resourceReservation.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555
  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 type="arcbar" :opts="opts0" :canvas2d="true" :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 type="arcbar" :opts="opts1" :canvas2d="true" :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 type="arcbar" :opts="opts2" :canvas2d="true" :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 type="arcbar" :opts="opts3" :canvas2d="true" :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 type="radar" :opts="optsTow" :echartsH5="true" :canvas2d="true" :chartData="chartDataThree" />
  69. </view>
  70. </view>
  71. </view>
  72. </template>
  73. <script>
  74. import {
  75. config
  76. } from '@/api/request/config.js'
  77. import {
  78. reportAppletReportApiResourceRateResourceList,
  79. reportAppletReportBsEquipDangerList
  80. } from '@/pages/api/index.js'
  81. export default {
  82. name: "resourceReservation",
  83. components: {
  84. },
  85. data() {
  86. return {
  87. opts0: {
  88. title: {
  89. name: "",
  90. fontSize: 12,
  91. color: "#fff"
  92. },
  93. subtitle: {
  94. name: "0%",
  95. fontSize: 10,
  96. color: "#FFCC00"
  97. },
  98. extra: {
  99. arcbar: {
  100. width: 6,
  101. backgroundColor: "#FF5201",
  102. startAngle: 0,
  103. endAngle: 1.5,
  104. gap: 2,
  105. }
  106. }
  107. },
  108. opts1: {
  109. title: {
  110. name: "",
  111. fontSize: 12,
  112. color: "#fff"
  113. },
  114. subtitle: {
  115. name: "0%",
  116. fontSize: 10,
  117. color: "#04A44C"
  118. },
  119. extra: {
  120. arcbar: {
  121. width: 6,
  122. backgroundColor: "#04A44C",
  123. startAngle: 0,
  124. endAngle: 1.5,
  125. gap: 2,
  126. }
  127. }
  128. },
  129. opts2: {
  130. title: {
  131. name: "",
  132. fontSize: 12,
  133. color: "#fff"
  134. },
  135. subtitle: {
  136. name: "0%",
  137. fontSize: 10,
  138. color: "#0283FA"
  139. },
  140. extra: {
  141. arcbar: {
  142. width: 6,
  143. backgroundColor: "#0283FA",
  144. startAngle: 0,
  145. endAngle: 1.5,
  146. gap: 2,
  147. }
  148. }
  149. },
  150. opts3: {
  151. title: {
  152. name: "",
  153. fontSize: 12,
  154. color: "#fff"
  155. },
  156. subtitle: {
  157. name: "0%",
  158. fontSize: 10,
  159. color: "#0283FA"
  160. },
  161. extra: {
  162. arcbar: {
  163. width: 6,
  164. backgroundColor: "#0283FA",
  165. startAngle: 0,
  166. endAngle: 1.5,
  167. gap: 2,
  168. }
  169. }
  170. },
  171. chartData0: {},
  172. chartData1: {},
  173. chartData2: {},
  174. chartData3: {},
  175. optsTow: {
  176. color: ["#1890FF", "#91CB74", "#FAC858", "#EE6666", "#73C0DE", "#3CA272", "#FC8452", "#9A60B4",
  177. "#ea7ccc"
  178. ],
  179. padding: [5, 5, 5, 5],
  180. dataLabel: false,
  181. enableScroll: false,
  182. legend: {
  183. show: false,
  184. position: "right",
  185. lineHeight: 25
  186. },
  187. extra: {
  188. radar: {
  189. gridType: "radar",
  190. gridColor: "#CCCCCC",
  191. gridCount: 3,
  192. opacity: 0.2,
  193. max: 200,
  194. labelShow: true,
  195. border: true,
  196. labelColor: '#fff',
  197. }
  198. }
  199. },
  200. chartDataTow: {},
  201. chartTabList: ['日', '月', '年'],
  202. chartTabIndex: 0,
  203. chartTabListTow: ['按资费', '按机时', '按样品'],
  204. chartTabIndexTow: 0,
  205. dataList: [],
  206. totalNum: 0,
  207. chartTabListThree: ['年度', '季度', '月度'],
  208. chartTabIndexThree: 0,
  209. }
  210. },
  211. created() {
  212. },
  213. beforeMount() {
  214. },
  215. mounted() {
  216. this.reportAppletReportApiResourceRateResourceList();
  217. this.reportAppletReportBsEquipDangerList()
  218. },
  219. methods: {
  220. async reportAppletReportApiResourceRateResourceList() {
  221. let self = this;
  222. const {
  223. data
  224. } = await reportAppletReportApiResourceRateResourceList({
  225. type: this.type
  226. });
  227. if (data.code == 200) {
  228. this.dataList = data.data;
  229. let colorList = ['#FFCC00', '#00FFDD', '#00FFEE', '#00FFEE']
  230. data.data.forEach(function(item, index) {
  231. self.totalNum += item.equNumber;
  232. const optsName = `opts${index}`;
  233. self[optsName].title.name = item.equType
  234. self[optsName].subtitle.name = item.useRate + '%'
  235. let res = {
  236. series: [{
  237. name: item.equType,
  238. color: colorList[index],
  239. data: item.useRate/100,
  240. }]
  241. };
  242. const propertyName = `chartData${index}`;
  243. self[propertyName] = JSON.parse(JSON.stringify(res));
  244. })
  245. }
  246. },
  247. async reportAppletReportBsEquipDangerList() {
  248. let self = this;
  249. const {
  250. data
  251. } = await reportAppletReportBsEquipDangerList({
  252. dangerType: '4',
  253. statisticsType: this.statisticsType
  254. });
  255. if (data.code == 200) {
  256. let list = [];
  257. let list2 = [];
  258. data.data.subjectList.forEach(function(item, index) {
  259. if (index < 5) {
  260. list.push(item.subjectName)
  261. list2.push(item.dangerNum)
  262. }
  263. })
  264. let res = {
  265. categories: list,
  266. series: [{
  267. name: "",
  268. data: list2
  269. }, ]
  270. };
  271. this.chartDataThree = JSON.parse(JSON.stringify(res));
  272. }
  273. },
  274. chartTabClickThree(index) {
  275. this.chartTabIndexThree = index;
  276. this.statisticsType = index + 1;
  277. this.reportAppletReportBsEquipDangerList();
  278. },
  279. chartTabClick(index) {
  280. this.chartTabIndex = index;
  281. },
  282. chartTabClickTow(index) {
  283. this.chartTabIndexTow = index;
  284. },
  285. },
  286. }
  287. </script>
  288. <style lang="stylus" scoped>
  289. .resourceReservation {
  290. height: 100%;
  291. width: 100%;
  292. background: #363744;
  293. padding: 20rpx 0rpx 0;
  294. box-sizing: border-box;
  295. .chart {
  296. width: 690rpx;
  297. height: 890rpx;
  298. background: #3E414F;
  299. border-radius: 20rpx 20rpx 20rpx 20rpx;
  300. overflow: hidden;
  301. margin: 0 30rpx;
  302. .chart-t {
  303. display: flex;
  304. justify-content: space-between;
  305. align-items: center;
  306. height: 50rpx;
  307. margin-top: 30rpx;
  308. padding: 0 24rpx 0 42rpx;
  309. box-sizing: border-box;
  310. .chart-t-l {
  311. >text {
  312. font-weight: 400;
  313. font-size: 30rpx;
  314. color: #FFFFFF;
  315. line-height: 42rpx;
  316. }
  317. >text:nth-of-type(1) {
  318. color: #FFFFFF;
  319. }
  320. >text:nth-of-type(2) {
  321. color: #0183FA;
  322. }
  323. }
  324. .chart-tab {
  325. width: 120rpx;
  326. height: 50rpx;
  327. border-radius: 10rpx;
  328. overflow: hidden;
  329. border: 1rpx solid #52545F;
  330. display: flex;
  331. justify-content: flex-start;
  332. .chart-tab-li {
  333. width: 60rpx;
  334. font-weight: 400;
  335. font-size: 28rpx;
  336. color: #999999;
  337. line-height: 50rpx;
  338. text-align: center;
  339. }
  340. .chart-tab-li:nth-of-type(1) {
  341. border-right: 1rpx solid #52545F;
  342. }
  343. .chart-tab-li:nth-of-type(2) {
  344. border-right: 1rpx solid #52545F;
  345. }
  346. .tab-A {
  347. color: #FFFFFF;
  348. background: #0183FA;
  349. }
  350. .tab-B {
  351. color: #999999;
  352. background: none;
  353. }
  354. }
  355. }
  356. .chart-b {
  357. display: flex;
  358. justify-content: space-between;
  359. flex-wrap: wrap;
  360. align-items: center;
  361. padding: 34rpx 74rpx 0;
  362. box-sizing: border-box;
  363. .chart-b-li {
  364. width: 270rpx;
  365. display: flex;
  366. flex-direction: column;
  367. align-items: center;
  368. margin-bottom: 34rpx;
  369. .chart-b-li-l {
  370. width: 180rpx;
  371. height: 180rpx;
  372. margin-right: 17rpx;
  373. }
  374. .chart-b-li-r {
  375. >view:nth-of-type(1) {
  376. font-size: 28rpx;
  377. color: #FFFFFF;
  378. line-height: 50rpx;
  379. text-align: left;
  380. }
  381. >view:nth-of-type(2) {
  382. display: flex;
  383. justify-content: flex-start;
  384. align-items: center;
  385. >text:nth-of-type(1) {
  386. width: 20rpx;
  387. height: 20rpx;
  388. background: #FF8C00;
  389. border-radius: 10rpx;
  390. margin-right: 12rpx;
  391. }
  392. font-size: 24rpx;
  393. color: #FFFFFF;
  394. line-height: 50rpx;
  395. text-align: left;
  396. }
  397. >view:nth-of-type(3) {
  398. display: flex;
  399. justify-content: flex-start;
  400. align-items: center;
  401. >text:nth-of-type(1) {
  402. width: 20rpx;
  403. height: 20rpx;
  404. background: #0183FA;
  405. border-radius: 10rpx;
  406. margin-right: 12rpx;
  407. }
  408. font-size: 24rpx;
  409. color: #FFFFFF;
  410. line-height: 50rpx;
  411. text-align: left;
  412. }
  413. }
  414. }
  415. }
  416. }
  417. .small-title {
  418. width: 690rpx;
  419. height: 50rpx;
  420. display: flex;
  421. justify-content: space-between;
  422. align-items: center;
  423. margin: 24rpx 30rpx;
  424. .small-title-l {
  425. font-weight: 400;
  426. font-size: 32rpx;
  427. color: #FFFFFF;
  428. line-height: 45rpx;
  429. }
  430. .chart-tab-tow {
  431. width: 300rpx;
  432. height: 50rpx;
  433. border-radius: 25rpx;
  434. overflow: hidden;
  435. border: 1rpx solid #52545F;
  436. display: flex;
  437. justify-content: flex-start;
  438. .chart-tab-li {
  439. width: 100rpx;
  440. font-weight: 400;
  441. font-size: 28rpx;
  442. color: #999999;
  443. line-height: 50rpx;
  444. text-align: center;
  445. }
  446. .chart-tab-li:nth-of-type(1) {
  447. border-right: 1rpx solid #52545F;
  448. }
  449. .chart-tab-li:nth-of-type(2) {
  450. border-right: 1rpx solid #52545F;
  451. }
  452. .tab-A {
  453. color: #FFFFFF;
  454. background: #0183FA;
  455. }
  456. .tab-B {
  457. color: #999999;
  458. background: none;
  459. }
  460. }
  461. }
  462. .small-title-tow {
  463. width: 750rpx;
  464. height: 80rpx;
  465. background: #3E414F;
  466. display: flex;
  467. justify-content: space-between;
  468. align-items: center;
  469. padding: 0 20rpx 0 30rpx;
  470. box-sizing: border-box;
  471. margin-top: 2rpx;
  472. .small-title-tow-l {
  473. flex: 1;
  474. font-weight: 400;
  475. font-size: 30rpx;
  476. color: #FFFFFF;
  477. line-height: 42rpx;
  478. overflow: hidden;
  479. text-overflow: ellipsis;
  480. white-space: nowrap;
  481. }
  482. .small-title-tow-r {
  483. width: 14rpx;
  484. height: 8rpx;
  485. }
  486. }
  487. .chart-tow {
  488. width: 690rpx;
  489. height: 480rpx;
  490. background: #3E414F;
  491. border-radius: 20rpx 20rpx 20rpx 30rpx;
  492. margin: 26rpx 30rpx 0;
  493. .chart-tow-b {
  494. width: 690rpx;
  495. height: 480rpx;
  496. }
  497. }
  498. }
  499. </style>