feat(wms):增加商品分类、商品品牌。
parent
1aad2f1648
commit
30e4fef7bb
|
|
@ -0,0 +1,46 @@
|
||||||
|
import request from '@/config/axios'
|
||||||
|
|
||||||
|
// WMS 商品品牌 VO
|
||||||
|
export interface ItemBrandVO {
|
||||||
|
id?: number
|
||||||
|
name?: string
|
||||||
|
createTime?: Date
|
||||||
|
}
|
||||||
|
|
||||||
|
// WMS 商品品牌 API
|
||||||
|
export const ItemBrandApi = {
|
||||||
|
// 查询商品品牌分页
|
||||||
|
getItemBrandPage: async (params: any) => {
|
||||||
|
return await request.get({ url: '/wms/item-brand/page', params })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 查询商品品牌精简列表
|
||||||
|
getItemBrandSimpleList: async () => {
|
||||||
|
return await request.get({ url: '/wms/item-brand/simple-list' })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 查询商品品牌详情
|
||||||
|
getItemBrand: async (id: number) => {
|
||||||
|
return await request.get({ url: '/wms/item-brand/get?id=' + id })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 新增商品品牌
|
||||||
|
createItemBrand: async (data: ItemBrandVO) => {
|
||||||
|
return await request.post({ url: '/wms/item-brand/create', data })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 修改商品品牌
|
||||||
|
updateItemBrand: async (data: ItemBrandVO) => {
|
||||||
|
return await request.put({ url: '/wms/item-brand/update', data })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 删除商品品牌
|
||||||
|
deleteItemBrand: async (id: number) => {
|
||||||
|
return await request.delete({ url: '/wms/item-brand/delete?id=' + id })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 导出商品品牌
|
||||||
|
exportItemBrand: async (params) => {
|
||||||
|
return await request.download({ url: '/wms/item-brand/export-excel', params })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,45 @@
|
||||||
|
import request from '@/config/axios'
|
||||||
|
|
||||||
|
// WMS 商品分类 VO
|
||||||
|
export interface ItemCategoryVO {
|
||||||
|
id?: number
|
||||||
|
parentId?: number
|
||||||
|
name?: string
|
||||||
|
sort?: number
|
||||||
|
status?: number
|
||||||
|
createTime?: Date
|
||||||
|
children?: ItemCategoryVO[]
|
||||||
|
}
|
||||||
|
|
||||||
|
// WMS 商品分类 API
|
||||||
|
export const ItemCategoryApi = {
|
||||||
|
// 查询商品分类列表
|
||||||
|
getItemCategoryList: async (params?: any) => {
|
||||||
|
return await request.get({ url: '/wms/item-category/list', params })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 查询商品分类精简列表
|
||||||
|
getItemCategorySimpleList: async () => {
|
||||||
|
return await request.get({ url: '/wms/item-category/simple-list' })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 查询商品分类详情
|
||||||
|
getItemCategory: async (id: number) => {
|
||||||
|
return await request.get({ url: '/wms/item-category/get?id=' + id })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 新增商品分类
|
||||||
|
createItemCategory: async (data: ItemCategoryVO) => {
|
||||||
|
return await request.post({ url: '/wms/item-category/create', data })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 修改商品分类
|
||||||
|
updateItemCategory: async (data: ItemCategoryVO) => {
|
||||||
|
return await request.put({ url: '/wms/item-category/update', data })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 删除商品分类
|
||||||
|
deleteItemCategory: async (id: number) => {
|
||||||
|
return await request.delete({ url: '/wms/item-category/delete?id=' + id })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -41,5 +41,10 @@ export const WarehouseAreaApi = {
|
||||||
// 删除库区
|
// 删除库区
|
||||||
deleteWarehouseArea: async (id: number) => {
|
deleteWarehouseArea: async (id: number) => {
|
||||||
return await request.delete({ url: '/wms/warehouse-area/delete?id=' + id })
|
return await request.delete({ url: '/wms/warehouse-area/delete?id=' + id })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 导出库区
|
||||||
|
exportWarehouseArea: async (params) => {
|
||||||
|
return await request.download({ url: '/wms/warehouse-area/export-excel', params })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,5 +40,10 @@ export const WarehouseApi = {
|
||||||
// 删除仓库
|
// 删除仓库
|
||||||
deleteWarehouse: async (id: number) => {
|
deleteWarehouse: async (id: number) => {
|
||||||
return await request.delete({ url: '/wms/warehouse/delete?id=' + id })
|
return await request.delete({ url: '/wms/warehouse/delete?id=' + id })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 导出仓库
|
||||||
|
exportWarehouse: async (params) => {
|
||||||
|
return await request.download({ url: '/wms/warehouse/export-excel', params })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,94 @@
|
||||||
|
<!-- WMS 商品品牌表单 -->
|
||||||
|
<template>
|
||||||
|
<Dialog v-model="dialogVisible" :title="dialogTitle">
|
||||||
|
<el-form
|
||||||
|
ref="formRef"
|
||||||
|
v-loading="formLoading"
|
||||||
|
:model="formData"
|
||||||
|
:rules="formRules"
|
||||||
|
label-width="100px"
|
||||||
|
>
|
||||||
|
<el-form-item label="品牌名称" prop="name">
|
||||||
|
<el-input v-model="formData.name" maxlength="30" placeholder="请输入品牌名称" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<el-button :disabled="formLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||||
|
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||||
|
</template>
|
||||||
|
</Dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ItemBrandApi, ItemBrandVO } from '@/api/wms/md/item/brand'
|
||||||
|
|
||||||
|
/** WMS 商品品牌表单 */
|
||||||
|
defineOptions({ name: 'WmsItemBrandForm' })
|
||||||
|
|
||||||
|
const { t } = useI18n() // 国际化
|
||||||
|
const message = useMessage() // 消息弹窗
|
||||||
|
|
||||||
|
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||||
|
const dialogTitle = ref('') // 弹窗的标题
|
||||||
|
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||||
|
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||||
|
const formData = ref<ItemBrandVO>({
|
||||||
|
id: undefined,
|
||||||
|
name: undefined
|
||||||
|
})
|
||||||
|
const formRules = reactive({
|
||||||
|
name: [{ required: true, message: '品牌名称不能为空', trigger: 'blur' }]
|
||||||
|
})
|
||||||
|
const formRef = ref() // 表单 Ref
|
||||||
|
|
||||||
|
/** 打开弹窗 */
|
||||||
|
const open = async (type: string, id?: number) => {
|
||||||
|
dialogVisible.value = true
|
||||||
|
dialogTitle.value = t('action.' + type)
|
||||||
|
formType.value = type
|
||||||
|
resetForm()
|
||||||
|
// 修改时,设置数据
|
||||||
|
if (id) {
|
||||||
|
formLoading.value = true
|
||||||
|
try {
|
||||||
|
formData.value = await ItemBrandApi.getItemBrand(id)
|
||||||
|
} finally {
|
||||||
|
formLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||||
|
|
||||||
|
/** 提交表单 */
|
||||||
|
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||||
|
const submitForm = async () => {
|
||||||
|
// 校验表单
|
||||||
|
await formRef.value.validate()
|
||||||
|
// 提交请求
|
||||||
|
formLoading.value = true
|
||||||
|
try {
|
||||||
|
const data = formData.value as ItemBrandVO
|
||||||
|
if (formType.value === 'create') {
|
||||||
|
await ItemBrandApi.createItemBrand(data)
|
||||||
|
message.success(t('common.createSuccess'))
|
||||||
|
} else {
|
||||||
|
await ItemBrandApi.updateItemBrand(data)
|
||||||
|
message.success(t('common.updateSuccess'))
|
||||||
|
}
|
||||||
|
dialogVisible.value = false
|
||||||
|
// 发送操作成功的事件
|
||||||
|
emit('success')
|
||||||
|
} finally {
|
||||||
|
formLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 重置表单 */
|
||||||
|
const resetForm = () => {
|
||||||
|
formData.value = {
|
||||||
|
id: undefined,
|
||||||
|
name: undefined
|
||||||
|
}
|
||||||
|
formRef.value?.resetFields()
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
@ -0,0 +1,183 @@
|
||||||
|
<!-- WMS 商品品牌管理 -->
|
||||||
|
<template>
|
||||||
|
<ContentWrap>
|
||||||
|
<!-- 搜索工作栏 -->
|
||||||
|
<el-form
|
||||||
|
ref="queryFormRef"
|
||||||
|
:inline="true"
|
||||||
|
:model="queryParams"
|
||||||
|
class="-mb-15px"
|
||||||
|
label-width="68px"
|
||||||
|
>
|
||||||
|
<el-form-item label="品牌名称" prop="name">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.name"
|
||||||
|
class="!w-240px"
|
||||||
|
clearable
|
||||||
|
placeholder="请输入品牌名称"
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button @click="handleQuery">
|
||||||
|
<Icon class="mr-5px" icon="ep:search" />
|
||||||
|
搜索
|
||||||
|
</el-button>
|
||||||
|
<el-button @click="resetQuery">
|
||||||
|
<Icon class="mr-5px" icon="ep:refresh" />
|
||||||
|
重置
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
v-hasPermi="['wms:item-brand:create']"
|
||||||
|
plain
|
||||||
|
type="primary"
|
||||||
|
@click="openForm('create')"
|
||||||
|
>
|
||||||
|
<Icon class="mr-5px" icon="ep:plus" />
|
||||||
|
新增
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
v-hasPermi="['wms:item-brand:export']"
|
||||||
|
:loading="exportLoading"
|
||||||
|
plain
|
||||||
|
type="success"
|
||||||
|
@click="handleExport"
|
||||||
|
>
|
||||||
|
<Icon class="mr-5px" icon="ep:download" />
|
||||||
|
导出
|
||||||
|
</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</ContentWrap>
|
||||||
|
|
||||||
|
<!-- 品牌列表 -->
|
||||||
|
<ContentWrap>
|
||||||
|
<el-table v-loading="loading" :data="list" :show-overflow-tooltip="true" :stripe="true">
|
||||||
|
<el-table-column align="center" label="品牌名称" prop="name" />
|
||||||
|
<el-table-column
|
||||||
|
:formatter="dateFormatter"
|
||||||
|
align="center"
|
||||||
|
label="创建时间"
|
||||||
|
prop="createTime"
|
||||||
|
width="180"
|
||||||
|
/>
|
||||||
|
<el-table-column align="center" label="操作" width="160">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button
|
||||||
|
v-hasPermi="['wms:item-brand:update']"
|
||||||
|
link
|
||||||
|
type="primary"
|
||||||
|
@click="openForm('update', scope.row.id)"
|
||||||
|
>
|
||||||
|
修改
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
v-hasPermi="['wms:item-brand:delete']"
|
||||||
|
link
|
||||||
|
type="danger"
|
||||||
|
@click="handleDelete(scope.row.id)"
|
||||||
|
>
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<!-- 分页 -->
|
||||||
|
<Pagination
|
||||||
|
v-model:limit="queryParams.pageSize"
|
||||||
|
v-model:page="queryParams.pageNo"
|
||||||
|
:total="total"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
</ContentWrap>
|
||||||
|
|
||||||
|
<!-- 表单弹窗:添加/修改 -->
|
||||||
|
<ItemBrandForm ref="formRef" @success="getList" />
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { dateFormatter } from '@/utils/formatTime'
|
||||||
|
import { ItemBrandApi, ItemBrandVO } from '@/api/wms/md/item/brand'
|
||||||
|
import ItemBrandForm from './ItemBrandForm.vue'
|
||||||
|
import download from '@/utils/download'
|
||||||
|
|
||||||
|
/** WMS 商品品牌管理 */
|
||||||
|
defineOptions({ name: 'WmsItemBrand' })
|
||||||
|
|
||||||
|
const message = useMessage() // 消息弹窗
|
||||||
|
const { t } = useI18n() // 国际化
|
||||||
|
|
||||||
|
const loading = ref(true) // 列表的加载中
|
||||||
|
const list = ref<ItemBrandVO[]>([]) // 列表的数据
|
||||||
|
const total = ref(0) // 列表的总页数
|
||||||
|
const queryParams = reactive({
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
name: undefined
|
||||||
|
})
|
||||||
|
const queryFormRef = ref() // 搜索的表单
|
||||||
|
const exportLoading = ref(false) // 导出的加载中
|
||||||
|
|
||||||
|
/** 查询商品品牌列表 */
|
||||||
|
const getList = async () => {
|
||||||
|
loading.value = true
|
||||||
|
try {
|
||||||
|
const data = await ItemBrandApi.getItemBrandPage(queryParams)
|
||||||
|
list.value = data.list
|
||||||
|
total.value = data.total
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
const handleQuery = () => {
|
||||||
|
queryParams.pageNo = 1
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
const resetQuery = () => {
|
||||||
|
queryFormRef.value.resetFields()
|
||||||
|
handleQuery()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 添加/修改操作 */
|
||||||
|
const formRef = ref()
|
||||||
|
const openForm = (type: string, id?: number) => {
|
||||||
|
formRef.value.open(type, id)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 删除品牌 */
|
||||||
|
const handleDelete = async (id: number) => {
|
||||||
|
try {
|
||||||
|
// 删除的二次确认
|
||||||
|
await message.delConfirm()
|
||||||
|
// 发起删除
|
||||||
|
await ItemBrandApi.deleteItemBrand(id)
|
||||||
|
message.success(t('common.delSuccess'))
|
||||||
|
// 刷新列表
|
||||||
|
await getList()
|
||||||
|
} catch {}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
const handleExport = async () => {
|
||||||
|
try {
|
||||||
|
// 导出的二次确认
|
||||||
|
await message.exportConfirm()
|
||||||
|
// 发起导出
|
||||||
|
exportLoading.value = true
|
||||||
|
const data = await ItemBrandApi.exportItemBrand(queryParams)
|
||||||
|
download.excel(data, '商品品牌.xls')
|
||||||
|
} catch {
|
||||||
|
} finally {
|
||||||
|
exportLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 初始化 */
|
||||||
|
onMounted(() => {
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
@ -0,0 +1,144 @@
|
||||||
|
<!-- WMS 商品分类表单 -->
|
||||||
|
<template>
|
||||||
|
<Dialog v-model="dialogVisible" :title="dialogTitle">
|
||||||
|
<el-form
|
||||||
|
ref="formRef"
|
||||||
|
v-loading="formLoading"
|
||||||
|
:model="formData"
|
||||||
|
:rules="formRules"
|
||||||
|
label-width="80px"
|
||||||
|
>
|
||||||
|
<el-form-item label="上级分类" prop="parentId">
|
||||||
|
<el-tree-select
|
||||||
|
v-model="formData.parentId"
|
||||||
|
:data="categoryTree"
|
||||||
|
:props="defaultProps"
|
||||||
|
check-strictly
|
||||||
|
default-expand-all
|
||||||
|
placeholder="请选择上级分类"
|
||||||
|
value-key="categoryId"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="分类名称" prop="name">
|
||||||
|
<el-input v-model="formData.name" placeholder="请输入分类名称" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="显示排序" prop="sort">
|
||||||
|
<el-input-number v-model="formData.sort" :min="0" class="!w-1/1" controls-position="right" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="状态" prop="status">
|
||||||
|
<el-select v-model="formData.status" clearable placeholder="请选择状态">
|
||||||
|
<el-option
|
||||||
|
v-for="dict in getIntDictOptions(DICT_TYPE.COMMON_STATUS)"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="dict.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||||
|
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||||
|
</template>
|
||||||
|
</Dialog>
|
||||||
|
</template>
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
|
||||||
|
import { defaultProps, handleTree } from '@/utils/tree'
|
||||||
|
import { CommonStatusEnum } from '@/utils/constants'
|
||||||
|
import { FormRules } from 'element-plus'
|
||||||
|
import { ItemCategoryApi, ItemCategoryVO } from '@/api/wms/md/item/category'
|
||||||
|
|
||||||
|
/** WMS 商品分类表单 */
|
||||||
|
defineOptions({ name: 'WmsItemCategoryForm' })
|
||||||
|
|
||||||
|
const { t } = useI18n() // 国际化
|
||||||
|
const message = useMessage() // 消息弹窗
|
||||||
|
|
||||||
|
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||||
|
const dialogTitle = ref('') // 弹窗的标题
|
||||||
|
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||||
|
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||||
|
const formData = ref<ItemCategoryVO>({
|
||||||
|
id: undefined,
|
||||||
|
parentId: undefined,
|
||||||
|
name: undefined,
|
||||||
|
sort: 0,
|
||||||
|
status: CommonStatusEnum.ENABLE
|
||||||
|
})
|
||||||
|
const formRules = reactive<FormRules>({
|
||||||
|
parentId: [{ required: true, message: '上级分类不能为空', trigger: 'blur' }],
|
||||||
|
name: [{ required: true, message: '分类名称不能为空', trigger: 'blur' }],
|
||||||
|
sort: [{ required: true, message: '显示排序不能为空', trigger: 'blur' }],
|
||||||
|
status: [{ required: true, message: '状态不能为空', trigger: 'blur' }]
|
||||||
|
})
|
||||||
|
const formRef = ref() // 表单 Ref
|
||||||
|
const categoryTree = ref() // 树形结构
|
||||||
|
|
||||||
|
/** 打开弹窗 */
|
||||||
|
const open = async (type: string, id?: number, parentId?: number) => {
|
||||||
|
dialogVisible.value = true
|
||||||
|
dialogTitle.value = t('action.' + type)
|
||||||
|
formType.value = type
|
||||||
|
resetForm(parentId)
|
||||||
|
// 修改时,设置数据
|
||||||
|
if (id) {
|
||||||
|
formLoading.value = true
|
||||||
|
try {
|
||||||
|
formData.value = await ItemCategoryApi.getItemCategory(id)
|
||||||
|
} finally {
|
||||||
|
formLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 获得分类树
|
||||||
|
await getTree()
|
||||||
|
}
|
||||||
|
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||||
|
|
||||||
|
/** 获得分类树 */
|
||||||
|
const getTree = async () => {
|
||||||
|
categoryTree.value = []
|
||||||
|
const data = await ItemCategoryApi.getItemCategorySimpleList()
|
||||||
|
let category: Tree = { id: 0, name: '顶级分类', children: [] }
|
||||||
|
category.children = handleTree(data, 'id', 'parentId')
|
||||||
|
categoryTree.value.push(category)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 提交表单 */
|
||||||
|
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||||
|
const submitForm = async () => {
|
||||||
|
// 校验表单
|
||||||
|
if (!formRef) return
|
||||||
|
const valid = await formRef.value.validate()
|
||||||
|
if (!valid) return
|
||||||
|
// 提交请求
|
||||||
|
formLoading.value = true
|
||||||
|
try {
|
||||||
|
const data = formData.value as ItemCategoryVO
|
||||||
|
if (formType.value === 'create') {
|
||||||
|
await ItemCategoryApi.createItemCategory(data)
|
||||||
|
message.success(t('common.createSuccess'))
|
||||||
|
} else {
|
||||||
|
await ItemCategoryApi.updateItemCategory(data)
|
||||||
|
message.success(t('common.updateSuccess'))
|
||||||
|
}
|
||||||
|
dialogVisible.value = false
|
||||||
|
// 发送操作成功的事件
|
||||||
|
emit('success')
|
||||||
|
} finally {
|
||||||
|
formLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 重置表单 */
|
||||||
|
const resetForm = (parentId?: number) => {
|
||||||
|
formData.value = {
|
||||||
|
id: undefined,
|
||||||
|
parentId,
|
||||||
|
name: undefined,
|
||||||
|
sort: 0,
|
||||||
|
status: CommonStatusEnum.ENABLE
|
||||||
|
}
|
||||||
|
formRef.value?.resetFields()
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
@ -0,0 +1,202 @@
|
||||||
|
<!-- WMS 商品分类管理 -->
|
||||||
|
<template>
|
||||||
|
<!-- 搜索工作栏 -->
|
||||||
|
<ContentWrap>
|
||||||
|
<el-form
|
||||||
|
ref="queryFormRef"
|
||||||
|
:inline="true"
|
||||||
|
:model="queryParams"
|
||||||
|
class="-mb-15px"
|
||||||
|
label-width="68px"
|
||||||
|
>
|
||||||
|
<el-form-item label="分类名称" prop="name">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.name"
|
||||||
|
class="!w-240px"
|
||||||
|
clearable
|
||||||
|
placeholder="请输入分类名称"
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="分类状态" prop="status">
|
||||||
|
<el-select
|
||||||
|
v-model="queryParams.status"
|
||||||
|
class="!w-240px"
|
||||||
|
clearable
|
||||||
|
placeholder="请选择分类状态"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="dict in getIntDictOptions(DICT_TYPE.COMMON_STATUS)"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="dict.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button @click="handleQuery">
|
||||||
|
<Icon class="mr-5px" icon="ep:search" />
|
||||||
|
搜索
|
||||||
|
</el-button>
|
||||||
|
<el-button @click="resetQuery">
|
||||||
|
<Icon class="mr-5px" icon="ep:refresh" />
|
||||||
|
重置
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
v-hasPermi="['wms:item-category:create']"
|
||||||
|
plain
|
||||||
|
type="primary"
|
||||||
|
@click="openForm('create')"
|
||||||
|
>
|
||||||
|
<Icon class="mr-5px" icon="ep:plus" />
|
||||||
|
新增
|
||||||
|
</el-button>
|
||||||
|
<el-button plain type="danger" @click="toggleExpandAll">
|
||||||
|
<Icon class="mr-5px" icon="ep:sort" />
|
||||||
|
展开/折叠
|
||||||
|
</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</ContentWrap>
|
||||||
|
|
||||||
|
<!-- 分类列表 -->
|
||||||
|
<ContentWrap>
|
||||||
|
<el-table
|
||||||
|
v-if="refreshTable"
|
||||||
|
v-loading="loading"
|
||||||
|
:data="list"
|
||||||
|
:default-expand-all="isExpandAll"
|
||||||
|
:show-overflow-tooltip="true"
|
||||||
|
:stripe="true"
|
||||||
|
row-key="id"
|
||||||
|
>
|
||||||
|
<el-table-column label="分类名称" prop="name" />
|
||||||
|
<el-table-column align="center" label="排序" prop="sort" width="120" />
|
||||||
|
<el-table-column align="center" label="状态" prop="status" width="120">
|
||||||
|
<template #default="scope">
|
||||||
|
<dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
:formatter="dateFormatter"
|
||||||
|
align="center"
|
||||||
|
label="创建时间"
|
||||||
|
prop="createTime"
|
||||||
|
width="180"
|
||||||
|
/>
|
||||||
|
<el-table-column align="center" label="操作" width="240">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button
|
||||||
|
v-hasPermi="['wms:item-category:create']"
|
||||||
|
link
|
||||||
|
type="primary"
|
||||||
|
@click="openForm('create', undefined, scope.row.id)"
|
||||||
|
>
|
||||||
|
新增下级
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
v-hasPermi="['wms:item-category:update']"
|
||||||
|
link
|
||||||
|
type="primary"
|
||||||
|
@click="openForm('update', scope.row.id)"
|
||||||
|
>
|
||||||
|
修改
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
v-hasPermi="['wms:item-category:delete']"
|
||||||
|
link
|
||||||
|
type="danger"
|
||||||
|
@click="handleDelete(scope.row.id)"
|
||||||
|
>
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</ContentWrap>
|
||||||
|
|
||||||
|
<!-- 表单弹窗:添加/修改 -->
|
||||||
|
<ItemCategoryForm ref="formRef" @success="getList" />
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
|
||||||
|
import { dateFormatter } from '@/utils/formatTime'
|
||||||
|
import { handleTree } from '@/utils/tree'
|
||||||
|
import { ItemCategoryApi, ItemCategoryVO } from '@/api/wms/md/item/category'
|
||||||
|
import ItemCategoryForm from './ItemCategoryForm.vue'
|
||||||
|
|
||||||
|
/** WMS 商品分类管理 */
|
||||||
|
defineOptions({ name: 'WmsItemCategory' })
|
||||||
|
|
||||||
|
const message = useMessage() // 消息弹窗
|
||||||
|
const { t } = useI18n() // 国际化
|
||||||
|
|
||||||
|
const loading = ref(true) // 列表的加载中
|
||||||
|
const list = ref<ItemCategoryVO[]>([]) // 列表的数据
|
||||||
|
const queryParams = reactive({
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 100,
|
||||||
|
name: undefined,
|
||||||
|
status: undefined
|
||||||
|
})
|
||||||
|
const queryFormRef = ref() // 搜索的表单
|
||||||
|
const isExpandAll = ref(true) // 是否展开,默认全部展开
|
||||||
|
const refreshTable = ref(true) // 重新渲染表格状态
|
||||||
|
|
||||||
|
/** 查询商品分类列表 */
|
||||||
|
const getList = async () => {
|
||||||
|
loading.value = true
|
||||||
|
try {
|
||||||
|
const data = await ItemCategoryApi.getItemCategoryList(queryParams)
|
||||||
|
list.value = handleTree(data, 'id', 'parentId')
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 展开/折叠操作 */
|
||||||
|
const toggleExpandAll = () => {
|
||||||
|
refreshTable.value = false
|
||||||
|
isExpandAll.value = !isExpandAll.value
|
||||||
|
nextTick(() => {
|
||||||
|
refreshTable.value = true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
const handleQuery = () => {
|
||||||
|
queryParams.pageNo = 1
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
const resetQuery = () => {
|
||||||
|
queryFormRef.value.resetFields()
|
||||||
|
handleQuery()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 添加/修改操作 */
|
||||||
|
const formRef = ref()
|
||||||
|
const openForm = (type: string, id?: number, parentId?: number) => {
|
||||||
|
formRef.value.open(type, id, parentId)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 删除分类 */
|
||||||
|
const handleDelete = async (id: number) => {
|
||||||
|
try {
|
||||||
|
// 删除的二次确认
|
||||||
|
await message.delConfirm()
|
||||||
|
// 发起删除
|
||||||
|
await ItemCategoryApi.deleteItemCategory(id)
|
||||||
|
message.success(t('common.delSuccess'))
|
||||||
|
// 刷新列表
|
||||||
|
await getList()
|
||||||
|
} catch {}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 初始化 */
|
||||||
|
onMounted(() => {
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
@ -60,6 +60,16 @@
|
||||||
<Icon class="mr-5px" icon="ep:plus" />
|
<Icon class="mr-5px" icon="ep:plus" />
|
||||||
新增
|
新增
|
||||||
</el-button>
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
v-hasPermi="['wms:warehouse-area:export']"
|
||||||
|
:loading="exportLoading"
|
||||||
|
plain
|
||||||
|
type="success"
|
||||||
|
@click="handleExport"
|
||||||
|
>
|
||||||
|
<Icon class="mr-5px" icon="ep:download" />
|
||||||
|
导出
|
||||||
|
</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</ContentWrap>
|
</ContentWrap>
|
||||||
|
|
@ -121,6 +131,7 @@ import { dateFormatter } from '@/utils/formatTime'
|
||||||
import { WarehouseApi, WarehouseVO } from '@/api/wms/md/warehouse'
|
import { WarehouseApi, WarehouseVO } from '@/api/wms/md/warehouse'
|
||||||
import { WarehouseAreaApi, WarehouseAreaVO } from '@/api/wms/md/warehouse/area'
|
import { WarehouseAreaApi, WarehouseAreaVO } from '@/api/wms/md/warehouse/area'
|
||||||
import WarehouseAreaForm from './WarehouseAreaForm.vue'
|
import WarehouseAreaForm from './WarehouseAreaForm.vue'
|
||||||
|
import download from '@/utils/download'
|
||||||
|
|
||||||
/** WMS 库区管理 */
|
/** WMS 库区管理 */
|
||||||
defineOptions({ name: 'WmsWarehouseArea' })
|
defineOptions({ name: 'WmsWarehouseArea' })
|
||||||
|
|
@ -140,6 +151,7 @@ const queryParams = reactive({
|
||||||
name: undefined
|
name: undefined
|
||||||
})
|
})
|
||||||
const queryFormRef = ref() // 搜索的表单
|
const queryFormRef = ref() // 搜索的表单
|
||||||
|
const exportLoading = ref(false) // 导出的加载中
|
||||||
const warehouseList = ref<WarehouseVO[]>([]) // 仓库精简列表
|
const warehouseList = ref<WarehouseVO[]>([]) // 仓库精简列表
|
||||||
const selectableWarehouseList = computed(() =>
|
const selectableWarehouseList = computed(() =>
|
||||||
warehouseList.value.filter((warehouse): warehouse is WarehouseVO & { id: number } => !!warehouse.id)
|
warehouseList.value.filter((warehouse): warehouse is WarehouseVO & { id: number } => !!warehouse.id)
|
||||||
|
|
@ -203,6 +215,21 @@ const handleDelete = async (id: number) => {
|
||||||
} catch {}
|
} catch {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
const handleExport = async () => {
|
||||||
|
try {
|
||||||
|
// 导出的二次确认
|
||||||
|
await message.exportConfirm()
|
||||||
|
// 发起导出
|
||||||
|
exportLoading.value = true
|
||||||
|
const data = await WarehouseAreaApi.exportWarehouseArea(queryParams)
|
||||||
|
download.excel(data, '库区.xls')
|
||||||
|
} catch {
|
||||||
|
} finally {
|
||||||
|
exportLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** 初始化 */
|
/** 初始化 */
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await getWarehouseList()
|
await getWarehouseList()
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,16 @@
|
||||||
<Icon class="mr-5px" icon="ep:plus" />
|
<Icon class="mr-5px" icon="ep:plus" />
|
||||||
新增
|
新增
|
||||||
</el-button>
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
v-hasPermi="['wms:warehouse:export']"
|
||||||
|
:loading="exportLoading"
|
||||||
|
plain
|
||||||
|
type="success"
|
||||||
|
@click="handleExport"
|
||||||
|
>
|
||||||
|
<Icon class="mr-5px" icon="ep:download" />
|
||||||
|
导出
|
||||||
|
</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</ContentWrap>
|
</ContentWrap>
|
||||||
|
|
@ -108,6 +118,7 @@ import { dateFormatter } from '@/utils/formatTime'
|
||||||
import { WarehouseApi, WarehouseVO } from '@/api/wms/md/warehouse'
|
import { WarehouseApi, WarehouseVO } from '@/api/wms/md/warehouse'
|
||||||
import { AREA_ENABLE } from '@/views/wms/utils/config'
|
import { AREA_ENABLE } from '@/views/wms/utils/config'
|
||||||
import WarehouseForm from './WarehouseForm.vue'
|
import WarehouseForm from './WarehouseForm.vue'
|
||||||
|
import download from '@/utils/download'
|
||||||
|
|
||||||
/** WMS 仓库管理 */
|
/** WMS 仓库管理 */
|
||||||
defineOptions({ name: 'WmsWarehouse' })
|
defineOptions({ name: 'WmsWarehouse' })
|
||||||
|
|
@ -125,6 +136,7 @@ const queryParams = reactive({
|
||||||
name: undefined
|
name: undefined
|
||||||
})
|
})
|
||||||
const queryFormRef = ref() // 搜索的表单
|
const queryFormRef = ref() // 搜索的表单
|
||||||
|
const exportLoading = ref(false) // 导出的加载中
|
||||||
|
|
||||||
/** 查询仓库列表 */
|
/** 查询仓库列表 */
|
||||||
const getList = async () => {
|
const getList = async () => {
|
||||||
|
|
@ -174,6 +186,21 @@ const handleDelete = async (id: number) => {
|
||||||
} catch {}
|
} catch {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
const handleExport = async () => {
|
||||||
|
try {
|
||||||
|
// 导出的二次确认
|
||||||
|
await message.exportConfirm()
|
||||||
|
// 发起导出
|
||||||
|
exportLoading.value = true
|
||||||
|
const data = await WarehouseApi.exportWarehouse(queryParams)
|
||||||
|
download.excel(data, '仓库.xls')
|
||||||
|
} catch {
|
||||||
|
} finally {
|
||||||
|
exportLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** 初始化 */
|
/** 初始化 */
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getList()
|
getList()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue