Browse Source

批量修改传参问题

java8
han\hanst 2 months ago
parent
commit
d35fe1760e
  1. 42
      src/views/modules/part/bom_create.vue

42
src/views/modules/part/bom_create.vue

@ -548,7 +548,7 @@
<el-dialog title="批量修改" :close-on-click-modal="false" v-drag :visible.sync="batchUpdateComponentsFlag" width="1500px">
<div class="rq ">
<el-table
:data="subDetailList"
:data="batchUpdateList"
height="286px"
border
style="width:100%">
@ -1017,6 +1017,7 @@ export default {
checkedDetail: [],
detailDataList: [],
subDetailList: [],
batchUpdateList: [], //
componentPartList: [],
componentPartList1: [],
batchComponentPartList: [],
@ -3944,21 +3945,32 @@ export default {
this.getDataList()
},
/**
* 打开批量修改弹窗
* 深拷贝 subDetailList batchUpdateList避免修改时影响原数据
*/
batchUpdateComponents() {
//
this.batchUpdateList = JSON.parse(JSON.stringify(this.subDetailList))
this.batchUpdateComponentsFlag = true
},
/**
* 保存批量修改
* 使用 batchUpdateList 临时数据进行修改和保存
* 成功后同步回 subDetailList
*/
async batchUpdateComponentsSave() {
// loading
this.batchUpdateSaveLoading = true
let flag = true
//
const listLength = this.subDetailList.length
const listLength = this.batchUpdateList.length
for (let i = 0; i < listLength; i++) {
//
let row = this.subDetailList[i]
let row = this.batchUpdateList[i]
this.componentData = {
flag: '2',
site: row.site,
@ -4050,8 +4062,25 @@ export default {
try {
const {data} = await computeQtyPerAssemblyEdit(this.componentData)
if (data && data.code === 0) {
//
this.subDetailList = data.rows.subDetailList
// componentPart lineSequence
//
const returnedList = data.rows.subDetailList || []
const currentRow = this.batchUpdateList[i]
//
const updatedRow = returnedList.find(item =>
item.componentPart === currentRow.componentPart &&
item.lineSequence === currentRow.lineSequence
)
if (updatedRow) {
//
this.$set(this.batchUpdateList, i, {
...this.batchUpdateList[i],
qtyPerAssembly: updatedRow.qtyPerAssembly, //
formula: updatedRow.formula, // setFormula
})
}
} else if (data && data.code !== 0) {
flag = false
this.batchUpdateSaveLoading = false
@ -4074,6 +4103,9 @@ export default {
this.batchUpdateSaveLoading = false
if(flag) {
//
this.subDetailList = JSON.parse(JSON.stringify(this.batchUpdateList))
this.$message({
message: '批量修改并计算完成',
type: 'success',

Loading…
Cancel
Save