@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,410 @@
1
+ var __async = (__this, __arguments, generator) => {
2
+ return new Promise((resolve, reject) => {
3
+ var fulfilled = (value) => {
4
+ try {
5
+ step(generator.next(value));
6
+ } catch (e) {
7
+ reject(e);
8
+ }
9
+ };
10
+ var rejected = (value) => {
11
+ try {
12
+ step(generator.throw(value));
13
+ } catch (e) {
14
+ reject(e);
15
+ }
16
+ };
17
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
18
+ step((generator = generator.apply(__this, __arguments)).next());
19
+ });
20
+ };
21
+ import { BasicTable, TableAction } from "/@/components/Table";
22
+ import { useMessage } from "/@/hooks/web/useMessage";
23
+ import OnlineAutoModal from "./OnlineAutoModal.js";
24
+ import OnlineCustomModal from "./OnlineCustomModal.js";
25
+ import { watch, resolveComponent, openBlock, createElementBlock, createVNode, normalizeClass, withCtx, createBlock, createCommentVNode, Fragment, renderList, createTextVNode, toDisplayString, withDirectives, vShow, createElementVNode, mergeProps, toHandlers, resolveDynamicComponent, normalizeProps, guardReactiveProps } from "vue";
26
+ import JImportModal from "/@/components/Form/src/jeecg/components/JImportModal.vue";
27
+ import { u as useOnlineTableContext, a as useListButton, b as useTableColumns } from "./useTableColumns.js";
28
+ import { u as useEnhance } from "./OnlineForm.js";
29
+ import OnlineQueryForm from "./OnlineQueryForm.js";
30
+ import OnlineSuperQuery from "./OnlineSuperQuery.js";
31
+ import { _ as _export_sfc } from "./index.js";
32
+ import "/@/components/Modal";
33
+ import "/@/utils/http/axios";
34
+ import "./useAutoForm.js";
35
+ import "./FormSchemaFactory.js";
36
+ import "/@/components/Form/src/jeecg/components/JUpload";
37
+ import "/@/views/system/user/user.api";
38
+ import "/@/store/modules/user";
39
+ import "/@/utils";
40
+ import "/@/utils/desform/customExpression";
41
+ import "/@/components/Form/src/componentMap";
42
+ import "./OnlineSelectCascade.js";
43
+ import "/@/components/jeecg/OnLine/JPopupOnlReport.vue";
44
+ import "vue-router";
45
+ import "/@/utils/common/compUtils";
46
+ import "/@/utils/cache";
47
+ import "/@/hooks/core/onMountedOrActivated";
48
+ import "ant-design-vue";
49
+ import "/@/hooks/system/useMethods";
50
+ import "./pick.js";
51
+ import "./isArray.js";
52
+ import "./toString.js";
53
+ import "./_arrayPush.js";
54
+ import "/@/utils/dict/JDictSelectUtil";
55
+ import "/@/components/Form/src/utils/Area";
56
+ import "/@/components/Preview/index";
57
+ import "/@/components/Form/index";
58
+ import "/@/components/Loading";
59
+ import "./OnlineSubForm.js";
60
+ import "./OnlineSuperQueryValComponent.vue_vue_type_script_lang.js";
61
+ import "/@/components/Form/src/helper";
62
+ import "/@/utils/is";
63
+ import "@ant-design/icons-vue";
64
+ var OnlineAutoList_vue_vue_type_style_index_0_lang = "";
65
+ const _sfc_main = {
66
+ name: "DefaultOnlineList",
67
+ components: {
68
+ BasicTable,
69
+ TableAction,
70
+ OnlineAutoModal,
71
+ JImportModal,
72
+ OnlineQueryForm,
73
+ OnlineSuperQuery,
74
+ OnlineCustomModal
75
+ },
76
+ setup() {
77
+ const { createMessage: $message } = useMessage();
78
+ const {
79
+ ID,
80
+ onlineTableContext,
81
+ onlineQueryFormOuter,
82
+ loading,
83
+ reload,
84
+ dataSource,
85
+ pagination,
86
+ handleSpecialConfig,
87
+ getColumnList,
88
+ handleChangeInTable,
89
+ loadData,
90
+ superQueryButtonRef,
91
+ superQueryStatus,
92
+ handleSuperQuery,
93
+ registerCustomModal
94
+ } = useOnlineTableContext();
95
+ if (!ID.value) {
96
+ $message.warning("\u5730\u5740\u9519\u8BEF, \u914D\u7F6EID\u4E0D\u5B58\u5728!");
97
+ return;
98
+ }
99
+ let { initCgEnhanceJs } = useEnhance(onlineTableContext);
100
+ const {
101
+ buttonSwitch,
102
+ cgLinkButtonList,
103
+ cgTopButtonList,
104
+ importUrl,
105
+ registerModal,
106
+ handleAdd,
107
+ handleEdit,
108
+ handleBatchDelete,
109
+ registerImportModal,
110
+ onImportExcel,
111
+ onExportExcel,
112
+ cgButtonJsHandler,
113
+ cgButtonActionHandler,
114
+ cgButtonLinkHandler,
115
+ handleSubmitFlow,
116
+ getDropDownActions,
117
+ getActions,
118
+ initButtonList,
119
+ initButtonSwitch
120
+ } = useListButton(onlineTableContext);
121
+ const {
122
+ columns,
123
+ actionColumn,
124
+ selectedKeys,
125
+ rowSelection,
126
+ enableScrollBar,
127
+ tableScroll,
128
+ downloadRowFile,
129
+ getImgView,
130
+ getPcaText,
131
+ getFormatDate,
132
+ handleColumnResult,
133
+ hrefComponent,
134
+ viewOnlineCellImage
135
+ } = useTableColumns(onlineTableContext);
136
+ watch(ID, () => {
137
+ console.log("watched id is change...");
138
+ initAutoList();
139
+ }, { immediate: true });
140
+ function initAutoList() {
141
+ return __async(this, null, function* () {
142
+ loading.value = true;
143
+ let columnResult = yield getColumnList();
144
+ handleTableConfig(columnResult);
145
+ yield loadData();
146
+ loading.value = false;
147
+ onlineTableContext.execButtonEnhance("setup");
148
+ });
149
+ }
150
+ function handleTableConfig(result) {
151
+ let EnhanceJS = initCgEnhanceJs(result.enhanceJs);
152
+ onlineTableContext["EnhanceJS"] = EnhanceJS;
153
+ initButtonList(result.cgButtonList);
154
+ initButtonSwitch(result.hideColumns);
155
+ handleColumnResult(result);
156
+ handleSpecialConfig(result);
157
+ }
158
+ function queryWithCondition(data) {
159
+ onlineTableContext["queryParam"] = data;
160
+ reload();
161
+ }
162
+ function onQueryFormLoaded(json) {
163
+ superQueryButtonRef.value.init(json);
164
+ }
165
+ const that = {
166
+ ID,
167
+ onlineQueryFormOuter,
168
+ queryWithCondition,
169
+ onQueryFormLoaded,
170
+ reload,
171
+ superQueryButtonRef,
172
+ superQueryStatus,
173
+ handleSuperQuery,
174
+ loading,
175
+ columns,
176
+ dataSource,
177
+ pagination,
178
+ actionColumn,
179
+ rowSelection,
180
+ selectedKeys,
181
+ tableScroll,
182
+ enableScrollBar,
183
+ handleChangeInTable,
184
+ buttonSwitch,
185
+ handleAdd,
186
+ handleEdit,
187
+ onImportExcel,
188
+ onExportExcel,
189
+ cgTopButtonList,
190
+ cgLinkButtonList,
191
+ cgButtonJsHandler,
192
+ cgButtonActionHandler,
193
+ cgButtonLinkHandler,
194
+ handleBatchDelete,
195
+ downloadRowFile,
196
+ getImgView,
197
+ getPcaText,
198
+ getFormatDate,
199
+ getActions,
200
+ getDropDownActions,
201
+ registerModal,
202
+ registerCustomModal,
203
+ registerImportModal,
204
+ importUrl,
205
+ handleSubmitFlow,
206
+ hrefComponent,
207
+ viewOnlineCellImage
208
+ };
209
+ return that;
210
+ }
211
+ };
212
+ const _hoisted_1 = { class: "p-2" };
213
+ const _hoisted_2 = /* @__PURE__ */ createTextVNode("\u65B0\u589E");
214
+ const _hoisted_3 = /* @__PURE__ */ createTextVNode("\u5BFC\u5165");
215
+ const _hoisted_4 = /* @__PURE__ */ createTextVNode(" \u5BFC\u51FA");
216
+ const _hoisted_5 = /* @__PURE__ */ createTextVNode(" \u6279\u91CF\u5220\u9664");
217
+ const _hoisted_6 = {
218
+ key: 0,
219
+ style: { "font-size": "12px", "font-style": "italic" }
220
+ };
221
+ const _hoisted_7 = /* @__PURE__ */ createTextVNode(" \u4E0B\u8F7D ");
222
+ const _hoisted_8 = {
223
+ key: 0,
224
+ style: { "font-size": "12px", "font-style": "italic" }
225
+ };
226
+ const _hoisted_9 = ["src", "onClick"];
227
+ const _hoisted_10 = ["innerHTML"];
228
+ const _hoisted_11 = ["title"];
229
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
230
+ const _component_online_query_form = resolveComponent("online-query-form");
231
+ const _component_a_button = resolveComponent("a-button");
232
+ const _component_online_super_query = resolveComponent("online-super-query");
233
+ const _component_TableAction = resolveComponent("TableAction");
234
+ const _component_BasicTable = resolveComponent("BasicTable");
235
+ const _component_OnlineAutoModal = resolveComponent("OnlineAutoModal");
236
+ const _component_JImportModal = resolveComponent("JImportModal");
237
+ const _component_a_modal = resolveComponent("a-modal");
238
+ const _component_online_custom_modal = resolveComponent("online-custom-modal");
239
+ return openBlock(), createElementBlock("div", _hoisted_1, [
240
+ createVNode(_component_online_query_form, {
241
+ ref: "onlineQueryFormOuter",
242
+ id: _ctx.ID,
243
+ onSearch: _ctx.queryWithCondition,
244
+ onLoaded: _ctx.onQueryFormLoaded
245
+ }, null, 8, ["id", "onSearch", "onLoaded"]),
246
+ createVNode(_component_BasicTable, {
247
+ ref: "onlineTable",
248
+ rowKey: "jeecg_row_key",
249
+ canResize: true,
250
+ bordered: true,
251
+ showIndexColumn: false,
252
+ loading: _ctx.loading,
253
+ columns: _ctx.columns,
254
+ dataSource: _ctx.dataSource,
255
+ pagination: _ctx.pagination,
256
+ rowSelection: _ctx.rowSelection,
257
+ actionColumn: _ctx.actionColumn,
258
+ showTableSetting: true,
259
+ clickToRowSelect: false,
260
+ scroll: _ctx.tableScroll,
261
+ onTableRedo: _ctx.reload,
262
+ class: normalizeClass({ "j-table-force-nowrap": _ctx.enableScrollBar }),
263
+ onChange: _ctx.handleChangeInTable
264
+ }, {
265
+ tableTitle: withCtx(() => [
266
+ _ctx.buttonSwitch.add ? (openBlock(), createBlock(_component_a_button, {
267
+ key: 0,
268
+ preIcon: "ant-design:plus-outlined",
269
+ type: "primary",
270
+ onClick: _ctx.handleAdd
271
+ }, {
272
+ default: withCtx(() => [
273
+ _hoisted_2
274
+ ]),
275
+ _: 1
276
+ }, 8, ["onClick"])) : createCommentVNode("", true),
277
+ _ctx.buttonSwitch.import ? (openBlock(), createBlock(_component_a_button, {
278
+ key: 1,
279
+ preIcon: "ant-design:import-outlined",
280
+ type: "primary",
281
+ onClick: _ctx.onImportExcel
282
+ }, {
283
+ default: withCtx(() => [
284
+ _hoisted_3
285
+ ]),
286
+ _: 1
287
+ }, 8, ["onClick"])) : createCommentVNode("", true),
288
+ _ctx.buttonSwitch.export ? (openBlock(), createBlock(_component_a_button, {
289
+ key: 2,
290
+ preIcon: "ant-design:export-outlined",
291
+ type: "primary",
292
+ onClick: _ctx.onExportExcel
293
+ }, {
294
+ default: withCtx(() => [
295
+ _hoisted_4
296
+ ]),
297
+ _: 1
298
+ }, 8, ["onClick"])) : createCommentVNode("", true),
299
+ _ctx.cgTopButtonList && _ctx.cgTopButtonList.length > 0 ? (openBlock(true), createElementBlock(Fragment, { key: 3 }, renderList(_ctx.cgTopButtonList, (item, index) => {
300
+ return openBlock(), createElementBlock(Fragment, null, [
301
+ item.optType == "js" ? (openBlock(), createBlock(_component_a_button, {
302
+ key: "cgbtn" + index,
303
+ onClick: ($event) => _ctx.cgButtonJsHandler(item.buttonCode),
304
+ type: "primary",
305
+ preIcon: item.buttonIcon ? "ant-design:" + item.buttonIcon : ""
306
+ }, {
307
+ default: withCtx(() => [
308
+ createTextVNode(toDisplayString(item.buttonName), 1)
309
+ ]),
310
+ _: 2
311
+ }, 1032, ["onClick", "preIcon"])) : item.optType == "action" ? (openBlock(), createBlock(_component_a_button, {
312
+ key: "cgbtn" + index,
313
+ onClick: ($event) => _ctx.cgButtonActionHandler(item.buttonCode),
314
+ type: "primary",
315
+ preIcon: item.buttonIcon ? "ant-design:" + item.buttonIcon : ""
316
+ }, {
317
+ default: withCtx(() => [
318
+ createTextVNode(toDisplayString(item.buttonName), 1)
319
+ ]),
320
+ _: 2
321
+ }, 1032, ["onClick", "preIcon"])) : createCommentVNode("", true)
322
+ ], 64);
323
+ }), 256)) : createCommentVNode("", true),
324
+ _ctx.buttonSwitch.batch_delete ? withDirectives((openBlock(), createBlock(_component_a_button, {
325
+ key: 4,
326
+ preIcon: "ant-design:delete-outlined",
327
+ onClick: _ctx.handleBatchDelete
328
+ }, {
329
+ default: withCtx(() => [
330
+ _hoisted_5
331
+ ]),
332
+ _: 1
333
+ }, 8, ["onClick"])), [
334
+ [vShow, _ctx.selectedKeys.length > 0]
335
+ ]) : createCommentVNode("", true),
336
+ _ctx.buttonSwitch.super_query ? (openBlock(), createBlock(_component_online_super_query, {
337
+ key: 5,
338
+ ref: "superQueryButtonRef",
339
+ status: _ctx.superQueryStatus,
340
+ onSearch: _ctx.handleSuperQuery
341
+ }, null, 8, ["status", "onSearch"])) : createCommentVNode("", true)
342
+ ]),
343
+ fileSlot: withCtx(({ text }) => [
344
+ !text ? (openBlock(), createElementBlock("span", _hoisted_6, "\u65E0\u6587\u4EF6")) : (openBlock(), createBlock(_component_a_button, {
345
+ key: 1,
346
+ ghost: true,
347
+ type: "primary",
348
+ preIcon: "ant-design:download",
349
+ size: "small",
350
+ onClick: ($event) => _ctx.downloadRowFile(text)
351
+ }, {
352
+ default: withCtx(() => [
353
+ _hoisted_7
354
+ ]),
355
+ _: 2
356
+ }, 1032, ["onClick"]))
357
+ ]),
358
+ imgSlot: withCtx(({ text }) => [
359
+ !text ? (openBlock(), createElementBlock("span", _hoisted_8, "\u65E0\u56FE\u7247")) : (openBlock(), createElementBlock("img", {
360
+ key: 1,
361
+ src: _ctx.getImgView(text),
362
+ alt: "\u56FE\u7247\u4E0D\u5B58\u5728",
363
+ class: "online-cell-image",
364
+ onClick: ($event) => _ctx.viewOnlineCellImage(text)
365
+ }, null, 8, _hoisted_9))
366
+ ]),
367
+ htmlSlot: withCtx(({ text }) => [
368
+ createElementVNode("div", { innerHTML: text }, null, 8, _hoisted_10)
369
+ ]),
370
+ pcaSlot: withCtx(({ text }) => [
371
+ createElementVNode("div", {
372
+ title: _ctx.getPcaText(text)
373
+ }, toDisplayString(_ctx.getPcaText(text)), 9, _hoisted_11)
374
+ ]),
375
+ dateSlot: withCtx(({ text }) => [
376
+ createElementVNode("span", null, toDisplayString(_ctx.getFormatDate(text)), 1)
377
+ ]),
378
+ action: withCtx(({ record }) => [
379
+ createVNode(_component_TableAction, {
380
+ actions: _ctx.getActions(record),
381
+ dropDownActions: _ctx.getDropDownActions(record)
382
+ }, null, 8, ["actions", "dropDownActions"])
383
+ ]),
384
+ _: 1
385
+ }, 8, ["loading", "columns", "dataSource", "pagination", "rowSelection", "actionColumn", "scroll", "onTableRedo", "class", "onChange"]),
386
+ createVNode(_component_OnlineAutoModal, {
387
+ id: _ctx.ID,
388
+ onRegister: _ctx.registerModal,
389
+ onSuccess: _ctx.reload
390
+ }, null, 8, ["id", "onRegister", "onSuccess"]),
391
+ createVNode(_component_JImportModal, {
392
+ onRegister: _ctx.registerImportModal,
393
+ url: _ctx.importUrl(),
394
+ onOk: _ctx.reload,
395
+ online: ""
396
+ }, null, 8, ["onRegister", "url", "onOk"]),
397
+ createVNode(_component_a_modal, mergeProps(_ctx.hrefComponent.model, toHandlers(_ctx.hrefComponent.on)), {
398
+ default: withCtx(() => [
399
+ (openBlock(), createBlock(resolveDynamicComponent(_ctx.hrefComponent.is), normalizeProps(guardReactiveProps(_ctx.hrefComponent.params)), null, 16))
400
+ ]),
401
+ _: 1
402
+ }, 16),
403
+ createVNode(_component_online_custom_modal, {
404
+ onRegister: _ctx.registerCustomModal,
405
+ onSuccess: _ctx.reload
406
+ }, null, 8, ["onRegister", "onSuccess"])
407
+ ]);
408
+ }
409
+ var OnlineAutoList = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
410
+ export { OnlineAutoList as default };
@@ -0,0 +1,265 @@
1
+ var __async = (__this, __arguments, generator) => {
2
+ return new Promise((resolve, reject) => {
3
+ var fulfilled = (value) => {
4
+ try {
5
+ step(generator.next(value));
6
+ } catch (e) {
7
+ reject(e);
8
+ }
9
+ };
10
+ var rejected = (value) => {
11
+ try {
12
+ step(generator.throw(value));
13
+ } catch (e) {
14
+ reject(e);
15
+ }
16
+ };
17
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
18
+ step((generator = generator.apply(__this, __arguments)).next());
19
+ });
20
+ };
21
+ import { defineComponent, ref, computed, unref, nextTick, watch, reactive, resolveComponent, openBlock, createBlock, mergeProps, withCtx, createElementBlock, Fragment, renderList, createTextVNode, toDisplayString, createCommentVNode, createVNode } from "vue";
22
+ import { BasicModal, useModalInner } from "/@/components/Modal";
23
+ import { defHttp } from "/@/utils/http/axios";
24
+ import { g as getRefPromise } from "./useAutoForm.js";
25
+ import { O as OnlineForm } from "./OnlineForm.js";
26
+ import { _ as _export_sfc } from "./index.js";
27
+ import "./FormSchemaFactory.js";
28
+ import "/@/components/Form/src/jeecg/components/JUpload";
29
+ import "/@/views/system/user/user.api";
30
+ import "/@/store/modules/user";
31
+ import "/@/utils";
32
+ import "/@/utils/desform/customExpression";
33
+ import "/@/components/Form/src/componentMap";
34
+ import "./OnlineSelectCascade.js";
35
+ import "/@/hooks/web/useMessage";
36
+ import "/@/components/jeecg/OnLine/JPopupOnlReport.vue";
37
+ import "vue-router";
38
+ import "/@/components/Form/index";
39
+ import "/@/components/Loading";
40
+ import "./OnlineSubForm.js";
41
+ import "./pick.js";
42
+ import "./isArray.js";
43
+ import "./toString.js";
44
+ import "./_arrayPush.js";
45
+ const singleWidth = 800;
46
+ const one2ManyWidth = 1100;
47
+ const _sfc_main = defineComponent({
48
+ name: "OnlineModal",
49
+ props: {
50
+ id: {
51
+ type: String,
52
+ default: ""
53
+ }
54
+ },
55
+ components: {
56
+ BasicModal,
57
+ OnlineForm
58
+ },
59
+ emits: ["success", "register"],
60
+ setup(props, { emit }) {
61
+ console.log("\u8FDB\u5165\u8868\u5355\u5F39\u6846\u300B\u300B\u300B\u300Bmodal");
62
+ const onlineFormCompRef = ref(null);
63
+ const disableSubmit = ref(false);
64
+ const formTemplate = ref(1);
65
+ const cgButtonList = ref([]);
66
+ const formRendered = ref(false);
67
+ const modalMinWidth = ref(0);
68
+ const isTreeForm = ref(false);
69
+ const pidFieldName = ref("");
70
+ const submitLoading = ref(false);
71
+ const title = computed(() => {
72
+ if (unref(disableSubmit) === true) {
73
+ return "\u8BE6\u60C5";
74
+ }
75
+ if (unref(isUpdate) === true) {
76
+ return "\u7F16\u8F91";
77
+ }
78
+ return "\u65B0\u589E";
79
+ });
80
+ const [registerModal, { setModalProps, closeModal }] = useModalInner((data) => __async(this, null, function* () {
81
+ setModalProps({ confirmLoading: false });
82
+ isUpdate.value = data.isUpdate;
83
+ disableSubmit.value = data.disableSubmit || false;
84
+ yield nextTick(() => __async(this, null, function* () {
85
+ yield getRefPromise(formRendered);
86
+ yield onlineFormCompRef.value.show(data == null ? void 0 : data.isUpdate, data == null ? void 0 : data.record, data == null ? void 0 : data.param);
87
+ }));
88
+ }));
89
+ function renderSuccess(extConfig) {
90
+ formRendered.value = true;
91
+ modalMinWidth.value = extConfig.modalMinWidth;
92
+ if (extConfig.modelFullscreen == 1) {
93
+ setModalProps({ defaultFullscreen: true });
94
+ } else {
95
+ setModalProps({ defaultFullscreen: false });
96
+ }
97
+ }
98
+ watch(() => props.id, renderFormItems, { immediate: true });
99
+ function renderFormItems() {
100
+ return __async(this, null, function* () {
101
+ formRendered.value = false;
102
+ if (!props.id) {
103
+ return;
104
+ }
105
+ console.log("\u91CD\u65B0\u6E32\u67D3\u8868\u5355\u300B\u300B\u300B\u300Bmodal");
106
+ let result = yield loadFormItems();
107
+ let dataFormTemplate = result.head.formTemplate;
108
+ formTemplate.value = dataFormTemplate ? Number(dataFormTemplate) : 1;
109
+ cgButtonList.value = result.cgButtonList;
110
+ isTreeForm.value = result.head.isTree === "Y";
111
+ pidFieldName.value = result.head.treeParentIdField || "";
112
+ nextTick(() => __async(this, null, function* () {
113
+ let myForm = yield getRefPromise(onlineFormCompRef);
114
+ myForm.createRootProperties(result);
115
+ }));
116
+ });
117
+ }
118
+ function loadFormItems() {
119
+ let url = `/online/cgform/api/getFormItem/${props.id}`;
120
+ return new Promise((resolve, reject) => {
121
+ defHttp.get({ url }, { isTransformResponse: false }).then((res) => {
122
+ console.log("\u8868\u5355\u7ED3\u679C\u300B\u300Bmodal:", res);
123
+ if (res.success) {
124
+ resolve(res.result);
125
+ } else {
126
+ reject(res.message);
127
+ }
128
+ }).catch(() => {
129
+ reject();
130
+ });
131
+ });
132
+ }
133
+ const modalWidth = computed(() => {
134
+ let diff = 200 * (formTemplate.value - 1);
135
+ let width = (!unref(single) ? one2ManyWidth : singleWidth) + diff;
136
+ width = calcModalMixWidth(width);
137
+ let minWidth = modalMinWidth.value;
138
+ console.log({ minWidth });
139
+ if (minWidth && width < minWidth) {
140
+ width = minWidth;
141
+ }
142
+ console.log({ width });
143
+ return width;
144
+ });
145
+ function calcModalMixWidth(width) {
146
+ let minWidth = extConfigJson.modalMinWidth;
147
+ if (minWidth != null && minWidth !== "") {
148
+ try {
149
+ minWidth = Number.parseInt(minWidth);
150
+ if (width < minWidth) {
151
+ return minWidth;
152
+ }
153
+ } catch (e) {
154
+ console.warn("error modalMinWidth value: ", minWidth);
155
+ }
156
+ }
157
+ return width;
158
+ }
159
+ const isUpdate = ref(false);
160
+ const single = ref(true);
161
+ const extConfigJson = reactive({});
162
+ function handleCgButtonClick(optType, buttonCode) {
163
+ onlineFormCompRef.value.handleCgButtonClick(optType, buttonCode);
164
+ }
165
+ function handleSubmit() {
166
+ submitLoading.value = true;
167
+ setTimeout(() => {
168
+ submitLoading.value = false;
169
+ }, 1500);
170
+ onlineFormCompRef.value.handleSubmit();
171
+ }
172
+ function handleCancel() {
173
+ closeModal();
174
+ }
175
+ function handleSuccess(formData) {
176
+ emit("success", formData);
177
+ closeModal();
178
+ }
179
+ const that = {
180
+ title,
181
+ onlineFormCompRef,
182
+ formRendered,
183
+ renderSuccess,
184
+ registerModal,
185
+ handleSubmit,
186
+ handleSuccess,
187
+ handleCancel,
188
+ modalWidth,
189
+ formTemplate,
190
+ disableSubmit,
191
+ cgButtonList,
192
+ handleCgButtonClick,
193
+ isTreeForm,
194
+ pidFieldName,
195
+ submitLoading
196
+ };
197
+ return that;
198
+ }
199
+ });
200
+ const _hoisted_1 = /* @__PURE__ */ createTextVNode("\u786E\u5B9A");
201
+ const _hoisted_2 = /* @__PURE__ */ createTextVNode("\u5173\u95ED");
202
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
203
+ const _component_a_button = resolveComponent("a-button");
204
+ const _component_online_form = resolveComponent("online-form");
205
+ const _component_BasicModal = resolveComponent("BasicModal");
206
+ return openBlock(), createBlock(_component_BasicModal, mergeProps({
207
+ title: _ctx.title,
208
+ width: _ctx.modalWidth
209
+ }, _ctx.$attrs, {
210
+ onRegister: _ctx.registerModal,
211
+ wrapClassName: "jeecg-online-modal",
212
+ onOk: _ctx.handleSubmit
213
+ }), {
214
+ footer: withCtx(() => [
215
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.cgButtonList, (btn) => {
216
+ return openBlock(), createBlock(_component_a_button, {
217
+ key: btn.id,
218
+ type: "primary",
219
+ onClick: ($event) => _ctx.handleCgButtonClick(btn.optType, btn.buttonCode),
220
+ preIcon: btn.buttonIcon ? "ant-design:" + btn.buttonIcon : ""
221
+ }, {
222
+ default: withCtx(() => [
223
+ createTextVNode(toDisplayString(btn.buttonName), 1)
224
+ ]),
225
+ _: 2
226
+ }, 1032, ["onClick", "preIcon"]);
227
+ }), 128)),
228
+ !_ctx.disableSubmit ? (openBlock(), createBlock(_component_a_button, {
229
+ key: "submit",
230
+ type: "primary",
231
+ onClick: _ctx.handleSubmit,
232
+ loading: _ctx.submitLoading
233
+ }, {
234
+ default: withCtx(() => [
235
+ _hoisted_1
236
+ ]),
237
+ _: 1
238
+ }, 8, ["onClick", "loading"])) : createCommentVNode("", true),
239
+ createVNode(_component_a_button, {
240
+ key: "back",
241
+ onClick: _ctx.handleCancel
242
+ }, {
243
+ default: withCtx(() => [
244
+ _hoisted_2
245
+ ]),
246
+ _: 1
247
+ }, 8, ["onClick"])
248
+ ]),
249
+ default: withCtx(() => [
250
+ createVNode(_component_online_form, {
251
+ ref: "onlineFormCompRef",
252
+ id: _ctx.id,
253
+ disabled: _ctx.disableSubmit,
254
+ "form-template": _ctx.formTemplate,
255
+ isTree: _ctx.isTreeForm,
256
+ pidField: _ctx.pidFieldName,
257
+ onRendered: _ctx.renderSuccess,
258
+ onSuccess: _ctx.handleSuccess
259
+ }, null, 8, ["id", "disabled", "form-template", "isTree", "pidField", "onRendered", "onSuccess"])
260
+ ]),
261
+ _: 1
262
+ }, 16, ["title", "width", "onRegister", "onOk"]);
263
+ }
264
+ var OnlineAutoModal = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
265
+ export { OnlineAutoModal as default };