@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
package/EnhanceJsModal.js DELETED
@@ -1,293 +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, createCommentVNode } from "vue";
22
- import { BasicModal, useModalInner, useModal } from "/@/components/Modal";
23
- import { JCodeEditor } from "/@/components/Form";
24
- import { u as useOnlineTest } from "./useOnlineTest.js";
25
- import { E as EnhanceJsHistory, u as useEnhanceStore } from "./EnhanceJsHistory.js";
26
- import { g as getEnhanceJsByCode, s as saveEnhanceJs } from "./enhance.api.js";
27
- import { useMessage } from "/@/hooks/web/useMessage";
28
- import { _ as _export_sfc } from "./index.js";
29
- import "/@/utils/dateUtil";
30
- import "/@/store";
31
- import "pinia";
32
- import "/@/utils/cache";
33
- import "/@/utils/http/axios";
34
- import "/@/utils/is";
35
- import "/@/components/jeecg/OnLine/JPopupOnlReport.vue";
36
- import "vue-router";
37
- const _sfc_main = defineComponent({
38
- name: "EnhanceJs",
39
- components: { BasicModal, JCodeEditor, EnhanceJsHistory },
40
- emits: ["register"],
41
- setup() {
42
- const { createMessage: $message } = useMessage();
43
- const enhanceStore = useEnhanceStore();
44
- const formEditorRef = ref();
45
- const listEditorRef = ref();
46
- const models = reactive({ form: {}, list: {} });
47
- const enhanceType = ref("list");
48
- const code = ref("");
49
- const showHistory = ref(false);
50
- const codeChange = ref(false);
51
- const tableName = ref("");
52
- const enhanceValues = reactive({ form: "", list: "" });
53
- const getFlag = { form: false, list: false };
54
- const reloading = ref(false);
55
- const [registerModal, { closeModal }] = useModalInner((data) => __async(this, null, function* () {
56
- show(data.row);
57
- }));
58
- const [registerEnhanceJsHistory, enhanceJsHistory] = useModal();
59
- const { aiTestMode, genEnhanceJsData } = useOnlineTest();
60
- function show(row) {
61
- code.value = row.id;
62
- codeChange.value = false;
63
- tableName.value = row.tableName;
64
- let enhances = enhanceStore.getEnhanceJs(code.value);
65
- if ((enhances == null ? void 0 : enhances.length) > 0) {
66
- enhanceType.value = enhances[enhances.length - 1].type;
67
- showHistory.value = true;
68
- } else {
69
- showHistory.value = false;
70
- }
71
- getFlag.form = false;
72
- getFlag.list = false;
73
- if (!enhanceType.value) {
74
- onChangeType("form");
75
- } else {
76
- onChangeType(enhanceType.value);
77
- }
78
- reloading.value = true;
79
- setTimeout(() => reloading.value = false, 150);
80
- }
81
- function onSubmit() {
82
- return __async(this, null, function* () {
83
- yield Promise.all([saveEnhanceJsByType("form"), saveEnhanceJsByType("list")]);
84
- closeModal();
85
- $message.success("\u4FDD\u5B58\u6210\u529F");
86
- });
87
- }
88
- function saveEnhanceJsByType(type) {
89
- return __async(this, null, function* () {
90
- let model = models[type];
91
- let params = {
92
- cgJs: enhanceValues[type],
93
- cgJsType: type
94
- };
95
- if (!getFlag[type] || model.cgJs === params.cgJs) {
96
- return;
97
- }
98
- let isUpdate = !!model.id;
99
- if (isUpdate) {
100
- params = Object.assign({}, model, params);
101
- }
102
- yield saveEnhanceJs(code.value, params, isUpdate);
103
- enhanceStore.addEnhanceJs({
104
- code: code.value,
105
- str: params.cgJs,
106
- type: params.cgJsType,
107
- date: new Date().getTime()
108
- });
109
- });
110
- }
111
- function onCancel() {
112
- closeModal();
113
- }
114
- function onChangeType(type) {
115
- return __async(this, null, function* () {
116
- enhanceType.value = type;
117
- try {
118
- if (!getFlag[type]) {
119
- let result = yield getEnhanceJsByCode(code.value, type);
120
- Object.assign(models[type], { id: null }, result);
121
- enhanceValues[type] = models[type].cgJs;
122
- getFlag[type] = true;
123
- }
124
- } catch (e) {
125
- console.error(e);
126
- }
127
- setTimeout(() => {
128
- if (type == "list") {
129
- listEditorRef.value.refresh();
130
- } else {
131
- formEditorRef.value.refresh();
132
- }
133
- }, 150);
134
- });
135
- }
136
- function onShowHistory() {
137
- enhanceJsHistory.openModal(true, {
138
- code: code.value,
139
- type: enhanceType.value
140
- });
141
- }
142
- function onCodeChange(value) {
143
- if (enhanceValues[enhanceType.value] != value) {
144
- codeChange.value = true;
145
- enhanceValues[enhanceType.value] = value;
146
- }
147
- }
148
- function onGenTestData() {
149
- if (enhanceType.value === "form") {
150
- genEnhanceJsData(tableName.value, enhanceType.value, formEditorRef.value);
151
- } else {
152
- genEnhanceJsData(tableName.value, enhanceType.value, listEditorRef.value);
153
- }
154
- }
155
- return {
156
- formEditorRef,
157
- listEditorRef,
158
- reloading,
159
- enhanceValues,
160
- enhanceType,
161
- showHistory,
162
- aiTestMode,
163
- tableName,
164
- genEnhanceJsData,
165
- onGenTestData,
166
- onChangeType,
167
- onCodeChange,
168
- onShowHistory,
169
- onSubmit,
170
- onCancel,
171
- registerModal,
172
- registerEnhanceJsHistory
173
- };
174
- }
175
- });
176
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
177
- const _component_JCodeEditor = resolveComponent("JCodeEditor");
178
- const _component_a_tab_pane = resolveComponent("a-tab-pane");
179
- const _component_a_tabs = resolveComponent("a-tabs");
180
- const _component_a_button = resolveComponent("a-button");
181
- const _component_a_space = resolveComponent("a-space");
182
- const _component_EnhanceJsHistory = resolveComponent("EnhanceJsHistory");
183
- const _component_BasicModal = resolveComponent("BasicModal");
184
- return openBlock(), createBlock(_component_BasicModal, {
185
- onRegister: _ctx.registerModal,
186
- title: "JS\u589E\u5F3A",
187
- width: 800,
188
- bodyStyle: { height: "360px" }
189
- }, {
190
- footer: withCtx(() => [
191
- createVNode(_component_a_space, null, {
192
- default: withCtx(() => [
193
- createVNode(_component_a_button, { onClick: _ctx.onCancel }, {
194
- default: withCtx(() => [
195
- createTextVNode("\u5173\u95ED")
196
- ]),
197
- _: 1
198
- }, 8, ["onClick"]),
199
- createVNode(_component_a_button, {
200
- type: "primary",
201
- onClick: _ctx.onSubmit
202
- }, {
203
- default: withCtx(() => [
204
- createTextVNode("\u786E\u5B9A")
205
- ]),
206
- _: 1
207
- }, 8, ["onClick"])
208
- ]),
209
- _: 1
210
- }),
211
- createVNode(_component_a_space, { style: { "float": "left" } }, {
212
- default: withCtx(() => [
213
- _ctx.showHistory ? (openBlock(), createBlock(_component_a_button, {
214
- key: 0,
215
- onClick: _ctx.onShowHistory
216
- }, {
217
- default: withCtx(() => [
218
- createTextVNode("\u67E5\u770B\u5386\u53F2\u7248\u672C")
219
- ]),
220
- _: 1
221
- }, 8, ["onClick"])) : createCommentVNode("", true),
222
- _ctx.aiTestMode ? (openBlock(), createBlock(_component_a_button, {
223
- key: 1,
224
- onClick: _ctx.onGenTestData
225
- }, {
226
- default: withCtx(() => [
227
- createTextVNode("\u751F\u6210\u6D4B\u8BD5\u6570\u636E")
228
- ]),
229
- _: 1
230
- }, 8, ["onClick"])) : createCommentVNode("", true)
231
- ]),
232
- _: 1
233
- })
234
- ]),
235
- default: withCtx(() => [
236
- createVNode(_component_a_tabs, {
237
- activeKey: _ctx.enhanceType,
238
- "onUpdate:activeKey": _cache[2] || (_cache[2] = ($event) => _ctx.enhanceType = $event),
239
- onChange: _ctx.onChangeType
240
- }, {
241
- default: withCtx(() => [
242
- createVNode(_component_a_tab_pane, {
243
- tab: "form",
244
- key: "form",
245
- forceRender: ""
246
- }, {
247
- default: withCtx(() => [
248
- !_ctx.reloading ? (openBlock(), createBlock(_component_JCodeEditor, {
249
- key: 0,
250
- ref: "formEditorRef",
251
- value: _ctx.enhanceValues.form,
252
- "onUpdate:value": _cache[0] || (_cache[0] = ($event) => _ctx.enhanceValues.form = $event),
253
- language: "javascript",
254
- fullScreen: true,
255
- lineNumbers: false,
256
- height: "240px",
257
- "language-change": false,
258
- onChange: _ctx.onCodeChange
259
- }, null, 8, ["value", "onChange"])) : createCommentVNode("", true)
260
- ]),
261
- _: 1
262
- }),
263
- createVNode(_component_a_tab_pane, {
264
- tab: "list",
265
- key: "list",
266
- forceRender: ""
267
- }, {
268
- default: withCtx(() => [
269
- !_ctx.reloading ? (openBlock(), createBlock(_component_JCodeEditor, {
270
- key: 0,
271
- ref: "listEditorRef",
272
- value: _ctx.enhanceValues.list,
273
- "onUpdate:value": _cache[1] || (_cache[1] = ($event) => _ctx.enhanceValues.list = $event),
274
- language: "javascript",
275
- fullScreen: true,
276
- lineNumbers: false,
277
- height: "240px",
278
- "language-change": false,
279
- onChange: _ctx.onCodeChange
280
- }, null, 8, ["value", "onChange"])) : createCommentVNode("", true)
281
- ]),
282
- _: 1
283
- })
284
- ]),
285
- _: 1
286
- }, 8, ["activeKey", "onChange"]),
287
- createVNode(_component_EnhanceJsHistory, { onRegister: _ctx.registerEnhanceJsHistory }, null, 8, ["onRegister"])
288
- ]),
289
- _: 1
290
- }, 8, ["onRegister"]);
291
- }
292
- var EnhanceJsModal = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
293
- export { EnhanceJsModal as default };
@@ -1,299 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
- var __hasOwnProp = Object.prototype.hasOwnProperty;
4
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
5
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
- var __spreadValues = (a, b) => {
7
- for (var prop in b || (b = {}))
8
- if (__hasOwnProp.call(b, prop))
9
- __defNormalProp(a, prop, b[prop]);
10
- if (__getOwnPropSymbols)
11
- for (var prop of __getOwnPropSymbols(b)) {
12
- if (__propIsEnum.call(b, prop))
13
- __defNormalProp(a, prop, b[prop]);
14
- }
15
- return a;
16
- };
17
- var __async = (__this, __arguments, generator) => {
18
- return new Promise((resolve, reject) => {
19
- var fulfilled = (value) => {
20
- try {
21
- step(generator.next(value));
22
- } catch (e) {
23
- reject(e);
24
- }
25
- };
26
- var rejected = (value) => {
27
- try {
28
- step(generator.throw(value));
29
- } catch (e) {
30
- reject(e);
31
- }
32
- };
33
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
34
- step((generator = generator.apply(__this, __arguments)).next());
35
- });
36
- };
37
- import { defineComponent, ref, reactive, computed, resolveComponent, openBlock, createBlock, withCtx, createVNode, createTextVNode, createElementBlock, createCommentVNode, normalizeProps, guardReactiveProps, nextTick } from "vue";
38
- import { BasicModal, useModalInner, useModal } from "/@/components/Modal";
39
- import { BasicForm, useForm } from "/@/components/Form";
40
- import { BasicTable, TableAction } from "/@/components/Table";
41
- import { useListPage } from "/@/hooks/system/useListPage";
42
- import { u as useOnlineTest } from "./useOnlineTest.js";
43
- import { b as useSqlFormSchemas, c as useSqlColumns } from "./enhance.data.js";
44
- import { c as getEnhanceSqlByCode, e as saveEnhanceSql, f as doEnhanceSqlBatchDelete } from "./enhance.api.js";
45
- import { _ as _export_sfc } from "./index.js";
46
- import "./cgform.data.js";
47
- import "/@/utils/dict";
48
- import "/@/utils/dict/JDictSelectUtil";
49
- import "/@/utils/uuid";
50
- import "/@/utils/http/axios";
51
- import "/@/utils/is";
52
- import "/@/components/jeecg/OnLine/JPopupOnlReport.vue";
53
- import "/@/hooks/web/useMessage";
54
- import "vue-router";
55
- const _sfc_main = defineComponent({
56
- name: "EnhanceSqlModal",
57
- components: { BasicModal, BasicTable, BasicForm, TableAction },
58
- emits: ["register"],
59
- setup() {
60
- const code = ref("");
61
- const tableName = ref("");
62
- const btnList = ref([]);
63
- const { columns } = useSqlColumns(btnList);
64
- const { doRequest, doDeleteRecord, tableContext } = useListPage({
65
- tableProps: {
66
- api: (params) => __async(this, null, function* () {
67
- let { dataSource, btnList: $btnList } = yield getEnhanceSqlByCode(code.value, params);
68
- btnList.value = $btnList;
69
- return dataSource;
70
- }),
71
- columns,
72
- canResize: false,
73
- useSearchForm: false,
74
- beforeFetch(params) {
75
- return Object.assign(params, { column: "orderNum", order: "asc" });
76
- }
77
- }
78
- });
79
- const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
80
- const [registerModal, { closeModal }] = useModalInner((data) => __async(this, null, function* () {
81
- code.value = data.row.id;
82
- tableName.value = data.row.tableName;
83
- reload();
84
- }));
85
- const { aiTestMode, genEnhanceSqlData } = useOnlineTest();
86
- const [registerFormModal, formModal] = useModal();
87
- const isUpdate = ref(false);
88
- const formModalProps = reactive({
89
- onRegister: registerFormModal,
90
- title: computed(() => (isUpdate == null ? void 0 : isUpdate.value) ? "\u4FEE\u6539" : "\u65B0\u589E"),
91
- width: 800,
92
- confirmLoading: false,
93
- onOk: onSubmit,
94
- onCancel: formModal.closeModal
95
- });
96
- let formRecord = {};
97
- const { formSchemas } = useSqlFormSchemas(btnList);
98
- const [registerForm, { resetFields, setFieldsValue, validate }] = useForm({
99
- schemas: formSchemas,
100
- showActionButtonGroup: false
101
- });
102
- function onCancel() {
103
- closeModal();
104
- }
105
- function openFormModal(data) {
106
- return __async(this, null, function* () {
107
- var _a;
108
- isUpdate.value = data.isUpdate;
109
- formRecord = __spreadValues({}, (_a = data.record) != null ? _a : {});
110
- formModal.openModal();
111
- yield nextTick();
112
- yield resetFields();
113
- setFieldsValue(formRecord);
114
- });
115
- }
116
- function onAdd() {
117
- openFormModal({ isUpdate: false });
118
- }
119
- function onEdit(record) {
120
- openFormModal({ isUpdate: true, record });
121
- }
122
- function onGenEnhanceSqlData() {
123
- genEnhanceSqlData(code.value, tableName.value);
124
- }
125
- function onBatchDelete() {
126
- return __async(this, null, function* () {
127
- doRequest(() => doEnhanceSqlBatchDelete(selectedRowKeys.value));
128
- });
129
- }
130
- function onSubmit() {
131
- return __async(this, null, function* () {
132
- try {
133
- formModalProps.confirmLoading = true;
134
- let values = yield validate();
135
- values = Object.assign({}, formRecord, values);
136
- yield saveEnhanceSql(code.value, values, isUpdate.value);
137
- reload();
138
- formModal.closeModal();
139
- } finally {
140
- formModalProps.confirmLoading = false;
141
- }
142
- });
143
- }
144
- function getTableAction(record) {
145
- return [
146
- {
147
- label: "\u7F16\u8F91",
148
- onClick: () => onEdit(record)
149
- }
150
- ];
151
- }
152
- function getDropDownAction(record) {
153
- return [
154
- {
155
- label: "\u5220\u9664",
156
- popConfirm: {
157
- title: "\u786E\u5B9A\u5220\u9664\u5417\uFF1F",
158
- placement: "left",
159
- confirm: () => doDeleteRecord(() => doEnhanceSqlBatchDelete([record.id]))
160
- }
161
- }
162
- ];
163
- }
164
- return {
165
- rowSelection,
166
- selectedRowKeys,
167
- aiTestMode,
168
- onCancel,
169
- onAdd,
170
- onGenEnhanceSqlData,
171
- onBatchDelete,
172
- getTableAction,
173
- getDropDownAction,
174
- formModalProps,
175
- registerModal,
176
- registerTable,
177
- registerForm
178
- };
179
- },
180
- computed: {
181
- tableScroll() {
182
- let height = window.innerHeight;
183
- return {
184
- y: height - 320
185
- };
186
- }
187
- }
188
- });
189
- const _hoisted_1 = {
190
- key: 0,
191
- style: { "float": "left" }
192
- };
193
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
194
- const _component_a_button = resolveComponent("a-button");
195
- const _component_a_icon = resolveComponent("a-icon");
196
- const _component_a_menu_item = resolveComponent("a-menu-item");
197
- const _component_a_menu = resolveComponent("a-menu");
198
- const _component_a_dropdown = resolveComponent("a-dropdown");
199
- const _component_TableAction = resolveComponent("TableAction");
200
- const _component_BasicTable = resolveComponent("BasicTable");
201
- const _component_BasicForm = resolveComponent("BasicForm");
202
- const _component_a_spin = resolveComponent("a-spin");
203
- const _component_BasicModal = resolveComponent("BasicModal");
204
- return openBlock(), createBlock(_component_BasicModal, {
205
- onRegister: _ctx.registerModal,
206
- title: "SQL\u589E\u5F3A",
207
- width: 1200,
208
- defaultFullscreen: "",
209
- onCancel: _ctx.onCancel
210
- }, {
211
- footer: withCtx(() => [
212
- createVNode(_component_a_button, { onClick: _ctx.onCancel }, {
213
- default: withCtx(() => [
214
- createTextVNode("\u5173\u95ED")
215
- ]),
216
- _: 1
217
- }, 8, ["onClick"]),
218
- _ctx.aiTestMode ? (openBlock(), createElementBlock("div", _hoisted_1, [
219
- createVNode(_component_a_button, { onClick: _ctx.onGenEnhanceSqlData }, {
220
- default: withCtx(() => [
221
- createTextVNode("\u751F\u6210\u6D4B\u8BD5\u6570\u636E")
222
- ]),
223
- _: 1
224
- }, 8, ["onClick"])
225
- ])) : createCommentVNode("", true)
226
- ]),
227
- default: withCtx(() => [
228
- createVNode(_component_BasicTable, {
229
- onRegister: _ctx.registerTable,
230
- rowSelection: _ctx.rowSelection
231
- }, {
232
- tableTitle: withCtx(() => [
233
- createVNode(_component_a_button, {
234
- onClick: _ctx.onAdd,
235
- type: "primary",
236
- preIcon: "ant-design:plus"
237
- }, {
238
- default: withCtx(() => [
239
- createTextVNode("\u65B0\u589E")
240
- ]),
241
- _: 1
242
- }, 8, ["onClick"]),
243
- _ctx.selectedRowKeys.length > 0 ? (openBlock(), createBlock(_component_a_dropdown, { key: 0 }, {
244
- overlay: withCtx(() => [
245
- createVNode(_component_a_menu, null, {
246
- default: withCtx(() => [
247
- createVNode(_component_a_menu_item, {
248
- key: "1",
249
- onClick: _ctx.onBatchDelete
250
- }, {
251
- default: withCtx(() => [
252
- createVNode(_component_a_icon, { type: "delete" }),
253
- createTextVNode(" \u5220\u9664 ")
254
- ]),
255
- _: 1
256
- }, 8, ["onClick"])
257
- ]),
258
- _: 1
259
- })
260
- ]),
261
- default: withCtx(() => [
262
- createVNode(_component_a_button, { style: { "margin-left": "8px" } }, {
263
- default: withCtx(() => [
264
- createTextVNode(" \u6279\u91CF\u64CD\u4F5C "),
265
- createVNode(_component_a_icon, { type: "down" })
266
- ]),
267
- _: 1
268
- })
269
- ]),
270
- _: 1
271
- })) : createCommentVNode("", true)
272
- ]),
273
- action: withCtx(({ record }) => [
274
- createVNode(_component_TableAction, {
275
- actions: _ctx.getTableAction(record),
276
- dropDownActions: _ctx.getDropDownAction(record)
277
- }, null, 8, ["actions", "dropDownActions"])
278
- ]),
279
- _: 1
280
- }, 8, ["onRegister", "rowSelection"]),
281
- createVNode(_component_BasicModal, normalizeProps(guardReactiveProps(_ctx.formModalProps)), {
282
- default: withCtx(() => [
283
- createVNode(_component_a_spin, {
284
- spinning: _ctx.formModalProps.confirmLoading
285
- }, {
286
- default: withCtx(() => [
287
- createVNode(_component_BasicForm, { onRegister: _ctx.registerForm }, null, 8, ["onRegister"])
288
- ]),
289
- _: 1
290
- }, 8, ["spinning"])
291
- ]),
292
- _: 1
293
- }, 16)
294
- ]),
295
- _: 1
296
- }, 8, ["onRegister", "onCancel"]);
297
- }
298
- var EnhanceSqlModal = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
299
- export { EnhanceSqlModal as default };