@liujitcn/kratos-admin-system 0.0.71 → 0.0.72

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.
@@ -56,7 +56,7 @@ export interface BaseRedactOutputPolicyForm {
56
56
  field_path: string;
57
57
  /** 服务名 */
58
58
  service_name: string;
59
- /** 租户ID,零表示全局策略 */
59
+ /** 租户ID,默认租户策略为全局策略 */
60
60
  tenant_id: number;
61
61
  /** 处理模式 */
62
62
  mode: BaseRedactOutputPolicyMode;
@@ -100,7 +100,7 @@ export interface BaseRedactOutputPolicy {
100
100
  message_ref: string;
101
101
  /** 返回字段路径 */
102
102
  field_path: string;
103
- /** 租户ID */
103
+ /** 租户ID,默认租户策略为全局策略 */
104
104
  tenant_id: number;
105
105
  /** 处理模式 */
106
106
  mode: BaseRedactOutputPolicyMode;
@@ -44,7 +44,7 @@ export interface BaseRedactStoragePolicyForm {
44
44
  rule_params: string;
45
45
  /** 数据源名称 */
46
46
  source_name: string;
47
- /** 租户ID,零表示全局策略 */
47
+ /** 租户ID,默认租户策略为全局策略 */
48
48
  tenant_id: number;
49
49
  /** 状态 */
50
50
  status: Status;
@@ -92,7 +92,7 @@ export interface BaseRedactStoragePolicy {
92
92
  rule_params: string;
93
93
  /** 数据源名称 */
94
94
  source_name: string;
95
- /** 租户ID */
95
+ /** 租户ID,默认租户策略为全局策略 */
96
96
  tenant_id: number;
97
97
  /** 数据表注释 */
98
98
  table_comment: string;
@@ -74,7 +74,7 @@ export interface BaseRedactOutputPolicyForm {
74
74
  field_path: string;
75
75
  /** 服务名 */
76
76
  service_name: string;
77
- /** 租户ID,零表示全局策略 */
77
+ /** 租户ID,默认租户策略为全局策略 */
78
78
  tenant_id: number;
79
79
  /** 处理模式 */
80
80
  mode: BaseRedactOutputPolicyMode;
@@ -123,7 +123,7 @@ export interface BaseRedactOutputPolicy {
123
123
  message_ref: string;
124
124
  /** 返回字段路径 */
125
125
  field_path: string;
126
- /** 租户ID */
126
+ /** 租户ID,默认租户策略为全局策略 */
127
127
  tenant_id: number;
128
128
  /** 处理模式 */
129
129
  mode: BaseRedactOutputPolicyMode;
@@ -61,7 +61,7 @@ export interface BaseRedactStoragePolicyForm {
61
61
  rule_params: string;
62
62
  /** 数据源名称 */
63
63
  source_name: string;
64
- /** 租户ID,零表示全局策略 */
64
+ /** 租户ID,默认租户策略为全局策略 */
65
65
  tenant_id: number;
66
66
  /** 状态 */
67
67
  status: Status;
@@ -114,7 +114,7 @@ export interface BaseRedactStoragePolicy {
114
114
  rule_params: string;
115
115
  /** 数据源名称 */
116
116
  source_name: string;
117
- /** 租户ID */
117
+ /** 租户ID,默认租户策略为全局策略 */
118
118
  tenant_id: number;
119
119
  /** 数据表注释 */
120
120
  table_comment: string;
@@ -220,12 +220,12 @@ const statusOptions = computed<ProFormOption[]>(() => [{ label: t("common.status
220
220
  const serviceOptions = computed<ProFormOption[]>(() => {
221
221
  const services = new Map<string, string>();
222
222
  for (const item of apiCatalog.value) {
223
- if (!isGetApi(item) || !matchesTenantScope(item)) continue;
223
+ if (!isGetApi(item)) continue;
224
224
  if (item.service_name && !services.has(item.service_name)) services.set(item.service_name, serviceLabel(item.service_name));
225
225
  }
226
226
  return [...services.entries()].sort(([left], [right]) => left.localeCompare(right)).map(([value, label]) => ({ label, value }));
227
227
  });
228
- const interfaceOptions = computed(() => apiCatalog.value.filter(item => item.service_name === form.service_name && isGetApi(item) && matchesTenantScope(item)));
228
+ const interfaceOptions = computed(() => apiCatalog.value.filter(item => item.service_name === form.service_name && isGetApi(item)));
229
229
  const serviceLabels = computed(() => new Map(apiCatalog.value.map(item => [item.service_name, item.service_desc || item.service_name])));
230
230
  const operationLabels = computed(() => new Map(apiCatalog.value.map(item => [item.operation, item.desc || item.operation])));
231
231
  const modeOptions = computed<ProFormOption[]>(() => [
@@ -235,8 +235,7 @@ const modeOptions = computed<ProFormOption[]>(() => [
235
235
  ]);
236
236
  const configuredFieldCount = computed(() => form.field_rows.filter(isConfiguredRow).length);
237
237
  const fields = computed<ProFormField[]>(() => [
238
- // 脱敏策略支持全局配置,租户选择器追加全局选项。
239
- tenantFormField({ label: t("common.field.tenant"), disabledOnEdit: true, includeGlobal: true }),
238
+ tenantFormField({ label: t("common.field.tenant"), disabledOnEdit: true }),
240
239
  { prop: "service_name", label: t("system.base.redact_output_policy.field.service_name"), component: "select", options: serviceOptions.value, props: { filterable: true, clearable: true, placeholder: t("system.base.redact_output_policy.placeholder.service"), onChange: handleServiceChange } },
241
240
  { prop: "api_id", label: t("system.base.redact_output_policy.field.api"), component: "select", options: interfaceOptions.value.map(api => ({ label: apiLabel(api), value: api.id })), props: { filterable: true, clearable: true, disabled: !form.service_name, placeholder: t("system.base.redact_output_policy.placeholder.api"), onChange: handleApiChange } },
242
241
  { prop: "field_rows", label: t("system.base.redact_output_policy.field.response_field"), component: "slot", slotName: "field_rows", colSpan: 24, visible: () => form.api_id !== undefined },
@@ -252,7 +251,7 @@ const rules = computed<FormRules>(() => ({
252
251
  const modeEnums = computed<EnumProps[]>(() => modeOptions.value);
253
252
  const columns = computed<ColumnProps[]>(() => [
254
253
  { type: "selection", width: 55 },
255
- ...tenantColumns({ label: t("common.field.tenant"), order: 1, includeGlobal: true }),
254
+ ...tenantColumns({ label: t("common.field.tenant"), order: 1 }),
256
255
  { prop: "service_name", label: t("system.base.redact_output_policy.field.service_name"), minWidth: 220, search: { el: "input" }, render: scope => serviceLabels.value.get(scope.row.service_name) ?? scope.row.service_name },
257
256
  { prop: "operation", label: t("system.base.redact_output_policy.field.api"), minWidth: 260, search: { el: "input" }, render: scope => operationLabels.value.get(scope.row.operation) ?? scope.row.operation },
258
257
  { prop: "message_ref", label: t("system.base.redact_output_policy.field.message_ref"), minWidth: 220 },
@@ -265,7 +264,7 @@ const columns = computed<ColumnProps[]>(() => [
265
264
  const headerActions = computed<HeaderActionProps[]>(() => [{ label: t("common.action.create"), type: "success", icon: CirclePlus, hidden: () => !BUTTONS.value["base:redact-output-policy:create"], onClick: () => openDialog() }, { label: t("common.action.delete"), type: "danger", icon: Delete, hidden: () => !BUTTONS.value["base:redact-output-policy:delete"], disabled: scope => !scope.selectedList.length, onClick: scope => deleteItems(scope.selectedList as BaseRedactOutputPolicy[]) }]);
266
265
 
267
266
  /** 请求出库脱敏策略分页列表。 */
268
- async function requestTable(params: PageBaseRedactOutputPolicyRequest) { const data = await defBaseRedactOutputPolicyService.PageBaseRedactOutputPolicy({ ...buildPageRequest(params), tenant_id: toRequestTenantId(params.tenant_id, true) }); return { data: { list: data.base_redact_output_policies ?? [], total: data.total } }; }
267
+ async function requestTable(params: PageBaseRedactOutputPolicyRequest) { const data = await defBaseRedactOutputPolicyService.PageBaseRedactOutputPolicy({ ...buildPageRequest(params), tenant_id: toRequestTenantId(params.tenant_id) }); return { data: { list: data.base_redact_output_policies ?? [], total: data.total } }; }
269
268
  /** 加载 API 选项。 */
270
269
  async function loadApis() { apiCatalog.value = await requestApis(); }
271
270
  /** 请求 GET API 选项,包含全局策略可用的非租户响应接口。 */
@@ -284,8 +283,6 @@ async function requestApis() {
284
283
  async function loadRules() { const rules = await requestRules(); ruleCatalog.value = rules.catalog; ruleOptions.value = rules.options; }
285
284
  /** 请求脱敏规则选项。 */
286
285
  async function requestRules() { const data = await defBaseRedactRuleService.PageBaseRedactRule({ code: "", name: "", rule_type: "", page_num: 1, page_size: 100 }); const catalog = (data.base_redact_rules ?? []).filter(item => item.rule_type !== "ENCRYPT"); return { catalog, options: catalog.map(item => ({ label: `${item.name} (${item.code})`, value: item.id, disabled: item.status !== Status.STATUS_ENABLE })) }; }
287
- /** 判断接口是否适用于当前租户范围;仅选择全局策略时允许租户响应以外的接口。 */
288
- function matchesTenantScope(item: BaseApi) { return form.tenant_id === 0 || Boolean(item.tenant_response); }
289
286
  /** 服务变更后清空接口和返回字段。 */
290
287
  function handleServiceChange(serviceName?: string) { responseFieldsRequestRevision += 1; form.service_name = serviceName ?? ""; form.api_id = undefined; form.operation = ""; form.message_ref = ""; form.field_path = ""; form.field_rows = []; }
291
288
  /** API 变更后重新加载返回字段。 */
@@ -200,8 +200,7 @@ let columnsRequestRevision = 0;
200
200
  const statusOptions = computed<ProFormOption[]>(() => [{ label: t("common.status.enabled"), value: Status.STATUS_ENABLE }, { label: t("common.status.disabled"), value: Status.STATUS_DISABLE }]);
201
201
  const configuredFieldCount = computed(() => form.column_rows.filter(row => Boolean(row.rule_id)).length);
202
202
  const fields = computed<ProFormField[]>(() => [
203
- // 脱敏策略支持全局配置,租户选择器追加全局选项。
204
- tenantFormField({ label: t("common.field.tenant"), disabledOnEdit: true, includeGlobal: true }),
203
+ tenantFormField({ label: t("common.field.tenant"), disabledOnEdit: true }),
205
204
  { prop: "source_name", label: t("system.base.redact_storage_policy.field.source_name"), component: "select", props: { filterable: true, disabled: Boolean(form.id), onChange: handleSourceChange }, options: sourceOptions.value },
206
205
  { prop: "table_name", label: t("system.base.redact_storage_policy.field.table_name"), component: "select", props: { filterable: true, disabled: Boolean(form.id) || !form.source_name, onChange: handleTableChange }, options: tableOptions.value },
207
206
  { prop: "column_rows", label: t("system.base.redact_storage_policy.field.column_name"), component: "slot", slotName: "column_rows", colSpan: 24, visible: () => Boolean(form.table_name) },
@@ -221,7 +220,7 @@ const rules = computed<FormRules>(() => ({
221
220
  }));
222
221
  const columns = computed<ColumnProps[]>(() => [
223
222
  { type: "selection", width: 55 },
224
- ...tenantColumns({ label: t("common.field.tenant"), order: 1, includeGlobal: true }),
223
+ ...tenantColumns({ label: t("common.field.tenant"), order: 1 }),
225
224
  { prop: "source_name", label: t("system.base.redact_storage_policy.field.source_name"), minWidth: 130, search: { el: "input" } },
226
225
  { prop: "table_name", label: t("system.base.redact_storage_policy.field.table_name"), minWidth: 180, search: { el: "input" }, render: scope => tableLabel(scope.row as BaseRedactStoragePolicy) },
227
226
  { prop: "column_name", label: t("system.base.redact_storage_policy.field.column_name"), minWidth: 150, search: { el: "input" } },
@@ -232,7 +231,7 @@ const columns = computed<ColumnProps[]>(() => [
232
231
  const headerActions = computed<HeaderActionProps[]>(() => [{ label: t("common.action.create"), type: "success", icon: CirclePlus, hidden: () => !BUTTONS.value["base:redact-storage-policy:create"], onClick: () => openDialog() }, { label: t("common.action.delete"), type: "danger", icon: Delete, hidden: () => !BUTTONS.value["base:redact-storage-policy:delete"], disabled: scope => !scope.selectedList.length, onClick: scope => deleteItems(scope.selectedList as BaseRedactStoragePolicy[]) }]);
233
232
 
234
233
  /** 请求入库脱敏策略分页列表。 */
235
- async function requestTable(params: PageBaseRedactStoragePolicyRequest) { const data = await defBaseRedactStoragePolicyService.PageBaseRedactStoragePolicy({ ...buildPageRequest(params), tenant_id: toRequestTenantId(params.tenant_id, true) }); return { data: { list: data.base_redact_storage_policies ?? [], total: data.total } }; }
234
+ async function requestTable(params: PageBaseRedactStoragePolicyRequest) { const data = await defBaseRedactStoragePolicyService.PageBaseRedactStoragePolicy({ ...buildPageRequest(params), tenant_id: toRequestTenantId(params.tenant_id) }); return { data: { list: data.base_redact_storage_policies ?? [], total: data.total } }; }
236
235
  /** 加载脱敏规则选项。 */
237
236
  async function loadRules() { const rules = await requestRules(); ruleCatalog.value = rules.catalog; ruleOptions.value = rules.options; }
238
237
  /** 请求脱敏规则选项。 */
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.71",
4
+ "version": "0.0.72",
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.71"
19
+ "@liujitcn/kratos-admin-core": "0.0.72"
20
20
  },
21
21
  "peerDependencies": {
22
22
  "@element-plus/icons-vue": "^2.3.1",