调整开发环境API服务地址至192.168.100.84,修改分类管理接口参数类型从string改为number,优化新增分类提交逻辑移除id字段传递,调整分类详情parentId字段映射为bid
This commit is contained in:
@@ -5,14 +5,14 @@ ENV = 'development'
|
|||||||
# 后端服务地址配置
|
# 后端服务地址配置
|
||||||
# 切换环境时,修改下面两个地址的 IP 即可
|
# 切换环境时,修改下面两个地址的 IP 即可
|
||||||
# 当前环境: 192.168.3.11(本地开发地址)
|
# 当前环境: 192.168.3.11(本地开发地址)
|
||||||
# 当前环境: 192.168.3.94(本地开发地址)王楠
|
|
||||||
# 备用环境: 192.168.3.200(服务器地址)
|
# 备用环境: 192.168.3.200(服务器地址)
|
||||||
# 备用环境: 116.204.74.41(公网开发地址)
|
# 备用环境: 116.204.74.41(公网开发地址)
|
||||||
|
# 备用环境: 172.20.10.7(张哥)
|
||||||
# ============================================================
|
# ============================================================
|
||||||
|
|
||||||
# 主服务地址(端口8808)
|
# 主服务地址(端口8808)
|
||||||
# 用途: 系统管理、用户认证、权限控制、模块开通等原有功能
|
# 用途: 系统管理、用户认证、权限控制、模块开通等原有功能
|
||||||
VITE_API_URL = 'http://192.168.3.11:8808/'
|
VITE_API_URL = 'http://192.168.100.84:8808/'
|
||||||
# 新功能服务地址(端口8000)
|
# 新功能服务地址(端口8000)
|
||||||
# 用途: 资产管理、分类、SKU、订单等新业务模块
|
# 用途: 资产管理、分类、SKU、订单等新业务模块
|
||||||
VITE_NEW_API_URL = 'http://192.168.3.11:8000/'
|
VITE_NEW_API_URL = 'http://192.168.100.84:8000/'
|
||||||
@@ -12,7 +12,7 @@ export function getCategoryTree(query?: Object) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 获取分类详情
|
// 获取分类详情
|
||||||
export function getCategory(id: string) {
|
export function getCategory(id: number) {
|
||||||
return newService({
|
return newService({
|
||||||
url: '/assets/category/getCategory',
|
url: '/assets/category/getCategory',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
@@ -56,7 +56,7 @@ export function updateCategory(data: object) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 删除分类
|
// 删除分类
|
||||||
export function deleteCategory(id: string) {
|
export function deleteCategory(id: number) {
|
||||||
return newService({
|
return newService({
|
||||||
url: '/assets/category/deleteCategory',
|
url: '/assets/category/deleteCategory',
|
||||||
method: 'delete',
|
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({
|
return newService({
|
||||||
url: '/assets/category/updateCategoryStatus',
|
url: '/assets/category/updateCategoryStatus',
|
||||||
method: 'put',
|
method: 'put',
|
||||||
|
|||||||
@@ -129,7 +129,8 @@ import { getDicts } from '/@/api/system/dict/data';
|
|||||||
import { createFormDiff } from '/@/utils/diffUtils';
|
import { createFormDiff } from '/@/utils/diffUtils';
|
||||||
|
|
||||||
interface CategoryRow {
|
interface CategoryRow {
|
||||||
id: string;
|
id: number;
|
||||||
|
bid: string;
|
||||||
name: string;
|
name: string;
|
||||||
level: number;
|
level: number;
|
||||||
options?: string[];
|
options?: string[];
|
||||||
@@ -163,7 +164,7 @@ interface DictValue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface RuleForm {
|
interface RuleForm {
|
||||||
id: string;
|
id: number | '';
|
||||||
parentId: string;
|
parentId: string;
|
||||||
name: string;
|
name: string;
|
||||||
sort: number;
|
sort: number;
|
||||||
@@ -186,7 +187,7 @@ const dictLoading = ref(false);
|
|||||||
const categoryFormDiff = createFormDiff<Record<string, any>>();
|
const categoryFormDiff = createFormDiff<Record<string, any>>();
|
||||||
|
|
||||||
const ruleForm = reactive<RuleForm>({
|
const ruleForm = reactive<RuleForm>({
|
||||||
id: '',
|
id: '',
|
||||||
parentId: '',
|
parentId: '',
|
||||||
name: '',
|
name: '',
|
||||||
sort: 0,
|
sort: 0,
|
||||||
@@ -332,7 +333,7 @@ const openDialog = (row?: CategoryRow | string, edit?: boolean) => {
|
|||||||
getCategory(row.id).then((res: any) => {
|
getCategory(row.id).then((res: any) => {
|
||||||
const data = res.data;
|
const data = res.data;
|
||||||
ruleForm.id = data.id || '';
|
ruleForm.id = data.id || '';
|
||||||
ruleForm.parentId = data.parentId || '';
|
ruleForm.parentId = data.bid || '';
|
||||||
ruleForm.name = data.name || '';
|
ruleForm.name = data.name || '';
|
||||||
ruleForm.sort = data.sort || 0;
|
ruleForm.sort = data.sort || 0;
|
||||||
// 处理 attrs 中的 options 字段
|
// 处理 attrs 中的 options 字段
|
||||||
@@ -469,8 +470,9 @@ const onSubmit = () => {
|
|||||||
submitLoading.value = false;
|
submitLoading.value = false;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// 新增模式:传递所有字段
|
// 新增模式:不传id
|
||||||
addCategory(submitData)
|
const { id, ...rest } = submitData;
|
||||||
|
addCategory(rest)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
ElMessage.success('添加成功');
|
ElMessage.success('添加成功');
|
||||||
closeDialog();
|
closeDialog();
|
||||||
|
|||||||
@@ -73,7 +73,8 @@ import OperationLogDialog from '../component/operationLogDialog.vue';
|
|||||||
import { getCategoryTree, deleteCategory, updateCategoryStatus,listCategories } from '/@/api/assets/category';
|
import { getCategoryTree, deleteCategory, updateCategoryStatus,listCategories } from '/@/api/assets/category';
|
||||||
|
|
||||||
interface CategoryRow {
|
interface CategoryRow {
|
||||||
id: string;
|
id: number;
|
||||||
|
bid: string;
|
||||||
name: string;
|
name: string;
|
||||||
level: number;
|
level: number;
|
||||||
type: string;
|
type: string;
|
||||||
|
|||||||
Reference in New Issue
Block a user