|
|
|
@ -500,15 +500,15 @@ |
|
|
|
v-model.trim="oneKeyForm.projectNo" |
|
|
|
:fetch-suggestions="queryOneKeyProjectSuggestions" |
|
|
|
:trigger-on-focus="true" |
|
|
|
placeholder="手工输入或按BU选择NPI项目" |
|
|
|
placeholder="输入项目描述模糊搜索" |
|
|
|
style="width: 100%" |
|
|
|
@select="handleOneKeyProjectSelect" |
|
|
|
@blur="handleOneKeyProjectNoBlur"> |
|
|
|
<template slot-scope="{ item }"> |
|
|
|
<div class="one-key-suggest-main">{{ item.value }}</div> |
|
|
|
<div class="one-key-suggest-sub"> |
|
|
|
{{ item.projectDesc || '-' }} | {{ item.customerDesc || '-' }} |
|
|
|
{{ item.value }} | {{ item.customerDesc || '-' }} |
|
|
|
</div> |
|
|
|
<div class="one-key-suggest-main">{{ item.projectDesc || item.value }}</div> |
|
|
|
</template> |
|
|
|
</el-autocomplete> |
|
|
|
</el-form-item> |
|
|
|
@ -595,13 +595,13 @@ |
|
|
|
v-model.trim="oneKeyForm.testPartNo" |
|
|
|
:fetch-suggestions="queryOneKeyPartSuggestions" |
|
|
|
:trigger-on-focus="true" |
|
|
|
placeholder="手工输入或按项目编码选择料号" |
|
|
|
placeholder="输入物料描述模糊搜索" |
|
|
|
style="width: 100%" |
|
|
|
@select="handleOneKeyPartSelect" |
|
|
|
@blur="handleOneKeyPartNoBlur"> |
|
|
|
<template slot-scope="{ item }"> |
|
|
|
<div class="one-key-suggest-main">{{ item.value }}</div> |
|
|
|
<div class="one-key-suggest-sub">{{ item.partDesc || '-' }}</div> |
|
|
|
<div class="one-key-suggest-sub">{{ item.value }}</div> |
|
|
|
<div class="one-key-suggest-main">{{ item.partDesc || item.value }}</div> |
|
|
|
</template> |
|
|
|
</el-autocomplete> |
|
|
|
</el-form-item> |
|
|
|
@ -1598,6 +1598,7 @@ export default { |
|
|
|
oneKeyProjectQueryToken: 0, |
|
|
|
oneKeyPartQueryToken: 0, |
|
|
|
oneKeyProjectNoSnapshot: '', |
|
|
|
oneKeyPartNoSnapshot: '', |
|
|
|
oneKeyProjectRoleBaseline: {}, |
|
|
|
|
|
|
|
proofDialogVisible: false, |
|
|
|
@ -4279,6 +4280,7 @@ export default { |
|
|
|
this.oneKeyForm.partDesc = '' |
|
|
|
this.oneKeyForm.partType = '' |
|
|
|
this.oneKeyForm.dry_wet_type = '' |
|
|
|
this.oneKeyPartNoSnapshot = '' |
|
|
|
return |
|
|
|
} |
|
|
|
if (previousProjectNo.toUpperCase() !== projectNo.toUpperCase()) { |
|
|
|
@ -4287,6 +4289,7 @@ export default { |
|
|
|
this.oneKeyForm.partDesc = '' |
|
|
|
this.oneKeyForm.partType = '' |
|
|
|
this.oneKeyForm.dry_wet_type = '' |
|
|
|
this.oneKeyPartNoSnapshot = '' |
|
|
|
} |
|
|
|
this.oneKeyProjectNoSnapshot = projectNo |
|
|
|
this.loadOneKeyProofingApplyOptions(projectNo, { keepCurrentIfMissing: false }) |
|
|
|
@ -4533,18 +4536,39 @@ export default { |
|
|
|
return leftKey.localeCompare(rightKey) |
|
|
|
}) |
|
|
|
}, |
|
|
|
queryOneKeyProjectOptions (projectNoKeyword) { |
|
|
|
getOneKeyDescSearchKeyword (queryString, selectedSnapshotCode) { |
|
|
|
const keyword = this.isBlankValue(queryString) ? '' : String(queryString).trim() |
|
|
|
if (!keyword) { |
|
|
|
return '' |
|
|
|
} |
|
|
|
const snapshotCode = this.isBlankValue(selectedSnapshotCode) ? '' : String(selectedSnapshotCode).trim() |
|
|
|
// 只能和“上次选中的编码”比较。输入框 v-model 就是当前关键字,拿它比较会把描述条件清掉。 |
|
|
|
if (snapshotCode && keyword.toUpperCase() === snapshotCode.toUpperCase()) { |
|
|
|
return '' |
|
|
|
} |
|
|
|
return keyword |
|
|
|
}, |
|
|
|
matchOneKeyDescKeyword (sourceText, keyword) { |
|
|
|
if (this.isBlankValue(keyword)) { |
|
|
|
return true |
|
|
|
} |
|
|
|
if (this.isBlankValue(sourceText)) { |
|
|
|
return false |
|
|
|
} |
|
|
|
return String(sourceText).toUpperCase().indexOf(String(keyword).trim().toUpperCase()) > -1 |
|
|
|
}, |
|
|
|
queryOneKeyProjectOptions (projectDescKeyword) { |
|
|
|
const buContext = this.getOneKeyBuQueryContext() |
|
|
|
if (!buContext) { |
|
|
|
return Promise.resolve([]) |
|
|
|
} |
|
|
|
const queryKeyword = this.isBlankValue(projectNoKeyword) ? '' : String(projectNoKeyword).trim() |
|
|
|
const queryKeyword = this.isBlankValue(projectDescKeyword) ? '' : String(projectDescKeyword).trim() |
|
|
|
const inData = { |
|
|
|
site: buContext.site, |
|
|
|
userName: this.$store.state.user.name, |
|
|
|
buDesc: buContext.buDesc, |
|
|
|
projectNo: queryKeyword, |
|
|
|
projectDesc: '', |
|
|
|
projectNo: '', |
|
|
|
projectDesc: queryKeyword, |
|
|
|
customerNo: '', |
|
|
|
customerDesc: '', |
|
|
|
projectCategory: '', |
|
|
|
@ -4565,7 +4589,6 @@ export default { |
|
|
|
const sourceRows = (data.page && data.page.list) || [] |
|
|
|
const targetBuNo = buContext.normalizedBuNo.toUpperCase() |
|
|
|
const targetBuDesc = this.isBlankValue(buContext.buDesc) ? '' : String(buContext.buDesc).trim().toUpperCase() |
|
|
|
const normalizedKeyword = queryKeyword.toUpperCase() |
|
|
|
const filteredRows = sourceRows.filter(item => { |
|
|
|
if (!item || this.isBlankValue(item.projectNo)) { |
|
|
|
return false |
|
|
|
@ -4577,31 +4600,29 @@ export default { |
|
|
|
if (hasRowBuInfo && !matchedBu) { |
|
|
|
return false |
|
|
|
} |
|
|
|
if (!normalizedKeyword) { |
|
|
|
return true |
|
|
|
} |
|
|
|
return String(item.projectNo).toUpperCase().indexOf(normalizedKeyword) > -1 |
|
|
|
return this.matchOneKeyDescKeyword(item.projectDesc, queryKeyword) |
|
|
|
|| this.matchOneKeyDescKeyword(item.projectName, queryKeyword) |
|
|
|
}) |
|
|
|
return this.sortRowsByDateDesc(filteredRows, ['createDate', 'projectCreationDate', 'updateDate']) |
|
|
|
}).catch(() => { |
|
|
|
return [] |
|
|
|
}) |
|
|
|
}, |
|
|
|
queryOneKeyPartOptions (projectNo, partNoKeyword) { |
|
|
|
queryOneKeyPartOptions (projectNo, partDescKeyword) { |
|
|
|
const normalizedProjectNo = this.normalizeProjectNo(projectNo) |
|
|
|
if (!normalizedProjectNo) { |
|
|
|
return Promise.resolve([]) |
|
|
|
} |
|
|
|
const buContext = this.getOneKeyBuQueryContext() |
|
|
|
const queryKeyword = this.isBlankValue(partNoKeyword) ? '' : String(partNoKeyword).trim() |
|
|
|
const queryKeyword = this.isBlankValue(partDescKeyword) ? '' : String(partDescKeyword).trim() |
|
|
|
const inData = { |
|
|
|
site: buContext ? buContext.site : this.$store.state.user.site, |
|
|
|
userName: this.$store.state.user.name, |
|
|
|
buDesc: buContext ? buContext.buDesc : '', |
|
|
|
projectNo: normalizedProjectNo, |
|
|
|
projectDesc: '', |
|
|
|
testPartNo: queryKeyword, |
|
|
|
partDesc: '', |
|
|
|
testPartNo: '', |
|
|
|
partDesc: queryKeyword, |
|
|
|
customerNo: '', |
|
|
|
customerDesc: '', |
|
|
|
projectCategory: '', |
|
|
|
@ -4625,17 +4646,13 @@ export default { |
|
|
|
} |
|
|
|
const sourceRows = (data.page && data.page.list) || [] |
|
|
|
const targetProjectNo = normalizedProjectNo.toUpperCase() |
|
|
|
const normalizedKeyword = queryKeyword.toUpperCase() |
|
|
|
const filteredRows = sourceRows.filter(item => { |
|
|
|
const rowPartNo = item && item.testPartNo ? String(item.testPartNo).trim() : '' |
|
|
|
const rowProjectNo = this.normalizeProjectNo(item && item.projectNo ? item.projectNo : '').toUpperCase() |
|
|
|
if (!rowPartNo || rowProjectNo !== targetProjectNo) { |
|
|
|
return false |
|
|
|
} |
|
|
|
if (!normalizedKeyword) { |
|
|
|
return true |
|
|
|
} |
|
|
|
return rowPartNo.toUpperCase().indexOf(normalizedKeyword) > -1 |
|
|
|
return this.matchOneKeyDescKeyword(item.partDesc, queryKeyword) |
|
|
|
}) |
|
|
|
return this.sortRowsByDateDesc(filteredRows, ['createDate', 'updateDate', 'buildDate']) |
|
|
|
}).catch(() => { |
|
|
|
@ -4645,7 +4662,8 @@ export default { |
|
|
|
queryOneKeyProjectSuggestions (queryString, callback) { |
|
|
|
const queryToken = this.oneKeyProjectQueryToken + 1 |
|
|
|
this.oneKeyProjectQueryToken = queryToken |
|
|
|
this.queryOneKeyProjectOptions(queryString).then(rows => { |
|
|
|
const descKeyword = this.getOneKeyDescSearchKeyword(queryString, this.oneKeyProjectNoSnapshot) |
|
|
|
this.queryOneKeyProjectOptions(descKeyword).then(rows => { |
|
|
|
if (queryToken !== this.oneKeyProjectQueryToken) { |
|
|
|
return |
|
|
|
} |
|
|
|
@ -4670,14 +4688,15 @@ export default { |
|
|
|
}) |
|
|
|
}, |
|
|
|
queryOneKeyPartSuggestions (queryString, callback) { |
|
|
|
const projectNo = this.normalizeProjectNo(this.oneKeyForm.projectNo) |
|
|
|
const projectNo = this.normalizeProjectNo(this.oneKeyProjectNoSnapshot) |
|
|
|
if (!projectNo) { |
|
|
|
callback([]) |
|
|
|
return |
|
|
|
} |
|
|
|
const queryToken = this.oneKeyPartQueryToken + 1 |
|
|
|
this.oneKeyPartQueryToken = queryToken |
|
|
|
this.queryOneKeyPartOptions(projectNo, queryString).then(rows => { |
|
|
|
const descKeyword = this.getOneKeyDescSearchKeyword(queryString, this.oneKeyPartNoSnapshot) |
|
|
|
this.queryOneKeyPartOptions(projectNo, descKeyword).then(rows => { |
|
|
|
if (queryToken !== this.oneKeyPartQueryToken) { |
|
|
|
return |
|
|
|
} |
|
|
|
@ -4772,6 +4791,7 @@ export default { |
|
|
|
this.oneKeyForm.partDesc = '' |
|
|
|
this.oneKeyForm.partType = '' |
|
|
|
this.oneKeyForm.dry_wet_type = '' |
|
|
|
this.oneKeyPartNoSnapshot = '' |
|
|
|
} |
|
|
|
this.loadOneKeyProofingApplyOptions(projectNo, { keepCurrentIfMissing: false }) |
|
|
|
}, |
|
|
|
@ -4782,6 +4802,7 @@ export default { |
|
|
|
return |
|
|
|
} |
|
|
|
this.oneKeyForm.testPartNo = partNo |
|
|
|
this.oneKeyPartNoSnapshot = partNo |
|
|
|
if (!this.isBlankValue(selectedPart.partDesc)) { |
|
|
|
this.oneKeyForm.partDesc = String(selectedPart.partDesc).trim() |
|
|
|
} |
|
|
|
@ -4992,6 +5013,7 @@ export default { |
|
|
|
this.oneKeyProjectQueryToken += 1 |
|
|
|
this.oneKeyPartQueryToken += 1 |
|
|
|
this.oneKeyProjectNoSnapshot = '' |
|
|
|
this.oneKeyPartNoSnapshot = '' |
|
|
|
this.oneKeyProjectRoleBaseline = {} |
|
|
|
this.oneKeyForm = this.getEmptyOneKeyForm() |
|
|
|
const selectedSearchBuNo = this.getSelectedSearchBuNo() |
|
|
|
@ -5055,6 +5077,7 @@ export default { |
|
|
|
this.oneKeyForm = this.buildOneKeyEditForm(current, projectRows[0], partRows[0]) |
|
|
|
this.snapshotOneKeyProjectRoles(projectRows[0]) |
|
|
|
this.oneKeyProjectNoSnapshot = this.normalizeProjectNo(this.oneKeyForm.projectNo) |
|
|
|
this.oneKeyPartNoSnapshot = this.isBlankValue(this.oneKeyForm.testPartNo) ? '' : String(this.oneKeyForm.testPartNo).trim() |
|
|
|
this.oneKeyProofingApplyQueryToken += 1 |
|
|
|
this.oneKeyProofingApplyLoading = false |
|
|
|
this.oneKeyProofingApplyOptions = [] |
|
|
|
|