warningDispose.vue 8.7 KB

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