earlyWarningList.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429
  1. <!-- 安全检查-校院巡查管理 -->
  2. <template>
  3. <view id="earlyWarning">
  4. <view class="top-picker-max-box">
  5. <view class="top-picker-box">
  6. <picker @change="facultyChange" :value="facultyIndex" :range="facultyArray">
  7. <view class="picker-view">
  8. <view class="picker-view-l">{{!facultyIndex?'学院':facultyArray[facultyIndex]}}</view>
  9. <img class="picker-img" src="@/pages_manage/images/icon_06.png" alt="">
  10. </view>
  11. </picker>
  12. </view>
  13. <view class="top-picker-box">
  14. <picker mode="date" @change="startChange($event)">
  15. <view class="picker-view">
  16. <view class="picker-view-l">{{!getData.startTime?'开始时间':getData.startTime}}</view>
  17. <img class="picker-img" src="@/pages_manage/images/icon_06.png" alt="">
  18. </view>
  19. </picker>
  20. </view>
  21. <view class="top-picker-box">
  22. <picker mode="date" @change="endChange($event)">
  23. <view class="picker-view">
  24. <view class="picker-view-l">{{!getData.endTime?'结束时间':getData.endTime}}</view>
  25. <img class="picker-img" src="@/pages_manage/images/icon_06.png" alt="">
  26. </view>
  27. </picker>
  28. </view>
  29. </view>
  30. <scroll-view scroll-y @scrolltolower="scrollGet" class="info-max-box">
  31. <viw class="list" v-for="(item,index) in dataList" :key="index">
  32. <view class="list_t">{{item[0].createDate}}</view>
  33. <view class="list_li" v-for="(item2,index2) in item" :key="index2" @click="handleClick(item2,'detail')">
  34. <view class="list_li_t">
  35. <view class="list_li_t_l"></view>
  36. <view class="list_li_t_c orange_color" v-if="item2.warningType==1">算法识别</view>
  37. <view class="list_li_t_c yellow_color" v-if="item2.warningType==2">化学品</view>
  38. <view class="list_li_t_c yellow_color" v-if="item2.warningType==3">气瓶</view>
  39. <view class="list_li_t_c red_color" v-if="item2.warningType==4">预案</view>
  40. <view class="list_li_t_c2">{{item2.warningContent}}</view>
  41. <view class="list_li_t_c3" v-if="item2.warningType==3">{{item2.dispose==0?'待处理':'已处理'}}</view>
  42. <view class="list_li_t_r"></view>
  43. </view>
  44. <view class="list_li_b">
  45. <view class="list_li_b_t">
  46. <text>{{item2.subName}}</text>
  47. <text>{{item2.warningTime.split(' ')[1]}}</text>
  48. </view>
  49. <view class="list_li_b_b">
  50. <img src="@/images/Version2.2/icon_wtzg_xx.png"/>
  51. <text>{{item2.buildName}}-{{item2.floorName}}{{item2.roomNum}}</text>
  52. </view>
  53. </view>
  54. </view>
  55. </viw>
  56. <img class="null-img" v-if="!dataList[0]" src="@/images/null-data-1.png">
  57. </scroll-view>
  58. </view>
  59. </template>
  60. <script>
  61. import { config } from '@/api/request/config.js'
  62. import {checkManageList,conditionCollegeInfo,warningNoticeLogList,listDepartments} from '@/api/index.js'
  63. export default {
  64. name: "earlyWarning",
  65. components: {
  66. },
  67. data() {
  68. return {
  69. //列表请求参数
  70. getData:{
  71. pageNum:1,
  72. pageSize:10,
  73. startTime:'',
  74. endTime:'',
  75. searchValue:'',
  76. },
  77. dataList:[],
  78. dataArr:[],//临时存储
  79. total:0,
  80. timeStatus:false,//判断是否超过当前时间30分钟
  81. //院系选择器数据
  82. facultyList:[],
  83. facultyArray:[],
  84. facultyIndex:"",
  85. }
  86. },
  87. onLoad(option) {
  88. },
  89. onShow() {
  90. },
  91. mounted(){
  92. this.listDepartments();
  93. this.getList();
  94. },
  95. methods: {
  96. //滚动事件
  97. scrollGet(){
  98. let self=this;
  99. if(self.total/self.getData.pageSize<=self.getData.pageNum){
  100. console.log('没有更多数据!')
  101. }else{
  102. setTimeout(function(){
  103. self.getData.pageNum += 1;
  104. self.getList();
  105. },1000)
  106. }
  107. },
  108. //获取院系
  109. async listDepartments(){
  110. const {data} = await listDepartments();
  111. if(data.code == 200){
  112. let list = [];
  113. for(let i=0;i<data.data.length;i++){
  114. list.push(data.data[i].deptName)
  115. }
  116. this.facultyArray = list;
  117. list.unshift('全部院系');
  118. this.facultyList = data.data;
  119. this.facultyList.unshift({deptName:"全部院系", deptId:""})
  120. }
  121. },
  122. //学院选中
  123. facultyChange: function(e) {
  124. if(this.facultyArray[0]){
  125. this.facultyIndex = parseInt(e.target.value);
  126. this.getData.collegeId=this.facultyList[e.target.value].deptId;
  127. this.getList()
  128. }
  129. },
  130. //开始时间选中事件
  131. startChange(e){
  132. if(new Date(e.target.value).getTime()>=new Date(this.getData.endTime).getTime()){
  133. uni.showToast({
  134. title: '结束时间不能小于开始时间',
  135. icon:"none",
  136. mask:true,
  137. duration: 2000
  138. });
  139. }else{
  140. this.getData.startTime=e.target.value
  141. }
  142. },
  143. //结束时间选中事件
  144. endChange(e){
  145. if(new Date(this.getData.startTime).getTime()>=new Date(e.target.value).getTime()){
  146. uni.showToast({
  147. title: '结束时间不能小于开始时间',
  148. icon:"none",
  149. mask:true,
  150. duration: 2000
  151. });
  152. }else{
  153. this.getData.endTime=e.target.value
  154. this.getList()
  155. }
  156. },
  157. handleClick(row,doType){
  158. let self=this;
  159. if( doType=='detail'){//详情
  160. uni.navigateTo({
  161. url: '/pages/earlyWarningManage/earlyWarningDetail?warningId='+row.id,//安全警报
  162. });
  163. }
  164. },
  165. //排序
  166. sortClass(sortData){
  167. const groupBy = (array, f) => {
  168. let groups = {};
  169. array.forEach((o) => {
  170. let group = JSON.stringify(f(o));
  171. groups[group] = groups[group] || [];
  172. groups[group].push(o);
  173. });
  174. return Object.keys(groups).map((group) => {
  175. return groups[group];
  176. });
  177. };
  178. const sorted = groupBy(sortData, (item) => {
  179. return item.createDate; // 返回需要分组的对象
  180. });
  181. return sorted;
  182. },
  183. async getList(){
  184. let self = this;
  185. const {data} = await warningNoticeLogList(this.getData);
  186. if(data.code==200){
  187. this.dataArr=[...this.dataArr,...data.data.records]
  188. this.dataList=this.sortClass(this.dataArr)
  189. console.log(this.dataList)
  190. this.total=data.data.total;
  191. }
  192. },
  193. }
  194. }
  195. </script>
  196. <style lang="stylus" scoped>
  197. #earlyWarning{
  198. height: 100%;
  199. width: 100%;
  200. flex :1;
  201. display flex;
  202. flex-direction column
  203. overflow hidden;
  204. .red_color{
  205. color: #D40000;
  206. border: 1rpx solid #D40000;
  207. }
  208. .orange_color{
  209. color: #FF4800;
  210. border: 1rpx solid #FF4800;
  211. }
  212. .yellow_color{
  213. color: #FFA34E;
  214. border: 1rpx solid #FFA34E;
  215. }
  216. .null-img{
  217. display block
  218. width:276rpx;
  219. height:321rpx;
  220. margin:100rpx 0 0 274rpx;
  221. }
  222. .top-picker-max-box{
  223. display:flex;
  224. padding:0 20rpx;
  225. background #fff
  226. border-bottom:1rpx solid #E0E0E0;
  227. .top-picker-box{
  228. line-height:80rpx;
  229. height:80rpx;
  230. .picker-view{
  231. display flex;
  232. .picker-view-l{
  233. display:block;
  234. overflow:hidden;
  235. text-overflow:ellipsis;
  236. white-space:nowrap;
  237. font-size:28rpx;
  238. }
  239. .picker-img{
  240. width:24rpx;
  241. height:13rpx;
  242. margin-top:36rpx;
  243. margin-left:13rpx;
  244. }
  245. }
  246. }
  247. .top-picker-box:nth-child(1){
  248. text-align left;
  249. width:320rpx;
  250. .picker-view{
  251. .picker-view-l{
  252. max-width:260rpx;
  253. }
  254. }
  255. }
  256. .top-picker-box:nth-child(2){
  257. text-align left;
  258. width:215rpx;
  259. .picker-view{
  260. .picker-view-l{
  261. max-width:156rpx;
  262. }
  263. }
  264. }
  265. .top-picker-box:nth-child(3){
  266. text-align right;
  267. width:195rpx;
  268. .picker-view{
  269. .picker-view-l{
  270. flex:1;
  271. }
  272. }
  273. }
  274. }
  275. .list{
  276. .list_t{
  277. height: 80rpx;
  278. font-size: 30rpx;
  279. font-family: PingFang SC-Medium, PingFang SC;
  280. font-weight: 400;
  281. color: #666666;
  282. line-height: 80rpx;
  283. }
  284. .list_li{
  285. width: 690rpx;
  286. height:auto;
  287. background: #FFFFFF;
  288. border-radius: 10rpx;
  289. padding-bottom: 52rpx;
  290. box-sizing: border-box;
  291. margin-bottom: 20rpx;
  292. .list_li_t{
  293. position: relative;
  294. height: 110rpx;
  295. display: flex;
  296. justify-content: flex-start;
  297. align-items: center;
  298. .list_li_t_l{
  299. position: absolute;
  300. left:-15rpx;
  301. top: 76rpx;
  302. width: 30rpx;
  303. height: 30rpx;
  304. background:#F5F5F5;
  305. border-radius: 15rpx;
  306. }
  307. .list_li_t_c{
  308. height: 40rpx;
  309. font-size: 30rpx;
  310. font-family: PingFang SC-Medium, PingFang SC;
  311. font-weight: 400;
  312. line-height: 36rpx;
  313. margin-left: 30rpx;
  314. margin-right: 20rpx;
  315. border-radius: 20rpx;
  316. padding: 0 20rpx;
  317. box-sizing: border-box;
  318. }
  319. .list_li_t_c2{
  320. font-size: 30rpx;
  321. font-family: PingFang SC-Medium, PingFang SC;
  322. font-weight: 400;
  323. color: #333333;
  324. line-height: 30rpx;
  325. white-space: nowrap;
  326. overflow: hidden;
  327. text-overflow: ellipsis;
  328. flex: 1;
  329. }
  330. .list_li_t_c3{
  331. font-size: 30rpx;
  332. font-family: PingFang SC-Medium, PingFang SC;
  333. font-weight: 400;
  334. color: #333333;
  335. line-height: 30rpx;
  336. white-space: nowrap;
  337. overflow: hidden;
  338. text-overflow: ellipsis;
  339. width: 140rpx;
  340. text-align: right;
  341. padding-right: 30rpx;
  342. box-sizing: border-box;
  343. }
  344. .list_li_t_r{
  345. position: absolute;
  346. right:-15rpx;
  347. top: 76rpx;
  348. width: 30rpx;
  349. height: 30rpx;
  350. background:#F5F5F5;
  351. border-radius: 15rpx;
  352. }
  353. }
  354. .list_li_b{
  355. margin: 0 30rpx;
  356. border-top: 1rpx dotted #D8D8D8;
  357. .list_li_b_t{
  358. display: flex;
  359. justify-content: space-between;
  360. margin-top:28rpx;
  361. >text:nth-of-type(1){
  362. font-size: 30rpx;
  363. font-family: PingFang SC-Medium, PingFang SC;
  364. font-weight: 400;
  365. color: #333333;
  366. line-height: 30rpx;
  367. }
  368. >text:nth-of-type(2){
  369. font-size: 30rpx;
  370. font-family: PingFang SC-Medium, PingFang SC;
  371. font-weight: 400;
  372. color: #666666;
  373. line-height: 30rpx;
  374. }
  375. }
  376. .list_li_b_b{
  377. display: flex;
  378. justify-content: flex-start;
  379. margin-top:30rpx;
  380. >img{
  381. width: 30rpx;
  382. height: 30rpx;
  383. margin-right: 22rpx;
  384. }
  385. >text{
  386. font-size: 28rpx;
  387. font-family: PingFang SC-Medium, PingFang SC;
  388. font-weight: 400;
  389. color: #666666;
  390. line-height: 28rpx;
  391. white-space: nowrap;
  392. overflow: hidden;
  393. text-overflow: ellipsis;
  394. flex: 1;
  395. }
  396. }
  397. }
  398. }
  399. }
  400. .info-max-box{
  401. flex: 1;
  402. overflow: scroll;
  403. padding: 0 30rpx;
  404. box-sizing: border-box;
  405. }
  406. }
  407. </style>