Browse Source

客户名称下拉且可以模糊查询

master
han\hanst 1 day ago
parent
commit
809d8a8003
  1. 1
      src/api/eam/eamProject.js
  2. 66
      src/views/modules/eam/eamProjectPartInfo.vue

1
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 getCustomerNo= data => createAPI(`/pms/eamProject/getCustomerNo`,'post',data)
export const saveNewCustomer= data => createAPI(`/pms/eamProject/saveNewCustomer`,'post',data) export const saveNewCustomer= data => createAPI(`/pms/eamProject/saveNewCustomer`,'post',data)
export const eamProjectPartSearch= data => createAPI(`/pms/eamProject/eamProjectPartSearch`,'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 queryEamProjectPart= data => createAPI(`/pms/eamProject/queryEamProjectPart`,'post',data)
export const eamProjectPartInfoSave= data => createAPI(`/pms/eamProject/eamProjectPartInfoSave`,'post',data) export const eamProjectPartInfoSave= data => createAPI(`/pms/eamProject/eamProjectPartInfoSave`,'post',data)
export const eamProjectPartInfoEdit= data => createAPI(`/pms/eamProject/eamProjectPartInfoEdit`,'post',data) export const eamProjectPartInfoEdit= data => createAPI(`/pms/eamProject/eamProjectPartInfoEdit`,'post',data)

66
src/views/modules/eam/eamProjectPartInfo.vue

@ -43,7 +43,24 @@
<el-input v-model="searchData.customerNo" style="width: 120px" clearable></el-input> <el-input v-model="searchData.customerNo" style="width: 120px" clearable></el-input>
</el-form-item> </el-form-item>
<el-form-item :label="'客户名称'"> <el-form-item :label="'客户名称'">
<el-input v-model="searchData.customerDesc" style="width: 120px" clearable></el-input>
<el-select
v-model="searchData.customerDesc"
filterable
clearable
remote
reserve-keyword
placeholder="请输入客户名称"
style="width: 160px"
:remote-method="handleSearchCustomerRemote"
:loading="searchCustomerOptionLoading"
@visible-change="handleSearchCustomerVisibleChange">
<el-option
v-for="item in searchCustomerOptions"
:key="item.customerNo + '_' + item.customerDesc"
:label="item.customerDesc"
:value="item.customerDesc">
</el-option>
</el-select>
</el-form-item> </el-form-item>
<el-form-item :label="'项目分类'"> <el-form-item :label="'项目分类'">
<el-select v-model="searchData.projectCategory" placeholder="请选择" clearable style="width: 130px"> <el-select v-model="searchData.projectCategory" placeholder="请选择" clearable style="width: 130px">
@ -1782,6 +1799,7 @@ import {
warnSendMailHandle, warnSendMailHandle,
confirmatorSendMailHandle, confirmatorSendMailHandle,
eamProjectPartSearch, eamProjectPartSearch,
queryProjectPartCustomerOptions,
eamProjectPartInfoEdit, eamProjectPartInfoEdit,
eamProjectPartInfoCancelEdit, eamProjectPartInfoCancelEdit,
getFinalPartDesc, getFinalPartDesc,
@ -1872,6 +1890,10 @@ import {uploadFileList} from '@/api/base/baseFunction.js';
activeModalTab: 'proofRecord', activeModalTab: 'proofRecord',
// 导出 end // 导出 end
tagNo:'', tagNo:'',
searchCustomerOptions: [],
searchCustomerOptionLoading: false,
searchCustomerQueryToken: 0,
searchCustomerOptionInitialized: false,
fileName:'', fileName:'',
folder: '', folder: '',
selectTypeFlag: [], selectTypeFlag: [],
@ -4120,6 +4142,48 @@ import {uploadFileList} from '@/api/base/baseFunction.js';
this.projectCategoryList = [] 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 变化后刷新项目分类 // 查询区 BU 变化后刷新项目分类
searchBuChangeHandle (buDesc) { searchBuChangeHandle (buDesc) {
this.searchData.projectCategory = '' this.searchData.projectCategory = ''

Loading…
Cancel
Save