@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.
Files changed (82) hide show
  1. package/AuthButtonConfig.js +140 -0
  2. package/AuthButtonTree.js +183 -0
  3. package/AuthDataConfig.js +243 -0
  4. package/AuthDataTree.js +160 -0
  5. package/AuthFieldConfig.js +167 -0
  6. package/AuthFieldTree.js +273 -0
  7. package/AuthManagerDrawer.js +125 -0
  8. package/AuthSetterModal.js +317 -0
  9. package/CgformCopyList.js +253 -0
  10. package/CgformModal.js +748 -0
  11. package/CgreportModal.js +673 -0
  12. package/ChartAutoRender.js +69 -0
  13. package/ChartDoubleRender.js +154 -0
  14. package/ChartSingleRender.js +132 -0
  15. package/ChartTabsRender.js +218 -0
  16. package/CheckDictTable.js +121 -0
  17. package/CodeGeneratorModal.js +293 -0
  18. package/CustomButtonList.js +413 -0
  19. package/DBAttributeTable.js +278 -0
  20. package/DbToOnlineModal.js +190 -0
  21. package/EnhanceJavaModal.js +304 -0
  22. package/EnhanceJsHistory.js +231 -0
  23. package/EnhanceJsModal.js +293 -0
  24. package/EnhanceSqlModal.js +305 -0
  25. package/ErrorTip.js +21 -0
  26. package/ExtendConfigModal.js +142 -0
  27. package/FieldTable.js +185 -0
  28. package/FileSelectModal.js +102 -0
  29. package/ForeignKeyTable.js +78 -0
  30. package/FormSchemaFactory.js +938 -0
  31. package/GraphreportAutoChart.js +352 -0
  32. package/GraphreportList.js +239 -0
  33. package/GraphreportModal.js +559 -0
  34. package/IndexTable.js +96 -0
  35. package/JOnlineSearchSelect.js +107 -0
  36. package/LICENSE +7 -0
  37. package/LeftDepart.js +96 -0
  38. package/LeftRole.js +95 -0
  39. package/LeftUser.js +114 -0
  40. package/ModalFormDemo.js +84 -0
  41. package/OnlineAutoList.js +410 -0
  42. package/OnlineAutoModal.js +265 -0
  43. package/OnlineAutoTreeList.js +513 -0
  44. package/OnlineCustomModal.js +269 -0
  45. package/OnlineForm.js +809 -0
  46. package/OnlineQueryForm.js +442 -0
  47. package/OnlineSearchFormItem.js +428 -0
  48. package/OnlineSelectCascade.js +217 -0
  49. package/OnlineSubForm.js +200 -0
  50. package/OnlineSuperQuery.js +912 -0
  51. package/OnlineSuperQueryValComponent.js +8 -0
  52. package/OnlineSuperQueryValComponent.vue_vue_type_script_lang.js +172 -0
  53. package/PageAttributeTable.js +242 -0
  54. package/ParamsTable.js +71 -0
  55. package/ProcessOnlineForm.js +183 -0
  56. package/QueryTable.js +128 -0
  57. package/README.md +23 -0
  58. package/_arrayPush.js +276 -0
  59. package/auth.api.js +43 -0
  60. package/auth.data.js +144 -0
  61. package/cgform.data.js +235 -0
  62. package/cloneDeep.js +475 -0
  63. package/enhance.api.js +120 -0
  64. package/enhance.data.js +196 -0
  65. package/graphreport.api.js +23 -0
  66. package/index.js +64 -0
  67. package/index2.js +336 -0
  68. package/index3.js +799 -0
  69. package/isArray.js +47 -0
  70. package/main.index.js +6 -0
  71. package/package.json +6 -0
  72. package/pick.js +238 -0
  73. package/style.css +1 -0
  74. package/toString.js +31 -0
  75. package/useAutoForm.js +4274 -0
  76. package/useCgformList.js +353 -0
  77. package/useChartRender.js +405 -0
  78. package/useMessageOnline.js +71 -0
  79. package/useOnlineTest.js +26866 -0
  80. package/useSchemas.js +505 -0
  81. package/useTableColumns.js +1154 -0
  82. package/useTableSync.js +105 -0
