From b5acca92bd0794c24310d15c6fba8433d08119c9 Mon Sep 17 00:00:00 2001 From: songshankun <songshankun@foxmail.com> Date: 星期三, 11 十月 2023 15:27:09 +0800 Subject: [PATCH] feat: 销售机会报价单销售总单销售子单 编辑弹窗调整表单编号位置, 更换适配新的编码组件 --- src/views/client/client/AddClientManageDialog.vue | 95 +++++++++++++++++++++++++---------------------- 1 files changed, 51 insertions(+), 44 deletions(-) diff --git a/src/views/client/client/AddClientManageDialog.vue b/src/views/client/client/AddClientManageDialog.vue index fd10291..62e3560 100644 --- a/src/views/client/client/AddClientManageDialog.vue +++ b/src/views/client/client/AddClientManageDialog.vue @@ -13,7 +13,7 @@ :model="editConfig.infomation" :rules="rules" label-position="right" - label-width="308px" + label-width="130px" size="mini" style="height: 60vh; overflow-x: hidden" > @@ -59,7 +59,7 @@ v-model="editConfig.infomation.member_id" placeholder="璇烽�夋嫨" size="mini" - style="width: 63%" + style="width: 100%" > <el-option v-for="item in memberOptions" :key="item.id" :label="item.username" :value="item.id"> </el-option> @@ -106,7 +106,7 @@ v-model="editConfig.infomation.client_level_id" placeholder="璇烽�夋嫨" size="mini" - style="width: 63%" + style="width: 100%" > <el-option v-for="item in importantLevelOptions" :key="item.id" :label="item.name" :value="item.id"> </el-option> @@ -133,6 +133,7 @@ value-format="yyyy-MM-dd" type="date" placeholder="閫夋嫨鏃ユ湡" + style="width: 100%" > </el-date-picker> </el-form-item> @@ -144,6 +145,7 @@ value-format="yyyy-MM-dd" type="date" placeholder="閫夋嫨鏃ユ湡" + style="width: 100%" > </el-date-picker> </el-form-item> @@ -218,6 +220,7 @@ value-format="yyyy-MM-dd HH:mm:ss" type="datetime" placeholder="閫夋嫨鏃ユ湡鏃堕棿" + style="width: 100%" > </el-date-picker> </el-form-item> @@ -490,7 +493,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", @@ -515,10 +518,16 @@ }, data() { return { - dialogWidth: "80%", + dialogWidth: "50%", 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 +563,8 @@ provinceOptions: [], // 鐪佷唤 cityOptions: [], // 鍩庡競 regionOptions: [], // 鍖哄煙 - approvalWorkflowOptions: [] // 瀹℃壒娴佺▼ + approvalWorkflowOptions: [], // 瀹℃壒娴佺▼ + clientName: this.editClientManageConfig.infomation.name } }, created() { @@ -603,43 +613,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 +687,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 +716,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("瀹㈡埛鍚嶇О閲嶅")) + } + }) + } } } } @@ -752,7 +759,7 @@ } .common-select { .common-select-sel { - width: 270px; + width: 100%; } } } -- Gitblit v1.8.0