equipmentControl.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650
  1. <!-- 数据看板-设备管控 -->
  2. <template>
  3. <view class="equipmentControl">
  4. <view class="statistics">
  5. <view class="statistics-b">
  6. <view class="statistics-b-li">
  7. <view class="statistics-b-li-t color-A">{{totalDeviceNum}}</view>
  8. <view class="statistics-b-li-b">设备总数</view>
  9. </view>
  10. <view class="line"></view>
  11. <view class="statistics-b-li">
  12. <view class="statistics-b-li-t color-B">{{newlyAddToday}}</view>
  13. <view class="statistics-b-li-b">今日新增设备</view>
  14. </view>
  15. <view class="line"></view>
  16. <view class="statistics-b-li">
  17. <view class="statistics-b-li-t color-C">{{overdueDeviceNum}}</view>
  18. <view class="statistics-b-li-b">超期服役设备</view>
  19. </view>
  20. </view>
  21. </view>
  22. <view class="small-title">
  23. <view class="small-title-l">超期服役排行TOP5</view>
  24. <img class="small-title-r" @click="goPage('overdue')" src="@/pages/images/icon_wdwg_gd.png">
  25. </view>
  26. <view class="chart">
  27. <view class="chart-b">
  28. <qiun-data-charts :canvas2d="true" type="bar" :opts="opts" :echartsH5="true" :chartData="chartData" />
  29. </view>
  30. </view>
  31. <view class="small-title">
  32. <view class="small-title-l">设备使用寿命</view>
  33. <img class="small-title-r" @click="goPage('life')" src="@/pages/images/icon_wdwg_gd.png">
  34. </view>
  35. <view class="chart-tow">
  36. <view class="chart-tow-b">
  37. <qiun-data-charts :canvas2d="true" type="funnel" :opts="optsTow" :echartsH5="true" :chartData="chartDataTow" />
  38. </view>
  39. </view>
  40. <view class="small-title">
  41. <view class="small-title-l">特种设备与常规冷热设备安全隐患统计</view>
  42. </view>
  43. <view class="chart-three">
  44. <view class="small-title-three">
  45. <view class="small-title-l"></view>
  46. <viwe class="chart-tab-tow">
  47. <view class="chart-tab-li" :class="chartTabIndexThree==index?'tab-A':'tab-B'"
  48. v-for="(item,index) in chartTabListThree" :key="index" @click="chartTabClickThree(index)">
  49. {{item}}
  50. </view>
  51. </viwe>
  52. </view>
  53. <view class="chart-three-b">
  54. <qiun-data-charts :canvas2d="true" type="pie" :opts="optsThree" :echartsH5="true" :chartData="chartDataThree" />
  55. </view>
  56. </view>
  57. <view class="chart-title">
  58. <view class="chart-title-l">安全检查指标</view>
  59. <view class="chart-title-r">占比</view>
  60. </view>
  61. <view class="list" v-for="(item,index) in dataList" :key="index">
  62. <view class="list-title">
  63. <view class="list-title-l">{{item.code}}{{item.name}}</view>
  64. <view class="list-title-r">{{item.rate}}%</view>
  65. </view>
  66. <view class="list-li" v-for="(item2,index2) in item.childList" :key="index2">{{item2.code}}{{item2.name}}
  67. </view>
  68. </view>
  69. </view>
  70. </template>
  71. <script>
  72. import {
  73. config
  74. } from '@/api/request/config.js'
  75. import {
  76. reportAppletReportApiDeviceStatGetDeviceStat,
  77. reportAppletReportBsEquipDangerCheckList,
  78. reportAppletReportBsEquipDangerList,
  79. reportAppletReportApiEquipOverdueList,
  80. reportAppletReportApiEquipLifeList,
  81. } from '@/pages/api/index.js'
  82. export default {
  83. name: "equipmentControl",
  84. components: {
  85. },
  86. data() {
  87. return {
  88. opts: {
  89. color: ["#1890FF", "#91CB74", "#FAC858", "#EE6666", "#73C0DE", "#3CA272", "#FC8452", "#9A60B4",
  90. "#ea7ccc"
  91. ],
  92. padding: [15, 30, 0, 5],
  93. enableScroll: false,
  94. legend: {
  95. show: false,
  96. },
  97. xAxis: {
  98. disabled: true,
  99. disableGrid: true,
  100. axisLine: false,
  101. fontColor: '#fff',
  102. },
  103. yAxis: {
  104. disabled: false,
  105. disableGrid: true,
  106. data: [{
  107. type: 'categories',
  108. fontColor: '#fff',
  109. }],
  110. },
  111. extra: {
  112. bar: {
  113. type: "group",
  114. width: 12,
  115. meterBorde: 1,
  116. meterFillColor: "#FFFFFF",
  117. activeBgColor: "#000000",
  118. activeBgOpacity: 0.08,
  119. linearType: "custom",
  120. barBorderCircle: true,
  121. seriesGap: 2,
  122. categoryGap: 2
  123. }
  124. }
  125. },
  126. chartData: {},
  127. optsTow: {
  128. color: ["#0183FA", "#38F0F0", "#2CCA73", "#FC6E21", "#FF4646", ],
  129. legend: {
  130. show: false,
  131. },
  132. padding: [15, 95, 10, 0],
  133. enableScroll: false,
  134. extra: {
  135. funnel: {
  136. type: 'triangle',
  137. border: false,
  138. labelAlign: "right",
  139. }
  140. }
  141. },
  142. chartDataTow: {},
  143. optsThree: {
  144. color: ["#10C139", "#FF8400", "#00FFE6", "#0183FA", "#73C0DE", "#3CA272", ],
  145. legend: {
  146. show: false,
  147. },
  148. padding: [5, 5, 5, 5],
  149. enableScroll: false,
  150. extra: {
  151. pie: {
  152. offsetAngle: 0,
  153. labelWidth: 15,
  154. border: true,
  155. borderWidth: 3,
  156. borderColor: "#3E414F",
  157. }
  158. }
  159. },
  160. chartDataThree: {},
  161. // 查询参数
  162. queryParams: {
  163. page: 1,
  164. pageSize: 10,
  165. },
  166. dataList: [],
  167. total: 0,
  168. newlyAddToday: 0,
  169. overdueDeviceNum: 0,
  170. totalDeviceNum: 0,
  171. statisticsType: 1, //1.年度2.季度3.月度
  172. chartTabListThree: ['年度', '季度', '月度'],
  173. chartTabIndexThree: 0,
  174. }
  175. },
  176. created() {
  177. },
  178. beforeMount() {
  179. },
  180. mounted() {
  181. this.reportAppletReportApiDeviceStatGetDeviceStat();
  182. this.reportAppletReportBsEquipDangerCheckList();
  183. this.reportAppletReportBsEquipDangerList();
  184. this.reportAppletReportApiEquipOverdueList();
  185. this.reportAppletReportApiEquipLifeList();
  186. //this.getServerData();
  187. //this.getServerDataTow();
  188. },
  189. methods: {
  190. //隐患统计
  191. async reportAppletReportBsEquipDangerList() {
  192. let self = this;
  193. const {
  194. data
  195. } = await reportAppletReportBsEquipDangerList({
  196. dangerType: '3',
  197. statisticsType: this.statisticsType
  198. });
  199. if (data.code == 200) {
  200. let list = [];
  201. data.data.subjectList.forEach(function(item, index) {
  202. if (index < 5) {
  203. list.push({
  204. "name": item.subjectName,
  205. "value": item.dangerNum,
  206. "textColor": "#fff",
  207. })
  208. }
  209. })
  210. let res = {
  211. series: [{
  212. data: list
  213. }]
  214. };
  215. this.chartDataThree = JSON.parse(JSON.stringify(res));
  216. }
  217. },
  218. //超期服役统计
  219. async reportAppletReportApiEquipOverdueList() {
  220. let self = this;
  221. const {
  222. data
  223. } = await reportAppletReportApiEquipOverdueList();
  224. if (data.code == 200) {
  225. let list = [];
  226. let list2 = [];
  227. data.data.forEach(function(item, index) {
  228. list.push(item.deptName)
  229. list2.push(item.deviceNum)
  230. })
  231. let res = {
  232. categories: list,
  233. series: [{
  234. name: "目标值",
  235. textColor: '#fff',
  236. data: list2
  237. }, ]
  238. };
  239. this.chartData = JSON.parse(JSON.stringify(res));
  240. }
  241. },
  242. //设备使用寿命统计
  243. async reportAppletReportApiEquipLifeList() {
  244. let self = this;
  245. const {
  246. data
  247. } = await reportAppletReportApiEquipLifeList();
  248. if (data.code == 200) {
  249. let list = [];
  250. data.data.forEach(function(item, index) {
  251. list.push({
  252. "name":item.lifeInterval,
  253. "value": item.deviceNum,
  254. "labelText":item.lifeInterval+' '+item.deviceNum+item.unit+' '+item.deviceRate+'%',
  255. "textColor": "#fff",
  256. })
  257. })
  258. let res = {
  259. series: [{
  260. data: list
  261. }]
  262. };
  263. this.chartDataTow = JSON.parse(JSON.stringify(res));
  264. }
  265. },
  266. async reportAppletReportApiDeviceStatGetDeviceStat() {
  267. let self = this;
  268. const {
  269. data
  270. } = await reportAppletReportApiDeviceStatGetDeviceStat();
  271. if (data.code == 200) {
  272. this.$set(self, 'newlyAddToday', data.data.newlyAddToday);
  273. this.$set(self, 'overdueDeviceNum', data.data.overdueDeviceNum);
  274. this.$set(self, 'totalDeviceNum', data.data.totalDeviceNum)
  275. }
  276. },
  277. //安全检查指标
  278. async reportAppletReportBsEquipDangerCheckList() {
  279. let self = this;
  280. const {
  281. data
  282. } = await reportAppletReportBsEquipDangerCheckList();
  283. if (data.code == 200) {
  284. this.$set(self, 'dataList', data.data);
  285. }
  286. },
  287. getServerData() {
  288. //模拟从服务器获取数据时的延时
  289. setTimeout(() => {
  290. //模拟服务器返回数据,如果数据格式和标准格式不同,需自行按下面的格式拼接
  291. let res = {
  292. categories: ["植物保护", "园林艺术", "生命科学", "理学院", "农学院"],
  293. series: [{
  294. name: "目标值",
  295. textColor: '#fff',
  296. data: [62, 37, 20, 41, 32]
  297. }, ]
  298. };
  299. this.chartData = JSON.parse(JSON.stringify(res));
  300. }, 500);
  301. },
  302. getServerDataTow() {
  303. //模拟从服务器获取数据时的延时
  304. setTimeout(() => {
  305. //模拟服务器返回数据,如果数据格式和标准格式不同,需自行按下面的格式拼接
  306. let res = {
  307. series: [{
  308. data: [{
  309. "name": "5年内",
  310. "value": 147,
  311. "labelText": "5年内 147台 26%",
  312. "textColor": "#fff",
  313. }, {
  314. "name": "10年内",
  315. "value": 136,
  316. "labelText": "10年内 136台 24%",
  317. "textColor": "#fff",
  318. }, {
  319. "name": "12年内",
  320. "value": 124,
  321. "labelText": "12年内 124台 22%",
  322. "textColor": "#fff",
  323. }, {
  324. "name": "20年内",
  325. "value": 96,
  326. "labelText": "20年内 96台 17%",
  327. "textColor": "#fff",
  328. }, {
  329. "name": "超期服役",
  330. "value": 67,
  331. "labelText": "超期服役 67台 11%",
  332. "textColor": "#fff",
  333. }]
  334. }]
  335. };
  336. this.chartDataTow = JSON.parse(JSON.stringify(res));
  337. }, 500);
  338. },
  339. dateClick(index) {
  340. this.dateIndex = index;
  341. },
  342. goPage(type) {
  343. if (type == 'overdue') {
  344. uni.navigateTo({
  345. url: '/pages/views/dataBoard/equipmentControlOverdue?pageType=1'
  346. });
  347. } else if (type == 'life') {
  348. uni.navigateTo({
  349. url: '/pages/views/dataBoard/equipmentControlOverdue?pageType=2'
  350. });
  351. }
  352. },
  353. chartTabClickThree(index) {
  354. this.chartTabIndexThree = index;
  355. this.statisticsType = index + 1;
  356. this.reportAppletReportBsEquipDangerList();
  357. },
  358. },
  359. }
  360. </script>
  361. <style lang="stylus" scoped>
  362. .equipmentControl {
  363. height: 100%;
  364. width: 100%;
  365. background: #363744;
  366. padding: 2rpx 0rpx 0;
  367. box-sizing: border-box;
  368. .statistics {
  369. width: 750rpx;
  370. height: 120rpx;
  371. background: #3E414F;
  372. .statistics-b {
  373. display: flex;
  374. justify-content: space-between;
  375. align-items: center;
  376. .statistics-b-li {
  377. flex: 1;
  378. text-align: center;
  379. .statistics-b-li-t {
  380. font-weight: 400;
  381. font-size: 36rpx;
  382. line-height: 50rpx;
  383. margin-top: 10rpx;
  384. }
  385. .statistics-b-li-b {
  386. font-weight: 400;
  387. font-size: 24rpx;
  388. color: #FFFFFF;
  389. line-height: 34rpx;
  390. margin-top: 9rpx;
  391. }
  392. }
  393. .line {
  394. width: 2rpx;
  395. height: 30rpx;
  396. background: #D8D8D8;
  397. }
  398. .color-A {
  399. color: #0183FA;
  400. }
  401. .color-B {
  402. color: #FF0000;
  403. }
  404. .color-C {
  405. color: #FFAA00;
  406. }
  407. }
  408. }
  409. .small-title {
  410. display: flex;
  411. justify-content: space-between;
  412. align-items: center;
  413. margin: 0 30rpx;
  414. .small-title-l {
  415. font-weight: 400;
  416. font-size: 32rpx;
  417. color: #FFFFFF;
  418. line-height: 45rpx;
  419. text-align: left;
  420. margin: 28rpx 0;
  421. }
  422. .small-title-r {
  423. width: 15rpx;
  424. height: 18rpx;
  425. }
  426. }
  427. .chart {
  428. width: 690rpx;
  429. height: 476rpx;
  430. background: #3E414F;
  431. border-radius: 20rpx 20rpx 20rpx 20rpx;
  432. margin: 0 30rpx;
  433. .chart-b {
  434. width: 690rpx;
  435. height: 476rpx;
  436. }
  437. }
  438. .chart-tow {
  439. width: 690rpx;
  440. height: 436rpx;
  441. background: #3E414F;
  442. border-radius: 20rpx 20rpx 20rpx 20rpx;
  443. margin: 0 30rpx;
  444. .chart-tow-b {
  445. width: 690rpx;
  446. height: 436rpx;
  447. }
  448. }
  449. .small-title-tow {
  450. width: 750rpx;
  451. height: 80rpx;
  452. background: #3E414F;
  453. display: flex;
  454. justify-content: space-between;
  455. align-items: center;
  456. padding: 0 20rpx 0 30rpx;
  457. box-sizing: border-box;
  458. margin-top: 2rpx;
  459. .small-title-tow-l {
  460. flex: 1;
  461. font-weight: 400;
  462. font-size: 30rpx;
  463. color: #FFFFFF;
  464. line-height: 42rpx;
  465. overflow: hidden;
  466. text-overflow: ellipsis;
  467. white-space: nowrap;
  468. }
  469. .small-title-tow-r {
  470. width: 14rpx;
  471. height: 8rpx;
  472. }
  473. }
  474. .small-title-three {
  475. height: 50rpx;
  476. display: flex;
  477. justify-content: space-between;
  478. align-items: center;
  479. margin: 24rpx 30rpx;
  480. .small-title-l {
  481. font-weight: 400;
  482. font-size: 32rpx;
  483. color: #FFFFFF;
  484. line-height: 45rpx;
  485. }
  486. .chart-tab-tow {
  487. width: 300rpx;
  488. height: 50rpx;
  489. border-radius: 25rpx;
  490. overflow: hidden;
  491. border: 1rpx solid #52545F;
  492. display: flex;
  493. justify-content: flex-start;
  494. .chart-tab-li {
  495. width: 100rpx;
  496. font-weight: 400;
  497. font-size: 28rpx;
  498. color: #999999;
  499. line-height: 50rpx;
  500. text-align: center;
  501. }
  502. .chart-tab-li:nth-of-type(1) {
  503. border-right: 1rpx solid #52545F;
  504. }
  505. .chart-tab-li:nth-of-type(2) {
  506. border-right: 1rpx solid #52545F;
  507. }
  508. .tab-A {
  509. color: #FFFFFF;
  510. background: #0183FA;
  511. }
  512. .tab-B {
  513. color: #999999;
  514. background: none;
  515. }
  516. }
  517. }
  518. .chart-three {
  519. width: 690rpx;
  520. height: 509rpx;
  521. background: #3E414F;
  522. border-radius: 20rpx 20rpx 0rpx 0rpx;
  523. margin: 34rpx 30rpx 0;
  524. overflow: hidden;
  525. .chart-three-b {
  526. width: 690rpx;
  527. height: 394rpx;
  528. }
  529. }
  530. .chart-title {
  531. width: 689rpx;
  532. height: 80rpx;
  533. background: rgba(162, 162, 162, 0.2);
  534. border-radius: 0rpx 0rpx 0rpx 0rpx;
  535. padding: 0 70rpx 0 38rpx;
  536. box-sizing: border-box;
  537. margin: 0 30rpx;
  538. display: flex;
  539. justify-content: space-between;
  540. .chart-title-l {
  541. font-weight: 400;
  542. font-size: 30rpx;
  543. color: #FFFFFF;
  544. line-height: 80rpx;
  545. }
  546. .chart-title-r {
  547. font-weight: 400;
  548. font-size: 30rpx;
  549. color: #FFFFFF;
  550. line-height: 80rpx;
  551. }
  552. }
  553. .list {
  554. margin: 0 30rpx;
  555. padding: 0 30rpx;
  556. box-sizing: border-box;
  557. .list-title {
  558. height: 80rpx;
  559. display: flex;
  560. justify-content: space-between;
  561. border-bottom: 1rpx dashed rgba(216, 216, 216, 0.2);
  562. padding: 0 38rpx 0 10rpx;
  563. box-sizing: border-box;
  564. .list-title-l {
  565. font-weight: 400;
  566. font-size: 28rpx;
  567. color: #FFFFFF;
  568. line-height: 80rpx;
  569. overflow: hidden;
  570. text-overflow: ellipsis;
  571. white-space: nowrap;
  572. }
  573. .list-title-r {
  574. font-weight: 400;
  575. font-size: 28rpx;
  576. color: #0183FA;
  577. line-height: 80rpx;
  578. }
  579. }
  580. .list-li {
  581. min-height: 80rpx;
  582. display: flex;
  583. justify-content: space-between;
  584. padding: 0 38rpx 0 10rpx;
  585. box-sizing: border-box;
  586. font-weight: 400;
  587. font-size: 28rpx;
  588. color: #999999;
  589. line-height: 40rpx;
  590. text-align: left;
  591. padding: 20rpx 0;
  592. box-sizing: border-box;
  593. }
  594. }
  595. }
  596. </style>