resourceReservation.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591
  1. <!-- 数据看板-资源预约 -->
  2. <template>
  3. <view class="resourceReservation">
  4. <view class="chart">
  5. <view class="chart-t">
  6. <viwe class="chart-t-l">
  7. <text>资源总数:</text>
  8. <text>{{totalNum}}</text>
  9. </viwe>
  10. <!-- <viwe class="chart-tab">
  11. <view class="chart-tab-li" :class="chartTabIndex==index?'tab-A':'tab-B'"
  12. v-for="(item,index) in chartTabList" :key="index" @click="chartTabClick(index)">{{item}}</view>
  13. </viwe> -->
  14. </view>
  15. <view class="chart-b">
  16. <view class="chart-b-li">
  17. <view class="chart-b-li-l">
  18. <qiun-data-charts :canvas2d="true" type="arcbar" :opts="opts0" :chartData="chartData0" />
  19. </view>
  20. <view class="chart-b-li-r">
  21. <view>总数: {{dataList[0].equNumber}}</view>
  22. <view><text></text>已使用 {{dataList[0].usedNumber}}</view>
  23. <view><text></text>未使用 {{dataList[0].noUseNumber}}</view>
  24. </view>
  25. </view>
  26. <view class="chart-b-li">
  27. <view class="chart-b-li-l">
  28. <qiun-data-charts :canvas2d="true" type="arcbar" :opts="opts1" :chartData="chartData1" />
  29. </view>
  30. <view class="chart-b-li-r">
  31. <view>总数: {{dataList[1].equNumber}}</view>
  32. <view><text></text>已使用 {{dataList[1].usedNumber}}</view>
  33. <view><text></text>未使用 {{dataList[1].noUseNumber}}</view>
  34. </view>
  35. </view>
  36. <view class="chart-b-li">
  37. <view class="chart-b-li-l">
  38. <qiun-data-charts :canvas2d="true" type="arcbar" :opts="opts2" :chartData="chartData2" />
  39. </view>
  40. <view class="chart-b-li-r">
  41. <view>总数: {{dataList[2].equNumber}}</view>
  42. <view><text></text>已使用 {{dataList[2].usedNumber}}</view>
  43. <view><text></text>未使用 {{dataList[2].noUseNumber}}</view>
  44. </view>
  45. </view>
  46. <view class="chart-b-li">
  47. <view class="chart-b-li-l">
  48. <qiun-data-charts :canvas2d="true" type="arcbar" :opts="opts3" :chartData="chartData3" />
  49. </view>
  50. <view class="chart-b-li-r">
  51. <view>总数: {{dataList[3].equNumber}}</view>
  52. <view><text></text>已使用 {{dataList[3].usedNumber}}</view>
  53. <view><text></text>未使用 {{dataList[3].noUseNumber}}</view>
  54. </view>
  55. </view>
  56. </view>
  57. </view>
  58. <view class="small-title">
  59. <view class="small-title-l">资源室隐患统计</view>
  60. <viwe class="chart-tab-tow">
  61. <view class="chart-tab-li" :class="chartTabIndexThree==index?'tab-A':'tab-B'"
  62. v-for="(item,index) in chartTabListThree" :key="index" @click="chartTabClickThree(index)">{{item}}
  63. </view>
  64. </viwe>
  65. </view>
  66. <view class="chart-tow">
  67. <view class="chart-tow-b">
  68. <qiun-data-charts :canvas2d="true" :tapLegend="false" :tooltipShow="false"
  69. type="bar" :opts="optsTow" :echartsH5="true" :chartData="chartDataThree" />
  70. </view>
  71. </view>
  72. </view>
  73. </template>
  74. <script>
  75. import {
  76. config
  77. } from '@/api/request/config.js'
  78. import {
  79. reportAppletReportApiResourceRateResourceList,
  80. reportAppletReportBsEquipDangerList
  81. } from '@/pages/api/index.js'
  82. export default {
  83. name: "resourceReservation",
  84. components: {
  85. },
  86. data() {
  87. return {
  88. opts0: {
  89. title: {
  90. name: "",
  91. fontSize: 12,
  92. color: "#fff"
  93. },
  94. subtitle: {
  95. name: "0%",
  96. fontSize: 10,
  97. color: "#FFCC00"
  98. },
  99. extra: {
  100. arcbar: {
  101. width: 6,
  102. direction:"ccw",
  103. startAngle: 1.5,
  104. endAngle: 1.51,
  105. gap: 2,
  106. backgroundColor: "#373745",
  107. // linearType:"custom",
  108. // customColor:["#FFCB00"],
  109. }
  110. }
  111. },
  112. opts1: {
  113. title: {
  114. name: "",
  115. fontSize: 12,
  116. color: "#fff"
  117. },
  118. subtitle: {
  119. name: "0%",
  120. fontSize: 10,
  121. color: "#04A44C"
  122. },
  123. extra: {
  124. arcbar: {
  125. width: 6,
  126. direction:"ccw",
  127. startAngle: 1.5,
  128. endAngle: 1.51,
  129. gap: 2,
  130. backgroundColor: "#373745",
  131. // linearType:"custom",
  132. // customColor:["#03F1CA"],
  133. }
  134. }
  135. },
  136. opts2: {
  137. title: {
  138. name: "",
  139. fontSize: 12,
  140. color: "#fff"
  141. },
  142. subtitle: {
  143. name: "0%",
  144. fontSize: 10,
  145. color: "#0283FA"
  146. },
  147. extra: {
  148. arcbar: {
  149. width: 6,
  150. direction:"ccw",
  151. startAngle: 1.5,
  152. endAngle: 1.51,
  153. gap: 2,
  154. backgroundColor: "#373745",
  155. // linearType:"custom",
  156. // customColor:["#01EBEE"],
  157. }
  158. }
  159. },
  160. opts3: {
  161. title: {
  162. name: "",
  163. fontSize: 12,
  164. color: "#fff"
  165. },
  166. subtitle: {
  167. name: "0%",
  168. fontSize: 10,
  169. color: "#0283FA"
  170. },
  171. extra: {
  172. arcbar: {
  173. width: 6,
  174. direction:"ccw",
  175. startAngle: 1.5,
  176. endAngle: 1.51,
  177. gap: 2,
  178. backgroundColor: "#373745",
  179. // linearType:"custom",
  180. // customColor:["#01EBEE"],
  181. }
  182. }
  183. },
  184. chartData0: {},
  185. chartData1: {},
  186. chartData2: {},
  187. chartData3: {},
  188. optsTow: {
  189. rotate: false,
  190. rotateLock: false,
  191. color: ["#1890FF", "#91CB74", "#FAC858", "#EE6666", "#73C0DE", "#3CA272", "#FC8452", "#9A60B4", "#ea7ccc"],
  192. padding: [15, 20, 15, 15],
  193. dataLabel: true,
  194. enableScroll: false,
  195. fontColor:'#ffffff',
  196. legend: {
  197. show:false,
  198. },
  199. xAxis: {
  200. boundaryGap: "justify",
  201. disableGrid: false,
  202. min: 0,
  203. axisLine: false,
  204. max: 40
  205. },
  206. yAxis: {},
  207. extra: {
  208. bar: {
  209. type: "group",
  210. width: 15,
  211. meterBorde: 1,
  212. meterFillColor: "#FFFFFF",
  213. activeBgColor: "#000000",
  214. activeBgOpacity: 0.08,
  215. linearType: "custom",
  216. barBorderCircle: true,
  217. seriesGap: 2,
  218. categoryGap: 2
  219. }
  220. }
  221. },
  222. chartDataTow: {},
  223. chartTabList: ['日', '月', '年'],
  224. chartTabIndex: 0,
  225. chartTabListTow: ['按资费', '按机时', '按样品'],
  226. chartTabIndexTow: 0,
  227. dataList: [],
  228. totalNum: 0,
  229. chartTabListThree: ['年度', '季度', '月度'],
  230. chartTabIndexThree: 0,
  231. chartDataThree:{},
  232. statisticsType:"1",
  233. }
  234. },
  235. created() {
  236. },
  237. beforeMount() {
  238. },
  239. mounted() {
  240. this.reportAppletReportApiResourceRateResourceList();
  241. this.reportAppletReportBsEquipDangerList()
  242. },
  243. methods: {
  244. async reportAppletReportApiResourceRateResourceList() {
  245. let self = this;
  246. const {
  247. data
  248. } = await reportAppletReportApiResourceRateResourceList({
  249. type: this.type
  250. });
  251. if (data.code == 200) {
  252. this.dataList = data.data;
  253. // let colorList = ['#FF5301', '#03A951', '#018EFA', '#018EFA']
  254. let colorList = ['#FF5301', '#03A951', '#018EFA', '#018EFA']
  255. data.data.forEach(function(item, index) {
  256. self.totalNum += item.equNumber;
  257. const optsName = `opts${index}`;
  258. self[optsName].title.name = item.equType
  259. self[optsName].subtitle.name = item.useRate + '%'
  260. let res = {
  261. series: [{
  262. name: item.equType,
  263. color: colorList[index],
  264. data: item.useRate/100,
  265. }]
  266. };
  267. const propertyName = `chartData${index}`;
  268. self[propertyName] = JSON.parse(JSON.stringify(res));
  269. })
  270. }
  271. },
  272. async reportAppletReportBsEquipDangerList() {
  273. let self = this;
  274. const {
  275. data
  276. } = await reportAppletReportBsEquipDangerList({
  277. dangerType: '4',
  278. statisticsType: this.statisticsType
  279. });
  280. if (data.code == 200) {
  281. let categories = [];
  282. let list = [];
  283. data.data.subjectList.forEach((item, index)=>{
  284. if (index < 5) {
  285. if (item.subjectName.length > 6) {
  286. item.subjectName = item.subjectName.slice(0, 6) + '...';
  287. }
  288. categories.push(item.subjectName)
  289. list.push(item.dangerNum)
  290. }
  291. })
  292. let res = {};
  293. if(categories[0]){
  294. res = {
  295. categories: categories,
  296. series: [{
  297. name: "",
  298. data: list
  299. }]
  300. };
  301. }else{
  302. res = {
  303. categories: ['无数据'],
  304. series: [{
  305. name: "",
  306. data: [0]
  307. }]
  308. };
  309. }
  310. console.log('res',res)
  311. self.$set(this,'chartDataThree',res);
  312. }
  313. },
  314. chartTabClickThree(index) {
  315. this.chartTabIndexThree = index;
  316. this.statisticsType = index + 1;
  317. this.reportAppletReportBsEquipDangerList();
  318. },
  319. chartTabClick(index) {
  320. this.chartTabIndex = index;
  321. },
  322. chartTabClickTow(index) {
  323. this.chartTabIndexTow = index;
  324. },
  325. },
  326. }
  327. </script>
  328. <style lang="stylus" scoped>
  329. .resourceReservation {
  330. height: 100%;
  331. width: 100%;
  332. background: #363744;
  333. padding: 20rpx 0rpx 0;
  334. box-sizing: border-box;
  335. .chart {
  336. width: 690rpx;
  337. height: 890rpx;
  338. background: #3E414F;
  339. border-radius: 20rpx 20rpx 20rpx 20rpx;
  340. overflow: hidden;
  341. margin: 0 30rpx;
  342. .chart-t {
  343. display: flex;
  344. justify-content: space-between;
  345. align-items: center;
  346. height: 50rpx;
  347. margin-top: 30rpx;
  348. padding: 0 24rpx 0 42rpx;
  349. box-sizing: border-box;
  350. .chart-t-l {
  351. >text {
  352. font-weight: 400;
  353. font-size: 30rpx;
  354. color: #FFFFFF;
  355. line-height: 42rpx;
  356. }
  357. >text:nth-of-type(1) {
  358. color: #FFFFFF;
  359. }
  360. >text:nth-of-type(2) {
  361. color: #0183FA;
  362. }
  363. }
  364. .chart-tab {
  365. width: 120rpx;
  366. height: 50rpx;
  367. border-radius: 10rpx;
  368. overflow: hidden;
  369. border: 1rpx solid #52545F;
  370. display: flex;
  371. justify-content: flex-start;
  372. .chart-tab-li {
  373. width: 60rpx;
  374. font-weight: 400;
  375. font-size: 28rpx;
  376. color: #999999;
  377. line-height: 50rpx;
  378. text-align: center;
  379. }
  380. .chart-tab-li:nth-of-type(1) {
  381. border-right: 1rpx solid #52545F;
  382. }
  383. .chart-tab-li:nth-of-type(2) {
  384. border-right: 1rpx solid #52545F;
  385. }
  386. .tab-A {
  387. color: #FFFFFF;
  388. background: #0183FA;
  389. }
  390. .tab-B {
  391. color: #999999;
  392. background: none;
  393. }
  394. }
  395. }
  396. .chart-b {
  397. display: flex;
  398. justify-content: space-between;
  399. flex-wrap: wrap;
  400. align-items: center;
  401. padding: 34rpx 74rpx 0;
  402. box-sizing: border-box;
  403. .chart-b-li {
  404. width: 270rpx;
  405. display: flex;
  406. flex-direction: column;
  407. align-items: center;
  408. margin-bottom: 34rpx;
  409. .chart-b-li-l {
  410. width: 180rpx;
  411. height: 180rpx;
  412. margin-right: 17rpx;
  413. }
  414. .chart-b-li-r {
  415. >view:nth-of-type(1) {
  416. font-size: 28rpx;
  417. color: #FFFFFF;
  418. line-height: 50rpx;
  419. text-align: left;
  420. }
  421. >view:nth-of-type(2) {
  422. display: flex;
  423. justify-content: flex-start;
  424. align-items: center;
  425. >text:nth-of-type(1) {
  426. width: 20rpx;
  427. height: 20rpx;
  428. background: #FF8C00;
  429. border-radius: 10rpx;
  430. margin-right: 12rpx;
  431. }
  432. font-size: 24rpx;
  433. color: #FFFFFF;
  434. line-height: 50rpx;
  435. text-align: left;
  436. }
  437. >view:nth-of-type(3) {
  438. display: flex;
  439. justify-content: flex-start;
  440. align-items: center;
  441. >text:nth-of-type(1) {
  442. width: 20rpx;
  443. height: 20rpx;
  444. background: #0183FA;
  445. border-radius: 10rpx;
  446. margin-right: 12rpx;
  447. }
  448. font-size: 24rpx;
  449. color: #FFFFFF;
  450. line-height: 50rpx;
  451. text-align: left;
  452. }
  453. }
  454. }
  455. }
  456. }
  457. .small-title {
  458. width: 690rpx;
  459. height: 50rpx;
  460. display: flex;
  461. justify-content: space-between;
  462. align-items: center;
  463. margin: 24rpx 30rpx;
  464. .small-title-l {
  465. font-weight: 400;
  466. font-size: 32rpx;
  467. color: #FFFFFF;
  468. line-height: 45rpx;
  469. }
  470. .chart-tab-tow {
  471. width: 300rpx;
  472. height: 50rpx;
  473. border-radius: 25rpx;
  474. overflow: hidden;
  475. border: 1rpx solid #52545F;
  476. display: flex;
  477. justify-content: flex-start;
  478. .chart-tab-li {
  479. width: 100rpx;
  480. font-weight: 400;
  481. font-size: 28rpx;
  482. color: #999999;
  483. line-height: 50rpx;
  484. text-align: center;
  485. }
  486. .chart-tab-li:nth-of-type(1) {
  487. border-right: 1rpx solid #52545F;
  488. }
  489. .chart-tab-li:nth-of-type(2) {
  490. border-right: 1rpx solid #52545F;
  491. }
  492. .tab-A {
  493. color: #FFFFFF;
  494. background: #0183FA;
  495. }
  496. .tab-B {
  497. color: #999999;
  498. background: none;
  499. }
  500. }
  501. }
  502. .small-title-tow {
  503. width: 750rpx;
  504. height: 80rpx;
  505. background: #3E414F;
  506. display: flex;
  507. justify-content: space-between;
  508. align-items: center;
  509. padding: 0 20rpx 0 30rpx;
  510. box-sizing: border-box;
  511. margin-top: 2rpx;
  512. .small-title-tow-l {
  513. flex: 1;
  514. font-weight: 400;
  515. font-size: 30rpx;
  516. color: #FFFFFF;
  517. line-height: 42rpx;
  518. overflow: hidden;
  519. text-overflow: ellipsis;
  520. white-space: nowrap;
  521. }
  522. .small-title-tow-r {
  523. width: 14rpx;
  524. height: 8rpx;
  525. }
  526. }
  527. .chart-tow {
  528. width: 690rpx;
  529. height: 480rpx;
  530. background: #3E414F;
  531. border-radius: 20rpx 20rpx 20rpx 30rpx;
  532. margin: 26rpx 30rpx 0;
  533. .chart-tow-b {
  534. width: 690rpx;
  535. height: 480rpx;
  536. }
  537. }
  538. }
  539. </style>