Browse Source

2025-06-26

master
fengyuan_yang 7 months ago
parent
commit
8c5402e7ba
  1. 4
      src/views/modules/part/partInformation.vue
  2. 116
      src/views/modules/project/projectInfo/com_project_info_part.vue

4
src/views/modules/part/partInformation.vue

@ -153,7 +153,7 @@
</el-pagination> </el-pagination>
<!-- 物料新增/编辑模态框 --> <!-- 物料新增/编辑模态框 -->
<el-dialog :title="modalData.title" top="10vh" :close-on-click-modal="false" v-drag :visible.sync="modalFlag" width="1000px">
<el-dialog :title="modalData.title" top="10vh" :close-on-click-modal="false" v-drag :visible.sync="modalFlag" @close="handleDialogClose" width="1000px">
<el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-top: -5px;"> <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-top: -5px;">
<el-form-item label="物料编码" prop="partNo" :rules="rules.partNo"> <el-form-item label="物料编码" prop="partNo" :rules="rules.partNo">
<el-input v-model="modalData.partNo" :disabled="modalDisableFlag" style="width: 128px" @blur="queryMasterField"></el-input> <el-input v-model="modalData.partNo" :disabled="modalDisableFlag" style="width: 128px" @blur="queryMasterField"></el-input>
@ -683,7 +683,7 @@
<el-footer style="height:35px;margin-top: 20px;text-align:center"> <el-footer style="height:35px;margin-top: 20px;text-align:center">
<el-button v-if="modalData.flag === '3'" type="primary" :loading="saveLoading" @click="saveData">同步</el-button> <el-button v-if="modalData.flag === '3'" type="primary" :loading="saveLoading" @click="saveData">同步</el-button>
<el-button v-if="modalData.flag === '1' || modalData.flag === '2'" type="primary" :loading="saveLoading" @click="saveData">保存</el-button> <el-button v-if="modalData.flag === '1' || modalData.flag === '2'" type="primary" :loading="saveLoading" @click="saveData">保存</el-button>
<el-button type="primary" @click="modalFlag = false" :loading="saveLoading">关闭</el-button>
<el-button type="primary" @click="closeModal()" :loading="saveLoading">关闭</el-button>
</el-footer> </el-footer>
</el-dialog> </el-dialog>

116
src/views/modules/project/projectInfo/com_project_info_part.vue

