@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/useListButton.js DELETED
@@ -1,923 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
- var __spreadValues = (a, b) => {
9
- for (var prop in b || (b = {}))
10
- if (__hasOwnProp.call(b, prop))
11
- __defNormalProp(a, prop, b[prop]);
12
- if (__getOwnPropSymbols)
13
- for (var prop of __getOwnPropSymbols(b)) {
14
- if (__propIsEnum.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- }
17
- return a;
18
- };
19
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- var __async = (__this, __arguments, generator) => {
21
- return new Promise((resolve, reject) => {
22
- var fulfilled = (value) => {
23
- try {
24
- step(generator.next(value));
25
- } catch (e) {
26
- reject(e);
27
- }
28
- };
29
- var rejected = (value) => {
30
- try {
31
- step(generator.throw(value));
32
- } catch (e) {
33
- reject(e);
34
- }
35
- };
36
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
37
- step((generator = generator.apply(__this, __arguments)).next());
38
- });
39
- };
40
- import { E as ENHANCEJS, q as SETUP } from "./useExtendComponent.js";
41
- import { useRoute } from "vue-router";
42
- import { router } from "/@/router";
43
- import { ref, onBeforeUnmount, toRaw, nextTick, reactive } from "vue";
44
- import { defHttp } from "/@/utils/http/axios";
45
- import { useMessage } from "/@/hooks/web/useMessage";
46
- import { filterObj } from "/@/utils/common/compUtils";
47
- import { u as useCustomHook, G as GET_FUN_BODY_REG } from "./OnlineForm.js";
48
- import { onMountedOrActivated } from "/@/hooks/core/onMountedOrActivated";
49
- import { useModal } from "/@/components/Modal";
50
- import { Modal } from "ant-design-vue";
51
- import { useMethods } from "/@/hooks/system/useMethods";
52
- import { getToken } from "/@/utils/auth";
53
- import { goJmReportViewPage } from "/@/utils";
54
- import { p as pick } from "./pick.js";
55
- const CONTEXT_PROP_DESCRIPTION = {
56
- acceptHrefParams: "<p> \u8DF3\u8F6C\u65F6\u83B7\u53D6\u7684\u53C2\u6570\u4FE1\u606F",
57
- currentPage: "<p> \u5F53\u524D\u9875\u6570",
58
- currentTableName: "<p> \u5F53\u524D\u8868\u540D",
59
- description: "<p> \u5F53\u524D\u8868\u63CF\u8FF0",
60
- hasChildrenField: "<p> \u662F\u5426\u6709\u5B50\u8282\u70B9\u7684\u5B57\u6BB5\u540D\uFF0C\u4EC5\u6811\u5F62\u8868\u5355\u4E0B\u6709\u6548",
61
- isDesForm: "<p> xx",
62
- isTree: "<m> \u662F\u5426\u662F\u6811\u5F62\u8868\u5355 ",
63
- loadData: "<m> \u52A0\u8F7D\u5217\u8868\u6570\u636E",
64
- pageSize: "<p> \u6BCF\u4E00\u9875\u663E\u793A\u6761\u6570",
65
- queryParam: "<p> \u67E5\u8BE2\u6761\u4EF6\u5BF9\u8C61\uFF0C\u6BCF\u6B21\u70B9\u51FB\u67E5\u8BE2\u540E\u624D\u4F1A\u66F4\u65B0\u6B64\u6570\u636E",
66
- selectedRowKeys: "<p> \u9009\u4E2D\u7684\u884C\u7684id\u6570\u7EC4",
67
- sortField: "<p> \u6392\u5E8F\u5B57\u6BB5",
68
- sortType: "<p> \u6392\u5E8F\u89C4\u5219",
69
- total: "<p> \u603B\u9875\u6570"
70
- };
71
- const onlineUrl = {
72
- getColumns: "/online/cgform/api/getColumns/",
73
- getQueryInfo: "/online/cgform/api/getQueryInfo/",
74
- getData: "/online/cgform/api/getData/",
75
- getTreeData: "/online/cgform/api/getTreeData/",
76
- optPre: "/online/cgform/api/form/",
77
- buttonAction: "/online/cgform/api/doButton",
78
- exportXls: "/online/cgform/api/exportXlsOld/",
79
- importXls: "/online/cgform/api/importXls/",
80
- startProcess: "/act/process/extActProcess/startMutilProcess"
81
- };
82
- let config = {
83
- sortField: "id",
84
- sortType: "asc",
85
- currentPage: 1,
86
- pageSize: 10,
87
- total: 0,
88
- selectedRowKeys: [],
89
- queryParam: {},
90
- acceptHrefParams: {},
91
- description: "",
92
- currentTableName: "",
93
- isDesForm: false,
94
- desFormCode: "",
95
- cache: false,
96
- isTree: false,
97
- hasChildrenField: ""
98
- };
99
- const metaPagination = {
100
- current: 1,
101
- pageSize: 10,
102
- pageSizeOptions: ["10", "20", "30"],
103
- showTotal: (total, range) => {
104
- return range[0] + "-" + range[1] + " \u5171" + total + "\u6761";
105
- },
106
- showQuickJumper: true,
107
- showSizeChanger: true,
108
- total: 0
109
- };
110
- const { createMessage: $message, createErrorModal } = useMessage();
111
- function useOnlineTableContext() {
112
- console.log("-------------------------useOnlineTableContext----------------------->");
113
- const ID = ref("");
114
- const route = useRoute();
115
- const onlineQueryFormOuter = ref();
116
- const superQueryButtonRef = ref();
117
- const pagination = ref(false);
118
- const dataSource = ref([]);
119
- const tableReloading = ref(true);
120
- const onlineExtConfigJson = ref();
121
- let specialConfigMap = {};
122
- const methods = {
123
- execButtonEnhance: function(code, record) {
124
- if (onlineTableContext[ENHANCEJS][code]) {
125
- if (SETUP === code) {
126
- executeEnhanceJsHook(code);
127
- } else {
128
- let row = toRaw(record);
129
- return onlineTableContext[ENHANCEJS][code].call(onlineTableContext, onlineTableContext, row);
130
- }
131
- } else if (onlineTableContext[ENHANCEJS][code + "_hook"]) {
132
- if (record) {
133
- let row = toRaw(record);
134
- executeEnhanceJsHook(code + "_hook", row);
135
- } else {
136
- executeEnhanceJsHook(code + "_hook");
137
- }
138
- } else {
139
- console.log("\u589E\u5F3A\u6CA1\u627E\u5230!", code);
140
- }
141
- },
142
- isTree: function(status) {
143
- if (typeof status === "boolean") {
144
- onlineTableContext["isTreeTable"] = status;
145
- return status;
146
- } else {
147
- return onlineTableContext["isTreeTable"];
148
- }
149
- }
150
- };
151
- function executeEnhanceJsHook(code, row) {
152
- let str = onlineTableContext[ENHANCEJS][code].toLocaleString();
153
- let arr = str.match(GET_FUN_BODY_REG);
154
- if (arr.length > 1) {
155
- let temp = arr[1];
156
- executeJsEnhanced(temp, row);
157
- }
158
- }
159
- const onlineTableContext = new Proxy(CONTEXT_PROP_DESCRIPTION, {
160
- get(_target, prop) {
161
- if (typeof methods[prop] === "function") {
162
- return methods[prop];
163
- } else {
164
- let temp = specialConfigMap[ID.value];
165
- return Reflect.get(temp, prop);
166
- }
167
- },
168
- set(_target, prop, value) {
169
- let temp = getCurrentPageSpecialConfigMap();
170
- if (typeof value === "function") {
171
- return Reflect.set(methods, prop, value);
172
- } else {
173
- return Reflect.set(temp, prop, value);
174
- }
175
- },
176
- deleteProperty(_target, key) {
177
- if (key === ID.value) {
178
- delete specialConfigMap[key];
179
- return true;
180
- } else {
181
- return false;
182
- }
183
- }
184
- });
185
- const { executeJsEnhanced } = useCustomHook({}, onlineTableContext);
186
- function getTableId() {
187
- let idValue = route.params.id;
188
- if (!idValue) {
189
- idValue = "";
190
- }
191
- return idValue;
192
- }
193
- onMountedOrActivated(() => {
194
- console.log("-------------------onMountedOrActivated-------------------");
195
- handlePageChange();
196
- });
197
- onBeforeUnmount(() => {
198
- console.log("-------------------onBeforeUnmount-------------------");
199
- delete specialConfigMap[ID.value];
200
- });
201
- function getCurrentPageSpecialConfigMap() {
202
- let temp = specialConfigMap[ID.value];
203
- if (!temp) {
204
- let obj = Object.assign({}, config, { onlineUrl });
205
- temp = JSON.parse(JSON.stringify(obj));
206
- specialConfigMap[ID.value] = temp;
207
- }
208
- return temp;
209
- }
210
- function handleAcceptHrefParams() {
211
- let acceptHrefParams = {};
212
- let hrefParam = route.query;
213
- if (hrefParam) {
214
- Object.keys(hrefParam).map((key) => {
215
- acceptHrefParams[key] = hrefParam[key];
216
- });
217
- onlineTableContext["acceptHrefParams"] = acceptHrefParams;
218
- }
219
- }
220
- function getColumnList() {
221
- return new Promise((resolve, reject) => {
222
- defHttp.get(
223
- {
224
- url: `${onlineTableContext.onlineUrl.getColumns}${ID.value}`
225
- },
226
- { isTransformResponse: false }
227
- ).then((res) => {
228
- if (res.success) {
229
- resolve(res.result);
230
- } else {
231
- $message.warning(res.message);
232
- reject();
233
- }
234
- }).catch(() => {
235
- reject();
236
- });
237
- });
238
- }
239
- function loadData() {
240
- return new Promise((resolve, reject) => {
241
- let url = `${onlineTableContext.onlineUrl.getData}${ID.value}`;
242
- if (onlineTableContext.isTree() === true) {
243
- url = `${onlineTableContext.onlineUrl.getTreeData}${ID.value}`;
244
- }
245
- let params = getLoadDataParams();
246
- console.log("------\u67E5\u8BE2\u53C2\u6570-----", params);
247
- defHttp.get({ url, params }, { isTransformResponse: false }).then((res) => {
248
- console.log("--onlineList-\u67E5\u8BE2\u5217\u8868\u6570\u636E", res);
249
- if (res.success) {
250
- handleDataResult(res.result);
251
- resolve(true);
252
- } else {
253
- if (res.message === "NO_DB_SYNC") {
254
- createErrorModal({
255
- title: "\u6570\u636E\u5E93\u672A\u540C\u6B65",
256
- content: "\u8BF7\u5148\u540C\u6B65\u6570\u636E\u5E93\u518D\u67E5\u770B\u6B64\u9875\u9762\uFF01",
257
- onOk: () => router.back()
258
- });
259
- } else {
260
- $message.warning(res.message);
261
- }
262
- reject(false);
263
- }
264
- }).catch(() => {
265
- let error = "\u8BF7\u6C42\u5217\u8868\u6570\u636E\u5F02\u5E38!";
266
- $message.warning(error);
267
- reject(false);
268
- });
269
- });
270
- }
271
- function getLoadDataParams() {
272
- const { sortField, sortType, acceptHrefParams, queryParam } = onlineTableContext;
273
- let treeParam = {};
274
- if (onlineTableContext.isTree() === true) {
275
- treeParam["hasQuery"] = "false";
276
- } else {
277
- treeParam["hasQuery"] = "true";
278
- }
279
- let params = Object.assign({}, treeParam, acceptHrefParams, queryParam, { column: sortField, order: sortType });
280
- if (pagination.value) {
281
- params.pageNo = pagination.value.current;
282
- params.pageSize = pagination.value.pageSize;
283
- } else {
284
- params["pageSize"] = -521;
285
- }
286
- let superQueryData = getSuperQueryData();
287
- params.superQueryMatchType = superQueryData.matchType || "";
288
- params.superQueryParams = superQueryData.params || "";
289
- return filterObj(params);
290
- }
291
- function handleDataResult(result) {
292
- let total = 0;
293
- if (Number(result.total) > 0) {
294
- if (onlineTableContext.isTree() === true) {
295
- dataSource.value = getTreeDataByResult(result.records);
296
- nextTick(() => {
297
- loadDataByExpandedRows(dataSource.value);
298
- });
299
- } else {
300
- dataSource.value = result.records;
301
- }
302
- total = Number(result.total);
303
- } else {
304
- dataSource.value = [];
305
- }
306
- if (pagination.value) {
307
- pagination.value = __spreadProps(__spreadValues({}, pagination.value), { total });
308
- }
309
- }
310
- function handleChangeInTable($pagination, _filters, sorter) {
311
- if (sorter && sorter.order) {
312
- onlineTableContext["sortField"] = sorter.field;
313
- onlineTableContext["sortType"] = "ascend" == sorter.order ? "asc" : "desc";
314
- } else {
315
- onlineTableContext["sortField"] = "id";
316
- onlineTableContext["sortType"] = "asc";
317
- }
318
- if (pagination.value) {
319
- pagination.value = $pagination;
320
- }
321
- loadData();
322
- }
323
- function handleSpecialConfig(result) {
324
- onlineTableContext["description"] = result.description;
325
- onlineTableContext["currentTableName"] = result.currentTableName;
326
- onlineTableContext["isDesForm"] = result.isDesForm;
327
- onlineTableContext["desFormCode"] = result.desFormCode;
328
- onlineTableContext["ID"] = ID.value;
329
- let { acceptHrefParams, queryParam, superQuery, currentPage, pageSize } = onlineTableContext;
330
- handleAcceptHrefParams();
331
- if (!queryParam) {
332
- onlineTableContext["queryParam"] = {};
333
- } else {
334
- onlineQueryFormOuter.value.initDefaultValues(queryParam, acceptHrefParams);
335
- }
336
- if (!superQuery) {
337
- onlineTableContext["superQuery"] = { params: "", matchType: "" };
338
- } else {
339
- superQueryButtonRef.value.initDefaultValues(superQuery);
340
- }
341
- if (result.paginationFlag == "Y") {
342
- pagination.value = __spreadValues(__spreadValues({}, metaPagination), { current: currentPage, pageSize });
343
- } else {
344
- pagination.value = false;
345
- }
346
- }
347
- function reloadTable() {
348
- return __async(this, null, function* () {
349
- tableReloading.value = true;
350
- yield nextTick();
351
- tableReloading.value = false;
352
- });
353
- }
354
- const add2Context = {
355
- loadData,
356
- getLoadDataParams,
357
- reloadTable
358
- };
359
- Object.keys(add2Context).map((key) => {
360
- onlineTableContext[key] = add2Context[key];
361
- });
362
- let loading = ref(false);
363
- function reload() {
364
- return __async(this, null, function* () {
365
- if (pagination.value) {
366
- pagination.value = __spreadProps(__spreadValues({}, pagination.value), { current: 1 });
367
- }
368
- onlineTableContext.clearSelectedRow();
369
- yield loadData();
370
- });
371
- }
372
- function getTreeDataByResult(result) {
373
- if (result) {
374
- return result.map((item) => {
375
- let hasChildrenField = onlineTableContext["hasChildrenField"];
376
- if (item[hasChildrenField] == "1") {
377
- let loadChild = { id: item.id + "_loadChild", name: "loading...", isLoading: true };
378
- loadChild["jeecg_row_key"] = loadChild.id;
379
- item.children = [loadChild];
380
- }
381
- return item;
382
- });
383
- }
384
- }
385
- const expandedRowKeys = ref([]);
386
- function handleExpandedRowsChange(expandedRowKeysValue) {
387
- expandedRowKeys.value = expandedRowKeysValue;
388
- }
389
- function loadDataByExpandedRows(dataList) {
390
- let expandedRowKeysValue = expandedRowKeys.value;
391
- if (expandedRowKeysValue.length > 0) {
392
- const { sortField, sortType, pidField } = onlineTableContext;
393
- let params = Object.assign({}, { column: sortField, order: sortType });
394
- params["hasQuery"] = "in";
395
- let superParams = Object.assign({});
396
- superParams.rule = "in";
397
- superParams.type = "text";
398
- superParams.val = expandedRowKeysValue.join(",");
399
- superParams.field = pidField;
400
- superParams = [superParams];
401
- params["superQueryParams"] = encodeURI(JSON.stringify(superParams));
402
- params["superQueryMatchType"] = "and";
403
- params["batchFlag"] = "true";
404
- let url = `${onlineTableContext.onlineUrl.getTreeData}${ID.value}`;
405
- console.log("--onlineList-\u67E5\u8BE2\u5B50\u8282\u70B9\u53C2\u6570", superParams);
406
- defHttp.get({ url, params }, { isTransformResponse: false }).then((res) => {
407
- console.log("--onlineList-\u67E5\u8BE2\u5B50\u8282\u70B9\u5217\u8868\u6570\u636E", res);
408
- if (res.success && res.result.records && res.result.records.length > 0) {
409
- let records = res.result.records;
410
- const listMap = /* @__PURE__ */ new Map();
411
- for (let item of records) {
412
- let pid = item[pidField];
413
- if (expandedRowKeysValue.join(",").includes(pid)) {
414
- let mapList = listMap.get(pid);
415
- if (mapList == null) {
416
- mapList = [];
417
- }
418
- mapList.push(item);
419
- listMap.set(pid, mapList);
420
- }
421
- }
422
- let childrenMap = listMap;
423
- let fn = (list) => {
424
- if (list) {
425
- list.forEach((data) => {
426
- if (expandedRowKeysValue.includes(data.id)) {
427
- data.children = getTreeDataByResult(childrenMap.get(data.id));
428
- fn(data.children);
429
- }
430
- });
431
- }
432
- };
433
- fn(dataList);
434
- }
435
- }).catch(() => {
436
- let error = "loadDataByExpandedRows\u8BF7\u6C42\u5217\u8868\u6570\u636E\u5F02\u5E38!";
437
- $message.warning(error);
438
- });
439
- } else {
440
- return Promise.resolve();
441
- }
442
- }
443
- function getSuperQueryData() {
444
- if (!onlineTableContext.superQuery) {
445
- return {};
446
- }
447
- const {
448
- superQuery: { params, matchType },
449
- currentTableName
450
- } = onlineTableContext;
451
- let pre = currentTableName + "@";
452
- let arr = [];
453
- if (params.length > 0) {
454
- for (let data of params) {
455
- let item = __spreadValues({}, data);
456
- let field = item.field;
457
- if (field.startsWith(pre)) {
458
- item.field = field.replace(pre, "");
459
- }
460
- arr.push(item);
461
- }
462
- }
463
- let str = arr.length > 0 ? JSON.stringify(arr) : "";
464
- console.log("\u9AD8\u7EA7\u67E5\u8BE2\u6761\u4EF6", arr, matchType);
465
- return {
466
- params: encodeURIComponent(str),
467
- matchType
468
- };
469
- }
470
- const superQueryStatus = ref(false);
471
- function handleSuperQuery(params, matchType) {
472
- onlineTableContext["superQuery"] = {
473
- params,
474
- matchType
475
- };
476
- if (params.length == 0) {
477
- superQueryStatus.value = false;
478
- } else {
479
- superQueryStatus.value = true;
480
- }
481
- loadData();
482
- }
483
- const [registerCustomModal, { openModal: doOpenCustomModal }] = useModal();
484
- function openCustomModal(param) {
485
- if (!param) {
486
- param = {};
487
- }
488
- if (!param.row) {
489
- let rows = onlineTableContext["selectedRows"];
490
- if (!rows || rows.length == 0 || rows.length > 1) {
491
- $message.warning("\u8BF7\u9009\u62E9\u4E00\u6761\u6570\u636E");
492
- return;
493
- }
494
- param.row = rows[0];
495
- }
496
- param["code"] = ID.value;
497
- doOpenCustomModal(true, param);
498
- }
499
- onlineTableContext["openCustomModal"] = openCustomModal;
500
- function handlePageChange() {
501
- let idValue = getTableId();
502
- ID.value = idValue;
503
- }
504
- handlePageChange();
505
- function handleFormConfig(formConfig) {
506
- let extConfigJson = formConfig.head.extConfigJson;
507
- if (extConfigJson) {
508
- onlineExtConfigJson.value = JSON.parse(extConfigJson);
509
- }
510
- }
511
- return __spreadValues({
512
- ID,
513
- onlineQueryFormOuter,
514
- superQueryButtonRef,
515
- loading,
516
- reload,
517
- dataSource,
518
- pagination,
519
- tableReloading,
520
- handleSpecialConfig,
521
- onlineTableContext,
522
- handleChangeInTable,
523
- getColumnList,
524
- getTreeDataByResult,
525
- expandedRowKeys,
526
- handleExpandedRowsChange,
527
- onlineExtConfigJson,
528
- handleFormConfig,
529
- superQueryStatus,
530
- handleSuperQuery,
531
- registerCustomModal
532
- }, add2Context);
533
- }
534
- const FLOW_CODE_PRE = "onl_";
535
- function useListButton(onlineTableContext, extConfigJson) {
536
- const buttonStatus = {
537
- add: true,
538
- addSub: true,
539
- update: true,
540
- delete: true,
541
- batch_delete: true,
542
- import: true,
543
- export: true,
544
- detail: true,
545
- super_query: true,
546
- bpm: true
547
- };
548
- const [registerModal, { openModal }] = useModal();
549
- const [registerImportModal, { openModal: openImportModal }] = useModal();
550
- const [registerDetailModal, { openModal: openDetailModal }] = useModal();
551
- const [registerBpmModal, { openModal: openBpmModal }] = useModal();
552
- const { createMessage: $message2 } = useMessage();
553
- const buttonSwitch = reactive(buttonStatus);
554
- const cgLinkButtonList = reactive([]);
555
- const cgTopButtonList = reactive([]);
556
- function initButtonList(btnList) {
557
- cgLinkButtonList.length = 0;
558
- cgTopButtonList.length = 0;
559
- if (btnList && btnList.length > 0) {
560
- for (let i = 0; i < btnList.length; i++) {
561
- let temp = pick(btnList[i], "buttonCode", "buttonName", "buttonStyle", "optType", "exp", "buttonIcon");
562
- if (temp.buttonStyle == "button") {
563
- cgTopButtonList.push(temp);
564
- } else if (temp.buttonStyle == "link") {
565
- cgLinkButtonList.push(temp);
566
- }
567
- }
568
- }
569
- }
570
- function initButtonSwitch(hideColumns) {
571
- Object.keys(buttonSwitch).forEach((key) => {
572
- buttonSwitch[key] = true;
573
- });
574
- if (hideColumns && hideColumns.length > 0) {
575
- Object.keys(buttonSwitch).forEach((key) => {
576
- if (hideColumns.indexOf(key) >= 0) {
577
- buttonSwitch[key] = false;
578
- }
579
- });
580
- }
581
- }
582
- function handleAdd(param) {
583
- let data = { isUpdate: false };
584
- if (param) {
585
- data["param"] = param;
586
- }
587
- openModal(true, data);
588
- }
589
- function handleEdit(record) {
590
- onlineTableContext.beforeEdit(record).then(() => {
591
- openModal(true, {
592
- isUpdate: true,
593
- record
594
- });
595
- }).catch((msg) => {
596
- $message2.warning(msg);
597
- });
598
- }
599
- const getDeleteButton = (record) => {
600
- return {
601
- label: "\u5220\u9664",
602
- popConfirm: {
603
- title: "\u662F\u5426\u5220\u9664\uFF1F",
604
- confirm: handleDeleteOne.bind(null, record)
605
- }
606
- };
607
- };
608
- function handleDeleteOne(record) {
609
- onlineTableContext.beforeDelete(record).then(() => {
610
- handleDelete(record.id);
611
- }).catch((msg) => {
612
- $message2.warning(msg);
613
- });
614
- }
615
- function getActions(record) {
616
- let bpmStatusValue = getBpmStatusValue(record);
617
- let canEdit = bpmStatusValue && (bpmStatusValue == "1" || bpmStatusValue == "3" || bpmStatusValue == "4") || !bpmStatusValue;
618
- if (toRaw(buttonSwitch.update) === true && canEdit) {
619
- return [
620
- {
621
- label: "\u7F16\u8F91",
622
- onClick: handleEdit.bind(null, record)
623
- }
624
- ];
625
- }
626
- return [];
627
- }
628
- function getSubmitFlowButton(record) {
629
- return {
630
- label: "\u63D0\u4EA4\u6D41\u7A0B",
631
- popConfirm: {
632
- title: "\u786E\u8BA4\u63D0\u4EA4\u6D41\u7A0B\u5417\uFF1F",
633
- confirm: handleSubmitFlow.bind(null, record)
634
- }
635
- };
636
- }
637
- function getViewBpmGraphicButton(record) {
638
- return {
639
- label: "\u5BA1\u6279\u8FDB\u5EA6",
640
- onClick: handleViewGraphic.bind(null, record)
641
- };
642
- }
643
- function handleViewGraphic(record) {
644
- const { currentTableName } = onlineTableContext;
645
- let flowCode = FLOW_CODE_PRE + currentTableName;
646
- let dataId = record.id;
647
- openBpmModal(true, {
648
- flowCode,
649
- dataId
650
- });
651
- }
652
- function getDropDownActions(record) {
653
- let arr = [];
654
- if (toRaw(buttonSwitch.detail) === true) {
655
- arr.push({
656
- label: "\u8BE6\u60C5",
657
- onClick: handleDetail.bind(null, record)
658
- });
659
- }
660
- if (onlineTableContext["hasBpmStatus"] === true && toRaw(buttonSwitch.bpm) === true) {
661
- let bpmStatusValue2 = getBpmStatusValue(record);
662
- if (!bpmStatusValue2 || bpmStatusValue2 == "1") {
663
- arr.push(getSubmitFlowButton(record));
664
- } else {
665
- arr.push(getViewBpmGraphicButton(record));
666
- }
667
- }
668
- if (extConfigJson.value) {
669
- let { reportPrintShow, reportPrintUrl } = extConfigJson.value;
670
- if (reportPrintShow && reportPrintUrl) {
671
- arr.push({
672
- label: "\u6253\u5370",
673
- onClick() {
674
- let url = reportPrintUrl;
675
- let id = record.id;
676
- let token = getToken();
677
- goJmReportViewPage(url, id, token);
678
- }
679
- });
680
- }
681
- }
682
- let bpmStatusValue = getBpmStatusValue(record);
683
- let canDelete = bpmStatusValue && bpmStatusValue == "1" || !bpmStatusValue;
684
- if (toRaw(buttonSwitch.delete) === true && canDelete) {
685
- arr.push(getDeleteButton(record));
686
- }
687
- let buttonList = cgLinkButtonList;
688
- if (buttonList && buttonList.length > 0) {
689
- for (let item of buttonList) {
690
- if (showLinkButtonOfExpression(item.exp || "", record) === true) {
691
- arr.push({
692
- label: item.buttonName,
693
- onClick: cgButtonLinkHandler.bind(null, record, item.buttonCode, item.optType)
694
- });
695
- }
696
- }
697
- }
698
- return arr;
699
- }
700
- function getBpmStatusValue(record) {
701
- const key = "bpm_status";
702
- let value = record[key];
703
- if (!value) {
704
- value = record[key.toUpperCase()];
705
- }
706
- return value;
707
- }
708
- function handleDetail(record) {
709
- openDetailModal(true, {
710
- isUpdate: true,
711
- disableSubmit: true,
712
- record
713
- });
714
- }
715
- function startProcess(record) {
716
- const {
717
- currentTableName,
718
- onlineUrl: { startProcess: startProcess2 }
719
- } = onlineTableContext;
720
- let postConfig = {
721
- url: startProcess2,
722
- params: {
723
- flowCode: FLOW_CODE_PRE + currentTableName,
724
- id: record.id,
725
- formUrl: "modules/bpm/task/form/OnlineFormDetail",
726
- formUrlMobile: "check/onlineForm/detail"
727
- }
728
- };
729
- let postOption = { isTransformResponse: false };
730
- return new Promise((resolve, reject) => {
731
- defHttp.post(postConfig, postOption).then((res) => {
732
- if (res.success) {
733
- resolve(res);
734
- $message2.success(res.message);
735
- } else {
736
- reject();
737
- $message2.warning(res.message);
738
- }
739
- });
740
- });
741
- }
742
- function handleSubmitFlow(record) {
743
- return __async(this, null, function* () {
744
- yield startProcess(record);
745
- onlineTableContext.loadData();
746
- });
747
- }
748
- function handleDelete(dataId) {
749
- console.log("\u5220\u9664\u6570\u636Eid\u503C", dataId);
750
- let url = `${onlineTableContext.onlineUrl.optPre}${onlineTableContext.ID}/${dataId}`;
751
- return new Promise((resolve, reject) => {
752
- defHttp.delete(
753
- {
754
- url
755
- },
756
- { isTransformResponse: false }
757
- ).then((res) => {
758
- if (res.success) {
759
- $message2.success(res.message);
760
- onlineTableContext.loadData();
761
- resolve(true);
762
- } else {
763
- $message2.warning(res.message);
764
- reject();
765
- }
766
- });
767
- });
768
- }
769
- function handleBatchDelete() {
770
- let arr = onlineTableContext["selectedRowKeys"];
771
- if (arr.length <= 0) {
772
- $message2.warning("\u8BF7\u9009\u62E9\u4E00\u6761\u8BB0\u5F55\uFF01");
773
- return false;
774
- } else {
775
- let idSet = [];
776
- arr.forEach(function(val) {
777
- let temp = val;
778
- if (temp && temp.endsWith("_loadChild")) {
779
- temp = temp.replace("_loadChild", "");
780
- }
781
- if (idSet.indexOf(temp) < 0) {
782
- idSet.push(temp);
783
- }
784
- });
785
- let ids = idSet.join(",");
786
- Modal.confirm({
787
- title: "\u786E\u8BA4\u5220\u9664",
788
- content: "\u662F\u5426\u5220\u9664\u9009\u4E2D\u6570\u636E",
789
- okText: "\u786E\u8BA4",
790
- cancelText: "\u53D6\u6D88",
791
- onOk: () => __async(this, null, function* () {
792
- yield handleDelete(ids);
793
- onlineTableContext.clearSelectedRow();
794
- })
795
- });
796
- }
797
- }
798
- function cgButtonLinkHandler(record, buttonCode, optType) {
799
- if (optType == "js") {
800
- onlineTableContext["execButtonEnhance"](buttonCode, record);
801
- } else if (optType == "action") {
802
- let params = {
803
- formId: onlineTableContext["ID"],
804
- buttonCode,
805
- dataId: record.id
806
- };
807
- let url = `${onlineTableContext.onlineUrl.buttonAction}`;
808
- defHttp.post(
809
- {
810
- url,
811
- params
812
- },
813
- { isTransformResponse: false }
814
- ).then((res) => {
815
- if (res.success) {
816
- onlineTableContext.loadData();
817
- $message2.success("\u5904\u7406\u5B8C\u6210!");
818
- } else {
819
- $message2.warning(res.message);
820
- }
821
- });
822
- }
823
- }
824
- function cgButtonJsHandler(buttonCode) {
825
- onlineTableContext["execButtonEnhance"](buttonCode);
826
- }
827
- function cgButtonActionHandler(buttonCode) {
828
- let arr = onlineTableContext["selectedRowKeys"];
829
- if (!arr || arr.length == 0) {
830
- $message2.warning("\u8BF7\u5148\u9009\u4E2D\u4E00\u6761\u8BB0\u5F55");
831
- return false;
832
- }
833
- let dataId = arr.join(",");
834
- let params = {
835
- formId: onlineTableContext["ID"],
836
- buttonCode,
837
- dataId
838
- };
839
- let url = `${onlineTableContext.onlineUrl.buttonAction}`;
840
- defHttp.post(
841
- {
842
- url,
843
- params
844
- },
845
- { isTransformResponse: false }
846
- ).then((res) => {
847
- if (res.success) {
848
- onlineTableContext.loadData();
849
- onlineTableContext.clearSelectedRow();
850
- $message2.success("\u5904\u7406\u5B8C\u6210!");
851
- } else {
852
- $message2.warning(res.message);
853
- }
854
- });
855
- }
856
- function onImportExcel() {
857
- openImportModal(true);
858
- }
859
- const importUrl = () => {
860
- return `${onlineTableContext.onlineUrl.importXls}${onlineTableContext.ID}`;
861
- };
862
- const { handleExportXlsx } = useMethods();
863
- function onExportExcel() {
864
- let params = onlineTableContext.getLoadDataParams();
865
- let selections = onlineTableContext["selectedRowKeys"];
866
- if (selections && selections.length > 0) {
867
- params["selections"] = selections.join(",");
868
- }
869
- let paramsStr = JSON.stringify(filterObj(params));
870
- let url = `${onlineTableContext.onlineUrl.exportXls}${onlineTableContext.ID}`;
871
- const description = onlineTableContext.description;
872
- return handleExportXlsx(description, url, { paramsStr });
873
- }
874
- function showLinkButtonOfExpression(expression, row) {
875
- if (!expression || expression == "") {
876
- return true;
877
- }
878
- let arr = expression.split("#");
879
- let fieldValue = row[arr[0]];
880
- let exp = arr[1].toLowerCase();
881
- if (exp === "eq") {
882
- return fieldValue == arr[2];
883
- } else if (exp === "ne") {
884
- return !(fieldValue == arr[2]);
885
- } else if (exp === "empty") {
886
- if (arr[2] === "true") {
887
- return !fieldValue || fieldValue == "";
888
- } else {
889
- return fieldValue && fieldValue.length > 0;
890
- }
891
- } else if (exp === "in") {
892
- let arr2 = arr[2].split(",");
893
- return arr2.indexOf(String(fieldValue)) >= 0;
894
- }
895
- return false;
896
- }
897
- return {
898
- buttonSwitch,
899
- cgLinkButtonList,
900
- cgTopButtonList,
901
- importUrl,
902
- registerModal,
903
- handleAdd,
904
- handleEdit,
905
- handleBatchDelete,
906
- registerImportModal,
907
- onImportExcel,
908
- onExportExcel,
909
- getDropDownActions,
910
- getActions,
911
- cgButtonJsHandler,
912
- cgButtonActionHandler,
913
- cgButtonLinkHandler,
914
- initButtonList,
915
- initButtonSwitch,
916
- getDeleteButton,
917
- handleSubmitFlow,
918
- getSubmitFlowButton,
919
- registerDetailModal,
920
- registerBpmModal
921
- };
922
- }
923
- export { useListButton as a, useOnlineTableContext as u };