earlyWarningList.vue 9.7 KB

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