From ed2f130164f4145560b4176da6629890c0806ded Mon Sep 17 00:00:00 2001 From: yangfeng <wanwan926_4@163.com> Date: 星期四, 10 八月 2023 18:11:27 +0800 Subject: [PATCH] 服务管理模块联调 --- src/views/service/serviceFollowup/AddServiceFollowupDialog.vue | 221 +++++++++++++++++++++++++++++++++++++++---------------- 1 files changed, 156 insertions(+), 65 deletions(-) diff --git a/src/views/service/serviceFollowup/AddServiceFollowupDialog.vue b/src/views/service/serviceFollowup/AddServiceFollowupDialog.vue index 3564b13..83ed22f 100644 --- a/src/views/service/serviceFollowup/AddServiceFollowupDialog.vue +++ b/src/views/service/serviceFollowup/AddServiceFollowupDialog.vue @@ -28,14 +28,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> @@ -49,18 +53,44 @@ <el-col :span="12"> <el-form-item label="鑱旂郴浜哄鍚�" prop="contactId"> <div class="custom-name"> - <el-input v-model="editConfig.infomation.contactId"></el-input> - <div class="common-select-btn"><i class="el-icon-circle-plus-outline" title="閫夋嫨"></i></div> - <div class="common-select-btn"><i class="el-icon-edit" title="缂栬緫"></i></div> + <el-autocomplete + v-model="editConfig.infomation.contact_name" + :fetch-suggestions=" + (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"> - <el-form-item label="瀹㈡埛鏈嶅姟鍗�" prop="customServiceForm"> + <el-form-item label="瀹㈡埛鏈嶅姟鍗�" prop="service_number"> <div class="custom-name"> - <el-input v-model="editConfig.infomation.customServiceForm"></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.service_number" + :fetch-suggestions=" + (queryString, callback) => { + querySearchAsync(queryString, callback, 'customService') + } + " + value-key="serviceNumber" + @select="handleSelectClient('customService', $event)" + ></el-autocomplete> + <div class="common-select-btn" @click="selClientClick('customService')"> + <i class="el-icon-circle-plus-outline" title="閫夋嫨"></i> + </div> + <div class="common-select-btn" @click="clearupClient('customService')"> + <i class="el-icon-edit-outline" title="娓呴櫎"></i> + </div> </div> </el-form-item> </el-col> @@ -210,6 +240,18 @@ :edit-common-config="editSelectClientConfig" @selClient="selClient" /> + <!-- 閫夋嫨鑱旂郴浜� --> + <SelectContactDialog + v-if="editSelectContactConfig.editVisible" + :edit-common-config="editSelectContactConfig" + @selClient="selClient" + /> + <!-- 瀹㈡埛鏈嶅姟璁㈠崟 --> + <SelectCommonDialog + v-if="editSelCommonConfig.editVisible" + :edit-common-config="editSelCommonConfig" + @selClient="selClient" + /> </el-dialog> </div> </template> @@ -218,6 +260,8 @@ import { getAllData } from "@/api/client/client" import { getAddServiceFollowup, getUpdateServiceFollowup } from "@/api/serviceManage/serviceFollowup" import SelectClientDialog from "@/views/other/commonDialog/SelectClientDialog" +import SelectContactDialog from "@/views/other/commonDialog/SelectContactDialog" +import SelectCommonDialog from "@/views/other/commonDialog/SelectCommonDialog" export default { name: "AddServiceFollowupDialog", props: { @@ -232,13 +276,16 @@ } } }, - components: { SelectClientDialog }, + components: { SelectClientDialog, SelectContactDialog, SelectCommonDialog }, computed: { - searchCommonHeight() { - return this.$refs.searchCommonView.offsetHeight - }, clientList() { return this.$store.state.getClientName.clientList + }, + contactNamelist() { + return this.$store.state.getClientName.contactNamelist + }, + serviceOrderList() { + return this.$store.state.getClientName.serviceOrderList } }, data() { @@ -259,11 +306,26 @@ editVisible: false, title: "", infomation: {} - } + }, + editSelectContactConfig: { + editVisible: false, + title: "", + infomation: {} + }, + editSelCommonConfig: { + editVisible: false, + title: "", + infomation: {} + }, + clientId: this.editCommonConfig.infomation.clientId, + contactId: this.editCommonConfig.infomation.contactId, + serviceId: this.editCommonConfig.infomation.serviceId } }, created() { this.$store.dispatch("geClient") + this.$store.dispatch("geContact") + this.$store.dispatch("geServiceOrder") this.getCommonData() }, methods: { @@ -289,37 +351,23 @@ const params = this.saveParams() console.log(params) if (this.editConfig.title === "鏂板缓") { - getAddServiceFollowup(params) - .then((res) => { - console.log(res) - this.editConfig.visible = false - if (res.code === 200) { - this.$message({ - message: "娣诲姞鎴愬姛", - type: "success" - }) - this.$parent.getData() - } - }) - .catch((err) => { - console.log(err) - }) + getAddServiceFollowup(params).then((res) => { + console.log(res) + this.editConfig.visible = false + if (res.code === 200) { + this.$message.success("娣诲姞鎴愬姛") + this.$parent.getData() + } + }) } else { - getUpdateServiceFollowup(params) - .then((res) => { - console.log(res) - this.editConfig.visible = false - if (res.code === 200) { - this.$message({ - message: "缂栬緫鎴愬姛", - type: "success" - }) - this.$parent.getData() - } - }) - .catch((err) => { - console.log(err) - }) + getUpdateServiceFollowup(params).then((res) => { + console.log(res) + this.editConfig.visible = false + if (res.code === 200) { + this.$message.success("缂栬緫鎴愬姛") + this.$parent.getData() + } + }) } } else { console.log("error submit") @@ -331,8 +379,8 @@ let data = this.editConfig.infomation let params = { id: this.editConfig.title === "鏂板缓" ? 0 : data.id, - clientId: data.clientId || 0, - contactId: data.contactId || 0, + clientId: this.clientId || 0, + contactId: this.contactId || 0, file: data.file || "", isVisit: data.isVisit || 0, memberId: data.memberId || 0, @@ -341,7 +389,7 @@ planId: data.planId || 0, remark: data.remark || "", satisfaction: data.satisfaction || 0, - serviceId: data.serviceId || 0, + serviceId: this.serviceId || 0, solveRate: data.solveRate || 0, timelyRate: data.timelyRate || 0 } @@ -351,31 +399,74 @@ 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 === "contact") { + restaurants = this.contactNamelist + } else if (value === "customService") { + console.log(this.serviceOrderList) + restaurants = this.serviceOrderList + } + 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 + if (value === "customService") { + return state.serviceNumber.toLowerCase().indexOf(queryString.toLowerCase()) === 0 + } else { + return state.name.toLowerCase().indexOf(queryString.toLowerCase()) === 0 + } } }, - handleSelectClient(item) { - this.editConfig.infomation.client_id = item.id + handleSelectClient(value, item) { + console.log(value) + if (value === "client") { + this.clientId = item.id + } else if (value === "contact") { + this.contactId = item.id + } else if (value === "customService") { + this.serviceId = item.id + } }, - selClientClick() { - this.editSelectClientConfig.editVisible = true + selClientClick(value) { + if (value === "client") { + this.editSelectClientConfig.editVisible = true + } else if (value === "contact") { + this.editSelectContactConfig.editVisible = true + } else if (value === "customService") { + this.editSelCommonConfig.title = "瀹㈡埛鏈嶅姟鍗�" + this.editSelCommonConfig.editVisible = true + this.editSelCommonConfig.tableInfomation = [...this.serviceOrderList] + } }, - selClient(row) { - console.log(row) - this.editConfig.infomation.client_name = row.name - this.editConfig.infomation.client_id = row.id + selClient(row, value) { + console.log(value) + if (value === "contact") { + this.editConfig.infomation.contact_name = row.name + this.contactId = row.id + } else if (value === "client") { + this.editConfig.infomation.client_name = row.name + this.clientId = row.id + } else if (value === "customService") { + this.editConfig.infomation.service_number = row.serviceNumber + this.serviceId = 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 + } else if (value === "customService") { + this.editConfig.infomation.service_number = "" + this.serviceId = 0 + } }, // 娣诲姞闄勪欢 addAnnexClick() {}, -- Gitblit v1.8.0