olp-table 5.3.7 → 5.5.1

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 (171) hide show
  1. package/{olp-table/olp-table.common.js → olp-table.common.js} +67 -67
  2. package/{olp-table/olp-table.umd.js → olp-table.umd.js} +67 -67
  3. package/{olp-table/olp-table.umd.min.js → olp-table.umd.min.js} +67 -67
  4. package/package.json +7 -87
  5. package/.env.build +0 -1
  6. package/.env.prod +0 -1
  7. package/README.md +0 -26
  8. package/babel.config.js +0 -5
  9. package/jsconfig.json +0 -22
  10. package/public/favicon.ico +0 -0
  11. package/public/index.html +0 -17
  12. package/rmMode.bat +0 -1
  13. package/src/App.vue +0 -199
  14. package/src/api/crud.js +0 -22
  15. package/src/api/dist.js +0 -6
  16. package/src/assets/iconfont/iconfont.css +0 -20
  17. package/src/assets/iconfont/iconfont.json +0 -16
  18. package/src/assets/iconfont/iconfont.ttf +0 -0
  19. package/src/assets/iconfont/iconfont.woff +0 -0
  20. package/src/assets/iconfont/iconfont.woff2 +0 -0
  21. package/src/assets/logo.png +0 -0
  22. package/src/components/auto-height/index.vue +0 -75
  23. package/src/components/codemirror-tag.vue +0 -100
  24. package/src/components/lazy-load-select.vue +0 -107
  25. package/src/components/ol-dialog-excel.vue +0 -112
  26. package/src/components/ol-dialog-import.vue +0 -304
  27. package/src/components/ol-dialog-json.vue +0 -83
  28. package/src/components/ol-dialog-table.vue +0 -81
  29. package/src/components/ol-dialog-upload-file.vue +0 -208
  30. package/src/components/ol-dict-tag.vue +0 -271
  31. package/src/components/ol-select-dom.vue +0 -71
  32. package/src/components/ol-table-filter.vue +0 -28
  33. package/src/components/ol-table-render.vue +0 -44
  34. package/src/components/ol-table-select.vue +0 -154
  35. package/src/components/pinia-init.vue +0 -18
  36. package/src/components/table/model/ModelMixins.js +0 -43
  37. package/src/components/table/model/model-index.vue +0 -124
  38. package/src/components/table/model/ot-left-right.vue +0 -18
  39. package/src/components/table/model/ot-left-tree-right-table.scss +0 -14
  40. package/src/components/table/model/ot-left-tree-right-table.vue +0 -41
  41. package/src/components/table/model/ot-top-1-bottom-2.vue +0 -39
  42. package/src/components/table/model/ot-top-2-bottom-1.vue +0 -38
  43. package/src/components/table/model/ot-top-2-bottom-2.vue +0 -38
  44. package/src/components/table/model/ot-top-bottom.vue +0 -18
  45. package/src/components/table/model/splitpanesModel.css +0 -22
  46. package/src/components/table/model/splitpanesModel.vue +0 -54
  47. package/src/components/table/ol-form/index.vue +0 -544
  48. package/src/components/table/ol-form-v3/index.vue +0 -455
  49. package/src/components/table/ol-main-form-sub-table/index.vue +0 -611
  50. package/src/components/table/ol-pager/index.vue +0 -46
  51. package/src/components/table/ol-table/components/ol-table-column-config/columnIndex.vue +0 -233
  52. package/src/components/table/ol-table/components/ol-table-column-config/index.vue +0 -145
  53. package/src/components/table/ol-table/components/ol-table-column-dict-color/index.vue +0 -88
  54. package/src/components/table/ol-table/index.vue +0 -232
  55. package/src/components/table/ol-table-operate/index.vue +0 -61
  56. package/src/components/table/ol-table-search/index.vue +0 -17
  57. package/src/components/table/ol-table-tool-btn/index.vue +0 -60
  58. package/src/components/tree/components/o-tree.vue +0 -289
  59. package/src/components/tree/index.vue +0 -46
  60. package/src/components/v-component/index.vue +0 -43
  61. package/src/config/dev-config.js +0 -5
  62. package/src/config/prod-config.js +0 -5
  63. package/src/config/shared-config.js +0 -20
  64. package/src/data.js +0 -9378
  65. package/src/directives/permission/hasPermi.js +0 -63
  66. package/src/directives/permission/hasRole.js +0 -30
  67. package/src/main.js +0 -55
  68. package/src/mixins/VTMixin/DefaultMethods.js +0 -821
  69. package/src/mixins/VTMixin/OTMixinBody.js +0 -105
  70. package/src/mixins/VTMixin/OTMixinBodyFooter.js +0 -93
  71. package/src/mixins/VTMixin/OTMixinBodyMethods.js +0 -421
  72. package/src/mixins/VTMixin/OTMixinColumnMethod.js +0 -454
  73. package/src/mixins/VTMixin/OTMixinInitMethod.js +0 -130
  74. package/src/mixins/VTMixin/OTMixinPager.js +0 -38
  75. package/src/mixins/VTMixin/OTMixinSortable.js +0 -43
  76. package/src/mixins/VTMixin/index.js +0 -18
  77. package/src/package/index.js +0 -20
  78. package/src/plugins/axios.js +0 -61
  79. package/src/store/dict.js +0 -76
  80. package/src/store/dictType.js +0 -52
  81. package/src/store/permi.js +0 -45
  82. package/src/styles/common.scss +0 -37
  83. package/src/styles/index.scss +0 -48
  84. package/src/styles/theme.scss +0 -32
  85. package/src/utils/AESCRUDUtils.js +0 -87
  86. package/src/utils/DateUtils.js +0 -35
  87. package/src/utils/ExcelUtil.js +0 -159
  88. package/src/utils/TableSortUtil.js +0 -91
  89. package/src/utils/columnProp.js +0 -3
  90. package/src/utils/groupCompute.js +0 -68
  91. package/src/utils/http/httpFactory.js +0 -92
  92. package/src/utils/http/httpFactory2.js +0 -79
  93. package/src/utils/http/httpUtil.js +0 -123
  94. package/src/utils/http/httpUtils.js +0 -38
  95. package/src/utils/loadStyle.js +0 -14
  96. package/src/utils/message.js +0 -56
  97. package/src/utils/object.js +0 -80
  98. package/src/utils/security/TokenUtil.js +0 -19
  99. package/src/utils/tree.js +0 -54
  100. package/src/utils/util.js +0 -127
  101. package/src/views/Test/index.vue +0 -77
  102. package/src/views/Test/index2.vue +0 -33
  103. package/src/views/components/btn-config/index.vue +0 -202
  104. package/src/views/components/option-config/index.vue +0 -192
  105. package/src/views/db/chineseToEnglish.vue +0 -127
  106. package/src/views/db/filed.vue +0 -395
  107. package/src/views/db/index.vue +0 -192
  108. package/src/views/db/preview/index.vue +0 -139
  109. package/src/views/db/preview/left.vue +0 -204
  110. package/src/views/db/preview/right.vue +0 -466
  111. package/src/views/groupTable/index.vue +0 -137
  112. package/src/views/groupTable/ol-table-column-config/columnIndex.vue +0 -194
  113. package/src/views/groupTable/ol-table-column-config/index.vue +0 -92
  114. package/src/views/table/add-or-edit/config/base-config/index.vue +0 -539
  115. package/src/views/table/add-or-edit/config/base-config/table-form.vue +0 -333
  116. package/src/views/table/add-or-edit/config/column-config/header-config.vue +0 -475
  117. package/src/views/table/add-or-edit/config/column-config/index.vue +0 -790
  118. package/src/views/table/add-or-edit/config/data/column.js +0 -218
  119. package/src/views/table/add-or-edit/config/data/crud.js +0 -122
  120. package/src/views/table/add-or-edit/config/data/events.js +0 -109
  121. package/src/views/table/add-or-edit/config/data/method.js +0 -127
  122. package/src/views/table/add-or-edit/config/data/option.js +0 -725
  123. package/src/views/table/add-or-edit/config/data/page.js +0 -79
  124. package/src/views/table/add-or-edit/config/field-config/filed-config-table.vue +0 -42
  125. package/src/views/table/add-or-edit/config/field-config/index.vue +0 -91
  126. package/src/views/table/add-or-edit/config/form-config/index.vue +0 -1180
  127. package/src/views/table/add-or-edit/config/index.vue +0 -377
  128. package/src/views/table/add-or-edit/config/initFormObject.js +0 -25
  129. package/src/views/table/add-or-edit/config/script-config/LeftMeun.vue +0 -71
  130. package/src/views/table/add-or-edit/config/script-config/index.vue +0 -70
  131. package/src/views/table/add-or-edit/config/table-config/btn-config.vue +0 -340
  132. package/src/views/table/add-or-edit/config/table-config/btn-sort.vue +0 -132
  133. package/src/views/table/add-or-edit/config/table-config/index.vue +0 -446
  134. package/src/views/table/add-or-edit/configOld/dataTags/filed-config-table-model.vue +0 -41
  135. package/src/views/table/add-or-edit/configOld/dataTags/filed-config.vue +0 -74
  136. package/src/views/table/add-or-edit/configOld/dataTags/index.vue +0 -439
  137. package/src/views/table/add-or-edit/configOld/dataTags/set-table-sql.vue +0 -79
  138. package/src/views/table/add-or-edit/configOld/dataTags/table-on-config.vue +0 -74
  139. package/src/views/table/add-or-edit/configOld/index.vue +0 -127
  140. package/src/views/table/add-or-edit/configOld/tableTags/columnConfig.js +0 -5
  141. package/src/views/table/add-or-edit/configOld/tableTags/index.vue +0 -353
  142. package/src/views/table/add-or-edit/configOld/tableTags/operation-but-config.vue +0 -75
  143. package/src/views/table/add-or-edit/configOld/tableTags/tool-but-config.vue +0 -92
  144. package/src/views/table/add-or-edit/index.vue +0 -201
  145. package/src/views/table/add-or-edit/themeModel/index.vue +0 -53
  146. package/src/views/table/add-or-edit/themeModel/init-model-table.vue +0 -48
  147. package/src/views/table/add-or-edit/themeModel/init-model.vue +0 -81
  148. package/src/views/table/add-or-edit/themeModel/left-right.vue +0 -24
  149. package/src/views/table/add-or-edit/themeModel/left-tree-right-table.vue +0 -75
  150. package/src/views/table/add-or-edit/themeModel/olTableSearchModelMixins.js +0 -42
  151. package/src/views/table/add-or-edit/themeModel/splitpanesThemeModel.vue +0 -49
  152. package/src/views/table/add-or-edit/themeModel/top-1-bottom-2.vue +0 -29
  153. package/src/views/table/add-or-edit/themeModel/top-2-bottom-1.vue +0 -32
  154. package/src/views/table/add-or-edit/themeModel/top-2-bottom-2.vue +0 -32
  155. package/src/views/table/add-or-edit/themeModel/top-bottom.vue +0 -14
  156. package/src/views/table/index.vue +0 -43
  157. package/src/views/table/index2.vue +0 -199
  158. package/src/views/table/preview/index.vue +0 -29
  159. package/src/views/tree/components/config-core-data.vue +0 -85
  160. package/src/views/tree/components/config-core-table.vue +0 -362
  161. package/src/views/tree/components/config-core-tree/data/events.js +0 -95
  162. package/src/views/tree/components/config-core-tree/data/option.js +0 -88
  163. package/src/views/tree/components/config-core-tree/data/prop.js +0 -28
  164. package/src/views/tree/components/config-core-tree/index.vue +0 -181
  165. package/src/views/tree/components/config-core.vue +0 -42
  166. package/src/views/tree/components/form-config/index.vue +0 -967
  167. package/src/views/tree/index.vue +0 -424
  168. package/vue.config.js +0 -44
  169. /package/{olp-table/demo.html → demo.html} +0 -0
  170. /package/{olp-table/fonts → fonts}/iconfont.1720006583309.7e4906d9.woff +0 -0
  171. /package/{olp-table/fonts → fonts}/iconfont.1720006583309.947a27f0.ttf +0 -0
