Browse Source

2026-07-10

RoHS优化
master
fengyuan_yang 3 weeks ago
parent
commit
c91e107f2b
  1. 113
      src/views/modules/rohs/rohsRecord.vue

113
src/views/modules/rohs/rohsRecord.vue

@ -1591,6 +1591,7 @@ import { verifyData } from "@/api/chooselist/chooselist.js"
import { searchProjectInfoList } from "@/api/quotation/quotationInformation.js" import { searchProjectInfoList } from "@/api/quotation/quotationInformation.js"
import { queryCustomer } from "@/api/customer/customerInformation" import { queryCustomer } from "@/api/customer/customerInformation"
import { queryProjectByCustomer } from "@/api/project/project" import { queryProjectByCustomer } from "@/api/project/project"
import { queryBuList } from "@/api/base/bu"
import { createOfficialPartForRohs, getNextPartNo as getPartNextPartNo, getItemListByCodeNo as getPartItemListByCodeNo, getItemExclusionAlreadyExists as getPartItemExclusionAlreadyExists } from "@/api/part/partInformation.js" import { createOfficialPartForRohs, getNextPartNo as getPartNextPartNo, getItemListByCodeNo as getPartItemListByCodeNo, getItemExclusionAlreadyExists as getPartItemExclusionAlreadyExists } from "@/api/part/partInformation.js"
import uploadFileList from '../common/uploadFileList' import uploadFileList from '../common/uploadFileList'
import ossComponents from '../oss/ossComponents.vue' import ossComponents from '../oss/ossComponents.vue'
@ -2101,6 +2102,8 @@ export default {
operatorId: '', operatorId: '',
operatorName: '' operatorName: ''
}, },
userBuPermissionList: [],
userFirstBuNo: '',
filterVisible: false, filterVisible: false,
isFilterSearch: false, isFilterSearch: false,
filterSearchData: {}, filterSearchData: {},
@ -2362,15 +2365,6 @@ export default {
handleProcessChange (value) { handleProcessChange (value) {
const processValue = String(value || '').trim() const processValue = String(value || '').trim()
this.$set(this.modalData, 'process', processValue) 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) { isRohsFieldDisabledWithFallback (primaryFieldId, fallbackFieldId) {
if (this.showModalFlag) { if (this.showModalFlag) {
@ -2649,6 +2643,65 @@ export default {
} }
this.applyHsfStandardDefaultByCustomer(formData) this.applyHsfStandardDefaultByCustomer(formData)
}, },
resolveFirstBuNoFromPermissionList (rows) {
if (!Array.isArray(rows)) {
return ''
}
const firstRow = rows.find(item => item && String(item.buNo || item.bu_no || '').trim())
return firstRow ? String(firstRow.buNo || firstRow.bu_no || '').trim() : ''
},
loadCurrentUserBuPermissionList (forceRefresh = false) {
if (!forceRefresh && Array.isArray(this.userBuPermissionList) && this.userBuPermissionList.length > 0) {
return Promise.resolve(this.userBuPermissionList)
}
const site = this.modalData.site || this.$store.state.user.site
const username = this.$store.state.user.name
if (!site || !username) {
this.userBuPermissionList = []
this.userFirstBuNo = ''
return Promise.resolve([])
}
return queryBuList({
site: site,
username: username
}).then(({data}) => {
if (data && data.code === 0 && Array.isArray(data.rows)) {
this.userBuPermissionList = data.rows
this.userFirstBuNo = this.resolveFirstBuNoFromPermissionList(data.rows)
} else {
this.userBuPermissionList = []
this.userFirstBuNo = ''
}
return this.userBuPermissionList
}).catch(() => {
this.userBuPermissionList = []
this.userFirstBuNo = ''
return []
})
},
ensureModalBuNo (showWarning = false, allowUserFirstBuFallback = true) {
const currentBuNo = String((this.modalData && this.modalData.buNo) || '').trim()
if (currentBuNo) {
return Promise.resolve(currentBuNo)
}
if (!allowUserFirstBuFallback) {
if (showWarning) {
this.$message.warning('当前单据bu_no为空,无法查询HSF审批人')
}
return Promise.resolve('')
}
return this.loadCurrentUserBuPermissionList(false).then((rows) => {
const firstBuNo = this.resolveFirstBuNoFromPermissionList(rows)
if (firstBuNo) {
this.$set(this.modalData, 'buNo', firstBuNo)
return firstBuNo
}
if (showWarning) {
this.$message.warning('当前用户未配置BU权限,无法查询HSF审批人')
}
return ''
})
},
resolveOperatorNameById (operatorId) { resolveOperatorNameById (operatorId) {
const normalizedId = String(operatorId || '').trim() const normalizedId = String(operatorId || '').trim()
if (!normalizedId) { if (!normalizedId) {
@ -2777,16 +2830,17 @@ export default {
if (this.isRohsFieldDisabled('hsfApprover')) { if (this.isRohsFieldDisabled('hsfApprover')) {
return return
} }
if (!this.modalData || !String(this.modalData.process || '').trim()) {
this.$message.warning('请先选择工艺')
return
}
this.loadHsfApproverByCurrentProcess(false).then(() => {
if (!this.hsfApproverOptionList || this.hsfApproverOptionList.length === 0) {
this.$message.warning('未查询到可选HSF审批人')
this.ensureModalBuNo(true, !this.isEditMode).then((buNo) => {
if (!buNo) {
return return
} }
this.hsfApproverFlag = true
this.loadHsfApproverByCurrentBuNo(false).then(() => {
if (!this.hsfApproverOptionList || this.hsfApproverOptionList.length === 0) {
this.$message.warning('未查询到可选HSF审批人')
return
}
this.hsfApproverFlag = true
})
}) })
}, },
openHsfApproverDialog () { openHsfApproverDialog () {
@ -2918,7 +2972,16 @@ export default {
this.$set(this.modalData, 'relatedPeople', '') this.$set(this.modalData, 'relatedPeople', '')
this.$set(this.modalData, 'relatedPeopleName', '') this.$set(this.modalData, 'relatedPeopleName', '')
}, },
loadHsfApproverByCurrentProcess (forceSelectAll = false) {
initHsfApproverForNewRecord () {
this.clearHsfApproverFields(false)
this.ensureModalBuNo(false, true).then((buNo) => {
if (!buNo) {
return
}
this.loadHsfApproverByCurrentBuNo(true)
})
},
loadHsfApproverByCurrentBuNo (forceSelectAll = false) {
if (!this.modalData || !this.modalData.site) { if (!this.modalData || !this.modalData.site) {
this.hsfApproverOptionList = [] this.hsfApproverOptionList = []
this.hsfApproverDisplayList = [] this.hsfApproverDisplayList = []
@ -2928,10 +2991,10 @@ export default {
} }
return Promise.resolve() return Promise.resolve()
} }
const buNo = String(this.modalData.process || '').trim()
const buNo = String(this.modalData.buNo || '').trim()
if (!buNo) { if (!buNo) {
if (forceSelectAll) { if (forceSelectAll) {
this.$message.warning('请先选择工艺')
this.$message.warning('当前单据未维护BU,无法加载HSF审批人')
this.clearHsfApproverFields(false) this.clearHsfApproverFields(false)
} }
this.hsfApproverOptionList = [] this.hsfApproverOptionList = []
@ -3672,7 +3735,7 @@ export default {
this.$set(this.modalData, 'materialClassifyList', this.modalData.materialClassify ? this.modalData.materialClassify.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, 'materialList', Array.isArray(this.modalData.materialList) ? this.modalData.materialList : [])
this.$set(this.modalData, 'hsfApproverCodeList', this.modalData.hsfApprover ? this.modalData.hsfApprover.split(';').filter(item => item) : []) this.$set(this.modalData, 'hsfApproverCodeList', this.modalData.hsfApprover ? this.modalData.hsfApprover.split(';').filter(item => item) : [])
this.$set(this.modalData, 'buNo', this.modalData.process || '')
this.$set(this.modalData, 'buNo', String(this.modalData.buNo || '').trim())
this.$set(this.modalData, 'isAhGrade', this.normalizeCheckboxFlag(this.modalData.isAhGrade)) this.$set(this.modalData, 'isAhGrade', this.normalizeCheckboxFlag(this.modalData.isAhGrade))
this.$set(this.modalData, 'validUntilValue', this.normalizeValidUntilValue(this.modalData.validUntilValue)) this.$set(this.modalData, 'validUntilValue', this.normalizeValidUntilValue(this.modalData.validUntilValue))
this.syncHsfApproverFields() this.syncHsfApproverFields()
@ -3686,7 +3749,12 @@ export default {
this.$set(this.modalData, 'tpProcessControl', 'N') this.$set(this.modalData, 'tpProcessControl', 'N')
this.$set(this.modalData, 'csProcessControl', 'N') this.$set(this.modalData, 'csProcessControl', 'N')
this.loadModalButtonCondition() this.loadModalButtonCondition()
this.loadHsfApproverByCurrentProcess(false)
this.ensureModalBuNo(true, false).then((buNo) => {
if (!buNo) {
return
}
this.loadHsfApproverByCurrentBuNo(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)) 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(() => { }).catch(() => {
@ -3775,6 +3843,7 @@ export default {
tpProcessControl: 'N', tpProcessControl: 'N',
csProcessControl: 'N' csProcessControl: 'N'
} }
this.initHsfApproverForNewRecord()
this.nodeAuthorityLoaded = true this.nodeAuthorityLoaded = true
} }
}, },

Loading…
Cancel
Save