This commit is contained in:
yanran200730
2022-12-23 16:04:44 +08:00
parent 09f9256f06
commit 7e51b443c2
3 changed files with 29 additions and 23 deletions

View File

@@ -52,7 +52,7 @@
</ai-user-selecter> </ai-user-selecter>
</el-form-item> </el-form-item>
<el-form-item label="审批人员" style="width: 100%" prop="fillingUserNames" :rules="[{required: true, message: '请选择审批人员', trigger: 'change'}]"> <el-form-item label="审批人员" style="width: 100%" prop="fillingUserNames" :rules="[{required: true, message: '请选择审批人员', trigger: 'change'}]">
<ai-user-selecter :instance="instance" v-model="form.fillingUserIds" @change="e => onUserChange(e, 'fillingUserNames')"> <ai-user-selecter :instance="instance" :props="{label: 'name', id: 'sysUserId'}" v-model="form.fillingUserIds" @change="e => onUserChange(e, 'fillingUserNames')">
<div class="AppAnnounceDetail-select"> <div class="AppAnnounceDetail-select">
<el-input class="AppAnnounceDetail-select__input" size="small" placeholder="请选择..." v-model="form.fillingUserNames"></el-input> <el-input class="AppAnnounceDetail-select__input" size="small" placeholder="请选择..." v-model="form.fillingUserNames"></el-input>
<div class="select-left" v-if="form.fillingUserIds.length"> <div class="select-left" v-if="form.fillingUserIds.length">
@@ -132,6 +132,7 @@
}, },
edit (e) { edit (e) {
console.log(e)
this.id = e.id this.id = e.id
this.form.name = e.name this.form.name = e.name
this.form.examineUserIds = e.examineUserIds.split(',').map((v, index) => { this.form.examineUserIds = e.examineUserIds.split(',').map((v, index) => {

View File

@@ -354,8 +354,9 @@
}, },
filterNode(value, data) { filterNode(value, data) {
console.log(data)
if (!value) return true if (!value) return true
return data.name.indexOf(value) !== -1 return data.fileName.indexOf(value) !== -1
}, },
settingAadmin (id) { settingAadmin (id) {

View File

@@ -83,7 +83,7 @@
<el-scrollbar class="AiWechatSelecter-list"> <el-scrollbar class="AiWechatSelecter-list">
<div class="user-wrapper"> <div class="user-wrapper">
<el-checkbox-group v-model="userIds" @change="onCheckboxChange"> <el-checkbox-group v-model="userIds" @change="onCheckboxChange">
<el-checkbox v-for="item in list" :label="item.id" :key="item.id" @change="e => onboxChange(item.id, e)">{{ item.name }}</el-checkbox> <el-checkbox v-for="item in list" :label="item[props.id]" :key="item[props.id]" @change="e => onboxChange(item[props.id], e)">{{ item.name }}</el-checkbox>
</el-checkbox-group> </el-checkbox-group>
</div> </div>
<AiEmpty v-if="!list.length"></AiEmpty> <AiEmpty v-if="!list.length"></AiEmpty>
@@ -235,7 +235,9 @@
return { return {
...item, ...item,
id: item[this.props.id], id: item[this.props.id],
name: item[this.props.label] name: item[this.props.label],
[this.props.id]: item[this.props.id],
[this.props.label]: item[this.props.label]
} }
}))) })))
@@ -254,7 +256,9 @@
return { return {
...item, ...item,
id: item[this.props.id], id: item[this.props.id],
name: item[this.props.label] name: item[this.props.label],
[this.props.id]: item[this.props.id],
[this.props.label]: item[this.props.label]
} }
}))) })))
this.userIds = this.chooseUser.map(v => v[this.props.id]) this.userIds = this.chooseUser.map(v => v[this.props.id])
@@ -278,14 +282,18 @@
return { return {
...item, ...item,
id: item[this.props.id], id: item[this.props.id],
name: item[this.props.label] name: item[this.props.label],
[this.props.id]: item[this.props.id],
[this.props.label]: item[this.props.label]
} }
}))) })))
this.chooseUser = JSON.parse(JSON.stringify(this.value.map(item => { this.chooseUser = JSON.parse(JSON.stringify(this.value.map(item => {
return { return {
...item, ...item,
id: item[this.props.id], id: item[this.props.id],
name: item[this.props.label] name: item[this.props.label],
[this.props.id]: item[this.props.id],
[this.props.label]: item[this.props.label]
} }
}))) })))
@@ -307,18 +315,18 @@
] ]
} else { } else {
this.list.forEach(v => { this.list.forEach(v => {
if (!this.chooseUser.map(e => e.id).includes(v.id)) { if (!this.chooseUser.map(e => e[this.props.id]).includes(v[this.props.id])) {
this.chooseUser.push(v) this.chooseUser.push(v)
} }
}) })
} }
} else { } else {
this.chooseUser = this.chooseUser.filter(v => { this.chooseUser = this.chooseUser.filter(v => {
return !this.list.map(v => v.id).includes(v.id) return !this.list.map(v => v[this.props.id]).includes(v[this.props.id])
}) })
} }
this.userIds = this.chooseUser.map(v => v.id) this.userIds = this.chooseUser.map(v => v[this.props.id])
}, },
showSelecter () { showSelecter () {
@@ -328,7 +336,7 @@
}, },
onTreeChange (e) { onTreeChange (e) {
this.search.departmentId = e.id || '' this.search.departmentId = e[this.props.id] || ''
this.search.current = 1 this.search.current = 1
this.$nextTick(() => { this.$nextTick(() => {
@@ -346,7 +354,7 @@
onboxChange (id, v) { onboxChange (id, v) {
if (!this.isMultiple) { if (!this.isMultiple) {
const checked = this.list.filter(v => v.id === id) const checked = this.list.filter(v => v[this.props.id] === id)
if (v) { if (v) {
const v = checked[checked.length - 1] const v = checked[checked.length - 1]
this.chooseUser = [v] this.chooseUser = [v]
@@ -354,7 +362,7 @@
} }
if (!v) { if (!v) {
if (this.chooseUser.findIndex(v => v.id === id) > -1) { if (this.chooseUser.findIndex(v => v[this.props.id] === id) > -1) {
this.chooseUser = [] this.chooseUser = []
} }
} }
@@ -363,21 +371,21 @@
onCheckboxChange (ids) { onCheckboxChange (ids) {
this.$nextTick(() => { this.$nextTick(() => {
const checked = this.list.filter(v => ids.includes(v.id)) const checked = this.list.filter(v => ids.includes(v[this.props.id]))
const unChecked = this.list.filter(v => !ids.includes(v.id)) const unChecked = this.list.filter(v => !ids.includes(v[this.props.id]))
if (!this.isMultiple) { if (!this.isMultiple) {
return false return false
} }
this.chooseUser.forEach((v, index) => { this.chooseUser.forEach((v, index) => {
if (unChecked.findIndex(e => e.id === v.id) > -1) { if (unChecked.findIndex(e => e[this.props.id] === v[this.props.id]) > -1) {
this.chooseUser.splice(index, 1) this.chooseUser.splice(index, 1)
} }
}) })
checked.forEach(v => { checked.forEach(v => {
if (this.chooseUser.findIndex(e => e.id === v.id) < 0) { if (this.chooseUser.findIndex(e => e[this.props.id] === v[this.props.id]) < 0) {
this.chooseUser.push(v) this.chooseUser.push(v)
} }
}) })
@@ -505,16 +513,12 @@
this.$emit('change', JSON.parse(JSON.stringify(this.chooseUser.map(item => { this.$emit('change', JSON.parse(JSON.stringify(this.chooseUser.map(item => {
return { return {
...item, ...item
[this.props.id]: item.id,
[this.props.label]: item.name
} }
})))) }))))
this.showUserList = JSON.parse(JSON.stringify(this.chooseUser.map(item => { this.showUserList = JSON.parse(JSON.stringify(this.chooseUser.map(item => {
return { return {
...item, ...item
[this.props.id]: item.id,
[this.props.label]: item.name
} }
}))) })))
this.isShow = false this.isShow = false