|
|
|
@ -182,6 +182,17 @@
|
|
|
|
|
>同步
|
|
|
|
|
</el-button>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="1.5">
|
|
|
|
|
<el-button
|
|
|
|
|
type="primary"
|
|
|
|
|
plain
|
|
|
|
|
icon="el-icon-check"
|
|
|
|
|
size="mini"
|
|
|
|
|
@click="handleBatchSave"
|
|
|
|
|
v-hasPermi="['mes:materialinfo:batchEdit']"
|
|
|
|
|
>批量保存
|
|
|
|
|
</el-button>
|
|
|
|
|
</el-col>
|
|
|
|
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
|
@ -229,7 +240,19 @@
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="批次数量" align="center" prop="batchAmount"/>
|
|
|
|
|
<el-table-column label="安全库存数量" align="center" prop="safeStockAmount"/>
|
|
|
|
|
<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"
|
|
|
|
|
:min="0"
|
|
|
|
|
:max="999999999"
|
|
|
|
|
size="mini"
|
|
|
|
|
style="width: 110px"
|
|
|
|
|
@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 label="库存数量" align="center" prop="availableAmount" >
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<span :style="setCellClassName(scope.row)">
|
|
|
|
@ -446,12 +469,14 @@ import {
|
|
|
|
|
delMaterialinfo,
|
|
|
|
|
addMaterialinfo,
|
|
|
|
|
updateMaterialinfo,
|
|
|
|
|
getMaterialTypes
|
|
|
|
|
getMaterialTypes,
|
|
|
|
|
batchUpdateSafeStock
|
|
|
|
|
} from "@/api/mes/materialinfo";
|
|
|
|
|
import {listBaseMaterialType} from "@//api/mes/baseMaterialType";
|
|
|
|
|
import Treeselect from "@riophae/vue-treeselect";
|
|
|
|
|
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
|
|
|
|
import {runJob} from "@/api/monitor/job";
|
|
|
|
|
import { checkPermi } from "@/utils/permission";
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
name: "Materialinfo",
|
|
|
|
@ -533,11 +558,14 @@ export default {
|
|
|
|
|
MATERIAL_CLASSFICATION:{
|
|
|
|
|
ERP:'1',
|
|
|
|
|
VIRTUAL:'2'
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
// 跟踪已修改的安全库存数据
|
|
|
|
|
modifiedSafeStockData: []
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
|
this.getList();
|
|
|
|
|
this.checkEditPermission();
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
/** 查询物料信息列表 */
|
|
|
|
@ -715,8 +743,68 @@ export default {
|
|
|
|
|
return 'color: #f56c6c';
|
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/** 批量保存安全库存 */
|
|
|
|
|
handleBatchSave() {
|
|
|
|
|
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.getList(); // 刷新列表
|
|
|
|
|
}).catch(() => {
|
|
|
|
|
this.loading = false;
|
|
|
|
|
});
|
|
|
|
|
}).catch(() => {});
|
|
|
|
|
},
|
|
|
|
|
checkPermi,
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
/* 只读状态的输入框样式 */
|
|
|
|
|
.el-input-number.is-disabled {
|
|
|
|
|
background-color: #f5f7fa;
|
|
|
|
|
border-color: #e4e7ed;
|
|
|
|
|
color: #606266;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* 只读状态的输入框内部样式 */
|
|
|
|
|
.el-input-number.is-disabled .el-input__inner {
|
|
|
|
|
background-color: #f5f7fa;
|
|
|
|
|
color: #606266;
|
|
|
|
|
cursor: not-allowed;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* 只读状态的增减按钮样式 */
|
|
|
|
|
.el-input-number.is-disabled .el-input-number__decrease,
|
|
|
|
|
.el-input-number.is-disabled .el-input-number__increase {
|
|
|
|
|
background-color: #f5f7fa;
|
|
|
|
|
color: #c0c4cc;
|
|
|
|
|
cursor: not-allowed;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|