olp-table 5.3.4 → 5.3.5

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/package.json +12 -92
  2. package/.env.build +0 -1
  3. package/README.md +0 -26
  4. package/babel.config.js +0 -5
  5. package/jsconfig.json +0 -22
  6. package/public/favicon.ico +0 -0
  7. package/public/index.html +0 -17
  8. package/rmMode.bat +0 -1
  9. package/src/App.vue +0 -199
  10. package/src/api/crud.js +0 -22
  11. package/src/api/dist.js +0 -6
  12. package/src/assets/iconfont/iconfont.css +0 -20
  13. package/src/assets/iconfont/iconfont.json +0 -16
  14. package/src/assets/iconfont/iconfont.ttf +0 -0
  15. package/src/assets/iconfont/iconfont.woff +0 -0
  16. package/src/assets/iconfont/iconfont.woff2 +0 -0
  17. package/src/assets/logo.png +0 -0
  18. package/src/components/auto-height/index.vue +0 -75
  19. package/src/components/codemirror-tag.vue +0 -100
  20. package/src/components/lazy-load-select.vue +0 -107
  21. package/src/components/ol-dialog-excel.vue +0 -112
  22. package/src/components/ol-dialog-import.vue +0 -304
  23. package/src/components/ol-dialog-json.vue +0 -82
  24. package/src/components/ol-dialog-table.vue +0 -81
  25. package/src/components/ol-dialog-upload-file.vue +0 -208
  26. package/src/components/ol-dict-tag.vue +0 -271
  27. package/src/components/ol-select-dom.vue +0 -71
  28. package/src/components/ol-table-filter.vue +0 -28
  29. package/src/components/ol-table-render.vue +0 -44
  30. package/src/components/ol-table-select.vue +0 -150
  31. package/src/components/pinia-init.vue +0 -18
  32. package/src/components/table/model/ModelMixins.js +0 -43
  33. package/src/components/table/model/model-index.vue +0 -121
  34. package/src/components/table/model/ot-left-right.vue +0 -18
  35. package/src/components/table/model/ot-left-tree-right-table.scss +0 -14
  36. package/src/components/table/model/ot-left-tree-right-table.vue +0 -41
  37. package/src/components/table/model/ot-top-1-bottom-2.vue +0 -39
  38. package/src/components/table/model/ot-top-2-bottom-1.vue +0 -38
  39. package/src/components/table/model/ot-top-2-bottom-2.vue +0 -38
  40. package/src/components/table/model/ot-top-bottom.vue +0 -18
  41. package/src/components/table/model/splitpanesModel.css +0 -22
  42. package/src/components/table/model/splitpanesModel.vue +0 -54
  43. package/src/components/table/ol-form/index.vue +0 -537
  44. package/src/components/table/ol-form-v3/index.vue +0 -455
  45. package/src/components/table/ol-main-form-sub-table/index.vue +0 -601
  46. package/src/components/table/ol-pager/index.vue +0 -46
  47. package/src/components/table/ol-table/components/ol-table-column-config/columnIndex.vue +0 -233
  48. package/src/components/table/ol-table/components/ol-table-column-config/index.vue +0 -145
  49. package/src/components/table/ol-table/components/ol-table-column-dict-color/index.vue +0 -88
  50. package/src/components/table/ol-table/index.vue +0 -232
  51. package/src/components/table/ol-table-operate/index.vue +0 -61
  52. package/src/components/table/ol-table-search/index.vue +0 -17
  53. package/src/components/table/ol-table-tool-btn/index.vue +0 -60
  54. package/src/components/tree/components/o-tree.vue +0 -289
  55. package/src/components/tree/index.vue +0 -46
  56. package/src/components/v-component/index.vue +0 -43
  57. package/src/config/dev-config.js +0 -5
  58. package/src/config/prod-config.js +0 -5
  59. package/src/config/shared-config.js +0 -20
  60. package/src/data.js +0 -9378
  61. package/src/directives/permission/hasPermi.js +0 -63
  62. package/src/directives/permission/hasRole.js +0 -30
  63. package/src/main.js +0 -55
  64. package/src/mixins/VTMixin/DefaultMethods.js +0 -749
  65. package/src/mixins/VTMixin/OTMixinBody.js +0 -105
  66. package/src/mixins/VTMixin/OTMixinBodyFooter.js +0 -93
  67. package/src/mixins/VTMixin/OTMixinBodyMethods.js +0 -420
  68. package/src/mixins/VTMixin/OTMixinColumnMethod.js +0 -450
  69. package/src/mixins/VTMixin/OTMixinInitMethod.js +0 -130
  70. package/src/mixins/VTMixin/OTMixinPager.js +0 -38
  71. package/src/mixins/VTMixin/OTMixinSortable.js +0 -43
  72. package/src/mixins/VTMixin/index.js +0 -18
  73. package/src/package/index.js +0 -20
  74. package/src/plugins/axios.js +0 -61
  75. package/src/store/dict.js +0 -76
  76. package/src/store/dictType.js +0 -52
  77. package/src/store/permi.js +0 -45
  78. package/src/styles/common.scss +0 -37
  79. package/src/styles/index.scss +0 -48
  80. package/src/styles/theme.scss +0 -32
  81. package/src/utils/AESCRUDUtils.js +0 -87
  82. package/src/utils/DateUtils.js +0 -35
  83. package/src/utils/ExcelUtil.js +0 -159
  84. package/src/utils/TableSortUtil.js +0 -91
  85. package/src/utils/columnProp.js +0 -3
  86. package/src/utils/groupCompute.js +0 -68
  87. package/src/utils/http/httpFactory.js +0 -92
  88. package/src/utils/http/httpFactory2.js +0 -79
  89. package/src/utils/http/httpUtil.js +0 -123
  90. package/src/utils/http/httpUtils.js +0 -38
  91. package/src/utils/loadStyle.js +0 -14
  92. package/src/utils/message.js +0 -56
  93. package/src/utils/object.js +0 -80
  94. package/src/utils/security/TokenUtil.js +0 -19
  95. package/src/utils/tree.js +0 -54
  96. package/src/utils/util.js +0 -127
  97. package/src/views/Test/index.vue +0 -77
  98. package/src/views/Test/index2.vue +0 -33
  99. package/src/views/components/btn-config/index.vue +0 -202
  100. package/src/views/components/option-config/index.vue +0 -192
  101. package/src/views/db/chineseToEnglish.vue +0 -127
  102. package/src/views/db/filed.vue +0 -395
  103. package/src/views/db/index.vue +0 -192
  104. package/src/views/db/preview/index.vue +0 -139
  105. package/src/views/db/preview/left.vue +0 -204
  106. package/src/views/db/preview/right.vue +0 -466
  107. package/src/views/groupTable/index.vue +0 -137
  108. package/src/views/groupTable/ol-table-column-config/columnIndex.vue +0 -194
  109. package/src/views/groupTable/ol-table-column-config/index.vue +0 -92
  110. package/src/views/table/add-or-edit/config/base-config/index.vue +0 -539
  111. package/src/views/table/add-or-edit/config/base-config/table-form.vue +0 -333
  112. package/src/views/table/add-or-edit/config/column-config/header-config.vue +0 -475
  113. package/src/views/table/add-or-edit/config/column-config/index.vue +0 -790
  114. package/src/views/table/add-or-edit/config/data/column.js +0 -218
  115. package/src/views/table/add-or-edit/config/data/crud.js +0 -122
  116. package/src/views/table/add-or-edit/config/data/events.js +0 -109
  117. package/src/views/table/add-or-edit/config/data/method.js +0 -127
  118. package/src/views/table/add-or-edit/config/data/option.js +0 -725
  119. package/src/views/table/add-or-edit/config/data/page.js +0 -79
  120. package/src/views/table/add-or-edit/config/field-config/filed-config-table.vue +0 -42
  121. package/src/views/table/add-or-edit/config/field-config/index.vue +0 -91
  122. package/src/views/table/add-or-edit/config/form-config/index.vue +0 -1179
  123. package/src/views/table/add-or-edit/config/index.vue +0 -376
  124. package/src/views/table/add-or-edit/config/initFormObject.js +0 -25
  125. package/src/views/table/add-or-edit/config/script-config/LeftMeun.vue +0 -71
  126. package/src/views/table/add-or-edit/config/script-config/index.vue +0 -70
  127. package/src/views/table/add-or-edit/config/table-config/btn-config.vue +0 -340
  128. package/src/views/table/add-or-edit/config/table-config/btn-sort.vue +0 -132
  129. package/src/views/table/add-or-edit/config/table-config/index.vue +0 -446
  130. package/src/views/table/add-or-edit/configOld/dataTags/filed-config-table-model.vue +0 -41
  131. package/src/views/table/add-or-edit/configOld/dataTags/filed-config.vue +0 -74
  132. package/src/views/table/add-or-edit/configOld/dataTags/index.vue +0 -439
  133. package/src/views/table/add-or-edit/configOld/dataTags/set-table-sql.vue +0 -79
  134. package/src/views/table/add-or-edit/configOld/dataTags/table-on-config.vue +0 -74
  135. package/src/views/table/add-or-edit/configOld/index.vue +0 -127
  136. package/src/views/table/add-or-edit/configOld/tableTags/columnConfig.js +0 -5
  137. package/src/views/table/add-or-edit/configOld/tableTags/index.vue +0 -353
  138. package/src/views/table/add-or-edit/configOld/tableTags/operation-but-config.vue +0 -75
  139. package/src/views/table/add-or-edit/configOld/tableTags/tool-but-config.vue +0 -92
  140. package/src/views/table/add-or-edit/index.vue +0 -201
  141. package/src/views/table/add-or-edit/themeModel/index.vue +0 -53
  142. package/src/views/table/add-or-edit/themeModel/init-model-table.vue +0 -48
  143. package/src/views/table/add-or-edit/themeModel/init-model.vue +0 -81
  144. package/src/views/table/add-or-edit/themeModel/left-right.vue +0 -24
  145. package/src/views/table/add-or-edit/themeModel/left-tree-right-table.vue +0 -75
  146. package/src/views/table/add-or-edit/themeModel/olTableSearchModelMixins.js +0 -42
  147. package/src/views/table/add-or-edit/themeModel/splitpanesThemeModel.vue +0 -49
  148. package/src/views/table/add-or-edit/themeModel/top-1-bottom-2.vue +0 -29
  149. package/src/views/table/add-or-edit/themeModel/top-2-bottom-1.vue +0 -32
  150. package/src/views/table/add-or-edit/themeModel/top-2-bottom-2.vue +0 -32
  151. package/src/views/table/add-or-edit/themeModel/top-bottom.vue +0 -14
  152. package/src/views/table/index.vue +0 -43
  153. package/src/views/table/index2.vue +0 -199
  154. package/src/views/table/preview/index.vue +0 -29
  155. package/src/views/tree/components/config-core-data.vue +0 -85
  156. package/src/views/tree/components/config-core-table.vue +0 -362
  157. package/src/views/tree/components/config-core-tree/data/events.js +0 -95
  158. package/src/views/tree/components/config-core-tree/data/option.js +0 -88
  159. package/src/views/tree/components/config-core-tree/data/prop.js +0 -28
  160. package/src/views/tree/components/config-core-tree/index.vue +0 -181
  161. package/src/views/tree/components/config-core.vue +0 -42
  162. package/src/views/tree/components/form-config/index.vue +0 -967
  163. package/src/views/tree/index.vue +0 -424
  164. package/vue.config.js +0 -44
  165. /package/{olp-table/demo.html → demo.html} +0 -0
  166. /package/{olp-table/fonts → fonts}/iconfont.1720006583309.7e4906d9.woff +0 -0
  167. /package/{olp-table/fonts → fonts}/iconfont.1720006583309.947a27f0.ttf +0 -0
  168. /package/{olp-table/olp-table.common.js → olp-table.common.js} +0 -0
  169. /package/{olp-table/olp-table.css → olp-table.css} +0 -0
  170. /package/{olp-table/olp-table.umd.js → olp-table.umd.js} +0 -0
  171. /package/{olp-table/olp-table.umd.min.js → olp-table.umd.min.js} +0 -0
