@liujitcn/kratos-admin-system 0.0.52 → 0.0.54

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/dist/package/declarations/src/api/base/v1/sse.d.ts +1 -1
  2. package/dist/package/declarations/src/locales/generated.d.ts +32 -0
  3. package/dist/package/declarations/src/rpc/base/v1/ai_search.d.ts +26 -0
  4. package/dist/package/declarations/src/rpc/system/admin/v1/base_redact_output_policy.d.ts +0 -1
  5. package/dist/package/src/api/base/v1/sse.ts +19 -12
  6. package/dist/package/src/components/log/LogTable.vue +25 -18
  7. package/dist/package/src/components/notification/Notification.vue +14 -7
  8. package/dist/package/src/components/tenant-project/TenantProjectManager.vue +12 -6
  9. package/dist/package/src/components/tenant-project-grant/ProjectGrantDialog.vue +22 -7
  10. package/dist/package/src/locales/en-US.json +8 -0
  11. package/dist/package/src/locales/ja-JP.json +8 -0
  12. package/dist/package/src/locales/zh-CN.json +8 -0
  13. package/dist/package/src/locales/zh-TW.json +8 -0
  14. package/dist/package/src/rpc/base/v1/ai_search.ts +37 -0
  15. package/dist/package/src/rpc/system/admin/v1/base_redact_output_policy.ts +0 -1
  16. package/dist/package/src/views/ai/chat/index.vue +16 -7
  17. package/dist/package/src/views/base/api-log/index.vue +1 -1
  18. package/dist/package/src/views/base/area/index.vue +15 -9
  19. package/dist/package/src/views/base/backup-management/archive-config/index.vue +22 -10
  20. package/dist/package/src/views/base/backup-management/backup-config/index.vue +13 -6
  21. package/dist/package/src/views/base/config/index.vue +38 -14
  22. package/dist/package/src/views/base/dashboard/index.vue +201 -53
  23. package/dist/package/src/views/base/dept/index.vue +31 -25
  24. package/dist/package/src/views/base/dict/index.vue +12 -8
  25. package/dist/package/src/views/base/dict/item.vue +12 -8
  26. package/dist/package/src/views/base/i18n-custom/index.vue +13 -7
  27. package/dist/package/src/views/base/job/index.vue +12 -8
  28. package/dist/package/src/views/base/job/log.vue +14 -9
  29. package/dist/package/src/views/base/language/index.vue +7 -4
  30. package/dist/package/src/views/base/login-policy/index.vue +22 -11
  31. package/dist/package/src/views/base/menu/index.vue +23 -16
  32. package/dist/package/src/views/base/message/index.vue +65 -21
  33. package/dist/package/src/views/base/message-category/index.vue +10 -4
  34. package/dist/package/src/views/base/oauth-client/index.vue +15 -5
  35. package/dist/package/src/views/base/post/index.vue +10 -4
  36. package/dist/package/src/views/base/redact-output-policy/index.vue +12 -5
  37. package/dist/package/src/views/base/redact-rule/index.vue +8 -7
  38. package/dist/package/src/views/base/redact-storage-policy/index.vue +32 -8
  39. package/dist/package/src/views/base/role/index.vue +24 -17
  40. package/dist/package/src/views/base/tenant/index.vue +7 -6
  41. package/dist/package/src/views/base/tenant-project-grant/index.vue +44 -27
  42. package/dist/package/src/views/base/user/components/dept-tree.vue +4 -9
  43. package/dist/package/src/views/base/user/index.vue +39 -28
  44. package/dist/package/src/views/message/inbox/index.vue +8 -3
  45. package/dist/package/src/views/profile/components/base.vue +1 -1
  46. package/dist/package/src/views/profile/index.vue +1 -1
  47. package/dist/package/src/views/tool/cache/index.vue +1 -1
  48. package/dist/package/src/views/tool/code-gen/columns/index.vue +35 -16
  49. package/dist/package/src/views/tool/code-gen/table/index.vue +58 -31
  50. package/package.json +2 -2
@@ -261,6 +261,7 @@
261
261
  </el-card>
262
262
 
263
263
  <ProDialog
264
+ ref="optionDialogRef"
264
265
  v-model="optionDialog.visible"
265
266
  :title="optionDialogTitle"
266
267
  width="560px"
@@ -591,6 +592,7 @@ const staticOptions = reactive(new Map<string, CodeGenStaticOption[]>());
591
592
  const loadingDictionaries = ref(false);
592
593
  const loadingDatabaseTables = ref(false);
593
594
  const loadingDatabaseColumns = reactive(new Set<string>());
595
+ const optionDialogRef = ref<InstanceType<typeof ProDialog>>();
594
596
  let dictionariesLoaded = false;
595
597
  let databaseTablesLoaded = false;
596
598
  let columnSortable: Sortable | undefined;
