9 changed files with 2821 additions and 0 deletions
@ -0,0 +1,89 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
export interface BalanceVO { |
||||
|
packingNumber: string |
||||
|
containerNumber: string |
||||
|
itemCode: string |
||||
|
batch: string |
||||
|
altBatch: string |
||||
|
arriveDate: Date |
||||
|
produceDate: Date |
||||
|
expireDate: Date |
||||
|
inventoryStatus: string |
||||
|
locationCode: string |
||||
|
locationGroupCode: string |
||||
|
areaCode: string |
||||
|
warehouseCode: string |
||||
|
erpLocationCode: string |
||||
|
ownerCode: string |
||||
|
uom: string |
||||
|
qty: number |
||||
|
lockedQty: number |
||||
|
usableQty: number |
||||
|
singlePrice: number |
||||
|
amount: number |
||||
|
putInTime: Date |
||||
|
frozen: string |
||||
|
frozenReason: string |
||||
|
lastTransNumber: string |
||||
|
weight: number |
||||
|
area: number |
||||
|
volume: number |
||||
|
} |
||||
|
|
||||
|
export const getTransactionBalancePage = async (params) => { |
||||
|
params.areaCode = "DIFF"; |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = {...params} |
||||
|
return await request.post({ url: '/wms/transaction/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/wms/transaction/page_balance`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 查询库存余额列表(包括已冻结,已失效的物料)
|
||||
|
export const getBalancePageAll = async (params) => { |
||||
|
params.locationCode = "DIFF"; |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = {...params} |
||||
|
return await request.post({ url: '/wms/balanceDIFF/seniorAll', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/wms/balanceDIFF/pageAll`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 导出库存余额 Excel
|
||||
|
export const exportBalance = async (params) => { |
||||
|
params.locationCode = "DIFF"; |
||||
|
if (params.isSearch) { |
||||
|
const data = {...params} |
||||
|
return await request.downloadPost({ url: `/wms/balanceDIFF/export-excel-senior`, data }) |
||||
|
} else { |
||||
|
return await request.download({ url: `/wms/balanceDIFF/export-excel`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
// 查询库存余额列表(包括已冻结,已失效的物料)
|
||||
|
export const getBalancePageAllDiff = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = {...params} |
||||
|
return await request.post({ url: '/wms/balanceDIFF/seniorAll', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/wms/balanceDIFF/pageAll`, params }) |
||||
|
} |
||||
|
} |
||||
|
// 查询库存余额列表增加物料筛选条件
|
||||
|
export const getBalanceItemPage = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = {...params} |
||||
|
return await request.post({ url: '/wms/balanceDIFF/seniorItems', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/wms/balanceDIFF/pageItems`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
@ -0,0 +1,62 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
export interface DifferenceRequestDetailVO { |
||||
|
id: number |
||||
|
packingNumber: string |
||||
|
containerNumber: string |
||||
|
batch: string |
||||
|
fromLocationCode: string |
||||
|
inventoryStatus: string |
||||
|
masterId: number |
||||
|
number: string |
||||
|
itemCode: string |
||||
|
remark: string |
||||
|
siteId: string |
||||
|
itemName: string |
||||
|
itemDesc1: string |
||||
|
itemDesc2: string |
||||
|
qty: number |
||||
|
uom: string |
||||
|
concurrencyStamp: number |
||||
|
} |
||||
|
|
||||
|
// 查询差异出库申请子列表
|
||||
|
export const getDetailPage = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = {...params} |
||||
|
return await request.post({ url: '/wms/difference-request-detail/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/wms/difference-request-detail/page`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 查询差异出库申请子详情
|
||||
|
export const getDetail = async (id: number) => { |
||||
|
return await request.get({ url: `/wms/difference-request-detail/get?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 新增差异出库申请子
|
||||
|
export const createDetail = async (data: DifferenceRequestDetailVO) => { |
||||
|
return await request.post({ url: `/wms/difference-request-detail/create`, data }) |
||||
|
} |
||||
|
|
||||
|
// 修改差异出库申请子
|
||||
|
export const updateDetail = async (data: DifferenceRequestDetailVO) => { |
||||
|
return await request.put({ url: `/wms/difference-request-detail/update`, data }) |
||||
|
} |
||||
|
|
||||
|
// 删除差异出库申请子
|
||||
|
export const deleteDetail = async (id: number) => { |
||||
|
return await request.delete({ url: `/wms/difference-request-detail/delete?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 导出差异出库申请子 Excel
|
||||
|
export const exportDetail = async (params) => { |
||||
|
return await request.download({ url: `/wms/difference-request-detail/export-excel`, params }) |
||||
|
} |
||||
|
|
||||
|
// 下载用户导入模板
|
||||
|
export const importTemplate = () => { |
||||
|
return request.download({ url: '/wms/difference-request-detail/get-import-template' }) |
||||
|
} |
@ -0,0 +1,87 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
export interface DifferenceRequestMainVO { |
||||
|
id: number |
||||
|
number: string |
||||
|
businessType: string |
||||
|
remark: string |
||||
|
reason: string |
||||
|
reasonCode: string |
||||
|
usageCode: string |
||||
|
usageDescription: string |
||||
|
departmentCode: string |
||||
|
status: string |
||||
|
autoCommit: string |
||||
|
autoAgree: string |
||||
|
autoExecute: string |
||||
|
extraProperties: string |
||||
|
siteId: string |
||||
|
requestTime: Date |
||||
|
dueTime: Date |
||||
|
concurrencyStamp: number |
||||
|
ruleUserId: number |
||||
|
serialNumber: string |
||||
|
} |
||||
|
|
||||
|
// 查询差异出库申请主列表
|
||||
|
export const getMainPage = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = {...params} |
||||
|
return await request.post({ url: '/wms/difference-request-main/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/wms/difference-request-main/page`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 查询差异出库申请主详情
|
||||
|
export const getMain = async (id: number) => { |
||||
|
return await request.get({ url: `/wms/difference-request-main/get?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 新增差异出库申请主
|
||||
|
export const createMain = async (data: DifferenceRequestMainVO) => { |
||||
|
return await request.post({ url: `/wms/difference-request-main/create`, data }) |
||||
|
} |
||||
|
|
||||
|
// 修改差异出库申请主
|
||||
|
export const updateMain = async (data: DifferenceRequestMainVO) => { |
||||
|
return await request.put({ url: `/wms/difference-request-main/update`, data }) |
||||
|
} |
||||
|
|
||||
|
// 删除差异出库申请主
|
||||
|
export const deleteMain = async (id: number) => { |
||||
|
return await request.delete({ url: `/wms/difference-request-main/delete?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 导出差异出库申请主 Excel
|
||||
|
export const exportMain = async (params) => { |
||||
|
return await request.download({ url: `/wms/difference-request-main/export-excel`, params }) |
||||
|
} |
||||
|
|
||||
|
// 下载用户导入模板
|
||||
|
export const importTemplate = () => { |
||||
|
return request.download({ url: '/wms/difference-request-main/get-import-template' }) |
||||
|
} |
||||
|
|
||||
|
// 关闭
|
||||
|
export const closeMain = async (id: number) => { |
||||
|
return await request.put({ url: `/wms/difference-request-main/close?id=` + id }) |
||||
|
} |
||||
|
// 提交
|
||||
|
export const submitMain = async (id: number) => { |
||||
|
return await request.put({ url: `/wms/difference-request-main/submit?id=` + id }) |
||||
|
} |
||||
|
// 处理
|
||||
|
export const handleMain = async (id: number) => { |
||||
|
return await request.put({ url: `/wms/difference-request-main/handle?id=` + id }) |
||||
|
} |
||||
|
// 审批通过
|
||||
|
export const agreeMain = async (id: number) => { |
||||
|
return await request.put({ url: `/wms/difference-request-main/agree?id=` + id }) |
||||
|
} |
||||
|
//审批拒绝
|
||||
|
export const abortMain = async (id: number) => { |
||||
|
return await request.put({ url: `/wms/difference-request-main/refused?id=` + id }) |
||||
|
} |
||||
|
|
@ -0,0 +1,853 @@ |
|||||
|
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: true |
||||
|
}, |
||||
|
{ |
||||
|
label: '物料描述1', |
||||
|
field: 'itemDesc1', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
hiddenSearchHigh: true,// 高级筛选中隐藏
|
||||
|
// isSearch: true
|
||||
|
}, |
||||
|
{ |
||||
|
label: '物料描述2', |
||||
|
field: 'itemDesc2', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
hiddenSearchHigh: true,// 高级筛选中隐藏
|
||||
|
// isSearch: true
|
||||
|
}, |
||||
|
{ |
||||
|
label: '物料类型', |
||||
|
field: 'itemType', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.ITEM_TYPE, |
||||
|
dictClass: 'string', |
||||
|
isSearch: true, |
||||
|
table: { |
||||
|
width: 100 |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '批次', |
||||
|
field: 'batch', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
isSearch: true |
||||
|
}, |
||||
|
{ |
||||
|
label: '供应商批次', |
||||
|
field: 'altBatch', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
isSearch: false, |
||||
|
isTable:false, |
||||
|
isDetail:false, |
||||
|
isForm:false |
||||
|
}, |
||||
|
{ |
||||
|
label: '包装号', |
||||
|
field: 'packingNumber', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
// isSearch: true
|
||||
|
}, |
||||
|
// {
|
||||
|
// label: '包装规格',
|
||||
|
// field: 'packUnit',
|
||||
|
// sort: 'custom',
|
||||
|
// table: {
|
||||
|
// width: 150
|
||||
|
// }
|
||||
|
// },
|
||||
|
// {
|
||||
|
// label: '包装数量',
|
||||
|
// field: 'packQty',
|
||||
|
// sort: 'custom',
|
||||
|
// 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: 'containerNumber',
|
||||
|
// sort: 'custom',
|
||||
|
// table: {
|
||||
|
// width: 150
|
||||
|
// },
|
||||
|
// },
|
||||
|
|
||||
|
{ |
||||
|
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', |
||||
|
isTable: true, |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
} |
||||
|
}, |
||||
|
// {
|
||||
|
// label: '库区类型',
|
||||
|
// field: 'areaType',
|
||||
|
// sort: 'custom',
|
||||
|
// dictType: DICT_TYPE.AREA_TYPE,
|
||||
|
// dictClass: 'string',
|
||||
|
// isTable: true,
|
||||
|
// table: {
|
||||
|
// width: 150
|
||||
|
// }
|
||||
|
// },
|
||||
|
|
||||
|
// {
|
||||
|
// label: '仓库代码',
|
||||
|
// field: 'warehouseCode',
|
||||
|
// sort: 'custom',
|
||||
|
// table: {
|
||||
|
// width: 150
|
||||
|
// }
|
||||
|
// },
|
||||
|
// {
|
||||
|
// label: '库位组代码',
|
||||
|
// field: 'locationGroupCode',
|
||||
|
// sort: 'custom',
|
||||
|
// table: {
|
||||
|
// width: 150
|
||||
|
// }
|
||||
|
// },
|
||||
|
// {
|
||||
|
// label: '库区代码',
|
||||
|
// field: 'areaCode',
|
||||
|
// sort: 'custom',
|
||||
|
// 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: 'standardVolume',
|
||||
|
// sort: 'custom',
|
||||
|
// form: {
|
||||
|
// component: 'InputNumber',
|
||||
|
// value: 0,
|
||||
|
// componentProps: {
|
||||
|
// min: 0,
|
||||
|
// precision:2
|
||||
|
// }
|
||||
|
// },
|
||||
|
// table:{
|
||||
|
// width: 120
|
||||
|
// }
|
||||
|
// },
|
||||
|
// {
|
||||
|
// label: '到货日期',
|
||||
|
// field: 'arriveDate',
|
||||
|
// isTable: true,
|
||||
|
// 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: 'produceDate',
|
||||
|
// isTable: true,
|
||||
|
// 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',
|
||||
|
// isTable: true,
|
||||
|
// 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
|
||||
|
// },
|
||||
|
// isTable: false
|
||||
|
// },
|
||||
|
// {
|
||||
|
// label: '锁定数量',
|
||||
|
// field: 'lockedQty',
|
||||
|
// sort: 'custom',
|
||||
|
// table: {
|
||||
|
// width: 150
|
||||
|
// },
|
||||
|
// 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',
|
||||
|
// isTable: true,
|
||||
|
// sort: 'custom',
|
||||
|
// table: {
|
||||
|
// width: 150
|
||||
|
// },
|
||||
|
// form: {
|
||||
|
// component: 'Switch',
|
||||
|
// value: 'TRUE',
|
||||
|
// componentProps: {
|
||||
|
// inactiveValue: 'FALSE',
|
||||
|
// activeValue: 'TRUE'
|
||||
|
// }
|
||||
|
// }
|
||||
|
// },
|
||||
|
// {
|
||||
|
// label: '钢卷号',
|
||||
|
// field: 'steelCoilNumber',
|
||||
|
// sort: 'custom',
|
||||
|
// table: {
|
||||
|
// width: 150
|
||||
|
// },
|
||||
|
// tableForm: {
|
||||
|
// disabled: false
|
||||
|
// },
|
||||
|
// isTable:false,
|
||||
|
// isDetail:false,
|
||||
|
// isForm:false
|
||||
|
// },
|
||||
|
// {
|
||||
|
// label: '炉号',
|
||||
|
// field: 'heatNumber',
|
||||
|
// sort: 'custom',
|
||||
|
// table: {
|
||||
|
// width: 150
|
||||
|
// },
|
||||
|
// tableForm: {
|
||||
|
// disabled: false
|
||||
|
// },
|
||||
|
// isTable:false,
|
||||
|
// isDetail:false,
|
||||
|
// isForm:false
|
||||
|
// },
|
||||
|
// {
|
||||
|
// label: '热处理日期',
|
||||
|
// field: 'heatTreatmentDate',
|
||||
|
// formatter: dateFormatter2,
|
||||
|
// detail: {
|
||||
|
// dateFormat: 'YYYY-MM-DD'
|
||||
|
// },
|
||||
|
// sort: 'custom',
|
||||
|
// table: {
|
||||
|
// width: 180
|
||||
|
// },
|
||||
|
// form: {
|
||||
|
// component: 'DatePicker',
|
||||
|
// componentProps: {
|
||||
|
// style: {width: '100%'},
|
||||
|
// type: 'date',
|
||||
|
// dateFormat: 'YYYY-MM-DD',
|
||||
|
// valueFormat: 'x',
|
||||
|
// }
|
||||
|
// },
|
||||
|
// tableForm: {
|
||||
|
// type: 'FormDate',
|
||||
|
// dateFormat: 'YYYY-MM-DD',
|
||||
|
// valueFormat: 'x',
|
||||
|
// },
|
||||
|
// isTable:false,
|
||||
|
// isDetail:false,
|
||||
|
// isForm:false
|
||||
|
// },
|
||||
|
// {
|
||||
|
// label: '有效日期',
|
||||
|
// field: 'effectiveDate',
|
||||
|
// formatter: dateFormatter2,
|
||||
|
// detail: {
|
||||
|
// dateFormat: 'YYYY-MM-DD'
|
||||
|
// },
|
||||
|
// sort: 'custom',
|
||||
|
// table: {
|
||||
|
// width: 180
|
||||
|
// },
|
||||
|
// form: {
|
||||
|
// component: 'DatePicker',
|
||||
|
// componentProps: {
|
||||
|
// style: {width: '100%'},
|
||||
|
// type: 'date',
|
||||
|
// dateFormat: 'YYYY-MM-DD',
|
||||
|
// valueFormat: 'x',
|
||||
|
// }
|
||||
|
// },
|
||||
|
// tableForm: {
|
||||
|
// type: 'FormDate',
|
||||
|
// dateFormat: 'YYYY-MM-DD',
|
||||
|
// valueFormat: 'x',
|
||||
|
// },
|
||||
|
// isTable:false,
|
||||
|
// isDetail:false,
|
||||
|
// isForm:false
|
||||
|
// },
|
||||
|
// {
|
||||
|
// 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',
|
||||
|
// table: {
|
||||
|
// width: 150
|
||||
|
// }
|
||||
|
// },
|
||||
|
{ |
||||
|
label: '创建人', |
||||
|
field: 'creator', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
isForm: false |
||||
|
}, |
||||
|
{ |
||||
|
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' |
||||
|
} |
||||
|
}, |
||||
|
isForm: false, |
||||
|
isSearch: true, |
||||
|
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'
|
||||
|
// }
|
||||
|
// },
|
||||
|
// isForm: false,
|
||||
|
// isTable: true
|
||||
|
// },
|
||||
|
// {
|
||||
|
// label: '最后更新者',
|
||||
|
// field: 'updater',
|
||||
|
// sort: 'custom',
|
||||
|
// table: {
|
||||
|
// width: 150
|
||||
|
// },
|
||||
|
// isForm: false,
|
||||
|
// isTable: true
|
||||
|
// },
|
||||
|
// // TODO: 临时添加 方便操作
|
||||
|
// {
|
||||
|
// label: '操作',
|
||||
|
// field: 'action',
|
||||
|
// isDetail: false,
|
||||
|
// isForm: false,
|
||||
|
// table: {
|
||||
|
// width: 250,
|
||||
|
// 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 MesRawMaterialConsumptionInfo = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
|
||||
|
|
||||
|
|
||||
|
{ |
||||
|
label: '物品代码', |
||||
|
field: 'itemCode', |
||||
|
sort: 'custom', |
||||
|
|
||||
|
isSearch: true |
||||
|
}, |
||||
|
{ |
||||
|
label: '物品名称', |
||||
|
field: 'itemName', |
||||
|
sort: 'custom', |
||||
|
|
||||
|
}, |
||||
|
{ |
||||
|
label: '包装号', |
||||
|
field: 'packingNumber', |
||||
|
sort: 'custom', |
||||
|
|
||||
|
isSearch: true |
||||
|
}, |
||||
|
|
||||
|
{ |
||||
|
label: 'DMC码', |
||||
|
field: 'dmcCode', |
||||
|
sort: 'custom', |
||||
|
|
||||
|
isSearch: true |
||||
|
}, |
||||
|
|
||||
|
{ |
||||
|
label: '激光码', |
||||
|
field: 'laserCode', |
||||
|
sort: 'custom', |
||||
|
|
||||
|
isSearch: true |
||||
|
}, |
||||
|
{ |
||||
|
label: '生产日期', |
||||
|
field: 'produceDate', |
||||
|
formatter: dateFormatter, |
||||
|
isSearch: true, |
||||
|
detail: { |
||||
|
dateFormat: 'YYYY-MM-DD HH:mm:ss' |
||||
|
}, |
||||
|
sort: 'custom', |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
])) |
||||
|
// 表单校验
|
||||
|
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,444 @@ |
|||||
|
<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 |
||||
|
:multiple="true" |
||||
|
: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,$index }"> |
||||
|
<ButtonBase :Butttondata="butttondata(row,$index)" @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" |
||||
|
/> |
||||
|
<SearchTable ref="searchTableRef" :selection="false" :hiddenSubmitButton="true"/> |
||||
|
<!-- 导入 --> |
||||
|
<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/balanceDifference' |
||||
|
import * as PackageApi from '@/api/wms/package' |
||||
|
import * as BarbasicApi from '@/api/wms/barbasic' |
||||
|
import BasicForm from '@/components/BasicForm/src/BasicForm.vue' |
||||
|
import { Balance,TransactionTab, BalanceRules,MesRawMaterialConsumptionInfo } 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' |
||||
|
import * as MesRawMaterialConsumptionInfoApi from '@/api/wms/mesRawMaterialConsumptionInfo' |
||||
|
import { Barbasic } from '@/views/dbc/labelManage/barbasic/barbasic.data' |
||||
|
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.getBalancePageAllDiff // 分页接口 |
||||
|
}) |
||||
|
|
||||
|
// 获得表格的各种操作 |
||||
|
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); |
||||
|
console.log('rows',rows); |
||||
|
getLoading?.close() |
||||
|
if(res.bcpLabel){ |
||||
|
//半成品标签 |
||||
|
const src = ref(BASE_URL + '/jmreport/view/1064421419843481600?token=' + getAccessToken()) |
||||
|
window.open(src.value+'&asn_number='+res.bcpLabel) |
||||
|
} |
||||
|
if (res.ccpLabel) { |
||||
|
//产成品标签 |
||||
|
const src = ref(BASE_URL + '/jmreport/view/1064431510835589120?token=' + getAccessToken()) |
||||
|
window.open(src.value+'&asn_number='+res.ccpLabel) |
||||
|
} |
||||
|
if (res.cgLabel) { |
||||
|
//采购标签 |
||||
|
const src = ref(BASE_URL + '/jmreport/view/1064443232879276032?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 = (row,$index) => { |
||||
|
const findIndex = row['masterId']?tableObject.tableList.findIndex(item=>item['masterId'] == row['masterId']):-1 |
||||
|
if(findIndex>-1&&findIndex<$index){ |
||||
|
return [] |
||||
|
} |
||||
|
return[ |
||||
|
{ |
||||
|
label: '标签信息', |
||||
|
name: 'bqxx', |
||||
|
hide: false, |
||||
|
type: 'primary', |
||||
|
icon: '', |
||||
|
color: '', |
||||
|
link: true, |
||||
|
float:'right', |
||||
|
hasPermi: '' |
||||
|
}, |
||||
|
defaultButtons.mainListPointBtn(null), // 标签打印 |
||||
|
{ |
||||
|
label: '包装明细', |
||||
|
name: 'package-detail', |
||||
|
hide: row.itemType!='BCP'&&row.itemType!='CCP', |
||||
|
type: 'primary', |
||||
|
icon: '', |
||||
|
color: '', |
||||
|
link: true, |
||||
|
float:'right', |
||||
|
hasPermi: '' |
||||
|
}, |
||||
|
|
||||
|
// defaultButtons.mainListEditBtn({hasPermi:'wms:balance:update'}), // 编辑 |
||||
|
// defaultButtons.mainListDeleteBtn({hasPermi:'wms:balance:delete'}), // 删除 |
||||
|
]} |
||||
|
// 列表-操作按钮事件 |
||||
|
const buttonTableClick = async (val, row) => { |
||||
|
if (val == 'bqxx') { |
||||
|
console.log(row.packingNumber) |
||||
|
if(row.packingNumber != ''){ |
||||
|
const params = { |
||||
|
current: 1, // 当前页码 |
||||
|
size: 10, // 每页条数 |
||||
|
number: row.packingNumber |
||||
|
}; |
||||
|
let bbb = await PackageApi.getPackagePage(params); |
||||
|
if(bbb.total == 0){ |
||||
|
message.alert("包装号为空,不能打印标签") |
||||
|
}else{ |
||||
|
console.log(row.packingNumber) |
||||
|
const barBasicParams = { |
||||
|
current: 1, // 当前页码 |
||||
|
size: 10, // 每页条数 |
||||
|
relateNumber: row.packingNumber |
||||
|
}; |
||||
|
let aaa = await BarbasicApi.getBarbasicPage(barBasicParams); |
||||
|
if(aaa.total != 0){ |
||||
|
message.info(aaa.list[0]['barcodeString']) |
||||
|
} |
||||
|
} |
||||
|
// let aaa = 'HPQ;V1.0;I'+row.itemCode+';P'+row.packingNumber+';B'+row.batch+';Q'+row.qty+';U'+row.uom |
||||
|
}else{ |
||||
|
message.alert("包装号为空,不能打印标签") |
||||
|
} |
||||
|
}else if (val == 'point') { // 标签打印 |
||||
|
handlePoint(row) |
||||
|
}else if(val == 'package-detail'){ |
||||
|
// 包装明细 |
||||
|
packageDetailClick(row) |
||||
|
|
||||
|
} |
||||
|
// if (val == 'edit') { // 编辑 |
||||
|
// // const res = await BalanceApi.getItempackaging(row.id) |
||||
|
// openForm('update', row) |
||||
|
// } else if (val == 'delete') { // 删除 |
||||
|
// handleDelete(row.id) |
||||
|
// } |
||||
|
} |
||||
|
|
||||
|
const searchTableRef = ref() |
||||
|
const packageDetailClick = (row) => { |
||||
|
searchTableRef.value.open( |
||||
|
"包装明细", |
||||
|
MesRawMaterialConsumptionInfo.allSchemas, |
||||
|
MesRawMaterialConsumptionInfoApi.getMesRawMaterialConsumptionInfoPage, |
||||
|
"hehehe", |
||||
|
"hehehe", |
||||
|
false, |
||||
|
'tableForm', |
||||
|
null, |
||||
|
{ |
||||
|
packingNumber:row.packingNumber |
||||
|
}, |
||||
|
undefined, |
||||
|
false, |
||||
|
undefined |
||||
|
) |
||||
|
} |
||||
|
|
||||
|
/** 添加/修改操作 */ |
||||
|
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) => { |
||||
|
// const itemCode = row.itemCode |
||||
|
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/1064443232879276032?token=' + getAccessToken()) |
||||
|
console.log(159,resLable ) |
||||
|
window.open(src.value+'&asn_number='+resLable) |
||||
|
} else { |
||||
|
if(row.itemType == 'BCP'){ |
||||
|
const src = ref(BASE_URL + '/jmreport/view/1064421419843481600?token=' + getAccessToken()) |
||||
|
window.open(src.value+'&asn_number='+resLable) |
||||
|
}else if(row.itemType == 'CCP'){ |
||||
|
const src = ref(BASE_URL + '/jmreport/view/1064431510835589120?token=' + getAccessToken()) |
||||
|
window.open(src.value+'&asn_number='+resLable) |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
}).catch(err => { |
||||
|
console.log(err) |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
/** 导出按钮操作 */ |
||||
|
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) => { |
||||
|
const filter = {}; |
||||
|
filter.action = "like"; |
||||
|
filter.column = "locationCode"; |
||||
|
filter.value = "DIFF"; |
||||
|
searchData.filters.push(filter); |
||||
|
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,195 @@ |
|||||
|
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
||||
|
import { dateFormatter } from '@/utils/formatTime' |
||||
|
// 表单校验
|
||||
|
export const DifferenceRecordMainRules = reactive({ |
||||
|
autoCommit: [required], |
||||
|
autoAgree: [required], |
||||
|
autoExecute: [required], |
||||
|
concurrencyStamp: [required] |
||||
|
}) |
||||
|
|
||||
|
export const DifferenceRecordMain = useCrudSchemas( |
||||
|
reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: '单据号', |
||||
|
field: 'number', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
table: { |
||||
|
width: 180, |
||||
|
// fixed: 'right'
|
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '申请单据号', |
||||
|
field: 'requestNumber', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
table: { |
||||
|
width: 180, |
||||
|
// fixed: 'right'
|
||||
|
} |
||||
|
} |
||||
|
// {
|
||||
|
// label: '申请时间',
|
||||
|
// field: 'requestTime',
|
||||
|
// sort: 'custom',
|
||||
|
// formatter: dateFormatter,
|
||||
|
// 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: {
|
||||
|
// type: 'datetime',
|
||||
|
// valueFormat: 'x'
|
||||
|
// }
|
||||
|
// }
|
||||
|
// },
|
||||
|
// {
|
||||
|
// label: '截止时间',
|
||||
|
// field: 'dueTime',
|
||||
|
// sort: 'custom',
|
||||
|
// formatter: dateFormatter,
|
||||
|
// // 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')]
|
||||
|
// }
|
||||
|
// },
|
||||
|
// form: {
|
||||
|
// component: 'DatePicker',
|
||||
|
// componentProps: {
|
||||
|
// type: 'datetime',
|
||||
|
// valueFormat: 'x'
|
||||
|
// }
|
||||
|
// }
|
||||
|
// },
|
||||
|
]) |
||||
|
) |
||||
|
// 表单校验
|
||||
|
export const DifferenceRecordDetailRules = reactive({ |
||||
|
batch: [required], |
||||
|
fromLocationCode: [required], |
||||
|
inventoryStatus: [required], |
||||
|
masterId: [required], |
||||
|
itemCode: [required], |
||||
|
concurrencyStamp: [required] |
||||
|
}) |
||||
|
|
||||
|
export const DifferenceRecordDetail = useCrudSchemas( |
||||
|
reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: '物料代码', |
||||
|
field: 'itemCode', |
||||
|
sort: 'custom',table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
isSearch: true |
||||
|
}, |
||||
|
{ |
||||
|
label: '物料名称', |
||||
|
field: 'itemName', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
isSearch: true |
||||
|
}, |
||||
|
{ |
||||
|
label: '物料描述1', |
||||
|
field: 'itemDesc1', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '物料描述2', |
||||
|
field: 'itemDesc2', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
}, |
||||
|
// {
|
||||
|
// label: '物料类型',
|
||||
|
// dictType: DICT_TYPE.ITEM_TYPE,
|
||||
|
// field: 'itemType',
|
||||
|
// // hiddenInMain: true,
|
||||
|
// // isSearch: true,
|
||||
|
// // tableForm: {
|
||||
|
// // type: 'Select',
|
||||
|
// // disabled: true
|
||||
|
// // },
|
||||
|
// width: 100
|
||||
|
// },
|
||||
|
{ |
||||
|
label: '出库数量', |
||||
|
field: 'qty', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: '计量单位', |
||||
|
field: 'uom', |
||||
|
dictType: DICT_TYPE.UOM, |
||||
|
dictClass: 'string', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: '批次', |
||||
|
field: 'batch', |
||||
|
sort: 'custom', |
||||
|
isSearch: true |
||||
|
}, |
||||
|
{ |
||||
|
label: '包装号', |
||||
|
field: 'packingNumber', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: '库存状态', |
||||
|
field: 'inventoryStatus', |
||||
|
dictType: DICT_TYPE.INVENTORY_STATUS, |
||||
|
dictClass: 'string', |
||||
|
sort: 'custom', |
||||
|
form: { |
||||
|
component: 'Radio' |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '从库位代码', |
||||
|
field: 'fromLocationCode', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建者', |
||||
|
field: 'creator', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建时间', |
||||
|
field: 'createTime', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
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')] |
||||
|
} |
||||
|
}, |
||||
|
isForm: false |
||||
|
} |
||||
|
]) |
||||
|
) |
@ -0,0 +1,273 @@ |
|||||
|
<template> |
||||
|
<ContentWrap> |
||||
|
<!-- 搜索工作栏 --> |
||||
|
<Search :schema="[...DifferenceRecordMain.allSchemas.searchSchema,...DifferenceRecordDetail.allSchemas.searchSchema]" @search="setSearchParams" @reset="setSearchParams" /> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 列表头部 --> |
||||
|
<TableHead |
||||
|
:HeadButttondata="HeadButttondata" |
||||
|
@button-base-click="buttonBaseClick" |
||||
|
:routeName="routeName" |
||||
|
@updataTableColumns="updataTableColumns" |
||||
|
@searchFormClick="searchFormClick" |
||||
|
:allSchemas="DifferenceRecordMain.allSchemas" |
||||
|
:detailAllSchemas="DifferenceRecordDetail.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="formRef" |
||||
|
@success="submitForm" |
||||
|
:rules="DifferenceRecordDetailRules" |
||||
|
:formAllSchemas="Detail.allSchemas" |
||||
|
:apiUpdate="DifferenceRecordDetailApi.updateDetail" |
||||
|
:apiCreate="DifferenceRecordDetailApi.createDetail" |
||||
|
@searchTableSuccess="searchTableSuccess" |
||||
|
:isBusiness="false" |
||||
|
/> |
||||
|
<!-- 详情 --> |
||||
|
<Detail ref="detailRef" |
||||
|
:isBasic="false" |
||||
|
:isShowDescriptions="true" |
||||
|
:allSchemas="DifferenceRecordMain.allSchemas" |
||||
|
:detailAllSchemas="DifferenceRecordDetail.allSchemas" |
||||
|
:apiPage="DifferenceRecordDetailApi.getDetailPage"/> |
||||
|
|
||||
|
<!-- 导入 --> |
||||
|
<ImportForm ref="importFormRef" url="/differenceRecord/detail/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import download from '@/utils/download' |
||||
|
import { DifferenceRecordMain,DifferenceRecordMainRules,DifferenceRecordDetail,DifferenceRecordDetailRules} from './differenceRecord.data' |
||||
|
import * as DifferenceRecordDetailApi from '@/api/wms/differenceRecordDetail' |
||||
|
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' |
||||
|
import {mainListApproveBtn, mainListTurnDownBtn} from "@/utils/disposition/defaultButtons"; |
||||
|
import { |
||||
|
abortMain, |
||||
|
agreeMain, |
||||
|
closeMain, |
||||
|
handleMain, |
||||
|
submitMain |
||||
|
} from "@/api/wms/differenceRequestMain"; |
||||
|
const { loadStart, loadDone } = usePageLoading() |
||||
|
|
||||
|
defineOptions({ name: 'DifferenceRecordDetail' }) |
||||
|
|
||||
|
const message = useMessage() // 消息弹窗 |
||||
|
const { t } = useI18n() // 国际化 |
||||
|
|
||||
|
const route = useRoute() // 路由信息 |
||||
|
const routeName = ref() |
||||
|
routeName.value = route.name |
||||
|
const tableColumns = ref([...DifferenceRecordMain.allSchemas.tableColumns,...DifferenceRecordDetail.allSchemas.tableColumns]) |
||||
|
|
||||
|
// 查询页面返回 |
||||
|
const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => { |
||||
|
nextTick(() => { |
||||
|
if (type == 'tableForm') { |
||||
|
// 明细查询页赋值 |
||||
|
row[formField] = val[0][searchField] |
||||
|
} else { |
||||
|
const setV = {} |
||||
|
setV[formField] = val[0][searchField] |
||||
|
formRef.setValues(setV) |
||||
|
} |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
|
||||
|
// 字段设置 更新主列表字段 |
||||
|
const updataTableColumns = (val) => { |
||||
|
tableColumns.value = val |
||||
|
} |
||||
|
|
||||
|
const { tableObject, tableMethods } = useTable({ |
||||
|
getListApi: DifferenceRecordDetailApi.getDetailPage // 分页接口 |
||||
|
}) |
||||
|
|
||||
|
// 获得表格的各种操作 |
||||
|
const { getList, setSearchParams } = tableMethods |
||||
|
|
||||
|
// 列表头部按钮 |
||||
|
const HeadButttondata = [ |
||||
|
// defaultButtons.defaultAddBtn({hasPermi:'wms:difference-record-detail:create'}), // 新增 |
||||
|
// defaultButtons.defaultImportBtn({hasPermi:'wms:detail:import'}), // 导入 |
||||
|
defaultButtons.defaultExportBtn({hasPermi:'wms:difference-record-detail: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') { // 刷新 |
||||
|
getList() |
||||
|
} else if (val == 'filtrate') { // 筛选 |
||||
|
} else { // 其他按钮 |
||||
|
console.log('其他按钮', item) |
||||
|
} |
||||
|
} |
||||
|
// 根据状态返回该按钮是否显示 |
||||
|
const isShowMainButton = (row, val) => { |
||||
|
if (val.indexOf(row.status) > -1) { |
||||
|
return false |
||||
|
} else { |
||||
|
return true |
||||
|
} |
||||
|
} |
||||
|
// 列表-操作按钮 |
||||
|
const butttondata = (row,$index) => { |
||||
|
const findIndex = row['masterId']?tableObject.tableList.findIndex(item=>item['masterId'] == row['masterId']):-1 |
||||
|
if(findIndex>-1&&findIndex<$index){ |
||||
|
return [] |
||||
|
} |
||||
|
return [ |
||||
|
] |
||||
|
} |
||||
|
|
||||
|
// 列表-操作按钮事件 |
||||
|
const buttonTableClick = async (val, row) => { |
||||
|
if (val == 'edit') { // 编辑 |
||||
|
openForm('update', row) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 添加/修改操作 */ |
||||
|
const formRef = ref() |
||||
|
const openForm = (type: string, row?: any) => { |
||||
|
formRef.value.open(type, row) |
||||
|
} |
||||
|
|
||||
|
// form表单提交 |
||||
|
const submitForm = async (formType,submitData) => { |
||||
|
let data = {...submitData} |
||||
|
try { |
||||
|
if (formType === 'create') { |
||||
|
await DifferenceRecordDetailApi.createDetail(data) |
||||
|
message.success(t('common.createSuccess')) |
||||
|
} else { |
||||
|
await DifferenceRecordDetailApi.updateDetail(data) |
||||
|
message.success(t('common.updateSuccess')) |
||||
|
} |
||||
|
formRef.value.dialogVisible = false |
||||
|
getList() |
||||
|
}finally { |
||||
|
formRef.value.formLoading = false |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 详情操作 */ |
||||
|
const detailRef = ref() |
||||
|
const openDetail = (row: any, titleName: any, titleValue: any) => { |
||||
|
detailRef.value.openDetail(row, titleName, titleValue, 'basicDetail') |
||||
|
} |
||||
|
|
||||
|
/** 删除按钮操作 */ |
||||
|
const handleDelete = async (id: number) => { |
||||
|
try { |
||||
|
// 删除的二次确认 |
||||
|
await message.delConfirm() |
||||
|
// 发起删除 |
||||
|
await DifferenceRecordDetailApi.deleteDetail(id) |
||||
|
message.success(t('common.delSuccess')) |
||||
|
// 刷新列表 |
||||
|
await getList() |
||||
|
} catch {} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** 导出按钮操作 */ |
||||
|
const exportLoading = ref(false) // 导出的加载中 |
||||
|
const handleExport = async () => { |
||||
|
try { |
||||
|
// 导出的二次确认 |
||||
|
await message.exportConfirm() |
||||
|
// 发起导出 |
||||
|
exportLoading.value = true |
||||
|
const excelTitle = ref(route.meta.title) |
||||
|
const data = await DifferenceRecordDetailApi.exportDetail(tableObject.params) |
||||
|
const time = formatDate(new Date()) |
||||
|
download.excel(data, `【${excelTitle.value}】【${time}】.xlsx`) |
||||
|
} catch { |
||||
|
} finally { |
||||
|
loadDone() |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 导入 */ |
||||
|
const importFormRef = ref() |
||||
|
const handleImport = () => { |
||||
|
importFormRef.value.open() |
||||
|
} |
||||
|
// 导入附件弹窗所需的参数 |
||||
|
const importTemplateData = reactive({ |
||||
|
templateUrl: '', |
||||
|
templateTitle: '差异出库记录子导入模版.xlsx' |
||||
|
}) |
||||
|
// 导入成功之后 |
||||
|
const importSuccess = () => { |
||||
|
getList() |
||||
|
} |
||||
|
|
||||
|
// 筛选提交 |
||||
|
const searchFormClick = (searchData) => { |
||||
|
tableObject.params = { |
||||
|
isSearch: true, |
||||
|
filters: searchData.filters |
||||
|
} |
||||
|
getList() // 刷新当前列表 |
||||
|
} |
||||
|
|
||||
|
/** 初始化 **/ |
||||
|
onMounted(async () => { |
||||
|
getList() |
||||
|
importTemplateData.templateUrl = await DifferenceRecordDetailApi.importTemplate() |
||||
|
}) |
||||
|
|
||||
|
</script> |
@ -0,0 +1,342 @@ |
|||||
|
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
||||
|
import { dateFormatter } from '@/utils/formatTime' |
||||
|
import * as LocationApi from '@/api/dbc/location' |
||||
|
import { Location } from '@/views/dbc/location/location.data' |
||||
|
import * as BalanceApi from '@/api/wms/balanceDifference' |
||||
|
import { Balance } from '@/views/wms/inventoryManage/balance/balance.data' |
||||
|
|
||||
|
// 表单校验
|
||||
|
export const DifferenceRequestMainRules = reactive({ |
||||
|
// toLocationCode: [required]
|
||||
|
}) |
||||
|
|
||||
|
export const DifferenceRequestMain = useCrudSchemas( |
||||
|
reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: '单据号', |
||||
|
field: 'number', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
isForm: false, |
||||
|
table: { |
||||
|
width: 200, |
||||
|
// fixed: 'right'
|
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '状态', |
||||
|
field: 'status', |
||||
|
dictType: DICT_TYPE.REQUEST_STATUS, |
||||
|
dictClass: 'string', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
isForm: false, |
||||
|
table: { |
||||
|
width: 100, |
||||
|
// fixed: 'right'
|
||||
|
} |
||||
|
}, |
||||
|
// {
|
||||
|
// label: '到库位代码',
|
||||
|
// field: 'toLocationCode',
|
||||
|
// sort: 'custom',
|
||||
|
// table: {
|
||||
|
// width: 150
|
||||
|
// },
|
||||
|
// // isSearch: true,
|
||||
|
// isForm: false,
|
||||
|
// isTable: false,
|
||||
|
// form: {
|
||||
|
// // labelMessage: '信息提示说明!!!',
|
||||
|
// componentProps: {
|
||||
|
// enterSearch: false,
|
||||
|
// isSearchList: true, // 开启查询弹窗
|
||||
|
// searchListPlaceholder: '请选择到库位代码', // 输入框占位文本
|
||||
|
// searchField: 'code', // 查询弹窗赋值字段
|
||||
|
// searchTitle: '到库位代码', // 查询弹窗标题
|
||||
|
// searchAllSchemas: Location.allSchemas, // 查询弹窗所需类
|
||||
|
// searchPage: LocationApi.selectBusinessTypeOutLocation, // 查询弹窗所需分页方法
|
||||
|
// searchCondition: [
|
||||
|
// {
|
||||
|
// key: 'businessType',
|
||||
|
// value: 'CustomerReject',
|
||||
|
// isMainValue: false
|
||||
|
// },
|
||||
|
// {
|
||||
|
// key: 'isIn',
|
||||
|
// value: 'in',
|
||||
|
// isMainValue: false
|
||||
|
// }
|
||||
|
// ],
|
||||
|
// verificationParams: [
|
||||
|
// {
|
||||
|
// key: 'code',
|
||||
|
// action: '==',
|
||||
|
// value: '',
|
||||
|
// isMainValue: false,
|
||||
|
// isSearch: true,
|
||||
|
// isFormModel: true
|
||||
|
// }
|
||||
|
// ] // 失去焦点校验参数
|
||||
|
// }
|
||||
|
// }
|
||||
|
// },
|
||||
|
]) |
||||
|
) |
||||
|
|
||||
|
// 表单校验
|
||||
|
export const DifferenceRequestDetailRules = reactive({ |
||||
|
itemCode: [required] |
||||
|
}) |
||||
|
|
||||
|
export const DifferenceRequestDetail = useCrudSchemas( |
||||
|
reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: '物料代码', |
||||
|
field: 'itemCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
tableForm: { |
||||
|
multiple: true, //多选
|
||||
|
disabled: true, |
||||
|
isInpuFocusShow: false, // 开启查询弹窗
|
||||
|
searchListPlaceholder: '请输入包装号', |
||||
|
searchField: 'itemCode', |
||||
|
searchTitle: '库存余额信息', |
||||
|
searchAllSchemas: Balance.allSchemas, |
||||
|
searchPage: BalanceApi.getBalanceItemPage, |
||||
|
searchCondition: [ |
||||
|
{ |
||||
|
key: 'available', |
||||
|
value: 'TRUE', |
||||
|
action: '==', |
||||
|
isSearch: true, |
||||
|
isMainValue: false |
||||
|
}, |
||||
|
{ |
||||
|
key: 'businessType', |
||||
|
value: 'UnplannedDeliver', |
||||
|
action: '==', |
||||
|
isSearch: true, |
||||
|
isMainValue: false |
||||
|
}, |
||||
|
{ |
||||
|
key: 'inOrOut', |
||||
|
value: 'out', |
||||
|
action: '==', |
||||
|
isSearch: true, |
||||
|
isMainValue: false |
||||
|
}, |
||||
|
{ |
||||
|
key: 'locationCode', |
||||
|
value: 'DIFF', |
||||
|
action: '==', |
||||
|
isSearch: true, |
||||
|
isMainValue: false |
||||
|
} |
||||
|
] |
||||
|
}, |
||||
|
form: { |
||||
|
// labelMessage: '信息提示说明!!!',
|
||||
|
componentProps: { |
||||
|
isSearchList: true, // 开启查询弹窗
|
||||
|
searchListPlaceholder: '请输入包装号', |
||||
|
searchField: 'packingNumber', |
||||
|
searchTitle: '库存余额信息', |
||||
|
searchAllSchemas: Balance.allSchemas, |
||||
|
searchPage: BalanceApi.getBalanceItemPage, |
||||
|
searchCondition: [ |
||||
|
{ |
||||
|
key: 'available', |
||||
|
value: 'TRUE', |
||||
|
action: '==', |
||||
|
isSearch: true, |
||||
|
isMainValue: false |
||||
|
}, |
||||
|
{ |
||||
|
key: 'businessType', |
||||
|
value: 'UnplannedDeliver', |
||||
|
action: '==', |
||||
|
isSearch: true, |
||||
|
isMainValue: false |
||||
|
}, |
||||
|
{ |
||||
|
key: 'inOrOut', |
||||
|
value: 'out', |
||||
|
action: '==', |
||||
|
isSearch: true, |
||||
|
isMainValue: false |
||||
|
},{ |
||||
|
key: 'locationCode', |
||||
|
value: 'DIFF', |
||||
|
action: '==', |
||||
|
isSearch: true, |
||||
|
isMainValue: false |
||||
|
} |
||||
|
] |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '物料名称', |
||||
|
field: 'itemName', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
tableForm: { |
||||
|
disabled: true |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '物料描述1', |
||||
|
field: 'itemDesc1', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
tableForm: { |
||||
|
disabled: true |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '物料描述2', |
||||
|
field: 'itemDesc2', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
isTableForm: false, |
||||
|
tableForm: { |
||||
|
disabled: true |
||||
|
} |
||||
|
}, |
||||
|
// {
|
||||
|
// label: '物料类型',
|
||||
|
// dictType: DICT_TYPE.ITEM_TYPE,
|
||||
|
// field: 'itemType',
|
||||
|
// // hiddenInMain: true,
|
||||
|
// // isSearch: true,
|
||||
|
// // tableForm: {
|
||||
|
// // type: 'Select',
|
||||
|
// // disabled: true
|
||||
|
// // },
|
||||
|
// width: 100
|
||||
|
// },
|
||||
|
{ |
||||
|
label: '计量单位', |
||||
|
field: 'uom', |
||||
|
dictType: DICT_TYPE.UOM, |
||||
|
dictClass: 'string', |
||||
|
isTable: true, |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
tableForm: { |
||||
|
type: 'Select', |
||||
|
disabled: true |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '出库数量', |
||||
|
field: 'requestQty', |
||||
|
sort: 'custom', |
||||
|
tableForm: { |
||||
|
type: 'InputNumber', |
||||
|
componentProps: { |
||||
|
min: 0, |
||||
|
precision: 2 |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '批次', |
||||
|
field: 'batch', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
tableForm: { |
||||
|
disabled: true |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '包装号', |
||||
|
field: 'packingNumber', |
||||
|
sort: 'custom', |
||||
|
// isSearch: true,
|
||||
|
tableForm: { |
||||
|
disabled: true |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '库存状态', |
||||
|
field: 'inventoryStatus', |
||||
|
dictType: DICT_TYPE.INVENTORY_STATUS, |
||||
|
dictClass: 'string', |
||||
|
sort: 'custom', |
||||
|
// isSearch: true,
|
||||
|
tableForm: { |
||||
|
type: 'Select', |
||||
|
disabled: true |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '从库位代码', |
||||
|
field: 'fromLocationCode', |
||||
|
sort: 'custom', |
||||
|
// isSearch: true
|
||||
|
isTableForm: false, |
||||
|
tableForm: { |
||||
|
disabled: true |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建时间', |
||||
|
field: 'createTime', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
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')] |
||||
|
} |
||||
|
}, |
||||
|
isTableForm: false, |
||||
|
isForm: false, |
||||
|
tableForm: { |
||||
|
disabled: true |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建人', |
||||
|
field: 'creator', |
||||
|
isForm: false, |
||||
|
isDetail: false, |
||||
|
isTableForm: false, |
||||
|
tableForm: { |
||||
|
disabled: true |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作', |
||||
|
field: 'action', |
||||
|
isForm: false, |
||||
|
isDetail: false, |
||||
|
table: { |
||||
|
width: 200, |
||||
|
fixed: 'right' |
||||
|
}, |
||||
|
isTableForm: false, |
||||
|
tableForm: { |
||||
|
disabled: true |
||||
|
} |
||||
|
} |
||||
|
]) |
||||
|
) |
@ -0,0 +1,476 @@ |
|||||
|
<template> |
||||
|
<ContentWrap> |
||||
|
<!-- 搜索工作栏 --> |
||||
|
<Search :schema="[...DifferenceRequestMain.allSchemas.searchSchema,...DifferenceRequestDetail.allSchemas.searchSchema]" @search="setSearchParams" @reset="setSearchParams" /> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 列表头部 --> |
||||
|
<TableHead |
||||
|
:HeadButttondata="HeadButttondata" |
||||
|
@button-base-click="buttonBaseClick" |
||||
|
:routeName="routeName" |
||||
|
@updataTableColumns="updataTableColumns" |
||||
|
@searchFormClick="searchFormClick" |
||||
|
:allSchemas="DifferenceRequestMain.allSchemas" |
||||
|
:detailAllSchemas="DifferenceRequestDetail.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="formRef" |
||||
|
:isOpenSearchTable="true" |
||||
|
fieldTableColumn="itemCode" |
||||
|
@submitForm="submitForm" |
||||
|
:rules="DifferenceRequestMainRules" |
||||
|
:formAllSchemas="DifferenceRequestMain.allSchemas" |
||||
|
:tableAllSchemas="DifferenceRequestDetail.allSchemas" |
||||
|
:tableFormRules="DifferenceRequestDetailRules" |
||||
|
:tableData="tableData" |
||||
|
:apiUpdate="DifferenceRequestMainApi.updateMain" |
||||
|
:apiCreate="DifferenceRequestMainApi.createMain" |
||||
|
@tableSelectionDelete="tableSelectionDelete" |
||||
|
@searchTableSuccess="searchTableSuccess" |
||||
|
@handleDeleteTable="handleDeleteTable" |
||||
|
:isShowReduceButtonSelection="true" |
||||
|
:isBusiness="true" |
||||
|
/> |
||||
|
<!-- 详情 --> |
||||
|
<Detail ref="detailRef" |
||||
|
:isBasic="false" |
||||
|
:isShowDescriptions="true" |
||||
|
:allSchemas="DifferenceRequestMain.allSchemas" |
||||
|
:detailAllSchemas="DifferenceRequestDetail.allSchemas" |
||||
|
:apiPage="DifferenceRequestDetailApi.getDetailPage"/> |
||||
|
|
||||
|
<!-- 导入 --> |
||||
|
<ImportForm ref="importFormRef" url="/wms/difference-request-main/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import download from '@/utils/download' |
||||
|
import { DifferenceRequestMain,DifferenceRequestMainRules,DifferenceRequestDetail,DifferenceRequestDetailRules} from './differenceRequest.data' |
||||
|
import * as DifferenceRequestDetailApi from '@/api/wms/differenceRequestDetail' |
||||
|
import * as DifferenceRequestMainApi from '@/api/wms/differenceRequestMain' |
||||
|
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' |
||||
|
import * as ruleApi from '@/api/wms/rule/index' |
||||
|
|
||||
|
const { loadStart, loadDone } = usePageLoading() |
||||
|
// 差异库存出库申请 |
||||
|
defineOptions({ name: 'DifferenceRequestDetail' }) |
||||
|
|
||||
|
const message = useMessage() // 消息弹窗 |
||||
|
const { t } = useI18n() // 国际化 |
||||
|
|
||||
|
const route = useRoute() // 路由信息 |
||||
|
const routeName = ref() |
||||
|
routeName.value = route.name |
||||
|
const tableColumns = ref([...DifferenceRequestMain.allSchemas.tableColumns,...DifferenceRequestDetail.allSchemas.tableMainColumns]) |
||||
|
const fromManagementPrecision = ref('') |
||||
|
const tableFormKeys = {} |
||||
|
DifferenceRequestDetail.allSchemas.tableFormColumns.forEach(item => { |
||||
|
tableFormKeys[item.field] = item.default ? item.default : '' |
||||
|
}) |
||||
|
// 查询页面返回 |
||||
|
const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => { |
||||
|
nextTick(() => { |
||||
|
if (type == 'tableForm') { |
||||
|
// 明细查询页赋值 |
||||
|
if(formField === 'itemCode'){ |
||||
|
let itemCodes = val.filter(item=>tableData.value.find(item1=>item1['id']==item['id'])) |
||||
|
if(itemCodes.length>0){ |
||||
|
itemCodes = itemCodes.map(item=>(item['itemCode'])) |
||||
|
message.warning(`物料${itemCodes.join(',')}已经存在`) |
||||
|
} |
||||
|
val = val.filter(item=>!tableData.value.find(item1=>item1['id']==item['id'])) |
||||
|
|
||||
|
val = val.filter(item=>!tableData.value.find(item1=>item1['itemCode']==item['itemCode']&&item1['batch']==item['batch']&&item1['packingNumber']==item['packingNumber']&&item1['fromLocationCode']==item['locationCode']&&item1['inventoryStatus']==item['inventoryStatus'])) |
||||
|
if(val.length==0) return |
||||
|
val.forEach(async item=>{ |
||||
|
let newRow = JSON.parse(JSON.stringify({...tableFormKeys,...item})) |
||||
|
newRow[formField] =item[searchField] |
||||
|
tableData.value.push(newRow) |
||||
|
}) |
||||
|
}else{ |
||||
|
row[formField] = val[0][searchField] |
||||
|
} |
||||
|
} else { |
||||
|
const setV = {} |
||||
|
setV[formField] = val[0][searchField] |
||||
|
formRef.setValues(setV) |
||||
|
} |
||||
|
}) |
||||
|
} |
||||
|
const getFormattedDate = () =>{ |
||||
|
const a = new Date(); |
||||
|
const year = a.getFullYear(); |
||||
|
const month = String(a.getMonth() + 1).padStart(2, '0'); |
||||
|
const day = String(a.getDate()).padStart(2, '0'); |
||||
|
return `${year}${month}${day}`; |
||||
|
} |
||||
|
// // 查询页面返回 |
||||
|
// const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => { |
||||
|
// nextTick(async() => { |
||||
|
// if (type == 'tableForm') { |
||||
|
// // 明细查询页赋值 |
||||
|
// if(formField === 'itemCode'){ |
||||
|
// val = val.filter(item=>!tableData.value.find(item1=>item1['itemCode']==item['itemCode']&&item1['batch']==item['batch']&&item1['packingNumber']==item['packingNumber']&&item1['fromLocationCode']==item['locationCode']&&item1['inventoryStatus']==item['inventoryStatus'])) |
||||
|
// if(val.length==0) return |
||||
|
// val.forEach(async item=>{ |
||||
|
// let newRow = JSON.parse(JSON.stringify(tableFormKeys)) |
||||
|
// newRow[formField] =item[searchField] |
||||
|
// newRow['packingNumber'] = item['packingNumber'] |
||||
|
// newRow['containerNumber'] = item['containerNumber'] |
||||
|
// newRow['batch'] = item['batch'] |
||||
|
// //从批次 |
||||
|
// await ruleApi.getManagementPrecision({ |
||||
|
// itemCodes: [item['itemCode']], |
||||
|
// locationCode:item['locationCode'] |
||||
|
// }).then((res) => { |
||||
|
// fromManagementPrecision.value = res[0].ManagementPrecision |
||||
|
// }) |
||||
|
// if (fromManagementPrecision.value == 'BY_QUANTITY') {//如果从批次+物料管理精度是按数量 |
||||
|
// if(newRow['batch']==''){ |
||||
|
// newRow['batch'] = getFormattedDate(); // 获取 YYYYMMDD 格式的日期 |
||||
|
// } |
||||
|
// newRow['batchFormItemType'] = 'FormDate' |
||||
|
// newRow['disabled_batch'] = false |
||||
|
|
||||
|
// }else { |
||||
|
// newRow['bathFormItemType'] = '' |
||||
|
// newRow['disabled_batch'] = true |
||||
|
// } |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
// newRow['inventoryStatus'] = item['inventoryStatus'] |
||||
|
// newRow['fromLocationCode'] = item['locationCode'] |
||||
|
// newRow['itemCode'] = item['itemCode'] |
||||
|
// newRow['uom'] = item['uom'] |
||||
|
// newRow['qty'] = item['qty'] |
||||
|
// tableData.value.push(newRow) |
||||
|
// }) |
||||
|
// }else if(formField === 'costcentreCode'){ |
||||
|
// row['costcentreCode'] = val[0]['costcentreCode'] |
||||
|
// }else if(formField === 'qadProjectCode'){ |
||||
|
// row['qadProjectCode'] = val[0]['projectCode'] |
||||
|
// } else { |
||||
|
// row[formField] = val[0][searchField] |
||||
|
// } |
||||
|
// } else { |
||||
|
// const setV = {} |
||||
|
// if(formField === 'usageDescription'){ |
||||
|
// setV['usageDescription'] = val[0]['usageDescription'] |
||||
|
// setV['usageCode'] = val[0]['code'] |
||||
|
// } |
||||
|
// if(formField === 'costCenterCode'){ |
||||
|
// setV['costcentreCode'] = val[0]['costcentreCode'] |
||||
|
// setV['costCenterType'] = val[0]['costcentreType'] |
||||
|
// } |
||||
|
// if(formField === 'reasonCodeRequisition'){ |
||||
|
// setV['reasonCodeRequisition'] = val[0]['code'] |
||||
|
// setV['reasonDescRequisition'] = val[0]['accountingName'] |
||||
|
// // 项目是否必填 |
||||
|
// if(UnplannedissueRequestMainRules['projectCode']){ |
||||
|
// UnplannedissueRequestMainRules['projectCode'][0].required = val[0]['isProject']=='TRUE' |
||||
|
// } |
||||
|
// } |
||||
|
// if(formField === 'projectCode'){ |
||||
|
// setV['projectCode'] = val[0]['projectCode'] |
||||
|
// } |
||||
|
// setV[formField] = val[0][searchField] |
||||
|
// formRef.setValues(setV) |
||||
|
// } |
||||
|
// }) |
||||
|
// } |
||||
|
|
||||
|
// 字段设置 更新主列表字段 |
||||
|
const updataTableColumns = (val) => { |
||||
|
tableColumns.value = val |
||||
|
} |
||||
|
|
||||
|
const { tableObject, tableMethods } = useTable({ |
||||
|
getListApi: DifferenceRequestDetailApi.getDetailPage // 分页接口 |
||||
|
}) |
||||
|
|
||||
|
// 获得表格的各种操作 |
||||
|
const { getList, setSearchParams } = tableMethods |
||||
|
|
||||
|
// 列表头部按钮 |
||||
|
const HeadButttondata = [ |
||||
|
defaultButtons.defaultAddBtn({hasPermi:'wms:difference-request-main:create'}), // 新增 |
||||
|
defaultButtons.defaultImportBtn({hasPermi:'wms:difference-request-main:import'}), // 导入 |
||||
|
defaultButtons.defaultExportBtn({hasPermi:'wms:difference-request-detail: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') { // 刷新 |
||||
|
getList() |
||||
|
} else if (val == 'filtrate') { // 筛选 |
||||
|
} else { // 其他按钮 |
||||
|
console.log('其他按钮', item) |
||||
|
} |
||||
|
} |
||||
|
// 根据状态返回该按钮是否显示 |
||||
|
const isShowMainButton = (row, val) => { |
||||
|
if (val.indexOf(row.status) > -1) { |
||||
|
return false |
||||
|
} else { |
||||
|
return true |
||||
|
} |
||||
|
} |
||||
|
// 列表-操作按钮 |
||||
|
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, ['1','2','3','4','6']),hasPermi:'wms:difference-request-main:close'}), // 关闭 |
||||
|
defaultButtons.mainListSubmitBtn({ hide: isShowMainButton(row, ['1']),hasPermi:'wms:difference-request-main:submit'}), // 提交 |
||||
|
defaultButtons.mainListTurnDownBtn({ hide: isShowMainButton(row, ['2']),hasPermi:'wms:difference-request-main:abort'}), // 驳回 |
||||
|
defaultButtons.mainListApproveBtn({ hide: isShowMainButton(row, ['2']),hasPermi:'wms:difference-request-main:agree'}), // 通过 |
||||
|
defaultButtons.mainListHandleBtn({ hide: isShowMainButton(row, ['3']),hasPermi:'wms:difference-request-main:handle'}), // 执行 |
||||
|
] |
||||
|
} |
||||
|
|
||||
|
// 列表-操作按钮事件 |
||||
|
const buttonTableClick = async (val, row) => { |
||||
|
if (val == 'edit') { // 编辑 |
||||
|
openForm('update', row) |
||||
|
} else if (val == 'mainClose') { // 关闭 |
||||
|
handleClose(row.masterId) |
||||
|
} else if (val == 'mainSubmit') { // 提交 |
||||
|
handleSubmit(row.masterId) |
||||
|
} else if (val == 'mainTurnDown') { // 驳回 |
||||
|
handleTurnDown(row.masterId) |
||||
|
} else if (val == 'mainApprove') { // 通过 |
||||
|
handleApprove(row.masterId) |
||||
|
} else if (val == 'mainHandle') { // 处理 |
||||
|
handleHandle(row.masterId) |
||||
|
} else if (val == 'delete') { // 删除 |
||||
|
handleDelete(row.id) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 添加/修改操作 */ |
||||
|
const formRef = ref() |
||||
|
const openForm = (type: string, row?: any) => { |
||||
|
tableData.value = [] |
||||
|
formRef.value.open(type, row) |
||||
|
} |
||||
|
|
||||
|
// form表单提交 |
||||
|
const submitForm = async (formType,submitData) => { |
||||
|
let data = {...submitData} |
||||
|
data.subList = tableData.value |
||||
|
try { |
||||
|
if (formType === 'create') { |
||||
|
await DifferenceRequestMainApi.createMain(data) |
||||
|
message.success(t('common.createSuccess')) |
||||
|
} else { |
||||
|
await DifferenceRequestMainApi.updateMain(data) |
||||
|
message.success(t('common.updateSuccess')) |
||||
|
} |
||||
|
formRef.value.dialogVisible = false |
||||
|
getList() |
||||
|
}finally { |
||||
|
formRef.value.formLoading = false |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 详情操作 */ |
||||
|
const detailRef = ref() |
||||
|
const openDetail = (row: any, titleName: any, titleValue: any) => { |
||||
|
detailRef.value.openDetail(row, titleName, titleValue, 'basicDetail') |
||||
|
} |
||||
|
|
||||
|
/** 删除按钮操作 */ |
||||
|
const handleDelete = async (id: number) => { |
||||
|
try { |
||||
|
// 删除的二次确认 |
||||
|
await message.delConfirm() |
||||
|
// 发起删除 |
||||
|
await DifferenceRequestDetailApi.deleteDetail(id) |
||||
|
message.success(t('common.delSuccess')) |
||||
|
// 刷新列表 |
||||
|
await getList() |
||||
|
} catch {} |
||||
|
} |
||||
|
|
||||
|
/** 关闭按钮操作 */ |
||||
|
const handleClose = async (id: number) => { |
||||
|
try { |
||||
|
// 删除的二次确认 |
||||
|
// await message.delConfirm() |
||||
|
// 发起删除 |
||||
|
await DifferenceRequestMainApi.closeMain(id) |
||||
|
message.success(t('common.closeSuccess')) |
||||
|
// 刷新列表 |
||||
|
await getList() |
||||
|
} catch {} |
||||
|
} |
||||
|
|
||||
|
/** 提交按钮操作 */ |
||||
|
const handleSubmit = async (id: number) => { |
||||
|
try { |
||||
|
// 删除的二次确认 |
||||
|
// await message.delConfirm() |
||||
|
// 发起删除 |
||||
|
await DifferenceRequestMainApi.submitMain(id) |
||||
|
message.success(t('common.submitSuccess')) |
||||
|
// 刷新列表 |
||||
|
await getList() |
||||
|
} catch {} |
||||
|
} |
||||
|
|
||||
|
/** 驳回按钮操作 */ |
||||
|
const handleTurnDown = async (id: number) => { |
||||
|
try { |
||||
|
// 删除的二次确认 |
||||
|
// await message.delConfirm() |
||||
|
// 发起删除 |
||||
|
await DifferenceRequestMainApi.abortMain(id) |
||||
|
message.success(t('common.refusedSuccess')) |
||||
|
// 刷新列表 |
||||
|
await getList() |
||||
|
} catch {} |
||||
|
} |
||||
|
|
||||
|
/** 通过按钮操作 */ |
||||
|
const handleApprove = async (id: number) => { |
||||
|
try { |
||||
|
// 删除的二次确认 |
||||
|
// await message.delConfirm() |
||||
|
// 发起删除 |
||||
|
await DifferenceRequestMainApi.agreeMain(id) |
||||
|
message.success(t('common.agreeSuccess')) |
||||
|
// 刷新列表 |
||||
|
await getList() |
||||
|
} catch {} |
||||
|
} |
||||
|
|
||||
|
/** 处理按钮操作 */ |
||||
|
const handleHandle = async (id: number) => { |
||||
|
try { |
||||
|
// 删除的二次确认 |
||||
|
// await message.delConfirm() |
||||
|
// 发起删除 |
||||
|
await DifferenceRequestMainApi.handleMain(id) |
||||
|
message.success(t('common.dealwithSuccess')) |
||||
|
// 刷新列表 |
||||
|
await getList() |
||||
|
} catch {} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** 导出按钮操作 */ |
||||
|
const exportLoading = ref(false) // 导出的加载中 |
||||
|
const handleExport = async () => { |
||||
|
try { |
||||
|
// 导出的二次确认 |
||||
|
await message.exportConfirm() |
||||
|
// 发起导出 |
||||
|
exportLoading.value = true |
||||
|
const excelTitle = ref(route.meta.title) |
||||
|
const data = await DifferenceRequestDetailApi.exportDetail(tableObject.params) |
||||
|
const time = formatDate(new Date()) |
||||
|
download.excel(data, `【${excelTitle.value}】【${time}】.xlsx`) |
||||
|
} catch { |
||||
|
} finally { |
||||
|
loadDone() |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 导入 */ |
||||
|
const importFormRef = ref() |
||||
|
const handleImport = () => { |
||||
|
importFormRef.value.open() |
||||
|
} |
||||
|
// 导入附件弹窗所需的参数 |
||||
|
const importTemplateData = reactive({ |
||||
|
templateUrl: '', |
||||
|
templateTitle: '差异出库申请子导入模版.xlsx' |
||||
|
}) |
||||
|
// 导入成功之后 |
||||
|
const importSuccess = () => { |
||||
|
getList() |
||||
|
} |
||||
|
|
||||
|
// 筛选提交 |
||||
|
const searchFormClick = (searchData) => { |
||||
|
tableObject.params = { |
||||
|
isSearch: true, |
||||
|
filters: searchData.filters |
||||
|
} |
||||
|
getList() // 刷新当前列表 |
||||
|
} |
||||
|
|
||||
|
|
||||
|
const tableData = ref([]) |
||||
|
// 删除明细 |
||||
|
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)) |
||||
|
} |
||||
|
/** 初始化 **/ |
||||
|
onMounted(async () => { |
||||
|
getList() |
||||
|
importTemplateData.templateUrl = await DifferenceRequestMainApi.importTemplate() |
||||
|
}) |
||||
|
|
||||
|
</script> |
Loading…
Reference in new issue