patrolPlanAddLab.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. <!-- 安全检查-发起巡查计划-选择实验室 -->
  2. <template>
  3. <view class="examine">
  4. <scroll-view scroll-y @scrolltolower="scrollGet" class="info-max-box">
  5. <view>
  6. <view class="lab_title">
  7. <picker @change="collegeChange" :value="collegeIndex" :range="collegeArray" class="lab_title_l">
  8. <view class="lab_title_l_n">
  9. <view>{{collegeArray[collegeIndex]}}</view>
  10. <img src="@/images/Version3.3.3/icon_06.png">
  11. </view>
  12. </picker>
  13. <view class="lab_title_r">
  14. <view class="lab_title_r_btn" @click="searchBtn">
  15. <img src="@/images/Version3.3.3/icon_aqjc_ss.png"/>
  16. </view>
  17. <input type="text" v-model="getData.name" placeholder="请输入实验室名称" maxlength="50" placeholder-style="color: #CCCCCC;font-size:26rpx;">
  18. </view>
  19. </view>
  20. <view class="list">
  21. <view class="list_li" v-for="(item,index) in dataList" :key="index" @click="labSelete(index)">
  22. <text :class="item.type?'color_B':'color_A'">{{item.name}}</text>
  23. <img v-if="item.type" src="@/images/Version3.3.3/icon_xzwt_xz.png">
  24. </view>
  25. </view>
  26. </view>
  27. </scroll-view>
  28. <view class="bottom_btn" @click="handleClick('subBtn')">保存</view>
  29. </view>
  30. </template>
  31. <script>
  32. import { config } from '@/api/request/config.js'
  33. import { } from '@/api/index.js'
  34. export default {
  35. name: "rectifyList",
  36. components: {
  37. },
  38. data() {
  39. return {
  40. pageType:0,
  41. //列表请求参数
  42. getData:{
  43. pageNum:1,
  44. pageSize:20,
  45. name:'',
  46. },
  47. total:0,
  48. collegeIndex :0,
  49. collegeArray:['选择学院','学院名称1','学院名称2','学院名称3',],
  50. dataList:[{name:'实验室名称-房间号',type:false,id:1},{name:'实验室名称-房间号',type:false,id:2},{name:'实验室名称-房间号',type:false,id:3}],
  51. seleteListLab:[],//临时存储选中的
  52. form:{},
  53. }
  54. },
  55. onLoad(option) {
  56. this.form=JSON.parse(decodeURIComponent(option.form));
  57. if(this.form.seleteListLab.length>0){
  58. this.seleteListLab=this.form.seleteListLab;
  59. }
  60. },
  61. onShow() {
  62. this.getList();
  63. },
  64. mounted(){
  65. },
  66. methods: {
  67. //滚动事件
  68. scrollGet(){
  69. let self=this;
  70. if(self.total<=self.getData.pageNum){
  71. console.log('没有更多数据!')
  72. }else{
  73. setTimeout(function(){
  74. self.getData.pageNum += 1;
  75. self.getList();
  76. },1000)
  77. }
  78. },
  79. //选择学院
  80. collegeChange(e){
  81. this.collegeIndex = e.target.value;
  82. this.dataList=[];
  83. this.getList();
  84. },
  85. //点击选择实验室
  86. labSelete(index){
  87. this.dataList[index].type = !this.dataList[index].type
  88. if(this.dataList[index].type){//判断是选中还是取消
  89. if(this.seleteListLab.length>0){
  90. //console.log(this.seleteListLab.findIndex((item)=>item.id===this.dataList[index].id))
  91. if(this.seleteListLab.findIndex((item)=>item.id===this.dataList[index].id) ==-1){//等于-1说明数组里没有当前选中元素,可以添加
  92. this.seleteListLab.push(this.dataList[index])
  93. }
  94. }else{
  95. this.seleteListLab.push(this.dataList[index])
  96. }
  97. }else{
  98. this.seleteListLab.splice(this.seleteListLab.indexOf(this.dataList[index]),1);
  99. }
  100. },
  101. //实验室搜索
  102. searchBtn(){
  103. this.dataList=[];
  104. this.getList();
  105. },
  106. handleClick(doType){
  107. let self=this;
  108. if( doType=='subBtn'){//保存数据
  109. this.$set(this.form,'seleteListLab',this.seleteListLab)
  110. uni.redirectTo({
  111. url: '/pages/pages_safetyExamine/patrolPlan/patrolPlanAdd?form='+encodeURIComponent(JSON.stringify(this.form))
  112. });
  113. }
  114. },
  115. async getList(){
  116. let list=[{name:'实验室名称-房间号',type:false,id:4},{name:'实验室名称-房间号',type:false,id:5}]
  117. this.total=5;
  118. this.dataList=[...this.dataList,...list]
  119. if(this.seleteListLab.length>0){//如果有选中的数据
  120. for(let i=0;i<this.dataList.length;i++){
  121. if(this.seleteListLab.findIndex((item)=>item.id===this.dataList[i].id) !=-1){//不等于-1说明数组里有当前元素,可以改为选中
  122. this.dataList[i].type=true;
  123. }else{
  124. }
  125. }
  126. }
  127. // let self = this;
  128. // let obj = {
  129. // pageNum:this.getData.page,
  130. // pageSize:this.getData.pageSize,
  131. // };
  132. // const {data} = await groupList(obj);
  133. // if(data.code==200){
  134. // this.total=data.total;
  135. // this.dataList=[...this.dataList,...data.data]
  136. // }
  137. }
  138. }
  139. }
  140. </script>
  141. <style lang="stylus" scoped>
  142. .examine{
  143. height:100%;
  144. display flex;
  145. .info-max-box{
  146. flex: 1;
  147. overflow: scroll;
  148. padding: 120rpx 0rpx 30rpx;
  149. box-sizing: border-box;
  150. }
  151. .lab_title{
  152. width: 750rpx;
  153. height: 100rpx;
  154. background: #FFFFFF;
  155. position: fixed;
  156. top: 0;
  157. padding: 10rpx 30rpx;
  158. box-sizing: border-box;
  159. display: flex;
  160. justify-content: flex-start;
  161. .lab_title_l{
  162. width: 250rpx;
  163. height: 80rpx;
  164. margin-right: 20rpx;
  165. .lab_title_l_n{
  166. width: 250rpx;
  167. height: 80rpx;
  168. border-radius: 10rpx;
  169. border: 1rpx solid #E0E0E0;
  170. display: flex;
  171. justify-content: flex-start;
  172. align-items: center;
  173. >view{
  174. flex:1;
  175. line-height:80rpx;
  176. margin-left:20rpx;
  177. color: #999999;
  178. font-size:28rpx;
  179. }
  180. >img{
  181. width: 14rpx;
  182. height: 8rpx;
  183. margin-right: 30rpx;
  184. }
  185. }
  186. }
  187. .lab_title_r{
  188. width: 420rpx;
  189. height: 80rpx;
  190. position:relative;
  191. border-radius: 10rpx;
  192. border: 1rpx solid #E0E0E0;
  193. .lab_title_r_btn{
  194. width: 60rpx;
  195. height: 80rpx
  196. position: absolute;
  197. top: 0rpx;
  198. left:0rpx;
  199. >img{
  200. width: 20rpx;
  201. height: 20rpx;
  202. position: absolute;
  203. top: 30rpx;
  204. left: 24rpx;
  205. }
  206. }
  207. >input{
  208. width: 360rpx;
  209. height: 80rpx;
  210. position: absolute;
  211. top: 0rpx;
  212. left: 60rpx;
  213. }
  214. }
  215. }
  216. .list{
  217. background: #FFFFFF;
  218. border-radius: 20rpx 20rpx 0rpx 0rpx;
  219. padding: 0 30rpx;
  220. box-sizing: border-box;
  221. margin: 0 30rpx;
  222. .list_li{
  223. display: flex;
  224. justify-content:space-between;
  225. align-items: center;
  226. height: 80rpx;
  227. border-bottom: 1rpx solid #E0E0E0;
  228. >text{
  229. font-size: 28rpx;
  230. font-family: PingFang SC-Medium, PingFang SC;
  231. font-weight: 400;
  232. line-height: 80rpx;
  233. overflow: hidden;
  234. text-overflow:ellipsis;
  235. white-space: nowrap;
  236. }
  237. >img{
  238. width: 24rpx;
  239. height: 16rpx;
  240. margin-right: 14rpx;
  241. }
  242. }
  243. .list_li:last-child{
  244. border: none;
  245. }
  246. .color_A{
  247. color: #333333;
  248. }
  249. .color_B{
  250. color: #0183FA;
  251. }
  252. }
  253. .bottom_btn{
  254. position: fixed;
  255. bottom: 26rpx;
  256. left: 30rpx;
  257. font-size: 30rpx;
  258. font-family: PingFang SC-Medium, PingFang SC;
  259. font-weight: 400;
  260. color: #FFFFFF;
  261. line-height: 90rpx;
  262. width: 690rpx;
  263. height: 90rpx;
  264. background: #0183FA;
  265. border-radius: 20rpx;
  266. text-align: center;
  267. }
  268. }
  269. </style>