@@ -1,821 +0,0 @@
1
- import {handleTree} from "@/utils/tree";
2
- import {useMessage} from "@/utils/message";
3
- import {post, get, request, postAes} from "@/utils/http/httpUtils";
4
- import {exportExcel} from "@/utils/ExcelUtil";
5
- import VXETable from "vxe-table";
6
- import {groupAndCompute} from "@/utils/groupCompute";
7
-
8
- const message = useMessage() // 消息弹窗
9
- export const DefaultMethods = {
10
- methods: {
11
- //删除主子表
12
- async doRemoveMainAndSub({obj, row}, subTableName, whereObj, subForeignKey, content) {
13
- if (content) {
14
- let type = await VXETable.modal.confirm({
15
- content: content, title: '提示', status: 'warning'
16
- })
17
- if (type == "cancel") {
18
- return
19
- }
20
- }
21
- this.doPostAes(obj.code, '/online/crudAes/deleteMainAndSubs', {
22
- dbName: this.tableConfig.dbName,
23
- tableName: this.tableConfig.mainTable,
24
- subTableName: subTableName,
25
- whereMap: this.doGetWhereMap(row, whereObj),//更新条件
26
- subForeignKey: subForeignKey,
27
- })
28
- },
29
- /**
30
- * 操作列保存:直接在操作按钮的自定义事件加入代码:this.doOneSave(o,'是否要保存数据')
31
- * @param obj 单击按钮的对象
32
- * @param row 单击当前行
33
- * @param content 提示内容
34
- * @returns {Promise<void>}
35
- */
36
- async doOneSave({obj, row}, content) {
37
- if (content) {
38
- let type = await VXETable.modal.confirm({
39
- content: content, title: '提示', status: 'warning'
40
- })
41
- if (type == "cancel") {
42
- return
43
- }
44
- }
45
- if (!row) {
46
- VXETable.modal.message({
47
- content: "数据为空!", title: '提示', status: 'error'
48
- })
49
- return
50
- }
51
- let dataSource = this.table.dataSource;
52
- if (!dataSource) {
53
- return;
54
- }
55
- let newRow = JSON.parse(JSON.stringify(row));
56
- try {
57
- newRow[this.formMainList.edit.formMain.updateKey] = ''
58
- } catch (e) {
59
-
60
- }
61
- let params = {
62
- dbName: this.tableConfig.dbName,
63
- tableName: this.tableConfig.mainTable,
64
- genIdMap: {[this.formMainList.edit.formMain.updateKey]: 'uuid'},
65
- columnAndValueMap: this.getColumnTableUpdateValue(this.table.columns, newRow)
66
- }
67
- this.doPostAes(obj.code, '/online/crudAes/save', params)
68
- },
69
- /**
70
- * 操作列更新:直接在操作按钮的自定义事件加入代码:this.doOneModify(o,'数据库更新字段=数据值,数据库更新字段:列字段,数据库更新字段','数据库更新条件','提示内容')
71
- *
72
- * @param obj 单击按钮的对象
73
- * @param row 单击当前行
74
- * @param updateObj
75
- * @param whereObj
76
- * @param content
77
- * @returns {Promise<void>}
78
- */
79
- async doOneModify({obj, row}, updateObj, whereObj, content) {
80
- if (content) {
81
- let type = await VXETable.modal.confirm({
82
- content: content, title: '提示', status: 'warning'
83
- })
84
- if (type == "cancel") {
85
- return
86
- }
87
- }
88
- let newRow = JSON.parse(JSON.stringify(row));
89
- this.doPostAes(obj.code, '/online/crudAes/modify', {
90
- dbName: this.tableConfig.dbName,
91
- tableName: this.tableConfig.mainTable,
92
- columnAndValueMap: this.doGetColumnAndValueMap(newRow, updateObj),//更新字段
93
- whereMap: this.doGetWhereMap(newRow, whereObj),//更新条件
94
- })
95
- },
96
- /**
97
- * 批量更新
98
- * @param code
99
- * @param updateObj
100
- * @param whereObj
101
- * @param content
102
- * @param updateRecords 如果为空,获取全部选中数据
103
- * @returns {Promise<void>}
104
- */
105
- async doBatchModify(code, updateObj, whereObj, content, updateRecords) {
106
- if (content) {
107
- let type = await VXETable.modal.confirm({
108
- content: content, title: '提示', status: 'warning'
109
- })
110
- if (type == "cancel") {
111
- return
112
- }
113
- }
114
- let rows = updateRecords;
115
- if (!updateRecords || updateRecords.length <= 0) {
116
- rows = this.getSelectRows();
117
- }
118
- if (rows.length == 0) {
119
- VXETable.modal.message({
120
- content: "请选数据!", title: '提示', status: 'error'
121
- })
122
- return
123
- }
124
- let list = [];
125
- for (const row of rows) {
126
- list.push({
127
- columnAndValueMap: this.doGetColumnAndValueMap(row, updateObj),//更新字段
128
- whereMap: this.doGetWhereMap(row, whereObj),//更新条件
129
- });
130
- }
131
- this.doPostAes(code, '/online/crudAes/batchModify', {
132
- dbName: this.tableConfig.dbName,
133
- tableName: this.tableConfig.mainTable,
134
- list
135
- })
136
- },
137
- /**
138
- * 直接发送post请求
139
- * @param code
140
- * @param url
141
- * @param params
142
- */
143
- doPostAes(code, url, params, noQuery) {
144
- if (code != undefined) {
145
- this.loading[code] = true
146
- }
147
- postAes(this.http, url, params).then(r => {
148
- if (r != false && noQuery != false) {
149
- this.query();
150
- }
151
- }).finally(() => {
152
- if (code != undefined) {
153
- this.loading[code] = false
154
- }
155
- });
156
- },
157
- /**
158
- * 根据列配置获取数据库表更新数据
159
- * @param column
160
- * @param formData
161
- * @returns {{}}
162
- */
163
- getTableUpdateValue(column, formData) {
164
- let columnAndValueMap = {}
165
- for (let {prop, tableField} of column) {
166
- if (!tableField || tableField != '1') {
167
- continue
168
- }
169
- let value = formData[prop];
170
- if (value) {
171
- if (value instanceof String) {
172
- value = value.trim();
173
- }
174
- columnAndValueMap[prop] = value;
175
- }
176
- }
177
- return columnAndValueMap;
178
- },
179
- /**
180
- * 获取表格更新列值
181
- * @param column
182
- * @param formData
183
- * @returns {{}}
184
- */
185
- getColumnTableUpdateValue(column, formData) {
186
- let columnAndValueMap = {}
187
- for (let {field, tableSaveToOtherProp} of column) {
188
- // 勾选,不属于数据库表字段
189
- if (tableSaveToOtherProp && tableSaveToOtherProp == '1') {
190
- continue
191
- }
192
- let value = formData[field];
193
- if (value) {
194
- if (value instanceof String) {
195
- value = value.trim();
196
- }
197
- columnAndValueMap[field] = value;
198
- }
199
- }
200
- return columnAndValueMap;
201
- },
202
- /**
203
- * 获取row更新值
204
- * @param row
205
- * @param updateObj 更新对象,允许为:"name='xx',name" 如果name=xx,数据直接赋值,如果没有=,则使用row的值
206
- * @returns {{}}
207
- */
208
- doGetColumnAndValueMap(row, updateObj) {
209
- let columnAndValueMap = {};
210
- for (let key of updateObj.split(",")) {
211
- let k = key.split("=");
212
-
213
- if (k.length == 2) {
214
- columnAndValueMap[k[0]] = k[1];
215
- } else {
216
- k = key.split(":");
217
- columnAndValueMap[k[k.length - 1]] = row[k[0]];
218
- }
219
- }
220
- return columnAndValueMap;
221
- },
222
- doGetColumnAndValueAny(rows, updateObj) {
223
- if (!updateObj) {
224
- return rows;
225
- }
226
- let list = []
227
- let keys = [];
228
- let hasKey = '';
229
- for (const row of rows) {
230
- keys = keys.length >= 1 ? keys : Object.keys(row)
231
- if (!hasKey) {
232
- hasKey = this.hasUpdateKey(keys, updateObj)
233
- }
234
- if (hasKey) {
235
- Object.assign(row, this.doGetColumnAndValueMap(row, updateObj))
236
- }
237
- list.push(row);
238
- }
239
- return list;
240
- },
241
- hasUpdateKey(keys, updateObj) {
242
- for (const key of keys) {
243
- if (updateObj.indexOf(key) >= 0) {
244
- return '1';
245
- }
246
- }
247
- return '0';
248
- },
249
- doGetWhereMap(row, whereObj) {
250
- let whereMap = {};
251
- for (let key of whereObj.split(",")) {
252
- let k = key.split(":");
253
- whereMap[k[k.length - 1]] = row[k[0]];
254
- }
255
- return whereMap;
256
- },
257
- /**
258
- * 内置批量删除方法
259
- * @param o
260
- * @returns {Promise<void>}
261
- */ batchRemove() {
262
- this.confirm("您选中" + this.getSelectRows().length + '条数据,删除后不可恢复,您确定要删除吗?', '删除提示', 'error').then(type => {
263
- if (type != "cancel") {
264
- let list = [];
265
- for (let r of this.getSelectRows()) {
266
- let p = JSON.parse(JSON.stringify(this.deleteParameter));
267
- delete p['$parentId'];
268
- for (let key of Object.keys(p)) {
269
- p[key] = r[key];
270
- }
271
- list.push(p);
272
- }
273
- this.loading['batchDelete'] = true
274
- postAes(this.http, '/online/crudAes/batchDelete', {
275
- dbName: this.tableConfig.dbName,
276
- tableName: this.tableConfig.mainTable,
277
- list: list
278
- }).then(r => {
279
- if (r != false) {
280
- this.query();
281
- }
282
- }).finally(() => {
283
- this.loading['batchDelete'] = false
284
- });
285
- }
286
- })
287
-
288
-
289
- }, /**
290
- * 内置重置方法
291
- * @param o
292
- * @returns {Promise<void>}
293
- */ resetQuery() {
294
- for (let k of Object.keys(this.table.formConfig.data)) {
295
- this.table.formConfig.data[k] = undefined
296
- }
297
- for (let k of Object.keys(this.parameter)) {
298
- this.parameter[k] = undefined
299
- }
300
- this.initDefaultValue();
301
- this.query();
302
- }, /**
303
- * 内置根据参数查询
304
- * @param o
305
- * @returns {Promise<void>}
306
- */
307
- queryParams(parameter) {
308
- if (parameter) {
309
- Object.assign(this.parameter, parameter)
310
- }
311
- return this.query();
312
- }, /**
313
- * 内置查询
314
- * @param o
315
- * @returns {Promise<void>}
316
- */
317
- query() {
318
- let axios = undefined;
319
- if (this.tableConfig.definitionSql == 2) {
320
- if (this.tableConfig.requestType == '1') {
321
- axios = post(this.http, this.tableConfig.api, this.getParams(), false, false);
322
- } else {
323
- axios = get(this.http, this.tableConfig.api, this.getParams(), false);
324
- }
325
- } else {
326
- axios = postAes(this.http, '/online/crudAes/query', this.getParams(), false, false);
327
- }
328
- this.doQuery(axios);
329
- }, doQuery(axios) {
330
- if (this.loading['select']) {
331
- return
332
- }
333
- this.table.loading = true;
334
- this.loading['select'] = true
335
- axios.then(({data, code, msg}) => {
336
- if (code != 200 && code != 0) {
337
- message.error(msg)
338
- return
339
- }
340
- let respData = (data instanceof Array) ? data : data.listData;
341
- if (this.table.treeConfig) {
342
- //id , parentId , children
343
- respData = handleTree(respData, this.table.treeConfig.treeId, this.table.treeConfig.treeParentId);
344
- }
345
- this.table.data = respData;
346
- this.doGroupAndCompute(respData)
347
- this.pagination.total = data.count;
348
- }).finally(() => {
349
- this.table.loading = false;
350
- this.loading['select'] = false
351
- });
352
- },
353
-
354
- /**
355
- * 内置删除方法
356
- * @param o
357
- * @returns {Promise<void>}
358
- */
359
- remove(o) {
360
- let {row} = o;
361
- this.confirm('数据删除后不可恢复,您确定要删除吗?', '删除提示', 'error').then(type => {
362
- if (type != "cancel") {
363
- let params = {};
364
- for (let key of Object.keys(this.deleteParameter)) {
365
- if (key != '$parentId') {
366
- params[key] = row[key];
367
- }
368
- }
369
- postAes(this.http, '/online/crudAes/delete', {
370
- where: params,
371
- dbName: this.tableConfig.dbName,
372
- tableName: this.tableConfig.mainTable,
373
- }).then(r => {
374
- if (r != false) {
375
- this.query()
376
- }
377
- })
378
- }
379
- })
380
- }, /**
381
- * 获取查询参数
382
- * @returns {{enablePage: OTMixinBodyMethods.methods.pagination.enabled, theme: OTMixinBodyMethods.methods.theme, id: OTMixinBodyMethods.methods.uuid}}
383
- */
384
- getParams() {
385
- if (this.tableConfig.definitionSql == 2) {
386
- let params = JSON.parse(JSON.stringify(this.table.formConfig.data));
387
- if (params.enablePage) {
388
- params.pageNumber = this.pagination.currentPage;
389
- params.pageSize = this.pagination.pageSize;
390
- }
391
- return {...this.parameter, ...params}
392
- }
393
- let params = {
394
- id: this.uuid, theme: this.theme, enablePage: this.pagination.enabled
395
- };
396
- if (params.enablePage) {
397
- params.pageNumber = this.pagination.currentPage;
398
- params.pageSize = this.pagination.pageSize;
399
- }
400
- let paramsKey = [];
401
- for (let o of this.table.formConfig.items) {
402
- let value = this.table.formConfig.data[o.key];
403
- if (value == undefined || value == '' || (o.itemRender && o.itemRender.name == '$buttons')) {
404
- continue
405
- }
406
- let key = o.key.replace(/\$/g, '');
407
- //文本域
408
- if (o.itemRender && o.itemRender.name == "textarea" && o.type != "9") {
409
- let values = value instanceof Array ? value : value.split("\n");
410
- if (values.length != 0) {
411
- let queryParameterMapIn = [];
412
- for (let v of values) {
413
- if (v != undefined && v.toString().trim() != '') {
414
- queryParameterMapIn.push(v);
415
- }
416
- }
417
- if (queryParameterMapIn.length != 0) {
418
- if (!params['queryParameterMapIn']) {
419
- params['queryParameterMapIn'] = {};
420
- }
421
- params['queryParameterMapIn'][key] = queryParameterMapIn;
422
- paramsKey.push(key);
423
- } else if (params['queryParameterMapIn']) {
424
- delete params['queryParameterMapIn'][key];
425
- }
426
- }
427
-
428
- } else if (value.toString().trim() != '') {
429
- if (!params['queryParameterListAnd']) {
430
- params['queryParameterListAnd'] = [];
431
- }
432
- let values = value instanceof Array ? value : value.split(",");
433
- if (o.type == "98") {
434
- params['queryParameterListAnd'].push({
435
- value: values[0], key: key, type: 5, toDate: o.toDate
436
- });
437
- params['queryParameterListAnd'].push({
438
- value: values[1], key: key, type: 6, toDate: o.toDate
439
- });
440
- paramsKey.push(key);
441
- } else if (value.length == 1 && !(value instanceof Array)) {
442
- o.value = value;
443
- //type 查询类型 默认等于1--> 1:= 2:!= 3: > 4:< 5: >= 6: <= 7:like '%value' 8:like '%value%' 9:like 'value%'
444
- //replace(/\$/g, '') 目的解决范围
445
- let obj = {
446
- value: value, key: key, type: o.type, toDate: o.toDate
447
- };
448
- params['queryParameterListAnd'].push(obj);
449
- paramsKey.push(key);
450
- } else {
451
- for (let v of values) {
452
- if (!v) {
453
- continue;
454
- }
455
- let obj = {
456
- value: v, key: key, type: o.type, toDate: o.toDate
457
- };
458
- params['queryParameterListAnd'].push(obj);
459
- paramsKey.push(key);
460
- }
461
- }
462
- }
463
- }
464
- for (let key of Object.keys(this.parameter)) {
465
- let v = this.parameter[key];
466
- if (paramsKey.indexOf(key) === -1 && v != undefined && v != '') {
467
- if (!params['queryParameterListAnd']) {
468
- params['queryParameterListAnd'] = [];
469
- }
470
- params['queryParameterListAnd'].push({
471
- key: key, value: v
472
- });
473
- }
474
- }
475
- if (this.orderByColumns.length != 0) {
476
- params['orderBy'] = this.orderByColumns;
477
- }
478
- if (this.events['queryBefore']) {
479
- this.events['queryBefore'](params)
480
- }
481
- return params;
482
- }, /**
483
- * 导出数据
484
- * @param columns 自定义导出字段 t_id
485
- * @param selectData 选择数据: 当前页数据、勾选行数据、全部数据
486
- * @param name
487
- */
488
- exportData({exportParam, cancelEvent}) {
489
- let {columns, selectData, name} = exportParam
490
- for (let column of this.table.columns) {
491
- for (let c of columns) {
492
- if (column.field === c.field && column.params) {
493
- c.params = column.params;
494
- }
495
- }
496
- }
497
- let data = []
498
- switch (selectData) {
499
- case '1': // 当前页
500
- data = this.table?.data
501
- break
502
- case '2': // 勾选
503
- data = this.getSelectRows()
504
- if (!data || data.length == 0) return message.error('勾选行数据为空!')
505
- break
506
- case '3': // 全部数据
507
- this.exportExcelAll(columns, name)
508
- break
509
- default:
510
- data = this.table.data
511
- break
512
- }
513
- if (selectData != '3') {
514
- exportExcel({
515
- data: data,
516
- name: name,
517
- columns: columns,
518
- option: {align: this.$table ? this.$table.align : 'center'}
519
- })
520
- }
521
- cancelEvent()
522
- }, /**
523
- * 全部数据导出
524
- * @param fields 自定义导出字段
525
- * @param name 文件名
526
- */
527
- exportExcelAll(columns, name) {
528
- let params = this.getParams();
529
- params.enablePage = false;
530
- if (this.tableConfig.definitionSql == 2) {
531
- params.pageNumber = 1;
532
- params.pageSize = 50000;
533
- }
534
- let url = this.tableConfig.definitionSql == 2 ? this.tableConfig.api : '/online/crud/query';
535
- let method = this.tableConfig.definitionSql == 2 ? (this.tableConfig.requestType == '1' ? 'post' : 'get') : 'post'
536
- request(this.http, {
537
- url: url, method: method, data: params, timeout: 1000 * 90 * 90
538
- }, false, false).then(({data}) => {
539
- let respData = (data instanceof Array) ? data : data.listData;
540
- exportExcel({
541
- data: respData,
542
- name: name,
543
- columns: columns,
544
- option: {align: this.$table ? this.$table.align : 'center'}
545
- })
546
- })
547
- }, /**
548
- * 内置确认框
549
- * @param content
550
- * @param title
551
- * @param status
552
- * @returns {Promise<"model"|"mask"|"close"|"confirm"|"cancel"|"exit"|"exist">}
553
- */
554
- async confirm(content, title, status) {
555
- return await VXETable.modal.confirm({
556
- content: content, title: title, status: status
557
- })
558
- }, /**
559
- * 内置调用方法
560
- * @param m
561
- * @param v
562
- * @param d
563
- */
564
- emits({m, v, d, js}) {
565
- if (js) {
566
- eval(js)
567
- } else if (m && this[m]) {
568
- this[m](v);
569
- }
570
- if (d != false) {
571
- this.customUrl = undefined;
572
- }
573
- },
574
- /**
575
- * 设置禁用按钮
576
- * @param ex
577
- */
578
- setAllBtnDisabled(ex) {
579
- if (ex) {
580
- ex = ex.split(",")
581
- } else {
582
- ex = [];
583
- }
584
- for (let toolBtn of this.toolBtn) {
585
- let disabled = true;
586
- for (let code of ex) {
587
- if (toolBtn.code == code) {
588
- disabled = false;
589
- }
590
- }
591
- toolBtn.disabled = disabled;
592
- }
593
- for (let toolBtn of this.operationBtn) {
594
- let disabled = true;
595
- for (let code of ex) {
596
- if (toolBtn.code == code) {
597
- disabled = false;
598
- }
599
- }
600
- toolBtn.disabled = disabled;
601
- }
602
- },
603
- /**
604
- * 设置工具栏 but
605
- * @param code 编码
606
- * @param key 要设置的key
607
- * @param value 要设置的value
608
- */
609
- setToolBtn(code, key, value) {
610
- for (let toolBtn of this.toolBtn) {
611
- if (toolBtn.code == code) {
612
- toolBtn[key] = value;
613
- }
614
- }
615
- }, /**
616
- * 设置操作按钮 but
617
- * @param code 编码
618
- * @param key 要设置的key
619
- * @param value 要设置的value
620
- */
621
- setOperationBtn(code, key, value) {
622
- for (let toolBtn of this.operationBtn) {
623
- if (toolBtn.code == code) {
624
- toolBtn[key] = value;
625
- }
626
- }
627
- },
628
- /**
629
- * 获取修改数据(包括未修改数据)
630
- */
631
- getUpdateRecords() {
632
- if (this.$table) {
633
- return this.$table.getUpdateRecords()
634
- }
635
- },
636
- /**
637
- * 批量保存
638
- */
639
- async batchSave(code, content, rows, foreignKey, foreignKeyValue) {
640
- if (content) {
641
- let type = await VXETable.modal.confirm({
642
- content: content, title: '提示', status: 'warning'
643
- })
644
- if (type == "cancel") {
645
- return
646
- }
647
- }
648
- if (rows.length == 0) {
649
- VXETable.modal.message({
650
- content: "请选数据!", title: '提示', status: 'error'
651
- })
652
- return
653
- }
654
- let list = [];
655
- let updateList = [];
656
- let dataSource = this.table.dataSource;
657
- this.formMainList.edit.formMain.updateKey = this.formMainList.edit.formMain.updateKey.trim();
658
- const srcMap = new Map(dataSource.map(item => [item[this.formMainList.edit.formMain.updateKey], item]));
659
- for (const row of rows) {
660
- let rowId = row[this.formMainList.edit.formMain.updateKey];
661
- if (rowId) {
662
- updateList.push({
663
- columnAndValueMap: this.getDifferingProperties(row, srcMap.get(row[this.formMainList.edit.formMain.updateKey])),//更新字段
664
- whereMap: this.doGetWhereMap(row, this.formMainList.edit.formMain.updateKey),//更新条件
665
- });
666
- continue
667
- }
668
- let columnTableUpdateValue = this.getColumnTableUpdateValue(this.table.columns, row);
669
- columnTableUpdateValue[foreignKey] = foreignKeyValue ? foreignKeyValue : this.mainId
670
- list.push(columnTableUpdateValue);
671
- }
672
- if (updateList && updateList.length >= 1) {
673
- console.log('updateList:', updateList)
674
- this.doPostAes(code, '/online/crudAes/batchModify', {
675
- dbName: this.tableConfig.dbName,
676
- tableName: this.tableConfig.mainTable,
677
- updateList
678
- })
679
- }
680
- if (list && list.length >= 1) {
681
- this.doPostAes(code, '/online/crudAes/batchSave', {
682
- dbName: this.tableConfig.dbName,
683
- tableName: this.tableConfig.mainTable,
684
- tableConfigId: this.tableConfig.tableConfigId,
685
- columnAndValueListMap: list,
686
- genIdMap: {[this.formMainList.edit.formMain.updateKey]: 'uuid'}
687
- })
688
- }
689
- },
690
- /**
691
- * 保存修改
692
- */
693
- async saveUpdate(code, content) {
694
- let dataSource = this.table.dataSource;
695
- const srcMap = new Map(dataSource.map(item => [item[this.formMainList.edit.formMain.updateKey], item]));
696
- let rows = []
697
- for (const row of this.getUpdateRecords()) {
698
- let src = srcMap.get(row[this.formMainList.edit.formMain.updateKey]);
699
- rows.push(this.getDifferingProperties(row, src));
700
- }
701
- // console.log('saveUpdate:',rows)
702
- if (content) {
703
- let type = await VXETable.modal.confirm({
704
- content: content, title: '提示', status: 'warning'
705
- })
706
- if (type == "cancel") {
707
- return
708
- }
709
- }
710
- if (rows.length == 0) {
711
- VXETable.modal.message({
712
- content: "请选数据!", title: '提示', status: 'error'
713
- })
714
- return
715
- }
716
- let list = [];
717
- for (const row of this.getUpdateRecords()) {
718
- list.push({
719
- columnAndValueMap: this.getDifferingProperties(row, srcMap.get(row[this.formMainList.edit.formMain.updateKey])),//更新字段
720
- whereMap: this.doGetWhereMap(row, this.formMainList.edit.formMain.updateKey),//更新条件
721
- });
722
- }
723
- this.doPostAes(code, '/online/crudAes/batchModify', {
724
- dbName: this.tableConfig.dbName,
725
- tableName: this.tableConfig.mainTable,
726
- list
727
- })
728
- // this.doBatchModify('batchModify', "age", this.formMainList.edit.formMain.updateKey, "确认修改编辑数据吗?", this.getUpdateRecords())
729
- },
730
- /**
731
- * 获取新增数据
732
- */
733
- getInsertEvent() {
734
- if (this.$table) {
735
- return this.$table.getInsertRecords()
736
- }
737
- },
738
- /**
739
- * 获取删除数据
740
- * @returns {*}
741
- */
742
- getRemoveEvent() {
743
- if (this.$table) {
744
- return this.$table.getRemoveRecords()
745
- }
746
- },
747
- /**
748
- * 获取选中
749
- * @returns {*|*[]|*[]}
750
- */
751
- getSelectRows() {
752
- if (this.selectBox == 1) {
753
- return this.$table.getRadioRecord() ? [this.$table.getRadioRecord()] : []
754
- } else if (this.selectBox == 2) {
755
- return this.$table.getCheckboxRecords(true)
756
- }
757
- }, updateColumn(rows) {
758
- this.table['show-footer'] = false;
759
- if (rows && rows instanceof Array) {
760
- for (let o of this.table.columns) {
761
- for (let row of rows) {
762
- if (row.id == o.id) {
763
- for (let key of Object.keys(row)) {
764
- o[key] = row[key];
765
- }
766
- }
767
- }
768
- this.setColumnHide(o);
769
- this.setFixed(o);
770
- this.setShowFooter(o);
771
- }
772
- }
773
- let data = this.table.columns.sort((a, b) => {
774
- return a.sort - b.sort;
775
- })
776
- this.doGroupAndCompute()
777
- this.$table.reloadColumn(data)
778
- }, doGroupAndCompute(dataSource) {
779
- if (dataSource) {
780
- this.table.dataSource = JSON.parse(JSON.stringify(dataSource));
781
- }
782
- if (this.tableConfig.paging != 2) {
783
- if (dataSource != undefined) {
784
- this.table.data = dataSource;
785
- }
786
- return
787
- }
788
-
789
- let groupKey = [];
790
- let comValue = [];
791
- for (let column of this.table.columns) {
792
- if (column.visible && column.groupToOtherProp == 1) {
793
- groupKey.push(column.field)
794
- }
795
- if (column.groupTotalToOtherProp) {
796
- comValue.push(column.field + ":" + column.groupTotalToOtherProp)
797
- }
798
- }
799
- if (dataSource == undefined) {
800
- dataSource = this.table.dataSource;
801
- }
802
- if (groupKey.length != 0 & comValue.length != 0) {
803
- dataSource = groupAndCompute(groupKey, comValue, dataSource)
804
- }
805
- this.table.data = dataSource;
806
- this.$table.reloadData(this.table.data)
807
- },
808
- getDifferingProperties(tar, src) {
809
- const differingProperties = {};
810
- // 假设两个对象都有相同的属性
811
- for (const key in tar) {
812
- if (tar.hasOwnProperty(key) && src.hasOwnProperty(key)) {
813
- if (tar[key] !== src[key]) {
814
- differingProperties[key] = tar[key]; // 可以选择返回obj2的值,或创建一个数组存放两个值
815
- }
816
- }
817
- }
818
- return differingProperties;
819
- }
820
- }
821
- }