@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.
Files changed (166) hide show
  1. package/README.md +43 -2
  2. package/dist/package/declarations/index.d.ts +1 -0
  3. package/dist/package/declarations/src/api/bi/admin/v1/bi_card.d.ts +18 -0
  4. package/dist/package/declarations/src/api/bi/admin/v1/bi_card.js +46 -0
  5. package/dist/package/declarations/src/api/bi/admin/v1/bi_dashboard.d.ts +17 -0
  6. package/dist/package/declarations/src/api/bi/admin/v1/bi_dashboard.js +30 -0
  7. package/dist/package/declarations/src/api/bi/admin/v1/bi_query.d.ts +11 -0
  8. package/dist/package/declarations/src/api/bi/admin/v1/bi_query.js +41 -0
  9. package/dist/package/declarations/src/api/bi/admin/v1/bi_query_record.d.ts +10 -0
  10. package/dist/package/declarations/src/api/bi/admin/v1/bi_query_record.js +14 -0
  11. package/dist/package/declarations/src/api/bi/admin/v1/bi_source.d.ts +26 -0
  12. package/dist/package/declarations/src/api/bi/admin/v1/bi_source.js +46 -0
  13. package/dist/package/declarations/src/bi-core.d.ts +17 -0
  14. package/dist/package/declarations/src/bi-core.js +22 -0
  15. package/dist/package/declarations/src/bi-dashboard-schema.d.ts +31 -0
  16. package/dist/package/declarations/src/bi-dashboard-schema.js +39 -0
  17. package/dist/package/declarations/src/bi-messages.d.ts +247 -0
  18. package/dist/package/declarations/src/bi-messages.js +247 -0
  19. package/dist/package/declarations/src/bi-response.d.ts +10 -0
  20. package/dist/package/declarations/src/bi-response.js +33 -0
  21. package/dist/package/declarations/src/bi-vue.d.ts +10 -0
  22. package/dist/package/declarations/src/bi-vue.js +10 -0
  23. package/dist/package/declarations/src/card-schema.d.ts +30 -0
  24. package/dist/package/declarations/src/card-schema.js +87 -0
  25. package/dist/package/declarations/src/components/BiCardChartEditor.vue.d.ts +17 -0
  26. package/dist/package/declarations/src/components/BiCardChartEditor.vue.js +527 -0
  27. package/dist/package/declarations/src/components/BiCardFormDialog.vue.d.ts +20 -0
  28. package/dist/package/declarations/src/components/BiCardFormDialog.vue.js +495 -0
  29. package/dist/package/declarations/src/components/BiCardLibrary.vue.d.ts +3 -0
  30. package/dist/package/declarations/src/components/BiCardLibrary.vue.js +807 -0
  31. package/dist/package/declarations/src/components/BiCardVisualization.vue.d.ts +10 -0
  32. package/dist/package/declarations/src/components/BiCardVisualization.vue.js +97 -0
  33. package/dist/package/declarations/src/components/BiChart.vue.d.ts +20 -0
  34. package/dist/package/declarations/src/components/BiChart.vue.js +112 -0
  35. package/dist/package/declarations/src/components/BiDashboard.vue.d.ts +9 -0
  36. package/dist/package/declarations/src/components/BiDashboard.vue.js +81 -0
  37. package/dist/package/declarations/src/components/BiDashboardMenuDialog.vue.d.ts +12 -0
  38. package/dist/package/declarations/src/components/BiDashboardMenuDialog.vue.js +252 -0
  39. package/dist/package/declarations/src/components/BiDataCard.vue.d.ts +36 -0
  40. package/dist/package/declarations/src/components/BiDataCard.vue.js +372 -0
  41. package/dist/package/declarations/src/components/BiDesigner.vue.d.ts +17 -0
  42. package/dist/package/declarations/src/components/BiDesigner.vue.js +666 -0
  43. package/dist/package/declarations/src/components/BiSourceModelDialog.vue.d.ts +17 -0
  44. package/dist/package/declarations/src/components/BiSourceModelDialog.vue.js +2118 -0
  45. package/dist/package/declarations/src/components/BiWorkbenchPreview.vue.d.ts +7 -0
  46. package/dist/package/declarations/src/components/BiWorkbenchPreview.vue.js +176 -0
  47. package/dist/package/declarations/src/components/source-model-layout.d.ts +3 -0
  48. package/dist/package/declarations/src/components/source-model-layout.js +66 -0
  49. package/dist/package/declarations/src/dataset/index.d.ts +7 -0
  50. package/dist/package/declarations/src/dataset/index.js +25 -0
  51. package/dist/package/declarations/src/dataset/labels.d.ts +2 -0
  52. package/dist/package/declarations/src/dataset/labels.js +21 -0
  53. package/dist/package/declarations/src/dataset/transform.d.ts +20 -0
  54. package/dist/package/declarations/src/dataset/transform.js +173 -0
  55. package/dist/package/declarations/src/engine/chart-types.d.ts +14 -0
  56. package/dist/package/declarations/src/engine/chart-types.js +37 -0
  57. package/dist/package/declarations/src/engine/echarts.d.ts +16 -0
  58. package/dist/package/declarations/src/engine/echarts.js +491 -0
  59. package/dist/package/declarations/src/engine/types.d.ts +36 -0
  60. package/dist/package/declarations/src/engine/types.js +20 -0
  61. package/dist/package/declarations/src/env.d.ts +17 -0
  62. package/dist/package/declarations/src/env.js +67 -0
  63. package/dist/package/declarations/src/index.d.ts +1 -0
  64. package/dist/package/declarations/src/index.js +1 -0
  65. package/dist/package/declarations/src/locales/en-US.json +254 -0
  66. package/dist/package/declarations/src/locales/generated.d.ts +1021 -0
  67. package/dist/package/declarations/src/locales/generated.js +13 -0
  68. package/dist/package/declarations/src/locales/ja-JP.json +254 -0
  69. package/dist/package/declarations/src/locales/zh-CN.json +254 -0
  70. package/dist/package/declarations/src/locales/zh-TW.json +254 -0
  71. package/dist/package/declarations/src/module.d.ts +2 -0
  72. package/dist/package/declarations/src/module.js +9 -0
  73. package/dist/package/declarations/src/rpc/bi/admin/v1/bi_card.d.ts +145 -0
  74. package/dist/package/declarations/src/rpc/bi/admin/v1/bi_card.js +6 -0
  75. package/dist/package/declarations/src/rpc/bi/admin/v1/bi_dashboard.d.ts +107 -0
  76. package/dist/package/declarations/src/rpc/bi/admin/v1/bi_dashboard.js +6 -0
  77. package/dist/package/declarations/src/rpc/bi/admin/v1/bi_query.d.ts +157 -0
  78. package/dist/package/declarations/src/rpc/bi/admin/v1/bi_query.js +6 -0
  79. package/dist/package/declarations/src/rpc/bi/admin/v1/bi_query_record.d.ts +83 -0
  80. package/dist/package/declarations/src/rpc/bi/admin/v1/bi_query_record.js +15 -0
  81. package/dist/package/declarations/src/rpc/bi/admin/v1/bi_source.d.ts +301 -0
  82. package/dist/package/declarations/src/rpc/bi/admin/v1/bi_source.js +6 -0
  83. package/dist/package/declarations/src/rpc/common/v1/types.d.ts +60 -0
  84. package/dist/package/declarations/src/rpc/common/v1/types.js +6 -0
  85. package/dist/package/declarations/src/schema/layout.d.ts +7 -0
  86. package/dist/package/declarations/src/schema/layout.js +52 -0
  87. package/dist/package/declarations/src/schema/types.d.ts +83 -0
  88. package/dist/package/declarations/src/schema/types.js +1 -0
  89. package/dist/package/declarations/src/theme/index.d.ts +29 -0
  90. package/dist/package/declarations/src/theme/index.js +83 -0
  91. package/dist/package/declarations/src/theme/palettes.d.ts +7 -0
  92. package/dist/package/declarations/src/theme/palettes.js +28 -0
  93. package/dist/package/declarations/src/theme/presets.d.ts +73 -0
  94. package/dist/package/declarations/src/theme/presets.js +235 -0
  95. package/dist/package/declarations/src/views/card/index.vue.d.ts +3 -0
  96. package/dist/package/declarations/src/views/card/index.vue.js +18 -0
  97. package/dist/package/declarations/src/views/dashboard/index.vue.d.ts +3 -0
  98. package/dist/package/declarations/src/views/dashboard/index.vue.js +107 -0
  99. package/dist/package/declarations/src/views/designer/index.vue.d.ts +3 -0
  100. package/dist/package/declarations/src/views/designer/index.vue.js +332 -0
  101. package/dist/package/declarations/src/views/manage/index.vue.d.ts +3 -0
  102. package/dist/package/declarations/src/views/manage/index.vue.js +325 -0
  103. package/dist/package/declarations/src/views/query/index.vue.d.ts +3 -0
  104. package/dist/package/declarations/src/views/query/index.vue.js +876 -0
  105. package/dist/package/declarations/src/views/source/index.vue.d.ts +3 -0
  106. package/dist/package/declarations/src/views/source/index.vue.js +343 -0
  107. package/dist/package/declarations/src/views/workbench/index.vue.d.ts +3 -0
  108. package/dist/package/declarations/src/views/workbench/index.vue.js +362 -0
  109. package/dist/package/src/api/bi/admin/v1/bi_card.ts +67 -0
  110. package/dist/package/src/api/bi/admin/v1/bi_dashboard.ts +51 -0
  111. package/dist/package/src/api/bi/admin/v1/bi_query.ts +55 -0
  112. package/dist/package/src/api/bi/admin/v1/bi_query_record.ts +25 -0
  113. package/dist/package/src/api/bi/admin/v1/bi_source.ts +80 -0
  114. package/dist/package/src/bi-core.ts +43 -0
  115. package/dist/package/src/bi-dashboard-schema.ts +69 -0
  116. package/dist/package/src/bi-messages.ts +249 -0
  117. package/dist/package/src/bi-response.ts +39 -0
  118. package/dist/package/src/bi-vue.ts +13 -0
  119. package/dist/package/src/card-schema.ts +111 -0
  120. package/dist/package/src/components/BiCardChartEditor.vue +139 -0
  121. package/dist/package/src/components/BiCardFormDialog.vue +289 -0
  122. package/dist/package/src/components/BiCardLibrary.vue +310 -0
  123. package/dist/package/src/components/BiCardVisualization.vue +95 -0
  124. package/dist/package/src/components/BiChart.vue +134 -0
  125. package/dist/package/src/components/BiDashboard.vue +53 -0
  126. package/dist/package/src/components/BiDashboardMenuDialog.vue +177 -0
  127. package/dist/package/src/components/BiDataCard.vue +231 -0
  128. package/dist/package/src/components/BiDesigner.vue +287 -0
  129. package/dist/package/src/components/BiSourceModelDialog.vue +846 -0
  130. package/dist/package/src/components/BiWorkbenchPreview.vue +131 -0
  131. package/dist/package/src/components/source-model-layout.ts +62 -0
  132. package/dist/package/src/dataset/index.ts +28 -0
  133. package/dist/package/src/dataset/labels.ts +19 -0
  134. package/dist/package/src/dataset/transform.ts +189 -0
  135. package/dist/package/src/engine/chart-types.ts +44 -0
  136. package/dist/package/src/engine/echarts.ts +568 -0
  137. package/dist/package/src/engine/types.ts +60 -0
  138. package/dist/package/src/env.ts +82 -0
  139. package/dist/package/src/index.ts +1 -0
  140. package/dist/package/src/locales/en-US.json +254 -0
  141. package/dist/package/src/locales/generated.ts +16 -0
  142. package/dist/package/src/locales/ja-JP.json +254 -0
  143. package/dist/package/src/locales/zh-CN.json +254 -0
  144. package/dist/package/src/locales/zh-TW.json +254 -0
  145. package/dist/package/src/module.ts +12 -0
  146. package/dist/package/src/rpc/bi/admin/v1/bi_card.ts +169 -0
  147. package/dist/package/src/rpc/bi/admin/v1/bi_dashboard.ts +126 -0
  148. package/dist/package/src/rpc/bi/admin/v1/bi_query.ts +187 -0
  149. package/dist/package/src/rpc/bi/admin/v1/bi_query_record.ts +98 -0
  150. package/dist/package/src/rpc/bi/admin/v1/bi_source.ts +338 -0
  151. package/dist/package/src/rpc/common/v1/types.ts +77 -0
  152. package/dist/package/src/schema/layout.ts +54 -0
  153. package/dist/package/src/schema/types.ts +103 -0
  154. package/dist/package/src/styles.scss +1 -0
  155. package/dist/package/src/theme/index.ts +108 -0
  156. package/dist/package/src/theme/palettes.ts +34 -0
  157. package/dist/package/src/theme/presets.ts +278 -0
  158. package/dist/package/src/views/card/index.vue +5 -0
  159. package/dist/package/src/views/dashboard/index.vue +58 -0
  160. package/dist/package/src/views/designer/index.vue +164 -0
  161. package/dist/package/src/views/manage/index.vue +276 -0
  162. package/dist/package/src/views/query/index.vue +593 -0
  163. package/dist/package/src/views/source/index.vue +214 -0
  164. package/dist/package/src/views/workbench/index.vue +208 -0
  165. package/package.json +67 -3
  166. package/tsconfig.json +12 -0
