Browse Source

2026-05-08

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

3
src/api/rohs/rohs.js

@ -15,6 +15,9 @@ export const saveRohs = data => createAPI(`/rohs/save`, 'post', data);
// 修改
export const updateRohs = data => createAPI(`/rohs/update`, 'post', data);
// 仅保存材料明细(编辑时即时保存)
export const updateRohsMaterials = data => createAPI(`/rohs/updateMaterials`, 'post', data);
// 下达
export const issueRohs = data => createAPI(`/rohs/issue`, 'post', data);

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

@ -299,7 +299,7 @@
<!-- NPD 信息 -->
<el-tab-pane label="NPD 信息" name="npdInfo">
<div style="height: 635px">
<div style="height: 635px; overflow-y: auto;">
<el-form :inline="true" label-position="top" :model="modalData" style="margin-top: -5px;">
<el-form-item label="现有材料不同规格/Same Material Diff Size">
<el-radio-group v-model="modalData.isSameMaterialDiffSize" style="width: 190px">
@ -318,6 +318,24 @@
<el-input type="textarea" :rows="3" v-model="modalData.npdRemark" resize="none" style="width: 802px;height: 30px"></el-input>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="modalData" style="margin-top: 50px">
<el-form-item label="TDS属性/TDS Property" style="display: block;">
<oss-components
:save-visible="authFileSave"
:download-visible="authFileDownLoad"
:remove-visible="authFileRemove"
:preview-visible="authFilePreview"
:disabled="showModalFlag || modalData.status === '已完成'"
label="序列号"
:height="180"
style="margin-top: 2px"
:columns="fileColumnList"
:order-ref1="modalData.site || ''"
:order-ref2="modalData.referenceNo || ''"
order-ref3="tdsProperty">
</oss-components>
</el-form-item>
</el-form>
</div>
</el-tab-pane>
@ -398,6 +416,9 @@
<el-table-column label="项目名称" prop="projectName"/>
</el-table>
</el-form>
<el-footer style="height:35px;margin-top: 10px;text-align:center">
<el-button type="primary" @click="chooseProjectListFlag = false">关闭</el-button>
</el-footer>
</el-dialog>
<el-dialog title="选择项目物料" top="15vh" width="75%" :close-on-click-modal="false" v-drag :visible.sync="projectMaterialDialogFlag">
@ -446,7 +467,7 @@
</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-button type="primary" @click="projectMaterialDialogFlag = false">关闭</el-button>
</el-footer>
</el-dialog>
@ -643,16 +664,34 @@
<el-form :inline="true" label-position="top" :model="currentRow" style="margin-top: 50px">
<el-form-item label="备注说明/NPD Remark" style="display: block;"><el-input type="textarea" :rows="3" :value="currentRow.npdRemark || ''" disabled resize="none" style="width: 802px;height: 30px"></el-input></el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="currentRow" style="margin-top: 50px">
<el-form-item label="TDS属性/TDS Property" style="display: block;">
<oss-components
:save-visible="authFileSave"
:download-visible="authFileDownLoad"
:remove-visible="authFileRemove"
:preview-visible="authFilePreview"
:disabled="true"
label="序列号"
:height="180"
style="margin-top: 2px"
:columns="fileColumnList"
:order-ref1="currentRow.site || ''"
:order-ref2="currentRow.referenceNo || ''"
order-ref3="tdsProperty">
</oss-components>
</el-form-item>
</el-form>
</div>
</el-tab-pane>
<el-tab-pane label="材料信息" name="materialInfo">
<div :style="{height: secondHeight + 'px'}" style="margin-left: 5px;margin-top: 5px; overflow-y: auto;">
<div :style="{height: secondHeight + 'px'}" style="overflow-y: auto;">
<el-table
class="rohs-material-table"
border
:data="currentRow.materialList || []"
:height="secondHeight - 10"
:height="secondHeight"
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>
@ -761,7 +800,7 @@ export default {
columnSortable: false,
status: true,
fixed: '',
columnWidth: 240
columnWidth: 200
},
{
columnProp: 'createDate',
@ -773,7 +812,7 @@ export default {
columnSortable: false,
status: true,
fixed: '',
columnWidth: 140
columnWidth: 150
},
{
columnProp: 'createBy',
@ -785,7 +824,7 @@ export default {
columnSortable: false,
status: true,
fixed: '',
columnWidth: 140
columnWidth: 120
}
],
@ -1296,9 +1335,9 @@ export default {
this.$set(this.modalData, 'commGroup1Desc', '')
this.$set(this.modalData, 'commGroup2Desc', '')
this.$set(this.modalData, 'commGroup3Desc', '')
//
this.$set(this.modalData, 'endCustomerFlag', false)
this.$set(this.modalData, 'projectIdFlag', !this.modalData.endCustomer)
//
this.$set(this.modalData, 'endCustomerFlag', true)
this.$set(this.modalData, 'projectIdFlag', true)
this.$set(this.modalData, 'createBy2', '')
this.$set(this.modalData, 'isReject', 'Y')
this.$set(this.modalData, 'tpProcessControl', 'N')
@ -1584,18 +1623,42 @@ export default {
this.$message.warning('请至少选择一条项目物料')
return
}
this.appendMaterialRows(this.projectMaterialSelections)
this.projectMaterialDialogFlag = false
const appendResult = this.appendMaterialRows(this.projectMaterialSelections)
if (!appendResult.appendedCount) {
this.$message.warning('所选物料已存在,未新增数据')
return
}
if (!this.shouldPersistMaterialsImmediately()) {
this.$set(this.modalData, 'materialList', appendResult.materialList)
this.projectMaterialDialogFlag = false
this.$message.success('已加入材料列表,保存单据后写入数据库')
return
}
this.$confirm('确认新增选中材料?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.persistMaterialList(appendResult.materialList, '新增材料成功', () => {
this.projectMaterialDialogFlag = false
this.projectMaterialSelections = []
if (this.$refs.projectMaterialTable) {
this.$refs.projectMaterialTable.clearSelection()
}
})
}).catch(() => {})
},
appendMaterialRows (rows) {
const materialList = Array.isArray(this.modalData.materialList) ? [...this.modalData.materialList] : []
const exists = new Set(materialList.map(item => item.testPartNo))
let appendedCount = 0
rows.forEach(row => {
const testPartNo = row.testPartNo || row.test_part_no
if (!testPartNo || exists.has(testPartNo)) {
return
}
exists.add(testPartNo)
appendedCount++
materialList.push({
site: this.modalData.site,
referenceNo: this.modalData.referenceNo,
@ -1607,11 +1670,53 @@ export default {
partSpec: row.partSpec || row.part_spec || ''
})
})
this.$set(this.modalData, 'materialList', materialList)
return {
materialList,
appendedCount
}
},
materialSelectionChange (rows) {
this.materialSelections = rows || []
},
shouldPersistMaterialsImmediately () {
return this.modalTitle === 'RoHs 编辑' && this.modalData && this.modalData.referenceNo && !String(this.modalData.referenceNo).startsWith('TEMP-')
},
normalizeMaterialListForSave (materialList) {
return (materialList || []).map((item, index) => {
return {
...item,
lineNo: index + 1,
projectId: item.projectId || this.modalData.projectId || ''
}
})
},
persistMaterialList (materialList, successMsg, successCallback) {
const normalizedList = this.normalizeMaterialListForSave(materialList)
const payload = {
site: this.modalData.site,
referenceNo: this.modalData.referenceNo,
projectId: this.modalData.projectId,
materialList: normalizedList
}
api.updateRohsMaterials(payload).then(({data}) => {
if (data && data.code === 0) {
this.$set(this.modalData, 'materialList', normalizedList)
this.modalData.ifsPartNo = normalizedList.length > 0 ? normalizedList[0].testPartNo : ''
this.materialSelections = []
if (this.currentRow && this.currentRow.referenceNo === this.modalData.referenceNo) {
this.$set(this.currentRow, 'materialList', normalizedList)
}
this.$message.success(successMsg || '保存成功')
if (typeof successCallback === 'function') {
successCallback()
}
} else {
this.$message.error((data && data.msg) || '保存失败')
}
}).catch(() => {
this.$message.error('保存失败')
})
},
removeSelectedMaterialRows () {
if (this.showModalFlag) {
return
@ -1622,8 +1727,19 @@ export default {
}
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 = []
if (!this.shouldPersistMaterialsImmediately()) {
this.$set(this.modalData, 'materialList', materialList)
this.materialSelections = []
this.$message.success('已删除材料,保存单据后写入数据库')
return
}
this.$confirm('确认删除选中材料?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.persistMaterialList(materialList, '删除材料成功')
}).catch(() => {})
},
// ======== chooseList ========
//
@ -1733,7 +1849,7 @@ export default {
if (data.rows && data.rows.length === 1) {
const customer = data.rows[0]
this.modalData.endCustomerName = customer.customerDesc || customer.Customer_desc || customer.customerName || ''
this.modalData.projectIdFlag = false
this.modalData.projectIdFlag = !!this.modalData.endCustomerFlag
} else {
this.modalData.endCustomerName = ''
this.modalData.projectId = ''

Loading…
Cancel
Save