earlyWarningList.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  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.appCreateTime}}</view>
  7. <view class="list_li" v-for="(item2,index2) in item.list" :key="index2" @click="handleClick(item2)">
  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.warnType==1">化学品</view>
  11. <view class="list_li_t_c yellow_color_one" v-if="item2.warnType==2">气瓶</view>
  12. <view class="list_li_t_c yellow_color" v-if="item2.warnType==3">算法识别</view>
  13. <view class="list_li_t_c red_color" v-if="item2.warnType==4">预案</view>
  14. <view class="list_li_t_c2" v-if="item2.warnType == 1">
  15. {{item2.chemicalWarnType == 1?'化学品违规带离':
  16. (item2.chemicalWarnType == 2?'化学品超时未归还':
  17. (item2.chemicalWarnType == 3?'化学品过期':
  18. (item2.chemicalWarnType == 4?'化学品即将过期':
  19. (item2.chemicalWarnType == 5?'化学品超期未入库':
  20. (item2.chemicalWarnType == 6?'化学品业务操作超时':
  21. '')))))}}
  22. </view>
  23. <view class="list_li_t_c2" v-else>{{item2.warnContent}}</view>
  24. <view class="list_li_t_r"></view>
  25. </view>
  26. <view class="list_li_b">
  27. <view class="list_li_b_t">
  28. <text>{{item2.subName}}</text>
  29. <text>{{item2.appTimeDivision}}</text>
  30. </view>
  31. <view class="list_li_b_b">
  32. <img src="@/pages_basics/images/icon_wtzg_xx.png" />
  33. <text>{{item2.buildName}}-{{item2.floorName}}{{item2.roomNum}}</text>
  34. </view>
  35. </view>
  36. </view>
  37. </viw>
  38. <view class="get-data-null-p" v-if="getDataType">- 没有更多数据 -</view>
  39. </scroll-view>
  40. </view>
  41. </template>
  42. <script>
  43. import {
  44. systemMineWarningNoticeList
  45. } from '@/pages_basics/api/index.js'
  46. export default {
  47. name: "rectifyList",
  48. components: {
  49. },
  50. data() {
  51. return {
  52. // 查询参数
  53. queryParams: {
  54. page: 1,
  55. pageSize: 4,
  56. },
  57. dataList: [],
  58. dataArr: [], //临时存储
  59. total: 0,
  60. timeStatus: false, //判断是否超过当前时间30分钟
  61. getDataType: false,
  62. }
  63. },
  64. onLoad(option) {
  65. },
  66. onShow() {
  67. },
  68. mounted() {
  69. this.getList();
  70. },
  71. methods: {
  72. //滚动加载事件
  73. scrollGet() {
  74. if (this.total / this.queryParams.pageSize <= this.queryParams.page) {
  75. this.$set(this, 'getDataType', true);
  76. } else {
  77. this.queryParams.page += 1;
  78. this.$nextTick(() => {
  79. this.getList();
  80. })
  81. }
  82. },
  83. handleClick(item) {
  84. if(item.warnType != 4){
  85. uni.navigateTo({
  86. url: '/pages_basics/views/earlyWarningManage/earlyWarningDetail?noticeId='+item.noticeId, //安全警报
  87. });
  88. }else{
  89. uni.navigateTo({
  90. url: '/pages_basics/views/earlyWarningManage/earlyWarningDetail?eventId='+item.chemicalWarnInfo, //安全警报
  91. });
  92. }
  93. },
  94. //排序
  95. sortClass(sortData) {
  96. const groupBy = (array, f) => {
  97. let groups = {};
  98. array.forEach((o) => {
  99. let group = JSON.stringify(f(o));
  100. groups[group] = groups[group] || [];
  101. groups[group].push(o);
  102. });
  103. return Object.keys(groups).map((group) => {
  104. return groups[group];
  105. });
  106. };
  107. const sorted = groupBy(sortData, (item) => {
  108. return item.createDate; // 返回需要分组的对象
  109. });
  110. return sorted;
  111. },
  112. async getList() {
  113. const {
  114. data
  115. } = await systemMineWarningNoticeList(this.queryParams);
  116. if (data.code == 200) {
  117. let list = JSON.parse(JSON.stringify(this.dataList));
  118. data.data.records.forEach((item) => {
  119. let num = 0;
  120. list.forEach((minItem) => {
  121. if (item.appCreateTime == minItem.appCreateTime) {
  122. num++
  123. minItem.list.push(item)
  124. }
  125. })
  126. if (num == 0) {
  127. list.push({
  128. appCreateTime: item.appCreateTime,
  129. list: [item]
  130. })
  131. }
  132. })
  133. this.$set(this, 'dataList', list);
  134. this.$set(this, 'total', data.data.total);
  135. if (data.data.total / this.queryParams.pageSize <= this.queryParams.page) {
  136. this.$set(this, 'getDataType', true);
  137. }
  138. }
  139. },
  140. }
  141. }
  142. </script>
  143. <style lang="stylus" scoped>
  144. .earlyWarning {
  145. height: 100%;
  146. display flex;
  147. flex-direction column;
  148. padding: 0 30rpx 30rpx;
  149. box-sizing: border-box;
  150. .red_color {
  151. color: #D40000;
  152. border: 1rpx solid #D40000;
  153. }
  154. .orange_color {
  155. color: #FF4800;
  156. border: 1rpx solid #FF4800;
  157. }
  158. .yellow_color {
  159. color: #FFA34E;
  160. border: 1rpx solid #FFA34E;
  161. }
  162. .yellow_color_one {
  163. color: #bc8f8f;
  164. border: 1rpx solid #bc8f8f;
  165. }
  166. .get-data-null-p {
  167. text-align: center;
  168. line-height: 40rpx;
  169. padding-bottom: 40px;
  170. color: #999;
  171. }
  172. .list {
  173. .list_t {
  174. height: 80rpx;
  175. font-size: 30rpx;
  176. font-family: PingFang SC-Medium, PingFang SC;
  177. font-weight: 400;
  178. color: #666666;
  179. line-height: 80rpx;
  180. }
  181. .list_li {
  182. width: 690rpx;
  183. height: auto;
  184. background: #FFFFFF;
  185. border-radius: 10rpx;
  186. padding-bottom: 52rpx;
  187. box-sizing: border-box;
  188. margin-bottom: 20rpx;
  189. .list_li_t {
  190. position: relative;
  191. height: 110rpx;
  192. display: flex;
  193. justify-content: flex-start;
  194. align-items: center;
  195. .list_li_t_l {
  196. position: absolute;
  197. left: -15rpx;
  198. top: 76rpx;
  199. width: 30rpx;
  200. height: 30rpx;
  201. background: #F5F5F5;
  202. border-radius: 15rpx;
  203. }
  204. .list_li_t_c {
  205. height: 40rpx;
  206. font-size: 30rpx;
  207. font-family: PingFang SC-Medium, PingFang SC;
  208. font-weight: 400;
  209. line-height: 36rpx;
  210. margin-left: 30rpx;
  211. margin-right: 20rpx;
  212. border-radius: 20rpx;
  213. padding: 0 20rpx;
  214. box-sizing: border-box;
  215. }
  216. .list_li_t_c2 {
  217. font-size: 30rpx;
  218. font-family: PingFang SC-Medium, PingFang SC;
  219. font-weight: 400;
  220. color: #333333;
  221. line-height: 30rpx;
  222. white-space: nowrap;
  223. overflow: hidden;
  224. text-overflow: ellipsis;
  225. flex: 1;
  226. }
  227. .list_li_t_r {
  228. position: absolute;
  229. right: -15rpx;
  230. top: 76rpx;
  231. width: 30rpx;
  232. height: 30rpx;
  233. background: #F5F5F5;
  234. border-radius: 15rpx;
  235. }
  236. }
  237. .list_li_b {
  238. margin: 0 30rpx;
  239. border-top: 1rpx dotted #D8D8D8;
  240. .list_li_b_t {
  241. display: flex;
  242. justify-content: space-between;
  243. margin-top: 28rpx;
  244. >text:nth-of-type(1) {
  245. font-size: 30rpx;
  246. font-family: PingFang SC-Medium, PingFang SC;
  247. font-weight: 400;
  248. color: #333333;
  249. line-height: 30rpx;
  250. }
  251. >text:nth-of-type(2) {
  252. font-size: 30rpx;
  253. font-family: PingFang SC-Medium, PingFang SC;
  254. font-weight: 400;
  255. color: #666666;
  256. line-height: 30rpx;
  257. }
  258. }
  259. .list_li_b_b {
  260. display: flex;
  261. justify-content: flex-start;
  262. margin-top: 30rpx;
  263. >img {
  264. width: 30rpx;
  265. height: 30rpx;
  266. margin-right: 22rpx;
  267. }
  268. >text {
  269. font-size: 28rpx;
  270. font-family: PingFang SC-Medium, PingFang SC;
  271. font-weight: 400;
  272. color: #666666;
  273. line-height: 28rpx;
  274. white-space: nowrap;
  275. overflow: hidden;
  276. text-overflow: ellipsis;
  277. flex: 1;
  278. }
  279. }
  280. }
  281. }
  282. }
  283. .info-max-box {
  284. flex: 1;
  285. overflow-y scroll;
  286. }
  287. }
  288. </style>