hazardousChemicals.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419
  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. let res = {}
  156. if (data.data.chemicalStockSubs[0]) {
  157. let list = [];
  158. data.data.chemicalStockSubs.forEach(function(item, index) {
  159. if (index < 5) {
  160. list.push({
  161. "name": item.deptSortName,
  162. "value": item.totalNumber,
  163. "labelText": "总量" + item.totalNumber + 'kg',
  164. "textColor": "#fff",
  165. })
  166. }
  167. newList.push({
  168. deptSortName:item.deptSortName,
  169. totalNumber:item.totalNumber,
  170. totalAmount:item.totalAmount+'kg',
  171. newTotal:item.newTotal,
  172. newData:item.newTotal+'/'+item.todayAdded+'kg',
  173. })
  174. })
  175. res = {
  176. series: [{
  177. data: list
  178. }]
  179. };
  180. this.chartData = JSON.parse(JSON.stringify(res));
  181. this.dataList = newList;
  182. }else{
  183. res = {
  184. series: [{
  185. data: [
  186. {
  187. "name": '暂无数据',
  188. "value": 0,
  189. "labelText": "总量" + 0 + 'kg',
  190. "textColor": "#fff",
  191. }
  192. ]
  193. }]
  194. };
  195. this.chartData = JSON.parse(JSON.stringify(res));
  196. this.dataList = [];
  197. }
  198. }
  199. },
  200. },
  201. }
  202. </script>
  203. <style lang="stylus" scoped>
  204. .hazardSources {
  205. height: 100%;
  206. width: 100%;
  207. background: #363744;
  208. padding: 20rpx 30rpx 36rpx;
  209. box-sizing: border-box;
  210. .small-title {
  211. display: flex;
  212. justify-content: space-between;
  213. align-items: center;
  214. .small-title-l {
  215. font-weight: 400;
  216. font-size: 32rpx;
  217. color: #FFFFFF;
  218. line-height: 45rpx;
  219. text-align: left;
  220. margin: 28rpx 0;
  221. }
  222. .small-title-r {
  223. width: 15rpx;
  224. height: 18rpx;
  225. }
  226. }
  227. .chart {
  228. width: 690rpx;
  229. // height: 850rpx;
  230. background: #3E414F;
  231. border-radius: 20rpx 20rpx 20rpx 20rpx;
  232. padding: 24rpx 20rpx 1rpx;
  233. box-sizing: border-box;
  234. .chart-t {
  235. width: 650rpx;
  236. height: 452rpx;
  237. margin-bottom: 20rpx;
  238. }
  239. .chart-b {
  240. padding: 0 30rpx;
  241. box-sizing: border-box;
  242. display: flex;
  243. justify-content: flex-start;
  244. align-items: center;
  245. height: 40rpx;
  246. margin-bottom: 36rpx;
  247. >view {
  248. overflow: hidden;
  249. text-overflow: ellipsis;
  250. white-space: nowrap;
  251. }
  252. >view:nth-of-type(1) {
  253. width: 32rpx;
  254. height: 32rpx;
  255. font-weight: 400;
  256. font-size: 28rpx;
  257. line-height: 32rpx;
  258. text-align: center;
  259. margin-right: 18rpx;
  260. }
  261. >view:nth-of-type(2) {
  262. width: 246rpx;
  263. font-weight: 400;
  264. font-size: 28rpx;
  265. color: #FFFFFF;
  266. line-height: 39rpx;
  267. }
  268. >view:nth-of-type(3) {
  269. width: 132rpx;
  270. font-weight: 400;
  271. font-size: 28rpx;
  272. color: #FFFFFF;
  273. line-height: 39rpx;
  274. }
  275. >view:nth-of-type(4) {
  276. width: 2rpx;
  277. height: 20rpx;
  278. background: #D8D8D8;
  279. margin-right: 22rpx;
  280. }
  281. >view:nth-of-type(5) {
  282. width: 154rpx;
  283. font-weight: 400;
  284. font-size: 28rpx;
  285. color: #FFFFFF;
  286. line-height: 39rpx;
  287. }
  288. >img {
  289. width: 22rpx;
  290. height: 28rpx;
  291. }
  292. }
  293. .chartOne {
  294. background: rgba(255, 0, 0, 0.2);
  295. color: #FF0000;
  296. }
  297. .chartTow {
  298. background: #FFE3CC;
  299. color: #FF9900;
  300. }
  301. .chartThree {
  302. background: #FFEECC;
  303. color: #FFAA00;
  304. }
  305. .chartFive {
  306. background: #CCE6FE;
  307. color: #0183FA;
  308. }
  309. }
  310. .statistics {
  311. width: 690rpx;
  312. height: 241rpx;
  313. background: #3E414F;
  314. border-radius: 20rpx 20rpx 20rpx 20rpx;
  315. margin-top: 20rpx;
  316. .statistics-t {
  317. height: 100rpx;
  318. display: flex;
  319. justify-content: space-between;
  320. align-items: center;
  321. border-bottom: 1rpx solid #52545F;
  322. padding: 0 42rpx 0 38rpx;
  323. box-sizing: border-box;
  324. .statistics-t-l {
  325. font-weight: 400;
  326. font-size: 32rpx;
  327. color: #FFFFFF;
  328. line-height: 45rpx;
  329. }
  330. .statistics-t-r {
  331. font-weight: 400;
  332. font-size: 36rpx;
  333. color: #FFFFFF;
  334. line-height: 50rpx;
  335. }
  336. }
  337. .statistics-b {
  338. display: flex;
  339. justify-content: space-between;
  340. align-items: center;
  341. .statistics-b-li {
  342. flex: 1;
  343. text-align: center;
  344. .statistics-b-li-t {
  345. font-weight: 400;
  346. font-size: 36rpx;
  347. line-height: 50rpx;
  348. margin-top: 28rpx;
  349. }
  350. .statistics-b-li-b {
  351. font-weight: 400;
  352. font-size: 28rpx;
  353. color: #FFFFFF;
  354. line-height: 39rpx;
  355. margin-top: 9rpx;
  356. }
  357. }
  358. .line {
  359. width: 2rpx;
  360. height: 30rpx;
  361. background: #D8D8D8;
  362. }
  363. .color-A {
  364. color: #FF8C00;
  365. }
  366. .color-B {
  367. color: #26C736;
  368. }
  369. .color-C {
  370. color: #FF0000;
  371. }
  372. }
  373. }
  374. .table {
  375. width: 690rpx;
  376. margin-top: 20rpx;
  377. border-radius: 20rpx 20rpx 0 0;
  378. overflow: hidden;
  379. }
  380. }
  381. </style>