仓库信息
parent
aec179db0d
commit
c09f10ffef
|
|
@ -8,39 +8,91 @@
|
|||
v-model="formData.warehouseName"
|
||||
placeholder="仓库名称"/>
|
||||
</ElFormItem>
|
||||
<ElFormItem label="位置">
|
||||
</template>
|
||||
<template #highFormItem="formData">
|
||||
<ElFormItem label="仓库名称">
|
||||
<ElInput
|
||||
v-model="formData.location"
|
||||
placeholder="位置"/>
|
||||
v-model="formData.warehouseName"
|
||||
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>
|
||||
</template>
|
||||
<template #columns>
|
||||
<ElTableColumn label="Id" prop="id"/>
|
||||
<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="创建人 Id; sys_user.id" prop="creatorId"/>
|
||||
<ElTableColumn label="修改人 Id;sys_user.id" prop="modifierId"/> -->
|
||||
<ElTableColumn label="最大容量" prop="maxCapacity"/>
|
||||
<ElTableColumn label="创建时间" prop="createTime"/>
|
||||
<ElTableColumn label="修改时间" prop="modifyTime"/>
|
||||
<!-- <ElTableColumn label="是否删除; 0-->未删除、1-->已删除" prop="deleted"/> -->
|
||||
<ElTableColumn label="操作" width="120">
|
||||
<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>
|
||||
<WarehouseForm ref="warehouseForm" :research="research"/>
|
||||
<WarehouseDetail ref="warehouseDetail"/>
|
||||
</ATablePage>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import WarehouseApi from '@/pages/wh/warehouse/warehouse-api.ts'
|
||||
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, {
|
||||
type ATablePageInstance,
|
||||
buildTablePageProps,
|
||||
} 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 warehouseDetailIns = useTemplateRef<InstanceType<typeof WarehouseDetail>>('warehouseDetail')
|
||||
const tablePageIns = useTemplateRef<ATablePageInstance>('tablePage')
|
||||
const tablePageProps = buildTablePageProps<WarehouseTypes.SearchWarehouseParam, WarehouseTypes.SearchWarehouseResult>({
|
||||
pageLayout: {
|
||||
enableHighForm: false,
|
||||
enableHighForm: true,
|
||||
},
|
||||
searchForm: {
|
||||
paging: WarehouseApi.paging,
|
||||
|
|
@ -58,32 +110,7 @@ const tablePageProps = buildTablePageProps<WarehouseTypes.SearchWarehouseParam,
|
|||
},
|
||||
table: {
|
||||
actionColumn: {
|
||||
tableActions: [
|
||||
{
|
||||
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
|
||||
})
|
||||
},
|
||||
},
|
||||
],
|
||||
// 操作列已在columns中自定义实现
|
||||
},
|
||||
},
|
||||
})
|
||||
|
|
@ -92,4 +119,23 @@ function research() {
|
|||
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>
|
||||
|
|
|
|||
|
|
@ -1,32 +1,32 @@
|
|||
<template>
|
||||
<ElDialog v-model="showDialog"
|
||||
destroy-on-close
|
||||
width="fit-content"
|
||||
width="700px"
|
||||
@close="dialogCloseHandler">
|
||||
<ElDescriptions title="仓库信息" border>
|
||||
<ElDescriptionsItem label="Id" prop="id">
|
||||
{{ detailData.id }}
|
||||
<ElDescriptions title="仓库信息" border :column="2">
|
||||
<ElDescriptionsItem label="仓库名称" :span="1">
|
||||
{{ detailData.warehouseName || '-' }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="仓库名称" prop="warehouseName">
|
||||
{{ detailData.warehouseName }}
|
||||
<ElDescriptionsItem label="仓库类型" :span="1">
|
||||
{{ getWarehouseTypeText(detailData.type) }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="位置" prop="location">
|
||||
{{ detailData.location }}
|
||||
<ElDescriptionsItem label="站点名称" :span="1">
|
||||
{{ detailData.stationName || '-' }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="创建人 Id; sys_user.id" prop="creatorId">
|
||||
{{ detailData.creatorId }}
|
||||
<ElDescriptionsItem label="位置" :span="1">
|
||||
{{ detailData.location || '-' }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="修改人 Id;sys_user.id" prop="modifierId">
|
||||
{{ detailData.modifierId }}
|
||||
<ElDescriptionsItem label="最大容量" :span="1">
|
||||
{{ detailData.maxCapacity ?? '-' }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="创建时间" prop="createTime">
|
||||
{{ detailData.createTime }}
|
||||
<ElDescriptionsItem label="创建时间" :span="1">
|
||||
{{ detailData.createTime || '-' }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="修改时间" prop="modifyTime">
|
||||
{{ detailData.modifyTime }}
|
||||
<ElDescriptionsItem label="修改时间" :span="1">
|
||||
{{ detailData.modifyTime || '-' }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="是否删除; 0-->未删除、1-->已删除" prop="deleted">
|
||||
{{ detailData.deleted }}
|
||||
<ElDescriptionsItem label="备注" :span="2">
|
||||
{{ detailData.remark || '-' }}
|
||||
</ElDescriptionsItem>
|
||||
</ElDescriptions>
|
||||
<template #footer>
|
||||
|
|
@ -37,8 +37,23 @@
|
|||
|
||||
<script lang="ts" setup>
|
||||
import WarehouseApi from '@/pages/wh/warehouse/warehouse-api.ts'
|
||||
import DictApi from '@/pages/sys/dict/dict-api.ts'
|
||||
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 detailData = Utils.resetAble(reactive<WarehouseTypes.SearchWarehouseResult>({}))
|
||||
|
|
@ -59,5 +74,4 @@ defineExpose({
|
|||
</script>
|
||||
|
||||
<style lang="stylus" scoped>
|
||||
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -4,41 +4,29 @@
|
|||
v-bind="formPanelProps">
|
||||
<template #default="formData">
|
||||
<div class="form-items">
|
||||
<ElFormItem label="Id" prop="id">
|
||||
<ElInput v-model="formData.id" placeholder="Id"/>
|
||||
</ElFormItem>
|
||||
<ElFormItem label="仓库名称" prop="warehouseName">
|
||||
<ElInput v-model="formData.warehouseName" placeholder="仓库名称"/>
|
||||
<ElInput v-model="formData.warehouseName" placeholder="请输入仓库名称"/>
|
||||
</ElFormItem>
|
||||
<ElFormItem label="仓库类型;raw_material-原料库,finished_product-成品库" prop="type">
|
||||
<ElInput v-model="formData.type" placeholder="仓库类型;raw_material-原料库,finished_product-成品库"/>
|
||||
<ElFormItem label="仓库类型" prop="type">
|
||||
<ADict v-model="formData.type" dict-key="warehouse_type" placeholder="请选择仓库类型"/>
|
||||
</ElFormItem>
|
||||
<ElFormItem label="所属站点 Id;关联站点表主键" prop="stationId">
|
||||
<ElInput v-model="formData.stationId" placeholder="所属站点 Id;关联站点表主键"/>
|
||||
<ElFormItem label="站点名称" prop="stationId">
|
||||
<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 label="位置" prop="location">
|
||||
<ElInput v-model="formData.location" placeholder="位置"/>
|
||||
<ElInput v-model="formData.location" placeholder="请输入仓库位置"/>
|
||||
</ElFormItem>
|
||||
<ElFormItem label="最大容量,单位:m³" prop="maxCapacity">
|
||||
<ElInput v-model="formData.maxCapacity" placeholder="最大容量,单位:m³"/>
|
||||
<ElFormItem label="最大容量" prop="maxCapacity">
|
||||
<ElInputNumber v-model="formData.maxCapacity" :min="0" placeholder="请输入最大容量" style="width: 100%"/>
|
||||
</ElFormItem>
|
||||
<ElFormItem label="备注" prop="remark">
|
||||
<ElInput v-model="formData.remark" placeholder="备注"/>
|
||||
</ElFormItem>
|
||||
<ElFormItem label="创建人 Id; sys_user.id" prop="creatorId">
|
||||
<ElInput v-model="formData.creatorId" placeholder="创建人 Id; sys_user.id"/>
|
||||
</ElFormItem>
|
||||
<ElFormItem label="修改人 Id;sys_user.id" prop="modifierId">
|
||||
<ElInput v-model="formData.modifierId" placeholder="修改人 Id;sys_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 label="备注" prop="remark" class="full-width">
|
||||
<ElInput v-model="formData.remark" type="textarea" :rows="3" placeholder="请输入备注"/>
|
||||
</ElFormItem>
|
||||
</div>
|
||||
</template>
|
||||
|
|
@ -47,6 +35,8 @@
|
|||
|
||||
<script lang="ts" setup>
|
||||
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, {
|
||||
type AFormPanelInstance,
|
||||
buildFormPanelProps,
|
||||
|
|
@ -59,13 +49,25 @@ const props = withDefaults(defineProps<{
|
|||
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 status = ref<'add' | 'modify'>('add')
|
||||
|
||||
const formPanelProps = buildFormPanelProps<WarehouseTypes.SearchWarehouseResult>({
|
||||
detailsLoader(id?: string) {
|
||||
if (Strings.isBlank(id)) {
|
||||
status.value = 'add'
|
||||
return Promise.resolve()
|
||||
return Promise.resolve({
|
||||
maxCapacity: 0,
|
||||
} as WarehouseTypes.SearchWarehouseResult)
|
||||
} else {
|
||||
status.value = 'modify'
|
||||
return WarehouseApi
|
||||
|
|
@ -84,34 +86,33 @@ const formPanelProps = buildFormPanelProps<WarehouseTypes.SearchWarehouseResult>
|
|||
.then(props.research)
|
||||
}
|
||||
},
|
||||
rules: {
|
||||
id: [ {required: true, message: '请填写Id', trigger: 'blur'} ],
|
||||
warehouseName: [ {required: true, message: '请填写仓库名称', trigger: 'blur'} ],
|
||||
type: [ {required: true, message: '请填写仓库类型;raw_material-原料库,finished_product-成品库', trigger: 'blur'} ],
|
||||
stationId: [ {required: true, message: '请填写所属站点 Id;关联站点表主键', 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: '请填写修改人 Id;sys_user.id', trigger: 'blur'} ],
|
||||
createTime: [ {required: true, message: '请填写创建时间', trigger: 'blur'} ],
|
||||
modifyTime: [ {required: true, message: '请填写修改时间', trigger: 'blur'} ],
|
||||
deleted: [ {required: true, message: '请填写是否删除; 0-->未删除、1-->已删除', trigger: 'blur'} ],
|
||||
rules: () => {
|
||||
return {
|
||||
warehouseName: [ { required: true, message: '请输入仓库名称', trigger: 'blur' } ],
|
||||
type: [ { required: true, message: '请选择仓库类型', trigger: 'change' } ],
|
||||
stationId: [ { required: true, message: '请选择站点', trigger: 'change' } ],
|
||||
location: [ { required: true, message: '请输入位置', trigger: 'blur' } ],
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
watchEffect(() => {
|
||||
formPanelProps.title = status.value === 'add' ? '新建仓库信息' : '修改仓库信息信息'
|
||||
formPanelProps.title = status.value === 'add' ? '新建仓库信息' : '修改仓库信息'
|
||||
})
|
||||
|
||||
defineExpose({
|
||||
open(data?: WarehouseTypes.SearchWarehouseResult) {
|
||||
formPanelIns.value?.open(data?.id)
|
||||
},
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="stylus" scoped>
|
||||
.form-items {
|
||||
grid-template-columns: 1fr 1fr;
|
||||
|
||||
.full-width {
|
||||
grid-column: span 2;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -1,12 +1,20 @@
|
|||
|
||||
export {}
|
||||
|
||||
declare global {
|
||||
namespace WarehouseTypes {
|
||||
// 仓库类型枚举
|
||||
type WarehouseType = 'raw_material' | 'finished_product'
|
||||
|
||||
interface SearchWarehouseParam extends G.PageParam {
|
||||
// Id
|
||||
id?: string
|
||||
// 仓库名称
|
||||
warehouseName?: string
|
||||
// 仓库类型
|
||||
type?: WarehouseType
|
||||
// 站点Id
|
||||
stationId?: string
|
||||
// 位置
|
||||
location?: string
|
||||
// 创建人Id;sys_user.id
|
||||
|
|
@ -17,7 +25,7 @@ declare global {
|
|||
createTime?: string
|
||||
// 修改时间
|
||||
modifyTime?: string
|
||||
// 是否删除; 0-->未删除、1-->已删除
|
||||
// 是否删除;0-->未删除;1-->已删除
|
||||
deleted?: boolean
|
||||
}
|
||||
|
||||
|
|
@ -26,8 +34,18 @@ declare global {
|
|||
id?: string
|
||||
// 仓库名称
|
||||
warehouseName?: string
|
||||
// 仓库类型
|
||||
type?: WarehouseType
|
||||
// 站点Id
|
||||
stationId?: string
|
||||
// 站点名称
|
||||
stationName?: string
|
||||
// 位置
|
||||
location?: string
|
||||
// 最大容量
|
||||
maxCapacity?: number
|
||||
// 备注
|
||||
remark?: string
|
||||
// 创建人Id;sys_user.id
|
||||
creatorId?: string
|
||||
// 修改人Id;sys_user.id
|
||||
|
|
@ -36,46 +54,42 @@ declare global {
|
|||
createTime?: string
|
||||
// 修改时间
|
||||
modifyTime?: string
|
||||
// 是否删除; 0-->未删除、1-->已删除
|
||||
// 是否删除;0-->未删除;1-->已删除
|
||||
deleted?: boolean
|
||||
}
|
||||
|
||||
interface AddWarehouseParam {
|
||||
// Id
|
||||
id?: string
|
||||
// 仓库名称
|
||||
warehouseName?: string
|
||||
warehouseName: string
|
||||
// 仓库类型
|
||||
type: WarehouseType
|
||||
// 站点Id
|
||||
stationId: string
|
||||
// 位置
|
||||
location?: string
|
||||
// 创建人 Id; sys_user.id
|
||||
creatorId?: string
|
||||
// 修改人 Id;sys_user.id
|
||||
modifierId?: string
|
||||
// 创建时间
|
||||
createTime?: string
|
||||
// 修改时间
|
||||
modifyTime?: string
|
||||
// 是否删除; 0-->未删除、1-->已删除
|
||||
deleted?: boolean
|
||||
location: string
|
||||
// 单位
|
||||
unit?: string
|
||||
// 最大容量
|
||||
maxCapacity?: number
|
||||
// 备注
|
||||
remark?: string
|
||||
}
|
||||
|
||||
interface ModifyWarehouseParam {
|
||||
// Id
|
||||
id?: string
|
||||
id: string
|
||||
// 仓库名称
|
||||
warehouseName?: string
|
||||
// 仓库类型
|
||||
type?: WarehouseType
|
||||
// 站点Id
|
||||
stationId?: string
|
||||
// 位置
|
||||
location?: string
|
||||
// 创建人 Id; sys_user.id
|
||||
creatorId?: string
|
||||
// 修改人 Id;sys_user.id
|
||||
modifierId?: string
|
||||
// 创建时间
|
||||
createTime?: string
|
||||
// 修改时间
|
||||
modifyTime?: string
|
||||
// 是否删除; 0-->未删除、1-->已删除
|
||||
deleted?: boolean
|
||||
// 最大容量
|
||||
maxCapacity?: number
|
||||
// 备注
|
||||
remark?: string
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue