From 982c97ab82f3beb1b4febcf014562eda34b9fc05 Mon Sep 17 00:00:00 2001
From: liu <2021943741@qq.com>
Date: 星期二, 29 九月 2026 17:59:41 +0800
Subject: [PATCH] feat(ui): 江苏商贸品牌视觉与首页/登录页改版

---
 src/views/archive/category/data.ts |  192 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 192 insertions(+), 0 deletions(-)

diff --git a/src/views/archive/category/data.ts b/src/views/archive/category/data.ts
new file mode 100644
index 0000000..da37a6f
--- /dev/null
+++ b/src/views/archive/category/data.ts
@@ -0,0 +1,192 @@
+import type { VbenFormSchema } from '#/adapter/form';
+import type { VxeTableGridOptions } from '#/adapter/vxe-table';
+import type { ArchiveCategoryApi } from '#/api/archive/category';
+
+import { DICT_TYPE } from '@vben/constants';
+import { getDictOptions } from '@vben/hooks';
+import { handleTree } from '@vben/utils';
+
+import { getCategoryList } from '#/api/archive/category';
+
+/** 鏂板/淇敼鐨勮〃鍗� */
+export function useFormSchema(): VbenFormSchema[] {
+  return [
+    {
+      component: 'Input',
+      fieldName: 'id',
+      dependencies: {
+        triggerFields: [''],
+        show: () => false,
+      },
+    },
+    {
+      fieldName: 'parentId',
+      label: '涓婄骇鍒嗙被',
+      component: 'ApiTreeSelect',
+      componentProps: {
+        allowClear: true,
+        api: async () => {
+          const data = await getCategoryList();
+          data.unshift({
+            id: 0,
+            name: '椤剁骇鍒嗙被',
+          } as ArchiveCategoryApi.Category);
+          return handleTree(data);
+        },
+        fieldNames: { label: 'name', value: 'id', children: 'children' },
+        placeholder: '璇烽�夋嫨涓婄骇鍒嗙被',
+        showSearch: true,
+        treeDefaultExpandAll: true,
+      },
+      rules: 'selectRequired',
+    },
+    {
+      fieldName: 'name',
+      label: '鍒嗙被鍚嶇О',
+      component: 'Input',
+      componentProps: {
+        placeholder: '璇疯緭鍏ュ垎绫诲悕绉�',
+      },
+      rules: 'required',
+    },
+    {
+      fieldName: 'code',
+      label: '鍒嗙被缂栫爜',
+      component: 'Input',
+      componentProps: {
+        placeholder: '鑻辨枃缂栫爜锛屽 member/research/finance',
+      },
+      rules: 'required',
+    },
+    {
+      fieldName: 'defaultSecretLevel',
+      label: '榛樿瀵嗙骇',
+      component: 'Select',
+      componentProps: {
+        options: getDictOptions(DICT_TYPE.ARCHIVE_SECRET_LEVEL, 'number'),
+        placeholder: '璇ュ垎绫讳笅妗f鐨勯粯璁ゅ瘑绾�',
+      },
+      rules: 'selectRequired',
+    },
+    {
+      fieldName: 'sort',
+      label: '鏄剧ず鎺掑簭',
+      component: 'InputNumber',
+      componentProps: {
+        min: 0,
+        placeholder: '鏁板瓧瓒婂皬瓒婇潬鍓�',
+      },
+    },
+    {
+      fieldName: 'status',
+      label: '鐘舵��',
+      component: 'Select',
+      componentProps: {
+        options: getDictOptions(DICT_TYPE.ARCHIVE_CATEGORY_STATUS, 'number'),
+        placeholder: '璇烽�夋嫨鐘舵��',
+      },
+    },
+    {
+      fieldName: 'description',
+      label: '鍒嗙被璇存槑',
+      component: 'Textarea',
+      componentProps: {
+        rows: 2,
+        placeholder: '璇疯緭鍏ュ垎绫昏鏄�',
+      },
+    },
+    {
+      fieldName: 'remark',
+      label: '澶囨敞',
+      component: 'Textarea',
+      componentProps: {
+        rows: 2,
+        placeholder: '璇疯緭鍏ュ娉�',
+      },
+    },
+  ];
+}
+
+/** 鍒楄〃鐨勬悳绱㈣〃鍗� */
+export function useGridFormSchema(): VbenFormSchema[] {
+  return [
+    {
+      fieldName: 'name',
+      label: '鍒嗙被鍚嶇О',
+      component: 'Input',
+      componentProps: {
+        allowClear: true,
+        placeholder: '璇疯緭鍏ュ垎绫诲悕绉�',
+      },
+    },
+    {
+      fieldName: 'status',
+      label: '鐘舵��',
+      component: 'Select',
+      componentProps: {
+        options: getDictOptions(DICT_TYPE.ARCHIVE_CATEGORY_STATUS, 'number'),
+        allowClear: true,
+        placeholder: '璇烽�夋嫨鐘舵��',
+      },
+    },
+  ];
+}
+
+/** 琛ㄦ牸鍒楅厤缃� */
+export function useGridColumns(): VxeTableGridOptions<ArchiveCategoryApi.Category>['columns'] {
+  return [
+    {
+      field: 'name',
+      title: '鍒嗙被鍚嶇О',
+      treeNode: true,
+    },
+    {
+      field: 'code',
+      title: '鍒嗙被缂栫爜',
+      minWidth: 130,
+    },
+    {
+      field: 'defaultSecretLevel',
+      title: '榛樿瀵嗙骇',
+      minWidth: 100,
+      cellRender: {
+        name: 'CellDict',
+        props: { type: DICT_TYPE.ARCHIVE_SECRET_LEVEL },
+      },
+    },
+    {
+      field: 'sort',
+      title: '鎺掑簭',
+      minWidth: 80,
+    },
+    {
+      field: 'description',
+      title: '鍒嗙被璇存槑',
+      minWidth: 180,
+    },
+    {
+      field: 'status',
+      title: '鐘舵��',
+      minWidth: 90,
+      cellRender: {
+        name: 'CellDict',
+        props: { type: DICT_TYPE.ARCHIVE_CATEGORY_STATUS },
+      },
+    },
+    {
+      field: 'createTime',
+      title: '鍒涘缓鏃堕棿',
+      minWidth: 170,
+      formatter: 'formatDateTime',
+    },
+    {
+      field: 'actions',
+      title: '鎿嶄綔',
+      width: 250,
+      fixed: 'right',
+      slots: {
+        default: 'actions',
+      },
+    },
+  ];
+}

--
Gitblit v1.9.3