From 05d33b5bb924e52b9e6185a1006b31a53370d350 Mon Sep 17 00:00:00 2001 From: yangfeng <wanwan926_4@163.com> Date: 星期二, 25 七月 2023 18:34:30 +0800 Subject: [PATCH] bug(4455)修复 --- src/views/sales/quotation/AddQuotationDialog.vue | 90 +++++++++++++++++++++++++++++++++++--------- 1 files changed, 71 insertions(+), 19 deletions(-) diff --git a/src/views/sales/quotation/AddQuotationDialog.vue b/src/views/sales/quotation/AddQuotationDialog.vue index 576dfc2..cb8f901 100644 --- a/src/views/sales/quotation/AddQuotationDialog.vue +++ b/src/views/sales/quotation/AddQuotationDialog.vue @@ -28,7 +28,7 @@ v-model="editConfig.infomation.client_name" :fetch-suggestions="querySearchAsync" value-key="name" - @select="handleSelectClient" + @select="handleSelectClient('client', $event)" ></el-autocomplete> <div class="common-select-btn" @click="selClientClick"> <i class="el-icon-circle-plus-outline" title="閫夋嫨"></i> @@ -75,9 +75,18 @@ <el-col :span="12"> <el-form-item label="鑱旂郴浜哄鍚�" prop="contact_id"> <div class="custom-name"> - <el-input v-model="editConfig.infomation.contact_id"></el-input> - <div class="common-select-btn"><i class="el-icon-circle-plus-outline" title="閫夋嫨"></i></div> - <div class="common-select-btn"><i class="el-icon-edit" title="缂栬緫"></i></div> + <el-autocomplete + v-model="editConfig.infomation.contact_name" + :fetch-suggestions="queryContactAsync" + value-key="name" + @select="handleSelectClient('contact', $event)" + ></el-autocomplete> + <div class="common-select-btn" @click="selClientClick('contact')"> + <i class="el-icon-circle-plus-outline" title="閫夋嫨"></i> + </div> + <div class="common-select-btn" @click="clearupClient('contact')"> + <i class="el-icon-edit-outline" title="娓呴櫎"></i> + </div> </div> </el-form-item> </el-col> @@ -213,6 +222,12 @@ :edit-common-config="editSelectClientConfig" @selClient="selClient" /> + <!-- 閫夋嫨鑱旂郴浜� --> + <SelectContactDialog + v-if="editSelectContactConfig.editVisible" + :edit-common-config="editSelectContactConfig" + @selClient="selClient" + /> </el-dialog> </div> </template> @@ -222,6 +237,7 @@ import { getAllData } from "@/api/client/client" import { getAddQuotation, getUpdateQuotation } from "@/api/sales/quotation" import SelectClientDialog from "@/views/other/commonDialog/SelectClientDialog" +import SelectContactDialog from "@/views/other/commonDialog/SelectContactDialog" export default { name: "QuotationDialog", props: { @@ -236,13 +252,16 @@ } } }, - components: { SelectClientDialog }, + components: { SelectClientDialog, SelectContactDialog }, computed: { searchCommonHeight() { return this.$refs.searchCommonView.offsetHeight }, clientList() { return this.$store.state.getClientName.clientList + }, + contactNamelist() { + return this.$store.state.getClientName.contactNamelist } }, data() { @@ -270,11 +289,19 @@ editVisible: false, title: "", infomation: {} - } + }, + editSelectContactConfig: { + editVisible: false, + title: "", + infomation: {} + }, + clientId: this.editCommonConfig.infomation.client_id, + contactId: this.editCommonConfig.infomation.contact_id } }, created() { this.$store.dispatch("geClient") + this.$store.dispatch("geContact") this.setTableForm() this.getCommonData() }, @@ -339,9 +366,9 @@ let data = this.editConfig.infomation let params = { id: this.editConfig.title === "鏂板缓" ? 0 : data.id, - client_id: parseInt(data.client_id) || 0, + client_id: parseInt(this.clientId) || 0, conditions: data.conditions || "", - contact_id: data.contact_id || 0, + contact_id: parseInt(this.contactId) || 0, file: data.file || "", member_id: data.member_id || 0, number: data.number || "", @@ -360,26 +387,51 @@ var results = queryString ? restaurants.filter(this.createStateFilter(queryString)) : restaurants cb(results) }, + // 閫夋嫨鑱旂郴浜哄鍚� + queryContactAsync(queryString, cb) { + var restaurants = this.contactNamelist + var results = queryString ? restaurants.filter(this.createStateFilter(queryString)) : restaurants + cb(results) + }, createStateFilter(queryString) { return (state) => { return state.name.toLowerCase().indexOf(queryString.toLowerCase()) === 0 } }, - handleSelectClient(item) { - this.editConfig.infomation.client_id = item.id + handleSelectClient(value, item) { + console.log(value) + if (value === "client") { + this.clientId = item.id + } else { + this.contactId = item.id + } }, - selClientClick() { - this.editSelectClientConfig.editVisible = true + selClientClick(value) { + if (value === "client") { + this.editSelectClientConfig.editVisible = true + } else if (value === "contact") { + this.editSelectContactConfig.editVisible = true + } }, - selClient(row) { - console.log(row) - this.editConfig.infomation.client_name = row.name - this.editConfig.infomation.client_id = row.id + selClient(row, value) { + console.log(value) + if (value === "contact") { + this.editConfig.infomation.contact_name = row.name + this.contactId = row.id + } else { + this.editConfig.infomation.client_name = row.name + this.clientId = row.id + } }, // 娓呴櫎宸查�夋嫨鐢ㄦ埛 - clearupClient() { - this.editConfig.infomation.client_name = "" - this.editConfig.infomation.client_id = 0 + clearupClient(value) { + if (value === "client") { + this.editConfig.infomation.client_name = "" + this.clientId = 0 + } else { + this.editConfig.infomation.contact_name = "" + this.contactId = 0 + } }, // 娣诲姞闄勪欢 addAnnexClick() {}, -- Gitblit v1.8.0