From d05d95424986dc6e8defefb24fab6dc62e37ee08 Mon Sep 17 00:00:00 2001 From: songshankun <songshankun@foxmail.com> Date: 星期六, 21 十月 2023 16:23:05 +0800 Subject: [PATCH] Merge branch 'dev' into songshankun/adjust-style --- src/views/sales/salesOpportunity/AddSalesOpportunityDialog.vue | 208 +++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 183 insertions(+), 25 deletions(-) diff --git a/src/views/sales/salesOpportunity/AddSalesOpportunityDialog.vue b/src/views/sales/salesOpportunity/AddSalesOpportunityDialog.vue index 45378e9..20d9d89 100644 --- a/src/views/sales/salesOpportunity/AddSalesOpportunityDialog.vue +++ b/src/views/sales/salesOpportunity/AddSalesOpportunityDialog.vue @@ -46,6 +46,15 @@ </el-form-item> </el-col> <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-circle-plus-outline" title="閫夋嫨"></i></div> --> + <!-- <div class="common-select-btn"><i class="el-icon-edit" title="缂栬緫"></i></div> --> + </div> + </el-form-item> + </el-col> + <el-col :span="12"> <el-form-item label="瀹㈡埛鍚嶇О" prop="client_name" ref="clientName"> <div class="custom-name"> <el-autocomplete @@ -71,15 +80,7 @@ </div> </el-form-item> </el-col> - <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-circle-plus-outline" title="閫夋嫨"></i></div> --> - <!-- <div class="common-select-btn"><i class="el-icon-edit" title="缂栬緫"></i></div> --> - </div> - </el-form-item> - </el-col> + <el-col :span="12"> <el-form-item label="鑱旂郴浜哄鍚�" prop="contact_name"> <div class="custom-name"> @@ -92,12 +93,18 @@ " value-key="name" @select="handleSelectClient('contact', $event)" + placeholder="璇峰厛閫夋嫨瀹㈡埛鍚嶇О" + :disabled="isContact" ></el-autocomplete> - <div class="common-select-btn" @click="selClientClick('contact')"> + <div v-if="!isContact" class="common-select-btn" @click="selClientClick('contact')"> <i class="el-icon-circle-plus-outline" title="閫夋嫨"></i> </div> <div - v-if="editConfig.infomation.contact_name && editConfig.infomation.contact_name.length > 0" + v-if=" + editConfig.infomation.contact_name && + editConfig.infomation.contact_name.length > 0 && + !isContact + " class="common-select-btn" @click="clearupClient('contact')" > @@ -107,7 +114,7 @@ </el-form-item> </el-col> <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" @@ -129,7 +136,7 @@ </el-form-item> </el-col> <el-col :span="12"> - <el-form-item label="鍟嗘満绫诲瀷" prop="sale_type_id"> + <el-form-item label="鏈轰細绫诲瀷" prop="sale_type_id"> <div class="common-select"> <el-select v-model="editConfig.infomation.sale_type_id" @@ -292,6 +299,30 @@ </el-col> </el-row> </div> + + <!-- 浜у搧绠$悊 --> + <div class="basic-info-title" style="display: flex"> + 浜у搧绠$悊 + <div style="margin-left: 400px"> + 甯佺 + <el-select v-model="editConfig.infomation.currency" placeholder="璇烽�夋嫨" size="mini" style="width: 63%"> + <el-option v-for="item in currencyOptions" :key="item.id" :label="item.name" :value="item.id"> + </el-option> + </el-select> + </div> + </div> + <div class="product-view"> + <CommonFormTableView + :show-summary="showSummary" + :product-table-list="productTableList" + @inputContent="inputContent" + @addProductClick="addProductClick" + @emptyProductClick="emptyProductClick" + @recalculateProductClick="recalculateProductClick" + @clearupProduct="clearupProduct" + /> + </div> + <!-- 鍟嗘満涓冭绱� --> <div class="basic-info-title">鍟嗘満涓冭绱�(5W2P)</div> <div class="basic-info-view"> @@ -571,6 +602,8 @@ import { getCityList } from "@/api/common/address" import WordInput from "@/components/wordInput.vue" import codeMixin from "@/views/client/followupRecords/mixin/codeMixin" +import { getContactList } from "@/api/client/contacts" +import CommonFormTableView from "@/components/makepager/CommonFormTableView.vue"; export default { name: "AddSalesOpportunityDialog", mixins: [codeMixin], @@ -586,16 +619,13 @@ } } }, - components: { WordInput, SelectClientDialog, SelectContactDialog }, + components: {CommonFormTableView, WordInput, SelectClientDialog, SelectContactDialog }, computed: { searchCommonHeight() { return this.$refs.searchCommonView.offsetHeight }, clientList() { return this.$store.state.getClientName.clientList - }, - contactNamelist() { - return this.$store.state.getClientName.contactNamelist } }, data() { @@ -639,17 +669,32 @@ restaurants: [], clientId: this.editCommonConfig.infomation.client_id, contactId: this.editCommonConfig.infomation.contact_id, - objCode: { name: "", page: 0, pageSize: 0, type: "閿�鍞満浼氱紪鐮�", codeStandID: "" } + objCode: { name: "", page: 0, pageSize: 0, type: "閿�鍞満浼氱紪鐮�", codeStandID: "" }, + isContact: true, + contactNamelist: [], + tableData: [], + productTableList: {}, + showSummary: { + show: true, + total: true, + sumProp: ["Amount", "total"], + mergeNumber: 2 + }, + productId:1, } }, created() { this.$store.dispatch("geClient") - this.$store.dispatch("geContact") if (this.editConfig.title !== "鏂板缓" && this.editConfig.infomation.province_id !== 0) { this.getCityList(this.editConfig.infomation.province_id, "edit") } + this.setTableForm() this.getCommonData() this.formInfo() + if (this.editConfig.title === "缂栬緫") { + this.isContact = false + this.getContactList(this.editConfig.infomation.contact_id) + } }, watch: { "editConfig.visible"(val) { @@ -702,8 +747,14 @@ // 淇濆瓨 saveClick(formName) { this.$refs[formName].validate((valid) => { + this.validateFormNumber() if (valid) { - console.log(this.editConfig.infomation) + const hasProduct = this.tableData.every(ele=>!!ele.name) + if (!hasProduct){ + this.$message.error("浜у搧鍚嶇О涓嶈兘涓虹┖") + return + } + const params = this.saveParams() console.log(params) if (this.editConfig.title === "鏂板缓") { @@ -767,14 +818,28 @@ status_id: data.status_id || 0, threats: data.threats || "", whether_established: data.whether_established || "", - remark: data.remark || "", detail_address: data.detail_address || "", codeStandID: data.ID, - codeRule: this.codeRule + codeRule: this.codeRule, + products: this.tableData, } return params + }, + // 鑾峰彇鑱旂郴浜哄垪琛� + getContactList(id) { + getContactList({ + page: 0, + pageSize: 0, + search_map: { + client_id: id + } + }).then((res) => { + if (res.code == 200) { + this.contactNamelist = res.data.list + } + }) }, // 閫夋嫨鐢ㄦ埛鐩稿叧鏂规硶 querySearchAsync(queryString, cb, value) { @@ -795,15 +860,23 @@ handleSelectClient(value, item) { if (value === "client") { this.clientId = item.id + this.editConfig.infomation.client_name = item.name + this.editConfig.infomation.contact_name = "" + this.contactId = 0 + this.isContact = false + this.getContactList(item.id) } else if (value === "contact") { + this.editConfig.infomation.contact_name = item.name this.contactId = item.id } + this.refresh() }, selClientClick(value) { if (value === "client") { this.editSelectClientConfig.editVisible = true } else if (value === "contact") { this.editSelectContactConfig.editVisible = true + this.editSelectContactConfig.clientId = this.clientId } }, selClient(row, value) { @@ -813,6 +886,10 @@ } else if (value === "client") { this.editConfig.infomation.client_name = row.name this.clientId = row.id + this.editConfig.infomation.contact_name = "" + this.contactId = 0 + this.isContact = false + this.getContactList(row.id) } this.refresh() }, @@ -831,6 +908,9 @@ if (value === "client") { this.editConfig.infomation.client_name = "" this.clientId = 0 + this.isContact = true + this.editConfig.infomation.contact_name = "" + this.contactId = 0 } else if (value === "contact") { this.editConfig.infomation.contact_name = "" this.contactId = 0 @@ -847,14 +927,92 @@ }, 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 (res.code === 200) { + this.cityOptions = res.data.list if (value === "sel") { this.editConfig.infomation.city_id = "" } } }) + }, + setTableForm() { + if (this.editConfig.title === "鏂板缓" || this.editConfig.infomation.products.length === 0) { + this.tableData = [ + { + productId: this.productId, + id: 0, + amount: 0, + desc: "", + name: "", + number: "", + price: 0, + total: 0 + } + ] + } else { + this.tableData = this.editConfig.infomation.products + this.tableData.map((item, index) => { + item.productId = index + 1 + }) + } + this.productTableList = { + tableData: this.tableData, + tableColumn: [ + { label: "#", prop: "productId", width: 40 }, + { label: "浜у搧鍚嶇О", prop: "name", productName: true, isRequird: true }, + { label: "浜у搧缂栧彿", prop: "number" }, + { label: "鏁伴噺", prop: "amount", inputNumber: true, isRequird: true }, + { label: "閿�鍞崟浠�", prop: "price", inputFloat: true }, + { label: "浠风◣鍚堣", prop: "total", inputFloat: true } + ] + } + }, + // 浜у搧鍒楄〃杈撳叆 + inputContent(val, prop, row) { + this.productId = row.productId + this.tableData.map((item) => { + if (item.productId === row.productId) { + item[prop] = val + } + }) + }, + // 浜у搧鏂板 + addProductClick() { + this.productId++ + this.tableData.push({ + productId: this.productId, + id: 0, + amount: 0, + desc: "", + name: "", + number: "", + price: 0, + total: 0 + }) + this.showSummary.show = true + }, + // 浜у搧娓呯┖ + emptyProductClick() { + this.productId = 1 + this.tableData = [ + { + productId: this.productId, + id: 0, + amount: 0, + desc: "", + name: "", + number: "", + price: 0, + total: 0 + } + ] + this.productTableList.tableData = this.tableData + }, + // 浜у搧閲嶇畻 + recalculateProductClick() {}, + clearupProduct(data) { + this.tableData = data + this.productTableList.tableData = this.tableData } } } -- Gitblit v1.8.0