@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,405 @@
1
+ import { ref, computed, reactive, watch } from "vue";
2
+ import { router } from "/@/router";
3
+ import { propTypes } from "/@/utils/propTypes";
4
+ import { printJS } from "/@/hooks/web/usePrintJS";
5
+ import { downloadByData } from "/@/utils/file/download";
6
+ import { filterDictText } from "/@/utils/dict/JDictSelectUtil";
7
+ import Bar from "/@/components/chart/Bar.vue";
8
+ import Pie from "/@/components/chart/Pie.vue";
9
+ import BarMulti from "/@/components/chart/BarMulti.vue";
10
+ import LineMulti from "/@/components/chart/LineMulti.vue";
11
+ import { defHttp } from "/@/utils/http/axios";
12
+ import { useMessage } from "/@/hooks/web/useMessage";
13
+ import { isFunction } from "/@/utils/is";
14
+ import { c as cloneDeep } from "./cloneDeep.js";
15
+ const ChartRenderProps = {
16
+ title: propTypes.string,
17
+ chartsData: propTypes.object,
18
+ asComponent: propTypes.bool.def(false)
19
+ };
20
+ const ChartRenderEmits = ["error"];
21
+ const ChartRenderComponents = {
22
+ LineMulti,
23
+ BarMulti,
24
+ Pie,
25
+ Bar
26
+ };
27
+ const ChartRenderCommon = {
28
+ components: ChartRenderComponents,
29
+ props: ChartRenderProps,
30
+ emits: ChartRenderEmits
31
+ };
32
+ const errorText = {
33
+ jsonFormattingFailed: "JSON\u5B57\u7B26\u4E32\u683C\u5F0F\u5316\u5931\u8D25"
34
+ };
35
+ function useChartRender(props, { emit }) {
36
+ const {
37
+ createMessage: $message,
38
+ createConfirm: $confirm,
39
+ createInfoModal: $info,
40
+ createErrorModal: $error,
41
+ createSuccessModal: $success,
42
+ createWarningModal: $warning
43
+ } = useMessage();
44
+ const headId = ref(null);
45
+ const height = ref("400px");
46
+ const activeKey = ref("bar");
47
+ const chartTypes = ref([]);
48
+ const pageSwitch = ref(true);
49
+ const printId = computed(() => `print-content-${headId.value}`);
50
+ const lineParams = reactive({
51
+ chartData: []
52
+ });
53
+ const barParams = reactive({
54
+ chartData: []
55
+ });
56
+ const pieParams = reactive({
57
+ chartData: []
58
+ });
59
+ const barLineParams = reactive({
60
+ dataSource: []
61
+ });
62
+ const tableParams = reactive({
63
+ fixedColumns: [
64
+ {
65
+ title: "#",
66
+ key: "rowIndex",
67
+ width: "10%",
68
+ align: "center",
69
+ customRender: function({ record, index }) {
70
+ if (record.isTotal === true) {
71
+ return "\u603B\u8BA1";
72
+ } else {
73
+ return parseInt(index) + 1;
74
+ }
75
+ }
76
+ }
77
+ ],
78
+ columns: [],
79
+ dataSource: []
80
+ });
81
+ const extendJsHandlerIsolation = reactive({});
82
+ const extendJsHandler = computed({
83
+ get() {
84
+ if (headId.value == null) {
85
+ return null;
86
+ } else {
87
+ return extendJsHandlerIsolation[headId.value];
88
+ }
89
+ },
90
+ set(obj) {
91
+ if (headId.value != null) {
92
+ extendJsHandlerIsolation[headId.value] = obj;
93
+ }
94
+ }
95
+ });
96
+ const hasLine = computed(() => chartTypes.value.includes("line"));
97
+ const hasBar = computed(() => chartTypes.value.includes("bar"));
98
+ const hasPie = computed(() => chartTypes.value.includes("pie"));
99
+ const hasTable = ref(false);
100
+ const lineProps = computed(() => {
101
+ return {
102
+ type: "line",
103
+ height: height.value,
104
+ chartData: lineParams.chartData,
105
+ onClick(params) {
106
+ emitExtendJsEvent(params);
107
+ }
108
+ };
109
+ });
110
+ const barProps = computed(() => {
111
+ return {
112
+ height: height.value,
113
+ chartData: barParams.chartData,
114
+ onClick(params) {
115
+ emitExtendJsEvent(params);
116
+ }
117
+ };
118
+ });
119
+ const pieProps = computed(() => {
120
+ return {
121
+ height: height.value,
122
+ chartData: pieParams.chartData,
123
+ onClick(params) {
124
+ emitExtendJsEvent(params);
125
+ }
126
+ };
127
+ });
128
+ const barLineProps = computed(() => {
129
+ return {
130
+ height: height.value,
131
+ dataSource: barLineParams.dataSource,
132
+ onClick(_event, _chart) {
133
+ console.debug("barLineProps-click: ", arguments);
134
+ }
135
+ };
136
+ });
137
+ const chartCardProps = computed(() => {
138
+ return {
139
+ title: props.title,
140
+ headStyle: { paddingLeft: "20px" },
141
+ bodyStyle: { padding: "10px" },
142
+ bordered: !props.asComponent
143
+ };
144
+ });
145
+ const tableCardProps = computed(() => {
146
+ return {
147
+ title: "\u6570\u636E\u660E\u7EC6",
148
+ headStyle: { paddingLeft: "20px" },
149
+ bodyStyle: { padding: "0" },
150
+ style: { marginTop: "20px" },
151
+ bordered: !props.asComponent
152
+ };
153
+ });
154
+ const exportButtonProps = computed(() => {
155
+ return {
156
+ type: "primary",
157
+ preIcon: "ant-design:download",
158
+ text: "\u5BFC\u51FA",
159
+ style: { margin: "12px" }
160
+ };
161
+ });
162
+ const pageSwitchProps = computed(() => {
163
+ return {
164
+ checkedChildren: "\u5206\u9875",
165
+ unCheckedChildren: "\u5206\u9875",
166
+ style: {
167
+ position: "absolute",
168
+ top: "17px",
169
+ right: "12px"
170
+ }
171
+ };
172
+ });
173
+ const tableProps = computed(() => {
174
+ return {
175
+ size: "middle",
176
+ rowKey: "id",
177
+ pagination: pageSwitch.value ? { pageSize: 10 } : false,
178
+ columns: tableParams.columns,
179
+ dataSource: tableParams.dataSource,
180
+ style: { borderTop: "1px solid #e8e8e8" }
181
+ };
182
+ });
183
+ const showPrint = computed(() => !props.asComponent);
184
+ const showDetail = computed(() => props.asComponent);
185
+ watch(() => props.chartsData, (data) => parseChartsData(data), { immediate: true });
186
+ function executeExtendJs(headId, jsCode) {
187
+ if (!jsCode || !headId) {
188
+ return;
189
+ }
190
+ let onClick = { line: null, bar: null, pie: null };
191
+ eval(`;(function () {
192
+ ${jsCode}
193
+ })();`);
194
+ if (extendJsHandler.value == null) {
195
+ extendJsHandler.value = { click: onClick };
196
+ } else {
197
+ extendJsHandler.value.click = onClick;
198
+ }
199
+ }
200
+ const onClickThis = {
201
+ $router: router,
202
+ $http: defHttp,
203
+ $message,
204
+ $confirm,
205
+ $info,
206
+ $error,
207
+ $success,
208
+ $warning
209
+ };
210
+ function emitExtendJsEvent(params) {
211
+ if (extendJsHandler.value != null) {
212
+ let clickType = params.seriesType;
213
+ let fn = extendJsHandler.value.click[clickType];
214
+ if (isFunction(fn)) {
215
+ fn.call(onClickThis, params);
216
+ }
217
+ }
218
+ }
219
+ function parseChartsData(chartsData) {
220
+ if (chartsData == null)
221
+ return null;
222
+ let { head, data, items, dictOptions } = chartsData;
223
+ if (head == null)
224
+ return;
225
+ let { id, xaxisField, yaxisField, dataType, cgrSql, graphType, extendJs } = head;
226
+ headId.value = id;
227
+ executeExtendJs(id, extendJs);
228
+ try {
229
+ data = dataType === "sql" || dataType === "api" ? data : JSON.parse(cgrSql);
230
+ } catch (e) {
231
+ emit("error", errorText.jsonFormattingFailed);
232
+ return;
233
+ }
234
+ let dictList = dictOptions[xaxisField];
235
+ let graphTypes = graphType.split(",");
236
+ activeKey.value = graphTypes[0];
237
+ chartTypes.value = graphTypes;
238
+ let yaxisFields = yaxisField.split(",");
239
+ let fieldMap = /* @__PURE__ */ new Map();
240
+ items.forEach((item) => fieldMap.set(item.fieldName, item));
241
+ let index = graphTypes.indexOf("table");
242
+ hasTable.value = index !== -1;
243
+ if (hasTable.value) {
244
+ graphTypes.splice(index, 1);
245
+ }
246
+ let parseOption = { graphTypes, data, items, fieldMap, xaxisField, yaxisFields, dictList, dictOptions };
247
+ parseLineData(parseOption);
248
+ parseBarData(parseOption);
249
+ parsePicData(parseOption);
250
+ parseTableData(parseOption);
251
+ }
252
+ function parseCommonData(option) {
253
+ var _a;
254
+ let { data, fieldMap, xaxisField, yaxisFields, dictList } = option;
255
+ let chartData = [];
256
+ for (let yField of yaxisFields) {
257
+ for (let item of data) {
258
+ let name = item[xaxisField];
259
+ if (dictList) {
260
+ name = filterDictText(dictList, name);
261
+ }
262
+ chartData.push({
263
+ name,
264
+ value: item[yField],
265
+ type: ((_a = fieldMap.get(yField)) == null ? void 0 : _a.fieldTxt) || yField
266
+ });
267
+ }
268
+ }
269
+ return chartData;
270
+ }
271
+ function parseLineData(option) {
272
+ let { graphTypes } = option;
273
+ if (graphTypes.includes("line")) {
274
+ lineParams.chartData = parseCommonData(option);
275
+ }
276
+ }
277
+ function parseBarData(option) {
278
+ let { graphTypes } = option;
279
+ if (graphTypes.includes("bar")) {
280
+ barParams.chartData = parseCommonData(option);
281
+ }
282
+ }
283
+ function parsePicData(option) {
284
+ let { graphTypes, data, xaxisField, yaxisFields, dictList } = option;
285
+ let yField = yaxisFields[0];
286
+ if (graphTypes.includes("pie")) {
287
+ let chartData = [];
288
+ for (let item of data) {
289
+ let name = item[xaxisField];
290
+ if (dictList) {
291
+ name = filterDictText(dictList, name);
292
+ }
293
+ chartData.push({
294
+ name,
295
+ value: item[yField]
296
+ });
297
+ }
298
+ pieParams.chartData = chartData;
299
+ }
300
+ }
301
+ function parseTableData(option) {
302
+ let { data, items, xaxisField, yaxisFields, dictList, dictOptions } = option;
303
+ if (hasTable.value) {
304
+ tableParams.dataSource = data.map((item, index) => {
305
+ item.id = index;
306
+ let pieData = {
307
+ item: item[xaxisField],
308
+ count: item[yaxisFields[0]]
309
+ };
310
+ if (dictList) {
311
+ pieData.item = filterDictText(dictList, pieData.item);
312
+ }
313
+ return item;
314
+ });
315
+ let tableColumns = cloneDeep(tableParams.fixedColumns);
316
+ let isTotals = [];
317
+ items.forEach((item) => {
318
+ if (item.isShow === "Y") {
319
+ let column = {
320
+ align: "center",
321
+ width: "10%",
322
+ title: item.fieldTxt,
323
+ dataIndex: item.fieldName
324
+ };
325
+ if (item.dictCode) {
326
+ column.customRender = ({ text }) => filterDictText(dictOptions[item.fieldName], text);
327
+ }
328
+ tableColumns.push(column);
329
+ if (item.isTotal === "Y")
330
+ isTotals.push(item.fieldName);
331
+ }
332
+ });
333
+ tableParams.columns = tableColumns;
334
+ if (isTotals.length > 0) {
335
+ let totalRow = { id: tableParams.dataSource.length, isTotal: true };
336
+ isTotals.forEach((column) => {
337
+ let count = 0;
338
+ tableParams.dataSource.forEach((row) => {
339
+ count += parseFloat(row[column]);
340
+ });
341
+ totalRow[column] = isNaN(count) ? "\u5305\u542B\u975E\u6570\u5B57\u5185\u5BB9" : count.toFixed(2);
342
+ });
343
+ tableParams.dataSource.push(totalRow);
344
+ }
345
+ }
346
+ }
347
+ function onExportXls() {
348
+ let fileName = props.title;
349
+ defHttp.get({
350
+ url: "/online/graphreport/api/exportXlsById",
351
+ params: {
352
+ id: headId.value,
353
+ name: fileName
354
+ },
355
+ responseType: "blob"
356
+ }, { isTransformResponse: false }).then((data) => {
357
+ if (!data || data.size == 0) {
358
+ $message.warning("\u5BFC\u51FA\u5931\u8D25\uFF01");
359
+ return;
360
+ }
361
+ downloadByData(data, fileName + ".xls");
362
+ });
363
+ }
364
+ function onPrint() {
365
+ printJS({
366
+ type: "html",
367
+ printable: "#" + printId.value
368
+ });
369
+ }
370
+ function onGoToDetail() {
371
+ goToInfo(props.chartsData);
372
+ }
373
+ function goToInfo(data) {
374
+ let url = `/online/graphreport/chart/${data.head.id}`;
375
+ router.push({ path: url });
376
+ }
377
+ return {
378
+ headId,
379
+ printId,
380
+ height,
381
+ activeKey,
382
+ chartTypes,
383
+ pageSwitch,
384
+ showPrint,
385
+ showDetail,
386
+ hasLine,
387
+ hasBar,
388
+ hasPie,
389
+ hasTable,
390
+ lineProps,
391
+ barProps,
392
+ pieProps,
393
+ tableProps,
394
+ barLineProps,
395
+ chartCardProps,
396
+ tableCardProps,
397
+ exportButtonProps,
398
+ pageSwitchProps,
399
+ extendJsHandlerIsolation,
400
+ onPrint,
401
+ onGoToDetail,
402
+ onExportXls
403
+ };
404
+ }
405
+ export { ChartRenderCommon as C, useChartRender as u };
@@ -0,0 +1,71 @@
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
+ import { createVNode } from "vue";
21
+ import { message, Modal } from "ant-design-vue";
22
+ import { InfoCircleFilled, CheckCircleFilled, CloseCircleFilled } from "@ant-design/icons-vue";
23
+ import { isString } from "/@/utils/is";
24
+ function getIcon(iconType) {
25
+ if (iconType === "warning") {
26
+ return createVNode(InfoCircleFilled, {
27
+ "class": "modal-icon-warning"
28
+ }, null);
29
+ } else if (iconType === "success") {
30
+ return createVNode(CheckCircleFilled, {
31
+ "class": "modal-icon-success"
32
+ }, null);
33
+ } else if (iconType === "info") {
34
+ return createVNode(InfoCircleFilled, {
35
+ "class": "modal-icon-info"
36
+ }, null);
37
+ } else {
38
+ return createVNode(CloseCircleFilled, {
39
+ "class": "modal-icon-error"
40
+ }, null);
41
+ }
42
+ }
43
+ function renderContent({
44
+ content
45
+ }) {
46
+ if (isString(content)) {
47
+ return createVNode("div", {
48
+ "innerHTML": `<div>${content}</div>`
49
+ }, null);
50
+ } else {
51
+ return content;
52
+ }
53
+ }
54
+ function createConfirm(options) {
55
+ const iconType = options.iconType || "warning";
56
+ Reflect.deleteProperty(options, "iconType");
57
+ const opt = __spreadProps(__spreadValues({
58
+ centered: true,
59
+ icon: getIcon(iconType)
60
+ }, options), {
61
+ content: renderContent(options)
62
+ });
63
+ return Modal.confirm(opt);
64
+ }
65
+ function useMessageOnline() {
66
+ return {
67
+ createMessage: message,
68
+ createConfirm
69
+ };
70
+ }
71
+ export { useMessageOnline };