From 19f81f34538f31f7c09e49ef3bbefcc46201ae28 Mon Sep 17 00:00:00 2001 From: wusijian0117 <2910410219@qq.com> Date: Mon, 16 Mar 2026 16:52:57 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=BC=80=E5=8F=91=E7=8E=AF?= =?UTF-8?q?=E5=A2=83API=E6=9C=8D=E5=8A=A1=E5=9C=B0=E5=9D=80=E8=87=B3192.16?= =?UTF-8?q?8.100.84,=E4=BF=AE=E6=94=B9=E5=88=86=E7=B1=BB=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=8F=82=E6=95=B0=E7=B1=BB=E5=9E=8B=E4=BB=8E?= =?UTF-8?q?string=E6=94=B9=E4=B8=BAnumber,=E4=BC=98=E5=8C=96=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E5=88=86=E7=B1=BB=E6=8F=90=E4=BA=A4=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E7=A7=BB=E9=99=A4id=E5=AD=97=E6=AE=B5=E4=BC=A0=E9=80=92,?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=88=86=E7=B1=BB=E8=AF=A6=E6=83=85parentId?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E6=98=A0=E5=B0=84=E4=B8=BAbid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 6 +++--- src/api/assets/category/index.ts | 6 +++--- .../assets/category/component/editCategory.vue | 14 ++++++++------ src/views/assets/category/index.vue | 3 ++- 4 files changed, 16 insertions(+), 13 deletions(-) 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;