feat(storefabric): 新增坯布库存管理功能

- 在http.api.js中添加坯布库存接口前缀和相关API定义
- 更新工作台页面,将坯布库存菜单链接到新的库存查询页面
- 在pages.json中注册坯布库存相关的三个新页面路由
- 创建storeFabricWarehouse.js文件,包含库存查询的常量、格式化函数和参数处理逻辑
- 新增storeFabricWarehouseDetail.vue页面,实现细码明细查看功能
- 添加storeFabricWarehouseGroupList.vue页面,实现坯布库存汇总查询
- 创建storeFabricWarehouseStockList.vue页面,实现库存维度汇总功能
- 新增storeFabricWarehouseGroupItem.vue和storeFabricWarehouseStockItem.vue组件,用于显示库存卡片
- 添加WarehouseDataTable.vue组件,提供可滚动的表格展示功能
This commit is contained in:
郭鸿轩 2026-06-22 14:06:06 +08:00
parent 567da03aea
commit 084bb235f8
10 changed files with 1047 additions and 18 deletions

View File

@ -12,6 +12,10 @@ const install = (Vue, vm) => {
const GFM_OTHER_DELIVERY_PREFIX = '/grey_fabric_manage/gfmOtherDeliveryOrder/';
const gfmOtherDeliveryUrl = (name) => (vm.$store.state.apiurl || '') + GFM_OTHER_DELIVERY_PREFIX + name;
// 坯布库存接口前缀
const GFM_WAREHOUSE_PREFIX = '/grey_fabric_manage/gfmWarehouse/';
const gfmWarehouseUrl = (name) => (vm.$store.state.apiurl || '') + GFM_WAREHOUSE_PREFIX + name;
// 将各个定义的接口名称统一放进对象挂载到vm.$u.api(因为vm就是this也即this.$u.api)下
vm.$u.api = {
@ -35,6 +39,13 @@ const install = (Vue, vm) => {
statusCancel: (params = {}) => vm.$u.putJson(gfmOtherDeliveryUrl('updateGfmOtherDeliveryOrderStatusCancel'), params),
},
// 坯布库存相关接口
gfmWarehouse: {
groupSummaryList: (params = {}) => vm.$u.get(gfmWarehouseUrl('getGfmWarehouseSummaryWeavingFactoryStockGroupList'), params),
stockSummaryList: (params = {}) => vm.$u.get(gfmWarehouseUrl('getGfmWarehouseSummaryWeavingFactoryStockList'), params),
detailList: (params = {}) => vm.$u.get(gfmWarehouseUrl('getGfmWarehouseList'), params),
},
// 营销体系下拉(路径相对 apiurl.../pda/v1/saleSystem/getSaleSystemDropdownList
saleSystem: {
getDropdownList: (params = {}) => vm.$u.get('/saleSystem/getSaleSystemDropdownList', params),

View File

@ -0,0 +1,274 @@
/**
* 坯布库存查询常量格式化查询参数组装
*/
import {
formatRoll,
formatWeightKg,
fetchAllOrderList,
LIST_PAGE_SIZE,
} from '@/common/storeFabricBusinessOut';
export { formatRoll, formatWeightKg, fetchAllOrderList, LIST_PAGE_SIZE };
/** 第一维度:坯布汇总表格列 */
export const GROUP_TABLE_COLUMNS = [
{ label: '坯布', key: 'fabric_label', width: 300 },
{ label: '仓库名称', key: 'warehouse_name', width: 180 },
{ label: '库存匹数', key: 'stock_roll_display', width: 130 },
{ label: '库存数量', key: 'stock_weight_display', width: 160 },
];
/** 第二维度:排除上期/本期字段后的表格列 */
export const STOCK_TABLE_COLUMNS = [
{ label: '颜色', key: 'gray_fabric_color_name', width: 120 },
{ label: '坯布编号', key: 'grey_fabric_code', width: 140 },
{ label: '坯布名称', key: 'grey_fabric_name', width: 160 },
{ label: '等级', key: 'grey_fabric_level_name', width: 100 },
{ label: '幅宽', key: 'grey_fabric_width_and_unit_name', width: 120 },
{ label: '克重', key: 'grey_fabric_gram_weight_and_unit_name', width: 120 },
{ label: '成分', key: 'component', width: 120 },
{ label: '客户', key: 'customer_name', width: 120 },
{ label: '织厂', key: 'supplier_name', width: 140 },
{ label: '机台号', key: 'machine_number', width: 100 },
{ label: '针寸数', key: 'needle_size', width: 100 },
{ label: '纱批', key: 'yarn_batch', width: 120 },
{ label: '原料纱名', key: 'raw_material_yarn_name', width: 140 },
{ label: '原料批号', key: 'raw_material_batch_num', width: 120 },
{ label: '原料品牌', key: 'raw_material_batch_brand', width: 120 },
{ label: '仓库', key: 'warehouse_name', width: 140 },
{ label: '收货单位', key: 'receiver_name', width: 140 },
{ label: '工厂备注', key: 'warehouse_remark', width: 140 },
{ label: '染厂用坯单号', key: 'dye_unit_use_order_no', width: 150 },
{ label: '生产通知单号', key: 'produce_order_no', width: 150 },
{ label: '出坯单号', key: 'source_code', width: 140 },
{ label: '出坯日期', key: 'source_time', width: 120 },
{ label: '坯布备注', key: 'source_remark', width: 140 },
{ label: '预约匹数', key: 'book_roll_display', width: 110 },
{ label: '库存匹数', key: 'stock_roll_display', width: 110 },
{ label: '库存数量', key: 'stock_weight_display', width: 140 },
{ label: '库存成本', key: 'stock_cost_display', width: 110 },
{ label: '单价', key: 'single_price_display', width: 100 },
{ label: '毛重成本', key: 'buoyant_weight_price_display', width: 110 },
];
/** 细码明细表格列 */
export const WAREHOUSE_DETAIL_COLUMNS = [
{ label: '序号', key: 'seq', width: 70 },
{ label: '卷号', key: 'volume_number', width: 90 },
{ label: '匹数', key: 'roll', width: 90 },
{ label: '数量(KG)', key: 'weight', width: 110 },
{ label: '条码', key: 'bar_code', width: 240 },
{ label: '仓位', key: 'position', width: 100 },
{ label: '颜色', key: 'gray_fabric_color_name', width: 100 },
{ label: '织厂', key: 'supplier_name', width: 120 },
{ label: '机台', key: 'machine_number', width: 90 },
{ label: '库龄(天)', key: 'days_of_age', width: 90 },
];
export function formatStockWeightWithUnit(weight, unitName) {
const val = formatWeightKg(weight);
if (val === 0 && (weight === 0 || weight === '0')) return unitName ? `0 ${unitName}` : '0';
if (!weight && weight !== 0) return '-';
return unitName ? `${val} ${unitName}` : `${val}`;
}
export function formatDisplayCell(value) {
if (value === null || value === undefined || value === '') return '-';
return String(value);
}
export function toQueryString(params = {}) {
return Object.keys(params)
.filter((key) => {
const val = params[key];
return val !== '' && val !== null && val !== undefined;
})
.map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(params[key])}`)
.join('&');
}
export function parsePageQuery(options = {}) {
const parsed = { ...options };
['grey_fabric_id', 'warehouse_id', 'supplier_id', 'gray_fabric_color_id', 'warehouse_sum_id'].forEach((key) => {
if (parsed[key] !== undefined && parsed[key] !== '') {
const num = Number(parsed[key]);
if (!Number.isNaN(num)) parsed[key] = num;
}
});
return parsed;
}
/** 第一维度接口筛选:仅坯布编号、坯布名称 */
export function buildGroupListQuery(filters = {}) {
const params = {};
if (filters.grey_fabric_code) params.grey_fabric_code = filters.grey_fabric_code;
if (filters.grey_fabric_name) params.grey_fabric_name = filters.grey_fabric_name;
return params;
}
/** 第二维度接口筛选:坯布 id + 机台号 */
export function buildStockListQuery(filters = {}, context = {}) {
const params = {};
if (context.grey_fabric_id) params.grey_fabric_id = context.grey_fabric_id;
if (filters.machine_number) params.machine_number = filters.machine_number;
return params;
}
export function buildDetailQuery(row = {}, context = {}) {
const params = {};
const greyFabricId = row.grey_fabric_id || context.grey_fabric_id;
if (greyFabricId) params.grey_fabric_id = greyFabricId;
if (row.warehouse_id || context.warehouse_id) {
params.warehouse_id = row.warehouse_id || context.warehouse_id;
}
if (row.supplier_id) params.supplier_id = row.supplier_id;
if (row.gray_fabric_color_id) params.gray_fabric_color_id = row.gray_fabric_color_id;
if (row.machine_number) params.machine_number = row.machine_number;
if (row.yarn_batch) params.yarn_batch = row.yarn_batch;
if (row.produce_order_no) params.produce_order_no = row.produce_order_no;
if (row.source_code) params.source_code = row.source_code;
if (row.id) params.warehouse_sum_id = row.id;
if (row.warehouse_sum_id) params.warehouse_sum_id = row.warehouse_sum_id;
return params;
}
export function buildStockListNavigateQuery(item) {
return {
grey_fabric_id: item.grey_fabric_id,
grey_fabric_code: item.grey_fabric_code || '',
grey_fabric_name: item.grey_fabric_name || '',
warehouse_id: item.warehouse_id || '',
};
}
export function buildDetailNavigateQuery(row, context = {}) {
const detailQuery = buildDetailQuery(row, context);
return {
...detailQuery,
grey_fabric_code: row.grey_fabric_code || context.grey_fabric_code || '',
grey_fabric_name: row.grey_fabric_name || context.grey_fabric_name || '',
gray_fabric_color_name: row.gray_fabric_color_name || '',
supplier_name: row.supplier_name || '',
machine_number: row.machine_number || '',
yarn_batch: row.yarn_batch || '',
warehouse_name: row.warehouse_name || '',
stock_roll: row.stock_roll_display || '',
stock_weight: row.stock_weight_display || '',
};
}
export function mapGroupTableRow(row) {
const code = row.grey_fabric_code || '';
const name = row.grey_fabric_name || '';
return {
...row,
_key: `${row.grey_fabric_id || ''}_${row.warehouse_id || ''}`,
fabric_label: code && name ? `${code}#${name}` : (code || name || '-'),
warehouse_name: formatDisplayCell(row.warehouse_name || row.receiver_name),
stock_roll_display: formatRoll(row.stock_roll),
stock_weight_display: formatStockWeightWithUnit(row.stock_weight, row.unit_name),
};
}
export function mapStockTableRow(row) {
const unitName = row.unit_name || '';
return {
...row,
_key: row.id || `${row.grey_fabric_id}_${row.gray_fabric_color_id}_${row.supplier_id}_${row.machine_number}`,
gray_fabric_color_name: formatDisplayCell(row.gray_fabric_color_name),
grey_fabric_code: formatDisplayCell(row.grey_fabric_code),
grey_fabric_name: formatDisplayCell(row.grey_fabric_name),
grey_fabric_level_name: formatDisplayCell(row.grey_fabric_level_name),
grey_fabric_width_and_unit_name: formatDisplayCell(row.grey_fabric_width_and_unit_name),
grey_fabric_gram_weight_and_unit_name: formatDisplayCell(row.grey_fabric_gram_weight_and_unit_name),
component: formatDisplayCell(row.component),
customer_name: formatDisplayCell(row.customer_name),
supplier_name: formatDisplayCell(row.supplier_name),
machine_number: formatDisplayCell(row.machine_number),
needle_size: formatDisplayCell(row.needle_size),
yarn_batch: formatDisplayCell(row.yarn_batch),
raw_material_yarn_name: formatDisplayCell(row.raw_material_yarn_name),
raw_material_batch_num: formatDisplayCell(row.raw_material_batch_num),
raw_material_batch_brand: formatDisplayCell(row.raw_material_batch_brand),
warehouse_name: formatDisplayCell(row.warehouse_name),
receiver_name: formatDisplayCell(row.receiver_name),
warehouse_remark: formatDisplayCell(row.warehouse_remark),
dye_unit_use_order_no: formatDisplayCell(row.dye_unit_use_order_no),
produce_order_no: formatDisplayCell(row.produce_order_no),
source_code: formatDisplayCell(row.source_code),
source_time: formatDisplayCell((row.source_time || '').slice(0, 10)),
source_remark: formatDisplayCell(row.source_remark),
book_roll_display: row.book_roll != null && row.book_roll !== '' ? formatRoll(row.book_roll) : '-',
stock_roll_display: formatRoll(row.stock_roll),
stock_weight_display: formatStockWeightWithUnit(row.stock_weight, unitName),
stock_cost_display: row.stock_cost != null && row.stock_cost !== '' ? formatWeightKg(row.stock_cost) : '-',
single_price_display: row.single_price != null && row.single_price !== '' ? formatWeightKg(row.single_price) : '-',
buoyant_weight_price_display: row.buoyant_weight_price != null && row.buoyant_weight_price !== ''
? formatWeightKg(row.buoyant_weight_price) : '-',
creator_name: formatDisplayCell(row.creator_name),
create_time: formatDisplayCell(row.create_time),
update_user_name: formatDisplayCell(row.update_user_name),
update_time: formatDisplayCell(row.update_time),
};
}
export function sumStockTotals(list = []) {
let roll = 0;
let weight = 0;
(list || []).forEach((item) => {
roll += Number(item.stock_roll || 0);
weight += Number(item.stock_weight || 0);
});
return {
roll: formatRoll(roll),
weight: formatWeightKg(weight),
count: list.length,
};
}
export function sumDetailTotals(list = []) {
let roll = 0;
let weight = 0;
(list || []).forEach((item) => {
roll += Number(item.num || 0);
weight += Number(item.weight || 0);
});
return {
roll: formatRoll(roll),
weight: formatWeightKg(weight),
count: list.length,
};
}
export function mapWarehouseDetailRows(list = []) {
return (list || []).map((item, index) => ({
seq: index + 1,
volume_number: item.volume_number || '-',
roll: item.num != null && item.num !== '' ? formatRoll(item.num) : '-',
weight: item.weight != null && item.weight !== '' ? formatWeightKg(item.weight) : '-',
bar_code: item.bar_code || item.fabric_piece_code || '-',
position: item.warehouse_bin_Name || '-',
gray_fabric_color_name: item.gray_fabric_color_name || '-',
supplier_name: item.supplier_name || '-',
machine_number: item.machine_number || '-',
days_of_age: item.days_of_age != null && item.days_of_age !== '' ? item.days_of_age : '-',
}));
}
export function getWarehouseDetailTableWidth(columns = WAREHOUSE_DETAIL_COLUMNS) {
const total = columns.reduce((sum, col) => sum + (col.width || 120), 0);
return `${total}rpx`;
}
export function fetchAllWarehouseList(listFn, params = {}, pageSize = LIST_PAGE_SIZE) {
return fetchAllOrderList(listFn, params, pageSize);
}
export function calcTableHeight(rowCount, options = {}) {
const headerPx = options.headerPx || 44;
const rowPx = options.rowPx || 44;
const minPx = options.minPx || 200;
const maxPx = options.maxPx || 520;
const total = headerPx + rowCount * rowPx;
return `${Math.min(Math.max(total, minPx), maxPx)}px`;
}

View File

@ -0,0 +1,50 @@
<template>
<view class="myCard">
<view class="cardTopName">
<text>{{ item.grey_fabric_code || '-' }}</text>
<text class="stockTag">{{ item.stock_roll_display }} </text>
</view>
<view class="cardRow">
<view>坯布名称</view>
<view>{{ item.grey_fabric_name || '-' }}</view>
</view>
<view class="cardRow">
<view>  </view>
<view>{{ item.warehouse_name || item.receiver_name || '-' }}</view>
</view>
<view class="cardRow">
<view>库存数量</view>
<view>{{ item.stock_weight_display }} KG{{ item.unit_label }}</view>
</view>
<view v-if="!isDetail" class="lookDetail">
<text>查看维度汇总</text>
<u-icon name="arrow-right" size="36" />
</view>
</view>
</template>
<script>
export default {
props: {
item: { type: Object, default: () => ({}) },
index: { type: Number, default: 0 },
isDetail: { type: Boolean, default: false },
},
};
</script>
<style scoped>
.cardTopName {
display: flex;
align-items: center;
justify-content: space-between;
}
.stockTag {
font-size: 24rpx;
padding: 4rpx 12rpx;
border-radius: 6rpx;
font-weight: normal;
background: #e6f7ff;
color: #1890ff;
}
</style>

View File

@ -0,0 +1,62 @@
<template>
<view class="myCard">
<view class="cardTopName">
<text>{{ item.gray_fabric_color_name || '未分色' }}</text>
<text class="stockTag">{{ item.stock_roll_display }} </text>
</view>
<view class="cardRow">
<view>  </view>
<view>{{ item.supplier_name || '-' }}</view>
</view>
<view class="cardRow">
<view> </view>
<view>{{ item.machine_number || '-' }}</view>
</view>
<view class="cardRow">
<view>  </view>
<view>{{ item.yarn_batch || '-' }}</view>
</view>
<view class="cardRow">
<view>  </view>
<view>{{ item.warehouse_name || '-' }}</view>
</view>
<view class="cardRow">
<view>幅宽/克重</view>
<view>{{ item.grey_fabric_width_and_unit_name || '-' }} / {{ item.grey_fabric_gram_weight_and_unit_name || '-' }}</view>
</view>
<view class="cardRow">
<view>库存数量</view>
<view>{{ item.stock_weight_display }} KG{{ item.unit_label }}</view>
</view>
<view v-if="!isDetail" class="lookDetail">
<text>查看细码明细</text>
<u-icon name="arrow-right" size="36" />
</view>
</view>
</template>
<script>
export default {
props: {
item: { type: Object, default: () => ({}) },
index: { type: Number, default: 0 },
isDetail: { type: Boolean, default: false },
},
};
</script>
<style scoped>
.cardTopName {
display: flex;
align-items: center;
justify-content: space-between;
}
.stockTag {
font-size: 24rpx;
padding: 4rpx 12rpx;
border-radius: 6rpx;
font-weight: normal;
background: #e6f7ff;
color: #1890ff;
}
</style>

View File

@ -0,0 +1,52 @@
<template>
<view class="warehouse-table-wrap">
<scroll-view scroll-x class="tableScrollX">
<wyb-table
ref="table"
:headers="headers"
:contents="contents"
:width="tableWidth"
:height="height"
:first-line-fixed="firstLineFixed"
@onCellClick="onCellClick"
/>
</scroll-view>
</view>
</template>
<script>
import wybTable from '@/components/wyb-table/wyb-table.vue';
export default {
components: { wybTable },
props: {
headers: { type: Array, default: () => [] },
contents: { type: Array, default: () => [] },
height: { type: String, default: 'auto' },
firstLineFixed: { type: Boolean, default: true },
},
computed: {
tableWidth() {
const total = (this.headers || []).reduce((sum, col) => sum + (col.width || 160), 0);
return `${total}rpx`;
},
},
methods: {
onCellClick(event) {
if (event && event.lineData) {
this.$emit('row-click', event.lineData, event);
}
},
},
};
</script>
<style scoped>
.warehouse-table-wrap {
width: 100%;
background: #fff;
}
.tableScrollX {
width: 100%;
}
</style>

View File

@ -597,6 +597,27 @@
"navigationBarTitleText": "查看坯布出仓单",
"enablePullDownRefresh": false
}
},{
"path" : "pages/storefabric/storeFabricWarehouseGroupList",
"style" :
{
"navigationBarTitleText": "坯布库存",
"enablePullDownRefresh": false
}
},{
"path" : "pages/storefabric/storeFabricWarehouseStockList",
"style" :
{
"navigationBarTitleText": "坯布库存汇总",
"enablePullDownRefresh": false
}
},{
"path" : "pages/storefabric/storeFabricWarehouseDetail",
"style" :
{
"navigationBarTitleText": "细码明细",
"enablePullDownRefresh": false
}
},{
"path" : "pages/storefabric/storefabricstoresearch",
"style" :

View File

@ -0,0 +1,260 @@
<template>
<view class="warehouse-detail-page">
<view class="infoCard">
<view class="infoTitle">坯布资料</view>
<view class="infoRow">
<text class="infoLabel">坯布编号</text>
<text class="infoValue">{{ header.grey_fabric_code || '-' }}</text>
</view>
<view class="infoRow">
<text class="infoLabel">坯布名称</text>
<text class="infoValue">{{ header.grey_fabric_name || '-' }}</text>
</view>
<view class="infoRow">
<text class="infoLabel">  </text>
<text class="infoValue">{{ header.gray_fabric_color_name || '-' }}</text>
</view>
<view class="infoRow">
<text class="infoLabel">  </text>
<text class="infoValue">{{ header.supplier_name || '-' }}</text>
</view>
<view class="infoRow">
<text class="infoLabel"> </text>
<text class="infoValue">{{ header.machine_number || '-' }}</text>
</view>
<view class="infoRow">
<text class="infoLabel">  </text>
<text class="infoValue">{{ header.yarn_batch || '-' }}</text>
</view>
<view class="infoRow">
<text class="infoLabel">  </text>
<text class="infoValue">{{ header.warehouse_name || '-' }}</text>
</view>
<view class="infoRow">
<text class="infoLabel">汇总库存</text>
<text class="infoValue">{{ header.stock_roll || '-' }} / {{ header.stock_weight || '-' }} KG</text>
</view>
</view>
<view class="summaryBar">
<text>细码{{ totals.count }} / {{ totals.roll }} / {{ totals.weight }} KG</text>
</view>
<scroll-view
scroll-y
:style="{ height: scrollHeight }"
refresher-enabled
:refresher-triggered="triggered"
@refresherrefresh="onRefresh"
>
<dataNull
v-if="tableRows.length === 0"
src="/src/static/img/chahua/gjNull.png"
title="暂无细码明细"
title1="请返回上一级调整筛选条件"
/>
<scroll-view v-else scroll-x class="tableScroll">
<view class="fineTable" :style="{ width: tableWidth }">
<view class="tableRow tableHead">
<view
v-for="col in columns"
:key="col.key"
class="tableCell headCell"
:style="cellStyle(col)"
>{{ col.label }}</view>
</view>
<view v-for="(row, rowIndex) in tableRows" :key="rowIndex" class="tableRow">
<view
v-for="col in columns"
:key="col.key"
class="tableCell"
:style="cellStyle(col)"
>{{ row[col.key] }}</view>
</view>
</view>
</scroll-view>
</scroll-view>
</view>
</template>
<script>
import {
WAREHOUSE_DETAIL_COLUMNS,
buildDetailQuery,
fetchAllWarehouseList,
getWarehouseDetailTableWidth,
mapWarehouseDetailRows,
parsePageQuery,
sumDetailTotals,
} from '@/common/storeFabricWarehouse';
export default {
data() {
return {
rawList: [],
scrollHeight: '667px',
triggered: false,
columns: WAREHOUSE_DETAIL_COLUMNS,
header: {
grey_fabric_id: '',
grey_fabric_code: '',
grey_fabric_name: '',
gray_fabric_color_name: '',
supplier_name: '',
machine_number: '',
yarn_batch: '',
warehouse_name: '',
stock_roll: '',
stock_weight: '',
},
queryParams: {},
};
},
computed: {
tableRows() {
return mapWarehouseDetailRows(this.rawList);
},
tableWidth() {
return getWarehouseDetailTableWidth(this.columns);
},
totals() {
return sumDetailTotals(this.rawList);
},
},
onLoad(options) {
const parsed = parsePageQuery(options || {});
this.header = {
grey_fabric_id: parsed.grey_fabric_id || '',
grey_fabric_code: parsed.grey_fabric_code || '',
grey_fabric_name: parsed.grey_fabric_name || '',
gray_fabric_color_name: parsed.gray_fabric_color_name || '',
supplier_name: parsed.supplier_name || '',
machine_number: parsed.machine_number || '',
yarn_batch: parsed.yarn_batch || '',
warehouse_name: parsed.warehouse_name || '',
stock_roll: parsed.stock_roll || '',
stock_weight: parsed.stock_weight || '',
};
this.queryParams = buildDetailQuery(parsed, parsed);
uni.setNavigationBarTitle({ title: '细码明细' });
uni.getSystemInfo({
success: (res) => {
this.scrollHeight = `${res.windowHeight - 360}px`;
},
});
if (!this.queryParams.grey_fabric_id) {
uni.showToast({ title: '缺少坯布参数', icon: 'none' });
return;
}
this.loadList();
},
methods: {
cellStyle(col) {
return {
width: `${col.width}rpx`,
minWidth: `${col.width}rpx`,
maxWidth: `${col.width}rpx`,
};
},
loadList() {
fetchAllWarehouseList((p) => this.$u.api.gfmWarehouse.detailList(p), this.queryParams)
.then((rows) => {
this.triggered = false;
this.rawList = rows || [];
})
.catch((err) => {
this.triggered = false;
this.rawList = [];
uni.showToast({ title: err.message || '加载失败', icon: 'none' });
});
},
onRefresh() {
this.triggered = true;
this.loadList();
},
},
};
</script>
<style>
page { background-color: #F8F8F8; }
.warehouse-detail-page { min-height: 100%; padding-bottom: 24rpx; }
.infoCard {
margin: 20rpx 24rpx 0;
padding: 20rpx 24rpx;
background: #fff;
border-radius: 12rpx;
}
.infoTitle {
font-size: 30rpx;
font-weight: bold;
margin-bottom: 16rpx;
color: #333;
}
.infoRow {
display: flex;
font-size: 26rpx;
padding: 8rpx 0;
}
.infoLabel {
width: 160rpx;
color: #999;
flex-shrink: 0;
}
.infoValue {
flex: 1;
color: #333;
word-break: break-all;
}
.summaryBar {
margin: 16rpx 24rpx 0;
padding: 12rpx 16rpx;
font-size: 26rpx;
color: #666;
background: #fff;
border-radius: 8rpx;
}
.tableScroll {
width: 100%;
margin: 16rpx 24rpx 0;
background: #fff;
border-radius: 8rpx;
box-sizing: border-box;
}
.fineTable {
display: inline-block;
vertical-align: top;
border: 1rpx solid #e1e1e1;
box-sizing: border-box;
}
.tableRow {
display: flex;
flex-direction: row;
flex-wrap: nowrap;
border-bottom: 1rpx solid #e1e1e1;
}
.tableRow:last-child {
border-bottom: none;
}
.tableHead {
background: #f1f1f1;
}
.tableCell {
flex-shrink: 0;
padding: 12rpx 8rpx;
font-size: 22rpx;
color: #333;
text-align: center;
border-right: 1rpx solid #e1e1e1;
box-sizing: border-box;
word-break: break-all;
white-space: normal;
}
.tableCell:last-child {
border-right: none;
}
.headCell {
font-weight: bold;
color: #3e3e3e;
}
</style>

View File

@ -0,0 +1,154 @@
<template>
<view class="warehouse-page">
<view class="filterBar">
<u-search
v-model="filters.grey_fabric_code"
placeholder="坯布编号"
shape="square"
:show-action="false"
height="64"
@search="loadList"
@custom="loadList"
/>
<u-search
v-model="filters.grey_fabric_name"
placeholder="坯布名称"
shape="square"
:show-action="false"
height="64"
@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="!loading && tableContents.length === 0"
src="/src/static/img/chahua/gjNull.png"
title="暂无库存汇总"
title1="请输入坯布编号或名称查询"
/>
<view v-else-if="tableContents.length" class="tableBox">
<WarehouseDataTable
:headers="tableHeaders"
:contents="tableContents"
:height="tableHeight"
@row-click="goStockList"
/>
</view>
</scroll-view>
</view>
</template>
<script>
import WarehouseDataTable from '@/components/storefabric/WarehouseDataTable.vue';
import {
GROUP_TABLE_COLUMNS,
buildGroupListQuery,
buildStockListNavigateQuery,
calcTableHeight,
fetchAllWarehouseList,
mapGroupTableRow,
sumStockTotals,
toQueryString,
} from '@/common/storeFabricWarehouse';
export default {
components: { WarehouseDataTable },
data() {
return {
list: [],
scrollHeight: '667px',
triggered: false,
loading: false,
tableHeaders: GROUP_TABLE_COLUMNS,
filters: {
grey_fabric_code: '',
grey_fabric_name: '',
},
};
},
computed: {
tableContents() {
return this.list.map(mapGroupTableRow);
},
totals() {
return sumStockTotals(this.list);
},
tableHeight() {
return calcTableHeight(this.tableContents.length);
},
},
onLoad() {
uni.setNavigationBarTitle({ title: '坯布库存' });
uni.getSystemInfo({
success: (res) => {
this.scrollHeight = `${res.windowHeight - 108}px`;
},
});
this.loadList();
},
methods: {
loadList() {
if (this.loading) return;
this.loading = true;
const params = buildGroupListQuery(this.filters);
fetchAllWarehouseList((p) => this.$u.api.gfmWarehouse.groupSummaryList(p), params)
.then((rows) => {
this.triggered = false;
this.list = rows || [];
})
.catch((err) => {
this.triggered = false;
this.list = [];
uni.showToast({ title: err.message || '加载失败', icon: 'none' });
})
.finally(() => {
this.loading = false;
});
},
onRefresh() {
this.triggered = true;
this.loadList();
},
goStockList(row) {
const query = buildStockListNavigateQuery(row);
uni.navigateTo({
url: `./storeFabricWarehouseStockList?${toQueryString(query)}`,
});
},
},
};
</script>
<style>
page { background-color: #F8F8F8; }
.warehouse-page { min-height: 100%; }
.filterBar {
display: flex;
flex-direction: column;
gap: 8rpx;
padding: 12rpx 20rpx;
background: #fff;
}
.summaryBar {
padding: 10rpx 24rpx;
font-size: 24rpx;
color: #666;
background: #fff;
border-top: 1rpx solid #f0f0f0;
}
.tableBox {
padding: 12rpx;
}
</style>

View File

@ -0,0 +1,157 @@
<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>

View File

@ -92,24 +92,12 @@
</view>
<view class="grid-text">坯布出库</view>
</u-grid-item>
<!-- <u-grid-item @click="navTo('')">-->
<!-- <view class="home-icon icon-color12">-->
<!-- <i class="iconfont icon-ribao"></i>-->
<!-- </view>-->
<!-- <view class="grid-text">坯布盘点</view>-->
<!-- </u-grid-item>-->
<!-- <u-grid-item @click="navTo('')">-->
<!-- <view class="home-icon icon-color04">-->
<!-- <i class="iconfont icon-tongzhi"></i>-->
<!-- </view>-->
<!-- <view class="grid-text">坯布移架</view>-->
<!-- </u-grid-item>-->
<!-- <u-grid-item @click="navTo('/pages/storefabric/storefabricstoresearch')">-->
<!-- <view class="home-icon icon-color05">-->
<!-- <i class="iconfont icon-huiyishi"></i>-->
<!-- </view>-->
<!-- <view class="grid-text">坯布库存</view>-->
<!-- </u-grid-item>-->
<u-grid-item @click="navTo('/pages/storefabric/storeFabricWarehouseGroupList')">
<view class="home-icon icon-color05">
<i class="iconfont icon-huiyishi"></i>
</view>
<view class="grid-text">坯布库存</view>
</u-grid-item>
<!-- <u-grid-item @click="navTo('/pages/storefabric/storefabricstoreallin')">-->
<!-- <view class="home-icon icon-color05">-->
<!-- <i class="iconfont icon-huiyishi"></i>-->