resourceReservation.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587
  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. reportAppletReportApiResourceRateAnalysisList
  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, 40, 15, 15],
  193. dataLabel: true,
  194. enableScroll: false,
  195. fontColor:'#ffffff',
  196. legend: {
  197. show:false,
  198. },
  199. xAxis: {
  200. disabled: true,
  201. disableGrid: true,
  202. axisLine: false,
  203. fontColor: '#fff',
  204. },
  205. yAxis: {},
  206. extra: {
  207. bar: {
  208. type: "group",
  209. width: 15,
  210. meterBorde: 1,
  211. meterFillColor: "#FFFFFF",
  212. activeBgColor: "#000000",
  213. activeBgOpacity: 0.08,
  214. linearType: "custom",
  215. barBorderCircle: true,
  216. seriesGap: 2,
  217. categoryGap: 2
  218. }
  219. }
  220. },
  221. chartDataTow: {},
  222. chartTabList: ['日', '月', '年'],
  223. chartTabIndex: 0,
  224. chartTabListTow: ['按资费', '按机时', '按样品'],
  225. chartTabIndexTow: 0,
  226. dataList: [],
  227. totalNum: 0,
  228. chartTabListThree: ['年度', '季度', '月度'],
  229. chartTabIndexThree: 0,
  230. chartDataThree:{},
  231. statisticsType:"1",
  232. }
  233. },
  234. created() {
  235. },
  236. beforeMount() {
  237. },
  238. mounted() {
  239. this.reportAppletReportApiResourceRateResourceList();
  240. this.reportAppletReportApiResourceRateAnalysisList()
  241. },
  242. methods: {
  243. async reportAppletReportApiResourceRateResourceList() {
  244. let self = this;
  245. const {
  246. data
  247. } = await reportAppletReportApiResourceRateResourceList({
  248. type: this.type
  249. });
  250. if (data.code == 200) {
  251. this.dataList = data.data;
  252. // let colorList = ['#FF5301', '#03A951', '#018EFA', '#018EFA']
  253. let colorList = ['#FF5301', '#03A951', '#018EFA', '#018EFA']
  254. data.data.forEach(function(item, index) {
  255. self.totalNum += item.equNumber;
  256. const optsName = `opts${index}`;
  257. self[optsName].title.name = item.equType
  258. self[optsName].subtitle.name = item.useRate + '%'
  259. let res = {
  260. series: [{
  261. name: item.equType,
  262. color: colorList[index],
  263. data: item.useRate/100,
  264. }]
  265. };
  266. const propertyName = `chartData${index}`;
  267. self[propertyName] = JSON.parse(JSON.stringify(res));
  268. })
  269. }
  270. },
  271. async reportAppletReportApiResourceRateAnalysisList() {
  272. let self = this;
  273. const {
  274. data
  275. } = await reportAppletReportApiResourceRateAnalysisList({});
  276. if (data.code == 200) {
  277. let categories = [];
  278. let list = [];
  279. data.data.forEach((item, index)=>{
  280. if (index < 5) {
  281. if (item.equType.length > 6) {
  282. item.equType = item.equType.slice(0, 6) + '...';
  283. }
  284. categories.push(item.equType)
  285. list.push(item.equNumber)
  286. }
  287. })
  288. let res = {};
  289. if(categories[0]){
  290. res = {
  291. categories: categories,
  292. series: [{
  293. name: "",
  294. data: list
  295. }]
  296. };
  297. }else{
  298. res = {
  299. categories: ['无数据'],
  300. series: [{
  301. name: "",
  302. data: [0]
  303. }]
  304. };
  305. }
  306. console.log('res',res)
  307. self.$set(this,'chartDataThree',res);
  308. }
  309. },
  310. chartTabClickThree(index) {
  311. this.chartTabIndexThree = index;
  312. this.statisticsType = index + 1;
  313. this.reportAppletReportApiResourceRateAnalysisList();
  314. },
  315. chartTabClick(index) {
  316. this.chartTabIndex = index;
  317. },
  318. chartTabClickTow(index) {
  319. this.chartTabIndexTow = index;
  320. },
  321. },
  322. }
  323. </script>
  324. <style lang="stylus" scoped>
  325. .resourceReservation {
  326. height: 100%;
  327. width: 100%;
  328. background: #363744;
  329. padding: 20rpx 0rpx 0;
  330. box-sizing: border-box;
  331. .chart {
  332. width: 690rpx;
  333. height: 890rpx;
  334. background: #3E414F;
  335. border-radius: 20rpx 20rpx 20rpx 20rpx;
  336. overflow: hidden;
  337. margin: 0 30rpx;
  338. .chart-t {
  339. display: flex;
  340. justify-content: space-between;
  341. align-items: center;
  342. height: 50rpx;
  343. margin-top: 30rpx;
  344. padding: 0 24rpx 0 42rpx;
  345. box-sizing: border-box;
  346. .chart-t-l {
  347. >text {
  348. font-weight: 400;
  349. font-size: 30rpx;
  350. color: #FFFFFF;
  351. line-height: 42rpx;
  352. }
  353. >text:nth-of-type(1) {
  354. color: #FFFFFF;
  355. }
  356. >text:nth-of-type(2) {
  357. color: #0183FA;
  358. }
  359. }
  360. .chart-tab {
  361. width: 120rpx;
  362. height: 50rpx;
  363. border-radius: 10rpx;
  364. overflow: hidden;
  365. border: 1rpx solid #52545F;
  366. display: flex;
  367. justify-content: flex-start;
  368. .chart-tab-li {
  369. width: 60rpx;
  370. font-weight: 400;
  371. font-size: 28rpx;
  372. color: #999999;
  373. line-height: 50rpx;
  374. text-align: center;
  375. }
  376. .chart-tab-li:nth-of-type(1) {
  377. border-right: 1rpx solid #52545F;
  378. }
  379. .chart-tab-li:nth-of-type(2) {
  380. border-right: 1rpx solid #52545F;
  381. }
  382. .tab-A {
  383. color: #FFFFFF;
  384. background: #0183FA;
  385. }
  386. .tab-B {
  387. color: #999999;
  388. background: none;
  389. }
  390. }
  391. }
  392. .chart-b {
  393. display: flex;
  394. justify-content: space-between;
  395. flex-wrap: wrap;
  396. align-items: center;
  397. padding: 34rpx 74rpx 0;
  398. box-sizing: border-box;
  399. .chart-b-li {
  400. width: 270rpx;
  401. display: flex;
  402. flex-direction: column;
  403. align-items: center;
  404. margin-bottom: 34rpx;
  405. .chart-b-li-l {
  406. width: 180rpx;
  407. height: 180rpx;
  408. margin-right: 17rpx;
  409. }
  410. .chart-b-li-r {
  411. >view:nth-of-type(1) {
  412. font-size: 28rpx;
  413. color: #FFFFFF;
  414. line-height: 50rpx;
  415. text-align: left;
  416. }
  417. >view:nth-of-type(2) {
  418. display: flex;
  419. justify-content: flex-start;
  420. align-items: center;
  421. >text:nth-of-type(1) {
  422. width: 20rpx;
  423. height: 20rpx;
  424. background: #FF8C00;
  425. border-radius: 10rpx;
  426. margin-right: 12rpx;
  427. }
  428. font-size: 24rpx;
  429. color: #FFFFFF;
  430. line-height: 50rpx;
  431. text-align: left;
  432. }
  433. >view:nth-of-type(3) {
  434. display: flex;
  435. justify-content: flex-start;
  436. align-items: center;
  437. >text:nth-of-type(1) {
  438. width: 20rpx;
  439. height: 20rpx;
  440. background: #0183FA;
  441. border-radius: 10rpx;
  442. margin-right: 12rpx;
  443. }
  444. font-size: 24rpx;
  445. color: #FFFFFF;
  446. line-height: 50rpx;
  447. text-align: left;
  448. }
  449. }
  450. }
  451. }
  452. }
  453. .small-title {
  454. width: 690rpx;
  455. height: 50rpx;
  456. display: flex;
  457. justify-content: space-between;
  458. align-items: center;
  459. margin: 24rpx 30rpx;
  460. .small-title-l {
  461. font-weight: 400;
  462. font-size: 32rpx;
  463. color: #FFFFFF;
  464. line-height: 45rpx;
  465. }
  466. .chart-tab-tow {
  467. width: 300rpx;
  468. height: 50rpx;
  469. border-radius: 25rpx;
  470. overflow: hidden;
  471. border: 1rpx solid #52545F;
  472. display: flex;
  473. justify-content: flex-start;
  474. .chart-tab-li {
  475. width: 100rpx;
  476. font-weight: 400;
  477. font-size: 28rpx;
  478. color: #999999;
  479. line-height: 50rpx;
  480. text-align: center;
  481. }
  482. .chart-tab-li:nth-of-type(1) {
  483. border-right: 1rpx solid #52545F;
  484. }
  485. .chart-tab-li:nth-of-type(2) {
  486. border-right: 1rpx solid #52545F;
  487. }
  488. .tab-A {
  489. color: #FFFFFF;
  490. background: #0183FA;
  491. }
  492. .tab-B {
  493. color: #999999;
  494. background: none;
  495. }
  496. }
  497. }
  498. .small-title-tow {
  499. width: 750rpx;
  500. height: 80rpx;
  501. background: #3E414F;
  502. display: flex;
  503. justify-content: space-between;
  504. align-items: center;
  505. padding: 0 20rpx 0 30rpx;
  506. box-sizing: border-box;
  507. margin-top: 2rpx;
  508. .small-title-tow-l {
  509. flex: 1;
  510. font-weight: 400;
  511. font-size: 30rpx;
  512. color: #FFFFFF;
  513. line-height: 42rpx;
  514. overflow: hidden;
  515. text-overflow: ellipsis;
  516. white-space: nowrap;
  517. }
  518. .small-title-tow-r {
  519. width: 14rpx;
  520. height: 8rpx;
  521. }
  522. }
  523. .chart-tow {
  524. width: 690rpx;
  525. height: 480rpx;
  526. background: #3E414F;
  527. border-radius: 20rpx 20rpx 20rpx 30rpx;
  528. margin: 26rpx 30rpx 0;
  529. .chart-tow-b {
  530. width: 690rpx;
  531. height: 480rpx;
  532. }
  533. }
  534. }
  535. </style>