hazardSources.vue 8.0 KB

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