chenfang
4 weeks ago
12 changed files with 3872 additions and 0 deletions
@ -0,0 +1,357 @@ |
|||||
|
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
||||
|
import { TableColumn } from '@/types/table' |
||||
|
import { dateFormatter } from '@/utils/formatTime' |
||||
|
|
||||
|
// 表单校验
|
||||
|
export const ContainerRecordMainRules = reactive({ |
||||
|
available: [required], |
||||
|
concurrencyStamp: [required], |
||||
|
}) |
||||
|
|
||||
|
// 获取当前操作人的部门
|
||||
|
import { useUserStore } from '@/store/modules/user' |
||||
|
const userStore = useUserStore() |
||||
|
const userDept = userStore.userSelfInfo.dept |
||||
|
// id 转str 否则form回显匹配不到
|
||||
|
userDept.id = userDept.id.toString() |
||||
|
const userDeptArray:any = [userDept] |
||||
|
|
||||
|
export const ContainerRecordMain = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: '单据号', |
||||
|
field: 'number', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
isForm: false, |
||||
|
table: { |
||||
|
width: 200 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '申请单号', |
||||
|
field: 'requestNumber', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '类型', |
||||
|
field: 'type', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.CONTAIN_MANAGE_TYPE, |
||||
|
dictClass: 'string', |
||||
|
isSearch: true, |
||||
|
isTable: true, |
||||
|
table: { |
||||
|
width: 120 |
||||
|
}, |
||||
|
form:{ |
||||
|
componentProps:{ |
||||
|
disabled: true, |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '是否可用', |
||||
|
field: 'available', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.TRUE_FALSE, |
||||
|
dictClass: 'string', |
||||
|
isForm: false, |
||||
|
isTable:false |
||||
|
}, |
||||
|
{ |
||||
|
label: '备注', |
||||
|
field: 'remark', |
||||
|
sort: 'custom', |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '部门', |
||||
|
field: 'departmentCode', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
isTable:false, |
||||
|
formatter: (_: Recordable, __: TableColumn, cellValue: number) => { |
||||
|
return userDeptArray.find((account) => account.id == cellValue)?.name |
||||
|
}, |
||||
|
form: { |
||||
|
value: userDept.id, |
||||
|
component: 'Select', |
||||
|
api: () => userDeptArray, |
||||
|
componentProps: { |
||||
|
disabled: true, |
||||
|
optionsAlias: { |
||||
|
labelField: 'name', |
||||
|
valueField: 'id' |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '扩展属性', |
||||
|
field: 'extraProperties', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '并发乐观锁', |
||||
|
field: 'concurrencyStamp', |
||||
|
sort: 'custom', |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
value: 0 |
||||
|
}, |
||||
|
isForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '地点ID', |
||||
|
field: 'siteId', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建时间', |
||||
|
field: 'createTime', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
detail: { |
||||
|
dateFormat : 'YYYY-MM-DD HH:mm:ss' |
||||
|
}, |
||||
|
table: { |
||||
|
width: 180 |
||||
|
}, |
||||
|
isSearch: false, |
||||
|
search: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
type: 'daterange', |
||||
|
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
||||
|
} |
||||
|
}, |
||||
|
isTable: false, |
||||
|
isForm: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建者', |
||||
|
field: 'creator', |
||||
|
table: { |
||||
|
width: 130 |
||||
|
}, |
||||
|
isForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '最后更新时间', |
||||
|
field: 'updateTime', |
||||
|
sort: 'custom', |
||||
|
isDetail: true, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
formatter: dateFormatter, |
||||
|
detail: { |
||||
|
dateFormat: 'YYYY-MM-DD HH:mm:ss' |
||||
|
}, |
||||
|
table: { |
||||
|
width: 180 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
style: {width:'100%'}, |
||||
|
type: 'datetime', |
||||
|
dateFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
valueFormat: 'x', |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '最后更新者', |
||||
|
field: 'updater', |
||||
|
isDetail: true, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
table: { |
||||
|
width: 150 |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作', |
||||
|
field: 'action', |
||||
|
isForm: false, |
||||
|
table: { |
||||
|
width: 150, |
||||
|
fixed: 'right' |
||||
|
} |
||||
|
} |
||||
|
])) |
||||
|
|
||||
|
// 表单校验
|
||||
|
export const ContainerRecordDetailRules = reactive({ |
||||
|
fromLocationCode: [required], |
||||
|
toLocationCode: [required], |
||||
|
concurrencyStamp: [required], |
||||
|
}) |
||||
|
|
||||
|
export const ContainerRecordDetail = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: 'id', |
||||
|
field: 'id', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '主表ID', |
||||
|
field: 'masterId', |
||||
|
sort: 'custom', |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
value: 0 |
||||
|
}, |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '单据号', |
||||
|
field: 'number', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '器具号', |
||||
|
field: 'containerNumber', |
||||
|
sort: 'custom' |
||||
|
}, |
||||
|
{ |
||||
|
label: '来源库位代码', |
||||
|
field: 'fromLocationCode', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: '目标库位代码', |
||||
|
field: 'toLocationCode', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: '到数量', |
||||
|
field: 'toQty', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: '计量单位', |
||||
|
field: 'uom', |
||||
|
dictType: DICT_TYPE.UOM, |
||||
|
dictClass: 'string', |
||||
|
isTable: true, |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
tableForm:{ |
||||
|
disabled: true, |
||||
|
type: 'Select' |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '备注', |
||||
|
field: 'remark', |
||||
|
sort: 'custom', |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建时间', |
||||
|
field: 'createTime', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
detail: { |
||||
|
dateFormat : 'YYYY-MM-DD HH:mm:ss' |
||||
|
}, |
||||
|
table: { |
||||
|
width: 180 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
type: 'datetime', |
||||
|
dateFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
valueFormat: 'x', |
||||
|
} |
||||
|
}, |
||||
|
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')] |
||||
|
} |
||||
|
}, |
||||
|
isTable: true, |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建者', |
||||
|
field: 'creator', |
||||
|
table: { |
||||
|
width: 130 |
||||
|
}, |
||||
|
isForm: false, |
||||
|
isTable: true |
||||
|
}, |
||||
|
{ |
||||
|
label: '地点ID', |
||||
|
field: 'siteId', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '并发乐观锁', |
||||
|
field: 'concurrencyStamp', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '从货主代码', |
||||
|
field: 'fromOwnerCode', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '到货主代码', |
||||
|
field: 'toOwnerCode', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作', |
||||
|
field: 'action', |
||||
|
isForm: false, |
||||
|
hiddenInMain:true, |
||||
|
isTableForm: false, |
||||
|
isTable: false, |
||||
|
table: { |
||||
|
width: 150, |
||||
|
fixed: 'right' |
||||
|
} |
||||
|
} |
||||
|
])) |
@ -0,0 +1,267 @@ |
|||||
|
<template> |
||||
|
<ContentWrap> |
||||
|
<!-- 搜索工作栏 --> |
||||
|
<Search :schema="[...ContainerRecordMain.allSchemas.searchSchema,...ContainerRecordDetail.allSchemas.searchSchema]" @search="searchList" @reset="searchList" /> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 列表头部 --> |
||||
|
<TableHead |
||||
|
:HeadButttondata="HeadButttondata" |
||||
|
@button-base-click="buttonBaseClick" |
||||
|
:routeName="routeName" |
||||
|
@updataTableColumns="updataTableColumns" |
||||
|
@searchFormClick="searchFormClick" |
||||
|
:allSchemas="ContainerRecordMain.allSchemas" |
||||
|
:detailAllSchemas="ContainerRecordDetailAllSchemas" |
||||
|
/> |
||||
|
|
||||
|
<!-- 列表 --> |
||||
|
<ContentWrap> |
||||
|
<Table |
||||
|
:columns="tableColumns" |
||||
|
:data="tableObject.tableList" |
||||
|
:loading="tableObject.loading" |
||||
|
:pagination="{ |
||||
|
total: tableObject.total |
||||
|
}" |
||||
|
v-model:pageSize="tableObject.pageSize" |
||||
|
v-model:currentPage="tableObject.currentPage" |
||||
|
v-model:sort="tableObject.sort" |
||||
|
> |
||||
|
<template #number="{row}"> |
||||
|
<el-button type="primary" link @click="openDetail(row, '代码', row.number)"> |
||||
|
<span>{{ row.number }}</span> |
||||
|
</el-button> |
||||
|
</template> |
||||
|
<template #action="{ row,$index }"> |
||||
|
<ButtonBase :Butttondata="butttondata(row,$index)" @button-base-click="buttonTableClick($event,row)" /> |
||||
|
</template> |
||||
|
</Table> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 表单弹窗:添加/修改 --> |
||||
|
<BasicForm |
||||
|
ref="basicFormRef" |
||||
|
@success="getList" |
||||
|
:rules="ContainerRecordMainRules" |
||||
|
:formAllSchemas="ContainerRecordMain.allSchemas" |
||||
|
:tableAllSchemas="ContainerRecordDetail.allSchemas" |
||||
|
:tableFormRules="ContainerRecordDetailRules" |
||||
|
:isBusiness="true" |
||||
|
/> |
||||
|
|
||||
|
<!-- 详情 --> |
||||
|
<Detail |
||||
|
ref="detailRef" |
||||
|
:isBasic="false" |
||||
|
:allSchemas="ContainerRecordMain.allSchemas" |
||||
|
:detailAllSchemas="ContainerRecordDetail.allSchemas" |
||||
|
:detailAllSchemasRules="ContainerRecordDetailRules" |
||||
|
:apiPage="ContainerRecordDetailApi.getContainerRecordDetailPage" |
||||
|
:detailButtonIsShowAdd="false" |
||||
|
:detailButtonIsShowDelete="false" |
||||
|
:detailButtonIsShowUpdate="false" |
||||
|
/> |
||||
|
|
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import download from '@/utils/download' |
||||
|
import { ContainerRecordMain, ContainerRecordMainRules, ContainerRecordDetail, ContainerRecordDetailRules } from './createContainerRecordMain.data' |
||||
|
|
||||
|
console.log(3444,ContainerRecordDetail) |
||||
|
import * as ContainerRecordMainApi from '@/api/wms/containerRecordMain' |
||||
|
import * as ContainerRecordDetailApi from '@/api/wms/containerRecordDetail' |
||||
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
||||
|
import TableHead from '@/components/TableHead/src/TableHead.vue' |
||||
|
import Detail from '@/components/Detail/src/Detail.vue' |
||||
|
import { CACHE_KEY, useCache } from '@/hooks/web/useCache' |
||||
|
import { formatDate } from '@/utils/formatTime' |
||||
|
import { usePageLoading } from '@/hooks/web/usePageLoading' |
||||
|
import { json } from 'stream/consumers' |
||||
|
const { loadStart, loadDone } = usePageLoading() |
||||
|
defineOptions({ name: 'ContainerRecordMain' }) |
||||
|
const message = useMessage() // 消息弹窗 |
||||
|
const { t } = useI18n() // 国际化 |
||||
|
const route = useRoute() // 路由信息 |
||||
|
const routeName = ref() |
||||
|
routeName.value = route.name |
||||
|
const businessType = ref() |
||||
|
const importFileName = ref() |
||||
|
const tableColumns = ref([...ContainerRecordMain.allSchemas.tableColumns, ...ContainerRecordDetail.allSchemas.tableMainColumns]) |
||||
|
// const ContainerRecordDetailTableColumns = ref(JSON.parse(JSON.stringify(ContainerRecordDetail.allSchemas.tableMainColumns))) |
||||
|
const ContainerRecordDetailAllSchemas = ref(JSON.parse(JSON.stringify(ContainerRecordDetail.allSchemas))) |
||||
|
console.log(2233,ContainerRecordDetail.allSchemas.tableMainColumns) |
||||
|
const searchType = ref() |
||||
|
const { tableObject, tableMethods } = useTable({ |
||||
|
getListApi: ContainerRecordDetailApi.getContainerRecordDetailPage // 分页接口 |
||||
|
}) |
||||
|
|
||||
|
// 判断 路由名称 进行条件过滤 |
||||
|
/** |
||||
|
* |
||||
|
*/ |
||||
|
// if ( routeName.value == 'InitialContainerManageRecord') { |
||||
|
// tableObject.params = { |
||||
|
// type:'INITIAL', |
||||
|
// } |
||||
|
// searchType.value = 'INITIAL' |
||||
|
// businessType.value = 'InitialContainerManage' |
||||
|
// importFileName.value = '器具初始化记录' |
||||
|
// } |
||||
|
// if ( routeName.value == 'InitialContainerManageRecord') { |
||||
|
// const array = ContainerRecordDetail.allSchemas.tableMainColumns.filter(item=>item.field != "fromLocationCode") |
||||
|
// ContainerRecordDetailAllSchemas.value.tableMainColumns = array |
||||
|
// tableColumns.value = [...ContainerRecordMain.allSchemas.tableColumns,...ContainerRecordDetailAllSchemas.value.tableMainColumns] |
||||
|
// } |
||||
|
// else { |
||||
|
// ContainerRecordDetail.allSchemas.tableMainColumns =JSON.parse(JSON.stringify(ContainerRecordDetail.allSchemas.tableMainColumns)) |
||||
|
// tableColumns.value = [...ContainerRecordMain.allSchemas.tableColumns,...ContainerRecordDetail.allSchemas.tableMainColumns] |
||||
|
// } |
||||
|
|
||||
|
|
||||
|
|
||||
|
// 字段设置 更新主列表字段 |
||||
|
const updataTableColumns = (val) => { |
||||
|
tableColumns.value = val |
||||
|
} |
||||
|
|
||||
|
// 获得表格的各种操作 |
||||
|
const { getList, setSearchParams } = tableMethods |
||||
|
// 列表头部按钮 |
||||
|
const HeadButttondata = [ |
||||
|
// defaultButtons.defaultAddBtn({hasPermi:`wms:{routeName.value}:create`}), // 新增 |
||||
|
defaultButtons.defaultExportBtn({hasPermi:`wms:${routeName.value}:export`}), // 导出 |
||||
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
||||
|
defaultButtons.defaultFilterBtn(null), // 筛选 |
||||
|
defaultButtons.defaultSetBtn(null), // 设置 |
||||
|
// { |
||||
|
// label: '自定义扩展按钮', |
||||
|
// name: 'zdy', |
||||
|
// hide: false, |
||||
|
// type: 'primary', |
||||
|
// icon: 'Select', |
||||
|
// color: '' |
||||
|
// }, |
||||
|
] |
||||
|
|
||||
|
const searchList = (model)=>{ |
||||
|
model.type = searchType.value |
||||
|
setSearchParams(model) |
||||
|
} |
||||
|
|
||||
|
// 头部按钮事件 |
||||
|
const buttonBaseClick = (val, item) => { |
||||
|
if (val == 'add') { // 新增 |
||||
|
openForm('create') |
||||
|
} else if (val == 'export') { // 导出 |
||||
|
handleExport() |
||||
|
} else if (val == 'refresh') { // 刷新 |
||||
|
if (tableObject.params.filters && tableObject.params.filters.length > 0 ) { |
||||
|
searchFormClick({ |
||||
|
filters: tableObject.params.filters |
||||
|
}) |
||||
|
} else { |
||||
|
getList() |
||||
|
} |
||||
|
} else if (val == 'filtrate') { // 筛选 |
||||
|
} else { // 其他按钮 |
||||
|
console.log('其他按钮', item) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 列表-操作按钮 |
||||
|
const butttondata = (row,$index) => { |
||||
|
const findIndex = row['masterId']?tableObject.tableList.findIndex(item=>item['masterId'] == row['masterId']):-1 |
||||
|
if(findIndex>-1&&findIndex<$index){ |
||||
|
return [] |
||||
|
} |
||||
|
return [ |
||||
|
// defaultButtons.mainListEditBtn({hasPermi:`wms:{routeName.value}:update`}), // 编辑 |
||||
|
// defaultButtons.mainListDeleteBtn({hasPermi:`wms:{routeName.value}:delete`}), // 删除 |
||||
|
] |
||||
|
} |
||||
|
|
||||
|
// 列表-操作按钮事件 |
||||
|
const buttonTableClick = async (val, row) => { |
||||
|
if (val == 'edit') { // 编辑 |
||||
|
openForm('update', row) |
||||
|
} else if (val == 'delete') { // 删除 |
||||
|
handleDelete(row.id) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 获取部门 用于详情 部门回显 |
||||
|
const { wsCache } = useCache() |
||||
|
/** 详情操作 */ |
||||
|
const detailRef = ref() |
||||
|
const openDetail = (row: any, titleName: any, titleValue: any) => { |
||||
|
const departmentCode = wsCache.get(CACHE_KEY.DEPT).find((account) => account.id == row.departmentCode)?.name |
||||
|
if (departmentCode) row.departmentCode = JSON.parse(JSON.stringify(departmentCode)) |
||||
|
detailRef.value.openDetail(row, titleName, titleValue,"recordContainerMain") |
||||
|
} |
||||
|
|
||||
|
/** 添加/修改操作 */ |
||||
|
const basicFormRef = ref() |
||||
|
const openForm = (type: string, row?: any) => { |
||||
|
basicFormRef.value.open(type, row) |
||||
|
} |
||||
|
|
||||
|
/** 删除按钮操作 */ |
||||
|
const handleDelete = async (id: number) => { |
||||
|
try { |
||||
|
// 删除的二次确认 |
||||
|
await message.delConfirm() |
||||
|
// 发起删除 |
||||
|
await ContainerRecordMainApi.deleteContainerRecordMain(id) |
||||
|
message.success(t('common.delSuccess')) |
||||
|
// 刷新列表 |
||||
|
buttonBaseClick('refresh',null) |
||||
|
} catch {} |
||||
|
} |
||||
|
|
||||
|
/** 导出按钮操作 */ |
||||
|
const handleExport = async () => { |
||||
|
try { |
||||
|
// 导出的二次确认 |
||||
|
await message.exportConfirm() |
||||
|
// 发起导出 |
||||
|
loadStart() |
||||
|
const excelTitle = ref(route.meta.title) |
||||
|
if(businessType.value = 'InitialContainerManage'){ |
||||
|
const data = await ContainerRecordMainApi.exportContainerInitRecordMain(tableObject.params) |
||||
|
download.excel(data, `【${excelTitle.value}】【${formatDate(new Date())}】.xlsx`) |
||||
|
}else { |
||||
|
const data = await ContainerRecordMainApi.exportContainerRecordMain(tableObject.params) |
||||
|
download.excel(data, `【${excelTitle.value}】【${formatDate(new Date())}】.xlsx`) |
||||
|
} |
||||
|
} catch { |
||||
|
} finally { |
||||
|
loadDone() |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 筛选提交 |
||||
|
const searchFormClick = (searchData) => { |
||||
|
const cmd = { |
||||
|
'column':'type', |
||||
|
'action':'==', |
||||
|
'value': 'CREATE' |
||||
|
} |
||||
|
if (!Array.isArray(searchData.filters)) { |
||||
|
searchData.filters = []; |
||||
|
} |
||||
|
searchData.filters.push(cmd) |
||||
|
tableObject.params = { |
||||
|
isSearch: true, |
||||
|
filters: searchData.filters |
||||
|
} |
||||
|
getList() // 刷新当前列表 |
||||
|
} |
||||
|
|
||||
|
/** 初始化 **/ |
||||
|
onMounted(async () => { |
||||
|
getList() |
||||
|
}) |
||||
|
|
||||
|
</script> |
@ -0,0 +1,357 @@ |
|||||
|
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
||||
|
import { TableColumn } from '@/types/table' |
||||
|
import { dateFormatter } from '@/utils/formatTime' |
||||
|
|
||||
|
// 表单校验
|
||||
|
export const ContainerRecordMainRules = reactive({ |
||||
|
available: [required], |
||||
|
concurrencyStamp: [required], |
||||
|
}) |
||||
|
|
||||
|
// 获取当前操作人的部门
|
||||
|
import { useUserStore } from '@/store/modules/user' |
||||
|
const userStore = useUserStore() |
||||
|
const userDept = userStore.userSelfInfo.dept |
||||
|
// id 转str 否则form回显匹配不到
|
||||
|
userDept.id = userDept.id.toString() |
||||
|
const userDeptArray:any = [userDept] |
||||
|
|
||||
|
export const ContainerRecordMain = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: '单据号', |
||||
|
field: 'number', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
isForm: false, |
||||
|
table: { |
||||
|
width: 200 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '申请单号', |
||||
|
field: 'requestNumber', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '类型', |
||||
|
field: 'type', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.CONTAIN_MANAGE_TYPE, |
||||
|
dictClass: 'string', |
||||
|
isSearch: true, |
||||
|
isTable: true, |
||||
|
table: { |
||||
|
width: 120 |
||||
|
}, |
||||
|
form:{ |
||||
|
componentProps:{ |
||||
|
disabled: true, |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '是否可用', |
||||
|
field: 'available', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.TRUE_FALSE, |
||||
|
dictClass: 'string', |
||||
|
isForm: false, |
||||
|
isTable:false |
||||
|
}, |
||||
|
{ |
||||
|
label: '备注', |
||||
|
field: 'remark', |
||||
|
sort: 'custom', |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '部门', |
||||
|
field: 'departmentCode', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
isTable:false, |
||||
|
formatter: (_: Recordable, __: TableColumn, cellValue: number) => { |
||||
|
return userDeptArray.find((account) => account.id == cellValue)?.name |
||||
|
}, |
||||
|
form: { |
||||
|
value: userDept.id, |
||||
|
component: 'Select', |
||||
|
api: () => userDeptArray, |
||||
|
componentProps: { |
||||
|
disabled: true, |
||||
|
optionsAlias: { |
||||
|
labelField: 'name', |
||||
|
valueField: 'id' |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '扩展属性', |
||||
|
field: 'extraProperties', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '并发乐观锁', |
||||
|
field: 'concurrencyStamp', |
||||
|
sort: 'custom', |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
value: 0 |
||||
|
}, |
||||
|
isForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '地点ID', |
||||
|
field: 'siteId', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建时间', |
||||
|
field: 'createTime', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
detail: { |
||||
|
dateFormat : 'YYYY-MM-DD HH:mm:ss' |
||||
|
}, |
||||
|
table: { |
||||
|
width: 180 |
||||
|
}, |
||||
|
isSearch: false, |
||||
|
search: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
type: 'daterange', |
||||
|
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
||||
|
} |
||||
|
}, |
||||
|
isTable: false, |
||||
|
isForm: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建者', |
||||
|
field: 'creator', |
||||
|
table: { |
||||
|
width: 130 |
||||
|
}, |
||||
|
isForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '最后更新时间', |
||||
|
field: 'updateTime', |
||||
|
sort: 'custom', |
||||
|
isDetail: true, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
formatter: dateFormatter, |
||||
|
detail: { |
||||
|
dateFormat: 'YYYY-MM-DD HH:mm:ss' |
||||
|
}, |
||||
|
table: { |
||||
|
width: 180 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
style: {width:'100%'}, |
||||
|
type: 'datetime', |
||||
|
dateFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
valueFormat: 'x', |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '最后更新者', |
||||
|
field: 'updater', |
||||
|
isDetail: true, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
table: { |
||||
|
width: 150 |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作', |
||||
|
field: 'action', |
||||
|
isForm: false, |
||||
|
table: { |
||||
|
width: 150, |
||||
|
fixed: 'right' |
||||
|
} |
||||
|
} |
||||
|
])) |
||||
|
|
||||
|
// 表单校验
|
||||
|
export const ContainerRecordDetailRules = reactive({ |
||||
|
fromLocationCode: [required], |
||||
|
toLocationCode: [required], |
||||
|
concurrencyStamp: [required], |
||||
|
}) |
||||
|
|
||||
|
export const ContainerRecordDetail = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: 'id', |
||||
|
field: 'id', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '主表ID', |
||||
|
field: 'masterId', |
||||
|
sort: 'custom', |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
value: 0 |
||||
|
}, |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '单据号', |
||||
|
field: 'number', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '器具号', |
||||
|
field: 'containerNumber', |
||||
|
sort: 'custom' |
||||
|
}, |
||||
|
{ |
||||
|
label: '来源库位代码', |
||||
|
field: 'fromLocationCode', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: '目标库位代码', |
||||
|
field: 'toLocationCode', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: '到数量', |
||||
|
field: 'toQty', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: '计量单位', |
||||
|
field: 'uom', |
||||
|
dictType: DICT_TYPE.UOM, |
||||
|
dictClass: 'string', |
||||
|
isTable: true, |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
tableForm:{ |
||||
|
disabled: true, |
||||
|
type: 'Select' |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '备注', |
||||
|
field: 'remark', |
||||
|
sort: 'custom', |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建时间', |
||||
|
field: 'createTime', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
detail: { |
||||
|
dateFormat : 'YYYY-MM-DD HH:mm:ss' |
||||
|
}, |
||||
|
table: { |
||||
|
width: 180 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
type: 'datetime', |
||||
|
dateFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
valueFormat: 'x', |
||||
|
} |
||||
|
}, |
||||
|
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')] |
||||
|
} |
||||
|
}, |
||||
|
isTable: true, |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建者', |
||||
|
field: 'creator', |
||||
|
table: { |
||||
|
width: 130 |
||||
|
}, |
||||
|
isForm: false, |
||||
|
isTable: true |
||||
|
}, |
||||
|
{ |
||||
|
label: '地点ID', |
||||
|
field: 'siteId', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '并发乐观锁', |
||||
|
field: 'concurrencyStamp', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '从货主代码', |
||||
|
field: 'fromOwnerCode', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '到货主代码', |
||||
|
field: 'toOwnerCode', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作', |
||||
|
field: 'action', |
||||
|
isForm: false, |
||||
|
hiddenInMain:true, |
||||
|
isTableForm: false, |
||||
|
isTable: false, |
||||
|
table: { |
||||
|
width: 150, |
||||
|
fixed: 'right' |
||||
|
} |
||||
|
} |
||||
|
])) |
@ -0,0 +1,267 @@ |
|||||
|
<template> |
||||
|
<ContentWrap> |
||||
|
<!-- 搜索工作栏 --> |
||||
|
<Search :schema="[...ContainerRecordMain.allSchemas.searchSchema,...ContainerRecordDetail.allSchemas.searchSchema]" @search="searchList" @reset="searchList" /> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 列表头部 --> |
||||
|
<TableHead |
||||
|
:HeadButttondata="HeadButttondata" |
||||
|
@button-base-click="buttonBaseClick" |
||||
|
:routeName="routeName" |
||||
|
@updataTableColumns="updataTableColumns" |
||||
|
@searchFormClick="searchFormClick" |
||||
|
:allSchemas="ContainerRecordMain.allSchemas" |
||||
|
:detailAllSchemas="ContainerRecordDetailAllSchemas" |
||||
|
/> |
||||
|
|
||||
|
<!-- 列表 --> |
||||
|
<ContentWrap> |
||||
|
<Table |
||||
|
:columns="tableColumns" |
||||
|
:data="tableObject.tableList" |
||||
|
:loading="tableObject.loading" |
||||
|
:pagination="{ |
||||
|
total: tableObject.total |
||||
|
}" |
||||
|
v-model:pageSize="tableObject.pageSize" |
||||
|
v-model:currentPage="tableObject.currentPage" |
||||
|
v-model:sort="tableObject.sort" |
||||
|
> |
||||
|
<template #number="{row}"> |
||||
|
<el-button type="primary" link @click="openDetail(row, '代码', row.number)"> |
||||
|
<span>{{ row.number }}</span> |
||||
|
</el-button> |
||||
|
</template> |
||||
|
<template #action="{ row,$index }"> |
||||
|
<ButtonBase :Butttondata="butttondata(row,$index)" @button-base-click="buttonTableClick($event,row)" /> |
||||
|
</template> |
||||
|
</Table> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 表单弹窗:添加/修改 --> |
||||
|
<BasicForm |
||||
|
ref="basicFormRef" |
||||
|
@success="getList" |
||||
|
:rules="ContainerRecordMainRules" |
||||
|
:formAllSchemas="ContainerRecordMain.allSchemas" |
||||
|
:tableAllSchemas="ContainerRecordDetail.allSchemas" |
||||
|
:tableFormRules="ContainerRecordDetailRules" |
||||
|
:isBusiness="true" |
||||
|
/> |
||||
|
|
||||
|
<!-- 详情 --> |
||||
|
<Detail |
||||
|
ref="detailRef" |
||||
|
:isBasic="false" |
||||
|
:allSchemas="ContainerRecordMain.allSchemas" |
||||
|
:detailAllSchemas="ContainerRecordDetail.allSchemas" |
||||
|
:detailAllSchemasRules="ContainerRecordDetailRules" |
||||
|
:apiPage="ContainerRecordDetailApi.getContainerRecordDetailPage" |
||||
|
:detailButtonIsShowAdd="false" |
||||
|
:detailButtonIsShowDelete="false" |
||||
|
:detailButtonIsShowUpdate="false" |
||||
|
/> |
||||
|
|
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import download from '@/utils/download' |
||||
|
import { ContainerRecordMain, ContainerRecordMainRules, ContainerRecordDetail, ContainerRecordDetailRules } from './deliverContainerRecordMain.data' |
||||
|
|
||||
|
console.log(3444,ContainerRecordDetail) |
||||
|
import * as ContainerRecordMainApi from '@/api/wms/containerRecordMain' |
||||
|
import * as ContainerRecordDetailApi from '@/api/wms/containerRecordDetail' |
||||
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
||||
|
import TableHead from '@/components/TableHead/src/TableHead.vue' |
||||
|
import Detail from '@/components/Detail/src/Detail.vue' |
||||
|
import { CACHE_KEY, useCache } from '@/hooks/web/useCache' |
||||
|
import { formatDate } from '@/utils/formatTime' |
||||
|
import { usePageLoading } from '@/hooks/web/usePageLoading' |
||||
|
import { json } from 'stream/consumers' |
||||
|
const { loadStart, loadDone } = usePageLoading() |
||||
|
defineOptions({ name: 'ContainerRecordMain' }) |
||||
|
const message = useMessage() // 消息弹窗 |
||||
|
const { t } = useI18n() // 国际化 |
||||
|
const route = useRoute() // 路由信息 |
||||
|
const routeName = ref() |
||||
|
routeName.value = route.name |
||||
|
const businessType = ref() |
||||
|
const importFileName = ref() |
||||
|
const tableColumns = ref([...ContainerRecordMain.allSchemas.tableColumns, ...ContainerRecordDetail.allSchemas.tableMainColumns]) |
||||
|
// const ContainerRecordDetailTableColumns = ref(JSON.parse(JSON.stringify(ContainerRecordDetail.allSchemas.tableMainColumns))) |
||||
|
const ContainerRecordDetailAllSchemas = ref(JSON.parse(JSON.stringify(ContainerRecordDetail.allSchemas))) |
||||
|
console.log(2233,ContainerRecordDetail.allSchemas.tableMainColumns) |
||||
|
const searchType = ref() |
||||
|
const { tableObject, tableMethods } = useTable({ |
||||
|
getListApi: ContainerRecordDetailApi.getContainerRecordDetailPage // 分页接口 |
||||
|
}) |
||||
|
|
||||
|
// 判断 路由名称 进行条件过滤 |
||||
|
/** |
||||
|
* |
||||
|
*/ |
||||
|
// if ( routeName.value == 'InitialContainerManageRecord') { |
||||
|
// tableObject.params = { |
||||
|
// type:'INITIAL', |
||||
|
// } |
||||
|
// searchType.value = 'INITIAL' |
||||
|
// businessType.value = 'InitialContainerManage' |
||||
|
// importFileName.value = '器具初始化记录' |
||||
|
// } |
||||
|
// if ( routeName.value == 'InitialContainerManageRecord') { |
||||
|
// const array = ContainerRecordDetail.allSchemas.tableMainColumns.filter(item=>item.field != "fromLocationCode") |
||||
|
// ContainerRecordDetailAllSchemas.value.tableMainColumns = array |
||||
|
// tableColumns.value = [...ContainerRecordMain.allSchemas.tableColumns,...ContainerRecordDetailAllSchemas.value.tableMainColumns] |
||||
|
// } |
||||
|
// else { |
||||
|
// ContainerRecordDetail.allSchemas.tableMainColumns =JSON.parse(JSON.stringify(ContainerRecordDetail.allSchemas.tableMainColumns)) |
||||
|
// tableColumns.value = [...ContainerRecordMain.allSchemas.tableColumns,...ContainerRecordDetail.allSchemas.tableMainColumns] |
||||
|
// } |
||||
|
|
||||
|
|
||||
|
|
||||
|
// 字段设置 更新主列表字段 |
||||
|
const updataTableColumns = (val) => { |
||||
|
tableColumns.value = val |
||||
|
} |
||||
|
|
||||
|
// 获得表格的各种操作 |
||||
|
const { getList, setSearchParams } = tableMethods |
||||
|
// 列表头部按钮 |
||||
|
const HeadButttondata = [ |
||||
|
// defaultButtons.defaultAddBtn({hasPermi:`wms:{routeName.value}:create`}), // 新增 |
||||
|
defaultButtons.defaultExportBtn({hasPermi:`wms:${routeName.value}:export`}), // 导出 |
||||
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
||||
|
defaultButtons.defaultFilterBtn(null), // 筛选 |
||||
|
defaultButtons.defaultSetBtn(null), // 设置 |
||||
|
// { |
||||
|
// label: '自定义扩展按钮', |
||||
|
// name: 'zdy', |
||||
|
// hide: false, |
||||
|
// type: 'primary', |
||||
|
// icon: 'Select', |
||||
|
// color: '' |
||||
|
// }, |
||||
|
] |
||||
|
|
||||
|
const searchList = (model)=>{ |
||||
|
model.type = searchType.value |
||||
|
setSearchParams(model) |
||||
|
} |
||||
|
|
||||
|
// 头部按钮事件 |
||||
|
const buttonBaseClick = (val, item) => { |
||||
|
if (val == 'add') { // 新增 |
||||
|
openForm('create') |
||||
|
} else if (val == 'export') { // 导出 |
||||
|
handleExport() |
||||
|
} else if (val == 'refresh') { // 刷新 |
||||
|
if (tableObject.params.filters && tableObject.params.filters.length > 0 ) { |
||||
|
searchFormClick({ |
||||
|
filters: tableObject.params.filters |
||||
|
}) |
||||
|
} else { |
||||
|
getList() |
||||
|
} |
||||
|
} else if (val == 'filtrate') { // 筛选 |
||||
|
} else { // 其他按钮 |
||||
|
console.log('其他按钮', item) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 列表-操作按钮 |
||||
|
const butttondata = (row,$index) => { |
||||
|
const findIndex = row['masterId']?tableObject.tableList.findIndex(item=>item['masterId'] == row['masterId']):-1 |
||||
|
if(findIndex>-1&&findIndex<$index){ |
||||
|
return [] |
||||
|
} |
||||
|
return [ |
||||
|
// defaultButtons.mainListEditBtn({hasPermi:`wms:{routeName.value}:update`}), // 编辑 |
||||
|
// defaultButtons.mainListDeleteBtn({hasPermi:`wms:{routeName.value}:delete`}), // 删除 |
||||
|
] |
||||
|
} |
||||
|
|
||||
|
// 列表-操作按钮事件 |
||||
|
const buttonTableClick = async (val, row) => { |
||||
|
if (val == 'edit') { // 编辑 |
||||
|
openForm('update', row) |
||||
|
} else if (val == 'delete') { // 删除 |
||||
|
handleDelete(row.id) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 获取部门 用于详情 部门回显 |
||||
|
const { wsCache } = useCache() |
||||
|
/** 详情操作 */ |
||||
|
const detailRef = ref() |
||||
|
const openDetail = (row: any, titleName: any, titleValue: any) => { |
||||
|
const departmentCode = wsCache.get(CACHE_KEY.DEPT).find((account) => account.id == row.departmentCode)?.name |
||||
|
if (departmentCode) row.departmentCode = JSON.parse(JSON.stringify(departmentCode)) |
||||
|
detailRef.value.openDetail(row, titleName, titleValue,"recordContainerMain") |
||||
|
} |
||||
|
|
||||
|
/** 添加/修改操作 */ |
||||
|
const basicFormRef = ref() |
||||
|
const openForm = (type: string, row?: any) => { |
||||
|
basicFormRef.value.open(type, row) |
||||
|
} |
||||
|
|
||||
|
/** 删除按钮操作 */ |
||||
|
const handleDelete = async (id: number) => { |
||||
|
try { |
||||
|
// 删除的二次确认 |
||||
|
await message.delConfirm() |
||||
|
// 发起删除 |
||||
|
await ContainerRecordMainApi.deleteContainerRecordMain(id) |
||||
|
message.success(t('common.delSuccess')) |
||||
|
// 刷新列表 |
||||
|
buttonBaseClick('refresh',null) |
||||
|
} catch {} |
||||
|
} |
||||
|
|
||||
|
/** 导出按钮操作 */ |
||||
|
const handleExport = async () => { |
||||
|
try { |
||||
|
// 导出的二次确认 |
||||
|
await message.exportConfirm() |
||||
|
// 发起导出 |
||||
|
loadStart() |
||||
|
const excelTitle = ref(route.meta.title) |
||||
|
if(businessType.value = 'InitialContainerManage'){ |
||||
|
const data = await ContainerRecordMainApi.exportContainerInitRecordMain(tableObject.params) |
||||
|
download.excel(data, `【${excelTitle.value}】【${formatDate(new Date())}】.xlsx`) |
||||
|
}else { |
||||
|
const data = await ContainerRecordMainApi.exportContainerRecordMain(tableObject.params) |
||||
|
download.excel(data, `【${excelTitle.value}】【${formatDate(new Date())}】.xlsx`) |
||||
|
} |
||||
|
} catch { |
||||
|
} finally { |
||||
|
loadDone() |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 筛选提交 |
||||
|
const searchFormClick = (searchData) => { |
||||
|
const cmd = { |
||||
|
'column':'type', |
||||
|
'action':'==', |
||||
|
'value': 'CREATE' |
||||
|
} |
||||
|
if (!Array.isArray(searchData.filters)) { |
||||
|
searchData.filters = []; |
||||
|
} |
||||
|
searchData.filters.push(cmd) |
||||
|
tableObject.params = { |
||||
|
isSearch: true, |
||||
|
filters: searchData.filters |
||||
|
} |
||||
|
getList() // 刷新当前列表 |
||||
|
} |
||||
|
|
||||
|
/** 初始化 **/ |
||||
|
onMounted(async () => { |
||||
|
getList() |
||||
|
}) |
||||
|
|
||||
|
</script> |
@ -0,0 +1,299 @@ |
|||||
|
<template> |
||||
|
<ContentWrap> |
||||
|
<!-- 搜索工作栏 --> |
||||
|
<Search :schema="[...ContainerRecordMain.allSchemas.searchSchema,...ContainerRecordDetail.allSchemas.searchSchema]" @search="searchList" @reset="searchList" /> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 列表头部 --> |
||||
|
<TableHead |
||||
|
:HeadButttondata="HeadButttondata" |
||||
|
@button-base-click="buttonBaseClick" |
||||
|
:routeName="routeName" |
||||
|
@updataTableColumns="updataTableColumns" |
||||
|
@searchFormClick="searchFormClick" |
||||
|
:allSchemas="ContainerRecordMain.allSchemas" |
||||
|
:detailAllSchemas="ContainerRecordDetailAllSchemas" |
||||
|
/> |
||||
|
|
||||
|
<!-- 列表 --> |
||||
|
<ContentWrap> |
||||
|
<Table |
||||
|
:columns="tableColumns" |
||||
|
:data="tableObject.tableList" |
||||
|
:loading="tableObject.loading" |
||||
|
:pagination="{ |
||||
|
total: tableObject.total |
||||
|
}" |
||||
|
v-model:pageSize="tableObject.pageSize" |
||||
|
v-model:currentPage="tableObject.currentPage" |
||||
|
v-model:sort="tableObject.sort" |
||||
|
> |
||||
|
<template #number="{row}"> |
||||
|
<el-button type="primary" link @click="openDetail(row, '代码', row.number)"> |
||||
|
<span>{{ row.number }}</span> |
||||
|
</el-button> |
||||
|
</template> |
||||
|
<template #action="{ row,$index }"> |
||||
|
<ButtonBase :Butttondata="butttondata(row,$index)" @button-base-click="buttonTableClick($event,row)" /> |
||||
|
</template> |
||||
|
</Table> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 表单弹窗:添加/修改 --> |
||||
|
<BasicForm |
||||
|
ref="basicFormRef" |
||||
|
@success="getList" |
||||
|
:rules="ContainerRecordMainRules" |
||||
|
:formAllSchemas="ContainerRecordMain.allSchemas" |
||||
|
:tableAllSchemas="ContainerRecordDetail.allSchemas" |
||||
|
:tableFormRules="ContainerRecordDetailRules" |
||||
|
:isBusiness="true" |
||||
|
/> |
||||
|
|
||||
|
<!-- 详情 --> |
||||
|
<Detail |
||||
|
ref="detailRef" |
||||
|
:isBasic="false" |
||||
|
:allSchemas="ContainerRecordMain.allSchemas" |
||||
|
:detailAllSchemas="ContainerRecordDetail.allSchemas" |
||||
|
:detailAllSchemasRules="ContainerRecordDetailRules" |
||||
|
:apiPage="ContainerRecordDetailApi.getContainerRecordDetailPage" |
||||
|
:detailButtonIsShowAdd="false" |
||||
|
:detailButtonIsShowDelete="false" |
||||
|
:detailButtonIsShowUpdate="false" |
||||
|
/> |
||||
|
|
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import download from '@/utils/download' |
||||
|
import { ContainerRecordMain, ContainerRecordMainRules, ContainerRecordDetail, ContainerRecordDetailRules } from './initialContainerRecordMain.data' |
||||
|
|
||||
|
console.log(3444,ContainerRecordDetail) |
||||
|
import * as ContainerRecordMainApi from '@/api/wms/containerRecordMain' |
||||
|
import * as ContainerRecordDetailApi from '@/api/wms/containerRecordDetail' |
||||
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
||||
|
import TableHead from '@/components/TableHead/src/TableHead.vue' |
||||
|
import Detail from '@/components/Detail/src/Detail.vue' |
||||
|
import { CACHE_KEY, useCache } from '@/hooks/web/useCache' |
||||
|
import { formatDate } from '@/utils/formatTime' |
||||
|
import { usePageLoading } from '@/hooks/web/usePageLoading' |
||||
|
import { json } from 'stream/consumers' |
||||
|
const { loadStart, loadDone } = usePageLoading() |
||||
|
defineOptions({ name: 'ContainerRecordMain' }) |
||||
|
const message = useMessage() // 消息弹窗 |
||||
|
const { t } = useI18n() // 国际化 |
||||
|
const route = useRoute() // 路由信息 |
||||
|
const routeName = ref() |
||||
|
routeName.value = route.name |
||||
|
const businessType = ref() |
||||
|
const importFileName = ref() |
||||
|
const tableColumns = ref([...ContainerRecordMain.allSchemas.tableColumns, ...ContainerRecordDetail.allSchemas.tableMainColumns]) |
||||
|
// const ContainerRecordDetailTableColumns = ref(JSON.parse(JSON.stringify(ContainerRecordDetail.allSchemas.tableMainColumns))) |
||||
|
const ContainerRecordDetailAllSchemas = ref(JSON.parse(JSON.stringify(ContainerRecordDetail.allSchemas))) |
||||
|
console.log(2233,ContainerRecordDetail.allSchemas.tableMainColumns) |
||||
|
const searchType = ref() |
||||
|
const { tableObject, tableMethods } = useTable({ |
||||
|
getListApi: ContainerRecordDetailApi.getContainerRecordDetailPage // 分页接口 |
||||
|
}) |
||||
|
|
||||
|
// // 判断 路由名称 进行条件过滤 |
||||
|
// /** |
||||
|
// * |
||||
|
// */ |
||||
|
// if ( routeName.value == 'ReturnContainerManageRecord') { |
||||
|
// tableObject.params = { |
||||
|
// type:'RETURN' |
||||
|
// } |
||||
|
// searchType.value = 'RETURN' |
||||
|
// businessType.value = 'ReturnContainerManage' |
||||
|
// importFileName.value = '器具返回记录' |
||||
|
// } else if ( routeName.value == 'MoveContainerManageRecord') { |
||||
|
// tableObject.params = { |
||||
|
// type:'MOVE' |
||||
|
// } |
||||
|
// searchType.value = 'MOVE' |
||||
|
// businessType.value = 'MoveContainerManage' |
||||
|
// importFileName.value = '器具转移记录' |
||||
|
// } else if ( routeName.value == 'InitialContainerManageRecord') { |
||||
|
// tableObject.params = { |
||||
|
// type:'INITIAL', |
||||
|
// } |
||||
|
// searchType.value = 'INITIAL' |
||||
|
// businessType.value = 'InitialContainerManage' |
||||
|
// importFileName.value = '器具初始化记录' |
||||
|
// } |
||||
|
// else if ( routeName.value == 'ScrapContainerManageRecord') { |
||||
|
// tableObject.params = { |
||||
|
// type:'SCRAP' |
||||
|
// } |
||||
|
// searchType.value = 'SCRAP' |
||||
|
// businessType.value = 'ScrapContainerManage' |
||||
|
// importFileName.value = '器具报废记录' |
||||
|
// } else if ( routeName.value == 'DeliverContainerManageRecord') { |
||||
|
// tableObject.params = { |
||||
|
// type: 'DELIVER', |
||||
|
// } |
||||
|
// searchType.value = 'DELIVER' |
||||
|
// businessType.value = 'DeliverContainerManage' |
||||
|
// importFileName.value = '器具发运记录' |
||||
|
// } else if( routeName.value == 'ContainerManageRecord'){ |
||||
|
// businessType.value = 'ContainerManage' |
||||
|
// importFileName.value = '器具管理记录' |
||||
|
// } |
||||
|
// if ( routeName.value == 'InitialContainerManageRecord') { |
||||
|
// const array = ContainerRecordDetail.allSchemas.tableMainColumns.filter(item=>item.field != "fromLocationCode") |
||||
|
// ContainerRecordDetailAllSchemas.value.tableMainColumns = array |
||||
|
// tableColumns.value = [...ContainerRecordMain.allSchemas.tableColumns,...ContainerRecordDetailAllSchemas.value.tableMainColumns] |
||||
|
// } |
||||
|
// else { |
||||
|
// ContainerRecordDetail.allSchemas.tableMainColumns =JSON.parse(JSON.stringify(ContainerRecordDetail.allSchemas.tableMainColumns)) |
||||
|
// tableColumns.value = [...ContainerRecordMain.allSchemas.tableColumns,...ContainerRecordDetail.allSchemas.tableMainColumns] |
||||
|
// } |
||||
|
|
||||
|
|
||||
|
|
||||
|
// 字段设置 更新主列表字段 |
||||
|
const updataTableColumns = (val) => { |
||||
|
tableColumns.value = val |
||||
|
} |
||||
|
|
||||
|
// 获得表格的各种操作 |
||||
|
const { getList, setSearchParams } = tableMethods |
||||
|
// 列表头部按钮 |
||||
|
const HeadButttondata = [ |
||||
|
// defaultButtons.defaultAddBtn({hasPermi:`wms:{routeName.value}:create`}), // 新增 |
||||
|
defaultButtons.defaultExportBtn({hasPermi:`wms:${routeName.value}:export`}), // 导出 |
||||
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
||||
|
defaultButtons.defaultFilterBtn(null), // 筛选 |
||||
|
defaultButtons.defaultSetBtn(null), // 设置 |
||||
|
// { |
||||
|
// label: '自定义扩展按钮', |
||||
|
// name: 'zdy', |
||||
|
// hide: false, |
||||
|
// type: 'primary', |
||||
|
// icon: 'Select', |
||||
|
// color: '' |
||||
|
// }, |
||||
|
] |
||||
|
|
||||
|
const searchList = (model)=>{ |
||||
|
model.type = searchType.value |
||||
|
setSearchParams(model) |
||||
|
} |
||||
|
|
||||
|
// 头部按钮事件 |
||||
|
const buttonBaseClick = (val, item) => { |
||||
|
if (val == 'add') { // 新增 |
||||
|
openForm('create') |
||||
|
} else if (val == 'export') { // 导出 |
||||
|
handleExport() |
||||
|
} else if (val == 'refresh') { // 刷新 |
||||
|
if (tableObject.params.filters && tableObject.params.filters.length > 0 ) { |
||||
|
searchFormClick({ |
||||
|
filters: tableObject.params.filters |
||||
|
}) |
||||
|
} else { |
||||
|
getList() |
||||
|
} |
||||
|
} else if (val == 'filtrate') { // 筛选 |
||||
|
} else { // 其他按钮 |
||||
|
console.log('其他按钮', item) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 列表-操作按钮 |
||||
|
const butttondata = (row,$index) => { |
||||
|
const findIndex = row['masterId']?tableObject.tableList.findIndex(item=>item['masterId'] == row['masterId']):-1 |
||||
|
if(findIndex>-1&&findIndex<$index){ |
||||
|
return [] |
||||
|
} |
||||
|
return [ |
||||
|
// defaultButtons.mainListEditBtn({hasPermi:`wms:{routeName.value}:update`}), // 编辑 |
||||
|
// defaultButtons.mainListDeleteBtn({hasPermi:`wms:{routeName.value}:delete`}), // 删除 |
||||
|
] |
||||
|
} |
||||
|
|
||||
|
// 列表-操作按钮事件 |
||||
|
const buttonTableClick = async (val, row) => { |
||||
|
if (val == 'edit') { // 编辑 |
||||
|
openForm('update', row) |
||||
|
} else if (val == 'delete') { // 删除 |
||||
|
handleDelete(row.id) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 获取部门 用于详情 部门回显 |
||||
|
const { wsCache } = useCache() |
||||
|
/** 详情操作 */ |
||||
|
const detailRef = ref() |
||||
|
const openDetail = (row: any, titleName: any, titleValue: any) => { |
||||
|
const departmentCode = wsCache.get(CACHE_KEY.DEPT).find((account) => account.id == row.departmentCode)?.name |
||||
|
if (departmentCode) row.departmentCode = JSON.parse(JSON.stringify(departmentCode)) |
||||
|
detailRef.value.openDetail(row, titleName, titleValue,"recordContainerMain") |
||||
|
} |
||||
|
|
||||
|
/** 添加/修改操作 */ |
||||
|
const basicFormRef = ref() |
||||
|
const openForm = (type: string, row?: any) => { |
||||
|
basicFormRef.value.open(type, row) |
||||
|
} |
||||
|
|
||||
|
/** 删除按钮操作 */ |
||||
|
const handleDelete = async (id: number) => { |
||||
|
try { |
||||
|
// 删除的二次确认 |
||||
|
await message.delConfirm() |
||||
|
// 发起删除 |
||||
|
await ContainerRecordMainApi.deleteContainerRecordMain(id) |
||||
|
message.success(t('common.delSuccess')) |
||||
|
// 刷新列表 |
||||
|
buttonBaseClick('refresh',null) |
||||
|
} catch {} |
||||
|
} |
||||
|
|
||||
|
/** 导出按钮操作 */ |
||||
|
const handleExport = async () => { |
||||
|
try { |
||||
|
// 导出的二次确认 |
||||
|
await message.exportConfirm() |
||||
|
// 发起导出 |
||||
|
loadStart() |
||||
|
const excelTitle = ref(route.meta.title) |
||||
|
if(businessType.value = 'InitialContainerManage'){ |
||||
|
const data = await ContainerRecordMainApi.exportContainerInitRecordMain(tableObject.params) |
||||
|
download.excel(data, `【${excelTitle.value}】【${formatDate(new Date())}】.xlsx`) |
||||
|
}else { |
||||
|
const data = await ContainerRecordMainApi.exportContainerRecordMain(tableObject.params) |
||||
|
download.excel(data, `【${excelTitle.value}】【${formatDate(new Date())}】.xlsx`) |
||||
|
} |
||||
|
} catch { |
||||
|
} finally { |
||||
|
loadDone() |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 筛选提交 |
||||
|
const searchFormClick = (searchData) => { |
||||
|
const cmd = { |
||||
|
'column':'type', |
||||
|
'action':'==', |
||||
|
'value':searchType.value |
||||
|
} |
||||
|
if (!Array.isArray(searchData.filters)) { |
||||
|
searchData.filters = []; |
||||
|
} |
||||
|
searchData.filters.push(cmd) |
||||
|
tableObject.params = { |
||||
|
isSearch: true, |
||||
|
filters: searchData.filters |
||||
|
} |
||||
|
getList() // 刷新当前列表 |
||||
|
} |
||||
|
|
||||
|
/** 初始化 **/ |
||||
|
onMounted(async () => { |
||||
|
getList() |
||||
|
}) |
||||
|
|
||||
|
</script> |
@ -0,0 +1,357 @@ |
|||||
|
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
||||
|
import { TableColumn } from '@/types/table' |
||||
|
import { dateFormatter } from '@/utils/formatTime' |
||||
|
|
||||
|
// 表单校验
|
||||
|
export const ContainerRecordMainRules = reactive({ |
||||
|
available: [required], |
||||
|
concurrencyStamp: [required], |
||||
|
}) |
||||
|
|
||||
|
// 获取当前操作人的部门
|
||||
|
import { useUserStore } from '@/store/modules/user' |
||||
|
const userStore = useUserStore() |
||||
|
const userDept = userStore.userSelfInfo.dept |
||||
|
// id 转str 否则form回显匹配不到
|
||||
|
userDept.id = userDept.id.toString() |
||||
|
const userDeptArray:any = [userDept] |
||||
|
|
||||
|
export const ContainerRecordMain = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: '单据号', |
||||
|
field: 'number', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
isForm: false, |
||||
|
table: { |
||||
|
width: 200 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '申请单号', |
||||
|
field: 'requestNumber', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '类型', |
||||
|
field: 'type', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.CONTAIN_MANAGE_TYPE, |
||||
|
dictClass: 'string', |
||||
|
isSearch: true, |
||||
|
isTable: true, |
||||
|
table: { |
||||
|
width: 120 |
||||
|
}, |
||||
|
form:{ |
||||
|
componentProps:{ |
||||
|
disabled: true, |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '是否可用', |
||||
|
field: 'available', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.TRUE_FALSE, |
||||
|
dictClass: 'string', |
||||
|
isForm: false, |
||||
|
isTable:false |
||||
|
}, |
||||
|
{ |
||||
|
label: '备注', |
||||
|
field: 'remark', |
||||
|
sort: 'custom', |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '部门', |
||||
|
field: 'departmentCode', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
isTable:false, |
||||
|
formatter: (_: Recordable, __: TableColumn, cellValue: number) => { |
||||
|
return userDeptArray.find((account) => account.id == cellValue)?.name |
||||
|
}, |
||||
|
form: { |
||||
|
value: userDept.id, |
||||
|
component: 'Select', |
||||
|
api: () => userDeptArray, |
||||
|
componentProps: { |
||||
|
disabled: true, |
||||
|
optionsAlias: { |
||||
|
labelField: 'name', |
||||
|
valueField: 'id' |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '扩展属性', |
||||
|
field: 'extraProperties', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '并发乐观锁', |
||||
|
field: 'concurrencyStamp', |
||||
|
sort: 'custom', |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
value: 0 |
||||
|
}, |
||||
|
isForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '地点ID', |
||||
|
field: 'siteId', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建时间', |
||||
|
field: 'createTime', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
detail: { |
||||
|
dateFormat : 'YYYY-MM-DD HH:mm:ss' |
||||
|
}, |
||||
|
table: { |
||||
|
width: 180 |
||||
|
}, |
||||
|
isSearch: false, |
||||
|
search: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
type: 'daterange', |
||||
|
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
||||
|
} |
||||
|
}, |
||||
|
isTable: false, |
||||
|
isForm: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建者', |
||||
|
field: 'creator', |
||||
|
table: { |
||||
|
width: 130 |
||||
|
}, |
||||
|
isForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '最后更新时间', |
||||
|
field: 'updateTime', |
||||
|
sort: 'custom', |
||||
|
isDetail: true, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
formatter: dateFormatter, |
||||
|
detail: { |
||||
|
dateFormat: 'YYYY-MM-DD HH:mm:ss' |
||||
|
}, |
||||
|
table: { |
||||
|
width: 180 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
style: {width:'100%'}, |
||||
|
type: 'datetime', |
||||
|
dateFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
valueFormat: 'x', |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '最后更新者', |
||||
|
field: 'updater', |
||||
|
isDetail: true, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
table: { |
||||
|
width: 150 |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作', |
||||
|
field: 'action', |
||||
|
isForm: false, |
||||
|
table: { |
||||
|
width: 150, |
||||
|
fixed: 'right' |
||||
|
} |
||||
|
} |
||||
|
])) |
||||
|
|
||||
|
// 表单校验
|
||||
|
export const ContainerRecordDetailRules = reactive({ |
||||
|
fromLocationCode: [required], |
||||
|
toLocationCode: [required], |
||||
|
concurrencyStamp: [required], |
||||
|
}) |
||||
|
|
||||
|
export const ContainerRecordDetail = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: 'id', |
||||
|
field: 'id', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '主表ID', |
||||
|
field: 'masterId', |
||||
|
sort: 'custom', |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
value: 0 |
||||
|
}, |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '单据号', |
||||
|
field: 'number', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '器具号', |
||||
|
field: 'containerNumber', |
||||
|
sort: 'custom' |
||||
|
}, |
||||
|
{ |
||||
|
label: '来源库位代码', |
||||
|
field: 'fromLocationCode', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: '目标库位代码', |
||||
|
field: 'toLocationCode', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: '到数量', |
||||
|
field: 'toQty', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: '计量单位', |
||||
|
field: 'uom', |
||||
|
dictType: DICT_TYPE.UOM, |
||||
|
dictClass: 'string', |
||||
|
isTable: true, |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
tableForm:{ |
||||
|
disabled: true, |
||||
|
type: 'Select' |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '备注', |
||||
|
field: 'remark', |
||||
|
sort: 'custom', |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建时间', |
||||
|
field: 'createTime', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
detail: { |
||||
|
dateFormat : 'YYYY-MM-DD HH:mm:ss' |
||||
|
}, |
||||
|
table: { |
||||
|
width: 180 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
type: 'datetime', |
||||
|
dateFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
valueFormat: 'x', |
||||
|
} |
||||
|
}, |
||||
|
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')] |
||||
|
} |
||||
|
}, |
||||
|
isTable: true, |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建者', |
||||
|
field: 'creator', |
||||
|
table: { |
||||
|
width: 130 |
||||
|
}, |
||||
|
isForm: false, |
||||
|
isTable: true |
||||
|
}, |
||||
|
{ |
||||
|
label: '地点ID', |
||||
|
field: 'siteId', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '并发乐观锁', |
||||
|
field: 'concurrencyStamp', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '从货主代码', |
||||
|
field: 'fromOwnerCode', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '到货主代码', |
||||
|
field: 'toOwnerCode', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作', |
||||
|
field: 'action', |
||||
|
isForm: false, |
||||
|
hiddenInMain:true, |
||||
|
isTableForm: false, |
||||
|
isTable: false, |
||||
|
table: { |
||||
|
width: 150, |
||||
|
fixed: 'right' |
||||
|
} |
||||
|
} |
||||
|
])) |
@ -0,0 +1,299 @@ |
|||||
|
<template> |
||||
|
<ContentWrap> |
||||
|
<!-- 搜索工作栏 --> |
||||
|
<Search :schema="[...ContainerRecordMain.allSchemas.searchSchema,...ContainerRecordDetail.allSchemas.searchSchema]" @search="searchList" @reset="searchList" /> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 列表头部 --> |
||||
|
<TableHead |
||||
|
:HeadButttondata="HeadButttondata" |
||||
|
@button-base-click="buttonBaseClick" |
||||
|
:routeName="routeName" |
||||
|
@updataTableColumns="updataTableColumns" |
||||
|
@searchFormClick="searchFormClick" |
||||
|
:allSchemas="ContainerRecordMain.allSchemas" |
||||
|
:detailAllSchemas="ContainerRecordDetailAllSchemas" |
||||
|
/> |
||||
|
|
||||
|
<!-- 列表 --> |
||||
|
<ContentWrap> |
||||
|
<Table |
||||
|
:columns="tableColumns" |
||||
|
:data="tableObject.tableList" |
||||
|
:loading="tableObject.loading" |
||||
|
:pagination="{ |
||||
|
total: tableObject.total |
||||
|
}" |
||||
|
v-model:pageSize="tableObject.pageSize" |
||||
|
v-model:currentPage="tableObject.currentPage" |
||||
|
v-model:sort="tableObject.sort" |
||||
|
> |
||||
|
<template #number="{row}"> |
||||
|
<el-button type="primary" link @click="openDetail(row, '代码', row.number)"> |
||||
|
<span>{{ row.number }}</span> |
||||
|
</el-button> |
||||
|
</template> |
||||
|
<template #action="{ row,$index }"> |
||||
|
<ButtonBase :Butttondata="butttondata(row,$index)" @button-base-click="buttonTableClick($event,row)" /> |
||||
|
</template> |
||||
|
</Table> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 表单弹窗:添加/修改 --> |
||||
|
<BasicForm |
||||
|
ref="basicFormRef" |
||||
|
@success="getList" |
||||
|
:rules="ContainerRecordMainRules" |
||||
|
:formAllSchemas="ContainerRecordMain.allSchemas" |
||||
|
:tableAllSchemas="ContainerRecordDetail.allSchemas" |
||||
|
:tableFormRules="ContainerRecordDetailRules" |
||||
|
:isBusiness="true" |
||||
|
/> |
||||
|
|
||||
|
<!-- 详情 --> |
||||
|
<Detail |
||||
|
ref="detailRef" |
||||
|
:isBasic="false" |
||||
|
:allSchemas="ContainerRecordMain.allSchemas" |
||||
|
:detailAllSchemas="ContainerRecordDetail.allSchemas" |
||||
|
:detailAllSchemasRules="ContainerRecordDetailRules" |
||||
|
:apiPage="ContainerRecordDetailApi.getContainerRecordDetailPage" |
||||
|
:detailButtonIsShowAdd="false" |
||||
|
:detailButtonIsShowDelete="false" |
||||
|
:detailButtonIsShowUpdate="false" |
||||
|
/> |
||||
|
|
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import download from '@/utils/download' |
||||
|
import { ContainerRecordMain, ContainerRecordMainRules, ContainerRecordDetail, ContainerRecordDetailRules } from './moveContainerRecordMain.data' |
||||
|
|
||||
|
console.log(3444,ContainerRecordDetail) |
||||
|
import * as ContainerRecordMainApi from '@/api/wms/containerRecordMain' |
||||
|
import * as ContainerRecordDetailApi from '@/api/wms/containerRecordDetail' |
||||
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
||||
|
import TableHead from '@/components/TableHead/src/TableHead.vue' |
||||
|
import Detail from '@/components/Detail/src/Detail.vue' |
||||
|
import { CACHE_KEY, useCache } from '@/hooks/web/useCache' |
||||
|
import { formatDate } from '@/utils/formatTime' |
||||
|
import { usePageLoading } from '@/hooks/web/usePageLoading' |
||||
|
import { json } from 'stream/consumers' |
||||
|
const { loadStart, loadDone } = usePageLoading() |
||||
|
defineOptions({ name: 'ContainerRecordMain' }) |
||||
|
const message = useMessage() // 消息弹窗 |
||||
|
const { t } = useI18n() // 国际化 |
||||
|
const route = useRoute() // 路由信息 |
||||
|
const routeName = ref() |
||||
|
routeName.value = route.name |
||||
|
const businessType = ref() |
||||
|
const importFileName = ref() |
||||
|
const tableColumns = ref([...ContainerRecordMain.allSchemas.tableColumns, ...ContainerRecordDetail.allSchemas.tableMainColumns]) |
||||
|
// const ContainerRecordDetailTableColumns = ref(JSON.parse(JSON.stringify(ContainerRecordDetail.allSchemas.tableMainColumns))) |
||||
|
const ContainerRecordDetailAllSchemas = ref(JSON.parse(JSON.stringify(ContainerRecordDetail.allSchemas))) |
||||
|
console.log(2233,ContainerRecordDetail.allSchemas.tableMainColumns) |
||||
|
const searchType = ref() |
||||
|
const { tableObject, tableMethods } = useTable({ |
||||
|
getListApi: ContainerRecordDetailApi.getContainerRecordDetailPage // 分页接口 |
||||
|
}) |
||||
|
|
||||
|
// 判断 路由名称 进行条件过滤 |
||||
|
/** |
||||
|
* |
||||
|
*/ |
||||
|
if ( routeName.value == 'ReturnContainerManageRecord') { |
||||
|
tableObject.params = { |
||||
|
type:'RETURN' |
||||
|
} |
||||
|
searchType.value = 'RETURN' |
||||
|
businessType.value = 'ReturnContainerManage' |
||||
|
importFileName.value = '器具返回记录' |
||||
|
} else if ( routeName.value == 'MoveContainerManageRecord') { |
||||
|
tableObject.params = { |
||||
|
type:'MOVE' |
||||
|
} |
||||
|
searchType.value = 'MOVE' |
||||
|
businessType.value = 'MoveContainerManage' |
||||
|
importFileName.value = '器具转移记录' |
||||
|
} else if ( routeName.value == 'InitialContainerManageRecord') { |
||||
|
tableObject.params = { |
||||
|
type:'INITIAL', |
||||
|
} |
||||
|
searchType.value = 'INITIAL' |
||||
|
businessType.value = 'InitialContainerManage' |
||||
|
importFileName.value = '器具初始化记录' |
||||
|
} |
||||
|
else if ( routeName.value == 'ScrapContainerManageRecord') { |
||||
|
tableObject.params = { |
||||
|
type:'SCRAP' |
||||
|
} |
||||
|
searchType.value = 'SCRAP' |
||||
|
businessType.value = 'ScrapContainerManage' |
||||
|
importFileName.value = '器具报废记录' |
||||
|
} else if ( routeName.value == 'DeliverContainerManageRecord') { |
||||
|
tableObject.params = { |
||||
|
type: 'DELIVER', |
||||
|
} |
||||
|
searchType.value = 'DELIVER' |
||||
|
businessType.value = 'DeliverContainerManage' |
||||
|
importFileName.value = '器具发运记录' |
||||
|
} else if( routeName.value == 'ContainerManageRecord'){ |
||||
|
businessType.value = 'ContainerManage' |
||||
|
importFileName.value = '器具管理记录' |
||||
|
} |
||||
|
if ( routeName.value == 'InitialContainerManageRecord') { |
||||
|
const array = ContainerRecordDetail.allSchemas.tableMainColumns.filter(item=>item.field != "fromLocationCode") |
||||
|
ContainerRecordDetailAllSchemas.value.tableMainColumns = array |
||||
|
tableColumns.value = [...ContainerRecordMain.allSchemas.tableColumns,...ContainerRecordDetailAllSchemas.value.tableMainColumns] |
||||
|
} |
||||
|
else { |
||||
|
ContainerRecordDetail.allSchemas.tableMainColumns =JSON.parse(JSON.stringify(ContainerRecordDetail.allSchemas.tableMainColumns)) |
||||
|
tableColumns.value = [...ContainerRecordMain.allSchemas.tableColumns,...ContainerRecordDetail.allSchemas.tableMainColumns] |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
// 字段设置 更新主列表字段 |
||||
|
const updataTableColumns = (val) => { |
||||
|
tableColumns.value = val |
||||
|
} |
||||
|
|
||||
|
// 获得表格的各种操作 |
||||
|
const { getList, setSearchParams } = tableMethods |
||||
|
// 列表头部按钮 |
||||
|
const HeadButttondata = [ |
||||
|
// defaultButtons.defaultAddBtn({hasPermi:`wms:{routeName.value}:create`}), // 新增 |
||||
|
defaultButtons.defaultExportBtn({hasPermi:`wms:${routeName.value}:export`}), // 导出 |
||||
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
||||
|
defaultButtons.defaultFilterBtn(null), // 筛选 |
||||
|
defaultButtons.defaultSetBtn(null), // 设置 |
||||
|
// { |
||||
|
// label: '自定义扩展按钮', |
||||
|
// name: 'zdy', |
||||
|
// hide: false, |
||||
|
// type: 'primary', |
||||
|
// icon: 'Select', |
||||
|
// color: '' |
||||
|
// }, |
||||
|
] |
||||
|
|
||||
|
const searchList = (model)=>{ |
||||
|
model.type = searchType.value |
||||
|
setSearchParams(model) |
||||
|
} |
||||
|
|
||||
|
// 头部按钮事件 |
||||
|
const buttonBaseClick = (val, item) => { |
||||
|
if (val == 'add') { // 新增 |
||||
|
openForm('create') |
||||
|
} else if (val == 'export') { // 导出 |
||||
|
handleExport() |
||||
|
} else if (val == 'refresh') { // 刷新 |
||||
|
if (tableObject.params.filters && tableObject.params.filters.length > 0 ) { |
||||
|
searchFormClick({ |
||||
|
filters: tableObject.params.filters |
||||
|
}) |
||||
|
} else { |
||||
|
getList() |
||||
|
} |
||||
|
} else if (val == 'filtrate') { // 筛选 |
||||
|
} else { // 其他按钮 |
||||
|
console.log('其他按钮', item) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 列表-操作按钮 |
||||
|
const butttondata = (row,$index) => { |
||||
|
const findIndex = row['masterId']?tableObject.tableList.findIndex(item=>item['masterId'] == row['masterId']):-1 |
||||
|
if(findIndex>-1&&findIndex<$index){ |
||||
|
return [] |
||||
|
} |
||||
|
return [ |
||||
|
// defaultButtons.mainListEditBtn({hasPermi:`wms:{routeName.value}:update`}), // 编辑 |
||||
|
// defaultButtons.mainListDeleteBtn({hasPermi:`wms:{routeName.value}:delete`}), // 删除 |
||||
|
] |
||||
|
} |
||||
|
|
||||
|
// 列表-操作按钮事件 |
||||
|
const buttonTableClick = async (val, row) => { |
||||
|
if (val == 'edit') { // 编辑 |
||||
|
openForm('update', row) |
||||
|
} else if (val == 'delete') { // 删除 |
||||
|
handleDelete(row.id) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 获取部门 用于详情 部门回显 |
||||
|
const { wsCache } = useCache() |
||||
|
/** 详情操作 */ |
||||
|
const detailRef = ref() |
||||
|
const openDetail = (row: any, titleName: any, titleValue: any) => { |
||||
|
const departmentCode = wsCache.get(CACHE_KEY.DEPT).find((account) => account.id == row.departmentCode)?.name |
||||
|
if (departmentCode) row.departmentCode = JSON.parse(JSON.stringify(departmentCode)) |
||||
|
detailRef.value.openDetail(row, titleName, titleValue,"recordContainerMain") |
||||
|
} |
||||
|
|
||||
|
/** 添加/修改操作 */ |
||||
|
const basicFormRef = ref() |
||||
|
const openForm = (type: string, row?: any) => { |
||||
|
basicFormRef.value.open(type, row) |
||||
|
} |
||||
|
|
||||
|
/** 删除按钮操作 */ |
||||
|
const handleDelete = async (id: number) => { |
||||
|
try { |
||||
|
// 删除的二次确认 |
||||
|
await message.delConfirm() |
||||
|
// 发起删除 |
||||
|
await ContainerRecordMainApi.deleteContainerRecordMain(id) |
||||
|
message.success(t('common.delSuccess')) |
||||
|
// 刷新列表 |
||||
|
buttonBaseClick('refresh',null) |
||||
|
} catch {} |
||||
|
} |
||||
|
|
||||
|
/** 导出按钮操作 */ |
||||
|
const handleExport = async () => { |
||||
|
try { |
||||
|
// 导出的二次确认 |
||||
|
await message.exportConfirm() |
||||
|
// 发起导出 |
||||
|
loadStart() |
||||
|
const excelTitle = ref(route.meta.title) |
||||
|
if(businessType.value = 'InitialContainerManage'){ |
||||
|
const data = await ContainerRecordMainApi.exportContainerInitRecordMain(tableObject.params) |
||||
|
download.excel(data, `【${excelTitle.value}】【${formatDate(new Date())}】.xlsx`) |
||||
|
}else { |
||||
|
const data = await ContainerRecordMainApi.exportContainerRecordMain(tableObject.params) |
||||
|
download.excel(data, `【${excelTitle.value}】【${formatDate(new Date())}】.xlsx`) |
||||
|
} |
||||
|
} catch { |
||||
|
} finally { |
||||
|
loadDone() |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 筛选提交 |
||||
|
const searchFormClick = (searchData) => { |
||||
|
const cmd = { |
||||
|
'column':'type', |
||||
|
'action':'==', |
||||
|
'value':searchType.value |
||||
|
} |
||||
|
if (!Array.isArray(searchData.filters)) { |
||||
|
searchData.filters = []; |
||||
|
} |
||||
|
searchData.filters.push(cmd) |
||||
|
tableObject.params = { |
||||
|
isSearch: true, |
||||
|
filters: searchData.filters |
||||
|
} |
||||
|
getList() // 刷新当前列表 |
||||
|
} |
||||
|
|
||||
|
/** 初始化 **/ |
||||
|
onMounted(async () => { |
||||
|
getList() |
||||
|
}) |
||||
|
|
||||
|
</script> |
@ -0,0 +1,357 @@ |
|||||
|
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
||||
|
import { TableColumn } from '@/types/table' |
||||
|
import { dateFormatter } from '@/utils/formatTime' |
||||
|
|
||||
|
// 表单校验
|
||||
|
export const ContainerRecordMainRules = reactive({ |
||||
|
available: [required], |
||||
|
concurrencyStamp: [required], |
||||
|
}) |
||||
|
|
||||
|
// 获取当前操作人的部门
|
||||
|
import { useUserStore } from '@/store/modules/user' |
||||
|
const userStore = useUserStore() |
||||
|
const userDept = userStore.userSelfInfo.dept |
||||
|
// id 转str 否则form回显匹配不到
|
||||
|
userDept.id = userDept.id.toString() |
||||
|
const userDeptArray:any = [userDept] |
||||
|
|
||||
|
export const ContainerRecordMain = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: '单据号', |
||||
|
field: 'number', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
isForm: false, |
||||
|
table: { |
||||
|
width: 200 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '申请单号', |
||||
|
field: 'requestNumber', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '类型', |
||||
|
field: 'type', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.CONTAIN_MANAGE_TYPE, |
||||
|
dictClass: 'string', |
||||
|
isSearch: true, |
||||
|
isTable: true, |
||||
|
table: { |
||||
|
width: 120 |
||||
|
}, |
||||
|
form:{ |
||||
|
componentProps:{ |
||||
|
disabled: true, |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '是否可用', |
||||
|
field: 'available', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.TRUE_FALSE, |
||||
|
dictClass: 'string', |
||||
|
isForm: false, |
||||
|
isTable:false |
||||
|
}, |
||||
|
{ |
||||
|
label: '备注', |
||||
|
field: 'remark', |
||||
|
sort: 'custom', |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '部门', |
||||
|
field: 'departmentCode', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
isTable:false, |
||||
|
formatter: (_: Recordable, __: TableColumn, cellValue: number) => { |
||||
|
return userDeptArray.find((account) => account.id == cellValue)?.name |
||||
|
}, |
||||
|
form: { |
||||
|
value: userDept.id, |
||||
|
component: 'Select', |
||||
|
api: () => userDeptArray, |
||||
|
componentProps: { |
||||
|
disabled: true, |
||||
|
optionsAlias: { |
||||
|
labelField: 'name', |
||||
|
valueField: 'id' |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '扩展属性', |
||||
|
field: 'extraProperties', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '并发乐观锁', |
||||
|
field: 'concurrencyStamp', |
||||
|
sort: 'custom', |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
value: 0 |
||||
|
}, |
||||
|
isForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '地点ID', |
||||
|
field: 'siteId', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建时间', |
||||
|
field: 'createTime', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
detail: { |
||||
|
dateFormat : 'YYYY-MM-DD HH:mm:ss' |
||||
|
}, |
||||
|
table: { |
||||
|
width: 180 |
||||
|
}, |
||||
|
isSearch: false, |
||||
|
search: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
type: 'daterange', |
||||
|
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
||||
|
} |
||||
|
}, |
||||
|
isTable: false, |
||||
|
isForm: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建者', |
||||
|
field: 'creator', |
||||
|
table: { |
||||
|
width: 130 |
||||
|
}, |
||||
|
isForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '最后更新时间', |
||||
|
field: 'updateTime', |
||||
|
sort: 'custom', |
||||
|
isDetail: true, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
formatter: dateFormatter, |
||||
|
detail: { |
||||
|
dateFormat: 'YYYY-MM-DD HH:mm:ss' |
||||
|
}, |
||||
|
table: { |
||||
|
width: 180 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
style: {width:'100%'}, |
||||
|
type: 'datetime', |
||||
|
dateFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
valueFormat: 'x', |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '最后更新者', |
||||
|
field: 'updater', |
||||
|
isDetail: true, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
table: { |
||||
|
width: 150 |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作', |
||||
|
field: 'action', |
||||
|
isForm: false, |
||||
|
table: { |
||||
|
width: 150, |
||||
|
fixed: 'right' |
||||
|
} |
||||
|
} |
||||
|
])) |
||||
|
|
||||
|
// 表单校验
|
||||
|
export const ContainerRecordDetailRules = reactive({ |
||||
|
fromLocationCode: [required], |
||||
|
toLocationCode: [required], |
||||
|
concurrencyStamp: [required], |
||||
|
}) |
||||
|
|
||||
|
export const ContainerRecordDetail = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: 'id', |
||||
|
field: 'id', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '主表ID', |
||||
|
field: 'masterId', |
||||
|
sort: 'custom', |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
value: 0 |
||||
|
}, |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '单据号', |
||||
|
field: 'number', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '器具号', |
||||
|
field: 'containerNumber', |
||||
|
sort: 'custom' |
||||
|
}, |
||||
|
{ |
||||
|
label: '来源库位代码', |
||||
|
field: 'fromLocationCode', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: '目标库位代码', |
||||
|
field: 'toLocationCode', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: '到数量', |
||||
|
field: 'toQty', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: '计量单位', |
||||
|
field: 'uom', |
||||
|
dictType: DICT_TYPE.UOM, |
||||
|
dictClass: 'string', |
||||
|
isTable: true, |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
tableForm:{ |
||||
|
disabled: true, |
||||
|
type: 'Select' |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '备注', |
||||
|
field: 'remark', |
||||
|
sort: 'custom', |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建时间', |
||||
|
field: 'createTime', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
detail: { |
||||
|
dateFormat : 'YYYY-MM-DD HH:mm:ss' |
||||
|
}, |
||||
|
table: { |
||||
|
width: 180 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
type: 'datetime', |
||||
|
dateFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
valueFormat: 'x', |
||||
|
} |
||||
|
}, |
||||
|
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')] |
||||
|
} |
||||
|
}, |
||||
|
isTable: true, |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建者', |
||||
|
field: 'creator', |
||||
|
table: { |
||||
|
width: 130 |
||||
|
}, |
||||
|
isForm: false, |
||||
|
isTable: true |
||||
|
}, |
||||
|
{ |
||||
|
label: '地点ID', |
||||
|
field: 'siteId', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '并发乐观锁', |
||||
|
field: 'concurrencyStamp', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '从货主代码', |
||||
|
field: 'fromOwnerCode', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '到货主代码', |
||||
|
field: 'toOwnerCode', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作', |
||||
|
field: 'action', |
||||
|
isForm: false, |
||||
|
hiddenInMain:true, |
||||
|
isTableForm: false, |
||||
|
isTable: false, |
||||
|
table: { |
||||
|
width: 150, |
||||
|
fixed: 'right' |
||||
|
} |
||||
|
} |
||||
|
])) |
@ -0,0 +1,299 @@ |
|||||
|
<template> |
||||
|
<ContentWrap> |
||||
|
<!-- 搜索工作栏 --> |
||||
|
<Search :schema="[...ContainerRecordMain.allSchemas.searchSchema,...ContainerRecordDetail.allSchemas.searchSchema]" @search="searchList" @reset="searchList" /> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 列表头部 --> |
||||
|
<TableHead |
||||
|
:HeadButttondata="HeadButttondata" |
||||
|
@button-base-click="buttonBaseClick" |
||||
|
:routeName="routeName" |
||||
|
@updataTableColumns="updataTableColumns" |
||||
|
@searchFormClick="searchFormClick" |
||||
|
:allSchemas="ContainerRecordMain.allSchemas" |
||||
|
:detailAllSchemas="ContainerRecordDetailAllSchemas" |
||||
|
/> |
||||
|
|
||||
|
<!-- 列表 --> |
||||
|
<ContentWrap> |
||||
|
<Table |
||||
|
:columns="tableColumns" |
||||
|
:data="tableObject.tableList" |
||||
|
:loading="tableObject.loading" |
||||
|
:pagination="{ |
||||
|
total: tableObject.total |
||||
|
}" |
||||
|
v-model:pageSize="tableObject.pageSize" |
||||
|
v-model:currentPage="tableObject.currentPage" |
||||
|
v-model:sort="tableObject.sort" |
||||
|
> |
||||
|
<template #number="{row}"> |
||||
|
<el-button type="primary" link @click="openDetail(row, '代码', row.number)"> |
||||
|
<span>{{ row.number }}</span> |
||||
|
</el-button> |
||||
|
</template> |
||||
|
<template #action="{ row,$index }"> |
||||
|
<ButtonBase :Butttondata="butttondata(row,$index)" @button-base-click="buttonTableClick($event,row)" /> |
||||
|
</template> |
||||
|
</Table> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 表单弹窗:添加/修改 --> |
||||
|
<BasicForm |
||||
|
ref="basicFormRef" |
||||
|
@success="getList" |
||||
|
:rules="ContainerRecordMainRules" |
||||
|
:formAllSchemas="ContainerRecordMain.allSchemas" |
||||
|
:tableAllSchemas="ContainerRecordDetail.allSchemas" |
||||
|
:tableFormRules="ContainerRecordDetailRules" |
||||
|
:isBusiness="true" |
||||
|
/> |
||||
|
|
||||
|
<!-- 详情 --> |
||||
|
<Detail |
||||
|
ref="detailRef" |
||||
|
:isBasic="false" |
||||
|
:allSchemas="ContainerRecordMain.allSchemas" |
||||
|
:detailAllSchemas="ContainerRecordDetail.allSchemas" |
||||
|
:detailAllSchemasRules="ContainerRecordDetailRules" |
||||
|
:apiPage="ContainerRecordDetailApi.getContainerRecordDetailPage" |
||||
|
:detailButtonIsShowAdd="false" |
||||
|
:detailButtonIsShowDelete="false" |
||||
|
:detailButtonIsShowUpdate="false" |
||||
|
/> |
||||
|
|
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import download from '@/utils/download' |
||||
|
import { ContainerRecordMain, ContainerRecordMainRules, ContainerRecordDetail, ContainerRecordDetailRules } from './moveContainerRecordMain.data' |
||||
|
|
||||
|
console.log(3444,ContainerRecordDetail) |
||||
|
import * as ContainerRecordMainApi from '@/api/wms/containerRecordMain' |
||||
|
import * as ContainerRecordDetailApi from '@/api/wms/containerRecordDetail' |
||||
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
||||
|
import TableHead from '@/components/TableHead/src/TableHead.vue' |
||||
|
import Detail from '@/components/Detail/src/Detail.vue' |
||||
|
import { CACHE_KEY, useCache } from '@/hooks/web/useCache' |
||||
|
import { formatDate } from '@/utils/formatTime' |
||||
|
import { usePageLoading } from '@/hooks/web/usePageLoading' |
||||
|
import { json } from 'stream/consumers' |
||||
|
const { loadStart, loadDone } = usePageLoading() |
||||
|
defineOptions({ name: 'ContainerRecordMain' }) |
||||
|
const message = useMessage() // 消息弹窗 |
||||
|
const { t } = useI18n() // 国际化 |
||||
|
const route = useRoute() // 路由信息 |
||||
|
const routeName = ref() |
||||
|
routeName.value = route.name |
||||
|
const businessType = ref() |
||||
|
const importFileName = ref() |
||||
|
const tableColumns = ref([...ContainerRecordMain.allSchemas.tableColumns, ...ContainerRecordDetail.allSchemas.tableMainColumns]) |
||||
|
// const ContainerRecordDetailTableColumns = ref(JSON.parse(JSON.stringify(ContainerRecordDetail.allSchemas.tableMainColumns))) |
||||
|
const ContainerRecordDetailAllSchemas = ref(JSON.parse(JSON.stringify(ContainerRecordDetail.allSchemas))) |
||||
|
console.log(2233,ContainerRecordDetail.allSchemas.tableMainColumns) |
||||
|
const searchType = ref() |
||||
|
const { tableObject, tableMethods } = useTable({ |
||||
|
getListApi: ContainerRecordDetailApi.getContainerRecordDetailPage // 分页接口 |
||||
|
}) |
||||
|
|
||||
|
// 判断 路由名称 进行条件过滤 |
||||
|
/** |
||||
|
* |
||||
|
*/ |
||||
|
if ( routeName.value == 'ReturnContainerManageRecord') { |
||||
|
tableObject.params = { |
||||
|
type:'RETURN' |
||||
|
} |
||||
|
searchType.value = 'RETURN' |
||||
|
businessType.value = 'ReturnContainerManage' |
||||
|
importFileName.value = '器具返回记录' |
||||
|
} else if ( routeName.value == 'MoveContainerManageRecord') { |
||||
|
tableObject.params = { |
||||
|
type:'MOVE' |
||||
|
} |
||||
|
searchType.value = 'MOVE' |
||||
|
businessType.value = 'MoveContainerManage' |
||||
|
importFileName.value = '器具转移记录' |
||||
|
} else if ( routeName.value == 'InitialContainerManageRecord') { |
||||
|
tableObject.params = { |
||||
|
type:'INITIAL', |
||||
|
} |
||||
|
searchType.value = 'INITIAL' |
||||
|
businessType.value = 'InitialContainerManage' |
||||
|
importFileName.value = '器具初始化记录' |
||||
|
} |
||||
|
else if ( routeName.value == 'ScrapContainerManageRecord') { |
||||
|
tableObject.params = { |
||||
|
type:'SCRAP' |
||||
|
} |
||||
|
searchType.value = 'SCRAP' |
||||
|
businessType.value = 'ScrapContainerManage' |
||||
|
importFileName.value = '器具报废记录' |
||||
|
} else if ( routeName.value == 'DeliverContainerManageRecord') { |
||||
|
tableObject.params = { |
||||
|
type: 'DELIVER', |
||||
|
} |
||||
|
searchType.value = 'DELIVER' |
||||
|
businessType.value = 'DeliverContainerManage' |
||||
|
importFileName.value = '器具发运记录' |
||||
|
} else if( routeName.value == 'ContainerManageRecord'){ |
||||
|
businessType.value = 'ContainerManage' |
||||
|
importFileName.value = '器具管理记录' |
||||
|
} |
||||
|
if ( routeName.value == 'InitialContainerManageRecord') { |
||||
|
const array = ContainerRecordDetail.allSchemas.tableMainColumns.filter(item=>item.field != "fromLocationCode") |
||||
|
ContainerRecordDetailAllSchemas.value.tableMainColumns = array |
||||
|
tableColumns.value = [...ContainerRecordMain.allSchemas.tableColumns,...ContainerRecordDetailAllSchemas.value.tableMainColumns] |
||||
|
} |
||||
|
else { |
||||
|
ContainerRecordDetail.allSchemas.tableMainColumns =JSON.parse(JSON.stringify(ContainerRecordDetail.allSchemas.tableMainColumns)) |
||||
|
tableColumns.value = [...ContainerRecordMain.allSchemas.tableColumns,...ContainerRecordDetail.allSchemas.tableMainColumns] |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
// 字段设置 更新主列表字段 |
||||
|
const updataTableColumns = (val) => { |
||||
|
tableColumns.value = val |
||||
|
} |
||||
|
|
||||
|
// 获得表格的各种操作 |
||||
|
const { getList, setSearchParams } = tableMethods |
||||
|
// 列表头部按钮 |
||||
|
const HeadButttondata = [ |
||||
|
// defaultButtons.defaultAddBtn({hasPermi:`wms:{routeName.value}:create`}), // 新增 |
||||
|
defaultButtons.defaultExportBtn({hasPermi:`wms:${routeName.value}:export`}), // 导出 |
||||
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
||||
|
defaultButtons.defaultFilterBtn(null), // 筛选 |
||||
|
defaultButtons.defaultSetBtn(null), // 设置 |
||||
|
// { |
||||
|
// label: '自定义扩展按钮', |
||||
|
// name: 'zdy', |
||||
|
// hide: false, |
||||
|
// type: 'primary', |
||||
|
// icon: 'Select', |
||||
|
// color: '' |
||||
|
// }, |
||||
|
] |
||||
|
|
||||
|
const searchList = (model)=>{ |
||||
|
model.type = searchType.value |
||||
|
setSearchParams(model) |
||||
|
} |
||||
|
|
||||
|
// 头部按钮事件 |
||||
|
const buttonBaseClick = (val, item) => { |
||||
|
if (val == 'add') { // 新增 |
||||
|
openForm('create') |
||||
|
} else if (val == 'export') { // 导出 |
||||
|
handleExport() |
||||
|
} else if (val == 'refresh') { // 刷新 |
||||
|
if (tableObject.params.filters && tableObject.params.filters.length > 0 ) { |
||||
|
searchFormClick({ |
||||
|
filters: tableObject.params.filters |
||||
|
}) |
||||
|
} else { |
||||
|
getList() |
||||
|
} |
||||
|
} else if (val == 'filtrate') { // 筛选 |
||||
|
} else { // 其他按钮 |
||||
|
console.log('其他按钮', item) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 列表-操作按钮 |
||||
|
const butttondata = (row,$index) => { |
||||
|
const findIndex = row['masterId']?tableObject.tableList.findIndex(item=>item['masterId'] == row['masterId']):-1 |
||||
|
if(findIndex>-1&&findIndex<$index){ |
||||
|
return [] |
||||
|
} |
||||
|
return [ |
||||
|
// defaultButtons.mainListEditBtn({hasPermi:`wms:{routeName.value}:update`}), // 编辑 |
||||
|
// defaultButtons.mainListDeleteBtn({hasPermi:`wms:{routeName.value}:delete`}), // 删除 |
||||
|
] |
||||
|
} |
||||
|
|
||||
|
// 列表-操作按钮事件 |
||||
|
const buttonTableClick = async (val, row) => { |
||||
|
if (val == 'edit') { // 编辑 |
||||
|
openForm('update', row) |
||||
|
} else if (val == 'delete') { // 删除 |
||||
|
handleDelete(row.id) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 获取部门 用于详情 部门回显 |
||||
|
const { wsCache } = useCache() |
||||
|
/** 详情操作 */ |
||||
|
const detailRef = ref() |
||||
|
const openDetail = (row: any, titleName: any, titleValue: any) => { |
||||
|
const departmentCode = wsCache.get(CACHE_KEY.DEPT).find((account) => account.id == row.departmentCode)?.name |
||||
|
if (departmentCode) row.departmentCode = JSON.parse(JSON.stringify(departmentCode)) |
||||
|
detailRef.value.openDetail(row, titleName, titleValue,"recordContainerMain") |
||||
|
} |
||||
|
|
||||
|
/** 添加/修改操作 */ |
||||
|
const basicFormRef = ref() |
||||
|
const openForm = (type: string, row?: any) => { |
||||
|
basicFormRef.value.open(type, row) |
||||
|
} |
||||
|
|
||||
|
/** 删除按钮操作 */ |
||||
|
const handleDelete = async (id: number) => { |
||||
|
try { |
||||
|
// 删除的二次确认 |
||||
|
await message.delConfirm() |
||||
|
// 发起删除 |
||||
|
await ContainerRecordMainApi.deleteContainerRecordMain(id) |
||||
|
message.success(t('common.delSuccess')) |
||||
|
// 刷新列表 |
||||
|
buttonBaseClick('refresh',null) |
||||
|
} catch {} |
||||
|
} |
||||
|
|
||||
|
/** 导出按钮操作 */ |
||||
|
const handleExport = async () => { |
||||
|
try { |
||||
|
// 导出的二次确认 |
||||
|
await message.exportConfirm() |
||||
|
// 发起导出 |
||||
|
loadStart() |
||||
|
const excelTitle = ref(route.meta.title) |
||||
|
if(businessType.value = 'InitialContainerManage'){ |
||||
|
const data = await ContainerRecordMainApi.exportContainerInitRecordMain(tableObject.params) |
||||
|
download.excel(data, `【${excelTitle.value}】【${formatDate(new Date())}】.xlsx`) |
||||
|
}else { |
||||
|
const data = await ContainerRecordMainApi.exportContainerRecordMain(tableObject.params) |
||||
|
download.excel(data, `【${excelTitle.value}】【${formatDate(new Date())}】.xlsx`) |
||||
|
} |
||||
|
} catch { |
||||
|
} finally { |
||||
|
loadDone() |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 筛选提交 |
||||
|
const searchFormClick = (searchData) => { |
||||
|
const cmd = { |
||||
|
'column':'type', |
||||
|
'action':'==', |
||||
|
'value':searchType.value |
||||
|
} |
||||
|
if (!Array.isArray(searchData.filters)) { |
||||
|
searchData.filters = []; |
||||
|
} |
||||
|
searchData.filters.push(cmd) |
||||
|
tableObject.params = { |
||||
|
isSearch: true, |
||||
|
filters: searchData.filters |
||||
|
} |
||||
|
getList() // 刷新当前列表 |
||||
|
} |
||||
|
|
||||
|
/** 初始化 **/ |
||||
|
onMounted(async () => { |
||||
|
getList() |
||||
|
}) |
||||
|
|
||||
|
</script> |
@ -0,0 +1,357 @@ |
|||||
|
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
||||
|
import { TableColumn } from '@/types/table' |
||||
|
import { dateFormatter } from '@/utils/formatTime' |
||||
|
|
||||
|
// 表单校验
|
||||
|
export const ContainerRecordMainRules = reactive({ |
||||
|
available: [required], |
||||
|
concurrencyStamp: [required], |
||||
|
}) |
||||
|
|
||||
|
// 获取当前操作人的部门
|
||||
|
import { useUserStore } from '@/store/modules/user' |
||||
|
const userStore = useUserStore() |
||||
|
const userDept = userStore.userSelfInfo.dept |
||||
|
// id 转str 否则form回显匹配不到
|
||||
|
userDept.id = userDept.id.toString() |
||||
|
const userDeptArray:any = [userDept] |
||||
|
|
||||
|
export const ContainerRecordMain = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: '单据号', |
||||
|
field: 'number', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
isForm: false, |
||||
|
table: { |
||||
|
width: 200 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '申请单号', |
||||
|
field: 'requestNumber', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '类型', |
||||
|
field: 'type', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.CONTAIN_MANAGE_TYPE, |
||||
|
dictClass: 'string', |
||||
|
isSearch: true, |
||||
|
isTable: true, |
||||
|
table: { |
||||
|
width: 120 |
||||
|
}, |
||||
|
form:{ |
||||
|
componentProps:{ |
||||
|
disabled: true, |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '是否可用', |
||||
|
field: 'available', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.TRUE_FALSE, |
||||
|
dictClass: 'string', |
||||
|
isForm: false, |
||||
|
isTable:false |
||||
|
}, |
||||
|
{ |
||||
|
label: '备注', |
||||
|
field: 'remark', |
||||
|
sort: 'custom', |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '部门', |
||||
|
field: 'departmentCode', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
isTable:false, |
||||
|
formatter: (_: Recordable, __: TableColumn, cellValue: number) => { |
||||
|
return userDeptArray.find((account) => account.id == cellValue)?.name |
||||
|
}, |
||||
|
form: { |
||||
|
value: userDept.id, |
||||
|
component: 'Select', |
||||
|
api: () => userDeptArray, |
||||
|
componentProps: { |
||||
|
disabled: true, |
||||
|
optionsAlias: { |
||||
|
labelField: 'name', |
||||
|
valueField: 'id' |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '扩展属性', |
||||
|
field: 'extraProperties', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '并发乐观锁', |
||||
|
field: 'concurrencyStamp', |
||||
|
sort: 'custom', |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
value: 0 |
||||
|
}, |
||||
|
isForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '地点ID', |
||||
|
field: 'siteId', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建时间', |
||||
|
field: 'createTime', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
detail: { |
||||
|
dateFormat : 'YYYY-MM-DD HH:mm:ss' |
||||
|
}, |
||||
|
table: { |
||||
|
width: 180 |
||||
|
}, |
||||
|
isSearch: false, |
||||
|
search: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
type: 'daterange', |
||||
|
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
||||
|
} |
||||
|
}, |
||||
|
isTable: false, |
||||
|
isForm: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建者', |
||||
|
field: 'creator', |
||||
|
table: { |
||||
|
width: 130 |
||||
|
}, |
||||
|
isForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '最后更新时间', |
||||
|
field: 'updateTime', |
||||
|
sort: 'custom', |
||||
|
isDetail: true, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
formatter: dateFormatter, |
||||
|
detail: { |
||||
|
dateFormat: 'YYYY-MM-DD HH:mm:ss' |
||||
|
}, |
||||
|
table: { |
||||
|
width: 180 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
style: {width:'100%'}, |
||||
|
type: 'datetime', |
||||
|
dateFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
valueFormat: 'x', |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '最后更新者', |
||||
|
field: 'updater', |
||||
|
isDetail: true, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
table: { |
||||
|
width: 150 |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作', |
||||
|
field: 'action', |
||||
|
isForm: false, |
||||
|
table: { |
||||
|
width: 150, |
||||
|
fixed: 'right' |
||||
|
} |
||||
|
} |
||||
|
])) |
||||
|
|
||||
|
// 表单校验
|
||||
|
export const ContainerRecordDetailRules = reactive({ |
||||
|
fromLocationCode: [required], |
||||
|
toLocationCode: [required], |
||||
|
concurrencyStamp: [required], |
||||
|
}) |
||||
|
|
||||
|
export const ContainerRecordDetail = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: 'id', |
||||
|
field: 'id', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '主表ID', |
||||
|
field: 'masterId', |
||||
|
sort: 'custom', |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
value: 0 |
||||
|
}, |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '单据号', |
||||
|
field: 'number', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '器具号', |
||||
|
field: 'containerNumber', |
||||
|
sort: 'custom' |
||||
|
}, |
||||
|
{ |
||||
|
label: '来源库位代码', |
||||
|
field: 'fromLocationCode', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: '目标库位代码', |
||||
|
field: 'toLocationCode', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: '到数量', |
||||
|
field: 'toQty', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: '计量单位', |
||||
|
field: 'uom', |
||||
|
dictType: DICT_TYPE.UOM, |
||||
|
dictClass: 'string', |
||||
|
isTable: true, |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
tableForm:{ |
||||
|
disabled: true, |
||||
|
type: 'Select' |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '备注', |
||||
|
field: 'remark', |
||||
|
sort: 'custom', |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建时间', |
||||
|
field: 'createTime', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
detail: { |
||||
|
dateFormat : 'YYYY-MM-DD HH:mm:ss' |
||||
|
}, |
||||
|
table: { |
||||
|
width: 180 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
type: 'datetime', |
||||
|
dateFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
valueFormat: 'x', |
||||
|
} |
||||
|
}, |
||||
|
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')] |
||||
|
} |
||||
|
}, |
||||
|
isTable: true, |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建者', |
||||
|
field: 'creator', |
||||
|
table: { |
||||
|
width: 130 |
||||
|
}, |
||||
|
isForm: false, |
||||
|
isTable: true |
||||
|
}, |
||||
|
{ |
||||
|
label: '地点ID', |
||||
|
field: 'siteId', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '并发乐观锁', |
||||
|
field: 'concurrencyStamp', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '从货主代码', |
||||
|
field: 'fromOwnerCode', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '到货主代码', |
||||
|
field: 'toOwnerCode', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作', |
||||
|
field: 'action', |
||||
|
isForm: false, |
||||
|
hiddenInMain:true, |
||||
|
isTableForm: false, |
||||
|
isTable: false, |
||||
|
table: { |
||||
|
width: 150, |
||||
|
fixed: 'right' |
||||
|
} |
||||
|
} |
||||
|
])) |
@ -0,0 +1,299 @@ |
|||||
|
<template> |
||||
|
<ContentWrap> |
||||
|
<!-- 搜索工作栏 --> |
||||
|
<Search :schema="[...ContainerRecordMain.allSchemas.searchSchema,...ContainerRecordDetail.allSchemas.searchSchema]" @search="searchList" @reset="searchList" /> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 列表头部 --> |
||||
|
<TableHead |
||||
|
:HeadButttondata="HeadButttondata" |
||||
|
@button-base-click="buttonBaseClick" |
||||
|
:routeName="routeName" |
||||
|
@updataTableColumns="updataTableColumns" |
||||
|
@searchFormClick="searchFormClick" |
||||
|
:allSchemas="ContainerRecordMain.allSchemas" |
||||
|
:detailAllSchemas="ContainerRecordDetailAllSchemas" |
||||
|
/> |
||||
|
|
||||
|
<!-- 列表 --> |
||||
|
<ContentWrap> |
||||
|
<Table |
||||
|
:columns="tableColumns" |
||||
|
:data="tableObject.tableList" |
||||
|
:loading="tableObject.loading" |
||||
|
:pagination="{ |
||||
|
total: tableObject.total |
||||
|
}" |
||||
|
v-model:pageSize="tableObject.pageSize" |
||||
|
v-model:currentPage="tableObject.currentPage" |
||||
|
v-model:sort="tableObject.sort" |
||||
|
> |
||||
|
<template #number="{row}"> |
||||
|
<el-button type="primary" link @click="openDetail(row, '代码', row.number)"> |
||||
|
<span>{{ row.number }}</span> |
||||
|
</el-button> |
||||
|
</template> |
||||
|
<template #action="{ row,$index }"> |
||||
|
<ButtonBase :Butttondata="butttondata(row,$index)" @button-base-click="buttonTableClick($event,row)" /> |
||||
|
</template> |
||||
|
</Table> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 表单弹窗:添加/修改 --> |
||||
|
<BasicForm |
||||
|
ref="basicFormRef" |
||||
|
@success="getList" |
||||
|
:rules="ContainerRecordMainRules" |
||||
|
:formAllSchemas="ContainerRecordMain.allSchemas" |
||||
|
:tableAllSchemas="ContainerRecordDetail.allSchemas" |
||||
|
:tableFormRules="ContainerRecordDetailRules" |
||||
|
:isBusiness="true" |
||||
|
/> |
||||
|
|
||||
|
<!-- 详情 --> |
||||
|
<Detail |
||||
|
ref="detailRef" |
||||
|
:isBasic="false" |
||||
|
:allSchemas="ContainerRecordMain.allSchemas" |
||||
|
:detailAllSchemas="ContainerRecordDetail.allSchemas" |
||||
|
:detailAllSchemasRules="ContainerRecordDetailRules" |
||||
|
:apiPage="ContainerRecordDetailApi.getContainerRecordDetailPage" |
||||
|
:detailButtonIsShowAdd="false" |
||||
|
:detailButtonIsShowDelete="false" |
||||
|
:detailButtonIsShowUpdate="false" |
||||
|
/> |
||||
|
|
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import download from '@/utils/download' |
||||
|
import { ContainerRecordMain, ContainerRecordMainRules, ContainerRecordDetail, ContainerRecordDetailRules } from './initialContainerRecordMain.data' |
||||
|
|
||||
|
console.log(3444,ContainerRecordDetail) |
||||
|
import * as ContainerRecordMainApi from '@/api/wms/containerRecordMain' |
||||
|
import * as ContainerRecordDetailApi from '@/api/wms/containerRecordDetail' |
||||
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
||||
|
import TableHead from '@/components/TableHead/src/TableHead.vue' |
||||
|
import Detail from '@/components/Detail/src/Detail.vue' |
||||
|
import { CACHE_KEY, useCache } from '@/hooks/web/useCache' |
||||
|
import { formatDate } from '@/utils/formatTime' |
||||
|
import { usePageLoading } from '@/hooks/web/usePageLoading' |
||||
|
import { json } from 'stream/consumers' |
||||
|
const { loadStart, loadDone } = usePageLoading() |
||||
|
defineOptions({ name: 'ContainerRecordMain' }) |
||||
|
const message = useMessage() // 消息弹窗 |
||||
|
const { t } = useI18n() // 国际化 |
||||
|
const route = useRoute() // 路由信息 |
||||
|
const routeName = ref() |
||||
|
routeName.value = route.name |
||||
|
const businessType = ref() |
||||
|
const importFileName = ref() |
||||
|
const tableColumns = ref([...ContainerRecordMain.allSchemas.tableColumns, ...ContainerRecordDetail.allSchemas.tableMainColumns]) |
||||
|
// const ContainerRecordDetailTableColumns = ref(JSON.parse(JSON.stringify(ContainerRecordDetail.allSchemas.tableMainColumns))) |
||||
|
const ContainerRecordDetailAllSchemas = ref(JSON.parse(JSON.stringify(ContainerRecordDetail.allSchemas))) |
||||
|
console.log(2233,ContainerRecordDetail.allSchemas.tableMainColumns) |
||||
|
const searchType = ref() |
||||
|
const { tableObject, tableMethods } = useTable({ |
||||
|
getListApi: ContainerRecordDetailApi.getContainerRecordDetailPage // 分页接口 |
||||
|
}) |
||||
|
|
||||
|
// 判断 路由名称 进行条件过滤 |
||||
|
/** |
||||
|
* |
||||
|
*/ |
||||
|
if ( routeName.value == 'ReturnContainerManageRecord') { |
||||
|
tableObject.params = { |
||||
|
type:'RETURN' |
||||
|
} |
||||
|
searchType.value = 'RETURN' |
||||
|
businessType.value = 'ReturnContainerManage' |
||||
|
importFileName.value = '器具返回记录' |
||||
|
} else if ( routeName.value == 'MoveContainerManageRecord') { |
||||
|
tableObject.params = { |
||||
|
type:'MOVE' |
||||
|
} |
||||
|
searchType.value = 'MOVE' |
||||
|
businessType.value = 'MoveContainerManage' |
||||
|
importFileName.value = '器具转移记录' |
||||
|
} else if ( routeName.value == 'InitialContainerManageRecord') { |
||||
|
tableObject.params = { |
||||
|
type:'INITIAL', |
||||
|
} |
||||
|
searchType.value = 'INITIAL' |
||||
|
businessType.value = 'InitialContainerManage' |
||||
|
importFileName.value = '器具初始化记录' |
||||
|
} |
||||
|
else if ( routeName.value == 'ScrapContainerManageRecord') { |
||||
|
tableObject.params = { |
||||
|
type:'SCRAP' |
||||
|
} |
||||
|
searchType.value = 'SCRAP' |
||||
|
businessType.value = 'ScrapContainerManage' |
||||
|
importFileName.value = '器具报废记录' |
||||
|
} else if ( routeName.value == 'DeliverContainerManageRecord') { |
||||
|
tableObject.params = { |
||||
|
type: 'DELIVER', |
||||
|
} |
||||
|
searchType.value = 'DELIVER' |
||||
|
businessType.value = 'DeliverContainerManage' |
||||
|
importFileName.value = '器具发运记录' |
||||
|
} else if( routeName.value == 'ContainerManageRecord'){ |
||||
|
businessType.value = 'ContainerManage' |
||||
|
importFileName.value = '器具管理记录' |
||||
|
} |
||||
|
if ( routeName.value == 'InitialContainerManageRecord') { |
||||
|
const array = ContainerRecordDetail.allSchemas.tableMainColumns.filter(item=>item.field != "fromLocationCode") |
||||
|
ContainerRecordDetailAllSchemas.value.tableMainColumns = array |
||||
|
tableColumns.value = [...ContainerRecordMain.allSchemas.tableColumns,...ContainerRecordDetailAllSchemas.value.tableMainColumns] |
||||
|
} |
||||
|
else { |
||||
|
ContainerRecordDetail.allSchemas.tableMainColumns =JSON.parse(JSON.stringify(ContainerRecordDetail.allSchemas.tableMainColumns)) |
||||
|
tableColumns.value = [...ContainerRecordMain.allSchemas.tableColumns,...ContainerRecordDetail.allSchemas.tableMainColumns] |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
// 字段设置 更新主列表字段 |
||||
|
const updataTableColumns = (val) => { |
||||
|
tableColumns.value = val |
||||
|
} |
||||
|
|
||||
|
// 获得表格的各种操作 |
||||
|
const { getList, setSearchParams } = tableMethods |
||||
|
// 列表头部按钮 |
||||
|
const HeadButttondata = [ |
||||
|
// defaultButtons.defaultAddBtn({hasPermi:`wms:{routeName.value}:create`}), // 新增 |
||||
|
defaultButtons.defaultExportBtn({hasPermi:`wms:${routeName.value}:export`}), // 导出 |
||||
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
||||
|
defaultButtons.defaultFilterBtn(null), // 筛选 |
||||
|
defaultButtons.defaultSetBtn(null), // 设置 |
||||
|
// { |
||||
|
// label: '自定义扩展按钮', |
||||
|
// name: 'zdy', |
||||
|
// hide: false, |
||||
|
// type: 'primary', |
||||
|
// icon: 'Select', |
||||
|
// color: '' |
||||
|
// }, |
||||
|
] |
||||
|
|
||||
|
const searchList = (model)=>{ |
||||
|
model.type = searchType.value |
||||
|
setSearchParams(model) |
||||
|
} |
||||
|
|
||||
|
// 头部按钮事件 |
||||
|
const buttonBaseClick = (val, item) => { |
||||
|
if (val == 'add') { // 新增 |
||||
|
openForm('create') |
||||
|
} else if (val == 'export') { // 导出 |
||||
|
handleExport() |
||||
|
} else if (val == 'refresh') { // 刷新 |
||||
|
if (tableObject.params.filters && tableObject.params.filters.length > 0 ) { |
||||
|
searchFormClick({ |
||||
|
filters: tableObject.params.filters |
||||
|
}) |
||||
|
} else { |
||||
|
getList() |
||||
|
} |
||||
|
} else if (val == 'filtrate') { // 筛选 |
||||
|
} else { // 其他按钮 |
||||
|
console.log('其他按钮', item) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 列表-操作按钮 |
||||
|
const butttondata = (row,$index) => { |
||||
|
const findIndex = row['masterId']?tableObject.tableList.findIndex(item=>item['masterId'] == row['masterId']):-1 |
||||
|
if(findIndex>-1&&findIndex<$index){ |
||||
|
return [] |
||||
|
} |
||||
|
return [ |
||||
|
// defaultButtons.mainListEditBtn({hasPermi:`wms:{routeName.value}:update`}), // 编辑 |
||||
|
// defaultButtons.mainListDeleteBtn({hasPermi:`wms:{routeName.value}:delete`}), // 删除 |
||||
|
] |
||||
|
} |
||||
|
|
||||
|
// 列表-操作按钮事件 |
||||
|
const buttonTableClick = async (val, row) => { |
||||
|
if (val == 'edit') { // 编辑 |
||||
|
openForm('update', row) |
||||
|
} else if (val == 'delete') { // 删除 |
||||
|
handleDelete(row.id) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 获取部门 用于详情 部门回显 |
||||
|
const { wsCache } = useCache() |
||||
|
/** 详情操作 */ |
||||
|
const detailRef = ref() |
||||
|
const openDetail = (row: any, titleName: any, titleValue: any) => { |
||||
|
const departmentCode = wsCache.get(CACHE_KEY.DEPT).find((account) => account.id == row.departmentCode)?.name |
||||
|
if (departmentCode) row.departmentCode = JSON.parse(JSON.stringify(departmentCode)) |
||||
|
detailRef.value.openDetail(row, titleName, titleValue,"recordContainerMain") |
||||
|
} |
||||
|
|
||||
|
/** 添加/修改操作 */ |
||||
|
const basicFormRef = ref() |
||||
|
const openForm = (type: string, row?: any) => { |
||||
|
basicFormRef.value.open(type, row) |
||||
|
} |
||||
|
|
||||
|
/** 删除按钮操作 */ |
||||
|
const handleDelete = async (id: number) => { |
||||
|
try { |
||||
|
// 删除的二次确认 |
||||
|
await message.delConfirm() |
||||
|
// 发起删除 |
||||
|
await ContainerRecordMainApi.deleteContainerRecordMain(id) |
||||
|
message.success(t('common.delSuccess')) |
||||
|
// 刷新列表 |
||||
|
buttonBaseClick('refresh',null) |
||||
|
} catch {} |
||||
|
} |
||||
|
|
||||
|
/** 导出按钮操作 */ |
||||
|
const handleExport = async () => { |
||||
|
try { |
||||
|
// 导出的二次确认 |
||||
|
await message.exportConfirm() |
||||
|
// 发起导出 |
||||
|
loadStart() |
||||
|
const excelTitle = ref(route.meta.title) |
||||
|
if(businessType.value = 'InitialContainerManage'){ |
||||
|
const data = await ContainerRecordMainApi.exportContainerInitRecordMain(tableObject.params) |
||||
|
download.excel(data, `【${excelTitle.value}】【${formatDate(new Date())}】.xlsx`) |
||||
|
}else { |
||||
|
const data = await ContainerRecordMainApi.exportContainerRecordMain(tableObject.params) |
||||
|
download.excel(data, `【${excelTitle.value}】【${formatDate(new Date())}】.xlsx`) |
||||
|
} |
||||
|
} catch { |
||||
|
} finally { |
||||
|
loadDone() |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 筛选提交 |
||||
|
const searchFormClick = (searchData) => { |
||||
|
const cmd = { |
||||
|
'column':'type', |
||||
|
'action':'==', |
||||
|
'value':searchType.value |
||||
|
} |
||||
|
if (!Array.isArray(searchData.filters)) { |
||||
|
searchData.filters = []; |
||||
|
} |
||||
|
searchData.filters.push(cmd) |
||||
|
tableObject.params = { |
||||
|
isSearch: true, |
||||
|
filters: searchData.filters |
||||
|
} |
||||
|
getList() // 刷新当前列表 |
||||
|
} |
||||
|
|
||||
|
/** 初始化 **/ |
||||
|
onMounted(async () => { |
||||
|
getList() |
||||
|
}) |
||||
|
|
||||
|
</script> |
@ -0,0 +1,357 @@ |
|||||
|
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
||||
|
import { TableColumn } from '@/types/table' |
||||
|
import { dateFormatter } from '@/utils/formatTime' |
||||
|
|
||||
|
// 表单校验
|
||||
|
export const ContainerRecordMainRules = reactive({ |
||||
|
available: [required], |
||||
|
concurrencyStamp: [required], |
||||
|
}) |
||||
|
|
||||
|
// 获取当前操作人的部门
|
||||
|
import { useUserStore } from '@/store/modules/user' |
||||
|
const userStore = useUserStore() |
||||
|
const userDept = userStore.userSelfInfo.dept |
||||
|
// id 转str 否则form回显匹配不到
|
||||
|
userDept.id = userDept.id.toString() |
||||
|
const userDeptArray:any = [userDept] |
||||
|
|
||||
|
export const ContainerRecordMain = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: '单据号', |
||||
|
field: 'number', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
isForm: false, |
||||
|
table: { |
||||
|
width: 200 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '申请单号', |
||||
|
field: 'requestNumber', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '类型', |
||||
|
field: 'type', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.CONTAIN_MANAGE_TYPE, |
||||
|
dictClass: 'string', |
||||
|
isSearch: true, |
||||
|
isTable: true, |
||||
|
table: { |
||||
|
width: 120 |
||||
|
}, |
||||
|
form:{ |
||||
|
componentProps:{ |
||||
|
disabled: true, |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '是否可用', |
||||
|
field: 'available', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.TRUE_FALSE, |
||||
|
dictClass: 'string', |
||||
|
isForm: false, |
||||
|
isTable:false |
||||
|
}, |
||||
|
{ |
||||
|
label: '备注', |
||||
|
field: 'remark', |
||||
|
sort: 'custom', |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '部门', |
||||
|
field: 'departmentCode', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
isTable:false, |
||||
|
formatter: (_: Recordable, __: TableColumn, cellValue: number) => { |
||||
|
return userDeptArray.find((account) => account.id == cellValue)?.name |
||||
|
}, |
||||
|
form: { |
||||
|
value: userDept.id, |
||||
|
component: 'Select', |
||||
|
api: () => userDeptArray, |
||||
|
componentProps: { |
||||
|
disabled: true, |
||||
|
optionsAlias: { |
||||
|
labelField: 'name', |
||||
|
valueField: 'id' |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '扩展属性', |
||||
|
field: 'extraProperties', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '并发乐观锁', |
||||
|
field: 'concurrencyStamp', |
||||
|
sort: 'custom', |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
value: 0 |
||||
|
}, |
||||
|
isForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '地点ID', |
||||
|
field: 'siteId', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建时间', |
||||
|
field: 'createTime', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
detail: { |
||||
|
dateFormat : 'YYYY-MM-DD HH:mm:ss' |
||||
|
}, |
||||
|
table: { |
||||
|
width: 180 |
||||
|
}, |
||||
|
isSearch: false, |
||||
|
search: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
type: 'daterange', |
||||
|
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
||||
|
} |
||||
|
}, |
||||
|
isTable: false, |
||||
|
isForm: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建者', |
||||
|
field: 'creator', |
||||
|
table: { |
||||
|
width: 130 |
||||
|
}, |
||||
|
isForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '最后更新时间', |
||||
|
field: 'updateTime', |
||||
|
sort: 'custom', |
||||
|
isDetail: true, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
formatter: dateFormatter, |
||||
|
detail: { |
||||
|
dateFormat: 'YYYY-MM-DD HH:mm:ss' |
||||
|
}, |
||||
|
table: { |
||||
|
width: 180 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
style: {width:'100%'}, |
||||
|
type: 'datetime', |
||||
|
dateFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
valueFormat: 'x', |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '最后更新者', |
||||
|
field: 'updater', |
||||
|
isDetail: true, |
||||
|
isForm: false, |
||||
|
isTable: false, |
||||
|
table: { |
||||
|
width: 150 |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作', |
||||
|
field: 'action', |
||||
|
isForm: false, |
||||
|
table: { |
||||
|
width: 150, |
||||
|
fixed: 'right' |
||||
|
} |
||||
|
} |
||||
|
])) |
||||
|
|
||||
|
// 表单校验
|
||||
|
export const ContainerRecordDetailRules = reactive({ |
||||
|
fromLocationCode: [required], |
||||
|
toLocationCode: [required], |
||||
|
concurrencyStamp: [required], |
||||
|
}) |
||||
|
|
||||
|
export const ContainerRecordDetail = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: 'id', |
||||
|
field: 'id', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '主表ID', |
||||
|
field: 'masterId', |
||||
|
sort: 'custom', |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
value: 0 |
||||
|
}, |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '单据号', |
||||
|
field: 'number', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '器具号', |
||||
|
field: 'containerNumber', |
||||
|
sort: 'custom' |
||||
|
}, |
||||
|
{ |
||||
|
label: '来源库位代码', |
||||
|
field: 'fromLocationCode', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: '目标库位代码', |
||||
|
field: 'toLocationCode', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: '到数量', |
||||
|
field: 'toQty', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: '计量单位', |
||||
|
field: 'uom', |
||||
|
dictType: DICT_TYPE.UOM, |
||||
|
dictClass: 'string', |
||||
|
isTable: true, |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
tableForm:{ |
||||
|
disabled: true, |
||||
|
type: 'Select' |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '备注', |
||||
|
field: 'remark', |
||||
|
sort: 'custom', |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建时间', |
||||
|
field: 'createTime', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
detail: { |
||||
|
dateFormat : 'YYYY-MM-DD HH:mm:ss' |
||||
|
}, |
||||
|
table: { |
||||
|
width: 180 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
type: 'datetime', |
||||
|
dateFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
valueFormat: 'x', |
||||
|
} |
||||
|
}, |
||||
|
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')] |
||||
|
} |
||||
|
}, |
||||
|
isTable: true, |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建者', |
||||
|
field: 'creator', |
||||
|
table: { |
||||
|
width: 130 |
||||
|
}, |
||||
|
isForm: false, |
||||
|
isTable: true |
||||
|
}, |
||||
|
{ |
||||
|
label: '地点ID', |
||||
|
field: 'siteId', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '并发乐观锁', |
||||
|
field: 'concurrencyStamp', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '从货主代码', |
||||
|
field: 'fromOwnerCode', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '到货主代码', |
||||
|
field: 'toOwnerCode', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
isTableForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作', |
||||
|
field: 'action', |
||||
|
isForm: false, |
||||
|
hiddenInMain:true, |
||||
|
isTableForm: false, |
||||
|
isTable: false, |
||||
|
table: { |
||||
|
width: 150, |
||||
|
fixed: 'right' |
||||
|
} |
||||
|
} |
||||
|
])) |
Loading…
Reference in new issue