Cpte-Vue3/src/views/receive/asn/Asn.data.ts

212 lines
4.8 KiB
TypeScript

import { BasicColumn } from '/@/components/Table';
import { JVxeTypes, JVxeColumn } from '/@/components/jeecg/JVxeTable/types';
import { render } from '@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
{
title: '系统单号',
align: 'center',
dataIndex: 'orderNo',
},
{
title: '外部单号',
align: 'center',
dataIndex: 'thirdOrderNo',
},
{
title: '任务号',
align: 'center',
dataIndex: 'no',
},
{
title: '订单状态',
align: 'center',
dataIndex: 'status_dictText',
customRender: ({ text }) => {
//入库状态:1.已创建;2.部分收货;3.收货完成;4.已取消。
const statusColorMap = {
'已创建': 'orange',
'部分收货': 'blue',
'收货完成': 'green',
'已取消': 'red',
};
const color = statusColorMap[text] || 'red';
return render.renderTag(text, color);
},
},
{
title: '单据类型',
align: 'center',
dataIndex: 'orderType_dictText',
},
{
title: '需求数量',
align: 'center',
dataIndex: 'orderQty',
},
{
title: '收货数量',
align: 'center',
dataIndex: 'receivedQty',
},
{
title: '供应商',
align: 'center',
dataIndex: 'supplierCode',
},
{
title: '外部仓库',
align: 'center',
dataIndex: 'whCode',
},
{
title: '订单日期',
align: 'center',
dataIndex: 'orderDate',
},
];
//子表表格配置
export const asnDetailColumns: JVxeColumn[] = [
{
title: '入库单ID',
key: 'asnId',
type: JVxeTypes.hidden,
},
{
title: '物料',
key: 'itemId',
type: JVxeTypes.selectSearch,
width: 150,
async: true, // 异步搜索,默认为 true
//查询状态启用、未删除的物料
dictCode: 'base_item where iz_active=1 and del_flag=0,item_code,id',
tipsContent: '请搜索物料',
validateRules: [
{
required: true, // 必填
message: '请选择${title}', // 显示的文本
},
],
},
{
title: '单位',
key: 'unit',
type: JVxeTypes.select,
dictCode: 'package_unit',
width: '130px',
placeholder: '请选择${title}',
defaultValue: '托',
},
{
title: '容器',
key: 'stockId',
type: JVxeTypes.selectSearch,
width: 150,
async: true, // 异步搜索,默认为 true
//查询状态为可用、启用、未删除的容器
dictCode: 'base_stock where iz_active=1 and del_flag=0,stock_code,id',
tipsContent: '请搜索容器',
validateRules: [
{
required: true, // 必填
message: '请选择${title}', // 显示的文本
},
],
},
{
title: '库位',
key: 'pointId',
type: JVxeTypes.selectSearch,
width: 150,
async: true, // 异步搜索,默认为 true
//查询状态为可用、启用、未删除的库位
dictCode: 'base_point where iz_active=1 and del_flag=0,point_code,id',
tipsContent: '请搜索库位',
validateRules: [
{
required: true, // 必填
message: '请选择${title}', // 显示的文本
},
],
},
{
title: '需求数量',
key: 'orderQty',
type: JVxeTypes.inputNumber,
width: '130px',
validateRules: [
{
required: true, // 必填
message: '请输入${title}', // 显示的文本
},
],
},
{
title: '收货数量',
key: 'receivedQty',
type: JVxeTypes.normal,
width: '130px',
defaultValue: '0',
disabled: true,
},
{
title: '明细状态',
key: 'status',
type: JVxeTypes.normal,
width: '120px',
defaultValue: '1',
formatter: ({ cellValue }) => {
//入库状态:1.已创建;2.部分收货;3.收货完成;4.已取消。
const statusMap = {
1: '已创建',
2: '部分收货',
3: '收货完成',
4: '已取消',
};
// 状态颜色映射
const statusColorMap = {
'已创建': 'orange',
'部分收货': 'blue',
'收货完成': 'green',
'已取消': 'red',
};
const text = statusMap[cellValue] || '未知状态';
const color = statusColorMap[text] || 'red';
return render.renderTag(text, color);
},
},
{
title: '项目号',
key: 'project',
type: JVxeTypes.input,
width: '130px',
placeholder: '请输入${title}',
defaultValue: null,
},
{
title: '任务号',
key: 'taskNo',
type: JVxeTypes.input,
width: '130px',
placeholder: '请输入${title}',
defaultValue: null,
},
{
title: '批次号',
key: 'propC1',
type: JVxeTypes.input,
width: '130px',
placeholder: '请输入${title}',
defaultValue: null,
},
{
title: '外部库存状态',
key: 'propC3',
type: JVxeTypes.input,
width: '130px',
placeholder: '请输入${title}',
defaultValue: null,
},
];