显示分类
This commit is contained in:
parent
811a6a3ad2
commit
864aa95d24
@ -19,6 +19,7 @@ const local: App.I18n.Schema = {
|
|||||||
check: 'Check',
|
check: 'Check',
|
||||||
expandColumn: 'Expand Column',
|
expandColumn: 'Expand Column',
|
||||||
columnSetting: 'Column Setting',
|
columnSetting: 'Column Setting',
|
||||||
|
loadFail: 'Load Fail',
|
||||||
config: 'Config',
|
config: 'Config',
|
||||||
confirm: 'Confirm',
|
confirm: 'Confirm',
|
||||||
save: 'Save',
|
save: 'Save',
|
||||||
|
@ -14,6 +14,7 @@ const local: App.I18n.Schema = {
|
|||||||
addSuccess: '添加成功',
|
addSuccess: '添加成功',
|
||||||
backToHome: '返回首页',
|
backToHome: '返回首页',
|
||||||
batchDelete: '批量删除',
|
batchDelete: '批量删除',
|
||||||
|
loadFail: '加载失败',
|
||||||
cancel: '取消',
|
cancel: '取消',
|
||||||
close: '关闭',
|
close: '关闭',
|
||||||
check: '勾选',
|
check: '勾选',
|
||||||
|
@ -26,15 +26,6 @@ export function fetchAddCategory(data: Api.Category.Model) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// /** edit category */
|
// /** edit category */
|
||||||
// export function fetchEditCategory(data: Api.Namespace.Namespace) {
|
|
||||||
// return request<boolean>({
|
|
||||||
// url: '/namespace',
|
|
||||||
// method: 'put',
|
|
||||||
// data
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
|
|
||||||
// /** add category */
|
|
||||||
export function fetchEditCategory(data: Api.Category.Model) {
|
export function fetchEditCategory(data: Api.Category.Model) {
|
||||||
return request({
|
return request({
|
||||||
url: '/category',
|
url: '/category',
|
||||||
|
7
src/typings/api.d.ts
vendored
7
src/typings/api.d.ts
vendored
@ -1372,7 +1372,6 @@ declare namespace Api {
|
|||||||
*/
|
*/
|
||||||
namespace Category {
|
namespace Category {
|
||||||
|
|
||||||
|
|
||||||
type CategoryType = '网站' | '文献';
|
type CategoryType = '网站' | '文献';
|
||||||
|
|
||||||
type RowData = Category & {
|
type RowData = Category & {
|
||||||
@ -1394,11 +1393,5 @@ declare namespace Api {
|
|||||||
type: string;
|
type: string;
|
||||||
parent: string;
|
parent: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Result {
|
|
||||||
status: 1,
|
|
||||||
message: string,
|
|
||||||
data: RowData[]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
1
src/typings/app.d.ts
vendored
1
src/typings/app.d.ts
vendored
@ -300,6 +300,7 @@ declare namespace App {
|
|||||||
check: string;
|
check: string;
|
||||||
expandColumn: string;
|
expandColumn: string;
|
||||||
columnSetting: string;
|
columnSetting: string;
|
||||||
|
loadFail: string;
|
||||||
config: string;
|
config: string;
|
||||||
confirm: string;
|
confirm: string;
|
||||||
save: string;
|
save: string;
|
||||||
|
@ -104,7 +104,7 @@ const {
|
|||||||
|
|
||||||
// 表头添加操作
|
// 表头添加操作
|
||||||
const headAdd = () => {
|
const headAdd = () => {
|
||||||
handleAdd(-1);
|
handleAdd(0);
|
||||||
}
|
}
|
||||||
const refresh = () => {
|
const refresh = () => {
|
||||||
console.log("你点击了刷新按钮")
|
console.log("你点击了刷新按钮")
|
||||||
|
@ -58,6 +58,7 @@ function updateModel(categoryName: string, categoryType: string, parentId: numbe
|
|||||||
}
|
}
|
||||||
function createDefaultModel(): Api.Category.Model {
|
function createDefaultModel(): Api.Category.Model {
|
||||||
return {
|
return {
|
||||||
|
id: 0,
|
||||||
name: '',
|
name: '',
|
||||||
type: '',
|
type: '',
|
||||||
parent: ''
|
parent: ''
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, reactive, ref, watch } from 'vue';
|
import { computed, reactive, ref, watch, onMounted } from 'vue';
|
||||||
import { useClipboard } from '@vueuse/core';
|
import { useClipboard } from '@vueuse/core';
|
||||||
import { useFormRules, useNaiveForm } from '@/hooks/common/form';
|
import { useFormRules, useNaiveForm } from '@/hooks/common/form';
|
||||||
import { $t } from '@/locales';
|
import { $t } from '@/locales';
|
||||||
@ -11,6 +11,7 @@ import {
|
|||||||
groupConfigYesOrNoOptions
|
groupConfigYesOrNoOptions
|
||||||
} from '@/constants/business';
|
} from '@/constants/business';
|
||||||
import { fetchAddGroupConfig, fetchEditGroupConfig, fetchGetPartitionTableList } from '@/service/api/group';
|
import { fetchAddGroupConfig, fetchEditGroupConfig, fetchGetPartitionTableList } from '@/service/api/group';
|
||||||
|
import { fetchGetCategoryList } from '@/service/api';
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: 'GroupOperateDrawer'
|
name: 'GroupOperateDrawer'
|
||||||
@ -194,52 +195,27 @@ async function handleCopy(source: string) {
|
|||||||
|
|
||||||
import { ElCascader } from 'element-plus';
|
import { ElCascader } from 'element-plus';
|
||||||
import type { CascaderOption } from 'element-plus';
|
import type { CascaderOption } from 'element-plus';
|
||||||
const options: CascaderOption[] = [
|
|
||||||
{
|
let options: CascaderOption[] = [];
|
||||||
value: '1',
|
// 转换函数
|
||||||
label: 'Group 1',
|
function transformData(data: any[]): CascaderOption[] {
|
||||||
children: [
|
return data.map(item => {
|
||||||
{
|
const transformedItem: CascaderOption = {
|
||||||
value: '1-1',
|
label: item.categoryName,
|
||||||
label: 'Subgroup 1-1',
|
value: item.categoryName,
|
||||||
children: [
|
children: item.children ? transformData(item.children) : undefined
|
||||||
{ value: '1-1-1', label: 'Item 1-1-1' },
|
};
|
||||||
{ value: '1-1-2', label: 'Item 1-1-2' }
|
return transformedItem;
|
||||||
]
|
});
|
||||||
},
|
}
|
||||||
{
|
onMounted(async () => {
|
||||||
value: '1-2',
|
try {
|
||||||
label: 'Subgroup 1-2',
|
const { data } = await fetchGetCategoryList();
|
||||||
children: [
|
options = transformData(data);
|
||||||
{ value: '1-2-1', label: 'Item 1-2-1' },
|
} catch (error) {
|
||||||
{ value: '1-2-2', label: 'Item 1-2-2' }
|
window.$message?.error($t('common.loadFail'));
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: '2',
|
|
||||||
label: 'Group 2',
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
value: '2-1',
|
|
||||||
label: 'Subgroup 2-1',
|
|
||||||
children: [
|
|
||||||
{ value: '2-1-1', label: 'Item 2-1-1' },
|
|
||||||
{ value: '2-1-2', label: 'Item 2-1-2' }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: '2-2',
|
|
||||||
label: 'Subgroup 2-2',
|
|
||||||
children: [
|
|
||||||
{ value: '2-2-1', label: 'Item 2-2-1' },
|
|
||||||
{ value: '2-2-2', label: 'Item 2-2-2' }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
];
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
Loading…
Reference in New Issue
Block a user