warningDispose.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529
  1. <!-- 数据看板-预警处置 -->
  2. <template>
  3. <view class="warningDispose">
  4. <!-- <view class="chart">
  5. <img class="chart-bg" :src="imagesUrl('dataBoard/dataBoard-icon4.png')">
  6. <view class="chart-n">
  7. <view class="chart-t">
  8. <view class="chart-t-li" @click="dateClick(index)" :class="dateIndex==index?'color-A':'color-B'"
  9. v-for="(item,index) in dateList">
  10. <view class="chart-t-li-t">{{item.num}}</view>
  11. <view class="chart-t-li-b">{{item.letterNUm}}</view>
  12. </view>
  13. </view>
  14. <view class="chart-b">
  15. <view class="chart-b-li" v-for="(item,index) in deptList" :key="index">
  16. <view>{{item.deptSortName}}:{{item.todayTotal}}</view>
  17. <img v-if="item.todayTotal==0" :src="imagesUrl('dataBoard/img_xyzc_bg@1x.png')">
  18. <img v-if="item.todayTotal!=0" :src="imagesUrl('dataBoard/img_xyyc_bg@1x.png')">
  19. </view>
  20. </view>
  21. </view>
  22. </view> -->
  23. <view class="statistics">
  24. <view class="statistics-b">
  25. <view class="statistics-b-li">
  26. <view class="statistics-b-li-t">{{yesterdayTotal}}</view>
  27. <view class="statistics-b-li-b">昨日预警处置数</view>
  28. </view>
  29. <view class="line"></view>
  30. <view class="statistics-b-li">
  31. <view class="statistics-b-li-t">{{todayTotal}}</view>
  32. <view class="statistics-b-li-b">今日预警处置数</view>
  33. </view>
  34. <view class="line"></view>
  35. <view class="statistics-b-li">
  36. <view class="statistics-b-li-t-tow">
  37. <text
  38. :class="rateType == 0?'color-C':(rateType == 1?'color-B':(rateType == 2?'color-A':''))">{{rate}}</text>
  39. <img :src="imagesUrl('dataBoard/dataBoard-icon2.png')" style="margin-left:10rpx;" v-if="rateType == 2">
  40. <img :src="imagesUrl('dataBoard/dataBoard-icon3.png')" style="margin-left:10rpx;transform: rotate(180deg);"
  41. v-if="rateType == 1">
  42. </view>
  43. <view class="statistics-b-li-b">环比增长</view>
  44. </view>
  45. </view>
  46. </view>
  47. <view class="table">
  48. <uni-card>
  49. <view style="height: 400px">
  50. <zb-table :cell-style="handleStyle" :columns="column" :stripe="false" :border="false"
  51. :data="dataList"></zb-table>
  52. </view>
  53. </uni-card>
  54. </view>
  55. </view>
  56. </template>
  57. <script>
  58. import {
  59. config
  60. } from '@/api/request/config.js'
  61. import {
  62. reportAppStatisticsWarningHandle
  63. } from '@/pages/api/index.js'
  64. export default {
  65. name: "warningDispose",
  66. components: {
  67. },
  68. data() {
  69. return {
  70. dateList: [],
  71. dateIndex: 6,
  72. deptList: [],
  73. // 查询参数
  74. queryParams: {
  75. page: 1,
  76. pageSize: 10,
  77. },
  78. column: [{
  79. type: 'index',
  80. label: '排行',
  81. fixed: true,
  82. width: 60,
  83. align: 'center',
  84. },
  85. {
  86. name: 'deptSortName',
  87. label: '学院单位',
  88. fixed: true,
  89. width: 80,
  90. align: 'center',
  91. },
  92. {
  93. name: 'handleTotal',
  94. label: '总数',
  95. align: 'center',
  96. },
  97. {
  98. name: 'yesterdayTotal',
  99. label: '昨日',
  100. align: 'center',
  101. },
  102. {
  103. name: 'todayTotal',
  104. label: '今日',
  105. align: 'center',
  106. },
  107. {
  108. name: 'rate',
  109. label: '环比',
  110. align: 'center',
  111. },
  112. ],
  113. dataList: [],
  114. total: 0,
  115. todayTotal: 0,
  116. yesterdayTotal: 0,
  117. rate: 0,
  118. rateType: 0,
  119. }
  120. },
  121. created() {
  122. },
  123. beforeMount() {
  124. },
  125. mounted() {
  126. this.getCurrentDate();
  127. },
  128. methods: {
  129. handleStyle(val) {
  130. if (val.column.name == 'rate') {
  131. console.log('val======>', val.row);
  132. if (val.row.rate.indexOf('-') != -1) {
  133. return {
  134. 'color': '#2EA805',
  135. }
  136. } else if (val.row.rate.indexOf('+') != -1){
  137. return {
  138. 'color': '#FF0000',
  139. }
  140. }else {
  141. return {
  142. 'color': '#FFFFFF',
  143. }
  144. }
  145. }
  146. },
  147. dateClick(index) {
  148. this.dateIndex = index;
  149. this.reportAppStatisticsWarningHandle();
  150. },
  151. getCurrentDate() {
  152. // 获取当前日期和星期
  153. let date = new Date();
  154. let weekdays = ["Sun", "Mon", "Tue", "Wed", "Thur", "Fri", "Sat"];
  155. let weekdaysTow = ["7", "1", "2", "3", "4", "5", "6"];
  156. // 获取星期几的索引
  157. let dayOfWeekIndex = date.getDay();
  158. // 获取当天的日期和星期
  159. let dayOfMonth = date.getDate();
  160. let month = date.getMonth() + 1; // 月份从0开始,需要加1
  161. let year = date.getFullYear();
  162. // 输出当前日期和星期
  163. console.log("Today is " + month + "/" + dayOfMonth + "/" + year + ", " + weekdays[dayOfWeekIndex] + ".");
  164. // 获取接下来一周的每天日期和星期
  165. let nextDays = [];
  166. for (let i = 0; i < 7; i++) {
  167. let nextDate = new Date(date.getTime() - (i * 24 * 60 * 60 * 1000)); // 加上一天的时间差
  168. nextDays.push({
  169. date: nextDate.getDate(),
  170. month: nextDate.getMonth() + 1,
  171. year: nextDate.getFullYear(),
  172. dayOfWeek: weekdays[nextDate.getDay()],
  173. dayOfWeekTow: weekdaysTow[nextDate.getDay()],
  174. });
  175. }
  176. // 输出接下来一周的每天日期和星期
  177. for (let i = 0; i < 7; i++) {
  178. this.dateList.push({
  179. num: nextDays[i].dayOfWeekTow,
  180. letterNUm: nextDays[i].dayOfWeek,
  181. format: nextDays[i].year + "-" + nextDays[i].month + "-" + nextDays[i].date
  182. })
  183. }
  184. this.dateList = this.dateList.reverse();
  185. this.reportAppStatisticsWarningHandle();
  186. },
  187. //预警处置
  188. async reportAppStatisticsWarningHandle(planId) {
  189. let self = this;
  190. const {
  191. data
  192. } = await reportAppStatisticsWarningHandle({
  193. 'date': this.dateList[this.dateIndex].format
  194. });
  195. if (data.code == 200) {
  196. this.deptList = data.data.warningList;
  197. this.dataList = data.data.warningScatterList;
  198. this.$set(self, 'todayTotal', data.data.warning.todayTotal);
  199. this.$set(self, 'yesterdayTotal', data.data.warning.yesterdayTotal);
  200. if (data.data.warning.rate.indexOf('-') != -1) {
  201. this.$set(self, 'rateType', 1);
  202. } else if (data.data.warning.rate.indexOf('+') != -1) {
  203. this.$set(self, 'rateType', 2);
  204. } else {
  205. this.$set(self, 'rateType', 0);
  206. }
  207. this.$set(self, 'rate', data.data.warning.rate);
  208. }
  209. },
  210. },
  211. }
  212. </script>
  213. <style lang="stylus" scoped>
  214. .warningDispose {
  215. height: 100%;
  216. width: 100%;
  217. background: #363744;
  218. padding: 20rpx 0rpx 36rpx;
  219. box-sizing: border-box;
  220. .chart {
  221. width: 750rpx;
  222. height: 500rpx;
  223. position: relative;
  224. .chart-bg {
  225. width: 750rpx;
  226. height: 500rpx;
  227. position: absolute;
  228. z-index: 100;
  229. }
  230. .chart-n {
  231. padding: 34rpx 0rpx 26rpx;
  232. box-sizing: border-box;
  233. position: absolute;
  234. z-index: 200;
  235. .chart-t {
  236. display: flex;
  237. justify-content: space-between;
  238. margin: 0 50rpx;
  239. width: 650rpx;
  240. .chart-t-li {
  241. width: 76rpx;
  242. height: 100rpx;
  243. .chart-t-li-t {
  244. font-weight: 400;
  245. font-size: 30rpx;
  246. line-height: 42rpx;
  247. text-align: center;
  248. margin-top: 8rpx;
  249. }
  250. .chart-t-li-b {
  251. font-weight: 400;
  252. font-size: 28rpx;
  253. line-height: 39rpx;
  254. text-align: center;
  255. margin-top: 4rpx;
  256. }
  257. }
  258. .color-A {
  259. background: #0183FA;
  260. border-radius: 10rpx 10rpx 10rpx 10rpx;
  261. .chart-t-li-t {
  262. color: #FFFFFF;
  263. }
  264. .chart-t-li-b {
  265. color: #FFFFFF;
  266. }
  267. }
  268. .color-B {
  269. background: none;
  270. .chart-t-li-t {
  271. color: #FFFFFF;
  272. }
  273. .chart-t-li-b {
  274. color: #FFFFFF;
  275. }
  276. }
  277. }
  278. .chart-b {
  279. width: 690rpx;
  280. height: 350rpx;
  281. position: absolute;
  282. .chart-b-li {
  283. position: absolute;
  284. z-index: 300;
  285. width: 200rpx;
  286. height: 46rpx;
  287. >img {
  288. width: 200rpx;
  289. height: 46rpx;
  290. position: absolute;
  291. z-index: 400;
  292. }
  293. >view {
  294. padding-left: 16rpx;
  295. box-sizing: border-box;
  296. width: 200rpx;
  297. height: 46rpx;
  298. position: absolute;
  299. z-index: 500;
  300. font-weight: 400;
  301. font-size: 24rpx;
  302. color: #FFFFFF;
  303. line-height: 46rpx;
  304. text-align: left;
  305. }
  306. }
  307. .chart-b-li:nth-child(1) {
  308. top: 20rpx;
  309. left: 30rpx;
  310. }
  311. .chart-b-li:nth-child(2) {
  312. top: 20rpx;
  313. left: 260rpx;
  314. }
  315. .chart-b-li:nth-child(3) {
  316. top: 20rpx;
  317. left: 490rpx;
  318. }
  319. .chart-b-li:nth-child(4) {
  320. top: 80rpx;
  321. left: 30rpx;
  322. }
  323. .chart-b-li:nth-child(5) {
  324. top: 80rpx;
  325. left: 260rpx;
  326. }
  327. .chart-b-li:nth-child(6) {
  328. top: 80rpx;
  329. left: 490rpx;
  330. }
  331. .chart-b-li:nth-child(7) {
  332. top: 140rpx;
  333. left: 30rpx;
  334. }
  335. .chart-b-li:nth-child(8) {
  336. top: 140rpx;
  337. left: 260rpx;
  338. }
  339. .chart-b-li:nth-child(9) {
  340. top: 140rpx;
  341. left: 490rpx;
  342. }
  343. .chart-b-li:nth-child(10) {
  344. top: 200rpx;
  345. left: 30rpx;
  346. }
  347. .chart-b-li:nth-child(11) {
  348. top: 200rpx;
  349. left: 260rpx;
  350. }
  351. .chart-b-li:nth-child(12) {
  352. top: 200rpx;
  353. left: 490rpx;
  354. }
  355. .chart-b-li:nth-child(13) {
  356. top: 260rpx;
  357. left: 30rpx;
  358. }
  359. .chart-b-li:nth-child(14) {
  360. top: 260rpx;
  361. left: 260rpx;
  362. }
  363. .chart-b-li:nth-child(15) {
  364. top: 260rpx;
  365. left: 490rpx;
  366. }
  367. .chart-b-li:nth-child(16) {
  368. top: 320rpx;
  369. left: 30rpx;
  370. }
  371. .chart-b-li:nth-child(17) {
  372. top: 320rpx;
  373. left: 260rpx;
  374. }
  375. .chart-b-li:nth-child(18) {
  376. top: 320rpx;
  377. left: 490rpx;
  378. }
  379. .chart-b-li:nth-child(19) {
  380. top: 380rpx;
  381. left: 30rpx;
  382. }
  383. .chart-b-li:nth-child(20) {
  384. top: 380rpx;
  385. left: 260rpx;
  386. }
  387. .chart-b-li:nth-child(21) {
  388. top: 380rpx;
  389. left: 490rpx;
  390. }
  391. }
  392. }
  393. }
  394. .statistics {
  395. width: 750rpx;
  396. height: 120rpx;
  397. background: #3E414F;
  398. .statistics-b {
  399. display: flex;
  400. justify-content: space-between;
  401. align-items: center;
  402. .statistics-b-li {
  403. flex: 1;
  404. text-align: center;
  405. .statistics-b-li-t {
  406. font-weight: 400;
  407. font-size: 36rpx;
  408. color: #FFFFFF;
  409. line-height: 50rpx;
  410. margin-top: 10rpx;
  411. }
  412. .statistics-b-li-t-tow {
  413. margin-top: 10rpx;
  414. display: flex;
  415. justify-content: center;
  416. align-items: center;
  417. >text {
  418. font-weight: 400;
  419. font-size: 28rpx;
  420. line-height: 50rpx;
  421. }
  422. >img {
  423. width: 22rpx;
  424. height: 28rpx;
  425. }
  426. }
  427. .color-A {
  428. color: #FF0000;
  429. }
  430. .color-B {
  431. color: #2EA805;
  432. }
  433. .color-C {
  434. color: #FFFFFF;
  435. }
  436. .statistics-b-li-b {
  437. font-weight: 400;
  438. font-size: 24rpx;
  439. color: #FFFFFF;
  440. line-height: 34rpx;
  441. margin-top: 9rpx;
  442. }
  443. }
  444. .line {
  445. width: 2rpx;
  446. height: 30rpx;
  447. background: #D8D8D8;
  448. }
  449. }
  450. }
  451. .table {
  452. width: 690rpx;
  453. margin-top: 20rpx;
  454. border-radius: 20rpx 20rpx 0 0;
  455. overflow: hidden;
  456. margin-left: 30rpx;
  457. }
  458. }
  459. </style>