patrolPlanAddMember.vue 5.4 KB

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