hazardSources.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388
  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">{{hazardTotal}}</view>
  8. </view>
  9. <view class="statistics-b">
  10. <view class="statistics-b-li">
  11. <view class="statistics-b-li-t color-A">{{newHazard}}</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">{{hazardChemicals}}</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">{{deviceNum}}</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-b">
  32. <qiun-data-charts type="bar" :opts="opts" :echartsH5="true" :chartData="chartData" />
  33. </view>
  34. </view>
  35. <view class="table">
  36. <uni-card>
  37. <view style="height: 200px">
  38. <zb-table :columns="column" :stripe="false" :border="false" :data="dataList"></zb-table>
  39. </view>
  40. </uni-card>
  41. </view>
  42. </view>
  43. </template>
  44. <script>
  45. import {
  46. config
  47. } from '@/api/request/config.js'
  48. import {
  49. reportAppStatisticsHazardTotalSort
  50. } from '@/pages/api/index.js'
  51. export default {
  52. name: "hazardSources",
  53. components: {
  54. },
  55. data() {
  56. return {
  57. opts: {
  58. color: ["#FF8C00", "#0183FA", ],
  59. padding: [2, 20, 0, 0],
  60. enableScroll: false,
  61. legend: {
  62. position: 'top',
  63. legendShape: 'square',
  64. fontColor: '#fff',
  65. },
  66. xAxis: {
  67. disabled: true,
  68. axisLine: false,
  69. disableGrid: true,
  70. fontColor: '#fff',
  71. },
  72. yAxis: {
  73. disabled: false,
  74. disableGrid: true,
  75. data: [{
  76. type: 'categories',
  77. fontColor: '#fff',
  78. }],
  79. },
  80. extra: {
  81. bar: {
  82. type: "stack",
  83. width: 20,
  84. meterBorde: 1,
  85. meterFillColor: "#FFFFFF",
  86. activeBgColor: "#000000",
  87. activeBgOpacity: 0.08,
  88. categoryGap: 2
  89. }
  90. }
  91. },
  92. chartData: {},
  93. // 查询参数
  94. queryParams: {
  95. page: 1,
  96. pageSize: 10,
  97. },
  98. hazardTotal:0,
  99. newHazard:0,
  100. hazardChemicals:0,
  101. deviceNum:0,
  102. column: [{
  103. type: 'index',
  104. label: '排行',
  105. fixed: true,
  106. width: 60,
  107. align: 'center',
  108. },
  109. {
  110. name: 'deptSortName',
  111. label: '学院单位',
  112. fixed: true,
  113. width: 80,
  114. align: 'center',
  115. },
  116. {
  117. name: 'totalNumber',
  118. label: '总数',
  119. align: 'center',
  120. },
  121. {
  122. name: 'newTotal',
  123. label: '危化品数',
  124. align: 'center',
  125. },
  126. {
  127. name: 'todayAdded',
  128. label: '冷热设备数',
  129. align: 'center',
  130. },
  131. ],
  132. dataList: [],
  133. total: 0,
  134. }
  135. },
  136. created() {
  137. },
  138. beforeMount() {
  139. },
  140. mounted() {
  141. this.reportAppStatisticsHazardTotalSort();
  142. },
  143. methods: {
  144. dateClick(index) {
  145. this.dateIndex = index;
  146. },
  147. //危化品
  148. async reportAppStatisticsHazardTotalSort() {
  149. let self = this;
  150. const {
  151. data
  152. } = await reportAppStatisticsHazardTotalSort();
  153. if (data.code == 200) {
  154. this.$set(self, 'hazardTotal', data.data.hazardTotal);
  155. this.$set(self, 'newHazard', data.data.newHazard);
  156. this.$set(self, 'hazardChemicals', data.data.hazardChemicals);
  157. this.$set(self, 'deviceNum', data.data.deviceNum);
  158. //列表
  159. this.dataList=data.data.hazardTotalSortSubs;
  160. //图表
  161. if(data.data.hazardTotalSortSubs[0]){
  162. let name=[];
  163. let list=[];
  164. let list2=[];
  165. data.data.hazardTotalSortSubs.forEach(function(item,index){
  166. if(index<5){
  167. name.push(item.deptSortName)
  168. list.push(item.chemical)
  169. list2.push(item.coolHotdevice)
  170. }
  171. })
  172. let res = {
  173. categories: name,
  174. series: [{
  175. name: "危险品",
  176. textColor: "#FFFFFF",
  177. data: list
  178. },
  179. {
  180. name: "冷热设备与特种设备",
  181. textColor: "#FFFFFF",
  182. data: list2
  183. }
  184. ]
  185. };
  186. this.chartData = JSON.parse(JSON.stringify(res));
  187. }
  188. }
  189. },
  190. },
  191. }
  192. </script>
  193. <style lang="stylus" scoped>
  194. .hazardSources {
  195. height: 100%;
  196. width: 100%;
  197. background: #363744;
  198. padding: 20rpx 30rpx 36rpx;
  199. box-sizing: border-box;
  200. .small-title {
  201. display: flex;
  202. justify-content: space-between;
  203. .small-title-l {
  204. font-weight: 400;
  205. font-size: 32rpx;
  206. color: #FFFFFF;
  207. line-height: 45rpx;
  208. text-align: left;
  209. margin: 28rpx 0;
  210. }
  211. .small-title-r {
  212. width: 15rpx;
  213. height: 18rpx;
  214. }
  215. }
  216. .chart {
  217. width: 690rpx;
  218. height: 400rpx;
  219. background: #3E414F;
  220. border-radius: 20rpx 20rpx 20rpx 20rpx;
  221. padding: 34rpx 30rpx 26rpx;
  222. box-sizing: border-box;
  223. .chart-b {
  224. width: 630rpx;
  225. height: 344rpx;
  226. }
  227. }
  228. .statistics {
  229. width: 690rpx;
  230. height: 241rpx;
  231. background: #3E414F;
  232. border-radius: 20rpx 20rpx 20rpx 20rpx;
  233. margin-top: 20rpx;
  234. .statistics-t {
  235. height: 100rpx;
  236. display: flex;
  237. justify-content: space-between;
  238. align-items: center;
  239. border-bottom: 1rpx solid #52545F;
  240. padding: 0 42rpx 0 38rpx;
  241. box-sizing: border-box;
  242. .statistics-t-l {
  243. font-weight: 400;
  244. font-size: 32rpx;
  245. color: #FFFFFF;
  246. line-height: 45rpx;
  247. }
  248. .statistics-t-r {
  249. font-weight: 400;
  250. font-size: 36rpx;
  251. color: #FFFFFF;
  252. line-height: 50rpx;
  253. }
  254. }
  255. .statistics-b {
  256. display: flex;
  257. justify-content: space-between;
  258. align-items: center;
  259. .statistics-b-li {
  260. flex: 1;
  261. text-align: center;
  262. .statistics-b-li-t {
  263. font-weight: 400;
  264. font-size: 36rpx;
  265. line-height: 50rpx;
  266. margin-top: 28rpx;
  267. }
  268. .statistics-b-li-b {
  269. font-weight: 400;
  270. font-size: 28rpx;
  271. color: #FFFFFF;
  272. line-height: 39rpx;
  273. margin-top: 9rpx;
  274. }
  275. }
  276. .line {
  277. width: 2rpx;
  278. height: 30rpx;
  279. background: #D8D8D8;
  280. }
  281. .color-A {
  282. color: #FF8C00;
  283. }
  284. .color-B {
  285. color: #26C736;
  286. }
  287. .color-C {
  288. color: #FF0000;
  289. }
  290. }
  291. }
  292. .table {
  293. width: 690rpx;
  294. margin-top: 20rpx;
  295. border-radius: 20rpx 20rpx 0 0;
  296. overflow: hidden;
  297. .sortOne {
  298. display: inline-block;
  299. width: 40rpx;
  300. height: 40rpx;
  301. padding: 4rpx;
  302. box-sizing: border-box;
  303. background: rgba(255, 0, 0, 0.2);
  304. font-weight: 400;
  305. font-size: 28rpx;
  306. color: #FF0000;
  307. line-height: 40rpx;
  308. text-align: center;
  309. border-radius: 20rpx;
  310. }
  311. .sortTow {
  312. display: inline-block;
  313. width: 40rpx;
  314. height: 40rpx;
  315. padding: 4rpx;
  316. box-sizing: border-box;
  317. background: rgba(255, 153, 0, 0.2);
  318. font-weight: 400;
  319. font-size: 28rpx;
  320. color: #FF9900;
  321. line-height: 40rpx;
  322. text-align: center;
  323. border-radius: 20rpx;
  324. }
  325. .sortThree {
  326. display: inline-block;
  327. width: 40rpx;
  328. height: 40rpx;
  329. padding: 4rpx;
  330. box-sizing: border-box;
  331. background: rgba(255, 242, 0, 0.2);
  332. font-weight: 400;
  333. font-size: 28rpx;
  334. color: #FFF200;
  335. line-height: 40rpx;
  336. text-align: center;
  337. border-radius: 20rpx;
  338. }
  339. .sortFive {
  340. display: inline-block;
  341. width: 40rpx;
  342. height: 40rpx;
  343. padding: 4rpx;
  344. box-sizing: border-box;
  345. background: rgba(1, 131, 250, 0.2);
  346. font-weight: 400;
  347. font-size: 28rpx;
  348. color: #0183FA;
  349. line-height: 40rpx;
  350. text-align: center;
  351. border-radius: 20rpx;
  352. }
  353. }
  354. }
  355. </style>