From 9556ecc3c377d2e8e8d3659b7c56f9e35ff0c626 Mon Sep 17 00:00:00 2001 From: yangfeng <wanwan926_4@163.com> Date: 星期一, 31 七月 2023 18:03:15 +0800 Subject: [PATCH] 增加联系人姓名、销售机会、销售线索等弹窗选择项 --- src/views/other/commonDialog/SelectContactDialog.vue | 6 src/store/modules/getClientName.js | 31 + src/views/other/commonDialog/SelectClientDialog.vue | 8 src/views/sales/subOrder/index.vue | 2 src/views/client/followupRecords/AddFollowupRecordsDialog.vue | 166 +++++++-- src/views/other/commonDialog/SelectCommonDialog.vue | 161 +++++++++ src/components/makepager/TableCommonView.vue | 12 src/views/sales/salesOpportunity/AddSalesOpportunityDialog.vue | 109 +++++- src/views/other/commonDialog/SelectChanceDialog.vue | 191 +++++++++++ src/views/other/commonDialog/SelectLeadDialog.vue | 158 +++++++++ src/views/sales/quotation/AddQuotationDialog.vue | 27 + src/views/client/followupRecords/index.vue | 5 src/views/sales/subOrder/AddSubOrderDialog.vue | 134 ++++++- 13 files changed, 889 insertions(+), 121 deletions(-) diff --git a/src/components/makepager/TableCommonView.vue b/src/components/makepager/TableCommonView.vue index fd225af..129ae2b 100644 --- a/src/components/makepager/TableCommonView.vue +++ b/src/components/makepager/TableCommonView.vue @@ -14,7 +14,6 @@ :header-cell-style="{ background: '#ECF4FF', color: '#666' }" > <el-table-column v-if="selectBox" type="selection" width="40"> </el-table-column> - <el-table-column v-for="(item, i) in tableList.tableColumn" :key="i" @@ -32,6 +31,9 @@ dateFormat("YYYY-mm-dd HH:MM:SS", scope.row[item.prop]) === "1900-01-01 08:00:00" ? "--" : dateFormat("YYYY-mm-dd HH:MM:SS", scope.row[item.prop]) + }}</span> + <span v-else-if="item.isClick" class="sel-name" @click="selNameClick(scope.row)">{{ + scope.row[item.prop] }}</span> <span v-else>{{ scope.row[item.prop] ? scope.row[item.prop] : "--" }}</span> </template> @@ -52,7 +54,6 @@ type: Boolean, default: true }, - tableList: { type: Object, default: () => { @@ -180,6 +181,9 @@ } } return fmt + }, + selNameClick(row) { + this.$emit("selCommonClick", row) } } } @@ -198,6 +202,10 @@ background-color: $color-primary; border-radius: 4px; } + .sel-name { + color: $color-primary; + cursor: pointer; + } } ::v-deep { .el-table__footer-wrapper tbody td.el-table__cell { diff --git a/src/store/modules/getClientName.js b/src/store/modules/getClientName.js index 3a2b6e6..18637e3 100644 --- a/src/store/modules/getClientName.js +++ b/src/store/modules/getClientName.js @@ -1,12 +1,17 @@ import { getClientList } from "@/api/client/client" // 瀵煎叆鎺ュ彛 import { getContactList } from "@/api/client/contacts" import { getSaleChanceList } from "@/api/sales/salesOpportunity" +import { getSalesLeadsList } from "@/api/client/salesLead" +import { getMasterOrderList } from "@/api/sales/masterOrder" import { Message } from "element-ui" export default { state: { clientList: [], // 瀹㈡埛鍒楄〃 - contactNamelist: [] // 鑱旂郴浜� + contactNamelist: [], // 鑱旂郴浜� + saleChancelist: [], // 閿�鍞満浼� + saleLeadlist: [], // 閿�鍞嚎绱� + masterOrderList: [] // 閿�鍞�诲崟 }, mutations: { clientNameList(state, payload) { @@ -17,6 +22,12 @@ }, saleChancelist(state, payload) { state.saleChancelist = payload + }, + saleLeadlist(state, payload) { + state.saleLeadlist = payload + }, + masterOrderList(state, payload) { + state.masterOrderList = payload } }, actions: { @@ -46,6 +57,24 @@ Message.error(res.msg) } }) + }, + geLead(context) { + getSalesLeadsList().then((res) => { + if (res.code == 200) { + context.commit("saleLeadlist", res.data.list) + } else { + Message.error(res.msg) + } + }) + }, + geMaster(context) { + getMasterOrderList().then((res) => { + if (res.code == 200) { + context.commit("masterOrderList", res.data.list) + } else { + Message.error(res.msg) + } + }) } } } diff --git a/src/views/client/followupRecords/AddFollowupRecordsDialog.vue b/src/views/client/followupRecords/AddFollowupRecordsDialog.vue index d0564e5..007f860 100644 --- a/src/views/client/followupRecords/AddFollowupRecordsDialog.vue +++ b/src/views/client/followupRecords/AddFollowupRecordsDialog.vue @@ -25,7 +25,11 @@ <div class="custom-name"> <el-autocomplete v-model="editConfig.infomation.client_name" - :fetch-suggestions="querySearchAsync" + :fetch-suggestions=" + (queryString, callback) => { + querySearchAsync(queryString, callback, 'client') + } + " value-key="name" @select="handleSelectClient('client', $event)" ></el-autocomplete> @@ -60,11 +64,15 @@ </el-form-item> </el-col> <el-col :span="12"> - <el-form-item label="鑱旂郴浜哄鍚�" prop="contact_id"> + <el-form-item label="鑱旂郴浜哄鍚�" prop="contact_name"> <div class="custom-name"> <el-autocomplete v-model="editConfig.infomation.contact_name" - :fetch-suggestions="queryContactAsync" + :fetch-suggestions=" + (queryString, callback) => { + querySearchAsync(queryString, callback, 'contact') + } + " value-key="name" @select="handleSelectClient('contact', $event)" ></el-autocomplete> @@ -110,26 +118,47 @@ </el-form-item> </el-col> <el-col v-if="isUnflod" :span="12"> - <el-form-item label="閿�鍞満浼�" prop="sale_chance_id"> + <el-form-item label="閿�鍞満浼�" prop="sale_chance_name"> <div class="custom-name"> - <el-input v-model="editConfig.infomation.sale_chance_id"></el-input> - <!-- <el-autocomplete - v-model="editConfig.infomation.sale_chance_id" - :fetch-suggestions="queryChanceAsync" + <el-autocomplete + v-model="editConfig.infomation.sale_chance_name" + :fetch-suggestions=" + (queryString, callback) => { + querySearchAsync(queryString, callback, 'chance') + } + " value-key="name" @select="handleSelectClient('chance', $event)" - ></el-autocomplete> --> - <div class="common-select-btn"><i class="el-icon-circle-plus-outline"></i></div> - <div class="common-select-btn"><i class="el-icon-edit-outline"></i></div> + ></el-autocomplete> + <div class="common-select-btn" @click="selClientClick('chance')"> + <i class="el-icon-circle-plus-outline"></i> + </div> + <div class="common-select-btn" @click="clearupClient('chance')"> + <i class="el-icon-edit-outline"></i> + </div> </div> </el-form-item> </el-col> <el-col :span="12"> - <el-form-item label="閿�鍞嚎绱�" prop="sales_leads_id"> + <el-form-item label="閿�鍞嚎绱�" prop="sales_leads_name"> <div class="custom-name"> - <el-input v-model="editConfig.infomation.sales_leads_id"></el-input> - <div class="common-select-btn"><i class="el-icon-circle-plus-outline"></i></div> - <div class="common-select-btn"><i class="el-icon-edit-outline"></i></div> + <!-- <el-input v-model="editConfig.infomation.sales_leads_id"></el-input> --> + <el-autocomplete + v-model="editConfig.infomation.sales_leads_name" + :fetch-suggestions=" + (queryString, callback) => { + querySearchAsync(queryString, callback, 'lead') + } + " + value-key="name" + @select="handleSelectClient('lead', $event)" + ></el-autocomplete> + <div class="common-select-btn" @click="selClientClick('lead')"> + <i class="el-icon-circle-plus-outline"></i> + </div> + <div class="common-select-btn" @click="clearupClient('lead')"> + <i class="el-icon-edit-outline"></i> + </div> </div> </el-form-item> </el-col> @@ -222,6 +251,18 @@ :edit-common-config="editSelectContactConfig" @selClient="selClient" /> + <!-- 閫夋嫨閿�鍞満浼� --> + <SelectChanceDialog + v-if="editSelectChanceConfig.editVisible" + :edit-common-config="editSelectChanceConfig" + @selClient="selClient" + /> + <!-- 閫夋嫨閿�鍞嚎绱� --> + <SelectLeadDialog + v-if="editSelectLeadConfig.editVisible" + :edit-common-config="editSelectLeadConfig" + @selClient="selClient" + /> </el-dialog> </div> </template> @@ -231,6 +272,8 @@ import { getAddFollowRecord, getUpdateFollowRecord } from "@/api/client/followupRecords" import SelectClientDialog from "@/views/other/commonDialog/SelectClientDialog" import SelectContactDialog from "@/views/other/commonDialog/SelectContactDialog" +import SelectChanceDialog from "@/views/other/commonDialog/SelectChanceDialog" +import SelectLeadDialog from "@/views/other/commonDialog/SelectLeadDialog" export default { name: "AddFollowupRecordsDialog", props: { @@ -245,7 +288,7 @@ } } }, - components: { SelectClientDialog, SelectContactDialog }, + components: { SelectClientDialog, SelectContactDialog, SelectChanceDialog, SelectLeadDialog }, computed: { searchCommonHeight() { return this.$refs.searchCommonView.offsetHeight @@ -258,6 +301,9 @@ }, saleChancelist() { return this.$store.state.getClientName.saleChancelist + }, + saleLeadlist() { + return this.$store.state.getClientName.saleLeadlist } }, data() { @@ -293,15 +339,27 @@ title: "", infomation: {} }, + editSelectChanceConfig: { + editVisible: false, + title: "", + infomation: {} + }, + editSelectLeadConfig: { + editVisible: false, + title: "", + infomation: {} + }, clientId: this.editContactsConfig.infomation.client_id, - contactId: this.editContactsConfig.infomation.contact_id - // saleChanceId: this.editContactsConfig.infomation.sale_chance_id + contactId: this.editContactsConfig.infomation.contact_id, + saleChanceId: this.editContactsConfig.infomation.sale_chance_id, + saleLeadId: this.editContactsConfig.infomation.sales_leads_id } }, created() { this.$store.dispatch("geClient") this.$store.dispatch("geContact") this.$store.dispatch("geChance") + this.$store.dispatch("geLead") this.getCommonData() }, methods: { @@ -311,10 +369,23 @@ console.log(res) this.clientStatusOptions = res.data.client_status this.memberOptions = res.data.member + this.dataProcess() }) .catch((err) => { console.log(err) }) + }, + dataProcess() { + this.saleChancelist.map((item) => { + if (this.saleChanceId === item.id) { + this.editConfig.infomation.sale_chance_name = item.name + } + }) + this.saleLeadlist.map((item) => { + if (this.saleLeadId === item.id) { + this.editConfig.infomation.sales_leads_name = item.name + } + }) }, handleClose() { this.editConfig.visible = false @@ -323,13 +394,10 @@ saveClick(formName) { this.$refs[formName].validate((valid) => { if (valid) { - console.log(this.editConfig.infomation) const params = this.saveParams() - console.log(params) if (this.editConfig.title === "鏂板缓") { getAddFollowRecord(params) .then((res) => { - console.log(res) this.editConfig.visible = false if (res.code === 200) { this.$message({ @@ -345,7 +413,6 @@ } else { getUpdateFollowRecord(params) .then((res) => { - console.log(res) this.editConfig.visible = false if (res.code === 200) { this.$message({ @@ -380,8 +447,8 @@ number: data.number || "", purpose: data.purpose || "", record: data.record || "", - sale_chance_id: parseInt(data.sale_chance_id), //data.sale_chance_id || - sales_leads_id: 0, // data.sales_leads_id || + sale_chance_id: parseInt(this.saleChanceId), //data.sale_chance_id || + sales_leads_id: parseInt(this.saleLeadId), // data.sales_leads_id || topic: data.topic || "" } } @@ -394,20 +461,17 @@ return params }, // 閫夋嫨瀹㈡埛鐩稿叧鏂规硶 - querySearchAsync(queryString, cb) { - var restaurants = this.clientList - 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) - }, - // 閿�鍞満浼� - queryChanceAsync(queryString, cb) { - var restaurants = this.saleChancelist + querySearchAsync(queryString, cb, value) { + var restaurants = [] + if (value === "client") { + restaurants = this.clientList + } else if (value === "contact") { + restaurants = this.contactNamelist + } else if (value === "chance") { + restaurants = this.saleChancelist + } else { + restaurants = this.saleLeadlist + } var results = queryString ? restaurants.filter(this.createStateFilter(queryString)) : restaurants cb(results) }, @@ -417,13 +481,14 @@ } }, handleSelectClient(value, item) { - console.log(value) if (value === "client") { this.clientId = item.id } else if (value === "contact") { this.contactId = item.id - } else { + } else if (value === "chance") { this.saleChanceId = item.id + } else { + this.saleLeadId = item.id } }, selClientClick(value) { @@ -431,16 +496,25 @@ this.editSelectClientConfig.editVisible = true } else if (value === "contact") { this.editSelectContactConfig.editVisible = true + } else if (value === "chance") { + this.editSelectChanceConfig.editVisible = true + } else { + this.editSelectLeadConfig.editVisible = true } }, selClient(row, value) { - console.log(value) if (value === "contact") { this.editConfig.infomation.contact_name = row.name this.contactId = row.id - } else { + } else if (value === "client") { this.editConfig.infomation.client_name = row.name this.clientId = row.id + } else if (value === "chance") { + this.editConfig.infomation.sale_chance_name = row.name + this.saleChanceId = row.id + } else { + this.editConfig.infomation.sales_leads_name = row.name + this.saleLeadId = row.id } }, // 娓呴櫎宸查�夋嫨鐢ㄦ埛 @@ -448,9 +522,15 @@ if (value === "client") { this.editConfig.infomation.client_name = "" this.clientId = 0 - } else { + } else if (value === "contact") { this.editConfig.infomation.contact_name = "" this.contactId = 0 + } else if (value === "chance") { + this.editConfig.infomation.sale_chance_name = "" + this.saleChanceId = 0 + } else { + this.editConfig.infomation.sales_leads_name = "" + this.saleLeadId = 0 } }, // 娣诲姞闄勪欢 diff --git a/src/views/client/followupRecords/index.vue b/src/views/client/followupRecords/index.vue index 20c0257..63e2a72 100644 --- a/src/views/client/followupRecords/index.vue +++ b/src/views/client/followupRecords/index.vue @@ -63,7 +63,8 @@ visible: false, title: "鏂板缓", infomation: {} - } + }, + saleChanceName: "" } }, created() { @@ -141,7 +142,7 @@ console.log(row) this.editConfig.visible = true this.editConfig.title = "缂栬緫" - this.editConfig.infomation = { ...row } + this.editConfig.infomation = { ...row, sale_chance_name: "", sales_leads_name: "" } }, // 鍒犻櫎 delClick(id) { diff --git a/src/views/other/commonDialog/SelectChanceDialog.vue b/src/views/other/commonDialog/SelectChanceDialog.vue new file mode 100644 index 0000000..bec8e0d --- /dev/null +++ b/src/views/other/commonDialog/SelectChanceDialog.vue @@ -0,0 +1,191 @@ +<template> + <div class="edit-selClient-box"> + <el-dialog + :title="'閿�鍞満浼�'" + :visible.sync="editConfig.editVisible" + :width="dialogWidth" + :before-close="handleClose" + :append-to-body="true" + :close-on-click-modal="false" + > + <div class="bg-view"> + <div class="query-bg"> + <el-input placeholder="璇疯緭鍏ュ唴瀹�" v-model="queryInput" size="mini" class="input-with-select"> + <el-select v-model="select" slot="prepend" placeholder="璇烽�夋嫨"> + <el-option label="鍏ㄩ儴瀛楁" value="1"></el-option> + <el-option label="閿�鍞満浼氱紪鍙�" value="2"></el-option> + <el-option label="鏈轰細鍚嶇О" value="3"></el-option> + <el-option label="閿�鍞樁娈�" value="4"></el-option> + <el-option label="閿�鍞礋璐d汉" value="5"></el-option> + <el-option label="棰勮鎴愪氦鏃ユ湡" value="6"></el-option> + </el-select> + </el-input> + <div class="btn"> + <el-button type="primary" size="mini" disabled>璁剧疆瀛楁</el-button> + <el-button type="primary" size="mini" disabled>蹇�熷垱寤�</el-button> + </div> + </div> + <el-table + :data="tableData" + border + size="mini" + v-loading="loading" + :header-cell-style="{ background: '#f7f7f7' }" + > + <el-table-column label="閿�鍞満浼氱紪鍙�" prop="number"></el-table-column> + <el-table-column label="鏈轰細鍚嶇О" prop="name" show-overflow-tooltip> + <template slot-scope="scope"> + <span class="sel-name" @click="selNameClick(scope.row)">{{ scope.row.name }}</span> + </template> + </el-table-column> + <el-table-column label="閿�鍞樁娈�" prop="sale_stage_id"></el-table-column> + <el-table-column label="閿�鍞礋璐d汉" prop="member_id"></el-table-column> + <el-table-column label="棰勮鎴愪氦鏃ユ湡" prop="expected_time" show-overflow-tooltip> + <template slot-scope="scope"> + <span>{{ + dateFormat("YYYY-mm-dd HH:MM:SS", scope.row.expected_time) === "1900-01-01 08:00:00" + ? "--" + : dateFormat("YYYY-mm-dd HH:MM:SS", scope.row.expected_time) + }}</span> + </template> + </el-table-column> + <div slot="empty"> + <el-empty :image-size="100"></el-empty> + </div> + </el-table> + <div slot="footer" class="dialog-footer"> + <div class="remark">璇存槑锛氭敮鎸佸瀛楁妯$硦鏌ヨ锛屼粎鏄剧ず绗﹀悎鏉′欢鐨勫墠5鏉℃暟鎹�</div> + </div> + </div> + </el-dialog> + </div> +</template> + +<script> +import { getSaleChanceList } from "@/api/sales/salesOpportunity" +export default { + name: "EditSelChanceDialog", + props: { + editCommonConfig: { + type: Object, + default: () => { + return { + editVisible: false, + title: "", + infomation: {} + } + } + } + }, + components: {}, + computed: {}, + data() { + return { + dialogWidth: "50%", + editConfig: this.editCommonConfig, + queryInput: "", + select: "1", + tableData: [], + searchSelOptions: [], + loading: false + } + }, + created() { + this.getData() + }, + methods: { + handleClose() { + this.editConfig.editVisible = false + }, + // 璇锋眰鏁版嵁 + async getData() { + this.loading = true + await getSaleChanceList() + .then((res) => { + console.log(res) + if (res.code === 200) { + if (res.data.list && res.data.list.length > 0) { + const list = res.data.list.map((item) => { + return { + ...item + } + }) + this.tableData = list.slice(0, 5) || [] + } else { + this.tableData = [] + } + } else { + this.tableData = [] + } + this.loading = false + }) + .catch((err) => { + console.log(err) + this.tableData = [] + this.loading = false + }) + }, + selNameClick(row) { + this.editConfig.editVisible = false + console.log(row) + this.$emit("selClient", row, "chance") + }, + // 鏃堕棿鏄剧ず + dateFormat(fmt, date) { + let ret = "" + date = new Date(date) + const opt = { + "Y+": date.getFullYear().toString(), // 骞� + "m+": (date.getMonth() + 1).toString(), // 鏈� + "d+": date.getDate().toString(), // 鏃� + "H+": date.getHours().toString(), // 鏃� + "M+": date.getMinutes().toString(), // 鍒� + "S+": date.getSeconds().toString() // 绉� + // 鏈夊叾浠栨牸寮忓寲瀛楃闇�姹傚彲浠ョ户缁坊鍔狅紝蹇呴』杞寲鎴愬瓧绗︿覆 + } + for (let k in opt) { + ret = new RegExp("(" + k + ")").exec(fmt) + if (ret) { + fmt = fmt.replace(ret[1], ret[1].length == 1 ? opt[k] : opt[k].padStart(ret[1].length, "0")) + } + } + return fmt + } + } +} +</script> + +<!-- Add "scoped" attribute to limit CSS to this component only --> +<style lang="scss" scoped> +.bg-view { + margin: 10px; + .query-bg { + margin-bottom: 10px; + display: flex; + justify-content: space-between; + .el-input { + width: 310px; + .el-select { + width: 100px; + } + } + .btn { + float: right; + } + } +} +.sel-name { + color: $color-primary; + cursor: pointer; +} +.dialog-footer { + height: 40px; + line-height: 40px; + color: red; +} +::v-deep { + .input-with-select .el-input-group__prepend { + background-color: #fff; + } +} +</style> diff --git a/src/views/other/commonDialog/SelectClientDialog.vue b/src/views/other/commonDialog/SelectClientDialog.vue index 1a62eb9..3a3726f 100644 --- a/src/views/other/commonDialog/SelectClientDialog.vue +++ b/src/views/other/commonDialog/SelectClientDialog.vue @@ -82,11 +82,7 @@ return { editVisible: false, title: "", - infomation: { - name: "", - color: "", - setDefault: "" - } + infomation: {} } } } @@ -142,7 +138,7 @@ }, selNameClick(row) { this.editConfig.editVisible = false - this.$emit("selClient", row) + this.$emit("selClient", row, "client") }, // 鏃堕棿鏄剧ず dateFormat(fmt, date) { diff --git a/src/views/other/commonDialog/SelectCommonDialog.vue b/src/views/other/commonDialog/SelectCommonDialog.vue new file mode 100644 index 0000000..04ff4a0 --- /dev/null +++ b/src/views/other/commonDialog/SelectCommonDialog.vue @@ -0,0 +1,161 @@ +<template> + <div class="edit-selClient-box"> + <el-dialog + :title="editCommonConfig.title" + :visible.sync="editConfig.editVisible" + :width="dialogWidth" + :before-close="handleClose" + :append-to-body="true" + :close-on-click-modal="false" + > + <div class="bg-view"> + <div class="query-bg"> + <el-input placeholder="璇疯緭鍏ュ唴瀹�" v-model="queryInput" size="mini" class="input-with-select"> + <el-select v-model="select" slot="prepend" placeholder="璇烽�夋嫨"> + <el-option v-for="item in commonOptions" :key="item.id" :label="item.name" :value="item.name"> + </el-option> + </el-select> + </el-input> + <div class="btn"> + <el-button type="primary" size="mini" disabled>璁剧疆瀛楁</el-button> + <el-button type="primary" size="mini" disabled>蹇�熷垱寤�</el-button> + </div> + </div> + <TableCommonView ref="tableListRef" :table-list="tableList" :select-box="false" @selCommonClick="selNameClick"> + </TableCommonView> + <div slot="footer" class="dialog-footer"> + <div class="remark">璇存槑锛氭敮鎸佸瀛楁妯$硦鏌ヨ锛屼粎鏄剧ず绗﹀悎鏉′欢鐨勫墠5鏉℃暟鎹�</div> + </div> + </div> + </el-dialog> + </div> +</template> + +<script> +import { getMasterOrderList } from "@/api/sales/masterOrder" +export default { + name: "EditSelChanceDialog", + props: { + editCommonConfig: { + type: Object, + default: () => { + return { + editVisible: false, + title: "", + infomation: {} + } + } + } + }, + components: {}, + computed: {}, + data() { + return { + dialogWidth: "50%", + editConfig: this.editCommonConfig, + queryInput: "", + select: "1", + tableData: [], + searchSelOptions: [], + loading: false, + tableList: {}, + commonOptions: [] + } + }, + created() { + this.getData() + this.setTable() + }, + methods: { + setTable() { + if (this.editConfig.title === "閿�鍞�诲崟") { + this.tableList = { + tableInfomation: [], + tableColumn: [ + { label: "鍗曟嵁缂栧彿", prop: "number", isClick: true }, // 鍗曟嵁缂栧彿 + { label: "璐熻矗浜�", prop: "member_id" } // 璐熻矗浜� + ] + } + } + + this.commonOptions = [{ value: 1, name: "鍏ㄩ儴瀛楁" }] + for (let i = 1; i < this.tableList.tableColumn.length; i++) { + const label = this.tableList.tableColumn[i].label + this.commonOptions.push({ value: (i + 1).toString(), name: label }) + } + }, + handleClose() { + this.editConfig.editVisible = false + }, + // 璇锋眰鏁版嵁 + async getData() { + this.loading = true + await getMasterOrderList() + .then((res) => { + console.log(res) + if (res.code === 200) { + if (res.data.list && res.data.list.length > 0) { + const list = res.data.list.map((item) => { + return { + ...item + } + }) + this.tableList.tableInfomation = list.slice(0, 5) || [] + } else { + this.tableList.tableInfomation = [] + } + } else { + this.tableList.tableInfomation = [] + } + this.loading = false + }) + .catch((err) => { + console.log(err) + this.tableData = [] + this.loading = false + }) + }, + selNameClick(row) { + this.editConfig.editVisible = false + if (this.editConfig.title === "閿�鍞�诲崟") { + this.$emit("selClient", row, "master") + } + } + } +} +</script> + +<!-- Add "scoped" attribute to limit CSS to this component only --> +<style lang="scss" scoped> +.bg-view { + margin: 10px; + .query-bg { + margin-bottom: 10px; + display: flex; + justify-content: space-between; + .el-input { + width: 310px; + .el-select { + width: 100px; + } + } + .btn { + float: right; + } + } +} +.sel-name { + color: $color-primary; + cursor: pointer; +} +.dialog-footer { + height: 40px; + line-height: 40px; + color: red; +} +::v-deep { + .input-with-select .el-input-group__prepend { + background-color: #fff; + } +} +</style> diff --git a/src/views/other/commonDialog/SelectContactDialog.vue b/src/views/other/commonDialog/SelectContactDialog.vue index 17a89be..ee4b4d3 100644 --- a/src/views/other/commonDialog/SelectContactDialog.vue +++ b/src/views/other/commonDialog/SelectContactDialog.vue @@ -62,11 +62,7 @@ return { editVisible: false, title: "", - infomation: { - name: "", - color: "", - setDefault: "" - } + infomation: {} } } } diff --git a/src/views/other/commonDialog/SelectLeadDialog.vue b/src/views/other/commonDialog/SelectLeadDialog.vue new file mode 100644 index 0000000..51ab2cd --- /dev/null +++ b/src/views/other/commonDialog/SelectLeadDialog.vue @@ -0,0 +1,158 @@ +<template> + <div class="edit-selClient-box"> + <el-dialog + :title="'閿�鍞嚎绱�'" + :visible.sync="editConfig.editVisible" + :width="dialogWidth" + :before-close="handleClose" + :append-to-body="true" + :close-on-click-modal="false" + > + <div class="bg-view"> + <div class="query-bg"> + <el-input placeholder="璇疯緭鍏ュ唴瀹�" v-model="queryInput" size="mini" class="input-with-select"> + <el-select v-model="select" slot="prepend" placeholder="璇烽�夋嫨"> + <el-option label="鍏ㄩ儴瀛楁" value="1"></el-option> + <el-option label="瀹㈡埛鍚嶇О" value="2"></el-option> + <el-option label="鍟嗘満鐘舵��" value="3"></el-option> + <el-option label="鍟嗘満鏉ユ簮" value="4"></el-option> + </el-select> + </el-input> + <div class="btn"> + <el-button type="primary" size="mini" disabled>璁剧疆瀛楁</el-button> + <el-button type="primary" size="mini" disabled>蹇�熷垱寤�</el-button> + </div> + </div> + <el-table + :data="tableData" + border + size="mini" + v-loading="loading" + :header-cell-style="{ background: '#f7f7f7' }" + > + <el-table-column label="瀹㈡埛鍚嶇О" prop="name" show-overflow-tooltip> + <template slot-scope="scope"> + <span class="sel-name" @click="selNameClick(scope.row)">{{ scope.row.name }}</span> + </template> + </el-table-column> + <el-table-column label="鍟嗘満鐘舵��" prop="businessStatus"></el-table-column> + <el-table-column label="鍟嗘満鏉ユ簮" prop="sales_sources_id"></el-table-column> + <div slot="empty"> + <el-empty :image-size="100"></el-empty> + </div> + </el-table> + <div slot="footer" class="dialog-footer"> + <div class="remark">璇存槑锛氭敮鎸佸瀛楁妯$硦鏌ヨ锛屼粎鏄剧ず绗﹀悎鏉′欢鐨勫墠5鏉℃暟鎹�</div> + </div> + </div> + </el-dialog> + </div> +</template> + +<script> +import { getSalesLeadsList } from "@/api/client/salesLead" +export default { + name: "EditSelChanceDialog", + props: { + editCommonConfig: { + type: Object, + default: () => { + return { + editVisible: false, + title: "", + infomation: {} + } + } + } + }, + components: {}, + computed: {}, + data() { + return { + dialogWidth: "50%", + editConfig: this.editCommonConfig, + queryInput: "", + select: "1", + tableData: [], + searchSelOptions: [], + loading: false + } + }, + created() { + this.getData() + }, + methods: { + handleClose() { + this.editConfig.editVisible = false + }, + // 璇锋眰鏁版嵁 + async getData() { + this.loading = true + await getSalesLeadsList() + .then((res) => { + console.log(res) + if (res.code === 200) { + if (res.data.list && res.data.list.length > 0) { + const list = res.data.list.map((item) => { + return { + ...item + } + }) + this.tableData = list.slice(0, 5) || [] + } else { + this.tableData = [] + } + } else { + this.tableData = [] + } + this.loading = false + }) + .catch((err) => { + console.log(err) + this.tableData = [] + this.loading = false + }) + }, + selNameClick(row) { + this.editConfig.editVisible = false + console.log(row) + this.$emit("selClient", row, "lead") + } + } +} +</script> + +<!-- Add "scoped" attribute to limit CSS to this component only --> +<style lang="scss" scoped> +.bg-view { + margin: 10px; + .query-bg { + margin-bottom: 10px; + display: flex; + justify-content: space-between; + .el-input { + width: 310px; + .el-select { + width: 100px; + } + } + .btn { + float: right; + } + } +} +.sel-name { + color: $color-primary; + cursor: pointer; +} +.dialog-footer { + height: 40px; + line-height: 40px; + color: red; +} +::v-deep { + .input-with-select .el-input-group__prepend { + background-color: #fff; + } +} +</style> diff --git a/src/views/sales/quotation/AddQuotationDialog.vue b/src/views/sales/quotation/AddQuotationDialog.vue index cb8f901..9c6c37d 100644 --- a/src/views/sales/quotation/AddQuotationDialog.vue +++ b/src/views/sales/quotation/AddQuotationDialog.vue @@ -26,7 +26,11 @@ <div class="custom-name"> <el-autocomplete v-model="editConfig.infomation.client_name" - :fetch-suggestions="querySearchAsync" + :fetch-suggestions=" + (queryString, callback) => { + querySearchAsync(queryString, callback, 'client') + } + " value-key="name" @select="handleSelectClient('client', $event)" ></el-autocomplete> @@ -77,7 +81,11 @@ <div class="custom-name"> <el-autocomplete v-model="editConfig.infomation.contact_name" - :fetch-suggestions="queryContactAsync" + :fetch-suggestions=" + (queryString, callback) => { + querySearchAsync(queryString, callback, 'contact') + } + " value-key="name" @select="handleSelectClient('contact', $event)" ></el-autocomplete> @@ -382,14 +390,13 @@ this.editConfig.visible = false }, // 閫夋嫨瀹㈡埛鐩稿叧鏂规硶 - querySearchAsync(queryString, cb) { - var restaurants = this.clientList - var results = queryString ? restaurants.filter(this.createStateFilter(queryString)) : restaurants - cb(results) - }, - // 閫夋嫨鑱旂郴浜哄鍚� - queryContactAsync(queryString, cb) { - var restaurants = this.contactNamelist + querySearchAsync(queryString, cb, value) { + var restaurants = [] + if (value === "client") { + restaurants = this.clientList + } else if (value === "contact") { + restaurants = this.contactNamelist + } var results = queryString ? restaurants.filter(this.createStateFilter(queryString)) : restaurants cb(results) }, diff --git a/src/views/sales/salesOpportunity/AddSalesOpportunityDialog.vue b/src/views/sales/salesOpportunity/AddSalesOpportunityDialog.vue index 9a8ff45..04fb294 100644 --- a/src/views/sales/salesOpportunity/AddSalesOpportunityDialog.vue +++ b/src/views/sales/salesOpportunity/AddSalesOpportunityDialog.vue @@ -26,14 +26,18 @@ <div class="custom-name"> <el-autocomplete v-model="editConfig.infomation.client_name" - :fetch-suggestions="querySearchAsync" + :fetch-suggestions=" + (queryString, callback) => { + querySearchAsync(queryString, callback, 'client') + } + " value-key="name" - @select="handleSelectClient" + @select="handleSelectClient('client', $event)" ></el-autocomplete> - <div class="common-select-btn" @click="selClientClick"> + <div class="common-select-btn" @click="selClientClick('client')"> <i class="el-icon-circle-plus-outline" title="閫夋嫨"></i> </div> - <div class="common-select-btn" @click="clearupClient"> + <div class="common-select-btn" @click="clearupClient('client')"> <i class="el-icon-edit-outline" title="娓呴櫎"></i> </div> </div> @@ -54,8 +58,25 @@ </el-form-item> </el-col> <el-col :span="12"> - <el-form-item label="鑱旂郴浜哄鍚�" prop="contact_id"> - <el-input v-model="editConfig.infomation.contact_id"></el-input> + <el-form-item label="鑱旂郴浜哄鍚�" prop="contact_name"> + <div class="custom-name"> + <el-autocomplete + v-model="editConfig.infomation.contact_name" + :fetch-suggestions=" + (queryString, callback) => { + querySearchAsync(queryString, callback, 'contact') + } + " + 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> <el-col :span="12"> @@ -122,7 +143,7 @@ size="mini" style="width: 63%" > - <el-option v-for="item in memberOptions" :key="item.id" :label="item.name" :value="item.id"> + <el-option v-for="item in memberOptions" :key="item.id" :label="item.username" :value="item.id"> </el-option> </el-select> </el-form-item> @@ -482,6 +503,12 @@ :edit-common-config="editSelectClientConfig" @selClient="selClient" /> + <!-- 閫夋嫨鑱旂郴浜� --> + <SelectContactDialog + v-if="editSelectContactConfig.editVisible" + :edit-common-config="editSelectContactConfig" + @selClient="selClient" + /> </el-dialog> </div> </template> @@ -490,6 +517,7 @@ import { getAllData } from "@/api/client/client" import { getAddSaleChance, getUpdateSaleChance } from "@/api/sales/salesOpportunity" import SelectClientDialog from "@/views/other/commonDialog/SelectClientDialog" +import SelectContactDialog from "@/views/other/commonDialog/SelectContactDialog" export default { name: "AddSalesOpportunityDialog", props: { @@ -504,13 +532,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() { @@ -543,11 +574,19 @@ title: "", infomation: {} }, - restaurants: [] + editSelectContactConfig: { + editVisible: false, + title: "", + infomation: {} + }, + restaurants: [], + clientId: this.editCommonConfig.infomation.client_id, + contactId: this.editCommonConfig.infomation.contact_id } }, created() { this.$store.dispatch("geClient") + this.$store.dispatch("geContact") this.getCommonData() }, methods: { @@ -629,9 +668,9 @@ budget: data.budget || 0, capital_budget: data.capital_budget || "", city_id: data.city_id || 0, - client_id: data.client_id || 0, + client_id: parseInt(this.clientId), competitors: data.competitors || "", - contact_id: data.contact_id || 0, + contact_id: parseInt(this.contactId), country_id: data.country_id || 0, currency: data.currency || 0, disadvantages: data.disadvantages || "", @@ -663,9 +702,13 @@ return params }, // 閫夋嫨鐢ㄦ埛鐩稿叧鏂规硶 - querySearchAsync(queryString, cb) { - console.log(this.clientList) - var restaurants = this.clientList + querySearchAsync(queryString, cb, value) { + var restaurants = [] + if (value === "client") { + restaurants = this.clientList + } else if (value === "contact") { + restaurants = this.contactNamelist + } var results = queryString ? restaurants.filter(this.createStateFilter(queryString)) : restaurants cb(results) }, @@ -674,20 +717,38 @@ return state.name.toLowerCase().indexOf(queryString.toLowerCase()) === 0 } }, - handleSelectClient(item) { - this.editConfig.infomation.client_id = item.id + handleSelectClient(value, item) { + if (value === "client") { + this.clientId = item.id + } else if (value === "contact") { + 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) { - this.editConfig.infomation.client_name = row.name - this.editConfig.infomation.client_id = row.id + selClient(row, value) { + if (value === "contact") { + this.editConfig.infomation.contact_name = row.name + this.contactId = row.id + } else if (value === "client") { + 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 if (value === "contact") { + this.editConfig.infomation.contact_name = "" + this.contactId = 0 + } }, // 娣诲姞闄勪欢 addAnnexClick() {}, diff --git a/src/views/sales/subOrder/AddSubOrderDialog.vue b/src/views/sales/subOrder/AddSubOrderDialog.vue index bdd8ef5..f6224c9 100644 --- a/src/views/sales/subOrder/AddSubOrderDialog.vue +++ b/src/views/sales/subOrder/AddSubOrderDialog.vue @@ -25,14 +25,18 @@ <div class="custom-name"> <el-autocomplete v-model="editConfig.infomation.client_name" - :fetch-suggestions="querySearchAsync" + :fetch-suggestions=" + (queryString, callback) => { + querySearchAsync(queryString, callback, 'client') + } + " value-key="name" - @select="handleSelectClient" + @select="handleSelectClient('client', $event)" ></el-autocomplete> - <div class="common-select-btn" @click="selClientClick"> + <div class="common-select-btn" @click="selClientClick('client')"> <i class="el-icon-circle-plus-outline" title="閫夋嫨"></i> </div> - <div class="common-select-btn" @click="clearupClient"> + <div class="common-select-btn" @click="clearupClient('client')"> <i class="el-icon-edit-outline" title="娓呴櫎"></i> </div> </div> @@ -44,11 +48,24 @@ </el-form-item> </el-col> <el-col :span="12"> - <el-form-item label="閿�鍞�诲崟" prop="masterOrderId"> + <el-form-item label="閿�鍞�诲崟" prop="masterOrderNumber"> <div class="custom-name"> - <el-input v-model="editConfig.infomation.masterOrderId"></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.masterOrderNumber" + :fetch-suggestions=" + (queryString, callback) => { + querySearchAsync(queryString, callback, 'master') + } + " + value-key="number" + @select="handleSelectClient('master', $event)" + ></el-autocomplete> + <div class="common-select-btn" @click="selClientClick('master')"> + <i class="el-icon-circle-plus-outline" title="閫夋嫨"></i> + </div> + <div class="common-select-btn" @click="clearupClient('master')"> + <i class="el-icon-edit-outline" title="娓呴櫎"></i> + </div> </div> </el-form-item> </el-col> @@ -184,6 +201,12 @@ :edit-common-config="editSelectClientConfig" @selClient="selClient" /> + <!-- 閫夋嫨閿�鍞�诲崟 --> + <SelectCommonDialog + v-if="editSelectMasterConfig.editVisible" + :edit-common-config="editSelectMasterConfig" + @selClient="selClient" + /> </el-dialog> </div> </template> @@ -193,9 +216,11 @@ import { getAllData } from "@/api/client/client" import { getAddSubOrder, getUpdateSubOrder } from "@/api/sales/subOrder" import SelectClientDialog from "@/views/other/commonDialog/SelectClientDialog" +import SelectCommonDialog from "@/views/other/commonDialog/SelectCommonDialog" + export default { name: "SubOrderDialog", - components: { CommonFormTableView, SelectClientDialog }, + components: { CommonFormTableView, SelectClientDialog, SelectCommonDialog }, props: { editCommonConfig: { type: Object, @@ -211,6 +236,9 @@ computed: { clientList() { return this.$store.state.getClientName.clientList + }, + masterOrderList() { + return this.$store.state.getClientName.masterOrderList } }, data() { @@ -244,11 +272,19 @@ editVisible: false, title: "", infomation: {} - } + }, + editSelectMasterConfig: { + editVisible: false, + title: "", + infomation: {} + }, + clientId: this.editCommonConfig.infomation.client_id, + masterId: this.editCommonConfig.infomation.masterOrderId } }, created() { this.$store.dispatch("geClient") + this.$store.dispatch("geMaster") this.setTableForm() this.getCommonData() }, @@ -259,11 +295,19 @@ console.log(res) if (res.code === 200) { this.memberOptions = res.data.member + this.dataProcess() } }) .catch((err) => { console.log(err) }) + }, + dataProcess() { + this.masterOrderList.map((item) => { + if (this.masterId === item.id) { + this.editConfig.infomation.masterOrderNumber = item.number + } + }) }, // 淇濆瓨 saveClick(formName) { @@ -315,8 +359,8 @@ let data = this.editConfig.infomation let params = { id: this.editConfig.title === "鏂板缓" ? 0 : data.id, - clientId: parseInt(data.client_id) || 0, - masterOrderId: parseInt(data.masterOrderId) || 0, + clientId: parseInt(this.clientId) || 0, + masterOrderId: parseInt(this.masterId) || 0, memberId: data.memberId || 0, number: data.number || "", product: [ @@ -337,31 +381,67 @@ this.editConfig.visible = false }, // 閫夋嫨瀹㈡埛鐩稿叧鏂规硶 - querySearchAsync(queryString, cb) { - var restaurants = this.clientList - var results = queryString ? restaurants.filter(this.createStateFilter(queryString)) : restaurants + querySearchAsync(queryString, cb, value) { + var restaurants = [] + if (value === "client") { + restaurants = this.clientList + } else if (value === "master") { + restaurants = this.masterOrderList + } + // else if (value === "chance") { + // restaurants = this.saleChancelist + // } else { + // restaurants = this.saleLeadlist + // } + var results = queryString ? restaurants.filter(this.createStateFilter(queryString, value)) : restaurants cb(results) }, - createStateFilter(queryString) { + createStateFilter(queryString, value) { return (state) => { - return state.name.toLowerCase().indexOf(queryString.toLowerCase()) === 0 + console.log(state) + if (value === "client") { + return state.name.toLowerCase().indexOf(queryString.toLowerCase()) === 0 + } else if (value === "master") { + return state.number.toLowerCase().indexOf(queryString.toLowerCase()) === 0 + } } }, - handleSelectClient(item) { - this.editConfig.infomation.client_id = item.id + handleSelectClient(value, item) { + if (value === "client") { + this.clientId = item.id + } else if (value === "master") { + this.masterId = item.id + } }, - selClientClick() { - this.editSelectClientConfig.editVisible = true + selClientClick(value) { + if (value == "client") { + this.editSelectClientConfig.editVisible = true + } else if (value == "master") { + this.editSelectMasterConfig.title = "閿�鍞�诲崟" + this.editSelectMasterConfig.editVisible = true + } }, - selClient(row) { + selClient(row, value) { console.log(row) - this.editConfig.infomation.client_name = row.name - this.editConfig.infomation.client_id = row.id + if (value == "client") { + this.editConfig.infomation.client_name = row.name + this.editConfig.infomation.client_id = row.id + this.clientId = row.id + } else if (value == "master") { + this.editConfig.infomation.masterOrderNumber = row.number + this.masterId = 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.editConfig.infomation.client_id = 0 + this.clientId = 0 + } else if (value == "master") { + this.editConfig.infomation.masterOrderNumber = "" + this.masterId = 0 + } }, // 娣诲姞闄勪欢 addAnnexClick() {}, diff --git a/src/views/sales/subOrder/index.vue b/src/views/sales/subOrder/index.vue index 0bcefe9..886cb82 100644 --- a/src/views/sales/subOrder/index.vue +++ b/src/views/sales/subOrder/index.vue @@ -140,7 +140,7 @@ console.log(row) this.editConfig.visible = true this.editConfig.title = "缂栬緫" - this.editConfig.infomation = { ...row } + this.editConfig.infomation = { ...row, masterOrderNumber: "" } }, // 鍒犻櫎 delClick(id) { -- Gitblit v1.8.0