From 003a3d7a15cad3c10c04696b318f677c9a123921 Mon Sep 17 00:00:00 2001 From: haoxuan <haoxuan> Date: 星期三, 11 十月 2023 15:14:46 +0800 Subject: [PATCH] 销售线索+客户管理+联系人的编码 --- src/views/client/client/AddClientManageDialog.vue | 310 +++++++++++++++++++++++++++++++++----------------- 1 files changed, 203 insertions(+), 107 deletions(-) diff --git a/src/views/client/client/AddClientManageDialog.vue b/src/views/client/client/AddClientManageDialog.vue index c262d24..abb9144 100644 --- a/src/views/client/client/AddClientManageDialog.vue +++ b/src/views/client/client/AddClientManageDialog.vue @@ -5,13 +5,15 @@ :visible.sync="editConfig.visible" :width="dialogWidth" :before-close="handleClose" + append-to-body + custom-class="iframe-dialog" > <el-form ref="form" :model="editConfig.infomation" :rules="rules" label-position="right" - label-width="308px" + label-width="130px" size="mini" style="height: 60vh; overflow-x: hidden" > @@ -22,17 +24,32 @@ <div class="basic-info-view"> <el-row> <el-col :span="12"> - <el-form-item label="瀹㈡埛鍚嶇О" prop="name"> - <div class="custom-name"> - <el-input v-model="editConfig.infomation.name"></el-input> - <div class="common-select-btn"><i class="el-icon-house" title="宸ュ晢鏌ヨ"></i></div> - <div class="common-select-btn"><i class="el-icon-search" title="鏌ラ噸"></i></div> - </div> + <el-form-item label="瀹㈡埛缂栧彿" prop="number"> + <WordInput + v-if="codenumer && (explain != '' || isIdDisabled)&&method == 0" + :codenumer="codenumer" + :sum="sum" + :disabled="editConfig.infomation.id || isIdDisabled" + :inputValue="inputValue" + @codeList="codeList" + /> + <span v-else-if="method == 0" style="color: #f56c6c" + >璇蜂紭鍏堥厤缃紪鐮佽鑼� + <el-button type="text" @click="numberClick"> + 閰嶇疆瑙勮寖 + </el-button + ></span + > + <span v-else>鑷姩鐢熸垚</span> </el-form-item> </el-col> <el-col :span="12"> - <el-form-item label="瀹㈡埛缂栧彿" prop="number"> - <el-input v-model="editConfig.infomation.number"></el-input> + <el-form-item label="瀹㈡埛鍚嶇О" prop="name"> + <div class="custom-name"> + <el-input v-model="editConfig.infomation.name"></el-input> + <!-- <div class="common-select-btn"><i class="el-icon-house" title="宸ュ晢鏌ヨ"></i></div> --> + <!-- <div class="common-select-btn"><i class="el-icon-search" title="鏌ラ噸"></i></div> --> + </div> </el-form-item> </el-col> <el-col :span="12"> @@ -47,7 +64,7 @@ <el-option v-for="item in clientStatusOptions" :key="item.id" :label="item.name" :value="item.id"> </el-option> </el-select> - <div class="common-select-btn"><i class="el-icon-setting"></i></div> + <!-- <div class="common-select-btn"><i class="el-icon-setting"></i></div> --> </div> </el-form-item> </el-col> @@ -57,7 +74,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> @@ -76,7 +93,7 @@ <el-option v-for="item in clientTypeOptions" :key="item.id" :label="item.name" :value="item.id"> </el-option> </el-select> - <div class="common-select-btn"><i class="el-icon-setting"></i></div> + <!-- <div class="common-select-btn"><i class="el-icon-setting"></i></div> --> </div> </el-form-item> </el-col> @@ -92,9 +109,9 @@ <el-option v-for="item in clientSourceOptions" :key="item.id" :label="item.name" :value="item.id"> </el-option> </el-select> - <div class="common-select-btn" @click="editDropdownBox"> + <!-- <div class="common-select-btn" @click="editDropdownBox"> <i class="el-icon-setting"></i> - </div> + </div> --> </div> </el-form-item> </el-col> @@ -104,7 +121,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> @@ -128,8 +145,10 @@ <el-form-item label="涓嬫鍥炶鏃ユ湡" prop="next_visit_time"> <el-date-picker v-model="editConfig.infomation.next_visit_time" - type="datetime" + value-format="yyyy-MM-dd" + type="date" placeholder="閫夋嫨鏃ユ湡" + style="width: 100%" > </el-date-picker> </el-form-item> @@ -138,8 +157,10 @@ <el-form-item label="鏈�鏅氭湇鍔″埌鏈熸棩" prop="latest_service_time"> <el-date-picker v-model="editConfig.infomation.latest_service_time" - type="datetime" + value-format="yyyy-MM-dd" + type="date" placeholder="閫夋嫨鏃ユ湡" + style="width: 100%" > </el-date-picker> </el-form-item> @@ -198,7 +219,7 @@ <el-option v-for="item in industryOptions" :key="item.id" :label="item.name" :value="item.id"> </el-option> </el-select> - <div class="common-select-btn"><i class="el-icon-setting"></i></div> + <!-- <div class="common-select-btn"><i class="el-icon-setting"></i></div> --> </div> </el-form-item> </el-col> @@ -211,8 +232,10 @@ <el-form-item label="娉ㄥ唽鏃堕棿" prop="registration_time"> <el-date-picker v-model="editConfig.infomation.registration_time" + value-format="yyyy-MM-dd HH:mm:ss" type="datetime" placeholder="閫夋嫨鏃ユ湡鏃堕棿" + style="width: 100%" > </el-date-picker> </el-form-item> @@ -234,7 +257,7 @@ > </el-option> </el-select> - <div class="common-select-btn"><i class="el-icon-setting"></i></div> + <!-- <div class="common-select-btn"><i class="el-icon-setting"></i></div> --> </div> </el-form-item> </el-col> @@ -255,7 +278,7 @@ > </el-option> </el-select> - <div class="common-select-btn"><i class="el-icon-setting"></i></div> + <!-- <div class="common-select-btn"><i class="el-icon-setting"></i></div> --> </div> </el-form-item> </el-col> @@ -276,7 +299,7 @@ > </el-option> </el-select> - <div class="common-select-btn"><i class="el-icon-setting"></i></div> + <!-- <div class="common-select-btn"><i class="el-icon-setting"></i></div> --> </div> </el-form-item> </el-col> @@ -314,11 +337,12 @@ placeholder="璇烽�夋嫨" class="common-select-sel" size="mini" + disabled > <el-option v-for="item in countryOptions" :key="item.id" :label="item.name" :value="item.id"> </el-option> </el-select> - <div class="common-select-btn"><i class="el-icon-setting"></i></div> + <!-- <div class="common-select-btn"><i class="el-icon-setting"></i></div> --> </div> </el-form-item> </el-col> @@ -330,11 +354,12 @@ placeholder="璇烽�夋嫨" class="common-select-sel" size="mini" + @change="selProvinceChange" > <el-option v-for="item in provinceOptions" :key="item.id" :label="item.name" :value="item.id"> </el-option> </el-select> - <div class="common-select-btn"><i class="el-icon-setting"></i></div> + <!-- <div class="common-select-btn"><i class="el-icon-setting"></i></div> --> </div> </el-form-item> </el-col> @@ -346,15 +371,16 @@ placeholder="璇烽�夋嫨" class="common-select-sel" size="mini" + :disabled="cityOptions.length <= 0 ? true : false" > <el-option v-for="item in cityOptions" :key="item.id" :label="item.name" :value="item.id"> </el-option> </el-select> - <div class="common-select-btn"><i class="el-icon-setting"></i></div> + <!-- <div class="common-select-btn"><i class="el-icon-setting"></i></div> --> </div> </el-form-item> </el-col> - <el-col :span="12"> + <!-- <el-col :span="12"> <el-form-item label="鍖哄煙" prop="region_id"> <div class="common-select"> <el-select @@ -369,7 +395,7 @@ <div class="common-select-btn"><i class="el-icon-setting"></i></div> </div> </el-form-item> - </el-col> + </el-col> --> <el-col :span="24"> <el-form-item label="璇︾粏鍦板潃" prop="detail_address"> <el-input @@ -475,16 +501,19 @@ <div slot="footer" class="dialog-footer"> <!-- <el-button type="primary" size="small" @click="editConfig.visible = false">淇濆苟鎻愪氦瀹℃壒</el-button> --> <el-button type="primary" size="small" @click="saveClick('form')">淇濆瓨</el-button> - <el-button size="small" @click="editConfig.visible = false">鍙栨秷</el-button> + <el-button size="small" @click="handleClose">鍙栨秷</el-button> </div> </el-dialog> </div> </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" +import codeMixin from "@/views/client/followupRecords/mixin/codeMixin"; export default { name: "AddClientManageDialog", + mixins: [codeMixin], props: { editClientManageConfig: { type: Object, @@ -492,6 +521,7 @@ return { visible: false, title: "鏂板缓", + isSalesOpportunity: false, infomation: {} } } @@ -505,10 +535,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" }], @@ -518,6 +554,14 @@ { pattern: /^1(3\d|4[5-9]|5[0-35-9]|6[2567]|7[0-8]|8\d|9[0-35-9])\d{8}$/, message: "璇疯緭鍏ユ纭殑鎵嬫満鍙�", + trigger: "blur" + } + ], + contact_email: [ + { required: false, message: "", trigger: "blur" }, + { + pattern: /^[a-zA-Z0-9_\\.]+@[a-zA-Z0-9-]+[\\.a-zA-Z]+$/, + message: "璇疯緭鍏ユ纭殑閭鏍煎紡", trigger: "blur" } ] @@ -532,21 +576,48 @@ registerCapitalOptions: [], // 娉ㄥ唽璧勯噾 enterpriseNatureOptions: [], // 鍏徃鎬ц川 enterpriseScaleOptions: [], // 瀹㈡埛瑙勬ā - countryOptions: [], // 鍥藉 + countryOptions: [{ id: 1, name: "涓浗" }], // 鍥藉 provinceOptions: [], // 鐪佷唤 cityOptions: [], // 鍩庡競 regionOptions: [], // 鍖哄煙 - approvalWorkflowOptions: [] // 瀹℃壒娴佺▼ + approvalWorkflowOptions: [], // 瀹℃壒娴佺▼ + clientName: this.editClientManageConfig.infomation.name } }, created() { + if (this.editConfig.title !== "鏂板缓" && this.editConfig.infomation.province_id !== 0) { + this.getCityList(this.editConfig.infomation.province_id, "edit") + } this.getCommonData() + this.formInfo(); + }, + watch:{ + 'editClientManageConfig.visible'(val){ + if(val){ + this.formInfo() + } + }, + 'editClientManageConfig.infomation.codeStandID'(){ + this.formInfo() + } }, methods: { + formInfo(){ + this.objCode.type='瀹㈡埛缂栫爜' + this.objCode.codeStandID = '' + if(this.editConfig.infomation.codeStandID){ + this.objCode.codeStandID = this.editConfig.infomation.codeStandID; + } + this.getRCodeStandardList(); + }, getCommonData() { + this.editConfig.infomation.country_id = 1 + this.editConfig.infomation.province_id = + this.editConfig.infomation.province_id === 0 ? "" : this.editConfig.infomation.province_id + this.editConfig.infomation.city_id = + this.editConfig.infomation.city_id === 0 ? "" : this.editConfig.infomation.city_id getAllData() .then((res) => { - console.log(res) this.memberOptions = res.data.member this.clientSourceOptions = res.data.client_origin this.clientStatusOptions = res.data.client_status @@ -556,9 +627,8 @@ this.registerCapitalOptions = res.data.registered_capital this.enterpriseNatureOptions = res.data.enterprise_nature this.enterpriseScaleOptions = res.data.enterprise_scale - this.countryOptions = res.data.country + // this.countryOptions = res.data.country this.provinceOptions = res.data.province - this.cityOptions = res.data.city this.regionOptions = res.data.region }) .catch((err) => { @@ -567,6 +637,9 @@ }, handleClose() { this.editConfig.visible = false + if (this.editConfig.title === "鏂板缓" && this.editConfig.infomation.sales_leads_id) { + this.$parent.handleClose() + } }, // 淇濆瓨 saveClick(formName) { @@ -576,37 +649,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" - }) + 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({ - message: "缂栬緫鎴愬姛", - type: "success" - }) - this.$parent.getData() - } - }) - .catch((err) => { - console.log(err) - }) + 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") @@ -619,7 +684,7 @@ let params = { id: this.editConfig.title === "鏂板缓" ? 0 : data.id, business_scope: data.business_scope, - city_id: 0, + city_id: data.city_id || 0, client_level_id: data.client_level_id || 0, client_origin_id: data.client_origin_id || 0, client_status_id: data.client_status_id || 0, @@ -651,13 +716,17 @@ name: data.name || "", next_visit_time: data.next_visit_time || "", number: data.number || "", - province_id: 0, + province_id: data.province_id || 0, region_id: 0, registered_capital_id: data.registered_capital_id || 0, registration_time: data.registration_time || "", remark: data.remark || "", representative: data.representative || "", - service_member_id: data.service_member_id || 0 + service_member_id: data.service_member_id || 0, + sales_leads_id: data.sales_leads_id || 0, + contact_id: data.contact_id || 0, + codeStandID:data.ID, + codeRule:this.codeRule, } return params }, @@ -670,6 +739,31 @@ console.log("aaa") this.editDropdownConfig.editVisible = true this.editDropdownConfig.title = "瀹㈡埛鏉ユ簮" + }, + // 閫夋嫨鐪佷唤 + selProvinceChange(val) { + this.getCityList(val, "sel") + }, + async getCityList(val, value) { + await getCityList({ province_id: val }).then((res) => { + console.log(res) + if (res.data.code === 200) { + this.cityOptions = res.data.data.list + if (value === "sel") { + this.editConfig.infomation.city_id = "" + } + } + }) + }, + // 鏌ラ噸 + 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("瀹㈡埛鍚嶇О閲嶅")) + } + }) + } } } } @@ -677,54 +771,56 @@ <!-- Add "scoped" attribute to limit CSS to this component only --> <style lang="scss" scoped> -.add-client-manage { - .basic-info { - .basic-info-title { - background-color: #f4f8fe; - padding-left: 10px; - font-size: 15px; - font-weight: bold; - color: #666; - height: 42px; - line-height: 42px; - } - .basic-info-view { - margin-top: 10px; - padding-right: 40px; - .custom-name, - .common-select { +::v-deep { + .iframe-dialog .el-dialog__body { + .basic-info { + .basic-info-title { + background-color: #f4f8fe; + padding-left: 10px; + font-size: 15px; + font-weight: bold; + color: #666; + height: 42px; + line-height: 42px; + } + .basic-info-view { + margin-top: 10px; + padding-right: 40px; + .custom-name, + .common-select { + display: flex; + .common-select-btn { + margin-left: 5px; + font-size: 18px; + cursor: pointer; + } + } + .common-select { + .common-select-sel { + width: 100%; + } + } + } + .annex-view { display: flex; - .common-select-btn { - margin-left: 5px; - font-size: 18px; - cursor: pointer; - } - } - .common-select { - .common-select-sel { - width: 270px; + color: #6166d3; + .setFormat { + margin-left: 10px; } } } - .annex-view { + .unflod-collapse { display: flex; + height: 30px; + justify-content: center; + align-items: center; color: #6166d3; - .setFormat { - margin-left: 10px; - } } - } - .unflod-collapse { - display: flex; - height: 30px; - justify-content: center; - align-items: center; - color: #6166d3; - } - .dialog-footer { - background-color: #f5f5f5; - height: 55px; - line-height: 55px; + .dialog-footer { + background-color: #f5f5f5; + height: 55px; + line-height: 55px; + } } } </style> -- Gitblit v1.8.0