@jeecg/online 1.0.1 → 3.4.3-GA

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 (93) hide show
  1. package/AuthButtonConfig.js +14 -7
  2. package/AuthButtonTree.js +3 -5
  3. package/AuthDataConfig.js +9 -6
  4. package/AuthDataTree.js +3 -5
  5. package/AuthFieldConfig.js +15 -12
  6. package/AuthFieldTree.js +24 -18
  7. package/AuthManagerDrawer.js +1 -1
  8. package/AuthSetterModal.js +1 -0
  9. package/CgformCopyList.js +34 -22
  10. package/CgformModal.js +57 -50
  11. package/CgreportModal.js +32 -39
  12. package/CheckDictTable.js +144 -24
  13. package/CodeFileListModal.js +175 -0
  14. package/CodeFileViewModal.js +325 -0
  15. package/CodeGeneratorModal.js +41 -38
  16. package/CustomButtonList.js +19 -22
  17. package/DBAttributeTable.js +248 -12
  18. package/DbToOnlineModal.js +27 -25
  19. package/DetailForm.js +609 -0
  20. package/EnhanceJavaModal.js +11 -17
  21. package/EnhanceJsHistory.js +6 -8
  22. package/EnhanceJsModal.js +16 -16
  23. package/EnhanceSqlModal.js +11 -17
  24. package/ExtendConfigModal.js +24 -15
  25. package/ForeignKeyTable.js +4 -3
  26. package/FormSchemaFactory.js +163 -30
  27. package/IndexTable.js +6 -5
  28. package/JModalTip.js +54 -0
  29. package/JOnlineSearchSelect.js +18 -10
  30. package/LeftDepart.js +1 -1
  31. package/LeftRole.js +7 -4
  32. package/LeftUser.js +7 -4
  33. package/LinkTableConfigModal.js +289 -0
  34. package/LinkTableFieldConfigModal.js +218 -0
  35. package/LinkTableListPiece.js +36 -0
  36. package/ModalFormDemo.js +3 -2
  37. package/OnlineAutoList.js +154 -55
  38. package/OnlineAutoModal.js +92 -131
  39. package/OnlineAutoTreeList.js +93 -53
  40. package/OnlineCustomModal.js +30 -14
  41. package/OnlineDetailModal.js +184 -0
  42. package/OnlineForm.js +274 -141
  43. package/OnlineFormDetail.js +326 -0
  44. package/OnlineQueryForm.js +72 -40
  45. package/OnlineSearchFormItem.js +26 -18
  46. package/OnlineSelectCascade.js +37 -26
  47. package/OnlineSubFormDetail.js +167 -0
  48. package/OnlineSuperQuery.js +70 -75
  49. package/OnlineSuperQueryValComponent.js +1 -0
  50. package/OnlineSuperQueryValComponent.vue_vue_type_script_lang.js +1 -17
  51. package/PageAttributeTable.js +233 -30
  52. package/ProcessOnlineForm.js +41 -16
  53. package/QueryTable.js +4 -3
  54. package/README.md +3 -8
  55. package/_arrayPush.js +5 -3
  56. package/{cloneDeep.js → _baseClone.js} +5 -9
  57. package/_baseSlice.js +18 -0
  58. package/_commonjsHelpers.js +5 -0
  59. package/_flatRest.js +174 -0
  60. package/auth.data.js +1 -3
  61. package/cgform.data.js +18 -9
  62. package/enhance.api.js +27 -18
  63. package/index.js +27 -8
  64. package/index2.js +48 -45
  65. package/index3.js +29 -26
  66. package/isArray.js +1 -1
  67. package/main.index.js +2 -2
  68. package/omit.js +60 -0
  69. package/package.json +1 -1
  70. package/pick.js +3 -173
  71. package/style.css +1 -1
  72. package/toString.js +2 -2
  73. package/useAutoForm.js +3457 -3791
  74. package/useCgformList.js +44 -31
  75. package/{useTableColumns.js → useListButton.js} +218 -409
  76. package/useOnlineTest.js +5 -26827
  77. package/useSchemas.js +382 -234
  78. package/useTableSync.js +19 -7
  79. package/ChartAutoRender.js +0 -69
  80. package/ChartDoubleRender.js +0 -154
  81. package/ChartSingleRender.js +0 -132
  82. package/ChartTabsRender.js +0 -218
  83. package/ErrorTip.js +0 -21
  84. package/FieldTable.js +0 -185
  85. package/GraphreportAutoChart.js +0 -352
  86. package/GraphreportList.js +0 -239
  87. package/GraphreportModal.js +0 -559
  88. package/LICENSE +0 -7
  89. package/OnlineSubForm.js +0 -200
  90. package/ParamsTable.js +0 -71
  91. package/graphreport.api.js +0 -23
  92. package/useChartRender.js +0 -405
  93. package/useMessageOnline.js +0 -71
