@jeecg/online 3.5.3-beta3 → 3.6.0-beta

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 (163) hide show
  1. package/AuthButtonConfig-b6a674fa.mjs +125 -0
  2. package/AuthButtonTree-09e57bc4.mjs +156 -0
  3. package/AuthDataConfig-6e7e61ec.mjs +212 -0
  4. package/AuthDataTree-e83286c5.mjs +139 -0
  5. package/AuthFieldConfig-f1ec2708.mjs +139 -0
  6. package/AuthFieldTree-bb72e21f.mjs +232 -0
  7. package/AuthManagerDrawer-28a2d108.mjs +114 -0
  8. package/AuthSetterModal-2990d553.mjs +261 -0
  9. package/CgformCopyList-36a4cbf0.mjs +246 -0
  10. package/CgformModal-7399a5ac.mjs +611 -0
  11. package/CgreportModal-2eb9c9e1.mjs +13 -0
  12. package/CgreportModal.vue_vue_type_script_setup_true_lang-c2ceb064.mjs +566 -0
  13. package/CheckDictTable-3a8a54b3.mjs +211 -0
  14. package/CodeFileListModal-72f0d3bb.mjs +158 -0
  15. package/CodeFileViewModal-9eb88c47.mjs +244 -0
  16. package/CodeGeneratorModal-a89958f5.mjs +233 -0
  17. package/CustomButtonList-c44aec5a.mjs +363 -0
  18. package/DBAttributeTable-7d285e8d.mjs +473 -0
  19. package/DbToOnlineModal-d23cbeb1.mjs +160 -0
  20. package/DetailForm-2901d215.mjs +461 -0
  21. package/EnhanceJavaModal-153899a9.mjs +264 -0
  22. package/EnhanceJsHistory-7f5db3b1.mjs +184 -0
  23. package/EnhanceJsModal-c2fb75b8.mjs +311 -0
  24. package/EnhanceSqlModal-965e9b0a.mjs +268 -0
  25. package/ExtendConfigModal-8f08466f.mjs +111 -0
  26. package/FieldExtendJsonModal-adfcf5a7.mjs +219 -0
  27. package/FileSelectModal-432d4521.mjs +103 -0
  28. package/ForeignKeyTable-faab7ccf.mjs +69 -0
  29. package/IndexTable-0a2d3718.mjs +89 -0
  30. package/JModalTip-e1938b49.mjs +46 -0
  31. package/JOnlineSearchSelect-7e908492.mjs +95 -0
  32. package/LeftDepart-54f245b3.mjs +82 -0
  33. package/LeftRole-c138f892.mjs +86 -0
  34. package/LeftUser-9c812f8a.mjs +105 -0
  35. package/LinkTableConfigModal-c2c5c7e6.mjs +230 -0
  36. package/LinkTableFieldConfigModal-a3553b1f.mjs +176 -0
  37. package/LinkTableListPiece-7f793b08.mjs +34 -0
  38. package/ModalFormDemo-65685b0e.mjs +78 -0
  39. package/OnlCgformErpList-52c87ed3.mjs +449 -0
  40. package/OnlCgformErpSubTable-6e7fb17b.mjs +398 -0
  41. package/OnlCgformInnerSubTable-f0727b8f.mjs +248 -0
  42. package/OnlCgformInnerTableList-9f89c173.mjs +430 -0
  43. package/OnlCgformTabList-15516315.mjs +390 -0
  44. package/OnlineAutoList-63a0224f.mjs +474 -0
  45. package/OnlineAutoModal-ffe19c3f.mjs +206 -0
  46. package/OnlineAutoTreeList-317c7105.mjs +495 -0
  47. package/OnlineCustomModal-3939ce78.mjs +227 -0
  48. package/OnlineDetailModal-bfb1375f.mjs +177 -0
  49. package/OnlineForm-069f6092.mjs +749 -0
  50. package/OnlineFormDetail-ad5735fb.mjs +296 -0
  51. package/OnlineQueryForm-0771c80f.mjs +385 -0
  52. package/OnlineSearchFormItem-0db5834f.mjs +348 -0
  53. package/OnlineSelectCascade-a05c30f4.mjs +159 -0
  54. package/OnlineSubFormDetail-583d01eb.mjs +142 -0
  55. package/OnlineTabAutoModal-747e071d.mjs +253 -0
  56. package/OnlineTabDetailModal-887f0174.mjs +222 -0
  57. package/OnlineTabForm-b1dcd4b4.mjs +765 -0
  58. package/OnlineTabFormDetail-8e494a96.mjs +323 -0
  59. package/PageAttributeTable-5966b201.mjs +404 -0
  60. package/ProcessOnlineForm-4382bea7.mjs +177 -0
  61. package/QueryTable-6e8053ad.mjs +115 -0
  62. package/README.md +2 -1
  63. package/SuperQuery-78db6998.mjs +841 -0
  64. package/SuperQueryValComponent-471110b5.mjs +8 -0
  65. package/SuperQueryValComponent.vue_vue_type_script_lang-e3ad7ee8.mjs +101 -0
  66. package/auth.api-d3a6c4b3.mjs +39 -0
  67. package/auth.data-8be5c9e3.mjs +141 -0
  68. package/{cgform.data.js → cgform.data-cbdd88c3.mjs} +93 -62
  69. package/constant-754f1a9d.mjs +9 -0
  70. package/enhance.api-138e6826.mjs +104 -0
  71. package/enhance.data-efc7e155.mjs +175 -0
  72. package/index-0a93652b.mjs +237 -0
  73. package/index-7e9a23f2.mjs +1494 -0
  74. package/index-b70302f2.mjs +56 -0
  75. package/main.index.js +7 -1
  76. package/package.json +1 -1
  77. package/style.css +1 -1
  78. package/useCgformList-0c603af1.mjs +424 -0
  79. package/useCustomHook-acb00837.mjs +53 -0
  80. package/useExtendComponent-aa1cdfc8.mjs +3917 -0
  81. package/useListButton-0f18bf6a.mjs +671 -0
  82. package/useOnlinePopEvent-687070b7.mjs +19 -0
  83. package/useOnlineTest-e4bd8be3.mjs +42 -0
  84. package/useSchemas-43429d80.mjs +685 -0
  85. package/useTableSync-774c3774.mjs +87 -0
  86. package/AuthButtonConfig.js +0 -147
  87. package/AuthButtonTree.js +0 -183
  88. package/AuthDataConfig.js +0 -246
  89. package/AuthDataTree.js +0 -160
  90. package/AuthFieldConfig.js +0 -170
  91. package/AuthFieldTree.js +0 -281
  92. package/AuthManagerDrawer.js +0 -125
  93. package/AuthSetterModal.js +0 -316
  94. package/CgformCopyList.js +0 -266
  95. package/CgformModal.js +0 -780
  96. package/CgreportModal.js +0 -667
  97. package/CheckDictTable.js +0 -242
  98. package/CodeFileListModal.js +0 -175
  99. package/CodeFileViewModal.js +0 -325
  100. package/CodeGeneratorModal.js +0 -297
  101. package/CustomButtonList.js +0 -410
  102. package/DBAttributeTable.js +0 -526
  103. package/DbToOnlineModal.js +0 -192
  104. package/DetailForm.js +0 -608
  105. package/EnhanceJavaModal.js +0 -298
  106. package/EnhanceJsHistory.js +0 -229
  107. package/EnhanceJsModal.js +0 -293
  108. package/EnhanceSqlModal.js +0 -299
  109. package/ExtendConfigModal.js +0 -151
  110. package/FieldExtendJsonModal.js +0 -283
  111. package/FileSelectModal.js +0 -102
  112. package/ForeignKeyTable.js +0 -79
  113. package/IndexTable.js +0 -97
  114. package/JModalTip.js +0 -54
  115. package/JOnlineSearchSelect.js +0 -115
  116. package/LICENSE +0 -9
  117. package/LeftDepart.js +0 -96
  118. package/LeftRole.js +0 -98
  119. package/LeftUser.js +0 -117
  120. package/LinkTableConfigModal.js +0 -289
  121. package/LinkTableFieldConfigModal.js +0 -218
  122. package/LinkTableListPiece.js +0 -36
  123. package/ModalFormDemo.js +0 -85
  124. package/OnlineAutoList.js +0 -523
  125. package/OnlineAutoModal.js +0 -226
  126. package/OnlineAutoTreeList.js +0 -552
  127. package/OnlineCustomModal.js +0 -286
  128. package/OnlineDetailModal.js +0 -190
  129. package/OnlineForm.js +0 -1016
  130. package/OnlineFormDetail.js +0 -347
  131. package/OnlineQueryForm.js +0 -484
  132. package/OnlineSearchFormItem.js +0 -436
  133. package/OnlineSelectCascade.js +0 -228
  134. package/OnlineSubFormDetail.js +0 -166
  135. package/PageAttributeTable.js +0 -486
  136. package/ProcessOnlineForm.js +0 -208
  137. package/QueryTable.js +0 -129
  138. package/SuperQuery.js +0 -1020
  139. package/SuperQueryValComponent.js +0 -8
  140. package/SuperQueryValComponent.vue_vue_type_script_lang.js +0 -168
  141. package/_arrayPush.js +0 -278
  142. package/_baseClone.js +0 -471
  143. package/_baseSlice.js +0 -18
  144. package/_commonjsHelpers.js +0 -5
  145. package/_flatRest.js +0 -174
  146. package/auth.api.js +0 -43
  147. package/auth.data.js +0 -142
  148. package/clipboard.js +0 -565
  149. package/enhance.api.js +0 -129
  150. package/enhance.data.js +0 -196
  151. package/index.js +0 -87
  152. package/index2.js +0 -340
  153. package/index3.js +0 -264
  154. package/isArray.js +0 -47
  155. package/omit.js +0 -60
  156. package/pick.js +0 -68
  157. package/toString.js +0 -31
  158. package/useCgformList.js +0 -470
  159. package/useExtendComponent.js +0 -5205
  160. package/useListButton.js +0 -923
  161. package/useOnlineTest.js +0 -44
  162. package/useSchemas.js +0 -653
  163. package/useTableSync.js +0 -117