@@ -0,0 +1,673 @@
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 { defineComponent, ref, reactive, unref, computed, resolveComponent, openBlock, createBlock, mergeProps, withCtx, createVNode, createElementVNode, createTextVNode, nextTick } from "vue";
41
+ import { useModalInner, BasicModal } from "/@/components/Modal";
42
+ import { useForm, BasicForm } from "/@/components/Form/index";
43
+ import { useJvxeMethod } from "/@/hooks/system/useJvxeMethods.ts";
44
+ import { JVxeTypes } from "/@/components/jeecg/JVxeTable/types";
45
+ import { duplicateCheck } from "/@/views/system/user/user.api";
46
+ import { defHttp } from "/@/utils/http/axios";
47
+ import { Modal } from "ant-design-vue";
48
+ import { useMessage } from "/@/hooks/web/useMessage";
49
+ const onlCgreportParamList = "/online/cgreport/param/listByHeadId";
50
+ const onlCgreportItemList = "/online/cgreport/item/listByHeadId";
51
+ const list = (params) => defHttp.get({ url: "/online/cgreport/head/list", params });
52
+ const deleteOne = (params, handleSuccess) => {
53
+ return defHttp.delete({ url: "/online/cgreport/head/delete", params }, { joinParamsToUrl: true }).then(() => {
54
+ handleSuccess();
55
+ });
56
+ };
57
+ const batchDelete = (params, handleSuccess) => {
58
+ Modal.confirm({
59
+ title: "\u786E\u8BA4\u5220\u9664",
60
+ content: "\u662F\u5426\u5220\u9664\u9009\u4E2D\u6570\u636E",
61
+ okText: "\u786E\u8BA4",
62
+ cancelText: "\u53D6\u6D88",
63
+ onOk: () => {
64
+ return defHttp.delete({ url: "/online/cgreport/head/deleteBatch", data: params }, { joinParamsToUrl: true }).then(() => {
65
+ handleSuccess();
66
+ });
67
+ }
68
+ });
69
+ };
70
+ const saveOrUpdate = (params, isUpdate) => {
71
+ if (isUpdate) {
72
+ return defHttp.put({ url: "/online/cgreport/head/editAll", params });
73
+ } else {
74
+ return defHttp.post({ url: "/online/cgreport/head/add", params });
75
+ }
76
+ };
77
+ const getReportParam = (id) => {
78
+ return defHttp.get({ url: "/online/cgreport/api/getParamsInfo/" + id });
79
+ };
80
+ const getDataSourceList = () => {
81
+ return defHttp.get({ url: "/sys/dataSource/options" });
82
+ };
83
+ const analyzeSql = (params) => {
84
+ return defHttp.get({
85
+ url: "/online/cgreport/head/parseSql?" + params
86
+ });
87
+ };
88
+ const columns = [
89
+ {
90
+ title: "\u62A5\u8868\u540D\u5B57",
91
+ align: "center",
92
+ dataIndex: "name",
93
+ width: 120
94
+ },
95
+ {
96
+ title: "\u62A5\u8868\u7F16\u7801",
97
+ align: "center",
98
+ dataIndex: "code",
99
+ width: 120
100
+ },
101
+ {
102
+ title: "\u62A5\u8868SQL",
103
+ align: "center",
104
+ dataIndex: "cgrSql",
105
+ width: 360
106
+ },
107
+ {
108
+ title: "\u6570\u636E\u6E90",
109
+ align: "center",
110
+ dataIndex: "dbSource",
111
+ width: 120
112
+ },
113
+ {
114
+ title: "\u521B\u5EFA\u65F6\u95F4",
115
+ align: "center",
116
+ dataIndex: "createTime",
117
+ width: 120
118
+ }
119
+ ];
120
+ const searchFormSchema = [
121
+ {
122
+ label: "\u62A5\u8868\u540D\u79F0",
123
+ field: "name",
124
+ component: "JInput"
125
+ },
126
+ {
127
+ label: "\u62A5\u8868\u7F16\u7801",
128
+ field: "code",
129
+ component: "JInput"
130
+ }
131
+ ];
132
+ const codePattern = /^[a-z|A-Z][a-z|A-Z|\d|_|-]{0,}$/;
133
+ const formSchema = [
134
+ {
135
+ label: "",
136
+ field: "id",
137
+ component: "Input",
138
+ show: false
139
+ },
140
+ {
141
+ label: "\u62A5\u8868\u7F16\u7801",
142
+ field: "code",
143
+ component: "Input",
144
+ colProps: {
145
+ sm: 24,
146
+ xs: 24,
147
+ md: 12,
148
+ lg: 8,
149
+ xl: 8,
150
+ xxl: 8
151
+ },
152
+ dynamicRules: ({ values, model }) => {
153
+ console.log("values:", values);
154
+ return [
155
+ {
156
+ required: true,
157
+ validator: (_, value) => {
158
+ return new Promise((resolve, reject) => {
159
+ if (!value) {
160
+ return reject("\u8BF7\u8F93\u5165\u62A5\u8868\u7F16\u7801\uFF01");
161
+ }
162
+ if (!codePattern.test(value)) {
163
+ return reject("\u7F16\u7801\u5FC5\u987B\u4EE5\u5B57\u6BCD\u5F00\u5934\uFF0C\u53EF\u5305\u542B\u6570\u5B57\u3001\u4E0B\u5212\u7EBF\u3001\u6A2A\u6760\uFF01");
164
+ }
165
+ let params = {
166
+ tableName: "onl_cgreport_head",
167
+ fieldName: "code",
168
+ fieldVal: value,
169
+ dataId: model.id
170
+ };
171
+ duplicateCheck(params).then((res) => {
172
+ res.success ? resolve() : reject("\u62A5\u8868\u7F16\u7801\u5DF2\u5B58\u5728!");
173
+ }).catch((err) => {
174
+ reject(err.message || "\u6821\u9A8C\u5931\u8D25");
175
+ });
176
+ });
177
+ }
178
+ }
179
+ ];
180
+ }
181
+ },
182
+ {
183
+ label: "\u62A5\u8868\u540D\u5B57",
184
+ field: "name",
185
+ component: "Input",
186
+ colProps: {
187
+ sm: 24,
188
+ xs: 24,
189
+ md: 12,
190
+ lg: 8,
191
+ xl: 8,
192
+ xxl: 8
193
+ },
194
+ dynamicRules: () => {
195
+ return [
196
+ { required: true, message: "\u8BF7\u8F93\u5165\u62A5\u8868\u540D\u5B57!" }
197
+ ];
198
+ }
199
+ },
200
+ {
201
+ label: "\u52A8\u6001\u6570\u636E\u6E90",
202
+ field: "dbSource",
203
+ colProps: {
204
+ sm: 24,
205
+ xs: 24,
206
+ md: 12,
207
+ lg: 8,
208
+ xl: 8,
209
+ xxl: 8
210
+ },
211
+ component: "ApiSelect",
212
+ componentProps: {
213
+ api: getDataSourceList
214
+ }
215
+ },
216
+ {
217
+ label: "\u62A5\u8868SQL",
218
+ field: "cgrSql",
219
+ component: "JCodeEditor",
220
+ rules: [{ required: true, message: "\u8BF7\u586B\u5199\u62A5\u8868SQL" }],
221
+ itemProps: {
222
+ labelCol: { xs: 24, sm: 2 },
223
+ wrapperCol: { xs: 24, sm: 22 }
224
+ },
225
+ componentProps: {
226
+ height: "200px",
227
+ fullScreen: true
228
+ },
229
+ colProps: {
230
+ span: 20
231
+ }
232
+ },
233
+ {
234
+ label: " ",
235
+ field: "analyseButton",
236
+ component: "Input",
237
+ slot: "analyseButton",
238
+ colProps: {
239
+ span: 4
240
+ },
241
+ itemProps: {
242
+ labelCol: { xs: 1, sm: 1 },
243
+ wrapperCol: { xs: 23, sm: 23 },
244
+ colon: false
245
+ }
246
+ }
247
+ ];
248
+ const onlCgreportParamColumns = [
249
+ {
250
+ title: "\u53C2\u6570\u5B57\u6BB5",
251
+ key: "paramName",
252
+ type: JVxeTypes.input,
253
+ width: "200px",
254
+ placeholder: "\u8BF7\u8F93\u5165${title}",
255
+ defaultValue: "",
256
+ validateRules: [{ required: true, message: "${title}\u4E0D\u80FD\u4E3A\u7A7A" }]
257
+ },
258
+ {
259
+ title: "\u53C2\u6570\u6587\u672C",
260
+ key: "paramTxt",
261
+ type: JVxeTypes.input,
262
+ width: "200px",
263
+ placeholder: "\u8BF7\u8F93\u5165${title}",
264
+ defaultValue: "",
265
+ validateRules: [{ required: true, message: "${title}\u4E0D\u80FD\u4E3A\u7A7A" }]
266
+ },
267
+ {
268
+ title: "\u53C2\u6570\u9ED8\u8BA4\u503C",
269
+ key: "paramValue",
270
+ type: JVxeTypes.input,
271
+ width: "200px",
272
+ placeholder: "\u8BF7\u8F93\u5165${title}",
273
+ defaultValue: ""
274
+ }
275
+ ];
276
+ const onlCgreportItemColumns = [
277
+ {
278
+ title: "\u5B57\u6BB5\u540D\u5B57",
279
+ key: "fieldName",
280
+ type: JVxeTypes.input,
281
+ minWidth: "150px",
282
+ placeholder: "\u8BF7\u8F93\u5165${title}",
283
+ defaultValue: "",
284
+ validateRules: [{ required: true, message: "${title}\u4E0D\u80FD\u4E3A\u7A7A" }]
285
+ },
286
+ {
287
+ title: "\u5B57\u6BB5\u6587\u672C",
288
+ key: "fieldTxt",
289
+ type: JVxeTypes.input,
290
+ minWidth: "150px",
291
+ placeholder: "\u8BF7\u8F93\u5165${title}",
292
+ defaultValue: "",
293
+ validateRules: [{ required: true, message: "${title}\u4E0D\u80FD\u4E3A\u7A7A" }]
294
+ },
295
+ {
296
+ title: "\u5B57\u6BB5\u7C7B\u578B",
297
+ key: "fieldType",
298
+ minWidth: "150px",
299
+ placeholder: "\u8BF7\u8F93\u5165${title}",
300
+ defaultValue: "",
301
+ validateRules: [{ required: true, message: "${title}\u4E0D\u80FD\u4E3A\u7A7A" }],
302
+ type: JVxeTypes.select,
303
+ options: [
304
+ { title: "\u6570\u503C\u7C7B\u578B", value: "Integer" },
305
+ { title: "\u5B57\u7B26\u7C7B\u578B", value: "String" },
306
+ { title: "\u65E5\u671F\u7C7B\u578B", value: "Date" },
307
+ { title: "\u65F6\u95F4\u7C7B\u578B", value: "Datetime" },
308
+ { title: "\u957F\u6574\u578B", value: "Long" }
309
+ ]
310
+ },
311
+ {
312
+ title: "\u662F\u5426\u663E\u793A",
313
+ key: "isShow",
314
+ minWidth: "80px",
315
+ align: "center",
316
+ type: JVxeTypes.checkbox,
317
+ customValue: [1, 0],
318
+ defaultChecked: true
319
+ },
320
+ {
321
+ title: "\u5B57\u6BB5href",
322
+ key: "fieldHref",
323
+ type: JVxeTypes.input,
324
+ minWidth: "150px",
325
+ placeholder: "\u8BF7\u8F93\u5165${title}",
326
+ defaultValue: ""
327
+ },
328
+ {
329
+ title: "\u67E5\u8BE2\u6A21\u5F0F",
330
+ key: "searchMode",
331
+ type: JVxeTypes.select,
332
+ minWidth: "150px",
333
+ placeholder: "\u8BF7\u9009\u62E9${title}",
334
+ options: [
335
+ { title: "\u5355\u6761\u4EF6\u67E5\u8BE2", value: "single" },
336
+ { title: "\u8303\u56F4\u67E5\u8BE2", value: "group" }
337
+ ]
338
+ },
339
+ {
340
+ title: "\u53D6\u503C\u8868\u8FBE\u5F0F",
341
+ key: "replaceVal",
342
+ type: JVxeTypes.input,
343
+ minWidth: "150px",
344
+ placeholder: "\u8BF7\u8F93\u5165${title}",
345
+ defaultValue: ""
346
+ },
347
+ {
348
+ title: "\u5B57\u5178code",
349
+ key: "dictCode",
350
+ type: JVxeTypes.input,
351
+ minWidth: "150px",
352
+ placeholder: "\u8BF7\u8F93\u5165${title}",
353
+ defaultValue: ""
354
+ },
355
+ {
356
+ title: "\u5206\u7EC4\u6807\u9898",
357
+ key: "groupTitle",
358
+ type: JVxeTypes.input,
359
+ minWidth: "150px",
360
+ placeholder: "\u8BF7\u8F93\u5165${title}",
361
+ defaultValue: ""
362
+ },
363
+ {
364
+ title: "\u662F\u5426\u67E5\u8BE2",
365
+ key: "isSearch",
366
+ type: JVxeTypes.checkbox,
367
+ customValue: ["1", "0"],
368
+ minWidth: "80px",
369
+ align: "center",
370
+ defaultChecked: false
371
+ },
372
+ {
373
+ title: "\u662F\u5426\u5408\u8BA1",
374
+ align: "center",
375
+ key: "isTotal",
376
+ type: JVxeTypes.checkbox,
377
+ customValue: ["1", "0"],
378
+ minWidth: "80px",
379
+ defaultChecked: false
380
+ }
381
+ ];
382
+ const _hoisted_1 = { style: { "flex": "1", "text-align": "left" } };
383
+ const _hoisted_2 = /* @__PURE__ */ createTextVNode(" \u60A8\u53EF\u4EE5\u952E\u5165\u201C\u201D\u4F5C\u4E3A\u4E00\u4E2A\u53C2\u6570\uFF0C\u8FD9\u91CCabc\u662F\u53C2\u6570\u7684\u540D\u79F0\u3002\u4F8B\u5982\uFF1A");
384
+ const _hoisted_3 = /* @__PURE__ */ createElementVNode("br", null, null, -1);
385
+ const _hoisted_4 = /* @__PURE__ */ createTextVNode(" select * from table where id = ${abc}\u3002");
386
+ const _hoisted_5 = /* @__PURE__ */ createElementVNode("br", null, null, -1);
387
+ const _hoisted_6 = /* @__PURE__ */ createTextVNode(" select * from table where id like concat('%',${abc},'%')\u3002(mysql\u6A21\u7CCA\u67E5\u8BE2)");
388
+ const _hoisted_7 = /* @__PURE__ */ createElementVNode("br", null, null, -1);
389
+ const _hoisted_8 = /* @__PURE__ */ createTextVNode(" select * from table where id like '%'||${abc}||'%'\u3002(oracle\u6A21\u7CCA\u67E5\u8BE2)");
390
+ const _hoisted_9 = /* @__PURE__ */ createElementVNode("br", null, null, -1);
391
+ const _hoisted_10 = /* @__PURE__ */ createTextVNode(" select * from table where id like '%'+${abc}+'%'\u3002(sqlserver\u6A21\u7CCA\u67E5\u8BE2)");
392
+ const _hoisted_11 = /* @__PURE__ */ createElementVNode("br", null, null, -1);
393
+ const _hoisted_12 = /* @__PURE__ */ createElementVNode("span", { style: { "color": "red" } }, "\u6CE8\uFF1A\u53C2\u6570\u53EA\u652F\u6301\u52A8\u6001\u62A5\u8868\uFF0Cpopup\u6682\u4E0D\u652F\u6301", -1);
394
+ const _hoisted_13 = /* @__PURE__ */ createTextVNode("SQL\u89E3\u6790");
395
+ const _sfc_main = /* @__PURE__ */ defineComponent({
396
+ name: "CgreportModal",
397
+ emits: ["register", "success"],
398
+ setup(__props, { emit }) {
399
+ const { createMessage } = useMessage();
400
+ const isUpdate = ref(true);
401
+ const confirmLoading = ref(true);
402
+ const refKeys = ref(["onlCgreportItem", "onlCgreportParam"]);
403
+ const activeKey = ref("onlCgreportItem");
404
+ const onlCgreportParam = ref();
405
+ const onlCgreportItem = ref();
406
+ const tableRefs = { onlCgreportItem, onlCgreportParam };
407
+ const onlCgreportParamTable = reactive({
408
+ loading: false,
409
+ dataSource: [],
410
+ columns: onlCgreportParamColumns
411
+ });
412
+ const onlCgreportItemTable = reactive({
413
+ loading: false,
414
+ dataSource: [],
415
+ columns: onlCgreportItemColumns
416
+ });
417
+ const [registerForm, { setProps, resetFields, setFieldsValue, validate, validateFields }] = useForm({
418
+ labelWidth: 150,
419
+ schemas: formSchema,
420
+ showActionButtonGroup: false
421
+ });
422
+ const [registerModal, { setModalProps, closeModal }] = useModalInner((data) => __async(this, null, function* () {
423
+ var _a, _b;
424
+ yield reset();
425
+ setModalProps({ confirmLoading: false, showCancelBtn: data == null ? void 0 : data.showFooter, showOkBtn: data == null ? void 0 : data.showFooter });
426
+ isUpdate.value = !!(data == null ? void 0 : data.isUpdate);
427
+ if (unref(isUpdate)) {
428
+ yield setFieldsValue(__spreadValues({}, data.record));
429
+ requestSubTableData(onlCgreportParamList, { headId: (_a = data == null ? void 0 : data.record) == null ? void 0 : _a.id }, onlCgreportParamTable);
430
+ requestSubTableData(onlCgreportItemList, { headId: (_b = data == null ? void 0 : data.record) == null ? void 0 : _b.id }, onlCgreportItemTable);
431
+ }
432
+ setProps({ disabled: !(data == null ? void 0 : data.showFooter) });
433
+ }));
434
+ const [handleChangeTabs, handleSubmit, requestSubTableData, formRef] = useJvxeMethod(requestAddOrEdit, classifyIntoFormData, tableRefs, activeKey, refKeys);
435
+ const title = computed(() => !unref(isUpdate) ? "\u65B0\u589E" : "\u7F16\u8F91");
436
+ function reset() {
437
+ return __async(this, null, function* () {
438
+ yield resetFields();
439
+ activeKey.value = "onlCgreportItem";
440
+ onlCgreportParamTable.dataSource = [];
441
+ onlCgreportItemTable.dataSource = [];
442
+ });
443
+ }
444
+ function classifyIntoFormData(allValues) {
445
+ let main = Object.assign({}, allValues.formValue);
446
+ return __spreadProps(__spreadValues({}, main), {
447
+ onlCgreportParamList: allValues.tablesValue[1].tableData,
448
+ onlCgreportItemList: allValues.tablesValue[0].tableData
449
+ });
450
+ }
451
+ function requestAddOrEdit(values) {
452
+ return __async(this, null, function* () {
453
+ try {
454
+ setModalProps({ confirmLoading: true });
455
+ let params = [], items = [], head = {};
456
+ Object.keys(values).map((k) => {
457
+ if (k == "onlCgreportItemList") {
458
+ items = values[k];
459
+ } else if (k == "onlCgreportParamList") {
460
+ params = values[k];
461
+ } else {
462
+ head[k] = values[k];
463
+ }
464
+ });
465
+ let obj = { head, params, items };
466
+ console.log("\u62A5\u8868\u914D\u7F6E\u4FDD\u5B58\u8BF7\u6C42\u53C2\u6570", obj);
467
+ yield saveOrUpdate(obj, isUpdate.value);
468
+ closeModal();
469
+ emit("success");
470
+ } finally {
471
+ setModalProps({ confirmLoading: false });
472
+ }
473
+ });
474
+ }
475
+ function handleSQLAnalyze() {
476
+ setModalProps({ confirmLoading: true });
477
+ validateFields(["cgrSql", "dbSource"]).then((values) => {
478
+ let { cgrSql, dbSource } = values;
479
+ let urlParam = "sql=" + encodeURIComponent(cgrSql);
480
+ if (dbSource) {
481
+ urlParam += "&dbKey=" + dbSource;
482
+ }
483
+ console.log("urlParam----", urlParam);
484
+ analyzeSql(urlParam).then((res) => {
485
+ if (res) {
486
+ createMessage.success("\u89E3\u6790\u6210\u529F");
487
+ let { fields, params } = res;
488
+ let newFields = fields.filter((item) => item.fieldName != "__row_number__");
489
+ let newItemDataList = getTabData(onlCgreportParamTable.dataSource, newFields || [], "fieldName");
490
+ onlCgreportItemTable.dataSource = [];
491
+ setDataSource(onlCgreportItem, newItemDataList);
492
+ let newParamList = getTabData(onlCgreportParamTable.dataSource, params || [], "paramName");
493
+ onlCgreportParamTable.dataSource = [];
494
+ setDataSource(onlCgreportParam, newParamList);
495
+ }
496
+ });
497
+ }).catch(() => {
498
+ console.log("\u89E3\u6790\u5931\u8D25");
499
+ }).finally(() => {
500
+ setModalProps({ confirmLoading: false });
501
+ });
502
+ }
503
+ function getTabData(old_arr, new_arr, columnName) {
504
+ if (old_arr.length > 0) {
505
+ let need = [], field_arr = [], max_order = 1;
506
+ for (let t of new_arr) {
507
+ for (let o of old_arr) {
508
+ if (o[columnName] == t[columnName]) {
509
+ need.push(o);
510
+ field_arr.push(t[columnName]);
511
+ if (o.orderNum > max_order) {
512
+ max_order = o.orderNum;
513
+ }
514
+ break;
515
+ }
516
+ }
517
+ }
518
+ for (let t of new_arr) {
519
+ if (field_arr.indexOf(t[columnName]) < 0) {
520
+ t.orderNum = ++max_order;
521
+ need.push(t);
522
+ }
523
+ }
524
+ return need;
525
+ } else {
526
+ let max_order = 0;
527
+ for (let t of new_arr) {
528
+ if (!t.orderNum) {
529
+ t.orderNum = ++max_order;
530
+ }
531
+ }
532
+ return new_arr;
533
+ }
534
+ }
535
+ function setDataSource(tableRef, data) {
536
+ return __async(this, null, function* () {
537
+ yield nextTick();
538
+ yield tableRef.value.getXTable().insert(data);
539
+ yield nextTick();
540
+ });
541
+ }
542
+ return (_ctx, _cache) => {
543
+ const _component_a_icon = resolveComponent("a-icon");
544
+ const _component_a_popover = resolveComponent("a-popover");
545
+ const _component_a_button = resolveComponent("a-button");
546
+ const _component_a_divider = resolveComponent("a-divider");
547
+ const _component_JVxeTable = resolveComponent("JVxeTable");
548
+ const _component_a_tab_pane = resolveComponent("a-tab-pane");
549
+ const _component_a_tabs = resolveComponent("a-tabs");
550
+ return openBlock(), createBlock(unref(BasicModal), mergeProps(_ctx.$attrs, {
551
+ onRegister: unref(registerModal),
552
+ title: unref(title),
553
+ width: 1200,
554
+ maskClosable: false,
555
+ defaultFullscreen: true,
556
+ confirmLoading: confirmLoading.value,
557
+ onOk: unref(handleSubmit)
558
+ }), {
559
+ default: withCtx(() => [
560
+ createVNode(unref(BasicForm), {
561
+ onRegister: unref(registerForm),
562
+ ref_key: "formRef",
563
+ ref: formRef
564
+ }, {
565
+ analyseButton: withCtx(() => [
566
+ createElementVNode("div", _hoisted_1, [
567
+ createVNode(_component_a_popover, {
568
+ title: "\u4F7F\u7528\u6307\u5357",
569
+ trigger: "hover",
570
+ style: { "margin": "0 10px 0 6px" }
571
+ }, {
572
+ content: withCtx(() => [
573
+ _hoisted_2,
574
+ _hoisted_3,
575
+ _hoisted_4,
576
+ _hoisted_5,
577
+ _hoisted_6,
578
+ _hoisted_7,
579
+ _hoisted_8,
580
+ _hoisted_9,
581
+ _hoisted_10,
582
+ _hoisted_11,
583
+ _hoisted_12
584
+ ]),
585
+ default: withCtx(() => [
586
+ createVNode(_component_a_icon, { type: "question-circle" })
587
+ ]),
588
+ _: 1
589
+ }),
590
+ createVNode(_component_a_button, {
591
+ style: { "margin-left": "10px" },
592
+ type: "primary",
593
+ onClick: handleSQLAnalyze
594
+ }, {
595
+ default: withCtx(() => [
596
+ _hoisted_13
597
+ ]),
598
+ _: 1
599
+ })
600
+ ])
601
+ ]),
602
+ _: 1
603
+ }, 8, ["onRegister"]),
604
+ createVNode(_component_a_divider, {
605
+ style: { "margin": "1px 0" },
606
+ class: "cust-divider"
607
+ }),
608
+ createVNode(_component_a_tabs, {
609
+ activeKey: activeKey.value,
610
+ "onUpdate:activeKey": _cache[0] || (_cache[0] = ($event) => activeKey.value = $event),
611
+ onChange: unref(handleChangeTabs)
612
+ }, {
613
+ default: withCtx(() => [
614
+ (openBlock(), createBlock(_component_a_tab_pane, {
615
+ tab: "\u52A8\u6001\u62A5\u8868\u914D\u7F6E\u660E\u7EC6",
616
+ key: refKeys.value[0],
617
+ forceRender: true
618
+ }, {
619
+ default: withCtx(() => [
620
+ createVNode(_component_JVxeTable, {
621
+ "keep-source": "",
622
+ dragSort: "",
623
+ resizable: "",
624
+ ref_key: "onlCgreportItem",
625
+ ref: onlCgreportItem,
626
+ loading: onlCgreportItemTable.loading,
627
+ columns: onlCgreportItemTable.columns,
628
+ dataSource: onlCgreportItemTable.dataSource,
629
+ height: 390,
630
+ rowNumber: true,
631
+ rowSelection: true,
632
+ toolbar: true
633
+ }, null, 8, ["loading", "columns", "dataSource"])
634
+ ]),
635
+ _: 1
636
+ })),
637
+ (openBlock(), createBlock(_component_a_tab_pane, {
638
+ tab: "\u62A5\u8868\u53C2\u6570",
639
+ key: refKeys.value[1],
640
+ forceRender: true
641
+ }, {
642
+ default: withCtx(() => [
643
+ createVNode(_component_JVxeTable, {
644
+ "keep-source": "",
645
+ resizable: "",
646
+ dragSort: "",
647
+ ref_key: "onlCgreportParam",
648
+ ref: onlCgreportParam,
649
+ loading: onlCgreportParamTable.loading,
650
+ columns: onlCgreportParamTable.columns,
651
+ dataSource: onlCgreportParamTable.dataSource,
652
+ height: 390,
653
+ rowNumber: true,
654
+ rowSelection: true,
655
+ toolbar: true
656
+ }, null, 8, ["loading", "columns", "dataSource"])
657
+ ]),
658
+ _: 1
659
+ }))
660
+ ]),
661
+ _: 1
662
+ }, 8, ["activeKey", "onChange"])
663
+ ]),
664
+ _: 1
665
+ }, 16, ["onRegister", "title", "confirmLoading", "onOk"]);
666
+ };
667
+ }
668
+ });
669
+ var CgreportModal = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
670
+ __proto__: null,
671
+ "default": _sfc_main
672
+ }, Symbol.toStringTag, { value: "Module" }));
673
+ export { CgreportModal as C, _sfc_main as _, batchDelete as b, columns as c, deleteOne as d, getReportParam as g, list as l, searchFormSchema as s };