|
@@ -46,7 +46,7 @@
|
|
|
</template>
|
|
|
<script setup lang="ts">
|
|
|
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
|
|
|
-import { ProductCategoryApi } from '@/api/erp/product/category'
|
|
|
+import { ProductCategoryApi, ProductCategoryVO } from '@/api/erp/product/category'
|
|
|
import { defaultProps, handleTree } from '@/utils/tree'
|
|
|
import { CommonStatusEnum } from '@/utils/constants'
|
|
|
|
|
@@ -66,7 +66,7 @@ const formData = ref({
|
|
|
name: undefined,
|
|
|
code: undefined,
|
|
|
sort: undefined,
|
|
|
- status: undefined
|
|
|
+ status: CommonStatusEnum.ENABLE
|
|
|
})
|
|
|
const formRules = reactive({
|
|
|
parentId: [{ required: true, message: '上级编号不能为空', trigger: 'blur' }],
|
|
@@ -105,7 +105,7 @@ const submitForm = async () => {
|
|
|
// 提交请求
|
|
|
formLoading.value = true
|
|
|
try {
|
|
|
- const data = formData.value as unknown as ProductCategoryApi.ProductCategoryVO
|
|
|
+ const data = formData.value as unknown as ProductCategoryVO
|
|
|
if (formType.value === 'create') {
|
|
|
await ProductCategoryApi.createProductCategory(data)
|
|
|
message.success(t('common.createSuccess'))
|
|
@@ -138,7 +138,7 @@ const resetForm = () => {
|
|
|
const getProductCategoryTree = async () => {
|
|
|
productCategoryTree.value = []
|
|
|
const data = await ProductCategoryApi.getProductCategoryList()
|
|
|
- const root: Tree = { id: undefined, name: '顶级产品分类', children: [] }
|
|
|
+ const root: Tree = { id: 0, name: '顶级产品分类', children: [] }
|
|
|
root.children = handleTree(data, 'id', 'parentId')
|
|
|
productCategoryTree.value.push(root)
|
|
|
}
|