diff --git a/src/api/eam/eamProject.js b/src/api/eam/eamProject.js index fe6021b..8ee556d 100644 --- a/src/api/eam/eamProject.js +++ b/src/api/eam/eamProject.js @@ -10,6 +10,7 @@ export const getFinalPartDesc= data => createAPI(`/pms/eamProject/getFinalPartDe export const getCustomerNo= data => createAPI(`/pms/eamProject/getCustomerNo`,'post',data) export const saveNewCustomer= data => createAPI(`/pms/eamProject/saveNewCustomer`,'post',data) export const eamProjectPartSearch= data => createAPI(`/pms/eamProject/eamProjectPartSearch`,'post',data) +export const queryProjectPartCustomerOptions = data => createAPI(`/pms/eamProject/queryProjectPartCustomerOptions`,'post',data) export const queryEamProjectPart= data => createAPI(`/pms/eamProject/queryEamProjectPart`,'post',data) export const eamProjectPartInfoSave= data => createAPI(`/pms/eamProject/eamProjectPartInfoSave`,'post',data) export const eamProjectPartInfoEdit= data => createAPI(`/pms/eamProject/eamProjectPartInfoEdit`,'post',data) diff --git a/src/views/modules/eam/eamProjectPartInfo.vue b/src/views/modules/eam/eamProjectPartInfo.vue index 0116857..3a563d1 100644 --- a/src/views/modules/eam/eamProjectPartInfo.vue +++ b/src/views/modules/eam/eamProjectPartInfo.vue @@ -43,7 +43,24 @@ - + + + + @@ -1782,6 +1799,7 @@ import { warnSendMailHandle, confirmatorSendMailHandle, eamProjectPartSearch, + queryProjectPartCustomerOptions, eamProjectPartInfoEdit, eamProjectPartInfoCancelEdit, getFinalPartDesc, @@ -1872,6 +1890,10 @@ import {uploadFileList} from '@/api/base/baseFunction.js'; activeModalTab: 'proofRecord', // 导出 end tagNo:'', + searchCustomerOptions: [], + searchCustomerOptionLoading: false, + searchCustomerQueryToken: 0, + searchCustomerOptionInitialized: false, fileName:'', folder: '', selectTypeFlag: [], @@ -4120,6 +4142,48 @@ import {uploadFileList} from '@/api/base/baseFunction.js'; this.projectCategoryList = [] }) }, + handleSearchCustomerVisibleChange (visible) { + if (!visible || this.searchCustomerOptionInitialized) { + return + } + this.querySearchCustomerOptions('') + }, + handleSearchCustomerRemote (keyword) { + this.querySearchCustomerOptions(keyword) + }, + querySearchCustomerOptions (keyword) { + const normalizedKeyword = keyword == null ? '' : String(keyword).trim() + const queryToken = this.searchCustomerQueryToken + 1 + this.searchCustomerQueryToken = queryToken + this.searchCustomerOptionLoading = true + queryProjectPartCustomerOptions({ + userName: this.$store.state.user.name, + customerDesc: normalizedKeyword + }).then(({ data }) => { + if (queryToken !== this.searchCustomerQueryToken) { + return + } + if (!(data && data.code === 0)) { + this.searchCustomerOptions = [] + this.$message.error((data && data.msg) || '查询客户下拉失败') + return + } + const rows = Array.isArray(data.rows) ? data.rows : [] + this.searchCustomerOptions = rows.filter(item => item && item.customerDesc) + if (!normalizedKeyword) { + this.searchCustomerOptionInitialized = true + } + }).catch(() => { + if (queryToken === this.searchCustomerQueryToken) { + this.searchCustomerOptions = [] + this.$message.error('查询客户下拉异常') + } + }).finally(() => { + if (queryToken === this.searchCustomerQueryToken) { + this.searchCustomerOptionLoading = false + } + }) + }, // 查询区 BU 变化后刷新项目分类 searchBuChangeHandle (buDesc) { this.searchData.projectCategory = ''