From d3a5476064256802f9e0c0626bed6b8048e51bc0 Mon Sep 17 00:00:00 2001 From: yangfeng <wanwan926_4@163.com> Date: 星期五, 13 十月 2023 17:37:00 +0800 Subject: [PATCH] 部分get请求获取返回数据修改 --- src/views/client/salesLead/AddSalesLeadDialog.vue | 175 +++++++++++++++++++++++++++++++++++++-------------------- 1 files changed, 113 insertions(+), 62 deletions(-) diff --git a/src/views/client/salesLead/AddSalesLeadDialog.vue b/src/views/client/salesLead/AddSalesLeadDialog.vue index 4c9ec58..e61ba56 100644 --- a/src/views/client/salesLead/AddSalesLeadDialog.vue +++ b/src/views/client/salesLead/AddSalesLeadDialog.vue @@ -11,7 +11,7 @@ :model="editConfig.infomation" :rules="rules" label-position="right" - label-width="308px" + label-width="130px" size="mini" > <!-- 淇℃伅 --> @@ -21,17 +21,32 @@ <div class="basic-info-view"> <el-row> <el-col :span="12"> - <el-form-item label="瀹㈡埛鍚嶇О" prop="name"> - <el-input v-model="editConfig.infomation.name"></el-input> + <el-form-item label="閿�鍞嚎绱㈢紪鍙�" prop="number"> + <WordInput + v-if="codenumer && (explain != '' || isIdDisabled)&&method == 0" + :codenumer="codenumer" + :sum="sum" + :disabled="this.editConfig.title !== '鏂板缓' || 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"> + <el-input v-model="editConfig.infomation.name" style="width: 100%"></el-input> </el-form-item> </el-col> - </el-row> - <el-row> + <!-- </el-row> + <el-row> --> <el-col :span="12"> <el-form-item label="鑱旂郴浜哄鍚�" prop="contact_name"> <el-input v-model="editConfig.infomation.contact_name"></el-input> @@ -42,8 +57,8 @@ <el-input v-model="editConfig.infomation.contact_position"></el-input> </el-form-item> </el-col> - </el-row> - <el-row> + <!-- </el-row> + <el-row> --> <el-col :span="12"> <el-form-item label="鎵嬫満鍙风爜" prop="contact_phone"> <el-input @@ -55,14 +70,14 @@ </el-form-item> </el-col> <el-col :span="12"> - <el-form-item label="鍟嗘満鐘舵��" prop="businessStatus"> + <el-form-item label="绾跨储鐘舵��" prop="businessStatus"> <span>{{ editConfig.infomation.businessStatus }}</span> </el-form-item> </el-col> </el-row> <el-row> <el-col :span="12"> - <el-form-item label="鍟嗘満鏉ユ簮" prop="sales_sources_id"> + <el-form-item label="绾跨储鏉ユ簮" prop="sales_sources_id"> <div class="common-select"> <el-select v-model="editConfig.infomation.sales_sources_id" @@ -78,15 +93,15 @@ > </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> <el-col :span="12"> <el-form-item label="璐熻矗浜�" prop="member_id"> - <el-select v-model="editConfig.infomation.member_id" placeholder="璇烽�夋嫨" size="mini"> + <el-select v-model="editConfig.infomation.member_id" placeholder="璇烽�夋嫨" style="width: 100%" size="mini"> <el-option v-for="item in memberOptions" :key="item.id" :label="item.username" :value="item.id"> </el-option> </el-select> @@ -120,11 +135,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> @@ -136,11 +152,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> @@ -152,15 +169,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 @@ -175,20 +193,20 @@ <div class="common-select-btn"><i class="el-icon-setting"></i></div> </div> </el-form-item> - </el-col> - </el-row> - <!-- <el-row> + </el-col> --> + <!-- </el-row> --> + <!-- <el-row> --> <el-col :span="24"> - <el-form-item label="鍦板潃" prop="address"> + <el-form-item label="璇︾粏鍦板潃" prop="detail_address"> <el-input type="textarea" :autosize="{ minRows: 2, maxRows: 4 }" placeholder="璇疯緭鍏ュ唴瀹�" - v-model="editConfig.infomation.address" + v-model="editConfig.infomation.detail_address" ></el-input> </el-form-item> </el-col> - </el-row> --> + </el-row> </div> <!-- 澶囨敞淇℃伅 --> <div v-if="isUnflod" class="basic-info-title">澶囨敞淇℃伅</div> @@ -228,9 +246,11 @@ import EditDropdownDialog from "@/views/other/commonDialog/EditDropdownDialog" import { getAddSalesLeads, getUpdateSalesLeads } from "@/api/client/salesLead" import { getAllData } from "@/api/client/client" - +import { getCityList } from "@/api/common/address" +import codeMixin from "@/views/client/followupRecords/mixin/codeMixin"; export default { name: "AddSalesLeadDialog", + mixins: [codeMixin], props: { editSalesLeadConfig: { type: Object, @@ -247,7 +267,7 @@ computed: {}, data() { return { - dialogWidth: "80%", + dialogWidth: "50%", editConfig: this.editSalesLeadConfig, rules: { name: [{ required: true, message: "璇疯緭鍏ュ鎴峰悕绉�", trigger: "blur" }], @@ -255,7 +275,7 @@ businessStatus: [{ required: true, message: "璇疯緭鍏ュ晢鏈虹姸鎬�", trigger: "blur" }], sales_sources_id: [{ required: true, message: "璇烽�夋嫨鍟嗘満鏉ユ簮", trigger: "change" }], contact_phone: [ - { required: false, message: "", trigger: "blur" }, + { required: true, message: "璇疯緭鍏ユ墜鏈哄彿鐮�", trigger: "blur" }, { len: 11, message: "闀垮害鍦�11涓瓧绗�", trigger: "blur" }, { pattern: /^1(3\d|4[5-9]|5[0-35-9]|6[2567]|7[0-8]|8\d|9[0-35-9])\d{8}$/, @@ -266,7 +286,7 @@ }, businessSourceOptions: [], memberOptions: [], - countryOptions: [], // 鍥藉 + countryOptions: [{ id: 1, name: "涓浗" }], // 鍥藉 provinceOptions: [], // 鐪佷唤 cityOptions: [], // 鍩庡競 regionOptions: [], // 鍖哄煙 @@ -280,18 +300,44 @@ } }, created() { + if (this.editConfig.title !== "鏂板缓" && this.editConfig.infomation.province_id !== 0) { + this.getCityList(this.editConfig.infomation.province_id, "edit") + } this.getCommonData() + this.formInfo(); }, mounted() {}, + watch:{ + 'editSalesLeadConfig.visible'(val){ + if(val){ + this.formInfo() + } + }, + 'editSalesLeadConfig.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.businessSourceOptions = res.data.sales_source - 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 this.memberOptions = res.data.member }) @@ -320,41 +366,30 @@ number: this.editConfig.infomation.number || "", province_id: this.editConfig.infomation.province_id || 0, region_id: this.editConfig.infomation.region_id || 0, - sales_sources_id: this.editConfig.infomation.sales_sources_id || 0 + sales_sources_id: this.editConfig.infomation.sales_sources_id || 0, + detail_address: this.editConfig.infomation.detail_address || "", + codeStandID:this.editConfig.infomation.ID, + codeRule:this.codeRule, } console.log(params) if (this.editConfig.title === "鏂板缓") { - getAddSalesLeads(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) - }) + getAddSalesLeads(params).then((res) => { + console.log(res) + this.editConfig.visible = false + if (res.code === 200) { + this.$message.success("娣诲姞鎴愬姛") + this.$parent.getData() + } + }) } else { - getUpdateSalesLeads(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) - }) + getUpdateSalesLeads(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") @@ -381,6 +416,21 @@ confirmPhone(value) { const inputValue = value.replace(/[^\d*]/g, "") this.editConfig.infomation.contact_phone = inputValue + }, + // 閫夋嫨鐪佷唤 + 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 = "" + } + } + }) } } } @@ -405,7 +455,7 @@ .common-select { display: flex; .common-select-sel { - width: 270px; + width:100%; } .common-select-btn { margin-left: 5px; @@ -420,6 +470,7 @@ height: 30px; justify-content: center; align-items: center; + cursor:pointer; color: #6166d3; } } -- Gitblit v1.8.0