@liujitcn/kratos-admin-system 0.0.49 → 0.0.50
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_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/ProjectGrantDialog.vue.d.ts +8 -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/index.d.ts +2 -0
- package/dist/package/declarations/src/locales/generated.d.ts +172 -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_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/base/i18n-custom/index.vue.d.ts +3 -0
- package/dist/package/declarations/src/views/base/project-grant/index.vue.d.ts +3 -0
- package/dist/package/declarations/src/views/base/tenant-project/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_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/ProjectGrantDialog.vue +108 -0
- package/dist/package/src/components/tenant-project/TenantProjectManager.vue +452 -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/index.ts +12 -0
- package/dist/package/src/locales/README.md +1 -1
- package/dist/package/src/locales/en-US.json +45 -2
- package/dist/package/src/locales/ja-JP.json +45 -2
- package/dist/package/src/locales/zh-CN.json +45 -2
- package/dist/package/src/locales/zh-TW.json +45 -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_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 +4 -3
- 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 +3 -3
- package/dist/package/src/views/base/login-log/index.vue +13 -4
- package/dist/package/src/views/base/login-policy/index.vue +97 -34
- 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/project-grant/index.vue +336 -0
- package/dist/package/src/views/base/role/index.vue +13 -47
- 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/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
|
@@ -150,12 +150,10 @@ import type { ColumnProps, HeaderActionProps, ProTableInstance } from "@liujitcn
|
|
|
150
150
|
import type { ProFormField, ProFormOption } from "@liujitcn/kratos-admin-core/components/ProForm/interface";
|
|
151
151
|
import { useAuthButtons } from "@liujitcn/kratos-admin-core/auth";
|
|
152
152
|
import { buildPageRequest, normalizeSelectedIds } from "@liujitcn/kratos-admin-core/table";
|
|
153
|
-
import {
|
|
154
|
-
import { useUserStore } from "@liujitcn/kratos-admin-core/stores/runtime";
|
|
153
|
+
import { useTenantScope } from "@liujitcn/kratos-admin-core/tenant";
|
|
155
154
|
import { t } from "@liujitcn/kratos-admin-core";
|
|
156
155
|
import { defBaseMessageService } from "@liujitcn/kratos-admin-system/api/system/admin/v1/base_message";
|
|
157
156
|
import { defBaseMessageCategoryService } from "@liujitcn/kratos-admin-system/api/system/admin/v1/base_message_category";
|
|
158
|
-
import { defBaseTenantService } from "@liujitcn/kratos-admin-system/api/system/admin/v1/base_tenant";
|
|
159
157
|
import type {
|
|
160
158
|
BaseMessage,
|
|
161
159
|
BaseMessageDetail,
|
|
@@ -189,12 +187,10 @@ type MessageFormState = Omit<BaseMessageForm, "tenant_id" | "category_id"> & {
|
|
|
189
187
|
};
|
|
190
188
|
|
|
191
189
|
const { BUTTONS } = useAuthButtons();
|
|
192
|
-
const
|
|
193
|
-
const isDefaultTenant = computed(() => userStore.userInfo.tenant_code === DEFAULT_TENANT_CODE);
|
|
190
|
+
const { isDefaultTenant, tenantColumns, tenantFormField, loadTenantOptions } = useTenantScope();
|
|
194
191
|
const proTable = ref<ProTableInstance>();
|
|
195
192
|
const formDialogRef = ref<InstanceType<typeof FormDialog>>();
|
|
196
193
|
const categoryOptions = ref<ProFormOption[]>([]);
|
|
197
|
-
const tenantOptions = ref<ProFormOption[]>([]);
|
|
198
194
|
const dialog = reactive({ visible: false, titleKey: "common.action.create" });
|
|
199
195
|
const content = reactive<{ visible: boolean; loading: boolean; data?: BaseMessageDetail }>({ visible: false, loading: false });
|
|
200
196
|
const detail = reactive<{ visible: boolean; data?: BaseMessageDetail }>({ visible: false });
|
|
@@ -270,13 +266,12 @@ const rules = computed(() => ({
|
|
|
270
266
|
|
|
271
267
|
const formFields = computed<ProFormField[]>(() => [
|
|
272
268
|
{
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
props: { filterable: true, disabled: Boolean(formState.id), placeholder: t("system.base.message.placeholder.tenant") }
|
|
269
|
+
...tenantFormField({
|
|
270
|
+
label: t("common.field.tenant"),
|
|
271
|
+
disabledOnEdit: true,
|
|
272
|
+
props: { placeholder: t("system.base.message.placeholder.tenant") }
|
|
273
|
+
}),
|
|
274
|
+
labelTooltip: t("system.base.message.tooltip.tenant")
|
|
280
275
|
},
|
|
281
276
|
{
|
|
282
277
|
prop: "category_id",
|
|
@@ -358,18 +353,7 @@ const formFields = computed<ProFormField[]>(() => [
|
|
|
358
353
|
|
|
359
354
|
const columns = computed<ColumnProps[]>(() => [
|
|
360
355
|
{ type: "selection", width: 55 },
|
|
361
|
-
...(
|
|
362
|
-
? ([
|
|
363
|
-
{
|
|
364
|
-
prop: "tenant_id",
|
|
365
|
-
label: t("common.field.tenant"),
|
|
366
|
-
minWidth: 120,
|
|
367
|
-
align: "left",
|
|
368
|
-
search: { el: "select" },
|
|
369
|
-
enum: requestTenantOptions
|
|
370
|
-
}
|
|
371
|
-
] satisfies ColumnProps[])
|
|
372
|
-
: []),
|
|
356
|
+
...tenantColumns({ label: t("common.field.tenant"), minWidth: 120 }),
|
|
373
357
|
{
|
|
374
358
|
prop: "title",
|
|
375
359
|
label: t("system.base.message.field.title"),
|
|
@@ -553,13 +537,6 @@ async function requestTable(params: Record<string, unknown>) {
|
|
|
553
537
|
return { data: { list: data.base_messages ?? [], total: data.total } };
|
|
554
538
|
}
|
|
555
539
|
|
|
556
|
-
/** 加载租户选项。 */
|
|
557
|
-
async function loadTenantOptions() {
|
|
558
|
-
if (!isDefaultTenant.value) return;
|
|
559
|
-
const result = await defBaseTenantService.OptionBaseTenant({ keyword: "" });
|
|
560
|
-
tenantOptions.value = result.list.map(item => ({ label: item.label, value: item.value }));
|
|
561
|
-
}
|
|
562
|
-
|
|
563
540
|
/** 加载消息分类选项。 */
|
|
564
541
|
async function loadCategoryOptions() {
|
|
565
542
|
const result = await defBaseMessageCategoryService.OptionBaseMessageCategory({});
|
|
@@ -23,8 +23,7 @@ import type { ColumnProps, HeaderActionProps, ProTableInstance } from "@liujitcn
|
|
|
23
23
|
import type { ProFormField, ProFormOption } from "@liujitcn/kratos-admin-core/components/ProForm/interface";
|
|
24
24
|
import { useAuthButtons } from "@liujitcn/kratos-admin-core/auth";
|
|
25
25
|
import { buildPageRequest, normalizeSelectedIds } from "@liujitcn/kratos-admin-core/table";
|
|
26
|
-
import {
|
|
27
|
-
import { useUserStore } from "@liujitcn/kratos-admin-core/stores/runtime";
|
|
26
|
+
import { useTenantScope } from "@liujitcn/kratos-admin-core/tenant";
|
|
28
27
|
import { t } from "@liujitcn/kratos-admin-core";
|
|
29
28
|
import { defBaseMessageCategoryService } from "@liujitcn/kratos-admin-system/api/system/admin/v1/base_message_category";
|
|
30
29
|
import type {
|
|
@@ -39,8 +38,7 @@ defineOptions({ name: "BaseMessageCategory", inheritAttrs: false });
|
|
|
39
38
|
|
|
40
39
|
/** 消息分类页面表单状态。 */
|
|
41
40
|
const { BUTTONS } = useAuthButtons();
|
|
42
|
-
const
|
|
43
|
-
const isDefaultTenant = computed(() => userStore.userInfo.tenant_code === DEFAULT_TENANT_CODE);
|
|
41
|
+
const { isDefaultTenant } = useTenantScope();
|
|
44
42
|
const proTable = ref<ProTableInstance>();
|
|
45
43
|
const formDialogRef = ref<InstanceType<typeof FormDialog>>();
|
|
46
44
|
const dialog = reactive({ visible: false, titleKey: "common.action.create" });
|
|
@@ -34,7 +34,6 @@ import { buildPageRequest, normalizeSelectedIds } from "@liujitcn/kratos-admin-c
|
|
|
34
34
|
import { t } from "@liujitcn/kratos-admin-core";
|
|
35
35
|
import { copyText } from "@liujitcn/kratos-admin-core/security";
|
|
36
36
|
import { defOauthClientService } from "@liujitcn/kratos-admin-system/api/system/admin/v1/oauth_client";
|
|
37
|
-
import { defBaseTenantService } from "@liujitcn/kratos-admin-system/api/system/admin/v1/base_tenant";
|
|
38
37
|
import type { BaseApi } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_api";
|
|
39
38
|
import {
|
|
40
39
|
OauthClientCryptoType,
|
|
@@ -42,10 +41,8 @@ import {
|
|
|
42
41
|
type OauthClientForm,
|
|
43
42
|
type PageOauthClientRequest
|
|
44
43
|
} from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/oauth_client";
|
|
45
|
-
import type { SelectOptionResponse_Option } from "@liujitcn/kratos-admin-system/rpc/common/v1/common";
|
|
46
44
|
import { Status } from "@liujitcn/kratos-admin-system/rpc/common/v1/enum";
|
|
47
|
-
import {
|
|
48
|
-
import { DEFAULT_TENANT_CODE, requestTenantOptions } from "@liujitcn/kratos-admin-core/tenant";
|
|
45
|
+
import { useTenantScope } from "@liujitcn/kratos-admin-core/tenant";
|
|
49
46
|
|
|
50
47
|
/** 开放授权客户端表单状态,新增时租户保持未选择。 */
|
|
51
48
|
type OauthClientFormState = Omit<OauthClientForm, "tenant_id"> & {
|
|
@@ -59,12 +56,10 @@ defineOptions({
|
|
|
59
56
|
});
|
|
60
57
|
|
|
61
58
|
const { BUTTONS } = useAuthButtons();
|
|
62
|
-
const
|
|
63
|
-
const isDefaultTenant = computed(() => userStore.userInfo.tenant_code === DEFAULT_TENANT_CODE);
|
|
59
|
+
const { isDefaultTenant, tenantColumns, tenantFormField, loadTenantOptions } = useTenantScope();
|
|
64
60
|
const proTable = ref<ProTableInstance>();
|
|
65
61
|
const formDialogRef = ref<InstanceType<typeof FormDialog>>();
|
|
66
62
|
const apiOptions = ref<BaseApi[]>([]);
|
|
67
|
-
const tenantOptions = ref<SelectOptionResponse_Option[]>([]);
|
|
68
63
|
|
|
69
64
|
const dialog = reactive({
|
|
70
65
|
titleKey: "common.action.create",
|
|
@@ -102,8 +97,6 @@ const transferOptions = computed<ProFormOption[]>(() =>
|
|
|
102
97
|
}))
|
|
103
98
|
);
|
|
104
99
|
|
|
105
|
-
const tenantNameMap = computed(() => new Map(tenantOptions.value.map(item => [item.value, item.label])));
|
|
106
|
-
|
|
107
100
|
const rules = computed(() => ({
|
|
108
101
|
tenant_id: [
|
|
109
102
|
{
|
|
@@ -137,18 +130,7 @@ const rules = computed(() => ({
|
|
|
137
130
|
}));
|
|
138
131
|
|
|
139
132
|
const formFields = computed<ProFormField[]>(() => [
|
|
140
|
-
{
|
|
141
|
-
prop: "tenant_id",
|
|
142
|
-
label: t("common.field.tenant"),
|
|
143
|
-
component: "select",
|
|
144
|
-
props: {
|
|
145
|
-
filterable: true,
|
|
146
|
-
disabled: Boolean(formData.id),
|
|
147
|
-
placeholder: t("common.placeholder.select")
|
|
148
|
-
},
|
|
149
|
-
options: tenantOptions.value,
|
|
150
|
-
visible: () => isDefaultTenant.value
|
|
151
|
-
},
|
|
133
|
+
tenantFormField({ label: t("common.field.tenant"), disabledOnEdit: true, props: { placeholder: t("common.placeholder.select") } }),
|
|
152
134
|
{
|
|
153
135
|
prop: "client_name",
|
|
154
136
|
label: t("system.base.oauth_client.field.client_name"),
|
|
@@ -184,20 +166,7 @@ const formFields = computed<ProFormField[]>(() => [
|
|
|
184
166
|
|
|
185
167
|
const columns = computed<ColumnProps[]>(() => [
|
|
186
168
|
{ type: "selection", width: 55 },
|
|
187
|
-
...(
|
|
188
|
-
? ([
|
|
189
|
-
{
|
|
190
|
-
prop: "tenant_id",
|
|
191
|
-
label: t("common.field.tenant"),
|
|
192
|
-
minWidth: 130,
|
|
193
|
-
align: "left",
|
|
194
|
-
search: { el: "select", key: "tenant_id", props: { filterable: true }, order: 1 },
|
|
195
|
-
enum: requestTenantOptions,
|
|
196
|
-
render: scope =>
|
|
197
|
-
tenantNameMap.value.get((scope.row as OauthClient).tenant_id) ?? String((scope.row as OauthClient).tenant_id)
|
|
198
|
-
}
|
|
199
|
-
] satisfies ColumnProps[])
|
|
200
|
-
: []),
|
|
169
|
+
...tenantColumns({ label: t("common.field.tenant"), minWidth: 130, order: 1 }),
|
|
201
170
|
{ prop: "client_id", label: t("system.base.oauth_client.field.client_id"), minWidth: 220 },
|
|
202
171
|
{ prop: "client_name", label: t("system.base.oauth_client.field.client_name"), minWidth: 160, search: { el: "input" } },
|
|
203
172
|
{
|
|
@@ -284,7 +253,10 @@ const headerActions = computed<HeaderActionProps[]>(() => [
|
|
|
284
253
|
]);
|
|
285
254
|
|
|
286
255
|
async function requestOauthClientTable(params: PageOauthClientRequest) {
|
|
287
|
-
const data = await defOauthClientService.PageOauthClient(
|
|
256
|
+
const data = await defOauthClientService.PageOauthClient({
|
|
257
|
+
...buildPageRequest(params),
|
|
258
|
+
tenant_id: isDefaultTenant.value ? params.tenant_id : undefined
|
|
259
|
+
});
|
|
288
260
|
return { data: { list: data.oauth_clients ?? [], total: data.total } };
|
|
289
261
|
}
|
|
290
262
|
|
|
@@ -293,12 +265,6 @@ async function loadApiOptions() {
|
|
|
293
265
|
apiOptions.value = data.base_apis ?? [];
|
|
294
266
|
}
|
|
295
267
|
|
|
296
|
-
async function loadTenantOptions() {
|
|
297
|
-
if (userStore.userInfo.tenant_code !== DEFAULT_TENANT_CODE || tenantOptions.value.length) return;
|
|
298
|
-
const data = await defBaseTenantService.OptionBaseTenant({ keyword: "" });
|
|
299
|
-
tenantOptions.value = data.list ?? [];
|
|
300
|
-
}
|
|
301
|
-
|
|
302
268
|
async function handleOpenDialog(id?: number) {
|
|
303
269
|
await loadTenantOptions();
|
|
304
270
|
await loadApiOptions();
|
|
@@ -15,14 +15,12 @@
|
|
|
15
15
|
<script setup lang="ts">
|
|
16
16
|
import { computed, ref } from "vue";
|
|
17
17
|
import ProTable from "@liujitcn/kratos-admin-core/components/ProTable";
|
|
18
|
-
import type { ColumnProps,
|
|
19
|
-
import {
|
|
20
|
-
import { useUserStore } from "@liujitcn/kratos-admin-core/stores/runtime";
|
|
18
|
+
import type { ColumnProps, ProTableInstance } from "@liujitcn/kratos-admin-core/components/ProTable/interface";
|
|
19
|
+
import { requestTenantCodeOptions, useTenantScope } from "@liujitcn/kratos-admin-core/tenant";
|
|
21
20
|
import { useAuthButtons } from "@liujitcn/kratos-admin-core/auth";
|
|
22
21
|
import { buildPageRequest } from "@liujitcn/kratos-admin-core/table";
|
|
23
22
|
import { formatDateTime } from "@liujitcn/kratos-admin-core/format";
|
|
24
23
|
import { t } from "@liujitcn/kratos-admin-core";
|
|
25
|
-
import { defBaseTenantService } from "@liujitcn/kratos-admin-system/api/system/admin/v1/base_tenant";
|
|
26
24
|
import { defBaseSessionService } from "@liujitcn/kratos-admin-system/api/system/admin/v1/base_session";
|
|
27
25
|
import type { BaseSession, PageOnlineBaseSessionsRequest } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_session";
|
|
28
26
|
|
|
@@ -30,18 +28,17 @@ defineOptions({ name: "BaseOnlineSession", inheritAttrs: false });
|
|
|
30
28
|
|
|
31
29
|
const { BUTTONS } = useAuthButtons();
|
|
32
30
|
const proTable = ref<ProTableInstance>();
|
|
33
|
-
const
|
|
34
|
-
const isDefaultTenant = computed(() => userStore.userInfo.tenant_code === DEFAULT_TENANT_CODE);
|
|
31
|
+
const { isDefaultTenant, tenantColumns } = useTenantScope();
|
|
35
32
|
|
|
36
33
|
const columns = computed<ColumnProps[]>(() => [
|
|
37
|
-
{
|
|
34
|
+
...tenantColumns({
|
|
38
35
|
prop: "tenant_code",
|
|
39
36
|
label: t("common.field.tenant"),
|
|
40
37
|
minWidth: 130,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
},
|
|
38
|
+
enum: requestTenantCodeOptions,
|
|
39
|
+
searchEl: "select",
|
|
40
|
+
render: scope => String((scope.row as BaseSession).tenant_code ?? "")
|
|
41
|
+
}),
|
|
45
42
|
{
|
|
46
43
|
prop: "user_name",
|
|
47
44
|
label: t("system.base.online_session.field.user_name"),
|
|
@@ -75,22 +72,6 @@ const columns = computed<ColumnProps[]>(() => [
|
|
|
75
72
|
}
|
|
76
73
|
]);
|
|
77
74
|
|
|
78
|
-
/** 将租户名称映射到会话使用的租户编码,供下拉筛选与表格展示复用。 */
|
|
79
|
-
async function requestSessionTenantOptions() {
|
|
80
|
-
if (!isDefaultTenant.value) {
|
|
81
|
-
return { data: [{ value: userStore.userInfo.tenant_code, label: userStore.userInfo.tenant_name }] };
|
|
82
|
-
}
|
|
83
|
-
const options: EnumProps[] = [];
|
|
84
|
-
const pageSize = 100;
|
|
85
|
-
for (let pageNum = 1; ; pageNum++) {
|
|
86
|
-
const response = await defBaseTenantService.PageBaseTenant({ code: "", name: "", page_num: pageNum, page_size: pageSize });
|
|
87
|
-
const tenants = response.base_tenants ?? [];
|
|
88
|
-
options.push(...tenants.map(tenant => ({ value: tenant.code, label: tenant.name })));
|
|
89
|
-
if (options.length >= response.total || tenants.length === 0) break;
|
|
90
|
-
}
|
|
91
|
-
return { data: options };
|
|
92
|
-
}
|
|
93
|
-
|
|
94
75
|
/** 查询在线用户会话列表。 */
|
|
95
76
|
async function requestTable(params: Record<string, unknown>) {
|
|
96
77
|
const response = await defBaseSessionService.PageOnlineBaseSessions(
|
|
@@ -6,10 +6,10 @@
|
|
|
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";
|
|
12
|
-
import { logDateSearch, logDetailColumn, logEnumLabel, createLogEnumOptions, requestLogTrace } from "@liujitcn/kratos-admin-system/components/log";
|
|
11
|
+
import LogTable, { type LogTableConfig } from "@liujitcn/kratos-admin-system/components/log/LogTable.vue";
|
|
12
|
+
import { logDateSearch, logDetailColumn, logEnumLabel, createLogEnumOptions, requestLogTrace } from "@liujitcn/kratos-admin-system/components/log/log";
|
|
13
13
|
import { defBaseOperationLogService } from "@liujitcn/kratos-admin-system/api/system/admin/v1/base_operation_log";
|
|
14
14
|
import { BaseLogResult } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_log";
|
|
15
15
|
import { BaseOperationAction } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_operation_log";
|
|
@@ -6,10 +6,10 @@
|
|
|
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";
|
|
12
|
-
import { logDateSearch, logDetailColumn, logEnumLabel, createLogEnumOptions, requestLogTrace } from "@liujitcn/kratos-admin-system/components/log";
|
|
11
|
+
import LogTable, { type LogTableConfig } from "@liujitcn/kratos-admin-system/components/log/LogTable.vue";
|
|
12
|
+
import { logDateSearch, logDetailColumn, logEnumLabel, createLogEnumOptions, requestLogTrace } from "@liujitcn/kratos-admin-system/components/log/log";
|
|
13
13
|
import { defBasePermissionLogService } from "@liujitcn/kratos-admin-system/api/system/admin/v1/base_permission_log";
|
|
14
14
|
import { BaseLogResult } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_log";
|
|
15
15
|
import { BasePermissionAction, BasePermissionTargetType } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_permission_log";
|
|
@@ -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 { defBasePolicyEvaluationLogService } from "@liujitcn/kratos-admin-system/api/system/admin/v1/base_policy_evaluation_log";
|
|
22
22
|
import { BasePolicyDecision, BasePolicyEvaluationType } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_policy_evaluation_log";
|
|
23
23
|
import type { BasePolicyEvaluationLog, PageBasePolicyEvaluationLogRequest } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_policy_evaluation_log";
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
</template>
|
|
25
25
|
|
|
26
26
|
<script setup lang="ts">
|
|
27
|
-
import { computed, reactive, ref } from "vue";
|
|
27
|
+
import { computed, onMounted, reactive, ref } from "vue";
|
|
28
28
|
import { ElMessage, ElMessageBox } from "element-plus";
|
|
29
29
|
import { CirclePlus, Delete, EditPen } from "@element-plus/icons-vue";
|
|
30
30
|
import type { ColumnProps, HeaderActionProps, ProTableInstance } from "@liujitcn/kratos-admin-core/components/ProTable/interface";
|
|
@@ -34,12 +34,9 @@ import type { ProFormField, ProFormOption } from "@liujitcn/kratos-admin-core/co
|
|
|
34
34
|
import { useAuthButtons } from "@liujitcn/kratos-admin-core/auth";
|
|
35
35
|
import { defBasePostService } from "@liujitcn/kratos-admin-system/api/system/admin/v1/base_post";
|
|
36
36
|
import type { BasePost, BasePostForm, PageBasePostRequest } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_post";
|
|
37
|
-
import { defBaseTenantService } from "@liujitcn/kratos-admin-system/api/system/admin/v1/base_tenant";
|
|
38
|
-
import type { SelectOptionResponse_Option } from "@liujitcn/kratos-admin-system/rpc/common/v1/common";
|
|
39
37
|
import { Status } from "@liujitcn/kratos-admin-system/rpc/common/v1/enum";
|
|
40
38
|
import { buildPageRequest, normalizeSelectedIds } from "@liujitcn/kratos-admin-core/table";
|
|
41
|
-
import {
|
|
42
|
-
import { useUserStore } from "@liujitcn/kratos-admin-core/stores/runtime";
|
|
39
|
+
import { useTenantScope } from "@liujitcn/kratos-admin-core/tenant";
|
|
43
40
|
import { t } from "@liujitcn/kratos-admin-core";
|
|
44
41
|
|
|
45
42
|
defineOptions({
|
|
@@ -54,7 +51,6 @@ type BasePostFormState = Omit<BasePostForm, "tenant_id"> & {
|
|
|
54
51
|
};
|
|
55
52
|
|
|
56
53
|
const { BUTTONS } = useAuthButtons();
|
|
57
|
-
const userStore = useUserStore();
|
|
58
54
|
const proTable = ref<ProTableInstance>();
|
|
59
55
|
const formDialogRef = ref<InstanceType<typeof FormDialog>>();
|
|
60
56
|
|
|
@@ -62,7 +58,6 @@ const dialog = reactive({
|
|
|
62
58
|
titleKey: "common.action.create_resource",
|
|
63
59
|
visible: false
|
|
64
60
|
});
|
|
65
|
-
const tenantOptions = ref<SelectOptionResponse_Option[]>([]);
|
|
66
61
|
const statusOptions = computed<ProFormOption[]>(() => [
|
|
67
62
|
{ label: t("common.status.enabled"), value: Status.STATUS_ENABLE },
|
|
68
63
|
{ label: t("common.status.disabled"), value: Status.STATUS_DISABLE }
|
|
@@ -132,23 +127,14 @@ const rules = computed(() => ({
|
|
|
132
127
|
]
|
|
133
128
|
}));
|
|
134
129
|
|
|
135
|
-
|
|
136
|
-
|
|
130
|
+
const { isDefaultTenant, tenantColumns, tenantFormField, toRequestTenantId, loadTenantOptions } = useTenantScope();
|
|
131
|
+
onMounted(() => {
|
|
132
|
+
if (isDefaultTenant.value) void loadTenantOptions();
|
|
133
|
+
});
|
|
137
134
|
|
|
138
135
|
/** 岗位表单字段配置。 */
|
|
139
136
|
const formFields = computed<ProFormField[]>(() => [
|
|
140
|
-
{
|
|
141
|
-
prop: "tenant_id",
|
|
142
|
-
label: t("common.field.tenant"),
|
|
143
|
-
component: "select",
|
|
144
|
-
props: {
|
|
145
|
-
placeholder: t("common.placeholder.select"),
|
|
146
|
-
filterable: true,
|
|
147
|
-
disabled: Boolean(formData.id)
|
|
148
|
-
},
|
|
149
|
-
visible: () => isDefaultTenant.value,
|
|
150
|
-
options: tenantOptions.value
|
|
151
|
-
},
|
|
137
|
+
tenantFormField({ label: t("common.field.tenant"), disabledOnEdit: true }),
|
|
152
138
|
{
|
|
153
139
|
prop: "name",
|
|
154
140
|
label: t("system.base.post.field.name"),
|
|
@@ -179,19 +165,7 @@ const formFields = computed<ProFormField[]>(() => [
|
|
|
179
165
|
/** 岗位表格列配置。 */
|
|
180
166
|
const columns = computed<ColumnProps[]>(() => [
|
|
181
167
|
{ type: "selection", width: 55 },
|
|
182
|
-
...(
|
|
183
|
-
? ([
|
|
184
|
-
{
|
|
185
|
-
prop: "tenant_id",
|
|
186
|
-
label: t("common.field.tenant"),
|
|
187
|
-
minWidth: 140,
|
|
188
|
-
align: "left",
|
|
189
|
-
showOverflowTooltip: true,
|
|
190
|
-
search: { el: "select", key: "tenant_id", props: { filterable: true }, order: 1 },
|
|
191
|
-
enum: requestTenantOptions
|
|
192
|
-
}
|
|
193
|
-
] satisfies ColumnProps[])
|
|
194
|
-
: []),
|
|
168
|
+
...tenantColumns({ label: t("common.field.tenant"), order: 1 }),
|
|
195
169
|
{ prop: "name", label: t("system.base.post.field.name"), minWidth: 140, search: { el: "input" } },
|
|
196
170
|
{ prop: "code", label: t("system.base.post.field.code"), minWidth: 140, search: { el: "input" } },
|
|
197
171
|
{ prop: "sort", label: t("common.field.sort"), minWidth: 90, align: "right" },
|
|
@@ -262,7 +236,7 @@ const headerActions = computed<HeaderActionProps[]>(() => [
|
|
|
262
236
|
async function requestBasePostTable(params: PageBasePostRequest) {
|
|
263
237
|
const data = await defBasePostService.PageBasePost({
|
|
264
238
|
...buildPageRequest(params),
|
|
265
|
-
tenant_id:
|
|
239
|
+
tenant_id: toRequestTenantId(params.tenant_id)
|
|
266
240
|
});
|
|
267
241
|
return { data: { list: data.base_posts ?? [], total: data.total } };
|
|
268
242
|
}
|
|
@@ -272,13 +246,6 @@ function refreshTable() {
|
|
|
272
246
|
proTable.value?.getTableList();
|
|
273
247
|
}
|
|
274
248
|
|
|
275
|
-
/** 加载租户选项。 */
|
|
276
|
-
async function loadTenantOptions() {
|
|
277
|
-
if (!isDefaultTenant.value || tenantOptions.value.length) return;
|
|
278
|
-
const response = await defBaseTenantService.OptionBaseTenant({ keyword: "" });
|
|
279
|
-
tenantOptions.value = response.list ?? [];
|
|
280
|
-
}
|
|
281
|
-
|
|
282
249
|
/** 打开岗位编辑弹窗。 */
|
|
283
250
|
async function handleOpenDialog(id?: number) {
|
|
284
251
|
resetForm();
|