equipmentControl.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603
  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="imagesUrl('commonality/icon_wdwg_gd.png')">
  25. </view>
  26. <view class="chart">
  27. <view class="chart-b">
  28. <qiun-data-charts :tapLegend="false" :tooltipShow="false" :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="imagesUrl('commonality/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. },
  187. methods: {
  188. //隐患统计
  189. async reportAppletReportBsEquipDangerList() {
  190. let self = this;
  191. const {
  192. data
  193. } = await reportAppletReportBsEquipDangerList({
  194. dangerType: '1',
  195. statisticsType: this.statisticsType
  196. });
  197. if (data.code == 200) {
  198. let list = [];
  199. data.data.subjectList.forEach(function(item, index) {
  200. if (index < 5) {
  201. list.push({
  202. "name": item.subjectName,
  203. "value": item.dangerNum,
  204. "textColor": "#fff",
  205. })
  206. }
  207. })
  208. let res = {
  209. series: [{
  210. data: list
  211. }]
  212. };
  213. this.chartDataThree = JSON.parse(JSON.stringify(res));
  214. }
  215. },
  216. //超期服役统计
  217. async reportAppletReportApiEquipOverdueList() {
  218. let self = this;
  219. const {
  220. data
  221. } = await reportAppletReportApiEquipOverdueList();
  222. if (data.code == 200) {
  223. let list = [];
  224. let list2 = [];
  225. data.data.forEach(function(item, index) {
  226. if(index<5){
  227. let newName = item.deptName;
  228. if(newName.length > 6){
  229. newName = newName.slice(0, 6) + '..';
  230. }
  231. list.push(newName)
  232. // list.push(item.deptName)
  233. list2.push(item.deviceNum)
  234. }
  235. })
  236. let res = {
  237. categories: list,
  238. series: [{
  239. name: "目标值",
  240. textColor: '#fff',
  241. data: list2
  242. }, ]
  243. };
  244. this.chartData = JSON.parse(JSON.stringify(res));
  245. }
  246. },
  247. //设备使用寿命统计
  248. async reportAppletReportApiEquipLifeList() {
  249. let self = this;
  250. const {
  251. data
  252. } = await reportAppletReportApiEquipLifeList();
  253. if (data.code == 200) {
  254. let list = [];
  255. data.data.forEach(function(item, index) {
  256. list.push({
  257. "name":item.lifeInterval,
  258. "value": item.deviceNum,
  259. "labelText":item.lifeInterval+' '+item.deviceNum+item.unit+' '+item.deviceRate+'%',
  260. "textColor": "#fff",
  261. })
  262. })
  263. let res = {
  264. series: [{
  265. data: list
  266. }]
  267. };
  268. this.chartDataTow = JSON.parse(JSON.stringify(res));
  269. }
  270. },
  271. async reportAppletReportApiDeviceStatGetDeviceStat() {
  272. let self = this;
  273. const {
  274. data
  275. } = await reportAppletReportApiDeviceStatGetDeviceStat();
  276. if (data.code == 200) {
  277. this.$set(self, 'newlyAddToday', data.data.newlyAddToday);
  278. this.$set(self, 'overdueDeviceNum', data.data.overdueDeviceNum);
  279. this.$set(self, 'totalDeviceNum', data.data.totalDeviceNum)
  280. }
  281. },
  282. //安全检查指标
  283. async reportAppletReportBsEquipDangerCheckList() {
  284. let self = this;
  285. const {
  286. data
  287. } = await reportAppletReportBsEquipDangerCheckList();
  288. if (data.code == 200) {
  289. this.$set(self, 'dataList', data.data);
  290. }
  291. },
  292. dateClick(index) {
  293. this.dateIndex = index;
  294. },
  295. goPage(type) {
  296. if (type == 'overdue') {
  297. uni.navigateTo({
  298. url: '/pages/views/dataBoard/equipmentControlOverdue?pageType=1'
  299. });
  300. } else if (type == 'life') {
  301. uni.navigateTo({
  302. url: '/pages/views/dataBoard/equipmentControlOverdue?pageType=2'
  303. });
  304. }
  305. },
  306. chartTabClickThree(index) {
  307. this.chartTabIndexThree = index;
  308. this.statisticsType = index + 1;
  309. this.reportAppletReportBsEquipDangerList();
  310. },
  311. },
  312. }
  313. </script>
  314. <style lang="stylus" scoped>
  315. .equipmentControl {
  316. height: 100%;
  317. width: 100%;
  318. background: #363744;
  319. padding: 2rpx 0rpx 0;
  320. box-sizing: border-box;
  321. .statistics {
  322. width: 750rpx;
  323. height: 120rpx;
  324. background: #3E414F;
  325. .statistics-b {
  326. display: flex;
  327. justify-content: space-between;
  328. align-items: center;
  329. .statistics-b-li {
  330. flex: 1;
  331. text-align: center;
  332. .statistics-b-li-t {
  333. font-weight: 400;
  334. font-size: 36rpx;
  335. line-height: 50rpx;
  336. margin-top: 10rpx;
  337. }
  338. .statistics-b-li-b {
  339. font-weight: 400;
  340. font-size: 24rpx;
  341. color: #FFFFFF;
  342. line-height: 34rpx;
  343. margin-top: 9rpx;
  344. }
  345. }
  346. .line {
  347. width: 2rpx;
  348. height: 30rpx;
  349. background: #D8D8D8;
  350. }
  351. .color-A {
  352. color: #0183FA;
  353. }
  354. .color-B {
  355. color: #FF0000;
  356. }
  357. .color-C {
  358. color: #FFAA00;
  359. }
  360. }
  361. }
  362. .small-title {
  363. display: flex;
  364. justify-content: space-between;
  365. align-items: center;
  366. margin: 0 30rpx;
  367. .small-title-l {
  368. font-weight: 400;
  369. font-size: 32rpx;
  370. color: #FFFFFF;
  371. line-height: 45rpx;
  372. text-align: left;
  373. margin: 28rpx 0;
  374. }
  375. .small-title-r {
  376. width: 15rpx;
  377. height: 18rpx;
  378. }
  379. }
  380. .chart {
  381. width: 690rpx;
  382. height: 476rpx;
  383. background: #3E414F;
  384. border-radius: 20rpx 20rpx 20rpx 20rpx;
  385. margin: 0 30rpx;
  386. .chart-b {
  387. width: 690rpx;
  388. height: 476rpx;
  389. }
  390. }
  391. .chart-tow {
  392. width: 690rpx;
  393. height: 436rpx;
  394. background: #3E414F;
  395. border-radius: 20rpx 20rpx 20rpx 20rpx;
  396. margin: 0 30rpx;
  397. .chart-tow-b {
  398. width: 690rpx;
  399. height: 436rpx;
  400. }
  401. }
  402. .small-title-tow {
  403. width: 750rpx;
  404. height: 80rpx;
  405. background: #3E414F;
  406. display: flex;
  407. justify-content: space-between;
  408. align-items: center;
  409. padding: 0 20rpx 0 30rpx;
  410. box-sizing: border-box;
  411. margin-top: 2rpx;
  412. .small-title-tow-l {
  413. flex: 1;
  414. font-weight: 400;
  415. font-size: 30rpx;
  416. color: #FFFFFF;
  417. line-height: 42rpx;
  418. overflow: hidden;
  419. text-overflow: ellipsis;
  420. white-space: nowrap;
  421. }
  422. .small-title-tow-r {
  423. width: 14rpx;
  424. height: 8rpx;
  425. }
  426. }
  427. .small-title-three {
  428. height: 50rpx;
  429. display: flex;
  430. justify-content: space-between;
  431. align-items: center;
  432. margin: 24rpx 30rpx;
  433. .small-title-l {
  434. font-weight: 400;
  435. font-size: 32rpx;
  436. color: #FFFFFF;
  437. line-height: 45rpx;
  438. }
  439. .chart-tab-tow {
  440. width: 300rpx;
  441. height: 50rpx;
  442. border-radius: 25rpx;
  443. overflow: hidden;
  444. border: 1rpx solid #52545F;
  445. display: flex;
  446. justify-content: flex-start;
  447. .chart-tab-li {
  448. width: 100rpx;
  449. font-weight: 400;
  450. font-size: 28rpx;
  451. color: #999999;
  452. line-height: 50rpx;
  453. text-align: center;
  454. }
  455. .chart-tab-li:nth-of-type(1) {
  456. border-right: 1rpx solid #52545F;
  457. }
  458. .chart-tab-li:nth-of-type(2) {
  459. border-right: 1rpx solid #52545F;
  460. }
  461. .tab-A {
  462. color: #FFFFFF;
  463. background: #0183FA;
  464. }
  465. .tab-B {
  466. color: #999999;
  467. background: none;
  468. }
  469. }
  470. }
  471. .chart-three {
  472. width: 690rpx;
  473. height: 509rpx;
  474. background: #3E414F;
  475. border-radius: 20rpx 20rpx 0rpx 0rpx;
  476. margin: 34rpx 30rpx 0;
  477. overflow: hidden;
  478. .chart-three-b {
  479. width: 690rpx;
  480. height: 394rpx;
  481. }
  482. }
  483. .chart-title {
  484. width: 689rpx;
  485. height: 80rpx;
  486. background: rgba(162, 162, 162, 0.2);
  487. border-radius: 0rpx 0rpx 0rpx 0rpx;
  488. padding: 0 70rpx 0 38rpx;
  489. box-sizing: border-box;
  490. margin: 0 30rpx;
  491. display: flex;
  492. justify-content: space-between;
  493. .chart-title-l {
  494. font-weight: 400;
  495. font-size: 30rpx;
  496. color: #FFFFFF;
  497. line-height: 80rpx;
  498. }
  499. .chart-title-r {
  500. font-weight: 400;
  501. font-size: 30rpx;
  502. color: #FFFFFF;
  503. line-height: 80rpx;
  504. }
  505. }
  506. .list {
  507. margin: 0 30rpx;
  508. padding: 0 30rpx;
  509. box-sizing: border-box;
  510. .list-title {
  511. height: 80rpx;
  512. display: flex;
  513. justify-content: space-between;
  514. border-bottom: 1rpx dashed rgba(216, 216, 216, 0.2);
  515. padding: 0 38rpx 0 10rpx;
  516. box-sizing: border-box;
  517. .list-title-l {
  518. font-weight: 400;
  519. font-size: 28rpx;
  520. color: #FFFFFF;
  521. line-height: 80rpx;
  522. overflow: hidden;
  523. text-overflow: ellipsis;
  524. white-space: nowrap;
  525. }
  526. .list-title-r {
  527. font-weight: 400;
  528. font-size: 28rpx;
  529. color: #0183FA;
  530. line-height: 80rpx;
  531. }
  532. }
  533. .list-li {
  534. min-height: 80rpx;
  535. display: flex;
  536. justify-content: space-between;
  537. padding: 0 38rpx 0 10rpx;
  538. box-sizing: border-box;
  539. font-weight: 400;
  540. font-size: 28rpx;
  541. color: #999999;
  542. line-height: 40rpx;
  543. text-align: left;
  544. padding: 20rpx 0;
  545. box-sizing: border-box;
  546. }
  547. }
  548. }
  549. </style>