Compare commits

...

2 Commits

Author SHA1 Message Date
ljw 1bcbc1c4cb Merge branch 'master' of https://git.njzscloud.com/lzq/njzscloud-dispose-web 2026-03-03 11:37:05 +08:00
ljw c09f10ffef 仓库信息 2026-03-03 11:36:56 +08:00
4 changed files with 204 additions and 129 deletions

View File

@ -8,39 +8,91 @@
v-model="formData.warehouseName" v-model="formData.warehouseName"
placeholder="仓库名称"/> placeholder="仓库名称"/>
</ElFormItem> </ElFormItem>
<ElFormItem label="位置"> </template>
<template #highFormItem="formData">
<ElFormItem label="仓库名称">
<ElInput <ElInput
v-model="formData.location" v-model="formData.warehouseName"
placeholder="位置"/> placeholder="仓库名称"/>
</ElFormItem>
<ElFormItem label="仓库类型">
<ADict v-model="formData.type" dict-key="warehouse_type" placeholder="请选择仓库类型"/>
</ElFormItem>
<ElFormItem label="站点">
<ElSelect v-model="formData.stationId" placeholder="请选择站点" clearable filterable>
<ElOption
v-for="item in stationOptions"
:key="item.id"
:label="item.stationName"
:value="item.id"/>
</ElSelect>
</ElFormItem> </ElFormItem>
</template> </template>
<template #columns> <template #columns>
<ElTableColumn label="Id" prop="id"/>
<ElTableColumn label="仓库名称" prop="warehouseName"/> <ElTableColumn label="仓库名称" prop="warehouseName"/>
<ElTableColumn label="仓库类型" prop="type">
<template #default="{ row }">
{{ getWarehouseTypeText(row.type) }}
</template>
</ElTableColumn>
<ElTableColumn label="站点名称" prop="stationName"/>
<ElTableColumn label="位置" prop="location"/> <ElTableColumn label="位置" prop="location"/>
<!-- <ElTableColumn label="创建人 Id sys_user.id" prop="creatorId"/> <ElTableColumn label="最大容量" prop="maxCapacity"/>
<ElTableColumn label="修改人 Idsys_user.id" prop="modifierId"/> -->
<ElTableColumn label="创建时间" prop="createTime"/> <ElTableColumn label="创建时间" prop="createTime"/>
<ElTableColumn label="修改时间" prop="modifyTime"/> <ElTableColumn label="操作" width="120">
<!-- <ElTableColumn label="是否删除; 0-->未删除、1-->已删除" prop="deleted"/> --> <template #default="{ row }">
<ElButton type="primary" link @click="openDetail(row)"></ElButton>
<ElButton type="primary" link @click="warehouseFormIns?.open(row)"></ElButton>
<ElButton type="danger" link @click="handleDelete(row)"></ElButton>
</template>
</ElTableColumn>
</template> </template>
<WarehouseForm ref="warehouseForm" :research="research"/> <WarehouseForm ref="warehouseForm" :research="research"/>
<WarehouseDetail ref="warehouseDetail"/>
</ATablePage> </ATablePage>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import WarehouseApi from '@/pages/wh/warehouse/warehouse-api.ts' import WarehouseApi from '@/pages/wh/warehouse/warehouse-api.ts'
import WarehouseForm from '@/pages/wh/warehouse/WarehouseForm.vue' import WarehouseForm from '@/pages/wh/warehouse/WarehouseForm.vue'
import WarehouseDetail from '@/pages/wh/warehouse/WarehouseDetail.vue'
import StationApi from '@/pages/cst/station/station-api.ts'
import ADict from '@/components/a-dict/ADict.vue'
import DictApi from '@/pages/sys/dict/dict-api.ts'
import ATablePage, { import ATablePage, {
type ATablePageInstance, type ATablePageInstance,
buildTablePageProps, buildTablePageProps,
} from '@/components/a-page/a-table-page/ATablePage.tsx' } from '@/components/a-page/a-table-page/ATablePage.tsx'
import { ElMessageBox } from 'element-plus'
//
const warehouseTypeOptions = ref<{ id: string; val: string; txt: string }[]>([])
//
function getWarehouseTypeText(type?: string) {
const found = warehouseTypeOptions.value.find(item => item.val === type)
return found ? found.txt : '-'
}
//
DictApi.obtainDictData({ dictKey: 'warehouse_type' }).then(res => {
warehouseTypeOptions.value = res.data || []
})
//
const stationOptions = ref<{ id: string; stationName: string }[]>([])
//
StationApi.paging({ current: 1, size: 9999 } as any).then(res => {
stationOptions.value = res.data?.records || []
})
const warehouseFormIns = useTemplateRef<InstanceType<typeof WarehouseForm>>('warehouseForm') const warehouseFormIns = useTemplateRef<InstanceType<typeof WarehouseForm>>('warehouseForm')
const warehouseDetailIns = useTemplateRef<InstanceType<typeof WarehouseDetail>>('warehouseDetail')
const tablePageIns = useTemplateRef<ATablePageInstance>('tablePage') const tablePageIns = useTemplateRef<ATablePageInstance>('tablePage')
const tablePageProps = buildTablePageProps<WarehouseTypes.SearchWarehouseParam, WarehouseTypes.SearchWarehouseResult>({ const tablePageProps = buildTablePageProps<WarehouseTypes.SearchWarehouseParam, WarehouseTypes.SearchWarehouseResult>({
pageLayout: { pageLayout: {
enableHighForm: false, enableHighForm: true,
}, },
searchForm: { searchForm: {
paging: WarehouseApi.paging, paging: WarehouseApi.paging,
@ -58,32 +110,7 @@ const tablePageProps = buildTablePageProps<WarehouseTypes.SearchWarehouseParam,
}, },
table: { table: {
actionColumn: { actionColumn: {
tableActions: [ // columns
{
tooltip: '编辑',
icon: 'Edit',
type: 'success',
action({row}) {
warehouseFormIns.value?.open(row)
},
},
{
icon: 'Delete',
loading: false,
type: 'danger',
tooltip: '删除',
confirm: {
title: '是否删除当前数据',
},
action({row}) {
return WarehouseApi.del([ row.id! ])
.then(() => {
ElMessage.success('删除成功')
return true
})
},
},
],
}, },
}, },
}) })
@ -92,4 +119,23 @@ function research() {
tablePageIns.value?.doSearch() tablePageIns.value?.doSearch()
} }
//
function openDetail(row: WarehouseTypes.SearchWarehouseResult) {
warehouseDetailIns.value?.open(row)
}
//
function handleDelete(row: WarehouseTypes.SearchWarehouseResult) {
ElMessageBox.confirm('是否删除当前数据', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(() => {
return WarehouseApi.del([ row.id! ])
.then(() => {
ElMessage.success('删除成功')
research()
})
}).catch(() => {})
}
</script> </script>

View File

@ -1,32 +1,32 @@
<template> <template>
<ElDialog v-model="showDialog" <ElDialog v-model="showDialog"
destroy-on-close destroy-on-close
width="fit-content" width="700px"
@close="dialogCloseHandler"> @close="dialogCloseHandler">
<ElDescriptions title="仓库信息" border> <ElDescriptions title="仓库信息" border :column="2">
<ElDescriptionsItem label="Id" prop="id"> <ElDescriptionsItem label="仓库名称" :span="1">
{{ detailData.id }} {{ detailData.warehouseName || '-' }}
</ElDescriptionsItem> </ElDescriptionsItem>
<ElDescriptionsItem label="仓库名称" prop="warehouseName"> <ElDescriptionsItem label="仓库类型" :span="1">
{{ detailData.warehouseName }} {{ getWarehouseTypeText(detailData.type) }}
</ElDescriptionsItem> </ElDescriptionsItem>
<ElDescriptionsItem label="位置" prop="location"> <ElDescriptionsItem label="站点名称" :span="1">
{{ detailData.location }} {{ detailData.stationName || '-' }}
</ElDescriptionsItem> </ElDescriptionsItem>
<ElDescriptionsItem label="创建人 Id sys_user.id" prop="creatorId"> <ElDescriptionsItem label="位置" :span="1">
{{ detailData.creatorId }} {{ detailData.location || '-' }}
</ElDescriptionsItem> </ElDescriptionsItem>
<ElDescriptionsItem label="修改人 Idsys_user.id" prop="modifierId"> <ElDescriptionsItem label="最大容量" :span="1">
{{ detailData.modifierId }} {{ detailData.maxCapacity ?? '-' }}
</ElDescriptionsItem> </ElDescriptionsItem>
<ElDescriptionsItem label="创建时间" prop="createTime"> <ElDescriptionsItem label="创建时间" :span="1">
{{ detailData.createTime }} {{ detailData.createTime || '-' }}
</ElDescriptionsItem> </ElDescriptionsItem>
<ElDescriptionsItem label="修改时间" prop="modifyTime"> <ElDescriptionsItem label="修改时间" :span="1">
{{ detailData.modifyTime }} {{ detailData.modifyTime || '-' }}
</ElDescriptionsItem> </ElDescriptionsItem>
<ElDescriptionsItem label="是否删除; 0-->未删除、1-->已删除" prop="deleted"> <ElDescriptionsItem label="备注" :span="2">
{{ detailData.deleted }} {{ detailData.remark || '-' }}
</ElDescriptionsItem> </ElDescriptionsItem>
</ElDescriptions> </ElDescriptions>
<template #footer> <template #footer>
@ -37,8 +37,23 @@
<script lang="ts" setup> <script lang="ts" setup>
import WarehouseApi from '@/pages/wh/warehouse/warehouse-api.ts' import WarehouseApi from '@/pages/wh/warehouse/warehouse-api.ts'
import DictApi from '@/pages/sys/dict/dict-api.ts'
import Utils from '@/common/utils' import Utils from '@/common/utils'
//
const warehouseTypeOptions = ref<{ id: string; val: string; txt: string }[]>([])
//
function getWarehouseTypeText(type?: string) {
const found = warehouseTypeOptions.value.find(item => item.val === type)
return found ? found.txt : '-'
}
//
DictApi.obtainDictData({ dictKey: 'warehouse_type' }).then(res => {
warehouseTypeOptions.value = res.data || []
})
const showDialog = ref(false) const showDialog = ref(false)
const detailData = Utils.resetAble(reactive<WarehouseTypes.SearchWarehouseResult>({})) const detailData = Utils.resetAble(reactive<WarehouseTypes.SearchWarehouseResult>({}))
@ -59,5 +74,4 @@ defineExpose({
</script> </script>
<style lang="stylus" scoped> <style lang="stylus" scoped>
</style> </style>

View File

@ -4,41 +4,29 @@
v-bind="formPanelProps"> v-bind="formPanelProps">
<template #default="formData"> <template #default="formData">
<div class="form-items"> <div class="form-items">
<ElFormItem label="Id" prop="id">
<ElInput v-model="formData.id" placeholder="Id"/>
</ElFormItem>
<ElFormItem label="仓库名称" prop="warehouseName"> <ElFormItem label="仓库名称" prop="warehouseName">
<ElInput v-model="formData.warehouseName" placeholder="仓库名称"/> <ElInput v-model="formData.warehouseName" placeholder="请输入仓库名称"/>
</ElFormItem> </ElFormItem>
<ElFormItem label="仓库类型raw_material-原料库finished_product-成品库" prop="type"> <ElFormItem label="仓库类型" prop="type">
<ElInput v-model="formData.type" placeholder="仓库类型raw_material-原料库finished_product-成品库"/> <ADict v-model="formData.type" dict-key="warehouse_type" placeholder="请选择仓库类型"/>
</ElFormItem> </ElFormItem>
<ElFormItem label="所属站点 Id关联站点表主键" prop="stationId"> <ElFormItem label="站点名称" prop="stationId">
<ElInput v-model="formData.stationId" placeholder="所属站点 Id关联站点表主键"/> <ElSelect v-model="formData.stationId" placeholder="请选择站点" filterable>
<ElOption
v-for="item in stationOptions"
:key="item.id"
:label="item.stationName"
:value="item.id"/>
</ElSelect>
</ElFormItem> </ElFormItem>
<ElFormItem label="位置" prop="location"> <ElFormItem label="位置" prop="location">
<ElInput v-model="formData.location" placeholder="位置"/> <ElInput v-model="formData.location" placeholder="请输入仓库位置"/>
</ElFormItem> </ElFormItem>
<ElFormItem label="最大容量单位m³" prop="maxCapacity"> <ElFormItem label="最大容量" prop="maxCapacity">
<ElInput v-model="formData.maxCapacity" placeholder="最大容量单位m³"/> <ElInputNumber v-model="formData.maxCapacity" :min="0" placeholder="请输入最大容量" style="width: 100%"/>
</ElFormItem> </ElFormItem>
<ElFormItem label="备注" prop="remark"> <ElFormItem label="备注" prop="remark" class="full-width">
<ElInput v-model="formData.remark" placeholder="备注"/> <ElInput v-model="formData.remark" type="textarea" :rows="3" placeholder="请输入备注"/>
</ElFormItem>
<ElFormItem label="创建人 Id sys_user.id" prop="creatorId">
<ElInput v-model="formData.creatorId" placeholder="创建人 Id sys_user.id"/>
</ElFormItem>
<ElFormItem label="修改人 Idsys_user.id" prop="modifierId">
<ElInput v-model="formData.modifierId" placeholder="修改人 Idsys_user.id"/>
</ElFormItem>
<ElFormItem label="创建时间" prop="createTime">
<ElInput v-model="formData.createTime" placeholder="创建时间"/>
</ElFormItem>
<ElFormItem label="修改时间" prop="modifyTime">
<ElInput v-model="formData.modifyTime" placeholder="修改时间"/>
</ElFormItem>
<ElFormItem label="是否删除; 0-->未删除、1-->已删除" prop="deleted">
<ElInput v-model="formData.deleted" placeholder="是否删除; 0-->未删除、1-->已删除"/>
</ElFormItem> </ElFormItem>
</div> </div>
</template> </template>
@ -47,6 +35,8 @@
<script lang="ts" setup> <script lang="ts" setup>
import WarehouseApi from '@/pages/wh/warehouse/warehouse-api.ts' import WarehouseApi from '@/pages/wh/warehouse/warehouse-api.ts'
import StationApi from '@/pages/cst/station/station-api.ts'
import ADict from '@/components/a-dict/ADict.vue'
import AFormPanel, { import AFormPanel, {
type AFormPanelInstance, type AFormPanelInstance,
buildFormPanelProps, buildFormPanelProps,
@ -59,13 +49,25 @@ const props = withDefaults(defineProps<{
research: () => { research: () => {
}, },
}) })
//
const stationOptions = ref<{ id: string; stationName: string }[]>([])
//
StationApi.paging({ current: 1, size: 9999 } as any).then(res => {
stationOptions.value = res.data?.records || []
})
const formPanelIns = useTemplateRef<AFormPanelInstance>('formPanel') const formPanelIns = useTemplateRef<AFormPanelInstance>('formPanel')
const status = ref<'add' | 'modify'>('add') const status = ref<'add' | 'modify'>('add')
const formPanelProps = buildFormPanelProps<WarehouseTypes.SearchWarehouseResult>({ const formPanelProps = buildFormPanelProps<WarehouseTypes.SearchWarehouseResult>({
detailsLoader(id?: string) { detailsLoader(id?: string) {
if (Strings.isBlank(id)) { if (Strings.isBlank(id)) {
status.value = 'add' status.value = 'add'
return Promise.resolve() return Promise.resolve({
maxCapacity: 0,
} as WarehouseTypes.SearchWarehouseResult)
} else { } else {
status.value = 'modify' status.value = 'modify'
return WarehouseApi return WarehouseApi
@ -84,34 +86,33 @@ const formPanelProps = buildFormPanelProps<WarehouseTypes.SearchWarehouseResult>
.then(props.research) .then(props.research)
} }
}, },
rules: { rules: () => {
id: [ {required: true, message: '请填写Id', trigger: 'blur'} ], return {
warehouseName: [ {required: true, message: '请填写仓库名称', trigger: 'blur'} ], warehouseName: [ { required: true, message: '请输入仓库名称', trigger: 'blur' } ],
type: [ {required: true, message: '请填写仓库类型raw_material-原料库finished_product-成品库', trigger: 'blur'} ], type: [ { required: true, message: '请选择仓库类型', trigger: 'change' } ],
stationId: [ {required: true, message: '请填写所属站点 Id关联站点表主键', trigger: 'blur'} ], stationId: [ { required: true, message: '请选择站点', trigger: 'change' } ],
location: [ {required: true, message: '请填写位置', trigger: 'blur'} ], location: [ { required: true, message: '请输入位置', trigger: 'blur' } ],
maxCapacity: [ {required: true, message: '请填写最大容量单位m³', trigger: 'blur'} ], }
remark: [ {required: true, message: '请填写备注', trigger: 'blur'} ],
creatorId: [ {required: true, message: '请填写创建人 Id sys_user.id', trigger: 'blur'} ],
modifierId: [ {required: true, message: '请填写修改人 Idsys_user.id', trigger: 'blur'} ],
createTime: [ {required: true, message: '请填写创建时间', trigger: 'blur'} ],
modifyTime: [ {required: true, message: '请填写修改时间', trigger: 'blur'} ],
deleted: [ {required: true, message: '请填写是否删除; 0-->未删除、1-->已删除', trigger: 'blur'} ],
}, },
}) })
watchEffect(() => { watchEffect(() => {
formPanelProps.title = status.value === 'add' ? '新建仓库信息' : '修改仓库信息信息' formPanelProps.title = status.value === 'add' ? '新建仓库信息' : '修改仓库信息'
}) })
defineExpose({ defineExpose({
open(data?: WarehouseTypes.SearchWarehouseResult) { open(data?: WarehouseTypes.SearchWarehouseResult) {
formPanelIns.value?.open(data?.id) formPanelIns.value?.open(data?.id)
}, },
}) })
</script> </script>
<style lang="stylus" scoped> <style lang="stylus" scoped>
.form-items { .form-items {
grid-template-columns: 1fr 1fr; grid-template-columns: 1fr 1fr;
.full-width {
grid-column: span 2;
}
} }
</style> </style>

View File

@ -1,23 +1,31 @@
export {} export {}
declare global { declare global {
namespace WarehouseTypes { namespace WarehouseTypes {
// 仓库类型枚举
type WarehouseType = 'raw_material' | 'finished_product'
interface SearchWarehouseParam extends G.PageParam { interface SearchWarehouseParam extends G.PageParam {
// Id // Id
id?: string id?: string
// 仓库名称 // 仓库名称
warehouseName?: string warehouseName?: string
// 仓库类型
type?: WarehouseType
// 站点Id
stationId?: string
// 位置 // 位置
location?: string location?: string
// 创建人 Id sys_user.id // 创建人Idsys_user.id
creatorId?: string creatorId?: string
// 修改人 Idsys_user.id // 修改人Idsys_user.id
modifierId?: string modifierId?: string
// 创建时间 // 创建时间
createTime?: string createTime?: string
// 修改时间 // 修改时间
modifyTime?: string modifyTime?: string
// 是否删除; 0-->未删除、1-->已删除 // 是否删除;0-->未删除;1-->已删除
deleted?: boolean deleted?: boolean
} }
@ -26,56 +34,62 @@ declare global {
id?: string id?: string
// 仓库名称 // 仓库名称
warehouseName?: string warehouseName?: string
// 仓库类型
type?: WarehouseType
// 站点Id
stationId?: string
// 站点名称
stationName?: string
// 位置 // 位置
location?: string location?: string
// 创建人 Id sys_user.id // 最大容量
maxCapacity?: number
// 备注
remark?: string
// 创建人Idsys_user.id
creatorId?: string creatorId?: string
// 修改人 Idsys_user.id // 修改人Idsys_user.id
modifierId?: string modifierId?: string
// 创建时间 // 创建时间
createTime?: string createTime?: string
// 修改时间 // 修改时间
modifyTime?: string modifyTime?: string
// 是否删除; 0-->未删除、1-->已删除 // 是否删除;0-->未删除;1-->已删除
deleted?: boolean deleted?: boolean
} }
interface AddWarehouseParam { interface AddWarehouseParam {
// Id
id?: string
// 仓库名称 // 仓库名称
warehouseName?: string warehouseName: string
// 仓库类型
type: WarehouseType
// 站点Id
stationId: string
// 位置 // 位置
location?: string location: string
// 创建人 Id sys_user.id // 单位
creatorId?: string unit?: string
// 修改人 Idsys_user.id // 最大容量
modifierId?: string maxCapacity?: number
// 创建时间 // 备注
createTime?: string remark?: string
// 修改时间
modifyTime?: string
// 是否删除; 0-->未删除、1-->已删除
deleted?: boolean
} }
interface ModifyWarehouseParam { interface ModifyWarehouseParam {
// Id // Id
id?: string id: string
// 仓库名称 // 仓库名称
warehouseName?: string warehouseName?: string
// 仓库类型
type?: WarehouseType
// 站点Id
stationId?: string
// 位置 // 位置
location?: string location?: string
// 创建人 Id sys_user.id // 最大容量
creatorId?: string maxCapacity?: number
// 修改人 Idsys_user.id // 备注
modifierId?: string remark?: string
// 创建时间
createTime?: string
// 修改时间
modifyTime?: string
// 是否删除; 0-->未删除、1-->已删除
deleted?: boolean
} }
} }
} }