diff --git a/src/api/rohs/rohs.js b/src/api/rohs/rohs.js index d41465c..d1f47ed 100644 --- a/src/api/rohs/rohs.js +++ b/src/api/rohs/rohs.js @@ -33,5 +33,8 @@ export const getRohsButtonCondition = data => createAPI(`/rohs/buttonCondition`, // 获取节点字段权限(复用工程变更接口) export const getRohsNodeAuthority = data => createAPI(`/plm/changeManagement/getNodeAuthority`, 'post', data); +// 查询BM角色人员(复用技术参数卡接口) +export const searchBmUser = data => createAPI(`/technicalSpecification/searchBMUser`, 'post', data); + // 导出 export const exportRohs = params => createAPI(`/rohs/export`, 'get', params); diff --git a/src/views/modules/rohs/rohsRecord.vue b/src/views/modules/rohs/rohsRecord.vue index 45e0673..651d04d 100644 --- a/src/views/modules/rohs/rohsRecord.vue +++ b/src/views/modules/rohs/rohsRecord.vue @@ -71,6 +71,8 @@ + + @@ -310,7 +312,48 @@ - + + + HSF审批人/HSF Approver + HSF审批人/HSF Approver + + + + + + + + + + + + + + + @@ -672,6 +715,12 @@ + + + + + + @@ -966,6 +1015,7 @@ export default { projectMaterialTotal: 0, projectMaterialLoading: false, projectList: [], + hsfApproverOptionList: [], fileList: [], approvalList: [], plmRohsAuthorityArr: [], @@ -1021,6 +1071,10 @@ export default { expiredDate: '', fiberInformation: '', hsfStandard: '', + hsfApprover: '', + hsfApproverList: [], + relatedPeople: '', + buNo: '', validUntil: '', isMeetRohsRequirement: '', isAhGrade: '', @@ -1103,7 +1157,8 @@ export default { const fieldMapping = { materialClassify: 'materialClassifyList', qualificationDocumentsNeeded: 'qualificationDocumentsNeededList', - testReportIncludingItems: 'testReportIncludingItemsList' + testReportIncludingItems: 'testReportIncludingItemsList', + hsfApprover: 'hsfApproverList' } const mappedField = fieldMapping[fieldId] if (mappedField) { @@ -1166,6 +1221,101 @@ export default { this.$set(formData, 'hsfStandard', '') } }, + syncHsfApproverFields () { + const list = Array.isArray(this.modalData.hsfApproverList) + ? this.modalData.hsfApproverList.filter(item => item && item.trim()) + : [] + this.$set(this.modalData, 'hsfApproverList', list) + this.$set(this.modalData, 'hsfApprover', list.join(';')) + if (!list.includes(this.modalData.relatedPeople)) { + this.$set(this.modalData, 'relatedPeople', '') + } + }, + clearHsfApproverFields (clearBuNo = false) { + if (clearBuNo) { + this.$set(this.modalData, 'buNo', '') + } + this.hsfApproverOptionList = [] + this.$set(this.modalData, 'hsfApproverList', []) + this.$set(this.modalData, 'hsfApprover', '') + this.$set(this.modalData, 'relatedPeople', '') + }, + handleHsfApproverChange (val) { + this.$set(this.modalData, 'hsfApproverList', Array.isArray(val) ? val : []) + this.syncHsfApproverFields() + }, + loadHsfApproverByCurrentProject (forceSelectAll = false) { + if (!this.modalData || !this.modalData.site || !this.modalData.projectId) { + if (forceSelectAll) { + this.$message.warning('请先选择项目编码') + } + if (forceSelectAll) { + this.clearHsfApproverFields(false) + } + return Promise.resolve() + } + const queryByBu = (buNo) => { + if (!buNo) { + if (forceSelectAll) { + this.$message.warning('当前项目未维护BU,无法查询HSF审批人') + } + 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 = data.rows + const allApprovers = data.rows.map(item => item.operatorName).filter(item => item) + if (forceSelectAll) { + this.$set(this.modalData, 'hsfApproverList', allApprovers) + } + this.syncHsfApproverFields() + } else { + this.hsfApproverOptionList = [] + if (forceSelectAll) { + this.clearHsfApproverFields(false) + } + } + }).catch(() => { + this.hsfApproverOptionList = [] + 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(() => { + if (forceSelectAll) { + this.clearHsfApproverFields(false) + } + }) + }, isCurrentApprover () { return this.superAdmin || (this.modalData.createBy2 && this.modalData.createBy2.split(';').includes(this.createBy2)) }, @@ -1418,6 +1568,7 @@ export default { this.projectMaterialDialogFlag = false this.projectMaterialSelections = [] this.materialSelections = [] + this.hsfApproverOptionList = [] this.plmRohsAuthorityArr = [] this.nodeAuthorityLoaded = !row this.isEditMode = !!row @@ -1441,6 +1592,9 @@ export default { this.$set(this.modalData, 'testReportIncludingItemsList', this.modalData.testReportIncludingItems ? this.modalData.testReportIncludingItems.split(';').filter(item => item) : []) 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.syncHsfApproverFields() this.fillDisplayFields(this.modalData, row || {}) // 编辑时不允许修改最终客户和项目编码 this.$set(this.modalData, 'endCustomerFlag', true) @@ -1450,6 +1604,7 @@ export default { this.$set(this.modalData, 'tpProcessControl', 'N') this.$set(this.modalData, 'csProcessControl', 'N') this.loadModalButtonCondition() + this.loadHsfApproverByCurrentProject(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(() => { @@ -1512,6 +1667,10 @@ export default { expiredDate: '', fiberInformation: '', hsfStandard: '', + hsfApprover: '', + hsfApproverList: [], + relatedPeople: '', + buNo: '', validUntil: '', isMeetRohsRequirement: '', isAhGrade: '', @@ -1539,6 +1698,7 @@ export default { return } this.normalizeHsfStandardByCustomer(this.modalData) + this.syncHsfApproverFields() this.modalData.qualificationDocumentsNeeded = this.modalData.qualificationDocumentsNeededList.join(';') this.modalData.testReportIncludingItems = this.modalData.testReportIncludingItemsList.join(';') this.modalData.materialClassify = this.modalData.materialClassifyList.join(';') @@ -1605,6 +1765,7 @@ export default { return } this.normalizeHsfStandardByCustomer(this.modalData) + this.syncHsfApproverFields() if (!this.nodeAuthorityLoaded) { this.$message.warning('节点权限加载中,请稍后重试') return @@ -1920,7 +2081,9 @@ 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) { @@ -1960,8 +2123,10 @@ 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 = { @@ -1978,27 +2143,35 @@ 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 = { @@ -2013,20 +2186,30 @@ 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 { @@ -2036,6 +2219,7 @@ export default { if (oldProjectId && oldProjectId !== row.projectId) { this.$set(this.modalData, 'materialList', []) } + this.loadHsfApproverByCurrentProject(!this.isEditMode) this.chooseProjectListFlag = false }, searchProjectInfoList() { @@ -2055,6 +2239,8 @@ 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 = []