Browse Source

HL-6311 器具记录进行拆分

hella_online_20241107
chenfang 4 weeks ago
parent
commit
491617e362
  1. 357
      src/views/wms/inventoryjobManage/containermanage/createContainerRecordMain/createContainerRecordMain.data.ts
  2. 267
      src/views/wms/inventoryjobManage/containermanage/createContainerRecordMain/index.vue
  3. 357
      src/views/wms/inventoryjobManage/containermanage/deliverContainerRecordMain/deliverContainerRecordMain.data.ts
  4. 267
      src/views/wms/inventoryjobManage/containermanage/deliverContainerRecordMain/index.vue
  5. 299
      src/views/wms/inventoryjobManage/containermanage/initialContainerRecordMain/index.vue
  6. 357
      src/views/wms/inventoryjobManage/containermanage/initialContainerRecordMain/initialContainerRecordMain.data.ts
  7. 299
      src/views/wms/inventoryjobManage/containermanage/moveContainerRecordMain/index.vue
  8. 357
      src/views/wms/inventoryjobManage/containermanage/moveContainerRecordMain/moveContainerRecordMain.data.ts
  9. 299
      src/views/wms/inventoryjobManage/containermanage/returnContainerRecordMain/index.vue
  10. 357
      src/views/wms/inventoryjobManage/containermanage/returnContainerRecordMain/moveContainerRecordMain.data.ts
  11. 299
      src/views/wms/inventoryjobManage/containermanage/scrapContainerRecordMain/index.vue
  12. 357
      src/views/wms/inventoryjobManage/containermanage/scrapContainerRecordMain/scrapContainerRecordMain.data.ts

357
src/views/wms/inventoryjobManage/containermanage/createContainerRecordMain/createContainerRecordMain.data.ts

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

267
src/views/wms/inventoryjobManage/containermanage/createContainerRecordMain/index.vue

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

357
src/views/wms/inventoryjobManage/containermanage/deliverContainerRecordMain/deliverContainerRecordMain.data.ts

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

267
src/views/wms/inventoryjobManage/containermanage/deliverContainerRecordMain/index.vue

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

299
src/views/wms/inventoryjobManage/containermanage/initialContainerRecordMain/index.vue

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

357
src/views/wms/inventoryjobManage/containermanage/initialContainerRecordMain/initialContainerRecordMain.data.ts

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

299
src/views/wms/inventoryjobManage/containermanage/moveContainerRecordMain/index.vue

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

357
src/views/wms/inventoryjobManage/containermanage/moveContainerRecordMain/moveContainerRecordMain.data.ts

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

299
src/views/wms/inventoryjobManage/containermanage/returnContainerRecordMain/index.vue

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

357
src/views/wms/inventoryjobManage/containermanage/returnContainerRecordMain/moveContainerRecordMain.data.ts

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

299
src/views/wms/inventoryjobManage/containermanage/scrapContainerRecordMain/index.vue

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

357
src/views/wms/inventoryjobManage/containermanage/scrapContainerRecordMain/scrapContainerRecordMain.data.ts

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