@jeecg/online 1.0.1
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/AuthButtonConfig.js +140 -0
- package/AuthButtonTree.js +183 -0
- package/AuthDataConfig.js +243 -0
- package/AuthDataTree.js +160 -0
- package/AuthFieldConfig.js +167 -0
- package/AuthFieldTree.js +273 -0
- package/AuthManagerDrawer.js +125 -0
- package/AuthSetterModal.js +317 -0
- package/CgformCopyList.js +253 -0
- package/CgformModal.js +748 -0
- package/CgreportModal.js +673 -0
- package/ChartAutoRender.js +69 -0
- package/ChartDoubleRender.js +154 -0
- package/ChartSingleRender.js +132 -0
- package/ChartTabsRender.js +218 -0
- package/CheckDictTable.js +121 -0
- package/CodeGeneratorModal.js +293 -0
- package/CustomButtonList.js +413 -0
- package/DBAttributeTable.js +278 -0
- package/DbToOnlineModal.js +190 -0
- package/EnhanceJavaModal.js +304 -0
- package/EnhanceJsHistory.js +231 -0
- package/EnhanceJsModal.js +293 -0
- package/EnhanceSqlModal.js +305 -0
- package/ErrorTip.js +21 -0
- package/ExtendConfigModal.js +142 -0
- package/FieldTable.js +185 -0
- package/FileSelectModal.js +102 -0
- package/ForeignKeyTable.js +78 -0
- package/FormSchemaFactory.js +938 -0
- package/GraphreportAutoChart.js +352 -0
- package/GraphreportList.js +239 -0
- package/GraphreportModal.js +559 -0
- package/IndexTable.js +96 -0
- package/JOnlineSearchSelect.js +107 -0
- package/LICENSE +7 -0
- package/LeftDepart.js +96 -0
- package/LeftRole.js +95 -0
- package/LeftUser.js +114 -0
- package/ModalFormDemo.js +84 -0
- package/OnlineAutoList.js +410 -0
- package/OnlineAutoModal.js +265 -0
- package/OnlineAutoTreeList.js +513 -0
- package/OnlineCustomModal.js +269 -0
- package/OnlineForm.js +809 -0
- package/OnlineQueryForm.js +442 -0
- package/OnlineSearchFormItem.js +428 -0
- package/OnlineSelectCascade.js +217 -0
- package/OnlineSubForm.js +200 -0
- package/OnlineSuperQuery.js +912 -0
- package/OnlineSuperQueryValComponent.js +8 -0
- package/OnlineSuperQueryValComponent.vue_vue_type_script_lang.js +172 -0
- package/PageAttributeTable.js +242 -0
- package/ParamsTable.js +71 -0
- package/ProcessOnlineForm.js +183 -0
- package/QueryTable.js +128 -0
- package/README.md +23 -0
- package/_arrayPush.js +276 -0
- package/auth.api.js +43 -0
- package/auth.data.js +144 -0
- package/cgform.data.js +235 -0
- package/cloneDeep.js +475 -0
- package/enhance.api.js +120 -0
- package/enhance.data.js +196 -0
- package/graphreport.api.js +23 -0
- package/index.js +64 -0
- package/index2.js +336 -0
- package/index3.js +799 -0
- package/isArray.js +47 -0
- package/main.index.js +6 -0
- package/package.json +6 -0
- package/pick.js +238 -0
- package/style.css +1 -0
- package/toString.js +31 -0
- package/useAutoForm.js +4274 -0
- package/useCgformList.js +353 -0
- package/useChartRender.js +405 -0
- package/useMessageOnline.js +71 -0
- package/useOnlineTest.js +26866 -0
- package/useSchemas.js +505 -0
- package/useTableColumns.js +1154 -0
- package/useTableSync.js +105 -0
|
@@ -0,0 +1,559 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
var __async = (__this, __arguments, generator) => {
|
|
21
|
+
return new Promise((resolve, reject) => {
|
|
22
|
+
var fulfilled = (value) => {
|
|
23
|
+
try {
|
|
24
|
+
step(generator.next(value));
|
|
25
|
+
} catch (e) {
|
|
26
|
+
reject(e);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
var rejected = (value) => {
|
|
30
|
+
try {
|
|
31
|
+
step(generator.throw(value));
|
|
32
|
+
} catch (e) {
|
|
33
|
+
reject(e);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
37
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
import { ref, computed, defineComponent, reactive, nextTick, resolveComponent, openBlock, createBlock, mergeProps, withCtx, createVNode, createElementVNode, createTextVNode } from "vue";
|
|
41
|
+
import { BasicModal, useModalInner } from "/@/components/Modal";
|
|
42
|
+
import { BasicForm, useForm } from "/@/components/Form/index";
|
|
43
|
+
import { useMessage } from "/@/hooks/web/useMessage";
|
|
44
|
+
import { duplicateCheck } from "/@/views/system/user/user.api";
|
|
45
|
+
import { bindMapFormSchema } from "/@/utils/common/compUtils";
|
|
46
|
+
import { usePermissionStore } from "/@/store/modules/permission";
|
|
47
|
+
import FieldTable from "./FieldTable.js";
|
|
48
|
+
import ParamsTable from "./ParamsTable.js";
|
|
49
|
+
import { defHttp } from "/@/utils/http/axios";
|
|
50
|
+
import { isArray } from "/@/utils/is";
|
|
51
|
+
import { _ as _export_sfc } from "./index.js";
|
|
52
|
+
import "/@/components/jeecg/JVxeTable/types";
|
|
53
|
+
import "./useMessageOnline.js";
|
|
54
|
+
import "ant-design-vue";
|
|
55
|
+
import "@ant-design/icons-vue";
|
|
56
|
+
import "/@/components/jeecg/OnLine/JPopupOnlReport.vue";
|
|
57
|
+
import "vue-router";
|
|
58
|
+
function useFormSchemas(_, handler) {
|
|
59
|
+
const permissionStore = usePermissionStore();
|
|
60
|
+
const mapFormSchema = bindMapFormSchema({
|
|
61
|
+
one: {
|
|
62
|
+
colProps: { xs: 24, sm: 24 },
|
|
63
|
+
itemProps: {
|
|
64
|
+
labelCol: { xs: 24, sm: 2 },
|
|
65
|
+
wrapperCol: { xs: 24, sm: 22 }
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
tow: {
|
|
69
|
+
colProps: { xs: 24, sm: 12 },
|
|
70
|
+
itemProps: {
|
|
71
|
+
labelCol: { xs: 24, sm: 4 },
|
|
72
|
+
wrapperCol: { xs: 24, sm: 20 }
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
threeTow: {
|
|
76
|
+
colProps: { xs: 24, sm: 16 },
|
|
77
|
+
itemProps: {
|
|
78
|
+
labelCol: { xs: 24, sm: 3 },
|
|
79
|
+
wrapperCol: { xs: 24, sm: 21 }
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
three: {
|
|
83
|
+
colProps: { xs: 24, sm: 8 },
|
|
84
|
+
itemProps: {
|
|
85
|
+
labelCol: { xs: 24, sm: 6 },
|
|
86
|
+
wrapperCol: { xs: 24, sm: 18 }
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}, "three");
|
|
90
|
+
const dataType = ref("sql");
|
|
91
|
+
const isCombination = ref("combination");
|
|
92
|
+
const formInfo = {
|
|
93
|
+
cgrSql: {
|
|
94
|
+
sql: { label: "\u67E5\u8BE2SQL", placeholder: "\u8BF7\u8F93\u5165\u67E5\u8BE2SQL", language: "sql" },
|
|
95
|
+
json: { label: "\u6570\u636EJSON", placeholder: "\u8BF7\u8F93\u5165\u6570\u636EJSON", language: "javascript" },
|
|
96
|
+
api: { label: "API\u63A5\u53E3", placeholder: "\u8BF7\u8F93\u5165API\u63A5\u53E3", language: "javascript" }
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
const cgrSqlFormInfo = computed(() => {
|
|
100
|
+
return formInfo.cgrSql[dataType.value];
|
|
101
|
+
});
|
|
102
|
+
const formSchemas = computed(() => {
|
|
103
|
+
var _a, _b, _c;
|
|
104
|
+
return [
|
|
105
|
+
{ label: "ID", field: "id", component: "Input", show: false },
|
|
106
|
+
mapFormSchema({
|
|
107
|
+
label: "\u56FE\u8868\u540D\u79F0",
|
|
108
|
+
field: "name",
|
|
109
|
+
component: "Input",
|
|
110
|
+
required: true
|
|
111
|
+
}),
|
|
112
|
+
mapFormSchema({
|
|
113
|
+
label: "\u7F16\u7801",
|
|
114
|
+
field: "code",
|
|
115
|
+
component: "Input",
|
|
116
|
+
dynamicRules({ model }) {
|
|
117
|
+
return [
|
|
118
|
+
{ required: true, message: "\u8BF7\u8F93\u5165\u7F16\u7801!" },
|
|
119
|
+
{
|
|
120
|
+
validator(_0, _1) {
|
|
121
|
+
return __async(this, arguments, function* ({}, value) {
|
|
122
|
+
if (/[\u4E00-\u9FA5]/g.test(value)) {
|
|
123
|
+
return Promise.reject("\u7F16\u7801\u4E0D\u80FD\u4E3A\u6C49\u5B57");
|
|
124
|
+
}
|
|
125
|
+
let { success, message } = yield duplicateCheck({
|
|
126
|
+
tableName: "onl_graphreport_head",
|
|
127
|
+
fieldName: "code",
|
|
128
|
+
fieldVal: value,
|
|
129
|
+
dataId: model.id
|
|
130
|
+
});
|
|
131
|
+
if (!success) {
|
|
132
|
+
return Promise.reject(message);
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
];
|
|
138
|
+
}
|
|
139
|
+
}),
|
|
140
|
+
mapFormSchema({
|
|
141
|
+
label: "\u5C55\u793A\u6A21\u677F",
|
|
142
|
+
field: "displayTemplate",
|
|
143
|
+
component: "Select",
|
|
144
|
+
componentProps: {
|
|
145
|
+
options: [
|
|
146
|
+
{ label: "Tab\u98CE\u683C", value: "tab" },
|
|
147
|
+
{ label: "\u5355\u6392\u5E03\u5C40", value: "single" },
|
|
148
|
+
{ label: "\u53CC\u6392\u5E03\u5C40", value: "double" }
|
|
149
|
+
]
|
|
150
|
+
},
|
|
151
|
+
defaultValue: "tab"
|
|
152
|
+
}),
|
|
153
|
+
mapFormSchema({
|
|
154
|
+
label: "X\u8F74\u5B57\u6BB5",
|
|
155
|
+
field: "xaxisField",
|
|
156
|
+
component: "Input",
|
|
157
|
+
required: true
|
|
158
|
+
}),
|
|
159
|
+
mapFormSchema({
|
|
160
|
+
label: "Y\u8F74\u5B57\u6BB5",
|
|
161
|
+
field: "yaxisField",
|
|
162
|
+
component: "JDictSelectTag",
|
|
163
|
+
componentProps: {
|
|
164
|
+
mode: "tags",
|
|
165
|
+
open: false,
|
|
166
|
+
dictCode: "online_graph_display_template"
|
|
167
|
+
},
|
|
168
|
+
required: true
|
|
169
|
+
}, "threeTow"),
|
|
170
|
+
mapFormSchema({
|
|
171
|
+
label: "\u6570\u636E\u7C7B\u578B",
|
|
172
|
+
field: "dataType",
|
|
173
|
+
component: "JDictSelectTag",
|
|
174
|
+
componentProps: {
|
|
175
|
+
dictCode: "online_graph_data_type",
|
|
176
|
+
showChooseOption: false,
|
|
177
|
+
onChange: (value) => dataType.value = value
|
|
178
|
+
},
|
|
179
|
+
defaultValue: "sql"
|
|
180
|
+
}),
|
|
181
|
+
mapFormSchema({
|
|
182
|
+
label: "\u6570\u636E\u6E90",
|
|
183
|
+
field: "dbSource",
|
|
184
|
+
component: "Select",
|
|
185
|
+
componentProps: {
|
|
186
|
+
options: handler.dbSourceOptions.value
|
|
187
|
+
},
|
|
188
|
+
rules: [{ required: permissionStore.sysSafeMode, message: "\u8BF7\u9009\u62E9\u6570\u636E\u6E90\uFF01" }],
|
|
189
|
+
ifShow: ({ model }) => model.dataType === "sql"
|
|
190
|
+
}),
|
|
191
|
+
mapFormSchema({
|
|
192
|
+
label: "\u56FE\u8868\u7C7B\u578B",
|
|
193
|
+
field: "graphType",
|
|
194
|
+
component: "JDictSelectTag",
|
|
195
|
+
componentProps: {
|
|
196
|
+
mode: isCombination.value === "single" ? "default" : "multiple",
|
|
197
|
+
dictCode: "online_graph_type",
|
|
198
|
+
showChooseOption: false
|
|
199
|
+
},
|
|
200
|
+
defaultValue: ["bar"]
|
|
201
|
+
}, dataType.value === "sql" ? "three" : "threeTow"),
|
|
202
|
+
mapFormSchema({
|
|
203
|
+
label: "\u63CF\u8FF0",
|
|
204
|
+
field: "content",
|
|
205
|
+
component: "Input"
|
|
206
|
+
}, "one"),
|
|
207
|
+
mapFormSchema({
|
|
208
|
+
label: (_a = cgrSqlFormInfo.value) == null ? void 0 : _a.label,
|
|
209
|
+
field: "cgrSql",
|
|
210
|
+
required: true,
|
|
211
|
+
component: "JCodeEditor",
|
|
212
|
+
componentProps: {
|
|
213
|
+
placeholder: (_b = cgrSqlFormInfo.value) == null ? void 0 : _b.placeholder,
|
|
214
|
+
language: (_c = cgrSqlFormInfo.value) == null ? void 0 : _c.language,
|
|
215
|
+
fullScreen: true,
|
|
216
|
+
autoHeight: "!ie",
|
|
217
|
+
height: "150px"
|
|
218
|
+
},
|
|
219
|
+
dynamicRules() {
|
|
220
|
+
var _a2;
|
|
221
|
+
return [
|
|
222
|
+
{
|
|
223
|
+
required: true,
|
|
224
|
+
message: (_a2 = cgrSqlFormInfo.value) == null ? void 0 : _a2.placeholder
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
validator(_0, _1) {
|
|
228
|
+
return __async(this, arguments, function* ({}, value) {
|
|
229
|
+
if (value && dataType.value === "json") {
|
|
230
|
+
try {
|
|
231
|
+
JSON.parse(value);
|
|
232
|
+
} catch (e) {
|
|
233
|
+
return Promise.reject("JSON\u683C\u5F0F\u4E0D\u6B63\u786E\uFF01");
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
];
|
|
240
|
+
}
|
|
241
|
+
}, "one"),
|
|
242
|
+
mapFormSchema({
|
|
243
|
+
label: " ",
|
|
244
|
+
field: "cgrSql",
|
|
245
|
+
component: "Input",
|
|
246
|
+
slot: "SQLAnalyzeButton",
|
|
247
|
+
itemProps: { colon: false },
|
|
248
|
+
ifShow: ({ model }) => model.dataType === "sql"
|
|
249
|
+
}, "one"),
|
|
250
|
+
mapFormSchema({
|
|
251
|
+
label: "JS\u589E\u5F3A",
|
|
252
|
+
field: "extendJs",
|
|
253
|
+
component: "JCodeEditor",
|
|
254
|
+
componentProps: {
|
|
255
|
+
placeholder: "JS\u589E\u5F3A",
|
|
256
|
+
language: "javascript",
|
|
257
|
+
fullScreen: true,
|
|
258
|
+
autoHeight: "!ie",
|
|
259
|
+
height: "150px"
|
|
260
|
+
}
|
|
261
|
+
}, "one")
|
|
262
|
+
];
|
|
263
|
+
});
|
|
264
|
+
return { formSchemas, dataType, isCombination };
|
|
265
|
+
}
|
|
266
|
+
const _sfc_main = defineComponent({
|
|
267
|
+
name: "GraphreportModal",
|
|
268
|
+
components: { ParamsTable, FieldTable, BasicModal, BasicForm },
|
|
269
|
+
emits: ["register", "success"],
|
|
270
|
+
setup(props, { emit }) {
|
|
271
|
+
const { createMessage: $message } = useMessage();
|
|
272
|
+
const isUpdate = ref(false);
|
|
273
|
+
const fieldTableRef = ref();
|
|
274
|
+
const paramsTableRef = ref();
|
|
275
|
+
let model = {};
|
|
276
|
+
const title = computed(() => isUpdate.value ? "\u7F16\u8F91" : "\u65B0\u589E");
|
|
277
|
+
const activeKey = ref("field");
|
|
278
|
+
const confirmLoading = ref(false);
|
|
279
|
+
const dbSourceOptions = ref([]);
|
|
280
|
+
const fieldTable = reactive({
|
|
281
|
+
dataSource: []
|
|
282
|
+
});
|
|
283
|
+
const paramsTable = reactive({
|
|
284
|
+
dataSource: []
|
|
285
|
+
});
|
|
286
|
+
const [registerModal, { closeModal }] = useModalInner((data) => {
|
|
287
|
+
var _a;
|
|
288
|
+
isUpdate.value = (_a = data == null ? void 0 : data.isUpdate) != null ? _a : false;
|
|
289
|
+
if (isUpdate.value) {
|
|
290
|
+
edit(data == null ? void 0 : data.record);
|
|
291
|
+
} else {
|
|
292
|
+
add();
|
|
293
|
+
}
|
|
294
|
+
});
|
|
295
|
+
const { formSchemas, dataType, isCombination } = useFormSchemas(props, {
|
|
296
|
+
dbSourceOptions
|
|
297
|
+
});
|
|
298
|
+
const [registerForm, { resetFields, clearValidate, setFieldsValue, validate }] = useForm({
|
|
299
|
+
schemas: formSchemas,
|
|
300
|
+
showActionButtonGroup: false,
|
|
301
|
+
labelAlign: "right"
|
|
302
|
+
});
|
|
303
|
+
function add() {
|
|
304
|
+
return __async(this, null, function* () {
|
|
305
|
+
var _a, _b;
|
|
306
|
+
fieldTable.dataSource = [];
|
|
307
|
+
paramsTable.dataSource = [];
|
|
308
|
+
yield nextTick();
|
|
309
|
+
(_b = (_a = fieldTableRef.value) == null ? void 0 : _a.tableRef) == null ? void 0 : _b.addRows({}, { setActive: false });
|
|
310
|
+
edit({});
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
function edit(record) {
|
|
314
|
+
return __async(this, null, function* () {
|
|
315
|
+
var _a;
|
|
316
|
+
confirmLoading.value = false;
|
|
317
|
+
activeKey.value = "field";
|
|
318
|
+
yield resetFields();
|
|
319
|
+
model = Object.assign({}, record);
|
|
320
|
+
model.dbSource = model.dbSource == null ? "" : model.dbSource;
|
|
321
|
+
if (isCombination.value === "combination" && typeof model.graphType === "string") {
|
|
322
|
+
model.graphType = model.graphType.split(",");
|
|
323
|
+
}
|
|
324
|
+
if (typeof model.yaxisField === "string") {
|
|
325
|
+
model.yaxisField = model.yaxisField.split(",");
|
|
326
|
+
}
|
|
327
|
+
yield setFieldsValue(model);
|
|
328
|
+
yield clearValidate();
|
|
329
|
+
dataType.value = (_a = model.dataType) != null ? _a : "sql";
|
|
330
|
+
if (model.id) {
|
|
331
|
+
requestSubData(model.id);
|
|
332
|
+
}
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
function requestSubData(headId) {
|
|
336
|
+
confirmLoading.value = true;
|
|
337
|
+
requestTabData("/online/graphreport/head/queryOnlGraphreportItemByMainId", { id: headId }, fieldTable).finally(() => {
|
|
338
|
+
confirmLoading.value = false;
|
|
339
|
+
});
|
|
340
|
+
requestTabData("/online/graphreport/params/listByHeadId", { headId }, paramsTable);
|
|
341
|
+
}
|
|
342
|
+
function requestTabData(url, params, tab) {
|
|
343
|
+
return defHttp.get({ url, params }).then((result) => {
|
|
344
|
+
tab.dataSource = result || [];
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
function onSQLAnalyze() {
|
|
348
|
+
return __async(this, null, function* () {
|
|
349
|
+
var _a, _b;
|
|
350
|
+
confirmLoading.value = true;
|
|
351
|
+
try {
|
|
352
|
+
let { cgrSql } = yield validate(["cgrSql"]);
|
|
353
|
+
let result = yield defHttp.get({ url: "/online/cgreport/head/parseSql", params: { sql: cgrSql } });
|
|
354
|
+
$message.success("\u89E3\u6790\u6210\u529F");
|
|
355
|
+
let newData = (result.fields || []).map((item) => {
|
|
356
|
+
item.isShow = item.isShow === 1 ? "Y" : "N";
|
|
357
|
+
return item;
|
|
358
|
+
});
|
|
359
|
+
let oldData = (_b = (_a = fieldTableRef.value) == null ? void 0 : _a.tableRef) == null ? void 0 : _b.getTableData();
|
|
360
|
+
fieldTable.dataSource = getTableData(oldData, newData, "fieldName");
|
|
361
|
+
paramsTable.dataSource = getTableData(paramsTable.dataSource, result.params || [], "paramName");
|
|
362
|
+
} finally {
|
|
363
|
+
confirmLoading.value = false;
|
|
364
|
+
}
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
function onSubmit() {
|
|
368
|
+
return __async(this, null, function* () {
|
|
369
|
+
var _a, _b, _c, _d;
|
|
370
|
+
try {
|
|
371
|
+
let mainValues = yield validate();
|
|
372
|
+
let errMap = yield (_b = (_a = fieldTableRef.value) == null ? void 0 : _a.tableRef) == null ? void 0 : _b.validateTable();
|
|
373
|
+
if (errMap) {
|
|
374
|
+
activeKey.value = "field";
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
errMap = yield (_d = (_c = paramsTableRef.value) == null ? void 0 : _c.tableRef) == null ? void 0 : _d.validateTable();
|
|
378
|
+
if (errMap) {
|
|
379
|
+
activeKey.value = "params";
|
|
380
|
+
return;
|
|
381
|
+
}
|
|
382
|
+
let formData = classifyIntoFormData(mainValues);
|
|
383
|
+
confirmLoading.value = true;
|
|
384
|
+
yield request(formData);
|
|
385
|
+
emit("success");
|
|
386
|
+
closeModal();
|
|
387
|
+
} finally {
|
|
388
|
+
confirmLoading.value = false;
|
|
389
|
+
}
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
function request(params) {
|
|
393
|
+
if (isUpdate.value) {
|
|
394
|
+
return defHttp.put({ url: "/online/graphreport/head/edit", params });
|
|
395
|
+
} else {
|
|
396
|
+
return defHttp.post({ url: "/online/graphreport/head/add", params });
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
function classifyIntoFormData(mainValues) {
|
|
400
|
+
var _a, _b, _c, _d;
|
|
401
|
+
let main = Object.assign(model, mainValues);
|
|
402
|
+
if (isArray(main.graphType)) {
|
|
403
|
+
main.graphType = main.graphType.join(",");
|
|
404
|
+
}
|
|
405
|
+
if (isArray(main.yaxisField)) {
|
|
406
|
+
main.yaxisField = main.yaxisField.join(",");
|
|
407
|
+
}
|
|
408
|
+
return __spreadProps(__spreadValues({}, main), {
|
|
409
|
+
onlGraphreportItemList: (_b = (_a = fieldTableRef.value) == null ? void 0 : _a.tableRef) == null ? void 0 : _b.getTableData(),
|
|
410
|
+
paramsList: (_d = (_c = paramsTableRef.value) == null ? void 0 : _c.tableRef) == null ? void 0 : _d.getTableData()
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
function onCancel() {
|
|
414
|
+
closeModal();
|
|
415
|
+
}
|
|
416
|
+
function queryDataSourceOptions() {
|
|
417
|
+
return __async(this, null, function* () {
|
|
418
|
+
let url = "/sys/dataSource/options";
|
|
419
|
+
try {
|
|
420
|
+
let result = yield defHttp.get({ url });
|
|
421
|
+
dbSourceOptions.value = result || [];
|
|
422
|
+
dbSourceOptions.value.unshift({ label: "\u8BF7\u9009\u62E9", value: "" });
|
|
423
|
+
} catch (e) {
|
|
424
|
+
dbSourceOptions.value = [{ label: "\u52A0\u8F7D\u5931\u8D25", value: void 0 }];
|
|
425
|
+
}
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
queryDataSourceOptions();
|
|
429
|
+
return {
|
|
430
|
+
fieldTableRef,
|
|
431
|
+
paramsTableRef,
|
|
432
|
+
title,
|
|
433
|
+
confirmLoading,
|
|
434
|
+
activeKey,
|
|
435
|
+
fieldTable,
|
|
436
|
+
paramsTable,
|
|
437
|
+
onSubmit,
|
|
438
|
+
onCancel,
|
|
439
|
+
onSQLAnalyze,
|
|
440
|
+
registerModal,
|
|
441
|
+
registerForm
|
|
442
|
+
};
|
|
443
|
+
}
|
|
444
|
+
});
|
|
445
|
+
function getTableData(oldData, newData, columnName) {
|
|
446
|
+
newData.forEach((newItem) => {
|
|
447
|
+
for (let oldItem of oldData) {
|
|
448
|
+
if (oldItem[columnName] === newItem[columnName]) {
|
|
449
|
+
Object.assign(newItem, oldItem);
|
|
450
|
+
break;
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
});
|
|
454
|
+
return newData;
|
|
455
|
+
}
|
|
456
|
+
const _hoisted_1 = { style: { "flex": "1", "text-align": "right" } };
|
|
457
|
+
const _hoisted_2 = /* @__PURE__ */ createTextVNode("SQL\u89E3\u6790");
|
|
458
|
+
const _hoisted_3 = /* @__PURE__ */ createTextVNode("\u5173\u95ED");
|
|
459
|
+
const _hoisted_4 = /* @__PURE__ */ createTextVNode("\u4FDD\u5B58");
|
|
460
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
461
|
+
const _component_a_button = resolveComponent("a-button");
|
|
462
|
+
const _component_BasicForm = resolveComponent("BasicForm");
|
|
463
|
+
const _component_FieldTable = resolveComponent("FieldTable");
|
|
464
|
+
const _component_a_tab_pane = resolveComponent("a-tab-pane");
|
|
465
|
+
const _component_ParamsTable = resolveComponent("ParamsTable");
|
|
466
|
+
const _component_a_tabs = resolveComponent("a-tabs");
|
|
467
|
+
const _component_a_spin = resolveComponent("a-spin");
|
|
468
|
+
const _component_BasicModal = resolveComponent("BasicModal");
|
|
469
|
+
return openBlock(), createBlock(_component_BasicModal, mergeProps({
|
|
470
|
+
title: _ctx.title,
|
|
471
|
+
width: 1200,
|
|
472
|
+
maskClosable: false,
|
|
473
|
+
confirmLoading: _ctx.confirmLoading,
|
|
474
|
+
defaultFullscreen: ""
|
|
475
|
+
}, _ctx.$attrs, {
|
|
476
|
+
onCancel: _ctx.onCancel,
|
|
477
|
+
onRegister: _ctx.registerModal
|
|
478
|
+
}), {
|
|
479
|
+
footer: withCtx(() => [
|
|
480
|
+
createVNode(_component_a_button, { onClick: _ctx.onCancel }, {
|
|
481
|
+
default: withCtx(() => [
|
|
482
|
+
_hoisted_3
|
|
483
|
+
]),
|
|
484
|
+
_: 1
|
|
485
|
+
}, 8, ["onClick"]),
|
|
486
|
+
createVNode(_component_a_button, {
|
|
487
|
+
type: "primary",
|
|
488
|
+
loading: _ctx.confirmLoading,
|
|
489
|
+
preIcon: "ant-design:save",
|
|
490
|
+
onClick: _ctx.onSubmit
|
|
491
|
+
}, {
|
|
492
|
+
default: withCtx(() => [
|
|
493
|
+
_hoisted_4
|
|
494
|
+
]),
|
|
495
|
+
_: 1
|
|
496
|
+
}, 8, ["loading", "onClick"])
|
|
497
|
+
]),
|
|
498
|
+
default: withCtx(() => [
|
|
499
|
+
createVNode(_component_a_spin, { spinning: _ctx.confirmLoading }, {
|
|
500
|
+
default: withCtx(() => [
|
|
501
|
+
createVNode(_component_BasicForm, { onRegister: _ctx.registerForm }, {
|
|
502
|
+
SQLAnalyzeButton: withCtx(() => [
|
|
503
|
+
createElementVNode("div", _hoisted_1, [
|
|
504
|
+
createVNode(_component_a_button, {
|
|
505
|
+
type: "primary",
|
|
506
|
+
onClick: _ctx.onSQLAnalyze
|
|
507
|
+
}, {
|
|
508
|
+
default: withCtx(() => [
|
|
509
|
+
_hoisted_2
|
|
510
|
+
]),
|
|
511
|
+
_: 1
|
|
512
|
+
}, 8, ["onClick"])
|
|
513
|
+
])
|
|
514
|
+
]),
|
|
515
|
+
_: 1
|
|
516
|
+
}, 8, ["onRegister"]),
|
|
517
|
+
createVNode(_component_a_tabs, {
|
|
518
|
+
activeKey: _ctx.activeKey,
|
|
519
|
+
"onUpdate:activeKey": _cache[0] || (_cache[0] = ($event) => _ctx.activeKey = $event)
|
|
520
|
+
}, {
|
|
521
|
+
default: withCtx(() => [
|
|
522
|
+
createVNode(_component_a_tab_pane, {
|
|
523
|
+
tab: "\u5217\u8868\u5B57\u6BB5",
|
|
524
|
+
key: "field",
|
|
525
|
+
forceRender: ""
|
|
526
|
+
}, {
|
|
527
|
+
default: withCtx(() => [
|
|
528
|
+
createVNode(_component_FieldTable, {
|
|
529
|
+
ref: "fieldTableRef",
|
|
530
|
+
dataSource: _ctx.fieldTable.dataSource
|
|
531
|
+
}, null, 8, ["dataSource"])
|
|
532
|
+
]),
|
|
533
|
+
_: 1
|
|
534
|
+
}),
|
|
535
|
+
createVNode(_component_a_tab_pane, {
|
|
536
|
+
tab: "\u56FE\u8868\u53C2\u6570",
|
|
537
|
+
key: "params",
|
|
538
|
+
forceRender: ""
|
|
539
|
+
}, {
|
|
540
|
+
default: withCtx(() => [
|
|
541
|
+
createVNode(_component_ParamsTable, {
|
|
542
|
+
ref: "paramsTableRef",
|
|
543
|
+
dataSource: _ctx.paramsTable.dataSource
|
|
544
|
+
}, null, 8, ["dataSource"])
|
|
545
|
+
]),
|
|
546
|
+
_: 1
|
|
547
|
+
})
|
|
548
|
+
]),
|
|
549
|
+
_: 1
|
|
550
|
+
}, 8, ["activeKey"])
|
|
551
|
+
]),
|
|
552
|
+
_: 1
|
|
553
|
+
}, 8, ["spinning"])
|
|
554
|
+
]),
|
|
555
|
+
_: 1
|
|
556
|
+
}, 16, ["title", "confirmLoading", "onCancel", "onRegister"]);
|
|
557
|
+
}
|
|
558
|
+
var GraphreportModal = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
559
|
+
export { GraphreportModal as default };
|
package/IndexTable.js
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { defineComponent, ref, resolveComponent, openBlock, createBlock } from "vue";
|
|
2
|
+
import { JVxeTypes } from "/@/components/jeecg/JVxeTable/types";
|
|
3
|
+
import { u as useTableSync } from "./useTableSync.js";
|
|
4
|
+
import { _ as _export_sfc } from "./index.js";
|
|
5
|
+
import "./cgform.data.js";
|
|
6
|
+
import "/@/utils/dict";
|
|
7
|
+
import "/@/utils/dict/JDictSelectUtil";
|
|
8
|
+
import "/@/utils/uuid";
|
|
9
|
+
import "./pick.js";
|
|
10
|
+
import "./isArray.js";
|
|
11
|
+
import "./toString.js";
|
|
12
|
+
import "./_arrayPush.js";
|
|
13
|
+
import "/@/components/jeecg/OnLine/JPopupOnlReport.vue";
|
|
14
|
+
import "/@/hooks/web/useMessage";
|
|
15
|
+
import "vue-router";
|
|
16
|
+
const _sfc_main = defineComponent({
|
|
17
|
+
name: "IndexTable",
|
|
18
|
+
components: {},
|
|
19
|
+
props: {
|
|
20
|
+
actionButton: {
|
|
21
|
+
type: Boolean,
|
|
22
|
+
default: true,
|
|
23
|
+
required: false
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
setup() {
|
|
27
|
+
const columns = ref([
|
|
28
|
+
{
|
|
29
|
+
title: "\u7D22\u5F15\u540D\u79F0",
|
|
30
|
+
key: "indexName",
|
|
31
|
+
width: 330,
|
|
32
|
+
type: JVxeTypes.input,
|
|
33
|
+
defaultValue: "",
|
|
34
|
+
placeholder: "\u8BF7\u8F93\u5165${title}",
|
|
35
|
+
validateRules: [{ required: true, message: "${title}\u4E0D\u80FD\u4E3A\u7A7A" }]
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
title: "\u7D22\u5F15\u680F\u4F4D",
|
|
39
|
+
key: "indexField",
|
|
40
|
+
width: 330,
|
|
41
|
+
type: JVxeTypes.selectMultiple,
|
|
42
|
+
options: [],
|
|
43
|
+
defaultValue: "",
|
|
44
|
+
placeholder: "\u8BF7\u9009\u62E9${title}",
|
|
45
|
+
validateRules: [{ required: true, message: "\u8BF7\u9009\u62E9${title}" }]
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
title: "\u7D22\u5F15\u7C7B\u578B",
|
|
49
|
+
key: "indexType",
|
|
50
|
+
width: 330,
|
|
51
|
+
type: JVxeTypes.select,
|
|
52
|
+
options: [
|
|
53
|
+
{ title: "normal", value: "normal" },
|
|
54
|
+
{ title: "unique", value: "unique" }
|
|
55
|
+
],
|
|
56
|
+
defaultValue: "normal",
|
|
57
|
+
placeholder: "\u8BF7\u9009\u62E9${title}",
|
|
58
|
+
validateRules: [{ required: true, message: "\u8BF7\u9009\u62E9${title}" }]
|
|
59
|
+
}
|
|
60
|
+
]);
|
|
61
|
+
const setup = useTableSync(columns);
|
|
62
|
+
const { tableRef, loading, dataSource, tableHeight, setDataSource, validateData } = setup;
|
|
63
|
+
function syncTable(dbTable) {
|
|
64
|
+
let options = [];
|
|
65
|
+
let data = dbTable.value.tableRef.getTableData();
|
|
66
|
+
data.forEach((value) => {
|
|
67
|
+
if (value.dbFieldName) {
|
|
68
|
+
options.push({
|
|
69
|
+
title: value.dbFieldName,
|
|
70
|
+
value: value.dbFieldName
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
columns.value[1].options = options;
|
|
75
|
+
}
|
|
76
|
+
return { tableRef, loading, dataSource, columns, tableHeight, syncTable, setDataSource, validateData };
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
80
|
+
const _component_JVxeTable = resolveComponent("JVxeTable");
|
|
81
|
+
return openBlock(), createBlock(_component_JVxeTable, {
|
|
82
|
+
ref: "tableRef",
|
|
83
|
+
rowNumber: "",
|
|
84
|
+
rowSelection: "",
|
|
85
|
+
dragSort: "",
|
|
86
|
+
keyboardEdit: "",
|
|
87
|
+
sortKey: "orderNum",
|
|
88
|
+
maxHeight: _ctx.tableHeight.normal,
|
|
89
|
+
loading: _ctx.loading,
|
|
90
|
+
columns: _ctx.columns,
|
|
91
|
+
dataSource: _ctx.dataSource,
|
|
92
|
+
toolbar: _ctx.actionButton
|
|
93
|
+
}, null, 8, ["maxHeight", "loading", "columns", "dataSource", "toolbar"]);
|
|
94
|
+
}
|
|
95
|
+
var IndexTable = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
96
|
+
export { IndexTable as default };
|