202503121456

This commit is contained in:
Cain 2025-03-12 14:56:46 +08:00
parent 075fd374b3
commit aea6dc5e6e
5 changed files with 12 additions and 14 deletions

View File

@ -21,7 +21,7 @@ export function fetchGetCategoryList(data?: Api.Category.CategorySearchParams) {
// /** add category */ // /** add category */
export function fetchAddCategory(data: Api.Category.Model) { export function fetchAddCategory(data: Api.Category.Model) {
return request<boolean>({ return request({
url: '/category', url: '/category',
method: 'post', method: 'post',
data:{ data:{

12
src/typings/api.d.ts vendored
View File

@ -1366,18 +1366,14 @@ declare namespace Api {
* backend api module: "Category" * backend api module: "Category"
*/ */
namespace Category { namespace Category {
type CategoryType = '网站' | '文献'; type CategoryType = '1' | '2';
type CategorySearchParams = { type CategorySearchParams = {
categoryName?: string | null, categoryName?: string | null,
categoryType?: string | null categoryType?: string | null
} }
type RowData = Category & { type Category = {
children?: RowData[];
};
interface Category {
id: number; id: number;
parentId: number; parentId: number;
categoryName: string; categoryName: string;
@ -1386,6 +1382,10 @@ declare namespace Api {
categoryType: CategoryType; categoryType: CategoryType;
} }
type RowData = Category & {
children?: RowData[];
};
interface Model { interface Model {
id: number; id: number;
name: string; name: string;

View File

@ -101,10 +101,7 @@ const Delete = async (id: number) => {
<template> <template>
<div class="min-h-500px flex-col-stretch gap-16px overflow-hidden lt-sm:overflow-auto"> <div class="min-h-500px flex-col-stretch gap-16px overflow-hidden lt-sm:overflow-auto">
<!-- 查询组件 --> <!-- 查询组件 -->
<CategorySearch <CategorySearch @update="onUpdate" v-model:model="params"/>
@update="onUpdate"
v-model:model="params"
/>
<DeleteAlert /> <DeleteAlert />
<NCard <NCard
:title="$t('page.category.title')" :title="$t('page.category.title')"

View File

@ -78,13 +78,14 @@ const rules: Record<RuleKey, App.Global.FormRule> = {
function handleUpdateModelWhenEdit() { function handleUpdateModelWhenEdit() {
if (props.operateType === 'add') { if (props.operateType === 'add') {
const { id, parentId } = props.rowData!; const { id, parentId } = props.rowData!;
updateModel(id, '', '网站', parentId); updateModel(id, '', '1', parentId);
console.log(model);
return; return;
} }
if (props.operateType === 'edit' && props.rowData) { if (props.operateType === 'edit' && props.rowData) {
const { id, categoryName, categoryType, parentId } = props.rowData; const { id, categoryName, categoryType, parentId } = props.rowData;
updateModel(id, categoryName, categoryType, parentId); updateModel(id, categoryName, categoryType.toString(), parentId);
console.log(model); console.log(model);
} }
} }

View File

@ -56,7 +56,7 @@ export function useFormOperate<T extends Record<string, any>>(config: {
categoryName: "", categoryName: "",
level: "", level: "",
createTime: "", createTime: "",
categoryType: "网站" categoryType: "1"
}; };
openDrawer(); openDrawer();
} }