Compare commits

..

2 Commits

Author SHA1 Message Date
shijing 9c302b215b Merge branch 'master' of http://gitea.xxhhcty.xyz:8080/zcdsj/factory_web 2026-07-23 16:40:07 +08:00
shijing f8e3523568 fix:禅道456 2026-07-23 16:40:05 +08:00
12 changed files with 107 additions and 11 deletions

View File

@ -0,0 +1,72 @@
<!--
物料仓库合格库存统计
数据来源: BI 数据集 code=materialCount2 (POST api/bi/dataset/{code}/exec)
抽自 factory_web/src/views/inm/good.vue "物料仓库合格库存统计"抽屉内容
-->
<template>
<el-container v-loading="loading">
<el-header style="display: flex; align-items: center;">
<span style="font-weight: 600;">物料仓库合格库存统计</span>
<el-text style="margin-left: 16px;">仓库总数{{ totalCount }}</el-text>
<el-button type="primary" icon="el-icon-refresh" @click="getProductCount" :loading="loading" style="margin-left: auto;">刷新</el-button>
</el-header>
<el-container>
<el-header style="height: 40%;">
<scTable :data="tableData" hideDo hidePagination row-key="material_name" style="width: 100%;">
<el-table-column label="物料名" prop="material_name"></el-table-column>
<el-table-column label="数量" prop="count"></el-table-column>
</scTable>
</el-header>
<el-main>
<scEcharts :option="echartsOptions" height="100%"></scEcharts>
</el-main>
</el-container>
</el-container>
</template>
<script>
import scEcharts from "@/components/scEcharts/index.vue";
export default {
name: "goodStatistic",
components: { scEcharts },
data() {
return {
loading: false,
tableData: [],
totalCount: 0,
echartsOptions: {},
};
},
mounted() {
this.getProductCount();
},
methods: {
getProductCount() {
let that = this;
let query = {
material_types: "10",
select_material: "material.name as material_name",
groupby_material: "material.name",
};
that.loading = true;
that.$API.bi.dataset.exec
.req("materialCount2", { query: query })
.then((res) => {
let data = (that.tableData = res.data2.ds0 || []);
let totalCount = 0;
data.forEach((item) => {
totalCount += Number(item.count) || 0;
});
that.totalCount = totalCount;
if (res.echart_options) {
that.echartsOptions = JSON.parse(res.echart_options);
}
})
.finally(() => {
that.loading = false;
});
},
},
};
</script>

View File

@ -1,7 +1,7 @@
<!-- <!--
物料保障车间-仓库数量汇总表 物料保障车间-仓库数量汇总表
数据来源: BI 数据集 code=wh_material_summary (POST api/bi/dataset/{code}/exec) 数据来源: BI 数据集 code=wh_material_summary (POST api/bi/dataset/{code}/exec)
返回 res.data2.ds0~ds3, 分组维度为 material.model(型号) 返回 res.data2.ds0~ds4, 分组维度为 material.model(型号)
菜单/路由由后端下发, component statistics/material_wh_summary 菜单/路由由后端下发, component statistics/material_wh_summary
--> -->
<template> <template>
@ -25,15 +25,13 @@
<el-main id="elMain" v-loading="loading"> <el-main id="elMain" v-loading="loading">
<!-- KPI 概览 --> <!-- KPI 概览 -->
<el-row :gutter="15" style="margin-bottom: 15px;"> <div class="kpi-grid">
<el-col :md="6" :sm="12" v-for="k in kpiList" :key="k.label"> <el-card v-for="k in kpiList" :key="k.label" shadow="hover" class="kpi-card" :style="{ borderLeft: '4px solid ' + k.color }">
<el-card shadow="hover" class="kpi-card" :style="{ borderLeft: '4px solid ' + k.color }"> <div class="kpi-label">{{ k.label }} · 现有库存合计</div>
<div class="kpi-label">{{ k.label }} · 现有库存合计</div> <div class="kpi-value" :style="{ color: k.color }">{{ fmtNum(k.total) }}</div>
<div class="kpi-value" :style="{ color: k.color }">{{ fmtNum(k.total) }}</div> <div class="kpi-sub">覆盖 {{ k.count }} 个型号</div>
<div class="kpi-sub">覆盖 {{ k.count }} 个型号</div> </el-card>
</el-card> </div>
</el-col>
</el-row>
<!-- 库存量对比图 --> <!-- 库存量对比图 -->
<el-card shadow="never" style="margin-bottom: 15px;"> <el-card shadow="never" style="margin-bottom: 15px;">
@ -103,6 +101,18 @@
</el-table> </el-table>
</el-card> </el-card>
</el-col> </el-col>
<el-col :lg="12">
<el-card shadow="never" class="rpt-card">
<template #header><b>半成品库周数据</b><span class="hd-tip">(入库=采购入库+生产入库 / 出库=生产领料)</span></template>
<el-table :data="ds4" border stripe size="small" show-summary :summary-method="sumRow">
<el-table-column label="型号" prop="型号" width="110" />
<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>
</el-card>
</el-col>
</el-row> </el-row>
<!-- 设置安全库存上下限 --> <!-- 设置安全库存上下限 -->
@ -136,6 +146,7 @@ import scEcharts from "@/components/scEcharts/index.vue";
const BLOCKS = [ const BLOCKS = [
{ key: "原料", color: "#409EFF" }, { key: "原料", color: "#409EFF" },
{ key: "成品", color: "#67C23A" }, { key: "成品", color: "#67C23A" },
{ key: "半成品", color: "#B37FEB" },
{ key: "白玻", color: "#E6A23C" }, { key: "白玻", color: "#E6A23C" },
{ key: "黑玻", color: "#909399" }, { key: "黑玻", color: "#909399" },
]; ];
@ -151,6 +162,7 @@ export default {
ds1: [], ds1: [],
ds2: [], ds2: [],
ds3: [], ds3: [],
ds4: [],
safeDialog: { safeDialog: {
visible: false, visible: false,
saving: false, saving: false,
@ -267,6 +279,7 @@ export default {
this.ds1 = d.ds1 || []; this.ds1 = d.ds1 || [];
this.ds2 = d.ds2 || []; this.ds2 = d.ds2 || [];
this.ds3 = d.ds3 || []; this.ds3 = d.ds3 || [];
this.ds4 = d.ds4 || [];
}) })
.finally(() => { .finally(() => {
this.loading = false; this.loading = false;
@ -335,8 +348,19 @@ export default {
</script> </script>
<style scoped> <style scoped>
.kpi-grid {
display: grid;
grid-template-columns: repeat(5, 1fr);
gap: 15px;
margin-bottom: 15px;
}
@media (max-width: 992px) {
.kpi-grid {
grid-template-columns: repeat(2, 1fr);
}
}
.kpi-card { .kpi-card {
margin-bottom: 8px; margin-bottom: 0;
} }
.kpi-label { .kpi-label {
color: #909399; color: #909399;