resourceReservation.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550
  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>965</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" :chartData="chartData0" />
  19. </view>
  20. <view class="chart-b-li-r">
  21. <text>60</text>
  22. <text>60%</text>
  23. </view>
  24. </view>
  25. <view class="chart-b-li">
  26. <view class="chart-b-li-l">
  27. <qiun-data-charts type="arcbar" :opts="opts1" :chartData="chartData1" />
  28. </view>
  29. <view class="chart-b-li-r">
  30. <text>60</text>
  31. <text>60%</text>
  32. </view>
  33. </view>
  34. <view class="chart-b-li">
  35. <view class="chart-b-li-l">
  36. <qiun-data-charts type="arcbar" :opts="opts2" :chartData="chartData2" />
  37. </view>
  38. <view class="chart-b-li-r">
  39. <text>60</text>
  40. <text>60%</text>
  41. </view>
  42. </view>
  43. <view class="chart-b-li">
  44. <view class="chart-b-li-l">
  45. <qiun-data-charts type="arcbar" :opts="opts3" :chartData="chartData3" />
  46. </view>
  47. <view class="chart-b-li-r">
  48. <text>60</text>
  49. <text>60%</text>
  50. </view>
  51. </view>
  52. </view>
  53. </view>
  54. <view class="small-title">
  55. <view class="small-title-l">安全隐患统计</view>
  56. </view>
  57. <view class="small-title-tow">
  58. <view class="small-title-tow-l">安全检查校级巡查计划标题标题标题标题标题</view>
  59. <img class="small-title-tow-r" src="@/pages/images/dataBoard/icon_06.png">
  60. </view>
  61. <view class="chart-tow">
  62. <view class="chart-tow-b">
  63. <qiun-data-charts type="radar" :opts="optsTow" :echartsH5="true" :chartData="chartDataTow" />
  64. </view>
  65. </view>
  66. </view>
  67. </template>
  68. <script>
  69. import {
  70. config
  71. } from '@/api/request/config.js'
  72. import {
  73. reportAppletReportApiResourceRateResourceList,
  74. reportAppletReportBsEquipDangerList
  75. } from '@/pages/api/index.js'
  76. export default {
  77. name: "resourceReservation",
  78. components: {
  79. },
  80. data() {
  81. return {
  82. opts0: {
  83. title: {
  84. name: "温室",
  85. fontSize: 15,
  86. color: "#fff"
  87. },
  88. subtitle: {
  89. name: "89%",
  90. fontSize: 15,
  91. color: "#FFCC00"
  92. },
  93. extra: {
  94. arcbar: {
  95. type: "default",
  96. width: 6,
  97. backgroundColor: "#FF5201",
  98. startAngle: 0,
  99. endAngle: 1.5,
  100. gap: 2,
  101. linearType: "custom"
  102. }
  103. }
  104. },
  105. opts1: {
  106. title: {
  107. name: "温室",
  108. fontSize: 15,
  109. color: "#fff"
  110. },
  111. subtitle: {
  112. name: "89%",
  113. fontSize: 15,
  114. color: "#04A44C"
  115. },
  116. extra: {
  117. arcbar: {
  118. type: "default",
  119. width: 6,
  120. backgroundColor: "#04A44C",
  121. startAngle: 0,
  122. endAngle: 1.5,
  123. gap: 2,
  124. linearType: "custom"
  125. }
  126. }
  127. },
  128. opts2: {
  129. title: {
  130. name: "温室",
  131. fontSize: 15,
  132. color: "#fff"
  133. },
  134. subtitle: {
  135. name: "89%",
  136. fontSize: 15,
  137. color: "#0283FA"
  138. },
  139. extra: {
  140. arcbar: {
  141. type: "default",
  142. width: 6,
  143. backgroundColor: "#0283FA",
  144. startAngle: 0,
  145. endAngle: 1.5,
  146. gap: 2,
  147. linearType: "custom"
  148. }
  149. }
  150. },
  151. opts3: {
  152. title: {
  153. name: "温室",
  154. fontSize: 15,
  155. color: "#fff"
  156. },
  157. subtitle: {
  158. name: "89%",
  159. fontSize: 15,
  160. color: "#0283FA"
  161. },
  162. extra: {
  163. arcbar: {
  164. type: "default",
  165. width: 6,
  166. backgroundColor: "#0283FA",
  167. startAngle: 0,
  168. endAngle: 1.5,
  169. gap: 2,
  170. linearType: "custom"
  171. }
  172. }
  173. },
  174. chartData0: {},
  175. chartData1: {},
  176. chartData2: {},
  177. chartData3: {},
  178. optsTow: {
  179. color: ["#1890FF", "#91CB74", "#FAC858", "#EE6666", "#73C0DE", "#3CA272", "#FC8452", "#9A60B4",
  180. "#ea7ccc"
  181. ],
  182. padding: [5, 5, 5, 5],
  183. dataLabel: false,
  184. enableScroll: false,
  185. legend: {
  186. show: false,
  187. position: "right",
  188. lineHeight: 25
  189. },
  190. extra: {
  191. radar: {
  192. gridType: "radar",
  193. gridColor: "#CCCCCC",
  194. gridCount: 3,
  195. opacity: 0.2,
  196. max: 200,
  197. labelShow: true,
  198. border: true,
  199. labelColor: '#fff',
  200. }
  201. }
  202. },
  203. chartDataTow: {},
  204. chartTabList: ['日', '月', '年'],
  205. chartTabIndex: 0,
  206. chartTabListTow: ['按资费', '按机时', '按样品'],
  207. chartTabIndexTow: 0,
  208. }
  209. },
  210. created() {
  211. },
  212. beforeMount() {
  213. },
  214. mounted() {
  215. this.reportAppletReportApiResourceRateResourceList();
  216. //this.getServerData();
  217. //this.getServerData2();
  218. //this.getServerData3();
  219. this.getServerDataTow();
  220. },
  221. methods: {
  222. async reportAppletReportApiResourceRateResourceList() {
  223. let self = this;
  224. const {
  225. data
  226. } = await reportAppletReportApiResourceRateResourceList({
  227. type: this.type
  228. });
  229. if (data.code == 200) {
  230. let nameList = []
  231. let colorList = ['#FFCC00', '#00FFDD', '#00FFEE', '#00FFEE']
  232. let numList = []
  233. data.data.forEach(function(item, index) {
  234. console.log(index)
  235. const optsName = `opts${index}`;
  236. self[optsName].title.name = item.equType
  237. let res = {
  238. series: [{
  239. name: item.equType,
  240. color: colorList[index],
  241. data: item.equNumber,
  242. }]
  243. };
  244. const propertyName = `chartData${index}`;
  245. self[propertyName] = JSON.parse(JSON.stringify(res));
  246. })
  247. }
  248. },
  249. getServerData() {
  250. //模拟从服务器获取数据时的延时
  251. setTimeout(() => {
  252. //模拟服务器返回数据,如果数据格式和标准格式不同,需自行按下面的格式拼接
  253. let res = {
  254. series: [{
  255. name: "温室",
  256. color: "#FF5201",
  257. data: 0.8
  258. }]
  259. };
  260. this.chartData = JSON.parse(JSON.stringify(res));
  261. }, 500);
  262. },
  263. getServerData2() {
  264. //模拟从服务器获取数据时的延时
  265. setTimeout(() => {
  266. //模拟服务器返回数据,如果数据格式和标准格式不同,需自行按下面的格式拼接
  267. let res = {
  268. series: [{
  269. name: "自然室",
  270. color: "#04A44C",
  271. data: 0.8
  272. }]
  273. };
  274. this.chartData2 = JSON.parse(JSON.stringify(res));
  275. }, 500);
  276. },
  277. getServerData3() {
  278. //模拟从服务器获取数据时的延时
  279. setTimeout(() => {
  280. //模拟服务器返回数据,如果数据格式和标准格式不同,需自行按下面的格式拼接
  281. let res = {
  282. series: [{
  283. name: "冷库",
  284. color: "#0283FA",
  285. data: 0.8
  286. }]
  287. };
  288. this.chartData3 = JSON.parse(JSON.stringify(res));
  289. }, 500);
  290. },
  291. getServerDataTow() {
  292. //模拟从服务器获取数据时的延时
  293. setTimeout(() => {
  294. //模拟服务器返回数据,如果数据格式和标准格式不同,需自行按下面的格式拼接
  295. let res = {
  296. categories: ["测定仪", "色谱仪", "分析仪", "光度计", "离子色谱仪"],
  297. series: [{
  298. name: "成交量1",
  299. data: [90, 110, 165, 195, 187]
  300. },
  301. {
  302. name: "成交量2",
  303. data: [190, 210, 105, 35, 27]
  304. }
  305. ]
  306. };
  307. this.chartDataTow = JSON.parse(JSON.stringify(res));
  308. }, 500);
  309. },
  310. chartTabClick(index) {
  311. this.chartTabIndex = index;
  312. },
  313. chartTabClickTow(index) {
  314. this.chartTabIndexTow = index;
  315. },
  316. },
  317. }
  318. </script>
  319. <style lang="stylus" scoped>
  320. .resourceReservation {
  321. height: 100%;
  322. width: 100%;
  323. background: #363744;
  324. padding: 20rpx 0rpx 0;
  325. box-sizing: border-box;
  326. .chart {
  327. width: 690rpx;
  328. height: 890rpx;
  329. background: #3E414F;
  330. border-radius: 20rpx 20rpx 20rpx 20rpx;
  331. overflow: hidden;
  332. margin: 0 30rpx;
  333. .chart-t {
  334. display: flex;
  335. justify-content: space-between;
  336. align-items: center;
  337. height: 50rpx;
  338. margin-top: 30rpx;
  339. padding: 0 24rpx 0 42rpx;
  340. box-sizing: border-box;
  341. .chart-t-l {
  342. >text {
  343. font-weight: 400;
  344. font-size: 30rpx;
  345. color: #FFFFFF;
  346. line-height: 42rpx;
  347. }
  348. >text:nth-of-type(1) {
  349. color: #FFFFFF;
  350. }
  351. >text:nth-of-type(2) {
  352. color: #0183FA;
  353. }
  354. }
  355. .chart-tab {
  356. width: 120rpx;
  357. height: 50rpx;
  358. border-radius: 10rpx;
  359. overflow: hidden;
  360. border: 1rpx solid #52545F;
  361. display: flex;
  362. justify-content: flex-start;
  363. .chart-tab-li {
  364. width: 60rpx;
  365. font-weight: 400;
  366. font-size: 28rpx;
  367. color: #999999;
  368. line-height: 50rpx;
  369. text-align: center;
  370. }
  371. .chart-tab-li:nth-of-type(1) {
  372. border-right: 1rpx solid #52545F;
  373. }
  374. .chart-tab-li:nth-of-type(2) {
  375. border-right: 1rpx solid #52545F;
  376. }
  377. .tab-A {
  378. color: #FFFFFF;
  379. background: #0183FA;
  380. }
  381. .tab-B {
  382. color: #999999;
  383. background: none;
  384. }
  385. }
  386. }
  387. .chart-b {
  388. display: flex;
  389. justify-content: space-between;
  390. flex-wrap: wrap;
  391. align-items: center;
  392. padding: 0 74rpx 0;
  393. box-sizing: border-box;
  394. .chart-b-li {
  395. width: 270rpx;
  396. display: flex;
  397. flex-direction: column;
  398. align-items: center;
  399. margin-bottom: 34rpx;
  400. .chart-b-li-l {
  401. width: 180rpx;
  402. height: 180rpx;
  403. margin-right: 17rpx;
  404. }
  405. .chart-b-li-r {
  406. >text {
  407. display: block;
  408. font-size: 28rpx;
  409. color: #FFFFFF;
  410. line-height: 40rpx;
  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>