员工概管理修改2

This commit is contained in:
zzyuan 2025-06-25 10:55:31 +08:00
parent 328fd3aefc
commit be6fb0e208
1 changed files with 81 additions and 40 deletions

View File

@ -305,6 +305,12 @@
size="mini" v-if="accessAuthorityList.length>1" size="mini" v-if="accessAuthorityList.length>1"
@click="delDevice(index)" @click="delDevice(index)"
>删除</el-button> >删除</el-button>
<el-button
type="info"
plain
size="mini" v-if="accessAuthorityList.length==1"
@click="clearDevice(index)"
>清空</el-button>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
@ -446,33 +452,42 @@ export default {
simpleCabinetStatus:1, simpleCabinetStatus:1,
// //
rules: { rules: {
staffName: [ staffName: [
{ required: true, message: "员工名称不能为空", trigger: "blur" } { required: true, message: "员工名称不能为空", trigger: "blur" }
], ],
staffNo: [ staffNo: [
{ required: true, message: "员工编号不能为空", trigger: "blur" } { required: true, message: "员工编号不能为空", trigger: "blur" }
], ],
sex: [ sex: [
{ required: true, message: "员工性别不能为空", trigger: "change" } { required: true, message: "员工性别不能为空", trigger: "change" }
], ],
mobile: [ mobile: [
{ {
required: true, required: true,
message: '手机号不能为空', message: '手机号不能为空',
trigger: 'blur', trigger: 'blur',
}, },
{ {
pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
message: '请输入正确的手机号码', message: '请输入正确的手机号码',
trigger: 'blur', trigger: 'blur',
}, },
], ],
canteenId: [ canteenId: [
{ required: true, message: "关联食堂不能为空", trigger: "change" } { required: true, message: "关联食堂不能为空", trigger: "change" }
], ],
postName: [ postName: [
{ required: true, message: "员工岗位名称不能为空", trigger: "blur" } { required: true, message: "员工岗位名称不能为空", trigger: "blur" }
], ],
faceUrl: [
{ required: true, message: "人脸照片不能为空", trigger: "change" }
],
healthCertExpire: [
{ required: true, message: "健康证到期日期不能为空", trigger: "change" }
],
healthCertFrontImg: [
{ required: true, message: "健康证照片不能为空", trigger: "change" }
],
}, },
fileList0: [],// fileList0: [],//
checkUrlList0: [],// checkUrlList0: [],//
@ -576,16 +591,21 @@ export default {
console.log(this.form) console.log(this.form)
if(this.form.accessAuthorityList&&this.form.accessAuthorityList.length>0){ if(this.form.accessAuthorityList&&this.form.accessAuthorityList.length>0){
console.log(this.form.accessAuthorityList) console.log(this.form.accessAuthorityList)
this.accessAuthorityList = [] let index = this.form.accessAuthorityList.findIndex(v=>v.deviceType==3)
this.form.accessAuthorityList.forEach(item=>{ if(index==-1){
if(item.deviceType==3){ this.simpleCabinetStatus = Number(this.form.accessAuthorityList[0].privilegeValue)
this.accessAuthorityList.push(item) }else{
this.$forceUpdate() this.accessAuthorityList = []
} this.form.accessAuthorityList.forEach(item=>{
if(item.deviceType==7){ if(item.deviceType==3){
this.simpleCabinetStatus = Number(item.privilegeValue) this.accessAuthorityList.push(item)
} this.$forceUpdate()
}) }
if(item.deviceType==7){
this.simpleCabinetStatus = Number(item.privilegeValue)
}
})
}
} }
console.log(this.accessAuthorityList) console.log(this.accessAuthorityList)
this.open = true; this.open = true;
@ -657,6 +677,17 @@ export default {
// //
delDevice(index){ delDevice(index){
this.accessAuthorityList.splice(index,1) this.accessAuthorityList.splice(index,1)
this.setDisabled()
},
clearDevice(index){
if(index==0){
this.accessAuthorityList.splice(index,1)
this.accessAuthorityList.push({
deviceId:"",
location:""
})
this.setDisabled()
}
}, },
chosenDevice(e){ chosenDevice(e){
let index = this.devicesOptions.findIndex(v=>v.deviceId==e) let index = this.devicesOptions.findIndex(v=>v.deviceId==e)
@ -691,7 +722,17 @@ export default {
privilegeValue:this.simpleCabinetStatus, privilegeValue:this.simpleCabinetStatus,
location:"" location:""
}] }]
this.form.accessAuthorityList = this.accessAuthorityList.concat(arr) let arr2 = this.accessAuthorityList.concat(arr)
this.form.accessAuthorityList=[]
arr2.forEach(item=>{
if(item.deviceType==3){
this.form.accessAuthorityList.push(item)
}
if(item.deviceType==7){
this.form.accessAuthorityList.push(item)
}
})
console.log(this.accessAuthorityList)
console.log(this.form) console.log(this.form)
if (this.form.staffId != undefined) { if (this.form.staffId != undefined) {
editKitchenStaffApi(this.form).then(response => { editKitchenStaffApi(this.form).then(response => {