Browse Source

物料管理

master
songguoqiang 1 year ago
parent
commit
a1663c39cf
  1. 70
      src/api/spc/location/index.ts
  2. 51
      src/api/spc/locationcapacity/index.ts
  3. 58
      src/api/spc/locationgroup/index.ts
  4. 67
      src/api/spc/supplier/index.ts
  5. 62
      src/api/spc/supplieritem/index.ts
  6. 56
      src/api/spc/warehouse/index.ts
  7. 23
      src/views/spc/itembasic/index.vue
  8. 503
      src/views/spc/itembasic/itembasic.data.ts
  9. 221
      src/views/spc/location/index.vue
  10. 377
      src/views/spc/location/location.data.ts
  11. 221
      src/views/spc/locationgroup/index.vue
  12. 205
      src/views/spc/locationgroup/locationgroup.data.ts
  13. 207
      src/views/spc/supplier/index.vue
  14. 261
      src/views/spc/supplier/supplier.data.ts
  15. 221
      src/views/spc/supplieritem/index.vue
  16. 350
      src/views/spc/supplieritem/supplieritem.data.ts
  17. 211
      src/views/spc/warehouse/index.vue
  18. 173
      src/views/spc/warehouse/warehouse.data.ts

70
src/api/spc/location/index.ts

@ -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' })
}

51
src/api/spc/locationcapacity/index.ts

@ -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' })
}

58
src/api/spc/locationgroup/index.ts

@ -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' })
}

67
src/api/spc/supplier/index.ts

@ -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' })
}

62
src/api/spc/supplieritem/index.ts

@ -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' })
}

56
src/api/spc/warehouse/index.ts

@ -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' })
}

23
src/views/spc/itembasic/index.vue