@@ -868,22 +870,39 @@ function handleFormEnabledChange(row: CodeGenColumnView) {
868
870
  /** 打开查询、列表或表单自己的选项编辑弹窗。 */
869
871
  async function openOptionDialog(row: CodeGenColumnView, scope: CodeGenOptionScope) {
870
872
  const config = getCodeGenOptionContainer(row, scope);
871
- syncOptionKind(config, scope);
872
- optionDialog.scope = scope;
873
- optionDialog.columnName = row.name;
874
- optionDialog.component = config.component;
875
- optionDialog.isJSONColumn = row.db_type.trim().toLowerCase() === "json";
876
- optionDialog.cacheKey = `${row.table_id}:${row.name}:${scope}`;
877
- optionDialog.option = config.option;
878
- optionDialog.formConfig = scope === "form" && config.component === "tree-select" ? row.form_config : null;
879
- optionDialog.visible = true;
880
- await prepareOptionEditor();
873
+ const draft = {
874
+ scope,
875
+ columnName: row.name,
876
+ component: config.component,
877
+ isJSONColumn: row.db_type.trim().toLowerCase() === "json",
878
+ cacheKey: `${row.table_id}:${row.name}:${scope}`,
879
+ option: { ...config.option },
880
+ formConfig:
881
+ scope === "form" && config.component === "tree-select"
882
+ ? { ...row.form_config, option: { ...row.form_config.option } }
883
+ : null
884
+ } satisfies Omit<CodeGenOptionDialog, "visible">;
885
+ await optionDialogRef.value?.open({
886
+ load: async () => {
887
+ syncOptionKind({ ...config, option: draft.option }, scope);
888
+ await prepareOptionEditor(draft);
889
+ return draft;
890
+ },
891
+ commit: loaded => {
892
+ Object.assign(optionDialog, loaded);
893
+ }
894
+ });
881
895
  }
882
896
 
883
897
  /** 保存选项配置并关闭弹窗。 */
884
898
  function handleSaveOptionDialog() {
885
899
  const row = columns.value.find(item => item.name === optionDialog.columnName);
886
- if (row) copyCodeGenOptionToEmptyMatches(row, optionDialog.scope);
900
+ if (row && optionDialog.option) {
901
+ const config = getCodeGenOptionContainer(row, optionDialog.scope);
902
+ Object.assign(config.option, optionDialog.option);
903
+ if (optionDialog.formConfig) Object.assign(row.form_config, optionDialog.formConfig, { option: config.option });
904
+ copyCodeGenOptionToEmptyMatches(row, optionDialog.scope);
905
+ }
887
906
  optionDialog.visible = false;
888
907
  }
889
908
 
@@ -894,12 +913,12 @@ function handleOptionDialogClosed() {
894
913
  }
895
914
 
896
915
  /** 按当前选项来源准备弹窗所需数据。 */
897
- async function prepareOptionEditor() {
898
- const option = optionDialog.option;
916
+ async function prepareOptionEditor(context: Pick<CodeGenOptionDialog, "option" | "cacheKey" | "component"> = optionDialog) {
917
+ const option = context.option;
899
918
  if (!option) return;
900
919
  if (option.source_type === "static") {
901
- if (!staticOptions.has(optionDialog.cacheKey)) {
902
- staticOptions.set(optionDialog.cacheKey, parseCodeGenStaticOptions(option.source_value));
920
+ if (!staticOptions.has(context.cacheKey)) {
921
+ staticOptions.set(context.cacheKey, parseCodeGenStaticOptions(option.source_value));
903
922
  }
904
923
  return;
905
924
  }
@@ -912,7 +931,7 @@ async function prepareOptionEditor() {
912
931
  if (option.source_type === "table") {
913
932
  await loadDatabaseTables();
914
933
  await loadDatabaseColumns(option.source_value);
915
- applyTableOptionDefaultFields(option, optionDialog.component);
934
+ applyTableOptionDefaultFields(option, context.component);
916
935
  }
917
936
  }
918
937
 
@@ -789,33 +789,58 @@ function refreshTable() {
789
789
 
790
790
  /** 打开新增或编辑弹窗,并加载当前表单所需选项。 */
791
791
  async function handleOpenDialog(tableId?: number) {
792
- resetForm();
793
- await loadSourceOptions();
794
- const detail = tableId ? await defCodeGenTableService.GetCodeGenTable({ id: tableId }) : undefined;
795
- if (detail) Object.assign(formData, detail);
796
- if (!formData.source_name) formData.source_name = String(sourceOptions.value[0]?.value ?? "");
797
- const [tableData, menuData, dictionaryData] = await Promise.all([
798
- loadDatabaseTables(formData.source_name),
799
- defBaseMenuService.TreeBaseMenu({}),
800
- defBaseDictService.OptionBaseDict({})
801
- ]);
802
- databaseTables.value = tableData.tables ?? [];
803
- parentMenuOptions.value = convertMenuOptions(menuData.base_menus ?? []);
804
- businessModuleItems.value = dictionaryData.base_dicts?.find(item => item.code === "business_module")?.items ?? [];
805
- if (detail) {
806
- formData.parent_menu_id = detail.parent_menu_id || undefined;
807
- formData.left_tree_config ??= createDefaultCodeGenLeftTreeConfig();
808
- if (!formData.comment) {
809
- formData.comment = databaseTables.value.find(item => item.name === formData.name)?.comment ?? "";
810
- }
811
- if (!formData.left_tree_config.comment) {
812
- formData.left_tree_config.comment =
813
- databaseTables.value.find(item => item.name === formData.left_tree_config?.table_name)?.comment ?? "";
792
+ await formDialogRef.value?.open({
793
+ load: async () => {
794
+ await loadSourceOptions();
795
+ const detail = tableId ? await defCodeGenTableService.GetCodeGenTable({ id: tableId }) : undefined;
796
+ const sourceName = detail?.source_name || String(sourceOptions.value[0]?.value ?? "");
797
+ const [tableData, menuData, dictionaryData] = await Promise.all([
798
+ loadDatabaseTables(sourceName),
799
+ defBaseMenuService.TreeBaseMenu({}),
800
+ defBaseDictService.OptionBaseDict({})
801
+ ]);
802
+ const tables = tableData.tables ?? [];
803
+ const form = {
804
+ ...createDefaultCodeGenTableForm(),
805
+ ...(detail ?? {}),
806
+ source_name: sourceName,
807
+ parent_menu_id: detail?.parent_menu_id || undefined,
808
+ left_tree_config: detail?.left_tree_config
809
+ ? { ...detail.left_tree_config }
810
+ : createDefaultCodeGenLeftTreeConfig()
811
+ };
812
+ if (detail) {
813
+ if (!form.comment) form.comment = tables.find(item => item.name === form.name)?.comment ?? "";
814
+ if (!form.left_tree_config.comment) {
815
+ form.left_tree_config.comment = tables.find(item => item.name === form.left_tree_config?.table_name)?.comment ?? "";
816
+ }
817
+ }
818
+ const [columns, leftTreeColumns] = detail
819
+ ? await Promise.all([
820
+ requestDatabaseColumns(form.source_name, form.name),
821
+ form.page_type === "left_tree" ? requestDatabaseColumns(form.source_name, form.left_tree_config.table_name) : Promise.resolve([])
822
+ ])
823
+ : [[], []];
824
+ return {
825
+ form,
826
+ tables,
827
+ menuOptions: convertMenuOptions(menuData.base_menus ?? []),
828
+ businessModuleItems: dictionaryData.base_dicts?.find(item => item.code === "business_module")?.items ?? [],
829
+ columns,
830
+ leftTreeColumns
831
+ };
832
+ },
833
+ commit: ({ form, tables, menuOptions, businessModuleItems: items, columns, leftTreeColumns }) => {
834
+ resetForm();
835
+ Object.assign(formData, form);
836
+ databaseTables.value = tables;
837
+ parentMenuOptions.value = menuOptions;
838
+ businessModuleItems.value = items;
839
+ databaseColumns.value = columns;
840
+ leftTreeDatabaseColumns.value = leftTreeColumns;
841
+ dialog.editing = Boolean(tableId);
814
842
  }
815
- await Promise.all([loadDatabaseColumns(databaseColumns, formData.source_name, formData.name), loadLeftTreeDatabaseColumns()]);
816
- dialog.editing = true;
817
- }
818
- dialog.visible = true;
843
+ });
819
844
  }
820
845
 
821
846
  /** 加载已初始化的数据源选项。 */
@@ -971,12 +996,14 @@ async function loadDatabaseTables(sourceName: string) {
971
996
 
972
997
  /** 查询指定数据源的数据表字段选项。 */
973
998
  async function loadDatabaseColumns(target: { value: CodeGenDatabaseColumn[] }, sourceName: string, tableName: string) {
974
- if (!tableName) {
975
- target.value = [];
976
- return;
977
- }
999
+ target.value = await requestDatabaseColumns(sourceName, tableName);
1000
+ }
1001
+
1002
+ /** 请求指定数据源和数据表的字段选项。 */
1003
+ async function requestDatabaseColumns(sourceName: string, tableName: string) {
1004
+ if (!tableName) return [];
978
1005
  const data = await defCodeGenColumnService.ListCodeGenDatabaseColumn({ source_name: sourceName, table_name: tableName });
979
- target.value = data.columns ?? [];
1006
+ return data.columns ?? [];
980
1007
  }
981
1008
 
982
1009
  /** 查询左树来源表字段选项。 */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@liujitcn/kratos-admin-system",
3
3
  "private": false,
4
- "version": "0.0.52",
4
+ "version": "0.0.54",
5
5
  "type": "module",
6
6
  "description": "kratos-admin system management module",
7
7
  "license": "MIT",
@@ -16,7 +16,7 @@
16
16
  "sortablejs": "^1.15.2",
17
17
  "swagger-ui-dist": "^5.32.15",
18
18
  "vue-element-plus-x": "^2.0.3",
19
- "@liujitcn/kratos-admin-core": "0.0.52"
19
+ "@liujitcn/kratos-admin-core": "0.0.54"
20
20
  },
21
21
  "peerDependencies": {
22
22
  "@element-plus/icons-vue": "^2.3.1",