patrolPlanAddMember.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  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. checkLevel:'0',
  38. groupName:'',
  39. },
  40. total:0,
  41. dataList:[],
  42. seleteListMember:[],//临时存储选中的
  43. form:{},
  44. }
  45. },
  46. onLoad(option) {
  47. if(option.form){
  48. this.form=JSON.parse(decodeURIComponent(option.form));
  49. if(this.form.seleteListMember.length>0){
  50. this.seleteListMember=this.form.seleteListMember;
  51. }
  52. }
  53. if(option.pageType){//pageType=1添加页面进入2编辑页面进入
  54. this.pageType=option.pageType
  55. }
  56. },
  57. onShow() {
  58. this.getList();
  59. },
  60. mounted(){
  61. },
  62. methods: {
  63. //滚动事件
  64. scrollGet(){
  65. let self=this;
  66. if(self.total<=self.getData.pageNum){
  67. console.log('没有更多数据!')
  68. }else{
  69. setTimeout(function(){
  70. self.getData.pageNum += 1;
  71. self.getList();
  72. },1000)
  73. }
  74. },
  75. //点击选择实验室
  76. labSelete(index){
  77. let _this = this;
  78. this.dataList[index].type = !this.dataList[index].type
  79. if (_this.dataList[index].type == true) {
  80. _this.dataList.forEach(function(item2) {
  81. if (item2.id == _this.dataList[index].id) {
  82. item2.type = true
  83. } else {
  84. item2.type = false
  85. }
  86. })
  87. }
  88. if(this.dataList[index].type){//判断是选中还是取消
  89. this.seleteListMember.push(this.dataList[index])
  90. }else{
  91. this.seleteListMember=[];
  92. }
  93. },
  94. //实验室搜索
  95. searchBtn(){
  96. this.dataList=[];
  97. this.getList();
  98. },
  99. handleClick(doType){
  100. let self=this;
  101. if( doType=='subBtn'){//保存数据
  102. }
  103. },
  104. //巡查组-保存
  105. async submitForm(){
  106. let _this = this;
  107. let id=this.seleteListMember[0].id
  108. this.$set(this.form,'checkGroupId',this.seleteListMember[0].id)
  109. this.$set(this.form,'checkGroupName',this.seleteListMember[0].groupName)
  110. const {data} = await checkGroupDetail({id:id,selectEnable:'1'});
  111. if(data.code == 200){
  112. this.$set(this.form,'checkGroupMemberList',data.data.checkGroupMemberList)
  113. if(this.pageType==1){
  114. uni.redirectTo({
  115. url: '/pages/pages_safetyExamine/patrolPlan/patrolPlanAdd?form='+encodeURIComponent(JSON.stringify(this.form))
  116. });
  117. }else if(this.pageType==2){
  118. uni.redirectTo({
  119. url: '/pages/pages_safetyExamine/patrolPlan/patrolPlanEdit?form='+encodeURIComponent(JSON.stringify(this.form))
  120. });
  121. }
  122. }
  123. },
  124. async getList(){
  125. let _this = this;
  126. const {data} = await checkGroupList(_this.getData);
  127. if(data.code==200){
  128. if(data.data){
  129. data.data.forEach(function(item){
  130. item.type=false
  131. })
  132. }
  133. this.dataList=[...this.dataList,...data.data]
  134. //如果有选中的数据
  135. if(this.seleteListMember.length>0){
  136. for(let i=0;i<this.dataList.length;i++){
  137. if(this.seleteListMember[0].id==this.dataList[i].id){
  138. this.dataList[i].type=true;
  139. }
  140. }
  141. }
  142. this.total=data.data.total;
  143. }
  144. }
  145. }
  146. }
  147. </script>
  148. <style lang="stylus" scoped>
  149. .examine{
  150. height:100%;
  151. display flex;
  152. .info-max-box{
  153. flex: 1;
  154. overflow: scroll;
  155. padding: 120rpx 0rpx 30rpx;
  156. box-sizing: border-box;
  157. }
  158. .lab_title{
  159. width: 750rpx;
  160. height: 100rpx;
  161. background: #FFFFFF;
  162. position: fixed;
  163. top: 0;
  164. padding: 10rpx 30rpx;
  165. box-sizing: border-box;
  166. .lab_title_n{
  167. width: 690rpx;
  168. height: 80rpx;
  169. position:relative;
  170. border-radius: 10rpx;
  171. border: 1rpx solid #E0E0E0;
  172. .lab_title_r_btn{
  173. width: 60rpx;
  174. height: 80rpx
  175. position: absolute;
  176. top: 0rpx;
  177. left:0rpx;
  178. >img{
  179. width: 20rpx;
  180. height: 20rpx;
  181. position: absolute;
  182. top: 30rpx;
  183. left: 24rpx;
  184. }
  185. }
  186. >input{
  187. width: 360rpx;
  188. height: 80rpx;
  189. position: absolute;
  190. top: 0rpx;
  191. left: 60rpx;
  192. }
  193. }
  194. }
  195. .list{
  196. background: #FFFFFF;
  197. border-radius: 20rpx 20rpx 0rpx 0rpx;
  198. padding: 0 30rpx;
  199. box-sizing: border-box;
  200. margin: 0 30rpx;
  201. .list_li{
  202. display: flex;
  203. justify-content:space-between;
  204. align-items: center;
  205. height: 80rpx;
  206. border-bottom: 1rpx solid #E0E0E0;
  207. >text{
  208. font-size: 28rpx;
  209. font-family: PingFang SC-Medium, PingFang SC;
  210. font-weight: 400;
  211. line-height: 80rpx;
  212. overflow: hidden;
  213. text-overflow:ellipsis;
  214. white-space: nowrap;
  215. }
  216. >img{
  217. width: 24rpx;
  218. height: 16rpx;
  219. margin-right: 14rpx;
  220. }
  221. }
  222. .list_li:last-child{
  223. border: none;
  224. }
  225. .color_A{
  226. color: #333333;
  227. }
  228. .color_B{
  229. color: #0183FA;
  230. }
  231. }
  232. .bottom_btn{
  233. position: fixed;
  234. bottom: 26rpx;
  235. left: 30rpx;
  236. font-size: 30rpx;
  237. font-family: PingFang SC-Medium, PingFang SC;
  238. font-weight: 400;
  239. color: #FFFFFF;
  240. line-height: 90rpx;
  241. width: 690rpx;
  242. height: 90rpx;
  243. background: #0183FA;
  244. border-radius: 20rpx;
  245. text-align: center;
  246. }
  247. }
  248. </style>