From b39bf36c1c380285582b7daffb5dd656aa1e1389 Mon Sep 17 00:00:00 2001 From: zuozhengqing <a13193816592@163.com> Date: 星期一, 06 十一月 2023 17:20:04 +0800 Subject: [PATCH] 退出动态跳转登录页 --- src/views/sales/salesOpportunity/AddSalesOpportunityDialog.vue | 349 +++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 296 insertions(+), 53 deletions(-) diff --git a/src/views/sales/salesOpportunity/AddSalesOpportunityDialog.vue b/src/views/sales/salesOpportunity/AddSalesOpportunityDialog.vue index 34e33e8..db9ee6d 100644 --- a/src/views/sales/salesOpportunity/AddSalesOpportunityDialog.vue +++ b/src/views/sales/salesOpportunity/AddSalesOpportunityDialog.vue @@ -9,11 +9,12 @@ custom-class="iframe-dialog" > <el-form + v-if="refreshFlag" ref="form" :model="editConfig.infomation" :rules="rules" label-position="right" - label-width="308px" + label-width="208px" size="mini" style="height: 60vh; overflow-x: hidden" > @@ -23,8 +24,53 @@ <div class="basic-info-title">鏈轰細鍩烘湰淇℃伅</div> <div class="basic-info-view"> <el-row> + <!-- <el-col :span="12">--> + <!-- <el-form-item label="閿�鍞満浼氱紪鍙�" prop="number">--> + <!-- <el-input v-model="editConfig.infomation.number"></el-input>--> + <!-- </el-form-item>--> + <!-- </el-col>--> <el-col :span="12"> - <el-form-item label="瀹㈡埛鍚嶇О" prop="client_name"> + <el-form-item label="閿�鍞満浼氱紪鍙�" prop="number"> + <el-input + v-if=" + editConfig.title == '缂栬緫' || + (editConfig.title == '鏂板缓' && + codenumer && + (explain != '' || isIdDisabled)) + " + :disabled="editConfig.title == '缂栬緫'" + v-model="editConfig.infomation.number" + placeholder="璇疯緭鍏ョ紪鐮�" + > + </el-input> + <span v-else-if="editConfig.title == '鏂板缓'" style="color: #f56c6c" + >璇蜂紭鍏堥厤缃紪鐮佽鑼� <el-button type="text" @click="numberClick"> 閰嶇疆瑙勮寖 </el-button></span + > + <!-- <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="name"> + <div class="custom-name"> + <el-input v-model="editConfig.infomation.name"></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="client_name" ref="clientName"> <div class="custom-name"> <el-autocomplete v-model="editConfig.infomation.client_name" @@ -39,26 +85,17 @@ <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('client')"> - <i class="el-icon-edit-outline" title="娓呴櫎"></i> + <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="number"> - <el-input v-model="editConfig.infomation.number"></el-input> - </el-form-item> - </el-col> - <el-col :span="12"> - <el-form-item label="鏈轰細鍚嶇О" prop="name"> - <div class="custom-name"> - <el-input v-model="editConfig.infomation.name"></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="contact_name"> <div class="custom-name"> @@ -71,18 +108,28 @@ " value-key="name" @select="handleSelectClient('contact', $event)" + placeholder="璇峰厛閫夋嫨瀹㈡埛鍚嶇О" + :disabled="isContact" ></el-autocomplete> - <div class="common-select-btn" @click="selClientClick('contact')"> + <div v-if="!isContact" 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 + v-if=" + editConfig.infomation.contact_name && + editConfig.infomation.contact_name.length > 0 && + !isContact + " + 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="sales_sources_id"> + <el-form-item label="鏈轰細鏉ユ簮" prop="sales_sources_id"> <div class="common-select"> <el-select v-model="editConfig.infomation.sales_sources_id" @@ -104,7 +151,7 @@ </el-form-item> </el-col> <el-col :span="12"> - <el-form-item label="鍟嗘満绫诲瀷" prop="sale_type_id"> + <el-form-item label="鏈轰細绫诲瀷" prop="sale_type_id"> <div class="common-select"> <el-select v-model="editConfig.infomation.sale_type_id" @@ -143,7 +190,7 @@ v-model="editConfig.infomation.member_id" placeholder="璇烽�夋嫨" size="mini" - style="width: 63%" + style="width: 100%" > <el-option v-for="item in memberOptions" :key="item.id" :label="item.username" :value="item.id"> </el-option> @@ -206,7 +253,7 @@ v-model="editConfig.infomation.currency" placeholder="璇烽�夋嫨" size="mini" - style="width: 63%" + style="width: 100%" > <el-option v-for="item in currencyOptions" :key="item.id" :label="item.name" :value="item.id"> </el-option> @@ -221,7 +268,7 @@ :min="0" :precision="2" :controls="false" - style="width: 25%; margin-right: 5px" + style="width: 100%" ></el-input-number> </el-form-item> </el-col> @@ -231,6 +278,7 @@ v-model="editConfig.infomation.expected_time" value-format="yyyy-MM-dd" type="date" + style="width: 100%" placeholder="閫夋嫨鏃ユ湡" > </el-date-picker> @@ -266,20 +314,45 @@ </el-col> </el-row> </div> + + <!-- 浜у搧绠$悊 --> + <div class="basic-info-title" style="display: flex"> + 浜у搧绠$悊 + <div style="margin-left: 400px"> + 甯佺 + <el-select v-model="editConfig.infomation.currency" placeholder="璇烽�夋嫨" size="mini" style="width: 63%"> + <el-option v-for="item in currencyOptions" :key="item.id" :label="item.name" :value="item.id"> + </el-option> + </el-select> + </div> + </div> + <div class="product-view"> + <CommonFormTableView + :show-summary="showSummary" + :product-table-list="productTableList" + @inputContent="inputContent" + @addProductClick="addProductClick" + @emptyProductClick="emptyProductClick" + @recalculateProductClick="recalculateProductClick" + @clearupProduct="clearupProduct" + /> + </div> + <!-- 鍟嗘満涓冭绱� --> <div class="basic-info-title">鍟嗘満涓冭绱�(5W2P)</div> <div class="basic-info-view"> <el-row> - <el-col :span="20"> + <el-col> <el-form-item label="瀹㈡埛闇�姹傛垨鐥涚偣锛坵hy锛�" prop="pain_points"> <el-input type="textarea" + style="width: 100%" :autosize="{ minRows: 2 }" v-model="editConfig.infomation.pain_points" ></el-input> </el-form-item> </el-col> - <el-col :span="20"> + <el-col> <el-form-item label="鏄惁宸茬粡绔嬮」锛坧lan锛�" prop="whether_established"> <el-input type="textarea" @@ -288,7 +361,7 @@ ></el-input> </el-form-item> </el-col> - <el-col :span="20"> + <el-col> <el-form-item label="璧勯噾棰勭畻鏄灏戯紙plan锛�" prop="capital_budget"> <el-input type="textarea" @@ -297,7 +370,7 @@ ></el-input> </el-form-item> </el-col> - <el-col :span="20"> + <el-col> <el-form-item label="鍏抽敭鍐崇瓥浜烘槸璋侊紙who锛�" prop="key_maker"> <el-input type="textarea" @@ -306,7 +379,7 @@ ></el-input> </el-form-item> </el-col> - <el-col :span="20"> + <el-col> <el-form-item label="鍏抽敭鍐崇瓥鍥犵礌鏈夊摢浜涳紙what锛�" prop="key_factors"> <el-input type="textarea" @@ -315,7 +388,7 @@ ></el-input> </el-form-item> </el-col> - <el-col :span="20"> + <el-col> <el-form-item label="鍐崇瓥娴佺▼鏄�庢牱鐨勶紙what锛�" prop="process"> <el-input type="textarea" @@ -324,7 +397,7 @@ ></el-input> </el-form-item> </el-col> - <el-col :span="20"> + <el-col> <el-form-item label="绔炰簤瀵规墜鎻愪緵鐨勬柟妗堬紙what锛�" prop="solutions"> <el-input type="textarea" @@ -458,7 +531,7 @@ </div> </el-form-item> </el-col> --> - <el-col :span="20"> + <el-col> <el-form-item label="璇︾粏鍦板潃" prop="detail_address"> <el-input type="textarea" @@ -474,7 +547,7 @@ <div class="basic-info-title">澶囨敞淇℃伅</div> <div class="basic-info-view"> <el-row> - <el-col :span="20"> + <el-col> <el-form-item label="澶囨敞" prop="remark"> <el-input type="textarea" @@ -542,8 +615,12 @@ import SelectClientDialog from "@/views/other/commonDialog/SelectClientDialog" import SelectContactDialog from "@/views/other/commonDialog/SelectContactDialog" import { getCityList } from "@/api/common/address" +import codeMixin from "@/components/makepager/mixin/codeMixin" +import { getContactList } from "@/api/client/contacts" +import CommonFormTableView from "@/components/makepager/CommonFormTableView.vue"; export default { name: "AddSalesOpportunityDialog", + mixins: [codeMixin], props: { editCommonConfig: { type: Object, @@ -556,30 +633,30 @@ } } }, - components: { SelectClientDialog, SelectContactDialog }, + components: {CommonFormTableView, SelectClientDialog, SelectContactDialog }, computed: { searchCommonHeight() { return this.$refs.searchCommonView.offsetHeight }, clientList() { return this.$store.state.getClientName.clientList - }, - contactNamelist() { - return this.$store.state.getClientName.contactNamelist } }, data() { return { - dialogWidth: "80%", + refreshFlag: true, + dialogWidth: "50%", editConfig: this.editCommonConfig, rules: { - number: [{ required: true, message: "璇疯緭鍏ラ攢鍞満浼氱紪鍙�", trigger: "blur" }], + number: [{ required: true, validator: this.validateCheckCode, trigger: ["blur",'change'] }], name: [{ required: true, message: "璇疯緭鍏ユ満浼氬悕绉�", trigger: "blur" }], + member_id: [{ required: true, message: "璇烽�夋嫨閿�鍞礋璐d汉", trigger: "change" }], sale_stage_id: [{ required: true, message: "璇烽�夋嫨閿�鍞樁娈�", trigger: "change" }], currency: [{ required: true, message: "璇烽�夋嫨甯佺", trigger: "change" }], expected_time: [{ required: true, message: "璇烽�夋嫨棰勮鎴愪氦鏃ユ湡", trigger: "change" }], - projected_amount: [{ required: true, message: "璇疯緭鍏ラ璁″悎鍚岄噾棰�", trigger: "blur" }] + projected_amount: [{ required: true, message: "璇疯緭鍏ラ璁″悎鍚岄噾棰�", trigger: "blur" }], + client_name: [{ required: true, message: "璇烽�夋嫨瀹㈡埛", trigger: "change" }] }, businessSourceOptions: [], memberOptions: [], @@ -605,18 +682,49 @@ }, restaurants: [], clientId: this.editCommonConfig.infomation.client_id, - contactId: this.editCommonConfig.infomation.contact_id + contactId: this.editCommonConfig.infomation.contact_id, + objCode: { name: "", page: 0, pageSize: 0, type: "閿�鍞満浼氱紪鐮�", codeStandID: "" }, + isContact: true, + contactNamelist: [], + tableData: [], + productTableList: {}, + showSummary: { + show: true, + total: true, + sumProp: ["Amount", "total"], + mergeNumber: 2 + }, + productId:1, } }, created() { this.$store.dispatch("geClient") - this.$store.dispatch("geContact") if (this.editConfig.title !== "鏂板缓" && this.editConfig.infomation.province_id !== 0) { this.getCityList(this.editConfig.infomation.province_id, "edit") } + this.setTableForm() this.getCommonData() + this.formInfo() + if (this.editConfig.title === "缂栬緫") { + this.isContact = false + this.getContactList(this.editConfig.infomation.contact_id) + } + }, + watch: { + "editConfig.visible"(val) { + if (val) { + this.formInfo() + } + }, }, methods: { + formInfo() { + this.objCode.codeStandID = "" + if (this.editConfig.infomation.codeStandID) { + this.objCode.codeStandID = this.editConfig.infomation.codeStandID + } + this.getRCodeStandardList() + }, getCommonData() { this.editConfig.infomation.country_id = 1 this.editConfig.infomation.province_id = @@ -651,7 +759,12 @@ saveClick(formName) { this.$refs[formName].validate((valid) => { if (valid) { - console.log(this.editConfig.infomation) + const hasProduct = this.tableData.every(ele=>!!ele.name) + if (!hasProduct){ + this.$message.error("浜у搧鍚嶇О涓嶈兘涓虹┖") + return + } + const params = this.saveParams() console.log(params) if (this.editConfig.title === "鏂板缓") { @@ -659,9 +772,11 @@ console.log(res) this.editConfig.visible = false if (res.code === 200) { - this.$message.success("娣诲姞鎴愬姛") + this.$message.success("娣诲姞鎴愬姛锛�") this.$parent.getData() // } + }else{ + this.$message.error(res.msg?res.msg:"娣诲姞澶辫触锛�") } }) } else { @@ -669,8 +784,10 @@ console.log(res) this.editConfig.visible = false if (res.code === 200) { - this.$message.success("缂栬緫鎴愬姛") + this.$message.success("缂栬緫鎴愬姛锛�") this.$parent.getData() + }else{ + this.$message.error(res.msg?res.msg:"缂栬緫澶辫触锛�") } }) } @@ -715,11 +832,27 @@ status_id: data.status_id || 0, threats: data.threats || "", whether_established: data.whether_established || "", - remark: data.remark || "", - detail_address: data.detail_address || "" + detail_address: data.detail_address || "", + + codeStandID: data.ID, + products: this.tableData, } return params + }, + // 鑾峰彇鑱旂郴浜哄垪琛� + getContactList(id) { + getContactList({ + page: 0, + pageSize: 0, + search_map: { + client_id: id + } + }).then((res) => { + if (res.code == 200) { + this.contactNamelist = res.data.list + } + }) }, // 閫夋嫨鐢ㄦ埛鐩稿叧鏂规硶 querySearchAsync(queryString, cb, value) { @@ -740,15 +873,23 @@ handleSelectClient(value, item) { if (value === "client") { this.clientId = item.id + this.editConfig.infomation.client_name = item.name + this.editConfig.infomation.contact_name = "" + this.contactId = 0 + this.isContact = false + this.getContactList(item.id) } else if (value === "contact") { + this.editConfig.infomation.contact_name = item.name this.contactId = item.id } + this.refresh() }, selClientClick(value) { if (value === "client") { this.editSelectClientConfig.editVisible = true } else if (value === "contact") { this.editSelectContactConfig.editVisible = true + this.editSelectContactConfig.clientId = this.clientId } }, selClient(row, value) { @@ -758,17 +899,36 @@ } else if (value === "client") { this.editConfig.infomation.client_name = row.name this.clientId = row.id + this.editConfig.infomation.contact_name = "" + this.contactId = 0 + this.isContact = false + this.getContactList(row.id) } + this.refresh() + }, + /** + * 寮哄埗鍒锋柊form缁勪欢 + * 澶栭儴鏇存敼琛ㄥ崟鍊间笉浼氳Е鍙戣〃鍗曟牎楠�,瀵艰嚧鍗充娇鏈夊�煎琚〃鍗曟牎楠岄樆濉炰綇 + */ + refresh() { + this.refreshFlag = false + requestAnimationFrame(() => { + this.refreshFlag = true + }) }, // 娓呴櫎宸查�夋嫨鐢ㄦ埛 clearupClient(value) { if (value === "client") { this.editConfig.infomation.client_name = "" this.clientId = 0 + this.isContact = true + this.editConfig.infomation.contact_name = "" + this.contactId = 0 } else if (value === "contact") { this.editConfig.infomation.contact_name = "" this.contactId = 0 } + this.refresh() }, // 娣诲姞闄勪欢 addAnnexClick() {}, @@ -780,14 +940,92 @@ }, async getCityList(val, value) { await getCityList({ province_id: val }).then((res) => { - console.log(res) - if (res.data.code === 200) { - this.cityOptions = res.data.data.list + if (res.code === 200) { + this.cityOptions = res.data.list if (value === "sel") { this.editConfig.infomation.city_id = "" } } }) + }, + setTableForm() { + if (this.editConfig.title === "鏂板缓" || this.editConfig.infomation.products.length === 0) { + this.tableData = [ + { + productId: this.productId, + id: 0, + amount: 0, + desc: "", + name: "", + number: "", + price: 0, + total: 0 + } + ] + } else { + this.tableData = this.editConfig.infomation.products + this.tableData.map((item, index) => { + item.productId = index + 1 + }) + } + this.productTableList = { + tableData: this.tableData, + tableColumn: [ + { label: "#", prop: "productId", width: 40 }, + { label: "浜у搧鍚嶇О", prop: "name", productName: true, isRequird: true }, + { label: "浜у搧缂栧彿", prop: "number" }, + { label: "鏁伴噺", prop: "amount", inputNumber: true, isRequird: true }, + { label: "閿�鍞崟浠�", prop: "price", inputFloat: true }, + { label: "浠风◣鍚堣", prop: "total", inputFloat: true } + ] + } + }, + // 浜у搧鍒楄〃杈撳叆 + inputContent(val, prop, row) { + this.productId = row.productId + this.tableData.map((item) => { + if (item.productId === row.productId) { + item[prop] = val + } + }) + }, + // 浜у搧鏂板 + addProductClick() { + this.productId++ + this.tableData.push({ + productId: this.productId, + id: 0, + amount: 0, + desc: "", + name: "", + number: "", + price: 0, + total: 0 + }) + this.showSummary.show = true + }, + // 浜у搧娓呯┖ + emptyProductClick() { + this.productId = 1 + this.tableData = [ + { + productId: this.productId, + id: 0, + amount: 0, + desc: "", + name: "", + number: "", + price: 0, + total: 0 + } + ] + this.productTableList.tableData = this.tableData + }, + // 浜у搧閲嶇畻 + recalculateProductClick() {}, + clearupProduct(data) { + this.tableData = data + this.productTableList.tableData = this.tableData } } } @@ -821,7 +1059,12 @@ } .common-select { .common-select-sel { - width: 270px; + flex: 1; + } + } + .custom-name { + .el-autocomplete { + flex: 1; } } } -- Gitblit v1.8.0