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 */
export function fetchAddCategory(data: Api.Category.Model) {
return request<boolean>({
return request({
url: '/category',
method: 'post',
data:{

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

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

View File

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

View File

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

View File

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