@liujitcn/kratos-admin-system 0.0.50 → 0.0.52
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 +3 -3
- 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/components/tenant-project/TenantProjectManager.vue.d.ts +1 -2
- package/dist/package/declarations/src/components/tenant-project/tenant-project-manager-data.d.ts +10 -0
- package/dist/package/declarations/src/components/tenant-project/tenant-project-manager.d.ts +8 -3
- package/dist/package/declarations/src/index.d.ts +1 -1
- package/dist/package/declarations/src/locales/generated.d.ts +24 -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/views/ai/chat/components/speech-recognition.d.ts +37 -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/components/tenant-project/TenantProjectManager.vue +77 -60
- package/dist/package/src/components/tenant-project/tenant-project-manager-data.ts +39 -1
- package/dist/package/src/components/tenant-project/tenant-project-manager.ts +19 -4
- package/dist/package/src/index.ts +2 -0
- package/dist/package/src/locales/en-US.json +6 -0
- package/dist/package/src/locales/ja-JP.json +6 -0
- package/dist/package/src/locales/zh-CN.json +6 -0
- package/dist/package/src/locales/zh-TW.json +6 -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/views/ai/chat/components/XSender.vue +18 -61
- package/dist/package/src/views/ai/chat/components/speech-recognition.ts +177 -0
- package/dist/package/src/views/base/job/index.vue +82 -158
- package/dist/package/src/views/base/login-policy/index.vue +12 -6
- 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 +1 -1
- package/dist/package/src/views/base/{project-grant → tenant-project-grant}/index.vue +3 -1
- package/package.json +2 -2
- /package/dist/package/declarations/src/components/{tenant-project → tenant-project-grant}/ProjectGrantDialog.vue.d.ts +0 -0
- /package/dist/package/declarations/src/views/base/{project-grant → tenant-project-grant}/index.vue.d.ts +0 -0
- /package/dist/package/src/components/{tenant-project → tenant-project-grant}/ProjectGrantDialog.vue +0 -0
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
<template v-if="row.rule_type === 'MASK'">
|
|
43
43
|
<ParameterNumber v-model="row.params.keep_first" :label="t('system.base.redact_rule.parameter.keep_first')" />
|
|
44
44
|
<ParameterNumber v-model="row.params.keep_last" :label="t('system.base.redact_rule.parameter.keep_last')" />
|
|
45
|
+
<ParameterNumber v-model="row.params.min_mask" :label="t('system.base.redact_rule.parameter.min_mask')" />
|
|
45
46
|
<ParameterText v-model="row.params.mask_char" :label="t('system.base.redact_rule.parameter.mask_char')" />
|
|
46
47
|
</template>
|
|
47
48
|
<template v-else-if="row.rule_type === 'EMAIL'">
|
|
@@ -93,7 +94,6 @@ import { useAuthButtons } from "@liujitcn/kratos-admin-core/auth";
|
|
|
93
94
|
import { buildPageRequest, normalizeSelectedIds } from "@liujitcn/kratos-admin-core/table";
|
|
94
95
|
import { t } from "@liujitcn/kratos-admin-core";
|
|
95
96
|
import { defBaseTableSourceService } from "@liujitcn/kratos-admin-system/api/system/admin/v1/base_table_source";
|
|
96
|
-
import { defCodeGenColumnService } from "@liujitcn/kratos-admin-system/api/system/admin/v1/code_gen_column";
|
|
97
97
|
import { defCodeGenTableService } from "@liujitcn/kratos-admin-system/api/system/admin/v1/code_gen_table";
|
|
98
98
|
import { defBaseRedactRuleService } from "@liujitcn/kratos-admin-system/api/system/admin/v1/base_redact_rule";
|
|
99
99
|
import { defBaseRedactStoragePolicyService } from "@liujitcn/kratos-admin-system/api/system/admin/v1/base_redact_storage_policy";
|
|
@@ -106,6 +106,7 @@ import { Status } from "@liujitcn/kratos-admin-system/rpc/common/v1/enum";
|
|
|
106
106
|
interface RuleParams {
|
|
107
107
|
keep_first?: number;
|
|
108
108
|
keep_last?: number;
|
|
109
|
+
min_mask?: number;
|
|
109
110
|
mask_char?: string;
|
|
110
111
|
keep_local_first?: number;
|
|
111
112
|
mask_domain?: boolean;
|
|
@@ -227,7 +228,7 @@ async function loadTables(sourceName = form.source_name) { if (!sourceName) { ta
|
|
|
227
228
|
/** 预加载数据表中文注释,供列表显示。 */
|
|
228
229
|
async function loadTableComments() { await loadSourceOptions(); const comments = new Map<string, string>(); await Promise.all(sourceOptions.value.map(async option => { const sourceName = String(option.value); const data = await defCodeGenTableService.ListCodeGenDatabaseTable({ source_name: sourceName }); for (const item of data.tables ?? []) { if (item.comment) comments.set(`${sourceName}\x00${item.name}`, item.comment); } })); tableCommentMap.value = comments; }
|
|
229
230
|
/** 加载并过滤数据库字段。 */
|
|
230
|
-
async function loadColumns() { if (!form.source_name || !form.table_name) { form.column_rows = []; return; } const data = await
|
|
231
|
+
async function loadColumns() { if (!form.source_name || !form.table_name) { form.column_rows = []; return; } const data = await defBaseRedactStoragePolicyService.ListBaseRedactStorageColumn({ source_name: form.source_name, table_name: form.table_name }); form.column_rows = (data.columns ?? []).filter(item => !STORAGE_AUDIT_COLUMN_NAMES.has(item.name.toLowerCase())).map(item => createColumnRow({ label: item.name, value: item.name, name: item.name, comment: item.comment, db_type: item.db_type })); }
|
|
231
232
|
/** 打开新增或编辑弹窗。 */
|
|
232
233
|
async function openDialog(id?: number) { resetForm(); await Promise.all([loadSourceOptions(), loadRules()]); if (id !== undefined) { const data = await defBaseRedactStoragePolicyService.GetBaseRedactStoragePolicy({ id }); Object.assign(form, data); await loadTables(); await loadColumns(); const row = form.column_rows.find(item => item.name === data.column_name); if (row) applyPolicy(row, data); } dialog.titleKey = id !== undefined ? "common.action.edit_resource" : "common.action.create_resource"; dialog.visible = true; }
|
|
233
234
|
/** 重置弹窗表单。 */
|
|
@@ -237,17 +238,27 @@ async function submit() { const valid = await dialogRef.value?.validate(); if (!
|
|
|
237
238
|
/** 将表格行转换为入库策略请求。 */
|
|
238
239
|
function buildPayload(row: StorageColumnRow): BaseRedactStoragePolicyForm { syncRowParams(row); return { id: row.id, source_name: form.source_name, table_name: form.table_name, column_name: row.name, rule_id: row.rule_id ?? 0, rule_params: row.rule_params, status: form.status, remark: form.remark }; }
|
|
239
240
|
/** 将已保存的策略回填到对应字段行。 */
|
|
240
|
-
function applyPolicy(row: StorageColumnRow, data: BaseRedactStoragePolicyForm) { row.id = data.id; row.rule_id = data.rule_id || undefined; row.rule_params = data.rule_params; if (row.rule_id) { const rule = ruleCatalog.value.find(item => item.id === row.rule_id); row.rule_type = rule?.rule_type ?? ""; row.params = parseParams(row.rule_type, row.rule_params); } }
|
|
241
|
+
function applyPolicy(row: StorageColumnRow, data: BaseRedactStoragePolicyForm) { row.id = data.id; row.rule_id = data.rule_id || undefined; row.rule_params = data.rule_params; if (row.rule_id) { const rule = ruleCatalog.value.find(item => item.id === row.rule_id); row.rule_type = rule?.rule_type ?? ""; row.params = rule ? parseParams(row.rule_type, row.rule_params, rule.rule) : {}; } }
|
|
241
242
|
/** 处理行规则变更。 */
|
|
242
243
|
function handleRuleChange(row: StorageTableRow) { const rule = ruleCatalog.value.find(item => item.id === row.rule_id); row.rule_type = rule?.rule_type ?? ""; row.params = rule ? parseParams(rule.rule_type, rule.rule) : {}; row.rule_params = rule ? rule.rule : "{}"; }
|
|
243
244
|
/** 同步单行规则参数。 */
|
|
244
245
|
function syncRowParams(row: StorageColumnRow) { const rule = ruleCatalog.value.find(item => item.id === row.rule_id); if (rule) { row.rule_type = rule.rule_type; row.rule_params = JSON.stringify({ [rule.rule_type.toLowerCase()]: row.params }); } }
|
|
245
246
|
/** 创建空的入库字段行。 */
|
|
246
247
|
function createColumnRow(option: Pick<StorageColumnRow, "label" | "value" | "name" | "comment" | "db_type">): StorageColumnRow { return { ...option, id: 0, rule_id: undefined, rule_type: "", params: {}, rule_params: "{}" }; }
|
|
247
|
-
/**
|
|
248
|
-
function parseParams(ruleType: string, raw: string
|
|
249
|
-
|
|
250
|
-
|
|
248
|
+
/** 解析规则参数,空策略参数时回退到数据库规则参数。 */
|
|
249
|
+
function parseParams(ruleType: string, raw: string, fallbackRaw = ""): RuleParams {
|
|
250
|
+
const candidates = fallbackRaw && fallbackRaw !== raw ? [raw, fallbackRaw] : [raw];
|
|
251
|
+
for (const candidate of candidates) {
|
|
252
|
+
try {
|
|
253
|
+
const value = JSON.parse(candidate) as Record<string, RuleParams>;
|
|
254
|
+
const params = value[ruleType.toLowerCase()];
|
|
255
|
+
if (params && typeof params === "object" && !Array.isArray(params)) return params;
|
|
256
|
+
} catch {
|
|
257
|
+
continue;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
return {};
|
|
261
|
+
}
|
|
251
262
|
/** 修改入库策略状态。 */
|
|
252
263
|
async function changeStatus(row: BaseRedactStoragePolicy) { const next = row.status === Status.STATUS_ENABLE ? Status.STATUS_DISABLE : Status.STATUS_ENABLE; try { await ElMessageBox.confirm(t("common.dialog.status_change", { action: t(next === Status.STATUS_ENABLE ? "common.status.enabled" : "common.status.disabled"), resource: t("system.base.redact_storage_policy.title"), field: t("system.base.redact_storage_policy.field.column_name"), value: row.column_name }), t("common.title.warning"), { type: "warning" }); await defBaseRedactStoragePolicyService.SetBaseRedactStoragePolicyStatus({ id: row.id, status: next }); table.value?.getTableList(); return true; } catch { return false; } }
|
|
253
264
|
/** 删除选中的入库策略。 */
|
|
@@ -233,7 +233,7 @@ const checkedBaseRole = ref<CheckedBaseRole>({});
|
|
|
233
233
|
const assignPermDialogVisible = ref(false);
|
|
234
234
|
const permKeywords = ref("");
|
|
235
235
|
const isExpanded = ref(true);
|
|
236
|
-
const parentChildLinked = ref(
|
|
236
|
+
const parentChildLinked = ref(false);
|
|
237
237
|
|
|
238
238
|
const { isDefaultTenant, tenantColumns, tenantFormField, toRequestTenantId, loadTenantOptions } = useTenantScope();
|
|
239
239
|
onMounted(() => {
|
|
@@ -231,7 +231,9 @@ async function handleOpenDialog(row?: BaseTenantProjectGrant) {
|
|
|
231
231
|
|
|
232
232
|
/** 加载目标租户项目选项。 */
|
|
233
233
|
async function loadProjectOptions() {
|
|
234
|
-
projectOptions.value = formData.tenant_id
|
|
234
|
+
projectOptions.value = formData.tenant_id
|
|
235
|
+
? (await defBaseTenantProjectService.OptionBaseTenantProject({ tenant_id: toRequestTenantId(formData.tenant_id) })).list ?? []
|
|
236
|
+
: [];
|
|
235
237
|
}
|
|
236
238
|
|
|
237
239
|
/** 根据授权类型加载岗位、角色、部门或用户主体选项。 */
|
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.
|
|
4
|
+
"version": "0.0.52",
|
|
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.
|
|
19
|
+
"@liujitcn/kratos-admin-core": "0.0.52"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
22
|
"@element-plus/icons-vue": "^2.3.1",
|
|
File without changes
|
|
File without changes
|
/package/dist/package/src/components/{tenant-project → tenant-project-grant}/ProjectGrantDialog.vue
RENAMED
|
File without changes
|