From f8d5828960bf8a44a45198984b99f7796586f90c Mon Sep 17 00:00:00 2001 From: yanran200730 Date: Tue, 18 Jan 2022 14:32:27 +0800 Subject: [PATCH] 26805 --- .../2.0.5/AppGridMember/components/add.vue | 59 +++++++++++-------- .../3.0.0/AppRiskArea/components/List.vue | 2 +- 2 files changed, 35 insertions(+), 26 deletions(-) diff --git a/packages/2.0.5/AppGridMember/components/add.vue b/packages/2.0.5/AppGridMember/components/add.vue index a27a5a4f..3cba47e0 100644 --- a/packages/2.0.5/AppGridMember/components/add.vue +++ b/packages/2.0.5/AppGridMember/components/add.vue @@ -34,6 +34,7 @@ @@ -56,6 +57,7 @@ @@ -67,7 +69,7 @@
- + - + @@ -159,7 +161,7 @@ - + @@ -388,36 +390,43 @@ export default { this.$refs["rules"].validate((valid) => { if (valid) { for (let i = 0; i < this.forms.girdInfoList.length; i++) { - if (!this.forms.girdInfoList[i].checkType) { + const currInfo = this.forms.girdInfoList[i] + const arr = JSON.parse(JSON.stringify(this.forms.girdInfoList)) + arr.splice(i, 1) + const sameInfo = arr.filter(v => v.id === currInfo.id) + if (!currInfo.checkType) { return this.$message.error('请选择网格员类型') } - if (!this.forms.girdInfoList[i].id) { + + if (!currInfo.id) { return this.$message.error('请选择网格') } + + if (currInfo.checkType === '1' && currInfo.girdLevel !== '2') { + return this.$message.error(`一级、二级网格不能添加网格员`) + } + + if (sameInfo.length) { + return this.$message.error('不能选择同一网格') + } } - this.instance - .post( - `/app/appgirdmemberinfo/addOrUpdate`, - { - ...this.forms, - girdInfoListStr: this.forms.girdInfoList.map(v => v.girdName).join(',') - }, - null - ) - .then((res) => { - if (res.code == 0) { - if (this.title == "添加网格员") { - this.cancel(true) - } else { - this.editOne = false; - this.editTwo = false; - this.searchDetail(); - } + this.instance.post(`/app/appgirdmemberinfo/addOrUpdate`,{ + ...this.forms, + girdInfoListStr: this.forms.girdInfoList.map(v => v.girdName).join(',') + }).then((res) => { + if (res.code == 0) { + if (this.title == "添加网格员") { + this.cancel(true) + } else { + this.editOne = false + this.editTwo = false + this.searchDetail() } - }); + } + }); } else { - return false; + return false } }); }, diff --git a/packages/3.0.0/AppRiskArea/components/List.vue b/packages/3.0.0/AppRiskArea/components/List.vue index f2f9f8fb..6cc3bd8a 100644 --- a/packages/3.0.0/AppRiskArea/components/List.vue +++ b/packages/3.0.0/AppRiskArea/components/List.vue @@ -1,7 +1,7 @@