diff --git a/src/views/modules/eam/eamProjectInfo.vue b/src/views/modules/eam/eamProjectInfo.vue index d6a6510..289723f 100644 --- a/src/views/modules/eam/eamProjectInfo.vue +++ b/src/views/modules/eam/eamProjectInfo.vue @@ -3011,6 +3011,21 @@ import {updateColumnSize} from "../../../api/table"; } return buValue }, + // 从 site_bu 中截取 site + getSiteByJoinedBuValue (buValue) { + if (!buValue) { + return '' + } + let matchBu = this.userBuList.find(item => item.buNo === buValue) + if (matchBu && matchBu.site) { + return matchBu.site + } + let buParts = String(buValue).split('_') + if (buParts.length >= 2) { + return buParts[0] + } + return '' + }, // 根据 BU 描述获取 bu_no getBuNoByBuDesc (buDesc) { if (!buDesc) { @@ -3068,6 +3083,9 @@ import {updateColumnSize} from "../../../api/table"; }, // 弹窗 BU 变化后刷新项目分类 modalBuChangeHandle (buValue) { + this.modalData.site = this.getSiteByJoinedBuValue(buValue) || this.$store.state.user.site + this.modalData.customerNo = '' + this.modalData.customerDesc = '' this.modalData.projectCategory = '' let buNo = this.getBuNoByJoinedValue(buValue) this.loadModalProjectCategory(buNo) @@ -3076,11 +3094,22 @@ import {updateColumnSize} from "../../../api/table"; // 获取基础数据列表S getBaseList (val,type) { this.tagNo = val + if (val === 509 && (this.modalData.bu === '' || this.modalData.bu == null)) { + this.$message.warning('请先选择BU!') + return + } this.$nextTick(() => { let strVal = '' let conSql = '' if (val === 509 ) { strVal = this.modalData.customerNo ? this.modalData.customerNo : '' + let currentSite = this.getSiteByJoinedBuValue(this.modalData.bu) + if (!currentSite) { + this.$message.warning('未获取到BU所属工厂,请重新选择BU!') + return + } + const escapedSite = String(currentSite).replace(/'/g, "''") + conSql = " and site = '" + escapedSite + "'" } // if (val === 2006 ) { // conSql = " and b.site = '" + this.$store.state.user.site + "'" @@ -3176,6 +3205,16 @@ import {updateColumnSize} from "../../../api/table"; }, newCustomer () { + if (this.modalData.bu === '' || this.modalData.bu == null) { + this.$message.warning('请先选择BU!') + return + } + let currentSite = this.getSiteByJoinedBuValue(this.modalData.bu) + if (!currentSite) { + this.$message.warning('未获取到BU所属工厂,请重新选择BU!') + return + } + this.modalData.site = currentSite this.modalData.customerNo = '' this.modalData.customerDesc = '' this.newCustomerFlag = true @@ -3202,11 +3241,17 @@ import {updateColumnSize} from "../../../api/table"; }, saveNewCustomer () { + let currentSite = this.getSiteByJoinedBuValue(this.modalData.bu) + if (!currentSite) { + this.$message.warning('未获取到BU所属工厂,请重新选择BU!') + return + } + this.modalData.site = currentSite this.generateNextCustomerNo().then((customerNo) => { if (customerNo !== false) { this.modalData.customerNo = customerNo let tempData = { - site: this.$store.state.user.site, + site: currentSite, customerNo: customerNo, customerDesc: this.modalData.customerDesc, createBy: this.$store.state.user.name,