@@ -1,466 +0,0 @@
1
- <template>
2
- <vxe-grid v-bind="table" :columns="$attrs.columns" ref="vexGridRef" @sortChange="sortChange" @keydown="keydown">
3
- <template #checkedBox_header="{ column }">
4
- <div style="display: flex;align-items: center;">
5
- <el-tooltip class="box-item"
6
- effect="dark"
7
- :content="column.title"
8
- placement="left-start"
9
- >
10
- <span style="margin-left: 5px;">{{
11
- column.title != undefined ? column.title.toString().substring(0, 4) : ''
12
- }} </span>
13
- </el-tooltip>
14
- <el-checkbox v-model="column.children[0].params.time" style="margin-left: 5px;margin-right: 5px"
15
- @change="column.children[0].params.range = false;query();">时间
16
- </el-checkbox>
17
- <el-checkbox v-model="column.children[0].params.range"
18
- @change="column.children[0].params.time = false;query();">范围
19
- </el-checkbox>
20
- </div>
21
- </template>
22
- <template #operate="{ row }">
23
- <el-tooltip class="box-item"
24
- effect="dark"
25
- content="保存"
26
- placement="top-start"
27
- >
28
- <vxe-button @click="saveUpdateEvent(row)" mode="text" icon="vxe-icon-save"
29
- :status="hasUpdateStatus(row) ? 'warning' : 'info'" size="mini"
30
- :disabled="!hasUpdateStatus(row)"
31
- :loading="row.loading"/>
32
- </el-tooltip>
33
- <el-tooltip class="box-item"
34
- effect="dark"
35
- content="复制数据"
36
- placement="top-start"
37
- >
38
- <vxe-button @click="add(row)" mode="text" icon="vxe-icon-add"
39
- status="primary" size="mini"/>
40
- </el-tooltip>
41
- <el-tooltip class="box-item"
42
- effect="dark"
43
- content="删除数据"
44
- placement="top-start"
45
- >
46
- <el-popconfirm title="是否删除数据" @confirm="remove(row)">
47
- <template #reference>
48
- <vxe-button mode="text" icon="vxe-icon-delete"
49
- status="danger" size="mini"/>
50
- </template>
51
- </el-popconfirm>
52
-
53
- </el-tooltip>
54
- </template>
55
- <template #header_name_auto_filter="{ column }">
56
- <div v-if="column.params.time">
57
- <el-date-picker
58
- v-model="column.params.start"
59
- style="width: 100%;"
60
- type="datetime"
61
- placeholder="开始时间"
62
- format="YYYY-MM-DD HH:mm:ss"
63
- @change="query"
64
- />
65
- <el-date-picker
66
- v-model="column.params.end"
67
- style="width: 100%;"
68
- type="datetime"
69
- placeholder="结束"
70
- format="YYYY-MM-DD HH:mm:ss"
71
- @change="query"
72
- />
73
- </div>
74
- <div v-else-if="column.params.range">
75
- <el-input
76
- v-model="column.params.start"
77
- style="width: 100%;"
78
- placeholder="开始"
79
- @change="query"
80
- />
81
- <el-input
82
- v-model="column.params.end"
83
- style="width: 100%;"
84
- placeholder="结束"
85
- @change="query"
86
- />
87
- </div>
88
- <el-input v-else v-model="column.params.value" style="width: 100%;"
89
- placeholder="关键字搜索" clearable
90
- @change="query">
91
- </el-input>
92
-
93
- </template>
94
- <template #pager>
95
- <olPager v-bind="pagination" :showDetails="false" @page-change="handlePageChange"
96
- @clearSelected="clearSelected"/>
97
- <el-input
98
- v-model="sql"
99
- style="width: 100%"
100
- type="textarea"
101
- placeholder="sql"
102
- />
103
- <el-button @click="addNew()" type="primary">新增列</el-button>
104
- </template>
105
- </vxe-grid>
106
- </template>
107
-
108
- <script>
109
- import olPager from "@/components/table/ol-pager/index.vue";
110
- import {get, post} from "@/utils/http/httpUtils";
111
- import Sortable from "sortablejs";
112
- import {OTMixinPager} from "@/mixins/VTMixin/OTMixinPager";
113
- import {dateFormat} from "@/utils/DateUtils";
114
-
115
- export default {
116
- name: "previewRight",
117
- components: {olPager},
118
- inject: ['http', 'column'],
119
- mixins: [OTMixinPager],
120
- data() {
121
- return {
122
- form: {},
123
- sql: '',
124
- table: {
125
- showOverflow: true,
126
- resizable: true,
127
- resizableConfig: {},
128
- columnConfig: {
129
- resizable: true, isHover: true, isCurrent: true,
130
- useKey: true,
131
- },
132
- keepSource: true,
133
- mouseConfig: {selected: true},
134
- rowConfig: {isHover: true, isCurrent: true, useKey: true},
135
- editConfig: {
136
- mode: 'cell',
137
- showIcon: false,
138
- trigger: 'click',
139
- showStatus: true,
140
- showUpdateStatus: true,
141
- beforeEditMethod: ({column, row}) => {
142
- let resp = column.params.is_pk != 1 || !row.resp_Data_UUID
143
- return resp
144
- }
145
- },
146
- align: 'center',
147
- filterConfig: {
148
- showIcon: false
149
- },
150
- sortConfig: {
151
- remote: true,
152
- },
153
- scrollX: {enabled: true, gt: 15},
154
- scrollY: {enabled: true, gt: 15},
155
- loading: false,
156
- size: 'mini',
157
- border: true,
158
- height: '100%',
159
- columns: [],
160
- data: []
161
- }
162
- }
163
- },
164
- methods: {
165
- async addNew(row) {
166
- console.log("add")
167
- const $table = this.$refs.vexGridRef
168
- const record = {}
169
- const {row: newRow} = await $table.insertAt(record, row)
170
- console.log(row,newRow)
171
- await $table.setEditCell(newRow, this.columns[2].COLUMN_NAME)
172
- },
173
- remove(row) {
174
- let params = {
175
- "_DbName_": this.form.datasource,
176
- "_TableName_": this.form.tableName
177
- };
178
- for (let column of this.$attrs.columns) {
179
- if (column.is_pk == 1) {
180
- params[column.COLUMN_NAME] = row[column.COLUMN_NAME];
181
- }
182
- }
183
- if (Object.keys(params).length == 0) {
184
- this.$message.error("保存失败,数据表没有唯一键!");
185
- return false;
186
- }
187
-
188
- post(this.http, '/online/asyncDb/data/remove/', params).then(res => {
189
- if (res) {
190
- this.query();
191
- }
192
- }).finally(() => {
193
- row.loading = false;
194
- })
195
- },
196
- add(row) {
197
- let is_pk = this.$attrs.columns.filter(o => o.is_pk == 1).map(o => o.COLUMN_NAME);
198
- var parse = JSON.parse(JSON.stringify(row));
199
- delete parse._X_ROW_KEY;
200
- delete parse.resp_Data_UUID;
201
- for (let key of is_pk) {
202
- if (key.toLowerCase() == 'id') {
203
- parse[key] = new Date().getTime()
204
- }
205
- }
206
- this.$table.insertAt(parse, row).then((e) => {
207
- this.$table.setEditCell(e.row, is_pk.length != 0 ? is_pk[0] : this.$attrs.columns[0].COLUMN_NAME)
208
- })
209
-
210
- },
211
- keydown({$event}) {
212
- if ($event.key == "Enter") {
213
- this.query();
214
- }
215
- },
216
- hasUpdateStatus(row) {
217
- if (this.$table) {
218
- return this.$table.isUpdateByRow(row) || this.$table.isInsertByRow(row)
219
- }
220
- },
221
- doSaveUpdate(row, type, params) {
222
- row.loading = true;
223
- post(this.http, '/online/asyncDb/data/' + type, params).then(res => {
224
- if (res) {
225
- this.query();
226
- }
227
- }).finally(() => {
228
- row.loading = false;
229
- })
230
- },
231
- setUpdateParams(row, params) {
232
- let whereMap = {};
233
- for (let column of this.$attrs.columns) {
234
- if (column.is_pk == 1) {
235
- whereMap[column.COLUMN_NAME] = row[column.COLUMN_NAME];
236
- }
237
- }
238
- if (Object.keys(whereMap).length == 0) {
239
- this.$message.error("保存失败,数据表没有唯一键!");
240
- return false;
241
- }
242
- let columnAndValueMap = {};
243
- for (let key of Object.keys(row)) {
244
- let updateByRow = this.$table.isUpdateByRow(row, key);
245
- if (updateByRow) {
246
- columnAndValueMap[key] = row[key];
247
- }
248
- }
249
- params.columnAndValueMap = columnAndValueMap;
250
- params.whereMap = whereMap;
251
- return true;
252
- },
253
- saveUpdateEvent(row) {
254
- let insertByRow = this.$table.isInsertByRow(row);
255
- var parse = JSON.parse(JSON.stringify(row));
256
- delete parse._X_ROW_KEY;
257
- delete parse.resp_Data_UUID;
258
- let params = {
259
- tableName: this.form.tableName,
260
- dbName: this.form.datasource
261
- }
262
- if (insertByRow) {
263
- let columnAndValueMap = {};
264
- for (let key of Object.keys(parse)) {
265
- let rowElement = parse[key];
266
- if (rowElement != undefined && rowElement != '') {
267
- columnAndValueMap[key] = parse[key];
268
- }
269
- }
270
- params.columnAndValueMap = columnAndValueMap;
271
- } else {
272
- let bool = this.setUpdateParams(row, params)
273
- if (!bool) {
274
- return;
275
- }
276
- }
277
- this.doSaveUpdate(insertByRow ? parse : row, insertByRow ? 'save' : 'modify', params);
278
-
279
- },
280
- query() {
281
- let orderByStr = '';
282
- let queryParameterListAnd = [];
283
- for (let column of this.$attrs.columns) {
284
- if (!column.children) {
285
- continue
286
- }
287
- let fvo = column.children[0].children[0];
288
- fvo.search = false;
289
- fvo.searchContent = '';
290
- if (!fvo.visible) {
291
- continue;
292
- }
293
- if (column.params.asc) {
294
- orderByStr = this.getNext(orderByStr, column.COLUMN_NAME + " ASC ")
295
- } else if (column.params.desc) {
296
- orderByStr = this.getNext(orderByStr, column.COLUMN_NAME + " DESC ")
297
- }
298
- if (fvo.params.time || fvo.params.range) {
299
- if (fvo.params.start.toString().trim()) {
300
-
301
- queryParameterListAnd.push({
302
- key: column.COLUMN_NAME,
303
- value: fvo.params.start,
304
- type: 5,
305
- })
306
- fvo.search = true;
307
- fvo.searchContent += column.COLUMN_NAME + " >= " + (fvo.params.time ? dateFormat(fvo.params.start) : fvo.params.start) + " ";
308
- }
309
- if (fvo.params.end.toString().trim()) {
310
- queryParameterListAnd.push({
311
- key: column.COLUMN_NAME,
312
- value: fvo.params.end,
313
- type: 6,
314
- })
315
- fvo.search = true;
316
- fvo.searchContent += column.COLUMN_NAME + " <= " + (fvo.params.time ? dateFormat(fvo.params.end) : fvo.params.end) + " ";
317
- }
318
- } else {
319
- if (fvo.params.value.toString().trim()) {
320
- queryParameterListAnd.push({
321
- key: column.COLUMN_NAME,
322
- value: fvo.params.value,
323
- type: 8,
324
- })
325
- fvo.search = true;
326
- fvo.searchContent = column.COLUMN_NAME + " like %" + fvo.params.value + "%" + " ";
327
- }
328
- }
329
- }
330
- let params = {
331
- dbName: this.form.datasource,
332
- tableName: this.form.tableName,
333
- queryParameterListAnd: queryParameterListAnd,
334
- orderByStr: orderByStr,
335
- pageNumber: this.pagination.currentPage,
336
- pageSize: this.pagination.pageSize
337
- }
338
- this.table.loading = true;
339
- post(this.http, "/online/asyncDb/getData", params, false, false).then(({data, msg}) => {
340
- let field = '';
341
- for (let column of this.$attrs.columns) {
342
- if (!column.children) {
343
- continue;
344
- }
345
- if (column.children[0].children[0].visible) {
346
- if (field.length > 0) {
347
- field += ",";
348
- }
349
- field += column.COLUMN_NAME;
350
- }
351
- }
352
- let indexOf = msg.toString().toLowerCase().indexOf(" from ");
353
- this.sql = "SELECT " + field + msg.substring(indexOf);
354
- let respData = (data instanceof Array) ? data : data.listData;
355
- let COLUMN_NAME = this.$attrs.columns.map(o => o.COLUMN_NAME).filter(item => item !== "" && item !== null && item !== undefined);
356
-
357
- for (let respDatum of respData) {
358
- respDatum.resp_Data_UUID = true;
359
- for (let i = COLUMN_NAME.length - 1; i >= 0; i--) {
360
- let k = COLUMN_NAME[i];
361
- if (respDatum[k] != undefined) {
362
- COLUMN_NAME.splice(i, 1); // 从后向前删除偶数
363
- }
364
- }
365
- }
366
- for (let column of this.$attrs.columns) {
367
- if (COLUMN_NAME.indexOf(column.COLUMN_NAME) != -1) {
368
- column.children[0].children[0].isNull = true;
369
- } else if (column.children) {
370
- column.children[0].children[0].isNull = false;
371
- }
372
- }
373
- if (COLUMN_NAME.length > 0) {
374
- this.$table.reloadColumn(this.$attrs.columns)
375
- }
376
- this.table.data = respData
377
- this.pagination.total = data.count;
378
- }).finally(() => {
379
- this.table.loading = false;
380
- })
381
-
382
- },
383
- getNext(str, str2) {
384
- if (str.trim().length != 0) {
385
- str += ",";
386
- }
387
- return str + str2;
388
- },
389
- clearSortEvent(field) {
390
- if (this.$table) {
391
- this.$table.clearSort(field)
392
- }
393
- },
394
- sortChange({field, order}) {
395
- for (const col of this.$attrs.columns) {
396
- if (col.field == field) {
397
- if (col.params.desc == true || col.params.asc == true) {
398
- this.clearSortEvent(field)
399
- col.params.desc = false
400
- col.params.asc = false
401
- break
402
- }
403
- col.params.desc = order == 'desc'
404
- col.params.asc = order == 'asc'
405
- break
406
- }
407
- }
408
- this.query()
409
- },
410
- init(o) {
411
- this.form = o;
412
- /*this.updateSort()
413
- this.$nextTick(() => {
414
- this.query()
415
- })*/
416
- },
417
- updateSort() {
418
- this.$nextTick(() => {
419
- //el绑定元素需要找到vxe的DOM下的tbody元素
420
- Sortable.create(this.$table.$el.querySelector('.body--wrapper>.vxe-table--header .vxe-header--row'),
421
- {
422
- filter: '.col--fixed',
423
- handle: '.vxe-header--column',
424
- onEnd: ({newIndex, oldIndex}) => {
425
- let tableColumn = JSON.parse(JSON.stringify(this.$table.getColumns()));
426
- let newColumn = tableColumn[newIndex];
427
- let oldColumn = tableColumn[oldIndex];
428
- for (let i = 0; i < this.$attrs.columns.length; i++) {
429
- let column = this.$attrs.columns[i];
430
- if (oldColumn.field == column.field) {
431
- oldIndex = i;
432
- } else if (newColumn.field == column.field) {
433
- newIndex = i;
434
- }
435
- }
436
- let columns = this.$attrs.columns;
437
-
438
- this.$table.loadColumn([]);
439
- let spliceElement = columns.splice(oldIndex, 1)[0];
440
- columns.splice(newIndex, 0, spliceElement);
441
- this.$attrs.columns = columns;
442
- this.$nextTick(() => {
443
- this.$table.loadColumn(this.$attrs.columns);
444
- this.$emit('updateColumn')
445
- })
446
-
447
- }
448
- })
449
- })
450
- },
451
- },
452
- created() {
453
- this.pagination.pageSizes = [50, 100, 500, 1000, 2000, 5000];
454
- },
455
- computed: {
456
- $table() {
457
- return this.$refs['vexGridRef']
458
- }
459
- },
460
- }
461
- </script>
462
- <style scoped>
463
- .vxe-body--column {
464
- height: 25px !important;
465
- }
466
- </style>
@@ -1,137 +0,0 @@
1
- <template>
2
- <div style="height: 90vh">
3
- <vxe-grid v-bind="gridOptions1" ref="table" show-footer :footer-method="footerMethod">
4
- <template #header_right>
5
- <vxe-button @click="zoomEvent" circle>
6
- <i class="vxe-icon-fullscreen" v-if="!isMaximized" title="全屏"/>
7
- <i class=" vxe-icon-minimize" title="取消全屏" v-else/>
8
- </vxe-button>
9
- <vxe-button icon="vxe-icon-refresh" @click="query" title="刷新" circle></vxe-button>
10
- <vxe-button icon="vxe-icon-setting-fill" @click="$refs.tableColumnConfig.open(gridOptions1.columns)"
11
- title="设置" circle></vxe-button>
12
- </template>
13
- </vxe-grid>
14
- <table-column-config ref="tableColumnConfig"></table-column-config>
15
- </div>
16
- </template>
17
-
18
- <script>
19
- import data from "@/data";
20
- import {groupAndCompute} from "@/utils/groupCompute";
21
- import TableColumnConfig from "@/views/groupTable/ol-table-column-config/index.vue";
22
- import http from "@/utils/http/httpUtil";
23
-
24
- export default {
25
- name: 'groupTable',
26
- components: {TableColumnConfig},
27
- data() {
28
- return {
29
- gridOptions1: data(),
30
- isMaximized: false,
31
- dataSource: [],
32
- }
33
- }, provide() {
34
- return {
35
- gridOptions1: this.gridOptions1
36
- }
37
- },
38
- methods: {
39
- refresh() {
40
- this.$refs.table.reloadColumn(this.gridOptions1.columns);
41
- let groupKey = [];
42
- let comValue = [];
43
- for (let column of this.gridOptions1.columns) {
44
- if (column.visible && column.group) {
45
- groupKey.push(column.field)
46
- }
47
- if (column.computes) {
48
- comValue.push(column.field + ":" + column.computes)
49
- }
50
- }
51
- let datas = groupAndCompute(groupKey, comValue, this.dataSource)
52
- console.log(datas)
53
- this.gridOptions1.data = datas;
54
- },
55
- sumNum(list, field) {
56
- let count = 0
57
- list.forEach(item => {
58
- count += Number(item[field])
59
- })
60
- return count
61
- },
62
- maxOrMin(list, field, max) {
63
- let count = max ? -9999999 : 9999999;
64
- data.forEach(item => {
65
- let n = Number(item[field]);
66
- if (max) {
67
- if (count < n) {
68
- count = n;
69
- }
70
- } else {
71
- if (count > n) {
72
- count = n;
73
- }
74
- }
75
- })
76
- return count;
77
- },
78
- footerMethod() {
79
- const footerData = [
80
- this.gridOptions1.columns.map((column, _columnIndex) => {
81
- if (_columnIndex === 0) {
82
- return '合计'
83
- }
84
- console.log(column.footer)
85
- if (column.footer) {
86
- let operation = column.footer;
87
- console.log(column)
88
- if (operation.toLowerCase() == 'avg') {
89
- return this.sumNum(this.gridOptions1.data, column.field) / this.gridOptions1.data.length
90
- } else if (operation.toLowerCase() == 'sum') {
91
- return this.sumNum(this.gridOptions1.data, column.field)
92
- } else if (operation.toLowerCase() == 'max') {
93
- return this.maxOrMin(this.gridOptions1.data, column.field, true)
94
- } else if (operation.toLowerCase() == 'min') {
95
- return this.maxOrMin(this.gridOptions1.data, column.field, false)
96
- }
97
- }
98
- return null
99
- })
100
- ]
101
- return footerData
102
- },
103
- query() {
104
- this.dataSource = JSON.parse(JSON.stringify(this.gridOptions1.data))
105
- },
106
- zoomEvent() {
107
-
108
- }
109
- },
110
- created() {
111
- this.$nextTick(() => {
112
- this.gridOptions1.refresh = this.refresh;
113
- })
114
- this.query();
115
- }
116
- }
117
- </script>
118
- <style lang="less" scoped>
119
- .table-right {
120
- position: relative;
121
- float: left;
122
- width: calc(100% - 315px);
123
- height: 100%;
124
- }
125
-
126
- .tree-left {
127
- height: 100%;
128
- position: relative;
129
- float: left;
130
- margin-right: 10px;
131
- z-index: 100;
132
-
133
- /deep/ .el-card__body {
134
- height: 100%;
135
- }
136
- }
137
- </style>