Files
bj_power/bj_power_wms/frontend/src/pages/Dashboard.vue
T
SunYF 1cc93795ce feat(mes): 添加定时同步可生产数量到WMS及BOM项相关标准字段
- 在main.go中添加定时任务每10分钟同步可生产数量到WMS系统
- 为BomItem实体添加relatedStandard字段及相关CRUD方法
- 为InspectionRecord实体添加reportNo、materialCode、materialName等字段
- 更新ent schema确保新字段的验证和默认值设置
- 添加必要的数据库迁移和字段映射逻辑
2026-09-17 12:49:07 +08:00

105 lines
3.9 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<script setup>
defineOptions({ name: 'Dashboard' })
import { onMounted, ref } from 'vue'
import { useRouter } from 'vue-router'
import { CircleCheck, Download, List, Monitor, Search, Upload, Box, Tickets, EditPen, Location, Goods } from '@element-plus/icons-vue'
import request from '../utils/request'
import { fmtNum } from '../utils/format'
const router = useRouter()
const overview = ref({})
const loaded = ref(false)
// 缺货预警(客户诉求 问题记录 L473:安全库存/缺货预警进 WMS 首页)
const shortage = ref([])
async function load() {
overview.value = await request.get('/display/overview')
loaded.value = true
}
async function loadShortage() {
try {
const d = await request.get('/stock/shortage')
shortage.value = d?.list || []
} catch (e) {
shortage.value = []
}
}
onMounted(() => {
load()
loadShortage()
})
const cards = [
{ key: 'totalQty', label: '在库总量' },
{ key: 'lockedQty', label: '锁定量' },
{ key: 'snInStock', label: 'SN 在库数' },
{ key: 'semiInStock', label: '半成品在库' },
{ key: 'packageCount', label: '装箱出库' },
{ key: 'batchCount', label: '批次数' },
{ key: 'inToday', label: '今日入库单' },
{ key: 'outToday', label: '今日出库单' }
]
const entries = [
{ path: '/inbound', title: '入库管理', icon: Download },
{ path: '/outbound', title: '备料出库', icon: Upload },
{ path: '/inventory', title: '库存查询', icon: Search },
{ path: '/inspection', title: '质量检验', icon: CircleCheck },
{ path: '/stocktake', title: '库存盘点', icon: List },
{ path: '/semi', title: '半成品管理', icon: Box },
{ path: '/ledger', title: '工单备料台账', icon: Tickets },
{ path: '/zone', title: '区域维护', icon: Location },
{ path: '/material', title: '物料档案', icon: Goods },
{ path: '/display', title: '免登录大屏', icon: Monitor }
]
</script>
<template>
<div>
<el-row :gutter="12">
<el-col v-for="c in cards" :key="c.key" :xs="12" :sm="8" :md="6" style="margin-bottom:12px">
<el-card shadow="hover">
<div class="kpi-label">{{ c.label }}</div>
<div class="kpi-value">{{ loaded ? fmtNum(overview[c.key]) : '—' }}</div>
</el-card>
</el-col>
</el-row>
<el-card v-if="shortage.length" shadow="never" class="mb12" style="margin-top:12px">
<template #header>
<span style="color:#f56c6c;font-weight:600">缺货预警({{ shortage.length }} 项物料可用量低于安全库存)</span>
</template>
<el-table :data="shortage" border size="small" empty-text="暂无缺货物料">
<el-table-column prop="materialCode" label="图号" min-width="140" />
<el-table-column prop="materialName" label="物料名称" min-width="150" />
<el-table-column prop="spec" label="规格" min-width="110">
<template #default="{ row }">{{ row.spec || '-' }}</template>
</el-table-column>
<el-table-column prop="safetyStock" label="安全库存" width="100" align="center" />
<el-table-column prop="availQty" label="可用量" width="90" align="center" />
<el-table-column label="缺口" width="90" align="center">
<template #default="{ row }">
<span style="color:#f56c6c;font-weight:600">{{ row.shortQty }}</span>
</template>
</el-table-column>
</el-table>
</el-card>
<el-card shadow="never" header="快捷入口">
<div class="entries">
<el-button v-for="e in entries" :key="e.path" size="large"
@click="router.push(e.path)">
<el-icon style="margin-right:6px"><component :is="e.icon" /></el-icon>{{ e.title }}
</el-button>
</div>
</el-card>
</div>
</template>
<style scoped>
.kpi-label { color: #909399; font-size: 13px; }
.kpi-value { font-size: 26px; font-weight: 700; margin-top: 4px; color: #303133; }
.entries { display: flex; flex-wrap: wrap; gap: 10px; }
</style>