resourceReservation.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588
  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. 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.reportAppletReportApiResourceRateAnalysisList()
  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 reportAppletReportApiResourceRateAnalysisList() {
  273. let self = this;
  274. const {
  275. data
  276. } = await reportAppletReportApiResourceRateAnalysisList({});
  277. if (data.code == 200) {
  278. let categories = [];
  279. let list = [];
  280. data.data.forEach((item, index)=>{
  281. if (index < 5) {
  282. if (item.equType.length > 6) {
  283. item.equType = item.equType.slice(0, 6) + '...';
  284. }
  285. categories.push(item.equType)
  286. list.push(item.equNumber)
  287. }
  288. })
  289. let res = {};
  290. if(categories[0]){
  291. res = {
  292. categories: categories,
  293. series: [{
  294. name: "",
  295. data: list
  296. }]
  297. };
  298. }else{
  299. res = {
  300. categories: ['无数据'],
  301. series: [{
  302. name: "",
  303. data: [0]
  304. }]
  305. };
  306. }
  307. console.log('res',res)
  308. self.$set(this,'chartDataThree',res);
  309. }
  310. },
  311. chartTabClickThree(index) {
  312. this.chartTabIndexThree = index;
  313. this.statisticsType = index + 1;
  314. this.reportAppletReportApiResourceRateAnalysisList();
  315. },
  316. chartTabClick(index) {
  317. this.chartTabIndex = index;
  318. },
  319. chartTabClickTow(index) {
  320. this.chartTabIndexTow = index;
  321. },
  322. },
  323. }
  324. </script>
  325. <style lang="stylus" scoped>
  326. .resourceReservation {
  327. height: 100%;
  328. width: 100%;
  329. background: #363744;
  330. padding: 20rpx 0rpx 0;
  331. box-sizing: border-box;
  332. .chart {
  333. width: 690rpx;
  334. height: 890rpx;
  335. background: #3E414F;
  336. border-radius: 20rpx 20rpx 20rpx 20rpx;
  337. overflow: hidden;
  338. margin: 0 30rpx;
  339. .chart-t {
  340. display: flex;
  341. justify-content: space-between;
  342. align-items: center;
  343. height: 50rpx;
  344. margin-top: 30rpx;
  345. padding: 0 24rpx 0 42rpx;
  346. box-sizing: border-box;
  347. .chart-t-l {
  348. >text {
  349. font-weight: 400;
  350. font-size: 30rpx;
  351. color: #FFFFFF;
  352. line-height: 42rpx;
  353. }
  354. >text:nth-of-type(1) {
  355. color: #FFFFFF;
  356. }
  357. >text:nth-of-type(2) {
  358. color: #0183FA;
  359. }
  360. }
  361. .chart-tab {
  362. width: 120rpx;
  363. height: 50rpx;
  364. border-radius: 10rpx;
  365. overflow: hidden;
  366. border: 1rpx solid #52545F;
  367. display: flex;
  368. justify-content: flex-start;
  369. .chart-tab-li {
  370. width: 60rpx;
  371. font-weight: 400;
  372. font-size: 28rpx;
  373. color: #999999;
  374. line-height: 50rpx;
  375. text-align: center;
  376. }
  377. .chart-tab-li:nth-of-type(1) {
  378. border-right: 1rpx solid #52545F;
  379. }
  380. .chart-tab-li:nth-of-type(2) {
  381. border-right: 1rpx solid #52545F;
  382. }
  383. .tab-A {
  384. color: #FFFFFF;
  385. background: #0183FA;
  386. }
  387. .tab-B {
  388. color: #999999;
  389. background: none;
  390. }
  391. }
  392. }
  393. .chart-b {
  394. display: flex;
  395. justify-content: space-between;
  396. flex-wrap: wrap;
  397. align-items: center;
  398. padding: 34rpx 74rpx 0;
  399. box-sizing: border-box;
  400. .chart-b-li {
  401. width: 270rpx;
  402. display: flex;
  403. flex-direction: column;
  404. align-items: center;
  405. margin-bottom: 34rpx;
  406. .chart-b-li-l {
  407. width: 180rpx;
  408. height: 180rpx;
  409. margin-right: 17rpx;
  410. }
  411. .chart-b-li-r {
  412. >view:nth-of-type(1) {
  413. font-size: 28rpx;
  414. color: #FFFFFF;
  415. line-height: 50rpx;
  416. text-align: left;
  417. }
  418. >view:nth-of-type(2) {
  419. display: flex;
  420. justify-content: flex-start;
  421. align-items: center;
  422. >text:nth-of-type(1) {
  423. width: 20rpx;
  424. height: 20rpx;
  425. background: #FF8C00;
  426. border-radius: 10rpx;
  427. margin-right: 12rpx;
  428. }
  429. font-size: 24rpx;
  430. color: #FFFFFF;
  431. line-height: 50rpx;
  432. text-align: left;
  433. }
  434. >view:nth-of-type(3) {
  435. display: flex;
  436. justify-content: flex-start;
  437. align-items: center;
  438. >text:nth-of-type(1) {
  439. width: 20rpx;
  440. height: 20rpx;
  441. background: #0183FA;
  442. border-radius: 10rpx;
  443. margin-right: 12rpx;
  444. }
  445. font-size: 24rpx;
  446. color: #FFFFFF;
  447. line-height: 50rpx;
  448. text-align: left;
  449. }
  450. }
  451. }
  452. }
  453. }
  454. .small-title {
  455. width: 690rpx;
  456. height: 50rpx;
  457. display: flex;
  458. justify-content: space-between;
  459. align-items: center;
  460. margin: 24rpx 30rpx;
  461. .small-title-l {
  462. font-weight: 400;
  463. font-size: 32rpx;
  464. color: #FFFFFF;
  465. line-height: 45rpx;
  466. }
  467. .chart-tab-tow {
  468. width: 300rpx;
  469. height: 50rpx;
  470. border-radius: 25rpx;
  471. overflow: hidden;
  472. border: 1rpx solid #52545F;
  473. display: flex;
  474. justify-content: flex-start;
  475. .chart-tab-li {
  476. width: 100rpx;
  477. font-weight: 400;
  478. font-size: 28rpx;
  479. color: #999999;
  480. line-height: 50rpx;
  481. text-align: center;
  482. }
  483. .chart-tab-li:nth-of-type(1) {
  484. border-right: 1rpx solid #52545F;
  485. }
  486. .chart-tab-li:nth-of-type(2) {
  487. border-right: 1rpx solid #52545F;
  488. }
  489. .tab-A {
  490. color: #FFFFFF;
  491. background: #0183FA;
  492. }
  493. .tab-B {
  494. color: #999999;
  495. background: none;
  496. }
  497. }
  498. }
  499. .small-title-tow {
  500. width: 750rpx;
  501. height: 80rpx;
  502. background: #3E414F;
  503. display: flex;
  504. justify-content: space-between;
  505. align-items: center;
  506. padding: 0 20rpx 0 30rpx;
  507. box-sizing: border-box;
  508. margin-top: 2rpx;
  509. .small-title-tow-l {
  510. flex: 1;
  511. font-weight: 400;
  512. font-size: 30rpx;
  513. color: #FFFFFF;
  514. line-height: 42rpx;
  515. overflow: hidden;
  516. text-overflow: ellipsis;
  517. white-space: nowrap;
  518. }
  519. .small-title-tow-r {
  520. width: 14rpx;
  521. height: 8rpx;
  522. }
  523. }
  524. .chart-tow {
  525. width: 690rpx;
  526. height: 480rpx;
  527. background: #3E414F;
  528. border-radius: 20rpx 20rpx 20rpx 30rpx;
  529. margin: 26rpx 30rpx 0;
  530. .chart-tow-b {
  531. width: 690rpx;
  532. height: 480rpx;
  533. }
  534. }
  535. }
  536. </style>