hazardSources.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395
  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 :tapLegend="false" :tooltipShow="false" :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, 0],
  61. enableScroll: false,
  62. legend: {
  63. position: 'top',
  64. legendShape: 'square',
  65. fontColor: '#fff',
  66. },
  67. xAxis: {
  68. disabled: true,
  69. disableGrid: true,
  70. axisLine: false,
  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. let newName = item.deptSortName;
  172. if(newName.length > 6){
  173. newName = newName.slice(0, 6) + '..';
  174. }
  175. // name.push(item.deptSortName)
  176. name.push(newName)
  177. list.push(item.chemical)
  178. list2.push(item.coolHotdevice)
  179. }
  180. })
  181. let res = {
  182. categories: name,
  183. series: [{
  184. name: "危险品",
  185. textColor: "#FFFFFF",
  186. data: list
  187. },
  188. {
  189. name: "冷热设备与特种设备",
  190. textColor: "#FFFFFF",
  191. data: list2
  192. }
  193. ]
  194. };
  195. this.chartData = JSON.parse(JSON.stringify(res));
  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. .small-title-l {
  213. font-weight: 400;
  214. font-size: 32rpx;
  215. color: #FFFFFF;
  216. line-height: 45rpx;
  217. text-align: left;
  218. margin: 28rpx 0;
  219. }
  220. .small-title-r {
  221. width: 15rpx;
  222. height: 18rpx;
  223. }
  224. }
  225. .chart {
  226. width: 690rpx;
  227. height: 560rpx;
  228. background: #3E414F;
  229. border-radius: 20rpx 20rpx 20rpx 20rpx;
  230. padding: 34rpx 30rpx 26rpx;
  231. box-sizing: border-box;
  232. .chart-b {
  233. width: 630rpx;
  234. height: 500rpx;
  235. }
  236. }
  237. .statistics {
  238. width: 690rpx;
  239. height: 241rpx;
  240. background: #3E414F;
  241. border-radius: 20rpx 20rpx 20rpx 20rpx;
  242. margin-top: 20rpx;
  243. .statistics-t {
  244. height: 100rpx;
  245. display: flex;
  246. justify-content: space-between;
  247. align-items: center;
  248. border-bottom: 1rpx solid #52545F;
  249. padding: 0 42rpx 0 38rpx;
  250. box-sizing: border-box;
  251. .statistics-t-l {
  252. font-weight: 400;
  253. font-size: 32rpx;
  254. color: #FFFFFF;
  255. line-height: 45rpx;
  256. }
  257. .statistics-t-r {
  258. font-weight: 400;
  259. font-size: 36rpx;
  260. color: #FFFFFF;
  261. line-height: 50rpx;
  262. }
  263. }
  264. .statistics-b {
  265. display: flex;
  266. justify-content: space-between;
  267. align-items: center;
  268. .statistics-b-li {
  269. flex: 1;
  270. text-align: center;
  271. .statistics-b-li-t {
  272. font-weight: 400;
  273. font-size: 36rpx;
  274. line-height: 50rpx;
  275. margin-top: 28rpx;
  276. }
  277. .statistics-b-li-b {
  278. font-weight: 400;
  279. font-size: 28rpx;
  280. color: #FFFFFF;
  281. line-height: 39rpx;
  282. margin-top: 9rpx;
  283. }
  284. }
  285. .line {
  286. width: 2rpx;
  287. height: 30rpx;
  288. background: #D8D8D8;
  289. }
  290. .color-A {
  291. color: #FF8C00;
  292. }
  293. .color-B {
  294. color: #26C736;
  295. }
  296. .color-C {
  297. color: #FF0000;
  298. }
  299. }
  300. }
  301. .table {
  302. width: 690rpx;
  303. margin-top: 20rpx;
  304. border-radius: 20rpx 20rpx 0 0;
  305. overflow: hidden;
  306. .sortOne {
  307. display: inline-block;
  308. width: 40rpx;
  309. height: 40rpx;
  310. padding: 4rpx;
  311. box-sizing: border-box;
  312. background: rgba(255, 0, 0, 0.2);
  313. font-weight: 400;
  314. font-size: 28rpx;
  315. color: #FF0000;
  316. line-height: 40rpx;
  317. text-align: center;
  318. border-radius: 20rpx;
  319. }
  320. .sortTow {
  321. display: inline-block;
  322. width: 40rpx;
  323. height: 40rpx;
  324. padding: 4rpx;
  325. box-sizing: border-box;
  326. background: rgba(255, 153, 0, 0.2);
  327. font-weight: 400;
  328. font-size: 28rpx;
  329. color: #FF9900;
  330. line-height: 40rpx;
  331. text-align: center;
  332. border-radius: 20rpx;
  333. }
  334. .sortThree {
  335. display: inline-block;
  336. width: 40rpx;
  337. height: 40rpx;
  338. padding: 4rpx;
  339. box-sizing: border-box;
  340. background: rgba(255, 242, 0, 0.2);
  341. font-weight: 400;
  342. font-size: 28rpx;
  343. color: #FFF200;
  344. line-height: 40rpx;
  345. text-align: center;
  346. border-radius: 20rpx;
  347. }
  348. .sortFive {
  349. display: inline-block;
  350. width: 40rpx;
  351. height: 40rpx;
  352. padding: 4rpx;
  353. box-sizing: border-box;
  354. background: rgba(1, 131, 250, 0.2);
  355. font-weight: 400;
  356. font-size: 28rpx;
  357. color: #0183FA;
  358. line-height: 40rpx;
  359. text-align: center;
  360. border-radius: 20rpx;
  361. }
  362. }
  363. }
  364. </style>