【修复】全局:id=0导致sqlserver的insert失败
							parent
							
								
									3976e49e35
								
							
						
					
					
						commit
						760bab7d29
					
				|  | @ -13,8 +13,8 @@ export interface ProductCategoryVO { | |||
| // ERP 产品分类 API
 | ||||
| export const ProductCategoryApi = { | ||||
|   // 查询产品分类列表
 | ||||
|   getProductCategoryList: async (params) => { | ||||
|     return await request.get({ url: `/erp/product-category/list`, params }) | ||||
|   getProductCategoryList: async () => { | ||||
|     return await request.get({ url: `/erp/product-category/list` }) | ||||
|   }, | ||||
| 
 | ||||
|   // 查询产品分类精简列表
 | ||||
|  |  | |||
|  | @ -7,8 +7,8 @@ export interface Demo02CategoryVO { | |||
| } | ||||
| 
 | ||||
| // 查询示例分类列表
 | ||||
| export const getDemo02CategoryList = async (params) => { | ||||
|   return await request.get({ url: `/infra/demo02-category/list`, params }) | ||||
| export const getDemo02CategoryList = async () => { | ||||
|   return await request.get({ url: `/infra/demo02-category/list` }) | ||||
| } | ||||
| 
 | ||||
| // 查询示例分类详情
 | ||||
|  |  | |||
|  | @ -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) | ||||
| } | ||||
|  |  | |||
|  | @ -107,7 +107,7 @@ const resetForm = () => { | |||
| const getDemo02CategoryTree = async () => { | ||||
|   demo02CategoryTree.value = [] | ||||
|   const data = await Demo02CategoryApi.getDemo02CategoryList() | ||||
|   const root: Tree = { id: undefined, name: '顶级示例分类', children: [] } | ||||
|   const root: Tree = { id: 0, name: '顶级示例分类', children: [] } | ||||
|   root.children = handleTree(data, 'id', 'parentId') | ||||
|   demo02CategoryTree.value.push(root) | ||||
| } | ||||
|  |  | |||
|  | @ -167,7 +167,7 @@ const resetForm = () => { | |||
| const getTree = async () => { | ||||
|   deptTree.value = [] | ||||
|   const data = await DeptApi.getSimpleDeptList() | ||||
|   let dept: Tree = { id: undefined, name: '顶级部门', children: [] } | ||||
|   let dept: Tree = { id: 0, name: '顶级部门', children: [] } | ||||
|   dept.children = handleTree(data) | ||||
|   deptTree.value.push(dept) | ||||
| } | ||||
|  |  | |||
|  | @ -223,7 +223,7 @@ const menuTree = ref<Tree[]>([]) // 树形结构 | |||
| const getTree = async () => { | ||||
|   menuTree.value = [] | ||||
|   const res = await MenuApi.getSimpleMenusList() | ||||
|   let menu: Tree = { id: undefined, name: '主类目', children: [] } | ||||
|   let menu: Tree = { id: 0, name: '主类目', children: [] } | ||||
|   menu.children = handleTree(res) | ||||
|   menuTree.value.push(menu) | ||||
| } | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 YunaiV
						YunaiV