zhaoxuebing
11 months ago
3 changed files with 718 additions and 0 deletions
@ -0,0 +1,226 @@ |
|||
<template> |
|||
<ContentWrap> |
|||
<!-- 搜索工作栏 --> |
|||
<Search :schema="ItemChange.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
|||
</ContentWrap> |
|||
|
|||
<!-- 列表头部 --> |
|||
<TableHead :HeadButttondata="HeadButttondata" @button-base-click="buttonBaseClick" :route-name="routeName" |
|||
@updataTableColumns="updataTableColumns" @searchFormClick="searchFormClick" :allSchemas="ItemChange.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 #itemCode="{ row }"> |
|||
<el-button type="primary" link @click="openDetail(row, '物料代码', row.itemCode)"> |
|||
<span>{{ row.itemCode }}</span> |
|||
</el-button> |
|||
</template> |
|||
<template #action="{ row }"> |
|||
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event, row)" /> |
|||
</template> |
|||
</Table> |
|||
</ContentWrap> |
|||
|
|||
<!-- 表单弹窗:添加/修改 --> |
|||
<BasicForm ref="basicFormRef" @success="submitForm" :rules="ItemChangeRules" :formAllSchemas="ItemChange.allSchemas" |
|||
:apiUpdate="BalanceApi.updateBalance" :apiCreate="BalanceApi.createBalance" :isBusiness="false" |
|||
@searchTableSuccess="searchTableSuccess" /> |
|||
|
|||
<!-- 详情 --> |
|||
<Detail ref="detailRef" :isBasic="true" :allSchemas="ItemChange.allSchemas" /> |
|||
|
|||
<!-- 导入 --> |
|||
<ImportForm ref="importFormRef" url="/wms/balance/import" :importTemplateData="importTemplateData" |
|||
@success="importSuccess" /> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import download from '@/utils/download' |
|||
import * as BalanceApi from '@/api/wms/balance' |
|||
import BasicForm from '@/components/BasicForm/src/BasicForm.vue' |
|||
import { ItemChange, ItemChangeRules } from './itemChange.data.ts' |
|||
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: 'ItemChange' }) |
|||
|
|||
const message = useMessage() // 消息弹窗 |
|||
const { t } = useI18n() // 国际化 |
|||
|
|||
const route = useRoute() //路由信息 |
|||
const routeName = ref() |
|||
routeName.value = route.name |
|||
const tableColumns = ref(ItemChange.allSchemas.tableColumns) |
|||
|
|||
// 查询页面返回 |
|||
const searchTableSuccess = (formField, searchField, val, formRef, type, row) => { |
|||
nextTick(() => { |
|||
if (type == 'tableForm') { |
|||
// 明细查询页赋值 |
|||
row[formField] = val[0][searchField] |
|||
} else { |
|||
const setV = {} |
|||
setV[formField] = val[0][searchField] |
|||
formRef.setValues(setV) |
|||
} |
|||
}) |
|||
} |
|||
|
|||
//字段设置 更新主列表字段 |
|||
const updataTableColumns = (val) => { |
|||
tableColumns.value = val |
|||
} |
|||
|
|||
const { tableObject, tableMethods } = useTable({ |
|||
getListApi: BalanceApi.getBalancePage // 分页接口 |
|||
}) |
|||
|
|||
// 获得表格的各种操作 |
|||
const { getList, setSearchParams } = tableMethods |
|||
|
|||
// 列表头部按钮 |
|||
const HeadButttondata = [ |
|||
// defaultButtons.defaultAddBtn({hasPermi:'wms:balance:create'}), // 新增 |
|||
// defaultButtons.defaultImportBtn({hasPermi:'wms:balance:import'}), // 导入 |
|||
// defaultButtons.defaultExportBtn({hasPermi:'wms:balance:export'}), // 导出 |
|||
defaultButtons.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:balance:update' }), // 编辑 |
|||
// defaultButtons.mainListDeleteBtn({hasPermi:'wms:balance:delete'}), // 删除 |
|||
] |
|||
|
|||
// 列表-操作按钮事件 |
|||
const buttonTableClick = async (val, row) => { |
|||
if (val == 'edit') { // 编辑 |
|||
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) |
|||
} |
|||
|
|||
/** 删除按钮操作 */ |
|||
const handleDelete = async (id: number) => { |
|||
try { |
|||
// 删除的二次确认 |
|||
await message.delConfirm() |
|||
// 发起删除 |
|||
await BalanceApi.deleteBalance(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 BalanceApi.exportBalance(setSearchParams) |
|||
download.excel(data, '库存余额.xlsx') |
|||
} catch { |
|||
} finally { |
|||
exportLoading.value = false |
|||
} |
|||
} |
|||
|
|||
// 主子数据 提交 |
|||
const submitForm = async (formType, data) => { |
|||
try { |
|||
if (formType === 'create') { |
|||
await BalanceApi.createBalance(data) |
|||
message.success(t('common.createSuccess')) |
|||
} else { |
|||
await BalanceApi.updateBalance(data) |
|||
message.success(t('common.updateSuccess')) |
|||
} |
|||
basicFormRef.value.dialogVisible = false |
|||
// 刷新当前列表 |
|||
getList() |
|||
} finally { |
|||
basicFormRef.value.formLoading = false |
|||
} |
|||
} |
|||
|
|||
/** 导入 */ |
|||
const importFormRef = ref() |
|||
const handleImport = () => { |
|||
importFormRef.value.open() |
|||
} |
|||
// 导入附件弹窗所需的参数 |
|||
const importTemplateData = reactive({ |
|||
templateUrl: '', |
|||
templateTitle: '库存余额导入模版.xlsx' |
|||
}) |
|||
// 导入成功之后 |
|||
const importSuccess = () => { |
|||
getList() |
|||
} |
|||
|
|||
// 筛选提交 |
|||
const searchFormClick = (searchData) => { |
|||
tableObject.params = { |
|||
isSearch: true, |
|||
filters: searchData.filters |
|||
} |
|||
getList() // 刷新当前列表 |
|||
} |
|||
|
|||
/** 初始化 **/ |
|||
onMounted(async () => { |
|||
getList() |
|||
// importTemplateData.templateUrl = await BalanceApi.importTemplate() |
|||
}) |
|||
</script> |
@ -0,0 +1,484 @@ |
|||
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
|||
import { dateFormatter } from '@/utils/formatTime' |
|||
|
|||
import * as OwnerApi from '@/api/wms/owner' |
|||
import { Owner } from '@/views/wms/basicDataManage/orderManage/owner/owner.data' |
|||
|
|||
/** |
|||
* @returns {Array} 物品调整 |
|||
*/ |
|||
export const ItemChange = useCrudSchemas(reactive<CrudSchema[]>([ |
|||
{ |
|||
label: 'id', |
|||
field: 'id', |
|||
isForm: false, |
|||
isTableForm: false, |
|||
isTable: false |
|||
}, |
|||
{ |
|||
label: '物料代码', |
|||
field: 'itemCode', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
form: { |
|||
componentProps: { |
|||
disabled: true |
|||
} |
|||
}, |
|||
isSearch: true, |
|||
}, |
|||
// 可修改
|
|||
{ |
|||
label: '批次', |
|||
field: 'batch', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '包装号', |
|||
field: 'packingNumber', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
isForm: false, |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '器具代码', |
|||
field: 'containerNumber', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
isForm: false |
|||
}, |
|||
// 可修改
|
|||
{ |
|||
label: '数量', |
|||
field: 'qty', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
form: { |
|||
component: 'InputNumber', |
|||
componentProps: { |
|||
precision: 6 |
|||
} |
|||
} |
|||
}, |
|||
{ |
|||
label: '计量单位', |
|||
field: 'uom', |
|||
dictType: DICT_TYPE.UOM, |
|||
dictClass: 'string', |
|||
isTable: true, |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
isForm: false |
|||
}, |
|||
{ |
|||
label: '库位代码', |
|||
field: 'locationCode', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
isForm: false, |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '仓库代码', |
|||
field: 'warehouseCode', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
isForm: false |
|||
}, |
|||
// 可修改
|
|||
{ |
|||
label: '库存状态', |
|||
field: 'inventoryStatus', |
|||
dictType: DICT_TYPE.INVENTORY_STATUS, |
|||
dictClass: 'string', |
|||
isTable: true, |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '库位组代码', |
|||
field: 'locationGroupCode', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
isForm: false |
|||
}, |
|||
{ |
|||
label: '库区代码', |
|||
field: 'areaCode', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
isForm: false |
|||
}, |
|||
{ |
|||
label: 'ERP库位代码', |
|||
field: 'erpLocationCode', |
|||
dictType: DICT_TYPE.ERP_LOCATION, |
|||
dictClass: 'string', |
|||
isTable: true, |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
isForm: false |
|||
}, |
|||
{ |
|||
label: '替代批次', |
|||
field: 'altBatch', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
isForm: false |
|||
}, |
|||
{ |
|||
label: '到货日期', |
|||
field: 'arriveDate', |
|||
isTable: true, |
|||
formatter: dateFormatter, |
|||
detail: { |
|||
dateFormat: 'YYYY-MM-DD HH:mm:ss' |
|||
}, |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
form: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
type: 'datetime', |
|||
} |
|||
}, |
|||
isForm: false |
|||
}, |
|||
{ |
|||
label: '生产日期', |
|||
field: 'produceDate', |
|||
isTable: true, |
|||
formatter: dateFormatter, |
|||
detail: { |
|||
dateFormat: 'YYYY-MM-DD HH:mm:ss' |
|||
}, |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
form: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
type: 'datetime', |
|||
} |
|||
}, |
|||
isForm: false |
|||
}, |
|||
// 可修改
|
|||
{ |
|||
label: '失效日期', |
|||
field: 'expireDate', |
|||
isTable: true, |
|||
formatter: dateFormatter, |
|||
detail: { |
|||
dateFormat: 'YYYY-MM-DD HH:mm:ss' |
|||
}, |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
form: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
style:{width:'100%'}, |
|||
type: 'datetime', |
|||
dateFormat: 'YYYY-MM-DD HH:mm:ss', |
|||
valueFormat: 'x', |
|||
} |
|||
} |
|||
}, |
|||
// 可修改
|
|||
{ |
|||
label: '货主代码', |
|||
field: 'ownerCode', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
form: { |
|||
// labelMessage: '信息提示说明!!!',
|
|||
componentProps: { |
|||
isSearchList: true, // 开启查询弹窗
|
|||
searchListPlaceholder: '请选择货主代码', // 输入框占位文本
|
|||
searchField: 'code', // 查询弹窗赋值字段
|
|||
searchTitle: '货主信息', // 查询弹窗标题
|
|||
searchAllSchemas: Owner.allSchemas, // 查询弹窗所需类
|
|||
searchPage: OwnerApi.getOwnerPage, // 查询弹窗所需分页方法
|
|||
searchCondition: [{ |
|||
key: 'available', |
|||
value: 'TRUE', |
|||
isMainValue: false |
|||
}] |
|||
} |
|||
} |
|||
}, |
|||
{ |
|||
label: '锁定数量', |
|||
field: 'lockedQty', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
form: { |
|||
component: 'InputNumber', |
|||
}, |
|||
isForm: false |
|||
}, |
|||
{ |
|||
label: '可用数量', |
|||
field: 'usableQty', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
form: { |
|||
component: 'InputNumber', |
|||
}, |
|||
isForm: false |
|||
}, |
|||
{ |
|||
label: '单价', |
|||
field: 'singlePrice', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
form: { |
|||
component: 'InputNumber', |
|||
}, |
|||
isForm: false |
|||
}, |
|||
{ |
|||
label: '金额', |
|||
field: 'amount', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
form: { |
|||
component: 'InputNumber', |
|||
}, |
|||
isForm: false |
|||
}, |
|||
{ |
|||
label: '入库时间', |
|||
field: 'putInTime', |
|||
isTable: true, |
|||
formatter: dateFormatter, |
|||
detail: { |
|||
dateFormat: 'YYYY-MM-DD HH:mm:ss' |
|||
}, |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
form: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
type: 'datetime', |
|||
} |
|||
}, |
|||
isForm: false |
|||
}, |
|||
{ |
|||
label: '是否冻结', |
|||
field: 'frozen', |
|||
dictType: DICT_TYPE.TRUE_FALSE, |
|||
dictClass: 'string', |
|||
isTable: true, |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
form: { |
|||
component: 'Switch', |
|||
value: 'TRUE', |
|||
componentProps: { |
|||
inactiveValue: 'FALSE', |
|||
activeValue: 'TRUE' |
|||
} |
|||
}, |
|||
isForm: false |
|||
}, |
|||
{ |
|||
label: '冻结原因', |
|||
field: 'frozenReason', |
|||
dictType: DICT_TYPE.FROZEN_REASON, |
|||
dictClass: 'string', |
|||
isTable: true, |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
isForm: false |
|||
}, |
|||
{ |
|||
label: '重量', |
|||
field: 'weight', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
form: { |
|||
component: 'InputNumber', |
|||
}, |
|||
isForm: false |
|||
}, |
|||
{ |
|||
label: '面积', |
|||
field: 'area', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
form: { |
|||
component: 'InputNumber', |
|||
}, |
|||
isForm: false |
|||
}, |
|||
{ |
|||
label: '体积', |
|||
field: 'volume', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
form: { |
|||
component: 'InputNumber', |
|||
}, |
|||
isForm: false |
|||
}, |
|||
{ |
|||
label: '最后事务号', |
|||
field: 'lastTransNumber', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
isForm: false |
|||
}, |
|||
{ |
|||
label: '创建时间', |
|||
field: 'createTime', |
|||
formatter: dateFormatter, |
|||
detail: { |
|||
dateFormat: 'YYYY-MM-DD HH:mm:ss' |
|||
}, |
|||
sort: 'custom', |
|||
table: { |
|||
width: 180 |
|||
}, |
|||
form: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
style: {width:'100%'}, |
|||
type: 'datetime', |
|||
dateFormat: 'YYYY-MM-DD HH:mm:ss', |
|||
valueFormat: 'x', |
|||
} |
|||
}, |
|||
isForm: false |
|||
}, |
|||
{ |
|||
label: '创建者', |
|||
field: 'creator', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
isForm: false |
|||
}, |
|||
{ |
|||
label: '最后更新时间', |
|||
field: 'updateTime', |
|||
formatter: dateFormatter, |
|||
detail: { |
|||
dateFormat: 'YYYY-MM-DD HH:mm:ss' |
|||
}, |
|||
sort: 'custom', |
|||
table: { |
|||
width: 180 |
|||
}, |
|||
form: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
type: 'datetime', |
|||
dateFormat: 'YYYY-MM-DD HH:mm:ss', |
|||
valueFormat: 'x', |
|||
} |
|||
}, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '最后更新者', |
|||
field: 'updater', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '操作', |
|||
field: 'action', |
|||
isDetail: false, |
|||
isForm: false, |
|||
table: { |
|||
width: 100, |
|||
fixed: 'right' |
|||
}, |
|||
} |
|||
])) |
|||
|
|||
// 表单校验
|
|||
export const ItemChangeRules = reactive({ |
|||
// packingNumber: [
|
|||
// { required: true, message: '请选择包装号', trigger: 'change' }
|
|||
// ],
|
|||
// containerNumber: [
|
|||
// { required: true, message: '请选择器具号', trigger: 'change' }
|
|||
// ],
|
|||
// itemCode: [
|
|||
// { required: true, message: '请选择物品代码', trigger: 'change' }
|
|||
// ],
|
|||
// batch: [
|
|||
// { required: true, message: '请输入批次', trigger: 'blur' }
|
|||
// ],
|
|||
// arriveDate: [
|
|||
// { required: true, message: '请选择到货日期', trigger: 'change' }
|
|||
// ],
|
|||
// produceDate: [
|
|||
// { required: true, message: '请选择生产日期', trigger: 'change' }
|
|||
// ],
|
|||
}) |
Loading…
Reference in new issue