hazardousChemicals.vue 8.1 KB

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