water-disaster.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  1. <template>
  2. <view class="page-body">
  3. <page-header :name="pageData.name" :bg="'#1560e0'" :showLeft="true" @goBack="goBack()"></page-header>
  4. <view class="scroll-wrap">
  5. <view class="basic-info-wrap">
  6. <view class="info-wrap">
  7. <view class="data-wrap">
  8. <view class="data-item-wrap" v-for="(item, index) in list">
  9. <view class="title">{{ item.name }}</view>
  10. <view class="data">{{ item.data }}</view>
  11. </view>
  12. </view>
  13. </view>
  14. <view class="radius-wrap"></view>
  15. </view>
  16. <view class="detail-info-wrap">
  17. <page-card style="margin-bottom: 30rpx;" :notShow="true" :name="'分站统计'">
  18. <template v-slot:content>
  19. <bar-chart :barType="'pie'" :data="pieChartData" :optSet="pieSet"
  20. :barHeight="'431rpx'"></bar-chart>
  21. <view class="icon-wrap">
  22. <view class="item" v-for="(item, index) in statusList">
  23. <view :style="{ backgroundColor: item.color }" class="icon"></view>
  24. <view class="title">{{ item.name }}</view>
  25. </view>
  26. </view>
  27. </template>
  28. </page-card>
  29. <page-card class="mix-chart-wrap" :notShow="true" :name="`${getCurrentTime()}隆雨星统计`">
  30. <template v-slot:content>
  31. <view class="type-wrap">
  32. <image @click="chartChange('line')" v-if="chartType === 'column'" src="@/static/line.png"/>
  33. <image v-if="chartType === 'line'" src="@/static/line-active.png"/>
  34. <image @click="chartChange('column')" v-if="chartType === 'line'" src="@/static/bar.png"/>
  35. <image v-if="chartType === 'column'" src="@/static/bar-active.png"/>
  36. </view>
  37. <bar-chart :barType="chartType" :data="chartData" :optSet="chartType === 'column' ? chartSet : chartSet1"
  38. :barHeight="'363rpx'"></bar-chart>
  39. </template>
  40. </page-card>
  41. </view>
  42. </view>
  43. </view>
  44. </template>
  45. <script>
  46. export default {
  47. data() {
  48. return {
  49. list: [{ // 列表
  50. name: '地面传感器',
  51. data: '9'
  52. }, {
  53. name: '压力水位传感器',
  54. data: '2'
  55. }, {
  56. name: '流量传感器',
  57. data: '23'
  58. }, {
  59. name: '自动雨量站',
  60. data: '1'
  61. }, {
  62. name: '地面断线传感器',
  63. data: '0'
  64. }, {
  65. name: '井下断线传感器',
  66. data: '0'
  67. }],
  68. pageData: {}, // 页头信息
  69. pieChartData: {}, // 饼状图数据
  70. statusList: [{ // 状态列表
  71. name: '(2016款)KJ402-F系列',
  72. color: '#1890FF'
  73. }, {
  74. name: 'XN水质分站',
  75. color: '#EE6666'
  76. }, {
  77. name: 'XN-流国统计分站',
  78. color: '#FAC858'
  79. }, {
  80. name: 'KJ402-FB-1',
  81. color: '#1890FF'
  82. }, {
  83. name: 'X飪肛H气氨站6要素',
  84. color: '#73C0DE'
  85. }],
  86. pieSet: { // 饼转图配置
  87. color: ["#1890FF", "#91CB74", "#FAC858", "#EE6666", "#73C0DE"],
  88. dataLabel: false,
  89. legend: {
  90. show: false
  91. },
  92. extra: {
  93. pie: {
  94. activeOpacity: 0.5,
  95. activeRadius: 10,
  96. offsetAngle: 0,
  97. labelWidth: 15,
  98. border: true,
  99. borderWidth: 3,
  100. borderColor: "#FFFFFF"
  101. }
  102. }
  103. },
  104. chartType: 'column', // 图表类型
  105. chartData: {}, // 柱图表数据
  106. chartSet: { // 柱状图配置
  107. color: ["#1890FF", "#91CB74"],
  108. legend: {
  109. show: false
  110. },
  111. xAxis: {
  112. disableGrid: true
  113. },
  114. extra: {
  115. column: {
  116. type: "group",
  117. width: 15,
  118. activeBgColor: "#000000",
  119. activeBgOpacity: 0.08
  120. }
  121. }
  122. },
  123. chartSet1: { // 折现线图配置
  124. color: ["#1890FF", "#91CB74"],
  125. legend: {
  126. show: false
  127. },
  128. yAxis: {
  129. gridType: "dash",
  130. dashLength: 2
  131. },
  132. extra: {
  133. line: {
  134. type: "straight",
  135. width: 2,
  136. activeType: "hollow"
  137. }
  138. }
  139. }
  140. }
  141. },
  142. onLoad(option) {
  143. this.pageData = JSON.parse(option.data)
  144. this.getPieData()
  145. this.getChartData()
  146. },
  147. methods: {
  148. goBack() { // 返回上一頁面
  149. uni.navigateBack()
  150. },
  151. getPieData() { // 获取饼图数据
  152. let res = {
  153. series: [{
  154. data: [{
  155. "value": 50
  156. }, {
  157. "value": 30
  158. }, {
  159. "value": 20
  160. }, {
  161. "value": 18
  162. }, {
  163. "value": 8
  164. }]
  165. }]
  166. };
  167. this.pieChartData = JSON.parse(JSON.stringify(res));
  168. },
  169. getChartData() { // 获取图表数据
  170. let res = {
  171. categories: ["2018", "2019", "2020", "2021", "2022", "2023"],
  172. series: [{
  173. name: "目标值",
  174. data: [35, 36, 31, 33, 13, 34]
  175. },
  176. {
  177. name: "完成量",
  178. data: [18, 27, 21, 24, 6, 28]
  179. }
  180. ]
  181. };
  182. this.chartData = JSON.parse(JSON.stringify(res));
  183. },
  184. getCurrentTime() { // 获取当前时间
  185. const now = new Date();
  186. const year = now.getFullYear();
  187. const month = String(now.getMonth() + 1).padStart(2, '0');
  188. return `${year}年${month}月`;
  189. },
  190. chartChange(data) { // 图标切换
  191. this.chartType = data
  192. }
  193. }
  194. }
  195. </script>
  196. <style scoped lang="scss">
  197. .page-body {
  198. .scroll-wrap {
  199. height: calc(100vh - 85rpx);
  200. overflow: scroll;
  201. .basic-info-wrap {
  202. position: relative;
  203. height: 390rpx;
  204. padding: 48rpx 90rpx;
  205. background: url(../../../../static/page_bg.png);
  206. background-size: 150%;
  207. .info-wrap {
  208. display: flex;
  209. flex-wrap: wrap;
  210. }
  211. .data-wrap {
  212. display: flex;
  213. flex-wrap: wrap;
  214. .data-item-wrap {
  215. width: 33.33%;
  216. padding: 9rpx 0;
  217. min-height: 81rpx;
  218. text-align: center;
  219. margin-top: 60rpx;
  220. .title {
  221. font-size: 22rpx;
  222. color: #FFFFFF;
  223. margin-bottom: 14rpx;
  224. }
  225. .data {
  226. font-weight: 700;
  227. font-size: 36rpx;
  228. color: #FFF600;
  229. }
  230. }
  231. .data-item-wrap:nth-child(-n+3) {
  232. margin-top: 0;
  233. }
  234. }
  235. .radius-wrap {
  236. position: absolute;
  237. left: 0;
  238. bottom: 0;
  239. width: 100vw;
  240. height: 30rpx;
  241. background-color: #fff;
  242. border-radius: 35rpx 35rpx 0 0;
  243. }
  244. }
  245. .detail-info-wrap {
  246. padding: 40rpx 35rpx;
  247. .icon-wrap {
  248. display: flex;
  249. flex-wrap: wrap;
  250. padding: 4rpx 40rpx 45rpx;
  251. .item {
  252. display: flex;
  253. width: calc(50% - 20rpx);
  254. margin-top: 36rpx;
  255. .icon {
  256. width: 32rpx;
  257. height: 32rpx;
  258. border-radius: 6rpx;
  259. margin-right: 8rpx;
  260. }
  261. .title {
  262. font-size: 24rpx;
  263. color: #000000;
  264. }
  265. }
  266. .item:nth-child(2n) {
  267. margin-left: 30rpx;
  268. }
  269. }
  270. .chart-wrap {
  271. padding: 30rpx 24rpx;
  272. }
  273. .mix-chart-wrap {
  274. .type-wrap {
  275. display: flex;
  276. justify-content: end;
  277. padding: 0 24rpx;
  278. image {
  279. width: 30rpx;
  280. height: 26rpx;
  281. }
  282. image:last-child {
  283. margin-left: 30rpx;
  284. }
  285. }
  286. .type-wrap {
  287. position: absolute;
  288. top: -54rpx;
  289. right: 0;
  290. }
  291. /deep/ .content-wrap {
  292. position: relative;
  293. }
  294. }
  295. /deep/ .card-wrap:last-child {
  296. margin-bottom: 0 !important;
  297. }
  298. }
  299. }
  300. }
  301. </style>