@jeecg/online 3.5.3-beta2 → 3.5.3-vite4

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 (154) hide show
  1. package/AuthButtonConfig-2f71787c.mjs +125 -0
  2. package/AuthButtonTree-d73bccf5.mjs +156 -0
  3. package/AuthDataConfig-32cf23d2.mjs +212 -0
  4. package/AuthDataTree-03d62d3f.mjs +139 -0
  5. package/AuthFieldConfig-b1217a0c.mjs +139 -0
  6. package/AuthFieldTree-888e04a9.mjs +232 -0
  7. package/AuthManagerDrawer-f127b8a2.mjs +114 -0
  8. package/AuthSetterModal-37da78ed.mjs +261 -0
  9. package/CgformCopyList-3adab58f.mjs +245 -0
  10. package/CgformModal-6938d8c2.mjs +613 -0
  11. package/CgreportModal-77ec8c17.mjs +12 -0
  12. package/CgreportModal.vue_vue_type_script_setup_true_lang-52dcec5e.mjs +567 -0
  13. package/CheckDictTable-414313f2.mjs +211 -0
  14. package/CodeFileListModal-4831ce3d.mjs +158 -0
  15. package/CodeFileViewModal-5990dac4.mjs +244 -0
  16. package/CodeGeneratorModal-7df9e25d.mjs +234 -0
  17. package/CustomButtonList-1c9bd859.mjs +363 -0
  18. package/DBAttributeTable-cd1c41e5.mjs +473 -0
  19. package/DbToOnlineModal-dc5d2030.mjs +160 -0
  20. package/DetailForm-e4538e7a.mjs +446 -0
  21. package/EnhanceJavaModal-7f53d2ca.mjs +260 -0
  22. package/EnhanceJsHistory-c30805ce.mjs +184 -0
  23. package/EnhanceJsModal-0b133341.mjs +233 -0
  24. package/EnhanceSqlModal-33a94c83.mjs +259 -0
  25. package/ExtendConfigModal-60f2cf86.mjs +111 -0
  26. package/FieldExtendJsonModal-48f7d67f.mjs +220 -0
  27. package/FileSelectModal-64aaf623.mjs +91 -0
  28. package/ForeignKeyTable-cb1abd1d.mjs +69 -0
  29. package/IndexTable-4e94cd1f.mjs +89 -0
  30. package/JModalTip-abe1515a.mjs +46 -0
  31. package/JOnlineSearchSelect-5608a5cf.mjs +94 -0
  32. package/LeftDepart-ca7a7375.mjs +82 -0
  33. package/LeftRole-d0fa8398.mjs +86 -0
  34. package/LeftUser-0c88c240.mjs +105 -0
  35. package/LinkTableConfigModal-77d7c0b9.mjs +230 -0
  36. package/LinkTableFieldConfigModal-c5689ab0.mjs +178 -0
  37. package/LinkTableListPiece-34266919.mjs +34 -0
  38. package/ModalFormDemo-0eeea994.mjs +78 -0
  39. package/OnlCgformErpList-7a0388d8.mjs +425 -0
  40. package/OnlCgformErpSubTable-fc6ade76.mjs +388 -0
  41. package/OnlineAutoList-85e6a30d.mjs +472 -0
  42. package/OnlineAutoModal-2a146238.mjs +206 -0
  43. package/OnlineAutoTreeList-f8d0e100.mjs +495 -0
  44. package/OnlineCustomModal-456a85a6.mjs +227 -0
  45. package/OnlineDetailModal-f967f080.mjs +177 -0
  46. package/OnlineForm-630a22c2.mjs +778 -0
  47. package/OnlineFormDetail-1b216792.mjs +296 -0
  48. package/OnlineQueryForm-1c5949a7.mjs +378 -0
  49. package/OnlineSearchFormItem-7c2ea9ed.mjs +352 -0
  50. package/OnlineSelectCascade-c7baf52b.mjs +160 -0
  51. package/OnlineSubFormDetail-0aa4966c.mjs +140 -0
  52. package/PageAttributeTable-811185fd.mjs +404 -0
  53. package/ProcessOnlineForm-27be6f6f.mjs +177 -0
  54. package/QueryTable-4ba771ef.mjs +115 -0
  55. package/SuperQuery-3821f984.mjs +845 -0
  56. package/SuperQueryValComponent-471110b5.mjs +8 -0
  57. package/SuperQueryValComponent.vue_vue_type_script_lang-e3ad7ee8.mjs +101 -0
  58. package/auth.api-d3a6c4b3.mjs +39 -0
  59. package/auth.data-8be5c9e3.mjs +141 -0
  60. package/{cgform.data.js → cgform.data-cbdd88c3.mjs} +93 -62
  61. package/constant-fe20103a.mjs +6 -0
  62. package/enhance.api-138e6826.mjs +104 -0
  63. package/enhance.data-efc7e155.mjs +175 -0
  64. package/index-074b92e5.mjs +236 -0
  65. package/index-6a09a912.mjs +58 -0
  66. package/index-9d32ae88.mjs +313 -0
  67. package/main.index.js +7 -1
  68. package/package.json +1 -1
  69. package/style.css +1 -1
  70. package/useCgformList-2d6a5955.mjs +388 -0
  71. package/useExtendComponent-48d37d9b.mjs +3919 -0
  72. package/useListButton-cef1371a.mjs +656 -0
  73. package/useOnlinePopEvent-e9a042f8.mjs +19 -0
  74. package/useOnlineTest-0df0ae86.mjs +43 -0
  75. package/useSchemas-fc8d97ce.mjs +669 -0
  76. package/useTableSync-dc333087.mjs +83 -0
  77. package/AuthButtonConfig.js +0 -147
  78. package/AuthButtonTree.js +0 -183
  79. package/AuthDataConfig.js +0 -246
  80. package/AuthDataTree.js +0 -160
  81. package/AuthFieldConfig.js +0 -170
  82. package/AuthFieldTree.js +0 -281
  83. package/AuthManagerDrawer.js +0 -125
  84. package/AuthSetterModal.js +0 -316
  85. package/CgformCopyList.js +0 -266
  86. package/CgformModal.js +0 -780
  87. package/CgreportModal.js +0 -667
  88. package/CheckDictTable.js +0 -242
  89. package/CodeFileListModal.js +0 -175
  90. package/CodeFileViewModal.js +0 -325
  91. package/CodeGeneratorModal.js +0 -297
  92. package/CustomButtonList.js +0 -410
  93. package/DBAttributeTable.js +0 -526
  94. package/DbToOnlineModal.js +0 -192
  95. package/DetailForm.js +0 -608
  96. package/EnhanceJavaModal.js +0 -298
  97. package/EnhanceJsHistory.js +0 -229
  98. package/EnhanceJsModal.js +0 -293
  99. package/EnhanceSqlModal.js +0 -299
  100. package/ExtendConfigModal.js +0 -151
  101. package/FieldExtendJsonModal.js +0 -283
  102. package/FileSelectModal.js +0 -102
  103. package/ForeignKeyTable.js +0 -79
  104. package/IndexTable.js +0 -97
  105. package/JModalTip.js +0 -54
  106. package/JOnlineSearchSelect.js +0 -115
  107. package/LICENSE +0 -9
  108. package/LeftDepart.js +0 -96
  109. package/LeftRole.js +0 -98
  110. package/LeftUser.js +0 -117
  111. package/LinkTableConfigModal.js +0 -289
  112. package/LinkTableFieldConfigModal.js +0 -218
  113. package/LinkTableListPiece.js +0 -36
  114. package/ModalFormDemo.js +0 -85
  115. package/OnlineAutoList.js +0 -524
  116. package/OnlineAutoModal.js +0 -226
  117. package/OnlineAutoTreeList.js +0 -553
  118. package/OnlineCustomModal.js +0 -286
  119. package/OnlineDetailModal.js +0 -190
  120. package/OnlineForm.js +0 -1018
  121. package/OnlineFormDetail.js +0 -347
  122. package/OnlineQueryForm.js +0 -484
  123. package/OnlineSearchFormItem.js +0 -436
  124. package/OnlineSelectCascade.js +0 -228
  125. package/OnlineSubFormDetail.js +0 -166
  126. package/PageAttributeTable.js +0 -486
  127. package/ProcessOnlineForm.js +0 -208
  128. package/QueryTable.js +0 -129
  129. package/SuperQuery.js +0 -1021
  130. package/SuperQueryValComponent.js +0 -9
  131. package/SuperQueryValComponent.vue_vue_type_script_lang.js +0 -162
  132. package/_arrayPush.js +0 -278
  133. package/_baseClone.js +0 -471
  134. package/_baseSlice.js +0 -18
  135. package/_commonjsHelpers.js +0 -5
  136. package/_flatRest.js +0 -174
  137. package/auth.api.js +0 -43
  138. package/auth.data.js +0 -142
  139. package/clipboard.js +0 -565
  140. package/enhance.api.js +0 -129
  141. package/enhance.data.js +0 -196
  142. package/index.js +0 -87
  143. package/index2.js +0 -340
  144. package/index3.js +0 -264
  145. package/isArray.js +0 -47
  146. package/omit.js +0 -60
  147. package/pick.js +0 -68
  148. package/toString.js +0 -31
  149. package/useCgformList.js +0 -470
  150. package/useExtendComponent.js +0 -5205
  151. package/useListButton.js +0 -923
  152. package/useOnlineTest.js +0 -44
  153. package/useSchemas.js +0 -653
  154. 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 { message } from "ant-design-vue";
31
- import { _ as _export_sfc } from "./index.js";
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
- 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 };