Commit 3ab392ce by test

选择员工组件BUG修复

1 parent c30a9c2d
...@@ -105,13 +105,6 @@ ...@@ -105,13 +105,6 @@
}) })
return dealOptions return dealOptions
}, },
setData () {
if (this.$refs.tree) this.$refs.tree.setCheckedKeys([])
this.userList.forEach(dd => {
this.$refs.tree.setCheckedKeys([dd.userId])
})
this.$forceUpdate()
},
loadNode (node, resolve) { loadNode (node, resolve) {
if (node.level === 0) { if (node.level === 0) {
if (!Array.isArray(this.defaultValues) || if (!Array.isArray(this.defaultValues) ||
...@@ -138,8 +131,6 @@ ...@@ -138,8 +131,6 @@
// }) // })
node.data.children && rows.push(...node.data.children) node.data.children && rows.push(...node.data.children)
resolve(rows) resolve(rows)
console.log(222)
this.setData()
} }
) )
} }
...@@ -157,10 +148,10 @@ ...@@ -157,10 +148,10 @@
handleCheckChange (data, checked, indeterminate) { handleCheckChange (data, checked, indeterminate) {
// console.log(arguments) // console.log(arguments)
if (checked) { if (checked) {
// if (this.isSigleSelect) { if (this.isSigleSelect) {
// // 单选情况 // 单选情况
// this.$refs.tree.setCheckedKeys([data.userId]) this.$refs.tree.setCheckedKeys([data.userId])
// } }
if (this.isOnlyLeaf) { if (this.isOnlyLeaf) {
if (data.userId && !data.isParty) { if (data.userId && !data.isParty) {
this.userList.push(data) this.userList.push(data)
...@@ -174,8 +165,19 @@ ...@@ -174,8 +165,19 @@
let index = this.userList.findIndex(i => i.userId === data.userId) let index = this.userList.findIndex(i => i.userId === data.userId)
index > -1 && this.userList.splice(index, 1) index > -1 && this.userList.splice(index, 1)
} }
this.setData()
// console.log(data, checked, indeterminate); // console.log(data, checked, indeterminate);
this.userList = this.unique(this.userList)
},
unique(arr){
for(var i=0; i<arr.length; i++){
for(var j=i+1; j<arr.length; j++){
if(arr[i].userId.split('_')[0] == arr[j].userId.split('_')[0]){
arr.splice(j,1);
j--;
}
}
}
return arr;
}, },
// 确 定 // 确 定
submit () { submit () {
...@@ -189,7 +191,6 @@ ...@@ -189,7 +191,6 @@
index > -1 && this.userList.splice(index, 1) index > -1 && this.userList.splice(index, 1)
let order = this.defaultValues.findIndex(i => i.userId === key) let order = this.defaultValues.findIndex(i => i.userId === key)
order > -1 && this.defaultValues.splice(order, 1) order > -1 && this.defaultValues.splice(order, 1)
this.setData()
}, },
}, },
} }
......
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,7 @@
<div v-if="codeForm.weEmpleCodeUseScops.length > 0"> <div v-if="codeForm.weEmpleCodeUseScops.length > 0">
<el-tag size="medium" v-for="(item, index) in codeForm.weEmpleCodeUseScops" :key="index">{{ item.businessName }}</el-tag> <el-tag size="medium" v-for="(item, index) in codeForm.weEmpleCodeUseScops" :key="index">{{ item.businessName }}</el-tag>
</div> </div>
<el-button style="margin-left:10px;" type="primary" plain size="mini" @click="onSelectUser">{{ codeForm.weEmpleCodeUseScops.length ? '修改' : '选择' }}员工</el-button> <el-button type="primary" plain size="mini" @click="onSelectUser">{{ codeForm.weEmpleCodeUseScops.length ? '修改' : '选择' }}员工</el-button>
<div class="sub-des">单人活码只能选择一个员工,多人活码支持选择多个员工</div> <div class="sub-des">单人活码只能选择一个员工,多人活码支持选择多个员工</div>
</el-form-item> </el-form-item>
<el-form-item v-if="codeForm.qrRuleType == 2" label="活码排班" prop="empleCodeRosterDto"> <el-form-item v-if="codeForm.qrRuleType == 2" label="活码排班" prop="empleCodeRosterDto">
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!