调整开发环境API服务地址至192.168.100.84,修改分类管理接口参数类型从string改为number,优化新增分类提交逻辑移除id字段传递,调整分类详情parentId字段映射为bid
This commit is contained in:
@@ -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<Record<string, any>>();
|
||||
|
||||
const ruleForm = reactive<RuleForm>({
|
||||
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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user