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

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:'' phone:''
}, },
total:0, total:0,
optionList1: [
{
value: '1',
label: '地级市'
},
{
value: '2',
label: '合肥区县'
}
]
}; };
}, },
methods: { methods: {

View File

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

View File

@ -48,6 +48,19 @@
}}</el-link> }}</el-link>
</template> </template>
</el-table-column> </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"> <el-table-column label="企业地址" align="center" prop="cityType">
<template slot-scope="scope"> <template slot-scope="scope">
{{ {{
@ -56,6 +69,11 @@
}}{{ scope.row.cityName }} }}{{ scope.row.cityName }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column
label="用户姓名"
align="center"
prop="nickName"
></el-table-column>
<el-table-column <el-table-column
label="登录手机号" label="登录手机号"
align="center" align="center"
@ -122,11 +140,11 @@ export default {
unscrambleList: [], unscrambleList: [],
optionList1: [ optionList1: [
{ {
value: '1', value: '2',
label: '地级市' label: '地级市'
}, },
{ {
value: '2', value: '3',
label: '合肥区县' label: '合肥区县'
} }
] ]

View File

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

View File

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

View File

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