diff --git a/.env.development b/.env.development index da4c113..9792d92 100644 --- a/.env.development +++ b/.env.development @@ -5,14 +5,14 @@ ENV = 'development' # 后端服务地址配置 # 切换环境时,修改下面两个地址的 IP 即可 # 当前环境: 192.168.3.11(本地开发地址) -# 当前环境: 192.168.3.94(本地开发地址)王楠 # 备用环境: 192.168.3.200(服务器地址) # 备用环境: 116.204.74.41(公网开发地址) +# 备用环境: 172.20.10.7(张哥) # ============================================================ # 主服务地址(端口8808) # 用途: 系统管理、用户认证、权限控制、模块开通等原有功能 -VITE_API_URL = 'http://192.168.3.11:8808/' +VITE_API_URL = 'http://192.168.100.84:8808/' # 新功能服务地址(端口8000) # 用途: 资产管理、分类、SKU、订单等新业务模块 -VITE_NEW_API_URL = 'http://192.168.3.11:8000/' \ No newline at end of file +VITE_NEW_API_URL = 'http://192.168.100.84:8000/' \ No newline at end of file diff --git a/src/api/assets/category/index.ts b/src/api/assets/category/index.ts index ab5943a..40c70ca 100644 --- a/src/api/assets/category/index.ts +++ b/src/api/assets/category/index.ts @@ -12,7 +12,7 @@ export function getCategoryTree(query?: Object) { } // 获取分类详情 -export function getCategory(id: string) { +export function getCategory(id: number) { return newService({ url: '/assets/category/getCategory', method: 'get', @@ -56,7 +56,7 @@ export function updateCategory(data: object) { } // 删除分类 -export function deleteCategory(id: string) { +export function deleteCategory(id: number) { return newService({ url: '/assets/category/deleteCategory', method: 'delete', @@ -65,7 +65,7 @@ export function deleteCategory(id: string) { } // 更新分类状态 -export function updateCategoryStatus(id: string, status: number) { +export function updateCategoryStatus(id: number, status: number) { return newService({ url: '/assets/category/updateCategoryStatus', method: 'put', diff --git a/src/views/assets/category/component/editCategory.vue b/src/views/assets/category/component/editCategory.vue index b29e901..c8cfe1a 100644 --- a/src/views/assets/category/component/editCategory.vue +++ b/src/views/assets/category/component/editCategory.vue @@ -129,7 +129,8 @@ import { getDicts } from '/@/api/system/dict/data'; import { createFormDiff } from '/@/utils/diffUtils'; interface CategoryRow { - id: string; + id: number; + bid: string; name: string; level: number; options?: string[]; @@ -163,7 +164,7 @@ interface DictValue { } interface RuleForm { - id: string; + id: number | ''; parentId: string; name: string; sort: number; @@ -186,7 +187,7 @@ const dictLoading = ref(false); const categoryFormDiff = createFormDiff>(); const ruleForm = reactive({ - id: '', + id: '', parentId: '', name: '', sort: 0, @@ -332,7 +333,7 @@ const openDialog = (row?: CategoryRow | string, edit?: boolean) => { getCategory(row.id).then((res: any) => { const data = res.data; ruleForm.id = data.id || ''; - ruleForm.parentId = data.parentId || ''; + ruleForm.parentId = data.bid || ''; ruleForm.name = data.name || ''; ruleForm.sort = data.sort || 0; // 处理 attrs 中的 options 字段 @@ -469,8 +470,9 @@ const onSubmit = () => { submitLoading.value = false; }); } else { - // 新增模式:传递所有字段 - addCategory(submitData) + // 新增模式:不传id + const { id, ...rest } = submitData; + addCategory(rest) .then(() => { ElMessage.success('添加成功'); closeDialog(); diff --git a/src/views/assets/category/index.vue b/src/views/assets/category/index.vue index 5f1a797..e802c6d 100644 --- a/src/views/assets/category/index.vue +++ b/src/views/assets/category/index.vue @@ -73,7 +73,8 @@ import OperationLogDialog from '../component/operationLogDialog.vue'; import { getCategoryTree, deleteCategory, updateCategoryStatus,listCategories } from '/@/api/assets/category'; interface CategoryRow { - id: string; + id: number; + bid: string; name: string; level: number; type: string;