From 8191562f28c525373941af4638c30c8f8e74c245 Mon Sep 17 00:00:00 2001 From: yangfeng <wanwan926_4@163.com> Date: 星期三, 16 八月 2023 12:12:10 +0800 Subject: [PATCH] bug修复 --- src/views/service/serviceContract/AddServiceContractDialog.vue | 2 src/api/client/followupRecords.js | 8 src/views/client/client/index.vue | 24 src/views/other/commonDialog/SelectContactDialog.vue | 89 ++++-- src/views/client/contacts/AddContactsDialog.vue | 25 - src/views/other/commonDialog/SelectChanceDialog.vue | 123 ++++----- src/views/other/commonDialog/SelectClientDialog.vue | 137 ++++----- src/views/client/followupRecords/index.vue | 3 src/views/client/followupRecords/AddFollowupRecordsDialog.vue | 55 +-- src/components/layout/components/appsidebar/index.vue | 2 src/views/other/commonDialog/SelectCommonDialog.vue | 261 ++++++++++++++++++- src/views/service/serviceContract/index.vue | 6 12 files changed, 487 insertions(+), 248 deletions(-) diff --git a/src/api/client/followupRecords.js b/src/api/client/followupRecords.js index a2af2ab..de9a91f 100644 --- a/src/api/client/followupRecords.js +++ b/src/api/client/followupRecords.js @@ -32,3 +32,11 @@ data }) } + +// 鑱旂郴鏂瑰紡鍒楄〃 +export function getContactInfoList() { + return request({ + url: "/api/contactInformation/list", + method: "get" + }) +} diff --git a/src/components/layout/components/appsidebar/index.vue b/src/components/layout/components/appsidebar/index.vue index 42578d9..ddcb6f1 100644 --- a/src/components/layout/components/appsidebar/index.vue +++ b/src/components/layout/components/appsidebar/index.vue @@ -36,7 +36,7 @@ <el-menu-item index="/sales/salesReturn">閿�鍞��璐у崟</el-menu-item> <el-menu-item index="/sales/refundForm">閿�鍞��娆惧崟</el-menu-item> <el-menu-item index="/sales/contractManage">鍚堝悓绠$悊</el-menu-item> - <el-menu-item index="/sales/generatePlan">鐢熸垚璁″垝</el-menu-item> + <!-- <el-menu-item index="/sales/generatePlan">鐢熸垚璁″垝</el-menu-item> --> </el-submenu> <el-submenu index="3"> <template slot="title"> diff --git a/src/views/client/client/index.vue b/src/views/client/client/index.vue index 4830133..b9b8999 100644 --- a/src/views/client/client/index.vue +++ b/src/views/client/client/index.vue @@ -171,15 +171,22 @@ let contact_name = "" let contact_phone = "" let contact_id = 0 + let contact_wechat = "" + let contact_email = "" + let position = "" if (item.contacts.length !== 0) { for (let i = 0; i < item.contacts.length; i++) { if (item.contacts[i].is_first) { contact_name = item.contacts[i].name contact_phone = item.contacts[i].phone contact_id = item.contacts[i].id + contact_wechat = item.contacts[i].wechat + contact_email = item.contacts[i].email + position = item.contacts[i].position } } } + console.log(contact_wechat, contact_email) return { ...item, contact_name: contact_name, @@ -187,7 +194,10 @@ client_level: item.client_level.name, client_status: item.client_status.name, contact_id: contact_id, - member_name: item.member.username + member_name: item.member.username, + contact_wechat: contact_wechat, + contact_email: contact_email, + position: position } }) this.tableList.tableInfomation = list || [] @@ -232,18 +242,8 @@ console.log(row) this.editConfig.visible = true this.editConfig.title = "缂栬緫" - let contactObj = {} - if (row.contacts.length > 0) { - row.contacts.forEach((ele) => { - if (ele.is_first) { - contactObj = { ...ele } - } - }) - } this.editConfig.infomation = { - ...row, - contact_wechat: contactObj.length > 0 ? contactObj.wechat : "", - contact_email: contactObj.length > 0 ? contactObj.email : "" + ...row } }, // 鍒犻櫎 diff --git a/src/views/client/contacts/AddContactsDialog.vue b/src/views/client/contacts/AddContactsDialog.vue index 3e45c21..d228881 100644 --- a/src/views/client/contacts/AddContactsDialog.vue +++ b/src/views/client/contacts/AddContactsDialog.vue @@ -76,7 +76,13 @@ </el-col> <el-col :span="12"> <el-form-item v-if="isUnflod" label="棣栬鑱旂郴浜�" prop="is_first"> - <el-switch v-model="editConfig.infomation.is_first" active-color="#2E68DB" inactive-color="#AEB9CA"> + <el-switch + v-model="editConfig.infomation.is_first" + active-color="#2E68DB" + inactive-color="#AEB9CA" + active-value="鏄�" + inactive-value="鍚�" + > </el-switch> </el-form-item> </el-col> @@ -335,18 +341,11 @@ 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.memberOptions = res.data.member - // this.countryOptions = res.data.country - this.provinceOptions = res.data.province - // this.cityOptions = res.data.city - // this.regionOptions = res.data.region - }) - .catch((err) => { - console.log(err) - }) + getAllData().then((res) => { + console.log(res) + this.memberOptions = res.data.member + this.provinceOptions = res.data.province + }) }, handleClose() { this.editConfig.visible = false diff --git a/src/views/client/followupRecords/AddFollowupRecordsDialog.vue b/src/views/client/followupRecords/AddFollowupRecordsDialog.vue index a50d001..35dc51c 100644 --- a/src/views/client/followupRecords/AddFollowupRecordsDialog.vue +++ b/src/views/client/followupRecords/AddFollowupRecordsDialog.vue @@ -110,20 +110,15 @@ </el-form-item> </el-col> <el-col :span="12"> - <el-form-item label="鑱旂郴鏂瑰紡" prop="contactInfo"> + <el-form-item label="鑱旂郴鏂瑰紡" prop="contact_information_id"> <!-- <el-input v-model="editConfig.infomation.phoneNumber" maxlength="11" show-word-limit oninput="value=value.replace(/[^\d]/g,'')" ></el-input> --> - <el-select v-model="editConfig.infomation.contactInfo" placeholder="璇烽�夋嫨" size="mini"> - <el-option - v-for="item in contactInfoOptions" - :key="item.id" - :label="item.username" - :value="item.id" - > + <el-select v-model="editConfig.infomation.contact_information_id" placeholder="璇烽�夋嫨" size="mini"> + <el-option v-for="item in contactInfoOptions" :key="item.id" :label="item.name" :value="item.id"> </el-option> </el-select> </el-form-item> @@ -290,7 +285,7 @@ <script> import { getAllData } from "@/api/client/client" -import { getAddFollowRecord, getUpdateFollowRecord } from "@/api/client/followupRecords" +import { getAddFollowRecord, getUpdateFollowRecord, getContactInfoList } 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" @@ -383,19 +378,23 @@ this.$store.dispatch("geChance") this.$store.dispatch("geLead") this.getCommonData() + this.getContactInfoList() }, methods: { getCommonData() { - getAllData() - .then((res) => { - console.log(res) - this.clientStatusOptions = res.data.client_status - this.memberOptions = res.data.member - this.dataProcess() - }) - .catch((err) => { - console.log(err) - }) + getAllData().then((res) => { + console.log(res) + this.clientStatusOptions = res.data.client_status + this.memberOptions = res.data.member + this.dataProcess() + }) + }, + async getContactInfoList() { + await getContactInfoList().then((res) => { + if (res.code === 200) { + this.contactInfoOptions = res.data.list + } + }) }, dataProcess() { this.saleChancelist.map((item) => { @@ -426,17 +425,13 @@ } }) } else { - getUpdateFollowRecord(params) - .then((res) => { - this.editConfig.visible = false - if (res.code === 200) { - this.$message.success("缂栬緫鎴愬姛") - this.$parent.getData() - } - }) - .catch((err) => { - console.log(err) - }) + getUpdateFollowRecord(params).then((res) => { + this.editConfig.visible = false + if (res.code === 200) { + this.$message.success("缂栬緫鎴愬姛") + this.$parent.getData() + } + }) } } else { console.log("error submit") diff --git a/src/views/client/followupRecords/index.vue b/src/views/client/followupRecords/index.vue index 605f11a..b08b3a2 100644 --- a/src/views/client/followupRecords/index.vue +++ b/src/views/client/followupRecords/index.vue @@ -146,7 +146,7 @@ { label: "瀹㈡埛鍚嶇О", prop: "client_name", min: 190, isClientClick: true }, // 瀹㈡埛鍚嶇О { label: "鑱旂郴浜哄鍚�", prop: "contact_name", min: 100, isContactClick: true }, // 鑱旂郴浜哄鍚� { label: "瀹㈡埛鐘舵��", prop: "client_status", min: 100 }, // 瀹㈡埛鐘舵�� - { label: "鑱旂郴鏂瑰紡", prop: "phone", min: 100 }, // 鑱旂郴鏂瑰紡 + { label: "鑱旂郴鏂瑰紡", prop: "contact_information_name", min: 100 }, // 鑱旂郴鏂瑰紡 { label: "鑱旂郴浜烘棩鏈�", prop: "follow_time", isTime: true, min: 130 }, // 鑱旂郴浜烘棩鏈� { label: "涓嬫鍥炶鏃ユ湡", prop: "next_follow_time", isTime: true, min: 130 }, // 涓嬫鍥炶鏃ユ湡 { label: "璐熻矗浜�", prop: "member_name", min: 110 }, // 璐熻矗浜� @@ -180,6 +180,7 @@ client_status: item.client_status.name, phone: item.contact.phone, member_name: item.member.username + // contact_information_name: item.contact_information.name } }) this.tableList.tableInfomation = list || [] diff --git a/src/views/other/commonDialog/SelectChanceDialog.vue b/src/views/other/commonDialog/SelectChanceDialog.vue index bec8e0d..34c450d 100644 --- a/src/views/other/commonDialog/SelectChanceDialog.vue +++ b/src/views/other/commonDialog/SelectChanceDialog.vue @@ -10,49 +10,25 @@ > <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> + <SearchCommonView + ref="searchCommonView" + :search-options="searchOptions" + @searchClick="searchClick" + @resetClick="resetClick" + /> <div class="btn"> - <el-button type="primary" size="mini" disabled>璁剧疆瀛楁</el-button> - <el-button type="primary" size="mini" disabled>蹇�熷垱寤�</el-button> + <!-- <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" + <TableCommonView + ref="tableListRef" v-loading="loading" - :header-cell-style="{ background: '#f7f7f7' }" + :table-list="tableList" + :select-box="false" + @selCommonClick="selNameClick" > - <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> + </TableCommonView> <div slot="footer" class="dialog-footer"> <div class="remark">璇存槑锛氭敮鎸佸瀛楁妯$硦鏌ヨ锛屼粎鏄剧ず绗﹀悎鏉′欢鐨勫墠5鏉℃暟鎹�</div> </div> @@ -85,43 +61,69 @@ editConfig: this.editCommonConfig, queryInput: "", select: "1", - tableData: [], + tableList: [], searchSelOptions: [], - loading: false + loading: false, + search_map: {} } }, created() { + this.setTable() this.getData() }, methods: { + setTable() { + this.tableList = { + tableInfomation: [], + tableColumn: [ + { label: "閿�鍞満浼氱紪鍙�", prop: "number" }, // 閿�鍞満浼氱紪鍙� + { label: "鏈轰細鍚嶇О", prop: "name", isCommonClick: true }, // 鏈轰細鍚嶇О + { label: "閿�鍞樁娈�", prop: "sale_stage_name" }, // 閿�鍞樁娈� + { label: "閿�鍞礋璐d汉", prop: "member_name" }, // 閿�鍞礋璐d汉 + { label: "棰勮鎴愪氦鏃ユ湡", prop: "expected_time" } // 棰勮鎴愪氦鏃ユ湡 + ] + } + this.searchOptions = [] + for (let i = 0; i < this.tableList.tableColumn.length; i++) { + const label = this.tableList.tableColumn[i].label + const value = this.tableList.tableColumn[i].prop + this.searchOptions.push({ value: value, label: label }) + } + }, handleClose() { this.editConfig.editVisible = false }, // 璇锋眰鏁版嵁 async getData() { this.loading = true - await getSaleChanceList() + await getSaleChanceList({ + search_map: this.search_map, + page: 0, + pageSize: 0 + }) .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 + ...item, + member_name: item.member.username, + sale_stage_name: item.sale_stage.name } }) - this.tableData = list.slice(0, 5) || [] + this.tableList.tableInfomation = list.slice(0, 5) || [] } else { - this.tableData = [] + this.tableList.tableInfomation = [] } } else { - this.tableData = [] + this.tableList.tableInfomation = [] } this.loading = false }) .catch((err) => { console.log(err) - this.tableData = [] + this.tableList.tableInfomation = [] this.loading = false }) }, @@ -130,26 +132,17 @@ 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() // 绉� - // 鏈夊叾浠栨牸寮忓寲瀛楃闇�姹傚彲浠ョ户缁坊鍔狅紝蹇呴』杞寲鎴愬瓧绗︿覆 + // 鎼滅储 + searchClick(val, content) { + console.log(val, content) + this.search_map = { + [val.value]: content } - 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 + this.getData() + }, + resetClick() { + this.search_map = {} + this.getData() } } } diff --git a/src/views/other/commonDialog/SelectClientDialog.vue b/src/views/other/commonDialog/SelectClientDialog.vue index 3a3726f..0f09db5 100644 --- a/src/views/other/commonDialog/SelectClientDialog.vue +++ b/src/views/other/commonDialog/SelectClientDialog.vue @@ -10,59 +10,25 @@ > <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="閿�鍞礋璐d汉" value="4"></el-option> - <el-option label="娉曞畾浠h〃浜�" value="5"></el-option> - <el-option label="娉ㄥ唽鏃堕棿" value="6"></el-option> - <el-option label="缁忚惀鑼冨洿" value="7"></el-option> - <el-option label="璇︾粏鍦板潃" value="8"></el-option> - <el-option label="澶囨敞" value="9"></el-option> - </el-select> - </el-input> + <SearchCommonView + ref="searchCommonView" + :search-options="searchOptions" + @searchClick="searchClick" + @resetClick="resetClick" + /> <div class="btn"> - <el-button type="primary" size="mini" disabled>璁剧疆瀛楁</el-button> - <el-button type="primary" size="mini" disabled>蹇�熷垱寤�</el-button> + <!-- <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" + <TableCommonView + ref="tableListRef" v-loading="loading" - :header-cell-style="{ background: '#f7f7f7' }" + :table-list="tableList" + :select-box="false" + @selClientClick="selNameClick" > - <el-table-column label="瀹㈡埛鍚嶇О" prop="name" show-overflow-tooltip> - <template slot-scope="scope"> - <!-- <div style="margin-right: 10px"> --> - <span class="sel-name" @click="selNameClick(scope.row)">{{ scope.row.name }}</span> - <!-- </div> --> - </template> - </el-table-column> - <el-table-column label="瀹㈡埛缂栧彿" prop="number"></el-table-column> - <el-table-column label="瀹㈡埛鐘舵��" prop="client_status"></el-table-column> - <el-table-column label="閿�鍞礋璐d汉" prop="member_id"></el-table-column> - <!-- <el-table-column label="绾跨储鍗囩骇鐘舵��" prop="setDefault"></el-table-column> --> - <el-table-column label="娉曞畾浠h〃浜�" prop="representative"></el-table-column> - <el-table-column label="娉ㄥ唽鏃堕棿" prop="registration_time" show-overflow-tooltip> - <template slot-scope="scope"> - <span>{{ - dateFormat("YYYY-mm-dd HH:MM:SS", scope.row.registration_time) === "1900-01-01 08:00:00" - ? "--" - : dateFormat("YYYY-mm-dd HH:MM:SS", scope.row.registration_time) - }}</span> - </template> - </el-table-column> - <el-table-column label="缁忚惀鑼冨洿" prop="business_scope"></el-table-column> - <el-table-column label="璇︾粏鍦板潃" prop="detail_address"></el-table-column> - <el-table-column label="澶囨敞" prop="remark"></el-table-column> - <div slot="empty"> - <el-empty :image-size="100"></el-empty> - </div> - </el-table> + </TableCommonView> <div slot="footer" class="dialog-footer"> <div class="remark">璇存槑锛氭敮鎸佸瀛楁妯$硦鏌ヨ锛屼粎鏄剧ず绗﹀悎鏉′欢鐨勫墠5鏉℃暟鎹�</div> </div> @@ -97,20 +63,50 @@ select: "1", tableData: [], searchSelOptions: [], - loading: false + loading: false, + searchOptions: [], + tableList: {}, + search_map: {} } }, created() { + this.setTable() this.getData() }, methods: { + setTable() { + this.tableList = { + tableInfomation: [], + tableColumn: [ + { label: "瀹㈡埛鍚嶇О", prop: "name", min: 100, isClientClick: true }, + { label: "瀹㈡埛缂栧彿", prop: "number" }, + { label: "瀹㈡埛鐘舵��", prop: "client_status" }, + { label: "閿�鍞礋璐d汉", prop: "member_name" }, + { label: "娉曞畾浠h〃浜�", prop: "representative" }, + { label: "娉ㄥ唽鏃堕棿", prop: "registration_time" }, + { label: "缁忚惀鑼冨洿", prop: "business_scope" }, + { label: "璇︾粏鍦板潃", prop: "detail_address" }, + { label: "澶囨敞", prop: "remark" } + ] + } + this.searchOptions = [] + for (let i = 0; i < this.tableList.tableColumn.length; i++) { + const label = this.tableList.tableColumn[i].label + const value = this.tableList.tableColumn[i].prop + this.searchOptions.push({ value: value, label: label }) + } + }, handleClose() { this.editConfig.editVisible = false }, // 璇锋眰鏁版嵁 async getData() { this.loading = true - await getClientList() + await getClientList({ + search_map: this.search_map, + page: 0, + pageSize: 0 + }) .then((res) => { console.log(res) if (res.code === 200) { @@ -118,21 +114,22 @@ const list = res.data.list.map((item) => { return { ...item, - client_status: item.client_status.name + client_status: item.client_status.name, + member_name: item.member.username } }) - this.tableData = list.slice(0, 5) || [] + this.tableList.tableInfomation = list.slice(0, 5) || [] } else { - this.tableData = [] + this.tableList.tableInfomation = [] } } else { - this.tableData = [] + this.tableList.tableInfomation = [] } this.loading = false }) .catch((err) => { console.log(err) - this.tableData = [] + this.this.tableList.tableInfomation = [] this.loading = false }) }, @@ -140,26 +137,17 @@ this.editConfig.editVisible = false this.$emit("selClient", row, "client") }, - // 鏃堕棿鏄剧ず - 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() // 绉� - // 鏈夊叾浠栨牸寮忓寲瀛楃闇�姹傚彲浠ョ户缁坊鍔狅紝蹇呴』杞寲鎴愬瓧绗︿覆 + // 鎼滅储 + searchClick(val, content) { + console.log(val, content) + this.search_map = { + [val.value]: content } - 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 + this.getData() + }, + resetClick() { + this.search_map = {} + this.getData() } } } @@ -170,6 +158,7 @@ .bg-view { margin: 10px; .query-bg { + margin-left: -20px; margin-bottom: 10px; display: flex; justify-content: space-between; diff --git a/src/views/other/commonDialog/SelectCommonDialog.vue b/src/views/other/commonDialog/SelectCommonDialog.vue index f3dd1e3..17cdf43 100644 --- a/src/views/other/commonDialog/SelectCommonDialog.vue +++ b/src/views/other/commonDialog/SelectCommonDialog.vue @@ -10,15 +10,22 @@ > <div class="bg-view"> <div class="query-bg"> - <el-input placeholder="璇疯緭鍏ュ唴瀹�" v-model="queryInput" size="mini" class="input-with-select"> + <!-- <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> + </el-input> --> + <SearchCommonView + ref="searchCommonView" + :search-options="searchOptions" + @searchClick="searchClick" + @resetClick="resetClick" + :search-sel="searchSel" + /> <div class="btn"> - <el-button type="primary" size="mini" disabled>璁剧疆瀛楁</el-button> - <el-button type="primary" size="mini" disabled>蹇�熷垱寤�</el-button> + <!-- <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"> @@ -32,6 +39,12 @@ </template> <script> +import { getMasterOrderList } from "@/api/sales/masterOrder" +import { getQuotationList } from "@/api/sales/quotation" +import { getSalesDetailsList } from "@/api/sales/salesDetails" +import { getServiceContractList } from "@/api/serviceManage/serviceContract" +import { getServiceOrderList } from "@/api/serviceManage/clientServiceOrder" +import { getProductList } from "@/api/common/other" export default { name: "EditSelCommonDialog", props: { @@ -58,56 +71,65 @@ searchSelOptions: [], loading: false, tableList: {}, - commonOptions: [] + searchOptions: [], + search_map: {}, + searchSel: {}, + keyword: "", + keywordType: "" } }, created() { this.setTable() + this.getData() }, methods: { setTable() { if (this.editConfig.title === "閿�鍞�诲崟") { this.tableList = { - tableInfomation: this.editConfig.tableInfomation, + tableInfomation: [], tableColumn: [ { label: "鍗曟嵁缂栧彿", prop: "number", isClick: true }, // 鍗曟嵁缂栧彿 - { label: "璐熻矗浜�", prop: "member_id" } // 璐熻矗浜� + { label: "璐熻矗浜�", prop: "member_name" } // 璐熻矗浜� ] } + this.searchSel = { value: "number", label: "鍗曟嵁缂栧彿" } } else if (this.editConfig.title === "鏈嶅姟鍚堝悓") { this.tableList = { - tableInfomation: this.editConfig.tableInfomation, + tableInfomation: [], tableColumn: [ - { label: "瀹㈡埛鍚嶇О", prop: "clientId" }, // 瀹㈡埛鍚嶇О + { label: "瀹㈡埛鍚嶇О", prop: "client_name" }, // 瀹㈡埛鍚嶇О { label: "鏈嶅姟鍚堝悓缂栧彿", prop: "number", isClick: true }, // 鏈嶅姟鍚堝悓缂栧彿 - { label: "璐熻矗浜�", prop: "memberId" }, // 璐熻矗浜� + { label: "璐熻矗浜�", prop: "member_name" }, // 璐熻矗浜� { label: "鍚堣", prop: "total" }, // 鍚堣 { label: "绛剧害鏃ユ湡", prop: "signTime", isTime: true }, // 绛剧害鏃ユ湡 - { label: "鍚堝悓鐘舵��", prop: "serviceContractStatusId" } // 鍚堝悓鐘舵�� + { label: "鍚堝悓鐘舵��", prop: "serviceContractStatus" } // 鍚堝悓鐘舵�� ] } + this.searchSel = { value: "number", label: "鏈嶅姟鍚堝悓缂栧彿" } } else if (this.editConfig.title === "閿�鍞槑缁嗗崟") { this.tableList = { - tableInfomation: this.editConfig.tableInfomation, + tableInfomation: [], tableColumn: [ - { label: "瀹㈡埛鍚嶇О", prop: "clientId" }, // 瀹㈡埛鍚嶇О + { label: "瀹㈡埛鍚嶇О", prop: "client_name" }, // 瀹㈡埛鍚嶇О { label: "璁㈠崟缂栧彿", prop: "number", isClick: true }, // 璁㈠崟缂栧彿 { label: "绛剧害鏃ユ湡", prop: "signTime" }, // 绛剧害鏃ユ湡 - { label: "閿�鍞礋璐d汉", prop: "memberId" }, // 閿�鍞礋璐d汉 + { label: "閿�鍞礋璐d汉", prop: "member_name" }, // 閿�鍞礋璐d汉 { label: "鍚堣", prop: "tptal" } // 鍚堣 ] } + this.searchSel = { value: "number", label: "璁㈠崟缂栧彿" } } else if (this.editConfig.title === "鎶ヤ环鍗�") { this.tableList = { - tableInfomation: this.editConfig.tableInfomation, + tableInfomation: [], tableColumn: [ { label: "鎶ヤ环鍗曞彿", prop: "number", isClick: true }, // 鎶ヤ环鍗曞彿 - { label: "閿�鍞礋璐d汉", prop: "memberId" } // 閿�鍞礋璐d汉 + { label: "閿�鍞礋璐d汉", prop: "member_name" } // 閿�鍞礋璐d汉 ] } + this.searchSel = { value: "number", label: "鎶ヤ环鍗曞彿" } } else if (this.editConfig.title === "瀹㈡埛鏈嶅姟鍗�") { this.tableList = { - tableInfomation: this.editConfig.tableInfomation, + tableInfomation: [], tableColumn: [ { label: "鏈嶅姟鍗曠紪鍙�", prop: "serviceNumber", isClick: true }, // 鏈嶅姟鍗曠紪鍙� { label: "涓婚", prop: "subject" }, // 涓婚 @@ -118,13 +140,192 @@ { label: "瀹㈡埛绛惧悕", prop: "qianming" } // 瀹㈡埛绛惧悕 ] } + this.searchSel = { value: "serviceNumber", label: "鏈嶅姟鍗曠紪鍙�" } + } else if (this.editConfig.title === "浜у搧鍚嶇О") { + this.tableList = { + tableInfomation: [], + tableColumn: [ + { label: "浜у搧鍚嶇О", prop: "Name", isClick: true }, + { label: "浜у搧缂栧彿", prop: "Number" }, + { label: "瑙勬牸鍨嬪彿", prop: "MaterialMode" } + ] + } + this.searchSel = { value: "Name", label: "浜у搧鍚嶇О" } } - - this.commonOptions = [{ id: 1, name: "鍏ㄩ儴瀛楁" }] - for (let i = 1; i < this.tableList.tableColumn.length; i++) { + this.searchOptions = [] + for (let i = 0; i < this.tableList.tableColumn.length; i++) { const label = this.tableList.tableColumn[i].label - this.commonOptions.push({ id: (i + 1).toString(), name: label }) + const value = this.tableList.tableColumn[i].prop + this.searchOptions.push({ value: value, label: label }) } + }, + // 璇锋眰鏁版嵁 + async getData() { + this.loading = true + if (this.editConfig.title === "閿�鍞�诲崟") { + this.getMasterOrderList() + } else if (this.editConfig.title === "鏈嶅姟鍚堝悓") { + this.getServiceContractList() + } else if (this.editConfig.title === "閿�鍞槑缁嗗崟") { + this.getSalesDetailsList() + } else if (this.editConfig.title === "鎶ヤ环鍗�") { + this.getQuotationList() + } else if (this.editConfig.title === "瀹㈡埛鏈嶅姟鍗�") { + this.getServiceOrderList() + } else if (this.editConfig.title === "浜у搧鍚嶇О") { + this.getProductList() + } + }, + // 閿�鍞�诲崟 + async getMasterOrderList() { + await getMasterOrderList({ + search_map: this.search_map, + page: 0, + pageSize: 0 + }).then((res) => { + if (res.code === 200) { + if (res.data.list && res.data.list.length > 0) { + const list = res.data.list.map((item) => { + return { + ...item, + member_name: item.member.username + } + }) + this.tableList.tableInfomation = list.slice(0, 5) || [] + } else { + this.tableList.tableInfomation = [] + } + } + this.loading = false + }) + }, + // 鏈嶅姟鍚堝悓 + async getServiceContractList() { + await getServiceContractList({ + keyword: this.keyword, + keywordType: this.keywordType, + page: 0, + pageSize: 0 + }).then((res) => { + if (res.code === 200) { + if (res.data.list && res.data.list.length > 0) { + const list = res.data.list.map((item) => { + return { + ...item, + client_name: item.client.name, + member_name: item.member.username, + serviceContractStatus: item.serviceContractStatus.name + } + }) + this.tableList.tableInfomation = list.slice(0, 5) || [] + } else { + this.tableList.tableInfomation = [] + } + } + this.loading = false + }) + }, + // 鎶ヤ环鍗� + async getQuotationList() { + await getQuotationList({ + search_map: this.search_map, + page: 0, + pageSize: 0 + }).then((res) => { + if (res.code === 200) { + if (res.data.list && res.data.list.length > 0) { + const list = res.data.list.map((item) => { + return { + ...item, + member_name: item.member.username + } + }) + this.tableList.tableInfomation = list.slice(0, 5) || [] + } else { + this.tableList.tableInfomation = [] + } + } + this.loading = false + }) + }, + // 閿�鍞槑缁嗗崟 + async getSalesDetailsList() { + await getSalesDetailsList({ + keyword: this.keyword, + keywordType: this.keywordType, + page: 0, + pageSize: 0 + }).then((res) => { + if (res.code === 200) { + if (res.data.list && res.data.list.length > 0) { + const list = res.data.list.map((item) => { + return { + ...item, + client_name: item.client.name, + member_name: item.Member.username + } + }) + this.tableList.tableInfomation = list.slice(0, 5) || [] + } else { + this.tableList.tableInfomation = [] + } + } + this.loading = false + }) + }, + // 瀹㈡埛鏈嶅姟鍗� + async getServiceOrderList() { + await getServiceOrderList({ + keyword: this.keyword, + keywordType: this.keywordType, + page: 0, + pageSize: 0 + }).then((res) => { + if (res.code === 200) { + if (res.data.list && res.data.list.length > 0) { + const list = res.data.list.map((item) => { + return { + ...item, + client_name: item.Client.name, + serviceType_name: item.ServiceType.name, + faultType_name: item.FaultType.name, + serviceContract_Number: item.ServiceContract.number + } + }) + this.tableList.tableInfomation = list.slice(0, 5) || [] + } else { + this.tableList.tableInfomation = [] + } + } + this.loading = false + }) + }, + // 浜у搧鍚嶇О + async getProductList() { + await getProductList({ + productName: "", + productNumber: "", + page: 0, + pageSize: 0 + }).then((res) => { + if (res.code === 200) { + if (res.data.list && res.data.list.length > 0) { + const list = res.data.list.map((item) => { + return { + ...item, + client_name: item.Client.name, + serviceType_name: item.ServiceType.name, + faultType_name: item.FaultType.name, + serviceContract_Number: item.ServiceContract.number + } + }) + this.tableList.tableInfomation = list.slice(0, 5) || [] + } else { + this.tableList.tableInfomation = [] + } + } + this.loading = false + }) }, handleClose() { this.editConfig.editVisible = false @@ -141,7 +342,25 @@ this.$emit("selClient", row, "quotation") } else if (this.editConfig.title === "瀹㈡埛鏈嶅姟鍗�") { this.$emit("selClient", row, "customService") + } else if (this.editConfig.title === "浜у搧鍚嶇О") { + this.$emit("selClient", row, "productName") } + }, + // 鎼滅储 + searchClick(val, content) { + console.log(val, content) + this.search_map = { + [val.value]: content + } + this.keyword = content + this.keywordType = val.label + this.getData() + }, + resetClick() { + this.search_map = {} + this.keyword = "" + this.keywordType = "" + this.getData() } } } diff --git a/src/views/other/commonDialog/SelectContactDialog.vue b/src/views/other/commonDialog/SelectContactDialog.vue index ee4b4d3..cc8f874 100644 --- a/src/views/other/commonDialog/SelectContactDialog.vue +++ b/src/views/other/commonDialog/SelectContactDialog.vue @@ -10,7 +10,7 @@ > <div class="bg-view"> <div class="query-bg"> - <el-input placeholder="璇疯緭鍏ュ唴瀹�" v-model="queryInput" size="mini" class="input-with-select"> + <!-- <el-input placeholder="璇疯緭鍏ュ唴瀹�" v-model="queryInput" size="mini" class="input-with-select"> <el-select v-model="select" slot="prepend" placeholder="璇烽�夋嫨" disabled> <el-option label="鍏ㄩ儴瀛楁" value="1"></el-option> <el-option label="鑱旂郴浜哄鍚�" value="2"></el-option> @@ -42,7 +42,26 @@ <div slot="empty"> <el-empty :image-size="100"></el-empty> </div> - </el-table> + </el-table> --> + <SearchCommonView + ref="searchCommonView" + :search-options="searchOptions" + @searchClick="searchClick" + @resetClick="resetClick" + /> + <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" + v-loading="loading" + :table-list="tableList" + :select-box="false" + @selContactsClick="selNameClick" + > + </TableCommonView> <div slot="footer" class="dialog-footer"> <div class="remark">璇存槑锛氭敮鎸佸瀛楁妯$硦鏌ヨ锛屼粎鏄剧ず绗﹀悎鏉′欢鐨勫墠5鏉℃暟鎹�</div> </div> @@ -75,22 +94,45 @@ editConfig: this.editCommonConfig, queryInput: "", select: "1", - tableData: [], + tableList: [], searchSelOptions: [], - loading: false + loading: false, + search_map: {} } }, created() { + this.setTable() this.getData() }, methods: { + setTable() { + this.tableList = { + tableInfomation: [], + tableColumn: [ + { label: "鑱旂郴浜哄鍚�", prop: "name", isContactClick: true }, // 鑱旂郴浜哄鍚� + { label: "鑱旂郴浜虹紪鍙�", prop: "number" }, // 鑱旂郴浜虹紪鍙� + { label: "瀹㈡埛鍚嶇О", prop: "client_name" }, // 瀹㈡埛鍚嶇О + { label: "鎵嬫満", prop: "phone" } // 鎵嬫満鍙风爜 + ] + } + this.searchOptions = [] + for (let i = 0; i < this.tableList.tableColumn.length; i++) { + const label = this.tableList.tableColumn[i].label + const value = this.tableList.tableColumn[i].prop + this.searchOptions.push({ value: value, label: label }) + } + }, handleClose() { this.editConfig.editVisible = false }, // 璇锋眰鏁版嵁 async getData() { this.loading = true - await getContactList() + await getContactList({ + search_map: this.search_map, + page: 0, + pageSize: 0 + }) .then((res) => { console.log(res) if (res.code === 200) { @@ -101,18 +143,18 @@ client_name: item.Client.name } }) - this.tableData = list.slice(0, 5) || [] + this.tableList.tableInfomation = list.slice(0, 5) || [] } else { - this.tableData = [] + this.tableList.tableInfomation = [] } } else { - this.tableData = [] + this.tableList.tableInfomation = [] } this.loading = false }) .catch((err) => { console.log(err) - this.tableData = [] + this.tableList.tableInfomation = [] this.loading = false }) }, @@ -120,26 +162,17 @@ this.editConfig.editVisible = false this.$emit("selClient", row, "contact") }, - // 鏃堕棿鏄剧ず - 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() // 绉� - // 鏈夊叾浠栨牸寮忓寲瀛楃闇�姹傚彲浠ョ户缁坊鍔狅紝蹇呴』杞寲鎴愬瓧绗︿覆 + // 鎼滅储 + searchClick(val, content) { + console.log(val, content) + this.search_map = { + [val.value]: content } - 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 + this.getData() + }, + resetClick() { + this.search_map = {} + this.getData() } } } diff --git a/src/views/service/serviceContract/AddServiceContractDialog.vue b/src/views/service/serviceContract/AddServiceContractDialog.vue index cebf667..2cef39f 100644 --- a/src/views/service/serviceContract/AddServiceContractDialog.vue +++ b/src/views/service/serviceContract/AddServiceContractDialog.vue @@ -620,11 +620,9 @@ } else if (value === "contract") { this.editSelCommonConfig.title = "閿�鍞槑缁嗗崟" this.editSelCommonConfig.editVisible = true - this.editSelCommonConfig.tableInfomation = [...this.salesDetailsList] } else if (value === "quotation") { this.editSelCommonConfig.title = "鎶ヤ环鍗�" this.editSelCommonConfig.editVisible = true - this.editSelCommonConfig.tableInfomation = [...this.quotationList] } }, selClient(row, value) { diff --git a/src/views/service/serviceContract/index.vue b/src/views/service/serviceContract/index.vue index 072f64e..180b8e7 100644 --- a/src/views/service/serviceContract/index.vue +++ b/src/views/service/serviceContract/index.vue @@ -197,7 +197,11 @@ console.log(row) this.editConfig.visible = true this.editConfig.title = "缂栬緫" - this.editConfig.infomation = { ...row } + this.editConfig.infomation = { + ...row, + contract_number: row.salesDetails.number, + quotation_number: row.quotation.number + } }, // 鍒犻櫎 delClick() { -- Gitblit v1.8.0