pda-cli/src/pages/storefabric/storeFabricWarehouseStockList.vue
xuan 084bb235f8 feat(storefabric): 新增坯布库存管理功能
- 在http.api.js中添加坯布库存接口前缀和相关API定义
- 更新工作台页面,将坯布库存菜单链接到新的库存查询页面
- 在pages.json中注册坯布库存相关的三个新页面路由
- 创建storeFabricWarehouse.js文件,包含库存查询的常量、格式化函数和参数处理逻辑
- 新增storeFabricWarehouseDetail.vue页面,实现细码明细查看功能
- 添加storeFabricWarehouseGroupList.vue页面,实现坯布库存汇总查询
- 创建storeFabricWarehouseStockList.vue页面,实现库存维度汇总功能
- 新增storeFabricWarehouseGroupItem.vue和storeFabricWarehouseStockItem.vue组件,用于显示库存卡片
- 添加WarehouseDataTable.vue组件,提供可滚动的表格展示功能
2026-06-22 14:06:06 +08:00

158 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.

<template>
<view class="warehouse-page">
<view class="fabricHeader">
<view class="fabricCode">{{ context.grey_fabric_code || '-' }}</view>
<view class="fabricName">{{ context.grey_fabric_name || '-' }}</view>
</view>
<view class="filterBar">
<u-search
v-model="filters.machine_number"
placeholder="机台号"
:show-action="false"
@search="loadList"
@custom="loadList"
/>
</view>
<view class="summaryBar">
<text>合计{{ totals.roll }} / {{ totals.weight }} KG{{ totals.count }} </text>
</view>
<scroll-view
scroll-y
:style="{ height: scrollHeight }"
refresher-enabled
:refresher-triggered="triggered"
@refresherrefresh="onRefresh"
>
<dataNull
v-if="tableContents.length === 0"
src="/src/static/img/chahua/gjNull.png"
title="暂无维度汇总"
title1="请调整机台号筛选后重试"
/>
<view v-else class="tableBox">
<WarehouseDataTable
:headers="tableHeaders"
:contents="tableContents"
:height="tableHeight"
@row-click="goDetail"
/>
</view>
</scroll-view>
</view>
</template>
<script>
import WarehouseDataTable from '@/components/storefabric/WarehouseDataTable.vue';
import {
STOCK_TABLE_COLUMNS,
buildDetailNavigateQuery,
buildStockListQuery,
calcTableHeight,
fetchAllWarehouseList,
mapStockTableRow,
parsePageQuery,
sumStockTotals,
toQueryString,
} from '@/common/storeFabricWarehouse';
export default {
components: { WarehouseDataTable },
data() {
return {
list: [],
scrollHeight: '667px',
triggered: false,
tableHeaders: STOCK_TABLE_COLUMNS,
context: {
grey_fabric_id: '',
grey_fabric_code: '',
grey_fabric_name: '',
warehouse_id: '',
},
filters: {
machine_number: '',
},
};
},
computed: {
tableContents() {
return this.list.map(mapStockTableRow);
},
totals() {
return sumStockTotals(this.list);
},
tableHeight() {
return calcTableHeight(this.tableContents.length, { maxPx: 9999 });
},
},
onLoad(options) {
const parsed = parsePageQuery(options || {});
this.context = {
grey_fabric_id: parsed.grey_fabric_id || '',
grey_fabric_code: parsed.grey_fabric_code || '',
grey_fabric_name: parsed.grey_fabric_name || '',
warehouse_id: parsed.warehouse_id || '',
};
const title = this.context.grey_fabric_name
? `${this.context.grey_fabric_name} 库存汇总`
: '坯布库存汇总';
uni.setNavigationBarTitle({ title });
uni.getSystemInfo({
success: (res) => {
this.scrollHeight = `${res.windowHeight - 120}px`;
},
});
if (!this.context.grey_fabric_id) {
uni.showToast({ title: '缺少坯布参数', icon: 'none' });
return;
}
this.loadList();
},
methods: {
loadList() {
const params = buildStockListQuery(this.filters, this.context);
fetchAllWarehouseList((p) => this.$u.api.gfmWarehouse.stockSummaryList(p), params)
.then((rows) => {
this.triggered = false;
this.list = rows || [];
})
.catch((err) => {
this.triggered = false;
this.list = [];
uni.showToast({ title: err.message || '加载失败', icon: 'none' });
});
},
onRefresh() {
this.triggered = true;
this.loadList();
},
goDetail(row) {
const query = buildDetailNavigateQuery(row, this.context);
uni.navigateTo({
url: `./storeFabricWarehouseDetail?${toQueryString(query)}`,
});
},
},
};
</script>
<style>
page { background-color: #F8F8F8; }
.warehouse-page { min-height: 100%; }
.fabricHeader { padding: 20rpx 24rpx; background: #fff; border-bottom: 1rpx solid #f0f0f0; }
.fabricCode { font-size: 30rpx; font-weight: bold; color: #333; }
.fabricName { margin-top: 8rpx; font-size: 26rpx; color: #666; }
.filterBar { padding: 16rpx 20rpx; background: #fff; }
.summaryBar {
padding: 12rpx 24rpx;
font-size: 26rpx;
color: #666;
background: #fff;
border-top: 1rpx solid #f0f0f0;
}
.tableBox { padding: 16rpx 12rpx; }
</style>