diff --git a/src/views/account/index.vue b/src/views/account/index.vue index 385593b..4618291 100644 --- a/src/views/account/index.vue +++ b/src/views/account/index.vue @@ -99,16 +99,6 @@ export default { phone:'' }, total:0, - optionList1: [ - { - value: '1', - label: '地级市' - }, - { - value: '2', - label: '合肥区县' - } - ] }; }, methods: { diff --git a/src/views/customer/add.vue b/src/views/customer/add.vue index 8c732a9..09bd09d 100644 --- a/src/views/customer/add.vue +++ b/src/views/customer/add.vue @@ -122,7 +122,7 @@ v-for="(item, index) in labelList" :key="item.id" > - + { 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({ diff --git a/src/views/customer/index.vue b/src/views/customer/index.vue index 9fc1e2c..8c23d2f 100644 --- a/src/views/customer/index.vue +++ b/src/views/customer/index.vue @@ -48,6 +48,19 @@ }} + + + + { - this.formatRichText(this.ruleForm.downloadUrl); + this.formatRichText(this.ruleForm.downloadUrl, this.ruleForm.id); }); }, }, diff --git a/src/views/policy/library/index.vue b/src/views/policy/library/index.vue index 36a7e01..12a0fae 100644 --- a/src/views/policy/library/index.vue +++ b/src/views/policy/library/index.vue @@ -212,8 +212,8 @@ :limit.sync="queryParams.pageSize" @pagination="getList" /> - - + +
- + { 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; diff --git a/src/views/policy/tag/index.vue b/src/views/policy/tag/index.vue index 00ff44a..40e7bef 100644 --- a/src/views/policy/tag/index.vue +++ b/src/views/policy/tag/index.vue @@ -43,7 +43,7 @@ > 删除