todayList.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. <template>
  2. <view id="todayList">
  3. <scroll-view scroll-y @scrolltolower="scrollGet" class="for-max-box">
  4. <view class="for-box" v-for="(item,index) in infoList" :key="index" @click="laboratoryInfo(item)">
  5. <view class="title-box">
  6. <view :class="item.subDiyVo.subClassVO.classtypeId == 1?'colorA':(item.subDiyVo.subClassVO.classtypeId == 2?'colorB':(item.subDiyVo.subClassVO.classtypeId == 3?'colorC':(item.subDiyVo.subClassVO.classtypeId == 4?'colorD':'')))">{{item.subDiyVo.subClassVO.levelName}}</view>
  7. <view>{{item.subDiyVo.name}}</view>
  8. <img src="@/images/icon_04.png">
  9. </view>
  10. <view class="address-box"><span>{{item.subDiyVo.subTypeLable}}</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="for-img-box">
  16. <view class="for-img-min-box" v-for="(minItem,index) in item.sensorSet" :key="index">
  17. <img src="@/images/icon_15.png">
  18. <view>{{minItem}}</view>
  19. </view>
  20. </view>
  21. </view>
  22. <img class="null-img" v-if="!infoList[0]" src="@/images/null-data-1.png">
  23. </scroll-view>
  24. </view>
  25. </template>
  26. <script>
  27. import { getSafeWarnList,laboratoryInfo } from '@/api/index.js'
  28. export default {
  29. name: "todayList",
  30. data() {
  31. return {
  32. infoList:[],
  33. //列表请求参数
  34. getData:{
  35. page:1,
  36. pageSize:20,
  37. getType:true,
  38. nullDataType:true,
  39. }
  40. }
  41. },
  42. onLoad(){
  43. },
  44. onShow(){
  45. this.clearData();
  46. this.getList();
  47. },
  48. methods:{
  49. async laboratoryInfo(item){
  50. const {data} = await laboratoryInfo(item.subDiyVo.id);
  51. if(data.code == 200){
  52. let obj = data.data[0];
  53. obj.subClassVO = item.subDiyVo.subClassVO;
  54. obj.name = item.subDiyVo.name;
  55. obj.subTypeLable = item.subDiyVo.subTypeLable;
  56. obj.deptName = item.subDiyVo.deptName;
  57. obj.subAddrrStr = item.subDiyVo.subAddrrStr;
  58. uni.navigateTo({
  59. url: '/pages_manage/workbench/laboratory/laboratoryInfo?item='+encodeURIComponent(JSON.stringify(obj))
  60. });
  61. }
  62. },
  63. //清除
  64. clearData(){
  65. this.infoList = [];
  66. this.getData.page = 1;
  67. this.getData.getType = true;
  68. this.getData.nullDataType = true;
  69. },
  70. //滚动事件
  71. scrollGet(){
  72. if(this.getData.getType){
  73. this.getData.page += 1;
  74. this.getList();
  75. }
  76. },
  77. //获取列表数据
  78. async getList(){
  79. let self = this;
  80. let obj = {
  81. pageNum:this.getData.page,
  82. pageSize:this.getData.pageSize,
  83. count:0,
  84. groupStatus:"",
  85. };
  86. const {data} = await getSafeWarnList(obj);
  87. if(data.code==200){
  88. if(self.page==1){
  89. if(data.rows.length > 0 && data.rows.length == self.getData.pageSize){
  90. self.infoList = data.rows;
  91. }else if(data.rows.length > 0 && data.rows.length != self.getData.pageSize){
  92. self.infoList = data.rows;
  93. self.getData.getType = false;
  94. self.getData.nullDataType = true;
  95. }else{
  96. self.getData.getType = false;
  97. self.getData.nullDataType = true;
  98. }
  99. }else{
  100. if(data.rows.length > 0 && data.rows.length == self.getData.pageSize){
  101. self.infoList = self.infoList.concat(data.rows)
  102. }else if(data.rows.length > 0 && data.rows.length != self.getData.pageSize){
  103. self.infoList = self.infoList.concat(data.rows);
  104. self.getData.getType = false;
  105. self.getData.nullDataType = true;
  106. }else{
  107. self.getData.getType = false;
  108. self.getData.nullDataType = true;
  109. }
  110. }
  111. }
  112. },
  113. },
  114. }
  115. </script>
  116. <style lang="stylus" scoped>
  117. #todayList{
  118. height:100%;
  119. flex:1;
  120. display flex
  121. flex-direction column
  122. overflow: hidden
  123. .for-max-box{
  124. flex:1;
  125. overflow-y scroll
  126. .for-box{
  127. background #fff
  128. margin-bottom:20rpx;
  129. overflow: hidden
  130. .title-box{
  131. margin:20rpx 20rpx 0;
  132. display flex
  133. view:nth-child(1){
  134. height:42rpx;
  135. line-height:42rpx;
  136. font-size:20rpx;
  137. border-radius:10rpx;
  138. padding:0 10rpx;
  139. color:#fff;
  140. margin-right:20rpx;
  141. }
  142. view:nth-child(2){
  143. line-height:42rpx;
  144. font-size:30rpx;
  145. color:#333;
  146. max-width:600rpx;
  147. flex:1;
  148. }
  149. img{
  150. width:12rpx;
  151. height:20rpx;
  152. margin-top:11rpx;
  153. }
  154. .colorA{
  155. background:#aa2315;
  156. }
  157. .colorB{
  158. background:#ff9b09;
  159. }
  160. .colorC{
  161. background:#3ea3e9;
  162. }
  163. .colorD{
  164. background:#3ea34c;
  165. }
  166. }
  167. .address-box{
  168. margin:20rpx 20rpx;
  169. font-size:26rpx;
  170. color:#999999;
  171. span{
  172. margin-right:60rpx;
  173. }
  174. }
  175. .address-box-two{
  176. display flex
  177. margin:0 20rpx 20rpx 20rpx;
  178. img{
  179. width:28rpx;
  180. height:30rpx;
  181. margin-right:18rpx;
  182. }
  183. view{
  184. line-height:30rpx;
  185. font-size:24rpx;
  186. color:#999999;
  187. }
  188. }
  189. .for-img-box{
  190. border-top:1rpx solid #e0e0e0;
  191. margin:0 20rpx;
  192. .for-img-min-box{
  193. display flex
  194. img{
  195. width:30rpx;
  196. height:27rpx;
  197. margin-top:24rpx;
  198. margin-right:10rpx;
  199. }
  200. view{
  201. line-height:74rpx;
  202. text-align center
  203. font-size:28rpx;
  204. color:#EE3A3A;
  205. }
  206. }
  207. }
  208. }
  209. .null-img{
  210. display block
  211. width:276rpx;
  212. height:321rpx;
  213. position absolute
  214. top:100rpx;
  215. left:274rpx;
  216. }
  217. }
  218. }
  219. </style>