|
|
|
@ -970,6 +970,7 @@ export default { |
|
|
|
approvalList: [], |
|
|
|
plmRohsAuthorityArr: [], |
|
|
|
plmRohsMaterialAuthorityArr: [], |
|
|
|
nodeAuthorityLoaded: false, |
|
|
|
modalTitle: 'RoHs 新增', |
|
|
|
activeName: 'basicInfo', |
|
|
|
showModalFlag: false, |
|
|
|
@ -1059,8 +1060,10 @@ export default { |
|
|
|
if (!site || stepId === null || stepId === undefined || !this.menuId) { |
|
|
|
this.plmRohsAuthorityArr = [] |
|
|
|
this.plmRohsMaterialAuthorityArr = [] |
|
|
|
this.nodeAuthorityLoaded = true |
|
|
|
return Promise.resolve() |
|
|
|
} |
|
|
|
this.nodeAuthorityLoaded = false |
|
|
|
let params = { |
|
|
|
site: site, |
|
|
|
stepId: stepId, |
|
|
|
@ -1074,9 +1077,11 @@ export default { |
|
|
|
this.plmRohsAuthorityArr = [] |
|
|
|
this.plmRohsMaterialAuthorityArr = [] |
|
|
|
} |
|
|
|
this.nodeAuthorityLoaded = true |
|
|
|
}).catch(() => { |
|
|
|
this.plmRohsAuthorityArr = [] |
|
|
|
this.plmRohsMaterialAuthorityArr = [] |
|
|
|
this.nodeAuthorityLoaded = true |
|
|
|
}) |
|
|
|
}, |
|
|
|
rohsFieldFlag (fieldId) { |
|
|
|
@ -1099,6 +1104,60 @@ export default { |
|
|
|
canEditRohsMaterial () { |
|
|
|
return !this.showModalFlag && this.rohsMaterialFieldFlag('testPartNo') !== 'N' |
|
|
|
}, |
|
|
|
getRohsSubmitFieldValue (fieldId) { |
|
|
|
const fieldMapping = { |
|
|
|
materialClassify: 'materialClassifyList', |
|
|
|
qualificationDocumentsNeeded: 'qualificationDocumentsNeededList', |
|
|
|
testReportIncludingItems: 'testReportIncludingItemsList' |
|
|
|
} |
|
|
|
const mappedField = fieldMapping[fieldId] |
|
|
|
if (mappedField) { |
|
|
|
return this.modalData[mappedField] |
|
|
|
} |
|
|
|
return this.modalData[fieldId] |
|
|
|
}, |
|
|
|
isSubmitFieldEmpty (value) { |
|
|
|
if (Array.isArray(value)) { |
|
|
|
return value.length === 0 |
|
|
|
} |
|
|
|
if (typeof value === 'string') { |
|
|
|
return value.trim() === '' |
|
|
|
} |
|
|
|
return !value |
|
|
|
}, |
|
|
|
validateSubmitRequiredFields () { |
|
|
|
if (this.plmRohsAuthorityArr && this.plmRohsAuthorityArr.length > 0) { |
|
|
|
for (let i = 0; i < this.plmRohsAuthorityArr.length; i++) { |
|
|
|
const fieldConfig = this.plmRohsAuthorityArr[i] |
|
|
|
if (fieldConfig.required !== 'Y') { |
|
|
|
continue |
|
|
|
} |
|
|
|
const value = this.getRohsSubmitFieldValue(fieldConfig.fieldId) |
|
|
|
if (this.isSubmitFieldEmpty(value)) { |
|
|
|
this.$message.warning((fieldConfig.fieldName || fieldConfig.fieldId) + '不能为空!') |
|
|
|
return false |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
const requiredMaterialFields = (this.plmRohsMaterialAuthorityArr || []).filter(item => item.required === 'Y') |
|
|
|
if (requiredMaterialFields.length > 0) { |
|
|
|
const materialList = Array.isArray(this.modalData.materialList) ? this.modalData.materialList : [] |
|
|
|
if (materialList.length === 0) { |
|
|
|
this.$message.warning('材料信息不能为空!') |
|
|
|
return false |
|
|
|
} |
|
|
|
for (let i = 0; i < requiredMaterialFields.length; i++) { |
|
|
|
const fieldConfig = requiredMaterialFields[i] |
|
|
|
const valid = materialList.every(item => !this.isSubmitFieldEmpty(item[fieldConfig.fieldId])) |
|
|
|
if (!valid) { |
|
|
|
this.$message.warning((fieldConfig.fieldName || fieldConfig.fieldId) + '不能为空!') |
|
|
|
return false |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return true |
|
|
|
}, |
|
|
|
materialDialogHeaderCellStyle () { |
|
|
|
return { |
|
|
|
whiteSpace: 'nowrap', |
|
|
|
@ -1368,6 +1427,7 @@ export default { |
|
|
|
this.materialSelections = [] |
|
|
|
this.plmRohsAuthorityArr = [] |
|
|
|
this.plmRohsMaterialAuthorityArr = [] |
|
|
|
this.nodeAuthorityLoaded = false |
|
|
|
this.projectMaterialPageIndex = 1 |
|
|
|
this.projectMaterialTotal = 0 |
|
|
|
this.projectMaterialList = [] |
|
|
|
@ -1551,6 +1611,13 @@ export default { |
|
|
|
this.$message.warning('单据主键信息缺失,无法提交审批') |
|
|
|
return |
|
|
|
} |
|
|
|
if (!this.nodeAuthorityLoaded) { |
|
|
|
this.$message.warning('节点权限加载中,请稍后重试') |
|
|
|
return |
|
|
|
} |
|
|
|
if (!this.validateSubmitRequiredFields()) { |
|
|
|
return |
|
|
|
} |
|
|
|
this.submitLoading = true |
|
|
|
let params = { |
|
|
|
site: this.modalData.site, |
|
|
|
|