change - 物料批量修改安全库存数量

master
yinq 13 hours ago
parent 1d5fbac18c
commit 3be57e51b3

@ -188,7 +188,8 @@
plain
icon="el-icon-check"
size="mini"
@click="handleBatchSave"
:disabled="multiple"
@click="handleBatchAdd"
v-hasPermi="['mes:materialinfo:batchEdit']"
>批量保存
</el-button>
@ -240,7 +241,7 @@
</template>
</el-table-column>
<el-table-column label="批次数量" align="center" prop="batchAmount"/>
<el-table-column label="安全库存数量" align="center" prop="safeStockAmount" width="120" v-if="checkPermi(['mes:materialinfo:batchEdit'])">
<!-- <el-table-column label="安全库存数量" align="center" prop="safeStockAmount" width="120" v-if="checkPermi(['mes:materialinfo:batchEdit'])">
<template slot-scope="scope">
<el-input-number
v-model="scope.row.safeStockAmount"
@ -251,8 +252,8 @@
@change="handleSafeStockChange(scope.row)"
/>
</template>
</el-table-column>
<el-table-column label="安全库存数量" align="center" prop="safeStockAmount" width="120" v-if="!checkPermi(['mes:materialinfo:batchEdit'])"/>
</el-table-column>-->
<el-table-column label="安全库存数量" align="center" prop="safeStockAmount" width="120" />
<el-table-column label="库存数量" align="center" prop="availableAmount" >
<template slot-scope="scope">
<span :style="setCellClassName(scope.row)">
@ -300,7 +301,6 @@
<!-- 添加或修改物料信息对话框 -->
<el-dialog :title="title" :visible.sync="open" width="700px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-form-item label="物料编码" prop="materialCode">
<el-input v-model="form.materialCode" placeholder="请输入物料编码" :disabled="true"/>
</el-form-item>
@ -455,7 +455,21 @@
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button type="primary" @click="handleBatchSave"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<!-- 添加或修改物料信息对话框 -->
<el-dialog :title="title" :visible.sync="batchOpen" width="700px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-form-item label="安全库存数量" prop="safeStockAmount">
<el-input-number v-model="form.safeStockAmount" placeholder="请输入安全库存数量" :min="1" :max="10000000000"
style="width:180px"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="handleBatchSave"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
@ -506,6 +520,8 @@ export default {
title: "",
//
open: false,
//
batchOpen: false,
//
queryParams: {
pageNum: 1,
@ -580,6 +596,7 @@ export default {
//
cancel() {
this.open = false;
this.batchOpen = false;
this.reset();
},
//
@ -745,41 +762,51 @@ export default {
return '';
},
handleSafeStockChange(row) {
//
const existingIndex = this.modifiedSafeStockData.findIndex(item => item.materialId === row.materialId);
if (existingIndex > -1) {
this.modifiedSafeStockData[existingIndex] = {
materialId: row.materialId,
safeStockAmount: row.safeStockAmount
};
} else {
this.modifiedSafeStockData.push({
materialId: row.materialId,
safeStockAmount: row.safeStockAmount
});
}
},
// handleSafeStockChange(row) {
// //
// const existingIndex = this.modifiedSafeStockData.findIndex(item => item.materialId === row.materialId);
// if (existingIndex > -1) {
// this.modifiedSafeStockData[existingIndex] = {
// materialId: row.materialId,
// safeStockAmount: row.safeStockAmount
// };
// } else {
// this.modifiedSafeStockData.push({
// materialId: row.materialId,
// safeStockAmount: row.safeStockAmount
// });
// }
// },
handleBatchAdd() {
this.reset();
this.batchOpen = true;
this.title = "批量修改安全库存数量";
},
/** 批量保存安全库存 */
handleBatchSave() {
const materialIds = this.ids;
materialIds.forEach((materialId) => {
const materialVO = {materialId: materialId, safeStockAmount: this.form.safeStockAmount};
this.modifiedSafeStockData.push(materialVO);
})
if (this.modifiedSafeStockData.length === 0) {
this.$modal.msgWarning("没有需要保存的修改");
return;
}
this.$modal.confirm('确认要保存修改的安全库存数量吗?').then(() => {
this.loading = true;
batchUpdateSafeStock(this.modifiedSafeStockData).then(response => {
this.$modal.msgSuccess("批量保存成功");
this.modifiedSafeStockData = []; //
this.batchOpen = false;
this.getList(); //
}).catch(() => {
this.loading = false;
});
}).catch(() => {});
},
checkPermi,
}
};

Loading…
Cancel
Save