@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,107 @@
|
|
|
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, ref, watch, onBeforeUnmount } from "vue";
|
|
4
|
+
import { useRoute } from "vue-router";
|
|
5
|
+
import { t } from "@liujitcn/kratos-admin-core";
|
|
6
|
+
import BiDashboard from "../../components/BiDashboard.vue";
|
|
7
|
+
import { parseDashboardLayout, dashboardResults } from "../../bi-dashboard-schema";
|
|
8
|
+
import { defBiDashboardService } from "../../api/bi/admin/v1/bi_dashboard";
|
|
9
|
+
const { defineOptions, } = {};
|
|
10
|
+
defineOptions({ name: "BiDashboard", inheritAttrs: false });
|
|
11
|
+
const route = useRoute();
|
|
12
|
+
const id = computed(() => {
|
|
13
|
+
return Number(route.params.id || route.path.match(/^\/reports\/dashboard\/([1-9]\d*)$/)?.[1] || 0);
|
|
14
|
+
});
|
|
15
|
+
const layout = ref({ schemaVersion: 3, name: "", cards: [] });
|
|
16
|
+
const results = ref(new Map());
|
|
17
|
+
const loading = ref(false), error = ref("");
|
|
18
|
+
let request = 0;
|
|
19
|
+
/** 从地址路径读取仪表盘编号,忽略切换页面前的迟到结果。 */
|
|
20
|
+
async function load() {
|
|
21
|
+
const current = ++request;
|
|
22
|
+
error.value = "";
|
|
23
|
+
results.value = new Map();
|
|
24
|
+
layout.value = { schemaVersion: 3, name: "", cards: [] };
|
|
25
|
+
if (!Number.isSafeInteger(id.value) || id.value <= 0) {
|
|
26
|
+
error.value = t("bi.dashboard.invalid_id");
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
loading.value = true;
|
|
30
|
+
try {
|
|
31
|
+
const result = await defBiDashboardService.GetBiDashboardData({ id: id.value, version: 0 });
|
|
32
|
+
if (current !== request)
|
|
33
|
+
return;
|
|
34
|
+
layout.value = parseDashboardLayout(result.schema_json);
|
|
35
|
+
results.value = dashboardResults(result);
|
|
36
|
+
}
|
|
37
|
+
catch (cause) {
|
|
38
|
+
if (current === request)
|
|
39
|
+
error.value = cause instanceof Error ? cause.message : t("bi.query.error");
|
|
40
|
+
}
|
|
41
|
+
finally {
|
|
42
|
+
if (current === request)
|
|
43
|
+
loading.value = false;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
watch(id, () => void load(), { immediate: true });
|
|
47
|
+
onBeforeUnmount(() => request++);
|
|
48
|
+
const __VLS_ctx = {};
|
|
49
|
+
let __VLS_components;
|
|
50
|
+
let __VLS_intrinsics;
|
|
51
|
+
let __VLS_directives;
|
|
52
|
+
void __VLS_ctx, __VLS_components, __VLS_intrinsics, __VLS_directives;
|
|
53
|
+
// @ts-ignore
|
|
54
|
+
__VLS_withDotValue(error, {});
|
|
55
|
+
// @ts-ignore
|
|
56
|
+
__VLS_withDotValue(loading, {});
|
|
57
|
+
void {};
|
|
58
|
+
__VLS_asFunctionalElement1(__VLS_intrinsics.main, __VLS_intrinsics.main)({
|
|
59
|
+
...{ class: "bi-dashboard-page" },
|
|
60
|
+
});
|
|
61
|
+
/** @type {__VLS_StyleScopedClasses['bi-dashboard-page']} */ ;
|
|
62
|
+
if (error.value) {
|
|
63
|
+
let __VLS_0;
|
|
64
|
+
/** @ts-ignore @type { | typeof __VLS_components.elAlert | typeof __VLS_components.ElAlert | typeof __VLS_components['el-alert']} */
|
|
65
|
+
elAlert;
|
|
66
|
+
// @ts-ignore
|
|
67
|
+
const __VLS_1 = __VLS_asFunctionalComponent1(__VLS_0, new __VLS_0({
|
|
68
|
+
// @ts-ignore
|
|
69
|
+
title: (error.value), type: "error", showIcon: true, closable: (false),
|
|
70
|
+
}));
|
|
71
|
+
const __VLS_2 = __VLS_1({
|
|
72
|
+
title: (error.value),
|
|
73
|
+
type: "error",
|
|
74
|
+
showIcon: true,
|
|
75
|
+
closable: (false),
|
|
76
|
+
}, ...__VLS_functionalComponentArgsRest(__VLS_1));
|
|
77
|
+
}
|
|
78
|
+
else if (loading.value) {
|
|
79
|
+
let __VLS_5;
|
|
80
|
+
/** @ts-ignore @type { | typeof __VLS_components.elSkeleton | typeof __VLS_components.ElSkeleton | typeof __VLS_components['el-skeleton']} */
|
|
81
|
+
elSkeleton;
|
|
82
|
+
// @ts-ignore
|
|
83
|
+
const __VLS_6 = __VLS_asFunctionalComponent1(__VLS_5, new __VLS_5({
|
|
84
|
+
// @ts-ignore
|
|
85
|
+
rows: (8), animated: true,
|
|
86
|
+
}));
|
|
87
|
+
const __VLS_7 = __VLS_6({
|
|
88
|
+
rows: (8),
|
|
89
|
+
animated: true,
|
|
90
|
+
}, ...__VLS_functionalComponentArgsRest(__VLS_6));
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
const __VLS_10 = BiDashboard;
|
|
94
|
+
// @ts-ignore
|
|
95
|
+
const __VLS_11 = __VLS_asFunctionalComponent1(__VLS_10, new __VLS_10({
|
|
96
|
+
// @ts-ignore
|
|
97
|
+
schema: (__VLS_unwrap(layout, {})), results: (__VLS_unwrap(results, {})),
|
|
98
|
+
}));
|
|
99
|
+
const __VLS_12 = __VLS_11({
|
|
100
|
+
schema: (__VLS_unwrap(layout, {})),
|
|
101
|
+
results: (__VLS_unwrap(results, {})),
|
|
102
|
+
}, ...__VLS_functionalComponentArgsRest(__VLS_11));
|
|
103
|
+
}
|
|
104
|
+
// @ts-ignore
|
|
105
|
+
[error, error, loading, layout, results,];
|
|
106
|
+
const __VLS_export = (await import('vue')).defineComponent({});
|
|
107
|
+
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;
|
|
@@ -0,0 +1,332 @@
|
|
|
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, ref, watch } from "vue";
|
|
4
|
+
import { useRoute, useRouter } from "vue-router";
|
|
5
|
+
import { t } from "@liujitcn/kratos-admin-core";
|
|
6
|
+
import BiDesigner from "../../components/BiDesigner.vue";
|
|
7
|
+
import BiCardFormDialog from "../../components/BiCardFormDialog.vue";
|
|
8
|
+
import { parseDashboardLayout } from "../../bi-dashboard-schema";
|
|
9
|
+
import { defBiDashboardService } from "../../api/bi/admin/v1/bi_dashboard";
|
|
10
|
+
import { defBiCardService } from "../../api/bi/admin/v1/bi_card";
|
|
11
|
+
import { defBiQueryService } from "../../api/bi/admin/v1/bi_query";
|
|
12
|
+
const { defineOptions, } = {};
|
|
13
|
+
defineOptions({ name: "BiDesignerPage", inheritAttrs: false });
|
|
14
|
+
const icons = { ArrowLeft, Document, Promotion };
|
|
15
|
+
const route = useRoute(), router = useRouter(), id = computed(() => Number(route.query.id || 0));
|
|
16
|
+
const dashboard = ref(), cards = ref([]), sources = ref([]), layout = ref({ schemaVersion: 3, name: "", cards: [] });
|
|
17
|
+
const loading = ref(false), saving = ref(false), cardOpen = ref(false), editingCard = ref();
|
|
18
|
+
let request = 0;
|
|
19
|
+
/** 编辑入口按仪表盘编号切换,卡片来自当前用户可见的统一卡片库。 */
|
|
20
|
+
async function load() {
|
|
21
|
+
const current = ++request;
|
|
22
|
+
dashboard.value = undefined;
|
|
23
|
+
if (!id.value)
|
|
24
|
+
return;
|
|
25
|
+
loading.value = true;
|
|
26
|
+
try {
|
|
27
|
+
const [record, dictionary] = await Promise.all([
|
|
28
|
+
defBiDashboardService.GetBiDashboard({ id: id.value }),
|
|
29
|
+
defBiQueryService.ListBiSources({})
|
|
30
|
+
]);
|
|
31
|
+
if (current !== request)
|
|
32
|
+
return;
|
|
33
|
+
if (!record.can_edit)
|
|
34
|
+
throw new Error(t("bi.dashboard.read_only"));
|
|
35
|
+
dashboard.value = record;
|
|
36
|
+
layout.value = { ...parseDashboardLayout(record.schema_json), name: record.name };
|
|
37
|
+
sources.value = dictionary.sources;
|
|
38
|
+
await loadCards();
|
|
39
|
+
}
|
|
40
|
+
catch (cause) {
|
|
41
|
+
ElMessage.error(cause instanceof Error ? cause.message : t("bi.query.error"));
|
|
42
|
+
}
|
|
43
|
+
finally {
|
|
44
|
+
if (current === request)
|
|
45
|
+
loading.value = false;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/** 分页加载可见卡片,避免设计器只能使用第一页的图表。 */
|
|
49
|
+
async function loadCards() {
|
|
50
|
+
const result = [];
|
|
51
|
+
let page = 1;
|
|
52
|
+
while (true) {
|
|
53
|
+
const data = await defBiCardService.PageBiCard({
|
|
54
|
+
name: "",
|
|
55
|
+
source_code: "",
|
|
56
|
+
category: "",
|
|
57
|
+
search_source_codes: [],
|
|
58
|
+
page_num: page,
|
|
59
|
+
page_size: 100
|
|
60
|
+
});
|
|
61
|
+
result.push(...data.cards);
|
|
62
|
+
if (result.length >= data.total || !data.cards.length)
|
|
63
|
+
break;
|
|
64
|
+
page++;
|
|
65
|
+
}
|
|
66
|
+
cards.value = result;
|
|
67
|
+
}
|
|
68
|
+
/** 新建与编辑统一复用卡片表单。 */
|
|
69
|
+
function editCard(card) {
|
|
70
|
+
if (!card) {
|
|
71
|
+
void router.push("/bi/query");
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
editingCard.value = card;
|
|
75
|
+
cardOpen.value = true;
|
|
76
|
+
}
|
|
77
|
+
/** 保存引用布局,发布时由服务端生成独立卡片配置快照。 */
|
|
78
|
+
async function save(publish) {
|
|
79
|
+
if (!dashboard.value || saving.value)
|
|
80
|
+
return;
|
|
81
|
+
saving.value = true;
|
|
82
|
+
try {
|
|
83
|
+
const saved = await defBiDashboardService.SaveBiDashboard({
|
|
84
|
+
dashboard: { ...dashboard.value, name: layout.value.name, schema_json: JSON.stringify(layout.value) }
|
|
85
|
+
});
|
|
86
|
+
dashboard.value = saved;
|
|
87
|
+
if (publish) {
|
|
88
|
+
dashboard.value = await defBiDashboardService.PublishBiDashboard({ id: saved.id, version: saved.draft_version });
|
|
89
|
+
void router.push(`/bi/dashboard/${saved.id}`);
|
|
90
|
+
}
|
|
91
|
+
ElMessage.success(t(publish ? "bi.dashboard.publish_success" : "bi.dashboard.save_success"));
|
|
92
|
+
}
|
|
93
|
+
catch (cause) {
|
|
94
|
+
ElMessage.error(cause instanceof Error ? cause.message : t("bi.query.error"));
|
|
95
|
+
}
|
|
96
|
+
finally {
|
|
97
|
+
saving.value = false;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
watch(id, () => void load(), { immediate: true });
|
|
101
|
+
const __VLS_ctx = {};
|
|
102
|
+
let __VLS_components;
|
|
103
|
+
let __VLS_intrinsics;
|
|
104
|
+
let __VLS_directives;
|
|
105
|
+
void __VLS_ctx, __VLS_components, __VLS_intrinsics, __VLS_directives;
|
|
106
|
+
// @ts-ignore
|
|
107
|
+
__VLS_withDotValue(dashboard, {});
|
|
108
|
+
// @ts-ignore
|
|
109
|
+
__VLS_withDotValue(icons, {});
|
|
110
|
+
// @ts-ignore
|
|
111
|
+
__VLS_withDotValue(router, {});
|
|
112
|
+
// @ts-ignore
|
|
113
|
+
__VLS_withDotValue(layout, {});
|
|
114
|
+
// @ts-ignore
|
|
115
|
+
__VLS_withDotValue(loading, {});
|
|
116
|
+
void {};
|
|
117
|
+
/** @type {__VLS_StyleScopedClasses['bi-designer-page__toolbar']} */ ;
|
|
118
|
+
/** @type {__VLS_StyleScopedClasses['bi-designer-page']} */ ;
|
|
119
|
+
/** @type {__VLS_StyleScopedClasses['bi-designer-page__toolbar']} */ ;
|
|
120
|
+
/** @type {__VLS_StyleScopedClasses['bi-designer-page__toolbar']} */ ;
|
|
121
|
+
/** @type {__VLS_StyleScopedClasses['el-button']} */ ;
|
|
122
|
+
__VLS_asFunctionalElement1(__VLS_intrinsics.main, __VLS_intrinsics.main)({
|
|
123
|
+
...{ class: "bi-designer-page" },
|
|
124
|
+
});
|
|
125
|
+
/** @type {__VLS_StyleScopedClasses['bi-designer-page']} */ ;
|
|
126
|
+
let __VLS_0;
|
|
127
|
+
/** @ts-ignore @type { | typeof __VLS_components.elCard | typeof __VLS_components.ElCard | typeof __VLS_components['el-card'] | typeof __VLS_components.elCard | typeof __VLS_components.ElCard | typeof __VLS_components['el-card']} */
|
|
128
|
+
elCard;
|
|
129
|
+
// @ts-ignore
|
|
130
|
+
const __VLS_1 = __VLS_asFunctionalComponent1(__VLS_0, new __VLS_0({
|
|
131
|
+
// @ts-ignore
|
|
132
|
+
...{ class: "admin-page-card bi-designer-page__toolbar" }, shadow: "never",
|
|
133
|
+
}));
|
|
134
|
+
const __VLS_2 = __VLS_1({
|
|
135
|
+
...{ class: "admin-page-card bi-designer-page__toolbar" },
|
|
136
|
+
shadow: "never",
|
|
137
|
+
}, ...__VLS_functionalComponentArgsRest(__VLS_1));
|
|
138
|
+
/** @type {__VLS_StyleScopedClasses['admin-page-card']} */ ;
|
|
139
|
+
/** @type {__VLS_StyleScopedClasses['bi-designer-page__toolbar']} */ ;
|
|
140
|
+
const { default: __VLS_5 } = __VLS_nonNull(__VLS_3.slots);
|
|
141
|
+
__VLS_asFunctionalElement1(__VLS_intrinsics.header, __VLS_intrinsics.header)({});
|
|
142
|
+
__VLS_asFunctionalElement1(__VLS_intrinsics.h2, __VLS_intrinsics.h2)({});
|
|
143
|
+
(dashboard.value?.name || __VLS_unwrap(t, {})("bi.dashboard.edit"));
|
|
144
|
+
__VLS_asFunctionalElement1(__VLS_intrinsics.div, __VLS_intrinsics.div)({});
|
|
145
|
+
let __VLS_6;
|
|
146
|
+
/** @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']} */
|
|
147
|
+
elButton;
|
|
148
|
+
// @ts-ignore
|
|
149
|
+
const __VLS_7 = __VLS_asFunctionalComponent1(__VLS_6, new __VLS_6({
|
|
150
|
+
// @ts-ignore
|
|
151
|
+
...{ 'onClick': {} }, icon: (icons.value.ArrowLeft),
|
|
152
|
+
}));
|
|
153
|
+
const __VLS_8 = __VLS_7({
|
|
154
|
+
...{ 'onClick': {} },
|
|
155
|
+
icon: (icons.value.ArrowLeft),
|
|
156
|
+
}, ...__VLS_functionalComponentArgsRest(__VLS_7));
|
|
157
|
+
let __VLS_11;
|
|
158
|
+
const __VLS_12 = {
|
|
159
|
+
/** @type {typeof __VLS_11.click} */
|
|
160
|
+
onClick: // @ts-ignore
|
|
161
|
+
(...[$event]) => {
|
|
162
|
+
void $event;
|
|
163
|
+
return (router.value.push('/bi/manage'));
|
|
164
|
+
// @ts-ignore
|
|
165
|
+
[dashboard, t, icons, router,];
|
|
166
|
+
},
|
|
167
|
+
};
|
|
168
|
+
void __VLS_12;
|
|
169
|
+
const { default: __VLS_13 } = __VLS_nonNull(__VLS_9.slots);
|
|
170
|
+
(__VLS_unwrap(t, {})("common.action.back"));
|
|
171
|
+
// @ts-ignore
|
|
172
|
+
[t,];
|
|
173
|
+
var __VLS_9;
|
|
174
|
+
var __VLS_10;
|
|
175
|
+
let __VLS_14;
|
|
176
|
+
/** @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']} */
|
|
177
|
+
elButton;
|
|
178
|
+
// @ts-ignore
|
|
179
|
+
const __VLS_15 = __VLS_asFunctionalComponent1(__VLS_14, new __VLS_14({
|
|
180
|
+
// @ts-ignore
|
|
181
|
+
...{ 'onClick': {} }, icon: (icons.value.Document), loading: (__VLS_unwrap(saving, {})), disabled: (!dashboard.value),
|
|
182
|
+
}));
|
|
183
|
+
const __VLS_16 = __VLS_15({
|
|
184
|
+
...{ 'onClick': {} },
|
|
185
|
+
icon: (icons.value.Document),
|
|
186
|
+
loading: (__VLS_unwrap(saving, {})),
|
|
187
|
+
disabled: (!dashboard.value),
|
|
188
|
+
}, ...__VLS_functionalComponentArgsRest(__VLS_15));
|
|
189
|
+
let __VLS_19;
|
|
190
|
+
const __VLS_20 = {
|
|
191
|
+
/** @type {typeof __VLS_19.click} */
|
|
192
|
+
onClick: // @ts-ignore
|
|
193
|
+
(...[$event]) => {
|
|
194
|
+
void $event;
|
|
195
|
+
return (save(false));
|
|
196
|
+
// @ts-ignore
|
|
197
|
+
[dashboard, icons, saving,];
|
|
198
|
+
},
|
|
199
|
+
};
|
|
200
|
+
void __VLS_20;
|
|
201
|
+
const { default: __VLS_21 } = __VLS_nonNull(__VLS_17.slots);
|
|
202
|
+
(__VLS_unwrap(t, {})("bi.dashboard.save"));
|
|
203
|
+
// @ts-ignore
|
|
204
|
+
[t,];
|
|
205
|
+
var __VLS_17;
|
|
206
|
+
var __VLS_18;
|
|
207
|
+
let __VLS_22;
|
|
208
|
+
/** @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']} */
|
|
209
|
+
elButton;
|
|
210
|
+
// @ts-ignore
|
|
211
|
+
const __VLS_23 = __VLS_asFunctionalComponent1(__VLS_22, new __VLS_22({
|
|
212
|
+
// @ts-ignore
|
|
213
|
+
...{ 'onClick': {} }, icon: (icons.value.Promotion), type: "primary", loading: (__VLS_unwrap(saving, {})), disabled: (!layout.value.cards.length),
|
|
214
|
+
}));
|
|
215
|
+
const __VLS_24 = __VLS_23({
|
|
216
|
+
...{ 'onClick': {} },
|
|
217
|
+
icon: (icons.value.Promotion),
|
|
218
|
+
type: "primary",
|
|
219
|
+
loading: (__VLS_unwrap(saving, {})),
|
|
220
|
+
disabled: (!layout.value.cards.length),
|
|
221
|
+
}, ...__VLS_functionalComponentArgsRest(__VLS_23));
|
|
222
|
+
let __VLS_27;
|
|
223
|
+
const __VLS_28 = {
|
|
224
|
+
/** @type {typeof __VLS_27.click} */
|
|
225
|
+
onClick: // @ts-ignore
|
|
226
|
+
(...[$event]) => {
|
|
227
|
+
void $event;
|
|
228
|
+
return (save(true));
|
|
229
|
+
// @ts-ignore
|
|
230
|
+
[icons, saving, layout,];
|
|
231
|
+
},
|
|
232
|
+
};
|
|
233
|
+
void __VLS_28;
|
|
234
|
+
const { default: __VLS_29 } = __VLS_nonNull(__VLS_25.slots);
|
|
235
|
+
(__VLS_unwrap(t, {})("bi.dashboard.publish"));
|
|
236
|
+
// @ts-ignore
|
|
237
|
+
[t,];
|
|
238
|
+
var __VLS_25;
|
|
239
|
+
var __VLS_26;
|
|
240
|
+
// @ts-ignore
|
|
241
|
+
[];
|
|
242
|
+
var __VLS_3;
|
|
243
|
+
if (loading.value) {
|
|
244
|
+
let __VLS_30;
|
|
245
|
+
/** @ts-ignore @type { | typeof __VLS_components.elSkeleton | typeof __VLS_components.ElSkeleton | typeof __VLS_components['el-skeleton']} */
|
|
246
|
+
elSkeleton;
|
|
247
|
+
// @ts-ignore
|
|
248
|
+
const __VLS_31 = __VLS_asFunctionalComponent1(__VLS_30, new __VLS_30({
|
|
249
|
+
// @ts-ignore
|
|
250
|
+
rows: (6), animated: true,
|
|
251
|
+
}));
|
|
252
|
+
const __VLS_32 = __VLS_31({
|
|
253
|
+
rows: (6),
|
|
254
|
+
animated: true,
|
|
255
|
+
}, ...__VLS_functionalComponentArgsRest(__VLS_31));
|
|
256
|
+
}
|
|
257
|
+
else if (!dashboard.value) {
|
|
258
|
+
let __VLS_35;
|
|
259
|
+
/** @ts-ignore @type { | typeof __VLS_components.elAlert | typeof __VLS_components.ElAlert | typeof __VLS_components['el-alert']} */
|
|
260
|
+
elAlert;
|
|
261
|
+
// @ts-ignore
|
|
262
|
+
const __VLS_36 = __VLS_asFunctionalComponent1(__VLS_35, new __VLS_35({
|
|
263
|
+
// @ts-ignore
|
|
264
|
+
title: (__VLS_unwrap(t, {})('bi.dashboard.select_first')), type: "info", showIcon: true,
|
|
265
|
+
}));
|
|
266
|
+
const __VLS_37 = __VLS_36({
|
|
267
|
+
title: (__VLS_unwrap(t, {})('bi.dashboard.select_first')),
|
|
268
|
+
type: "info",
|
|
269
|
+
showIcon: true,
|
|
270
|
+
}, ...__VLS_functionalComponentArgsRest(__VLS_36));
|
|
271
|
+
}
|
|
272
|
+
else {
|
|
273
|
+
const __VLS_40 = BiDesigner;
|
|
274
|
+
// @ts-ignore
|
|
275
|
+
const __VLS_41 = __VLS_asFunctionalComponent1(__VLS_40, new __VLS_40({
|
|
276
|
+
// @ts-ignore
|
|
277
|
+
...{ 'onEditCard': {} }, ...{ 'onCreateCard': {} }, modelValue: (layout.value), cards: (__VLS_unwrap(cards, {})),
|
|
278
|
+
}));
|
|
279
|
+
const __VLS_42 = __VLS_41({
|
|
280
|
+
...{ 'onEditCard': {} },
|
|
281
|
+
...{ 'onCreateCard': {} },
|
|
282
|
+
modelValue: (layout.value),
|
|
283
|
+
cards: (__VLS_unwrap(cards, {})),
|
|
284
|
+
}, ...__VLS_functionalComponentArgsRest(__VLS_41));
|
|
285
|
+
let __VLS_45;
|
|
286
|
+
const __VLS_46 = {
|
|
287
|
+
/** @type {typeof __VLS_45.editCard} */
|
|
288
|
+
onEditCard: (editCard),
|
|
289
|
+
};
|
|
290
|
+
void __VLS_46;
|
|
291
|
+
const __VLS_47 = {
|
|
292
|
+
/** @type {typeof __VLS_45.createCard} */
|
|
293
|
+
onCreateCard: // @ts-ignore
|
|
294
|
+
(...[$event]) => {
|
|
295
|
+
void $event;
|
|
296
|
+
if (!!(loading.value))
|
|
297
|
+
throw 0;
|
|
298
|
+
if (!!(!dashboard.value))
|
|
299
|
+
throw 0;
|
|
300
|
+
return (editCard());
|
|
301
|
+
// @ts-ignore
|
|
302
|
+
[dashboard, t, layout, loading, cards,];
|
|
303
|
+
},
|
|
304
|
+
};
|
|
305
|
+
void __VLS_47;
|
|
306
|
+
var __VLS_43;
|
|
307
|
+
var __VLS_44;
|
|
308
|
+
}
|
|
309
|
+
const __VLS_48 = BiCardFormDialog;
|
|
310
|
+
// @ts-ignore
|
|
311
|
+
const __VLS_49 = __VLS_asFunctionalComponent1(__VLS_48, new __VLS_48({
|
|
312
|
+
// @ts-ignore
|
|
313
|
+
...{ 'onSaved': {} }, modelValue: (__VLS_unwrap(cardOpen, {})), sources: (__VLS_unwrap(sources, {})), card: (__VLS_unwrap(editingCard, {})),
|
|
314
|
+
}));
|
|
315
|
+
const __VLS_50 = __VLS_49({
|
|
316
|
+
...{ 'onSaved': {} },
|
|
317
|
+
modelValue: (__VLS_unwrap(cardOpen, {})),
|
|
318
|
+
sources: (__VLS_unwrap(sources, {})),
|
|
319
|
+
card: (__VLS_unwrap(editingCard, {})),
|
|
320
|
+
}, ...__VLS_functionalComponentArgsRest(__VLS_49));
|
|
321
|
+
let __VLS_53;
|
|
322
|
+
const __VLS_54 = {
|
|
323
|
+
/** @type {typeof __VLS_53.saved} */
|
|
324
|
+
onSaved: (loadCards),
|
|
325
|
+
};
|
|
326
|
+
void __VLS_54;
|
|
327
|
+
var __VLS_51;
|
|
328
|
+
var __VLS_52;
|
|
329
|
+
// @ts-ignore
|
|
330
|
+
[cardOpen, sources, editingCard,];
|
|
331
|
+
const __VLS_export = (await import('vue')).defineComponent({});
|
|
332
|
+
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;
|