From c6aa3652be2321a30bafddd4bb44e3ab681d79e0 Mon Sep 17 00:00:00 2001 From: songshankun <songshankun@foxmail.com> Date: 星期四, 28 九月 2023 09:53:41 +0800 Subject: [PATCH] feat: 联系人页列表配置列显隐控制 --- src/views/client/client/AddClientManageDialog.vue | 82 +++++++++++++++++++++------------------- 1 files changed, 43 insertions(+), 39 deletions(-) diff --git a/src/views/client/client/AddClientManageDialog.vue b/src/views/client/client/AddClientManageDialog.vue index fd10291..5c15e02 100644 --- a/src/views/client/client/AddClientManageDialog.vue +++ b/src/views/client/client/AddClientManageDialog.vue @@ -490,7 +490,7 @@ </template> <script> -import { getAllData, getAddClient, getUpdateClient } from "@/api/client/client" +import { getAllData, getAddClient, getUpdateClient, checkNameClient } from "@/api/client/client" import { getCityList } from "@/api/common/address" export default { name: "AddClientManageDialog", @@ -518,7 +518,13 @@ dialogWidth: "80%", editConfig: this.editClientManageConfig, rules: { - name: [{ required: true, message: "璇疯緭鍏ュ鎴峰悕绉�", trigger: "blur" }], + name: [ + { required: true, message: "璇疯緭鍏ュ鎴峰悕绉�", trigger: "blur" }, + { + validator: this.checkNameClient, + trigger: "blur" + } + ], client_status_id: [{ required: true, message: "璇烽�夋嫨瀹㈡埛鐘舵��", trigger: "change" }], member_id: [{ required: true, message: "璇烽�夋嫨閿�鍞礋璐d汉", trigger: "change" }], approvalOpinion: [{ required: true, message: "璇疯緭鍏ュ鎵规剰瑙�", trigger: "blur" }], @@ -554,7 +560,8 @@ provinceOptions: [], // 鐪佷唤 cityOptions: [], // 鍩庡競 regionOptions: [], // 鍖哄煙 - approvalWorkflowOptions: [] // 瀹℃壒娴佺▼ + approvalWorkflowOptions: [], // 瀹℃壒娴佺▼ + clientName: this.editClientManageConfig.infomation.name } }, created() { @@ -603,43 +610,29 @@ const params = this.saveParams() console.log(params) if (this.editConfig.title === "鏂板缓") { - getAddClient(params) - .then((res) => { - console.log(res) - this.editConfig.visible = false - if (res.code === 200) { - this.$message({ - message: "娣诲姞鎴愬姛", - type: "success" - }) - if (this.editConfig.isSalesOpportunity) { - this.$emit("salesOpportunityClick", this.editConfig.infomation) - } else if (this.editConfig.title === "鏂板缓" && this.editConfig.infomation.sales_leads_id) { - this.$parent.handleClose() - } else { - this.$parent.getData() - } - } - }) - .catch((err) => { - console.log(err) - }) - } else { - getUpdateClient(params) - .then((res) => { - console.log(res) - this.editConfig.visible = false - if (res.code === 200) { - this.$message({ - message: "缂栬緫鎴愬姛", - type: "success" - }) + getAddClient(params).then((res) => { + console.log(res) + this.editConfig.visible = false + if (res.code === 200) { + this.$message.success("娣诲姞鎴愬姛") + if (this.editConfig.isSalesOpportunity) { + this.$emit("salesOpportunityClick", this.editConfig.infomation) + } else if (this.editConfig.title === "鏂板缓" && this.editConfig.infomation.sales_leads_id) { + this.$parent.handleClose() + } else { this.$parent.getData() } - }) - .catch((err) => { - console.log(err) - }) + } + }) + } else { + getUpdateClient(params).then((res) => { + console.log(res) + this.editConfig.visible = false + if (res.code === 200) { + this.$message.success("缂栬緫鎴愬姛") + this.$parent.getData() + } + }) } } else { console.log("error submit") @@ -691,7 +684,8 @@ remark: data.remark || "", representative: data.representative || "", service_member_id: data.service_member_id || 0, - sales_leads_id: data.sales_leads_id || 0 + sales_leads_id: data.sales_leads_id || 0, + contact_id: data.contact_id || 0 } return params }, @@ -719,6 +713,16 @@ } } }) + }, + // 鏌ラ噸 + async checkNameClient(rule, value, callback) { + if (this.editConfig.title === "鏂板缓" || this.clientName !== this.editConfig.infomation.name) { + await checkNameClient({ name: value }).then((res) => { + if (res.data.code === 700001) { + return callback(new Error("瀹㈡埛鍚嶇О閲嶅")) + } + }) + } } } } -- Gitblit v1.8.0