chenfang
4 weeks ago
18 changed files with 5159 additions and 367 deletions
@ -0,0 +1,738 @@ |
|||||
|
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
||||
|
import { dateFormatter, dateFormatter2 } from '@/utils/formatTime' |
||||
|
|
||||
|
/** |
||||
|
* @returns {Array} 库存余额 |
||||
|
*/ |
||||
|
export const Balance = useCrudSchemas( |
||||
|
reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: '器具代码', |
||||
|
field: 'itemCode', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
isSearch: true |
||||
|
}, |
||||
|
{ |
||||
|
label: '器具名称', |
||||
|
field: 'itemName', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
isSearch: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '物料描述1', |
||||
|
field: 'itemDesc1', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
hiddenSearchHigh: true,// 高级筛选中隐藏
|
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '物料描述2', |
||||
|
field: 'itemDesc2', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
hiddenSearchHigh: true,// 高级筛选中隐藏
|
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '物料类型', |
||||
|
field: 'itemType', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.ITEM_TYPE, |
||||
|
dictClass: 'string', |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
table: { |
||||
|
width: 100 |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '批次', |
||||
|
field: 'batch', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '供应商批次', |
||||
|
field: 'altBatch', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '包装号', |
||||
|
field: 'packingNumber', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '包装规格', |
||||
|
field: 'packUnit', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
table: { |
||||
|
width: 150 |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '包装数量', |
||||
|
field: 'packQty', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
table: { |
||||
|
width: 150 |
||||
|
} |
||||
|
}, |
||||
|
// {
|
||||
|
// label: '器具代码',
|
||||
|
// field: 'containerNumber',
|
||||
|
// sort: 'custom',
|
||||
|
// table: {
|
||||
|
// width: 150
|
||||
|
// },
|
||||
|
// isTable:false
|
||||
|
// },
|
||||
|
{ |
||||
|
label: '库存数量', |
||||
|
field: 'qty', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'InputNumber' |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建者', |
||||
|
field: 'creator', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '计量单位', |
||||
|
field: 'uom', |
||||
|
dictType: DICT_TYPE.UOM, |
||||
|
dictClass: 'string', |
||||
|
isTable: true, |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '库位代码', |
||||
|
field: 'locationCode', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
isSearch: true |
||||
|
}, |
||||
|
{ |
||||
|
label: '库存状态', |
||||
|
field: 'inventoryStatus', |
||||
|
dictType: DICT_TYPE.INVENTORY_STATUS, |
||||
|
dictClass: 'string', |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '库区类型', |
||||
|
field: 'areaType', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.AREA_TYPE, |
||||
|
dictClass: 'string', |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
table: { |
||||
|
width: 150 |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
{ |
||||
|
label: '仓库代码', |
||||
|
field: 'warehouseCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
table: { |
||||
|
width: 150 |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '库位组代码', |
||||
|
field: 'locationGroupCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
table: { |
||||
|
width: 150 |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '库区代码', |
||||
|
field: 'areaCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
table: { |
||||
|
width: 150 |
||||
|
} |
||||
|
}, |
||||
|
// {
|
||||
|
// label: 'ERP库位代码',
|
||||
|
// field: 'erpLocationCode',
|
||||
|
// dictType: DICT_TYPE.ERP_LOCATION,
|
||||
|
// dictClass: 'string',
|
||||
|
// isTable: false,
|
||||
|
// sort: 'custom',
|
||||
|
// table: {
|
||||
|
// width: 150
|
||||
|
// },
|
||||
|
// },
|
||||
|
// {
|
||||
|
// label: '替代批次',
|
||||
|
// field: 'altBatch',
|
||||
|
// sort: 'custom',
|
||||
|
// table: {
|
||||
|
// width: 150
|
||||
|
// },
|
||||
|
// isTable: false,
|
||||
|
// },
|
||||
|
{ |
||||
|
label: '到货日期', |
||||
|
field: 'arriveDate', |
||||
|
formatter: dateFormatter2, |
||||
|
detail: { |
||||
|
dateFormat: 'YYYY-MM-DD' |
||||
|
}, |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
style: { width: '100%' }, |
||||
|
type: 'date', |
||||
|
dateFormat: 'YYYY-MM-DD', |
||||
|
valueFormat: 'x' |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '生产日期', |
||||
|
field: 'produceDate', |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
formatter: dateFormatter2, |
||||
|
detail: { |
||||
|
dateFormat: 'YYYY-MM-DD' |
||||
|
}, |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
style: { width: '100%' }, |
||||
|
type: 'date', |
||||
|
dateFormat: 'YYYY-MM-DD', |
||||
|
valueFormat: 'x' |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '失效日期', |
||||
|
field: 'expireDate', |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
formatter: dateFormatter2, |
||||
|
detail: { |
||||
|
dateFormat: 'YYYY-MM-DD' |
||||
|
}, |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
style: { width: '100%' }, |
||||
|
type: 'date', |
||||
|
dateFormat: 'YYYY-MM-DD', |
||||
|
valueFormat: 'x' |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '货主代码', |
||||
|
field: 'ownerCode', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '锁定数量', |
||||
|
field: 'lockedQty', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
form: { |
||||
|
component: 'InputNumber' |
||||
|
} |
||||
|
}, |
||||
|
// {
|
||||
|
// label: '可用数量',
|
||||
|
// field: 'usableQty',
|
||||
|
// sort: 'custom',
|
||||
|
// table: {
|
||||
|
// width: 150
|
||||
|
// },
|
||||
|
// form: {
|
||||
|
// component: 'InputNumber',
|
||||
|
// }
|
||||
|
// },
|
||||
|
// {
|
||||
|
// label: '单价',
|
||||
|
// field: 'singlePrice',
|
||||
|
// sort: 'custom',
|
||||
|
// table: {
|
||||
|
// width: 150
|
||||
|
// },
|
||||
|
// form: {
|
||||
|
// component: 'InputNumber',
|
||||
|
// }
|
||||
|
// },
|
||||
|
// {
|
||||
|
// label: '金额',
|
||||
|
// field: 'amount',
|
||||
|
// sort: 'custom',
|
||||
|
// table: {
|
||||
|
// width: 150
|
||||
|
// },
|
||||
|
// form: {
|
||||
|
// component: 'InputNumber',
|
||||
|
// }
|
||||
|
// },
|
||||
|
// {
|
||||
|
// label: '入库时间',
|
||||
|
// field: 'putInTime',
|
||||
|
// isTable: true,
|
||||
|
// formatter: dateFormatter,
|
||||
|
// detail: {
|
||||
|
// dateFormat: 'YYYY-MM-DD HH:mm:ss'
|
||||
|
// },
|
||||
|
// sort: 'custom',
|
||||
|
// table: {
|
||||
|
// width: 150
|
||||
|
// },
|
||||
|
// form: {
|
||||
|
// component: 'DatePicker',
|
||||
|
// componentProps: {
|
||||
|
// type: 'datetime',
|
||||
|
// }
|
||||
|
// }
|
||||
|
// },
|
||||
|
{ |
||||
|
label: '是否冻结', |
||||
|
field: 'frozen', |
||||
|
dictType: DICT_TYPE.TRUE_FALSE, |
||||
|
dictClass: 'string', |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'Switch', |
||||
|
value: 'TRUE', |
||||
|
componentProps: { |
||||
|
inactiveValue: 'FALSE', |
||||
|
activeValue: 'TRUE' |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
// {
|
||||
|
// label: '冻结原因',
|
||||
|
// field: 'frozenReason',
|
||||
|
// dictType: DICT_TYPE.FROZEN_REASON,
|
||||
|
// dictClass: 'string',
|
||||
|
// isTable: true,
|
||||
|
// sort: 'custom',
|
||||
|
// table: {
|
||||
|
// width: 150
|
||||
|
// },
|
||||
|
// },
|
||||
|
// {
|
||||
|
// label: '重量',
|
||||
|
// field: 'weight',
|
||||
|
// sort: 'custom',
|
||||
|
// table: {
|
||||
|
// width: 150
|
||||
|
// },
|
||||
|
// form: {
|
||||
|
// component: 'InputNumber',
|
||||
|
// }
|
||||
|
// },
|
||||
|
// {
|
||||
|
// label: '面积',
|
||||
|
// field: 'area',
|
||||
|
// sort: 'custom',
|
||||
|
// table: {
|
||||
|
// width: 150
|
||||
|
// },
|
||||
|
// form: {
|
||||
|
// component: 'InputNumber',
|
||||
|
// }
|
||||
|
// },
|
||||
|
// {
|
||||
|
// label: '体积',
|
||||
|
// field: 'volume',
|
||||
|
// sort: 'custom',
|
||||
|
// table: {
|
||||
|
// width: 150
|
||||
|
// },
|
||||
|
// form: {
|
||||
|
// component: 'InputNumber',
|
||||
|
// }
|
||||
|
// },
|
||||
|
{ |
||||
|
label: '最后事务号', |
||||
|
field: 'lastTransNumber', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
table: { |
||||
|
width: 150 |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建时间', |
||||
|
field: 'createTime', |
||||
|
formatter: dateFormatter, |
||||
|
detail: { |
||||
|
dateFormat: 'YYYY-MM-DD HH:mm:ss' |
||||
|
}, |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 180 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
style: { width: '100%' }, |
||||
|
type: 'datetime', |
||||
|
dateFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
valueFormat: 'x' |
||||
|
} |
||||
|
}, |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
search: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
type: 'datetimerange', |
||||
|
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '最后更新时间', |
||||
|
field: 'updateTime', |
||||
|
formatter: dateFormatter, |
||||
|
detail: { |
||||
|
dateFormat: 'YYYY-MM-DD HH:mm:ss' |
||||
|
}, |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 180 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
type: 'datetime', |
||||
|
dateFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
valueFormat: 'x' |
||||
|
} |
||||
|
}, |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '最后更新者', |
||||
|
field: 'updater', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
}, |
||||
|
// TODO: 临时添加 方便操作
|
||||
|
{ |
||||
|
label: '操作', |
||||
|
field: 'action', |
||||
|
isDetail: false, |
||||
|
isForm: false, |
||||
|
table: { |
||||
|
width: 200, |
||||
|
fixed: 'right' |
||||
|
} |
||||
|
} |
||||
|
]) |
||||
|
) |
||||
|
|
||||
|
|
||||
|
export const TransactionTab = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: 'id', |
||||
|
field: 'id', |
||||
|
sort: 'custom', |
||||
|
isTable: true, |
||||
|
isForm: true, |
||||
|
isDetail:true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建时间', |
||||
|
field: 'createTime', |
||||
|
isTable: true, |
||||
|
formatter: dateFormatter, |
||||
|
detail: { |
||||
|
dateFormat: 'YYYY-MM-DD HH:mm:ss' |
||||
|
}, |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
style: {width: '100%'}, |
||||
|
type: 'date', |
||||
|
dateFormat: 'YYYY-MM-DD', |
||||
|
valueFormat: 'x', |
||||
|
} |
||||
|
}, |
||||
|
isSearch: true, |
||||
|
search: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
type: 'daterange', |
||||
|
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '业务类型', |
||||
|
field: 'businessType', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '事务类型', |
||||
|
field: 'transactionType', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '库存动作', |
||||
|
field: 'inventoryAction', |
||||
|
dictType: DICT_TYPE.INVENTORY_ACTION, |
||||
|
dictClass: 'string', |
||||
|
isTable: true, |
||||
|
isSearch: true, |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '业务记录号', |
||||
|
field: 'recordNumber', |
||||
|
sort: 'custom', |
||||
|
isTable: true, |
||||
|
isSearch: true, |
||||
|
table: { |
||||
|
width: 180 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '包装号', |
||||
|
field: 'packingNumber', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '物料代码', |
||||
|
field: 'itemCode', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '批次', |
||||
|
field: 'batch', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '替代批次', |
||||
|
field: 'altBatch', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '库位代码', |
||||
|
field: 'locationCode', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '库存状态', |
||||
|
field: 'inventoryStatus', |
||||
|
dictType: DICT_TYPE.INVENTORY_STATUS, |
||||
|
dictClass: 'string', |
||||
|
isTable: true, |
||||
|
isSearch: true, |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '数量', |
||||
|
field: 'qty', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '事务号', |
||||
|
field: 'number', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 180 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '备注', |
||||
|
field: 'remark', |
||||
|
sort: 'custom', |
||||
|
isSearch: true |
||||
|
} |
||||
|
|
||||
|
])) |
||||
|
|
||||
|
// 表单校验
|
||||
|
export const BalanceRules = reactive({ |
||||
|
packingNumber: [ |
||||
|
{ required: true, message: '请选择包装号', trigger: 'change' } |
||||
|
], |
||||
|
// containerNumber: [
|
||||
|
// { required: true, message: '请选择器具号', trigger: 'change' }
|
||||
|
// ],
|
||||
|
itemCode: [ |
||||
|
{ required: true, message: '请选择物料代码', trigger: 'change' } |
||||
|
], |
||||
|
batch: [ |
||||
|
{ required: true, message: '请输入批次', trigger: 'blur' } |
||||
|
], |
||||
|
arriveDate: [ |
||||
|
{ required: true, message: '请选择到货日期', trigger: 'change' } |
||||
|
], |
||||
|
produceDate: [ |
||||
|
{ required: true, message: '请选择生产日期', trigger: 'change' } |
||||
|
], |
||||
|
}) |
@ -0,0 +1,373 @@ |
|||||
|
<template> |
||||
|
<ContentWrap> |
||||
|
<!-- 搜索工作栏 --> |
||||
|
<Search :schema="Balance.allSchemas.searchSchema" @search="searchList" @reset="searchList" /> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 列表头部 --> |
||||
|
<TableHead |
||||
|
:HeadButttondata="HeadButttondata" |
||||
|
@button-base-click="buttonBaseClick" |
||||
|
:route-name="routeName" |
||||
|
@updataTableColumns="updataTableColumns" |
||||
|
@searchFormClick="searchFormClick" |
||||
|
:allSchemas="Balance.allSchemas" |
||||
|
/> |
||||
|
|
||||
|
<!-- 列表 --> |
||||
|
<ContentWrap> |
||||
|
<Table ref="tableRef" v-clientTable |
||||
|
:selection="true" |
||||
|
:columns="tableColumns" |
||||
|
:data="tableObject.tableList" |
||||
|
:loading="tableObject.loading" |
||||
|
:pagination="{ |
||||
|
total: tableObject.total |
||||
|
}" |
||||
|
v-model:pageSize="tableObject.pageSize" |
||||
|
v-model:currentPage="tableObject.currentPage" |
||||
|
v-model:sort="tableObject.sort" |
||||
|
@getSelectionRows="getSelectionRows" |
||||
|
> |
||||
|
<template #itemCode="{row}"> |
||||
|
<el-button :type="row.frozen=='TRUE'||row.expireDate<dayjs().valueOf()?'danger':'primary'" link @click="openDetail(row, '物料代码', row.itemCode)"> |
||||
|
<span >{{ row.itemCode }}</span> |
||||
|
</el-button> |
||||
|
</template> |
||||
|
<template #action="{ row }"> |
||||
|
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> |
||||
|
</template> |
||||
|
</Table> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 表单弹窗:添加/修改 --> |
||||
|
<BasicForm |
||||
|
ref="basicFormRef" |
||||
|
@success="getList" |
||||
|
:rules="BalanceRules" |
||||
|
:formAllSchemas="Balance.allSchemas" |
||||
|
:apiUpdate="BalanceApi.updateBalance" |
||||
|
:apiCreate="BalanceApi.createBalance" |
||||
|
:isBusiness="false" |
||||
|
/> |
||||
|
|
||||
|
<!-- 详情 --> |
||||
|
<Detail |
||||
|
ref="detailRef" |
||||
|
:isBasic="true" |
||||
|
:allSchemas="TransactionTab.allSchemas" |
||||
|
:detailAllSchemas="TransactionTab.allSchemas" |
||||
|
:apiPage="apiPage" |
||||
|
:tabsExtend="tabsExtend" |
||||
|
:tabs="[{ |
||||
|
label: '库存事务', |
||||
|
prop: 'Transaction' |
||||
|
}]" |
||||
|
@changeTabs="changeTabs" |
||||
|
:tableObjectExtend="tableObjectExtend" |
||||
|
/> |
||||
|
|
||||
|
<!-- 导入 --> |
||||
|
<ImportForm ref="importFormRef" url="/wms/balance/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import dayjs from 'dayjs' |
||||
|
import download from '@/utils/download' |
||||
|
import * as BalanceApi from '@/api/wms/balance' |
||||
|
import * as PackageApi from '@/api/wms/package' |
||||
|
import BasicForm from '@/components/BasicForm/src/BasicForm.vue' |
||||
|
import { Balance,TransactionTab, BalanceRules } from './balance.data' |
||||
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
||||
|
import TableHead from '@/components/TableHead/src/TableHead.vue' |
||||
|
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' |
||||
|
import Detail from '@/components/Detail/src/Detail.vue' |
||||
|
import { getAccessToken } from '@/utils/auth' |
||||
|
import { getJmreportBaseUrl } from '@/utils/systemParam' |
||||
|
import { formatDate } from '@/utils/formatTime' |
||||
|
import { usePageLoading } from '@/hooks/web/usePageLoading' |
||||
|
const { loadStart, loadDone } = usePageLoading() |
||||
|
// 库存余额 |
||||
|
defineOptions({ name: 'Balance' }) |
||||
|
|
||||
|
const message = useMessage() // 消息弹窗 |
||||
|
const { t } = useI18n() // 国际化 |
||||
|
|
||||
|
const route = useRoute() //路由信息 |
||||
|
const routeName = ref() |
||||
|
routeName.value = route.name |
||||
|
const tableColumns = ref(Balance.allSchemas.tableColumns) |
||||
|
const tabsExtend = ref(false) |
||||
|
const apiPage = ref() |
||||
|
const tableObjectExtend = ref() |
||||
|
|
||||
|
//字段设置 更新主列表字段 |
||||
|
const updataTableColumns = (val) => { |
||||
|
tableColumns.value = val |
||||
|
} |
||||
|
|
||||
|
const { tableObject, tableMethods } = useTable({ |
||||
|
getListApi: BalanceApi.getBalanceByQJ // 分页接口 |
||||
|
}) |
||||
|
|
||||
|
// 获得表格的各种操作 |
||||
|
const { getList, setSearchParams } = tableMethods |
||||
|
|
||||
|
// 列表头部按钮 |
||||
|
const HeadButttondata = [ |
||||
|
// defaultButtons.defaultAddBtn({hasPermi:'wms:balance:create'}), // 新增 |
||||
|
// defaultButtons.defaultImportBtn({hasPermi:'wms:balance:import'}), // 导入 |
||||
|
defaultButtons.defaultExportBtn({hasPermi:'wms:balance:export'}), // 导出 |
||||
|
defaultButtons.mainLisSelectiontPointBtn(null), // 批量标签打印 |
||||
|
defaultButtons.defaultFreshBtn(null),//刷新 |
||||
|
defaultButtons.defaultFilterBtn(null), //筛选 |
||||
|
defaultButtons.defaultSetBtn(null), // 设置 |
||||
|
// { |
||||
|
// label: '自定义扩展按钮', |
||||
|
// name: 'zdy', |
||||
|
// hide: false, |
||||
|
// type: 'primary', |
||||
|
// icon: 'Select', |
||||
|
// color: '' |
||||
|
// }, |
||||
|
] |
||||
|
|
||||
|
// 头部按钮事件 |
||||
|
const buttonBaseClick = (val, item) => { |
||||
|
if (val == 'add') { // 新增 |
||||
|
openForm('create') |
||||
|
} else if (val == 'import') { // 导入 |
||||
|
handleImport() |
||||
|
} else if (val == 'export') { // 导出 |
||||
|
handleExport() |
||||
|
} else if (val == 'refresh') { // 刷新 |
||||
|
selectionRows.value = [] |
||||
|
if (tableObject.params.filters && tableObject.params.filters.length > 0 ) { |
||||
|
searchFormClick({ |
||||
|
filters: tableObject.params.filters |
||||
|
}) |
||||
|
} else { |
||||
|
getList() |
||||
|
} |
||||
|
} else if (val == 'filtrate') { // 筛选 |
||||
|
} else if (val=='selection_point'){// 批量打印 |
||||
|
handleSelectionPoint() |
||||
|
} else { // 其他按钮 |
||||
|
console.log('其他按钮', item) |
||||
|
} |
||||
|
} |
||||
|
const searchList = (model)=>{ |
||||
|
selectionRows.value = [] |
||||
|
setSearchParams(model) |
||||
|
} |
||||
|
watch( |
||||
|
() => tableObject.tableList, |
||||
|
() => { |
||||
|
const currentRows = selectionRows.value.find(item=>item.currentPage==tableObject.currentPage) |
||||
|
if(currentRows){ |
||||
|
nextTick(() => { |
||||
|
currentRows.selectionRows.forEach(item=>{ |
||||
|
tableRef.value.toggleRowSelection(item,true) |
||||
|
}) |
||||
|
}) |
||||
|
} |
||||
|
} |
||||
|
) |
||||
|
const selectionRows = ref<any>([]) |
||||
|
const tableRef = ref() |
||||
|
const getSelectionRows = (currentPage,currentPageSelectionRows) => { |
||||
|
console.log("getSelectionRows",currentPage,currentPageSelectionRows) |
||||
|
const currentRows = selectionRows.value.find(item=>item.currentPage==currentPage) |
||||
|
if(currentRows){ |
||||
|
currentRows.selectionRows = currentPageSelectionRows |
||||
|
}else{ |
||||
|
selectionRows.value.push({ |
||||
|
currentPage, |
||||
|
selectionRows:currentPageSelectionRows |
||||
|
}) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
const handleSelectionPoint = async ()=>{ |
||||
|
let rows:any = [] |
||||
|
selectionRows.value.forEach(item=>{ |
||||
|
rows = [...rows,...item.selectionRows.map(item1=>item1.packingNumber)] |
||||
|
}) |
||||
|
console.log('批量打印',rows.join(',')) |
||||
|
let getLoading = ElLoading.service({ |
||||
|
lock: true, |
||||
|
text: 'loading...', |
||||
|
background: 'rgba(0, 0, 0, 0.7)' |
||||
|
}) |
||||
|
PackageApi.getBalanceToPackageSelection(rows).then(res => { |
||||
|
console.log('res',res); |
||||
|
getLoading?.close() |
||||
|
if(res.zzLabel){ |
||||
|
//制造标签 |
||||
|
const src = ref(BASE_URL + '/jmreport/view/922734157577715712?token=' + getAccessToken()) |
||||
|
window.open(src.value+'&asn_number='+res.zzLabel) |
||||
|
} |
||||
|
if (res.cgLabel) { |
||||
|
//采购标签 |
||||
|
const src = ref(BASE_URL + '/jmreport/view/922729953438072832?token=' + getAccessToken()) |
||||
|
window.open(src.value+'&asn_number='+res.cgLabel) |
||||
|
} |
||||
|
|
||||
|
}).catch(err => { |
||||
|
console.log(err) |
||||
|
getLoading?.close() |
||||
|
}) |
||||
|
// window.open(srcPoint.value+'&relateNumber='+rows.join(',')) |
||||
|
} |
||||
|
// 列表-操作按钮 |
||||
|
const butttondata = [ |
||||
|
{ |
||||
|
label: '标签信息', |
||||
|
name: 'bqxx', |
||||
|
hide: false, |
||||
|
type: 'primary', |
||||
|
icon: '', |
||||
|
color: '', |
||||
|
link: true, |
||||
|
float:'right', |
||||
|
hasPermi: '' |
||||
|
}, |
||||
|
defaultButtons.mainListPointBtn(null), // 标签打印 |
||||
|
// defaultButtons.mainListEditBtn({hasPermi:'wms:balance:update'}), // 编辑 |
||||
|
// defaultButtons.mainListDeleteBtn({hasPermi:'wms:balance:delete'}), // 删除 |
||||
|
] |
||||
|
|
||||
|
// 列表-操作按钮事件 |
||||
|
const buttonTableClick = async (val, row) => { |
||||
|
if (val == 'bqxx') { |
||||
|
let aaa = 'HPQ;V1.0;I'+row.itemCode+';P'+row.packingNumber+';B'+row.batch+';Q'+row.qty+';U'+row.uom |
||||
|
alert(aaa) |
||||
|
}else if (val == 'point') { // 标签打印 |
||||
|
handlePoint(row) |
||||
|
} |
||||
|
// if (val == 'edit') { // 编辑 |
||||
|
// // const res = await BalanceApi.getItempackaging(row.id) |
||||
|
// openForm('update', row) |
||||
|
// } else if (val == 'delete') { // 删除 |
||||
|
// handleDelete(row.id) |
||||
|
// } |
||||
|
} |
||||
|
|
||||
|
/** 添加/修改操作 */ |
||||
|
const basicFormRef = ref() |
||||
|
const openForm = (type: string, row?: any) => { |
||||
|
basicFormRef.value.open(type, row) |
||||
|
} |
||||
|
|
||||
|
/** 详情操作 */ |
||||
|
const detailRef = ref() |
||||
|
const chooseRow = ref() |
||||
|
const openDetail = (row: any, titleName: any, titleValue: any) => { |
||||
|
chooseRow.value = row |
||||
|
detailRef.value.openDetail(row, titleName, titleValue,'transactionBalance') |
||||
|
} |
||||
|
|
||||
|
const BASE_URL = getJmreportBaseUrl() |
||||
|
const labelType = ref('') // 标签类别 采购还是制造等 |
||||
|
// 标签打印 |
||||
|
const handlePoint = async (row) => { |
||||
|
console.log(row.packingNumber,445555555555555); |
||||
|
PackageApi.getBalanceToPackage(row.packingNumber).then(res => { |
||||
|
console.log(777,res); |
||||
|
if (res.productionLineCode != null) { |
||||
|
labelType.value = 'zz' |
||||
|
} else { |
||||
|
labelType.value = 'cg' |
||||
|
} |
||||
|
PackageApi.batchPrintingLable((res.number)).then((resLable) =>{ |
||||
|
console.log(159,resLable ) |
||||
|
// 判断是采购还是制造 |
||||
|
if (labelType.value == 'cg') { |
||||
|
const src = ref(BASE_URL + '/jmreport/view/922729953438072832?token=' + getAccessToken()) |
||||
|
console.log(159,resLable ) |
||||
|
window.open(src.value+'&asn_number='+resLable) |
||||
|
} else { |
||||
|
const src = ref(BASE_URL + '/jmreport/view/922734157577715712?token=' + getAccessToken()) |
||||
|
window.open(src.value+'&asn_number='+resLable) |
||||
|
} |
||||
|
}) |
||||
|
}).catch(err => { |
||||
|
console.log(err) |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
/** 删除按钮操作 */ |
||||
|
const handleDelete = async (id: number) => { |
||||
|
try { |
||||
|
// 删除的二次确认 |
||||
|
await message.delConfirm() |
||||
|
// 发起删除 |
||||
|
await BalanceApi.deleteBalance(id) |
||||
|
message.success(t('common.delSuccess')) |
||||
|
// 刷新列表 |
||||
|
buttonBaseClick('refresh',null) |
||||
|
} catch {} |
||||
|
} |
||||
|
|
||||
|
/** 导出按钮操作 */ |
||||
|
const handleExport = async () => { |
||||
|
try { |
||||
|
// 导出的二次确认 |
||||
|
await message.exportConfirm() |
||||
|
// 发起导出 |
||||
|
loadStart() |
||||
|
const excelTitle = ref(route.meta.title) |
||||
|
const data = await BalanceApi.exportBalance(tableObject.params) |
||||
|
download.excel(data, `【${excelTitle.value}】【${formatDate(new Date())}】.xlsx`) |
||||
|
} catch { |
||||
|
} finally { |
||||
|
loadDone() |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 导入 */ |
||||
|
const importFormRef = ref() |
||||
|
const handleImport = () => { |
||||
|
importFormRef.value.open() |
||||
|
} |
||||
|
// 导入附件弹窗所需的参数 |
||||
|
const importTemplateData = reactive({ |
||||
|
templateUrl: '', |
||||
|
templateTitle: `【${route.meta.title}】导入模版.xlsx` |
||||
|
}) |
||||
|
// 导入成功之后 |
||||
|
const importSuccess = () => { |
||||
|
getList() |
||||
|
} |
||||
|
|
||||
|
// 筛选提交 |
||||
|
const searchFormClick = (searchData) => { |
||||
|
tableObject.params = { |
||||
|
isSearch: true, |
||||
|
filters: searchData.filters |
||||
|
} |
||||
|
getList() // 刷新当前列表 |
||||
|
} |
||||
|
const changeTabs = (item) => { |
||||
|
if (item.prop == 'Transaction') { |
||||
|
tabsExtend.value = true |
||||
|
// 当前物料代码作为条件 |
||||
|
tableObjectExtend.value = [{ |
||||
|
key: 'masterId', |
||||
|
value: chooseRow.value.id |
||||
|
}] |
||||
|
apiPage.value = BalanceApi.getTransactionBalancePage |
||||
|
|
||||
|
console.log(988,tableObjectExtend.value) |
||||
|
} else { |
||||
|
tableObjectExtend.value = [] |
||||
|
tabsExtend.value = false |
||||
|
apiPage.value = '' |
||||
|
} |
||||
|
} |
||||
|
/** 初始化 **/ |
||||
|
onMounted(async() => { |
||||
|
getList() |
||||
|
// importTemplateData.templateUrl = await BalanceApi.importTemplate() |
||||
|
}) |
||||
|
</script> |
@ -0,0 +1,623 @@ |
|||||
|
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
||||
|
import { TableColumn } from '@/types/table' |
||||
|
import { dateFormatter } from '@/utils/formatTime' |
||||
|
|
||||
|
import * as BalanceApi from '@/api/wms/balance' |
||||
|
import { Balance } from '@/views/wms/inventoryManage/balance/balance.data' |
||||
|
|
||||
|
import * as LocationApi from '@/api/wms/location' |
||||
|
import { Location } from '@/views/wms/basicDataManage/factoryModeling/location/location.data' |
||||
|
|
||||
|
import * as ItembasicApi from '@/api/wms/itembasic' |
||||
|
import { ItembasicCopy } from '@/views/wms/basicDataManage/itemManage/itembasic/itembasic.data' |
||||
|
|
||||
|
import * as getRequestsettingApi from '@/api/wms/requestsetting/index' |
||||
|
import * as getBusinessTypeApi from '@/api/wms/businesstype/index' |
||||
|
|
||||
|
// 表单校验
|
||||
|
export const ContainerMainRequestRules = reactive({ |
||||
|
type:[ |
||||
|
{ required: true, message: '请选择类型', trigger: 'change' }, |
||||
|
], |
||||
|
concurrencyStamp: [required], |
||||
|
}) |
||||
|
|
||||
|
const businessTypeQueryParams = { |
||||
|
pageSize:10, |
||||
|
pageNo:1, |
||||
|
code:'CreateContainerManage', |
||||
|
name:'器具新增管理' |
||||
|
} |
||||
|
|
||||
|
const businessTypeValue = await getBusinessTypeApi.getBusinesstypePage(businessTypeQueryParams) |
||||
|
const businessTypeData =businessTypeValue?.list[0]||{} |
||||
|
|
||||
|
// 获取自动提交自动通过自动执行,跳过任务直接删生成记录的默认值
|
||||
|
const queryParams = { |
||||
|
pageSize:10, |
||||
|
pageNo:1, |
||||
|
code:'ContainerRequest' |
||||
|
} |
||||
|
const data = await getRequestsettingApi.getRequestsettingPage(queryParams) |
||||
|
const requestsettingData =data?.list[0]||{} |
||||
|
|
||||
|
// 获取当前操作人的部门
|
||||
|
import { useUserStore } from '@/store/modules/user' |
||||
|
const userStore = useUserStore() |
||||
|
const userDept = userStore.userSelfInfo.dept |
||||
|
// id 转str 否则form回显匹配不到
|
||||
|
userDept.id = userDept.id.toString() |
||||
|
const userDeptArray:any = [userDept] |
||||
|
|
||||
|
export const ContainerMainRequest = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: '单据号', |
||||
|
field: 'number', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
isForm: false, |
||||
|
table: { |
||||
|
width: 100 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '状态', |
||||
|
field: 'status', |
||||
|
dictType: DICT_TYPE.REQUEST_STATUS, |
||||
|
dictClass: 'string', |
||||
|
isSearch: true, |
||||
|
isForm: false, |
||||
|
isTable: true, |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
form: { |
||||
|
componentProps: { |
||||
|
disabled: true |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '初始化库位代码', |
||||
|
field: 'toLocationCode', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
tableForm:{ |
||||
|
isInpuFocusShow: true, // 开启查询弹窗
|
||||
|
searchListPlaceholder: '请选择初始化库位代码', |
||||
|
searchField: 'code', |
||||
|
searchTitle: '库位信息', |
||||
|
searchAllSchemas: Location.allSchemas, |
||||
|
searchPage: LocationApi.selectBusinessTypeToLocation, |
||||
|
searchCondition: [{ |
||||
|
key: 'businessType', |
||||
|
value: businessTypeData.code, |
||||
|
},{ |
||||
|
key: 'isIn', |
||||
|
value: 'in', |
||||
|
isMainValue: false |
||||
|
}] |
||||
|
}, |
||||
|
form: { |
||||
|
// labelMessage: '信息提示说明!!!',
|
||||
|
componentProps: { |
||||
|
isSearchList: true, // 开启查询弹窗
|
||||
|
searchListPlaceholder: '请选择初始化库位代码', |
||||
|
searchField: 'code', |
||||
|
searchTitle: '库位信息', |
||||
|
searchAllSchemas: Location.allSchemas, |
||||
|
searchPage: LocationApi.selectBusinessTypeToLocation, |
||||
|
searchCondition: [{ |
||||
|
key: 'businessType', |
||||
|
value: businessTypeData.code, |
||||
|
},{ |
||||
|
key: 'isIn', |
||||
|
value: 'in', |
||||
|
isMainValue: false |
||||
|
}] |
||||
|
} |
||||
|
}, |
||||
|
isSearch: false, |
||||
|
isForm: true, |
||||
|
isTable: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '类型', |
||||
|
field: 'type', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.CONTAIN_MANAGE_TYPE, |
||||
|
dictClass: 'string', |
||||
|
isSearch: true, |
||||
|
isTable: true, |
||||
|
table: { |
||||
|
width: 120 |
||||
|
}, |
||||
|
form:{ |
||||
|
componentProps:{ |
||||
|
disabled: true, |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '是否可用', |
||||
|
field: 'available', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.TRUE_FALSE, |
||||
|
dictClass: 'string', |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '主备注', |
||||
|
field: 'mainRemark', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isForm: true, |
||||
|
isTable: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '部门', |
||||
|
field: 'departmentCode', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
formatter: (_: Recordable, __: TableColumn, cellValue: number) => { |
||||
|
return userDeptArray.find((account) => account.id == cellValue)?.name |
||||
|
}, |
||||
|
form: { |
||||
|
value: userDept.id, |
||||
|
component: 'Select', |
||||
|
api: () => userDeptArray, |
||||
|
componentProps: { |
||||
|
disabled: true, |
||||
|
optionsAlias: { |
||||
|
labelField: 'name', |
||||
|
valueField: 'id' |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '自动提交', |
||||
|
field: 'autoCommit', |
||||
|
dictType: DICT_TYPE.TRUE_FALSE, |
||||
|
dictClass: 'string', |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'Switch', |
||||
|
value: requestsettingData.autoCommit, |
||||
|
componentProps: { |
||||
|
inactiveValue: 'FALSE', |
||||
|
activeValue: 'TRUE', |
||||
|
disabled: true |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '自动通过', |
||||
|
field: 'autoAgree', |
||||
|
dictType: DICT_TYPE.TRUE_FALSE, |
||||
|
dictClass: 'string', |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'Switch', |
||||
|
value: requestsettingData.autoAgree, |
||||
|
componentProps: { |
||||
|
inactiveValue: 'FALSE', |
||||
|
activeValue: 'TRUE', |
||||
|
disabled: true |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '自动执行', |
||||
|
field: 'autoExecute', |
||||
|
dictType: DICT_TYPE.TRUE_FALSE, |
||||
|
dictClass: 'string', |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'Switch', |
||||
|
value: requestsettingData.autoExecute, |
||||
|
componentProps: { |
||||
|
inactiveValue: 'FALSE', |
||||
|
activeValue: 'TRUE', |
||||
|
disabled: true |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '直接生成记录', |
||||
|
field: 'directCreateRecord', |
||||
|
dictType: DICT_TYPE.TRUE_FALSE, |
||||
|
dictClass: 'string', |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'Switch', |
||||
|
value: requestsettingData.directCreateRecord, |
||||
|
componentProps: { |
||||
|
inactiveValue: 'FALSE', |
||||
|
activeValue: 'TRUE', |
||||
|
disabled: true |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建时间', |
||||
|
field: 'createTime', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
detail: { |
||||
|
dateFormat : 'YYYY-MM-DD HH:mm:ss' |
||||
|
}, |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
search: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
type: 'daterange', |
||||
|
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
||||
|
} |
||||
|
}, |
||||
|
table: { |
||||
|
width: 180 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建者', |
||||
|
field: 'creator', |
||||
|
table: { |
||||
|
width: 130 |
||||
|
}, |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '最后更新时间', |
||||
|
field: 'updateTime', |
||||
|
sort: 'custom', |
||||
|
isDetail: true, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
formatter: dateFormatter, |
||||
|
detail: { |
||||
|
dateFormat: 'YYYY-MM-DD HH:mm:ss' |
||||
|
}, |
||||
|
table: { |
||||
|
width: 180 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
style: {width:'100%'}, |
||||
|
type: 'datetime', |
||||
|
dateFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
valueFormat: 'x', |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '最后更新者', |
||||
|
field: 'updater', |
||||
|
isDetail: true, |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
table: { |
||||
|
width: 150 |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '扩展属性', |
||||
|
field: 'extraProperties', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '并发乐观锁', |
||||
|
field: 'concurrencyStamp', |
||||
|
sort: 'custom', |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
value: 0 |
||||
|
}, |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '地点ID', |
||||
|
field: 'siteId', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作', |
||||
|
field: 'action', |
||||
|
isForm: false, |
||||
|
table: { |
||||
|
width: 200, |
||||
|
fixed: 'right' |
||||
|
} |
||||
|
} |
||||
|
])) |
||||
|
|
||||
|
// 表单校验
|
||||
|
export const ContainerDetailRequestRules = reactive({ |
||||
|
toLocationCode: [ |
||||
|
{ required: true, message: '请选择目标库位', trigger: 'blur' } |
||||
|
], |
||||
|
containerNumber: [ |
||||
|
{ required: true, message: '请选择器具号', trigger: 'blur' } |
||||
|
], |
||||
|
toQty: [ |
||||
|
{ required: true, message: '请输入到数量', trigger: 'blur' } |
||||
|
], |
||||
|
}) |
||||
|
|
||||
|
export const ContainerDetailRequest = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: 'id', |
||||
|
field: 'id', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '主表ID', |
||||
|
field: 'masterId', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
value: 0 |
||||
|
}, |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '单据号', |
||||
|
field: 'number', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '器具号', |
||||
|
field: 'containerNumber', |
||||
|
sort: 'custom', |
||||
|
tableForm:{ |
||||
|
multiple:true, |
||||
|
isInpuFocusShow: false, // 开启查询弹窗
|
||||
|
disabled: true, |
||||
|
searchListPlaceholder: '请选择器具号', |
||||
|
searchField: 'itemCode', |
||||
|
searchTitle: '器具信息', |
||||
|
searchAllSchemas: ItembasicCopy.allSchemas, |
||||
|
searchPage: ItembasicApi.selectConfigToItembasic, |
||||
|
verificationPage: ItembasicApi.selectContainermanageItemCode, // tableForm下方输入框校验失去焦点之后是否正确的方法
|
||||
|
isShowTableFormSearch: true, //tableForm下方是否出现输入框
|
||||
|
isRepeat: true,//tableForm下方输入框是否可以重复添加该条数据
|
||||
|
// 失去焦点校验参数
|
||||
|
verificationParams: [{ |
||||
|
key: 'code', |
||||
|
action: '==', |
||||
|
value: '', |
||||
|
isMainValue: false, |
||||
|
isSearch: 'true', |
||||
|
isFormModel: true, |
||||
|
}] |
||||
|
}, |
||||
|
form: { |
||||
|
// labelMessage: '信息提示说明!!!',
|
||||
|
componentProps: { |
||||
|
isSearchList: true, // 开启查询弹窗
|
||||
|
searchListPlaceholder: '请选择器具号', |
||||
|
searchField: 'itemCode', |
||||
|
searchTitle: '器具信息', |
||||
|
searchAllSchemas: ItembasicCopy.allSchemas, |
||||
|
searchPage: ItembasicApi.selectConfigToItembasic, |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '数量', |
||||
|
field: 'toQty', |
||||
|
sort: 'custom', |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
componentProps: { |
||||
|
disabled: true, |
||||
|
min: 0, |
||||
|
precision: 6 |
||||
|
} |
||||
|
}, |
||||
|
tableForm: { |
||||
|
type: 'InputNumber', |
||||
|
min: 0, |
||||
|
precision: 6 |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '计量单位', |
||||
|
field: 'uom', |
||||
|
dictType: DICT_TYPE.UOM, |
||||
|
dictClass: 'string', |
||||
|
isTable: true, |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
tableForm: { |
||||
|
type: 'Select', |
||||
|
disabled: true |
||||
|
}, |
||||
|
form: { |
||||
|
componentProps: { |
||||
|
disabled: true |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '库存状态', |
||||
|
field: 'toInventoryStatus', |
||||
|
dictType: DICT_TYPE.INVENTORY_STATUS, |
||||
|
dictClass: 'string', |
||||
|
isTable: true, |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
tableForm: { |
||||
|
disabled: true, |
||||
|
type: 'Select' |
||||
|
}, |
||||
|
form: { |
||||
|
componentProps: { |
||||
|
disabled: true |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '子备注', |
||||
|
field: 'remark', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建时间', |
||||
|
field: 'createTime', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
detail: { |
||||
|
dateFormat : 'YYYY-MM-DD HH:mm:ss' |
||||
|
}, |
||||
|
search: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
type: 'daterange', |
||||
|
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
||||
|
} |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
style: {width:'100%'}, |
||||
|
type: 'datetime', |
||||
|
dateFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
valueFormat: 'x', |
||||
|
} |
||||
|
}, |
||||
|
table: { |
||||
|
width: 180 |
||||
|
}, |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建者', |
||||
|
field: 'creator', |
||||
|
table: { |
||||
|
width: 130 |
||||
|
}, |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '地点ID', |
||||
|
field: 'siteId', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '并发乐观锁', |
||||
|
field: 'concurrencyStamp', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '从货主代码', |
||||
|
field: 'fromOwnerCode', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '到货主代码', |
||||
|
field: 'toOwnerCode', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作', |
||||
|
field: 'action', |
||||
|
isForm: false, |
||||
|
hiddenInMain:true, |
||||
|
isTableForm: false, |
||||
|
table: { |
||||
|
width: 200, |
||||
|
fixed: 'right' |
||||
|
} |
||||
|
} |
||||
|
])) |
||||
|
|
@ -0,0 +1,541 @@ |
|||||
|
<template> |
||||
|
<ContentWrap> |
||||
|
<!-- 搜索工作栏 --> |
||||
|
<Search :schema="ContainerMainRequest.allSchemas.searchSchema" @search="searchList" @reset="searchList" /> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 列表头部 --> |
||||
|
<TableHead |
||||
|
:HeadButttondata="HeadButttondata" |
||||
|
@button-base-click="buttonBaseClick" |
||||
|
:routeName="routeName" |
||||
|
@updataTableColumns="updataTableColumns" |
||||
|
@searchFormClick="searchFormClick" |
||||
|
:allSchemas="ContainerMainRequest.allSchemas" |
||||
|
:detailAllSchemas="ContainerDetailRequest.allSchemas" |
||||
|
/> |
||||
|
|
||||
|
<!-- 列表 --> |
||||
|
<ContentWrap> |
||||
|
<Table |
||||
|
:columns="tableColumns" |
||||
|
:data="tableObject.tableList" |
||||
|
:loading="tableObject.loading" |
||||
|
:pagination="{ |
||||
|
total: tableObject.total |
||||
|
}" |
||||
|
v-model:pageSize="tableObject.pageSize" |
||||
|
v-model:currentPage="tableObject.currentPage" |
||||
|
v-model:sort="tableObject.sort" |
||||
|
> |
||||
|
<template #number="{row}"> |
||||
|
<el-button type="primary" link @click="openDetail(row, '代码', row.number)"> |
||||
|
<span>{{ row.number }}</span> |
||||
|
</el-button> |
||||
|
</template> |
||||
|
<template #action="{ row,$index }"> |
||||
|
<ButtonBase :Butttondata="butttondata(row,$index)" @button-base-click="buttonTableClick($event,row)" /> |
||||
|
</template> |
||||
|
</Table> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 表单弹窗:添加/修改 --> |
||||
|
<BasicForm |
||||
|
ref="basicFormRef" |
||||
|
:isOpenSearchTable="true" |
||||
|
fieldTableColumn="containerNumber" |
||||
|
@success="getList" |
||||
|
:rules="ContainerMainRequestRules" |
||||
|
:formAllSchemas="ContainerMainRequest.allSchemas" |
||||
|
:tableAllSchemas="ContainerDetailRequest.allSchemas" |
||||
|
:tableFormRules="ContainerDetailRequestRules" |
||||
|
:tableData="tableData" |
||||
|
:apiUpdate="ContainerMainRequestApi.updateContainerMainRequest" |
||||
|
:apiCreate="ContainerMainRequestApi.createContainerMainRequest" |
||||
|
:isBusiness="true" |
||||
|
fromeWhere="ContainerMainRequest" |
||||
|
@handleAddTable="handleAddTable" |
||||
|
@handleDeleteTable="handleDeleteTable" |
||||
|
:isShowReduceButtonSelection="true" |
||||
|
@tableSelectionDelete="tableSelectionDelete" |
||||
|
@searchTableSuccess="searchTableSuccess" |
||||
|
@submitForm="submitForm" |
||||
|
:isShowButton = isShowButton |
||||
|
/> |
||||
|
|
||||
|
<!-- 详情 --> |
||||
|
<Detail |
||||
|
ref="detailRef" |
||||
|
:isBasic="false" |
||||
|
:allSchemas="ContainerMainRequest.allSchemas" |
||||
|
:detailAllSchemas="ContainerDetailRequest.allSchemas" |
||||
|
:detailAllSchemasRules="ContainerDetailRequestRules" |
||||
|
:apiCreate="ContainerDetailRequestApi.createContainerDetailRequest" |
||||
|
:apiUpdate="ContainerDetailRequestApi.createContainerDetailRequest" |
||||
|
:apiPage="ContainerDetailRequestApi.getContainerDetailRequestPage" |
||||
|
:apiDelete="ContainerDetailRequestApi.deleteContainerDetailRequest" |
||||
|
fromeWhere="ContainerDetailRequest" |
||||
|
@searchTableSuccessDetail="searchTableSuccessDetail" |
||||
|
:detailButtonIsShowAdd="trueFalse" |
||||
|
:detailButtonIsShowDelete="trueFalse" |
||||
|
/> |
||||
|
|
||||
|
<!-- 导入 --> |
||||
|
<ImportForm ref="importFormRef" url="/wms/container-main-request/import" :importTemplateData="importTemplateData" @success="importSuccess" :toInventoryStatus= "toInventoryStatus"/> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import download from '@/utils/download' |
||||
|
import { ContainerMainRequest,ContainerMainRequestRules,ContainerDetailRequest,ContainerDetailRequestRules } from './createContainerMainRequest.data' |
||||
|
import * as ContainerMainRequestApi from '@/api/wms/containerMainRequest' |
||||
|
import * as ContainerDetailRequestApi from '@/api/wms/containerDetailRequest' |
||||
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
||||
|
import TableHead from '@/components/TableHead/src/TableHead.vue' |
||||
|
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' |
||||
|
import Detail from '@/components/Detail/src/Detail.vue' |
||||
|
import { formatDate } from '@/utils/formatTime' |
||||
|
import { usePageLoading } from '@/hooks/web/usePageLoading' |
||||
|
const { loadStart, loadDone } = usePageLoading() |
||||
|
defineOptions({ name: 'CreateContainerManageRequest' }) |
||||
|
|
||||
|
const message = useMessage() // 消息弹窗 |
||||
|
const { t } = useI18n() // 国际化 |
||||
|
const businessType = ref() |
||||
|
const toLocationCode = ref() |
||||
|
const importFileName = ref() |
||||
|
const route = useRoute() // 路由信息 |
||||
|
const routeName = ref() |
||||
|
const toInventoryStatus = 'CREATE' |
||||
|
routeName.value = route.name |
||||
|
const tableColumns = ref(ContainerMainRequest.allSchemas.tableColumns) |
||||
|
console.log(99 , routeName.value) |
||||
|
const searchType = ref() |
||||
|
const { tableObject, tableMethods } = useTable({ |
||||
|
getListApi: ContainerDetailRequestApi.getContainerDetailRequestPage // 分页接口 |
||||
|
}) |
||||
|
// 判断 路由名称 进行条件过滤 |
||||
|
/** |
||||
|
* |
||||
|
*/ |
||||
|
|
||||
|
if ( routeName.value == 'CreateContainerManageRequest') { |
||||
|
tableObject.params = { |
||||
|
type:'CREATE', |
||||
|
} |
||||
|
searchType.value = 'CREATE' |
||||
|
ContainerMainRequest.allSchemas.formSchema.forEach(item=>{ |
||||
|
if(item.field == 'type'){ |
||||
|
item.value = "CREATE" |
||||
|
} |
||||
|
if(item.field == 'toLocationCode'){ |
||||
|
item.value = "INIT_CONTAIN" |
||||
|
} |
||||
|
}); |
||||
|
businessType.value = 'CreateContainerManage' |
||||
|
importFileName.value = '器具新增申请' |
||||
|
} |
||||
|
|
||||
|
//定义 展示子表数据时是否显示新增/修改/删除按钮 |
||||
|
const trueFalse = ref(false) |
||||
|
// 查询页面返回 |
||||
|
const searchTableSuccess = (formField, searchField, val, formRef, type, row) => { |
||||
|
nextTick(() => { |
||||
|
if (type == 'tableForm') { |
||||
|
if(formField == 'containerNumber') { |
||||
|
let itemCodes = val.filter(item=>tableData.value.find(item1=>item1['containerNumber']==item['code'])) |
||||
|
if(itemCodes.length>0){ |
||||
|
itemCodes = itemCodes.map(item=>(item['code'])) |
||||
|
message.warning(`器具号${itemCodes.join(',')}已经存在`) |
||||
|
} |
||||
|
val = val.filter(item=>!tableData.value.find(item1=>item1['containerNumber']==item['code'])) |
||||
|
if(val.length==0) return |
||||
|
val.forEach(item=>{ |
||||
|
const newRow = JSON.parse(JSON.stringify({...tableFormKeys,...item})) |
||||
|
newRow['containerNumber'] = item['code'] |
||||
|
newRow['uom'] = item['uom'] |
||||
|
newRow['toInventoryStatus'] = 'OK' |
||||
|
tableData.value.push(newRow) |
||||
|
}) |
||||
|
|
||||
|
}else if(formField == 'toLocationCode'){ |
||||
|
row['toLocationCode'] = val[0]['code'] |
||||
|
}else { |
||||
|
row[formField] = val[0][searchField] |
||||
|
} |
||||
|
} |
||||
|
const setV = {} |
||||
|
setV[formField] = val[0][searchField] |
||||
|
formRef.setValues(setV) |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
const searchList = (model)=>{ |
||||
|
model.type = searchType.value |
||||
|
setSearchParams(model) |
||||
|
} |
||||
|
|
||||
|
// 查询页面返回——详情 |
||||
|
const searchTableSuccessDetail = (formField, searchField, val, formRef ) => { |
||||
|
nextTick(() => { |
||||
|
const setV = {} |
||||
|
if(formField == 'containerNumber') { |
||||
|
setV['containerNumber'] = val[0]['code'] |
||||
|
setV['uom'] = val[0]['uom'] |
||||
|
}else if(formField == 'toLocationCode'){ |
||||
|
setV['toLocationCode'] = val[0]['code'] |
||||
|
}else { |
||||
|
setV[formField] = val[0][searchField] |
||||
|
} |
||||
|
formRef.setValues(setV) |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
// 修改 tableform 属性 |
||||
|
ContainerDetailRequest.allSchemas.tableFormColumns.map(item => { |
||||
|
if(item.field == "toLocationCode"){ |
||||
|
if (toLocationCode.value) { |
||||
|
item.tableForm.searchCondition = [ |
||||
|
{ |
||||
|
key: 'businessType', |
||||
|
value: businessType.value, |
||||
|
isMainValue: false |
||||
|
},{ |
||||
|
key: 'isIn', |
||||
|
value: 'in', |
||||
|
isMainValue: false |
||||
|
}] |
||||
|
item.form.componentProps.searchCondition = [ |
||||
|
{ |
||||
|
key: 'businessType', |
||||
|
value: businessType.value, |
||||
|
isMainValue: false |
||||
|
},{ |
||||
|
key: 'isIn', |
||||
|
value: 'in', |
||||
|
isMainValue: false |
||||
|
}] |
||||
|
}else if (toLocationCode.value == null) { |
||||
|
item.tableForm.searchCondition = [ |
||||
|
{ |
||||
|
key: 'businessType', |
||||
|
value: businessType.value , |
||||
|
isMainValue: false |
||||
|
},{ |
||||
|
key: 'isIn', |
||||
|
value: 'in', |
||||
|
isMainValue: false |
||||
|
}] |
||||
|
item.form.componentProps.searchCondition = [ |
||||
|
{ |
||||
|
key: 'businessType', |
||||
|
value: businessType.value, |
||||
|
isMainValue: false |
||||
|
},{ |
||||
|
key: 'isIn', |
||||
|
value: 'in', |
||||
|
isMainValue: false |
||||
|
}] |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
|
||||
|
// 字段设置 更新主列表字段 |
||||
|
const updataTableColumns = (val) => { |
||||
|
tableColumns.value = val |
||||
|
} |
||||
|
|
||||
|
// 获得表格的各种操作 |
||||
|
const { getList, setSearchParams } = tableMethods |
||||
|
|
||||
|
// 根据状态返回该按钮是否显示 |
||||
|
const isShowMainButton = (row,val) => { |
||||
|
if (val.indexOf(row.status) > -1) { |
||||
|
return false |
||||
|
} else { |
||||
|
return true |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 列表头部按钮 |
||||
|
const HeadButttondata = [ |
||||
|
defaultButtons.defaultAddBtn({hasPermi:'wms:initial-container-main-request:create'}), // 新增 |
||||
|
defaultButtons.defaultImportBtn({hasPermi:'wms:initial-container-main-request:import'}), // 导入 |
||||
|
defaultButtons.defaultExportBtn({hasPermi:'wms:initial-container-main-request:export'}), // 导出 |
||||
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
||||
|
defaultButtons.defaultFilterBtn(null), // 筛选 |
||||
|
defaultButtons.defaultSetBtn(null), // 设置 |
||||
|
// { |
||||
|
// label: '自定义扩展按钮', |
||||
|
// name: 'zdy', |
||||
|
// hide: false, |
||||
|
// type: 'primary', |
||||
|
// icon: 'Select', |
||||
|
// color: '' |
||||
|
// }, |
||||
|
] |
||||
|
|
||||
|
// 头部按钮事件 |
||||
|
const buttonBaseClick = (val, item) => { |
||||
|
if (val == 'add') { // 新增 |
||||
|
openForm('create') |
||||
|
} else if (val == 'import') { // 导入 |
||||
|
handleImport() |
||||
|
} else if (val == 'export') { // 导出 |
||||
|
handleExport() |
||||
|
} else if (val == 'refresh') { // 刷新 |
||||
|
if (tableObject.params.filters && tableObject.params.filters.length > 0 ) { |
||||
|
searchFormClick({ |
||||
|
filters: tableObject.params.filters |
||||
|
}) |
||||
|
} else { |
||||
|
getList() |
||||
|
} |
||||
|
} else if (val == 'filtrate') { // 筛选 |
||||
|
} else { // 其他按钮 |
||||
|
console.log('其他按钮', item) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 列表-操作按钮 |
||||
|
const butttondata = (row,$index) => { |
||||
|
const findIndex = row['masterId']?tableObject.tableList.findIndex(item=>item['masterId'] == row['masterId']):-1 |
||||
|
if(findIndex>-1&&findIndex<$index){ |
||||
|
return [] |
||||
|
} |
||||
|
return [ |
||||
|
defaultButtons.mainListCloseBtn({hide:isShowMainButton(row,['2','3','4','6']),hasPermi:'wms:initial-container-main-request:close'}), // 关闭 |
||||
|
defaultButtons.mainListReAddBtn({hide:isShowMainButton(row,['4','5']),hasPermi:'wms:initial-container-main-request:reAdd'}), //重新添加 |
||||
|
defaultButtons.mainListSubmitBtn({hide:isShowMainButton(row,['1']),hasPermi:'wms:initial-container-main-request:submit'}), // 提交审批 |
||||
|
defaultButtons.mainListTurnDownBtn({hide:isShowMainButton(row,['2']),hasPermi:'wms:initial-container-main-request:refused'}), // 驳回 |
||||
|
defaultButtons.mainListApproveBtn({hide:isShowMainButton(row,['2']),hasPermi:'wms:initial-container-main-request:agree'}), // 审批通过 |
||||
|
defaultButtons.mainListHandleBtn({hide:isShowMainButton(row,['3']),hasPermi:'wms:initial-container-main-request:handle'}), // 处理 |
||||
|
defaultButtons.mainListEditBtn({hide:isShowMainButton(row,['1']),hasPermi:'wms:initial-container-main-request:update'}), // 编辑 |
||||
|
// defaultButtons.mainListDeleteBtn({hasPermi:'wms:initial-container-main-request:delete'}), // 删除 |
||||
|
] |
||||
|
} |
||||
|
|
||||
|
// 列表-操作按钮事件 |
||||
|
const buttonTableClick = async (val, row) => { |
||||
|
if (val == 'mainClose') { // 关闭 |
||||
|
await message.confirm('确认要关闭吗?') |
||||
|
tableObject.loading = true |
||||
|
ContainerMainRequestApi.close(row.masterId).then(() => { |
||||
|
message.success(t('common.updateSuccess')) |
||||
|
tableObject.loading = false |
||||
|
buttonBaseClick('refresh',null) |
||||
|
}).catch(err => { |
||||
|
tableObject.loading = false |
||||
|
console.log(err) |
||||
|
}) |
||||
|
} else if (val == 'mainReAdd') { // 重新添加 |
||||
|
await message.confirm('确认要重新添加吗?') |
||||
|
tableObject.loading = true |
||||
|
ContainerMainRequestApi.reAdd(row.masterId).then(() => { |
||||
|
message.success(t('common.updateSuccess')) |
||||
|
tableObject.loading = false |
||||
|
buttonBaseClick('refresh',null) |
||||
|
}).catch(err => { |
||||
|
tableObject.loading = false |
||||
|
console.log(err) |
||||
|
}) |
||||
|
} else if (val == 'mainSubmit') { // 提交审批 |
||||
|
await message.confirm('确认要提交审批吗?') |
||||
|
tableObject.loading = true |
||||
|
ContainerMainRequestApi.submit(row.masterId).then(() => { |
||||
|
message.success(t('common.updateSuccess')) |
||||
|
tableObject.loading = false |
||||
|
buttonBaseClick('refresh',null) |
||||
|
}).catch(err => { |
||||
|
tableObject.loading = false |
||||
|
console.log(err) |
||||
|
}) |
||||
|
} else if (val == 'mainTurnDown') { // 驳回 |
||||
|
await message.confirm('确认要驳回吗?') |
||||
|
tableObject.loading = true |
||||
|
ContainerMainRequestApi.refused(row.masterId).then(() => { |
||||
|
message.success(t('common.updateSuccess')) |
||||
|
tableObject.loading = false |
||||
|
buttonBaseClick('refresh',null) |
||||
|
}).catch(err => { |
||||
|
tableObject.loading = false |
||||
|
console.log(err) |
||||
|
}) |
||||
|
} else if (val == 'mainApprove') { // 审批通过 |
||||
|
await message.confirm('确认要审批通过吗?') |
||||
|
tableObject.loading = true |
||||
|
ContainerMainRequestApi.agree(row.masterId).then(() => { |
||||
|
message.success(t('common.updateSuccess')) |
||||
|
tableObject.loading = false |
||||
|
buttonBaseClick('refresh',null) |
||||
|
}).catch(err => { |
||||
|
tableObject.loading = false |
||||
|
console.log(err) |
||||
|
}) |
||||
|
} else if (val == 'mainHandle') { // 处理 |
||||
|
await message.confirm('确认要 处理吗?') |
||||
|
tableObject.loading = true |
||||
|
ContainerMainRequestApi.handle(row.masterId).then(() => { |
||||
|
message.success(t('common.updateSuccess')) |
||||
|
tableObject.loading = false |
||||
|
buttonBaseClick('refresh',null) |
||||
|
}).catch(err => { |
||||
|
tableObject.loading = false |
||||
|
console.log(err) |
||||
|
}) |
||||
|
} else if (val == 'edit') { // 编辑 |
||||
|
openForm('update', row) |
||||
|
} else if (val == 'delete') { // 删除 |
||||
|
handleDelete(row.id) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 添加/修改操作 */ |
||||
|
const basicFormRef = ref() |
||||
|
const openForm = (type: string, row?: any) => { |
||||
|
if('create'==type){ |
||||
|
tableData.value = [] |
||||
|
} |
||||
|
basicFormRef.value.open(type, row) |
||||
|
} |
||||
|
|
||||
|
const isShowButton = ref(true) |
||||
|
|
||||
|
/** |
||||
|
* tableForm方法 |
||||
|
*/ |
||||
|
const tableFormKeys = {} |
||||
|
ContainerDetailRequest.allSchemas.tableFormColumns.forEach(item => { |
||||
|
tableFormKeys[item.field] = item.default ? item.default : '' |
||||
|
}) |
||||
|
const tableData = ref([]) |
||||
|
|
||||
|
// 添加明细 |
||||
|
const handleAddTable = () => { |
||||
|
tableData.value.push(JSON.parse(JSON.stringify(tableFormKeys))) |
||||
|
} |
||||
|
// 删除明细 |
||||
|
const handleDeleteTable = (item, index) => { |
||||
|
let itemIndex = tableData.value.indexOf(item) |
||||
|
if(itemIndex>-1){ |
||||
|
tableData.value.splice(itemIndex, 1) |
||||
|
} |
||||
|
} |
||||
|
const tableSelectionDelete = (selection) => { |
||||
|
tableData.value = tableData.value.filter(item => !selection.includes(item)) |
||||
|
} |
||||
|
//为true表示子表数据中存在数量为0的数据 |
||||
|
const flag = ref() |
||||
|
|
||||
|
// form表单提交 |
||||
|
const submitForm = async (formType,submitData) => { |
||||
|
let data = {...submitData} |
||||
|
if(data.masterId){ |
||||
|
data.id = data.masterId |
||||
|
} |
||||
|
data.subList = tableData.value // 拼接子表数据参数 |
||||
|
data.subList.forEach(item => { |
||||
|
if(item.qty == 0){ |
||||
|
message.error(`到数量不能为0!`) |
||||
|
flag.value = true |
||||
|
return; |
||||
|
} |
||||
|
}) |
||||
|
basicFormRef.value.formLoading = true |
||||
|
try { |
||||
|
if (formType === 'create') { |
||||
|
data.businessType = businessType.value |
||||
|
console.log(data.businessType,999); |
||||
|
|
||||
|
await ContainerMainRequestApi.createContainerMainRequest(data) |
||||
|
message.success(t('common.createSuccess')) |
||||
|
} else { |
||||
|
await ContainerMainRequestApi.updateContainerMainRequest(data) |
||||
|
message.success(t('common.updateSuccess')) |
||||
|
} |
||||
|
basicFormRef.value.dialogVisible = false |
||||
|
if (formType === 'create') { |
||||
|
getList() |
||||
|
}else{ |
||||
|
buttonBaseClick('refresh',null) |
||||
|
} |
||||
|
} finally { |
||||
|
basicFormRef.value.formLoading = false |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 详情操作 */ |
||||
|
const detailRef = ref() |
||||
|
const openDetail = (row: any, titleName: any, titleValue: any) => { |
||||
|
detailRef.value.openDetail(row, titleName, titleValue, 'requestContainerMain') |
||||
|
} |
||||
|
|
||||
|
/** 删除按钮操作 */ |
||||
|
const handleDelete = async (id: number) => { |
||||
|
try { |
||||
|
// 删除的二次确认 |
||||
|
await message.delConfirm() |
||||
|
// 发起删除 |
||||
|
await ContainerMainRequestApi.deleteContainerMainRequest(id) |
||||
|
message.success(t('common.delSuccess')) |
||||
|
// 刷新列表 |
||||
|
buttonBaseClick('refresh',null) |
||||
|
} catch {} |
||||
|
} |
||||
|
|
||||
|
/** 导出按钮操作 */ |
||||
|
const handleExport = async () => { |
||||
|
try { |
||||
|
// 导出的二次确认 |
||||
|
await message.exportConfirm() |
||||
|
// 发起导出 |
||||
|
loadStart() |
||||
|
const excelTitle = ref(route.meta.title) |
||||
|
const data = await ContainerMainRequestApi.exportInitialContainerMainRequest(tableObject.params) |
||||
|
download.excel(data, `【${excelTitle.value}】【${formatDate(new Date())}】.xlsx`) |
||||
|
} catch { |
||||
|
} finally { |
||||
|
loadDone() |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 导入 */ |
||||
|
const importFormRef = ref() |
||||
|
const handleImport = () => { |
||||
|
importFormRef.value.open() |
||||
|
} |
||||
|
// 导入附件弹窗所需的参数 |
||||
|
const importTemplateData = reactive({ |
||||
|
templateUrl: '', |
||||
|
templateTitle: `【${route.meta.title}】导入模版.xlsx` |
||||
|
}) |
||||
|
// 导入成功之后 |
||||
|
const importSuccess = () => { |
||||
|
getList() |
||||
|
} |
||||
|
|
||||
|
// 筛选提交 |
||||
|
const searchFormClick = (searchData) => { |
||||
|
const cmd = { |
||||
|
'column':'type', |
||||
|
'action':'==', |
||||
|
'value':'CREATE' |
||||
|
} |
||||
|
if (!Array.isArray(searchData.filters)) { |
||||
|
searchData.filters = []; |
||||
|
} |
||||
|
searchData.filters.push(cmd) |
||||
|
tableObject.params = { |
||||
|
isSearch: true, |
||||
|
filters: searchData.filters |
||||
|
} |
||||
|
getList() // 刷新当前列表 |
||||
|
} |
||||
|
|
||||
|
/** 初始化 **/ |
||||
|
onMounted(async () => { |
||||
|
getList() |
||||
|
importTemplateData.templateUrl = await ContainerMainRequestApi.importTemplate() |
||||
|
}) |
||||
|
|
||||
|
</script> |
||||
|
|
@ -0,0 +1,542 @@ |
|||||
|
<template> |
||||
|
<ContentWrap> |
||||
|
<!-- 搜索工作栏 --> |
||||
|
<Search :schema="ContainerMainRequest.allSchemas.searchSchema" @search="searchList" @reset="searchList" /> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 列表头部 --> |
||||
|
<TableHead |
||||
|
:HeadButttondata="HeadButttondata" |
||||
|
@button-base-click="buttonBaseClick" |
||||
|
:routeName="routeName" |
||||
|
@updataTableColumns="updataTableColumns" |
||||
|
@searchFormClick="searchFormClick" |
||||
|
:allSchemas="ContainerMainRequest.allSchemas" |
||||
|
:detailAllSchemas="ContainerDetailRequest.allSchemas" |
||||
|
/> |
||||
|
|
||||
|
<!-- 列表 --> |
||||
|
<ContentWrap> |
||||
|
<Table |
||||
|
:columns="tableColumns" |
||||
|
:data="tableObject.tableList" |
||||
|
:loading="tableObject.loading" |
||||
|
:pagination="{ |
||||
|
total: tableObject.total |
||||
|
}" |
||||
|
v-model:pageSize="tableObject.pageSize" |
||||
|
v-model:currentPage="tableObject.currentPage" |
||||
|
v-model:sort="tableObject.sort" |
||||
|
> |
||||
|
<template #number="{row}"> |
||||
|
<el-button type="primary" link @click="openDetail(row, '代码', row.number)"> |
||||
|
<span>{{ row.number }}</span> |
||||
|
</el-button> |
||||
|
</template> |
||||
|
<template #action="{ row,$index }"> |
||||
|
<ButtonBase :Butttondata="butttondata(row,$index)" @button-base-click="buttonTableClick($event,row)" /> |
||||
|
</template> |
||||
|
</Table> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 表单弹窗:添加/修改 --> |
||||
|
<BasicForm |
||||
|
ref="basicFormRef" |
||||
|
:isOpenSearchTable="true" |
||||
|
fieldTableColumn="containerNumber" |
||||
|
@success="getList" |
||||
|
:rules="ContainerMainRequestRules" |
||||
|
:formAllSchemas="ContainerMainRequest.allSchemas" |
||||
|
:tableAllSchemas="ContainerDetailRequest.allSchemas" |
||||
|
:tableFormRules="ContainerDetailRequestRules" |
||||
|
:tableData="tableData" |
||||
|
:apiUpdate="ContainerMainRequestApi.updateContainerMainRequest" |
||||
|
:apiCreate="ContainerMainRequestApi.createContainerMainRequest" |
||||
|
:isBusiness="true" |
||||
|
fromeWhere="ContainerMainRequest" |
||||
|
@handleAddTable="handleAddTable" |
||||
|
@handleDeleteTable="handleDeleteTable" |
||||
|
:isShowReduceButtonSelection="true" |
||||
|
@tableSelectionDelete="tableSelectionDelete" |
||||
|
@searchTableSuccess="searchTableSuccess" |
||||
|
@submitForm="submitForm" |
||||
|
:isShowButton = isShowButton |
||||
|
/> |
||||
|
|
||||
|
<!-- 详情 --> |
||||
|
<Detail |
||||
|
ref="detailRef" |
||||
|
:isBasic="false" |
||||
|
:allSchemas="ContainerMainRequest.allSchemas" |
||||
|
:detailAllSchemas="ContainerDetailRequest.allSchemas" |
||||
|
:detailAllSchemasRules="ContainerDetailRequestRules" |
||||
|
:apiCreate="ContainerDetailRequestApi.createContainerDetailRequest" |
||||
|
:apiUpdate="ContainerDetailRequestApi.createContainerDetailRequest" |
||||
|
:apiPage="ContainerDetailRequestApi.getContainerDetailRequestPage" |
||||
|
:apiDelete="ContainerDetailRequestApi.deleteContainerDetailRequest" |
||||
|
fromeWhere="ContainerDetailRequest" |
||||
|
@searchTableSuccessDetail="searchTableSuccessDetail" |
||||
|
:detailButtonIsShowAdd="trueFalse" |
||||
|
:detailButtonIsShowDelete="trueFalse" |
||||
|
/> |
||||
|
|
||||
|
<!-- 导入 --> |
||||
|
<ImportForm ref="importFormRef" url="/wms/container-main-request/import" :importTemplateData="importTemplateData" @success="importSuccess" :toInventoryStatus= "toInventoryStatus"/> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import download from '@/utils/download' |
||||
|
import { ContainerMainRequest,ContainerMainRequestRules,ContainerDetailRequest,ContainerDetailRequestRules } from './moveContainerMainRequest.data' |
||||
|
import * as ContainerMainRequestApi from '@/api/wms/containerMainRequest' |
||||
|
import * as ContainerDetailRequestApi from '@/api/wms/containerDetailRequest' |
||||
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
||||
|
import TableHead from '@/components/TableHead/src/TableHead.vue' |
||||
|
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' |
||||
|
import Detail from '@/components/Detail/src/Detail.vue' |
||||
|
import { formatDate } from '@/utils/formatTime' |
||||
|
import { usePageLoading } from '@/hooks/web/usePageLoading' |
||||
|
const { loadStart, loadDone } = usePageLoading() |
||||
|
defineOptions({ name: 'MoveContainerManageRequest' }) |
||||
|
|
||||
|
const message = useMessage() // 消息弹窗 |
||||
|
const { t } = useI18n() // 国际化 |
||||
|
const businessType = ref() |
||||
|
const toLocationCode = ref() |
||||
|
const importFileName = ref() |
||||
|
const route = useRoute() // 路由信息 |
||||
|
const routeName = ref() |
||||
|
const toInventoryStatus = 'MOVE' |
||||
|
routeName.value = route.name |
||||
|
const tableColumns = ref(ContainerMainRequest.allSchemas.tableColumns) |
||||
|
console.log(99 , routeName.value) |
||||
|
const searchType = ref() |
||||
|
const { tableObject, tableMethods } = useTable({ |
||||
|
getListApi: ContainerDetailRequestApi.getContainerDetailRequestPage // 分页接口 |
||||
|
}) |
||||
|
// 判断 路由名称 进行条件过滤 |
||||
|
/** |
||||
|
* |
||||
|
*/ |
||||
|
|
||||
|
if ( routeName.value == 'MoveContainerManageRequest') { |
||||
|
tableObject.params = { |
||||
|
type:'MOVE', |
||||
|
} |
||||
|
searchType.value = 'MOVE' |
||||
|
ContainerMainRequest.allSchemas.formSchema.forEach(item=>{ |
||||
|
if(item.field == 'type'){ |
||||
|
item.value = "MOVE" |
||||
|
} |
||||
|
|
||||
|
}); |
||||
|
businessType.value = 'MoveContainerManage' |
||||
|
importFileName.value = '器具移动申请' |
||||
|
} |
||||
|
|
||||
|
//定义 展示子表数据时是否显示新增/修改/删除按钮 |
||||
|
const trueFalse = ref(false) |
||||
|
// 查询页面返回 |
||||
|
const searchTableSuccess = (formField, searchField, val, formRef, type, row) => { |
||||
|
nextTick(() => { |
||||
|
if (type == 'tableForm') { |
||||
|
if(formField == 'containerNumber') { |
||||
|
let itemCodes = val.filter(item=>tableData.value.find(item1=>item1['containerNumber']==item['code'])) |
||||
|
if(itemCodes.length>0){ |
||||
|
itemCodes = itemCodes.map(item=>(item['code'])) |
||||
|
message.warning(`器具号${itemCodes.join(',')}已经存在`) |
||||
|
} |
||||
|
val = val.filter(item=>!tableData.value.find(item1=>item1['containerNumber']==item['code'])) |
||||
|
if(val.length==0) return |
||||
|
val.forEach(item=>{ |
||||
|
const newRow = JSON.parse(JSON.stringify({...tableFormKeys,...item})) |
||||
|
newRow['containerNumber'] = item['itemCode'] |
||||
|
newRow['uom'] = item['uom'] |
||||
|
newRow['toInventoryStatus'] = 'OK' |
||||
|
newRow['fromLocationCode'] = item['locationCode'] |
||||
|
newRow['fromInventoryStatus'] = item['inventoryStatus'] |
||||
|
newRow['toQty'] = item['qty'] |
||||
|
tableData.value.push(newRow) |
||||
|
}) |
||||
|
|
||||
|
}else if(formField == 'toLocationCode'){ |
||||
|
row['toLocationCode'] = val[0]['code'] |
||||
|
}else { |
||||
|
row[formField] = val[0][searchField] |
||||
|
} |
||||
|
} |
||||
|
const setV = {} |
||||
|
setV[formField] = val[0][searchField] |
||||
|
formRef.setValues(setV) |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
const searchList = (model)=>{ |
||||
|
model.type = searchType.value |
||||
|
setSearchParams(model) |
||||
|
} |
||||
|
|
||||
|
// 查询页面返回——详情 |
||||
|
const searchTableSuccessDetail = (formField, searchField, val, formRef ) => { |
||||
|
nextTick(() => { |
||||
|
const setV = {} |
||||
|
if(formField == 'containerNumber') { |
||||
|
setV['containerNumber'] = val[0]['code'] |
||||
|
setV['uom'] = val[0]['uom'] |
||||
|
}else if(formField == 'toLocationCode'){ |
||||
|
setV['toLocationCode'] = val[0]['code'] |
||||
|
}else { |
||||
|
setV[formField] = val[0][searchField] |
||||
|
} |
||||
|
formRef.setValues(setV) |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
// 修改 tableform 属性 |
||||
|
ContainerDetailRequest.allSchemas.tableFormColumns.map(item => { |
||||
|
if(item.field == "toLocationCode"){ |
||||
|
if (toLocationCode.value) { |
||||
|
item.tableForm.searchCondition = [ |
||||
|
{ |
||||
|
key: 'businessType', |
||||
|
value: businessType.value, |
||||
|
isMainValue: false |
||||
|
},{ |
||||
|
key: 'isIn', |
||||
|
value: 'in', |
||||
|
isMainValue: false |
||||
|
}] |
||||
|
item.form.componentProps.searchCondition = [ |
||||
|
{ |
||||
|
key: 'businessType', |
||||
|
value: businessType.value, |
||||
|
isMainValue: false |
||||
|
},{ |
||||
|
key: 'isIn', |
||||
|
value: 'in', |
||||
|
isMainValue: false |
||||
|
}] |
||||
|
}else if (toLocationCode.value == null) { |
||||
|
item.tableForm.searchCondition = [ |
||||
|
{ |
||||
|
key: 'businessType', |
||||
|
value: businessType.value , |
||||
|
isMainValue: false |
||||
|
},{ |
||||
|
key: 'isIn', |
||||
|
value: 'in', |
||||
|
isMainValue: false |
||||
|
}] |
||||
|
item.form.componentProps.searchCondition = [ |
||||
|
{ |
||||
|
key: 'businessType', |
||||
|
value: businessType.value, |
||||
|
isMainValue: false |
||||
|
},{ |
||||
|
key: 'isIn', |
||||
|
value: 'in', |
||||
|
isMainValue: false |
||||
|
}] |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
|
||||
|
// 字段设置 更新主列表字段 |
||||
|
const updataTableColumns = (val) => { |
||||
|
tableColumns.value = val |
||||
|
} |
||||
|
|
||||
|
// 获得表格的各种操作 |
||||
|
const { getList, setSearchParams } = tableMethods |
||||
|
|
||||
|
// 根据状态返回该按钮是否显示 |
||||
|
const isShowMainButton = (row,val) => { |
||||
|
if (val.indexOf(row.status) > -1) { |
||||
|
return false |
||||
|
} else { |
||||
|
return true |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 列表头部按钮 |
||||
|
const HeadButttondata = [ |
||||
|
defaultButtons.defaultAddBtn({hasPermi:'wms:initial-container-main-request:create'}), // 新增 |
||||
|
defaultButtons.defaultImportBtn({hasPermi:'wms:initial-container-main-request:import'}), // 导入 |
||||
|
defaultButtons.defaultExportBtn({hasPermi:'wms:initial-container-main-request:export'}), // 导出 |
||||
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
||||
|
defaultButtons.defaultFilterBtn(null), // 筛选 |
||||
|
defaultButtons.defaultSetBtn(null), // 设置 |
||||
|
// { |
||||
|
// label: '自定义扩展按钮', |
||||
|
// name: 'zdy', |
||||
|
// hide: false, |
||||
|
// type: 'primary', |
||||
|
// icon: 'Select', |
||||
|
// color: '' |
||||
|
// }, |
||||
|
] |
||||
|
|
||||
|
// 头部按钮事件 |
||||
|
const buttonBaseClick = (val, item) => { |
||||
|
if (val == 'add') { // 新增 |
||||
|
openForm('create') |
||||
|
} else if (val == 'import') { // 导入 |
||||
|
handleImport() |
||||
|
} else if (val == 'export') { // 导出 |
||||
|
handleExport() |
||||
|
} else if (val == 'refresh') { // 刷新 |
||||
|
if (tableObject.params.filters && tableObject.params.filters.length > 0 ) { |
||||
|
searchFormClick({ |
||||
|
filters: tableObject.params.filters |
||||
|
}) |
||||
|
} else { |
||||
|
getList() |
||||
|
} |
||||
|
} else if (val == 'filtrate') { // 筛选 |
||||
|
} else { // 其他按钮 |
||||
|
console.log('其他按钮', item) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 列表-操作按钮 |
||||
|
const butttondata = (row,$index) => { |
||||
|
const findIndex = row['masterId']?tableObject.tableList.findIndex(item=>item['masterId'] == row['masterId']):-1 |
||||
|
if(findIndex>-1&&findIndex<$index){ |
||||
|
return [] |
||||
|
} |
||||
|
return [ |
||||
|
defaultButtons.mainListCloseBtn({hide:isShowMainButton(row,['2','3','4','6']),hasPermi:'wms:initial-container-main-request:close'}), // 关闭 |
||||
|
defaultButtons.mainListReAddBtn({hide:isShowMainButton(row,['4','5']),hasPermi:'wms:initial-container-main-request:reAdd'}), //重新添加 |
||||
|
defaultButtons.mainListSubmitBtn({hide:isShowMainButton(row,['1']),hasPermi:'wms:initial-container-main-request:submit'}), // 提交审批 |
||||
|
defaultButtons.mainListTurnDownBtn({hide:isShowMainButton(row,['2']),hasPermi:'wms:initial-container-main-request:refused'}), // 驳回 |
||||
|
defaultButtons.mainListApproveBtn({hide:isShowMainButton(row,['2']),hasPermi:'wms:initial-container-main-request:agree'}), // 审批通过 |
||||
|
defaultButtons.mainListHandleBtn({hide:isShowMainButton(row,['3']),hasPermi:'wms:initial-container-main-request:handle'}), // 处理 |
||||
|
defaultButtons.mainListEditBtn({hide:isShowMainButton(row,['1']),hasPermi:'wms:initial-container-main-request:update'}), // 编辑 |
||||
|
// defaultButtons.mainListDeleteBtn({hasPermi:'wms:initial-container-main-request:delete'}), // 删除 |
||||
|
] |
||||
|
} |
||||
|
|
||||
|
// 列表-操作按钮事件 |
||||
|
const buttonTableClick = async (val, row) => { |
||||
|
if (val == 'mainClose') { // 关闭 |
||||
|
await message.confirm('确认要关闭吗?') |
||||
|
tableObject.loading = true |
||||
|
ContainerMainRequestApi.close(row.masterId).then(() => { |
||||
|
message.success(t('common.updateSuccess')) |
||||
|
tableObject.loading = false |
||||
|
buttonBaseClick('refresh',null) |
||||
|
}).catch(err => { |
||||
|
tableObject.loading = false |
||||
|
console.log(err) |
||||
|
}) |
||||
|
} else if (val == 'mainReAdd') { // 重新添加 |
||||
|
await message.confirm('确认要重新添加吗?') |
||||
|
tableObject.loading = true |
||||
|
ContainerMainRequestApi.reAdd(row.masterId).then(() => { |
||||
|
message.success(t('common.updateSuccess')) |
||||
|
tableObject.loading = false |
||||
|
buttonBaseClick('refresh',null) |
||||
|
}).catch(err => { |
||||
|
tableObject.loading = false |
||||
|
console.log(err) |
||||
|
}) |
||||
|
} else if (val == 'mainSubmit') { // 提交审批 |
||||
|
await message.confirm('确认要提交审批吗?') |
||||
|
tableObject.loading = true |
||||
|
ContainerMainRequestApi.submit(row.masterId).then(() => { |
||||
|
message.success(t('common.updateSuccess')) |
||||
|
tableObject.loading = false |
||||
|
buttonBaseClick('refresh',null) |
||||
|
}).catch(err => { |
||||
|
tableObject.loading = false |
||||
|
console.log(err) |
||||
|
}) |
||||
|
} else if (val == 'mainTurnDown') { // 驳回 |
||||
|
await message.confirm('确认要驳回吗?') |
||||
|
tableObject.loading = true |
||||
|
ContainerMainRequestApi.refused(row.masterId).then(() => { |
||||
|
message.success(t('common.updateSuccess')) |
||||
|
tableObject.loading = false |
||||
|
buttonBaseClick('refresh',null) |
||||
|
}).catch(err => { |
||||
|
tableObject.loading = false |
||||
|
console.log(err) |
||||
|
}) |
||||
|
} else if (val == 'mainApprove') { // 审批通过 |
||||
|
await message.confirm('确认要审批通过吗?') |
||||
|
tableObject.loading = true |
||||
|
ContainerMainRequestApi.agree(row.masterId).then(() => { |
||||
|
message.success(t('common.updateSuccess')) |
||||
|
tableObject.loading = false |
||||
|
buttonBaseClick('refresh',null) |
||||
|
}).catch(err => { |
||||
|
tableObject.loading = false |
||||
|
console.log(err) |
||||
|
}) |
||||
|
} else if (val == 'mainHandle') { // 处理 |
||||
|
await message.confirm('确认要 处理吗?') |
||||
|
tableObject.loading = true |
||||
|
ContainerMainRequestApi.handle(row.masterId).then(() => { |
||||
|
message.success(t('common.updateSuccess')) |
||||
|
tableObject.loading = false |
||||
|
buttonBaseClick('refresh',null) |
||||
|
}).catch(err => { |
||||
|
tableObject.loading = false |
||||
|
console.log(err) |
||||
|
}) |
||||
|
} else if (val == 'edit') { // 编辑 |
||||
|
openForm('update', row) |
||||
|
} else if (val == 'delete') { // 删除 |
||||
|
handleDelete(row.id) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 添加/修改操作 */ |
||||
|
const basicFormRef = ref() |
||||
|
const openForm = (type: string, row?: any) => { |
||||
|
if('create'==type){ |
||||
|
tableData.value = [] |
||||
|
} |
||||
|
basicFormRef.value.open(type, row) |
||||
|
} |
||||
|
|
||||
|
const isShowButton = ref(true) |
||||
|
|
||||
|
/** |
||||
|
* tableForm方法 |
||||
|
*/ |
||||
|
const tableFormKeys = {} |
||||
|
ContainerDetailRequest.allSchemas.tableFormColumns.forEach(item => { |
||||
|
tableFormKeys[item.field] = item.default ? item.default : '' |
||||
|
}) |
||||
|
const tableData = ref([]) |
||||
|
|
||||
|
// 添加明细 |
||||
|
const handleAddTable = () => { |
||||
|
tableData.value.push(JSON.parse(JSON.stringify(tableFormKeys))) |
||||
|
} |
||||
|
// 删除明细 |
||||
|
const handleDeleteTable = (item, index) => { |
||||
|
let itemIndex = tableData.value.indexOf(item) |
||||
|
if(itemIndex>-1){ |
||||
|
tableData.value.splice(itemIndex, 1) |
||||
|
} |
||||
|
} |
||||
|
const tableSelectionDelete = (selection) => { |
||||
|
tableData.value = tableData.value.filter(item => !selection.includes(item)) |
||||
|
} |
||||
|
//为true表示子表数据中存在数量为0的数据 |
||||
|
const flag = ref() |
||||
|
|
||||
|
// form表单提交 |
||||
|
const submitForm = async (formType,submitData) => { |
||||
|
let data = {...submitData} |
||||
|
if(data.masterId){ |
||||
|
data.id = data.masterId |
||||
|
} |
||||
|
data.subList = tableData.value // 拼接子表数据参数 |
||||
|
data.subList.forEach(item => { |
||||
|
if(item.qty == 0){ |
||||
|
message.error(`到数量不能为0!`) |
||||
|
flag.value = true |
||||
|
return; |
||||
|
} |
||||
|
}) |
||||
|
basicFormRef.value.formLoading = true |
||||
|
try { |
||||
|
if (formType === 'create') { |
||||
|
data.businessType = businessType.value |
||||
|
console.log(data.businessType,999); |
||||
|
|
||||
|
await ContainerMainRequestApi.createContainerMainRequest(data) |
||||
|
message.success(t('common.createSuccess')) |
||||
|
} else { |
||||
|
await ContainerMainRequestApi.updateContainerMainRequest(data) |
||||
|
message.success(t('common.updateSuccess')) |
||||
|
} |
||||
|
basicFormRef.value.dialogVisible = false |
||||
|
if (formType === 'create') { |
||||
|
getList() |
||||
|
}else{ |
||||
|
buttonBaseClick('refresh',null) |
||||
|
} |
||||
|
} finally { |
||||
|
basicFormRef.value.formLoading = false |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 详情操作 */ |
||||
|
const detailRef = ref() |
||||
|
const openDetail = (row: any, titleName: any, titleValue: any) => { |
||||
|
detailRef.value.openDetail(row, titleName, titleValue, 'requestContainerMain') |
||||
|
} |
||||
|
|
||||
|
/** 删除按钮操作 */ |
||||
|
const handleDelete = async (id: number) => { |
||||
|
try { |
||||
|
// 删除的二次确认 |
||||
|
await message.delConfirm() |
||||
|
// 发起删除 |
||||
|
await ContainerMainRequestApi.deleteContainerMainRequest(id) |
||||
|
message.success(t('common.delSuccess')) |
||||
|
// 刷新列表 |
||||
|
buttonBaseClick('refresh',null) |
||||
|
} catch {} |
||||
|
} |
||||
|
|
||||
|
/** 导出按钮操作 */ |
||||
|
const handleExport = async () => { |
||||
|
try { |
||||
|
// 导出的二次确认 |
||||
|
await message.exportConfirm() |
||||
|
// 发起导出 |
||||
|
loadStart() |
||||
|
const excelTitle = ref(route.meta.title) |
||||
|
const data = await ContainerMainRequestApi.exportInitialContainerMainRequest(tableObject.params) |
||||
|
download.excel(data, `【${excelTitle.value}】【${formatDate(new Date())}】.xlsx`) |
||||
|
} catch { |
||||
|
} finally { |
||||
|
loadDone() |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 导入 */ |
||||
|
const importFormRef = ref() |
||||
|
const handleImport = () => { |
||||
|
importFormRef.value.open() |
||||
|
} |
||||
|
// 导入附件弹窗所需的参数 |
||||
|
const importTemplateData = reactive({ |
||||
|
templateUrl: '', |
||||
|
templateTitle: `【${route.meta.title}】导入模版.xlsx` |
||||
|
}) |
||||
|
// 导入成功之后 |
||||
|
const importSuccess = () => { |
||||
|
getList() |
||||
|
} |
||||
|
|
||||
|
// 筛选提交 |
||||
|
const searchFormClick = (searchData) => { |
||||
|
const cmd = { |
||||
|
'column':'type', |
||||
|
'action':'==', |
||||
|
'value':'Move' |
||||
|
} |
||||
|
if (!Array.isArray(searchData.filters)) { |
||||
|
searchData.filters = []; |
||||
|
} |
||||
|
searchData.filters.push(cmd) |
||||
|
tableObject.params = { |
||||
|
isSearch: true, |
||||
|
filters: searchData.filters |
||||
|
} |
||||
|
getList() // 刷新当前列表 |
||||
|
} |
||||
|
|
||||
|
/** 初始化 **/ |
||||
|
onMounted(async () => { |
||||
|
getList() |
||||
|
importTemplateData.templateUrl = await ContainerMainRequestApi.importTemplateReturnAndMove() |
||||
|
}) |
||||
|
|
||||
|
</script> |
||||
|
|
@ -0,0 +1,607 @@ |
|||||
|
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
||||
|
import { TableColumn } from '@/types/table' |
||||
|
import { dateFormatter } from '@/utils/formatTime' |
||||
|
|
||||
|
import * as BalanceApi from '@/api/wms/balance' |
||||
|
import { Balance } from '@/views/wms/inventoryManage/balance/balance.data' |
||||
|
|
||||
|
import * as LocationApi from '@/api/wms/location' |
||||
|
import { Location } from '@/views/wms/basicDataManage/factoryModeling/location/location.data' |
||||
|
|
||||
|
import * as getRequestsettingApi from '@/api/wms/requestsetting/index' |
||||
|
import * as getBusinessTypeApi from '@/api/wms/businesstype/index' |
||||
|
|
||||
|
// 表单校验
|
||||
|
export const ContainerMainRequestRules = reactive({ |
||||
|
type:[ |
||||
|
{ required: true, message: '请选择类型', trigger: 'change' }, |
||||
|
], |
||||
|
concurrencyStamp: [required], |
||||
|
}) |
||||
|
|
||||
|
const businessTypeQueryParams = { |
||||
|
pageSize:10, |
||||
|
pageNo:1, |
||||
|
code:'MoveContainerManage', |
||||
|
name:'器具移动管理' |
||||
|
} |
||||
|
|
||||
|
const businessTypeValue = await getBusinessTypeApi.getBusinesstypePage(businessTypeQueryParams) |
||||
|
const businessTypeData =businessTypeValue?.list[0]||{} |
||||
|
|
||||
|
// 获取自动提交自动通过自动执行,跳过任务直接删生成记录的默认值
|
||||
|
const queryParams = { |
||||
|
pageSize:10, |
||||
|
pageNo:1, |
||||
|
code:'ContainerRequest' |
||||
|
} |
||||
|
const data = await getRequestsettingApi.getRequestsettingPage(queryParams) |
||||
|
const requestsettingData =data?.list[0]||{} |
||||
|
|
||||
|
// 获取当前操作人的部门
|
||||
|
import { useUserStore } from '@/store/modules/user' |
||||
|
const userStore = useUserStore() |
||||
|
const userDept = userStore.userSelfInfo.dept |
||||
|
// id 转str 否则form回显匹配不到
|
||||
|
userDept.id = userDept.id.toString() |
||||
|
const userDeptArray:any = [userDept] |
||||
|
|
||||
|
export const ContainerMainRequest = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: '单据号', |
||||
|
field: 'number', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
isForm: false, |
||||
|
table: { |
||||
|
width: 100 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '状态', |
||||
|
field: 'status', |
||||
|
dictType: DICT_TYPE.REQUEST_STATUS, |
||||
|
dictClass: 'string', |
||||
|
isSearch: true, |
||||
|
isForm: false, |
||||
|
isTable: true, |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
form: { |
||||
|
componentProps: { |
||||
|
disabled: true |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '到库位代码', |
||||
|
field: 'toLocationCode', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
tableForm:{ |
||||
|
isInpuFocusShow: true, // 开启查询弹窗
|
||||
|
searchListPlaceholder: '请选择到库位代码', |
||||
|
searchField: 'code', |
||||
|
searchTitle: '库位信息', |
||||
|
searchAllSchemas: Location.allSchemas, |
||||
|
searchPage: LocationApi.selectBusinessTypeToLocation, |
||||
|
searchCondition: [{ |
||||
|
key: 'businessType', |
||||
|
value: businessTypeData.code, |
||||
|
},{ |
||||
|
key: 'isIn', |
||||
|
value: 'in', |
||||
|
isMainValue: false |
||||
|
}] |
||||
|
}, |
||||
|
form: { |
||||
|
// labelMessage: '信息提示说明!!!',
|
||||
|
componentProps: { |
||||
|
isSearchList: true, // 开启查询弹窗
|
||||
|
searchListPlaceholder: '请选择到库位代码', |
||||
|
searchField: 'code', |
||||
|
searchTitle: '库位信息', |
||||
|
searchAllSchemas: Location.allSchemas, |
||||
|
searchPage: LocationApi.selectBusinessTypeToLocation, |
||||
|
searchCondition: [{ |
||||
|
key: 'businessType', |
||||
|
value: businessTypeData.code, |
||||
|
},{ |
||||
|
key: 'isIn', |
||||
|
value: 'in', |
||||
|
isMainValue: false |
||||
|
}] |
||||
|
} |
||||
|
}, |
||||
|
isSearch: false, |
||||
|
isForm: true, |
||||
|
isTable: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '类型', |
||||
|
field: 'type', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.CONTAIN_MANAGE_TYPE, |
||||
|
dictClass: 'string', |
||||
|
isSearch: true, |
||||
|
isTable: true, |
||||
|
table: { |
||||
|
width: 120 |
||||
|
}, |
||||
|
form:{ |
||||
|
componentProps:{ |
||||
|
disabled: true, |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '是否可用', |
||||
|
field: 'available', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.TRUE_FALSE, |
||||
|
dictClass: 'string', |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '主备注', |
||||
|
field: 'mainRemark', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isForm: true, |
||||
|
isTable: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '部门', |
||||
|
field: 'departmentCode', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
formatter: (_: Recordable, __: TableColumn, cellValue: number) => { |
||||
|
return userDeptArray.find((account) => account.id == cellValue)?.name |
||||
|
}, |
||||
|
form: { |
||||
|
value: userDept.id, |
||||
|
component: 'Select', |
||||
|
api: () => userDeptArray, |
||||
|
componentProps: { |
||||
|
disabled: true, |
||||
|
optionsAlias: { |
||||
|
labelField: 'name', |
||||
|
valueField: 'id' |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '自动提交', |
||||
|
field: 'autoCommit', |
||||
|
dictType: DICT_TYPE.TRUE_FALSE, |
||||
|
dictClass: 'string', |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'Switch', |
||||
|
value: requestsettingData.autoCommit, |
||||
|
componentProps: { |
||||
|
inactiveValue: 'FALSE', |
||||
|
activeValue: 'TRUE', |
||||
|
disabled: true |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '自动通过', |
||||
|
field: 'autoAgree', |
||||
|
dictType: DICT_TYPE.TRUE_FALSE, |
||||
|
dictClass: 'string', |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'Switch', |
||||
|
value: requestsettingData.autoAgree, |
||||
|
componentProps: { |
||||
|
inactiveValue: 'FALSE', |
||||
|
activeValue: 'TRUE', |
||||
|
disabled: true |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '自动执行', |
||||
|
field: 'autoExecute', |
||||
|
dictType: DICT_TYPE.TRUE_FALSE, |
||||
|
dictClass: 'string', |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'Switch', |
||||
|
value: requestsettingData.autoExecute, |
||||
|
componentProps: { |
||||
|
inactiveValue: 'FALSE', |
||||
|
activeValue: 'TRUE', |
||||
|
disabled: true |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '直接生成记录', |
||||
|
field: 'directCreateRecord', |
||||
|
dictType: DICT_TYPE.TRUE_FALSE, |
||||
|
dictClass: 'string', |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'Switch', |
||||
|
value: requestsettingData.directCreateRecord, |
||||
|
componentProps: { |
||||
|
inactiveValue: 'FALSE', |
||||
|
activeValue: 'TRUE', |
||||
|
disabled: true |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建时间', |
||||
|
field: 'createTime', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
detail: { |
||||
|
dateFormat : 'YYYY-MM-DD HH:mm:ss' |
||||
|
}, |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
search: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
type: 'daterange', |
||||
|
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
||||
|
} |
||||
|
}, |
||||
|
table: { |
||||
|
width: 180 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建者', |
||||
|
field: 'creator', |
||||
|
table: { |
||||
|
width: 130 |
||||
|
}, |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '最后更新时间', |
||||
|
field: 'updateTime', |
||||
|
sort: 'custom', |
||||
|
isDetail: true, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
formatter: dateFormatter, |
||||
|
detail: { |
||||
|
dateFormat: 'YYYY-MM-DD HH:mm:ss' |
||||
|
}, |
||||
|
table: { |
||||
|
width: 180 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
style: {width:'100%'}, |
||||
|
type: 'datetime', |
||||
|
dateFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
valueFormat: 'x', |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '最后更新者', |
||||
|
field: 'updater', |
||||
|
isDetail: true, |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
table: { |
||||
|
width: 150 |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '扩展属性', |
||||
|
field: 'extraProperties', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '并发乐观锁', |
||||
|
field: 'concurrencyStamp', |
||||
|
sort: 'custom', |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
value: 0 |
||||
|
}, |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '地点ID', |
||||
|
field: 'siteId', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作', |
||||
|
field: 'action', |
||||
|
isForm: false, |
||||
|
table: { |
||||
|
width: 200, |
||||
|
fixed: 'right' |
||||
|
} |
||||
|
} |
||||
|
])) |
||||
|
|
||||
|
// 表单校验
|
||||
|
export const ContainerDetailRequestRules = reactive({ |
||||
|
toLocationCode: [ |
||||
|
{ required: true, message: '请选择目标库位', trigger: 'blur' } |
||||
|
], |
||||
|
containerNumber: [ |
||||
|
{ required: true, message: '请选择器具号', trigger: 'blur' } |
||||
|
], |
||||
|
toQty: [ |
||||
|
{ required: true, message: '请输入到数量', trigger: 'blur' } |
||||
|
], |
||||
|
}) |
||||
|
|
||||
|
export const ContainerDetailRequest = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: 'id', |
||||
|
field: 'id', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '主表ID', |
||||
|
field: 'masterId', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
value: 0 |
||||
|
}, |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '单据号', |
||||
|
field: 'number', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '器具号', |
||||
|
field: 'containerNumber', |
||||
|
sort: 'custom', |
||||
|
tableForm:{ |
||||
|
multiple:true, |
||||
|
isInpuFocusShow: true, // 开启查询弹窗
|
||||
|
searchListPlaceholder: '请选择器具号', |
||||
|
searchField: 'itemCode', |
||||
|
searchTitle: '库存余额信息', |
||||
|
searchAllSchemas: Balance.allSchemas, |
||||
|
searchPage: BalanceApi.getBalanceByQJ, |
||||
|
}, |
||||
|
form: { |
||||
|
// labelMessage: '信息提示说明!!!',
|
||||
|
componentProps: { |
||||
|
isSearchList: true, // 开启查询弹窗
|
||||
|
searchListPlaceholder: '请选择器具号', |
||||
|
searchField: 'itemCode', |
||||
|
searchTitle: '库存余额信息', |
||||
|
searchAllSchemas: Balance.allSchemas, |
||||
|
searchPage: BalanceApi.getBalanceByQJ, |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '数量', |
||||
|
field: 'toQty', |
||||
|
sort: 'custom', |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
componentProps: { |
||||
|
disabled: true, |
||||
|
min: 0, |
||||
|
precision: 6 |
||||
|
} |
||||
|
}, |
||||
|
tableForm: { |
||||
|
type: 'InputNumber', |
||||
|
min: 0, |
||||
|
precision: 6 |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '计量单位', |
||||
|
field: 'uom', |
||||
|
dictType: DICT_TYPE.UOM, |
||||
|
dictClass: 'string', |
||||
|
isTable: true, |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
tableForm: { |
||||
|
type: 'Select', |
||||
|
disabled: true |
||||
|
}, |
||||
|
form: { |
||||
|
componentProps: { |
||||
|
disabled: true |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '库存状态', |
||||
|
field: 'toInventoryStatus', |
||||
|
dictType: DICT_TYPE.INVENTORY_STATUS, |
||||
|
dictClass: 'string', |
||||
|
isTable: true, |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
tableForm: { |
||||
|
disabled: true, |
||||
|
type: 'Select' |
||||
|
}, |
||||
|
form: { |
||||
|
componentProps: { |
||||
|
disabled: true |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '子备注', |
||||
|
field: 'remark', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建时间', |
||||
|
field: 'createTime', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
detail: { |
||||
|
dateFormat : 'YYYY-MM-DD HH:mm:ss' |
||||
|
}, |
||||
|
search: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
type: 'daterange', |
||||
|
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
||||
|
} |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
style: {width:'100%'}, |
||||
|
type: 'datetime', |
||||
|
dateFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
valueFormat: 'x', |
||||
|
} |
||||
|
}, |
||||
|
table: { |
||||
|
width: 180 |
||||
|
}, |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建者', |
||||
|
field: 'creator', |
||||
|
table: { |
||||
|
width: 130 |
||||
|
}, |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '地点ID', |
||||
|
field: 'siteId', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '并发乐观锁', |
||||
|
field: 'concurrencyStamp', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '从货主代码', |
||||
|
field: 'fromOwnerCode', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '到货主代码', |
||||
|
field: 'toOwnerCode', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作', |
||||
|
field: 'action', |
||||
|
isForm: false, |
||||
|
hiddenInMain:true, |
||||
|
isTableForm: false, |
||||
|
table: { |
||||
|
width: 200, |
||||
|
fixed: 'right' |
||||
|
} |
||||
|
} |
||||
|
])) |
||||
|
|
@ -0,0 +1,542 @@ |
|||||
|
<template> |
||||
|
<ContentWrap> |
||||
|
<!-- 搜索工作栏 --> |
||||
|
<Search :schema="ContainerMainRequest.allSchemas.searchSchema" @search="searchList" @reset="searchList" /> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 列表头部 --> |
||||
|
<TableHead |
||||
|
:HeadButttondata="HeadButttondata" |
||||
|
@button-base-click="buttonBaseClick" |
||||
|
:routeName="routeName" |
||||
|
@updataTableColumns="updataTableColumns" |
||||
|
@searchFormClick="searchFormClick" |
||||
|
:allSchemas="ContainerMainRequest.allSchemas" |
||||
|
:detailAllSchemas="ContainerDetailRequest.allSchemas" |
||||
|
/> |
||||
|
|
||||
|
<!-- 列表 --> |
||||
|
<ContentWrap> |
||||
|
<Table |
||||
|
:columns="tableColumns" |
||||
|
:data="tableObject.tableList" |
||||
|
:loading="tableObject.loading" |
||||
|
:pagination="{ |
||||
|
total: tableObject.total |
||||
|
}" |
||||
|
v-model:pageSize="tableObject.pageSize" |
||||
|
v-model:currentPage="tableObject.currentPage" |
||||
|
v-model:sort="tableObject.sort" |
||||
|
> |
||||
|
<template #number="{row}"> |
||||
|
<el-button type="primary" link @click="openDetail(row, '代码', row.number)"> |
||||
|
<span>{{ row.number }}</span> |
||||
|
</el-button> |
||||
|
</template> |
||||
|
<template #action="{ row,$index }"> |
||||
|
<ButtonBase :Butttondata="butttondata(row,$index)" @button-base-click="buttonTableClick($event,row)" /> |
||||
|
</template> |
||||
|
</Table> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 表单弹窗:添加/修改 --> |
||||
|
<BasicForm |
||||
|
ref="basicFormRef" |
||||
|
:isOpenSearchTable="true" |
||||
|
fieldTableColumn="containerNumber" |
||||
|
@success="getList" |
||||
|
:rules="ContainerMainRequestRules" |
||||
|
:formAllSchemas="ContainerMainRequest.allSchemas" |
||||
|
:tableAllSchemas="ContainerDetailRequest.allSchemas" |
||||
|
:tableFormRules="ContainerDetailRequestRules" |
||||
|
:tableData="tableData" |
||||
|
:apiUpdate="ContainerMainRequestApi.updateContainerMainRequest" |
||||
|
:apiCreate="ContainerMainRequestApi.createContainerMainRequest" |
||||
|
:isBusiness="true" |
||||
|
fromeWhere="ContainerMainRequest" |
||||
|
@handleAddTable="handleAddTable" |
||||
|
@handleDeleteTable="handleDeleteTable" |
||||
|
:isShowReduceButtonSelection="true" |
||||
|
@tableSelectionDelete="tableSelectionDelete" |
||||
|
@searchTableSuccess="searchTableSuccess" |
||||
|
@submitForm="submitForm" |
||||
|
:isShowButton = isShowButton |
||||
|
/> |
||||
|
|
||||
|
<!-- 详情 --> |
||||
|
<Detail |
||||
|
ref="detailRef" |
||||
|
:isBasic="false" |
||||
|
:allSchemas="ContainerMainRequest.allSchemas" |
||||
|
:detailAllSchemas="ContainerDetailRequest.allSchemas" |
||||
|
:detailAllSchemasRules="ContainerDetailRequestRules" |
||||
|
:apiCreate="ContainerDetailRequestApi.createContainerDetailRequest" |
||||
|
:apiUpdate="ContainerDetailRequestApi.createContainerDetailRequest" |
||||
|
:apiPage="ContainerDetailRequestApi.getContainerDetailRequestPage" |
||||
|
:apiDelete="ContainerDetailRequestApi.deleteContainerDetailRequest" |
||||
|
fromeWhere="ContainerDetailRequest" |
||||
|
@searchTableSuccessDetail="searchTableSuccessDetail" |
||||
|
:detailButtonIsShowAdd="trueFalse" |
||||
|
:detailButtonIsShowDelete="trueFalse" |
||||
|
/> |
||||
|
|
||||
|
<!-- 导入 --> |
||||
|
<ImportForm ref="importFormRef" url="/wms/container-main-request/import" :importTemplateData="importTemplateData" @success="importSuccess":toInventoryStatus= "toInventoryStatus"/> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import download from '@/utils/download' |
||||
|
import { ContainerMainRequest,ContainerMainRequestRules,ContainerDetailRequest,ContainerDetailRequestRules } from './returnContainerMainRequest.data' |
||||
|
import * as ContainerMainRequestApi from '@/api/wms/containerMainRequest' |
||||
|
import * as ContainerDetailRequestApi from '@/api/wms/containerDetailRequest' |
||||
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
||||
|
import TableHead from '@/components/TableHead/src/TableHead.vue' |
||||
|
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' |
||||
|
import Detail from '@/components/Detail/src/Detail.vue' |
||||
|
import { formatDate } from '@/utils/formatTime' |
||||
|
import { usePageLoading } from '@/hooks/web/usePageLoading' |
||||
|
const { loadStart, loadDone } = usePageLoading() |
||||
|
defineOptions({ name: 'ReturnContainerManageRequest' }) |
||||
|
|
||||
|
const message = useMessage() // 消息弹窗 |
||||
|
const { t } = useI18n() // 国际化 |
||||
|
const businessType = ref() |
||||
|
const toLocationCode = ref() |
||||
|
const importFileName = ref() |
||||
|
const route = useRoute() // 路由信息 |
||||
|
const routeName = ref() |
||||
|
const toInventoryStatus = 'RETURN' |
||||
|
routeName.value = route.name |
||||
|
const tableColumns = ref(ContainerMainRequest.allSchemas.tableColumns) |
||||
|
console.log(99 , routeName.value) |
||||
|
const searchType = ref() |
||||
|
const { tableObject, tableMethods } = useTable({ |
||||
|
getListApi: ContainerDetailRequestApi.getContainerDetailRequestPage // 分页接口 |
||||
|
}) |
||||
|
// 判断 路由名称 进行条件过滤 |
||||
|
/** |
||||
|
* |
||||
|
*/ |
||||
|
|
||||
|
if ( routeName.value == 'ReturnContainerManageRequest') { |
||||
|
tableObject.params = { |
||||
|
type:'RETURN', |
||||
|
} |
||||
|
searchType.value = 'RETURN' |
||||
|
ContainerMainRequest.allSchemas.formSchema.forEach(item=>{ |
||||
|
if(item.field == 'type'){ |
||||
|
item.value = "RETURN" |
||||
|
} |
||||
|
|
||||
|
}); |
||||
|
businessType.value = 'ReturnContainerManage' |
||||
|
importFileName.value = '器具返回申请' |
||||
|
} |
||||
|
|
||||
|
//定义 展示子表数据时是否显示新增/修改/删除按钮 |
||||
|
const trueFalse = ref(false) |
||||
|
// 查询页面返回 |
||||
|
const searchTableSuccess = (formField, searchField, val, formRef, type, row) => { |
||||
|
nextTick(() => { |
||||
|
if (type == 'tableForm') { |
||||
|
if(formField == 'containerNumber') { |
||||
|
let itemCodes = val.filter(item=>tableData.value.find(item1=>item1['containerNumber']==item['code'])) |
||||
|
if(itemCodes.length>0){ |
||||
|
itemCodes = itemCodes.map(item=>(item['code'])) |
||||
|
message.warning(`器具号${itemCodes.join(',')}已经存在`) |
||||
|
} |
||||
|
val = val.filter(item=>!tableData.value.find(item1=>item1['containerNumber']==item['code'])) |
||||
|
if(val.length==0) return |
||||
|
val.forEach(item=>{ |
||||
|
const newRow = JSON.parse(JSON.stringify({...tableFormKeys,...item})) |
||||
|
newRow['containerNumber'] = item['itemCode'] |
||||
|
newRow['uom'] = item['uom'] |
||||
|
newRow['toInventoryStatus'] = 'OK' |
||||
|
newRow['fromLocationCode'] = item['locationCode'] |
||||
|
newRow['fromInventoryStatus'] = item['inventoryStatus'] |
||||
|
newRow['toQty'] = item['qty'] |
||||
|
tableData.value.push(newRow) |
||||
|
}) |
||||
|
|
||||
|
}else if(formField == 'toLocationCode'){ |
||||
|
row['toLocationCode'] = val[0]['code'] |
||||
|
}else { |
||||
|
row[formField] = val[0][searchField] |
||||
|
} |
||||
|
} |
||||
|
const setV = {} |
||||
|
setV[formField] = val[0][searchField] |
||||
|
formRef.setValues(setV) |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
const searchList = (model)=>{ |
||||
|
model.type = searchType.value |
||||
|
setSearchParams(model) |
||||
|
} |
||||
|
|
||||
|
// 查询页面返回——详情 |
||||
|
const searchTableSuccessDetail = (formField, searchField, val, formRef ) => { |
||||
|
nextTick(() => { |
||||
|
const setV = {} |
||||
|
if(formField == 'containerNumber') { |
||||
|
setV['containerNumber'] = val[0]['code'] |
||||
|
setV['uom'] = val[0]['uom'] |
||||
|
}else if(formField == 'toLocationCode'){ |
||||
|
setV['toLocationCode'] = val[0]['code'] |
||||
|
}else { |
||||
|
setV[formField] = val[0][searchField] |
||||
|
} |
||||
|
formRef.setValues(setV) |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
// 修改 tableform 属性 |
||||
|
ContainerDetailRequest.allSchemas.tableFormColumns.map(item => { |
||||
|
if(item.field == "toLocationCode"){ |
||||
|
if (toLocationCode.value) { |
||||
|
item.tableForm.searchCondition = [ |
||||
|
{ |
||||
|
key: 'businessType', |
||||
|
value: businessType.value, |
||||
|
isMainValue: false |
||||
|
},{ |
||||
|
key: 'isIn', |
||||
|
value: 'in', |
||||
|
isMainValue: false |
||||
|
}] |
||||
|
item.form.componentProps.searchCondition = [ |
||||
|
{ |
||||
|
key: 'businessType', |
||||
|
value: businessType.value, |
||||
|
isMainValue: false |
||||
|
},{ |
||||
|
key: 'isIn', |
||||
|
value: 'in', |
||||
|
isMainValue: false |
||||
|
}] |
||||
|
}else if (toLocationCode.value == null) { |
||||
|
item.tableForm.searchCondition = [ |
||||
|
{ |
||||
|
key: 'businessType', |
||||
|
value: businessType.value , |
||||
|
isMainValue: false |
||||
|
},{ |
||||
|
key: 'isIn', |
||||
|
value: 'in', |
||||
|
isMainValue: false |
||||
|
}] |
||||
|
item.form.componentProps.searchCondition = [ |
||||
|
{ |
||||
|
key: 'businessType', |
||||
|
value: businessType.value, |
||||
|
isMainValue: false |
||||
|
},{ |
||||
|
key: 'isIn', |
||||
|
value: 'in', |
||||
|
isMainValue: false |
||||
|
}] |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
|
||||
|
// 字段设置 更新主列表字段 |
||||
|
const updataTableColumns = (val) => { |
||||
|
tableColumns.value = val |
||||
|
} |
||||
|
|
||||
|
// 获得表格的各种操作 |
||||
|
const { getList, setSearchParams } = tableMethods |
||||
|
|
||||
|
// 根据状态返回该按钮是否显示 |
||||
|
const isShowMainButton = (row,val) => { |
||||
|
if (val.indexOf(row.status) > -1) { |
||||
|
return false |
||||
|
} else { |
||||
|
return true |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 列表头部按钮 |
||||
|
const HeadButttondata = [ |
||||
|
defaultButtons.defaultAddBtn({hasPermi:'wms:initial-container-main-request:create'}), // 新增 |
||||
|
defaultButtons.defaultImportBtn({hasPermi:'wms:initial-container-main-request:import'}), // 导入 |
||||
|
defaultButtons.defaultExportBtn({hasPermi:'wms:initial-container-main-request:export'}), // 导出 |
||||
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
||||
|
defaultButtons.defaultFilterBtn(null), // 筛选 |
||||
|
defaultButtons.defaultSetBtn(null), // 设置 |
||||
|
// { |
||||
|
// label: '自定义扩展按钮', |
||||
|
// name: 'zdy', |
||||
|
// hide: false, |
||||
|
// type: 'primary', |
||||
|
// icon: 'Select', |
||||
|
// color: '' |
||||
|
// }, |
||||
|
] |
||||
|
|
||||
|
// 头部按钮事件 |
||||
|
const buttonBaseClick = (val, item) => { |
||||
|
if (val == 'add') { // 新增 |
||||
|
openForm('create') |
||||
|
} else if (val == 'import') { // 导入 |
||||
|
handleImport() |
||||
|
} else if (val == 'export') { // 导出 |
||||
|
handleExport() |
||||
|
} else if (val == 'refresh') { // 刷新 |
||||
|
if (tableObject.params.filters && tableObject.params.filters.length > 0 ) { |
||||
|
searchFormClick({ |
||||
|
filters: tableObject.params.filters |
||||
|
}) |
||||
|
} else { |
||||
|
getList() |
||||
|
} |
||||
|
} else if (val == 'filtrate') { // 筛选 |
||||
|
} else { // 其他按钮 |
||||
|
console.log('其他按钮', item) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 列表-操作按钮 |
||||
|
const butttondata = (row,$index) => { |
||||
|
const findIndex = row['masterId']?tableObject.tableList.findIndex(item=>item['masterId'] == row['masterId']):-1 |
||||
|
if(findIndex>-1&&findIndex<$index){ |
||||
|
return [] |
||||
|
} |
||||
|
return [ |
||||
|
defaultButtons.mainListCloseBtn({hide:isShowMainButton(row,['2','3','4','6']),hasPermi:'wms:initial-container-main-request:close'}), // 关闭 |
||||
|
defaultButtons.mainListReAddBtn({hide:isShowMainButton(row,['4','5']),hasPermi:'wms:initial-container-main-request:reAdd'}), //重新添加 |
||||
|
defaultButtons.mainListSubmitBtn({hide:isShowMainButton(row,['1']),hasPermi:'wms:initial-container-main-request:submit'}), // 提交审批 |
||||
|
defaultButtons.mainListTurnDownBtn({hide:isShowMainButton(row,['2']),hasPermi:'wms:initial-container-main-request:refused'}), // 驳回 |
||||
|
defaultButtons.mainListApproveBtn({hide:isShowMainButton(row,['2']),hasPermi:'wms:initial-container-main-request:agree'}), // 审批通过 |
||||
|
defaultButtons.mainListHandleBtn({hide:isShowMainButton(row,['3']),hasPermi:'wms:initial-container-main-request:handle'}), // 处理 |
||||
|
defaultButtons.mainListEditBtn({hide:isShowMainButton(row,['1']),hasPermi:'wms:initial-container-main-request:update'}), // 编辑 |
||||
|
// defaultButtons.mainListDeleteBtn({hasPermi:'wms:initial-container-main-request:delete'}), // 删除 |
||||
|
] |
||||
|
} |
||||
|
|
||||
|
// 列表-操作按钮事件 |
||||
|
const buttonTableClick = async (val, row) => { |
||||
|
if (val == 'mainClose') { // 关闭 |
||||
|
await message.confirm('确认要关闭吗?') |
||||
|
tableObject.loading = true |
||||
|
ContainerMainRequestApi.close(row.masterId).then(() => { |
||||
|
message.success(t('common.updateSuccess')) |
||||
|
tableObject.loading = false |
||||
|
buttonBaseClick('refresh',null) |
||||
|
}).catch(err => { |
||||
|
tableObject.loading = false |
||||
|
console.log(err) |
||||
|
}) |
||||
|
} else if (val == 'mainReAdd') { // 重新添加 |
||||
|
await message.confirm('确认要重新添加吗?') |
||||
|
tableObject.loading = true |
||||
|
ContainerMainRequestApi.reAdd(row.masterId).then(() => { |
||||
|
message.success(t('common.updateSuccess')) |
||||
|
tableObject.loading = false |
||||
|
buttonBaseClick('refresh',null) |
||||
|
}).catch(err => { |
||||
|
tableObject.loading = false |
||||
|
console.log(err) |
||||
|
}) |
||||
|
} else if (val == 'mainSubmit') { // 提交审批 |
||||
|
await message.confirm('确认要提交审批吗?') |
||||
|
tableObject.loading = true |
||||
|
ContainerMainRequestApi.submit(row.masterId).then(() => { |
||||
|
message.success(t('common.updateSuccess')) |
||||
|
tableObject.loading = false |
||||
|
buttonBaseClick('refresh',null) |
||||
|
}).catch(err => { |
||||
|
tableObject.loading = false |
||||
|
console.log(err) |
||||
|
}) |
||||
|
} else if (val == 'mainTurnDown') { // 驳回 |
||||
|
await message.confirm('确认要驳回吗?') |
||||
|
tableObject.loading = true |
||||
|
ContainerMainRequestApi.refused(row.masterId).then(() => { |
||||
|
message.success(t('common.updateSuccess')) |
||||
|
tableObject.loading = false |
||||
|
buttonBaseClick('refresh',null) |
||||
|
}).catch(err => { |
||||
|
tableObject.loading = false |
||||
|
console.log(err) |
||||
|
}) |
||||
|
} else if (val == 'mainApprove') { // 审批通过 |
||||
|
await message.confirm('确认要审批通过吗?') |
||||
|
tableObject.loading = true |
||||
|
ContainerMainRequestApi.agree(row.masterId).then(() => { |
||||
|
message.success(t('common.updateSuccess')) |
||||
|
tableObject.loading = false |
||||
|
buttonBaseClick('refresh',null) |
||||
|
}).catch(err => { |
||||
|
tableObject.loading = false |
||||
|
console.log(err) |
||||
|
}) |
||||
|
} else if (val == 'mainHandle') { // 处理 |
||||
|
await message.confirm('确认要 处理吗?') |
||||
|
tableObject.loading = true |
||||
|
ContainerMainRequestApi.handle(row.masterId).then(() => { |
||||
|
message.success(t('common.updateSuccess')) |
||||
|
tableObject.loading = false |
||||
|
buttonBaseClick('refresh',null) |
||||
|
}).catch(err => { |
||||
|
tableObject.loading = false |
||||
|
console.log(err) |
||||
|
}) |
||||
|
} else if (val == 'edit') { // 编辑 |
||||
|
openForm('update', row) |
||||
|
} else if (val == 'delete') { // 删除 |
||||
|
handleDelete(row.id) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 添加/修改操作 */ |
||||
|
const basicFormRef = ref() |
||||
|
const openForm = (type: string, row?: any) => { |
||||
|
if('create'==type){ |
||||
|
tableData.value = [] |
||||
|
} |
||||
|
basicFormRef.value.open(type, row) |
||||
|
} |
||||
|
|
||||
|
const isShowButton = ref(true) |
||||
|
|
||||
|
/** |
||||
|
* tableForm方法 |
||||
|
*/ |
||||
|
const tableFormKeys = {} |
||||
|
ContainerDetailRequest.allSchemas.tableFormColumns.forEach(item => { |
||||
|
tableFormKeys[item.field] = item.default ? item.default : '' |
||||
|
}) |
||||
|
const tableData = ref([]) |
||||
|
|
||||
|
// 添加明细 |
||||
|
const handleAddTable = () => { |
||||
|
tableData.value.push(JSON.parse(JSON.stringify(tableFormKeys))) |
||||
|
} |
||||
|
// 删除明细 |
||||
|
const handleDeleteTable = (item, index) => { |
||||
|
let itemIndex = tableData.value.indexOf(item) |
||||
|
if(itemIndex>-1){ |
||||
|
tableData.value.splice(itemIndex, 1) |
||||
|
} |
||||
|
} |
||||
|
const tableSelectionDelete = (selection) => { |
||||
|
tableData.value = tableData.value.filter(item => !selection.includes(item)) |
||||
|
} |
||||
|
//为true表示子表数据中存在数量为0的数据 |
||||
|
const flag = ref() |
||||
|
|
||||
|
// form表单提交 |
||||
|
const submitForm = async (formType,submitData) => { |
||||
|
let data = {...submitData} |
||||
|
if(data.masterId){ |
||||
|
data.id = data.masterId |
||||
|
} |
||||
|
data.subList = tableData.value // 拼接子表数据参数 |
||||
|
data.subList.forEach(item => { |
||||
|
if(item.qty == 0){ |
||||
|
message.error(`到数量不能为0!`) |
||||
|
flag.value = true |
||||
|
return; |
||||
|
} |
||||
|
}) |
||||
|
basicFormRef.value.formLoading = true |
||||
|
try { |
||||
|
if (formType === 'create') { |
||||
|
data.businessType = businessType.value |
||||
|
console.log(data.businessType,999); |
||||
|
|
||||
|
await ContainerMainRequestApi.createContainerMainRequest(data) |
||||
|
message.success(t('common.createSuccess')) |
||||
|
} else { |
||||
|
await ContainerMainRequestApi.updateContainerMainRequest(data) |
||||
|
message.success(t('common.updateSuccess')) |
||||
|
} |
||||
|
basicFormRef.value.dialogVisible = false |
||||
|
if (formType === 'create') { |
||||
|
getList() |
||||
|
}else{ |
||||
|
buttonBaseClick('refresh',null) |
||||
|
} |
||||
|
} finally { |
||||
|
basicFormRef.value.formLoading = false |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 详情操作 */ |
||||
|
const detailRef = ref() |
||||
|
const openDetail = (row: any, titleName: any, titleValue: any) => { |
||||
|
detailRef.value.openDetail(row, titleName, titleValue, 'requestContainerMain') |
||||
|
} |
||||
|
|
||||
|
/** 删除按钮操作 */ |
||||
|
const handleDelete = async (id: number) => { |
||||
|
try { |
||||
|
// 删除的二次确认 |
||||
|
await message.delConfirm() |
||||
|
// 发起删除 |
||||
|
await ContainerMainRequestApi.deleteContainerMainRequest(id) |
||||
|
message.success(t('common.delSuccess')) |
||||
|
// 刷新列表 |
||||
|
buttonBaseClick('refresh',null) |
||||
|
} catch {} |
||||
|
} |
||||
|
|
||||
|
/** 导出按钮操作 */ |
||||
|
const handleExport = async () => { |
||||
|
try { |
||||
|
// 导出的二次确认 |
||||
|
await message.exportConfirm() |
||||
|
// 发起导出 |
||||
|
loadStart() |
||||
|
const excelTitle = ref(route.meta.title) |
||||
|
const data = await ContainerMainRequestApi.exportInitialContainerMainRequest(tableObject.params) |
||||
|
download.excel(data, `【${excelTitle.value}】【${formatDate(new Date())}】.xlsx`) |
||||
|
} catch { |
||||
|
} finally { |
||||
|
loadDone() |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 导入 */ |
||||
|
const importFormRef = ref() |
||||
|
const handleImport = () => { |
||||
|
importFormRef.value.open() |
||||
|
} |
||||
|
// 导入附件弹窗所需的参数 |
||||
|
const importTemplateData = reactive({ |
||||
|
templateUrl: '', |
||||
|
templateTitle: `【${route.meta.title}】导入模版.xlsx` |
||||
|
}) |
||||
|
// 导入成功之后 |
||||
|
const importSuccess = () => { |
||||
|
getList() |
||||
|
} |
||||
|
|
||||
|
// 筛选提交 |
||||
|
const searchFormClick = (searchData) => { |
||||
|
const cmd = { |
||||
|
'column':'type', |
||||
|
'action':'==', |
||||
|
'value':'RETURN' |
||||
|
} |
||||
|
if (!Array.isArray(searchData.filters)) { |
||||
|
searchData.filters = []; |
||||
|
} |
||||
|
searchData.filters.push(cmd) |
||||
|
tableObject.params = { |
||||
|
isSearch: true, |
||||
|
filters: searchData.filters |
||||
|
} |
||||
|
getList() // 刷新当前列表 |
||||
|
} |
||||
|
|
||||
|
/** 初始化 **/ |
||||
|
onMounted(async () => { |
||||
|
getList() |
||||
|
importTemplateData.templateUrl = await ContainerMainRequestApi.importTemplateReturnAndMove() |
||||
|
}) |
||||
|
|
||||
|
</script> |
||||
|
|
@ -0,0 +1,629 @@ |
|||||
|
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
||||
|
import { TableColumn } from '@/types/table' |
||||
|
import { dateFormatter } from '@/utils/formatTime' |
||||
|
|
||||
|
import * as BalanceApi from '@/api/wms/balance' |
||||
|
import { Balance } from '@/views/wms/inventoryManage/balance/balance.data' |
||||
|
|
||||
|
import * as LocationApi from '@/api/wms/location' |
||||
|
import { Location } from '@/views/wms/basicDataManage/factoryModeling/location/location.data' |
||||
|
|
||||
|
import * as getRequestsettingApi from '@/api/wms/requestsetting/index' |
||||
|
import * as getBusinessTypeApi from '@/api/wms/businesstype/index' |
||||
|
|
||||
|
// 表单校验
|
||||
|
export const ContainerMainRequestRules = reactive({ |
||||
|
type:[ |
||||
|
{ required: true, message: '请选择类型', trigger: 'change' }, |
||||
|
], |
||||
|
concurrencyStamp: [required], |
||||
|
}) |
||||
|
|
||||
|
const businessTypeQueryParams = { |
||||
|
pageSize:10, |
||||
|
pageNo:1, |
||||
|
code:'ReturnContainerManage', |
||||
|
name:'器具返回管理' |
||||
|
} |
||||
|
|
||||
|
const businessTypeValue = await getBusinessTypeApi.getBusinesstypePage(businessTypeQueryParams) |
||||
|
const businessTypeData =businessTypeValue?.list[0]||{} |
||||
|
|
||||
|
// 获取自动提交自动通过自动执行,跳过任务直接删生成记录的默认值
|
||||
|
const queryParams = { |
||||
|
pageSize:10, |
||||
|
pageNo:1, |
||||
|
code:'ContainerRequest' |
||||
|
} |
||||
|
const data = await getRequestsettingApi.getRequestsettingPage(queryParams) |
||||
|
const requestsettingData =data?.list[0]||{} |
||||
|
|
||||
|
// 获取当前操作人的部门
|
||||
|
import { useUserStore } from '@/store/modules/user' |
||||
|
const userStore = useUserStore() |
||||
|
const userDept = userStore.userSelfInfo.dept |
||||
|
// id 转str 否则form回显匹配不到
|
||||
|
userDept.id = userDept.id.toString() |
||||
|
const userDeptArray:any = [userDept] |
||||
|
|
||||
|
export const ContainerMainRequest = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: '单据号', |
||||
|
field: 'number', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
isForm: false, |
||||
|
table: { |
||||
|
width: 100 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '状态', |
||||
|
field: 'status', |
||||
|
dictType: DICT_TYPE.REQUEST_STATUS, |
||||
|
dictClass: 'string', |
||||
|
isSearch: true, |
||||
|
isForm: false, |
||||
|
isTable: true, |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
form: { |
||||
|
componentProps: { |
||||
|
disabled: true |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '到库位代码', |
||||
|
field: 'toLocationCode', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
tableForm:{ |
||||
|
isInpuFocusShow: true, // 开启查询弹窗
|
||||
|
searchListPlaceholder: '请选择到库位代码', |
||||
|
searchField: 'code', |
||||
|
searchTitle: '库位信息', |
||||
|
searchAllSchemas: Location.allSchemas, |
||||
|
searchPage: LocationApi.selectBusinessTypeToLocation, |
||||
|
searchCondition: [{ |
||||
|
key: 'businessType', |
||||
|
value: businessTypeData.code, |
||||
|
},{ |
||||
|
key: 'isIn', |
||||
|
value: 'in', |
||||
|
isMainValue: false |
||||
|
}] |
||||
|
}, |
||||
|
form: { |
||||
|
// labelMessage: '信息提示说明!!!',
|
||||
|
componentProps: { |
||||
|
isSearchList: true, // 开启查询弹窗
|
||||
|
searchListPlaceholder: '请选择到库位代码', |
||||
|
searchField: 'code', |
||||
|
searchTitle: '库位信息', |
||||
|
searchAllSchemas: Location.allSchemas, |
||||
|
searchPage: LocationApi.selectBusinessTypeToLocation, |
||||
|
searchCondition: [{ |
||||
|
key: 'businessType', |
||||
|
value: businessTypeData.code, |
||||
|
},{ |
||||
|
key: 'isIn', |
||||
|
value: 'in', |
||||
|
isMainValue: false |
||||
|
}] |
||||
|
} |
||||
|
}, |
||||
|
isSearch: false, |
||||
|
isForm: true, |
||||
|
isTable: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '类型', |
||||
|
field: 'type', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.CONTAIN_MANAGE_TYPE, |
||||
|
dictClass: 'string', |
||||
|
isSearch: true, |
||||
|
isTable: true, |
||||
|
table: { |
||||
|
width: 120 |
||||
|
}, |
||||
|
form:{ |
||||
|
componentProps:{ |
||||
|
disabled: true, |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '是否可用', |
||||
|
field: 'available', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.TRUE_FALSE, |
||||
|
dictClass: 'string', |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '主备注', |
||||
|
field: 'mainRemark', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isForm: true, |
||||
|
isTable: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '部门', |
||||
|
field: 'departmentCode', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
formatter: (_: Recordable, __: TableColumn, cellValue: number) => { |
||||
|
return userDeptArray.find((account) => account.id == cellValue)?.name |
||||
|
}, |
||||
|
form: { |
||||
|
value: userDept.id, |
||||
|
component: 'Select', |
||||
|
api: () => userDeptArray, |
||||
|
componentProps: { |
||||
|
disabled: true, |
||||
|
optionsAlias: { |
||||
|
labelField: 'name', |
||||
|
valueField: 'id' |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '自动提交', |
||||
|
field: 'autoCommit', |
||||
|
dictType: DICT_TYPE.TRUE_FALSE, |
||||
|
dictClass: 'string', |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'Switch', |
||||
|
value: requestsettingData.autoCommit, |
||||
|
componentProps: { |
||||
|
inactiveValue: 'FALSE', |
||||
|
activeValue: 'TRUE', |
||||
|
disabled: true |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '自动通过', |
||||
|
field: 'autoAgree', |
||||
|
dictType: DICT_TYPE.TRUE_FALSE, |
||||
|
dictClass: 'string', |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'Switch', |
||||
|
value: requestsettingData.autoAgree, |
||||
|
componentProps: { |
||||
|
inactiveValue: 'FALSE', |
||||
|
activeValue: 'TRUE', |
||||
|
disabled: true |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '自动执行', |
||||
|
field: 'autoExecute', |
||||
|
dictType: DICT_TYPE.TRUE_FALSE, |
||||
|
dictClass: 'string', |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'Switch', |
||||
|
value: requestsettingData.autoExecute, |
||||
|
componentProps: { |
||||
|
inactiveValue: 'FALSE', |
||||
|
activeValue: 'TRUE', |
||||
|
disabled: true |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '直接生成记录', |
||||
|
field: 'directCreateRecord', |
||||
|
dictType: DICT_TYPE.TRUE_FALSE, |
||||
|
dictClass: 'string', |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'Switch', |
||||
|
value: requestsettingData.directCreateRecord, |
||||
|
componentProps: { |
||||
|
inactiveValue: 'FALSE', |
||||
|
activeValue: 'TRUE', |
||||
|
disabled: true |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建时间', |
||||
|
field: 'createTime', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
detail: { |
||||
|
dateFormat : 'YYYY-MM-DD HH:mm:ss' |
||||
|
}, |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
search: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
type: 'daterange', |
||||
|
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
||||
|
} |
||||
|
}, |
||||
|
table: { |
||||
|
width: 180 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建者', |
||||
|
field: 'creator', |
||||
|
table: { |
||||
|
width: 130 |
||||
|
}, |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '最后更新时间', |
||||
|
field: 'updateTime', |
||||
|
sort: 'custom', |
||||
|
isDetail: true, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
formatter: dateFormatter, |
||||
|
detail: { |
||||
|
dateFormat: 'YYYY-MM-DD HH:mm:ss' |
||||
|
}, |
||||
|
table: { |
||||
|
width: 180 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
style: {width:'100%'}, |
||||
|
type: 'datetime', |
||||
|
dateFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
valueFormat: 'x', |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '最后更新者', |
||||
|
field: 'updater', |
||||
|
isDetail: true, |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
table: { |
||||
|
width: 150 |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '扩展属性', |
||||
|
field: 'extraProperties', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '并发乐观锁', |
||||
|
field: 'concurrencyStamp', |
||||
|
sort: 'custom', |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
value: 0 |
||||
|
}, |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '地点ID', |
||||
|
field: 'siteId', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作', |
||||
|
field: 'action', |
||||
|
isForm: false, |
||||
|
table: { |
||||
|
width: 200, |
||||
|
fixed: 'right' |
||||
|
} |
||||
|
} |
||||
|
])) |
||||
|
|
||||
|
// 表单校验
|
||||
|
export const ContainerDetailRequestRules = reactive({ |
||||
|
toLocationCode: [ |
||||
|
{ required: true, message: '请选择目标库位', trigger: 'blur' } |
||||
|
], |
||||
|
containerNumber: [ |
||||
|
{ required: true, message: '请选择器具号', trigger: 'blur' } |
||||
|
], |
||||
|
toQty: [ |
||||
|
{ required: true, message: '请输入到数量', trigger: 'blur' } |
||||
|
], |
||||
|
}) |
||||
|
|
||||
|
export const ContainerDetailRequest = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: 'id', |
||||
|
field: 'id', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '主表ID', |
||||
|
field: 'masterId', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
value: 0 |
||||
|
}, |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '单据号', |
||||
|
field: 'number', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '器具号', |
||||
|
field: 'containerNumber', |
||||
|
sort: 'custom', |
||||
|
tableForm:{ |
||||
|
multiple:true, |
||||
|
isInpuFocusShow: true, // 开启查询弹窗
|
||||
|
searchListPlaceholder: '请选择器具号', |
||||
|
searchField: 'itemCode', |
||||
|
searchTitle: '库存余额信息', |
||||
|
searchAllSchemas: Balance.allSchemas, |
||||
|
searchPage: BalanceApi.getBalanceByQJ, |
||||
|
}, |
||||
|
form: { |
||||
|
// labelMessage: '信息提示说明!!!',
|
||||
|
componentProps: { |
||||
|
isSearchList: true, // 开启查询弹窗
|
||||
|
searchListPlaceholder: '请选择器具号', |
||||
|
searchField: 'itemCode', |
||||
|
searchTitle: '库存余额信息', |
||||
|
searchAllSchemas: Balance.allSchemas, |
||||
|
searchPage: BalanceApi.getBalanceByQJ, |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '数量', |
||||
|
field: 'toQty', |
||||
|
sort: 'custom', |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
componentProps: { |
||||
|
disabled: true, |
||||
|
min: 0, |
||||
|
precision: 6 |
||||
|
} |
||||
|
}, |
||||
|
tableForm: { |
||||
|
type: 'InputNumber', |
||||
|
min: 0, |
||||
|
precision: 6 |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '计量单位', |
||||
|
field: 'uom', |
||||
|
dictType: DICT_TYPE.UOM, |
||||
|
dictClass: 'string', |
||||
|
isTable: true, |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
tableForm: { |
||||
|
type: 'Select', |
||||
|
disabled: true |
||||
|
}, |
||||
|
form: { |
||||
|
componentProps: { |
||||
|
disabled: true |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '从库存状态', |
||||
|
field: 'fromInventoryStatus', |
||||
|
dictType: DICT_TYPE.INVENTORY_STATUS, |
||||
|
dictClass: 'string', |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false, |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
tableForm: { |
||||
|
disabled: true, |
||||
|
type: 'Select' |
||||
|
}, |
||||
|
form: { |
||||
|
componentProps: { |
||||
|
disabled: true |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '到库存状态', |
||||
|
field: 'toInventoryStatus', |
||||
|
dictType: DICT_TYPE.INVENTORY_STATUS, |
||||
|
dictClass: 'string', |
||||
|
isTable: true, |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
tableForm: { |
||||
|
disabled: true, |
||||
|
type: 'Select' |
||||
|
}, |
||||
|
form: { |
||||
|
componentProps: { |
||||
|
disabled: true |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '子备注', |
||||
|
field: 'remark', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建时间', |
||||
|
field: 'createTime', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
detail: { |
||||
|
dateFormat : 'YYYY-MM-DD HH:mm:ss' |
||||
|
}, |
||||
|
search: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
type: 'daterange', |
||||
|
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
||||
|
} |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
style: {width:'100%'}, |
||||
|
type: 'datetime', |
||||
|
dateFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
valueFormat: 'x', |
||||
|
} |
||||
|
}, |
||||
|
table: { |
||||
|
width: 180 |
||||
|
}, |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建者', |
||||
|
field: 'creator', |
||||
|
table: { |
||||
|
width: 130 |
||||
|
}, |
||||
|
isSearch: false, |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '地点ID', |
||||
|
field: 'siteId', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '并发乐观锁', |
||||
|
field: 'concurrencyStamp', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '从货主代码', |
||||
|
field: 'fromOwnerCode', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '到货主代码', |
||||
|
field: 'toOwnerCode', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作', |
||||
|
field: 'action', |
||||
|
isForm: false, |
||||
|
hiddenInMain:true, |
||||
|
isTableForm: false, |
||||
|
table: { |
||||
|
width: 200, |
||||
|
fixed: 'right' |
||||
|
} |
||||
|
} |
||||
|
])) |
||||
|
|
Loading…
Reference in new issue