【修复】全局:id=0导致sqlserver的insert失败

This commit is contained in:
YunaiV 2024-05-07 22:18:43 +08:00
parent 3976e49e35
commit 760bab7d29
6 changed files with 11 additions and 11 deletions

View File

@ -13,8 +13,8 @@ export interface ProductCategoryVO {
// ERP 产品分类 API // ERP 产品分类 API
export const ProductCategoryApi = { export const ProductCategoryApi = {
// 查询产品分类列表 // 查询产品分类列表
getProductCategoryList: async (params) => { getProductCategoryList: async () => {
return await request.get({ url: `/erp/product-category/list`, params }) return await request.get({ url: `/erp/product-category/list` })
}, },
// 查询产品分类精简列表 // 查询产品分类精简列表

View File

@ -7,8 +7,8 @@ export interface Demo02CategoryVO {
} }
// 查询示例分类列表 // 查询示例分类列表
export const getDemo02CategoryList = async (params) => { export const getDemo02CategoryList = async () => {
return await request.get({ url: `/infra/demo02-category/list`, params }) return await request.get({ url: `/infra/demo02-category/list` })
} }
// 查询示例分类详情 // 查询示例分类详情

View File

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

View File

@ -107,7 +107,7 @@ const resetForm = () => {
const getDemo02CategoryTree = async () => { const getDemo02CategoryTree = async () => {
demo02CategoryTree.value = [] demo02CategoryTree.value = []
const data = await Demo02CategoryApi.getDemo02CategoryList() 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') root.children = handleTree(data, 'id', 'parentId')
demo02CategoryTree.value.push(root) demo02CategoryTree.value.push(root)
} }

View File

@ -167,7 +167,7 @@ const resetForm = () => {
const getTree = async () => { const getTree = async () => {
deptTree.value = [] deptTree.value = []
const data = await DeptApi.getSimpleDeptList() const data = await DeptApi.getSimpleDeptList()
let dept: Tree = { id: undefined, name: '顶级部门', children: [] } let dept: Tree = { id: 0, name: '顶级部门', children: [] }
dept.children = handleTree(data) dept.children = handleTree(data)
deptTree.value.push(dept) deptTree.value.push(dept)
} }

View File

@ -223,7 +223,7 @@ const menuTree = ref<Tree[]>([]) // 树形结构
const getTree = async () => { const getTree = async () => {
menuTree.value = [] menuTree.value = []
const res = await MenuApi.getSimpleMenusList() const res = await MenuApi.getSimpleMenusList()
let menu: Tree = { id: undefined, name: '主类目', children: [] } let menu: Tree = { id: 0, name: '主类目', children: [] }
menu.children = handleTree(res) menu.children = handleTree(res)
menuTree.value.push(menu) menuTree.value.push(menu)
} }