earlyWarningList.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. <!-- 安全检查-校院巡查管理 -->
  2. <template>
  3. <view class="earlyWarning">
  4. <scroll-view scroll-y @scrolltolower="scrollGet" class="info-max-box">
  5. <viw class="list" v-for="(item,index) in dataList" :key="index">
  6. <view class="list_t">{{item[0].createDate}}</view>
  7. <view class="list_li" v-for="(item2,index2) in item" :key="index2" @click="handleClick(item2,'detail')">
  8. <view class="list_li_t">
  9. <view class="list_li_t_l"></view>
  10. <view class="list_li_t_c orange_color" v-if="item2.warningType==1">算法识别</view>
  11. <view class="list_li_t_c yellow_color" v-if="item2.warningType==2">化学品</view>
  12. <view class="list_li_t_c yellow_color" v-if="item2.warningType==3">气瓶</view>
  13. <view class="list_li_t_c red_color" v-if="item2.warningType==4">预案</view>
  14. <view class="list_li_t_c2">{{item2.warningContent}}</view>
  15. <view class="list_li_t_r"></view>
  16. </view>
  17. <view class="list_li_b">
  18. <view class="list_li_b_t">
  19. <text>{{item2.subName}}</text>
  20. <text>{{item2.warningTime.split(' ')[1]}}</text>
  21. </view>
  22. <view class="list_li_b_b">
  23. <img src="@/images/basicsModules/icon_wtzg_xx.png"/>
  24. <text>{{item2.buildName}}-{{item2.floorName}}{{item2.roomNum}}</text>
  25. </view>
  26. </view>
  27. </view>
  28. </viw>
  29. <img class="null-img" v-if="!dataList[0]" src="@/images/basicsModules/null-data-1.png">
  30. </scroll-view>
  31. </view>
  32. </template>
  33. <script>
  34. import { config } from '@/api/request/config.js'
  35. import {warningNoticeLogList} from '@/api/apiDemo/index.js'
  36. export default {
  37. name: "rectifyList",
  38. components: {
  39. },
  40. data() {
  41. return {
  42. //列表请求参数
  43. getData:{
  44. pageNum:1,
  45. pageSize:10,
  46. },
  47. dataList:[],
  48. dataArr:[],//临时存储
  49. total:0,
  50. timeStatus:false,//判断是否超过当前时间30分钟
  51. }
  52. },
  53. onLoad(option) {
  54. },
  55. onShow() {
  56. },
  57. mounted(){
  58. this.getList();
  59. },
  60. methods: {
  61. //滚动事件
  62. scrollGet(){
  63. let self=this;
  64. if(self.total/self.getData.pageSize<=self.getData.pageNum){
  65. console.log('没有更多数据!')
  66. }else{
  67. setTimeout(function(){
  68. self.getData.pageNum += 1;
  69. self.getList();
  70. },1000)
  71. }
  72. },
  73. handleClick(row,doType){
  74. let self=this;
  75. if( doType=='detail'){//详情
  76. uni.navigateTo({
  77. url: '/page_basics/earlyWarningManage/earlyWarningDetail?warningId='+row.id,//安全警报
  78. });
  79. }
  80. },
  81. //排序
  82. sortClass(sortData){
  83. const groupBy = (array, f) => {
  84. let groups = {};
  85. array.forEach((o) => {
  86. let group = JSON.stringify(f(o));
  87. groups[group] = groups[group] || [];
  88. groups[group].push(o);
  89. });
  90. return Object.keys(groups).map((group) => {
  91. return groups[group];
  92. });
  93. };
  94. const sorted = groupBy(sortData, (item) => {
  95. return item.createDate; // 返回需要分组的对象
  96. });
  97. return sorted;
  98. },
  99. async getList(){
  100. let self = this;
  101. const {data} = await warningNoticeLogList(this.getData);
  102. if(data.code==200){
  103. this.dataArr=[...this.dataArr,...data.data.records]
  104. this.dataList=this.sortClass(this.dataArr)
  105. console.log(this.dataList)
  106. this.total=data.data.total;
  107. }
  108. },
  109. }
  110. }
  111. </script>
  112. <style lang="stylus" scoped>
  113. .earlyWarning{
  114. height:100%;
  115. display flex;
  116. padding: 0 30rpx;
  117. box-sizing: border-box;
  118. .red_color{
  119. color: #D40000;
  120. border: 1rpx solid #D40000;
  121. }
  122. .orange_color{
  123. color: #FF4800;
  124. border: 1rpx solid #FF4800;
  125. }
  126. .yellow_color{
  127. color: #FFA34E;
  128. border: 1rpx solid #FFA34E;
  129. }
  130. .null-img{
  131. display block
  132. width:276rpx;
  133. height:321rpx;
  134. margin:100rpx 0 0 274rpx;
  135. }
  136. .list{
  137. .list_t{
  138. height: 80rpx;
  139. font-size: 30rpx;
  140. font-family: PingFang SC-Medium, PingFang SC;
  141. font-weight: 400;
  142. color: #666666;
  143. line-height: 80rpx;
  144. }
  145. .list_li{
  146. width: 690rpx;
  147. height:auto;
  148. background: #FFFFFF;
  149. border-radius: 10rpx;
  150. padding-bottom: 52rpx;
  151. box-sizing: border-box;
  152. margin-bottom: 20rpx;
  153. .list_li_t{
  154. position: relative;
  155. height: 110rpx;
  156. display: flex;
  157. justify-content: flex-start;
  158. align-items: center;
  159. .list_li_t_l{
  160. position: absolute;
  161. left:-15rpx;
  162. top: 76rpx;
  163. width: 30rpx;
  164. height: 30rpx;
  165. background:#F5F5F5;
  166. border-radius: 15rpx;
  167. }
  168. .list_li_t_c{
  169. height: 40rpx;
  170. font-size: 30rpx;
  171. font-family: PingFang SC-Medium, PingFang SC;
  172. font-weight: 400;
  173. line-height: 36rpx;
  174. margin-left: 30rpx;
  175. margin-right: 20rpx;
  176. border-radius: 20rpx;
  177. padding: 0 20rpx;
  178. box-sizing: border-box;
  179. }
  180. .list_li_t_c2{
  181. font-size: 30rpx;
  182. font-family: PingFang SC-Medium, PingFang SC;
  183. font-weight: 400;
  184. color: #333333;
  185. line-height: 30rpx;
  186. white-space: nowrap;
  187. overflow: hidden;
  188. text-overflow: ellipsis;
  189. flex: 1;
  190. }
  191. .list_li_t_r{
  192. position: absolute;
  193. right:-15rpx;
  194. top: 76rpx;
  195. width: 30rpx;
  196. height: 30rpx;
  197. background:#F5F5F5;
  198. border-radius: 15rpx;
  199. }
  200. }
  201. .list_li_b{
  202. margin: 0 30rpx;
  203. border-top: 1rpx dotted #D8D8D8;
  204. .list_li_b_t{
  205. display: flex;
  206. justify-content: space-between;
  207. margin-top:28rpx;
  208. >text:nth-of-type(1){
  209. font-size: 30rpx;
  210. font-family: PingFang SC-Medium, PingFang SC;
  211. font-weight: 400;
  212. color: #333333;
  213. line-height: 30rpx;
  214. }
  215. >text:nth-of-type(2){
  216. font-size: 30rpx;
  217. font-family: PingFang SC-Medium, PingFang SC;
  218. font-weight: 400;
  219. color: #666666;
  220. line-height: 30rpx;
  221. }
  222. }
  223. .list_li_b_b{
  224. display: flex;
  225. justify-content: flex-start;
  226. margin-top:30rpx;
  227. >img{
  228. width: 30rpx;
  229. height: 30rpx;
  230. margin-right: 22rpx;
  231. }
  232. >text{
  233. font-size: 28rpx;
  234. font-family: PingFang SC-Medium, PingFang SC;
  235. font-weight: 400;
  236. color: #666666;
  237. line-height: 28rpx;
  238. white-space: nowrap;
  239. overflow: hidden;
  240. text-overflow: ellipsis;
  241. flex: 1;
  242. }
  243. }
  244. }
  245. }
  246. }
  247. .info-max-box{
  248. flex: 1;
  249. overflow: scroll;
  250. }
  251. }
  252. </style>