@@ -0,0 +1,175 @@
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 { ref, reactive, resolveComponent, openBlock, createElementBlock, Fragment, createVNode, withCtx, createTextVNode, createElementVNode, normalizeStyle, renderList, toDisplayString } from "vue";
22
+ import { defHttp } from "/@/utils/http/axios";
23
+ import "/@/components/Form";
24
+ import { BasicModal, useModalInner, useModal } from "/@/components/Modal";
25
+ import { InfoCircleTwoTone } from "@ant-design/icons-vue";
26
+ import CodeFileViewModal from "./CodeFileViewModal.js";
27
+ import { useMessage } from "/@/hooks/web/useMessage";
28
+ import { downloadByData } from "/@/utils/file/download";
29
+ import { _ as _export_sfc } from "./index.js";
30
+ import "ant-design-vue";
31
+ import "/@/components/jeecg/OnLine/JPopupOnlReport.vue";
32
+ import "vue-router";
33
+ const _sfc_main = {
34
+ name: "CodeFileListModal",
35
+ components: {
36
+ BasicModal,
37
+ InfoCircleTwoTone,
38
+ CodeFileViewModal
39
+ },
40
+ emits: ["register"],
41
+ setup() {
42
+ const { createMessage: $message } = useMessage();
43
+ const codeList = ref([]);
44
+ const height = window.innerHeight - 150;
45
+ const divStyle = reactive({
46
+ overflowY: "auto",
47
+ maxHeight: height + "px"
48
+ });
49
+ const loading = ref(false);
50
+ const tableName = ref("");
51
+ const pathKey = ref("");
52
+ const [registerModal, { closeModal }] = useModalInner((data) => __async(this, null, function* () {
53
+ codeList.value = data.codeList;
54
+ tableName.value = data.tableName;
55
+ pathKey.value = data.pathKey;
56
+ }));
57
+ function handleClose() {
58
+ closeModal();
59
+ }
60
+ function onDownloadGenerateCode() {
61
+ let codeFileList = codeList.value;
62
+ if (!codeFileList || codeFileList.length == 0) {
63
+ $message.warning("\u65E0\u4EE3\u7801\uFF01");
64
+ return;
65
+ }
66
+ let temp = codeFileList.join(",");
67
+ return defHttp.post(
68
+ {
69
+ url: "/online/cgform/api/downGenerateCode",
70
+ params: {
71
+ fileList: encodeURI(temp),
72
+ pathKey: pathKey.value
73
+ },
74
+ responseType: "blob"
75
+ },
76
+ { isTransformResponse: false }
77
+ ).then((data) => {
78
+ if (!data || data.size == 0) {
79
+ $message.warning("\u5BFC\u51FA\u4EE3\u7801\u5931\u8D25\uFF01");
80
+ return;
81
+ }
82
+ let fileName = "\u5BFC\u5230\u751F\u6210\u4EE3\u7801_" + tableName.value + "_" + new Date().getTime() + ".zip";
83
+ downloadByData(data, fileName, "application/zip");
84
+ });
85
+ }
86
+ const [registerCodeViewModal, { openModal }] = useModal();
87
+ function handleView() {
88
+ let temp = codeList.value;
89
+ openModal(true, {
90
+ codeList: temp,
91
+ pathKey: pathKey.value
92
+ });
93
+ }
94
+ return {
95
+ registerModal,
96
+ registerCodeViewModal,
97
+ divStyle,
98
+ codeList,
99
+ onDownloadGenerateCode,
100
+ handleClose,
101
+ handleView,
102
+ loading
103
+ };
104
+ }
105
+ };
106
+ const _hoisted_1 = /* @__PURE__ */ createElementVNode("br", null, null, -1);
107
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
108
+ const _component_info_circle_two_tone = resolveComponent("info-circle-two-tone");
109
+ const _component_a_button = resolveComponent("a-button");
110
+ const _component_BasicModal = resolveComponent("BasicModal");
111
+ const _component_code_file_view_modal = resolveComponent("code-file-view-modal");
112
+ return openBlock(), createElementBlock(Fragment, null, [
113
+ createVNode(_component_BasicModal, {
114
+ onRegister: $setup.registerModal,
115
+ width: 1200,
116
+ defaultFullscreen: false,
117
+ canFullscreen: false
118
+ }, {
119
+ title: withCtx(() => [
120
+ createVNode(_component_info_circle_two_tone),
121
+ createTextVNode(" \u4EE3\u7801\u751F\u6210\u7ED3\u679C ")
122
+ ]),
123
+ footer: withCtx(() => [
124
+ createVNode(_component_a_button, { onClick: $setup.handleClose }, {
125
+ default: withCtx(() => [
126
+ createTextVNode("\u5173\u95ED")
127
+ ]),
128
+ _: 1
129
+ }, 8, ["onClick"]),
130
+ createVNode(_component_a_button, {
131
+ type: "primary",
132
+ ghost: "",
133
+ onClick: $setup.handleView
134
+ }, {
135
+ default: withCtx(() => [
136
+ createTextVNode("\u5728\u7EBF\u9884\u89C8")
137
+ ]),
138
+ _: 1
139
+ }, 8, ["onClick"]),
140
+ createVNode(_component_a_button, {
141
+ type: "primary",
142
+ onClick: $setup.onDownloadGenerateCode,
143
+ loading: $setup.loading
144
+ }, {
145
+ default: withCtx(() => [
146
+ createTextVNode("\u4E0B\u8F7D\u5230\u672C\u5730")
147
+ ]),
148
+ _: 1
149
+ }, 8, ["onClick", "loading"])
150
+ ]),
151
+ default: withCtx(() => [
152
+ createElementVNode("div", {
153
+ style: normalizeStyle($setup.divStyle)
154
+ }, [
155
+ createElementVNode("p", null, [
156
+ (openBlock(true), createElementBlock(Fragment, null, renderList($setup.codeList, (item) => {
157
+ return openBlock(), createElementBlock(Fragment, null, [
158
+ createTextVNode(toDisplayString(item), 1),
159
+ _hoisted_1
160
+ ], 64);
161
+ }), 256))
162
+ ])
163
+ ], 4)
164
+ ]),
165
+ _: 1
166
+ }, 8, ["onRegister"]),
167
+ createVNode(_component_code_file_view_modal, {
168
+ onRegister: $setup.registerCodeViewModal,
169
+ onDownload: $setup.onDownloadGenerateCode,
170
+ onClose: $setup.handleClose
171
+ }, null, 8, ["onRegister", "onDownload", "onClose"])
172
+ ], 64);
173
+ }
174
+ var CodeFileListModal = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
175
+ export { CodeFileListModal as default };
@@ -0,0 +1,325 @@
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, reactive, resolveComponent, openBlock, createBlock, withCtx, createVNode, createTextVNode, createElementVNode, normalizeStyle, createCommentVNode } from "vue";
22
+ import { defHttp } from "/@/utils/http/axios";
23
+ import { BasicModal, useModalInner } from "/@/components/Modal";
24
+ import { InfoCircleTwoTone } from "@ant-design/icons-vue";
25
+ import { message } from "ant-design-vue";
26
+ import { JCodeEditor } from "/@/components/Form";
27
+ import { _ as _export_sfc } from "./index.js";
28
+ import "/@/components/jeecg/OnLine/JPopupOnlReport.vue";
29
+ import "/@/hooks/web/useMessage";
30
+ import "vue-router";
31
+ const _sfc_main = defineComponent({
32
+ name: "CodeFileViewModal",
33
+ components: {
34
+ BasicModal,
35
+ InfoCircleTwoTone,
36
+ JCodeEditor
37
+ },
38
+ emits: ["download", "register", "close"],
39
+ setup(_p, { emit }) {
40
+ const codeList = ref([]);
41
+ const pathKey = ref("");
42
+ const treeData = ref([]);
43
+ const expandStatus = ref(false);
44
+ const height = window.innerHeight - 160;
45
+ const language = ref("java");
46
+ const activeCodeContent = ref("");
47
+ let codeMap = reactive({});
48
+ const [registerModal, { closeModal }] = useModalInner((data) => __async(this, null, function* () {
49
+ codeMap = reactive({});
50
+ activeCodeContent.value = "";
51
+ codeList.value = data.codeList;
52
+ pathKey.value = data.pathKey;
53
+ getTreeData();
54
+ expandStatus.value = true;
55
+ }));
56
+ function getTreeData() {
57
+ let list = getPlainList();
58
+ let root = list[0];
59
+ assembleTree(root, list);
60
+ let treeList = [];
61
+ const getFinalTreeData = function(root2) {
62
+ if (root2.children) {
63
+ let children = root2.children;
64
+ if (children.length == 1) {
65
+ getFinalTreeData(children[0]);
66
+ } else if (children.length > 1) {
67
+ treeList.push(root2);
68
+ }
69
+ }
70
+ };
71
+ getFinalTreeData(root);
72
+ console.log(123, treeList);
73
+ treeData.value = treeList;
74
+ setTimeout(() => {
75
+ loadFirstFileContent(root);
76
+ }, 300);
77
+ }
78
+ function loadFirstFileContent(root) {
79
+ return __async(this, null, function* () {
80
+ const getFirstFile = function(temp) {
81
+ if (temp.isLeaf === true) {
82
+ return temp;
83
+ } else {
84
+ if (temp.children) {
85
+ return getFirstFile(temp.children[0]);
86
+ }
87
+ }
88
+ };
89
+ let node = getFirstFile(root);
90
+ if (node && node.isLeaf === true) {
91
+ let path = node.path;
92
+ if (!codeMap[path]) {
93
+ yield loadCode(path);
94
+ }
95
+ language.value = getCodeLanguage(path);
96
+ activeCodeContent.value = codeMap[path];
97
+ }
98
+ });
99
+ }
100
+ function assembleTree(root, list) {
101
+ for (let item of list) {
102
+ if (root.key == item.pid) {
103
+ let children = root.children;
104
+ if (!children) {
105
+ root.children = [];
106
+ }
107
+ root.children.push(item);
108
+ assembleTree(item, list);
109
+ }
110
+ }
111
+ }
112
+ function getAbsolutePath(arr, index) {
113
+ let i = 0;
114
+ let str = "";
115
+ while (i <= index) {
116
+ str += arr[i];
117
+ i++;
118
+ }
119
+ return str;
120
+ }
121
+ function getPlainList() {
122
+ let list = [];
123
+ let list2 = [];
124
+ let arr = codeList.value;
125
+ for (let item of arr) {
126
+ let temp = item.replace(new RegExp("\\\\", "g"), "/").replace("\u751F\u6210\u6210\u529F\uFF1A", "").trim();
127
+ if (temp) {
128
+ let arr2 = temp.split("/");
129
+ for (let i = 0; i < arr2.length; i++) {
130
+ let a = arr2[i];
131
+ let id = getAbsolutePath(arr2, i);
132
+ if (a) {
133
+ let item2 = {
134
+ title: a,
135
+ key: id
136
+ };
137
+ if (a == 0)
138
+ ;
139
+ else {
140
+ let lastKey = getAbsolutePath(arr2, i - 1);
141
+ if (lastKey) {
142
+ item2["pid"] = lastKey;
143
+ }
144
+ }
145
+ if (i == arr2.length - 1) {
146
+ item2["isLeaf"] = true;
147
+ item2["path"] = temp;
148
+ }
149
+ if (list2.indexOf(id) < 0 || i == arr2.length - 1) {
150
+ list.push(item2);
151
+ list2.push(id);
152
+ }
153
+ }
154
+ }
155
+ }
156
+ }
157
+ return list;
158
+ }
159
+ function handleClose() {
160
+ closeModal();
161
+ emit("close");
162
+ }
163
+ function onDownloadGenerateCode() {
164
+ emit("download");
165
+ }
166
+ function getCodeLanguage(path) {
167
+ if (path.endsWith("xml")) {
168
+ return "application/xml";
169
+ }
170
+ if (path.endsWith("sql")) {
171
+ return "text/x-sql";
172
+ }
173
+ if (path.endsWith("vue")) {
174
+ return "text/x-vue";
175
+ }
176
+ if (path.endsWith("ts")) {
177
+ return "text/typescript";
178
+ } else {
179
+ return "text/x-java";
180
+ }
181
+ }
182
+ function showCodeContent(_selectedKeys, e) {
183
+ return __async(this, null, function* () {
184
+ let node = e.node.dataRef;
185
+ if (node.isLeaf) {
186
+ let path = node.path;
187
+ if (!codeMap[path]) {
188
+ yield loadCode(path);
189
+ }
190
+ language.value = getCodeLanguage(path);
191
+ activeCodeContent.value = codeMap[path];
192
+ }
193
+ });
194
+ }
195
+ function loadCode(path) {
196
+ return new Promise((resolve) => {
197
+ let params = {
198
+ path: encodeURI(path),
199
+ pathKey: pathKey.value
200
+ };
201
+ defHttp.get({ url: "/online/cgform/api/codeView", params }, { isTransformResponse: false }).then((data) => {
202
+ if (!data || data.size === 0) {
203
+ message.warning("\u6587\u4EF6\u4E0B\u8F7D\u5931\u8D25");
204
+ return;
205
+ }
206
+ let blob = new Blob([data]);
207
+ let reader = new FileReader();
208
+ reader.readAsText(blob, "utf8");
209
+ reader.onload = function() {
210
+ let content = this.result;
211
+ codeMap[path] = content;
212
+ resolve(1);
213
+ };
214
+ });
215
+ });
216
+ }
217
+ return {
218
+ registerModal,
219
+ codeList,
220
+ onDownloadGenerateCode,
221
+ handleClose,
222
+ treeData,
223
+ showCodeContent,
224
+ activeCodeContent,
225
+ expandStatus,
226
+ height,
227
+ language
228
+ };
229
+ }
230
+ });
231
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
232
+ const _component_info_circle_two_tone = resolveComponent("info-circle-two-tone");
233
+ const _component_a_directory_tree = resolveComponent("a-directory-tree");
234
+ const _component_a_col = resolveComponent("a-col");
235
+ const _component_JCodeEditor = resolveComponent("JCodeEditor");
236
+ const _component_a_empty = resolveComponent("a-empty");
237
+ const _component_a_row = resolveComponent("a-row");
238
+ const _component_a_button = resolveComponent("a-button");
239
+ const _component_BasicModal = resolveComponent("BasicModal");
240
+ return openBlock(), createBlock(_component_BasicModal, {
241
+ onRegister: _ctx.registerModal,
242
+ okText: "",
243
+ cancelText: "\u5173\u95ED",
244
+ width: 1200,
245
+ defaultFullscreen: true,
246
+ canFullscreen: false,
247
+ onOk: _ctx.onDownloadGenerateCode
248
+ }, {
249
+ title: withCtx(() => [
250
+ createVNode(_component_info_circle_two_tone),
251
+ createTextVNode(" \u4EE3\u7801\u5728\u7EBF\u9884\u89C8 ")
252
+ ]),
253
+ footer: withCtx(() => [
254
+ createVNode(_component_a_button, { onClick: _ctx.handleClose }, {
255
+ default: withCtx(() => [
256
+ createTextVNode("\u5173\u95ED")
257
+ ]),
258
+ _: 1
259
+ }, 8, ["onClick"]),
260
+ createVNode(_component_a_button, {
261
+ type: "primary",
262
+ onClick: _ctx.onDownloadGenerateCode
263
+ }, {
264
+ default: withCtx(() => [
265
+ createTextVNode("\u4E0B\u8F7D\u5230\u672C\u5730")
266
+ ]),
267
+ _: 1
268
+ }, 8, ["onClick"])
269
+ ]),
270
+ default: withCtx(() => [
271
+ createElementVNode("div", null, [
272
+ createVNode(_component_a_row, null, {
273
+ default: withCtx(() => [
274
+ createVNode(_component_a_col, {
275
+ span: 6,
276
+ gutter: 3,
277
+ style: { "border-right": "1px solid #eee" }
278
+ }, {
279
+ default: withCtx(() => [
280
+ createElementVNode("div", {
281
+ style: normalizeStyle({ height: _ctx.height + "px", overflowY: "auto" })
282
+ }, [
283
+ _ctx.treeData.length ? (openBlock(), createBlock(_component_a_directory_tree, {
284
+ key: 0,
285
+ defaultExpandAll: true,
286
+ "tree-data": _ctx.treeData,
287
+ onSelect: _ctx.showCodeContent
288
+ }, null, 8, ["tree-data", "onSelect"])) : createCommentVNode("", true)
289
+ ], 4)
290
+ ]),
291
+ _: 1
292
+ }),
293
+ createVNode(_component_a_col, {
294
+ span: 18,
295
+ gutter: 3
296
+ }, {
297
+ default: withCtx(() => [
298
+ _ctx.activeCodeContent ? (openBlock(), createBlock(_component_JCodeEditor, {
299
+ key: 0,
300
+ value: _ctx.activeCodeContent,
301
+ "onUpdate:value": _cache[0] || (_cache[0] = ($event) => _ctx.activeCodeContent = $event),
302
+ theme: "idea",
303
+ language: _ctx.language,
304
+ fullScreen: false,
305
+ lineNumbers: true,
306
+ height: _ctx.height + "px",
307
+ "language-change": true
308
+ }, null, 8, ["value", "language", "height"])) : (openBlock(), createBlock(_component_a_empty, {
309
+ key: 1,
310
+ style: { "margin-top": "50px" },
311
+ description: "\u8BF7\u9009\u62E9\u5DE6\u4FA7\u6587\u4EF6\uFF0C\u663E\u793A\u8BE6\u7EC6\u4EE3\u7801"
312
+ }))
313
+ ]),
314
+ _: 1
315
+ })
316
+ ]),
317
+ _: 1
318
+ })
319
+ ])
320
+ ]),
321
+ _: 1
322
+ }, 8, ["onRegister", "onOk"]);
323
+ }
324
+ var CodeFileViewModal = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
325
+ export { CodeFileViewModal as default };
@@ -25,24 +25,24 @@ import { BasicModal, useModalInner, useModal } from "/@/components/Modal";
25
25
  import { JVxeTypes } from "/@/components/jeecg/JVxeTable/types";
