From c1adf27fbabbff1d76b60993521c765ef1ed79ef Mon Sep 17 00:00:00 2001 From: yangfeng <wanwan926_4@163.com> Date: 星期二, 15 八月 2023 20:03:21 +0800 Subject: [PATCH] 新建客户管理 客户名称查重 --- src/views/sales/quotation/index.vue | 199 ++++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 169 insertions(+), 30 deletions(-) diff --git a/src/views/sales/quotation/index.vue b/src/views/sales/quotation/index.vue index eb67ab2..4eff953 100644 --- a/src/views/sales/quotation/index.vue +++ b/src/views/sales/quotation/index.vue @@ -1,44 +1,81 @@ <template> <div class="quotation"> - <SearchCommonView - ref="searchCommonView" - :label-search="true" - :query-class-options="queryClassOptions" - :search-options="searchOptions" - /> - <div class="btn-pager"> - <PublicFunctionBtnView :submit-approval="true" :operates-list="operatesList" /> - <PagerView class="page" /> + <div v-if="isDetail" class="detail-top"> + <DetailListCommonBtn :query-class-options="queryClassOptions" /> + <PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" /> </div> - <TableCommonView ref="tableListRef" :table-list="tableList"> + <div v-else class="top"> + <SearchCommonView + ref="searchCommonView" + :label-search="true" + :query-class-options="queryClassOptions" + :search-options="searchOptions" + @searchClick="searchClick" + @resetClick="resetClick" + :search-sel="searchSel" + /> + <div class="btn-pager"> + <PublicFunctionBtnView :submit-approval="true" :operates-list="operatesList" @batchDelete="delClick" /> + <PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" /> + </div> + </div> + <TableCommonView + ref="tableListRef" + :table-list="tableList" + :select-box="!isDetail" + @selClientClick="selClientClick" + @selContactsClick="selContactsClick" + @selCommonClick="selCommonClick" + @getSelectArray="getSelectArray" + > <template slot="tableButton"> - <el-table-column label="鎿嶄綔" width="60"> + <el-table-column label="鎿嶄綔" width="90"> <template slot-scope="scope"> <el-button @click="handleClick(scope.row)" type="text" size="small">缂栬緫</el-button> + <!-- <el-button @click="delClick(scope.row.id)" type="text" size="small">鍒犻櫎</el-button> --> </template> </el-table-column> </template> </TableCommonView> <!-- 鏂板缓/缂栬緫 --> <AddQuotationDialog v-if="editConfig.visible" :edit-common-config="editConfig" /> + <!-- 鎶ヤ环鍗曡鎯� --> + <DetailQuotation v-if="quotationDeail.visible" :quotation-detail="quotationDeail" /> + <!-- 瀹㈡埛璇︽儏 --> + <DetailClientManage v-if="clientDeail.visible" :client-manage-detail="clientDeail" /> + <!-- 鑱旂郴浜鸿鎯� --> + <DetailContacts v-if="contactsDeail.visible" :contacts-detail="contactsDeail" /> </div> </template> <script> import AddQuotationDialog from "@/views/sales/quotation/AddQuotationDialog" -import { getQuotationList } from "@/api/sales/quotation" +import { getQuotationList, getDelQuotation } from "@/api/sales/quotation" +import pageMixin from "@/components/makepager/pager/mixin/pageMixin" +import DetailQuotation from "@/views/sales/quotation/DetailQuotation" export default { name: "QuotationView", - props: {}, - components: { - AddQuotationDialog - }, - computed: { - searchCommonHeight() { - return this.$refs.searchCommonView.offsetHeight + props: { + isDetail: { + type: Boolean, + default: false + }, + addConfig: { + type: Object, + default: () => { + return {} + } } }, + mixins: [pageMixin], + components: { + AddQuotationDialog, + DetailQuotation, + DetailContacts: () => import("@/views/client/contacts/DetailContacts"), + DetailClientManage: () => import("@/views/client/client/DetailClientManage") + }, + computed: {}, data() { return { tableList: {}, @@ -63,40 +100,70 @@ visible: false, title: "鏂板缓", infomation: {} + }, + quotationDeail: { + visible: false, + infomation: {} + }, + contactsDeail: { + visible: false, + infomation: {} + }, + clientDeail: { + visible: false, + infomation: {} + }, + selValueList: [], + search_map: {}, + searchSel: { + value: "number", + label: "鎶ヤ环鍗曞彿" } } }, created() { this.setTable() - this.getData() + if (!this.isDetail) { + this.search_map = {} + } else { + this.search_map = { + [this.addConfig.id_name]: this.addConfig.client_name + } + } + this.getData(this.search_map) }, methods: { setTable() { this.tableList = { tableInfomation: [], tableColumn: [ - { label: "鎶ヤ环鍗曞彿", prop: "number", min: 90 }, // 鎶ヤ环鍗曞彿 - { label: "瀹㈡埛鍚嶇О", prop: "client_name", min: 120 }, // 瀹㈡埛鍚嶇О - { label: "鑱旂郴浜哄鍚�", prop: "contact_name", min: 90 }, // 鑱旂郴浜哄鍚� - { label: "閿�鍞礋璐d汉", prop: "member_id" }, // 閿�鍞礋璐d汉 + { label: "鎶ヤ环鍗曞彿", prop: "number", min: 90, isCommonClick: true }, // 鎶ヤ环鍗曞彿 + { label: "瀹㈡埛鍚嶇О", prop: "client_name", min: 120, isClientClick: true }, // 瀹㈡埛鍚嶇О + { label: "鑱旂郴浜哄鍚�", prop: "contact_name", min: 90, isContactClick: true }, // 鑱旂郴浜哄鍚� + { label: "閿�鍞礋璐d汉", prop: "member_name" }, // 閿�鍞礋璐d汉 { label: "鏈夋晥鏈�", prop: "validity_date", min: 100 }, // 淇敼鏃堕棿 { label: "灏忚", prop: "subTotal" }, // 灏忚 { label: "鍚堣", prop: "total" }, // 鍚堣 { label: "浜у搧鍚嶇О", prop: "productName" }, // 浜у搧鍚嶇О - { label: "鏁伴噺", prop: "number" }, // 鏁伴噺 + { label: "鏁伴噺", prop: "number1" }, // 鏁伴噺 { label: "浠风◣鍚堣", prop: "priceTax" } // 浠风◣鍚堣 ] } this.searchOptions = [] for (let i = 0; i < this.tableList.tableColumn.length; i++) { const label = this.tableList.tableColumn[i].label - this.searchOptions.push({ value: (i + 1).toString(), label: label }) + const value = this.tableList.tableColumn[i].prop + this.searchOptions.push({ value: value, label: label }) } }, // 璇锋眰鏁版嵁 async getData() { this.loading = true - await getQuotationList() + await getQuotationList({ + search_map: this.search_map, + page: this.pagerOptions.currPage, + pageSize: this.pagerOptions.pageSize + }) .then((res) => { console.log(res) if (res.code === 200) { @@ -105,10 +172,12 @@ return { ...item, client_name: item.client.name, - contact_name: item.contact.name + contact_name: item.contact.name, + member_name: item.member.username } }) this.tableList.tableInfomation = list || [] + this.pagerOptions.totalCount = res.data.count } else { this.tableList.tableInfomation = [] } @@ -123,11 +192,23 @@ this.loading = false }) }, + // 鎼滅储 + searchClick(val, content) { + console.log(val, content) + this.search_map = { + [val.value]: content + } + this.getData() + }, + resetClick() { + this.search_map = {} + this.getData() + }, // 鏂板缓 addBtnClick() { this.editConfig.visible = true this.editConfig.title = "鏂板缓" - this.editConfig.infomation = {} + this.editConfig.infomation = { ...this.addConfig } }, // 缂栬緫 handleClick(row) { @@ -135,6 +216,55 @@ this.editConfig.visible = true this.editConfig.title = "缂栬緫" this.editConfig.infomation = { ...row } + }, + // 鍒犻櫎 + delClick() { + if (this.selValueList && this.selValueList.length > 0) { + this.$confirm("鏄惁纭鍒犻櫎?", "璀﹀憡", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning" + }) + .then(() => { + getDelQuotation({ ids: this.selValueList }).then((response) => { + if (response.code === 200) { + this.$message.success("鍒犻櫎鎴愬姛") + this.getData() + } else { + this.$message.warning("鍒犻櫎澶辫触") + } + }) + }) + .catch(() => {}) + } else { + this.$message.warning("璇疯嚦灏戦�夋嫨涓�鏉¤褰�") + } + }, + getSelectArray(val) { + console.log(val) + this.selValueList = [] + const list = val.map((item) => { + return item.id + }) + this.selValueList = list + }, + // 瀹㈡埛鍚嶇О璇︽儏 + selClientClick(row) { + console.log(row) + this.clientDeail.visible = true + this.clientDeail.infomation = { ...row, client_name: row.name } + }, + // 鑱旂郴浜鸿鎯� + selContactsClick(row) { + console.log(row) + this.contactsDeail.visible = true + this.contactsDeail.infomation = { ...row } + }, + // 鏈轰細鍚嶇О璇︽儏 + selCommonClick(row) { + console.log(row) + this.quotationDeail.visible = true + this.quotationDeail.infomation = { ...row } } } } @@ -143,7 +273,16 @@ <!-- Add "scoped" attribute to limit CSS to this component only --> <style lang="scss" scoped> .quotation { - .btn-pager { + .top { + margin-bottom: 20px; + .btn-pager { + display: flex; + .page { + margin-left: auto; + } + } + } + .detail-top { display: flex; .page { margin-left: auto; -- Gitblit v1.8.0