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

master
yinq 13 hours ago
parent 1d5fbac18c
commit 3be57e51b3

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

Loading…
Cancel
Save