添加图片和修改画像的多选

This commit is contained in:
熊丽君
2021-08-20 14:26:33 +08:00
parent b5d5016423
commit eb782ddaf4
21 changed files with 163 additions and 112 deletions

View File

@ -78,7 +78,12 @@
v-for="(item, index) in labelList"
:key="item.id"
>
<el-select v-model="arr[index]" placeholder="请选择" clearable>
<el-select
v-model="arr[index]"
multiple
placeholder="请选择"
clearable
>
<el-option
v-for="i in item.labelList"
:key="i.id"
@ -166,13 +171,26 @@ export default {
getLabelSetting({ companyId: data ? data.companyId : 1 }).then(
({ data }) => {
this.labelList = data;
this.arr = data.map(item =>
item.labelList
? item.labelList.filter(v => v.isHas)[0]
? item.labelList.filter(v => v.isHas)[0].id
: ''
: undefined
);
// 单选
// this.arr = data.map(item =>
// item.labelList
// ? item.labelList.filter(v => v.isHas)[0]
// ? item.labelList.filter(v => v.isHas)[0].id
// : ''
// : undefined
// );
// 多选
this.arr = data.map(item => {
return item.labelList
? item.labelList
.map(v => {
if (v.isHas) {
return v.id;
}
})
.filter(i => i)
: undefined;
});
}
);
});
@ -212,6 +230,11 @@ export default {
submitForm() {
this.$refs['form'].validate(valid => {
if (valid) {
let ids = [];
this.arr.map(item => {
ids = [...ids, ...item];
});
this.form.labelIdList = ids;
updateCompanyUser(this.form).then(({ message }) => {
this.msgSuccess(message);
this.getUserInfo();