@jeecg/online 3.5.3-beta3 → 3.6.0-beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (163) hide show
  1. package/AuthButtonConfig-b6a674fa.mjs +125 -0
  2. package/AuthButtonTree-09e57bc4.mjs +156 -0
  3. package/AuthDataConfig-6e7e61ec.mjs +212 -0
  4. package/AuthDataTree-e83286c5.mjs +139 -0
  5. package/AuthFieldConfig-f1ec2708.mjs +139 -0
  6. package/AuthFieldTree-bb72e21f.mjs +232 -0
  7. package/AuthManagerDrawer-28a2d108.mjs +114 -0
  8. package/AuthSetterModal-2990d553.mjs +261 -0
  9. package/CgformCopyList-36a4cbf0.mjs +246 -0
  10. package/CgformModal-7399a5ac.mjs +611 -0
  11. package/CgreportModal-2eb9c9e1.mjs +13 -0
  12. package/CgreportModal.vue_vue_type_script_setup_true_lang-c2ceb064.mjs +566 -0
  13. package/CheckDictTable-3a8a54b3.mjs +211 -0
  14. package/CodeFileListModal-72f0d3bb.mjs +158 -0
  15. package/CodeFileViewModal-9eb88c47.mjs +244 -0
  16. package/CodeGeneratorModal-a89958f5.mjs +233 -0
  17. package/CustomButtonList-c44aec5a.mjs +363 -0
  18. package/DBAttributeTable-7d285e8d.mjs +473 -0
  19. package/DbToOnlineModal-d23cbeb1.mjs +160 -0
  20. package/DetailForm-2901d215.mjs +461 -0
  21. package/EnhanceJavaModal-153899a9.mjs +264 -0
  22. package/EnhanceJsHistory-7f5db3b1.mjs +184 -0
  23. package/EnhanceJsModal-c2fb75b8.mjs +311 -0
  24. package/EnhanceSqlModal-965e9b0a.mjs +268 -0
  25. package/ExtendConfigModal-8f08466f.mjs +111 -0
  26. package/FieldExtendJsonModal-adfcf5a7.mjs +219 -0
  27. package/FileSelectModal-432d4521.mjs +103 -0
  28. package/ForeignKeyTable-faab7ccf.mjs +69 -0
  29. package/IndexTable-0a2d3718.mjs +89 -0
  30. package/JModalTip-e1938b49.mjs +46 -0
  31. package/JOnlineSearchSelect-7e908492.mjs +95 -0
  32. package/LeftDepart-54f245b3.mjs +82 -0
  33. package/LeftRole-c138f892.mjs +86 -0
  34. package/LeftUser-9c812f8a.mjs +105 -0
  35. package/LinkTableConfigModal-c2c5c7e6.mjs +230 -0
  36. package/LinkTableFieldConfigModal-a3553b1f.mjs +176 -0
  37. package/LinkTableListPiece-7f793b08.mjs +34 -0
  38. package/ModalFormDemo-65685b0e.mjs +78 -0
  39. package/OnlCgformErpList-52c87ed3.mjs +449 -0
  40. package/OnlCgformErpSubTable-6e7fb17b.mjs +398 -0
  41. package/OnlCgformInnerSubTable-f0727b8f.mjs +248 -0
  42. package/OnlCgformInnerTableList-9f89c173.mjs +430 -0
  43. package/OnlCgformTabList-15516315.mjs +390 -0
  44. package/OnlineAutoList-63a0224f.mjs +474 -0
  45. package/OnlineAutoModal-ffe19c3f.mjs +206 -0
  46. package/OnlineAutoTreeList-317c7105.mjs +495 -0
  47. package/OnlineCustomModal-3939ce78.mjs +227 -0
  48. package/OnlineDetailModal-bfb1375f.mjs +177 -0
  49. package/OnlineForm-069f6092.mjs +749 -0
  50. package/OnlineFormDetail-ad5735fb.mjs +296 -0
  51. package/OnlineQueryForm-0771c80f.mjs +385 -0
  52. package/OnlineSearchFormItem-0db5834f.mjs +348 -0
  53. package/OnlineSelectCascade-a05c30f4.mjs +159 -0
  54. package/OnlineSubFormDetail-583d01eb.mjs +142 -0
  55. package/OnlineTabAutoModal-747e071d.mjs +253 -0
  56. package/OnlineTabDetailModal-887f0174.mjs +222 -0
  57. package/OnlineTabForm-b1dcd4b4.mjs +765 -0
  58. package/OnlineTabFormDetail-8e494a96.mjs +323 -0
  59. package/PageAttributeTable-5966b201.mjs +404 -0
  60. package/ProcessOnlineForm-4382bea7.mjs +177 -0
  61. package/QueryTable-6e8053ad.mjs +115 -0
  62. package/README.md +2 -1
  63. package/SuperQuery-78db6998.mjs +841 -0
  64. package/SuperQueryValComponent-471110b5.mjs +8 -0
  65. package/SuperQueryValComponent.vue_vue_type_script_lang-e3ad7ee8.mjs +101 -0
  66. package/auth.api-d3a6c4b3.mjs +39 -0
  67. package/auth.data-8be5c9e3.mjs +141 -0
  68. package/{cgform.data.js → cgform.data-cbdd88c3.mjs} +93 -62
  69. package/constant-754f1a9d.mjs +9 -0
  70. package/enhance.api-138e6826.mjs +104 -0
  71. package/enhance.data-efc7e155.mjs +175 -0
  72. package/index-0a93652b.mjs +237 -0
  73. package/index-7e9a23f2.mjs +1494 -0
  74. package/index-b70302f2.mjs +56 -0
  75. package/main.index.js +7 -1
  76. package/package.json +1 -1
  77. package/style.css +1 -1
  78. package/useCgformList-0c603af1.mjs +424 -0
  79. package/useCustomHook-acb00837.mjs +53 -0
  80. package/useExtendComponent-aa1cdfc8.mjs +3917 -0
  81. package/useListButton-0f18bf6a.mjs +671 -0
  82. package/useOnlinePopEvent-687070b7.mjs +19 -0
  83. package/useOnlineTest-e4bd8be3.mjs +42 -0
  84. package/useSchemas-43429d80.mjs +685 -0
  85. package/useTableSync-774c3774.mjs +87 -0
  86. package/AuthButtonConfig.js +0 -147
  87. package/AuthButtonTree.js +0 -183
  88. package/AuthDataConfig.js +0 -246
  89. package/AuthDataTree.js +0 -160
  90. package/AuthFieldConfig.js +0 -170
  91. package/AuthFieldTree.js +0 -281
  92. package/AuthManagerDrawer.js +0 -125
  93. package/AuthSetterModal.js +0 -316
  94. package/CgformCopyList.js +0 -266
  95. package/CgformModal.js +0 -780
  96. package/CgreportModal.js +0 -667
  97. package/CheckDictTable.js +0 -242
  98. package/CodeFileListModal.js +0 -175
  99. package/CodeFileViewModal.js +0 -325
  100. package/CodeGeneratorModal.js +0 -297
  101. package/CustomButtonList.js +0 -410
  102. package/DBAttributeTable.js +0 -526
  103. package/DbToOnlineModal.js +0 -192
  104. package/DetailForm.js +0 -608
  105. package/EnhanceJavaModal.js +0 -298
  106. package/EnhanceJsHistory.js +0 -229
  107. package/EnhanceJsModal.js +0 -293
  108. package/EnhanceSqlModal.js +0 -299
  109. package/ExtendConfigModal.js +0 -151
  110. package/FieldExtendJsonModal.js +0 -283
  111. package/FileSelectModal.js +0 -102
  112. package/ForeignKeyTable.js +0 -79
  113. package/IndexTable.js +0 -97
  114. package/JModalTip.js +0 -54
  115. package/JOnlineSearchSelect.js +0 -115
  116. package/LICENSE +0 -9
  117. package/LeftDepart.js +0 -96
  118. package/LeftRole.js +0 -98
  119. package/LeftUser.js +0 -117
  120. package/LinkTableConfigModal.js +0 -289
  121. package/LinkTableFieldConfigModal.js +0 -218
  122. package/LinkTableListPiece.js +0 -36
  123. package/ModalFormDemo.js +0 -85
  124. package/OnlineAutoList.js +0 -523
  125. package/OnlineAutoModal.js +0 -226
  126. package/OnlineAutoTreeList.js +0 -552
  127. package/OnlineCustomModal.js +0 -286
  128. package/OnlineDetailModal.js +0 -190
  129. package/OnlineForm.js +0 -1016
  130. package/OnlineFormDetail.js +0 -347
  131. package/OnlineQueryForm.js +0 -484
  132. package/OnlineSearchFormItem.js +0 -436
  133. package/OnlineSelectCascade.js +0 -228
  134. package/OnlineSubFormDetail.js +0 -166
  135. package/PageAttributeTable.js +0 -486
  136. package/ProcessOnlineForm.js +0 -208
  137. package/QueryTable.js +0 -129
  138. package/SuperQuery.js +0 -1020
  139. package/SuperQueryValComponent.js +0 -8
  140. package/SuperQueryValComponent.vue_vue_type_script_lang.js +0 -168
  141. package/_arrayPush.js +0 -278
  142. package/_baseClone.js +0 -471
  143. package/_baseSlice.js +0 -18
  144. package/_commonjsHelpers.js +0 -5
  145. package/_flatRest.js +0 -174
  146. package/auth.api.js +0 -43
  147. package/auth.data.js +0 -142
  148. package/clipboard.js +0 -565
  149. package/enhance.api.js +0 -129
  150. package/enhance.data.js +0 -196
  151. package/index.js +0 -87
  152. package/index2.js +0 -340
  153. package/index3.js +0 -264
  154. package/isArray.js +0 -47
  155. package/omit.js +0 -60
  156. package/pick.js +0 -68
  157. package/toString.js +0 -31
  158. package/useCgformList.js +0 -470
  159. package/useExtendComponent.js +0 -5205
  160. package/useListButton.js +0 -923
  161. package/useOnlineTest.js +0 -44
  162. package/useSchemas.js +0 -653
  163. package/useTableSync.js +0 -117
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 };