songguoqiang
1 year ago
18 changed files with 3158 additions and 207 deletions
@ -0,0 +1,70 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
export interface LocationVO { |
||||
|
code: string |
||||
|
name: string |
||||
|
description: string |
||||
|
warehouseCode: string |
||||
|
areaCode: string |
||||
|
locationGroupCode: string |
||||
|
erpLocationCode: string |
||||
|
type: string |
||||
|
aisle: string |
||||
|
shelf: string |
||||
|
locationRow: number |
||||
|
locationColum: number |
||||
|
pickPriority: number |
||||
|
maxWeight: number |
||||
|
maxArea: number |
||||
|
maxVolume: number |
||||
|
userGroupCode: string |
||||
|
available: number |
||||
|
activeTime: Date |
||||
|
expireTime: Date |
||||
|
remark: string |
||||
|
} |
||||
|
|
||||
|
// 查询库位列表
|
||||
|
export const getLocationPage = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = {...params} |
||||
|
return request.post({ url: '/wms/location/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/wms/location/page`, params }) |
||||
|
} |
||||
|
} |
||||
|
// 查询库位所有列表
|
||||
|
export const getLocationList = async (params) => { |
||||
|
return await request.get({ url: `/wms/location/list`, params }) |
||||
|
} |
||||
|
|
||||
|
// 查询库位详情
|
||||
|
export const getLocation = async (id: number) => { |
||||
|
return await request.get({ url: `/wms/location/get?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 新增库位
|
||||
|
export const createLocation = async (data: LocationVO) => { |
||||
|
return await request.post({ url: `/wms/location/create`, data }) |
||||
|
} |
||||
|
|
||||
|
// 修改库位
|
||||
|
export const updateLocation = async (data: LocationVO) => { |
||||
|
return await request.put({ url: `/wms/location/update`, data }) |
||||
|
} |
||||
|
|
||||
|
// 删除库位
|
||||
|
export const deleteLocation = async (id: number) => { |
||||
|
return await request.delete({ url: `/wms/location/delete?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 导出库位 Excel
|
||||
|
export const exportLocation = async (params) => { |
||||
|
return await request.download({ url: `/wms/location/export-excel`, params }) |
||||
|
} |
||||
|
|
||||
|
// 下载用户导入模板
|
||||
|
export const importTemplate = () => { |
||||
|
return request.download({ url: '/wms/location/get-import-template' }) |
||||
|
} |
@ -0,0 +1,51 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
export interface LocationcapacityVO { |
||||
|
locationCode: string |
||||
|
warehouseCode: string |
||||
|
usedCapacity: number |
||||
|
availableCapacity: number |
||||
|
bearableOverloadCapacity: number |
||||
|
isInfinity: string |
||||
|
} |
||||
|
|
||||
|
// 查询库位容量列表
|
||||
|
export const getLocationcapacityPage = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = {...params} |
||||
|
return await request.post({ url: '/wms/locationcapacity/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/wms/locationcapacity/page`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 查询库位容量详情
|
||||
|
export const getLocationcapacity = async (id: number) => { |
||||
|
return await request.get({ url: `/wms/locationcapacity/get?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 新增库位容量
|
||||
|
export const createLocationcapacity = async (data: LocationcapacityVO) => { |
||||
|
return await request.post({ url: `/wms/locationcapacity/create`, data }) |
||||
|
} |
||||
|
|
||||
|
// 修改库位容量
|
||||
|
export const updateLocationcapacity = async (data: LocationcapacityVO) => { |
||||
|
return await request.put({ url: `/wms/locationcapacity/update`, data }) |
||||
|
} |
||||
|
|
||||
|
// 删除库位容量
|
||||
|
export const deleteLocationcapacity = async (id: number) => { |
||||
|
return await request.delete({ url: `/wms/locationcapacity/delete?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 导出库位容量 Excel
|
||||
|
export const exportLocationcapacity = async (params) => { |
||||
|
return await request.download({ url: `/wms/locationcapacity/export-excel`, params }) |
||||
|
} |
||||
|
|
||||
|
// 下载用户导入模板
|
||||
|
export const importTemplate = () => { |
||||
|
return request.download({ url: '/wms/locationcapacity/get-import-template' }) |
||||
|
} |
@ -0,0 +1,58 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
export interface LocationgroupVO { |
||||
|
code: string |
||||
|
name: string |
||||
|
description: string |
||||
|
warehouseCode: string |
||||
|
areaCode: string |
||||
|
available: number |
||||
|
activeTime: Date |
||||
|
expireTime: Date |
||||
|
remark: string |
||||
|
} |
||||
|
|
||||
|
// 查询库位组列表
|
||||
|
export const getLocationgroupPage = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = {...params} |
||||
|
return request.post({ url: '/wms/locationgroup/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/wms/locationgroup/page`, params }) |
||||
|
} |
||||
|
} |
||||
|
// 查询库位组列表
|
||||
|
export const getLocationgroupList = async (params) => { |
||||
|
return await request.get({ url: `/wms/locationgroup/list`, params }) |
||||
|
} |
||||
|
|
||||
|
// 查询库位组详情
|
||||
|
export const getLocationgroup = async (id: number) => { |
||||
|
return await request.get({ url: `/wms/locationgroup/get?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 新增库位组
|
||||
|
export const createLocationgroup = async (data: LocationgroupVO) => { |
||||
|
return await request.post({ url: `/wms/locationgroup/create`, data }) |
||||
|
} |
||||
|
|
||||
|
// 修改库位组
|
||||
|
export const updateLocationgroup = async (data: LocationgroupVO) => { |
||||
|
return await request.put({ url: `/wms/locationgroup/update`, data }) |
||||
|
} |
||||
|
|
||||
|
// 删除库位组
|
||||
|
export const deleteLocationgroup = async (id: number) => { |
||||
|
return await request.delete({ url: `/wms/locationgroup/delete?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 导出库位组 Excel
|
||||
|
export const exportLocationgroup = async (params) => { |
||||
|
return await request.download({ url: `/wms/locationgroup/export-excel`, params }) |
||||
|
} |
||||
|
|
||||
|
// 下载用户导入模板
|
||||
|
export const importTemplate = () => { |
||||
|
return request.download({ url: '/wms/locationgroup/get-import-template' }) |
||||
|
} |
@ -0,0 +1,67 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
export interface SupplierVO { |
||||
|
code: string |
||||
|
name: string |
||||
|
shortName: string |
||||
|
address: string |
||||
|
country: string |
||||
|
city: string |
||||
|
phone: string |
||||
|
fax: string |
||||
|
postId: string |
||||
|
contacts: string |
||||
|
bank: string |
||||
|
currency: string |
||||
|
taxRate: number |
||||
|
type: string |
||||
|
available: number |
||||
|
activeTime: Date |
||||
|
expireTime: Date |
||||
|
remark: string |
||||
|
} |
||||
|
|
||||
|
// 查询供应商列表分页
|
||||
|
export const getSupplierPage = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = {...params} |
||||
|
return request.post({ url: '/spc/supplier/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/spc/supplier/page`, params }) |
||||
|
} |
||||
|
} |
||||
|
// 查询供应商列表
|
||||
|
export const getSupplierList = async (params) => { |
||||
|
return await request.get({ url: `/spc/supplier/list`, params }) |
||||
|
} |
||||
|
|
||||
|
// 查询供应商详情
|
||||
|
export const getSupplier = async (id: number) => { |
||||
|
return await request.get({ url: `/spc/supplier/get?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 新增供应商
|
||||
|
export const createSupplier = async (data: SupplierVO) => { |
||||
|
return await request.post({ url: `/spc/supplier/create`, data }) |
||||
|
} |
||||
|
|
||||
|
// 修改供应商
|
||||
|
export const updateSupplier = async (data: SupplierVO) => { |
||||
|
return await request.put({ url: `/spc/supplier/update`, data }) |
||||
|
} |
||||
|
|
||||
|
// 删除供应商
|
||||
|
export const deleteSupplier = async (id: number) => { |
||||
|
return await request.delete({ url: `/spc/supplier/delete?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 导出供应商 Excel
|
||||
|
export const exportSupplier = async (params) => { |
||||
|
return await request.download({ url: `/spc/supplier/export-excel`, params }) |
||||
|
} |
||||
|
|
||||
|
// 下载用户导入模板
|
||||
|
export const importTemplate = () => { |
||||
|
return request.download({ url: '/spc/supplier/get-import-template' }) |
||||
|
} |
@ -0,0 +1,62 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
export interface SupplieritemVO { |
||||
|
supplierCode: string |
||||
|
itemCode: string |
||||
|
supplierItemCode: string |
||||
|
supplierUom: string |
||||
|
convertRate: number |
||||
|
packUnit: string |
||||
|
packQty: number |
||||
|
altPackUnit: string |
||||
|
altPackQty: number |
||||
|
packQtyOfContainer: number |
||||
|
defaultWarehouseCode: string |
||||
|
defaultLocationCode: string |
||||
|
settlementType: string |
||||
|
available: number |
||||
|
activeTime: Date |
||||
|
expireTime: Date |
||||
|
remark: string |
||||
|
} |
||||
|
|
||||
|
// 查询供应商物品列表
|
||||
|
export const getSupplieritemPage = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = {...params} |
||||
|
return request.post({ url: '/spc/supplieritem/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/spc/supplieritem/page`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 查询供应商物品详情
|
||||
|
export const getSupplieritem = async (id: number) => { |
||||
|
return await request.get({ url: `/spc/supplieritem/get?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 新增供应商物品
|
||||
|
export const createSupplieritem = async (data: SupplieritemVO) => { |
||||
|
return await request.post({ url: `/spc/supplieritem/create`, data }) |
||||
|
} |
||||
|
|
||||
|
// 修改供应商物品
|
||||
|
export const updateSupplieritem = async (data: SupplieritemVO) => { |
||||
|
return await request.put({ url: `/spc/supplieritem/update`, data }) |
||||
|
} |
||||
|
|
||||
|
// 删除供应商物品
|
||||
|
export const deleteSupplieritem = async (id: number) => { |
||||
|
return await request.delete({ url: `/spc/supplieritem/delete?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 导出供应商物品 Excel
|
||||
|
export const exportSupplieritem = async (params) => { |
||||
|
return await request.download({ url: `/spc/supplieritem/export-excel`, params }) |
||||
|
} |
||||
|
|
||||
|
// 下载用户导入模板
|
||||
|
export const importTemplate = () => { |
||||
|
return request.download({ url: '/spc/supplieritem/get-import-template' }) |
||||
|
} |
@ -0,0 +1,56 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
export interface WarehouseVO { |
||||
|
code: string |
||||
|
name: string |
||||
|
description: string |
||||
|
type: string |
||||
|
available: number |
||||
|
activeTime: Date |
||||
|
expireTime: Date |
||||
|
remark: string |
||||
|
} |
||||
|
|
||||
|
// 查询仓库列表
|
||||
|
export const getWarehousePage = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = {...params} |
||||
|
return request.post({ url: '/spc/warehouse/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/spc/warehouse/page`, params }) |
||||
|
} |
||||
|
} |
||||
|
// 查询仓库所有列表
|
||||
|
export const getWarehouseList = async (params) => { |
||||
|
return await request.get({ url: `/spc/warehouse/list`, params }) |
||||
|
} |
||||
|
// 查询仓库详情
|
||||
|
export const getWarehouse = async (id: number) => { |
||||
|
return await request.get({ url: `/spc/warehouse/get?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 新增仓库
|
||||
|
export const createWarehouse = async (data: WarehouseVO) => { |
||||
|
return await request.post({ url: `/spc/warehouse/create`, data }) |
||||
|
} |
||||
|
|
||||
|
// 修改仓库
|
||||
|
export const updateWarehouse = async (data: WarehouseVO) => { |
||||
|
return await request.put({ url: `/spc/warehouse/update`, data }) |
||||
|
} |
||||
|
|
||||
|
// 删除仓库
|
||||
|
export const deleteWarehouse = async (id: number) => { |
||||
|
return await request.delete({ url: `/spc/warehouse/delete?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 导出仓库 Excel
|
||||
|
export const exportWarehouse = async (params) => { |
||||
|
return await request.download({ url: `/spc/warehouse/export-excel`, params }) |
||||
|
} |
||||
|
|
||||
|
// 下载用户导入模板
|
||||
|
export const importTemplate = () => { |
||||
|
return request.download({ url: '/spc/warehouse/get-import-template' }) |
||||
|
} |
@ -1,355 +1,490 @@ |
|||||
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
||||
import { dateFormatter } from '@/utils/formatTime' |
import { dateFormatter } from '@/utils/formatTime' |
||||
|
const { t } = useI18n() // 国际化
|
||||
|
|
||||
// 表单校验
|
/** |
||||
export const ItembasicRules = reactive({ |
* @returns {Array} 基础物料信息 |
||||
code: [required], |
*/ |
||||
status: [required], |
|
||||
uom: [required], |
|
||||
isStdPack: [required], |
|
||||
enableBuy: [required], |
|
||||
enableMake: [required], |
|
||||
enableOutsourcing: [required], |
|
||||
isRecycled: [required], |
|
||||
isPhantom: [required], |
|
||||
abcClass: [required], |
|
||||
type: [required], |
|
||||
validityDays: [required], |
|
||||
available: [required] |
|
||||
}) |
|
||||
|
|
||||
export const Itembasic = useCrudSchemas(reactive<CrudSchema[]>([ |
export const Itembasic = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
{ |
{ |
||||
label: '代码', |
label: '代码', |
||||
field: 'code', |
field: 'code', |
||||
sort: 'custom', |
sort: 'custom', |
||||
isSearch: true |
isSearch: true, |
||||
|
table: { |
||||
|
width: 150, |
||||
|
fixed: 'left' |
||||
|
}, |
||||
|
// tableForm:{
|
||||
|
// minWidth:200,
|
||||
|
// sortable:false
|
||||
|
// }
|
||||
}, |
}, |
||||
{ |
{ |
||||
label: '名称', |
label: '名称', |
||||
field: 'name', |
field: 'name', |
||||
sort: 'custom', |
sort: 'custom', |
||||
isSearch: true |
isSearch: true, |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
}, |
}, |
||||
{ |
{ |
||||
label: '描述1', |
label: '描述1', |
||||
field: 'desc1', |
field: 'desc1', |
||||
sort: 'custom', |
sort: 'custom', |
||||
isSearch: true |
table: { |
||||
|
width: 150 |
||||
|
} , |
||||
|
// isTableForm:false
|
||||
}, |
}, |
||||
{ |
{ |
||||
label: '描述2', |
label: '描述2', |
||||
field: 'desc2', |
field: 'desc2', |
||||
sort: 'custom', |
sort: 'custom', |
||||
isSearch: true |
table: { |
||||
|
width: 150 |
||||
|
} , |
||||
}, |
}, |
||||
{ |
{ |
||||
label: '状态', |
label: '状态', |
||||
field: 'status', |
field: 'status', |
||||
sort: 'custom', |
sort: 'custom', |
||||
dictType: DICT_TYPE.ITEM_STATUS, |
dictType: DICT_TYPE.ITEM_STATUS, |
||||
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
|
dictClass: 'string', |
||||
|
isForm: true, |
||||
isSearch: true, |
isSearch: true, |
||||
|
isTable: true, |
||||
|
table: { |
||||
|
width: 100 |
||||
|
} , |
||||
form: { |
form: { |
||||
component: 'SelectV2' |
component: 'Switch', |
||||
|
value: 'ENABLE', |
||||
|
componentProps: { |
||||
|
inactiveValue: 'DISABLE', |
||||
|
activeValue: 'ENABLE' |
||||
} |
} |
||||
}, |
}, |
||||
|
}, |
||||
{ |
{ |
||||
label: '计量单位', |
label: '计量单位', |
||||
field: 'uom', |
field: 'uom', |
||||
sort: 'custom', |
sort: 'custom', |
||||
dictType: DICT_TYPE.UOM, |
dictType: DICT_TYPE.UOM, |
||||
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
|
dictClass: 'string', |
||||
isSearch: true, |
isSearch: true, |
||||
form: { |
isTable: true, |
||||
component: 'SelectV2' |
table: { |
||||
} |
width: 120 |
||||
|
} , |
||||
}, |
}, |
||||
{ |
{ |
||||
label: '替代计量单位', |
label: '替代计量单位', |
||||
field: 'altUom', |
field: 'altUom', |
||||
sort: 'custom', |
sort: 'custom', |
||||
dictType: DICT_TYPE.UOM, |
dictType: DICT_TYPE.UOM, |
||||
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
|
dictClass: 'string', |
||||
isSearch: true, |
isTable: true, |
||||
form: { |
table: { |
||||
component: 'SelectV2' |
width: 150 |
||||
} |
} , |
||||
}, |
}, |
||||
{ |
{ |
||||
label: '是否标包', |
label: '是否标包', |
||||
field: 'isStdPack', |
field: 'isStdPack', |
||||
sort: 'custom', |
sort: 'custom', |
||||
isSearch: true, |
dictType: DICT_TYPE.TRUE_FALSE, |
||||
|
dictClass: 'string', |
||||
|
// colorType: 'danger',
|
||||
|
isTable: true, |
||||
|
table: { |
||||
|
width: 120 |
||||
|
}, |
||||
form: { |
form: { |
||||
component: 'SelectV2' |
component: 'Switch', |
||||
|
value: 'TRUE', |
||||
|
componentProps: { |
||||
|
inactiveValue: 'FALSE', |
||||
|
activeValue: 'TRUE' |
||||
} |
} |
||||
}, |
}, |
||||
|
// tableForm:{
|
||||
|
// width: 180,
|
||||
|
// type:'Radio',
|
||||
|
// }
|
||||
|
}, |
||||
{ |
{ |
||||
label: '可采购', |
label: '可采购', |
||||
field: 'enableBuy', |
field: 'enableBuy', |
||||
sort: 'custom', |
sort: 'custom', |
||||
isSearch: true, |
dictType: DICT_TYPE.TRUE_FALSE, |
||||
|
dictClass: 'string', |
||||
|
isTable: true, |
||||
|
table: { |
||||
|
width: 100 |
||||
|
}, |
||||
form: { |
form: { |
||||
component: 'SelectV2' |
component: 'Switch', |
||||
|
value: 'TRUE', |
||||
|
componentProps: { |
||||
|
inactiveValue: 'FALSE', |
||||
|
activeValue: 'TRUE' |
||||
} |
} |
||||
}, |
}, |
||||
|
}, |
||||
{ |
{ |
||||
label: '可制造', |
label: '可制造', |
||||
field: 'enableMake', |
field: 'enableMake', |
||||
sort: 'custom', |
sort: 'custom', |
||||
isSearch: true, |
dictType: DICT_TYPE.TRUE_FALSE, |
||||
|
dictClass: 'string', |
||||
|
isTable: true, |
||||
|
table: { |
||||
|
width: 100 |
||||
|
} , |
||||
form: { |
form: { |
||||
component: 'SelectV2' |
component: 'Switch', |
||||
|
value: 'TRUE', |
||||
|
componentProps: { |
||||
|
inactiveValue: 'FALSE', |
||||
|
activeValue: 'TRUE' |
||||
} |
} |
||||
}, |
}, |
||||
|
}, |
||||
{ |
{ |
||||
label: '可委外加工', |
label: '可委外加工', |
||||
field: 'enableOutsourcing', |
field: 'enableOutsourcing', |
||||
sort: 'custom', |
sort: 'custom', |
||||
isSearch: true, |
dictType: DICT_TYPE.TRUE_FALSE, |
||||
|
dictClass: 'string', |
||||
|
isTable: true, |
||||
|
table: { |
||||
|
width: 120 |
||||
|
} , |
||||
form: { |
form: { |
||||
component: 'SelectV2' |
component: 'Switch', |
||||
|
value: 'TRUE', |
||||
|
componentProps: { |
||||
|
inactiveValue: 'FALSE', |
||||
|
activeValue: 'TRUE' |
||||
} |
} |
||||
}, |
}, |
||||
|
}, |
||||
{ |
{ |
||||
label: '回收件', |
label: '回收件', |
||||
field: 'isRecycled', |
field: 'isRecycled', |
||||
sort: 'custom', |
sort: 'custom', |
||||
isSearch: true, |
dictType: DICT_TYPE.TRUE_FALSE, |
||||
|
dictClass: 'string', |
||||
|
isTable: true, |
||||
|
table: { |
||||
|
width: 100 |
||||
|
}, |
||||
form: { |
form: { |
||||
component: 'SelectV2' |
component: 'Switch', |
||||
|
value: 'TRUE', |
||||
|
componentProps: { |
||||
|
inactiveValue: 'FALSE', |
||||
|
activeValue: 'TRUE' |
||||
} |
} |
||||
}, |
}, |
||||
|
}, |
||||
{ |
{ |
||||
label: '虚零件', |
label: '虚零件', |
||||
field: 'isPhantom', |
field: 'isPhantom', |
||||
sort: 'custom', |
sort: 'custom', |
||||
isSearch: true, |
dictType: DICT_TYPE.TRUE_FALSE, |
||||
|
dictClass: 'string', |
||||
|
isTable: true, |
||||
|
table: { |
||||
|
width: 100 |
||||
|
} , |
||||
form: { |
form: { |
||||
component: 'SelectV2' |
component: 'Switch', |
||||
|
value: 'TRUE', |
||||
|
componentProps: { |
||||
|
inactiveValue: 'FALSE', |
||||
|
activeValue: 'TRUE' |
||||
} |
} |
||||
}, |
}, |
||||
|
}, |
||||
{ |
{ |
||||
label: 'ABC类', |
label: 'ABC类', |
||||
field: 'abcClass', |
field: 'abcClass', |
||||
sort: 'custom', |
sort: 'custom', |
||||
isSearch: true, |
dictType: DICT_TYPE.ABC_CLASS, |
||||
form: { |
dictClass: 'string', |
||||
component: 'SelectV2' |
isTable: true, |
||||
} |
table: { |
||||
|
width: 100 |
||||
|
} , |
||||
}, |
}, |
||||
{ |
{ |
||||
label: '类型', |
label: '类型', |
||||
field: 'type', |
field: 'type', |
||||
sort: 'custom', |
sort: 'custom', |
||||
isSearch: true, |
dictType: DICT_TYPE.ITEM_TYPE, |
||||
form: { |
dictClass: 'string', |
||||
component: 'SelectV2' |
isTable: true, |
||||
} |
table: { |
||||
|
width: 100 |
||||
|
} , |
||||
}, |
}, |
||||
{ |
{ |
||||
label: '种类', |
label: '种类', |
||||
field: 'category', |
field: 'category', |
||||
sort: 'custom', |
sort: 'custom', |
||||
dictType: DICT_TYPE.ITEM_CATEGORY, |
dictType: DICT_TYPE.ITEM_CATEGORY, |
||||
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
|
dictClass: 'string', |
||||
isSearch: true, |
isTable: true, |
||||
form: { |
table: { |
||||
component: 'SelectV2' |
width: 100 |
||||
} |
} , |
||||
}, |
}, |
||||
{ |
{ |
||||
label: '分组', |
label: '分组', |
||||
field: 'itemGroup', |
field: 'itemGroup', |
||||
sort: 'custom', |
sort: 'custom', |
||||
dictType: DICT_TYPE.ITEM_GROUP, |
dictType: DICT_TYPE.ITEM_GROUP, |
||||
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
|
dictClass: 'string', |
||||
isSearch: true, |
isTable: true, |
||||
form: { |
table: { |
||||
component: 'SelectV2' |
width: 100 |
||||
} |
} , |
||||
}, |
}, |
||||
{ |
{ |
||||
label: '颜色', |
label: '颜色', |
||||
field: 'color', |
field: 'color', |
||||
sort: 'custom', |
sort: 'custom', |
||||
dictType: DICT_TYPE.ITEM_COLOR, |
dictType: DICT_TYPE.ITEM_COLOR, |
||||
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
|
dictClass: 'string', |
||||
isSearch: true, |
isTable: true, |
||||
form: { |
table: { |
||||
component: 'SelectV2' |
width: 100 |
||||
} |
} , |
||||
}, |
}, |
||||
{ |
{ |
||||
label: '配置', |
label: '配置', |
||||
field: 'configuration', |
field: 'configuration', |
||||
sort: 'custom', |
sort: 'custom', |
||||
dictType: DICT_TYPE.ITEM_CONFIGURATION, |
dictType: DICT_TYPE.ITEM_CONFIGURATION, |
||||
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
|
dictClass: 'string', |
||||
isSearch: true, |
isTable: true, |
||||
form: { |
table: { |
||||
component: 'SelectV2' |
width: 100 |
||||
} |
} , |
||||
}, |
}, |
||||
{ |
{ |
||||
label: '项目', |
label: '项目', |
||||
field: 'project', |
field: 'project', |
||||
sort: 'custom', |
sort: 'custom', |
||||
isSearch: true |
table: { |
||||
|
width: 100 |
||||
|
} , |
||||
}, |
}, |
||||
{ |
{ |
||||
label: '质量等级', |
label: '质量等级', |
||||
field: 'eqLevel', |
field: 'eqLevel', |
||||
sort: 'custom', |
sort: 'custom', |
||||
dictType: DICT_TYPE.EQ_LEVEL, |
dictType: DICT_TYPE.EQ_LEVEL, |
||||
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
|
dictClass: 'string', |
||||
isSearch: true, |
isTable: true, |
||||
form: { |
table: { |
||||
component: 'SelectV2' |
width: 120 |
||||
} |
} , |
||||
}, |
}, |
||||
{ |
{ |
||||
label: '有效天数', |
label: '有效天数', |
||||
field: 'validityDays', |
field: 'validityDays', |
||||
sort: 'custom', |
sort: 'custom', |
||||
isSearch: true, |
table: { |
||||
|
width: 120 |
||||
|
}, |
||||
form: { |
form: { |
||||
component: 'InputNumber', |
component: 'InputNumber', |
||||
value: 0 |
componentProps: { |
||||
|
min: 0 |
||||
} |
} |
||||
}, |
}, |
||||
{ |
|
||||
label: '用户组代码', |
|
||||
field: 'userGroupCode', |
|
||||
sort: 'custom', |
|
||||
isSearch: true |
|
||||
}, |
}, |
||||
{ |
{ |
||||
label: '是否可用', |
label: '是否可用', |
||||
field: 'available', |
field: 'available', |
||||
sort: 'custom', |
sort: 'custom', |
||||
isSearch: true |
dictType: DICT_TYPE.TRUE_FALSE, |
||||
|
dictClass: 'string', |
||||
|
isTable: true, |
||||
|
table: { |
||||
|
width: 120 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'Switch', |
||||
|
value: 'TRUE', |
||||
|
componentProps: { |
||||
|
inactiveValue: 'FALSE', |
||||
|
activeValue: 'TRUE' |
||||
|
} |
||||
|
}, |
||||
}, |
}, |
||||
{ |
{ |
||||
label: '生效时间', |
label: '生效时间', |
||||
field: 'activeTime', |
field: 'activeTime', |
||||
sort: 'custom', |
sort: 'custom', |
||||
|
isTable: true, |
||||
formatter: dateFormatter, |
formatter: dateFormatter, |
||||
isSearch: true, |
detail: { |
||||
search: { |
dateFormat: 'YYYY-MM-DD HH:mm:ss' |
||||
component: 'DatePicker', |
}, |
||||
componentProps: { |
table: { |
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
width: 180 |
||||
type: 'daterange', |
|
||||
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
|
||||
} |
|
||||
} , |
} , |
||||
form: { |
form: { |
||||
component: 'DatePicker', |
component: 'DatePicker', |
||||
componentProps: { |
componentProps: { |
||||
|
style: {width:'100%'}, |
||||
type: 'datetime', |
type: 'datetime', |
||||
valueFormat: 'x' |
dateFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
} |
valueFormat: 'x', |
||||
} |
} |
||||
}, |
}, |
||||
|
// tableForm:{
|
||||
|
// width: 200,
|
||||
|
// type:'FormDateTime',
|
||||
|
// }
|
||||
|
}, |
||||
{ |
{ |
||||
label: '失效时间', |
label: '失效时间', |
||||
field: 'expireTime', |
field: 'expireTime', |
||||
sort: 'custom', |
sort: 'custom', |
||||
|
isTable: true, |
||||
formatter: dateFormatter, |
formatter: dateFormatter, |
||||
isSearch: true, |
detail: { |
||||
search: { |
dateFormat: 'YYYY-MM-DD HH:mm:ss' |
||||
component: 'DatePicker', |
}, |
||||
componentProps: { |
table: { |
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
width: 180 |
||||
type: 'daterange', |
|
||||
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
|
||||
} |
|
||||
} , |
} , |
||||
form: { |
form: { |
||||
component: 'DatePicker', |
component: 'DatePicker', |
||||
componentProps: { |
componentProps: { |
||||
|
style: {width:'100%'}, |
||||
type: 'datetime', |
type: 'datetime', |
||||
valueFormat: 'x' |
dateFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
} |
valueFormat: 'x', |
||||
} |
} |
||||
}, |
}, |
||||
{ |
|
||||
label: '备注', |
|
||||
field: 'remark', |
|
||||
sort: 'custom', |
|
||||
isSearch: true |
|
||||
}, |
}, |
||||
{ |
{ |
||||
label: '创建时间', |
label: '创建时间', |
||||
field: 'createTime', |
field: 'createTime', |
||||
sort: 'custom', |
sort: 'custom', |
||||
|
isTable: true, |
||||
formatter: dateFormatter, |
formatter: dateFormatter, |
||||
isSearch: true, |
isForm: false, |
||||
search: { |
detail: { |
||||
component: 'DatePicker', |
dateFormat: 'YYYY-MM-DD HH:mm:ss' |
||||
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 |
|
||||
}, |
}, |
||||
{ |
table: { |
||||
label: '删除时间', |
width: 180 |
||||
field: 'deletionTime', |
|
||||
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: { |
form: { |
||||
component: 'DatePicker', |
component: 'DatePicker', |
||||
componentProps: { |
componentProps: { |
||||
|
style: {width:'100%'}, |
||||
type: 'datetime', |
type: 'datetime', |
||||
valueFormat: 'x' |
dateFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
valueFormat: 'x', |
||||
} |
} |
||||
} |
} |
||||
}, |
}, |
||||
{ |
{ |
||||
label: '删除者ID', |
label: '创建者', |
||||
field: 'deleterId', |
field: 'creator', |
||||
sort: 'custom', |
isForm: false, |
||||
isSearch: true |
isTable: false |
||||
}, |
|
||||
{ |
|
||||
label: '扩展属性', |
|
||||
field: 'extraProperties', |
|
||||
sort: 'custom', |
|
||||
isSearch: true |
|
||||
}, |
|
||||
{ |
|
||||
label: '并发乐观锁', |
|
||||
field: 'concurrencyStamp', |
|
||||
sort: 'custom', |
|
||||
isSearch: true |
|
||||
}, |
|
||||
{ |
|
||||
label: '地点ID', |
|
||||
field: 'siteId', |
|
||||
sort: 'custom', |
|
||||
isSearch: true |
|
||||
}, |
}, |
||||
|
{ label: '备注', field: 'remark', sort: 'custom', isTable: false}, |
||||
{ |
{ |
||||
label: '操作', |
label: '操作', |
||||
field: 'action', |
field: 'action', |
||||
|
isDetail: false, |
||||
isForm: false , |
isForm: false , |
||||
table: { |
table: { |
||||
width: 150, |
width: 150, |
||||
fixed: 'right' |
fixed: 'right' |
||||
} |
}, |
||||
} |
} |
||||
])) |
])) |
||||
|
// 表单校验
|
||||
|
export const rules = reactive({ |
||||
|
code: [ |
||||
|
{ required: true, message: '请输入代码', trigger: 'blur' } |
||||
|
], |
||||
|
name: [ |
||||
|
{ required: true, message: '请输入名称', trigger: 'blur' } |
||||
|
], |
||||
|
status: [ |
||||
|
{ required: true, message: '请选择状态', trigger: 'change' } |
||||
|
], |
||||
|
uom: [ |
||||
|
{ required: true, message: '请选择计量单位', trigger: 'change' } |
||||
|
], |
||||
|
altUom: [ |
||||
|
{ required: true, message: '请选择替代计量单位', trigger: 'change' } |
||||
|
], |
||||
|
isStdPack: [ |
||||
|
{ required: true, message: '请选择是否标包', trigger: 'change' } |
||||
|
], |
||||
|
enableBuy: [ |
||||
|
{ required: true, message: '请选择是否可采购', trigger: 'change' } |
||||
|
], |
||||
|
enableMake: [ |
||||
|
{ required: true, message: '请选择是否可制造', trigger: 'change' } |
||||
|
], |
||||
|
enableOutsourcing: [ |
||||
|
{ required: true, message: '请选择是否可委外加工', trigger: 'change' } |
||||
|
], |
||||
|
isRecycled: [ |
||||
|
{ required: true, message: '请选择回收件', trigger: 'change' } |
||||
|
], |
||||
|
isPhantom: [ |
||||
|
{ required: true, message: '请选择虚零件', trigger: 'change' } |
||||
|
], |
||||
|
abcClass: [ |
||||
|
{ required: true, message: '请选择ABC类', trigger: 'change' } |
||||
|
], |
||||
|
type: [ |
||||
|
{ required: true, message: '请选择类型', trigger: 'change' } |
||||
|
], |
||||
|
category: [ |
||||
|
{ required: true, message: '请选择种类', trigger: 'change' } |
||||
|
], |
||||
|
itemGroup: [ |
||||
|
{ required: true, message: '请选择分组', trigger: 'change' } |
||||
|
], |
||||
|
color: [ |
||||
|
{ required: true, message: '请选择颜色', trigger: 'change' } |
||||
|
], |
||||
|
configuration: [ |
||||
|
{ required: true, message: '请选择配置', trigger: 'change' } |
||||
|
], |
||||
|
project: [ |
||||
|
{ required: true, message: '请输入项目', trigger: 'blur' } |
||||
|
], |
||||
|
eqLevel: [ |
||||
|
{ required: true, message: '请选择质量等级', trigger: 'change' } |
||||
|
], |
||||
|
validityDays: [ |
||||
|
{ required: true, message: '请输入有效天数', trigger: 'change' } |
||||
|
], |
||||
|
available: [ |
||||
|
{ required: true, message: '请选择是否可用', trigger: 'change' } |
||||
|
], |
||||
|
activeTime: [ |
||||
|
{ required: true, message: '请输入生效时间', trigger: 'change' } |
||||
|
], |
||||
|
expireTime: [ |
||||
|
{ required: true, message: '请输入失效时间', trigger: 'change' } |
||||
|
], |
||||
|
}) |
@ -0,0 +1,221 @@ |
|||||
|
<template> |
||||
|
<ContentWrap> |
||||
|
<!-- 搜索工作栏 --> |
||||
|
<Search :schema="Location.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 列表头部 --> |
||||
|
<TableHead |
||||
|
:HeadButttondata="HeadButttondata" |
||||
|
@button-base-click="buttonBaseClick" |
||||
|
:route-name="routeName" |
||||
|
@updataTableColumns="updataTableColumns" |
||||
|
@searchFormClick="searchFormClick" |
||||
|
:allSchemas="Location.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 #code="{row}"> |
||||
|
<el-button type="primary" link @click="openDetail(row, '代码', row.code)"> |
||||
|
<span>{{ row.code }}</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="LocationRules" |
||||
|
:formAllSchemas="Location.allSchemas" |
||||
|
:apiUpdate="LocationApi.updateLocation" |
||||
|
:apiCreate="LocationApi.createLocation" |
||||
|
@searchTableSuccess="searchTableSuccess" |
||||
|
:isBusiness="false" |
||||
|
/> |
||||
|
|
||||
|
<!-- 详情 --> |
||||
|
<Detail ref="detailRef" :isBasic="true" :allSchemas="Location.allSchemas" /> |
||||
|
|
||||
|
<!-- 导入 --> |
||||
|
<ImportForm ref="importFormRef" url="/wms/location/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import download from '@/utils/download' |
||||
|
import * as LocationApi from '@/api/wms/location' |
||||
|
import BasicForm from '@/components/BasicForm/src/BasicForm.vue' |
||||
|
import { Location, LocationRules } from './location.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' |
||||
|
|
||||
|
defineOptions({ name: 'Location' }) |
||||
|
|
||||
|
const message = useMessage() // 消息弹窗 |
||||
|
const { t } = useI18n() // 国际化 |
||||
|
|
||||
|
const route = useRoute() //路由信息 |
||||
|
const routeName = ref() |
||||
|
routeName.value = route.name |
||||
|
const tableColumns = ref(Location.allSchemas.tableColumns) |
||||
|
|
||||
|
//字段设置 更新主列表字段 |
||||
|
const updataTableColumns = (val) => { |
||||
|
tableColumns.value = val |
||||
|
} |
||||
|
|
||||
|
const { tableObject, tableMethods } = useTable({ |
||||
|
getListApi: LocationApi.getLocationPage // 分页接口 |
||||
|
}) |
||||
|
|
||||
|
// 获得表格的各种操作 |
||||
|
const { getList, setSearchParams } = tableMethods |
||||
|
|
||||
|
// 列表头部按钮 |
||||
|
const HeadButttondata = [ |
||||
|
defaultButtons.defaultAddBtn({hasPermi:'wms:location:create'}), // 新增 |
||||
|
defaultButtons.defaultImportBtn({hasPermi:'wms:location:import'}), // 导入 |
||||
|
defaultButtons.defaultExportBtn({hasPermi:'wms:location: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 butttondata = [ |
||||
|
defaultButtons.mainListEditBtn({hasPermi:'wms:location:update'}), // 编辑 |
||||
|
defaultButtons.mainListDeleteBtn({hasPermi:'wms:location:delete'}), // 删除 |
||||
|
] |
||||
|
|
||||
|
// 列表-操作按钮事件 |
||||
|
const buttonTableClick = async (val, row) => { |
||||
|
if (val == 'edit') { // 编辑 |
||||
|
// const res = await LocationApi.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 searchTableSuccess = (formField, searchField, val, formRef) => { |
||||
|
nextTick(() => { |
||||
|
const setV = {} |
||||
|
setV[formField] = val[0][searchField] |
||||
|
formRef.setValues(setV) |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
/** 详情操作 */ |
||||
|
const detailRef = ref() |
||||
|
const openDetail = (row: any, titleName: any, titleValue: any) => { |
||||
|
detailRef.value.openDetail(row, titleName, titleValue, 'basicLocation') |
||||
|
} |
||||
|
|
||||
|
/** 删除按钮操作 */ |
||||
|
const handleDelete = async (id: number) => { |
||||
|
try { |
||||
|
// 删除的二次确认 |
||||
|
await message.delConfirm() |
||||
|
// 发起删除 |
||||
|
await LocationApi.deleteLocation(id) |
||||
|
message.success(t('common.delSuccess')) |
||||
|
// 刷新列表 |
||||
|
await getList() |
||||
|
} catch {} |
||||
|
} |
||||
|
|
||||
|
/** 导出按钮操作 */ |
||||
|
const exportLoading = ref(false) // 导出的加载中 |
||||
|
const handleExport = async () => { |
||||
|
try { |
||||
|
// 导出的二次确认 |
||||
|
await message.exportConfirm() |
||||
|
// 发起导出 |
||||
|
exportLoading.value = true |
||||
|
const data = await LocationApi.exportLocation(setSearchParams) |
||||
|
download.excel(data, '库位.xls') |
||||
|
} catch { |
||||
|
} finally { |
||||
|
exportLoading.value = false |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 导入 */ |
||||
|
const importFormRef = ref() |
||||
|
const handleImport = () => { |
||||
|
importFormRef.value.open() |
||||
|
} |
||||
|
// 导入附件弹窗所需的参数 |
||||
|
const importTemplateData = reactive({ |
||||
|
templateUrl: '', |
||||
|
templateTitle: '库位导入模版.xls' |
||||
|
}) |
||||
|
// 导入成功之后 |
||||
|
const importSuccess = () => { |
||||
|
getList() |
||||
|
} |
||||
|
|
||||
|
// 筛选提交 |
||||
|
const searchFormClick = (searchData) => { |
||||
|
tableObject.params = { |
||||
|
isSearch: true, |
||||
|
filters: searchData.filters |
||||
|
} |
||||
|
getList() // 刷新当前列表 |
||||
|
} |
||||
|
|
||||
|
/** 初始化 **/ |
||||
|
onMounted(async() => { |
||||
|
getList() |
||||
|
importTemplateData.templateUrl = await LocationApi.importTemplate() |
||||
|
}) |
||||
|
</script> |
@ -0,0 +1,377 @@ |
|||||
|
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
||||
|
import { dateFormatter } from '@/utils/formatTime' |
||||
|
|
||||
|
// import * as AreaApi from '@/api/wms/areabasic'
|
||||
|
// import { Area } from '@/views/wms/basicDataManage/factoryModeling/areabasic/areabasic.data'
|
||||
|
|
||||
|
import * as WarehouseApi from '@/api/spc/warehouse' |
||||
|
import { Warehouse } from '@/views/spc/warehouse/warehouse.data' |
||||
|
|
||||
|
import * as LocationgroupApi from '@/api/spc/locationgroup' |
||||
|
import { Locationgroup } from '@/views/spc/locationgroup/locationgroup.data' |
||||
|
const { t } = useI18n() // 国际化
|
||||
|
|
||||
|
/** |
||||
|
* @returns {Array} 库位 |
||||
|
*/ |
||||
|
export const Location = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: '代码', |
||||
|
field: 'code', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150, |
||||
|
fixed: 'left' |
||||
|
}, |
||||
|
isSearch: true |
||||
|
}, |
||||
|
{ |
||||
|
label: '名称', |
||||
|
field: 'name', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '仓库代码', |
||||
|
field: 'warehouseCode', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
form: { |
||||
|
// labelMessage: '信息提示说明!!!',
|
||||
|
componentProps: { |
||||
|
isSearchList: true, // 开启查询弹窗
|
||||
|
searchListPlaceholder: '请选择仓库代码', // 输入框占位文本
|
||||
|
searchField: 'code', // 查询弹窗赋值字段
|
||||
|
searchTitle: '仓库信息', // 查询弹窗标题
|
||||
|
searchAllSchemas: Warehouse.allSchemas, // 查询弹窗所需类
|
||||
|
searchPage: WarehouseApi.getWarehousePage // 查询弹窗所需分页方法
|
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '库区代码', |
||||
|
field: 'areaCode', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
form: { |
||||
|
// labelMessage: '信息提示说明!!!',
|
||||
|
componentProps: { |
||||
|
isSearchList: true, // 开启查询弹窗
|
||||
|
searchListPlaceholder: '请选择库区代码', // 输入框占位文本
|
||||
|
searchField: 'code', // 查询弹窗赋值字段
|
||||
|
searchTitle: '库区信息', // 查询弹窗标题
|
||||
|
// searchAllSchemas: Area.allSchemas, // 查询弹窗所需类
|
||||
|
// searchPage: AreaApi.getAreaPage // 查询弹窗所需分页方法
|
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '库位组代码', |
||||
|
field: 'locationGroupCode', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
form: { |
||||
|
// labelMessage: '信息提示说明!!!',
|
||||
|
componentProps: { |
||||
|
isSearchList: true, // 开启查询弹窗
|
||||
|
searchListPlaceholder: '请选择库区代码', // 输入框占位文本
|
||||
|
searchField: 'code', // 查询弹窗赋值字段
|
||||
|
searchTitle: '库区信息', // 查询弹窗标题
|
||||
|
searchAllSchemas: Locationgroup.allSchemas, // 查询弹窗所需类
|
||||
|
searchPage: LocationgroupApi.getLocationgroupPage // 查询弹窗所需分页方法
|
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: 'ERP库位代码', |
||||
|
field: 'erpLocationCode', |
||||
|
dictType: DICT_TYPE.ERP_LOCATION, |
||||
|
dictClass: 'string', |
||||
|
isSearch: true, |
||||
|
isTable: true, |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '类型', |
||||
|
field: 'type', |
||||
|
dictType: DICT_TYPE.LOCATION_TYPE, |
||||
|
dictClass: 'string', |
||||
|
isSearch: true, |
||||
|
isTable: true, |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '巷道', |
||||
|
field: 'aisle', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '货架', |
||||
|
field: 'shelf', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '行', |
||||
|
field: 'locationRow', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
componentProps: { |
||||
|
min: 1, |
||||
|
precision: 6 |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '列', |
||||
|
field: 'locationColum', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
componentProps: { |
||||
|
min: 1, |
||||
|
precision: 6 |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '拣料优先级', |
||||
|
field: 'pickPriority', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
componentProps: { |
||||
|
min: 1, |
||||
|
precision: 6 |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '最大承重', |
||||
|
field: 'maxWeight', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
componentProps: { |
||||
|
min: 1, |
||||
|
precision: 6 |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '最大面积', |
||||
|
field: 'maxArea', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
componentProps: { |
||||
|
min: 1, |
||||
|
precision: 6 |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '最大体积', |
||||
|
field: 'maxVolume', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
componentProps: { |
||||
|
min: 1, |
||||
|
precision: 6 |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '用户组代码', |
||||
|
field: 'userGroupCode', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '是否可用', |
||||
|
field: 'available', |
||||
|
dictType: DICT_TYPE.TRUE_FALSE, |
||||
|
dictClass: 'string', |
||||
|
isTable: true, |
||||
|
isSearch: true, |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'Switch', |
||||
|
value: 'TRUE', |
||||
|
componentProps: { |
||||
|
inactiveValue: 'FALSE', |
||||
|
activeValue: 'TRUE' |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '生效时间', |
||||
|
field: 'activeTime', |
||||
|
isTable: true, |
||||
|
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', |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '失效时间', |
||||
|
field: 'expireTime', |
||||
|
isTable: true, |
||||
|
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', |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '备注', |
||||
|
field: 'remark', |
||||
|
sort: 'custom', |
||||
|
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', |
||||
|
} |
||||
|
}, |
||||
|
isForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建者', |
||||
|
field: 'creator', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
isForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作', |
||||
|
field: 'action', |
||||
|
isDetail: false, |
||||
|
isForm: false , |
||||
|
table: { |
||||
|
width: 150, |
||||
|
fixed: 'right' |
||||
|
} |
||||
|
} |
||||
|
])) |
||||
|
|
||||
|
//表单校验
|
||||
|
export const LocationRules = reactive({ |
||||
|
code: [ |
||||
|
{ required: true, message: '请输入代码', trigger: 'blur' } |
||||
|
], |
||||
|
warehouseCode: [ |
||||
|
{ required: true, message: '请输入仓库代码', trigger: 'change' } |
||||
|
], |
||||
|
areaCode: [ |
||||
|
{ required: true, message: '请输入库区代码', trigger: 'change' } |
||||
|
], |
||||
|
locationGroupCode: [ |
||||
|
{ required: true, message: '请输入库位组代码', trigger: 'change' } |
||||
|
], |
||||
|
erpLocationCode: [ |
||||
|
{ required: true, message: '请选择ERP库位代码', trigger: 'change' } |
||||
|
], |
||||
|
type: [ |
||||
|
{ required: true, message: '请选择类型', trigger: 'change' } |
||||
|
], |
||||
|
pickPriority: [ |
||||
|
{ required: true, message: '请输入拣料优先级', trigger: 'blur' } |
||||
|
], |
||||
|
userGroupCode: [ |
||||
|
{ required: true, message: '请输入用户组代码', trigger: 'blur' } |
||||
|
], |
||||
|
available: [ |
||||
|
{ required: true, message: '请选择是否可用', trigger: 'change' } |
||||
|
], |
||||
|
}) |
@ -0,0 +1,221 @@ |
|||||
|
<template> |
||||
|
<ContentWrap> |
||||
|
<!-- 搜索工作栏 --> |
||||
|
<Search :schema="Locationgroup.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 列表头部 --> |
||||
|
<TableHead |
||||
|
:HeadButttondata="HeadButttondata" |
||||
|
@button-base-click="buttonBaseClick" |
||||
|
:route-name="routeName" |
||||
|
@updataTableColumns="updataTableColumns" |
||||
|
@searchFormClick="searchFormClick" |
||||
|
:allSchemas="Locationgroup.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 #code="{row}"> |
||||
|
<el-button type="primary" link @click="openDetail(row, '代码', row.code)"> |
||||
|
<span>{{ row.code }}</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="LocationgroupRules" |
||||
|
:formAllSchemas="Locationgroup.allSchemas" |
||||
|
:apiUpdate="LocationgroupApi.updateLocationgroup" |
||||
|
:apiCreate="LocationgroupApi.createLocationgroup" |
||||
|
@searchTableSuccess="searchTableSuccess" |
||||
|
:isBusiness="false" |
||||
|
/> |
||||
|
|
||||
|
<!-- 详情 --> |
||||
|
<Detail ref="detailRef" :isBasic="true" :allSchemas="Locationgroup.allSchemas" /> |
||||
|
|
||||
|
<!-- 导入 --> |
||||
|
<ImportForm ref="importFormRef" url="/wms/locationgroup/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import download from '@/utils/download' |
||||
|
import * as LocationgroupApi from '@/api/wms/locationgroup' |
||||
|
import BasicForm from '@/components/BasicForm/src/BasicForm.vue' |
||||
|
import { Locationgroup, LocationgroupRules } from './locationgroup.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' |
||||
|
|
||||
|
defineOptions({ name: 'Locationgroup' }) |
||||
|
|
||||
|
const message = useMessage() // 消息弹窗 |
||||
|
const { t } = useI18n() // 国际化 |
||||
|
|
||||
|
const route = useRoute() //路由信息 |
||||
|
const routeName = ref() |
||||
|
routeName.value = route.name |
||||
|
const tableColumns = ref(Locationgroup.allSchemas.tableColumns) |
||||
|
|
||||
|
//字段设置 更新主列表字段 |
||||
|
const updataTableColumns = (val) => { |
||||
|
tableColumns.value = val |
||||
|
} |
||||
|
|
||||
|
const { tableObject, tableMethods } = useTable({ |
||||
|
getListApi: LocationgroupApi.getLocationgroupPage // 分页接口 |
||||
|
}) |
||||
|
|
||||
|
// 获得表格的各种操作 |
||||
|
const { getList, setSearchParams } = tableMethods |
||||
|
|
||||
|
// 列表头部按钮 |
||||
|
const HeadButttondata = [ |
||||
|
defaultButtons.defaultAddBtn({hasPermi:'wms:locationgroup:create'}), // 新增 |
||||
|
defaultButtons.defaultImportBtn({hasPermi:'wms:locationgroup:import'}), // 导入 |
||||
|
defaultButtons.defaultExportBtn({hasPermi:'wms:locationgroup: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 butttondata = [ |
||||
|
defaultButtons.mainListEditBtn({hasPermi:'wms:locationgroup:update'}), // 编辑 |
||||
|
defaultButtons.mainListDeleteBtn({hasPermi:'wms:locationgroup:delete'}), // 删除 |
||||
|
] |
||||
|
|
||||
|
// 列表-操作按钮事件 |
||||
|
const buttonTableClick = async (val, row) => { |
||||
|
if (val == 'edit') { // 编辑 |
||||
|
// const res = await LocationgroupApi.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 searchTableSuccess = (formField, searchField, val, formRef) => { |
||||
|
nextTick(() => { |
||||
|
const setV = {} |
||||
|
setV[formField] = val[0][searchField] |
||||
|
formRef.setValues(setV) |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
/** 详情操作 */ |
||||
|
const detailRef = ref() |
||||
|
const openDetail = (row: any, titleName: any, titleValue: any) => { |
||||
|
detailRef.value.openDetail(row, titleName, titleValue, 'basicLocationgroup') |
||||
|
} |
||||
|
|
||||
|
/** 删除按钮操作 */ |
||||
|
const handleDelete = async (id: number) => { |
||||
|
try { |
||||
|
// 删除的二次确认 |
||||
|
await message.delConfirm() |
||||
|
// 发起删除 |
||||
|
await LocationgroupApi.deleteLocationgroup(id) |
||||
|
message.success(t('common.delSuccess')) |
||||
|
// 刷新列表 |
||||
|
await getList() |
||||
|
} catch {} |
||||
|
} |
||||
|
|
||||
|
/** 导出按钮操作 */ |
||||
|
const exportLoading = ref(false) // 导出的加载中 |
||||
|
const handleExport = async () => { |
||||
|
try { |
||||
|
// 导出的二次确认 |
||||
|
await message.exportConfirm() |
||||
|
// 发起导出 |
||||
|
exportLoading.value = true |
||||
|
const data = await LocationgroupApi.exportLocationgroup(setSearchParams) |
||||
|
download.excel(data, '库位组.xls') |
||||
|
} catch { |
||||
|
} finally { |
||||
|
exportLoading.value = false |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 导入 */ |
||||
|
const importFormRef = ref() |
||||
|
const handleImport = () => { |
||||
|
importFormRef.value.open() |
||||
|
} |
||||
|
// 导入附件弹窗所需的参数 |
||||
|
const importTemplateData = reactive({ |
||||
|
templateUrl: '', |
||||
|
templateTitle: '库位组导入模版.xls' |
||||
|
}) |
||||
|
// 导入成功之后 |
||||
|
const importSuccess = () => { |
||||
|
getList() |
||||
|
} |
||||
|
|
||||
|
// 筛选提交 |
||||
|
const searchFormClick = (searchData) => { |
||||
|
tableObject.params = { |
||||
|
isSearch: true, |
||||
|
filters: searchData.filters |
||||
|
} |
||||
|
getList() // 刷新当前列表 |
||||
|
} |
||||
|
|
||||
|
/** 初始化 **/ |
||||
|
onMounted(async() => { |
||||
|
getList() |
||||
|
importTemplateData.templateUrl = await LocationgroupApi.importTemplate() |
||||
|
}) |
||||
|
</script> |
@ -0,0 +1,205 @@ |
|||||
|
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
||||
|
import { dateFormatter } from '@/utils/formatTime' |
||||
|
|
||||
|
// import * as AreaApi from '@/api/wms/areabasic'
|
||||
|
// import { Area } from '@/views/wms/basicDataManage/factoryModeling/areabasic/areabasic.data'
|
||||
|
|
||||
|
import * as WarehouseApi from '@/api/spc/warehouse' |
||||
|
import { Warehouse } from '@/views/spc/warehouse/warehouse.data' |
||||
|
|
||||
|
const { t } = useI18n() // 国际化
|
||||
|
|
||||
|
/** |
||||
|
* @returns {Array} 库位组 |
||||
|
*/ |
||||
|
export const Locationgroup = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: '代码', |
||||
|
field: 'code', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150, |
||||
|
fixed: 'left' |
||||
|
}, |
||||
|
isSearch: true |
||||
|
}, |
||||
|
{ |
||||
|
label: '名称', |
||||
|
field: 'name', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '仓库代码', |
||||
|
field: 'warehouseCode', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
isSearch: true, |
||||
|
form: { |
||||
|
// labelMessage: '信息提示说明!!!',
|
||||
|
componentProps: { |
||||
|
isSearchList: true, // 开启查询弹窗
|
||||
|
searchListPlaceholder: '请选择仓库代码', // 输入框占位文本
|
||||
|
searchField: 'code', // 查询弹窗赋值字段
|
||||
|
searchTitle: '仓库信息', // 查询弹窗标题
|
||||
|
searchAllSchemas: Warehouse.allSchemas, // 查询弹窗所需类
|
||||
|
searchPage: WarehouseApi.getWarehousePage // 查询弹窗所需分页方法
|
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '库区代码', |
||||
|
field: 'areaCode', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
form: { |
||||
|
// labelMessage: '信息提示说明!!!',
|
||||
|
componentProps: { |
||||
|
isSearchList: true, // 开启查询弹窗
|
||||
|
searchListPlaceholder: '请选择库区代码', // 输入框占位文本
|
||||
|
searchField: 'code', // 查询弹窗赋值字段
|
||||
|
searchTitle: '库区信息', // 查询弹窗标题
|
||||
|
searchAllSchemas: Area.allSchemas, // 查询弹窗所需类
|
||||
|
searchPage: AreaApi.getAreaPage // 查询弹窗所需分页方法
|
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '是否可用', |
||||
|
field: 'available', |
||||
|
dictType: DICT_TYPE.TRUE_FALSE, |
||||
|
dictClass: 'string', |
||||
|
isTable: true, |
||||
|
isSearch: true, |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'Switch', |
||||
|
value: 'TRUE', |
||||
|
componentProps: { |
||||
|
inactiveValue: 'FALSE', |
||||
|
activeValue: 'TRUE' |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '生效时间', |
||||
|
field: 'activeTime', |
||||
|
isTable: true, |
||||
|
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', |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '失效时间', |
||||
|
field: 'expireTime', |
||||
|
isTable: true, |
||||
|
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', |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '备注', |
||||
|
field: 'remark', |
||||
|
sort: 'custom', |
||||
|
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', |
||||
|
} |
||||
|
}, |
||||
|
isForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建者', |
||||
|
field: 'creator', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
isForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作', |
||||
|
field: 'action', |
||||
|
isDetail: false, |
||||
|
isForm: false , |
||||
|
table: { |
||||
|
width: 150, |
||||
|
fixed: 'right' |
||||
|
} |
||||
|
} |
||||
|
])) |
||||
|
|
||||
|
//表单校验
|
||||
|
export const LocationgroupRules = reactive({ |
||||
|
code: [ |
||||
|
{ required: true, message: '请输入代码', trigger: 'blur' } |
||||
|
], |
||||
|
warehouseCode: [ |
||||
|
{ required: true, message: '请输入仓库代码', trigger: 'change' } |
||||
|
], |
||||
|
areaCode: [ |
||||
|
{ required: true, message: '请输入库区代码', trigger: 'change' } |
||||
|
], |
||||
|
available: [ |
||||
|
{ required: true, message: '请选择是否可用', trigger: 'change' } |
||||
|
], |
||||
|
}) |
@ -0,0 +1,207 @@ |
|||||
|
<template> |
||||
|
<ContentWrap> |
||||
|
<!-- 搜索工作栏 --> |
||||
|
<Search :schema="Supplier.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 列表头部 --> |
||||
|
<TableHead |
||||
|
:HeadButttondata="HeadButttondata" |
||||
|
@button-base-click="buttonBaseClick" |
||||
|
:route-name="routeName" |
||||
|
@updataTableColumns="updataTableColumns" |
||||
|
@searchFormClick="searchFormClick" |
||||
|
:allSchemas="Supplier.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 #code="{row}"> |
||||
|
<el-button type="primary" link @click="openDetail(row, '代码', row.code)"> |
||||
|
<span>{{ row.code }}</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="SupplierRules" |
||||
|
:formAllSchemas="Supplier.allSchemas" |
||||
|
:apiUpdate="SupplierApi.updateSupplier" |
||||
|
:apiCreate="SupplierApi.createSupplier" |
||||
|
:isBusiness="false" |
||||
|
/> |
||||
|
|
||||
|
<!-- 详情 --> |
||||
|
<!-- <Detail ref="detailRef" :isBasic="true" :allSchemas="Supplier.allSchemas" /> --> |
||||
|
|
||||
|
<!-- 导入 --> |
||||
|
<!-- <ImportForm ref="importFormRef" url="/wms/supplier/import" :importTemplateData="importTemplateData" @success="importSuccess" /> --> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import download from '@/utils/download' |
||||
|
import * as SupplierApi from '@/api/spc/supplier' |
||||
|
import { Supplier, SupplierRules } from './supplier.data' |
||||
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
||||
|
|
||||
|
defineOptions({ name: 'Supplier' }) |
||||
|
|
||||
|
const message = useMessage() // 消息弹窗 |
||||
|
const { t } = useI18n() // 国际化 |
||||
|
|
||||
|
const route = useRoute() //路由信息 |
||||
|
const routeName = ref() |
||||
|
routeName.value = route.name |
||||
|
const tableColumns = ref(Supplier.allSchemas.tableColumns) |
||||
|
|
||||
|
//字段设置 更新主列表字段 |
||||
|
const updataTableColumns = (val) => { |
||||
|
tableColumns.value = val |
||||
|
} |
||||
|
|
||||
|
const { tableObject, tableMethods } = useTable({ |
||||
|
getListApi: SupplierApi.getSupplierPage // 分页接口 |
||||
|
}) |
||||
|
|
||||
|
// 获得表格的各种操作 |
||||
|
const { getList, setSearchParams } = tableMethods |
||||
|
|
||||
|
// 列表头部按钮 |
||||
|
const HeadButttondata = [ |
||||
|
defaultButtons.defaultAddBtn(null), // 新增 |
||||
|
// defaultButtons.defaultImportBtn({hasPermi:'wms:supplier:import'}), // 导入 |
||||
|
// defaultButtons.defaultExportBtn({hasPermi:'wms:supplier: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 butttondata = [ |
||||
|
defaultButtons.mainListEditBtn(null), // 编辑 |
||||
|
defaultButtons.mainListDeleteBtn(null), // 删除 |
||||
|
] |
||||
|
|
||||
|
// 列表-操作按钮事件 |
||||
|
const buttonTableClick = async (val, row) => { |
||||
|
if (val == 'edit') { // 编辑 |
||||
|
// const res = await SupplierApi.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 openDetail = (row: any, titleName: any, titleValue: any) => { |
||||
|
detailRef.value.openDetail(row, titleName, titleValue, 'basicSupplier') |
||||
|
} |
||||
|
|
||||
|
/** 删除按钮操作 */ |
||||
|
const handleDelete = async (id: number) => { |
||||
|
try { |
||||
|
// 删除的二次确认 |
||||
|
await message.delConfirm() |
||||
|
// 发起删除 |
||||
|
await SupplierApi.deleteSupplier(id) |
||||
|
message.success(t('common.delSuccess')) |
||||
|
// 刷新列表 |
||||
|
await getList() |
||||
|
} catch {} |
||||
|
} |
||||
|
|
||||
|
/** 导出按钮操作 */ |
||||
|
const exportLoading = ref(false) // 导出的加载中 |
||||
|
const handleExport = async () => { |
||||
|
try { |
||||
|
// 导出的二次确认 |
||||
|
await message.exportConfirm() |
||||
|
// 发起导出 |
||||
|
exportLoading.value = true |
||||
|
const data = await SupplierApi.exportSupplier(setSearchParams) |
||||
|
download.excel(data, '供应商.xls') |
||||
|
} catch { |
||||
|
} finally { |
||||
|
exportLoading.value = false |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 导入 */ |
||||
|
const importFormRef = ref() |
||||
|
const handleImport = () => { |
||||
|
importFormRef.value.open() |
||||
|
} |
||||
|
// 导入附件弹窗所需的参数 |
||||
|
const importTemplateData = reactive({ |
||||
|
templateUrl: '', |
||||
|
templateTitle: '供应商导入模版.xls' |
||||
|
}) |
||||
|
// 导入成功之后 |
||||
|
const importSuccess = () => { |
||||
|
getList() |
||||
|
} |
||||
|
|
||||
|
// 筛选提交 |
||||
|
const searchFormClick = (searchData) => { |
||||
|
tableObject.params = { |
||||
|
isSearch: true, |
||||
|
filters: searchData.filters |
||||
|
} |
||||
|
getList() // 刷新当前列表 |
||||
|
} |
||||
|
|
||||
|
/** 初始化 **/ |
||||
|
onMounted(async() => { |
||||
|
getList() |
||||
|
importTemplateData.templateUrl = await SupplierApi.importTemplate() |
||||
|
}) |
||||
|
</script> |
@ -0,0 +1,261 @@ |
|||||
|
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
||||
|
import { dateFormatter } from '@/utils/formatTime' |
||||
|
const { t } = useI18n() // 国际化
|
||||
|
|
||||
|
/** |
||||
|
* @returns {Array} 供应商 |
||||
|
*/ |
||||
|
export const Supplier = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: '代码', |
||||
|
field: 'code', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
table: { |
||||
|
width: 150, |
||||
|
fixed: 'left' |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '名称', |
||||
|
field: 'name', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '简称', |
||||
|
field: 'shortName', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '地址', |
||||
|
field: 'address', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '国家', |
||||
|
field: 'country', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '城市', |
||||
|
field: 'city', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '电话', |
||||
|
field: 'phone', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '传真', |
||||
|
field: 'fax', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '邮编', |
||||
|
field: 'postId', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '联系人', |
||||
|
field: 'contacts', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label:'银行', |
||||
|
field: 'bank', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '币种', |
||||
|
field: 'currency', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.CURRENCY, |
||||
|
dictClass: 'string', |
||||
|
isSearch: true, |
||||
|
isTable: true, |
||||
|
table: { |
||||
|
width: 150 |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '税率', |
||||
|
field: 'taxRate', |
||||
|
sort: 'custom', |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
componentProps: { |
||||
|
min: 0 |
||||
|
} |
||||
|
}, |
||||
|
table: { |
||||
|
width: 150 |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '类型', |
||||
|
field: 'type', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.SUPPLIER_TYPE, |
||||
|
dictClass: 'string', |
||||
|
isSearch: true, |
||||
|
isTable: true, |
||||
|
table: { |
||||
|
width: 150 |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '是否可用', |
||||
|
field: 'available', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.TRUE_FALSE, |
||||
|
dictClass: 'string', |
||||
|
isSearch: true, |
||||
|
isTable: true, |
||||
|
form: { |
||||
|
component: 'Switch', |
||||
|
value: 'TRUE', |
||||
|
componentProps: { |
||||
|
inactiveValue: 'FALSE', |
||||
|
activeValue: 'TRUE' |
||||
|
} |
||||
|
}, |
||||
|
table: { |
||||
|
width: 150 |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '生效时间', |
||||
|
field: 'activeTime', |
||||
|
sort: 'custom', |
||||
|
isTable: true, |
||||
|
formatter: dateFormatter, |
||||
|
detail: { |
||||
|
dateFormat: 'YYYY-MM-DD HH:mm:ss' |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
style: {width:'100%'}, |
||||
|
type: 'datetime', |
||||
|
dateFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
valueFormat: 'x', |
||||
|
} |
||||
|
}, |
||||
|
table: { |
||||
|
width: 180 |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '失效时间', |
||||
|
field: 'expireTime', |
||||
|
sort: 'custom', |
||||
|
isTable: true, |
||||
|
formatter: dateFormatter, |
||||
|
detail: { |
||||
|
dateFormat: 'YYYY-MM-DD HH:mm:ss' |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
style: {width:'100%'}, |
||||
|
type: 'datetime', |
||||
|
dateFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
valueFormat: 'x', |
||||
|
} |
||||
|
}, |
||||
|
table: { |
||||
|
width: 180 |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '备注', |
||||
|
field: 'remark', |
||||
|
sort: 'custom', |
||||
|
isTable: false, |
||||
|
isForm: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建时间', |
||||
|
field: 'createTime', |
||||
|
sort: 'custom', |
||||
|
isTable: false, |
||||
|
isForm: false, |
||||
|
formatter: dateFormatter, |
||||
|
detail: { |
||||
|
dateFormat: 'YYYY-MM-DD HH:mm:ss' |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
style: {width:'100%'}, |
||||
|
type: 'datetime', |
||||
|
dateFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
valueFormat: 'x', |
||||
|
} |
||||
|
}, |
||||
|
table: { |
||||
|
width: 180 |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建者', |
||||
|
field: 'creator', |
||||
|
sort: 'custom', |
||||
|
isTable: false, |
||||
|
isForm: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作', |
||||
|
field: 'action', |
||||
|
isDetail: false, |
||||
|
isForm: false , |
||||
|
table: { |
||||
|
width: 150, |
||||
|
fixed: 'right' |
||||
|
} |
||||
|
} |
||||
|
])) |
||||
|
|
||||
|
//表单校验
|
||||
|
export const SupplierRules = reactive({ |
||||
|
code: [ |
||||
|
{ required: true, message: '请输入代码', trigger: 'blur' } |
||||
|
], |
||||
|
shortName: [ |
||||
|
{ required: true, message: '请输入简称', trigger: 'blur' } |
||||
|
], |
||||
|
available: [ |
||||
|
{ required: true, message: '请选择是否可用', trigger: 'change' } |
||||
|
], |
||||
|
}) |
@ -0,0 +1,221 @@ |
|||||
|
<template> |
||||
|
<ContentWrap> |
||||
|
<!-- 搜索工作栏 --> |
||||
|
<Search :schema="Supplieritem.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 列表头部 --> |
||||
|
<TableHead |
||||
|
:HeadButttondata="HeadButttondata" |
||||
|
@button-base-click="buttonBaseClick" |
||||
|
:route-name="routeName" |
||||
|
@updataTableColumns="updataTableColumns" |
||||
|
@searchFormClick="searchFormClick" |
||||
|
:allSchemas="Supplieritem.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 #supplierCode="{row}"> |
||||
|
<el-button type="primary" link @click="openDetail(row, '供应商代码', row.supplierCode)"> |
||||
|
<span>{{ row.supplierCode }}</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="SupplieritemRules" |
||||
|
:formAllSchemas="Supplieritem.allSchemas" |
||||
|
:apiUpdate="SupplieritemApi.updateSupplieritem" |
||||
|
:apiCreate="SupplieritemApi.createSupplieritem" |
||||
|
@searchTableSuccess="searchTableSuccess" |
||||
|
:isBusiness="false" |
||||
|
/> |
||||
|
|
||||
|
<!-- 详情 --> |
||||
|
<!-- <Detail ref="detailRef" :isBasic="true" :allSchemas="Supplieritem.allSchemas" /> --> |
||||
|
|
||||
|
<!-- 导入 --> |
||||
|
<!-- <ImportForm ref="importFormRef" url="/wms/supplieritem/import" :importTemplateData="importTemplateData" @success="importSuccess" /> --> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import download from '@/utils/download' |
||||
|
import * as SupplieritemApi from '@/api/spc/supplieritem' |
||||
|
// import BasicForm from '@/components/BasicForm/src/BasicForm.vue' |
||||
|
import { Supplieritem, SupplieritemRules } from './supplieritem.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' |
||||
|
|
||||
|
defineOptions({ name: 'Supplieritem' }) |
||||
|
|
||||
|
const message = useMessage() // 消息弹窗 |
||||
|
const { t } = useI18n() // 国际化 |
||||
|
|
||||
|
const route = useRoute() //路由信息 |
||||
|
const routeName = ref() |
||||
|
routeName.value = route.name |
||||
|
const tableColumns = ref(Supplieritem.allSchemas.tableColumns) |
||||
|
|
||||
|
//字段设置 更新主列表字段 |
||||
|
const updataTableColumns = (val) => { |
||||
|
tableColumns.value = val |
||||
|
} |
||||
|
|
||||
|
const { tableObject, tableMethods } = useTable({ |
||||
|
getListApi: SupplieritemApi.getSupplieritemPage // 分页接口 |
||||
|
}) |
||||
|
|
||||
|
// 获得表格的各种操作 |
||||
|
const { getList, setSearchParams } = tableMethods |
||||
|
|
||||
|
// 列表头部按钮 |
||||
|
const HeadButttondata = [ |
||||
|
defaultButtons.defaultAddBtn(null), // 新增 |
||||
|
defaultButtons.defaultImportBtn(null), // 导入 |
||||
|
defaultButtons.defaultExportBtn(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') { // 刷新 |
||||
|
getList() |
||||
|
} else if (val == 'filtrate') { // 筛选 |
||||
|
} else { // 其他按钮 |
||||
|
console.log('其他按钮', item) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 列表-操作按钮 |
||||
|
const butttondata = [ |
||||
|
defaultButtons.mainListEditBtn(null), // 编辑 |
||||
|
defaultButtons.mainListDeleteBtn(null), // 删除 |
||||
|
] |
||||
|
|
||||
|
// 列表-操作按钮事件 |
||||
|
const buttonTableClick = async (val, row) => { |
||||
|
if (val == 'edit') { // 编辑 |
||||
|
// const res = await SupplieritemApi.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 searchTableSuccess = (formField, searchField, val, formRef) => { |
||||
|
nextTick(() => { |
||||
|
const setV = {} |
||||
|
setV[formField] = val[0][searchField] |
||||
|
formRef.setValues(setV) |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
/** 详情操作 */ |
||||
|
// const detailRef = ref() |
||||
|
// const openDetail = (row: any, titleName: any, titleValue: any) => { |
||||
|
// detailRef.value.openDetail(row, titleName, titleValue, 'basicSupplieritem') |
||||
|
// } |
||||
|
|
||||
|
/** 删除按钮操作 */ |
||||
|
const handleDelete = async (id: number) => { |
||||
|
try { |
||||
|
// 删除的二次确认 |
||||
|
await message.delConfirm() |
||||
|
// 发起删除 |
||||
|
await SupplieritemApi.deleteSupplieritem(id) |
||||
|
message.success(t('common.delSuccess')) |
||||
|
// 刷新列表 |
||||
|
await getList() |
||||
|
} catch {} |
||||
|
} |
||||
|
|
||||
|
/** 导出按钮操作 */ |
||||
|
const exportLoading = ref(false) // 导出的加载中 |
||||
|
const handleExport = async () => { |
||||
|
try { |
||||
|
// 导出的二次确认 |
||||
|
await message.exportConfirm() |
||||
|
// 发起导出 |
||||
|
exportLoading.value = true |
||||
|
const data = await SupplieritemApi.exportSupplieritem(setSearchParams) |
||||
|
download.excel(data, '供应商物品.xls') |
||||
|
} catch { |
||||
|
} finally { |
||||
|
exportLoading.value = false |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 导入 */ |
||||
|
const importFormRef = ref() |
||||
|
const handleImport = () => { |
||||
|
importFormRef.value.open() |
||||
|
} |
||||
|
// 导入附件弹窗所需的参数 |
||||
|
const importTemplateData = reactive({ |
||||
|
templateUrl: '', |
||||
|
templateTitle: '供应商物品导入模版.xls' |
||||
|
}) |
||||
|
// 导入成功之后 |
||||
|
const importSuccess = () => { |
||||
|
getList() |
||||
|
} |
||||
|
|
||||
|
// 筛选提交 |
||||
|
const searchFormClick = (searchData) => { |
||||
|
tableObject.params = { |
||||
|
isSearch: true, |
||||
|
filters: searchData.filters |
||||
|
} |
||||
|
getList() // 刷新当前列表 |
||||
|
} |
||||
|
|
||||
|
/** 初始化 **/ |
||||
|
onMounted(async() => { |
||||
|
getList() |
||||
|
importTemplateData.templateUrl = await SupplieritemApi.importTemplate() |
||||
|
}) |
||||
|
</script> |
@ -0,0 +1,350 @@ |
|||||
|
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
||||
|
import { dateFormatter } from '@/utils/formatTime' |
||||
|
|
||||
|
import * as ItembasicApi from '@/api/spc/itembasic' |
||||
|
import { Itembasic } from '@/views/spc/itembasic/itembasic.data' |
||||
|
|
||||
|
import * as SupplierApi from '@/api/spc/supplier' |
||||
|
import { Supplier } from '@/views/spc/supplier/supplier.data' |
||||
|
|
||||
|
// import * as WarehouseApi from '@/api/spc/warehouse'
|
||||
|
// import { Warehouse } from '@/views/spc/warehouse/warehouse.data'
|
||||
|
|
||||
|
// import * as LocationApi from '@/api/spc/location'
|
||||
|
// import { Location } from '@/views/spc/location/location.data'
|
||||
|
|
||||
|
const { t } = useI18n() // 国际化
|
||||
|
|
||||
|
/** |
||||
|
* @returns {Array} 供应商物品 |
||||
|
*/ |
||||
|
export const Supplieritem = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: '供应商代码', |
||||
|
field: 'supplierCode', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150, |
||||
|
fixed: 'left' |
||||
|
}, |
||||
|
form: { |
||||
|
// labelMessage: '信息提示说明!!!',
|
||||
|
componentProps: { |
||||
|
isSearchList: true, // 开启查询弹窗
|
||||
|
searchListPlaceholder: '请选择供应商代码', // 输入框占位文本
|
||||
|
searchField: 'code', // 查询弹窗赋值字段
|
||||
|
searchTitle: '供应商信息', // 查询弹窗标题
|
||||
|
searchAllSchemas: Supplier.allSchemas, // 查询弹窗所需类
|
||||
|
searchPage: SupplierApi.getSupplierPage // 查询弹窗所需分页方法
|
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '物料代码', |
||||
|
field: 'itemCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
form: { |
||||
|
// labelMessage: '信息提示说明!!!',
|
||||
|
componentProps: { |
||||
|
isSearchList: true, // 开启查询弹窗
|
||||
|
searchListPlaceholder: '请选择物品代码', // 输入框占位文本
|
||||
|
searchField: 'code', // 查询弹窗赋值字段
|
||||
|
searchTitle: '物品基础信息', // 查询弹窗标题
|
||||
|
searchAllSchemas: Itembasic.allSchemas, // 查询弹窗所需类
|
||||
|
searchPage: ItembasicApi.getItembasicPage // 查询弹窗所需分页方法
|
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '供应商物料代码', |
||||
|
field: 'supplierItemCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
table: { |
||||
|
width: 150 |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '供应商计量单位', |
||||
|
field: 'supplierUom', |
||||
|
dictType: DICT_TYPE.UOM, |
||||
|
dictClass: 'string', |
||||
|
isTable: true, |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '转换率', |
||||
|
field: 'convertRate', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
componentProps: { |
||||
|
min: 0 |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '供应商包装单位', |
||||
|
field: 'packUnit', |
||||
|
dictType: DICT_TYPE.PACK_UNIT, |
||||
|
dictClass: 'string', |
||||
|
isTable: true, |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '供应商包装量', |
||||
|
field: 'packQty', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
componentProps: { |
||||
|
min: 1, |
||||
|
precision: 6 |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '供应商替代包装单位', |
||||
|
field: 'altPackUnit', |
||||
|
dictType: DICT_TYPE.PACK_UNIT, |
||||
|
dictClass: 'string', |
||||
|
isTable: true, |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '供应商替代包装量', |
||||
|
field: 'altPackQty', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
componentProps: { |
||||
|
min: 0, |
||||
|
precision: 6 |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '每器具包装数', |
||||
|
field: 'packQtyOfContainer', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
componentProps: { |
||||
|
min: 0, |
||||
|
precision: 6 |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
// {
|
||||
|
// label: '默认收货仓库',
|
||||
|
// field: 'defaultWarehouseCode',
|
||||
|
// sort: 'custom',
|
||||
|
// table: {
|
||||
|
// width: 150
|
||||
|
// },
|
||||
|
// form: {
|
||||
|
// // labelMessage: '信息提示说明!!!',
|
||||
|
// componentProps: {
|
||||
|
// isSearchList: true, // 开启查询弹窗
|
||||
|
// searchListPlaceholder: '请选择仓库代码', // 输入框占位文本
|
||||
|
// searchField: 'code', // 查询弹窗赋值字段
|
||||
|
// searchTitle: '仓库信息', // 查询弹窗标题
|
||||
|
// searchAllSchemas: Warehouse.allSchemas, // 查询弹窗所需类
|
||||
|
// searchPage: WarehouseApi.getWarehousePage // 查询弹窗所需分页方法
|
||||
|
// }
|
||||
|
// }
|
||||
|
// },
|
||||
|
// {
|
||||
|
// label: '默认收货库位',
|
||||
|
// field: 'defaultLocationCode',
|
||||
|
// sort: 'custom',
|
||||
|
// table: {
|
||||
|
// width: 150
|
||||
|
// },
|
||||
|
// form: {
|
||||
|
// // labelMessage: '信息提示说明!!!',
|
||||
|
// componentProps: {
|
||||
|
// isSearchList: true, // 开启查询弹窗
|
||||
|
// searchListPlaceholder: '请选择库位代码', // 输入框占位文本
|
||||
|
// searchField: 'code', // 查询弹窗赋值字段
|
||||
|
// searchTitle: '库位信息', // 查询弹窗标题
|
||||
|
// searchAllSchemas: Location.allSchemas, // 查询弹窗所需类
|
||||
|
// searchPage: LocationApi.getLocationPage // 查询弹窗所需分页方法
|
||||
|
// }
|
||||
|
// }
|
||||
|
// },
|
||||
|
{ |
||||
|
label: '结算方式', |
||||
|
field: 'settlementType', |
||||
|
dictType: DICT_TYPE.SETTLEMENT_TYPE, |
||||
|
dictClass: 'string', |
||||
|
isSearch: true, |
||||
|
isTable: true, |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '是否可用', |
||||
|
field: 'available', |
||||
|
dictType: DICT_TYPE.TRUE_FALSE, |
||||
|
dictClass: 'string', |
||||
|
isSearch: true, |
||||
|
isTable: true, |
||||
|
sort: 'custom', |
||||
|
form: { |
||||
|
component: 'Switch', |
||||
|
value: 'TRUE', |
||||
|
componentProps: { |
||||
|
inactiveValue: 'FALSE', |
||||
|
activeValue: 'TRUE' |
||||
|
} |
||||
|
}, |
||||
|
table: { |
||||
|
width: 150 |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '生效时间', |
||||
|
field: 'activeTime', |
||||
|
formatter: dateFormatter, |
||||
|
isTable: true, |
||||
|
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', |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '失效时间', |
||||
|
field: 'expireTime', |
||||
|
isTable: true, |
||||
|
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', |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '备注', |
||||
|
field: 'remark', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建时间', |
||||
|
field: 'createTime', |
||||
|
isTable: true, |
||||
|
isForm: false, |
||||
|
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', |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建者', |
||||
|
field: 'creator', |
||||
|
isTable: true, |
||||
|
isForm: false, |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作', |
||||
|
field: 'action', |
||||
|
isDetail: false, |
||||
|
isForm: false , |
||||
|
table: { |
||||
|
width: 150, |
||||
|
fixed: 'right' |
||||
|
} |
||||
|
} |
||||
|
])) |
||||
|
|
||||
|
//表单校验
|
||||
|
export const SupplieritemRules = reactive({ |
||||
|
supplierCode: [ |
||||
|
{ required: true, message: '请输入供应商代码', trigger: 'change' } |
||||
|
], |
||||
|
itemCode: [ |
||||
|
{ required: true, message: '请输入物料代码', trigger: 'change' } |
||||
|
], |
||||
|
packUnit: [ |
||||
|
{ required: true, message: '请选择供应商包装单位', trigger: 'change' } |
||||
|
], |
||||
|
packQty: [ |
||||
|
{ required: true, message: '请输入供应商包装量', trigger: 'blur' } |
||||
|
], |
||||
|
packQtyOfContainer: [ |
||||
|
{ required: true, message: '请输入每器具包装数', trigger: 'blur' } |
||||
|
], |
||||
|
available: [ |
||||
|
{ required: true, message: '请选择是否可用', trigger: 'change' } |
||||
|
], |
||||
|
}) |
@ -0,0 +1,211 @@ |
|||||
|
<template> |
||||
|
<ContentWrap> |
||||
|
<!-- 搜索工作栏 --> |
||||
|
<Search :schema="Warehouse.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 列表头部 --> |
||||
|
<TableHead |
||||
|
:HeadButttondata="HeadButttondata" |
||||
|
@button-base-click="buttonBaseClick" |
||||
|
:route-name="routeName" |
||||
|
@updataTableColumns="updataTableColumns" |
||||
|
@searchFormClick="searchFormClick" |
||||
|
:allSchemas="Warehouse.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 #code="{row}"> |
||||
|
<el-button type="primary" link @click="openDetail(row, '代码', row.code)"> |
||||
|
<span>{{ row.code }}</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="WarehouseRules" |
||||
|
:formAllSchemas="Warehouse.allSchemas" |
||||
|
:apiUpdate="WarehouseApi.updateWarehouse" |
||||
|
:apiCreate="WarehouseApi.createWarehouse" |
||||
|
:isBusiness="false" |
||||
|
/> |
||||
|
|
||||
|
<!-- 详情 --> |
||||
|
<Detail ref="detailRef" :isBasic="true" :allSchemas="Warehouse.allSchemas" /> |
||||
|
|
||||
|
<!-- 导入 --> |
||||
|
<ImportForm ref="importFormRef" url="/wms/warehouse/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import download from '@/utils/download' |
||||
|
import * as WarehouseApi from '@/api/spc/warehouse' |
||||
|
import BasicForm from '@/components/BasicForm/src/BasicForm.vue' |
||||
|
import { Warehouse, WarehouseRules } from './warehouse.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' |
||||
|
|
||||
|
defineOptions({ name: 'Warehouse' }) |
||||
|
|
||||
|
const message = useMessage() // 消息弹窗 |
||||
|
const { t } = useI18n() // 国际化 |
||||
|
|
||||
|
const route = useRoute() //路由信息 |
||||
|
const routeName = ref() |
||||
|
routeName.value = route.name |
||||
|
const tableColumns = ref(Warehouse.allSchemas.tableColumns) |
||||
|
|
||||
|
//字段设置 更新主列表字段 |
||||
|
const updataTableColumns = (val) => { |
||||
|
tableColumns.value = val |
||||
|
} |
||||
|
|
||||
|
const { tableObject, tableMethods } = useTable({ |
||||
|
getListApi: WarehouseApi.getWarehousePage // 分页接口 |
||||
|
}) |
||||
|
|
||||
|
// 获得表格的各种操作 |
||||
|
const { getList, setSearchParams } = tableMethods |
||||
|
|
||||
|
// 列表头部按钮 |
||||
|
const HeadButttondata = [ |
||||
|
defaultButtons.defaultAddBtn({hasPermi:'wms:warehouse:create'}), // 新增 |
||||
|
defaultButtons.defaultImportBtn({hasPermi:'wms:warehouse:import'}), // 导入 |
||||
|
defaultButtons.defaultExportBtn({hasPermi:'wms:warehouse: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 butttondata = [ |
||||
|
defaultButtons.mainListEditBtn({hasPermi:'wms:warehouse:update'}), // 编辑 |
||||
|
defaultButtons.mainListDeleteBtn({hasPermi:'wms:warehouse:delete'}), // 删除 |
||||
|
] |
||||
|
|
||||
|
// 列表-操作按钮事件 |
||||
|
const buttonTableClick = async (val, row) => { |
||||
|
if (val == 'edit') { // 编辑 |
||||
|
// const res = await WarehouseApi.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 openDetail = (row: any, titleName: any, titleValue: any) => { |
||||
|
detailRef.value.openDetail(row, titleName, titleValue, 'basicWarehouse') |
||||
|
} |
||||
|
|
||||
|
/** 删除按钮操作 */ |
||||
|
const handleDelete = async (id: number) => { |
||||
|
try { |
||||
|
// 删除的二次确认 |
||||
|
await message.delConfirm() |
||||
|
// 发起删除 |
||||
|
await WarehouseApi.deleteWarehouse(id) |
||||
|
message.success(t('common.delSuccess')) |
||||
|
// 刷新列表 |
||||
|
await getList() |
||||
|
} catch {} |
||||
|
} |
||||
|
|
||||
|
/** 导出按钮操作 */ |
||||
|
const exportLoading = ref(false) // 导出的加载中 |
||||
|
const handleExport = async () => { |
||||
|
try { |
||||
|
// 导出的二次确认 |
||||
|
await message.exportConfirm() |
||||
|
// 发起导出 |
||||
|
exportLoading.value = true |
||||
|
const data = await WarehouseApi.exportWarehouse(setSearchParams) |
||||
|
download.excel(data, '仓库.xls') |
||||
|
} catch { |
||||
|
} finally { |
||||
|
exportLoading.value = false |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 导入 */ |
||||
|
const importFormRef = ref() |
||||
|
const handleImport = () => { |
||||
|
importFormRef.value.open() |
||||
|
} |
||||
|
// 导入附件弹窗所需的参数 |
||||
|
const importTemplateData = reactive({ |
||||
|
templateUrl: '', |
||||
|
templateTitle: '仓库导入模版.xls' |
||||
|
}) |
||||
|
// 导入成功之后 |
||||
|
const importSuccess = () => { |
||||
|
getList() |
||||
|
} |
||||
|
|
||||
|
// 筛选提交 |
||||
|
const searchFormClick = (searchData) => { |
||||
|
tableObject.params = { |
||||
|
isSearch: true, |
||||
|
filters: searchData.filters |
||||
|
} |
||||
|
getList() // 刷新当前列表 |
||||
|
} |
||||
|
|
||||
|
/** 初始化 **/ |
||||
|
onMounted(async() => { |
||||
|
getList() |
||||
|
importTemplateData.templateUrl = await WarehouseApi.importTemplate() |
||||
|
}) |
||||
|
</script> |
@ -0,0 +1,173 @@ |
|||||
|
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
||||
|
import { dateFormatter } from '@/utils/formatTime' |
||||
|
const { t } = useI18n() // 国际化
|
||||
|
|
||||
|
/** |
||||
|
* @returns {Array} 仓库 |
||||
|
*/ |
||||
|
export const Warehouse = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: '代码', |
||||
|
field: 'code', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150, |
||||
|
fixed: 'left' |
||||
|
}, |
||||
|
isSearch: true |
||||
|
}, |
||||
|
{ |
||||
|
label: '名称', |
||||
|
field: 'name', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
isSearch: true |
||||
|
}, |
||||
|
{ |
||||
|
label: '描述', |
||||
|
field: 'description', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '类型', |
||||
|
field: 'type', |
||||
|
dictType: DICT_TYPE.WAREHOUSE_TYPE, |
||||
|
dictClass: 'string', |
||||
|
isSearch: true, |
||||
|
isTable: true, |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '是否可用', |
||||
|
field: 'available', |
||||
|
dictType: DICT_TYPE.TRUE_FALSE, |
||||
|
dictClass: 'string', |
||||
|
isTable: true, |
||||
|
isSearch: true, |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'Switch', |
||||
|
value: 'TRUE', |
||||
|
componentProps: { |
||||
|
inactiveValue: 'FALSE', |
||||
|
activeValue: 'TRUE' |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '生效时间', |
||||
|
field: 'activeTime', |
||||
|
isTable: true, |
||||
|
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', |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '失效时间', |
||||
|
field: 'expireTime', |
||||
|
isTable: true, |
||||
|
formatter: dateFormatter, |
||||
|
detail: { |
||||
|
dateFormat: 'YYYY-MM-DD HH:mm:ss' |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
style: {width:'100%'}, |
||||
|
type: 'datetime', |
||||
|
dateFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
valueFormat: 'x', |
||||
|
} |
||||
|
}, |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 180 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '备注', |
||||
|
field: 'remark', |
||||
|
sort: 'custom', |
||||
|
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', |
||||
|
} |
||||
|
}, |
||||
|
isTable: false, |
||||
|
isForm: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建者', |
||||
|
field: 'creator', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
isTable: false, |
||||
|
isForm: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作', |
||||
|
field: 'action', |
||||
|
isDetail: false, |
||||
|
isForm: false , |
||||
|
table: { |
||||
|
width: 150, |
||||
|
fixed: 'right' |
||||
|
} |
||||
|
} |
||||
|
])) |
||||
|
|
||||
|
//表单校验
|
||||
|
export const WarehouseRules = reactive({ |
||||
|
code: [ |
||||
|
{ required: true, message: '请输入代码', trigger: 'blur' } |
||||
|
], |
||||
|
available: [ |
||||
|
{ required: true, message: '请选择是否可用', trigger: 'change' } |
||||
|
], |
||||
|
}) |
Loading…
Reference in new issue