| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423 |
- <template>
- <!--
- 成品库存管理主页面
- @Author: Antigravity
- -->
- <div class="app-container goods-stock-container">
- <!-- 头部高格调数据看板区 -->
- <el-row :gutter="20" class="mb20 summary-row">
- <el-col :span="6">
- <div class="summary-card total-stock">
- <div class="card-icon"><el-icon><Box /></el-icon></div>
- <div class="card-info">
- <span class="label">当前总库存支数</span>
- <h2 class="value">{{ summaryData.totalQty.toLocaleString() }} <small>支</small></h2>
- </div>
- </div>
- </el-col>
- <el-col :span="6">
- <div class="summary-card total-weight">
- <div class="card-icon"><el-icon><ScaleToOriginal /></el-icon></div>
- <div class="card-info">
- <span class="label">库存总重量</span>
- <h2 class="value">{{ summaryData.totalWt.toFixed(2) }} <small>kg</small></h2>
- </div>
- </div>
- </el-col>
- <el-col :span="6">
- <div class="summary-card aging-stock">
- <div class="card-icon"><el-icon><Timer /></el-icon></div>
- <div class="card-info">
- <span class="label">超 30 天超龄库存</span>
- <h2 class="value warning-text">{{ summaryData.agingCount }} <small>款</small></h2>
- </div>
- </div>
- </el-col>
- <el-col :span="6">
- <div class="summary-card warehouse-stock">
- <div class="card-icon"><el-icon><HomeFilled /></el-icon></div>
- <div class="card-info">
- <span class="label">关联单据数</span>
- <h2 class="value info-text">{{ summaryData.docCount }} <small>个</small></h2>
- </div>
- </div>
- </el-col>
- </el-row>
- <!-- 过滤搜索控制栏 -->
- <el-card class="search-card mb20 shadow-sm" border="false">
- <el-form :model="queryParams" ref="queryFormRef" :inline="true" label-width="80px">
- <el-form-item label="型材型号" prop="modelNum">
- <el-input
- v-model="queryParams.modelNum"
- placeholder="请输入型材型号"
- clearable
- style="width: 200px"
- @keyup.enter="handleQuery"
- />
- </el-form-item>
- <el-form-item label="表面名称" prop="colorName">
- <el-input
- v-model="queryParams.colorName"
- placeholder="请输入表面名称"
- clearable
- style="width: 200px"
- @keyup.enter="handleQuery"
- />
- </el-form-item>
- <el-form-item label="客户名称" prop="clientName">
- <el-input
- v-model="queryParams.clientName"
- placeholder="请输入客户名称"
- clearable
- style="width: 200px"
- @keyup.enter="handleQuery"
- />
- </el-form-item>
- <el-form-item label="单据编号" prop="docCode">
- <el-input
- v-model="queryParams.docCode"
- placeholder="请输入单据编号"
- clearable
- style="width: 200px"
- @keyup.enter="handleQuery"
- />
- </el-form-item>
- <el-form-item class="btn-group">
- <el-button type="primary" icon="Search" class="glow-btn" @click="handleQuery">搜索</el-button>
- <el-button icon="Refresh" @click="resetQuery">重置</el-button>
- </el-form-item>
- </el-form>
- </el-card>
- <!-- 数据呈现主表格 -->
- <el-card class="table-card shadow-sm" border="false">
- <el-table
- v-loading="loading"
- :data="stockList"
- stripe
- row-key="itemNo"
- border
- highlight-current-row
- class="premium-table"
- >
- <el-table-column type="index" label="序号" align="center" width="55" fixed />
- <el-table-column label="单据编号" align="center" prop="docCode" width="130" show-overflow-tooltip fixed />
- <el-table-column label="型材型号" align="left" prop="modelNum" width="130" show-overflow-tooltip fixed>
- <template #default="scope">
- <span class="bold-text">{{ scope.row.modelNum }}</span>
- </template>
- </el-table-column>
- <el-table-column label="型材名称" align="left" prop="modelName" width="150" show-overflow-tooltip />
- <el-table-column label="客户型号" align="left" prop="clientModel" width="130" show-overflow-tooltip />
- <el-table-column label="表面名称" align="center" prop="colorName" width="130" show-overflow-tooltip>
- <template #default="scope">
- <el-tag effect="plain" type="success" size="small">{{ scope.row.colorName }}</el-tag>
- </template>
- </el-table-column>
- <el-table-column label="材质" align="center" prop="alloyName" width="90" />
- <el-table-column label="壁厚(mm)" align="right" prop="thick" width="95">
- <template #default="scope">
- <span>{{ scope.row.thick ? Number(scope.row.thick).toFixed(2) : '-' }}</span>
- </template>
- </el-table-column>
- <el-table-column label="膜厚" align="right" prop="film" width="85">
- <template #default="scope">
- <span>{{ scope.row.film ? Number(scope.row.film).toFixed(2) : '-' }}</span>
- </template>
- </el-table-column>
- <el-table-column label="长度(mm)" align="right" prop="flength" width="95">
- <template #default="scope">
- <span class="highlight-value">{{ scope.row.flength ? Math.round(scope.row.flength) : '-' }}</span>
- </template>
- </el-table-column>
- <el-table-column label="现存支数" align="right" prop="qty" width="100">
- <template #default="scope">
- <span class="qty-text">{{ scope.row.qty ? scope.row.qty : 0 }}</span>
- </template>
- </el-table-column>
- <el-table-column label="实际重量(kg)" align="right" prop="wt" width="115">
- <template #default="scope">
- <span class="wt-text">{{ scope.row.wt ? Number(scope.row.wt).toFixed(2) : '0.00' }}</span>
- </template>
- </el-table-column>
- <el-table-column label="存放框名" align="center" prop="frameName" width="120" show-overflow-tooltip />
- <el-table-column label="仓库名称" align="center" prop="storeName" width="120" show-overflow-tooltip />
- <el-table-column label="库龄" align="center" prop="stockDays" width="95">
- <template #default="scope">
- <el-tooltip :content="'生产完成日期: ' + parseTime(scope.row.finishDate)" placement="top">
- <el-tag :type="getAgingTagType(scope.row.stockDays)" effect="dark" size="small">
- {{ scope.row.stockDays }} 天
- </el-tag>
- </el-tooltip>
- </template>
- </el-table-column>
- <el-table-column label="客户名称" align="left" prop="clientName" width="150" show-overflow-tooltip />
- <el-table-column label="完成日期" align="center" prop="finishDate" width="160">
- <template #default="scope">
- <span>{{ parseTime(scope.row.finishDate, '{y}-{m}-{d} {h}:{i}') }}</span>
- </template>
- </el-table-column>
- </el-table>
- <pagination
- v-show="total > 0"
- :total="total"
- v-model:page="queryParams.pageNum"
- v-model:limit="queryParams.pageSize"
- @pagination="getList"
- />
- </el-card>
- </div>
- </template>
- <script setup name="GoodsStock">
- /**
- * 成品库存组件逻辑
- * @Author: Antigravity
- */
- import { ref, onMounted, reactive } from 'vue';
- import { listGoodsStockPage } from '@/api/erp/goodsStock';
- import { parseTime } from '@/utils/ruoyi';
- const queryFormRef = ref();
- const loading = ref(false);
- const total = ref(0);
- const stockList = ref([]);
- // 汇总栏数据定义
- const summaryData = reactive({
- totalQty: 0,
- totalWt: 0,
- agingCount: 0,
- docCount: 0
- });
- // 查询参数配置
- const queryParams = ref({
- pageNum: 1,
- pageSize: 10,
- modelNum: undefined,
- colorName: undefined,
- clientName: undefined,
- docCode: undefined
- });
- /** 查询库存列表 */
- function getList() {
- loading.value = true;
- listGoodsStockPage(queryParams.value).then(response => {
- stockList.value = response.rows;
- total.value = response.total;
- loading.value = false;
- calculateSummary(response.rows);
- }).catch(() => {
- loading.value = false;
- });
- }
- /** 动态统计当前页/当前汇总概览 */
- function calculateSummary(rows) {
- if (!rows || rows.length === 0) {
- summaryData.totalQty = 0;
- summaryData.totalWt = 0;
- summaryData.agingCount = 0;
- summaryData.docCount = 0;
- return;
- }
- let qty = 0;
- let wt = 0;
- let aging = 0;
- const docs = new Set();
- rows.forEach(r => {
- qty += Number(r.qty || 0);
- wt += Number(r.wt || 0);
- if (Number(r.stockDays || 0) > 30) {
- aging++;
- }
- if (r.docCode) {
- docs.add(r.docCode);
- }
- });
- summaryData.totalQty = qty;
- summaryData.totalWt = wt;
- summaryData.agingCount = aging;
- summaryData.docCount = docs.size;
- }
- /** 库龄颜色渲染 */
- function getAgingTagType(days) {
- const d = Number(days || 0);
- if (d <= 7) return 'success'; // 新鲜库存
- if (d <= 30) return 'info'; // 正常库存
- if (d <= 90) return 'warning'; // 超龄中等库存
- return 'danger'; // 呆滞库存
- }
- /** 搜索按钮操作 */
- function handleQuery() {
- queryParams.value.pageNum = 1;
- getList();
- }
- /** 重置查询 */
- function resetQuery() {
- queryFormRef.value?.resetFields();
- handleQuery();
- }
- onMounted(() => {
- getList();
- });
- </script>
- <style scoped lang="scss">
- .goods-stock-container {
- padding: 20px;
- background-color: #f6f8fb;
- min-height: calc(100vh - 84px);
- // 1. 数据统计卡片区美化
- .summary-row {
- margin-bottom: 20px;
- .summary-card {
- display: flex;
- align-items: center;
- padding: 20px;
- background: #ffffff;
- border-radius: 12px;
- box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.03);
- transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
- border-left: 5px solid #409eff;
- &:hover {
- transform: translateY(-4px);
- box-shadow: 0 8px 30px 0 rgba(64, 158, 255, 0.12);
- }
- &.total-stock {
- border-left-color: #409eff;
- .card-icon { background: rgba(64, 158, 255, 0.1); color: #409eff; }
- }
- &.total-weight {
- border-left-color: #67c23a;
- .card-icon { background: rgba(103, 194, 58, 0.1); color: #67c23a; }
- }
- &.aging-stock {
- border-left-color: #f56c6c;
- .card-icon { background: rgba(245, 108, 108, 0.1); color: #f56c6c; }
- }
- &.warehouse-stock {
- border-left-color: #e6a23c;
- .card-icon { background: rgba(230, 162, 60, 0.1); color: #e6a23c; }
- }
- .card-icon {
- width: 54px;
- height: 54px;
- border-radius: 10px;
- display: flex;
- align-items: center;
- justify-content: center;
- font-size: 26px;
- margin-right: 15px;
- }
- .card-info {
- .label {
- font-size: 13px;
- color: #909399;
- display: block;
- margin-bottom: 5px;
- }
- .value {
- margin: 0;
- font-size: 22px;
- font-weight: 700;
- color: #303133;
- small {
- font-size: 12px;
- font-weight: normal;
- color: #909399;
- margin-left: 2px;
- }
- }
- .warning-text { color: #f56c6c; }
- .info-text { color: #e6a23c; }
- }
- }
- }
- // 2. 搜索控制栏美化
- .search-card {
- background: #ffffff;
- border-radius: 12px;
- border: none;
- :deep(.el-form-item) {
- margin-bottom: 0;
- margin-right: 18px;
- }
- .btn-group {
- margin-left: 10px;
- }
- .glow-btn {
- box-shadow: 0 4px 14px 0 rgba(64, 158, 255, 0.4);
- transition: all 0.3s;
- &:hover {
- transform: translateY(-1px);
- box-shadow: 0 6px 20px 0 rgba(64, 158, 255, 0.5);
- }
- }
- }
- // 3. 数据表格区美化
- .table-card {
- border-radius: 12px;
- border: none;
- background: #ffffff;
- .premium-table {
- font-size: 13px;
- :deep(.el-table__header-wrapper) th {
- background-color: #f8f9fc !important;
- color: #606266;
- font-weight: bold;
- height: 48px;
- }
- :deep(.el-table__row) {
- height: 44px;
- }
- .bold-text {
- font-weight: 600;
- color: #2c3e50;
- }
- .highlight-value {
- color: #2c3e50;
- font-weight: bold;
- }
- .qty-text {
- font-weight: bold;
- color: #2980b9;
- }
- .wt-text {
- font-weight: bold;
- color: #27ae60;
- }
- }
- }
- .mb20 { margin-bottom: 20px; }
- }
- </style>
|