@ -8,6 +8,7 @@
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:tableColumns="tableColumns"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
@ -42,9 +43,9 @@
<BasicForm
ref="basicFormRef"
@success="getList"
:rules="ItembasicRules"
:formAllSchemas="Itembasic.allSchemas"
:searchTableParams="searchTableParams"
:rules="rules"
:apiUpdate="ItembasicApi.updateItembasic"
:apiCreate="ItembasicApi.createItembasic"
@searchTableSuccess="searchTableSuccess"
@ -52,7 +53,7 @@
/>
<!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="Itembasic.allSchemas" />
<!-- <Detail ref="detailRef" :isBasic="true" :allSchemas="Itembasic.allSchemas" /> -->
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/spc/itembasic/import" :importTemplateData="importTemplateData" @success="importSuccess" />
@ -60,7 +61,7 @@
<script setup lang="ts">
import download from '@/utils/download'
import { Itembasic,ItembasicRules } from './itembasic.data'
import { Itembasic,rules } from './itembasic.data'
import * as ItembasicApi from '@/api/spc/itembasic'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
@ -98,11 +99,11 @@ const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'wms:itembasic:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'wms:itembasic:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'wms:itembasic:export'}), //
defaultButtons.defaultAddBtn(null), //
defaultButtons.defaultImportBtn(null), //
defaultButtons.defaultExportBtn(null), //
defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), //
//defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
// {
// label: '',
@ -116,6 +117,7 @@ const HeadButttondata = [
//
const buttonBaseClick = (val, item) => {
console.log(val)
if (val == 'add') { //
openForm('create')
} else if (val == 'import') { //
@ -132,15 +134,18 @@ const buttonBaseClick = (val, item) => {
// -
const butttondata = [
defaultButtons.mainListEditBtn({hasPermi:'wms:itembasic:update'}), //
defaultButtons.mainListDeleteBtn({hasPermi:'wms:itembasic:delete'}), //
defaultButtons.mainListEditBtn(null), //
defaultButtons.mainListDeleteBtn(null), //
]
// -
const buttonTableClick = async (val, row) => {
console.info(row)
if (val == 'edit') { //
console.info("编辑",row)
openForm('update', row)
} else if (val == 'delete') { //
console.info("编辑",row)
handleDelete(row.id)
}
}

503
src/views/spc/itembasic/itembasic.data.ts

@ -1,355 +1,490 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
const { t } = useI18n() // 国际化
// 表单校验
export const ItembasicRules = reactive({
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]
})
/**
* @returns {Array}
*/
export const Itembasic = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '代码',
field: 'code',
sort: 'custom',
isSearch: true
isSearch: true,
table: {
width: 150,
fixed: 'left'
},
// tableForm:{
// minWidth:200,
// sortable:false
// }
},
{
label: '名称',
field: 'name',
sort: 'custom',
isSearch: true
isSearch: true,
table: {
width: 150
},
},
{
label: '描述1',
field: 'desc1',
sort: 'custom',
isSearch: true
table: {
width: 150
} ,
// isTableForm:false
},
{
label: '描述2',
field: 'desc2',
sort: 'custom',
isSearch: true
table: {
width: 150
} ,
},
{
label: '状态',
field: 'status',
sort: 'custom',
dictType: DICT_TYPE.ITEM_STATUS,
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
dictType: DICT_TYPE.ITEM_STATUS,
dictClass: 'string',
isForm: true,
isSearch: true,
form: {
component: 'SelectV2'
}
isTable: true,
table: {
width: 100
} ,
form: {
component: 'Switch',
value: 'ENABLE',
componentProps: {
inactiveValue: 'DISABLE',
activeValue: 'ENABLE'
}
},
},
{
label: '计量单位',
field: 'uom',
sort: 'custom',
dictType: DICT_TYPE.UOM,
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
dictType: DICT_TYPE.UOM,
dictClass: 'string',
isSearch: true,
form: {
component: 'SelectV2'
}
isTable: true,
table: {
width: 120
} ,
},
{
label: '替代计量单位',
field: 'altUom',
sort: 'custom',
dictType: DICT_TYPE.UOM,
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
isSearch: true,
form: {
component: 'SelectV2'
}
dictType: DICT_TYPE.UOM,
dictClass: 'string',
isTable: true,
table: {
width: 150
} ,
},
{
label: '是否标包',
field: 'isStdPack',
sort: 'custom',
isSearch: true,
form: {
component: 'SelectV2'
}
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
// colorType: 'danger',
isTable: true,
table: {
width: 120
},
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
},
// tableForm:{
// width: 180,
// type:'Radio',
// }
},
{
label: '可采购',
field: 'enableBuy',
sort: 'custom',
isSearch: true,
form: {
component: 'SelectV2'
}
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isTable: true,
table: {
width: 100
},
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
},
},
{
label: '可制造',
field: 'enableMake',
sort: 'custom',
isSearch: true,
form: {
component: 'SelectV2'
}
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isTable: true,
table: {
width: 100
} ,
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
},
},
{
label: '可委外加工',
field: 'enableOutsourcing',
sort: 'custom',
isSearch: true,
form: {
component: 'SelectV2'
}
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isTable: true,
table: {
width: 120
} ,
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
},
},
{
label: '回收件',
field: 'isRecycled',
sort: 'custom',
isSearch: true,
form: {
component: 'SelectV2'
}
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isTable: true,
table: {
width: 100
},
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
},
},
{
label: '虚零件',
field: 'isPhantom',
sort: 'custom',
isSearch: true,
form: {
component: 'SelectV2'
}
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isTable: true,
table: {
width: 100
} ,
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
},
},
{
label: 'ABC类',
field: 'abcClass',
sort: 'custom',
isSearch: true,
form: {
component: 'SelectV2'
}
dictType: DICT_TYPE.ABC_CLASS,
dictClass: 'string',
isTable: true,
table: {
width: 100
} ,
},
{
label: '类型',
field: 'type',
sort: 'custom',
isSearch: true,
form: {
component: 'SelectV2'
}
dictType: DICT_TYPE.ITEM_TYPE,
dictClass: 'string',
isTable: true,
table: {
width: 100
} ,
},
{
label: '种类',
field: 'category',
sort: 'custom',
dictType: DICT_TYPE.ITEM_CATEGORY,
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
isSearch: true,
form: {
component: 'SelectV2'
}
dictType: DICT_TYPE.ITEM_CATEGORY,
dictClass: 'string',
isTable: true,
table: {
width: 100
} ,
},
{
label: '分组',
field: 'itemGroup',
sort: 'custom',
dictType: DICT_TYPE.ITEM_GROUP,
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
isSearch: true,
form: {
component: 'SelectV2'
}
dictType: DICT_TYPE.ITEM_GROUP,
dictClass: 'string',
isTable: true,
table: {
width: 100
} ,
},
{
label: '颜色',
field: 'color',
sort: 'custom',
dictType: DICT_TYPE.ITEM_COLOR,
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
isSearch: true,
form: {
component: 'SelectV2'
}
dictType: DICT_TYPE.ITEM_COLOR,
dictClass: 'string',
isTable: true,
table: {
width: 100
} ,
},
{
label: '配置',
field: 'configuration',
sort: 'custom',
dictType: DICT_TYPE.ITEM_CONFIGURATION,
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
isSearch: true,
form: {
component: 'SelectV2'
}
dictType: DICT_TYPE.ITEM_CONFIGURATION,
dictClass: 'string',
isTable: true,
table: {
width: 100
} ,
},
{
label: '项目',
field: 'project',
sort: 'custom',
isSearch: true
table: {
width: 100
} ,
},
{
label: '质量等级',
field: 'eqLevel',
sort: 'custom',
dictType: DICT_TYPE.EQ_LEVEL,
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
isSearch: true,
form: {
component: 'SelectV2'
}
dictType: DICT_TYPE.EQ_LEVEL,
dictClass: 'string',
isTable: true,
table: {
width: 120
} ,
},
{
label: '有效天数',
field: 'validityDays',
sort: 'custom',
isSearch: true,
table: {
width: 120
},
form: {
component: 'InputNumber',
value: 0
}
},
{
label: '用户组代码',
field: 'userGroupCode',
sort: 'custom',
isSearch: true
componentProps: {
min: 0
}
},
},
{
label: '是否可用',
field: 'available',
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: '生效时间',
field: 'activeTime',
sort: 'custom',
isTable: true,
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')]
}
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
table: {
width: 180
} ,
form: {
component: 'DatePicker',
componentProps: {
style: {width:'100%'},
type: 'datetime',
valueFormat: 'x'
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
}
}
},
// tableForm:{
// width: 200,
// type:'FormDateTime',
// }
},
{
label: '失效时间',
field: 'expireTime',
sort: 'custom',
isTable: true,
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')]
}
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
table: {
width: 180
} ,
form: {
component: 'DatePicker',
componentProps: {
style: {width:'100%'},
type: 'datetime',
valueFormat: 'x'
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
}
}
},
{
label: '备注',
field: 'remark',
sort: 'custom',
isSearch: true
},
},
{
label: '创建时间',
field: 'createTime',
sort: 'custom',
isTable: true,
formatter: dateFormatter,
isSearch: true,
search: {
component: 'DatePicker',
componentProps: {
valueFormat: 'YYYY-MM-DD HH:mm:ss',
type: 'daterange',
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
}
isForm: false,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
isForm: false
},
{
label: '删除时间',
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')]
}
table: {
width: 180
},
form: {
component: 'DatePicker',
componentProps: {
style: {width:'100%'},
type: 'datetime',
valueFormat: 'x'
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
}
}
},
{
label: '删除者ID',
field: 'deleterId',
sort: 'custom',
isSearch: true
},
{
label: '扩展属性',
field: 'extraProperties',
sort: 'custom',
isSearch: true
},
{
label: '并发乐观锁',
field: 'concurrencyStamp',
sort: 'custom',
isSearch: true
},
{
label: '地点ID',
field: 'siteId',
sort: 'custom',
isSearch: true
label: '创建者',
field: 'creator',
isForm: false,
isTable: false
},
{ label: '备注', field: 'remark', sort: 'custom', isTable: false},
{
label: '操作',
field: 'action',
isForm: false,
isDetail: false,
isForm: false ,
table: {
width: 150,
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' }
],
})

221
src/views/spc/location/index.vue

@ -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>

377
src/views/spc/location/location.data.ts

@ -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' }
],
})

221
src/views/spc/locationgroup/index.vue

@ -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>

205
src/views/spc/locationgroup/locationgroup.data.ts

@ -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' }
],
})

207
src/views/spc/supplier/index.vue

@ -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>

261
src/views/spc/supplier/supplier.data.ts

@ -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' }
],
})

221
src/views/spc/supplieritem/index.vue

@ -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>

350
src/views/spc/supplieritem/supplieritem.data.ts

@ -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' }
],
})

211
src/views/spc/warehouse/index.vue

@ -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>

173
src/views/spc/warehouse/warehouse.data.ts

@ -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…
Cancel
Save