|
|
@ -362,7 +362,21 @@ |
|
|
</el-col> |
|
|
</el-col> |
|
|
<el-col :span="6" v-show="isOneKeyCreateFieldVisible('projectNo')"> |
|
|
<el-col :span="6" v-show="isOneKeyCreateFieldVisible('projectNo')"> |
|
|
<el-form-item label="项目编码"> |
|
|
<el-form-item label="项目编码"> |
|
|
<el-input v-model="oneKeyForm.projectNo" style="width: 100%" @blur="handleOneKeyProjectNoBlur"></el-input> |
|
|
|
|
|
|
|
|
<el-autocomplete |
|
|
|
|
|
v-model.trim="oneKeyForm.projectNo" |
|
|
|
|
|
:fetch-suggestions="queryOneKeyProjectSuggestions" |
|
|
|
|
|
:trigger-on-focus="true" |
|
|
|
|
|
placeholder="手工输入或按BU选择NPI项目" |
|
|
|
|
|
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 || '-' }} |
|
|
|
|
|
</div> |
|
|
|
|
|
</template> |
|
|
|
|
|
</el-autocomplete> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
</el-col> |
|
|
</el-col> |
|
|
<el-col :span="12" v-show="isOneKeyCreateFieldVisible('projectDesc')"> |
|
|
<el-col :span="12" v-show="isOneKeyCreateFieldVisible('projectDesc')"> |
|
|
@ -443,7 +457,19 @@ |
|
|
<el-row :gutter="16"> |
|
|
<el-row :gutter="16"> |
|
|
<el-col :span="6" v-show="isOneKeyCreateFieldVisible('testPartNo')"> |
|
|
<el-col :span="6" v-show="isOneKeyCreateFieldVisible('testPartNo')"> |
|
|
<el-form-item label="项目料号"> |
|
|
<el-form-item label="项目料号"> |
|
|
<el-input v-model="oneKeyForm.testPartNo" style="width: 100%"></el-input> |
|
|
|
|
|
|
|
|
<el-autocomplete |
|
|
|
|
|
v-model.trim="oneKeyForm.testPartNo" |
|
|
|
|
|
:fetch-suggestions="queryOneKeyPartSuggestions" |
|
|
|
|
|
:trigger-on-focus="true" |
|
|
|
|
|
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 || '-' }} | 创建: {{ item.createDateText || '-' }}</div> |
|
|
|
|
|
</template> |
|
|
|
|
|
</el-autocomplete> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
</el-col> |
|
|
</el-col> |
|
|
<el-col :span="12" v-show="isOneKeyCreateFieldVisible('partDesc')"> |
|
|
<el-col :span="12" v-show="isOneKeyCreateFieldVisible('partDesc')"> |
|
|
@ -947,7 +973,7 @@ import { |
|
|
updateProofTrackingProcess |
|
|
updateProofTrackingProcess |
|
|
} from '@/api/sampleTracking/sampleTracking' |
|
|
} from '@/api/sampleTracking/sampleTracking' |
|
|
import { searchExpApplyList } from '@/api/erf/erf' |
|
|
import { searchExpApplyList } from '@/api/erf/erf' |
|
|
import { getCustomerNo, saveNewCustomer } from '@/api/eam/eamProject.js' |
|
|
|
|
|
|
|
|
import { eamProjectInfoSearch, eamProjectPartSearch, getCustomerNo, saveNewCustomer } from '@/api/eam/eamProject.js' |
|
|
import { getSiteAndBuByUserName } from '@/api/eam/eam.js' |
|
|
import { getSiteAndBuByUserName } from '@/api/eam/eam.js' |
|
|
import { |
|
|
import { |
|
|
searchBusinessInfo, |
|
|
searchBusinessInfo, |
|
|
@ -1009,6 +1035,23 @@ function cloneDefaultProcessColumns () { |
|
|
return DEFAULT_PROCESS_COLUMNS.map(item => Object.assign({}, item)) |
|
|
return DEFAULT_PROCESS_COLUMNS.map(item => Object.assign({}, item)) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const ONE_KEY_ROLE_FIELDS = [ |
|
|
|
|
|
'projectManager', |
|
|
|
|
|
'projectOwner', |
|
|
|
|
|
'engineer', |
|
|
|
|
|
'cManufactureEngineer', |
|
|
|
|
|
'cQualityEngineer1', |
|
|
|
|
|
'cQualityEngineer2', |
|
|
|
|
|
'cQualityEngineer3', |
|
|
|
|
|
'cQualityEngineer4', |
|
|
|
|
|
'cQualityEngineer5', |
|
|
|
|
|
'cQualityEngineer6', |
|
|
|
|
|
'cQualityEngineer7', |
|
|
|
|
|
'ipqcHardTag', |
|
|
|
|
|
'docEngineer', |
|
|
|
|
|
'docEngineer2' |
|
|
|
|
|
] |
|
|
|
|
|
|
|
|
const DEFAULT_TRACKING_COLUMNS = [ |
|
|
const DEFAULT_TRACKING_COLUMNS = [ |
|
|
{ |
|
|
{ |
|
|
serialNumber: 'proofTrackingTable1ProjectNo', |
|
|
serialNumber: 'proofTrackingTable1ProjectNo', |
|
|
@ -1349,6 +1392,10 @@ export default { |
|
|
oneKeyProofingApplyOptions: [], |
|
|
oneKeyProofingApplyOptions: [], |
|
|
oneKeyProofingApplyLoading: false, |
|
|
oneKeyProofingApplyLoading: false, |
|
|
oneKeyProofingApplyQueryToken: 0, |
|
|
oneKeyProofingApplyQueryToken: 0, |
|
|
|
|
|
oneKeyProjectQueryToken: 0, |
|
|
|
|
|
oneKeyPartQueryToken: 0, |
|
|
|
|
|
oneKeyProjectNoSnapshot: '', |
|
|
|
|
|
oneKeyProjectRoleBaseline: {}, |
|
|
|
|
|
|
|
|
proofDialogVisible: false, |
|
|
proofDialogVisible: false, |
|
|
proofSaveLoading: false, |
|
|
proofSaveLoading: false, |
|
|
@ -3003,14 +3050,27 @@ export default { |
|
|
}, |
|
|
}, |
|
|
handleOneKeyProjectNoBlur () { |
|
|
handleOneKeyProjectNoBlur () { |
|
|
const projectNo = this.normalizeProjectNo(this.oneKeyForm.projectNo) |
|
|
const projectNo = this.normalizeProjectNo(this.oneKeyForm.projectNo) |
|
|
|
|
|
const previousProjectNo = this.normalizeProjectNo(this.oneKeyProjectNoSnapshot) |
|
|
|
|
|
this.oneKeyForm.projectNo = projectNo |
|
|
if (!projectNo) { |
|
|
if (!projectNo) { |
|
|
this.oneKeyProofingApplyQueryToken += 1 |
|
|
this.oneKeyProofingApplyQueryToken += 1 |
|
|
this.oneKeyProofingApplyLoading = false |
|
|
this.oneKeyProofingApplyLoading = false |
|
|
this.oneKeyProofingApplyOptions = [] |
|
|
this.oneKeyProofingApplyOptions = [] |
|
|
this.oneKeyForm.proofingNo = '' |
|
|
this.oneKeyForm.proofingNo = '' |
|
|
this.oneKeyForm.requiredDeliveryDate = '' |
|
|
this.oneKeyForm.requiredDeliveryDate = '' |
|
|
|
|
|
this.oneKeyProjectNoSnapshot = '' |
|
|
|
|
|
this.oneKeyForm.testPartNo = '' |
|
|
|
|
|
this.oneKeyForm.partDesc = '' |
|
|
|
|
|
this.oneKeyForm.partType = '' |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
if (previousProjectNo.toUpperCase() !== projectNo.toUpperCase()) { |
|
|
|
|
|
// 项目编码变化后需清理旧料号,避免跨项目保留旧料号与角色信息。 |
|
|
|
|
|
this.oneKeyForm.testPartNo = '' |
|
|
|
|
|
this.oneKeyForm.partDesc = '' |
|
|
|
|
|
this.oneKeyForm.partType = '' |
|
|
|
|
|
} |
|
|
|
|
|
this.oneKeyProjectNoSnapshot = projectNo |
|
|
this.loadOneKeyProofingApplyOptions(projectNo, { keepCurrentIfMissing: false }) |
|
|
this.loadOneKeyProofingApplyOptions(projectNo, { keepCurrentIfMissing: false }) |
|
|
}, |
|
|
}, |
|
|
handleOneKeyProofingNoChange (proofingNo) { |
|
|
handleOneKeyProofingNoChange (proofingNo) { |
|
|
@ -3162,6 +3222,351 @@ export default { |
|
|
const splitIdx = strVal.indexOf('-') |
|
|
const splitIdx = strVal.indexOf('-') |
|
|
return splitIdx > -1 ? strVal.substring(splitIdx + 1) : strVal |
|
|
return splitIdx > -1 ? strVal.substring(splitIdx + 1) : strVal |
|
|
}, |
|
|
}, |
|
|
|
|
|
normalizeRoleValue (value) { |
|
|
|
|
|
if (this.isBlankValue(value)) { |
|
|
|
|
|
return '' |
|
|
|
|
|
} |
|
|
|
|
|
return String(value).trim() |
|
|
|
|
|
}, |
|
|
|
|
|
getSiteByJoinedBuNo (buNo) { |
|
|
|
|
|
const rawBuNo = buNo == null ? '' : String(buNo).trim() |
|
|
|
|
|
if (!rawBuNo) { |
|
|
|
|
|
return this.$store.state.user.site |
|
|
|
|
|
} |
|
|
|
|
|
const splitIdx = rawBuNo.indexOf('_') |
|
|
|
|
|
if (splitIdx > 0) { |
|
|
|
|
|
return rawBuNo.substring(0, splitIdx) |
|
|
|
|
|
} |
|
|
|
|
|
return this.$store.state.user.site |
|
|
|
|
|
}, |
|
|
|
|
|
getOneKeyBuQueryContext () { |
|
|
|
|
|
const currentBuNo = this.oneKeyForm && this.oneKeyForm.buNo |
|
|
|
|
|
? String(this.oneKeyForm.buNo).trim() |
|
|
|
|
|
: '' |
|
|
|
|
|
const normalizedBuNo = this.normalizeBuNo(currentBuNo, this.$store.state.user.site) |
|
|
|
|
|
if (!normalizedBuNo) { |
|
|
|
|
|
return null |
|
|
|
|
|
} |
|
|
|
|
|
const matchedBu = this.userBuList.find(item => { |
|
|
|
|
|
if (!item || !item.buNo) { |
|
|
|
|
|
return false |
|
|
|
|
|
} |
|
|
|
|
|
const itemBuNo = this.normalizeBuNo(item.buNo, this.$store.state.user.site) |
|
|
|
|
|
return itemBuNo.toUpperCase() === normalizedBuNo.toUpperCase() |
|
|
|
|
|
}) || null |
|
|
|
|
|
const joinedBuNo = matchedBu && matchedBu.buNo ? matchedBu.buNo : currentBuNo |
|
|
|
|
|
return { |
|
|
|
|
|
normalizedBuNo: normalizedBuNo, |
|
|
|
|
|
buDesc: matchedBu && matchedBu.buDesc ? String(matchedBu.buDesc).trim() : '', |
|
|
|
|
|
site: this.getSiteByJoinedBuNo(joinedBuNo) |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
getRowDateSortTime (row, fieldList) { |
|
|
|
|
|
if (!row || !Array.isArray(fieldList)) { |
|
|
|
|
|
return 0 |
|
|
|
|
|
} |
|
|
|
|
|
for (let i = 0; i < fieldList.length; i += 1) { |
|
|
|
|
|
const fieldKey = fieldList[i] |
|
|
|
|
|
const rawVal = row[fieldKey] |
|
|
|
|
|
if (this.isBlankValue(rawVal)) { |
|
|
|
|
|
continue |
|
|
|
|
|
} |
|
|
|
|
|
const date = new Date(rawVal) |
|
|
|
|
|
if (isNaN(date.getTime())) { |
|
|
|
|
|
continue |
|
|
|
|
|
} |
|
|
|
|
|
return date.getTime() |
|
|
|
|
|
} |
|
|
|
|
|
return 0 |
|
|
|
|
|
}, |
|
|
|
|
|
sortRowsByDateDesc (rows, fieldList) { |
|
|
|
|
|
const sourceRows = Array.isArray(rows) ? rows : [] |
|
|
|
|
|
return sourceRows.slice().sort((a, b) => { |
|
|
|
|
|
const diff = this.getRowDateSortTime(b, fieldList) - this.getRowDateSortTime(a, fieldList) |
|
|
|
|
|
if (diff !== 0) { |
|
|
|
|
|
return diff |
|
|
|
|
|
} |
|
|
|
|
|
const leftKey = this.isBlankValue(a && a.projectNo) ? (a && a.testPartNo ? String(a.testPartNo) : '') : String(a.projectNo) |
|
|
|
|
|
const rightKey = this.isBlankValue(b && b.projectNo) ? (b && b.testPartNo ? String(b.testPartNo) : '') : String(b.projectNo) |
|
|
|
|
|
return leftKey.localeCompare(rightKey) |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
queryOneKeyProjectOptions (projectNoKeyword) { |
|
|
|
|
|
const buContext = this.getOneKeyBuQueryContext() |
|
|
|
|
|
if (!buContext) { |
|
|
|
|
|
return Promise.resolve([]) |
|
|
|
|
|
} |
|
|
|
|
|
const queryKeyword = this.isBlankValue(projectNoKeyword) ? '' : String(projectNoKeyword).trim() |
|
|
|
|
|
const inData = { |
|
|
|
|
|
site: buContext.site, |
|
|
|
|
|
userName: this.$store.state.user.name, |
|
|
|
|
|
buDesc: buContext.buDesc, |
|
|
|
|
|
projectNo: queryKeyword, |
|
|
|
|
|
projectDesc: '', |
|
|
|
|
|
customerNo: '', |
|
|
|
|
|
customerDesc: '', |
|
|
|
|
|
projectCategory: '', |
|
|
|
|
|
status: '', |
|
|
|
|
|
projectManager: '', |
|
|
|
|
|
projectOwner: '', |
|
|
|
|
|
engineer: '', |
|
|
|
|
|
cProjectRegion: '', |
|
|
|
|
|
startDate: '', |
|
|
|
|
|
endDate: '', |
|
|
|
|
|
page: 1, |
|
|
|
|
|
limit: 300 |
|
|
|
|
|
} |
|
|
|
|
|
return eamProjectInfoSearch(inData).then(({ data }) => { |
|
|
|
|
|
if (!(data && data.code === 0)) { |
|
|
|
|
|
return [] |
|
|
|
|
|
} |
|
|
|
|
|
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 |
|
|
|
|
|
} |
|
|
|
|
|
const rowBuNo = this.normalizeBuNo(item.buNo || item.bu || '', buContext.site).toUpperCase() |
|
|
|
|
|
const rowBuDesc = this.isBlankValue(item.buDesc) ? '' : String(item.buDesc).trim().toUpperCase() |
|
|
|
|
|
const matchedBu = (targetBuNo && rowBuNo && rowBuNo === targetBuNo) || (targetBuDesc && rowBuDesc && rowBuDesc === targetBuDesc) |
|
|
|
|
|
const hasRowBuInfo = !this.isBlankValue(item.buNo || item.bu || item.buDesc) |
|
|
|
|
|
if (hasRowBuInfo && !matchedBu) { |
|
|
|
|
|
return false |
|
|
|
|
|
} |
|
|
|
|
|
if (!normalizedKeyword) { |
|
|
|
|
|
return true |
|
|
|
|
|
} |
|
|
|
|
|
return String(item.projectNo).toUpperCase().indexOf(normalizedKeyword) > -1 |
|
|
|
|
|
}) |
|
|
|
|
|
return this.sortRowsByDateDesc(filteredRows, ['createDate', 'projectCreationDate', 'updateDate']) |
|
|
|
|
|
}).catch(() => { |
|
|
|
|
|
return [] |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
queryOneKeyPartOptions (projectNo, partNoKeyword) { |
|
|
|
|
|
const normalizedProjectNo = this.normalizeProjectNo(projectNo) |
|
|
|
|
|
if (!normalizedProjectNo) { |
|
|
|
|
|
return Promise.resolve([]) |
|
|
|
|
|
} |
|
|
|
|
|
const buContext = this.getOneKeyBuQueryContext() |
|
|
|
|
|
const queryKeyword = this.isBlankValue(partNoKeyword) ? '' : String(partNoKeyword).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: '', |
|
|
|
|
|
customerNo: '', |
|
|
|
|
|
customerDesc: '', |
|
|
|
|
|
projectCategory: '', |
|
|
|
|
|
status: '', |
|
|
|
|
|
startDate: '', |
|
|
|
|
|
endDate: '', |
|
|
|
|
|
projectManager: '', |
|
|
|
|
|
projectOwner: '', |
|
|
|
|
|
engineer: '', |
|
|
|
|
|
cProjectRegion: '', |
|
|
|
|
|
finalPartNo: '', |
|
|
|
|
|
massProductionStartDate: '', |
|
|
|
|
|
massProductionEndDate: '', |
|
|
|
|
|
feedingFlag: '0', |
|
|
|
|
|
page: 1, |
|
|
|
|
|
limit: 300 |
|
|
|
|
|
} |
|
|
|
|
|
return eamProjectPartSearch(inData).then(({ data }) => { |
|
|
|
|
|
if (!(data && data.code === 0)) { |
|
|
|
|
|
return [] |
|
|
|
|
|
} |
|
|
|
|
|
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.sortRowsByDateDesc(filteredRows, ['createDate', 'updateDate', 'buildDate']) |
|
|
|
|
|
}).catch(() => { |
|
|
|
|
|
return [] |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
queryOneKeyProjectSuggestions (queryString, callback) { |
|
|
|
|
|
const queryToken = this.oneKeyProjectQueryToken + 1 |
|
|
|
|
|
this.oneKeyProjectQueryToken = queryToken |
|
|
|
|
|
this.queryOneKeyProjectOptions(queryString).then(rows => { |
|
|
|
|
|
if (queryToken !== this.oneKeyProjectQueryToken) { |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
const suggestionRows = rows.map(item => { |
|
|
|
|
|
const projectNo = this.normalizeProjectNo(item.projectNo) |
|
|
|
|
|
if (!projectNo) { |
|
|
|
|
|
return null |
|
|
|
|
|
} |
|
|
|
|
|
return { |
|
|
|
|
|
value: projectNo, |
|
|
|
|
|
projectDesc: item.projectDesc || item.projectName || '', |
|
|
|
|
|
customerDesc: item.customerDesc || '', |
|
|
|
|
|
createDateText: this.formatDate(item.createDate || item.projectCreationDate || item.updateDate), |
|
|
|
|
|
source: item |
|
|
|
|
|
} |
|
|
|
|
|
}).filter(item => !!item) |
|
|
|
|
|
callback(suggestionRows) |
|
|
|
|
|
}).catch(() => { |
|
|
|
|
|
if (queryToken === this.oneKeyProjectQueryToken) { |
|
|
|
|
|
callback([]) |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
queryOneKeyPartSuggestions (queryString, callback) { |
|
|
|
|
|
const projectNo = this.normalizeProjectNo(this.oneKeyForm.projectNo) |
|
|
|
|
|
if (!projectNo) { |
|
|
|
|
|
callback([]) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
const queryToken = this.oneKeyPartQueryToken + 1 |
|
|
|
|
|
this.oneKeyPartQueryToken = queryToken |
|
|
|
|
|
this.queryOneKeyPartOptions(projectNo, queryString).then(rows => { |
|
|
|
|
|
if (queryToken !== this.oneKeyPartQueryToken) { |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
const suggestionRows = rows.map(item => { |
|
|
|
|
|
const partNo = item && item.testPartNo ? String(item.testPartNo).trim() : '' |
|
|
|
|
|
if (!partNo) { |
|
|
|
|
|
return null |
|
|
|
|
|
} |
|
|
|
|
|
return { |
|
|
|
|
|
value: partNo, |
|
|
|
|
|
partDesc: item.partDesc || '', |
|
|
|
|
|
createDateText: this.formatDate(item.createDate || item.updateDate || item.buildDate), |
|
|
|
|
|
source: item |
|
|
|
|
|
} |
|
|
|
|
|
}).filter(item => !!item) |
|
|
|
|
|
callback(suggestionRows) |
|
|
|
|
|
}).catch(() => { |
|
|
|
|
|
if (queryToken === this.oneKeyPartQueryToken) { |
|
|
|
|
|
callback([]) |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
setOneKeyRoleFieldValue (fieldKey, roleValue) { |
|
|
|
|
|
const normalizedRoleValue = this.normalizeRoleValue(roleValue) |
|
|
|
|
|
this.oneKeyForm[fieldKey] = normalizedRoleValue |
|
|
|
|
|
const roleCfg = this.roleConfig[fieldKey] |
|
|
|
|
|
if (roleCfg && roleCfg.nameField) { |
|
|
|
|
|
this.oneKeyForm[roleCfg.nameField] = this.getRoleDisplayName(normalizedRoleValue) |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
setOneKeyRoleFieldsFromSource (source) { |
|
|
|
|
|
const roleSource = source || {} |
|
|
|
|
|
ONE_KEY_ROLE_FIELDS.forEach(fieldKey => { |
|
|
|
|
|
this.setOneKeyRoleFieldValue(fieldKey, roleSource[fieldKey]) |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
snapshotOneKeyProjectRoles (source) { |
|
|
|
|
|
const roleSource = source || {} |
|
|
|
|
|
const roleBaseline = {} |
|
|
|
|
|
ONE_KEY_ROLE_FIELDS.forEach(fieldKey => { |
|
|
|
|
|
roleBaseline[fieldKey] = this.normalizeRoleValue(roleSource[fieldKey]) |
|
|
|
|
|
}) |
|
|
|
|
|
this.oneKeyProjectRoleBaseline = roleBaseline |
|
|
|
|
|
}, |
|
|
|
|
|
syncOneKeyPartRoleFields (partRow) { |
|
|
|
|
|
const changedRoleFields = [] |
|
|
|
|
|
ONE_KEY_ROLE_FIELDS.forEach(fieldKey => { |
|
|
|
|
|
const partRoleValue = this.normalizeRoleValue(partRow && partRow[fieldKey]) |
|
|
|
|
|
if (!partRoleValue) { |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
const baselineRoleValue = this.normalizeRoleValue(this.oneKeyProjectRoleBaseline[fieldKey]) |
|
|
|
|
|
if (baselineRoleValue === partRoleValue) { |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
const currentRoleValue = this.normalizeRoleValue(this.oneKeyForm[fieldKey]) |
|
|
|
|
|
if (currentRoleValue === partRoleValue) { |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
this.setOneKeyRoleFieldValue(fieldKey, partRoleValue) |
|
|
|
|
|
changedRoleFields.push(fieldKey) |
|
|
|
|
|
}) |
|
|
|
|
|
if (changedRoleFields.length > 0) { |
|
|
|
|
|
this.$message.info('项目料号角色人员有变动,已同步角色账号') |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
applyOneKeyProjectSelection (projectRow) { |
|
|
|
|
|
const selectedProject = projectRow || {} |
|
|
|
|
|
const projectNo = this.normalizeProjectNo(selectedProject.projectNo) |
|
|
|
|
|
if (!projectNo) { |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
const previousProjectNo = this.normalizeProjectNo(this.oneKeyProjectNoSnapshot) |
|
|
|
|
|
const projectChanged = previousProjectNo.toUpperCase() !== projectNo.toUpperCase() |
|
|
|
|
|
this.oneKeyForm.projectNo = projectNo |
|
|
|
|
|
this.oneKeyProjectNoSnapshot = projectNo |
|
|
|
|
|
this.oneKeyForm.projectName = selectedProject.projectName || selectedProject.projectDesc || '' |
|
|
|
|
|
this.oneKeyForm.projectDesc = selectedProject.projectDesc || selectedProject.projectName || '' |
|
|
|
|
|
this.oneKeyForm.customerNo = this.isBlankValue(selectedProject.customerNo) ? '' : String(selectedProject.customerNo).trim() |
|
|
|
|
|
this.oneKeyForm.customerDesc = selectedProject.customerDesc || '' |
|
|
|
|
|
this.oneKeyForm.projectCreationDate = this.formatDate(selectedProject.projectCreationDate || selectedProject.createDate) |
|
|
|
|
|
this.oneKeyForm.needDate = this.formatDate(selectedProject.needDate) |
|
|
|
|
|
this.oneKeyForm.projectCategory = this.getProjectCategoryValue(selectedProject) |
|
|
|
|
|
this.oneKeyForm.cProjectRegion = this.isBlankValue(selectedProject.cProjectRegion) ? '' : String(selectedProject.cProjectRegion).trim() |
|
|
|
|
|
const rawPriority = this.isBlankValue(selectedProject.priorityLevel) ? selectedProject.priority : selectedProject.priorityLevel |
|
|
|
|
|
this.oneKeyForm.priorityLevel = this.isBlankValue(rawPriority) ? '' : String(rawPriority).trim() |
|
|
|
|
|
this.setOneKeyRoleFieldsFromSource(selectedProject) |
|
|
|
|
|
this.snapshotOneKeyProjectRoles(selectedProject) |
|
|
|
|
|
if (projectChanged) { |
|
|
|
|
|
// 项目切换时清理料号相关字段,防止旧料号角色残留到新项目。 |
|
|
|
|
|
this.oneKeyForm.testPartNo = '' |
|
|
|
|
|
this.oneKeyForm.partDesc = '' |
|
|
|
|
|
this.oneKeyForm.partType = '' |
|
|
|
|
|
} |
|
|
|
|
|
this.loadOneKeyProofingApplyOptions(projectNo, { keepCurrentIfMissing: false }) |
|
|
|
|
|
}, |
|
|
|
|
|
applyOneKeyPartSelection (partRow) { |
|
|
|
|
|
const selectedPart = partRow || {} |
|
|
|
|
|
const partNo = this.isBlankValue(selectedPart.testPartNo) ? '' : String(selectedPart.testPartNo).trim() |
|
|
|
|
|
if (!partNo) { |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
this.oneKeyForm.testPartNo = partNo |
|
|
|
|
|
if (!this.isBlankValue(selectedPart.partDesc)) { |
|
|
|
|
|
this.oneKeyForm.partDesc = String(selectedPart.partDesc).trim() |
|
|
|
|
|
} |
|
|
|
|
|
if (!this.isBlankValue(selectedPart.partType)) { |
|
|
|
|
|
this.oneKeyForm.partType = String(selectedPart.partType).trim() |
|
|
|
|
|
} |
|
|
|
|
|
// 业务要求:料号角色与项目角色存在差异时,界面需优先回填料号角色账号。 |
|
|
|
|
|
this.syncOneKeyPartRoleFields(selectedPart) |
|
|
|
|
|
}, |
|
|
|
|
|
handleOneKeyProjectSelect (item) { |
|
|
|
|
|
const selectedRow = item && item.source ? item.source : null |
|
|
|
|
|
if (!selectedRow) { |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
this.applyOneKeyProjectSelection(selectedRow) |
|
|
|
|
|
}, |
|
|
|
|
|
handleOneKeyPartSelect (item) { |
|
|
|
|
|
const selectedRow = item && item.source ? item.source : null |
|
|
|
|
|
if (!selectedRow) { |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
this.applyOneKeyPartSelection(selectedRow) |
|
|
|
|
|
}, |
|
|
|
|
|
handleOneKeyPartNoBlur () { |
|
|
|
|
|
this.oneKeyForm.testPartNo = this.isBlankValue(this.oneKeyForm.testPartNo) |
|
|
|
|
|
? '' |
|
|
|
|
|
: String(this.oneKeyForm.testPartNo).trim() |
|
|
|
|
|
}, |
|
|
buildOneKeySubmitPayload () { |
|
|
buildOneKeySubmitPayload () { |
|
|
const inData = Object.assign({}, this.oneKeyForm, { |
|
|
const inData = Object.assign({}, this.oneKeyForm, { |
|
|
createBy: this.$store.state.user.name, |
|
|
createBy: this.$store.state.user.name, |
|
|
@ -3318,6 +3723,10 @@ export default { |
|
|
this.oneKeyProofingApplyQueryToken += 1 |
|
|
this.oneKeyProofingApplyQueryToken += 1 |
|
|
this.oneKeyProofingApplyLoading = false |
|
|
this.oneKeyProofingApplyLoading = false |
|
|
this.oneKeyProofingApplyOptions = [] |
|
|
this.oneKeyProofingApplyOptions = [] |
|
|
|
|
|
this.oneKeyProjectQueryToken += 1 |
|
|
|
|
|
this.oneKeyPartQueryToken += 1 |
|
|
|
|
|
this.oneKeyProjectNoSnapshot = '' |
|
|
|
|
|
this.oneKeyProjectRoleBaseline = {} |
|
|
this.oneKeyForm = this.getEmptyOneKeyForm() |
|
|
this.oneKeyForm = this.getEmptyOneKeyForm() |
|
|
if (this.userBuList.length > 0) { |
|
|
if (this.userBuList.length > 0) { |
|
|
this.oneKeyForm.buNo = this.userBuList[0].buNo || '' |
|
|
this.oneKeyForm.buNo = this.userBuList[0].buNo || '' |
|
|
@ -3373,9 +3782,13 @@ export default { |
|
|
throw new Error('未找到对应的项目物料信息,无法修改') |
|
|
throw new Error('未找到对应的项目物料信息,无法修改') |
|
|
} |
|
|
} |
|
|
this.oneKeyForm = this.buildOneKeyEditForm(current, projectRows[0], partRows[0]) |
|
|
this.oneKeyForm = this.buildOneKeyEditForm(current, projectRows[0], partRows[0]) |
|
|
|
|
|
this.snapshotOneKeyProjectRoles(projectRows[0]) |
|
|
|
|
|
this.oneKeyProjectNoSnapshot = this.normalizeProjectNo(this.oneKeyForm.projectNo) |
|
|
this.oneKeyProofingApplyQueryToken += 1 |
|
|
this.oneKeyProofingApplyQueryToken += 1 |
|
|
this.oneKeyProofingApplyLoading = false |
|
|
this.oneKeyProofingApplyLoading = false |
|
|
this.oneKeyProofingApplyOptions = [] |
|
|
this.oneKeyProofingApplyOptions = [] |
|
|
|
|
|
this.oneKeyProjectQueryToken += 1 |
|
|
|
|
|
this.oneKeyPartQueryToken += 1 |
|
|
this.oneKeyDialogVisible = true |
|
|
this.oneKeyDialogVisible = true |
|
|
this.loadOneKeyProofingApplyOptions(this.oneKeyForm.projectNo, { keepCurrentIfMissing: true }) |
|
|
this.loadOneKeyProofingApplyOptions(this.oneKeyForm.projectNo, { keepCurrentIfMissing: true }) |
|
|
}).catch((e) => { |
|
|
}).catch((e) => { |
|
|
@ -4468,6 +4881,18 @@ export default { |
|
|
margin-bottom: 10px; |
|
|
margin-bottom: 10px; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.one-key-suggest-main { |
|
|
|
|
|
color: #303133; |
|
|
|
|
|
font-size: 12px; |
|
|
|
|
|
line-height: 18px; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.one-key-suggest-sub { |
|
|
|
|
|
color: #909399; |
|
|
|
|
|
font-size: 12px; |
|
|
|
|
|
line-height: 16px; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
.proof-grid-form { |
|
|
.proof-grid-form { |
|
|
padding: 0 8px; |
|
|
padding: 0 8px; |
|
|
} |
|
|
} |
|
|
|