From 0f5e988ddea93b06c5e2568b372c351cfaed016d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=86=8A=E4=B8=BD=E5=90=9B?= <664953382@qq.com> Date: Fri, 20 Aug 2021 17:37:09 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=B0=E7=BA=A7=E5=B8=82=E7=9A=84=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E5=8F=8A=E4=BC=81=E4=B8=9A=E7=94=BB=E5=83=8F=E7=9A=84?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=9B=9E=E6=98=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/account/index.vue | 10 ---- src/views/customer/add.vue | 92 ++++++++++++++++++------------ src/views/customer/index.vue | 22 ++++++- src/views/feedback/index.vue | 10 ---- src/views/policy/library/add.vue | 2 +- src/views/policy/library/index.vue | 77 +++++++++++++++++++------ src/views/policy/tag/index.vue | 2 +- 7 files changed, 135 insertions(+), 80 deletions(-) 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 @@ > 删除