Browse Source

2026-05-07

RoHs功能优化
master
fengyuan_yang 1 month ago
parent
commit
84bd0f0ff6
  1. 3
      src/api/rohs/rohs.js
  2. 264
      src/views/modules/rohs/rohsRecord.vue

3
src/api/rohs/rohs.js

@ -6,6 +6,9 @@ export const getRohsList = params => createAPI(`/rohs/list`, 'get', params);
// 获取详情
export const getRohsDetail = (site, referenceNo) => createAPI(`/rohs/info`, 'get', { site, referenceNo });
// 查询项目物料(用于RoHs材料明细选择)
export const getRohsProjectMaterialList = params => createAPI(`/rohs/projectMaterialList`, 'get', params);
// 新增
export const saveRohs = data => createAPI(`/rohs/save`, 'post', data);

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

@ -324,11 +324,28 @@
<!-- 材料信息 -->
<el-tab-pane label="材料信息" name="materialInfo">
<div style="height: 635px">
<el-form :inline="true" label-position="top" :model="modalData" style="margin-top: -5px;">
<el-form-item label="材料IFS编号/IFS Part No.">
<el-input v-model="modalData.ifsPartNo" style="width: 190px"></el-input>
<el-form :inline="true" label-position="top" :model="modalData" style="margin-top: -15px;">
<el-form-item label=" ">
<el-button type="primary" v-if="!showModalFlag" @click="openProjectMaterialDialog">新增材料</el-button>
<el-button type="danger" v-if="!showModalFlag" @click="removeSelectedMaterialRows">删除材料</el-button>
</el-form-item>
</el-form>
<el-table
ref="rohsMaterialTable"
class="rohs-material-table"
border
:data="modalData.materialList"
@selection-change="materialSelectionChange"
:header-cell-style="materialDialogHeaderCellStyle"
:height="585"
style="width: 100%">
<el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column>
<el-table-column type="index" label="序号" width="50" header-align="center" align="center"></el-table-column>
<el-table-column prop="testPartNo" label="PLM物料编码/Test Part No." min-width="180" header-align="center" align="left" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="finalPartNo" label="IFS物料编码/Final Part No." min-width="180" header-align="center" align="left" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="customerPartNo" label="客户料号/Customer Part No." min-width="180" header-align="center" align="left" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="partDesc" label="描述/Part Desc." min-width="220" header-align="center" align="left" :show-overflow-tooltip="true"></el-table-column>
</el-table>
</div>
</el-tab-pane>
</el-tabs>
@ -383,6 +400,56 @@
</el-form>
</el-dialog>
<el-dialog title="选择项目物料" top="15vh" width="75%" :close-on-click-modal="false" v-drag :visible.sync="projectMaterialDialogFlag">
<el-form :inline="true" label-position="top" :model="projectMaterialSearchData">
<el-form-item label="PLM物料编码/Test Part No.">
<el-input v-model="projectMaterialSearchData.testPartNo" clearable style="width: 150px"></el-input>
</el-form-item>
<el-form-item label="描述/Part Desc">
<el-input v-model="projectMaterialSearchData.partDesc" clearable style="width: 150px"></el-input>
</el-form-item>
<el-form-item label="IFS物料编码/Final Part No.">
<el-input v-model="projectMaterialSearchData.finalPartNo" clearable style="width: 150px"></el-input>
</el-form-item>
<el-form-item label="客户料号/Customer Part No.">
<el-input v-model="projectMaterialSearchData.customerPartNo" clearable style="width: 150px"></el-input>
</el-form-item>
<el-form-item label=" ">
<el-button type="primary" @click="searchProjectMaterialList">查询</el-button>
</el-form-item>
</el-form>
<el-table
ref="projectMaterialTable"
class="rohs-material-table"
border
v-loading="projectMaterialLoading"
:data="projectMaterialList"
@selection-change="projectMaterialSelectionChange"
:header-cell-style="materialDialogHeaderCellStyle"
:height="320"
style="width: 100%">
<el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column>
<el-table-column prop="testPartNo" label="PLM物料编码/Test Part No." min-width="180" header-align="center" align="left" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="finalPartNo" label="IFS物料编码/Final Part No." min-width="180" header-align="center" align="left" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="customerPartNo" label="客户料号/Customer Part No." min-width="180" header-align="center" align="left" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="partDesc" label="描述/Part Desc." min-width="220" header-align="center" align="left" :show-overflow-tooltip="true"></el-table-column>
</el-table>
<el-pagination
style="margin-top: 10px"
@size-change="projectMaterialSizeChangeHandle"
@current-change="projectMaterialCurrentChangeHandle"
:current-page="projectMaterialPageIndex"
:page-sizes="[20, 50, 100]"
:page-size="projectMaterialPageSize"
:total="projectMaterialTotal"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<el-footer style="height:35px;margin-top: 10px;text-align:center">
<el-button type="primary" @click="confirmProjectMaterialSelection">确定</el-button>
<el-button type="primary" @click="projectMaterialDialogFlag = false">取消</el-button>
</el-footer>
</el-dialog>
<el-dialog title="驳回" top="30vh" :close-on-click-modal="false" v-drag :visible.sync="submitModalFlag" width="500px">
<el-form label-position="top">
<el-form-item label="驳回意见/Reject Opinion">
@ -581,9 +648,18 @@
<el-tab-pane label="材料信息" name="materialInfo">
<div :style="{height: secondHeight + 'px'}" style="margin-left: 5px;margin-top: 5px; overflow-y: auto;">
<el-form :inline="true" label-position="top" :model="currentRow">
<el-form-item label="材料IFS编号/IFS Part No."><el-input :value="currentRow.ifsPartNo || ''" disabled style="width: 205px"></el-input></el-form-item>
</el-form>
<el-table
class="rohs-material-table"
border
:data="currentRow.materialList || []"
:height="secondHeight - 10"
style="width: 100%">
<el-table-column type="index" label="序号" width="50" header-align="center" align="center"></el-table-column>
<el-table-column prop="testPartNo" label="PLM物料编码/Test Part No." min-width="180" header-align="center" align="left" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="finalPartNo" label="IFS物料编码/Final Part No." min-width="180" header-align="center" align="left" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="customerPartNo" label="客户料号/Customer Part No." min-width="180" header-align="center" align="left" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="partDesc" label="描述/Part Desc." min-width="220" header-align="center" align="left" :show-overflow-tooltip="true"></el-table-column>
</el-table>
</div>
</el-tab-pane>
@ -716,12 +792,26 @@ export default {
modalFlag: false,
uploadDialog: false,
chooseProjectListFlag: false,
projectMaterialDialogFlag: false,
searchProjectData: {
site: '',
projectId: undefined,
projectName: undefined,
customerId: undefined,
},
projectMaterialSearchData: {
testPartNo: '',
partDesc: '',
finalPartNo: '',
customerPartNo: ''
},
projectMaterialList: [],
projectMaterialSelections: [],
materialSelections: [],
projectMaterialPageIndex: 1,
projectMaterialPageSize: 20,
projectMaterialTotal: 0,
projectMaterialLoading: false,
projectList: [],
fileList: [],
approvalList: [],
@ -783,6 +873,7 @@ export default {
npdRemark: '',
isSameMaterialDiffSize: '',
ifsPartNo: '',
materialList: [],
createBy2: '',
isReject: 'Y',
tpProcessControl: 'N',
@ -806,6 +897,12 @@ export default {
})
},
methods: {
materialDialogHeaderCellStyle () {
return {
whiteSpace: 'nowrap',
wordBreak: 'keep-all'
}
},
displayYesNo (value) {
if (value === 'Y') {
return '是'
@ -891,10 +988,16 @@ export default {
} else {
this.currentRow = row || {}
}
if (!Array.isArray(this.currentRow.materialList)) {
this.$set(this.currentRow, 'materialList', [])
}
this.loadCurrentRowNames()
this.refreshCurrentTabTable()
}).catch(() => {
this.currentRow = row || {}
if (!Array.isArray(this.currentRow.materialList)) {
this.$set(this.currentRow, 'materialList', [])
}
this.loadCurrentRowNames()
this.refreshCurrentTabTable()
})
@ -902,6 +1005,9 @@ export default {
currentChange (val) {
this.currentRow = val || {}
if (val) {
if (!Array.isArray(this.currentRow.materialList)) {
this.$set(this.currentRow, 'materialList', [])
}
this.loadCurrentRowNames()
this.refreshCurrentTabTable()
} else {
@ -1156,6 +1262,18 @@ export default {
this.uploadDialog = false
this.submitModalFlag = false
this.rejectOpinion = ''
this.projectMaterialDialogFlag = false
this.projectMaterialSelections = []
this.materialSelections = []
this.projectMaterialPageIndex = 1
this.projectMaterialTotal = 0
this.projectMaterialList = []
this.projectMaterialSearchData = {
testPartNo: '',
partDesc: '',
finalPartNo: '',
customerPartNo: ''
}
this.showModalFlag = !!(row && row.status === '已完成')
if (row) {
@ -1166,6 +1284,7 @@ export default {
this.$set(this.modalData, 'qualificationDocumentsNeededList', this.modalData.qualificationDocumentsNeeded ? this.modalData.qualificationDocumentsNeeded.split(';').filter(item => item) : [])
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 : [])
// Initialize names for display if needed
this.$set(this.modalData, 'applicantName', '')
this.$set(this.modalData, 'pmName', '')
@ -1264,6 +1383,7 @@ export default {
npdRemark: '',
isSameMaterialDiffSize: '',
ifsPartNo: '',
materialList: [],
createBy2: '',
isReject: 'Y',
tpProcessControl: 'N',
@ -1280,6 +1400,14 @@ export default {
this.modalData.qualificationDocumentsNeeded = this.modalData.qualificationDocumentsNeededList.join(';')
this.modalData.testReportIncludingItems = this.modalData.testReportIncludingItemsList.join(';')
this.modalData.materialClassify = this.modalData.materialClassifyList.join(';')
this.modalData.materialList = (this.modalData.materialList || []).map((item, index) => {
return {
...item,
lineNo: index + 1,
projectId: this.modalData.projectId
}
})
this.modalData.ifsPartNo = this.modalData.materialList.length > 0 ? this.modalData.materialList[0].testPartNo : ''
const submitMethod = this.modalTitle === 'RoHs 新增' ? api.saveRohs : api.updateRohs
submitMethod(this.modalData).then(({data}) => {
@ -1387,6 +1515,116 @@ export default {
})
})
},
openProjectMaterialDialog () {
if (!this.modalData.projectId) {
this.$message.warning('请先选择项目编码')
return
}
if (!this.modalData.endCustomer) {
this.$message.warning('请先选择最终客户')
return
}
this.projectMaterialDialogFlag = true
this.projectMaterialPageIndex = 1
this.searchProjectMaterialList()
},
searchProjectMaterialList () {
if (!this.modalData.projectId) {
this.projectMaterialList = []
this.projectMaterialTotal = 0
return
}
this.projectMaterialLoading = true
const params = {
page: this.projectMaterialPageIndex,
limit: this.projectMaterialPageSize,
site: this.$store.state.user.site,
projectId: this.modalData.projectId,
endCustomer: this.modalData.endCustomer,
testPartNo: this.projectMaterialSearchData.testPartNo,
partDesc: this.projectMaterialSearchData.partDesc,
finalPartNo: this.projectMaterialSearchData.finalPartNo,
customerPartNo: this.projectMaterialSearchData.customerPartNo
}
api.getRohsProjectMaterialList(params).then(({data}) => {
if (data && data.code === 0 && data.page) {
this.projectMaterialList = data.page.list || []
this.projectMaterialTotal = data.page.totalCount || 0
this.$nextTick(() => {
if (this.$refs.projectMaterialTable) {
this.$refs.projectMaterialTable.clearSelection()
}
})
} else {
this.projectMaterialList = []
this.projectMaterialTotal = 0
this.$message.error(data.msg || '项目物料查询失败')
}
this.projectMaterialLoading = false
}).catch(() => {
this.projectMaterialList = []
this.projectMaterialTotal = 0
this.projectMaterialLoading = false
})
},
projectMaterialSelectionChange (rows) {
this.projectMaterialSelections = rows || []
},
projectMaterialSizeChangeHandle (val) {
this.projectMaterialPageSize = val
this.projectMaterialPageIndex = 1
this.searchProjectMaterialList()
},
projectMaterialCurrentChangeHandle (val) {
this.projectMaterialPageIndex = val
this.searchProjectMaterialList()
},
confirmProjectMaterialSelection () {
if (!this.projectMaterialSelections || this.projectMaterialSelections.length === 0) {
this.$message.warning('请至少选择一条项目物料')
return
}
this.appendMaterialRows(this.projectMaterialSelections)
this.projectMaterialDialogFlag = false
},
appendMaterialRows (rows) {
const materialList = Array.isArray(this.modalData.materialList) ? [...this.modalData.materialList] : []
const exists = new Set(materialList.map(item => item.testPartNo))
rows.forEach(row => {
const testPartNo = row.testPartNo || row.test_part_no
if (!testPartNo || exists.has(testPartNo)) {
return
}
exists.add(testPartNo)
materialList.push({
site: this.modalData.site,
referenceNo: this.modalData.referenceNo,
projectId: this.modalData.projectId,
testPartNo: testPartNo,
finalPartNo: row.finalPartNo || row.final_part_no || '',
customerPartNo: row.customerPartNo || row.customer_part_no || '',
partDesc: row.partDesc || row.part_desc || '',
partSpec: row.partSpec || row.part_spec || ''
})
})
this.$set(this.modalData, 'materialList', materialList)
},
materialSelectionChange (rows) {
this.materialSelections = rows || []
},
removeSelectedMaterialRows () {
if (this.showModalFlag) {
return
}
if (!this.materialSelections || this.materialSelections.length === 0) {
this.$message.warning('请先选择要删除的材料')
return
}
const removeSet = new Set(this.materialSelections.map(item => item.testPartNo))
const materialList = (this.modalData.materialList || []).filter(item => !removeSet.has(item.testPartNo))
this.$set(this.modalData, 'materialList', materialList)
this.materialSelections = []
},
// ======== chooseList ========
//
getBaseList (val, type) {
@ -1442,6 +1680,7 @@ export default {
this.modalData.endCustomerName = val.Customer_desc
this.modalData.projectId = ''
this.modalData.projectName = ''
this.$set(this.modalData, 'materialList', [])
}
}
if (this.tagNo === 103) {
@ -1482,6 +1721,7 @@ export default {
this.modalData.projectId = ''
this.modalData.projectName = ''
this.modalData.projectIdFlag = true
this.$set(this.modalData, 'materialList', [])
return
}
let params = {
@ -1499,18 +1739,21 @@ export default {
this.modalData.projectId = ''
this.modalData.projectName = ''
this.modalData.projectIdFlag = true
this.$set(this.modalData, 'materialList', [])
}
} else {
this.modalData.endCustomerName = ''
this.modalData.projectId = ''
this.modalData.projectName = ''
this.modalData.projectIdFlag = true
this.$set(this.modalData, 'materialList', [])
}
}).catch((error) => {
this.modalData.endCustomerName = ''
this.modalData.projectId = ''
this.modalData.projectName = ''
this.modalData.projectIdFlag = true
this.$set(this.modalData, 'materialList', [])
})
},
handleQueryProjectByCustomer() {
@ -1541,6 +1784,7 @@ export default {
})
},
projectClickRow(row) {
const oldProjectId = this.modalData.projectId
this.modalData.projectId = row.projectId
this.modalData.projectName = row.projectName
if (this.modalData.endCustomer && this.modalData.endCustomer !== '') {
@ -1549,6 +1793,9 @@ export default {
this.modalData.endCustomer = row.customerId
this.modalData.endCustomerName = row.customerName
}
if (oldProjectId && oldProjectId !== row.projectId) {
this.$set(this.modalData, 'materialList', [])
}
this.chooseProjectListFlag = false
},
searchProjectInfoList() {
@ -1757,4 +2004,9 @@ export default {
/deep/ .customer-tab .el-tabs__content {
padding: 0 !important;
}
/deep/ .rohs-material-table .el-table__header-wrapper th > .cell {
white-space: nowrap;
word-break: keep-all;
}
</style>
Loading…
Cancel
Save