securityAlertList.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  1. <template>
  2. <view id="securityAlertList">
  3. <scroll-view scroll-y @scrolltolower="scrollGet" class="for-max-box">
  4. <view class="for-box" v-for="(item,index) in infoList" :key="index">
  5. <view class="title-box">
  6. <view :style="'border:1rpx solid '+item.subDiyVo.fiedColor+';background:#fff;color:'+item.subDiyVo.fiedColor+';'">{{item.subDiyVo.levelName}}</view>
  7. <view>{{item.subDiyVo.name}}</view>
  8. <view v-if="item.groupStatus==1">进行中</view>
  9. </view>
  10. <view class="address-box"><span>{{item.subDiyVo.typeName}}</span>{{item.subDiyVo.deptName}}</view>
  11. <view class="address-box-two">
  12. <img src="@/images/icon_14.png">
  13. <view>{{item.subDiyVo.subAddrrStr}}</view>
  14. </view>
  15. <view class="time-box">
  16. <img src="@/images/icon_aqbj_sj.png">
  17. <view>{{item.beginDate}}</view>
  18. </view>
  19. <view class="for-img-box">
  20. <view class="for-img-min-box" v-for="(minItem,index) in item.sensorSet" :key="index">
  21. <img src="@/images/icon_15.png">
  22. <view>{{minItem}}</view>
  23. </view>
  24. </view>
  25. </view>
  26. <img class="null-img" v-if="!infoList[0]" src="@/images/null-data-1.png">
  27. </scroll-view>
  28. </view>
  29. </template>
  30. <script>
  31. import { getSafeWarnList,getSafeWarnCount,laboratoryInfo,getSubByRiskPlanDetail } from '@/api/index.js'
  32. export default {
  33. name: "securityAlertList",
  34. data() {
  35. return {
  36. todayNum:0,
  37. yesterdayNum:0,
  38. historyNum:0,
  39. infoList:[],
  40. //列表请求参数
  41. getData:{
  42. page:1,
  43. pageSize:20,
  44. getType:true,
  45. nullDataType:true,
  46. }
  47. }
  48. },
  49. onLoad(){
  50. },
  51. onShow(){
  52. this.getSafeWarnCount();
  53. this.clearData();
  54. this.getList();
  55. },
  56. methods:{
  57. async getSubByRiskPlanDetail(item){
  58. const {data} = await getSubByRiskPlanDetail(item.riskPlanLogId);
  59. if(data.code == 200){
  60. let obj = data.rows[0];
  61. obj.subClassVO = item.subDiyVo.subClassVO;
  62. obj.name = item.subDiyVo.name;
  63. obj.subTypeLable = item.subDiyVo.subTypeLable;
  64. obj.deptName = item.subDiyVo.deptName;
  65. obj.subAddrrStr = item.subDiyVo.subAddrrStr;
  66. uni.navigateTo({
  67. url: '/pages_manage/workbench/plan/planInfo?item='+encodeURIComponent(JSON.stringify(obj))
  68. });
  69. }
  70. },
  71. async laboratoryInfo(item){
  72. const {data} = await laboratoryInfo(item.subDiyVo.id);
  73. if(data.code == 200){
  74. let obj = data.data[0];
  75. obj.subClassVO = item.subDiyVo.subClassVO;
  76. obj.name = item.subDiyVo.name;
  77. obj.subTypeLable = item.subDiyVo.subTypeLable;
  78. obj.deptName = item.subDiyVo.deptName;
  79. obj.subAddrrStr = item.subDiyVo.subAddrrStr;
  80. uni.navigateTo({
  81. url: '/pages_manage/workbench/laboratory/laboratoryInfo?item='+encodeURIComponent(JSON.stringify(obj))
  82. });
  83. }
  84. },
  85. //获取报警信息数量
  86. async getSafeWarnCount(){
  87. const {data} = await getSafeWarnCount();
  88. if(data.code == 200){
  89. this.historyNum = data.data.allday;
  90. this.todayNum = data.data.today;
  91. this.yesterdayNum = data.data.yesterday;
  92. }
  93. },
  94. //跳转页面
  95. goInfoPage(type){
  96. if(type == 1){
  97. uni.navigateTo({
  98. url: '/pages_manage/workbench/securityAlert/todayList',//今日报警
  99. });
  100. }else if(type == 2){
  101. uni.navigateTo({
  102. url: '/pages_manage/workbench/securityAlert/yesterdayList',//昨日报警
  103. });
  104. }else if(type == 3){
  105. uni.navigateTo({
  106. url: '/pages_manage/workbench/securityAlert/historyList',//历史报警
  107. });
  108. }
  109. },
  110. //清除
  111. clearData(){
  112. this.infoList = [];
  113. this.getData.page = 1;
  114. this.getData.getType = true;
  115. this.getData.nullDataType = true;
  116. },
  117. //滚动事件
  118. scrollGet(){
  119. if(this.getData.getType){
  120. this.getData.page += 1;
  121. this.getList();
  122. }
  123. },
  124. //获取列表数据
  125. async getList(){
  126. let self = this;
  127. let obj = {
  128. pageNum:this.getData.page,
  129. pageSize:this.getData.pageSize,
  130. count:-1,
  131. groupStatus:"",
  132. };
  133. const {data} = await getSafeWarnList(obj);
  134. if(data.code==200){
  135. if(self.page==1){
  136. if(data.rows.length > 0 && data.rows.length == self.getData.pageSize){
  137. self.infoList = data.rows;
  138. }else if(data.rows.length > 0 && data.rows.length != self.getData.pageSize){
  139. self.infoList = data.rows;
  140. self.getData.getType = false;
  141. self.getData.nullDataType = true;
  142. }else{
  143. self.getData.getType = false;
  144. self.getData.nullDataType = true;
  145. }
  146. }else{
  147. if(data.rows.length > 0 && data.rows.length == self.getData.pageSize){
  148. self.infoList = self.infoList.concat(data.rows)
  149. }else if(data.rows.length > 0 && data.rows.length != self.getData.pageSize){
  150. self.infoList = self.infoList.concat(data.rows);
  151. self.getData.getType = false;
  152. self.getData.nullDataType = true;
  153. }else{
  154. self.getData.getType = false;
  155. self.getData.nullDataType = true;
  156. }
  157. }
  158. }
  159. },
  160. },
  161. }
  162. </script>
  163. <style lang="stylus" scoped>
  164. #securityAlertList{
  165. height:100%;
  166. flex:1;
  167. display flex
  168. flex-direction column
  169. overflow: hidden
  170. .top-num-box{
  171. background #fff
  172. height:80rpx;
  173. border-bottom:1rpx solid #e0e0e0;
  174. display: flex;
  175. view{
  176. flex:1;
  177. color:#0183FA;
  178. text-align center
  179. line-height:80rpx;
  180. font-size:28rpx;
  181. }
  182. }
  183. .for-max-box{
  184. flex:1;
  185. overflow-y scroll
  186. .for-box{
  187. background #fff
  188. margin-bottom:20rpx;
  189. overflow: hidden
  190. .title-box{
  191. margin:20rpx 20rpx 0;
  192. display flex
  193. view:nth-child(1){
  194. height:40rpx;
  195. line-height:40rpx;
  196. font-size:20rpx;
  197. border-radius:10rpx;
  198. padding:0 20rpx;
  199. color:#fff;
  200. margin-right:20rpx;
  201. }
  202. view:nth-child(2){
  203. line-height:42rpx;
  204. font-size:30rpx;
  205. color:#333;
  206. max-width:600rpx;
  207. flex:1;
  208. }
  209. view:nth-child(3){
  210. line-height:42rpx;
  211. font-size:24rpx;
  212. color:#EE3A3A;
  213. margin-right:10px;
  214. }
  215. img{
  216. width:12rpx;
  217. height:20rpx;
  218. margin-top:11rpx;
  219. }
  220. .colorA{
  221. background:#aa2315;
  222. }
  223. .colorB{
  224. background:#ff9b09;
  225. }
  226. .colorC{
  227. background:#3ea3e9;
  228. }
  229. .colorD{
  230. background:#3ea34c;
  231. }
  232. }
  233. .address-box{
  234. margin:20rpx 20rpx;
  235. font-size:26rpx;
  236. color:#999999;
  237. span{
  238. margin-right:60rpx;
  239. }
  240. }
  241. .address-box-two{
  242. display flex
  243. margin:0 20rpx 20rpx 20rpx;
  244. border-bottom:1rpx solid #e0e0e0;
  245. padding-bottom:20rpx;
  246. img{
  247. width:28rpx;
  248. height:30rpx;
  249. margin-right:18rpx;
  250. }
  251. view{
  252. line-height:30rpx;
  253. font-size:24rpx;
  254. color:#999999;
  255. }
  256. }
  257. .time-box{
  258. display flex
  259. margin:0 20rpx;
  260. img{
  261. width:30rpx;
  262. height:30rpx;
  263. margin-top:12rpx;
  264. margin-right:18rpx;
  265. }
  266. view{
  267. line-height:50rpx;
  268. font-size:28rpx;
  269. color:#999999;
  270. }
  271. }
  272. .for-img-box{
  273. margin:0 20rpx;
  274. padding-bottom:20rpx;
  275. .for-img-min-box{
  276. display flex
  277. img{
  278. width:30rpx;
  279. height:27rpx;
  280. margin-top:24rpx;
  281. margin-right:10rpx;
  282. }
  283. view{
  284. line-height:74rpx;
  285. text-align center
  286. font-size:28rpx;
  287. color:#EE3A3A;
  288. }
  289. }
  290. }
  291. }
  292. .null-img{
  293. display block
  294. width:276rpx;
  295. height:321rpx;
  296. position absolute
  297. top:100rpx;
  298. left:274rpx;
  299. }
  300. }
  301. }
  302. </style>