hazardSources.vue 7.9 KB

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