@@ -1,325 +0,0 @@
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 };
@@ -1,297 +0,0 @@
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, reactive, nextTick, resolveComponent, openBlock, createElementBlock, Fragment, createVNode, withCtx, createBlock, mergeProps, createCommentVNode } from "vue";
22
- import { defHttp } from "/@/utils/http/axios";
23
- import { BasicForm, useForm } from "/@/components/Form";
24
- import { BasicModal, useModalInner, useModal } from "/@/components/Modal";
25
- import { JVxeTypes } from "/@/components/jeecg/JVxeTable/types";
26
- import { b as useCodeGeneratorFormSchemas } from "./useSchemas.js";
27
- import { underLine2CamelCase } from "/@/utils/common/compUtils";
28
- import CodeFileListModal from "./CodeFileListModal.js";
29
- import FileSelectModal from "./FileSelectModal.js";
30
- import { _ as _export_sfc } from "./index.js";
31
- import "ant-design-vue";
32
- import "@ant-design/icons-vue";
33
- import "/@/hooks/web/usePermission";
34
- import "/@/utils/helper/validator";
35
- import "./CodeFileViewModal.js";
36
- import "/@/hooks/web/useMessage";
37
- import "/@/utils/file/download";
38
- import "/@/components/jeecg/OnLine/JPopupOnlReport.vue";
39
- import "vue-router";
40
- const _sfc_main = defineComponent({
41
- name: "CodeGenerator",
42
- components: { BasicForm, BasicModal, FileSelectModal, CodeFileListModal },
43
- emits: ["register"],
44
- setup(props) {
45
- const JEECG_ONL_PROJECT_PATH = "JEECG_ONL_PROJECT_PATH";
46
- const single = ref(true);
47
- const subTableRef = ref();
48
- const modalWidth = computed(() => single.value ? 800 : 1200);
49
- const title = ref("\u4EE3\u7801\u751F\u6210");
50
- const confirmLoading = ref(false);
51
- const code = ref("");
52
- const metaModel = reactive({
53
- projectPath: "",
54
- packageStyle: "service",
55
- jspMode: "",
56
- jformType: "1",
57
- tableName_tmp: "",
58
- ftlDescription: "",
59
- entityName: "",
60
- codeTypes: "controller,service,dao,mapper,entity,vue"
61
- });
62
- const model = reactive({});
63
- const jspModeOptions = ref([]);
64
- const subTable = reactive({
65
- dataSource: [],
66
- columns: [
67
- {
68
- title: "\u5B50\u8868\u540D",
69
- key: "tableName",
70
- type: JVxeTypes.input,
71
- disabled: true,
72
- validateRules: [{ required: true, message: "\u8BF7\u8F93\u5165${title}" }]
73
- },
74
- {
75
- title: "\u5B50\u8868\u5B9E\u4F53",
76
- key: "entityName",
77
- type: JVxeTypes.input,
78
- validateRules: [{ required: true, message: "\u8BF7\u8F93\u5165${title}" }]
79
- },
80
- {
81
- title: "\u529F\u80FD\u8BF4\u660E",
82
- key: "ftlDescription",
83
- type: JVxeTypes.input,
84
- validateRules: [{ required: true, message: "\u8BF7\u8F93\u5165${title}" }]
85
- }
86
- ]
87
- });
88
- const showSubTable = computed(() => subTable.dataSource.length > 0);
89
- const { formSchemas } = useCodeGeneratorFormSchemas(
90
- props,
91
- {
92
- onProjectPathChange,
93
- onProjectPathSearch,
94
- jspModeOptions
95
- },
96
- single
97
- );
98
- const [registerForm, { resetFields, setFieldsValue, validate }] = useForm({
99
- schemas: formSchemas,
100
- showActionButtonGroup: false,
101
- labelAlign: "right"
102
- });
103
- const [registerModal, { closeModal }] = useModalInner((data) => __async(this, null, function* () {
104
- yield resetFields();
105
- code.value = data.code;
106
- confirmLoading.value = false;
107
- subTable.dataSource = [];
108
- jspModeOptions.value = [];
109
- getStoreProjectPath();
110
- Object.assign(model, metaModel);
111
- loadData();
112
- }));
113
- function loadData() {
114
- return __async(this, null, function* () {
115
- let { main, sub, jspModeList, projectPath } = yield defHttp.get({
116
- url: "/online/cgform/head/tableInfo",
117
- params: { code: code.value }
118
- });
119
- let jspModeListForVue3 = [];
120
- for (let mode of jspModeList) {
121
- const { code: code2, note } = mode;
122
- if (code2 == "many")
123
- ;
124
- else {
125
- jspModeListForVue3.push({
126
- label: note,
127
- value: code2
128
- });
129
- }
130
- }
131
- jspModeOptions.value = jspModeListForVue3;
132
- if (main.isTree == "Y") {
133
- model.jspMode = "tree";
134
- } else {
135
- model.jspMode = jspModeListForVue3[0].value;
136
- }
137
- single.value = main.tableType == 1;
138
- title.value = "\u4EE3\u7801\u751F\u6210\u3010" + main.tableName + "\u3011";
139
- if (!model.projectPath) {
140
- model.projectPath = projectPath;
141
- window.localStorage.setItem(JEECG_ONL_PROJECT_PATH, projectPath);
142
- }
143
- model.jformType = main.tableType + "";
144
- model.tableName_tmp = main.tableName;
145
- model.ftlDescription = main.tableTxt;
146
- let entityNameTemp = underLine2CamelCase(main.tableName);
147
- model.entityName = entityNameTemp.substring(0, 1).toUpperCase() + entityNameTemp.substring(1);
148
- yield nextTick();
149
- setFieldsValue(model);
150
- if (sub && sub.length > 0) {
151
- subTable.dataSource = sub.map((item) => ({
152
- tableName: item.tableName,
153
- entityName: getCamelCase(item.tableName),
154
- ftlDescription: item.tableTxt
155
- }));
156
- }
157
- });
158
- }
159
- const [registerCodeFileListModal, { openModal: openCodeFileListModal }] = useModal();
160
- function onSubmit() {
161
- return __async(this, null, function* () {
162
- try {
163
- const values = yield validate();
164
- let params = Object.assign({}, values, { code: code.value, tableName: values.tableName_tmp });
165
- if (showSubTable.value) {
166
- let errMap = yield subTableRef.value.validateTable();
167
- if (errMap) {
168
- return;
169
- }
170
- params.subList = subTableRef.value.getTableData();
171
- }
172
- confirmLoading.value = true;
173
- let res = yield codeGen(params);
174
- openCodeFileListModal(true, {
175
- codeList: res.codeList,
176
- pathKey: res.pathKey,
177
- tableName: values.tableName_tmp
178
- });
179
- closeModal();
180
- } catch (e) {
181
- console.error(e);
182
- } finally {
183
- confirmLoading.value = false;
184
- }
185
- });
186
- }
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
- this.$message.error(res.message);
199
- reject(res.message);
200
- }
201
- });
202
- });
203
- }
204
- function onCancel() {
205
- closeModal();
206
- }
207
- const [registerFileSelectModal, fileSelectModal] = useModal();
208
- function onProjectPathSearch() {
209
- fileSelectModal.openModal(true, {});
210
- }
211
- function onFileSelect(url) {
212
- window.localStorage.setItem(JEECG_ONL_PROJECT_PATH, url);
213
- setFieldsValue({ projectPath: url });
214
- }
215
- function getCamelCase(val) {
216
- let temp = underLine2CamelCase(val);
217
- return temp.substring(0, 1).toUpperCase() + temp.substring(1);
218
- }
219
- function getStoreProjectPath() {
220
- let path = window.localStorage.getItem(JEECG_ONL_PROJECT_PATH);
221
- if (path) {
222
- metaModel.projectPath = path;
223
- }
224
- }
225
- function onProjectPathChange(e) {
226
- if (e.target.value)
227
- window.localStorage.setItem(JEECG_ONL_PROJECT_PATH, e.target.value);
228
- }
229
- return {
230
- title,
231
- modalWidth,
232
- confirmLoading,
233
- subTable,
234
- showSubTable,
235
- onSubmit,
236
- onCancel,
237
- onFileSelect,
238
- registerFileSelectModal,
239
- subTableRef,
240
- registerForm,
241
- registerModal,
242
- registerCodeFileListModal
243
- };
244
- }
245
- });
246
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
247
- const _component_BasicForm = resolveComponent("BasicForm");
248
- const _component_JVxeTable = resolveComponent("JVxeTable");
249
- const _component_a_card = resolveComponent("a-card");
250
- const _component_a_spin = resolveComponent("a-spin");
251
- const _component_BasicModal = resolveComponent("BasicModal");
252
- const _component_FileSelectModal = resolveComponent("FileSelectModal");
253
- const _component_code_file_list_modal = resolveComponent("code-file-list-modal");
254
- return openBlock(), createElementBlock(Fragment, null, [
255
- createVNode(_component_BasicModal, {
256
- onRegister: _ctx.registerModal,
257
- title: _ctx.title,
258
- width: _ctx.modalWidth,
259
- confirmLoading: _ctx.confirmLoading,
260
- okText: "\u5F00\u59CB\u751F\u6210",
261
- cancelText: "\u53D6\u6D88",
262
- onOk: _ctx.onSubmit,
263
- onCancel: _ctx.onCancel
264
- }, {
265
- default: withCtx(() => [
266
- createVNode(_component_a_spin, { spinning: _ctx.confirmLoading }, {
267
- default: withCtx(() => [
268
- createVNode(_component_BasicForm, { onRegister: _ctx.registerForm }, null, 8, ["onRegister"]),
269
- _ctx.showSubTable ? (openBlock(), createBlock(_component_a_card, {
270
- key: 0,
271
- title: "\u5B50\u8868\u4FE1\u606F",
272
- size: "small"
273
- }, {
274
- default: withCtx(() => [
275
- createVNode(_component_JVxeTable, mergeProps({
276
- ref: "subTableRef",
277
- rowNumber: "",
278
- maxHeight: 580
279
- }, _ctx.subTable), null, 16)
280
- ]),
281
- _: 1
282
- })) : createCommentVNode("", true)
283
- ]),
284
- _: 1
285
- }, 8, ["spinning"])
286
- ]),
287
- _: 1
288
- }, 8, ["onRegister", "title", "width", "confirmLoading", "onOk", "onCancel"]),
289
- createVNode(_component_FileSelectModal, {
290
- onRegister: _ctx.registerFileSelectModal,
291
- onSelect: _ctx.onFileSelect
292
- }, null, 8, ["onRegister", "onSelect"]),
293
- createVNode(_component_code_file_list_modal, { onRegister: _ctx.registerCodeFileListModal }, null, 8, ["onRegister"])
294
- ], 64);
295
- }
296
- var CodeGeneratorModal = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
297
- export { CodeGeneratorModal as default };