增加商品、商品分类页面
parent
e2d1e04b38
commit
ec6dab2896
|
|
@ -124,12 +124,12 @@ const searchForm = ref<ProjectTypes.SearchProjectParam>({
|
||||||
const searching = ref(false)
|
const searching = ref(false)
|
||||||
const deling = ref(false)
|
const deling = ref(false)
|
||||||
const showSearchForm = ref(true)
|
const showSearchForm = ref(true)
|
||||||
const projectFormIns = useTemplateRef<InstanceType<typeof ProjectForm>>('projectForm')
|
// const projectFormIns = useTemplateRef<InstanceType<typeof ProjectForm>>('projectForm')
|
||||||
const projectDetailIns = useTemplateRef<InstanceType<typeof ProjectDetail>>('projectDetail')
|
const projectDetailIns = useTemplateRef<InstanceType<typeof ProjectDetail>>('projectDetail')
|
||||||
|
|
||||||
function showDialog(data?: ProjectTypes.SearchProjectResult) {
|
// function showDialog(data?: ProjectTypes.SearchProjectResult) {
|
||||||
projectFormIns.value?.open(data)
|
// projectFormIns.value?.open(data)
|
||||||
}
|
// }
|
||||||
|
|
||||||
function delHandler({row}: { row: ProjectTypes.SearchProjectResult }) {
|
function delHandler({row}: { row: ProjectTypes.SearchProjectResult }) {
|
||||||
deling.value = true
|
deling.value = true
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,231 @@
|
||||||
|
<template>
|
||||||
|
<Page>
|
||||||
|
<ElForm v-show="showSearchForm" inline @submit.prevent="paging">
|
||||||
|
<ElFormItem label="Id">
|
||||||
|
<ElInput
|
||||||
|
v-model="searchForm.id"
|
||||||
|
placeholder="Id"/>
|
||||||
|
</ElFormItem>
|
||||||
|
<ElFormItem label="业务类型;字典代码:biz_type,ZaiShengPin-->再生品、HuiShouPin-->回收品、QiTa-->其他">
|
||||||
|
<ElInput
|
||||||
|
v-model="searchForm.bizType"
|
||||||
|
placeholder="业务类型;字典代码:biz_type,ZaiShengPin-->再生品、HuiShouPin-->回收品、QiTa-->其他"/>
|
||||||
|
</ElFormItem>
|
||||||
|
<ElFormItem label="分类名称">
|
||||||
|
<ElInput
|
||||||
|
v-model="searchForm.categoryName"
|
||||||
|
placeholder="分类名称"/>
|
||||||
|
</ElFormItem>
|
||||||
|
<ElFormItem label="图片">
|
||||||
|
<ElInput
|
||||||
|
v-model="searchForm.picture"
|
||||||
|
placeholder="图片"/>
|
||||||
|
</ElFormItem>
|
||||||
|
<ElFormItem label="排序">
|
||||||
|
<ElInput
|
||||||
|
v-model="searchForm.sort"
|
||||||
|
placeholder="排序"/>
|
||||||
|
</ElFormItem>
|
||||||
|
<ElFormItem label="创建人 Id;sys_user.id">
|
||||||
|
<ElInput
|
||||||
|
v-model="searchForm.creatorId"
|
||||||
|
placeholder="创建人 Id;sys_user.id"/>
|
||||||
|
</ElFormItem>
|
||||||
|
<ElFormItem label="修改人 Id;sys_user.id">
|
||||||
|
<ElInput
|
||||||
|
v-model="searchForm.modifierId"
|
||||||
|
placeholder="修改人 Id;sys_user.id"/>
|
||||||
|
</ElFormItem>
|
||||||
|
<ElFormItem label="创建时间">
|
||||||
|
<ElInput
|
||||||
|
v-model="searchForm.createTime"
|
||||||
|
placeholder="创建时间"/>
|
||||||
|
</ElFormItem>
|
||||||
|
<ElFormItem label="修改时间">
|
||||||
|
<ElInput
|
||||||
|
v-model="searchForm.modifyTime"
|
||||||
|
placeholder="修改时间"/>
|
||||||
|
</ElFormItem>
|
||||||
|
<ElFormItem label="是否删除; 0-->未删除、1-->已删除">
|
||||||
|
<ElInput
|
||||||
|
v-model="searchForm.deleted"
|
||||||
|
placeholder="是否删除; 0-->未删除、1-->已删除"/>
|
||||||
|
</ElFormItem>
|
||||||
|
<ElFormItem>
|
||||||
|
<ElButton :icon="elIcons.Search" :loading="searching" native-type="submit" type="primary">搜索</ElButton>
|
||||||
|
<ElButton :icon="elIcons.Refresh" :loading="searching" @click="reset">重置</ElButton>
|
||||||
|
</ElFormItem>
|
||||||
|
</ElForm>
|
||||||
|
|
||||||
|
<div class="tool-bar">
|
||||||
|
<ElButton :icon="elIcons.Plus" type="primary" @click="addHandler">新建</ElButton>
|
||||||
|
<ElButton :icon="elIcons.Filter" type="default" @click="showSearchForm = !showSearchForm"/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<ElTable v-loading="searching" :data="tableData"
|
||||||
|
cell-class-name="table-cell"
|
||||||
|
class="table-list"
|
||||||
|
empty-text="暂无数据"
|
||||||
|
header-row-class-name="table-header"
|
||||||
|
row-key="id">
|
||||||
|
<ElTableColumn label="Id" prop="id"/>
|
||||||
|
<ElTableColumn label="业务类型;字典代码:biz_type,ZaiShengPin-->再生品、HuiShouPin-->回收品、QiTa-->其他" prop="bizType"/>
|
||||||
|
<ElTableColumn label="分类名称" prop="categoryName"/>
|
||||||
|
<ElTableColumn label="图片" prop="picture"/>
|
||||||
|
<ElTableColumn label="排序" prop="sort"/>
|
||||||
|
<ElTableColumn label="创建人 Id;sys_user.id" prop="creatorId"/>
|
||||||
|
<ElTableColumn label="修改人 Id;sys_user.id" prop="modifierId"/>
|
||||||
|
<ElTableColumn label="创建时间" prop="createTime"/>
|
||||||
|
<ElTableColumn label="修改时间" prop="modifyTime"/>
|
||||||
|
<ElTableColumn label="是否删除; 0-->未删除、1-->已删除" prop="deleted"/>
|
||||||
|
<ElTableColumn label="操作" width="180">
|
||||||
|
<template #default="scope">
|
||||||
|
<div class="action-btn">
|
||||||
|
<ElPopconfirm
|
||||||
|
confirm-button-text="是"
|
||||||
|
cancel-button-text="否"
|
||||||
|
confirm-button-type="danger"
|
||||||
|
cancel-button-type="primary"
|
||||||
|
placement="top"
|
||||||
|
title="是否删除当前数据?"
|
||||||
|
width="180"
|
||||||
|
@confirm="delHandler(scope)">
|
||||||
|
<template #reference>
|
||||||
|
<ElButton text type="danger" :loading="deling">删除</ElButton>
|
||||||
|
</template>
|
||||||
|
</ElPopconfirm>
|
||||||
|
<ElButton text type="primary" @click="modifyHandler(scope)">修改</ElButton>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</ElTableColumn>
|
||||||
|
</ElTable>
|
||||||
|
<ElPagination
|
||||||
|
layout="->, sizes, total, prev, pager, next"
|
||||||
|
v-model:current-page="searchForm.current"
|
||||||
|
v-model:page-size="searchForm.size"
|
||||||
|
:total="totalCount"
|
||||||
|
:page-sizes="[10, 20, 50, 100, 500]"
|
||||||
|
:hide-on-single-page="false"
|
||||||
|
:teleported="false"
|
||||||
|
@change="paging"/>
|
||||||
|
<GoodsCategoryForm ref="goodsCategoryForm" @edit-succ="paging"/>
|
||||||
|
</Page>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import GoodsCategoryApi from '@/pages/gds/goods-category/goods-category-api.ts'
|
||||||
|
import GoodsCategoryForm from '@/pages/gds/goods-category/GoodsCategoryForm.vue'
|
||||||
|
import Page from '@/components/page/Page.vue'
|
||||||
|
import { elIcons } from '@/common/element/element.ts'
|
||||||
|
import Utils from '@/common/utils'
|
||||||
|
|
||||||
|
const totalCount = ref(0)
|
||||||
|
const tableData = Utils.resetAble(reactive<GoodsCategoryTypes.SearchGoodsCategoryResult[]>([]))
|
||||||
|
const searchForm = Utils.resetAble(reactive<GoodsCategoryTypes.SearchGoodsCategoryParam>({
|
||||||
|
current: 1,
|
||||||
|
size: 20,
|
||||||
|
}))
|
||||||
|
const searching = ref(false)
|
||||||
|
const deling = ref(false)
|
||||||
|
const showSearchForm = ref(true)
|
||||||
|
const goodsCategoryFormIns = useTemplateRef<InstanceType<typeof GoodsCategoryForm>>('goodsCategoryForm')
|
||||||
|
|
||||||
|
function showDialog(data?: GoodsCategoryTypes.SearchGoodsCategoryResult) {
|
||||||
|
goodsCategoryFormIns.value?.open(data)
|
||||||
|
}
|
||||||
|
|
||||||
|
function delHandler({row}: { row: GoodsCategoryTypes.SearchGoodsCategoryResult }) {
|
||||||
|
deling.value = true
|
||||||
|
GoodsCategoryApi.del([ row.id! ])
|
||||||
|
.then(() => {
|
||||||
|
ElMessage.success('删除成功')
|
||||||
|
paging()
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
deling.value = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function modifyHandler({row}: { row: GoodsCategoryTypes.SearchGoodsCategoryResult }) {
|
||||||
|
showDialog(row)
|
||||||
|
}
|
||||||
|
|
||||||
|
function addHandler() {
|
||||||
|
showDialog()
|
||||||
|
}
|
||||||
|
|
||||||
|
function reset() {
|
||||||
|
searchForm.$reset()
|
||||||
|
paging()
|
||||||
|
}
|
||||||
|
|
||||||
|
function paging() {
|
||||||
|
searching.value = true
|
||||||
|
GoodsCategoryApi.paging(searchForm)
|
||||||
|
.then(res => {
|
||||||
|
totalCount.value = res.data?.total ?? 0
|
||||||
|
tableData.$reset(res.data?.records ?? [])
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
searching.value = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
onMounted(() => {
|
||||||
|
paging()
|
||||||
|
})
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="stylus" scoped>
|
||||||
|
.table-list {
|
||||||
|
flex 1;
|
||||||
|
margin 0 0 20px 0
|
||||||
|
width 100%
|
||||||
|
|
||||||
|
:deep(.table-header) {
|
||||||
|
color #454C59
|
||||||
|
|
||||||
|
th {
|
||||||
|
background-color #EDF1F7
|
||||||
|
font-weight 500
|
||||||
|
position relative
|
||||||
|
|
||||||
|
& > div {
|
||||||
|
display flex
|
||||||
|
gap 5px
|
||||||
|
align-items center
|
||||||
|
}
|
||||||
|
|
||||||
|
&:not(:first-child) > div::before {
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 1px;
|
||||||
|
width: 1px;
|
||||||
|
background-color: #D3D7DE;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
content: "";
|
||||||
|
height 50%
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.table-cell) {
|
||||||
|
color #2F3540
|
||||||
|
}
|
||||||
|
.action-btn {
|
||||||
|
width 100%
|
||||||
|
display flex
|
||||||
|
flex-wrap wrap
|
||||||
|
|
||||||
|
& > button {
|
||||||
|
margin 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.tool-bar {
|
||||||
|
display flex
|
||||||
|
justify-content space-between
|
||||||
|
margin 0 0 20px 0
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -0,0 +1,163 @@
|
||||||
|
<template>
|
||||||
|
<ElDialog v-model="showDialog"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
destroy-on-close
|
||||||
|
width="fit-content"
|
||||||
|
@close="dialogCloseHandler">
|
||||||
|
<ElForm :model="formData"
|
||||||
|
:rules="rules"
|
||||||
|
ref="goodsCategoryForm"
|
||||||
|
class="form-panel"
|
||||||
|
label-width="auto">
|
||||||
|
<ElFormItem label="Id" prop="id">
|
||||||
|
<ElInput
|
||||||
|
v-model="formData.id"
|
||||||
|
:disabled="status === 'view'"
|
||||||
|
placeholder="Id"/>
|
||||||
|
</ElFormItem>
|
||||||
|
<ElFormItem label="业务类型;字典代码:biz_type,ZaiShengPin-->再生品、HuiShouPin-->回收品、QiTa-->其他" prop="bizType">
|
||||||
|
<ElInput
|
||||||
|
v-model="formData.bizType"
|
||||||
|
:disabled="status === 'view'"
|
||||||
|
placeholder="业务类型;字典代码:biz_type,ZaiShengPin-->再生品、HuiShouPin-->回收品、QiTa-->其他"/>
|
||||||
|
</ElFormItem>
|
||||||
|
<ElFormItem label="分类名称" prop="categoryName">
|
||||||
|
<ElInput
|
||||||
|
v-model="formData.categoryName"
|
||||||
|
:disabled="status === 'view'"
|
||||||
|
placeholder="分类名称"/>
|
||||||
|
</ElFormItem>
|
||||||
|
<ElFormItem label="图片" prop="picture">
|
||||||
|
<ElInput
|
||||||
|
v-model="formData.picture"
|
||||||
|
:disabled="status === 'view'"
|
||||||
|
placeholder="图片"/>
|
||||||
|
</ElFormItem>
|
||||||
|
<ElFormItem label="排序" prop="sort">
|
||||||
|
<ElInput
|
||||||
|
v-model="formData.sort"
|
||||||
|
:disabled="status === 'view'"
|
||||||
|
placeholder="排序"/>
|
||||||
|
</ElFormItem>
|
||||||
|
<ElFormItem label="创建人 Id;sys_user.id" prop="creatorId">
|
||||||
|
<ElInput
|
||||||
|
v-model="formData.creatorId"
|
||||||
|
:disabled="status === 'view'"
|
||||||
|
placeholder="创建人 Id;sys_user.id"/>
|
||||||
|
</ElFormItem>
|
||||||
|
<ElFormItem label="修改人 Id;sys_user.id" prop="modifierId">
|
||||||
|
<ElInput
|
||||||
|
v-model="formData.modifierId"
|
||||||
|
:disabled="status === 'view'"
|
||||||
|
placeholder="修改人 Id;sys_user.id"/>
|
||||||
|
</ElFormItem>
|
||||||
|
<ElFormItem label="创建时间" prop="createTime">
|
||||||
|
<ElInput
|
||||||
|
v-model="formData.createTime"
|
||||||
|
:disabled="status === 'view'"
|
||||||
|
placeholder="创建时间"/>
|
||||||
|
</ElFormItem>
|
||||||
|
<ElFormItem label="修改时间" prop="modifyTime">
|
||||||
|
<ElInput
|
||||||
|
v-model="formData.modifyTime"
|
||||||
|
:disabled="status === 'view'"
|
||||||
|
placeholder="修改时间"/>
|
||||||
|
</ElFormItem>
|
||||||
|
<ElFormItem label="是否删除; 0-->未删除、1-->已删除" prop="deleted">
|
||||||
|
<ElInput
|
||||||
|
v-model="formData.deleted"
|
||||||
|
:disabled="status === 'view'"
|
||||||
|
placeholder="是否删除; 0-->未删除、1-->已删除"/>
|
||||||
|
</ElFormItem>
|
||||||
|
</ElForm>
|
||||||
|
<template #footer>
|
||||||
|
<ElButton @click="showDialog = false">{{ status === 'view' ? '关闭' : '取消' }}</ElButton>
|
||||||
|
<ElButton v-if="status !== 'view'" :loading="submiting" type="primary" @click="submitHandler">提交</ElButton>
|
||||||
|
</template>
|
||||||
|
</ElDialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import GoodsCategoryApi from '@/pages/gds/goods-category/goods-category-api.ts'
|
||||||
|
import Strings from '@/common/utils/strings.ts'
|
||||||
|
import FormUtil from '@/common/utils/formUtil.ts'
|
||||||
|
import Utils from '@/common/utils'
|
||||||
|
import {
|
||||||
|
ElMessage,
|
||||||
|
type FormInstance,
|
||||||
|
type FormRules,
|
||||||
|
} from 'element-plus'
|
||||||
|
|
||||||
|
const emits = defineEmits(['editSucc'])
|
||||||
|
const showDialog = ref(false)
|
||||||
|
const submiting = ref(false)
|
||||||
|
const status = ref<'add' | 'view' | 'modify'>('add')
|
||||||
|
|
||||||
|
const goodsCategoryFormIns = useTemplateRef<FormInstance>('goodsCategoryForm')
|
||||||
|
|
||||||
|
const formData = Utils.resetAble(reactive<GoodsCategoryTypes.SearchGoodsCategoryResult>({}))
|
||||||
|
const rules = reactive<FormRules<GoodsCategoryTypes.SearchGoodsCategoryResult>>({
|
||||||
|
id: [{ required: true, message: '请填写Id', trigger: 'blur' }],
|
||||||
|
bizType: [{ required: true, message: '请填写业务类型;字典代码:biz_type,ZaiShengPin-->再生品、HuiShouPin-->回收品、QiTa-->其他', trigger: 'blur' }],
|
||||||
|
categoryName: [{ required: true, message: '请填写分类名称', trigger: 'blur' }],
|
||||||
|
picture: [{ required: true, message: '请填写图片', trigger: 'blur' }],
|
||||||
|
sort: [{ 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' }],
|
||||||
|
})
|
||||||
|
|
||||||
|
function dialogCloseHandler() {
|
||||||
|
formData.$reset()
|
||||||
|
}
|
||||||
|
|
||||||
|
function submitHandler() {
|
||||||
|
if (status.value === 'view') return
|
||||||
|
submiting.value = true
|
||||||
|
if (formData.id != null) {
|
||||||
|
FormUtil.submit(goodsCategoryFormIns, () => GoodsCategoryApi.modify(formData))
|
||||||
|
.then(() => {
|
||||||
|
ElMessage.success('修改成功')
|
||||||
|
emits('editSucc')
|
||||||
|
showDialog.value = false
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
submiting.value = false
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
FormUtil.submit(goodsCategoryFormIns, () => GoodsCategoryApi.add(formData))
|
||||||
|
.then(() => {
|
||||||
|
ElMessage.success('添加成功')
|
||||||
|
emits('editSucc')
|
||||||
|
showDialog.value = false
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
submiting.value = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
open(data: GoodsCategoryTypes.SearchGoodsCategoryResult = {}) {
|
||||||
|
showDialog.value = true
|
||||||
|
if (!Strings.isBlank(data.id)) {
|
||||||
|
status.value = 'modify'
|
||||||
|
GoodsCategoryApi.detail(data.id!)
|
||||||
|
.then(res => {
|
||||||
|
formData.$reset(res.data)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
status.value = 'add'
|
||||||
|
formData.$reset(data)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="stylus" scoped>
|
||||||
|
.form-panel {
|
||||||
|
padding 20px
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
import {
|
||||||
|
get,
|
||||||
|
post
|
||||||
|
} from '@/common/utils/http-util.ts'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
paging(data: GoodsCategoryTypes.SearchGoodsCategoryParam) {
|
||||||
|
return get<G.PageResult<GoodsCategoryTypes.SearchGoodsCategoryResult>>('/goods_category/paging', data)
|
||||||
|
},
|
||||||
|
detail(id: string) {
|
||||||
|
return get<GoodsCategoryTypes.SearchGoodsCategoryResult>('/goods_category/detail', {id})
|
||||||
|
},
|
||||||
|
add(data: GoodsCategoryTypes.AddGoodsCategoryParam) {
|
||||||
|
return post('/goods_category/add', data)
|
||||||
|
},
|
||||||
|
modify(data: GoodsCategoryTypes.ModifyGoodsCategoryParam) {
|
||||||
|
return post('/goods_category/modify', data)
|
||||||
|
},
|
||||||
|
del(ids: string[]) {
|
||||||
|
return post('/goods_category/del', ids)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,97 @@
|
||||||
|
export {}
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
namespace GoodsCategoryTypes {
|
||||||
|
interface SearchGoodsCategoryParam extends G.PageParam {
|
||||||
|
// Id
|
||||||
|
id?: string
|
||||||
|
// 业务类型;字典代码:biz_type,ZaiShengPin-->再生品、HuiShouPin-->回收品、QiTa-->其他
|
||||||
|
bizType?: string
|
||||||
|
// 分类名称
|
||||||
|
categoryName?: string
|
||||||
|
// 图片
|
||||||
|
picture?: string
|
||||||
|
// 排序
|
||||||
|
sort?: number
|
||||||
|
// 创建人 Id;sys_user.id
|
||||||
|
creatorId?: string
|
||||||
|
// 修改人 Id;sys_user.id
|
||||||
|
modifierId?: string
|
||||||
|
// 创建时间
|
||||||
|
createTime?: string
|
||||||
|
// 修改时间
|
||||||
|
modifyTime?: string
|
||||||
|
// 是否删除; 0-->未删除、1-->已删除
|
||||||
|
deleted?: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
interface SearchGoodsCategoryResult {
|
||||||
|
// Id
|
||||||
|
id?: string
|
||||||
|
// 业务类型;字典代码:biz_type,ZaiShengPin-->再生品、HuiShouPin-->回收品、QiTa-->其他
|
||||||
|
bizType?: string
|
||||||
|
// 分类名称
|
||||||
|
categoryName?: string
|
||||||
|
// 图片
|
||||||
|
picture?: string
|
||||||
|
// 排序
|
||||||
|
sort?: number
|
||||||
|
// 创建人 Id;sys_user.id
|
||||||
|
creatorId?: string
|
||||||
|
// 修改人 Id;sys_user.id
|
||||||
|
modifierId?: string
|
||||||
|
// 创建时间
|
||||||
|
createTime?: string
|
||||||
|
// 修改时间
|
||||||
|
modifyTime?: string
|
||||||
|
// 是否删除; 0-->未删除、1-->已删除
|
||||||
|
deleted?: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
interface AddGoodsCategoryParam {
|
||||||
|
// Id
|
||||||
|
id?: string
|
||||||
|
// 业务类型;字典代码:biz_type,ZaiShengPin-->再生品、HuiShouPin-->回收品、QiTa-->其他
|
||||||
|
bizType?: string
|
||||||
|
// 分类名称
|
||||||
|
categoryName?: string
|
||||||
|
// 图片
|
||||||
|
picture?: string
|
||||||
|
// 排序
|
||||||
|
sort?: number
|
||||||
|
// 创建人 Id;sys_user.id
|
||||||
|
creatorId?: string
|
||||||
|
// 修改人 Id;sys_user.id
|
||||||
|
modifierId?: string
|
||||||
|
// 创建时间
|
||||||
|
createTime?: string
|
||||||
|
// 修改时间
|
||||||
|
modifyTime?: string
|
||||||
|
// 是否删除; 0-->未删除、1-->已删除
|
||||||
|
deleted?: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ModifyGoodsCategoryParam {
|
||||||
|
// Id
|
||||||
|
id?: string
|
||||||
|
// 业务类型;字典代码:biz_type,ZaiShengPin-->再生品、HuiShouPin-->回收品、QiTa-->其他
|
||||||
|
bizType?: string
|
||||||
|
// 分类名称
|
||||||
|
categoryName?: string
|
||||||
|
// 图片
|
||||||
|
picture?: string
|
||||||
|
// 排序
|
||||||
|
sort?: number
|
||||||
|
// 创建人 Id;sys_user.id
|
||||||
|
creatorId?: string
|
||||||
|
// 修改人 Id;sys_user.id
|
||||||
|
modifierId?: string
|
||||||
|
// 创建时间
|
||||||
|
createTime?: string
|
||||||
|
// 修改时间
|
||||||
|
modifyTime?: string
|
||||||
|
// 是否删除; 0-->未删除、1-->已删除
|
||||||
|
deleted?: boolean
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
export default {
|
||||||
|
component: () => import('@/pages/gds/goods-category/GoodsCategory.vue'),
|
||||||
|
} as RouterTypes.RouteConfig
|
||||||
|
|
@ -0,0 +1,279 @@
|
||||||
|
<template>
|
||||||
|
<Page>
|
||||||
|
<ElForm v-show="showSearchForm" inline @submit.prevent="paging">
|
||||||
|
<ElFormItem label="Id">
|
||||||
|
<ElInput
|
||||||
|
v-model="searchForm.id"
|
||||||
|
placeholder="Id"/>
|
||||||
|
</ElFormItem>
|
||||||
|
<ElFormItem label="产品类型 Id">
|
||||||
|
<ElInput
|
||||||
|
v-model="searchForm.goodsCategoryId"
|
||||||
|
placeholder="产品类型 Id"/>
|
||||||
|
</ElFormItem>
|
||||||
|
<ElFormItem label="商品编码">
|
||||||
|
<ElInput
|
||||||
|
v-model="searchForm.sn"
|
||||||
|
placeholder="商品编码"/>
|
||||||
|
</ElFormItem>
|
||||||
|
<ElFormItem label="产品名称">
|
||||||
|
<ElInput
|
||||||
|
v-model="searchForm.goodsName"
|
||||||
|
placeholder="产品名称"/>
|
||||||
|
</ElFormItem>
|
||||||
|
<ElFormItem label="规格">
|
||||||
|
<ElInput
|
||||||
|
v-model="searchForm.specParams"
|
||||||
|
placeholder="规格"/>
|
||||||
|
</ElFormItem>
|
||||||
|
<ElFormItem label="图片">
|
||||||
|
<ElInput
|
||||||
|
v-model="searchForm.picture"
|
||||||
|
placeholder="图片"/>
|
||||||
|
</ElFormItem>
|
||||||
|
<ElFormItem label="计量单位;字典代码:unit">
|
||||||
|
<ElInput
|
||||||
|
v-model="searchForm.unit"
|
||||||
|
placeholder="计量单位;字典代码:unit"/>
|
||||||
|
</ElFormItem>
|
||||||
|
<ElFormItem label="是否为成品;0-->否、1-->是">
|
||||||
|
<ElInput
|
||||||
|
v-model="searchForm.fg"
|
||||||
|
placeholder="是否为成品;0-->否、1-->是"/>
|
||||||
|
</ElFormItem>
|
||||||
|
<ElFormItem label="是否为半成品;0-->否、1-->是">
|
||||||
|
<ElInput
|
||||||
|
v-model="searchForm.sfg"
|
||||||
|
placeholder="是否为半成品;0-->否、1-->是"/>
|
||||||
|
</ElFormItem>
|
||||||
|
<ElFormItem label="是否为原料;0-->否、1-->是">
|
||||||
|
<ElInput
|
||||||
|
v-model="searchForm.rg"
|
||||||
|
placeholder="是否为原料;0-->否、1-->是"/>
|
||||||
|
</ElFormItem>
|
||||||
|
<ElFormItem label="排序">
|
||||||
|
<ElInput
|
||||||
|
v-model="searchForm.sort"
|
||||||
|
placeholder="排序"/>
|
||||||
|
</ElFormItem>
|
||||||
|
<ElFormItem label="是否可用;0-->否、1-->是">
|
||||||
|
<ElInput
|
||||||
|
v-model="searchForm.canuse"
|
||||||
|
placeholder="是否可用;0-->否、1-->是"/>
|
||||||
|
</ElFormItem>
|
||||||
|
<ElFormItem label="备注">
|
||||||
|
<ElInput
|
||||||
|
v-model="searchForm.memo"
|
||||||
|
placeholder="备注"/>
|
||||||
|
</ElFormItem>
|
||||||
|
<ElFormItem label="创建人 Id;sys_user.id">
|
||||||
|
<ElInput
|
||||||
|
v-model="searchForm.creatorId"
|
||||||
|
placeholder="创建人 Id;sys_user.id"/>
|
||||||
|
</ElFormItem>
|
||||||
|
<ElFormItem label="修改人 Id;sys_user.id">
|
||||||
|
<ElInput
|
||||||
|
v-model="searchForm.modifierId"
|
||||||
|
placeholder="修改人 Id;sys_user.id"/>
|
||||||
|
</ElFormItem>
|
||||||
|
<ElFormItem label="创建时间">
|
||||||
|
<ElInput
|
||||||
|
v-model="searchForm.createTime"
|
||||||
|
placeholder="创建时间"/>
|
||||||
|
</ElFormItem>
|
||||||
|
<ElFormItem label="修改时间">
|
||||||
|
<ElInput
|
||||||
|
v-model="searchForm.modifyTime"
|
||||||
|
placeholder="修改时间"/>
|
||||||
|
</ElFormItem>
|
||||||
|
<ElFormItem label="是否删除; 0-->未删除、1-->已删除">
|
||||||
|
<ElInput
|
||||||
|
v-model="searchForm.deleted"
|
||||||
|
placeholder="是否删除; 0-->未删除、1-->已删除"/>
|
||||||
|
</ElFormItem>
|
||||||
|
<ElFormItem>
|
||||||
|
<ElButton :icon="elIcons.Search" :loading="searching" native-type="submit" type="primary">搜索</ElButton>
|
||||||
|
<ElButton :icon="elIcons.Refresh" :loading="searching" @click="reset">重置</ElButton>
|
||||||
|
</ElFormItem>
|
||||||
|
</ElForm>
|
||||||
|
|
||||||
|
<div class="tool-bar">
|
||||||
|
<ElButton :icon="elIcons.Plus" type="primary" @click="addHandler">新建</ElButton>
|
||||||
|
<ElButton :icon="elIcons.Filter" type="default" @click="showSearchForm = !showSearchForm"/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<ElTable v-loading="searching" :data="tableData"
|
||||||
|
cell-class-name="table-cell"
|
||||||
|
class="table-list"
|
||||||
|
empty-text="暂无数据"
|
||||||
|
header-row-class-name="table-header"
|
||||||
|
row-key="id">
|
||||||
|
<ElTableColumn label="Id" prop="id"/>
|
||||||
|
<ElTableColumn label="产品类型 Id" prop="goodsCategoryId"/>
|
||||||
|
<ElTableColumn label="商品编码" prop="sn"/>
|
||||||
|
<ElTableColumn label="产品名称" prop="goodsName"/>
|
||||||
|
<ElTableColumn label="规格" prop="specParams"/>
|
||||||
|
<ElTableColumn label="图片" prop="picture"/>
|
||||||
|
<ElTableColumn label="计量单位;字典代码:unit" prop="unit"/>
|
||||||
|
<ElTableColumn label="是否为成品;0-->否、1-->是" prop="fg"/>
|
||||||
|
<ElTableColumn label="是否为半成品;0-->否、1-->是" prop="sfg"/>
|
||||||
|
<ElTableColumn label="是否为原料;0-->否、1-->是" prop="rg"/>
|
||||||
|
<ElTableColumn label="排序" prop="sort"/>
|
||||||
|
<ElTableColumn label="是否可用;0-->否、1-->是" prop="canuse"/>
|
||||||
|
<ElTableColumn label="备注" prop="memo"/>
|
||||||
|
<ElTableColumn label="创建人 Id;sys_user.id" prop="creatorId"/>
|
||||||
|
<ElTableColumn label="修改人 Id;sys_user.id" prop="modifierId"/>
|
||||||
|
<ElTableColumn label="创建时间" prop="createTime"/>
|
||||||
|
<ElTableColumn label="修改时间" prop="modifyTime"/>
|
||||||
|
<ElTableColumn label="是否删除; 0-->未删除、1-->已删除" prop="deleted"/>
|
||||||
|
<ElTableColumn label="操作" width="180">
|
||||||
|
<template #default="scope">
|
||||||
|
<div class="action-btn">
|
||||||
|
<ElPopconfirm
|
||||||
|
confirm-button-text="是"
|
||||||
|
cancel-button-text="否"
|
||||||
|
confirm-button-type="danger"
|
||||||
|
cancel-button-type="primary"
|
||||||
|
placement="top"
|
||||||
|
title="是否删除当前数据?"
|
||||||
|
width="180"
|
||||||
|
@confirm="delHandler(scope)">
|
||||||
|
<template #reference>
|
||||||
|
<ElButton text type="danger" :loading="deling">删除</ElButton>
|
||||||
|
</template>
|
||||||
|
</ElPopconfirm>
|
||||||
|
<ElButton text type="primary" @click="modifyHandler(scope)">修改</ElButton>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</ElTableColumn>
|
||||||
|
</ElTable>
|
||||||
|
<ElPagination
|
||||||
|
layout="->, sizes, total, prev, pager, next"
|
||||||
|
v-model:current-page="searchForm.current"
|
||||||
|
v-model:page-size="searchForm.size"
|
||||||
|
:total="totalCount"
|
||||||
|
:page-sizes="[10, 20, 50, 100, 500]"
|
||||||
|
:hide-on-single-page="false"
|
||||||
|
:teleported="false"
|
||||||
|
@change="paging"/>
|
||||||
|
<GoodsForm ref="goodsForm" @edit-succ="paging"/>
|
||||||
|
</Page>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import GoodsApi from '@/pages/gds/goods/goods-api.ts'
|
||||||
|
import GoodsForm from '@/pages/gds/goods/GoodsForm.vue'
|
||||||
|
import Page from '@/components/page/Page.vue'
|
||||||
|
import { elIcons } from '@/common/element/element.ts'
|
||||||
|
import Utils from '@/common/utils'
|
||||||
|
|
||||||
|
const totalCount = ref(0)
|
||||||
|
const tableData = Utils.resetAble(reactive<GoodsTypes.SearchGoodsResult[]>([]))
|
||||||
|
const searchForm = Utils.resetAble(reactive<GoodsTypes.SearchGoodsParam>({
|
||||||
|
current: 1,
|
||||||
|
size: 20,
|
||||||
|
}))
|
||||||
|
const searching = ref(false)
|
||||||
|
const deling = ref(false)
|
||||||
|
const showSearchForm = ref(true)
|
||||||
|
const goodsFormIns = useTemplateRef<InstanceType<typeof GoodsForm>>('goodsForm')
|
||||||
|
|
||||||
|
function showDialog(data?: GoodsTypes.SearchGoodsResult) {
|
||||||
|
goodsFormIns.value?.open(data)
|
||||||
|
}
|
||||||
|
|
||||||
|
function delHandler({row}: { row: GoodsTypes.SearchGoodsResult }) {
|
||||||
|
deling.value = true
|
||||||
|
GoodsApi.del([ row.id! ])
|
||||||
|
.then(() => {
|
||||||
|
ElMessage.success('删除成功')
|
||||||
|
paging()
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
deling.value = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function modifyHandler({row}: { row: GoodsTypes.SearchGoodsResult }) {
|
||||||
|
showDialog(row)
|
||||||
|
}
|
||||||
|
|
||||||
|
function addHandler() {
|
||||||
|
showDialog()
|
||||||
|
}
|
||||||
|
|
||||||
|
function reset() {
|
||||||
|
searchForm.$reset()
|
||||||
|
paging()
|
||||||
|
}
|
||||||
|
|
||||||
|
function paging() {
|
||||||
|
searching.value = true
|
||||||
|
GoodsApi.paging(searchForm)
|
||||||
|
.then(res => {
|
||||||
|
totalCount.value = res.data?.total ?? 0
|
||||||
|
tableData.$reset(res.data?.records ?? [])
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
searching.value = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
onMounted(() => {
|
||||||
|
paging()
|
||||||
|
})
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="stylus" scoped>
|
||||||
|
.table-list {
|
||||||
|
flex 1;
|
||||||
|
margin 0 0 20px 0
|
||||||
|
width 100%
|
||||||
|
|
||||||
|
:deep(.table-header) {
|
||||||
|
color #454C59
|
||||||
|
|
||||||
|
th {
|
||||||
|
background-color #EDF1F7
|
||||||
|
font-weight 500
|
||||||
|
position relative
|
||||||
|
|
||||||
|
& > div {
|
||||||
|
display flex
|
||||||
|
gap 5px
|
||||||
|
align-items center
|
||||||
|
}
|
||||||
|
|
||||||
|
&:not(:first-child) > div::before {
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 1px;
|
||||||
|
width: 1px;
|
||||||
|
background-color: #D3D7DE;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
content: "";
|
||||||
|
height 50%
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.table-cell) {
|
||||||
|
color #2F3540
|
||||||
|
}
|
||||||
|
.action-btn {
|
||||||
|
width 100%
|
||||||
|
display flex
|
||||||
|
flex-wrap wrap
|
||||||
|
|
||||||
|
& > button {
|
||||||
|
margin 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.tool-bar {
|
||||||
|
display flex
|
||||||
|
justify-content space-between
|
||||||
|
margin 0 0 20px 0
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -0,0 +1,219 @@
|
||||||
|
<template>
|
||||||
|
<ElDialog v-model="showDialog"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
destroy-on-close
|
||||||
|
width="fit-content"
|
||||||
|
@close="dialogCloseHandler">
|
||||||
|
<ElForm :model="formData"
|
||||||
|
:rules="rules"
|
||||||
|
ref="goodsForm"
|
||||||
|
class="form-panel"
|
||||||
|
label-width="auto">
|
||||||
|
<ElFormItem label="Id" prop="id">
|
||||||
|
<ElInput
|
||||||
|
v-model="formData.id"
|
||||||
|
:disabled="status === 'view'"
|
||||||
|
placeholder="Id"/>
|
||||||
|
</ElFormItem>
|
||||||
|
<ElFormItem label="产品类型 Id" prop="goodsCategoryId">
|
||||||
|
<ElInput
|
||||||
|
v-model="formData.goodsCategoryId"
|
||||||
|
:disabled="status === 'view'"
|
||||||
|
placeholder="产品类型 Id"/>
|
||||||
|
</ElFormItem>
|
||||||
|
<ElFormItem label="商品编码" prop="sn">
|
||||||
|
<ElInput
|
||||||
|
v-model="formData.sn"
|
||||||
|
:disabled="status === 'view'"
|
||||||
|
placeholder="商品编码"/>
|
||||||
|
</ElFormItem>
|
||||||
|
<ElFormItem label="产品名称" prop="goodsName">
|
||||||
|
<ElInput
|
||||||
|
v-model="formData.goodsName"
|
||||||
|
:disabled="status === 'view'"
|
||||||
|
placeholder="产品名称"/>
|
||||||
|
</ElFormItem>
|
||||||
|
<ElFormItem label="规格" prop="specParams">
|
||||||
|
<ElInput
|
||||||
|
v-model="formData.specParams"
|
||||||
|
:disabled="status === 'view'"
|
||||||
|
placeholder="规格"/>
|
||||||
|
</ElFormItem>
|
||||||
|
<ElFormItem label="图片" prop="picture">
|
||||||
|
<ElInput
|
||||||
|
v-model="formData.picture"
|
||||||
|
:disabled="status === 'view'"
|
||||||
|
placeholder="图片"/>
|
||||||
|
</ElFormItem>
|
||||||
|
<ElFormItem label="计量单位;字典代码:unit" prop="unit">
|
||||||
|
<ElInput
|
||||||
|
v-model="formData.unit"
|
||||||
|
:disabled="status === 'view'"
|
||||||
|
placeholder="计量单位;字典代码:unit"/>
|
||||||
|
</ElFormItem>
|
||||||
|
<ElFormItem label="是否为成品;0-->否、1-->是" prop="fg">
|
||||||
|
<ElInput
|
||||||
|
v-model="formData.fg"
|
||||||
|
:disabled="status === 'view'"
|
||||||
|
placeholder="是否为成品;0-->否、1-->是"/>
|
||||||
|
</ElFormItem>
|
||||||
|
<ElFormItem label="是否为半成品;0-->否、1-->是" prop="sfg">
|
||||||
|
<ElInput
|
||||||
|
v-model="formData.sfg"
|
||||||
|
:disabled="status === 'view'"
|
||||||
|
placeholder="是否为半成品;0-->否、1-->是"/>
|
||||||
|
</ElFormItem>
|
||||||
|
<ElFormItem label="是否为原料;0-->否、1-->是" prop="rg">
|
||||||
|
<ElInput
|
||||||
|
v-model="formData.rg"
|
||||||
|
:disabled="status === 'view'"
|
||||||
|
placeholder="是否为原料;0-->否、1-->是"/>
|
||||||
|
</ElFormItem>
|
||||||
|
<ElFormItem label="排序" prop="sort">
|
||||||
|
<ElInput
|
||||||
|
v-model="formData.sort"
|
||||||
|
:disabled="status === 'view'"
|
||||||
|
placeholder="排序"/>
|
||||||
|
</ElFormItem>
|
||||||
|
<ElFormItem label="是否可用;0-->否、1-->是" prop="canuse">
|
||||||
|
<ElInput
|
||||||
|
v-model="formData.canuse"
|
||||||
|
:disabled="status === 'view'"
|
||||||
|
placeholder="是否可用;0-->否、1-->是"/>
|
||||||
|
</ElFormItem>
|
||||||
|
<ElFormItem label="备注" prop="memo">
|
||||||
|
<ElInput
|
||||||
|
v-model="formData.memo"
|
||||||
|
:disabled="status === 'view'"
|
||||||
|
placeholder="备注"/>
|
||||||
|
</ElFormItem>
|
||||||
|
<ElFormItem label="创建人 Id;sys_user.id" prop="creatorId">
|
||||||
|
<ElInput
|
||||||
|
v-model="formData.creatorId"
|
||||||
|
:disabled="status === 'view'"
|
||||||
|
placeholder="创建人 Id;sys_user.id"/>
|
||||||
|
</ElFormItem>
|
||||||
|
<ElFormItem label="修改人 Id;sys_user.id" prop="modifierId">
|
||||||
|
<ElInput
|
||||||
|
v-model="formData.modifierId"
|
||||||
|
:disabled="status === 'view'"
|
||||||
|
placeholder="修改人 Id;sys_user.id"/>
|
||||||
|
</ElFormItem>
|
||||||
|
<ElFormItem label="创建时间" prop="createTime">
|
||||||
|
<ElInput
|
||||||
|
v-model="formData.createTime"
|
||||||
|
:disabled="status === 'view'"
|
||||||
|
placeholder="创建时间"/>
|
||||||
|
</ElFormItem>
|
||||||
|
<ElFormItem label="修改时间" prop="modifyTime">
|
||||||
|
<ElInput
|
||||||
|
v-model="formData.modifyTime"
|
||||||
|
:disabled="status === 'view'"
|
||||||
|
placeholder="修改时间"/>
|
||||||
|
</ElFormItem>
|
||||||
|
<ElFormItem label="是否删除; 0-->未删除、1-->已删除" prop="deleted">
|
||||||
|
<ElInput
|
||||||
|
v-model="formData.deleted"
|
||||||
|
:disabled="status === 'view'"
|
||||||
|
placeholder="是否删除; 0-->未删除、1-->已删除"/>
|
||||||
|
</ElFormItem>
|
||||||
|
</ElForm>
|
||||||
|
<template #footer>
|
||||||
|
<ElButton @click="showDialog = false">{{ status === 'view' ? '关闭' : '取消' }}</ElButton>
|
||||||
|
<ElButton v-if="status !== 'view'" :loading="submiting" type="primary" @click="submitHandler">提交</ElButton>
|
||||||
|
</template>
|
||||||
|
</ElDialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import GoodsApi from '@/pages/gds/goods/goods-api.ts'
|
||||||
|
import Strings from '@/common/utils/strings.ts'
|
||||||
|
import FormUtil from '@/common/utils/formUtil.ts'
|
||||||
|
import Utils from '@/common/utils'
|
||||||
|
import {
|
||||||
|
ElMessage,
|
||||||
|
type FormInstance,
|
||||||
|
type FormRules,
|
||||||
|
} from 'element-plus'
|
||||||
|
|
||||||
|
const emits = defineEmits(['editSucc'])
|
||||||
|
const showDialog = ref(false)
|
||||||
|
const submiting = ref(false)
|
||||||
|
const status = ref<'add' | 'view' | 'modify'>('add')
|
||||||
|
|
||||||
|
const goodsFormIns = useTemplateRef<FormInstance>('goodsForm')
|
||||||
|
|
||||||
|
const formData = Utils.resetAble(reactive<GoodsTypes.SearchGoodsResult>({}))
|
||||||
|
const rules = reactive<FormRules<GoodsTypes.SearchGoodsResult>>({
|
||||||
|
id: [{ required: true, message: '请填写Id', trigger: 'blur' }],
|
||||||
|
goodsCategoryId: [{ required: true, message: '请填写产品类型 Id', trigger: 'blur' }],
|
||||||
|
sn: [{ required: true, message: '请填写商品编码', trigger: 'blur' }],
|
||||||
|
goodsName: [{ required: true, message: '请填写产品名称', trigger: 'blur' }],
|
||||||
|
specParams: [{ required: true, message: '请填写规格', trigger: 'blur' }],
|
||||||
|
picture: [{ required: true, message: '请填写图片', trigger: 'blur' }],
|
||||||
|
unit: [{ required: true, message: '请填写计量单位;字典代码:unit', trigger: 'blur' }],
|
||||||
|
fg: [{ required: true, message: '请填写是否为成品;0-->否、1-->是', trigger: 'blur' }],
|
||||||
|
sfg: [{ required: true, message: '请填写是否为半成品;0-->否、1-->是', trigger: 'blur' }],
|
||||||
|
rg: [{ required: true, message: '请填写是否为原料;0-->否、1-->是', trigger: 'blur' }],
|
||||||
|
sort: [{ required: true, message: '请填写排序', trigger: 'blur' }],
|
||||||
|
canuse: [{ required: true, message: '请填写是否可用;0-->否、1-->是', trigger: 'blur' }],
|
||||||
|
memo: [{ 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' }],
|
||||||
|
})
|
||||||
|
|
||||||
|
function dialogCloseHandler() {
|
||||||
|
formData.$reset()
|
||||||
|
}
|
||||||
|
|
||||||
|
function submitHandler() {
|
||||||
|
if (status.value === 'view') return
|
||||||
|
submiting.value = true
|
||||||
|
if (formData.id != null) {
|
||||||
|
FormUtil.submit(goodsFormIns, () => GoodsApi.modify(formData))
|
||||||
|
.then(() => {
|
||||||
|
ElMessage.success('修改成功')
|
||||||
|
emits('editSucc')
|
||||||
|
showDialog.value = false
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
submiting.value = false
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
FormUtil.submit(goodsFormIns, () => GoodsApi.add(formData))
|
||||||
|
.then(() => {
|
||||||
|
ElMessage.success('添加成功')
|
||||||
|
emits('editSucc')
|
||||||
|
showDialog.value = false
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
submiting.value = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
open(data: GoodsTypes.SearchGoodsResult = {}) {
|
||||||
|
showDialog.value = true
|
||||||
|
if (!Strings.isBlank(data.id)) {
|
||||||
|
status.value = 'modify'
|
||||||
|
GoodsApi.detail(data.id!)
|
||||||
|
.then(res => {
|
||||||
|
formData.$reset(res.data)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
status.value = 'add'
|
||||||
|
formData.$reset(data)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="stylus" scoped>
|
||||||
|
.form-panel {
|
||||||
|
padding 20px
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
import {
|
||||||
|
get,
|
||||||
|
post
|
||||||
|
} from '@/common/utils/http-util.ts'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
paging(data: GoodsTypes.SearchGoodsParam) {
|
||||||
|
return get<G.PageResult<GoodsTypes.SearchGoodsResult>>('/goods/paging', data)
|
||||||
|
},
|
||||||
|
detail(id: string) {
|
||||||
|
return get<GoodsTypes.SearchGoodsResult>('/goods/detail', {id})
|
||||||
|
},
|
||||||
|
add(data: GoodsTypes.AddGoodsParam) {
|
||||||
|
return post('/goods/add', data)
|
||||||
|
},
|
||||||
|
modify(data: GoodsTypes.ModifyGoodsParam) {
|
||||||
|
return post('/goods/modify', data)
|
||||||
|
},
|
||||||
|
del(ids: string[]) {
|
||||||
|
return post('/goods/del', ids)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,161 @@
|
||||||
|
export {}
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
namespace GoodsTypes {
|
||||||
|
interface SearchGoodsParam extends G.PageParam {
|
||||||
|
// Id
|
||||||
|
id?: string
|
||||||
|
// 产品类型 Id
|
||||||
|
goodsCategoryId?: string
|
||||||
|
// 商品编码
|
||||||
|
sn?: string
|
||||||
|
// 产品名称
|
||||||
|
goodsName?: string
|
||||||
|
// 规格
|
||||||
|
specParams?: string
|
||||||
|
// 图片
|
||||||
|
picture?: string
|
||||||
|
// 计量单位;字典代码:unit
|
||||||
|
unit?: string
|
||||||
|
// 是否为成品;0-->否、1-->是
|
||||||
|
fg?: boolean
|
||||||
|
// 是否为半成品;0-->否、1-->是
|
||||||
|
sfg?: boolean
|
||||||
|
// 是否为原料;0-->否、1-->是
|
||||||
|
rg?: boolean
|
||||||
|
// 排序
|
||||||
|
sort?: number
|
||||||
|
// 是否可用;0-->否、1-->是
|
||||||
|
canuse?: boolean
|
||||||
|
// 备注
|
||||||
|
memo?: string
|
||||||
|
// 创建人 Id;sys_user.id
|
||||||
|
creatorId?: string
|
||||||
|
// 修改人 Id;sys_user.id
|
||||||
|
modifierId?: string
|
||||||
|
// 创建时间
|
||||||
|
createTime?: string
|
||||||
|
// 修改时间
|
||||||
|
modifyTime?: string
|
||||||
|
// 是否删除; 0-->未删除、1-->已删除
|
||||||
|
deleted?: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
interface SearchGoodsResult {
|
||||||
|
// Id
|
||||||
|
id?: string
|
||||||
|
// 产品类型 Id
|
||||||
|
goodsCategoryId?: string
|
||||||
|
// 商品编码
|
||||||
|
sn?: string
|
||||||
|
// 产品名称
|
||||||
|
goodsName?: string
|
||||||
|
// 规格
|
||||||
|
specParams?: string
|
||||||
|
// 图片
|
||||||
|
picture?: string
|
||||||
|
// 计量单位;字典代码:unit
|
||||||
|
unit?: string
|
||||||
|
// 是否为成品;0-->否、1-->是
|
||||||
|
fg?: boolean
|
||||||
|
// 是否为半成品;0-->否、1-->是
|
||||||
|
sfg?: boolean
|
||||||
|
// 是否为原料;0-->否、1-->是
|
||||||
|
rg?: boolean
|
||||||
|
// 排序
|
||||||
|
sort?: number
|
||||||
|
// 是否可用;0-->否、1-->是
|
||||||
|
canuse?: boolean
|
||||||
|
// 备注
|
||||||
|
memo?: string
|
||||||
|
// 创建人 Id;sys_user.id
|
||||||
|
creatorId?: string
|
||||||
|
// 修改人 Id;sys_user.id
|
||||||
|
modifierId?: string
|
||||||
|
// 创建时间
|
||||||
|
createTime?: string
|
||||||
|
// 修改时间
|
||||||
|
modifyTime?: string
|
||||||
|
// 是否删除; 0-->未删除、1-->已删除
|
||||||
|
deleted?: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
interface AddGoodsParam {
|
||||||
|
// Id
|
||||||
|
id?: string
|
||||||
|
// 产品类型 Id
|
||||||
|
goodsCategoryId?: string
|
||||||
|
// 商品编码
|
||||||
|
sn?: string
|
||||||
|
// 产品名称
|
||||||
|
goodsName?: string
|
||||||
|
// 规格
|
||||||
|
specParams?: string
|
||||||
|
// 图片
|
||||||
|
picture?: string
|
||||||
|
// 计量单位;字典代码:unit
|
||||||
|
unit?: string
|
||||||
|
// 是否为成品;0-->否、1-->是
|
||||||
|
fg?: boolean
|
||||||
|
// 是否为半成品;0-->否、1-->是
|
||||||
|
sfg?: boolean
|
||||||
|
// 是否为原料;0-->否、1-->是
|
||||||
|
rg?: boolean
|
||||||
|
// 排序
|
||||||
|
sort?: number
|
||||||
|
// 是否可用;0-->否、1-->是
|
||||||
|
canuse?: boolean
|
||||||
|
// 备注
|
||||||
|
memo?: string
|
||||||
|
// 创建人 Id;sys_user.id
|
||||||
|
creatorId?: string
|
||||||
|
// 修改人 Id;sys_user.id
|
||||||
|
modifierId?: string
|
||||||
|
// 创建时间
|
||||||
|
createTime?: string
|
||||||
|
// 修改时间
|
||||||
|
modifyTime?: string
|
||||||
|
// 是否删除; 0-->未删除、1-->已删除
|
||||||
|
deleted?: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ModifyGoodsParam {
|
||||||
|
// Id
|
||||||
|
id?: string
|
||||||
|
// 产品类型 Id
|
||||||
|
goodsCategoryId?: string
|
||||||
|
// 商品编码
|
||||||
|
sn?: string
|
||||||
|
// 产品名称
|
||||||
|
goodsName?: string
|
||||||
|
// 规格
|
||||||
|
specParams?: string
|
||||||
|
// 图片
|
||||||
|
picture?: string
|
||||||
|
// 计量单位;字典代码:unit
|
||||||
|
unit?: string
|
||||||
|
// 是否为成品;0-->否、1-->是
|
||||||
|
fg?: boolean
|
||||||
|
// 是否为半成品;0-->否、1-->是
|
||||||
|
sfg?: boolean
|
||||||
|
// 是否为原料;0-->否、1-->是
|
||||||
|
rg?: boolean
|
||||||
|
// 排序
|
||||||
|
sort?: number
|
||||||
|
// 是否可用;0-->否、1-->是
|
||||||
|
canuse?: boolean
|
||||||
|
// 备注
|
||||||
|
memo?: string
|
||||||
|
// 创建人 Id;sys_user.id
|
||||||
|
creatorId?: string
|
||||||
|
// 修改人 Id;sys_user.id
|
||||||
|
modifierId?: string
|
||||||
|
// 创建时间
|
||||||
|
createTime?: string
|
||||||
|
// 修改时间
|
||||||
|
modifyTime?: string
|
||||||
|
// 是否删除; 0-->未删除、1-->已删除
|
||||||
|
deleted?: boolean
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
export default {
|
||||||
|
component: () => import('@/pages/gds/goods/Goods.vue'),
|
||||||
|
} as RouterTypes.RouteConfig
|
||||||
Loading…
Reference in New Issue