feat:仓库数量汇总报表支持点击状态设定安全库存上下限并日期自动查询
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
b301a09cac
commit
2e22f851a0
|
|
@ -94,6 +94,15 @@ export default {
|
|||
);
|
||||
},
|
||||
},
|
||||
setSafe: {
|
||||
name: "设置安全库存上下限",
|
||||
req: async function (id, data) {
|
||||
return await http.put(
|
||||
`${config.API_URL}/mtm/material/${id}/set_safe/`,
|
||||
data
|
||||
);
|
||||
},
|
||||
},
|
||||
update: {
|
||||
name: "更新",
|
||||
req: async function (id, data) {
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
end-placeholder="截止时间(当周周末)"
|
||||
:clearable="false"
|
||||
style="margin-right: 12px;"
|
||||
@change="fetchData"
|
||||
/>
|
||||
<el-button type="primary" icon="el-icon-search" @click="fetchData" :loading="loading">查询</el-button>
|
||||
<span style="margin-left: auto; color: #909399; font-size: 13px;">分组维度: 物料型号(model)</span>
|
||||
|
|
@ -52,9 +53,12 @@
|
|||
<el-table-column label="库存量" prop="库存量" align="right" :formatter="numCell" />
|
||||
<el-table-column label="下限" prop="安全库存下限" align="right" :formatter="numCell" />
|
||||
<el-table-column label="上限" prop="安全库存上限" align="right" :formatter="numCell" />
|
||||
<el-table-column label="状态" width="72" align="center">
|
||||
<el-table-column label="状态" width="90" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="safeState(row).type" size="small" effect="light">{{ safeState(row).text }}</el-tag>
|
||||
<el-tag :type="safeState(row).type" size="small" effect="light"
|
||||
style="cursor: pointer;" @click="openSafe(row)" title="点击设置上下限">
|
||||
{{ safeState(row).text }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
|
@ -100,6 +104,28 @@
|
|||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<!-- 设置安全库存上下限 -->
|
||||
<el-dialog v-model="safeDialog.visible" title="设置安全库存上下限" width="420px" append-to-body>
|
||||
<el-form label-width="110px">
|
||||
<el-form-item label="区块 / 型号">
|
||||
<b>{{ safeDialog.block }} / {{ safeDialog.model }}</b>
|
||||
</el-form-item>
|
||||
<el-form-item label="当前库存量">
|
||||
<span>{{ fmtNum(safeDialog.stock) }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="安全库存下限">
|
||||
<el-input-number v-model="safeDialog.count_safe" :min="0" controls-position="right" style="width: 180px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="安全库存上限">
|
||||
<el-input-number v-model="safeDialog.count_safe_upper" :min="0" controls-position="right" style="width: 180px;" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="safeDialog.visible = false">取消</el-button>
|
||||
<el-button type="primary" :loading="safeDialog.saving" @click="saveSafe">保存</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</el-main>
|
||||
</el-container>
|
||||
</template>
|
||||
|
|
@ -125,6 +151,16 @@ export default {
|
|||
ds1: [],
|
||||
ds2: [],
|
||||
ds3: [],
|
||||
safeDialog: {
|
||||
visible: false,
|
||||
saving: false,
|
||||
material_id: null,
|
||||
block: "",
|
||||
model: "",
|
||||
stock: 0,
|
||||
count_safe: undefined,
|
||||
count_safe_upper: undefined,
|
||||
},
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
|
|
@ -236,6 +272,46 @@ export default {
|
|||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 打开设定弹窗(按型号代表物料 material_id 设置)
|
||||
openSafe(row) {
|
||||
if (!row.material_id) {
|
||||
this.$message.warning("该型号暂无可设定的物料");
|
||||
return;
|
||||
}
|
||||
const lo = row["安全库存下限"];
|
||||
const hi = row["安全库存上限"];
|
||||
this.safeDialog = {
|
||||
visible: true,
|
||||
saving: false,
|
||||
material_id: row.material_id,
|
||||
block: row["区块"],
|
||||
model: row["型号"],
|
||||
stock: row["库存量"],
|
||||
count_safe: lo === null || lo === undefined || lo === "" ? undefined : this.num(lo),
|
||||
count_safe_upper: hi === null || hi === undefined || hi === "" ? undefined : this.num(hi),
|
||||
};
|
||||
},
|
||||
saveSafe() {
|
||||
const d = this.safeDialog;
|
||||
if (d.count_safe != null && d.count_safe_upper != null && Number(d.count_safe) > Number(d.count_safe_upper)) {
|
||||
this.$message.warning("下限不能大于上限");
|
||||
return;
|
||||
}
|
||||
d.saving = true;
|
||||
this.$API.mtm.material.setSafe
|
||||
.req(d.material_id, {
|
||||
count_safe: d.count_safe === undefined ? null : d.count_safe,
|
||||
count_safe_upper: d.count_safe_upper === undefined ? null : d.count_safe_upper,
|
||||
})
|
||||
.then(() => {
|
||||
this.$message.success("设置成功");
|
||||
d.visible = false;
|
||||
this.fetchData();
|
||||
})
|
||||
.finally(() => {
|
||||
d.saving = false;
|
||||
});
|
||||
},
|
||||
mergeFirstCol(rows, key, rowIndex, columnIndex) {
|
||||
if (columnIndex !== 0) return;
|
||||
const cur = rows[rowIndex] && rows[rowIndex][key];
|
||||
|
|
|
|||
Loading…
Reference in New Issue