patrolPlanAddMember.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  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.groupName" 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.groupName}}</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="submitForm">保存</view>
  23. </view>
  24. </template>
  25. <script>
  26. import { config } from '@/api/request/config.js'
  27. import { checkGroupList,checkGroupDetail} 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. groupName:'',
  40. },
  41. total:0,
  42. dataList:[],
  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. }
  101. },
  102. //巡查组-保存
  103. async submitForm(){
  104. let _this = this;
  105. let id=this.seleteListMember[0].id
  106. this.$set(this.form,'checkGroupId',this.seleteListMember[0].id)
  107. this.$set(this.form,'checkGroupName',this.seleteListMember[0].groupName)
  108. const {data} = await checkGroupDetail({id:id});
  109. if(data.code == 200){
  110. this.$set(this.form,'checkGroupMemberList',data.data.checkGroupMemberList)
  111. uni.redirectTo({
  112. url: '/pages/pages_safetyExamine/patrolPlan/patrolPlanAdd?form='+encodeURIComponent(JSON.stringify(this.form))
  113. });
  114. }
  115. },
  116. async getList(){
  117. let _this = this;
  118. const {data} = await checkGroupList(_this.getData);
  119. if(data.code==200){
  120. if(data.data.records){
  121. data.data.records.forEach(function(item){
  122. item.type=false
  123. })
  124. }
  125. this.dataList=[...this.dataList,...data.data.records]
  126. //如果有选中的数据
  127. if(this.seleteListMember.length>0){
  128. for(let i=0;i<this.dataList.length;i++){
  129. if(this.seleteListMember[0].id==this.dataList[i].id){
  130. this.dataList[i].type=true;
  131. }
  132. }
  133. }
  134. this.total=data.total;
  135. }
  136. }
  137. }
  138. }
  139. </script>
  140. <style lang="stylus" scoped>
  141. .examine{
  142. height:100%;
  143. display flex;
  144. .info-max-box{
  145. flex: 1;
  146. overflow: scroll;
  147. padding: 120rpx 0rpx 30rpx;
  148. box-sizing: border-box;
  149. }
  150. .lab_title{
  151. width: 750rpx;
  152. height: 100rpx;
  153. background: #FFFFFF;
  154. position: fixed;
  155. top: 0;
  156. padding: 10rpx 30rpx;
  157. box-sizing: border-box;
  158. .lab_title_n{
  159. width: 690rpx;
  160. height: 80rpx;
  161. position:relative;
  162. border-radius: 10rpx;
  163. border: 1rpx solid #E0E0E0;
  164. .lab_title_r_btn{
  165. width: 60rpx;
  166. height: 80rpx
  167. position: absolute;
  168. top: 0rpx;
  169. left:0rpx;
  170. >img{
  171. width: 20rpx;
  172. height: 20rpx;
  173. position: absolute;
  174. top: 30rpx;
  175. left: 24rpx;
  176. }
  177. }
  178. >input{
  179. width: 360rpx;
  180. height: 80rpx;
  181. position: absolute;
  182. top: 0rpx;
  183. left: 60rpx;
  184. }
  185. }
  186. }
  187. .list{
  188. background: #FFFFFF;
  189. border-radius: 20rpx 20rpx 0rpx 0rpx;
  190. padding: 0 30rpx;
  191. box-sizing: border-box;
  192. margin: 0 30rpx;
  193. .list_li{
  194. display: flex;
  195. justify-content:space-between;
  196. align-items: center;
  197. height: 80rpx;
  198. border-bottom: 1rpx solid #E0E0E0;
  199. >text{
  200. font-size: 28rpx;
  201. font-family: PingFang SC-Medium, PingFang SC;
  202. font-weight: 400;
  203. line-height: 80rpx;
  204. overflow: hidden;
  205. text-overflow:ellipsis;
  206. white-space: nowrap;
  207. }
  208. >img{
  209. width: 24rpx;
  210. height: 16rpx;
  211. margin-right: 14rpx;
  212. }
  213. }
  214. .list_li:last-child{
  215. border: none;
  216. }
  217. .color_A{
  218. color: #333333;
  219. }
  220. .color_B{
  221. color: #0183FA;
  222. }
  223. }
  224. .bottom_btn{
  225. position: fixed;
  226. bottom: 26rpx;
  227. left: 30rpx;
  228. font-size: 30rpx;
  229. font-family: PingFang SC-Medium, PingFang SC;
  230. font-weight: 400;
  231. color: #FFFFFF;
  232. line-height: 90rpx;
  233. width: 690rpx;
  234. height: 90rpx;
  235. background: #0183FA;
  236. border-radius: 20rpx;
  237. text-align: center;
  238. }
  239. }
  240. </style>