26
26
  import { b as useCodeGeneratorFormSchemas } from "./useSchemas.js";
27
27
  import { underLine2CamelCase } from "/@/utils/common/compUtils";
28
- import { useMessage } from "/@/hooks/web/useMessage";
29
- import { downloadByData } from "/@/utils/file/download";
28
+ import CodeFileListModal from "./CodeFileListModal.js";
30
29
  import FileSelectModal from "./FileSelectModal.js";
31
- import { useMessageOnline } from "./useMessageOnline.js";
32
30
  import { _ as _export_sfc } from "./index.js";
33
31
  import "ant-design-vue";
34
32
  import "@ant-design/icons-vue";
35
- import "/@/utils/is";
33
+ import "/@/hooks/web/usePermission";
34
+ import "/@/utils/helper/validator";
35
+ import "./CodeFileViewModal.js";
36
+ import "/@/hooks/web/useMessage";
37
+ import "/@/utils/file/download";
36
38
  import "/@/components/jeecg/OnLine/JPopupOnlReport.vue";
37
39
  import "vue-router";
38
40
  const _sfc_main = defineComponent({
39
41
  name: "CodeGenerator",
40
- components: { BasicForm, BasicModal, FileSelectModal },
42
+ components: { BasicForm, BasicModal, FileSelectModal, CodeFileListModal },
41
43
  emits: ["register"],
42
44
  setup(props) {
43
45
  const JEECG_ONL_PROJECT_PATH = "JEECG_ONL_PROJECT_PATH";
44
- const { createMessage: $message } = useMessage();
45
- const { createConfirm: $confirm } = useMessageOnline();
46
46
  const single = ref(true);
47
47
  const subTableRef = ref();
48
48
  const modalWidth = computed(() => single.value ? 800 : 1200);
@@ -86,11 +86,15 @@ const _sfc_main = defineComponent({
86
86
  ]
87
87
  });
88
88
  const showSubTable = computed(() => subTable.dataSource.length > 0);
89
- const { formSchemas } = useCodeGeneratorFormSchemas(props, {
90
- onProjectPathChange,
91
- onProjectPathSearch,
92
- jspModeOptions
93
- }, single);
89
+ const { formSchemas } = useCodeGeneratorFormSchemas(
90
+ props,
91
+ {
92
+ onProjectPathChange,
93
+ onProjectPathSearch,
94
+ jspModeOptions
95
+ },
96
+ single
97
+ );
94
98
  const [registerForm, { resetFields, setFieldsValue, validate }] = useForm({
95
99
  schemas: formSchemas,
96
100
  showActionButtonGroup: false,
@@ -152,6 +156,7 @@ const _sfc_main = defineComponent({
152
156
  }
153
157
  });
154
158
  }
159
+ const [registerCodeFileListModal, { openModal: openCodeFileListModal }] = useModal();
155
160
  function onSubmit() {
156
161
  return __async(this, null, function* () {
157
162
  try {
@@ -165,16 +170,11 @@ const _sfc_main = defineComponent({
165
170
  params.subList = subTableRef.value.getTableData();
166
171
  }
167
172
  confirmLoading.value = true;
168
- let codeList = yield defHttp.post({ url: "/online/cgform/api/codeGenerate", params });
169
- $confirm({
170
- iconType: "info",
171
- title: "\u4EE3\u7801\u751F\u6210\u7ED3\u679C",
172
- width: 1200,
173
- closable: true,
174
- okText: "\u4E0B\u8F7D\u5230\u672C\u5730",
175
- cancelText: "\u786E\u5B9A\u5E76\u5173\u95ED",
176
- content: `<p>${codeList.map((item) => item + "<br>").join("")}</p>`,
177
- onOk: () => onDownloadGenerateCode(codeList, values.tableName_tmp)
173
+ let res = yield codeGen(params);
174
+ openCodeFileListModal(true, {
175
+ codeList: res.codeList,
176
+ pathKey: res.pathKey,
177
+ tableName: values.tableName_tmp
178
178
  });
179
179
  closeModal();
180
180
  } catch (e) {
@@ -184,20 +184,20 @@ const _sfc_main = defineComponent({
184
184
  }
185
185
  });
186
186
  }
187
- function onDownloadGenerateCode(codeList, tableName) {
188
- return defHttp.get({
189
- url: "/online/cgform/api/downGenerateCode",
190
- params: {
191
- fileList: encodeURI(codeList)
192
- },
193
- responseType: "blob"
194
- }, { isTransformResponse: false }).then((data) => {
195
- if (!data || data.size == 0) {
196
- $message.warning("\u5BFC\u51FA\u4EE3\u7801\u5931\u8D25\uFF01");
197
- return;
198
- }
199
- let fileName = "\u5BFC\u5230\u751F\u6210\u4EE3\u7801_" + tableName + "_" + new Date().getTime() + ".zip";
200
- downloadByData(data, fileName, "application/zip");
187
+ function codeGen(params) {
188
+ return new Promise((resolve, reject) => {
189
+ defHttp.post({ url: "/online/cgform/api/codeGenerate", params }, { isTransformResponse: false }).then((res) => {
190
+ if (res.success) {
191
+ let codeList = res.result;
192
+ let pathKey = res.message;
193
+ resolve({
194
+ codeList,
195
+ pathKey
196
+ });
197
+ } else {
198
+ reject(res.message);
199
+ }
200
+ });
201
201
  });
202
202
  }
203
203
  function onCancel() {
@@ -237,7 +237,8 @@ const _sfc_main = defineComponent({
237
237
  registerFileSelectModal,
238
238
  subTableRef,
239
239
  registerForm,
240
- registerModal
240
+ registerModal,
241
+ registerCodeFileListModal
241
242
  };
242
243
  }
243
244
  });
@@ -248,6 +249,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
248
249
  const _component_a_spin = resolveComponent("a-spin");
249
250
  const _component_BasicModal = resolveComponent("BasicModal");
250
251
  const _component_FileSelectModal = resolveComponent("FileSelectModal");
252
+ const _component_code_file_list_modal = resolveComponent("code-file-list-modal");
251
253
  return openBlock(), createElementBlock(Fragment, null, [
252
254
  createVNode(_component_BasicModal, {
253
255
  onRegister: _ctx.registerModal,
@@ -286,7 +288,8 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
286
288
  createVNode(_component_FileSelectModal, {
287
289
  onRegister: _ctx.registerFileSelectModal,
288
290
  onSelect: _ctx.onFileSelect
289
- }, null, 8, ["onRegister", "onSelect"])
291
+ }, null, 8, ["onRegister", "onSelect"]),
292
+ createVNode(_component_code_file_list_modal, { onRegister: _ctx.registerCodeFileListModal }, null, 8, ["onRegister"])
290
293
  ], 64);
291
294
  }
292
295
  var CodeGeneratorModal = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);