equipmentControl.vue 13 KB

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