feat(wms): 新增热轧原料库存透视功能及相关组件

添加热轧原料库存透视表API接口
创建透视表展示组件HotZhaRaw.vue和Perspective.vue
实现数据持久化功能及左右布局管理界面
优化锌卷标签显示样式及字段名称
This commit is contained in:
砂糖
2026-03-09 13:06:30 +08:00
parent d3da84f65e
commit 693edbb543
7 changed files with 844 additions and 6 deletions

View File

@@ -0,0 +1,241 @@
<template>
<div class="app-container">
<el-row :gutter="10">
<el-col :span="6">
<LeftList ref="leftList" @add="handleAdd" @select="handleSelect" />
</el-col>
<el-col :span="18">
<div style="height: calc(100vh - 124px); overflow-y: scroll; overflow-x: hidden;">
<div v-if="currentRow.summaryId">
<Preview :data="currentRow.statJson" />
</div>
<div v-else>
<div>钢卷生产统计详情</div>
</div>
</div>
</el-col>
</el-row>
<el-dialog v-loading="previewLoading" title="效果预览" :visible.sync="previewOpen" width="800px" append-to-body>
<Preview :data="liveData" />
<el-button type="primary" @click="handleSave">保存</el-button>
</el-dialog>
</div>
</template>
<script>
import { getCoilStatisticsSummary, delCoilStatisticsSummary, addCoilStatisticsSummary, updateCoilStatisticsSummary } from "@/api/wms/coilStatisticsSummary";
import LeftList from "./components/LeftList.vue";
import Preview from "@/views/wms/coil/panels/Perspective/index.vue";
import { listRawMaterialPerspective } from "@/api/wms/rawMaterial";
export default {
name: "CoilStatisticsSummary",
components: {
LeftList,
Preview
},
data() {
return {
// 按钮loading
buttonLoading: false,
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 钢卷生产统计表格数据
coilStatisticsSummaryList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
title: undefined,
statType: undefined,
},
// 表单参数
form: {},
// 表单校验
rules: {
},
previewLoading: false,
previewOpen: false,
liveData: {},
currentRow: {},
};
},
created() {
this.getList();
},
methods: {
/** 查询钢卷生产统计列表 */
getList() {
this.loading = true;
listCoilStatisticsSummary(this.queryParams).then(response => {
this.coilStatisticsSummaryList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
summaryId: undefined,
title: undefined,
statType: undefined,
statJson: undefined,
remark: undefined,
createBy: undefined,
createTime: undefined,
updateBy: undefined,
updateTime: undefined,
delFlag: undefined
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelect(row) {
this.currentRow = {
...row,
statJson: JSON.parse(row.statJson)
};
},
/** 新增按钮操作 */
handleAdd(form) {
this.previewOpen = true;
this.form = form;
if (form.statType == '热轧原料') {
this.previewLoading = true;
listRawMaterialPerspective().then(response => {
const data = response.data;
// 处理数据
const filteredData = data.filter(manufacturer => {
// 确保manufacturer和其materials存在
if (!manufacturer || !Array.isArray(manufacturer.materials)) {
return false;
}
// 过滤材质totalCoilCount > 0
manufacturer.materials = manufacturer.materials.filter(material => {
// 确保material和其specifications存在
if (!material || !Array.isArray(material.specifications)) {
return false;
}
// 过滤规格coilCount > 0
material.specifications = material.specifications.filter(spec => spec.coilCount > 0);
// 只有当规格数组不为空时,才保留该材质
return material.specifications.length > 0;
});
// 只有当材质数组不为空时,才保留该厂家
return manufacturer.materials.length > 0;
});
this.liveData = filteredData;
}).finally(() => {
this.previewLoading = false;
});
}
},
handleSave() {
addCoilStatisticsSummary({
...this.form,
statJson: JSON.stringify(this.liveData)
}).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.liveData = [];
this.form = {};
this.$refs.leftList.getList();
}).finally(() => {
this.buttonLoading = false;
});
},
/** 修改按钮操作 */
handleUpdate(row) {
this.loading = true;
this.reset();
const summaryId = row.summaryId || this.ids
getCoilStatisticsSummary(summaryId).then(response => {
this.loading = false;
this.form = response.data;
this.open = true;
this.title = "修改钢卷生产统计";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
this.buttonLoading = true;
if (this.form.summaryId != null) {
updateCoilStatisticsSummary(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
}).finally(() => {
this.buttonLoading = false;
});
} else {
addCoilStatisticsSummary(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
}).finally(() => {
this.buttonLoading = false;
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const summaryIds = row.summaryId || this.ids;
this.$modal.confirm('是否确认删除钢卷生产统计编号为"' + summaryIds + '"的数据项?').then(() => {
this.loading = true;
return delCoilStatisticsSummary(summaryIds);
}).then(() => {
this.loading = false;
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
}).finally(() => {
this.loading = false;
});
},
/** 导出按钮操作 */
handleExport() {
this.download('wms/coilStatisticsSummary/export', {
...this.queryParams
}, `coilStatisticsSummary_${new Date().getTime()}.xlsx`)
}
}
};
</script>