From 61883fcf237024ceb7622daf5b23434e3eb1be74 Mon Sep 17 00:00:00 2001 From: yangfeng <wanwan926_4@163.com> Date: 星期一, 16 十月 2023 10:38:50 +0800 Subject: [PATCH] 产品获取值修改 --- src/views/service/serviceFollowup/AddServiceFollowupDialog.vue | 611 +++++++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 455 insertions(+), 156 deletions(-) diff --git a/src/views/service/serviceFollowup/AddServiceFollowupDialog.vue b/src/views/service/serviceFollowup/AddServiceFollowupDialog.vue index 2c252ab..229809f 100644 --- a/src/views/service/serviceFollowup/AddServiceFollowupDialog.vue +++ b/src/views/service/serviceFollowup/AddServiceFollowupDialog.vue @@ -5,13 +5,15 @@ :visible.sync="editConfig.visible" :width="dialogWidth" :before-close="handleClose" + append-to-body + custom-class="iframe-dialog" > <el-form ref="form" :model="editConfig.infomation" :rules="rules" label-position="right" - label-width="308px" + label-width="168px" size="mini" style="height: 60vh; overflow-x: hidden" > @@ -22,89 +24,193 @@ <div class="basic-info-view"> <el-row> <el-col :span="12"> - <el-form-item label="瀹㈡埛鍚嶇О" prop="customName"> + <el-form-item label="鍥炶鍗曠紪鍙�" prop="number"> + <WordInput + v-if="codenumer && (explain != '' || isIdDisabled) && method == 0" + :codenumer="codenumer" + :sum="sum" + :disabled="editConfig.title !== '鏂板缓' || isIdDisabled" + :inputValue="inputValue" + @codeList="codeList" + /> + <span v-else-if="method == 0" style="color: #f56c6c" + >璇蜂紭鍏堥厤缃紪鐮佽鑼� <el-button type="text" @click="numberClick"> 閰嶇疆瑙勮寖 </el-button></span + > + <span v-else>{{ editConfig.title === "鏂板缓" ? "鑷姩鐢熸垚" : editConfig.infomation.number }}</span> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="瀹㈡埛鍚嶇О" prop="client_name"> <div class="custom-name"> - <el-input v-model="editConfig.infomation.customName"></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.client_name" + :fetch-suggestions=" + (queryString, callback) => { + querySearchAsync(queryString, callback, 'client') + } + " + value-key="name" + @select="handleSelectClient('client', $event)" + style="width: 100%" + ></el-autocomplete> + <div class="common-select-btn" @click="selClientClick('client')"> + <i class="el-icon-circle-plus-outline" title="閫夋嫨"></i> + </div> + <div + v-if="editConfig.infomation.client_name && editConfig.infomation.client_name.length > 0" + class="common-select-btn" + @click="clearupClient('client')" + > + <i class="el-icon-remove-outline" title="娓呴櫎"></i> + </div> </div> </el-form-item> </el-col> <el-col :span="12"> - <el-form-item label="鍥炶鍗曠紪鍙�" prop="followupNumber"> - <el-input v-model="editConfig.infomation.followupNumber"></el-input> - </el-form-item> - </el-col> - <el-col :span="12"> - <el-form-item label="鑱旂郴浜哄鍚�" prop="contactName"> + <el-form-item label="鑱旂郴浜哄鍚�" prop="contact_name"> <div class="custom-name"> - <el-input v-model="editConfig.infomation.contactName"></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)" + style="width: 100%" + ></el-autocomplete> + <div class="common-select-btn" @click="selClientClick('contact')"> + <i class="el-icon-circle-plus-outline" title="閫夋嫨"></i> + </div> + <div + v-if="editConfig.infomation.contact_name && editConfig.infomation.contact_name.length > 0" + class="common-select-btn" + @click="clearupClient('contact')" + > + <i class="el-icon-remove-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)" + style="width: 100%" + ></el-autocomplete> + <div class="common-select-btn" @click="selClientClick('customService')"> + <i class="el-icon-circle-plus-outline" title="閫夋嫨"></i> + </div> + <div + v-if="editConfig.infomation.service_number && editConfig.infomation.service_number.length > 0" + class="common-select-btn" + @click="clearupClient('customService')" + > + <i class="el-icon-remove-outline" title="娓呴櫎"></i> + </div> </div> </el-form-item> </el-col> <el-col :span="12"> - <el-form-item label="鍥炶浜�" prop="visitor"> - <el-select v-model="editConfig.infomation.visitor" size="mini"> - <el-option v-for="item in visitorOptions" :key="item.value" :label="item.label" :value="item.value"> + <el-form-item label="鍥炶浜�" prop="memberId"> + <el-select v-model="editConfig.infomation.memberId" size="mini" style="width: 100%"> + <el-option v-for="item in memberOptions" :key="item.id" :label="item.username" :value="item.id"> + </el-option> + </el-select> + </el-form-item> + </el-col> + <!-- <el-col :span="12"> + <el-form-item label="椤圭洰璁″垝" prop="planId"> + <div class="custom-name"> + <el-input v-model="editConfig.infomation.planId"></el-input> + <div class="common-select-btn"><i class="el-icon-circle-plus-outline" title="閫夋嫨"></i></div> + <div class="common-select-btn"><i class="el-icon-edit" title="缂栬緫"></i></div> + </div> + </el-form-item> + </el-col> --> + <el-col :span="12"> + <el-form-item label="婊℃剰搴�" prop="satisfactionId"> + <div class="common-select"> + <el-select + v-model="editConfig.infomation.satisfactionId" + placeholder="璇烽�夋嫨" + class="common-select-sel" + size="mini" + style="width: 100%" + > + <el-option v-for="item in satisfactionOptions" :key="item.id" :label="item.name" :value="item.id"> + </el-option> + </el-select> + <!-- <div class="common-select-btn"><i class="el-icon-setting"></i></div> --> + </div> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鍙婃椂鐜�" prop="timelyRateId"> + <div class="common-select"> + <el-select + v-model="editConfig.infomation.timelyRateId" + placeholder="璇烽�夋嫨" + class="common-select-sel" + size="mini" + style="width: 100%" + > + <el-option v-for="item in timelyRateOptions" :key="item.id" :label="item.name" :value="item.id"> + </el-option> + </el-select> + <!-- <div class="common-select-btn"><i class="el-icon-setting"></i></div> --> + </div> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="瑙e喅鐜�" prop="solveRateId"> + <div class="common-select"> + <el-select + v-model="editConfig.infomation.solveRateId" + placeholder="璇烽�夋嫨" + class="common-select-sel" + size="mini" + style="width: 100%" + > + <el-option v-for="item in solveRateOptions" :key="item.id" :label="item.name" :value="item.id"> + </el-option> + </el-select> + <!-- <div class="common-select-btn"><i class="el-icon-setting"></i></div> --> + </div> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鍘熸湇鍔′汉鍛�" prop="oldMemberId"> + <el-select v-model="editConfig.infomation.oldMemberId" size="mini" style="width: 100%"> + <el-option v-for="item in oldMemberOptions" :key="item.id" :label="item.username" :value="item.id"> </el-option> </el-select> </el-form-item> </el-col> <el-col :span="12"> - <el-form-item label="椤圭洰璁″垝" prop="projectPlan"> - <div class="custom-name"> - <el-input v-model="editConfig.infomation.projectPlan"></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-form-item label="鏈嶅姟浜哄憳鏄惁鏉ヨ繃" prop="isVisitId"> + <div class="common-select"> + <el-select + v-model="editConfig.infomation.isVisitId" + placeholder="璇烽�夋嫨" + class="common-select-sel" + size="mini" + style="width: 100%" + > + <el-option v-for="item in isVisitOptions" :key="item.id" :label="item.name" :value="item.id"> + </el-option> + </el-select> + <!-- <div class="common-select-btn"><i class="el-icon-setting"></i></div> --> </div> - </el-form-item> - </el-col> - <el-col :span="12"> - <el-form-item label="婊℃剰搴�" prop="satisfaction"> - <CommonSelectView - :common-value="editConfig.infomation.satisfaction" - :common-options="satisfactionOptions" - /> - </el-form-item> - </el-col> - <el-col :span="12"> - <el-form-item label="鍙婃椂鐜�" prop="timelyRate"> - <CommonSelectView - :common-value="editConfig.infomation.timelyRate" - :common-options="satisfactionOptions" - /> - </el-form-item> - </el-col> - <el-col :span="12"> - <el-form-item label="瑙e喅鐜�" prop="resolveRate"> - <CommonSelectView - :common-value="editConfig.infomation.resolveRate" - :common-options="satisfactionOptions" - /> - </el-form-item> - </el-col> - <el-col :span="12"> - <el-form-item label="鍘熸湇鍔′汉鍛�" prop="originServicePerson"> - <el-select v-model="editConfig.infomation.originServicePerson" size="mini"> - <el-option v-for="item in visitorOptions" :key="item.value" :label="item.label" :value="item.value"> - </el-option> - </el-select> - </el-form-item> - </el-col> - <el-col :span="12"> - <el-form-item label="鏈嶅姟浜哄憳鏄惁鏉ヨ繃" prop="haveBeen"> - <CommonSelectView :common-value="editConfig.infomation.haveBeen" :common-options="haveBeenOptions" /> </el-form-item> </el-col> </el-row> @@ -114,46 +220,82 @@ <div class="basic-info-view"> <el-row> <el-col :span="24"> - <el-form-item label="澶囨敞" prop="notes"> + <el-form-item label="澶囨敞" prop="remark"> <el-input type="textarea" :autosize="{ minRows: 2, maxRows: 4 }" placeholder="璇疯緭鍏ュ唴瀹�" - v-model="editConfig.infomation.notes" + v-model="editConfig.infomation.remark" ></el-input> </el-form-item> </el-col> </el-row> </div> <!-- 闄勪欢淇℃伅 --> - <div class="basic-info-title">闄勪欢淇℃伅</div> + <!-- <div class="basic-info-title">闄勪欢淇℃伅</div> <div class="basic-info-view"> <el-row> <el-col :span="12"> <el-form-item label="闄勪欢" prop=""> + <template slot="label"> + <div style="display: flex; float: right"> + <div style="font-size: 16px"> + <i class="el-icon-warning-outline" title="鏈�澶氫笂浼�20涓檮浠讹紝鏈�澶ч檺鍒�5MB"></i> + </div> + <span style="margin-left: 5px">闄勪欢</span> + </div> + </template> <div class="annex-view"> - <div @click="addAnnexClick">娣诲姞</div> + <div @click="addAnnexClick"> + <div style="display: flex; float: right"> + <div style="font-size: 16px"><i class="el-icon-paperclip"></i></div> + <span>娣诲姞</span> + </div> + </div> <div class="setFormat" @click="setFormatClick">璁剧疆鍏佽涓婁紶鐨勬枃浠舵牸寮�</div> </div> </el-form-item> </el-col> </el-row> - </div> + </div> --> </div> </el-form> - <div slot="footer" class="dialog-footer"> - <el-button type="primary" size="small" @click="editConfig.visible = false">淇濆瓨</el-button> + <el-button type="primary" size="small" @click="saveClick('form')">淇濆瓨</el-button> <el-button size="small" @click="editConfig.visible = false">鍙栨秷</el-button> </div> + <!-- 閫夋嫨瀹㈡埛 --> + <SelectClientDialog + v-if="editSelectClientConfig.editVisible" + :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> <script> -import CommonSelectView from "@/components/makepager/CommonSelectView" +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" +import codeMixin from "@/views/client/followupRecords/mixin/codeMixin" export default { name: "AddServiceFollowupDialog", + mixins: [codeMixin], props: { editCommonConfig: { type: Object, @@ -161,51 +303,225 @@ return { visible: false, title: "鏂板缓", - infomation: { - customName: "", - followupNumber: "HF21", - contactName: "", - customServiceForm: "", - visitor: "", - projectPlan: "", - satisfaction: "", - timelyRate: "", - resolveRate: "", - originServicePerson: "", - haveBeen: "", - notes: "" - } + infomation: {} } } } }, - components: { CommonSelectView }, + 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() { return { - dialogWidth: "80%", + dialogWidth: "50%", editConfig: this.editCommonConfig, rules: { - followupNumber: [{ required: true, message: "璇疯緭鍏ュ洖璁垮崟鍗曠紪鍙�", trigger: "blur" }], - visitor: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }] + number: [{ required: true, message: "璇疯緭鍏ュ洖璁垮崟鍗曠紪鍙�", trigger: "blur" }], + client_name: [{ required: true, message: "璇烽�夋嫨瀹㈡埛鍚嶇О", trigger: "change" }], + service_number: [{ required: true, message: "璇烽�夋嫨瀹㈡埛鏈嶅姟鍗�", trigger: "change" }], + memberId: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }] }, - satisfactionOptions: [], // 婊℃剰搴� 鍙婃椂鐜� 瑙e喅鐜� - haveBeenOptions: [], // 鏈嶅姟浜哄憳鏄惁鏉ヨ繃 - visitorOptions: [ - // 鍥炶浜� - { value: "1", label: "绯荤粺绠$悊鍛�" }, - { value: "2", label: "閿�鍞�荤洃" } - ] + satisfactionOptions: [], // 婊℃剰搴� + timelyRateOptions: [], // 鍙婃椂鐜� + solveRateOptions: [], // 瑙e喅鐜� + oldMemberOptions: [], // 鍘熸湇鍔′汉鍛� + isVisitOptions: [], // 鏈嶅姟浜哄憳鏄惁鏉ヨ繃 + memberOptions: [], + editSelectClientConfig: { + editVisible: false, + title: "", + infomation: {} + }, + editSelectContactConfig: { + editVisible: false, + title: "", + infomation: {} + }, + editSelCommonConfig: { + editVisible: false, + title: "", + infomation: {} + }, + clientId: this.editCommonConfig.infomation.clientId, + contactId: this.editCommonConfig.infomation.contactId, + serviceOrderId: this.editCommonConfig.infomation.serviceOrderId } }, - created() {}, + created() { + this.$store.dispatch("geClient") + this.$store.dispatch("geContact") + this.$store.dispatch("geServiceOrder") + this.getCommonData() + this.formInfo() + }, + watch: { + "editCommonConfig.visible"(val) { + if (val) { + this.formInfo() + } + }, + "editCommonConfig.infomation.codeStandID"() { + this.formInfo() + } + }, methods: { + formInfo() { + this.objCode.type = "鏈嶅姟鍥炶缂栫爜" + this.objCode.codeStandID = "" + if (this.editConfig.infomation.codeStandID) { + this.objCode.codeStandID = this.editConfig.infomation.codeStandID + } + this.getRCodeStandardList() + }, + getCommonData() { + getAllData() + .then((res) => { + this.memberOptions = res.data.member + this.satisfactionOptions = res.data.satisfaction // 婊℃剰搴� + this.timelyRateOptions = res.data.timely_rate // 鍙婃椂鐜� + this.solveRateOptions = res.data.solve_rate // 瑙e喅鐜� + this.oldMemberOptions = res.data.member // 鍘熸湇鍔′汉鍛� + this.isVisitOptions = res.data.isVisit // 鏈嶅姟浜哄憳鏄惁鏉ヨ繃 + }) + .catch((err) => { + console.log(err) + }) + }, + // 淇濆瓨 + 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 === "鏂板缓") { + 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.success("缂栬緫鎴愬姛") + this.$parent.getData() + } + }) + } + } else { + console.log("error submit") + return false + } + }) + }, + saveParams() { + let data = this.editConfig.infomation + let params = { + id: this.editConfig.title === "鏂板缓" ? 0 : data.id, + clientId: this.clientId || 0, + contactId: this.contactId || 0, + file: data.file || "", + isVisit: data.isVisitId || 0, + memberId: data.memberId || 0, + number: data.number || "", + oldMemberId: data.oldMemberId || 0, + planId: data.planId || 0, + remark: data.remark || "", + satisfaction: data.satisfactionId || 0, + serviceOrderId: this.serviceOrderId || 0, + solveRate: data.solveRateId || 0, + timelyRate: data.timelyRateId || 0, + codeStandID: data.ID, + codeRule: this.codeRule + } + return params + }, handleClose() { this.editConfig.visible = false + }, + // 閫夋嫨瀹㈡埛鐩稿叧鏂规硶 + 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, value) { + return (state) => { + if (value === "customService") { + return state.serviceNumber.toLowerCase().indexOf(queryString.toLowerCase()) === 0 + } else { + return state.name.toLowerCase().indexOf(queryString.toLowerCase()) === 0 + } + } + }, + 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.serviceOrderId = item.id + } + }, + 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, 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.serviceOrderId = row.id + } + }, + // 娓呴櫎宸查�夋嫨鐢ㄦ埛 + 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.serviceOrderId = 0 + } }, // 娣诲姞闄勪欢 addAnnexClick() {}, @@ -217,71 +533,54 @@ <!-- Add "scoped" attribute to limit CSS to this component only --> <style lang="scss" scoped> -.service-followup { - .basic-info { - .basic-info-title { - background-color: #f4f8fe; - padding-left: 10px; - font-size: 15px; - font-weight: bold; - color: #666; - height: 42px; - line-height: 42px; - } - .basic-info-view { - margin-top: 10px; - padding-right: 40px; - .custom-name { +::v-deep { + .iframe-dialog .el-dialog__body { + .basic-info { + .basic-info-title { + background-color: #f4f8fe; + padding-left: 10px; + font-size: 15px; + font-weight: bold; + color: #666; + height: 42px; + line-height: 42px; + } + .basic-info-view { + margin-top: 10px; + padding-right: 40px; + .custom-name, + .common-select { + display: flex; + .common-select-sel { + width: 270px; + } + .common-select-btn { + margin-left: 5px; + font-size: 16px; + cursor: pointer; + } + } + } + .annex-view { display: flex; - .common-select-btn { - margin-left: 5px; - font-size: 18px; + color: #6166d3; + .setFormat { + margin-left: 10px; } } } - .address-view { - margin-top: 10px; - padding-right: 40px; - } - .annex-view { + .unflod-collapse { display: flex; + height: 30px; + justify-content: center; + align-items: center; color: #6166d3; - .setFormat { - margin-left: 10px; - } } - } - .unflod-collapse { - display: flex; - height: 30px; - justify-content: center; - align-items: center; - color: #6166d3; - } - .dialog-footer { - background-color: #f5f5f5; - height: 55px; - line-height: 55px; - } -} -::v-deep { - .el-dialog__header { - padding: 12.5px 10px; - border-bottom: 1px solid #e5e5e5; - .el-dialog__title { - font-size: 15px; - color: #323232; - font-weight: bold; + .dialog-footer { + background-color: #f5f5f5; + height: 55px; + line-height: 55px; } - } - .el-dialog__body { - padding: 0px; - } - .el-dialog__footer { - padding: 0px; - text-align: center; - box-sizing: border-box; - border-top: 1px solid #dadee5; } } </style> -- Gitblit v1.8.0