@liujitcn/kratos-admin-bi 0.0.0-stage → 0.1.6
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 +43 -2
- package/dist/package/declarations/index.d.ts +1 -0
- package/dist/package/declarations/src/api/bi/admin/v1/bi_card.d.ts +18 -0
- package/dist/package/declarations/src/api/bi/admin/v1/bi_card.js +46 -0
- package/dist/package/declarations/src/api/bi/admin/v1/bi_dashboard.d.ts +17 -0
- package/dist/package/declarations/src/api/bi/admin/v1/bi_dashboard.js +30 -0
- package/dist/package/declarations/src/api/bi/admin/v1/bi_query.d.ts +11 -0
- package/dist/package/declarations/src/api/bi/admin/v1/bi_query.js +41 -0
- package/dist/package/declarations/src/api/bi/admin/v1/bi_query_record.d.ts +10 -0
- package/dist/package/declarations/src/api/bi/admin/v1/bi_query_record.js +14 -0
- package/dist/package/declarations/src/api/bi/admin/v1/bi_source.d.ts +26 -0
- package/dist/package/declarations/src/api/bi/admin/v1/bi_source.js +46 -0
- package/dist/package/declarations/src/bi-core.d.ts +17 -0
- package/dist/package/declarations/src/bi-core.js +22 -0
- package/dist/package/declarations/src/bi-dashboard-schema.d.ts +31 -0
- package/dist/package/declarations/src/bi-dashboard-schema.js +39 -0
- package/dist/package/declarations/src/bi-messages.d.ts +247 -0
- package/dist/package/declarations/src/bi-messages.js +247 -0
- package/dist/package/declarations/src/bi-response.d.ts +10 -0
- package/dist/package/declarations/src/bi-response.js +33 -0
- package/dist/package/declarations/src/bi-vue.d.ts +10 -0
- package/dist/package/declarations/src/bi-vue.js +10 -0
- package/dist/package/declarations/src/card-schema.d.ts +30 -0
- package/dist/package/declarations/src/card-schema.js +87 -0
- package/dist/package/declarations/src/components/BiCardChartEditor.vue.d.ts +17 -0
- package/dist/package/declarations/src/components/BiCardChartEditor.vue.js +527 -0
- package/dist/package/declarations/src/components/BiCardFormDialog.vue.d.ts +20 -0
- package/dist/package/declarations/src/components/BiCardFormDialog.vue.js +495 -0
- package/dist/package/declarations/src/components/BiCardLibrary.vue.d.ts +3 -0
- package/dist/package/declarations/src/components/BiCardLibrary.vue.js +807 -0
- package/dist/package/declarations/src/components/BiCardVisualization.vue.d.ts +10 -0
- package/dist/package/declarations/src/components/BiCardVisualization.vue.js +97 -0
- package/dist/package/declarations/src/components/BiChart.vue.d.ts +20 -0
- package/dist/package/declarations/src/components/BiChart.vue.js +112 -0
- package/dist/package/declarations/src/components/BiDashboard.vue.d.ts +9 -0
- package/dist/package/declarations/src/components/BiDashboard.vue.js +81 -0
- package/dist/package/declarations/src/components/BiDashboardMenuDialog.vue.d.ts +12 -0
- package/dist/package/declarations/src/components/BiDashboardMenuDialog.vue.js +252 -0
- package/dist/package/declarations/src/components/BiDataCard.vue.d.ts +36 -0
- package/dist/package/declarations/src/components/BiDataCard.vue.js +372 -0
- package/dist/package/declarations/src/components/BiDesigner.vue.d.ts +17 -0
- package/dist/package/declarations/src/components/BiDesigner.vue.js +666 -0
- package/dist/package/declarations/src/components/BiSourceModelDialog.vue.d.ts +17 -0
- package/dist/package/declarations/src/components/BiSourceModelDialog.vue.js +2118 -0
- package/dist/package/declarations/src/components/BiWorkbenchPreview.vue.d.ts +7 -0
- package/dist/package/declarations/src/components/BiWorkbenchPreview.vue.js +176 -0
- package/dist/package/declarations/src/components/source-model-layout.d.ts +3 -0
- package/dist/package/declarations/src/components/source-model-layout.js +66 -0
- package/dist/package/declarations/src/dataset/index.d.ts +7 -0
- package/dist/package/declarations/src/dataset/index.js +25 -0
- package/dist/package/declarations/src/dataset/labels.d.ts +2 -0
- package/dist/package/declarations/src/dataset/labels.js +21 -0
- package/dist/package/declarations/src/dataset/transform.d.ts +20 -0
- package/dist/package/declarations/src/dataset/transform.js +173 -0
- package/dist/package/declarations/src/engine/chart-types.d.ts +14 -0
- package/dist/package/declarations/src/engine/chart-types.js +37 -0
- package/dist/package/declarations/src/engine/echarts.d.ts +16 -0
- package/dist/package/declarations/src/engine/echarts.js +491 -0
- package/dist/package/declarations/src/engine/types.d.ts +36 -0
- package/dist/package/declarations/src/engine/types.js +20 -0
- package/dist/package/declarations/src/env.d.ts +17 -0
- package/dist/package/declarations/src/env.js +67 -0
- package/dist/package/declarations/src/index.d.ts +1 -0
- package/dist/package/declarations/src/index.js +1 -0
- package/dist/package/declarations/src/locales/en-US.json +254 -0
- package/dist/package/declarations/src/locales/generated.d.ts +1021 -0
- package/dist/package/declarations/src/locales/generated.js +13 -0
- package/dist/package/declarations/src/locales/ja-JP.json +254 -0
- package/dist/package/declarations/src/locales/zh-CN.json +254 -0
- package/dist/package/declarations/src/locales/zh-TW.json +254 -0
- package/dist/package/declarations/src/module.d.ts +2 -0
- package/dist/package/declarations/src/module.js +9 -0
- package/dist/package/declarations/src/rpc/bi/admin/v1/bi_card.d.ts +145 -0
- package/dist/package/declarations/src/rpc/bi/admin/v1/bi_card.js +6 -0
- package/dist/package/declarations/src/rpc/bi/admin/v1/bi_dashboard.d.ts +107 -0
- package/dist/package/declarations/src/rpc/bi/admin/v1/bi_dashboard.js +6 -0
- package/dist/package/declarations/src/rpc/bi/admin/v1/bi_query.d.ts +157 -0
- package/dist/package/declarations/src/rpc/bi/admin/v1/bi_query.js +6 -0
- package/dist/package/declarations/src/rpc/bi/admin/v1/bi_query_record.d.ts +83 -0
- package/dist/package/declarations/src/rpc/bi/admin/v1/bi_query_record.js +15 -0
- package/dist/package/declarations/src/rpc/bi/admin/v1/bi_source.d.ts +301 -0
- package/dist/package/declarations/src/rpc/bi/admin/v1/bi_source.js +6 -0
- package/dist/package/declarations/src/rpc/common/v1/types.d.ts +60 -0
- package/dist/package/declarations/src/rpc/common/v1/types.js +6 -0
- package/dist/package/declarations/src/schema/layout.d.ts +7 -0
- package/dist/package/declarations/src/schema/layout.js +52 -0
- package/dist/package/declarations/src/schema/types.d.ts +83 -0
- package/dist/package/declarations/src/schema/types.js +1 -0
- package/dist/package/declarations/src/theme/index.d.ts +29 -0
- package/dist/package/declarations/src/theme/index.js +83 -0
- package/dist/package/declarations/src/theme/palettes.d.ts +7 -0
- package/dist/package/declarations/src/theme/palettes.js +28 -0
- package/dist/package/declarations/src/theme/presets.d.ts +73 -0
- package/dist/package/declarations/src/theme/presets.js +235 -0
- package/dist/package/declarations/src/views/card/index.vue.d.ts +3 -0
- package/dist/package/declarations/src/views/card/index.vue.js +18 -0
- package/dist/package/declarations/src/views/dashboard/index.vue.d.ts +3 -0
- package/dist/package/declarations/src/views/dashboard/index.vue.js +107 -0
- package/dist/package/declarations/src/views/designer/index.vue.d.ts +3 -0
- package/dist/package/declarations/src/views/designer/index.vue.js +332 -0
- package/dist/package/declarations/src/views/manage/index.vue.d.ts +3 -0
- package/dist/package/declarations/src/views/manage/index.vue.js +325 -0
- package/dist/package/declarations/src/views/query/index.vue.d.ts +3 -0
- package/dist/package/declarations/src/views/query/index.vue.js +876 -0
- package/dist/package/declarations/src/views/source/index.vue.d.ts +3 -0
- package/dist/package/declarations/src/views/source/index.vue.js +343 -0
- package/dist/package/declarations/src/views/workbench/index.vue.d.ts +3 -0
- package/dist/package/declarations/src/views/workbench/index.vue.js +362 -0
- package/dist/package/src/api/bi/admin/v1/bi_card.ts +67 -0
- package/dist/package/src/api/bi/admin/v1/bi_dashboard.ts +51 -0
- package/dist/package/src/api/bi/admin/v1/bi_query.ts +55 -0
- package/dist/package/src/api/bi/admin/v1/bi_query_record.ts +25 -0
- package/dist/package/src/api/bi/admin/v1/bi_source.ts +80 -0
- package/dist/package/src/bi-core.ts +43 -0
- package/dist/package/src/bi-dashboard-schema.ts +69 -0
- package/dist/package/src/bi-messages.ts +249 -0
- package/dist/package/src/bi-response.ts +39 -0
- package/dist/package/src/bi-vue.ts +13 -0
- package/dist/package/src/card-schema.ts +111 -0
- package/dist/package/src/components/BiCardChartEditor.vue +139 -0
- package/dist/package/src/components/BiCardFormDialog.vue +289 -0
- package/dist/package/src/components/BiCardLibrary.vue +310 -0
- package/dist/package/src/components/BiCardVisualization.vue +95 -0
- package/dist/package/src/components/BiChart.vue +134 -0
- package/dist/package/src/components/BiDashboard.vue +53 -0
- package/dist/package/src/components/BiDashboardMenuDialog.vue +177 -0
- package/dist/package/src/components/BiDataCard.vue +231 -0
- package/dist/package/src/components/BiDesigner.vue +287 -0
- package/dist/package/src/components/BiSourceModelDialog.vue +846 -0
- package/dist/package/src/components/BiWorkbenchPreview.vue +131 -0
- package/dist/package/src/components/source-model-layout.ts +62 -0
- package/dist/package/src/dataset/index.ts +28 -0
- package/dist/package/src/dataset/labels.ts +19 -0
- package/dist/package/src/dataset/transform.ts +189 -0
- package/dist/package/src/engine/chart-types.ts +44 -0
- package/dist/package/src/engine/echarts.ts +568 -0
- package/dist/package/src/engine/types.ts +60 -0
- package/dist/package/src/env.ts +82 -0
- package/dist/package/src/index.ts +1 -0
- package/dist/package/src/locales/en-US.json +254 -0
- package/dist/package/src/locales/generated.ts +16 -0
- package/dist/package/src/locales/ja-JP.json +254 -0
- package/dist/package/src/locales/zh-CN.json +254 -0
- package/dist/package/src/locales/zh-TW.json +254 -0
- package/dist/package/src/module.ts +12 -0
- package/dist/package/src/rpc/bi/admin/v1/bi_card.ts +169 -0
- package/dist/package/src/rpc/bi/admin/v1/bi_dashboard.ts +126 -0
- package/dist/package/src/rpc/bi/admin/v1/bi_query.ts +187 -0
- package/dist/package/src/rpc/bi/admin/v1/bi_query_record.ts +98 -0
- package/dist/package/src/rpc/bi/admin/v1/bi_source.ts +338 -0
- package/dist/package/src/rpc/common/v1/types.ts +77 -0
- package/dist/package/src/schema/layout.ts +54 -0
- package/dist/package/src/schema/types.ts +103 -0
- package/dist/package/src/styles.scss +1 -0
- package/dist/package/src/theme/index.ts +108 -0
- package/dist/package/src/theme/palettes.ts +34 -0
- package/dist/package/src/theme/presets.ts +278 -0
- package/dist/package/src/views/card/index.vue +5 -0
- package/dist/package/src/views/dashboard/index.vue +58 -0
- package/dist/package/src/views/designer/index.vue +164 -0
- package/dist/package/src/views/manage/index.vue +276 -0
- package/dist/package/src/views/query/index.vue +593 -0
- package/dist/package/src/views/source/index.vue +214 -0
- package/dist/package/src/views/workbench/index.vue +208 -0
- package/package.json +67 -3
- package/tsconfig.json +12 -0
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
/// <reference types="../../../../../../node_modules/.pnpm/@vue+language-core@3.3.13/node_modules/@vue/language-core/types/template-helpers.d.ts" />
|
|
2
|
+
/// <reference types="../../../../../../node_modules/.pnpm/@vue+language-core@3.3.13/node_modules/@vue/language-core/types/props-fallback.d.ts" />
|
|
3
|
+
import { computed, reactive, ref } from "vue";
|
|
4
|
+
import { ElMessage, ElMessageBox } from "element-plus";
|
|
5
|
+
import { CirclePlus, Connection, Delete, EditPen, SetUp } from "@element-plus/icons-vue";
|
|
6
|
+
import ProTable from "@liujitcn/kratos-admin-core/components/ProTable";
|
|
7
|
+
import FormDialog from "@liujitcn/kratos-admin-core/components/Dialog/FormDialog.vue";
|
|
8
|
+
import { useAuthButtons } from "@liujitcn/kratos-admin-core/auth";
|
|
9
|
+
import { encodeSecretFields } from "@liujitcn/kratos-admin-core/security";
|
|
10
|
+
import { buildPageRequest } from "@liujitcn/kratos-admin-core/table";
|
|
11
|
+
import { useTenantScope } from "@liujitcn/kratos-admin-core/tenant";
|
|
12
|
+
import { t } from "@liujitcn/kratos-admin-core";
|
|
13
|
+
import { defBiSourceService } from "../../api/bi/admin/v1/bi_source";
|
|
14
|
+
import BiSourceModelDialog from "../../components/BiSourceModelDialog.vue";
|
|
15
|
+
const { defineOptions, } = {};
|
|
16
|
+
defineOptions({ name: "BiSource", inheritAttrs: false });
|
|
17
|
+
const { BUTTONS } = useAuthButtons();
|
|
18
|
+
const { isDefaultTenant } = useTenantScope();
|
|
19
|
+
const table = ref();
|
|
20
|
+
const dialogRef = ref();
|
|
21
|
+
const dialog = reactive({ visible: false, editing: false });
|
|
22
|
+
const form = reactive(defaultForm());
|
|
23
|
+
const modelDialog = ref(false);
|
|
24
|
+
const modelSource = ref();
|
|
25
|
+
const editingModelConfigured = ref(false);
|
|
26
|
+
const testing = ref(false);
|
|
27
|
+
const driverOptions = [
|
|
28
|
+
{ label: "MySQL", value: "mysql" },
|
|
29
|
+
{ label: "PostgreSQL", value: "postgres" },
|
|
30
|
+
{ label: "Doris", value: "doris" },
|
|
31
|
+
{ label: "TiDB", value: "tidb" }
|
|
32
|
+
];
|
|
33
|
+
const driverDefaultPorts = { mysql: 3306, postgres: 5432, doris: 9030, tidb: 4000 };
|
|
34
|
+
const fields = computed(() => [
|
|
35
|
+
{ prop: "code", label: t("bi.source.field.code"), component: "input", colSpan: 12, props: { maxlength: 128, disabled: dialog.editing } },
|
|
36
|
+
{ prop: "name", label: t("bi.source.field.name"), component: "input", colSpan: 12, props: { maxlength: 128 } },
|
|
37
|
+
{ prop: "description", label: t("bi.source.field.description"), component: "input", colSpan: 24, props: { maxlength: 500 } },
|
|
38
|
+
{
|
|
39
|
+
prop: "source_name",
|
|
40
|
+
label: t("bi.source.field.source_name"),
|
|
41
|
+
component: "input",
|
|
42
|
+
colSpan: 24,
|
|
43
|
+
visible: () => isDefaultTenant.value,
|
|
44
|
+
props: { maxlength: 64, placeholder: t("bi.source.placeholder.source_name") }
|
|
45
|
+
},
|
|
46
|
+
{ prop: "driver", label: t("bi.source.field.driver"), component: "select", colSpan: 12, options: driverOptions, props: { onChange: handleDriverChange } },
|
|
47
|
+
...(!form.source_name ? [
|
|
48
|
+
{ prop: "host", label: t("bi.source.field.host"), component: "input", colSpan: 12, props: { maxlength: 255 } },
|
|
49
|
+
{ prop: "port", label: t("bi.source.field.port"), component: "input-number", colSpan: 12, props: { min: 1, max: 65535, precision: 0, controlsPosition: "right" } },
|
|
50
|
+
{ prop: "database_name", label: t("bi.source.field.database_name"), component: "input", colSpan: 12, props: { maxlength: 128 } },
|
|
51
|
+
{ prop: "username", label: t("bi.source.field.username"), component: "input", colSpan: 12, props: { maxlength: 128, autocomplete: "off" } },
|
|
52
|
+
{ prop: "password", label: t("bi.source.field.password"), component: "input", colSpan: 12, secret: { resource: "bi_source", field: "password" }, props: { type: "password", showPassword: true, maxlength: 512, autocomplete: "new-password", placeholder: form.password_configured ? t("bi.source.placeholder.keep_password") : t("bi.source.placeholder.password") } },
|
|
53
|
+
{ prop: "ssl_mode", label: t("bi.source.field.ssl_mode"), component: "input", colSpan: 12, props: { maxlength: 32, placeholder: "disable" } }
|
|
54
|
+
] : []),
|
|
55
|
+
{ prop: "schema_name", label: t("bi.source.field.schema_name"), component: "input", colSpan: 12, props: { maxlength: 128 } },
|
|
56
|
+
{ prop: "max_rows", label: t("bi.source.field.max_rows"), component: "input-number", colSpan: 12, props: { min: 1, max: 1000, precision: 0, controlsPosition: "right" } }
|
|
57
|
+
]);
|
|
58
|
+
const rules = computed(() => ({
|
|
59
|
+
code: [{ required: true, message: t("bi.source.validation.code"), trigger: "blur" }],
|
|
60
|
+
name: [{ required: true, message: t("bi.source.validation.name"), trigger: "blur" }],
|
|
61
|
+
driver: [{ required: true, message: t("bi.source.validation.driver"), trigger: "change" }],
|
|
62
|
+
host: [{ required: !form.source_name, message: t("bi.source.validation.host"), trigger: "blur" }],
|
|
63
|
+
database_name: [{ required: !form.source_name, message: t("bi.source.validation.database_name"), trigger: "blur" }],
|
|
64
|
+
username: [{ required: !form.source_name, message: t("bi.source.validation.username"), trigger: "blur" }],
|
|
65
|
+
password: [{ required: !form.source_name && !dialog.editing, message: t("bi.source.validation.password"), trigger: "blur" }]
|
|
66
|
+
}));
|
|
67
|
+
const columns = computed(() => [
|
|
68
|
+
{ prop: "code", label: t("bi.source.field.code"), minWidth: 150, search: { el: "input" } },
|
|
69
|
+
{ prop: "name", label: t("bi.source.field.name"), minWidth: 140 },
|
|
70
|
+
{ prop: "driver", label: t("bi.source.field.driver"), width: 110 },
|
|
71
|
+
{ prop: "source_name", label: t("bi.source.field.connection"), minWidth: 190, render: ({ row }) => row.host ? `${row.host}:${row.port}/${row.database_name}` : row.source_name },
|
|
72
|
+
{ prop: "table_count", label: t("bi.source.model.field.tables"), width: 120, render: ({ row }) => row.model_configured ? String(row.table_count) : t("bi.source.value.not_configured") },
|
|
73
|
+
{ prop: "password_configured", label: t("bi.source.field.password"), width: 120, render: ({ row }) => row.password_configured ? t("bi.source.value.configured") : t("bi.source.value.not_configured") },
|
|
74
|
+
{ prop: "status", label: t("common.field.status"), width: 100, cellType: "status", statusProps: { activeValue: 1, inactiveValue: 2, activeText: t("common.status.enabled"), inactiveText: t("common.status.disabled"), disabled: scope => !BUTTONS.value["bi:source:status"] || !scope.row.model_configured, beforeChange: async (scope) => { await setStatus(scope.row); return true; } } },
|
|
75
|
+
{ prop: "updated_at", label: t("common.field.updated_at"), minWidth: 175 },
|
|
76
|
+
{ prop: "operation", label: t("common.field.operation"), cellType: "actions", fixed: "right", width: 250, actions: [
|
|
77
|
+
{ label: t("bi.source.model.action.configure"), link: true, icon: SetUp, hidden: () => !BUTTONS.value["bi:source:update"], onClick: scope => openModel(scope.row.id) },
|
|
78
|
+
{ label: t("common.action.edit"), link: true, icon: EditPen, hidden: () => !BUTTONS.value["bi:source:update"], onClick: scope => openDialog(scope.row.id) },
|
|
79
|
+
{ label: t("common.action.delete"), type: "danger", link: true, icon: Delete, hidden: () => !BUTTONS.value["bi:source:delete"], onClick: scope => remove(scope.row) }
|
|
80
|
+
] }
|
|
81
|
+
]);
|
|
82
|
+
const headerActions = computed(() => [{ label: t("common.action.create"), type: "primary", icon: CirclePlus, hidden: () => !BUTTONS.value["bi:source:create"], onClick: () => openDialog() }]);
|
|
83
|
+
/** 创建空的数据源连接表单。 */
|
|
84
|
+
function defaultForm() {
|
|
85
|
+
return { id: 0, code: "", name: "", description: "", source_name: "", driver: "mysql", host: "", port: 3306, database_name: "", username: "", password: undefined, password_configured: false, ssl_mode: "disable", schema_name: "", max_rows: 100, status: 2 };
|
|
86
|
+
}
|
|
87
|
+
/** 根据所选数据库驱动更新默认端口。 */
|
|
88
|
+
function handleDriverChange(driver) {
|
|
89
|
+
form.port = driverDefaultPorts[driver] ?? 3306;
|
|
90
|
+
}
|
|
91
|
+
/** 请求数据源列表。 */
|
|
92
|
+
async function requestTable(params) {
|
|
93
|
+
const data = await defBiSourceService.PageBiSource(buildPageRequest(params));
|
|
94
|
+
return { data: { list: data.sources ?? [], total: data.total } };
|
|
95
|
+
}
|
|
96
|
+
/** 打开连接表单,普通租户的已有宿主绑定需要改为独立连接。 */
|
|
97
|
+
async function openDialog(id) {
|
|
98
|
+
const source = id ? await defBiSourceService.GetBiSource({ id }) : undefined;
|
|
99
|
+
await dialogRef.value?.open({
|
|
100
|
+
load: () => source,
|
|
101
|
+
commit: value => {
|
|
102
|
+
Object.assign(form, defaultForm(), value ?? {});
|
|
103
|
+
if (!isDefaultTenant.value)
|
|
104
|
+
form.source_name = "";
|
|
105
|
+
dialog.editing = Boolean(id);
|
|
106
|
+
editingModelConfigured.value = Boolean(value?.model_configured);
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
/** 保存连接配置,连接变化导致模型失效时重新配置。 */
|
|
111
|
+
async function submit() {
|
|
112
|
+
const valid = await dialogRef.value?.validate();
|
|
113
|
+
if (!valid)
|
|
114
|
+
return;
|
|
115
|
+
const encoded = await encodeSecretFields(fields.value, form);
|
|
116
|
+
const { password_configured: _passwordConfigured, ...source } = encoded;
|
|
117
|
+
const result = dialog.editing ? await defBiSourceService.UpdateBiSource({ source }) : await defBiSourceService.CreateBiSource({ source });
|
|
118
|
+
ElMessage.success(t(dialog.editing ? "bi.source.message.update_success" : "bi.source.message.create_success"));
|
|
119
|
+
dialog.visible = false;
|
|
120
|
+
resetForm();
|
|
121
|
+
table.value?.getTableList();
|
|
122
|
+
if (editingModelConfigured.value && !result.model_configured)
|
|
123
|
+
await openModel(result);
|
|
124
|
+
}
|
|
125
|
+
/** 测试表单中的连接,不要求先选择表。 */
|
|
126
|
+
async function testSource() {
|
|
127
|
+
const valid = await dialogRef.value?.validate();
|
|
128
|
+
if (!valid)
|
|
129
|
+
return;
|
|
130
|
+
testing.value = true;
|
|
131
|
+
try {
|
|
132
|
+
const encoded = await encodeSecretFields(fields.value, form);
|
|
133
|
+
const { password_configured: _passwordConfigured, ...source } = encoded;
|
|
134
|
+
const result = await defBiSourceService.TestBiSource({ source });
|
|
135
|
+
ElMessage[result.success ? "success" : "warning"](result.message || t(result.success ? "bi.source.message.test_success" : "bi.source.message.test_failed"));
|
|
136
|
+
}
|
|
137
|
+
finally {
|
|
138
|
+
testing.value = false;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
/** 打开表结构与关系模型配置。 */
|
|
142
|
+
async function openModel(sourceOrID) {
|
|
143
|
+
modelSource.value = typeof sourceOrID === "number" ? await defBiSourceService.GetBiSource({ id: sourceOrID }) : sourceOrID;
|
|
144
|
+
modelDialog.value = true;
|
|
145
|
+
}
|
|
146
|
+
/** 保存模型后刷新连接列表。 */
|
|
147
|
+
function handleModelSaved(source) {
|
|
148
|
+
modelSource.value = source;
|
|
149
|
+
table.value?.getTableList();
|
|
150
|
+
}
|
|
151
|
+
/** 切换数据源启用状态。 */
|
|
152
|
+
async function setStatus(row) {
|
|
153
|
+
await defBiSourceService.SetBiSourceStatus({ id: row.id, status: row.status === 1 ? 2 : 1 });
|
|
154
|
+
table.value?.getTableList();
|
|
155
|
+
}
|
|
156
|
+
/** 删除数据源连接。 */
|
|
157
|
+
async function remove(row) {
|
|
158
|
+
await ElMessageBox.confirm(t("bi.source.dialog.delete_confirm", { name: row.name }), t("common.title.warning"));
|
|
159
|
+
await defBiSourceService.DeleteBiSource({ id: row.id });
|
|
160
|
+
ElMessage.success(t("bi.source.message.delete_success"));
|
|
161
|
+
table.value?.getTableList();
|
|
162
|
+
}
|
|
163
|
+
/** 重置表单和校验状态。 */
|
|
164
|
+
function resetForm() {
|
|
165
|
+
Object.assign(form, defaultForm());
|
|
166
|
+
dialog.editing = false;
|
|
167
|
+
editingModelConfigured.value = false;
|
|
168
|
+
}
|
|
169
|
+
const __VLS_ctx = {};
|
|
170
|
+
let __VLS_components;
|
|
171
|
+
let __VLS_intrinsics;
|
|
172
|
+
let __VLS_directives;
|
|
173
|
+
void __VLS_ctx, __VLS_components, __VLS_intrinsics, __VLS_directives;
|
|
174
|
+
// @ts-ignore
|
|
175
|
+
__VLS_withDotValue(dialog, {});
|
|
176
|
+
__VLS_asFunctionalElement1(__VLS_intrinsics.div, __VLS_intrinsics.div)({
|
|
177
|
+
...{ class: "table-box" },
|
|
178
|
+
});
|
|
179
|
+
/** @type {__VLS_StyleScopedClasses['table-box']} */ ;
|
|
180
|
+
let __VLS_0;
|
|
181
|
+
/** @ts-ignore @type { | typeof __VLS_components.ProTable} */
|
|
182
|
+
ProTable;
|
|
183
|
+
// @ts-ignore
|
|
184
|
+
const __VLS_1 = __VLS_asFunctionalComponent1(__VLS_0, new __VLS_0({
|
|
185
|
+
// @ts-ignore
|
|
186
|
+
ref: "table", rowKey: "id", columns: (__VLS_unwrap(columns, {})), headerActions: (__VLS_unwrap(headerActions, {})), requestApi: (requestTable),
|
|
187
|
+
}));
|
|
188
|
+
const __VLS_2 = __VLS_1({
|
|
189
|
+
ref: "table",
|
|
190
|
+
rowKey: "id",
|
|
191
|
+
columns: (__VLS_unwrap(columns, {})),
|
|
192
|
+
headerActions: (__VLS_unwrap(headerActions, {})),
|
|
193
|
+
requestApi: (requestTable),
|
|
194
|
+
}, ...__VLS_functionalComponentArgsRest(__VLS_1));
|
|
195
|
+
const __VLS_5 = FormDialog || FormDialog;
|
|
196
|
+
// @ts-ignore
|
|
197
|
+
const __VLS_6 = __VLS_asFunctionalComponent1(__VLS_5, new __VLS_5({
|
|
198
|
+
// @ts-ignore
|
|
199
|
+
...{ 'onConfirm': {} }, ...{ 'onClose': {} }, ref: "dialogRef", modelValue: (dialog.value.visible), title: (dialog.value.editing ? __VLS_unwrap(t, {})('bi.source.title.edit') : __VLS_unwrap(t, {})('bi.source.title.create')), width: "min(1040px, 96vw)", labelWidth: "10em", model: (__VLS_unwrap(form, {})), fields: (__VLS_unwrap(fields, {})), rules: (__VLS_unwrap(rules, {})), formProps: ({ disabled: __VLS_unwrap(testing, {}) }),
|
|
200
|
+
}));
|
|
201
|
+
const __VLS_7 = __VLS_6({
|
|
202
|
+
...{ 'onConfirm': {} },
|
|
203
|
+
...{ 'onClose': {} },
|
|
204
|
+
ref: "dialogRef",
|
|
205
|
+
modelValue: (dialog.value.visible),
|
|
206
|
+
title: (dialog.value.editing ? __VLS_unwrap(t, {})('bi.source.title.edit') : __VLS_unwrap(t, {})('bi.source.title.create')),
|
|
207
|
+
width: "min(1040px, 96vw)",
|
|
208
|
+
labelWidth: "10em",
|
|
209
|
+
model: (__VLS_unwrap(form, {})),
|
|
210
|
+
fields: (__VLS_unwrap(fields, {})),
|
|
211
|
+
rules: (__VLS_unwrap(rules, {})),
|
|
212
|
+
formProps: ({ disabled: __VLS_unwrap(testing, {}) }),
|
|
213
|
+
}, ...__VLS_functionalComponentArgsRest(__VLS_6));
|
|
214
|
+
let __VLS_10;
|
|
215
|
+
const __VLS_11 = {
|
|
216
|
+
/** @type {typeof __VLS_10.confirm} */
|
|
217
|
+
onConfirm: (submit),
|
|
218
|
+
};
|
|
219
|
+
void __VLS_11;
|
|
220
|
+
const __VLS_12 = {
|
|
221
|
+
/** @type {typeof __VLS_10.close} */
|
|
222
|
+
onClose: (resetForm),
|
|
223
|
+
};
|
|
224
|
+
void __VLS_12;
|
|
225
|
+
const { default: __VLS_13 } = __VLS_nonNull(__VLS_8.slots);
|
|
226
|
+
{
|
|
227
|
+
const { footer: __VLS_14 } = __VLS_nonNull(__VLS_8.slots);
|
|
228
|
+
__VLS_asFunctionalElement1(__VLS_intrinsics.div, __VLS_intrinsics.div)({
|
|
229
|
+
...{ class: "dialog-footer" },
|
|
230
|
+
});
|
|
231
|
+
/** @type {__VLS_StyleScopedClasses['dialog-footer']} */ ;
|
|
232
|
+
let __VLS_15;
|
|
233
|
+
/** @ts-ignore @type { | typeof __VLS_components.elButton | typeof __VLS_components.ElButton | typeof __VLS_components['el-button'] | typeof __VLS_components.elButton | typeof __VLS_components.ElButton | typeof __VLS_components['el-button']} */
|
|
234
|
+
elButton;
|
|
235
|
+
// @ts-ignore
|
|
236
|
+
const __VLS_16 = __VLS_asFunctionalComponent1(__VLS_15, new __VLS_15({
|
|
237
|
+
// @ts-ignore
|
|
238
|
+
...{ 'onClick': {} }, disabled: (__VLS_unwrap(testing, {})),
|
|
239
|
+
}));
|
|
240
|
+
const __VLS_17 = __VLS_16({
|
|
241
|
+
...{ 'onClick': {} },
|
|
242
|
+
disabled: (__VLS_unwrap(testing, {})),
|
|
243
|
+
}, ...__VLS_functionalComponentArgsRest(__VLS_16));
|
|
244
|
+
let __VLS_20;
|
|
245
|
+
const __VLS_21 = {
|
|
246
|
+
/** @type {typeof __VLS_20.click} */
|
|
247
|
+
onClick: // @ts-ignore
|
|
248
|
+
(...[$event]) => {
|
|
249
|
+
void $event;
|
|
250
|
+
return (dialog.value.visible = false);
|
|
251
|
+
// @ts-ignore
|
|
252
|
+
[columns, headerActions, dialog, dialog, dialog, t, t, form, fields, rules, testing, testing,];
|
|
253
|
+
},
|
|
254
|
+
};
|
|
255
|
+
void __VLS_21;
|
|
256
|
+
const { default: __VLS_22 } = __VLS_nonNull(__VLS_18.slots);
|
|
257
|
+
(__VLS_unwrap(t, {})("common.action.cancel"));
|
|
258
|
+
// @ts-ignore
|
|
259
|
+
[t,];
|
|
260
|
+
var __VLS_18;
|
|
261
|
+
var __VLS_19;
|
|
262
|
+
let __VLS_23;
|
|
263
|
+
/** @ts-ignore @type { | typeof __VLS_components.elButton | typeof __VLS_components.ElButton | typeof __VLS_components['el-button'] | typeof __VLS_components.elButton | typeof __VLS_components.ElButton | typeof __VLS_components['el-button']} */
|
|
264
|
+
elButton;
|
|
265
|
+
// @ts-ignore
|
|
266
|
+
const __VLS_24 = __VLS_asFunctionalComponent1(__VLS_23, new __VLS_23({
|
|
267
|
+
// @ts-ignore
|
|
268
|
+
...{ 'onClick': {} }, type: "primary", plain: true, icon: (__VLS_unwrap(Connection, {})), loading: (__VLS_unwrap(testing, {})),
|
|
269
|
+
}));
|
|
270
|
+
const __VLS_25 = __VLS_24({
|
|
271
|
+
...{ 'onClick': {} },
|
|
272
|
+
type: "primary",
|
|
273
|
+
plain: true,
|
|
274
|
+
icon: (__VLS_unwrap(Connection, {})),
|
|
275
|
+
loading: (__VLS_unwrap(testing, {})),
|
|
276
|
+
}, ...__VLS_functionalComponentArgsRest(__VLS_24));
|
|
277
|
+
let __VLS_28;
|
|
278
|
+
const __VLS_29 = {
|
|
279
|
+
/** @type {typeof __VLS_28.click} */
|
|
280
|
+
onClick: (testSource),
|
|
281
|
+
};
|
|
282
|
+
void __VLS_29;
|
|
283
|
+
const { default: __VLS_30 } = __VLS_nonNull(__VLS_26.slots);
|
|
284
|
+
(__VLS_unwrap(t, {})("bi.source.action.test"));
|
|
285
|
+
// @ts-ignore
|
|
286
|
+
[t, testing, Connection,];
|
|
287
|
+
var __VLS_26;
|
|
288
|
+
var __VLS_27;
|
|
289
|
+
let __VLS_31;
|
|
290
|
+
/** @ts-ignore @type { | typeof __VLS_components.elButton | typeof __VLS_components.ElButton | typeof __VLS_components['el-button'] | typeof __VLS_components.elButton | typeof __VLS_components.ElButton | typeof __VLS_components['el-button']} */
|
|
291
|
+
elButton;
|
|
292
|
+
// @ts-ignore
|
|
293
|
+
const __VLS_32 = __VLS_asFunctionalComponent1(__VLS_31, new __VLS_31({
|
|
294
|
+
// @ts-ignore
|
|
295
|
+
...{ 'onClick': {} }, type: "primary", disabled: (__VLS_unwrap(testing, {})),
|
|
296
|
+
}));
|
|
297
|
+
const __VLS_33 = __VLS_32({
|
|
298
|
+
...{ 'onClick': {} },
|
|
299
|
+
type: "primary",
|
|
300
|
+
disabled: (__VLS_unwrap(testing, {})),
|
|
301
|
+
}, ...__VLS_functionalComponentArgsRest(__VLS_32));
|
|
302
|
+
let __VLS_36;
|
|
303
|
+
const __VLS_37 = {
|
|
304
|
+
/** @type {typeof __VLS_36.click} */
|
|
305
|
+
onClick: (submit),
|
|
306
|
+
};
|
|
307
|
+
void __VLS_37;
|
|
308
|
+
const { default: __VLS_38 } = __VLS_nonNull(__VLS_34.slots);
|
|
309
|
+
(__VLS_unwrap(t, {})("common.action.confirm"));
|
|
310
|
+
// @ts-ignore
|
|
311
|
+
[t, testing,];
|
|
312
|
+
var __VLS_34;
|
|
313
|
+
var __VLS_35;
|
|
314
|
+
// @ts-ignore
|
|
315
|
+
[];
|
|
316
|
+
}
|
|
317
|
+
// @ts-ignore
|
|
318
|
+
[];
|
|
319
|
+
var __VLS_8;
|
|
320
|
+
var __VLS_9;
|
|
321
|
+
const __VLS_39 = BiSourceModelDialog;
|
|
322
|
+
// @ts-ignore
|
|
323
|
+
const __VLS_40 = __VLS_asFunctionalComponent1(__VLS_39, new __VLS_39({
|
|
324
|
+
// @ts-ignore
|
|
325
|
+
...{ 'onSaved': {} }, modelValue: (__VLS_unwrap(modelDialog, {})), source: (__VLS_unwrap(modelSource, {})),
|
|
326
|
+
}));
|
|
327
|
+
const __VLS_41 = __VLS_40({
|
|
328
|
+
...{ 'onSaved': {} },
|
|
329
|
+
modelValue: (__VLS_unwrap(modelDialog, {})),
|
|
330
|
+
source: (__VLS_unwrap(modelSource, {})),
|
|
331
|
+
}, ...__VLS_functionalComponentArgsRest(__VLS_40));
|
|
332
|
+
let __VLS_44;
|
|
333
|
+
const __VLS_45 = {
|
|
334
|
+
/** @type {typeof __VLS_44.saved} */
|
|
335
|
+
onSaved: (handleModelSaved),
|
|
336
|
+
};
|
|
337
|
+
void __VLS_45;
|
|
338
|
+
var __VLS_42;
|
|
339
|
+
var __VLS_43;
|
|
340
|
+
// @ts-ignore
|
|
341
|
+
[modelDialog, modelSource,];
|
|
342
|
+
const __VLS_export = (await import('vue')).defineComponent({});
|
|
343
|
+
export default {};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|