增加替换接口的参数
This commit is contained in:
@@ -83,7 +83,9 @@
|
||||
<el-scrollbar class="AiWechatSelecter-list">
|
||||
<div class="user-wrapper">
|
||||
<el-checkbox-group v-model="userIds" @change="onCheckboxChange">
|
||||
<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 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>
|
||||
</div>
|
||||
<AiEmpty v-if="!list.length"></AiEmpty>
|
||||
@@ -99,7 +101,9 @@
|
||||
@size-change="getList"
|
||||
@current-change="getList">
|
||||
<div class="paginationPre" v-if="isMultiple">
|
||||
<el-checkbox :disabled="!list.length" :indeterminate="isIndeterminate" @change="onAllChange" v-model="isCheckAll">全选</el-checkbox>
|
||||
<el-checkbox :disabled="!list.length" :indeterminate="isIndeterminate" @change="onAllChange"
|
||||
v-model="isCheckAll">全选
|
||||
</el-checkbox>
|
||||
</div>
|
||||
</el-pagination>
|
||||
</el-scrollbar>
|
||||
@@ -171,7 +175,8 @@
|
||||
id: 'id'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
actions: {default: () => ({})}
|
||||
},
|
||||
|
||||
data() {
|
||||
@@ -216,13 +221,7 @@
|
||||
const arr = this.chooseUser.filter(v => {
|
||||
return this.list.map(v => v.id).includes(v.id)
|
||||
})
|
||||
|
||||
if (arr.length === this.list.length && this.list.length) {
|
||||
this.isCheckAll = true
|
||||
} else {
|
||||
this.isCheckAll = false
|
||||
}
|
||||
|
||||
this.isCheckAll = !!(arr.length === this.list.length && this.list.length);
|
||||
return arr.length !== 0 && arr.length < this.list.length
|
||||
},
|
||||
|
||||
@@ -230,7 +229,6 @@
|
||||
if (!this.value) {
|
||||
return []
|
||||
}
|
||||
|
||||
this.chooseUser = JSON.parse(JSON.stringify(this.value.map(item => {
|
||||
return {
|
||||
...item,
|
||||
@@ -242,7 +240,12 @@
|
||||
})))
|
||||
|
||||
return this.value.map(v => v[this.props.id])
|
||||
}
|
||||
},
|
||||
action: v => ({
|
||||
tree: "/app/wxcp/wxdepartment/listAll",
|
||||
users: `/app/wxcp/wxuser/list`,
|
||||
...v.actions
|
||||
})
|
||||
},
|
||||
|
||||
watch: {
|
||||
@@ -393,20 +396,14 @@
|
||||
},
|
||||
|
||||
arrDeduplication(arr) {
|
||||
var hash = {}
|
||||
const hash = {};
|
||||
arr = arr.reduce(function (item, next) {
|
||||
hash[next.id] ? '' : hash[next.id] = true && item.push(next)
|
||||
hash[next.id] = hash[next.id] || item.push(next)
|
||||
return item
|
||||
}, [])
|
||||
|
||||
return arr
|
||||
},
|
||||
|
||||
onCheckChange (e, isChoosed, isSunChoosed) {
|
||||
this.$nextTick(() => {
|
||||
})
|
||||
},
|
||||
|
||||
removeUser(index, item) {
|
||||
this.chooseUser.splice(index, 1)
|
||||
this.userIds.splice(this.userIds.findIndex(v => v === item.id), 1)
|
||||
@@ -438,7 +435,7 @@
|
||||
|
||||
getList() {
|
||||
this.loading = true
|
||||
this.instance.post(`/app/wxcp/wxuser/list`, null, {
|
||||
this.instance.post(this.action.users, null, {
|
||||
params: {
|
||||
...this.search,
|
||||
departmentId: this.search.departmentId,
|
||||
@@ -472,21 +469,14 @@
|
||||
},
|
||||
|
||||
getTree() {
|
||||
this.instance.post(`/app/wxcp/wxdepartment/listAll?unitName=${this.unitName}`).then(res => {
|
||||
if (res.code === 0) {
|
||||
let parent = res.data.map(v => {
|
||||
v.label = v.name
|
||||
v.children = []
|
||||
|
||||
return v
|
||||
}).filter(e => !e.parentid)[0]
|
||||
|
||||
if (!this.defaultExpanded.length) {
|
||||
this.defaultExpanded = [parent.id]
|
||||
}
|
||||
this.search.departmentId = parent.id
|
||||
this.addChild(parent, res.data)
|
||||
this.unitList = [parent]
|
||||
this.instance.post(this.action.tree, null, {
|
||||
params: {unitName: this.unitName}
|
||||
}).then(res => {
|
||||
if (res?.data) {
|
||||
this.unitList = this.$arr2tree(res.data)
|
||||
const defaultRoot = this.unitList.at(0)?.id
|
||||
this.defaultExpanded = [defaultRoot].filter(Boolean) || []
|
||||
this.search.departmentId = defaultRoot
|
||||
}
|
||||
})
|
||||
},
|
||||
@@ -636,6 +626,7 @@
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
img {
|
||||
width: 27px;
|
||||
height: 27px;
|
||||
@@ -779,6 +770,7 @@
|
||||
justify-content: flex-end;
|
||||
background: #fcfcfc;
|
||||
padding: 10px 10px;
|
||||
|
||||
.paginationPre {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -839,6 +831,7 @@
|
||||
.tags-wrapper {
|
||||
padding: 0 8px;
|
||||
}
|
||||
|
||||
.el-tag {
|
||||
margin: 0 8px 8px 0px;
|
||||
color: #222222;
|
||||
|
||||
Reference in New Issue
Block a user