hazardousChemicals.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418
  1. <!-- 数据看板-危化品 -->
  2. <template>
  3. <view class="hazardSources">
  4. <view class="statistics">
  5. <view class="statistics-t">
  6. <view class="statistics-t-l">危化品总数:</view>
  7. <view class="statistics-t-r">{{totalNumber}} </view>
  8. </view>
  9. <view class="statistics-b">
  10. <view class="statistics-b-li">
  11. <view class="statistics-b-li-t color-A">{{totalAmount}} kg</view>
  12. <view class="statistics-b-li-b">总量</view>
  13. </view>
  14. <view class="line"></view>
  15. <view class="statistics-b-li">
  16. <view class="statistics-b-li-t color-B">{{newTotal}} </view>
  17. <view class="statistics-b-li-b">今日新增数</view>
  18. </view>
  19. <view class="line"></view>
  20. <view class="statistics-b-li">
  21. <view class="statistics-b-li-t color-C">{{todayAdded}} kg</view>
  22. <view class="statistics-b-li-b">今日新增量</view>
  23. </view>
  24. </view>
  25. </view>
  26. <view class="small-title">
  27. <view class="small-title-l">危化品存量排行TOP5</view>
  28. </view>
  29. <view class="chart">
  30. <view class="chart-t">
  31. <qiun-data-charts :canvas2d="true" type="funnel" :opts="opts" :echartsH5="true" :chartData="chartData" />
  32. </view>
  33. <view class="chart-b" v-for="(item,index) in dataList" :key="index">
  34. <view :class="index==0?'chartOne':(index==1?'chartTow':(index==2?'chartThree':'chartFive'))">
  35. {{index+1}}
  36. </view>
  37. <view>{{item.deptSortName}}</view>
  38. <view>总数{{item.totalNumber}}</view>
  39. <view>|</view>
  40. <view>今日新增{{item.newTotal}}</view>
  41. <img :src="imagesUrl('dataBoard/dataBoard-icon2.png')">
  42. </view>
  43. </view>
  44. <view class="table">
  45. <uni-card>
  46. <view style="height: 200px">
  47. <zb-table :columns="column" :stripe="false" :border="false" :data="dataList"></zb-table>
  48. </view>
  49. </uni-card>
  50. </view>
  51. </view>
  52. </template>
  53. <script>
  54. import {
  55. config
  56. } from '@/api/request/config.js'
  57. import {
  58. reportAppStatisticsChemicalStockSort
  59. } from '@/pages/api/index.js'
  60. export default {
  61. name: "hazardSources",
  62. components: {
  63. },
  64. data() {
  65. return {
  66. opts: {
  67. color: ['#FF0000', '#D40000', '#FF5900', '#FF9900', '#FF9900'],
  68. legend: {
  69. show: false,
  70. },
  71. padding: [15, 85, 6, 5],
  72. enableScroll: false,
  73. extra: {
  74. funnel: {
  75. activeOpacity: 0.3,
  76. activeWidth: 10,
  77. border: false,
  78. borderWidth: 2,
  79. borderColor: "#FFFFFF",
  80. fillOpacity: 1,
  81. labelAlign: "right",
  82. type: "pyramid"
  83. }
  84. }
  85. },
  86. chartData: {},
  87. totalNumber: 0,
  88. totalAmount: 0,
  89. newTotal: 0,
  90. todayAdded: 0,
  91. // 查询参数
  92. queryParams: {
  93. page: 1,
  94. pageSize: 10,
  95. },
  96. column: [{
  97. type: 'index',
  98. label: '排行',
  99. fixed: true,
  100. width: 60,
  101. align: 'center',
  102. },
  103. {
  104. name: 'deptSortName',
  105. label: '学院单位',
  106. fixed: true,
  107. width: 80,
  108. align: 'center',
  109. },
  110. {
  111. name: 'totalNumber',
  112. label: '总数',
  113. align: 'center',
  114. },
  115. {
  116. name: 'totalAmount',
  117. label: '总量',
  118. align: 'center',
  119. },
  120. {
  121. name: 'newData',
  122. label: '今日新增',
  123. align: 'center',
  124. },
  125. ],
  126. dataList: [],
  127. total: 0,
  128. }
  129. },
  130. created() {
  131. },
  132. beforeMount() {
  133. },
  134. mounted() {
  135. this.reportAppStatisticsChemicalStockSort();
  136. },
  137. methods: {
  138. dateClick(index) {
  139. this.dateIndex = index;
  140. },
  141. async reportAppStatisticsChemicalStockSort() {
  142. let self = this;
  143. const {
  144. data
  145. } = await reportAppStatisticsChemicalStockSort();
  146. if (data.code == 200) {
  147. this.$set(self, 'totalNumber', data.data.totalNumber);
  148. this.$set(self, 'totalAmount', data.data.totalAmount);
  149. this.$set(self, 'newTotal', data.data.newTotal);
  150. this.$set(self, 'todayAdded', data.data.todayAdded);
  151. //列表
  152. let newList = [];
  153. //图表
  154. let res = {}
  155. if (data.data.chemicalStockSubs[0]) {
  156. let list = [];
  157. data.data.chemicalStockSubs.forEach(function(item, index) {
  158. if (index < 5) {
  159. list.push({
  160. "name": item.deptSortName,
  161. "value": item.totalNumber,
  162. "labelText": "总量" + item.totalNumber + 'kg',
  163. "textColor": "#fff",
  164. })
  165. }
  166. newList.push({
  167. deptSortName:item.deptSortName,
  168. totalNumber:item.totalNumber,
  169. totalAmount:item.totalAmount+'kg',
  170. newTotal:item.newTotal,
  171. newData:item.newTotal+'/'+item.todayAdded+'kg',
  172. })
  173. })
  174. res = {
  175. series: [{
  176. data: list
  177. }]
  178. };
  179. this.chartData = JSON.parse(JSON.stringify(res));
  180. this.dataList = newList;
  181. }else{
  182. res = {
  183. series: [{
  184. data: [
  185. {
  186. "name": '暂无数据',
  187. "value": 0,
  188. "labelText": "总量" + 0 + 'kg',
  189. "textColor": "#fff",
  190. }
  191. ]
  192. }]
  193. };
  194. this.chartData = JSON.parse(JSON.stringify(res));
  195. this.dataList = [];
  196. }
  197. }
  198. },
  199. },
  200. }
  201. </script>
  202. <style lang="stylus" scoped>
  203. .hazardSources {
  204. height: 100%;
  205. width: 100%;
  206. background: #363744;
  207. padding: 20rpx 30rpx 36rpx;
  208. box-sizing: border-box;
  209. .small-title {
  210. display: flex;
  211. justify-content: space-between;
  212. align-items: center;
  213. .small-title-l {
  214. font-weight: 400;
  215. font-size: 32rpx;
  216. color: #FFFFFF;
  217. line-height: 45rpx;
  218. text-align: left;
  219. margin: 28rpx 0;
  220. }
  221. .small-title-r {
  222. width: 15rpx;
  223. height: 18rpx;
  224. }
  225. }
  226. .chart {
  227. width: 690rpx;
  228. // height: 850rpx;
  229. background: #3E414F;
  230. border-radius: 20rpx 20rpx 20rpx 20rpx;
  231. padding: 24rpx 20rpx 1rpx;
  232. box-sizing: border-box;
  233. .chart-t {
  234. width: 650rpx;
  235. height: 452rpx;
  236. margin-bottom: 20rpx;
  237. }
  238. .chart-b {
  239. padding: 0 30rpx;
  240. box-sizing: border-box;
  241. display: flex;
  242. justify-content: flex-start;
  243. align-items: center;
  244. height: 40rpx;
  245. margin-bottom: 36rpx;
  246. >view {
  247. overflow: hidden;
  248. text-overflow: ellipsis;
  249. white-space: nowrap;
  250. }
  251. >view:nth-of-type(1) {
  252. width: 32rpx;
  253. height: 32rpx;
  254. font-weight: 400;
  255. font-size: 28rpx;
  256. line-height: 32rpx;
  257. text-align: center;
  258. margin-right: 18rpx;
  259. }
  260. >view:nth-of-type(2) {
  261. width: 246rpx;
  262. font-weight: 400;
  263. font-size: 28rpx;
  264. color: #FFFFFF;
  265. line-height: 39rpx;
  266. }
  267. >view:nth-of-type(3) {
  268. width: 132rpx;
  269. font-weight: 400;
  270. font-size: 28rpx;
  271. color: #FFFFFF;
  272. line-height: 39rpx;
  273. }
  274. >view:nth-of-type(4) {
  275. width: 2rpx;
  276. height: 20rpx;
  277. background: #D8D8D8;
  278. margin-right: 22rpx;
  279. }
  280. >view:nth-of-type(5) {
  281. width: 154rpx;
  282. font-weight: 400;
  283. font-size: 28rpx;
  284. color: #FFFFFF;
  285. line-height: 39rpx;
  286. }
  287. >img {
  288. width: 22rpx;
  289. height: 28rpx;
  290. }
  291. }
  292. .chartOne {
  293. background: rgba(255, 0, 0, 0.2);
  294. color: #FF0000;
  295. }
  296. .chartTow {
  297. background: #FFE3CC;
  298. color: #FF9900;
  299. }
  300. .chartThree {
  301. background: #FFEECC;
  302. color: #FFAA00;
  303. }
  304. .chartFive {
  305. background: #CCE6FE;
  306. color: #0183FA;
  307. }
  308. }
  309. .statistics {
  310. width: 690rpx;
  311. height: 241rpx;
  312. background: #3E414F;
  313. border-radius: 20rpx 20rpx 20rpx 20rpx;
  314. margin-top: 20rpx;
  315. .statistics-t {
  316. height: 100rpx;
  317. display: flex;
  318. justify-content: space-between;
  319. align-items: center;
  320. border-bottom: 1rpx solid #52545F;
  321. padding: 0 42rpx 0 38rpx;
  322. box-sizing: border-box;
  323. .statistics-t-l {
  324. font-weight: 400;
  325. font-size: 32rpx;
  326. color: #FFFFFF;
  327. line-height: 45rpx;
  328. }
  329. .statistics-t-r {
  330. font-weight: 400;
  331. font-size: 36rpx;
  332. color: #FFFFFF;
  333. line-height: 50rpx;
  334. }
  335. }
  336. .statistics-b {
  337. display: flex;
  338. justify-content: space-between;
  339. align-items: center;
  340. .statistics-b-li {
  341. flex: 1;
  342. text-align: center;
  343. .statistics-b-li-t {
  344. font-weight: 400;
  345. font-size: 36rpx;
  346. line-height: 50rpx;
  347. margin-top: 28rpx;
  348. }
  349. .statistics-b-li-b {
  350. font-weight: 400;
  351. font-size: 28rpx;
  352. color: #FFFFFF;
  353. line-height: 39rpx;
  354. margin-top: 9rpx;
  355. }
  356. }
  357. .line {
  358. width: 2rpx;
  359. height: 30rpx;
  360. background: #D8D8D8;
  361. }
  362. .color-A {
  363. color: #FF8C00;
  364. }
  365. .color-B {
  366. color: #26C736;
  367. }
  368. .color-C {
  369. color: #FF0000;
  370. }
  371. }
  372. }
  373. .table {
  374. width: 690rpx;
  375. margin-top: 20rpx;
  376. border-radius: 20rpx 20rpx 0 0;
  377. overflow: hidden;
  378. }
  379. }
  380. </style>