@@ -0,0 +1,362 @@
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 { onActivated, onMounted, ref } from "vue";
4
+ import { useRouter } from "vue-router";
5
+ import { t } from "@liujitcn/kratos-admin-core";
6
+ import { orderWorkbenchDashboards } from "../../card-schema";
7
+ import { defBiCardService } from "../../api/bi/admin/v1/bi_card";
8
+ import { parseDashboardLayout } from "../../bi-dashboard-schema";
9
+ import BiWorkbenchPreview from "../../components/BiWorkbenchPreview.vue";
10
+ const { defineOptions, } = {};
11
+ defineOptions({ name: "BiWorkbench", inheritAttrs: false });
12
+ const router = useRouter(), dashboards = ref([]), loading = ref(false), saving = ref(false), dragged = ref(-1);
13
+ let loaded = false;
14
+ /** 读取收藏的仪表盘,重新进入时同步管理页的收藏变化。 */
15
+ async function load() {
16
+ loading.value = true;
17
+ try {
18
+ const config = await defBiCardService.GetBiWorkbench({});
19
+ dashboards.value = orderWorkbenchDashboards(config.dashboard_ids, config.dashboards);
20
+ loaded = true;
21
+ }
22
+ catch (cause) {
23
+ ElMessage.error(cause instanceof Error ? cause.message : t("bi.query.error"));
24
+ }
25
+ finally {
26
+ loading.value = false;
27
+ }
28
+ }
29
+ /** 卡片默认允许拖动,按钮保留原有点击操作。 */
30
+ function startDrag(event, index) {
31
+ if (saving.value || event.target.closest("button")) {
32
+ event.preventDefault();
33
+ return;
34
+ }
35
+ dragged.value = index;
36
+ if (event.dataTransfer) {
37
+ event.dataTransfer.effectAllowed = "move";
38
+ event.dataTransfer.setData("text/plain", String(dashboards.value[index].id));
39
+ }
40
+ }
41
+ /** 拖动或键盘排序后自动保存,失败恢复原顺序并保留卡片收藏。 */
42
+ async function move(from, to) {
43
+ if (saving.value || from === to || from < 0 || to < 0 || from >= dashboards.value.length || to >= dashboards.value.length)
44
+ return;
45
+ const previous = dashboards.value;
46
+ const next = [...previous];
47
+ const [item] = next.splice(from, 1);
48
+ next.splice(to, 0, item);
49
+ dashboards.value = next;
50
+ dragged.value = -1;
51
+ saving.value = true;
52
+ try {
53
+ const latest = await defBiCardService.GetBiWorkbench({});
54
+ const saved = await defBiCardService.SaveBiWorkbench({
55
+ dashboard_ids: dashboards.value.map(item => item.id),
56
+ favorite_ids: latest.favorite_ids
57
+ });
58
+ dashboards.value = orderWorkbenchDashboards(saved.dashboard_ids, saved.dashboards);
59
+ ElMessage.success(t("bi.workbench.saved"));
60
+ }
61
+ catch (cause) {
62
+ dashboards.value = previous;
63
+ ElMessage.error(cause instanceof Error ? cause.message : t("bi.query.error"));
64
+ }
65
+ finally {
66
+ saving.value = false;
67
+ }
68
+ }
69
+ onMounted(() => void load());
70
+ onActivated(() => {
71
+ if (loaded && !saving.value)
72
+ void load();
73
+ });
74
+ const __VLS_ctx = {};
75
+ let __VLS_components;
76
+ let __VLS_intrinsics;
77
+ let __VLS_directives;
78
+ void __VLS_ctx, __VLS_components, __VLS_intrinsics, __VLS_directives;
79
+ // @ts-ignore
80
+ __VLS_withDotValue(loading, {});
81
+ // @ts-ignore
82
+ __VLS_withDotValue(dashboards, {});
83
+ // @ts-ignore
84
+ __VLS_withDotValue(router, {});
85
+ // @ts-ignore
86
+ __VLS_withDotValue(dragged, {});
87
+ // @ts-ignore
88
+ __VLS_withDotValue(saving, {});
89
+ void {};
90
+ /** @type {__VLS_StyleScopedClasses['bi-workbench__entry']} */ ;
91
+ /** @type {__VLS_StyleScopedClasses['bi-workbench__entry']} */ ;
92
+ /** @type {__VLS_StyleScopedClasses['bi-workbench__entry']} */ ;
93
+ /** @type {__VLS_StyleScopedClasses['bi-workbench__title']} */ ;
94
+ /** @type {__VLS_StyleScopedClasses['bi-workbench']} */ ;
95
+ /** @type {__VLS_StyleScopedClasses['bi-workbench__meta']} */ ;
96
+ /** @type {__VLS_StyleScopedClasses['bi-workbench__description']} */ ;
97
+ /** @type {__VLS_StyleScopedClasses['bi-workbench']} */ ;
98
+ /** @type {__VLS_StyleScopedClasses['bi-workbench__grid']} */ ;
99
+ /** @type {__VLS_StyleScopedClasses['bi-workbench__grid']} */ ;
100
+ /** @type {__VLS_StyleScopedClasses['bi-workbench__grid']} */ ;
101
+ __VLS_asFunctionalElement1(__VLS_intrinsics.main, __VLS_intrinsics.main)({
102
+ ...{ class: "bi-workbench" },
103
+ });
104
+ /** @type {__VLS_StyleScopedClasses['bi-workbench']} */ ;
105
+ if (loading.value) {
106
+ let __VLS_0;
107
+ /** @ts-ignore @type { | typeof __VLS_components.elSkeleton | typeof __VLS_components.ElSkeleton | typeof __VLS_components['el-skeleton']} */
108
+ elSkeleton;
109
+ // @ts-ignore
110
+ const __VLS_1 = __VLS_asFunctionalComponent1(__VLS_0, new __VLS_0({
111
+ // @ts-ignore
112
+ rows: (6), animated: true,
113
+ }));
114
+ const __VLS_2 = __VLS_1({
115
+ rows: (6),
116
+ animated: true,
117
+ }, ...__VLS_functionalComponentArgsRest(__VLS_1));
118
+ }
119
+ else if (!dashboards.value.length) {
120
+ let __VLS_5;
121
+ /** @ts-ignore @type { | typeof __VLS_components.elEmpty | typeof __VLS_components.ElEmpty | typeof __VLS_components['el-empty'] | typeof __VLS_components.elEmpty | typeof __VLS_components.ElEmpty | typeof __VLS_components['el-empty']} */
122
+ elEmpty;
123
+ // @ts-ignore
124
+ const __VLS_6 = __VLS_asFunctionalComponent1(__VLS_5, new __VLS_5({
125
+ // @ts-ignore
126
+ description: (__VLS_unwrap(t, {})('bi.workbench.empty')),
127
+ }));
128
+ const __VLS_7 = __VLS_6({
129
+ description: (__VLS_unwrap(t, {})('bi.workbench.empty')),
130
+ }, ...__VLS_functionalComponentArgsRest(__VLS_6));
131
+ const { default: __VLS_10 } = __VLS_nonNull(__VLS_8.slots);
132
+ let __VLS_11;
133
+ /** @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']} */
134
+ elButton;
135
+ // @ts-ignore
136
+ const __VLS_12 = __VLS_asFunctionalComponent1(__VLS_11, new __VLS_11({
137
+ // @ts-ignore
138
+ ...{ 'onClick': {} },
139
+ }));
140
+ const __VLS_13 = __VLS_12({
141
+ ...{ 'onClick': {} },
142
+ }, ...__VLS_functionalComponentArgsRest(__VLS_12));
143
+ let __VLS_16;
144
+ const __VLS_17 = {
145
+ /** @type {typeof __VLS_16.click} */
146
+ onClick: // @ts-ignore
147
+ (...[$event]) => {
148
+ void $event;
149
+ if (!!(loading.value))
150
+ throw 0;
151
+ if (!(!dashboards.value.length))
152
+ throw 0;
153
+ return (router.value.push('/bi/manage'));
154
+ // @ts-ignore
155
+ [loading, dashboards, t, router,];
156
+ },
157
+ };
158
+ void __VLS_17;
159
+ const { default: __VLS_18 } = __VLS_nonNull(__VLS_14.slots);
160
+ (__VLS_unwrap(t, {})("bi.dashboard.manage"));
161
+ // @ts-ignore
162
+ [t,];
163
+ var __VLS_14;
164
+ var __VLS_15;
165
+ // @ts-ignore
166
+ [];
167
+ var __VLS_8;
168
+ }
169
+ else {
170
+ __VLS_asFunctionalElement1(__VLS_intrinsics.div, __VLS_intrinsics.div)({
171
+ ...{ class: "bi-workbench__grid" },
172
+ 'aria-busy': (saving.value),
173
+ });
174
+ /** @type {__VLS_StyleScopedClasses['bi-workbench__grid']} */ ;
175
+ const __VLS_19 = __VLS_tryAsConstant((dashboards.value));
176
+ for (const [item, index] of __VLS_vFor(__VLS_nonNull(__VLS_19))) {
177
+ __VLS_asFunctionalElement1(__VLS_intrinsics.article, __VLS_intrinsics.article)({
178
+ ...{ onDragstart: // @ts-ignore
179
+ (...[$event]) => {
180
+ void $event;
181
+ if (!!(loading.value))
182
+ throw 0;
183
+ if (!!(!dashboards.value.length))
184
+ throw 0;
185
+ return (startDrag($event, index));
186
+ // @ts-ignore
187
+ [dashboards, saving,];
188
+ } },
189
+ ...{ onDragend: // @ts-ignore
190
+ (...[$event]) => {
191
+ void $event;
192
+ if (!!(loading.value))
193
+ throw 0;
194
+ if (!!(!dashboards.value.length))
195
+ throw 0;
196
+ return (dragged.value = -1);
197
+ // @ts-ignore
198
+ [dragged,];
199
+ } },
200
+ ...{ onDragover: () => { } },
201
+ ...{ onDrop: // @ts-ignore
202
+ (...[$event]) => {
203
+ void $event;
204
+ if (!!(loading.value))
205
+ throw 0;
206
+ if (!!(!dashboards.value.length))
207
+ throw 0;
208
+ return (move(dragged.value, index));
209
+ // @ts-ignore
210
+ [dragged,];
211
+ } },
212
+ ...{ onKeydown: // @ts-ignore
213
+ (...[$event]) => {
214
+ void $event;
215
+ if (!!(loading.value))
216
+ throw 0;
217
+ if (!!(!dashboards.value.length))
218
+ throw 0;
219
+ return (move(index, index - 1));
220
+ // @ts-ignore
221
+ [];
222
+ } },
223
+ ...{ onKeydown: // @ts-ignore
224
+ (...[$event]) => {
225
+ void $event;
226
+ if (!!(loading.value))
227
+ throw 0;
228
+ if (!!(!dashboards.value.length))
229
+ throw 0;
230
+ return (move(index, index + 1));
231
+ // @ts-ignore
232
+ [];
233
+ } },
234
+ key: (item.id),
235
+ ...{ class: "bi-workbench__entry" },
236
+ ...{ class: ({ 'is-dragging': dragged.value === index }) },
237
+ draggable: (!saving.value),
238
+ tabindex: "0",
239
+ 'aria-label': (`${item.name}:${__VLS_unwrap(t, {})('bi.workbench.drag')}`),
240
+ 'aria-keyshortcuts': "Alt+ArrowLeft Alt+ArrowRight",
241
+ });
242
+ /** @type {__VLS_StyleScopedClasses['bi-workbench__entry']} */ ;
243
+ /** @type {__VLS_StyleScopedClasses['is-dragging']} */ ;
244
+ const __VLS_20 = BiWorkbenchPreview;
245
+ // @ts-ignore
246
+ const __VLS_21 = __VLS_asFunctionalComponent1(__VLS_20, new __VLS_20({
247
+ // @ts-ignore
248
+ key: (`${item.id}:${item.published_version}`), dashboard: (item),
249
+ }));
250
+ const __VLS_22 = __VLS_21({
251
+ key: (`${item.id}:${item.published_version}`),
252
+ dashboard: (item),
253
+ }, ...__VLS_functionalComponentArgsRest(__VLS_21));
254
+ __VLS_asFunctionalElement1(__VLS_intrinsics.div, __VLS_intrinsics.div)({
255
+ ...{ class: "bi-workbench__info" },
256
+ });
257
+ /** @type {__VLS_StyleScopedClasses['bi-workbench__info']} */ ;
258
+ __VLS_asFunctionalElement1(__VLS_intrinsics.div, __VLS_intrinsics.div)({
259
+ ...{ class: "bi-workbench__title" },
260
+ });
261
+ /** @type {__VLS_StyleScopedClasses['bi-workbench__title']} */ ;
262
+ __VLS_asFunctionalElement1(__VLS_intrinsics.h3, __VLS_intrinsics.h3)({
263
+ title: (item.name),
264
+ });
265
+ (item.name);
266
+ let __VLS_25;
267
+ /** @ts-ignore @type { | typeof __VLS_components.elTag | typeof __VLS_components.ElTag | typeof __VLS_components['el-tag'] | typeof __VLS_components.elTag | typeof __VLS_components.ElTag | typeof __VLS_components['el-tag']} */
268
+ elTag;
269
+ // @ts-ignore
270
+ const __VLS_26 = __VLS_asFunctionalComponent1(__VLS_25, new __VLS_25({
271
+ // @ts-ignore
272
+ size: "small", effect: "light",
273
+ }));
274
+ const __VLS_27 = __VLS_26({
275
+ size: "small",
276
+ effect: "light",
277
+ }, ...__VLS_functionalComponentArgsRest(__VLS_26));
278
+ const { default: __VLS_30 } = __VLS_nonNull(__VLS_28.slots);
279
+ (__VLS_unwrap(t, {})("bi.dashboard.status_published"));
280
+ // @ts-ignore
281
+ [t, t, saving, dragged,];
282
+ var __VLS_28;
283
+ __VLS_asFunctionalElement1(__VLS_intrinsics.p, __VLS_intrinsics.p)({
284
+ ...{ class: "bi-workbench__meta" },
285
+ });
286
+ /** @type {__VLS_StyleScopedClasses['bi-workbench__meta']} */ ;
287
+ (__VLS_unwrap(t, {})("bi.card.total", { count: __VLS_unwrap(parseDashboardLayout, {})(item.schema_json).cards.length }));
288
+ (item.published_version);
289
+ if (item.description) {
290
+ __VLS_asFunctionalElement1(__VLS_intrinsics.p, __VLS_intrinsics.p)({
291
+ ...{ class: "bi-workbench__description" },
292
+ });
293
+ /** @type {__VLS_StyleScopedClasses['bi-workbench__description']} */ ;
294
+ (item.description);
295
+ }
296
+ __VLS_asFunctionalElement1(__VLS_intrinsics.footer, __VLS_intrinsics.footer)({});
297
+ let __VLS_31;
298
+ /** @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']} */
299
+ elButton;
300
+ // @ts-ignore
301
+ const __VLS_32 = __VLS_asFunctionalComponent1(__VLS_31, new __VLS_31({
302
+ // @ts-ignore
303
+ ...{ 'onClick': {} }, type: "primary",
304
+ }));
305
+ const __VLS_33 = __VLS_32({
306
+ ...{ 'onClick': {} },
307
+ type: "primary",
308
+ }, ...__VLS_functionalComponentArgsRest(__VLS_32));
309
+ let __VLS_36;
310
+ const __VLS_37 = {
311
+ /** @type {typeof __VLS_36.click} */
312
+ onClick: // @ts-ignore
313
+ (...[$event]) => {
314
+ void $event;
315
+ if (!!(loading.value))
316
+ throw 0;
317
+ if (!!(!dashboards.value.length))
318
+ throw 0;
319
+ return (router.value.push(`/bi/dashboard/${item.id}`));
320
+ // @ts-ignore
321
+ [t, router, parseDashboardLayout,];
322
+ },
323
+ };
324
+ void __VLS_37;
325
+ const { default: __VLS_38 } = __VLS_nonNull(__VLS_34.slots);
326
+ (__VLS_unwrap(t, {})("bi.workbench.open_dashboard"));
327
+ let __VLS_39;
328
+ /** @ts-ignore @type { | typeof __VLS_components.elIcon | typeof __VLS_components.ElIcon | typeof __VLS_components['el-icon'] | typeof __VLS_components.elIcon | typeof __VLS_components.ElIcon | typeof __VLS_components['el-icon']} */
329
+ elIcon;
330
+ // @ts-ignore
331
+ const __VLS_40 = __VLS_asFunctionalComponent1(__VLS_39, new __VLS_39({
332
+ // @ts-ignore
333
+ ...{ class: "el-icon--right" },
334
+ }));
335
+ const __VLS_41 = __VLS_40({
336
+ ...{ class: "el-icon--right" },
337
+ }, ...__VLS_functionalComponentArgsRest(__VLS_40));
338
+ /** @type {__VLS_StyleScopedClasses['el-icon--right']} */ ;
339
+ const { default: __VLS_44 } = __VLS_nonNull(__VLS_42.slots);
340
+ let __VLS_45;
341
+ /** @ts-ignore @type { | typeof __VLS_components.ArrowRight} */
342
+ ArrowRight;
343
+ // @ts-ignore
344
+ const __VLS_46 = __VLS_asFunctionalComponent1(__VLS_45, new __VLS_45({
345
+ // @ts-ignore
346
+ }));
347
+ const __VLS_47 = __VLS_46({}, ...__VLS_functionalComponentArgsRest(__VLS_46));
348
+ // @ts-ignore
349
+ [t,];
350
+ var __VLS_42;
351
+ // @ts-ignore
352
+ [];
353
+ var __VLS_34;
354
+ var __VLS_35;
355
+ // @ts-ignore
356
+ [];
357
+ }
358
+ }
359
+ // @ts-ignore
360
+ [];
361
+ const __VLS_export = (await import('vue')).defineComponent({});
362
+ export default {};
@@ -0,0 +1,67 @@
1
+ import service from "@liujitcn/kratos-admin-core/request";
2
+ import { normalizeBiCard, normalizeBiWorkbench, normalizeBiQueryResult } from "../../../../bi-response";
3
+ import type {
4
+ BiCard,
5
+ BiCardService,
6
+ BiWorkbench,
7
+ DeleteBiCardRequest,
8
+ DeleteBiCardResponse,
9
+ GetBiCardDataRequest,
10
+ GetBiWorkbenchRequest,
11
+ PageBiCardRequest,
12
+ PageBiCardResponse,
13
+ SaveBiCardRequest,
14
+ SaveBiWorkbenchRequest
15
+ } from "../../../../rpc/bi/admin/v1/bi_card";
16
+ import type { BiQueryResult } from "../../../../rpc/bi/admin/v1/bi_query";
17
+
18
+ const BI_CARD_URL = "/v1/admin/bi/card";
19
+ const BI_WORKBENCH_URL = "/v1/admin/bi/workbench";
20
+
21
+ /** 数据卡片与个人工作台请求实现。 */
22
+ export class BiCardServiceImpl implements BiCardService {
23
+ /** 分页查询当前用户可见的卡片。 */
24
+ PageBiCard(request: PageBiCardRequest): Promise<PageBiCardResponse> {
25
+ return service<PageBiCardRequest, PageBiCardResponse>({ url: BI_CARD_URL, method: "get", params: request }).then(result => ({
26
+ cards: (result.cards ?? []).map(normalizeBiCard),
27
+ total: result.total ?? 0,
28
+ counts: {
29
+ all: result.counts?.all ?? 0,
30
+ system: result.counts?.system ?? 0,
31
+ mine: result.counts?.mine ?? 0,
32
+ favorite: result.counts?.favorite ?? 0,
33
+ shared: result.counts?.shared ?? 0
34
+ }
35
+ }));
36
+ }
37
+ /** 保存当前用户的数据卡片。 */
38
+ SaveBiCard(request: SaveBiCardRequest): Promise<BiCard> {
39
+ return service<SaveBiCardRequest, BiCard>({ url: BI_CARD_URL, method: "post", data: request }).then(normalizeBiCard);
40
+ }
41
+ /** 删除当前用户的数据卡片。 */
42
+ DeleteBiCard(request: DeleteBiCardRequest): Promise<DeleteBiCardResponse> {
43
+ return service({ url: `${BI_CARD_URL}/${request.id}`, method: "delete" });
44
+ }
45
+ /** 按访问者权限执行卡片查询。 */
46
+ GetBiCardData(request: GetBiCardDataRequest): Promise<BiQueryResult> {
47
+ return service<GetBiCardDataRequest, BiQueryResult>({
48
+ url: `${BI_CARD_URL}/${request.id}/data`,
49
+ method: "get",
50
+ params: { range_days: request.range_days }
51
+ }).then(normalizeBiQueryResult);
52
+ }
53
+ /** 获取个人工作台。 */
54
+ GetBiWorkbench(request: GetBiWorkbenchRequest): Promise<BiWorkbench> {
55
+ return service<GetBiWorkbenchRequest, BiWorkbench>({ url: BI_WORKBENCH_URL, method: "get", params: request }).then(
56
+ normalizeBiWorkbench
57
+ );
58
+ }
59
+ /** 保存个人工作台与收藏。 */
60
+ SaveBiWorkbench(request: SaveBiWorkbenchRequest): Promise<BiWorkbench> {
61
+ return service<SaveBiWorkbenchRequest, BiWorkbench>({ url: BI_WORKBENCH_URL, method: "put", data: request }).then(
62
+ normalizeBiWorkbench
63
+ );
64
+ }
65
+ }
66
+
67
+ export const defBiCardService = new BiCardServiceImpl();
@@ -0,0 +1,51 @@
1
+ import service from "@liujitcn/kratos-admin-core/request";
2
+ import type {
3
+ BiDashboard,
4
+ BiDashboardService,
5
+ DeleteBiDashboardRequest,
6
+ DeleteBiDashboardResponse,
7
+ BiDashboardDataResponse,
8
+ GetBiDashboardDataRequest,
9
+ GetBiDashboardRequest,
10
+ PageBiDashboardRequest,
11
+ PageBiDashboardResponse,
12
+ PublishBiDashboardRequest,
13
+ SaveBiDashboardRequest
14
+ } from "../../../../rpc/bi/admin/v1/bi_dashboard";
15
+
16
+ const BI_DASHBOARD_URL = "/v1/admin/bi/dashboard";
17
+
18
+ /** BI 仪表盘管理服务实现。 */
19
+ export class BiDashboardServiceImpl implements BiDashboardService {
20
+ /** 分页查询仪表盘。 */
21
+ PageBiDashboard(request: PageBiDashboardRequest): Promise<PageBiDashboardResponse> {
22
+ return service({url: BI_DASHBOARD_URL, method: "get", params: request});
23
+ }
24
+
25
+ /** 查询仪表盘详情。 */
26
+ GetBiDashboard(request: GetBiDashboardRequest): Promise<BiDashboard> {
27
+ return service({url: `${BI_DASHBOARD_URL}/${request.id}`, method: "get"});
28
+ }
29
+
30
+ /** 保存仪表盘草稿。 */
31
+ SaveBiDashboard(request: SaveBiDashboardRequest): Promise<BiDashboard> {
32
+ return service({url: BI_DASHBOARD_URL, method: "post", data: request});
33
+ }
34
+
35
+ /** 发布仪表盘草稿。 */
36
+ PublishBiDashboard(request: PublishBiDashboardRequest): Promise<BiDashboard> {
37
+ return service({url: `${BI_DASHBOARD_URL}/${request.id}/publish`, method: "post", data: request});
38
+ }
39
+
40
+ /** 删除仪表盘。 */
41
+ DeleteBiDashboard(request: DeleteBiDashboardRequest): Promise<DeleteBiDashboardResponse> {
42
+ return service({url: `${BI_DASHBOARD_URL}/${request.id}`, method: "delete"});
43
+ }
44
+
45
+ /** 执行已发布仪表盘中的图表查询。 */
46
+ GetBiDashboardData(request: GetBiDashboardDataRequest): Promise<BiDashboardDataResponse> {
47
+ return service({url: `${BI_DASHBOARD_URL}/${request.id}/data`, method: "get", params: {version: request.version}});
48
+ }
49
+ }
50
+
51
+ export const defBiDashboardService = new BiDashboardServiceImpl();
@@ -0,0 +1,55 @@
1
+ import service from "@liujitcn/kratos-admin-core/request";
2
+ import { normalizeBiQuerySpec, normalizeBiQueryResult } from "../../../../bi-response";
3
+ import type {
4
+ AskBiQueryRequest,
5
+ AskBiQueryResponse,
6
+ BiQueryService,
7
+ BiQueryResult,
8
+ ListBiSourcesRequest,
9
+ ListBiSourcesResponse,
10
+ PreviewBiQueryRequest
11
+ } from "../../../../rpc/bi/admin/v1/bi_query";
12
+
13
+ const BI_QUERY_URL = "/v1/admin/bi";
14
+
15
+ /** BI 语义查询服务实现。 */
16
+ export class BiQueryServiceImpl implements BiQueryService {
17
+ /** 查询当前用户可用的数据源目录。 */
18
+ ListBiSources(request: ListBiSourcesRequest): Promise<ListBiSourcesResponse> {
19
+ return service<ListBiSourcesRequest, ListBiSourcesResponse>({
20
+ url: `${BI_QUERY_URL}/sources`,
21
+ method: "get",
22
+ params: request
23
+ }).then(result => ({
24
+ sources: (result.sources ?? []).map(source => ({
25
+ ...source,
26
+ dimensions: source.dimensions ?? [],
27
+ measures: (source.measures ?? []).map(measure => ({ ...measure, aggregations: measure.aggregations ?? [] }))
28
+ }))
29
+ }));
30
+ }
31
+
32
+ /** 预览一个语义查询。 */
33
+ PreviewBiQuery(request: PreviewBiQueryRequest): Promise<BiQueryResult> {
34
+ return service<PreviewBiQueryRequest, BiQueryResult>({
35
+ url: `${BI_QUERY_URL}/query/preview`,
36
+ method: "post",
37
+ data: request
38
+ }).then(normalizeBiQueryResult);
39
+ }
40
+
41
+ /** 根据自然语言生成语义查询并预览。 */
42
+ AskBiQuery(request: AskBiQueryRequest): Promise<AskBiQueryResponse> {
43
+ return service<AskBiQueryRequest, AskBiQueryResponse>({
44
+ url: `${BI_QUERY_URL}/query/ask`,
45
+ method: "post",
46
+ data: request
47
+ }).then(response => ({
48
+ ...response,
49
+ query: response.query ? normalizeBiQuerySpec(response.query) : undefined,
50
+ result: response.result ? normalizeBiQueryResult(response.result) : undefined
51
+ }));
52
+ }
53
+ }
54
+
55
+ export const defBiQueryService = new BiQueryServiceImpl();
@@ -0,0 +1,25 @@
1
+ import service from "@liujitcn/kratos-admin-core/request";
2
+ import type {
3
+ BiQueryRecordService,
4
+ GetBiQueryRequest,
5
+ PageBiQueryRequest,
6
+ PageBiQueryResponse
7
+ } from "../../../../rpc/bi/admin/v1/bi_query_record";
8
+ import type { BiQueryRecord } from "../../../../rpc/bi/admin/v1/bi_query_record";
9
+
10
+ const BI_QUERY_URL = "/v1/admin/bi/query-record";
11
+
12
+ /** 智能问数记录管理服务实现。 */
13
+ export class BiQueryRecordServiceImpl implements BiQueryRecordService {
14
+ /** 分页查询智能问数记录。 */
15
+ PageBiQuery(request: PageBiQueryRequest): Promise<PageBiQueryResponse> {
16
+ return service({ url: BI_QUERY_URL, method: "get", params: request });
17
+ }
18
+
19
+ /** 查询智能问数记录详情。 */
20
+ GetBiQuery(request: GetBiQueryRequest): Promise<BiQueryRecord> {
21
+ return service({ url: `${BI_QUERY_URL}/${request.id}`, method: "get" });
22
+ }
23
+ }
24
+
25
+ export const defBiQueryRecordService = new BiQueryRecordServiceImpl();
@@ -0,0 +1,80 @@
1
+ import service from "@liujitcn/kratos-admin-core/request";
2
+ import type {
3
+ BiSource,
4
+ BiSourceForm,
5
+ BiSourceService,
6
+ ListBiSourceTablesRequest,
7
+ ListBiSourceTablesResponse,
8
+ CreateBiSourceRequest,
9
+ DeleteBiSourceRequest,
10
+ DeleteBiSourceResponse,
11
+ GetBiSourceRequest,
12
+ OptionBiSourceDatabaseRequest,
13
+ OptionBiSourceDatabaseResponse,
14
+ PageBiSourceRequest,
15
+ PageBiSourceResponse,
16
+ SetBiSourceStatusRequest,
17
+ SaveBiSourceModelRequest,
18
+ TestBiSourceRequest,
19
+ TestBiSourceResponse,
20
+ UpdateBiSourceRequest
21
+ } from "../../../../rpc/bi/admin/v1/bi_source";
22
+
23
+ const BI_SOURCE_URL = "/v1/admin/bi/source";
24
+
25
+ /** BI 数据源配置服务实现。 */
26
+ export class BiSourceServiceImpl implements BiSourceService {
27
+ /** 分页查询当前租户的数据源配置。 */
28
+ PageBiSource(request: PageBiSourceRequest): Promise<PageBiSourceResponse> {
29
+ return service({url: BI_SOURCE_URL, method: "get", params: request});
30
+ }
31
+
32
+ /** 查询数据源配置详情。 */
33
+ GetBiSource(request: GetBiSourceRequest): Promise<BiSource> {
34
+ return service({url: `${BI_SOURCE_URL}/${request.id}`, method: "get", params: request});
35
+ }
36
+
37
+ /** 创建数据源配置。 */
38
+ CreateBiSource(request: CreateBiSourceRequest): Promise<BiSource> {
39
+ return service({url: BI_SOURCE_URL, method: "post", data: request.source});
40
+ }
41
+
42
+ /** 更新数据源配置。 */
43
+ UpdateBiSource(request: UpdateBiSourceRequest): Promise<BiSource> {
44
+ return service({url: `${BI_SOURCE_URL}/${request.source?.id ?? 0}`, method: "put", data: request.source});
45
+ }
46
+
47
+ /** 删除数据源配置。 */
48
+ DeleteBiSource(request: DeleteBiSourceRequest): Promise<DeleteBiSourceResponse> {
49
+ return service({url: `${BI_SOURCE_URL}/${request.id}`, method: "delete", data: request});
50
+ }
51
+
52
+ /** 修改数据源启用状态。 */
53
+ SetBiSourceStatus(request: SetBiSourceStatusRequest): Promise<BiSource> {
54
+ return service({url: `${BI_SOURCE_URL}/${request.id}/status`, method: "put", data: {status: request.status}});
55
+ }
56
+
57
+ /** 查询服务端已配置的数据库客户端选项。 */
58
+ OptionBiSourceDatabase(request: OptionBiSourceDatabaseRequest): Promise<OptionBiSourceDatabaseResponse> {
59
+ return service({url: `${BI_SOURCE_URL}/options/databases`, method: "get", params: request});
60
+ }
61
+
62
+ /** 测试数据源连接和表配置。 */
63
+ TestBiSource(request: TestBiSourceRequest): Promise<TestBiSourceResponse> {
64
+ return service({url: `${BI_SOURCE_URL}/test`, method: "post", data: request.source});
65
+ }
66
+
67
+ /** 查询数据源中的表和字段结构。 */
68
+ ListBiSourceTables(request: ListBiSourceTablesRequest): Promise<ListBiSourceTablesResponse> {
69
+ return service({url: `${BI_SOURCE_URL}/${request.id}/tables`, method: "get", params: request});
70
+ }
71
+
72
+ /** 保存数据源语义模型。 */
73
+ SaveBiSourceModel(request: SaveBiSourceModelRequest): Promise<BiSource> {
74
+ return service({url: `${BI_SOURCE_URL}/${request.id}/model`, method: "put", data: request.model});
75
+ }
76
+ }
77
+
78
+ export const defBiSourceService = new BiSourceServiceImpl();
79
+
80
+ export type { BiSourceForm };