| <template> | 
|     <view class="box"> | 
|         <view class="box_list"> | 
|             <u--form | 
|                 labelPosition="top" | 
|                 :model="model" | 
|                 :rules="rules" | 
|                 labelWidth="160" | 
|                 ref="uForm" | 
|             > | 
|                 <u-form-item | 
|                     label="姓名:" | 
|                     prop="memberName" | 
|                     borderBottom | 
|                     required | 
|                 > | 
|                     <u--input v-model="model.memberName" border="none" @input="changeSearch" placeholder="请输入"></u--input> | 
|                     <scroll-view scroll-y class="box_list_data" v-if="model.memberName && user.length > 0"> | 
|                         <view class="box_list_data_item" v-for="(item, index) in user" :key="index" @click="clickItem(item)"> | 
|                             {{item.name}} - {{item.idcardNo}} | 
|                         </view> | 
|                     </scroll-view> | 
|                 </u-form-item> | 
|                 <u-form-item | 
|                     label="身份证号:" | 
|                     prop="idcardNo" | 
|                     borderBottom | 
|                     required | 
|                 > | 
|                     <u--input v-model="model.idcardNo" maxlength="18" border="none" placeholder="请输入"></u--input> | 
|                 </u-form-item> | 
|                 <u-form-item | 
|                     label="原派遣单位:" | 
|                     prop="oldDuName" | 
|                     borderBottom | 
|                     required | 
|                 > | 
|                     <u--input v-model="model.oldDuName" disabled disabledColor="#ffffff" placeholder="请选择" border="none"></u--input> | 
|                 </u-form-item> | 
|                 <u-form-item | 
|                     label="原所属工种:" | 
|                     prop="oldWorkTypeName" | 
|                     borderBottom | 
|                     required | 
|                 > | 
|                     <u--input v-model="model.oldWorkTypeName" disabled disabledColor="#ffffff" placeholder="请选择" border="none"></u--input> | 
|                 </u-form-item> | 
|                 <u-form-item | 
|                     label="更换后派遣单位:" | 
|                     prop="duName" | 
|                     borderBottom | 
|                     required | 
|                     @click="show = true" | 
|                 > | 
|                     <u--input v-model="model.duName" disabled disabledColor="#ffffff" placeholder="请选择" border="none"></u--input> | 
|                     <u-icon slot="right" name="arrow-right"></u-icon> | 
|                 </u-form-item> | 
|                 <u-form-item | 
|                     label="更换后所属工种:" | 
|                     prop="workTypeName" | 
|                     borderBottom | 
|                     required | 
|                     @click="show1 = true" | 
|                 > | 
|                     <u--input v-model="model.workTypeName" disabled disabledColor="#ffffff" placeholder="请选择" border="none"></u--input> | 
|                     <u-icon slot="right" name="arrow-right"></u-icon> | 
|                 </u-form-item> | 
|                 <u-form-item | 
|                     label="备注:" | 
|                     prop="remark" | 
|                     borderBottom | 
|                     required | 
|                 > | 
|                     <u--input v-model="model.remark" maxlength="18" border="none" placeholder="请输入"></u--input> | 
|                 </u-form-item> | 
|             </u--form> | 
|         </view> | 
|         <view class="box_footer"> | 
|             <u-button type="primary" shape="circle" color="#437CB3" text="确认添加" @click="submit"></u-button> | 
|         </view> | 
|         <!-- 派遣单位 --> | 
|         <u-picker :show="show" :columns="columns" confirmColor="#437CB3" keyName="label" @cancel="show = false" @confirm="confirm"></u-picker> | 
|         <!-- 工种 --> | 
|         <u-picker :show="show1" :columns="columns1" confirmColor="#437CB3" keyName="label" @cancel="show1 = false" @confirm="confirm1"></u-picker> | 
|     </view> | 
| </template> | 
|   | 
| <script> | 
|     export default { | 
|         data() { | 
|             return { | 
|                 show: false, | 
|                 show1: false, | 
|                 validTime: null, | 
|                 insuranceApplyId: null, | 
|                 solutionId: null, | 
|                 columns: [], | 
|                 columns1: [], | 
|                 duSolutionId: '', | 
|                 user: [], | 
|                 model: { | 
|                     memberName: '', | 
|                     memberId: '', | 
|                     remark:'', | 
|                     idcardNo: '', | 
|                     oldDuName: '', | 
|                     oldDuId: '', | 
|                     oldWorkTypeName: '', | 
|                     oldWorktypeId: '', | 
|                     worktypeId: '', | 
|                     workTypeName: '', | 
|                     duId: '', | 
|                     duName: '' | 
|                 }, | 
|                 rules: { | 
|                     'memberName': { | 
|                         type: 'string', | 
|                         required: true, | 
|                         message: '请填写姓名', | 
|                         trigger: ['blur', 'change'] | 
|                     }, | 
|                     'idcardNo': { | 
|                         type: 'string', | 
|                         required: true, | 
|                         message: '请填写身份证号', | 
|                         trigger: ['blur', 'change'] | 
|                     }, | 
|                     'oldDuName': { | 
|                         type: 'string', | 
|                         required: true, | 
|                         message: '原派遣单位不能为空', | 
|                         trigger: ['blur', 'change'] | 
|                     }, | 
|                     'oldDuName': { | 
|                         type: 'string', | 
|                         required: true, | 
|                         message: '原派遣单位不能为空', | 
|                         trigger: ['blur', 'change'] | 
|                     }, | 
|                     'oldWorkTypeName': { | 
|                         type: 'string', | 
|                         required: true, | 
|                         message: '原所属工种不能为空', | 
|                         trigger: ['blur', 'change'] | 
|                     }, | 
|                     'duName': { | 
|                         type: 'string', | 
|                         required: true, | 
|                         message: '更换后派遣单位不能为空', | 
|                         trigger: ['blur', 'change'] | 
|                     }, | 
|                     'workTypeName': { | 
|                         type: 'string', | 
|                         required: true, | 
|                         message: '更换后所属工种不能为空', | 
|                         trigger: ['blur', 'change'] | 
|                     } | 
|                 } | 
|             }; | 
|         }, | 
|         onLoad(options) { | 
|             this.solutionId = options.solutionId | 
|             this.validTime = options.validTime | 
|             this.insuranceApplyId = options.insuranceApplyId | 
|             this.getDispatchingUnit() | 
|         }, | 
|         methods: { | 
|             clickItem(item) { | 
|                 this.model.memberName = item.name | 
|                 this.model.memberId = item.id | 
|                 this.model.idcardNo = item.idcardNo | 
|                 this.model.oldDuName = item.duName | 
|                 this.model.remark = item.remark | 
|                 this.model.oldDuId = item.duId | 
|                 this.model.oldWorkTypeName = item.workTypeName | 
|                 this.model.oldWorktypeId = item.worktypeId | 
|                 this.user = [] | 
|             }, | 
|             // 搜索 | 
|             changeSearch(name) { | 
|                 if (!name) { | 
|                     this.user = [] | 
|                     return | 
|                 } | 
|                 this.$u.api.memberFindListByDTO({ | 
|                     name, | 
|                     insuranceApplyId: this.insuranceApplyId, | 
|                     validTime: this.validTime | 
|                 }).then(res => { | 
|                     if (res.code === 200) { | 
|                         if (res.data.length > 0) { | 
|                             this.user = res.data | 
|                         } else { | 
|                             uni.showToast({ title: '未找到该人员', icon: 'none' }) | 
|                         } | 
|                     } | 
|                 }) | 
|             }, | 
|             // 派遣单位 | 
|             getDispatchingUnit() { | 
|                 this.$u.api.findListByDTO({ | 
|                     solutionId: this.solutionId | 
|                 }).then(res => { | 
|                     if (res.code === 200) { | 
|                         let arr = res.data.map(item => { | 
|                             return { | 
|                                 label: item.name, | 
|                                 duSolutionId: item.duSolutionId, | 
|                                 id: item.id | 
|                             } | 
|                         }) | 
|                         this.columns.push(arr) | 
|                     } | 
|                 }) | 
|             }, | 
|             // 工种 | 
|             getGZ() { | 
|                 this.$u.api.worktypeFindListByDTO({ | 
|                     id: this.duSolutionId, | 
|                     queryType: 1 | 
|                 }).then(res => { | 
|                     if (res.code === 200) { | 
|                         let arr = res.data.map(item => { | 
|                             return { | 
|                                 label: item.name, | 
|                                 id: item.id | 
|                             } | 
|                         }) | 
|                         this.columns1 = [arr] | 
|                     } | 
|                 }) | 
|             }, | 
|             confirm(e) { | 
|                 this.model.duId = e.value[0].id | 
|                 this.model.duName = e.value[0].label | 
|                 this.duSolutionId = e.value[0].duSolutionId | 
|                 this.model.worktypeId = '' | 
|                 this.model.remark='' | 
|                 this.model.workTypeName = '' | 
|                 this.getGZ() | 
|                 this.show = false | 
|             }, | 
|             confirm1(e) { | 
|                 this.model.worktypeId = e.value[0].id | 
|                 this.model.workTypeName = e.value[0].label | 
|                 this.show1 = false | 
|             }, | 
|             submit() { | 
|                 if (!this.model.memberId) return uni.showToast({ | 
|                     title: '请选择人员', | 
|                     icon: 'none' | 
|                 }) | 
|                 this.$refs.uForm.validate().then(res => { | 
|                     uni.$emit('data', this.model) | 
|                     uni.navigateBack({ delta: 1 }); | 
|                 }).catch(errors => { | 
|                      | 
|                 }) | 
|             } | 
|         } | 
|     } | 
| </script> | 
| <style> | 
|     page { | 
|         background-color: #f7f7f7; | 
|     } | 
| </style> | 
| <style lang="scss" scoped> | 
|     .box { | 
|         width: 100vw; | 
|         height: 100vh; | 
|         padding: 20rpx 30rpx; | 
|         box-sizing: border-box; | 
|         .box_list { | 
|             width: 100%; | 
|             height: auto; | 
|             // height: calc(100vh - 158rpx - env(safe-area-inset-bottom)); | 
|             background: #FFFFFF; | 
|             border-radius: 16rpx; | 
|             padding: 32rpx 30rpx; | 
|             box-sizing: border-box; | 
|             .box_list_data { | 
|                 width: 100%; | 
|                 max-height: 400rpx; | 
|                 margin-top: 10rpx; | 
|                 .box_list_data_item { | 
|                     width: 100%; | 
|                     height: 80rpx; | 
|                     padding: 0 20rpx; | 
|                     box-sizing: border-box; | 
|                     line-height: 80rpx; | 
|                     border-bottom: 1px solid #dfdfdf; | 
|                     &:last-child { | 
|                         border: none; | 
|                     } | 
|                 } | 
|             } | 
|         } | 
|         .box_footer { | 
|             width: 100%; | 
|             margin-top: 40rpx; | 
|             height: 88rpx; | 
|         } | 
|     } | 
| </style> |