地级市的类型及企业画像的数据回显

This commit is contained in:
熊丽君
2021-08-20 17:37:09 +08:00
parent e641f06a72
commit 0f5e988dde
7 changed files with 135 additions and 80 deletions

View File

@ -99,16 +99,6 @@ export default {
phone:''
},
total:0,
optionList1: [
{
value: '1',
label: '地级市'
},
{
value: '2',
label: '合肥区县'
}
]
};
},
methods: {

View File

@ -122,7 +122,7 @@
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="请选择">
<el-option
v-for="i in item.labelList"
:key="i.id"
@ -196,11 +196,11 @@ export default {
},
optionList1: [
{
value: 1,
value: 2,
label: '地级市'
},
{
value: 2,
value: 3,
label: '合肥区县'
}
],
@ -276,6 +276,12 @@ export default {
submitForm(formName) {
this.$refs[formName].validate(valid => {
if (valid) {
let formData = Object.assign({},this.ruleForm)
let ids = [];
formData.labelIdList.map((item) => {
ids = [...ids, ...item];
});
formData.labelIdList = ids
if (this.editPage) {
// 修改
checkPhoneExist({
@ -283,7 +289,7 @@ export default {
userId: this.ruleForm.userId
}).then(({ data }) => {
if (data === 500) return this.msgError('该手机号已被注册');
updateCompanyUser(this.ruleForm).then(({ message }) => {
updateCompanyUser(formData).then(({ message }) => {
this.msgSuccess(message);
this.$router.go(-1);
});
@ -293,7 +299,7 @@ export default {
checkPhoneExist({ phone: this.ruleForm.username }).then(
({ data }) => {
if (data === 500) return this.msgError('该手机号已被注册');
addCompanyUser(this.ruleForm).then(({ message }) => {
addCompanyUser(formData).then(({ message }) => {
this.msgSuccess(message);
this.$router.go(-1);
});
@ -310,7 +316,7 @@ export default {
handleCity(e) {
this.ruleForm.cityId = '';
// 地级市
if (e === 1) {
if (e === 2) {
this.getType(false);
} else {
this.getCity(false);
@ -320,7 +326,6 @@ export default {
getType(edit, info) {
getDictListByStatus({ type: 5 }).then(({ data }) => {
this.optionList2 = data;
console.log(info);
if (edit) this.ruleForm = info;
});
},
@ -328,7 +333,6 @@ export default {
getCity(edit, info) {
getDictListByStatus({ type: 6 }).then(({ data }) => {
this.optionList2 = data;
console.log(info);
if (edit) this.ruleForm = info;
});
},
@ -351,48 +355,60 @@ export default {
if(!this.check){
getOptions({ companyId: id }).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;
})
getCompanyUserInfo({ companyId: id }).then(({ data }) => {
data.addressType = data.addressType - 0;
console.log(this.arr);
data.labelIdList = this.arr.filter(item => item);
console.log(data);
if (data.addressType == 1) {
if (data.addressType == 2) {
this.getType(true, data);
} else {
} else if(data.addressType == 3) {
this.getCity(true, data);
}
});
});
}else{
// 账户管理
getCompanyUserInfoByUserId({ userId: id }).then(({ data }) => {
data.addressType = data.addressType - 0;
getOptions({ companyId: data.companyId }).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].name
: ''
: undefined
);
});
if (data.addressType == 1) {
this.getType(true, data);
} else {
this.getCity(true, data);
getCompanyUserInfoByUserId({ userId: id }).then(({ data }) => {
data.addressType = data.addressType - 0;
getOptions({ companyId: data.companyId }).then(({ data }) => {
this.labelList = data;
const arrs = data.map(item =>
item.labelList
? item.labelList.map(v => {
if(v.isHas){
return v.name
}
});
}).filter(v=>v)
: undefined
);
arrs.map(item=>{
this.arr = [...this.arr,...item]
})
});
if (data.addressType == 2) {
this.getType(true, data);
} else if (data.addressType == 3) {
this.getCity(true, data);
}
});
}
} else {
getLabelSetting({

View File

@ -48,6 +48,19 @@
}}</el-link>
</template>
</el-table-column>
<el-table-column
label="头像"
align="center"
prop="icon"
>
<template slot-scope="scope">
<el-image
style="width: 100px; height: 100px"
:src="scope.row.icon"
fit="cover">
</el-image>
</template>
</el-table-column>
<el-table-column label="企业地址" align="center" prop="cityType">
<template slot-scope="scope">
{{
@ -56,6 +69,11 @@
}}{{ scope.row.cityName }}
</template>
</el-table-column>
<el-table-column
label="用户姓名"
align="center"
prop="nickName"
></el-table-column>
<el-table-column
label="登录手机号"
align="center"
@ -122,11 +140,11 @@ export default {
unscrambleList: [],
optionList1: [
{
value: '1',
value: '2',
label: '地级市'
},
{
value: '2',
value: '3',
label: '合肥区县'
}
]

View File

@ -56,16 +56,6 @@ export default {
pageSize: 10,
},
total:0,
optionList1: [
{
value: '1',
label: '地级市'
},
{
value: '2',
label: '合肥区县'
}
]
};
},
methods: {

View File

@ -283,7 +283,7 @@ export default {
ruleForm: {
handler: function () {
this.$nextTick(() => {
this.formatRichText(this.ruleForm.downloadUrl);
this.formatRichText(this.ruleForm.downloadUrl, this.ruleForm.id);
});
},
},

View File

@ -212,8 +212,8 @@
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<el-dialog :title="str" :visible.sync="dialogVisible" width="20%">
<el-form ref="form" :model="form" label-width="80px">
<el-dialog :title="str" :visible.sync="dialogVisible" width="30%">
<el-form ref="form" :model="form" label-width="200px">
<section v-show="str === '标签设置'">
<el-form-item
:label="item.name"
@ -221,7 +221,7 @@
:key="item.id"
>
<!-- v-if="item.labelList" -->
<el-select v-model="arr[index]" placeholder="请选择" clearable>
<el-select v-model="arr[index]" multiple placeholder="请选择">
<el-option
v-for="i in item.labelList"
:key="i.id"
@ -399,21 +399,56 @@ export default {
getLabelSetting({ policyId: row.id, pageNum: 1, pageSize: 100 }).then(
({ data }) => {
this.labelList = data.list;
this.arr = data.list.map((item) =>
item.labelList
? item.labelList.filter((v) => v.isHas)[0]
? item.labelList.filter((v) => v.isHas)[0].id
: ''
: undefined
);
// this.arr = data.list.map(item => {
// // return item.labelList ? item.labelList.map(v => v.id) : undefined;
// return item.labelList
// ? item.labelList.filter(v => v.isHas)[0]
// ? item.labelList.filter(v => v.isHas)[0].id
// 单选
// this.arr = data.list.map((item) =>
// item.labelList
// ? item.labelList.filter((v) => v.isHas)[0]
// ? item.labelList.filter((v) => v.isHas)[0].id
// : ''
// : undefined;
// });
// : undefined
// );
// 多选
this.arr = data.list.map((item) => {
// return item.labelList
// ? item.labelList.filter((v, i) => {
// return v.isHas;
// })
// : undefined;
return item.labelList
? item.labelList
.map((v) => {
if (v.isHas) {
return v.id;
}
})
.filter((i) => i)
: undefined;
// if (item.labelList) {
// let objs = [];
// item.labelList.forEach(function (element) {
// if (element.isHas) {
// objs.push(element.id);
// }
// });
// return objs;
// }
// return item.labelList
// ? item.labelList
// .map(function (element) {
// if (element.isHas) {
// return element.id;
// }
// })
// .filter(function (element) {
// console.log(element);
// return element !== undefined;
// // if (element !== undefined) return element;
// })
// : undefined;
});
}
);
},
@ -424,7 +459,13 @@ export default {
},
submitForm() {
if (this.str === '标签设置') {
let ids = this.arr.filter((item) => item);
// 单选
// let ids = this.arr.filter((item) => item);
// 多选
let ids = [];
this.arr.map((item) => {
ids = [...ids, ...item];
});
setPolicyLabel({ id: this.policyId, ids }).then(({ message }) => {
this.msgSuccess(message);
this.dialogVisible = false;

View File

@ -43,7 +43,7 @@
>
<el-button
@click="handleDelete(scope.row.id)"
:disabled="scope.row.name == '类型' ? true : false"
:disabled="scope.row.name == '类型' || scope.row.name == '行业' ? true : false"
type="text"
size="small"
>删除</el-button