@liujitcn/kratos-admin-system 0.0.49 → 0.0.51
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.
- package/README.md +44 -8
- package/dist/package/declarations/src/api/system/admin/v1/base_i18n_custom.d.ts +18 -0
- package/dist/package/declarations/src/api/system/admin/v1/base_redact_output_policy.d.ts +4 -1
- package/dist/package/declarations/src/api/system/admin/v1/base_redact_storage_policy.d.ts +3 -1
- package/dist/package/declarations/src/api/system/admin/v1/base_tenant.d.ts +2 -2
- package/dist/package/declarations/src/api/system/admin/v1/base_tenant_project.d.ts +23 -0
- package/dist/package/declarations/src/api/system/admin/v1/base_tenant_project_grant.d.ts +16 -0
- package/dist/package/declarations/src/components/tenant-project/TenantProjectManager.vue.d.ts +29 -0
- package/dist/package/declarations/src/components/tenant-project/TenantProjectSelect.vue.d.ts +31 -0
- package/dist/package/declarations/src/components/tenant-project/TenantProjectText.vue.d.ts +19 -0
- package/dist/package/declarations/src/components/tenant-project/tenant-project-manager-data.d.ts +14 -0
- package/dist/package/declarations/src/components/tenant-project/tenant-project-manager.d.ts +40 -0
- package/dist/package/declarations/src/components/tenant-project-grant/ProjectGrantDialog.vue.d.ts +8 -0
- package/dist/package/declarations/src/index.d.ts +2 -0
- package/dist/package/declarations/src/locales/generated.d.ts +196 -0
- package/dist/package/declarations/src/rpc/base/v1/config.d.ts +11 -0
- package/dist/package/declarations/src/rpc/system/admin/v1/base_i18n_custom.d.ts +105 -0
- package/dist/package/declarations/src/rpc/system/admin/v1/base_redact_output_policy.d.ts +8 -0
- package/dist/package/declarations/src/rpc/system/admin/v1/base_redact_storage_policy.d.ts +25 -0
- package/dist/package/declarations/src/rpc/system/admin/v1/base_tenant.d.ts +10 -1
- package/dist/package/declarations/src/rpc/system/admin/v1/base_tenant_project.d.ts +141 -0
- package/dist/package/declarations/src/rpc/system/admin/v1/base_tenant_project_grant.d.ts +105 -0
- package/dist/package/declarations/src/views/ai/chat/components/SessionPanel.vue.d.ts +2 -2
- package/dist/package/declarations/src/views/ai/chat/components/speech-recognition.d.ts +33 -0
- package/dist/package/declarations/src/views/base/i18n-custom/index.vue.d.ts +3 -0
- package/dist/package/declarations/src/views/base/tenant-project/index.vue.d.ts +3 -0
- package/dist/package/declarations/src/views/base/tenant-project-grant/index.vue.d.ts +3 -0
- package/dist/package/src/api/system/admin/v1/base_i18n_custom.ts +72 -0
- package/dist/package/src/api/system/admin/v1/base_redact_output_policy.ts +7 -0
- package/dist/package/src/api/system/admin/v1/base_redact_storage_policy.ts +7 -0
- package/dist/package/src/api/system/admin/v1/base_tenant.ts +3 -2
- package/dist/package/src/api/system/admin/v1/base_tenant_project.ts +94 -0
- package/dist/package/src/api/system/admin/v1/base_tenant_project_grant.ts +63 -0
- package/dist/package/src/components/tenant-project/TenantProjectManager.vue +431 -0
- package/dist/package/src/components/tenant-project/TenantProjectSelect.vue +83 -0
- package/dist/package/src/components/tenant-project/TenantProjectText.vue +37 -0
- package/dist/package/src/components/tenant-project/tenant-project-manager-data.ts +26 -0
- package/dist/package/src/components/tenant-project/tenant-project-manager.ts +48 -0
- package/dist/package/src/components/tenant-project-grant/ProjectGrantDialog.vue +108 -0
- package/dist/package/src/index.ts +12 -0
- package/dist/package/src/locales/README.md +1 -1
- package/dist/package/src/locales/en-US.json +51 -2
- package/dist/package/src/locales/ja-JP.json +51 -2
- package/dist/package/src/locales/zh-CN.json +51 -2
- package/dist/package/src/locales/zh-TW.json +51 -2
- package/dist/package/src/module.ts +3 -3
- package/dist/package/src/rpc/base/v1/config.ts +12 -0
- package/dist/package/src/rpc/system/admin/v1/base_i18n_custom.ts +126 -0
- package/dist/package/src/rpc/system/admin/v1/base_redact_output_policy.ts +9 -0
- package/dist/package/src/rpc/system/admin/v1/base_redact_storage_policy.ts +30 -0
- package/dist/package/src/rpc/system/admin/v1/base_tenant.ts +11 -1
- package/dist/package/src/rpc/system/admin/v1/base_tenant_project.ts +166 -0
- package/dist/package/src/rpc/system/admin/v1/base_tenant_project_grant.ts +128 -0
- package/dist/package/src/views/ai/chat/components/XSender.vue +21 -28
- package/dist/package/src/views/ai/chat/components/speech-recognition.ts +156 -0
- package/dist/package/src/views/base/api-log/index.vue +3 -3
- package/dist/package/src/views/base/config/index.vue +3 -3
- package/dist/package/src/views/base/data-access-log/index.vue +3 -3
- package/dist/package/src/views/base/dept/index.vue +10 -45
- package/dist/package/src/views/base/dict/index.vue +3 -3
- package/dist/package/src/views/base/dict/item.vue +3 -3
- package/dist/package/src/views/base/file/index.vue +12 -3
- package/dist/package/src/views/base/i18n-custom/index.vue +321 -0
- package/dist/package/src/views/base/job/index.vue +85 -161
- package/dist/package/src/views/base/login-log/index.vue +13 -4
- package/dist/package/src/views/base/login-policy/index.vue +109 -40
- package/dist/package/src/views/base/menu/index.vue +3 -3
- package/dist/package/src/views/base/message/index.vue +9 -32
- package/dist/package/src/views/base/message-category/index.vue +2 -4
- package/dist/package/src/views/base/oauth-client/index.vue +8 -42
- package/dist/package/src/views/base/online-session/index.vue +8 -27
- package/dist/package/src/views/base/operation-log/index.vue +3 -3
- package/dist/package/src/views/base/permission-log/index.vue +3 -3
- package/dist/package/src/views/base/policy-evaluation-log/index.vue +3 -3
- package/dist/package/src/views/base/post/index.vue +9 -42
- package/dist/package/src/views/base/redact-output-policy/index.vue +19 -7
- package/dist/package/src/views/base/redact-rule/index.vue +70 -53
- package/dist/package/src/views/base/redact-storage-policy/index.vue +18 -7
- package/dist/package/src/views/base/role/index.vue +14 -48
- package/dist/package/src/views/base/tenant/index.vue +163 -19
- package/dist/package/src/views/base/tenant-project/index.vue +12 -0
- package/dist/package/src/views/base/tenant-project-grant/index.vue +338 -0
- package/dist/package/src/views/base/user/index.vue +30 -51
- package/dist/package/src/views/profile/components/login-log.vue +15 -2
- package/dist/package/src/views/profile/components/password.vue +1 -1
- package/dist/package/src/views/profile/components/security.vue +2 -2
- package/dist/package/src/views/tool/code-gen/components/CodeGenLocaleEditor.vue +2 -2
- package/dist/package/src/views/tool/code-gen/config.ts +2 -1
- package/package.json +2 -2
- /package/dist/package/declarations/src/components/{ChangePasswordForm.vue.d.ts → account/ChangePasswordForm.vue.d.ts} +0 -0
- /package/dist/package/declarations/src/components/{ForcedPasswordDialog.vue.d.ts → account/ForcedPasswordDialog.vue.d.ts} +0 -0
- /package/dist/package/declarations/src/components/{Ai.vue.d.ts → ai/Ai.vue.d.ts} +0 -0
- /package/dist/package/declarations/src/components/{DynamicI18nCell.vue.d.ts → i18n/DynamicI18nCell.vue.d.ts} +0 -0
- /package/dist/package/declarations/src/components/{DynamicI18nEditor.vue.d.ts → i18n/DynamicI18nEditor.vue.d.ts} +0 -0
- /package/dist/package/declarations/src/components/{dynamicI18n.d.ts → i18n/dynamicI18n.d.ts} +0 -0
- /package/dist/package/declarations/src/components/{LogTable.vue.d.ts → log/LogTable.vue.d.ts} +0 -0
- /package/dist/package/declarations/src/components/{log.d.ts → log/log.d.ts} +0 -0
- /package/dist/package/declarations/src/components/{Notification.vue.d.ts → notification/Notification.vue.d.ts} +0 -0
- /package/dist/package/src/components/{ChangePasswordForm.vue → account/ChangePasswordForm.vue} +0 -0
- /package/dist/package/src/components/{ForcedPasswordDialog.vue → account/ForcedPasswordDialog.vue} +0 -0
- /package/dist/package/src/components/{Ai.vue → ai/Ai.vue} +0 -0
- /package/dist/package/src/components/{DynamicI18nCell.vue → i18n/DynamicI18nCell.vue} +0 -0
- /package/dist/package/src/components/{DynamicI18nEditor.vue → i18n/DynamicI18nEditor.vue} +0 -0
- /package/dist/package/src/components/{dynamicI18n.ts → i18n/dynamicI18n.ts} +0 -0
- /package/dist/package/src/components/{LogTable.vue → log/LogTable.vue} +0 -0
- /package/dist/package/src/components/{log.ts → log/log.ts} +0 -0
- /package/dist/package/src/components/{Notification.vue → notification/Notification.vue} +0 -0
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { getCurrentInstance, onBeforeUnmount, ref } from "vue";
|
|
2
|
+
|
|
3
|
+
/** 语音识别结果的最小结构,便于在不同浏览器实现间复用。 */
|
|
4
|
+
export type SpeechResultList = ArrayLike<{
|
|
5
|
+
0?: {
|
|
6
|
+
transcript: string;
|
|
7
|
+
};
|
|
8
|
+
length: number;
|
|
9
|
+
}>;
|
|
10
|
+
|
|
11
|
+
/** 语音识别错误的最小结构,兼容浏览器事件和不支持错误。 */
|
|
12
|
+
export type SpeechRecognitionError = {
|
|
13
|
+
code?: number;
|
|
14
|
+
error?: string;
|
|
15
|
+
message?: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
type SpeechRecognitionResultEvent = {
|
|
19
|
+
results: SpeechResultList;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
type SpeechRecognitionInstance = {
|
|
23
|
+
continuous: boolean;
|
|
24
|
+
interimResults: boolean;
|
|
25
|
+
lang: string;
|
|
26
|
+
onstart: (() => void) | null;
|
|
27
|
+
onend: (() => void) | null;
|
|
28
|
+
onerror: ((error: SpeechRecognitionError) => void) | null;
|
|
29
|
+
onresult: ((event: SpeechRecognitionResultEvent) => void) | null;
|
|
30
|
+
start: () => void;
|
|
31
|
+
stop: () => void;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
type SpeechRecognitionConstructor = new () => SpeechRecognitionInstance;
|
|
35
|
+
|
|
36
|
+
type SpeechRecognitionWindow = Window & {
|
|
37
|
+
SpeechRecognition?: SpeechRecognitionConstructor;
|
|
38
|
+
webkitSpeechRecognition?: SpeechRecognitionConstructor;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
type SpeechRecognitionOptions = {
|
|
42
|
+
/** 识别错误回调。 */
|
|
43
|
+
onError?: (error: SpeechRecognitionError) => void;
|
|
44
|
+
/** 识别开始回调。 */
|
|
45
|
+
onStart?: () => void;
|
|
46
|
+
/** 识别结束回调。 */
|
|
47
|
+
onEnd?: (text: string) => void;
|
|
48
|
+
/** 识别结果回调。 */
|
|
49
|
+
onResult?: (text: string) => void;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
/** 收集一次识别事件中的完整文本。 */
|
|
53
|
+
export function collectSpeechResultText(results: SpeechResultList) {
|
|
54
|
+
let text = "";
|
|
55
|
+
for (let index = 0; index < results.length; index++) {
|
|
56
|
+
text += results[index]?.[0]?.transcript ?? "";
|
|
57
|
+
}
|
|
58
|
+
return text;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** 创建浏览器语音识别实例,并统一结果、状态和卸载处理。 */
|
|
62
|
+
export function useSpeechRecognition({ onError, onStart, onEnd, onResult }: SpeechRecognitionOptions = {}) {
|
|
63
|
+
const loading = ref(false);
|
|
64
|
+
const value = ref("");
|
|
65
|
+
let recognition: SpeechRecognitionInstance | null = null;
|
|
66
|
+
let recognitionSession = 0;
|
|
67
|
+
|
|
68
|
+
/** 获取当前浏览器支持的语音识别构造函数。 */
|
|
69
|
+
function resolveRecognitionConstructor() {
|
|
70
|
+
if (typeof window === "undefined") return undefined;
|
|
71
|
+
const speechWindow = window as SpeechRecognitionWindow;
|
|
72
|
+
return speechWindow.SpeechRecognition ?? speechWindow.webkitSpeechRecognition;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** 开始一次语音识别。 */
|
|
76
|
+
function start() {
|
|
77
|
+
if (loading.value) return;
|
|
78
|
+
const RecognitionConstructor = resolveRecognitionConstructor();
|
|
79
|
+
if (!RecognitionConstructor) {
|
|
80
|
+
onError?.({ code: -1, message: "Speech recognition is not supported by this browser" });
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const nextRecognition = new RecognitionConstructor();
|
|
85
|
+
const currentSession = ++recognitionSession;
|
|
86
|
+
recognition = nextRecognition;
|
|
87
|
+
const isCurrentRecognition = () => recognition === nextRecognition && recognitionSession === currentSession;
|
|
88
|
+
nextRecognition.continuous = true;
|
|
89
|
+
nextRecognition.interimResults = true;
|
|
90
|
+
nextRecognition.lang = "zh-CN";
|
|
91
|
+
nextRecognition.onstart = () => {
|
|
92
|
+
if (!isCurrentRecognition()) return;
|
|
93
|
+
loading.value = true;
|
|
94
|
+
value.value = "";
|
|
95
|
+
onStart?.();
|
|
96
|
+
};
|
|
97
|
+
nextRecognition.onresult = event => {
|
|
98
|
+
if (!isCurrentRecognition()) return;
|
|
99
|
+
value.value = collectSpeechResultText(event.results);
|
|
100
|
+
onResult?.(value.value);
|
|
101
|
+
};
|
|
102
|
+
nextRecognition.onerror = error => {
|
|
103
|
+
if (!isCurrentRecognition()) return;
|
|
104
|
+
loading.value = false;
|
|
105
|
+
recognition = null;
|
|
106
|
+
onError?.(error);
|
|
107
|
+
};
|
|
108
|
+
nextRecognition.onend = () => {
|
|
109
|
+
if (!isCurrentRecognition()) return;
|
|
110
|
+
loading.value = false;
|
|
111
|
+
recognition = null;
|
|
112
|
+
onEnd?.(value.value);
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
loading.value = true;
|
|
116
|
+
try {
|
|
117
|
+
nextRecognition.start();
|
|
118
|
+
} catch (error) {
|
|
119
|
+
if (!isCurrentRecognition()) return;
|
|
120
|
+
loading.value = false;
|
|
121
|
+
recognition = null;
|
|
122
|
+
onError?.({
|
|
123
|
+
code: -2,
|
|
124
|
+
message: error instanceof Error ? error.message : String(error)
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/** 停止当前语音识别。 */
|
|
130
|
+
function stop() {
|
|
131
|
+
const currentRecognition = recognition;
|
|
132
|
+
if (!currentRecognition) return;
|
|
133
|
+
recognition = null;
|
|
134
|
+
recognitionSession++;
|
|
135
|
+
loading.value = false;
|
|
136
|
+
onEnd?.(value.value);
|
|
137
|
+
currentRecognition.stop();
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
if (getCurrentInstance()) {
|
|
141
|
+
onBeforeUnmount(() => {
|
|
142
|
+
const currentRecognition = recognition;
|
|
143
|
+
recognition = null;
|
|
144
|
+
recognitionSession++;
|
|
145
|
+
loading.value = false;
|
|
146
|
+
currentRecognition?.stop();
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
return {
|
|
151
|
+
loading,
|
|
152
|
+
start,
|
|
153
|
+
stop,
|
|
154
|
+
value
|
|
155
|
+
};
|
|
156
|
+
}
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
import { computed, ref } from "vue";
|
|
7
7
|
import type { ColumnProps } from "@liujitcn/kratos-admin-core/components/ProTable/interface";
|
|
8
8
|
import { t } from "@liujitcn/kratos-admin-core";
|
|
9
|
-
import { formatLogDateTime } from "@liujitcn/kratos-admin-system/components/log";
|
|
9
|
+
import { formatLogDateTime } from "@liujitcn/kratos-admin-system/components/log/log";
|
|
10
10
|
import { buildPageRequest } from "@liujitcn/kratos-admin-core/table";
|
|
11
|
-
import LogTable, { type LogTableConfig } from "@liujitcn/kratos-admin-system/components/LogTable.vue";
|
|
11
|
+
import LogTable, { type LogTableConfig } from "@liujitcn/kratos-admin-system/components/log/LogTable.vue";
|
|
12
12
|
import {
|
|
13
13
|
createLogEnumOptions,
|
|
14
14
|
formatLogBytes,
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
logDetailColumn,
|
|
19
19
|
logEnumLabel,
|
|
20
20
|
requestLogTrace
|
|
21
|
-
} from "@liujitcn/kratos-admin-system/components/log";
|
|
21
|
+
} from "@liujitcn/kratos-admin-system/components/log/log";
|
|
22
22
|
import { defBaseApiLogService } from "@liujitcn/kratos-admin-system/api/system/admin/v1/base_api_log";
|
|
23
23
|
import { BaseLogResult } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_log";
|
|
24
24
|
import type { BaseApiLog, PageBaseApiLogRequest } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_api_log";
|
|
@@ -137,13 +137,13 @@ import { BaseConfigType } from "@liujitcn/kratos-admin-system/rpc/system/admin/v
|
|
|
137
137
|
import { I18nTargetType } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_i18n";
|
|
138
138
|
import { buildPageRequest, normalizeSelectedIds } from "@liujitcn/kratos-admin-core/table";
|
|
139
139
|
import { t } from "@liujitcn/kratos-admin-core";
|
|
140
|
-
import DynamicI18nEditor from "@liujitcn/kratos-admin-system/components/DynamicI18nEditor.vue";
|
|
141
|
-
import DynamicI18nCell from "@liujitcn/kratos-admin-system/components/DynamicI18nCell.vue";
|
|
140
|
+
import DynamicI18nEditor from "@liujitcn/kratos-admin-system/components/i18n/DynamicI18nEditor.vue";
|
|
141
|
+
import DynamicI18nCell from "@liujitcn/kratos-admin-system/components/i18n/DynamicI18nCell.vue";
|
|
142
142
|
import {
|
|
143
143
|
getEditableLanguageOptions,
|
|
144
144
|
serializeDynamicI18ns,
|
|
145
145
|
type DynamicI18nValue
|
|
146
|
-
} from "@liujitcn/kratos-admin-system/components/dynamicI18n";
|
|
146
|
+
} from "@liujitcn/kratos-admin-system/components/i18n/dynamicI18n";
|
|
147
147
|
|
|
148
148
|
/** 系统配置编辑表单状态,新增时枚举字段保持为空,避免把未知值 0 显示为下拉文本。 */
|
|
149
149
|
type BaseConfigFormState = Omit<BaseConfigForm, "site" | "type"> & {
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
import { computed, ref } from "vue";
|
|
7
7
|
import type { ColumnProps } from "@liujitcn/kratos-admin-core/components/ProTable/interface";
|
|
8
8
|
import { t } from "@liujitcn/kratos-admin-core";
|
|
9
|
-
import { formatLogDateTime } from "@liujitcn/kratos-admin-system/components/log";
|
|
9
|
+
import { formatLogDateTime } from "@liujitcn/kratos-admin-system/components/log/log";
|
|
10
10
|
import { buildPageRequest } from "@liujitcn/kratos-admin-core/table";
|
|
11
|
-
import LogTable, { type LogTableConfig } from "@liujitcn/kratos-admin-system/components/LogTable.vue";
|
|
11
|
+
import LogTable, { type LogTableConfig } from "@liujitcn/kratos-admin-system/components/log/LogTable.vue";
|
|
12
12
|
import {
|
|
13
13
|
createLogEnumOptions,
|
|
14
14
|
formatLogCount,
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
logDetailColumn,
|
|
18
18
|
logEnumLabel,
|
|
19
19
|
requestLogTrace
|
|
20
|
-
} from "@liujitcn/kratos-admin-system/components/log";
|
|
20
|
+
} from "@liujitcn/kratos-admin-system/components/log/log";
|
|
21
21
|
import { defBaseDataAccessLogService } from "@liujitcn/kratos-admin-system/api/system/admin/v1/base_data_access_log";
|
|
22
22
|
import { BaseLogResult } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_log";
|
|
23
23
|
import { BaseDataAccessType } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_data_access_log";
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
</template>
|
|
29
29
|
|
|
30
30
|
<script setup lang="ts">
|
|
31
|
-
import { computed, reactive, ref } from "vue";
|
|
31
|
+
import { computed, onMounted, reactive, ref } from "vue";
|
|
32
32
|
import { ElMessage, ElMessageBox } from "element-plus";
|
|
33
33
|
import { CirclePlus, Delete, EditPen } from "@element-plus/icons-vue";
|
|
34
34
|
import type { ColumnProps, HeaderActionProps, ProTableInstance } from "@liujitcn/kratos-admin-core/components/ProTable/interface";
|
|
@@ -37,13 +37,11 @@ import FormDialog from "@liujitcn/kratos-admin-core/components/Dialog/FormDialog
|
|
|
37
37
|
import type { ProFormField, ProFormOption } from "@liujitcn/kratos-admin-core/components/ProForm/interface";
|
|
38
38
|
import { useAuthButtons } from "@liujitcn/kratos-admin-core/auth";
|
|
39
39
|
import { defBaseDeptService } from "@liujitcn/kratos-admin-system/api/system/admin/v1/base_dept";
|
|
40
|
-
import { defBaseTenantService } from "@liujitcn/kratos-admin-system/api/system/admin/v1/base_tenant";
|
|
41
|
-
import { useUserStore } from "@liujitcn/kratos-admin-core/stores/runtime";
|
|
42
40
|
import type { BaseDept, BaseDeptForm } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_dept";
|
|
43
|
-
import type {
|
|
41
|
+
import type { TreeOptionResponse_Option } from "@liujitcn/kratos-admin-system/rpc/common/v1/common";
|
|
44
42
|
import { Status } from "@liujitcn/kratos-admin-system/rpc/common/v1/enum";
|
|
45
43
|
import { normalizeSelectedIds } from "@liujitcn/kratos-admin-core/table";
|
|
46
|
-
import {
|
|
44
|
+
import { useTenantScope } from "@liujitcn/kratos-admin-core/tenant";
|
|
47
45
|
import { t } from "@liujitcn/kratos-admin-core";
|
|
48
46
|
|
|
49
47
|
defineOptions({
|
|
@@ -58,7 +56,6 @@ type BaseDeptFormState = Omit<BaseDeptForm, "tenant_id"> & {
|
|
|
58
56
|
};
|
|
59
57
|
|
|
60
58
|
const { BUTTONS } = useAuthButtons();
|
|
61
|
-
const userStore = useUserStore();
|
|
62
59
|
const proTable = ref<ProTableInstance>();
|
|
63
60
|
const formDialogRef = ref<InstanceType<typeof FormDialog>>();
|
|
64
61
|
|
|
@@ -68,7 +65,6 @@ const dialog = reactive({
|
|
|
68
65
|
});
|
|
69
66
|
|
|
70
67
|
const deptOptions = ref<TreeOptionResponse_Option[]>([]);
|
|
71
|
-
const tenantOptions = ref<SelectOptionResponse_Option[]>([]);
|
|
72
68
|
const currentTenantId = ref<number | undefined>();
|
|
73
69
|
const statusOptions = computed<ProFormOption[]>(() => [
|
|
74
70
|
{ label: t("common.status.enabled"), value: Status.STATUS_ENABLE },
|
|
@@ -129,24 +125,14 @@ const rules = computed(() => ({
|
|
|
129
125
|
]
|
|
130
126
|
}));
|
|
131
127
|
|
|
132
|
-
|
|
133
|
-
|
|
128
|
+
const { isDefaultTenant, tenantColumns, tenantFormField, toRequestTenantId, loadTenantOptions } = useTenantScope();
|
|
129
|
+
onMounted(() => {
|
|
130
|
+
if (isDefaultTenant.value) void loadTenantOptions();
|
|
131
|
+
});
|
|
134
132
|
|
|
135
133
|
/** 部门表单字段配置。 */
|
|
136
134
|
const formFields = computed<ProFormField[]>(() => [
|
|
137
|
-
{
|
|
138
|
-
prop: "tenant_id",
|
|
139
|
-
label: t("common.field.tenant"),
|
|
140
|
-
component: "select",
|
|
141
|
-
props: {
|
|
142
|
-
placeholder: t("common.placeholder.select"),
|
|
143
|
-
filterable: true,
|
|
144
|
-
disabled: Boolean(formData.id),
|
|
145
|
-
onChange: handleFormTenantChange
|
|
146
|
-
},
|
|
147
|
-
visible: () => isDefaultTenant.value,
|
|
148
|
-
options: tenantOptions.value
|
|
149
|
-
},
|
|
135
|
+
tenantFormField({ label: t("common.field.tenant"), disabledOnEdit: true, props: { onChange: handleFormTenantChange } }),
|
|
150
136
|
{
|
|
151
137
|
prop: "parent_id",
|
|
152
138
|
label: t("system.base.dept.field.parent"),
|
|
@@ -184,19 +170,7 @@ const formFields = computed<ProFormField[]>(() => [
|
|
|
184
170
|
/** 部门树表格列配置。 */
|
|
185
171
|
const columns = computed<ColumnProps[]>(() => [
|
|
186
172
|
{ type: "selection", width: 55 },
|
|
187
|
-
...(
|
|
188
|
-
? ([
|
|
189
|
-
{
|
|
190
|
-
prop: "tenant_id",
|
|
191
|
-
label: t("common.field.tenant"),
|
|
192
|
-
minWidth: 140,
|
|
193
|
-
align: "left",
|
|
194
|
-
showOverflowTooltip: true,
|
|
195
|
-
search: { el: "select", key: "tenant_id", props: { filterable: true }, order: 1 },
|
|
196
|
-
enum: requestTenantOptions
|
|
197
|
-
}
|
|
198
|
-
] satisfies ColumnProps[])
|
|
199
|
-
: []),
|
|
173
|
+
...tenantColumns({ label: t("common.field.tenant"), order: 1 }),
|
|
200
174
|
{ prop: "name", label: t("system.base.dept.field.name"), minWidth: 140, align: "right", search: { el: "input" } },
|
|
201
175
|
{ prop: "remark", label: t("common.field.remark"), minWidth: 160, search: { el: "input" } },
|
|
202
176
|
{ prop: "sort", label: t("common.field.sort"), minWidth: 90, align: "right" },
|
|
@@ -334,7 +308,7 @@ async function loadDeptOptions() {
|
|
|
334
308
|
return;
|
|
335
309
|
}
|
|
336
310
|
const optionBaseDeptResponse = await defBaseDeptService.OptionBaseDept({
|
|
337
|
-
tenant_id:
|
|
311
|
+
tenant_id: toRequestTenantId(formData.tenant_id)
|
|
338
312
|
});
|
|
339
313
|
deptOptions.value = [
|
|
340
314
|
{
|
|
@@ -347,15 +321,6 @@ async function loadDeptOptions() {
|
|
|
347
321
|
];
|
|
348
322
|
}
|
|
349
323
|
|
|
350
|
-
/**
|
|
351
|
-
* 加载租户下拉选项。
|
|
352
|
-
*/
|
|
353
|
-
async function loadTenantOptions() {
|
|
354
|
-
if (!isDefaultTenant.value || tenantOptions.value.length) return;
|
|
355
|
-
const response = await defBaseTenantService.OptionBaseTenant({ keyword: "" });
|
|
356
|
-
tenantOptions.value = response.list ?? [];
|
|
357
|
-
}
|
|
358
|
-
|
|
359
324
|
/**
|
|
360
325
|
* 切换表单租户时重新加载对应租户的上级部门树。
|
|
361
326
|
*/
|
|
@@ -49,14 +49,14 @@ import { Status } from "@liujitcn/kratos-admin-system/rpc/common/v1/enum";
|
|
|
49
49
|
import { I18nTargetType } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_i18n";
|
|
50
50
|
import { buildPageRequest, normalizeSelectedIds } from "@liujitcn/kratos-admin-core/table";
|
|
51
51
|
import { t } from "@liujitcn/kratos-admin-core";
|
|
52
|
-
import DynamicI18nEditor from "@liujitcn/kratos-admin-system/components/DynamicI18nEditor.vue";
|
|
53
|
-
import DynamicI18nCell from "@liujitcn/kratos-admin-system/components/DynamicI18nCell.vue";
|
|
52
|
+
import DynamicI18nEditor from "@liujitcn/kratos-admin-system/components/i18n/DynamicI18nEditor.vue";
|
|
53
|
+
import DynamicI18nCell from "@liujitcn/kratos-admin-system/components/i18n/DynamicI18nCell.vue";
|
|
54
54
|
import {
|
|
55
55
|
normalizeDynamicI18ns,
|
|
56
56
|
serializeDynamicI18ns,
|
|
57
57
|
type DynamicI18nRecord,
|
|
58
58
|
type DynamicI18nValue
|
|
59
|
-
} from "@liujitcn/kratos-admin-system/components/dynamicI18n";
|
|
59
|
+
} from "@liujitcn/kratos-admin-system/components/i18n/dynamicI18n";
|
|
60
60
|
|
|
61
61
|
defineOptions({
|
|
62
62
|
name: "BaseDict",
|
|
@@ -68,14 +68,14 @@ import { Status } from "@liujitcn/kratos-admin-system/rpc/common/v1/enum";
|
|
|
68
68
|
import { I18nTargetType } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_i18n";
|
|
69
69
|
import { buildPageRequest, normalizeSelectedIds } from "@liujitcn/kratos-admin-core/table";
|
|
70
70
|
import { t } from "@liujitcn/kratos-admin-core";
|
|
71
|
-
import DynamicI18nEditor from "@liujitcn/kratos-admin-system/components/DynamicI18nEditor.vue";
|
|
72
|
-
import DynamicI18nCell from "@liujitcn/kratos-admin-system/components/DynamicI18nCell.vue";
|
|
71
|
+
import DynamicI18nEditor from "@liujitcn/kratos-admin-system/components/i18n/DynamicI18nEditor.vue";
|
|
72
|
+
import DynamicI18nCell from "@liujitcn/kratos-admin-system/components/i18n/DynamicI18nCell.vue";
|
|
73
73
|
import {
|
|
74
74
|
normalizeDynamicI18ns,
|
|
75
75
|
serializeDynamicI18ns,
|
|
76
76
|
type DynamicI18nRecord,
|
|
77
77
|
type DynamicI18nValue
|
|
78
|
-
} from "@liujitcn/kratos-admin-system/components/dynamicI18n";
|
|
78
|
+
} from "@liujitcn/kratos-admin-system/components/i18n/dynamicI18n";
|
|
79
79
|
|
|
80
80
|
defineOptions({
|
|
81
81
|
name: "BaseDictItem",
|
|
@@ -77,13 +77,14 @@
|
|
|
77
77
|
</template>
|
|
78
78
|
|
|
79
79
|
<script setup lang="ts">
|
|
80
|
-
import { computed, ref } from "vue";
|
|
80
|
+
import { computed, onMounted, ref } from "vue";
|
|
81
81
|
import { Download, Delete, View } from "@element-plus/icons-vue";
|
|
82
82
|
import ProTable from "@liujitcn/kratos-admin-core/components/ProTable";
|
|
83
83
|
import ProDialog from "@liujitcn/kratos-admin-core/components/Dialog/ProDialog.vue";
|
|
84
84
|
import type { ColumnProps, ProTableInstance } from "@liujitcn/kratos-admin-core/components/ProTable/interface";
|
|
85
85
|
import { useAuthButtons } from "@liujitcn/kratos-admin-core/auth";
|
|
86
86
|
import { buildPageRequest } from "@liujitcn/kratos-admin-core/table";
|
|
87
|
+
import { useTenantScope } from "@liujitcn/kratos-admin-core/tenant";
|
|
87
88
|
import { t } from "@liujitcn/kratos-admin-core";
|
|
88
89
|
import { defFileService } from "@liujitcn/kratos-admin-core/api/base/v1/file";
|
|
89
90
|
import { defBaseFileService } from "@liujitcn/kratos-admin-system/api/system/admin/v1/base_file";
|
|
@@ -92,6 +93,7 @@ import type { BaseFile, PageBaseFileRequest } from "@liujitcn/kratos-admin-syste
|
|
|
92
93
|
defineOptions({ name: "BaseFile", inheritAttrs: false });
|
|
93
94
|
|
|
94
95
|
const { BUTTONS } = useAuthButtons();
|
|
96
|
+
const { isDefaultTenant, tenantColumns, toRequestTenantId, loadTenantOptions } = useTenantScope();
|
|
95
97
|
const proTable = ref<ProTableInstance>();
|
|
96
98
|
const detailVisible = ref(false);
|
|
97
99
|
const detail = ref<BaseFile>();
|
|
@@ -106,13 +108,17 @@ type PreviewKind = "image" | "video" | "audio" | "pdf" | "text" | "unsupported";
|
|
|
106
108
|
|
|
107
109
|
const previewKind = computed<PreviewKind>(() => (detail.value ? getPreviewKind(detail.value) : "unsupported"));
|
|
108
110
|
|
|
111
|
+
onMounted(() => {
|
|
112
|
+
if (isDefaultTenant.value) void loadTenantOptions();
|
|
113
|
+
});
|
|
114
|
+
|
|
109
115
|
const columns = computed<ColumnProps[]>(() => [
|
|
110
116
|
{ prop: "file_name", label: t("system.base.file.field.name"), minWidth: 220, search: { el: "input" } },
|
|
111
117
|
{ prop: "extension", label: t("system.base.file.field.extension"), width: 100, search: { el: "input" } },
|
|
112
118
|
{ prop: "mime_type", label: t("system.base.file.field.mime"), minWidth: 180 },
|
|
113
119
|
{ prop: "size", label: t("system.base.file.field.size"), width: 120, align: "right", render: scope => formatFileSize((scope.row as BaseFile).size) },
|
|
114
120
|
{ prop: "content_hash", label: t("system.base.file.field.hash"), minWidth: 220 },
|
|
115
|
-
{
|
|
121
|
+
...tenantColumns({ label: t("system.base.file.field.tenant"), minWidth: 100 }),
|
|
116
122
|
{ prop: "created_at", align: "center", label: t("common.field.created_at"), minWidth: 180 },
|
|
117
123
|
{
|
|
118
124
|
prop: "operation",
|
|
@@ -141,7 +147,10 @@ const columns = computed<ColumnProps[]>(() => [
|
|
|
141
147
|
|
|
142
148
|
/** 请求文件资产分页列表。 */
|
|
143
149
|
async function requestBaseFileTable(params: PageBaseFileRequest) {
|
|
144
|
-
const data = await defBaseFileService.PageBaseFile(
|
|
150
|
+
const data = await defBaseFileService.PageBaseFile({
|
|
151
|
+
...buildPageRequest(params),
|
|
152
|
+
tenant_id: toRequestTenantId(params.tenant_id)
|
|
153
|
+
});
|
|
145
154
|
return { data: { list: data.base_files ?? [], total: data.total } };
|
|
146
155
|
}
|
|
147
156
|
|