|
|
|
@ -168,7 +168,7 @@ |
|
|
|
<el-input v-model="modalData.site" disabled style="width: 95px"></el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="工艺"> |
|
|
|
<dict-data-select v-model="modalData.process" clearable :disabled="isRohsFieldDisabled('process')" style="width: 121px" dict-type="rohs_process"></dict-data-select> |
|
|
|
<dict-data-select v-model="modalData.process" clearable @change="handleProcessChange" :disabled="isProcessFieldDisabled()" style="width: 121px" dict-type="rohs_process"></dict-data-select> |
|
|
|
</el-form-item> |
|
|
|
</el-form> |
|
|
|
<el-form :inline="true" label-position="top" :model="modalData"> |
|
|
|
@ -1359,6 +1359,25 @@ export default { |
|
|
|
} |
|
|
|
return this.rohsFieldFlag(fieldId) === 'N' |
|
|
|
}, |
|
|
|
isProcessFieldDisabled () { |
|
|
|
if (this.isEditMode) { |
|
|
|
return true |
|
|
|
} |
|
|
|
return this.isRohsFieldDisabled('process') |
|
|
|
}, |
|
|
|
handleProcessChange (value) { |
|
|
|
const processValue = String(value || '').trim() |
|
|
|
this.$set(this.modalData, 'process', processValue) |
|
|
|
this.$set(this.modalData, 'buNo', processValue) |
|
|
|
if (this.isEditMode) { |
|
|
|
return |
|
|
|
} |
|
|
|
this.clearHsfApproverFields(false) |
|
|
|
if (!processValue) { |
|
|
|
return |
|
|
|
} |
|
|
|
this.loadHsfApproverByCurrentProcess(true) |
|
|
|
}, |
|
|
|
isRohsFieldDisabledWithFallback (primaryFieldId, fallbackFieldId) { |
|
|
|
if (this.showModalFlag) { |
|
|
|
return true |
|
|
|
@ -1586,11 +1605,11 @@ export default { |
|
|
|
if (this.isRohsFieldDisabled('hsfApprover')) { |
|
|
|
return |
|
|
|
} |
|
|
|
if (!this.modalData || !this.modalData.projectId) { |
|
|
|
this.$message.warning('请先选择项目编码') |
|
|
|
if (!this.modalData || !String(this.modalData.process || '').trim()) { |
|
|
|
this.$message.warning('请先选择工艺') |
|
|
|
return |
|
|
|
} |
|
|
|
this.loadHsfApproverByCurrentProject(false).then(() => { |
|
|
|
this.loadHsfApproverByCurrentProcess(false).then(() => { |
|
|
|
if (!this.hsfApproverOptionList || this.hsfApproverOptionList.length === 0) { |
|
|
|
this.$message.warning('未查询到可选HSF审批人') |
|
|
|
return |
|
|
|
@ -1659,11 +1678,8 @@ export default { |
|
|
|
this.$set(this.modalData, 'hsfApprover', '') |
|
|
|
this.$set(this.modalData, 'relatedPeople', '') |
|
|
|
}, |
|
|
|
loadHsfApproverByCurrentProject (forceSelectAll = false) { |
|
|
|
if (!this.modalData || !this.modalData.site || !this.modalData.projectId) { |
|
|
|
if (forceSelectAll) { |
|
|
|
this.$message.warning('请先选择项目编码') |
|
|
|
} |
|
|
|
loadHsfApproverByCurrentProcess (forceSelectAll = false) { |
|
|
|
if (!this.modalData || !this.modalData.site) { |
|
|
|
this.hsfApproverOptionList = [] |
|
|
|
this.hsfApproverDisplayList = [] |
|
|
|
this.hsfApproverSelectionCache = [] |
|
|
|
@ -1672,72 +1688,44 @@ export default { |
|
|
|
} |
|
|
|
return Promise.resolve() |
|
|
|
} |
|
|
|
const queryByBu = (buNo) => { |
|
|
|
if (!buNo) { |
|
|
|
if (forceSelectAll) { |
|
|
|
this.$message.warning('当前项目未维护BU,无法查询HSF审批人') |
|
|
|
} |
|
|
|
this.hsfApproverOptionList = [] |
|
|
|
this.hsfApproverDisplayList = [] |
|
|
|
const buNo = String(this.modalData.process || '').trim() |
|
|
|
if (!buNo) { |
|
|
|
if (forceSelectAll) { |
|
|
|
this.$message.warning('请先选择工艺') |
|
|
|
this.clearHsfApproverFields(false) |
|
|
|
} |
|
|
|
this.hsfApproverOptionList = [] |
|
|
|
this.hsfApproverDisplayList = [] |
|
|
|
this.hsfApproverSelectionCache = [] |
|
|
|
return Promise.resolve() |
|
|
|
} |
|
|
|
const params = { |
|
|
|
site: this.modalData.site, |
|
|
|
buNo: buNo, |
|
|
|
roleNo: 'R015' |
|
|
|
} |
|
|
|
return api.searchBmUser(params).then(({data}) => { |
|
|
|
if (data && data.code === 0 && Array.isArray(data.rows)) { |
|
|
|
this.hsfApproverOptionList = this.normalizeHsfApproverOptionList(data.rows) |
|
|
|
this.filterHsfApproverOptions() |
|
|
|
this.hsfApproverSelectionCache = [] |
|
|
|
if (forceSelectAll) { |
|
|
|
this.clearHsfApproverFields(false) |
|
|
|
} |
|
|
|
return Promise.resolve() |
|
|
|
} |
|
|
|
const params = { |
|
|
|
site: this.modalData.site, |
|
|
|
buNo: buNo, |
|
|
|
roleNo: 'R015' |
|
|
|
} |
|
|
|
return api.searchBmUser(params).then(({data}) => { |
|
|
|
if (data && data.code === 0 && Array.isArray(data.rows)) { |
|
|
|
this.hsfApproverOptionList = this.normalizeHsfApproverOptionList(data.rows) |
|
|
|
this.filterHsfApproverOptions() |
|
|
|
this.hsfApproverSelectionCache = [] |
|
|
|
if (forceSelectAll) { |
|
|
|
const defaultSelectedNames = this.hsfApproverOptionList.map(item => item.operatorName).filter(item => item) |
|
|
|
this.$set(this.modalData, 'hsfApproverList', defaultSelectedNames) |
|
|
|
} |
|
|
|
this.syncHsfApproverFields() |
|
|
|
} else { |
|
|
|
this.hsfApproverOptionList = [] |
|
|
|
this.hsfApproverDisplayList = [] |
|
|
|
this.hsfApproverSelectionCache = [] |
|
|
|
if (forceSelectAll) { |
|
|
|
this.clearHsfApproverFields(false) |
|
|
|
} |
|
|
|
const defaultSelectedNames = this.hsfApproverOptionList.map(item => item.operatorName).filter(item => item) |
|
|
|
this.$set(this.modalData, 'hsfApproverList', defaultSelectedNames) |
|
|
|
} |
|
|
|
}).catch(() => { |
|
|
|
this.syncHsfApproverFields() |
|
|
|
} else { |
|
|
|
this.hsfApproverOptionList = [] |
|
|
|
this.hsfApproverDisplayList = [] |
|
|
|
this.hsfApproverSelectionCache = [] |
|
|
|
if (forceSelectAll) { |
|
|
|
this.clearHsfApproverFields(false) |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
if (this.modalData.buNo) { |
|
|
|
return queryByBu(this.modalData.buNo) |
|
|
|
} |
|
|
|
const projectParams = { |
|
|
|
site: this.modalData.site, |
|
|
|
projectId: this.modalData.projectId |
|
|
|
} |
|
|
|
if (this.modalData.endCustomer) { |
|
|
|
projectParams.customerId = this.modalData.endCustomer |
|
|
|
} |
|
|
|
return queryProjectByCustomer(projectParams).then(({data}) => { |
|
|
|
if (data && data.code === 0 && data.rows && data.rows.length === 1) { |
|
|
|
const project = data.rows[0] |
|
|
|
this.$set(this.modalData, 'buNo', project.buNo || project.bu_no || '') |
|
|
|
return queryByBu(this.modalData.buNo) |
|
|
|
} else { |
|
|
|
if (forceSelectAll) { |
|
|
|
this.clearHsfApproverFields(false) |
|
|
|
} |
|
|
|
} |
|
|
|
}).catch(() => { |
|
|
|
this.hsfApproverOptionList = [] |
|
|
|
this.hsfApproverDisplayList = [] |
|
|
|
this.hsfApproverSelectionCache = [] |
|
|
|
if (forceSelectAll) { |
|
|
|
this.clearHsfApproverFields(false) |
|
|
|
} |
|
|
|
@ -2218,7 +2206,7 @@ export default { |
|
|
|
this.$set(this.modalData, 'materialClassifyList', this.modalData.materialClassify ? this.modalData.materialClassify.split(';').filter(item => item) : []) |
|
|
|
this.$set(this.modalData, 'materialList', Array.isArray(this.modalData.materialList) ? this.modalData.materialList : []) |
|
|
|
this.$set(this.modalData, 'hsfApproverList', this.modalData.hsfApprover ? this.modalData.hsfApprover.split(';').filter(item => item) : []) |
|
|
|
this.$set(this.modalData, 'buNo', this.modalData.buNo || '') |
|
|
|
this.$set(this.modalData, 'buNo', this.modalData.process || '') |
|
|
|
this.$set(this.modalData, 'validUntilValue', this.normalizeValidUntilValue(this.modalData.validUntilValue)) |
|
|
|
this.syncHsfApproverFields() |
|
|
|
this.fillDisplayFields(this.modalData, row || {}) |
|
|
|
@ -2230,7 +2218,7 @@ export default { |
|
|
|
this.$set(this.modalData, 'tpProcessControl', 'N') |
|
|
|
this.$set(this.modalData, 'csProcessControl', 'N') |
|
|
|
this.loadModalButtonCondition() |
|
|
|
this.loadHsfApproverByCurrentProject(false) |
|
|
|
this.loadHsfApproverByCurrentProcess(false) |
|
|
|
this.loadNodeAuthority(this.modalData.site || row.site, this.modalData.stepId !== null && this.modalData.stepId !== undefined ? this.modalData.stepId : (row.stepId !== null && row.stepId !== undefined ? row.stepId : 10)) |
|
|
|
} |
|
|
|
}).catch(() => { |
|
|
|
@ -2717,9 +2705,7 @@ export default { |
|
|
|
this.modalData.endCustomerName = val.Customer_desc |
|
|
|
this.modalData.projectId = '' |
|
|
|
this.modalData.projectName = '' |
|
|
|
this.modalData.buNo = '' |
|
|
|
this.$set(this.modalData, 'materialList', []) |
|
|
|
this.clearHsfApproverFields(false) |
|
|
|
} |
|
|
|
} |
|
|
|
if (this.tagNo === 103 || this.tagNo === 2001 || this.tagNo === 2054) { |
|
|
|
@ -2759,10 +2745,8 @@ export default { |
|
|
|
this.modalData.endCustomerName = '' |
|
|
|
this.modalData.projectId = '' |
|
|
|
this.modalData.projectName = '' |
|
|
|
this.modalData.buNo = '' |
|
|
|
this.modalData.projectIdFlag = true |
|
|
|
this.$set(this.modalData, 'materialList', []) |
|
|
|
this.clearHsfApproverFields(false) |
|
|
|
return |
|
|
|
} |
|
|
|
let params = { |
|
|
|
@ -2779,35 +2763,27 @@ export default { |
|
|
|
this.modalData.endCustomerName = '' |
|
|
|
this.modalData.projectId = '' |
|
|
|
this.modalData.projectName = '' |
|
|
|
this.modalData.buNo = '' |
|
|
|
this.modalData.projectIdFlag = true |
|
|
|
this.$set(this.modalData, 'materialList', []) |
|
|
|
this.clearHsfApproverFields(false) |
|
|
|
} |
|
|
|
} else { |
|
|
|
this.modalData.endCustomerName = '' |
|
|
|
this.modalData.projectId = '' |
|
|
|
this.modalData.projectName = '' |
|
|
|
this.modalData.buNo = '' |
|
|
|
this.modalData.projectIdFlag = true |
|
|
|
this.$set(this.modalData, 'materialList', []) |
|
|
|
this.clearHsfApproverFields(false) |
|
|
|
} |
|
|
|
}).catch((error) => { |
|
|
|
this.modalData.endCustomerName = '' |
|
|
|
this.modalData.projectId = '' |
|
|
|
this.modalData.projectName = '' |
|
|
|
this.modalData.buNo = '' |
|
|
|
this.modalData.projectIdFlag = true |
|
|
|
this.$set(this.modalData, 'materialList', []) |
|
|
|
this.clearHsfApproverFields(false) |
|
|
|
}) |
|
|
|
}, |
|
|
|
handleQueryProjectByCustomer() { |
|
|
|
if (!this.modalData.projectId) { |
|
|
|
this.modalData.projectName = '' |
|
|
|
this.modalData.buNo = '' |
|
|
|
this.clearHsfApproverFields(false) |
|
|
|
return |
|
|
|
} |
|
|
|
let params = { |
|
|
|
@ -2822,30 +2798,20 @@ export default { |
|
|
|
if (data.rows && data.rows.length === 1) { |
|
|
|
const project = data.rows[0] |
|
|
|
this.modalData.projectName = project.projectName || project.Project_name || '' |
|
|
|
this.modalData.buNo = project.buNo || project.bu_no || '' |
|
|
|
const forceSelectAll = !this.isEditMode |
|
|
|
this.loadHsfApproverByCurrentProject(forceSelectAll) |
|
|
|
} else { |
|
|
|
this.modalData.projectName = '' |
|
|
|
this.modalData.buNo = '' |
|
|
|
this.clearHsfApproverFields(false) |
|
|
|
} |
|
|
|
} else { |
|
|
|
this.modalData.projectName = '' |
|
|
|
this.modalData.buNo = '' |
|
|
|
this.clearHsfApproverFields(false) |
|
|
|
} |
|
|
|
}).catch((error) => { |
|
|
|
this.modalData.projectName = '' |
|
|
|
this.modalData.buNo = '' |
|
|
|
this.clearHsfApproverFields(false) |
|
|
|
}) |
|
|
|
}, |
|
|
|
projectClickRow(row) { |
|
|
|
const oldProjectId = this.modalData.projectId |
|
|
|
this.modalData.projectId = row.projectId |
|
|
|
this.modalData.projectName = row.projectName |
|
|
|
this.modalData.buNo = row.buNo || row.bu_no || '' |
|
|
|
if (this.modalData.endCustomer && this.modalData.endCustomer !== '') { |
|
|
|
// do nothing |
|
|
|
} else { |
|
|
|
@ -2855,7 +2821,6 @@ export default { |
|
|
|
if (oldProjectId && oldProjectId !== row.projectId) { |
|
|
|
this.$set(this.modalData, 'materialList', []) |
|
|
|
} |
|
|
|
this.loadHsfApproverByCurrentProject(!this.isEditMode) |
|
|
|
this.chooseProjectListFlag = false |
|
|
|
}, |
|
|
|
searchProjectInfoList() { |
|
|
|
@ -2875,8 +2840,6 @@ export default { |
|
|
|
this.modalData.projectName = rows[0].projectName |
|
|
|
this.modalData.endCustomer = rows[0].customerId |
|
|
|
this.modalData.endCustomerName = rows[0].customerName |
|
|
|
this.modalData.buNo = rows[0].buNo || rows[0].bu_no || '' |
|
|
|
this.loadHsfApproverByCurrentProject(!this.isEditMode) |
|
|
|
} |
|
|
|
} else { |
|
|
|
this.projectList = [] |
|
|
|
|