@ -72,7 +72,7 @@
</el-pagination> </el-pagination>
<!-- 物料新增/编辑模态框 --> <!-- 物料新增/编辑模态框 -->
<el-dialog :title="modalData.title" :close-on-click-modal="false" v-drag :visible.sync="modalFlag" width="1000px">
<el-dialog :title="modalData.title" :close-on-click-modal="false" v-drag :visible.sync="modalFlag" @close="handleDialogClose" width="1000px">
<el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-top: -5px;"> <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-top: -5px;">
<el-form-item label="物料编码" prop="partNo" :rules="rules.partNo"> <el-form-item label="物料编码" prop="partNo" :rules="rules.partNo">
<el-input v-model="modalData.partNo" disabled style="width: 128px"></el-input> <el-input v-model="modalData.partNo" disabled style="width: 128px"></el-input>
@ -529,7 +529,7 @@
</el-form> </el-form>
<el-footer style="height:35px;margin-top: 20px;text-align:center"> <el-footer style="height:35px;margin-top: 20px;text-align:center">
<el-button type="primary" @click="saveData()">保存</el-button> <el-button type="primary" @click="saveData()">保存</el-button>
<el-button type="primary" @click="modalFlag = false">关闭</el-button>
<el-button type="primary" @click="closeModal()">关闭</el-button>
</el-footer> </el-footer>
</el-dialog> </el-dialog>
@ -1726,7 +1726,14 @@ import {
fixed: '', fixed: '',
}, },
], ],
itemSelections: []
itemSelections: [],
watchers: [],
unwatchTable: null, //
mainInfoFlag: false, //
costsInfoFlag: false, // costs
manufacturingInfoFlag: false, // Manufacturing
planningInfoFlag: false, // planning
partItemInfoFlag: false, //
} }
}, },
@ -1735,6 +1742,75 @@ import {
}, },
methods: { methods: {
//
resetFlags () {
this.mainInfoFlag = false
this.costsInfoFlag = false
this.manufacturingInfoFlag = false
this.planningInfoFlag = false
this.partItemInfoFlag = false
},
//
setupWatchers() {
this.teardownWatchers()
const groups = {
mainInfoFlag: ['partType', 'hazardCode', 'productGroupId4', 'productGroupId3',
'umId', 'groupId', 'productGroupId1', 'familyId', 'productGroupId2', 'typeDesignation',
'assetClass', 'dimQuality', 'partStatus', 'weightNet', 'uomForWeightNet', 'frequencyClass',
'abcClass', 'volumeNet', 'uomForVolumeNet', 'lifecycleStage', 'manufacturingLeadTime',
'countryOfOrigin', 'expectedLeadTime', 'durabilityDay', 'regionOfOrigin', 'intrastatConvFactor',
'customsStatNo', 'remark', 'inventoryValuationMethod', 'partCostGroupId', 'inventoryPartCostLevel',
'invoiceConsideration', 'zeroCostFlag'],
costsInfoFlag: ['estimatedMaterialCost'],
manufacturingInfoFlag: ['cumLeadTime', 'backFlushPart', 'byProdAsSupplyInMrpDb', 'unprotectedLeadTime',
'issueType', 'mrpControlFlagDb', 'fixedLeadTimeDay', 'overReporting', 'useTheoreticalDensityDb',
'variableLeadTimeDay', 'overReportTolerance', 'fixedLeadTimeHour', 'density', 'variableLeadTimeHour'],
planningInfoFlag: ['planningMethod', 'safetyStock', 'minOrderQty', 'maxOrderQty', 'mulOrderQty',
'safetyLeadTime', 'shrinkageFac', 'stdOrderQty'],
}
Object.entries(groups).forEach(([flagName, keys]) => {
keys.forEach(key => {
const unwatch = this.$watch(
() => this.modalData[key],
(newVal, oldVal) => {
if (oldVal === undefined) return; //
if (newVal !== oldVal && !this[flagName]) {
this[flagName] = true
}
}
)
this.watchers.push(unwatch)
})
})
let isFirstChange = true
this.unwatchTable = this.$watch(
() => JSON.stringify(this.partItemList),
(newVal, oldVal) => {
if (isFirstChange) {
isFirstChange = false
return //
}
if (newVal !== oldVal) {
this.partItemInfoFlag = true
}
}
)
},
//
teardownWatchers () {
//
this.watchers.forEach(unwatch => unwatch())
this.watchers = []
//
if (this.unwatchTable) {
this.unwatchTable()
this.unwatchTable = null
}
},
// //
sizeChangeHandle (val) { sizeChangeHandle (val) {
this.pageSize = val this.pageSize = val
@ -2038,6 +2114,11 @@ import {
ifsPartNo: '', ifsPartNo: '',
showInQueryFlag: 'Y', showInQueryFlag: 'Y',
temporaryPartFlag: 'Y', temporaryPartFlag: 'Y',
mainInfoFlag: false, //
costsInfoFlag: false, // costs
manufacturingInfoFlag: false, // Manufacturing
planningInfoFlag: false, // planning
partItemInfoFlag: false //
} }
this.partItemList = [] this.partItemList = []
this.modalFlag = true this.modalFlag = true
@ -2161,7 +2242,14 @@ import {
ifsPartNo: data.rows.ifsPartNo, ifsPartNo: data.rows.ifsPartNo,
showInQueryFlag: data.rows.showInQueryFlag, showInQueryFlag: data.rows.showInQueryFlag,
temporaryPartFlag: data.rows.temporaryPartFlag, temporaryPartFlag: data.rows.temporaryPartFlag,
mainInfoFlag: false, //
costsInfoFlag: false, // costs
manufacturingInfoFlag: false, // Manufacturing
planningInfoFlag: false, // planning
partItemInfoFlag: false //
} }
this.resetFlags() //
this.setupWatchers() //
this.getPartCharacteristicList(row.testPartNo) this.getPartCharacteristicList(row.testPartNo)
this.modalFlag = true this.modalFlag = true
this.modalDisableFlag = true this.modalDisableFlag = true
@ -2284,6 +2372,11 @@ import {
ifsPartNo: data.rows.ifsPartNo, ifsPartNo: data.rows.ifsPartNo,
showInQueryFlag: 'Y', showInQueryFlag: 'Y',
temporaryPartFlag: 'Y', temporaryPartFlag: 'Y',
mainInfoFlag: false, //
costsInfoFlag: false, // costs
manufacturingInfoFlag: false, // Manufacturing
planningInfoFlag: false, // planning
partItemInfoFlag: false //
} }
this.getPartCharacteristicList(row.testPartNo) this.getPartCharacteristicList(row.testPartNo)
this.modalFlag = true this.modalFlag = true
@ -2295,6 +2388,18 @@ import {
}) })
}, },
//
closeModal () {
this.modalFlag = false
},
//
handleDialogClose () {
if (this.modalData.flag === '2') {
this.teardownWatchers() //
}
},
// / // /
saveData () { saveData () {
if (this.modalData.partNo === '' || this.modalData.partNo == null) { if (this.modalData.partNo === '' || this.modalData.partNo == null) {
@ -2380,6 +2485,11 @@ import {
} }
}) })
} else { } else {
this.modalData.mainInfoFlag = this.mainInfoFlag
this.modalData.costsInfoFlag = this.costsInfoFlag
this.modalData.manufacturingInfoFlag = this.manufacturingInfoFlag
this.modalData.planningInfoFlag = this.planningInfoFlag
this.modalData.partItemInfoFlag = this.partItemInfoFlag
partInformationEdit2(this.modalData).then(({data}) => { partInformationEdit2(this.modalData).then(({data}) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.searchTable() this.searchTable()

Loading…
Cancel
Save