imatrix-ui 0.0.15 → 0.1.1-up

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/.vscode/extensions.json +3 -0
  2. package/README.md +7 -0
  3. package/components/dynamic-source-select/dynamic-source-select-service.js +106 -0
  4. package/components/dynamic-source-select/dynamic-source-select.vue +673 -0
  5. package/components/dynamic-source-select/events.js +77 -0
  6. package/components/fs-preview/fs-preview.vue +287 -0
  7. package/components/index.js +26 -0
  8. package/components/plugins/export-data-new.js +623 -0
  9. package/components/plugins/export-data.js +431 -0
  10. package/components/plugins/index.js +15 -0
  11. package/components/plugins/public-method.js +47 -0
  12. package/components/rich-editor/index-bak.vue +306 -0
  13. package/components/rich-editor/index.vue +236 -0
  14. package/components/rich-editor/langs/zh-Hans.js +438 -0
  15. package/components/rich-editor/viewer.vue +105 -0
  16. package/components/super-grid/apis.js +1065 -0
  17. package/components/super-grid/columns-config.vue +430 -0
  18. package/components/super-grid/custom-formatter.js +330 -0
  19. package/components/super-grid/dynamic-input.vue +1706 -0
  20. package/components/super-grid/eventBus.js +2 -0
  21. package/components/super-grid/events.js +56 -0
  22. package/components/super-grid/formValidatorUtil.js +300 -0
  23. package/components/super-grid/formatter.js +190 -0
  24. package/components/super-grid/group-column.vue +100 -0
  25. package/components/super-grid/header-context-menu.vue +82 -0
  26. package/components/super-grid/index-column.vue +69 -0
  27. package/components/super-grid/normal-column.vue +1148 -0
  28. package/components/super-grid/public-methods.js +30 -0
  29. package/components/super-grid/row-operation.vue +193 -0
  30. package/components/super-grid/search-button.vue +74 -0
  31. package/components/super-grid/search-condition-input.vue +73 -0
  32. package/components/super-grid/search-condition-list.vue +68 -0
  33. package/components/super-grid/search-form-advancedQuery.vue +820 -0
  34. package/components/super-grid/search-form-dialog.vue +77 -0
  35. package/components/super-grid/search-form-item.vue +470 -0
  36. package/components/super-grid/search-form-number.vue +111 -0
  37. package/components/super-grid/search-form-open.vue +178 -0
  38. package/components/super-grid/search-form-ordinarySearch.vue +218 -0
  39. package/components/super-grid/search-form.vue +756 -0
  40. package/components/super-grid/search-methods.js +484 -0
  41. package/components/super-grid/selection-column.vue +46 -0
  42. package/components/super-grid/store.js +3 -0
  43. package/components/super-grid/super-grid-service.js +682 -0
  44. package/components/super-grid/super-grid.vue +2893 -0
  45. package/components/super-grid/utils.js +851 -0
  46. package/components/super-grid/view-image-dialog.vue +173 -0
  47. package/components/utils/gogocodeTransfer.js +59 -0
  48. package/components/utils/utils.js +180 -0
  49. package/components/utils/value-set.js +98 -0
  50. package/components/z-test-utton/index.vue +82 -0
  51. package/package.json +29 -40
  52. package/public/index.html +13 -0
  53. package/public/vite.svg +1 -0
  54. package/src/api/sso-service.js +172 -19
  55. package/src/api/tab.js +36 -0
  56. package/src/api/user-service.js +11 -11
  57. package/src/assets/401/401.gif +0 -0
  58. package/src/assets/404/404-cloud.png +0 -0
  59. package/src/assets/404/404.png +0 -0
  60. package/src/assets/cloud.png +0 -0
  61. package/src/directives/permission/index.js +13 -13
  62. package/src/directives/permission/permission.js +20 -15
  63. package/src/i18n/i18n.js +16 -0
  64. package/src/i18n/langs/cn.js +254 -0
  65. package/src/i18n/langs/en.js +264 -0
  66. package/src/permission.js +157 -71
  67. package/src/plugins.js +18 -18
  68. package/src/router/index.js +96 -69
  69. package/src/store/getters.js +15 -10
  70. package/src/store/index.js +19 -19
  71. package/src/store/modules/app.js +54 -42
  72. package/src/store/modules/permission.js +137 -73
  73. package/src/store/modules/tab-content.js +36 -0
  74. package/src/store/modules/user.js +293 -80
  75. package/src/styles/display-layout.scss +34 -0
  76. package/src/styles/element-ui.scss +29 -29
  77. package/src/styles/index.scss +157 -78
  78. package/src/styles/mixin.scss +27 -27
  79. package/src/styles/theme/black/font-style.scss +70 -0
  80. package/src/styles/theme/black/index.scss +306 -0
  81. package/src/styles/theme/black/sidebar.scss +189 -0
  82. package/src/styles/theme/blue/font-style.scss +46 -0
  83. package/src/styles/theme/blue/index.scss +172 -0
  84. package/src/styles/{sidebar.scss → theme/blue/sidebar.scss} +171 -141
  85. package/src/styles/theme/blue2/font-style.scss +70 -0
  86. package/src/styles/theme/blue2/index.scss +188 -0
  87. package/src/styles/theme/blue2/sidebar.scss +201 -0
  88. package/src/styles/theme/dark-blue/button.scss +9 -0
  89. package/src/styles/theme/dark-blue/card.scss +62 -0
  90. package/src/styles/theme/dark-blue/checkbox.scss +10 -0
  91. package/src/styles/theme/dark-blue/dark-blue-var.scss +8 -0
  92. package/src/styles/theme/dark-blue/dialog.scss +21 -0
  93. package/src/styles/theme/dark-blue/element-variables.scss +7 -0
  94. package/src/styles/theme/dark-blue/font.scss +71 -0
  95. package/src/styles/theme/dark-blue/form.scss +51 -0
  96. package/src/styles/theme/dark-blue/index.scss +269 -0
  97. package/src/styles/theme/dark-blue/input.scss +15 -0
  98. package/src/styles/theme/dark-blue/message.scss +8 -0
  99. package/src/styles/theme/dark-blue/pagination.scss +14 -0
  100. package/src/styles/theme/dark-blue/scrollbar-style.scss +32 -0
  101. package/src/styles/theme/dark-blue/sidebar.scss +266 -0
  102. package/src/styles/theme/dark-blue/tab.scss +83 -0
  103. package/src/styles/theme/dark-blue/table.scss +60 -0
  104. package/src/styles/theme/dark-blue/tree.scss +31 -0
  105. package/src/styles/theme/dark-blue/var.scss +1028 -0
  106. package/src/styles/theme/gray/card-style.scss +54 -0
  107. package/src/styles/theme/gray/font-style.scss +70 -0
  108. package/src/styles/theme/gray/index.scss +172 -0
  109. package/src/styles/theme/gray/input-style.scss +19 -0
  110. package/src/styles/theme/gray/scrollbar-style.scss +32 -0
  111. package/src/styles/theme/gray/sidebar.scss +231 -0
  112. package/src/styles/theme/gray/tab-style.scss +81 -0
  113. package/src/styles/transition.scss +47 -46
  114. package/src/utils/auth-api.js +159 -0
  115. package/src/utils/auth.js +61 -15
  116. package/src/utils/calculator/calculator-factory-wf.js +558 -0
  117. package/src/utils/calculator/calculator-factory.js +145 -0
  118. package/src/utils/calculator/calculator-util.js +166 -0
  119. package/src/utils/common-util.js +305 -0
  120. package/src/utils/eventBus.js +2 -0
  121. package/src/utils/iconUtils.js +28 -0
  122. package/src/utils/index.js +102 -86
  123. package/src/utils/jump-page-utils.js +814 -0
  124. package/src/utils/local-storage.js +33 -31
  125. package/src/utils/menu.js +19 -0
  126. package/src/utils/permission.js +31 -26
  127. package/src/utils/permissionAuth.js +90 -0
  128. package/src/utils/range-selector.js +188 -0
  129. package/src/utils/request.js +270 -116
  130. package/src/utils/restful-interface-utils.js +57 -0
  131. package/src/utils/util.js +698 -0
  132. package/src/utils/validate.js +34 -33
  133. package/src/utils/watermark.js +108 -0
  134. package/src/utils/workflow-util.js +93 -0
  135. package/src/views/404.vue +248 -228
  136. package/src/views/dsc-component/Sidebar/Item.vue +84 -0
  137. package/src/views/dsc-component/Sidebar/Link.vue +38 -0
  138. package/src/views/dsc-component/Sidebar/SidebarItem.vue +196 -0
  139. package/src/views/dsc-component/Sidebar/index.vue +220 -0
  140. package/src/views/dsc-component/tabs/tab-content.vue +199 -0
  141. package/src/views/error-page/401.vue +106 -91
  142. package/src/views/error-page/404.vue +248 -228
  143. package/src/views/layout/EmptyLayout.vue +3 -0
  144. package/src/views/layout/Layout.vue +81 -68
  145. package/src/views/layout/NewLayout.vue +18 -0
  146. package/src/views/layout/components/AppMain.vue +39 -29
  147. package/src/views/layout/components/Breadcrumb/index.vue +156 -0
  148. package/src/views/layout/components/Menubar/Item.vue +57 -0
  149. package/src/views/layout/components/Menubar/Link.vue +38 -0
  150. package/src/views/layout/components/Menubar/SidebarItem.vue +164 -0
  151. package/src/views/layout/components/Menubar/index.vue +210 -0
  152. package/src/views/layout/components/Sidebar/Item.vue +53 -29
  153. package/src/views/layout/components/Sidebar/Link.vue +38 -39
  154. package/src/views/layout/components/Sidebar/SidebarItem.vue +135 -100
  155. package/src/views/layout/components/Sidebar/index.vue +141 -48
  156. package/src/views/layout/components/iframe-page.vue +38 -0
  157. package/src/views/layout/components/index.js +4 -3
  158. package/src/views/layout/components/tabs/tab-content.vue +207 -0
  159. package/src/views/layout/mixin/ResizeHandler.js +41 -41
  160. package/src/views/layout/tab-content-iframe-index.vue +38 -0
  161. package/src/views/layout/tab-content-index.vue +93 -0
  162. package/src/views/login/authredirect.vue +10 -10
  163. package/src/views/login/index.vue +296 -203
  164. package/src/views/login/update-password.vue +243 -0
  165. package/src/views/redirect/index.vue +14 -12
  166. package/src/views/wf-history/tache-subprocess-history.vue +45 -0
  167. package/vite.config.js +31 -0
  168. package/lib/super-ui.css +0 -1
  169. package/lib/super-ui.umd.min.js +0 -2
  170. package/src/styles/variables.scss +0 -4
  171. package/src/views/layout/components/Navbar.vue +0 -92
@@ -0,0 +1,2893 @@
1
+ <template>
2
+ <div>
3
+ <search-form
4
+ v-if="
5
+ !isFormSubTable &&
6
+ hasLoadedColumns &&
7
+ query &&
8
+ query.showType === 'embedded'
9
+ "
10
+ ref="sf"
11
+ :columns="columns"
12
+ :code="code"
13
+ :url="url"
14
+ :pagination="pagination"
15
+ :query="query"
16
+ :search-form-info="searchFormInfo"
17
+ :search-param="searchFormContent"
18
+ :init-search-props="initSearchProps"
19
+ :list-toolbar-form-data="listToolbarFormData"
20
+ @search="doSearch"
21
+ @reset="resetSearch"
22
+ @open-fold="openFold"
23
+ />
24
+ <search-form-dialog
25
+ v-if="hasLoadedColumns && query && query.showType === 'popup'"
26
+ ref="sfDialog"
27
+ :columns="columns"
28
+ :code="code"
29
+ :url="url"
30
+ :pagination="pagination"
31
+ :query="query"
32
+ :search-param="searchFormContent"
33
+ :init-search-props="initSearchProps"
34
+ @search="doSearchDialog"
35
+ @reset="resetSearch"
36
+ @close="closeSearchFormDialog"
37
+ />
38
+ <div :class="'grid-area ' + code">
39
+ <el-table
40
+ v-if="refreshGrid && hasLoadedColumns"
41
+ ref="superGrid"
42
+ :data="gridData"
43
+ :row-key="getRowKeyProp"
44
+ :show-summary="showSummary"
45
+ :summary-method="getSummaries"
46
+ style="width: 100%"
47
+ :stripe="stripe"
48
+ :border="true"
49
+ :default-expand-all="defaultExpandAll"
50
+ :lazy="isLazy"
51
+ :load="loadChildren"
52
+ :row-style="changeRowStyle"
53
+ :cell-style="changeCellStyle"
54
+ :header-cell-style="changeHeaderStyle"
55
+ :highlight-current-row="true"
56
+ :span-method="rowSpan"
57
+ :max-height="maxHeight"
58
+ :height="height"
59
+ class="elTable"
60
+ :tree-props="getTreeProps(parentProp, isSql, isLazy, dataSourceType)"
61
+ @sort-change="handleSortChange"
62
+ @select="select"
63
+ @select-all="selectAll"
64
+ @row-click="rowClickEvent"
65
+ @row-dblclick="rowDblclickEvent"
66
+ @expand-change="expandChange"
67
+ @header-click="headerClick"
68
+ @header-dragend="changeHederWidth"
69
+ @header-contextmenu="headerContextmenu"
70
+ @cell-click="selectCell"
71
+ >
72
+ <template v-if="myCustomFormatter">
73
+ <component
74
+ :is="getComponentType(column.prop)"
75
+ v-for="(column, index) in visibleColumns"
76
+ :ref="column.prop"
77
+ :key="column.label + index"
78
+ :column="column"
79
+ :is-sql="isSql"
80
+ :list-code="code"
81
+ :custom-format="
82
+ getComponentType(column.prop) === 'GroupColumn'
83
+ ? myCustomFormatter
84
+ : myCustomFormatter[column.prop]
85
+ "
86
+ :new-width="newWidth"
87
+ :drag-column-prop="dragColumnProp"
88
+ :right-click-menu-arr="options.rightClickMenuArr"
89
+ :table-name="tableName"
90
+ :page-code="pageCode"
91
+ :list-name="listName"
92
+ :options="options"
93
+ :pagination="pagination"
94
+ :current-page="currentPage"
95
+ :grid-data="isSubTableShowPage ? subTableData : gridData"
96
+ :page-grid-data="
97
+ isSubTableShowPage ? getSubTableGridData(subTableData) : gridData
98
+ "
99
+ @open-page="openPageDialog"
100
+ @refresPortData="refresPortData"
101
+ @refresPortsData="refresPortsData"
102
+ @refresMainTableFields="refresMainTableFields"
103
+ @prohibitToEdit="prohibitToEdit"
104
+ />
105
+ </template>
106
+ <template v-else>
107
+ <component
108
+ :is="getComponentType(column.prop)"
109
+ v-for="(column, index) in visibleColumns"
110
+ :ref="column.prop"
111
+ :key="column.label + index"
112
+ :is-sql="isSql"
113
+ :column="column"
114
+ :list-code="code"
115
+ :is-line-edit="lineEdit !== null && lineEdit.editable"
116
+ :new-width="newWidth"
117
+ :drag-column-prop="dragColumnProp"
118
+ :right-click-menu-arr="options.rightClickMenuArr"
119
+ :table-name="tableName"
120
+ :page-code="pageCode"
121
+ :list-toolbar-form-data="listToolbarFormData"
122
+ :list-name="listName"
123
+ :options="options"
124
+ :current-page="currentPage"
125
+ :pagination="pagination"
126
+ :grid-data="isSubTableShowPage ? subTableData : gridData"
127
+ :page-grid-data="
128
+ isSubTableShowPage ? getSubTableGridData(subTableData) : gridData
129
+ "
130
+ @open-page="openPageDialog"
131
+ @refresData="refresData"
132
+ @refresPortData="refresPortData"
133
+ @refresPortsData="refresPortsData"
134
+ @refresMainTableFields="refresMainTableFields"
135
+ @prohibitToEdit="prohibitToEdit"
136
+ />
137
+ </template>
138
+ </el-table>
139
+ <div v-if="showPagination" style="position: relative; margin-top: 5px">
140
+ <el-row>
141
+ <!-- <el-col
142
+ v-if="
143
+ !(
144
+ typeof options.isAdministerListView !== 'undefined' &&
145
+ options.isAdministerListView != null &&
146
+ options.isAdministerListView === true
147
+ )
148
+ "
149
+ :span="2"
150
+ > -->
151
+ <el-icon style="float: left; padding: 10px 0px; color: #777"
152
+ ><el-icon-setting
153
+ /></el-icon>
154
+ <el-icon style="float: left; padding: 10px 0px; color: #777"
155
+ ><el-icon-refresh
156
+ /></el-icon>
157
+ <!-- </el-col> -->
158
+ <el-col
159
+ :span="
160
+ !(
161
+ typeof options.isAdministerListView !== 'undefined' &&
162
+ options.isAdministerListView != null &&
163
+ options.isAdministerListView === true
164
+ )
165
+ ? 22
166
+ : 24
167
+ "
168
+ >
169
+ <el-pagination
170
+ v-if="pagination && isShowPage"
171
+ background
172
+ v-model:current-page="currentPage"
173
+ :page-sizes="pagination.pageSizes"
174
+ :page-size="pagination.pageSize"
175
+ :layout="pagination.layout"
176
+ :total="pagination.total"
177
+ @size-change="handleSizeChange"
178
+ @current-change="handleCurrentChange"
179
+ />
180
+ </el-col>
181
+ </el-row>
182
+ </div>
183
+ </div>
184
+
185
+ <columns-config
186
+ v-if="showColumnConfig"
187
+ :columns="columns"
188
+ :list-code="code"
189
+ :is-sql="isSql"
190
+ @close="closeCustomConfig($event)"
191
+ @reset="resetCustomConfig($event)"
192
+ />
193
+ <header-context-menu
194
+ v-show="showHeaderContextmenu"
195
+ ref="headerMenu"
196
+ :buttom-arr="options.rightClickMenuArr"
197
+ :column="rightClickColumn"
198
+ @clearHeaderContextmenu="clearHeaderContextmenu"
199
+ />
200
+ <super-page-dialog
201
+ v-if="isShowPageDialog"
202
+ :dev-mode="pageDevMode"
203
+ :jump-page-setting="jumpPageSetting"
204
+ :source-page-code="pageCode"
205
+ @close="closePageDialog"
206
+ @update-value="updateValues"
207
+ />
208
+ </div>
209
+ </template>
210
+
211
+ <script>
212
+ import {
213
+ Setting as ElIconSetting,
214
+ Refresh as ElIconRefresh,
215
+ } from '@element-plus/icons'
216
+ import { $on, $off, $once, $emit } from '../utils/gogocodeTransfer'
217
+ import IndexColumn from './index-column.vue'
218
+ import SelectionColumn from './selection-column.vue'
219
+ import NormalColumn from './normal-column.vue'
220
+ import GroupColumn from './group-column.vue'
221
+ import ColumnsConfig from './columns-config.vue'
222
+ import SearchForm from './search-form.vue'
223
+ import searchFormDialog from './search-form-dialog.vue'
224
+ import { setEntityFieldValue } from '../../src/utils/util'
225
+ import eventBus from './eventBus'
226
+ import {
227
+ getSpanValuesForColumn,
228
+ getFirstEditableColumn,
229
+ getGridParams,
230
+ getTableHeight,
231
+ isObjectValueEqual,
232
+ isHasEditOption,
233
+ isHasOptionFunction,
234
+ isCanRefreshGrid,
235
+ isEditOptionFunction,
236
+ getExtraParam,
237
+ getLastPageNum,
238
+ } from './utils'
239
+ import Sortable from 'sortablejs'
240
+ import store from './store'
241
+ import events from './events'
242
+ import publicMethods from './public-methods'
243
+ import superGridService from './super-grid-service'
244
+ import formValidatorService from './formValidatorUtil'
245
+ import { getSystemCode } from '../../src/utils/permissionAuth'
246
+ import apis from './apis'
247
+ import headerContextMenu from './header-context-menu.vue'
248
+ import { addDynamicProp } from './utils'
249
+ import { updateWithPageValue } from '../../src/utils/jump-page-utils'
250
+ import { getEntityFieldValueWithOutCase } from '../../src/utils/util'
251
+ import { checkPermission } from '../../src/utils/permission'
252
+ import * as Vue from 'vue'
253
+ export default {
254
+ components: {
255
+ IndexColumn,
256
+ SelectionColumn,
257
+ NormalColumn,
258
+ GroupColumn,
259
+ ColumnsConfig,
260
+ SearchForm,
261
+ headerContextMenu,
262
+ searchFormDialog,
263
+ ElIconSetting,
264
+ ElIconRefresh,
265
+ },
266
+ name: 'SuperGrid',
267
+ props: {
268
+ code: {
269
+ type: String,
270
+ default: '',
271
+ },
272
+ url: {
273
+ type: String,
274
+ default: '',
275
+ },
276
+ options: {
277
+ type: Object,
278
+ default: function () {
279
+ return {}
280
+ },
281
+ },
282
+ // 为了兼容平台的旧写法,暂不删除以下属性
283
+ // 操作列、占位符列内容显示的函数,格式为:{'属性名':方法},例如:{'name':viewUser,'operation':showOperation}
284
+ customFormatter: {
285
+ type: Object,
286
+ default: null,
287
+ },
288
+ searchFormInfo: {
289
+ type: Object,
290
+ default: () => {
291
+ return {}
292
+ },
293
+ },
294
+ // 是否显示分页器
295
+ showPagination: {
296
+ type: Boolean,
297
+ default: true,
298
+ },
299
+ listToolbarFormData: {
300
+ type: Object,
301
+ default: null,
302
+ },
303
+ },
304
+ data() {
305
+ let parentProp
306
+ const parentPropSetting = this.options.parentProp
307
+ if (
308
+ typeof parentPropSetting !== 'undefined' &&
309
+ parentPropSetting !== '' &&
310
+ parentPropSetting !== null
311
+ ) {
312
+ parentProp = parentPropSetting
313
+ }
314
+ let mergeFields = []
315
+ if (
316
+ this.options &&
317
+ this.options.mergeFields &&
318
+ this.options.mergeFields !== ''
319
+ ) {
320
+ mergeFields = this.options.mergeFields.split(',')
321
+ }
322
+ let optionTableHeight
323
+ if (
324
+ this.options &&
325
+ this.options.optionTableHeight &&
326
+ this.options.optionTableHeight !== ''
327
+ ) {
328
+ optionTableHeight = this.options.optionTableHeight
329
+ }
330
+ let pageCode
331
+ if (this.options && this.options.pageCode) {
332
+ pageCode = this.options.pageCode
333
+ }
334
+ let pageHeight
335
+ if (this.options && this.options.pageHeight) {
336
+ pageHeight = this.options.pageHeight
337
+ }
338
+ let isLazy = true
339
+ if (this.options && this.options.lazy !== undefined) {
340
+ isLazy = this.options.lazy
341
+ }
342
+ let defaultExpandAll = true
343
+ if (this.options && this.options.defaultExpandAll !== undefined) {
344
+ defaultExpandAll = this.options.defaultExpandAll
345
+ }
346
+ // 数据库类型,值为mysql、oracle、sqlserver,默认是mysql,树形表格时需要使用
347
+ let dataSourceType = 'mysql'
348
+ if (window.$vueApp.config.globalProperties.dataSourceType) {
349
+ dataSourceType =
350
+ window.$vueApp.config.globalProperties.dataSourceType.toLowerCase()
351
+ }
352
+ let pageDevMode = this.options.pageDevMode
353
+ if (pageDevMode === undefined) {
354
+ pageDevMode = false
355
+ }
356
+ return {
357
+ isLoading: false,
358
+ currentPage: 1,
359
+ showColumnConfig: false,
360
+ basicInfo: {
361
+ summary: 'no',
362
+ },
363
+ columns: [],
364
+ pagination: null,
365
+ query: null,
366
+ lineEdit: null,
367
+ gridData: [],
368
+ summaries: null,
369
+ sortInfo: null,
370
+ pageSize: null,
371
+ showSearch: false,
372
+ myCustomFormatter: null,
373
+ height: null,
374
+ timer: null,
375
+ timer2: null,
376
+ isSql: false, // 是否是sql查询
377
+ parentProp, // 树状结构数据时,父字段名,默认是id
378
+ hasLoadData: false,
379
+ mergeFields,
380
+ newWidth: null,
381
+ dragColumnProp: null,
382
+ hasLoadedColumns: false, // 是否已经加载了列配置
383
+ backgroundColorMap: {},
384
+ showHeaderContextmenu: false,
385
+ rightClickColumn: null,
386
+ externalClickFlag: false, // 是否是外部点击
387
+ dataTableCode: null,
388
+ dynamicColumnInfo: null, // 列表管理/字段配置/动态列配置中解析的动态列集合,在获得列表数据和行编辑保存动态列时使用
389
+ mainDefaultValueColumns: null, // 当前列表对应的数据表的字段配置有默认值的字段集合,动态列insert插入主表记录时使用
390
+ dynamicServiceName: null, // 动态列展示及行编辑时数据保存的service处理类,可以不填,使用平台默认的处理类
391
+ searchFormContent: null,
392
+ initSearchProps: [], // 初始查询的字段属性名集合
393
+ refreshGrid: true, // 字段配置刷新列表时用于重新渲染列表的状态位
394
+ optionTableHeight, // option传递的table高度
395
+ isFormSubTable: false,
396
+ isShowPageDialog: false, // 是否显示弹框
397
+ jumpPageSetting: null,
398
+ pageCode,
399
+ maxHeight: null,
400
+ pageHeight, // 页面高度
401
+ currentSelectCell: null,
402
+ isLazy, // 树形结构时是否懒加载,默认是懒加载的
403
+ defaultExpandAll, // 树形结构是否默认展开所有节点
404
+ parentFormData: null, // 父表单实体信息
405
+ stripe: true,
406
+ dataSourceType,
407
+ pageDevMode,
408
+ toolbarFieldParam: [],
409
+ tableName: null,
410
+ listName: null,
411
+ subTableData: [],
412
+ isShowPage: false, // 子表或普通列表是否显示分页
413
+ isSubTableShowPage: false, // 子表是否显示分页
414
+ isDelete: false, // 获取请求参数是否删除后
415
+ }
416
+ },
417
+ computed: {
418
+ visibleColumns() {
419
+ const gridParams = store.get(this.code)
420
+ const operations = this.getOptionOperations()
421
+ gridParams.canntEdit = false
422
+ if (
423
+ operations &&
424
+ operations.operation &&
425
+ operations.operation.length > 0
426
+ ) {
427
+ operations.operation.forEach((buttonInfo) => {
428
+ if (buttonInfo.props.code === 'lineEditUpdate') {
429
+ if (checkPermission(buttonInfo.props.functionCode)) {
430
+ gridParams.canntEdit = true
431
+ }
432
+ }
433
+ })
434
+ }
435
+ if (
436
+ typeof this.options.isAdministerListView !== 'undefined' &&
437
+ this.options.isAdministerListView != null &&
438
+ this.options.isAdministerListView === true
439
+ ) {
440
+ return this.columns
441
+ } else {
442
+ return this.columns.filter((column) => {
443
+ if (
444
+ typeof this.options.multiple !== 'undefined' &&
445
+ this.options.multiple === false &&
446
+ column.prop === '$selection'
447
+ ) {
448
+ // 表示不显示“多选”列
449
+ return false
450
+ }
451
+ if (
452
+ typeof this.options.showIndex !== 'undefined' &&
453
+ this.options.showIndex === false &&
454
+ column.prop === '$index'
455
+ ) {
456
+ // 表示不显示“序号”列
457
+ return false
458
+ }
459
+ let isVisible
460
+ if (column.show === undefined || column.show) {
461
+ isVisible = true
462
+ const hiddenColumns = this.options.hiddenColumns
463
+ if (
464
+ hiddenColumns &&
465
+ hiddenColumns.length > 0 &&
466
+ hiddenColumns.indexOf(column.prop) !== -1
467
+ ) {
468
+ // 如果当前字段包含在隐藏字段集合中,则不显示该字段
469
+ isVisible = false
470
+ return isVisible
471
+ }
472
+ // 给列配置操作属性
473
+ this.initColumnOperation(column, operations)
474
+ if (!gridParams.$dataTypeMap) {
475
+ gridParams.$dataTypeMap = {}
476
+ }
477
+ // sql时行编辑保存后台代码需要
478
+ gridParams.$dataTypeMap[column.prop] = column.dataType
479
+ } else {
480
+ isVisible = false
481
+ }
482
+ // 存储有默认值的字段集合
483
+ this.storeHasDefaultValueColumns(column, gridParams)
484
+ return isVisible
485
+ })
486
+ }
487
+ },
488
+ spanArr() {
489
+ const spanArr = []
490
+ for (const column of this.columns) {
491
+ if (
492
+ column.span ||
493
+ (this.mergeFields && this.mergeFields.indexOf(column.prop) !== -1)
494
+ ) {
495
+ spanArr[column.prop] = getSpanValuesForColumn(
496
+ this.gridData,
497
+ column.prop,
498
+ column.mergerCellBasis
499
+ )
500
+ }
501
+ }
502
+ return spanArr
503
+ },
504
+ showSummary() {
505
+ return (
506
+ this.basicInfo.summary !== undefined && this.basicInfo.summary !== 'no'
507
+ )
508
+ },
509
+ // 返回table用来确定唯一的字段。必须配置,否则树形结构时无法显示子集合。
510
+ getRowKeyProp() {
511
+ const gridParams = store.get(this.code)
512
+ if (gridParams && gridParams.options && gridParams.options.rowKeyProp) {
513
+ return gridParams.options.rowKeyProp
514
+ } else {
515
+ if (this.dataSourceType === 'oracle') {
516
+ return 'ID'
517
+ } else {
518
+ return 'id'
519
+ }
520
+ }
521
+ },
522
+ // ,
523
+ // hasLoadMainTable() {
524
+ // const hasLoadMainTable = store.get('hasLoadMainTable')
525
+ // if (typeof (hasLoadMainTable) === 'undefined') {
526
+ // return false
527
+ // }
528
+ // return hasLoadMainTable
529
+ // }
530
+ },
531
+ watch: {
532
+ 'options.SuperGrid': {
533
+ deep: true,
534
+ handler: function () {
535
+ this.externalClickFlag = true
536
+ console.log('监听到数据改变')
537
+ this.initSetting()
538
+ this.initialize()
539
+ },
540
+ },
541
+ // 监控列表数据修改,列表作为表单编辑器中子表时使用
542
+ gridData: {
543
+ deep: true,
544
+ immediate: true,
545
+ handler: function (Val) {
546
+ if (!this.isSubTableShowPage) {
547
+ // 列表子表不分页时使用
548
+ $emit(this, 'change-grid-data', this.gridData)
549
+ }
550
+ },
551
+ },
552
+ // 监控列表数据修改,列表作为表单编辑器中子表时使用
553
+ subTableData: {
554
+ deep: true,
555
+ immediate: true,
556
+ handler: function () {
557
+ if (this.isSubTableShowPage) {
558
+ // 列表子表分页时使用
559
+ const gridParams = store.get(this.code)
560
+ $emit(this, 'change-grid-data', this.subTableData)
561
+ if (
562
+ gridParams.isChangePage !== undefined &&
563
+ gridParams.isChangePage
564
+ ) {
565
+ // 表示新建记录时
566
+ // 新建记录时跳转到最后一页
567
+ const lastPageNum = getLastPageNum(
568
+ this.subTableData.length,
569
+ this.pageSize
570
+ )
571
+ // 表示最后一页页码和当前页不同时需要切换页码
572
+ if (lastPageNum !== this.currentPage) {
573
+ // 切换当前页码为最后一页
574
+ this.currentPage = lastPageNum
575
+ // 切换当前页码到最后一页的数据
576
+ this.changePage()
577
+ } else {
578
+ // 表示不需要切换页码
579
+ this.gridData = this.getSubTableGridData(this.subTableData)
580
+ gridParams.gridData = this.gridData // 完成深拷贝,复制一份对象,行编辑时使用
581
+ gridParams.orgGridData = [].concat(
582
+ JSON.parse(JSON.stringify(this.gridData))
583
+ )
584
+ }
585
+ if (gridParams.lineEdit.editingCell) {
586
+ gridParams.lineEdit.editingCell.row = this.gridData.length
587
+ }
588
+ // 使用完状态还原
589
+ gridParams.isChangePage = false
590
+ } else {
591
+ // 表示不是子表新建记录
592
+ this.gridData = this.getSubTableGridData(this.subTableData)
593
+ gridParams.gridData = this.gridData
594
+ // 完成深拷贝,复制一份对象,行编辑时使用
595
+ gridParams.orgGridData = [].concat(
596
+ JSON.parse(JSON.stringify(this.gridData))
597
+ )
598
+ }
599
+ }
600
+ },
601
+ },
602
+ currentSelectCell: {
603
+ deep: true,
604
+ handler: function (newVal, oldVal) {
605
+ this.$nextTick(() => {
606
+ if (newVal) {
607
+ // 手动触发新单元格的点击事件
608
+ newVal.click()
609
+ }
610
+ if (oldVal) {
611
+ // 清空上一个单元格的选中样式
612
+ oldVal.style.border = ''
613
+ }
614
+ })
615
+ },
616
+ },
617
+ 'options.validateRules': {
618
+ deep: true,
619
+ handler: function () {
620
+ this.externalClickFlag = true
621
+ console.log(
622
+ '监听到数据改变================',
623
+ this.options.validateRules
624
+ )
625
+ const gridParams = store.get(this.code)
626
+ if (gridParams && gridParams.options) {
627
+ gridParams.options.validateRules = this.options.validateRules
628
+ store.set(this.code, gridParams)
629
+ }
630
+ // this.initSetting()
631
+ // this.initialize()
632
+ },
633
+ },
634
+ 'options.subTableCanAdd': {
635
+ deep: true,
636
+ handler: function () {
637
+ const gridParams = store.get(this.code)
638
+ if (gridParams && gridParams.options) {
639
+ gridParams.options.subTableCanAdd = this.options.subTableCanAdd
640
+ store.set(this.code, gridParams)
641
+ }
642
+ },
643
+ },
644
+ // pageSize每页显示多少条,改变时抛出事件,配置出来的流程表单子表验证提示信息时使用,例如:“第x页第x条记录,xxx必填”,获得页数时需要使用
645
+ pageSize: {
646
+ deep: true,
647
+
648
+ handler(newValue, oldValue) {
649
+ $emit(this, 'change-rows-per-page', this.pageSize)
650
+ },
651
+ },
652
+ },
653
+ provide() {
654
+ return {}
655
+ },
656
+ created() {
657
+ store.set(this.code, getGridParams())
658
+ store.set('_list_code', this.code)
659
+ this.initSetting()
660
+ this.judgeIsFormSubTable()
661
+ let stripe = true
662
+ if (isHasOptionFunction('rowStyleRender', this.code)) {
663
+ // 当行需要自定义样式时,斑马线样式会影响效果,所以需要去掉斑马线配置
664
+ stripe = false
665
+ }
666
+ this.stripe = stripe
667
+
668
+ // if (this.parentProp) {
669
+ // // 表示配置了树形配置
670
+ // this.treeProps = this.getTreeProps()
671
+ // }
672
+ // this.showDemo()
673
+ },
674
+ mounted() {
675
+ this.initialize().then(() => {
676
+ const gridParams = store.get(this.code)
677
+ if (
678
+ gridParams &&
679
+ gridParams.basicInfo &&
680
+ gridParams.basicInfo.tableName
681
+ ) {
682
+ this.tableName = gridParams.basicInfo.tableName
683
+ }
684
+ if (gridParams && gridParams.basicInfo && gridParams.basicInfo.name) {
685
+ this.listName = gridParams.basicInfo.name
686
+ }
687
+ this.$nextTick(() => {
688
+ // 将子表选项组值传递super-pages中,解决到处报告时子表选项组赋值问题
689
+ this.columns.forEach((column) => {
690
+ if (column.valueSet) {
691
+ $emit(this, 'set-select-options', {
692
+ prop: this.code + '.' + column.prop,
693
+ valueSet: column.valueSet,
694
+ })
695
+ }
696
+ })
697
+ this.rowDrop()
698
+ this.columnDrop()
699
+ store.get(this.code).superGrid = this.$refs.superGrid
700
+ if (this.query && this.query.showType === 'embedded') {
701
+ // 嵌入查询时,刚进台账要计算一次列表高度
702
+ this.resizeTableHeight()
703
+ } else {
704
+ this.$watch(
705
+ 'showSearch',
706
+ function (newVal, oldVal) {
707
+ this.resizeTableHeight()
708
+ },
709
+ {
710
+ immediate: true,
711
+ deep: true,
712
+ }
713
+ )
714
+ }
715
+
716
+ this.$watch(
717
+ 'hasLoadData',
718
+ function (newVal, oldVal) {
719
+ if (newVal === true) {
720
+ this.$nextTick(() => {
721
+ const gridParams = store.get(this.code)
722
+ if (isHasOptionFunction('gridComplete', this.code)) {
723
+ gridParams.options.gridComplete.call(this, {
724
+ gridData: this.isSubTableShowPage
725
+ ? this.subTableData
726
+ : this.gridData,
727
+ columns: gridParams.columns,
728
+ superGrid: this.$refs.superGrid,
729
+ pageGridData: this.isSubTableShowPage
730
+ ? this.gridData
731
+ : null,
732
+ })
733
+ }
734
+ })
735
+ }
736
+ },
737
+ {
738
+ immediate: true,
739
+ deep: true,
740
+ }
741
+ )
742
+
743
+ const that = this
744
+ const isShowUserTreeDialog =
745
+ document.querySelector('.user-tree') !== null
746
+ // 当前页面监视键盘输入
747
+ document.querySelector('.' + this.code).onkeydown = function (e) {
748
+ if (!that.isShowPageDialog && !isShowUserTreeDialog) {
749
+ // 当前列表页面没有弹框或选人弹框,才走键盘监视事件
750
+ // 事件对象兼容
751
+ // eslint-disable-next-line no-caller
752
+ const e1 =
753
+ e || event || window.event || arguments.callee.caller.arguments[0]
754
+ // 处于行编辑状态时,左右上下箭头事件不需要生效
755
+ const isEdit = that.isEditRow(that)
756
+ // 键盘按键判断:左箭头-37;上箭头-38;右箭头-39;下箭头-40
757
+ // 左
758
+ if (e1 && e1.keyCode === 37) {
759
+ // 左箭头
760
+ if (!isEdit) {
761
+ that.selectLeftCell(that)
762
+ }
763
+ } else if (e1 && e1.keyCode === 38) {
764
+ // 上箭头
765
+ if (!isEdit) {
766
+ that.selectUpCell(that)
767
+ }
768
+ } else if (e1 && e1.keyCode === 39) {
769
+ // 右箭头
770
+ if (!isEdit) {
771
+ that.selectRightCell(that)
772
+ }
773
+ } else if (e1 && e1.keyCode === 40) {
774
+ // 下箭头
775
+ if (!isEdit) {
776
+ that.selectDownCell(that)
777
+ }
778
+ } else if (e1 && e1.keyCode === 13) {
779
+ // 回车
780
+ that.enterOperation(that)
781
+ } else if (e1 && e1.keyCode === 27) {
782
+ // ESC
783
+ that.escOperation(that)
784
+ }
785
+ }
786
+ }
787
+ })
788
+ if (this.query && this.query.showType === 'popup') {
789
+ $emit(this, 'setSearchType', true)
790
+ }
791
+ this.$watch(
792
+ 'options.extraParam',
793
+ function (newValue, oldVal) {
794
+ this.options['extraParam'] = newValue
795
+ const gridParams = store.get(this.code)
796
+ gridParams.options.extraParam = newValue
797
+ },
798
+ {
799
+ deep: true,
800
+ }
801
+ )
802
+ })
803
+ },
804
+ methods: {
805
+ ...events,
806
+ ...publicMethods,
807
+ ...superGridService,
808
+ ...apis,
809
+ isDeleteChange(boole) {
810
+ this.isDelete = boole
811
+ },
812
+ isShowPageArea() {
813
+ if (this.isFormSubTable) {
814
+ return (
815
+ this.options.showPageArea !== undefined &&
816
+ this.options.showPageArea === true
817
+ )
818
+ } else {
819
+ return true
820
+ }
821
+ },
822
+ resizeTableHeight() {
823
+ this.$nextTick(() => {
824
+ let tableHeight = getTableHeight(
825
+ this.$refs.superGrid,
826
+ this.code,
827
+ this.pageHeight
828
+ )
829
+ const gridParams = store.get(this.code)
830
+ if (isHasOptionFunction('resizeHeight', this.code)) {
831
+ let searchHeight = 0
832
+ if (this.$refs.sf) {
833
+ // 获得查询区高度
834
+ searchHeight = this.$refs.sf.$el.offsetHeight
835
+ }
836
+ const newHeight = gridParams.options.resizeHeight.call(this, {
837
+ code: this.code,
838
+ height: tableHeight,
839
+ searchHeight: searchHeight,
840
+ })
841
+ if (newHeight) {
842
+ tableHeight = newHeight
843
+ }
844
+ }
845
+ this.height = tableHeight
846
+ if (this.optionTableHeight) {
847
+ this.height = this.optionTableHeight
848
+ } else if (
849
+ gridParams.options &&
850
+ gridParams.options.isFormSubTable &&
851
+ gridParams.options.isPdfEditor
852
+ ) {
853
+ this.height = null
854
+ } else if (
855
+ gridParams.options &&
856
+ gridParams.options.isFormSubTable &&
857
+ gridParams.options.formSetHeight
858
+ ) {
859
+ this.height = gridParams.options.formSetHeight
860
+ } else if (
861
+ !this.basicInfo.displayEffect ||
862
+ this.basicInfo.displayEffect === '' ||
863
+ this.basicInfo.displayEffect === 'default'
864
+ ) {
865
+ this.height = null
866
+ }
867
+ this.maxHeight = tableHeight
868
+ if (
869
+ gridParams.options &&
870
+ gridParams.options.isFormSubTable &&
871
+ gridParams.options.isPdfEditor
872
+ ) {
873
+ this.maxHeight = null
874
+ } else if (
875
+ gridParams.options &&
876
+ gridParams.options.isFormSubTable &&
877
+ gridParams.options.formSetMaxHeight
878
+ ) {
879
+ this.maxHeight = gridParams.options.formSetMaxHeight
880
+ }
881
+ })
882
+ },
883
+ // 回车键
884
+ enterOperation(that) {
885
+ const gridParams = store.get(that.code)
886
+ if (gridParams.options && gridParams.options.isFormSubTable) {
887
+ // 如果是子表,只是取消行编辑状态
888
+ const editRow = gridParams.$editRow
889
+ if (editRow) {
890
+ setEntityFieldValue(editRow, '$editing', false)
891
+ gridParams.$editRow = null
892
+ }
893
+ } else {
894
+ // 不是子表
895
+ if (gridParams.options && !gridParams.options.isFormSubTable) {
896
+ const currentSelectCell = that.currentSelectCell
897
+ if (currentSelectCell) {
898
+ const textAreaCell = currentSelectCell.querySelector('.el-textarea')
899
+ if (textAreaCell) {
900
+ return
901
+ }
902
+ }
903
+ // 表示不是表单子表时,才需要回车保存
904
+ const rowIndex = gridParams.$rowIndex
905
+ if (rowIndex !== undefined && rowIndex !== null) {
906
+ const row = gridParams.gridData[rowIndex]
907
+ if (isEditOptionFunction('enter', that.listCode)) {
908
+ gridParams.options.lineEditOptions.enter.call(
909
+ that,
910
+ rowIndex,
911
+ that.column,
912
+ row,
913
+ gridParams.orgGridData[rowIndex]
914
+ )
915
+ } else {
916
+ that.saveRow(rowIndex, that.code)
917
+ }
918
+ }
919
+ }
920
+ }
921
+ },
922
+ // ESC键取消行编辑
923
+ escOperation(that) {
924
+ const gridParams = store.get(that.code)
925
+ if (gridParams.options && !gridParams.options.isFormSubTable) {
926
+ // 表示不是表单子表时,才需要处理ESC取消操作
927
+ const rowIndex = gridParams.$rowIndex
928
+ if (rowIndex !== undefined && rowIndex !== null) {
929
+ that.restoreRow(rowIndex, that.code)
930
+ const row = gridParams.gridData[rowIndex]
931
+ if (isEditOptionFunction('esc', that.listCode)) {
932
+ gridParams.options.lineEditOptions.esc.call(
933
+ that,
934
+ rowIndex,
935
+ that.column,
936
+ row,
937
+ gridParams.orgGridData[rowIndex]
938
+ )
939
+ } else {
940
+ that.restoreRow(rowIndex, that.code)
941
+ }
942
+ }
943
+ }
944
+ },
945
+ // 是否正在编辑行,如果正在编辑左右上下箭头事件不需要生效
946
+ isEditRow(that) {
947
+ const currentSelectCell = that.currentSelectCell
948
+ if (currentSelectCell) {
949
+ const inputInner = currentSelectCell.querySelector('.el-input__inner')
950
+ if (inputInner) {
951
+ return true
952
+ }
953
+ }
954
+ return false
955
+ },
956
+ // 选中上方单元格
957
+ selectUpCell(that) {
958
+ const currentSelectCell = that.currentSelectCell
959
+ if (currentSelectCell) {
960
+ const trDom = currentSelectCell.parentNode
961
+ if (trDom) {
962
+ let tdClass = null
963
+ let classes = null
964
+ const classObj = currentSelectCell.attributes['class']
965
+ if (classObj) {
966
+ classes = classObj['nodeValue']
967
+ }
968
+ if (classes && classes.indexOf(' ') > 0) {
969
+ const classArr = classes.split(' ')
970
+ tdClass = classArr[0]
971
+ }
972
+ const preTr = trDom['previousSibling']
973
+ if (preTr) {
974
+ const targetCell = preTr.querySelector('.' + tdClass)
975
+ that.currentSelectCell = targetCell
976
+ }
977
+ }
978
+ }
979
+ },
980
+ // 选中下方单元格
981
+ selectDownCell(that) {
982
+ const currentSelectCell = that.currentSelectCell
983
+ if (currentSelectCell) {
984
+ const trDom = currentSelectCell.parentNode
985
+ if (trDom) {
986
+ let tdClass = null
987
+ let classes = null
988
+ const classObj = currentSelectCell.attributes['class']
989
+ if (classObj) {
990
+ classes = classObj['nodeValue']
991
+ }
992
+ if (classes && classes.indexOf(' ') > 0) {
993
+ const classArr = classes.split(' ')
994
+ tdClass = classArr[0]
995
+ }
996
+ const preTr = trDom['nextSibling']
997
+ if (preTr) {
998
+ const targetCell = preTr.querySelector('.' + tdClass)
999
+ that.currentSelectCell = targetCell
1000
+ }
1001
+ }
1002
+ }
1003
+ },
1004
+ // 选中右侧单元格
1005
+ selectRightCell(that) {
1006
+ if (that.currentSelectCell) {
1007
+ const nextCell = that.currentSelectCell['nextSibling']
1008
+ if (nextCell) {
1009
+ let classes
1010
+ const classObj = nextCell.attributes['class']
1011
+ if (classObj) {
1012
+ classes = classObj['nodeValue']
1013
+ }
1014
+ if (classes && classes.indexOf(' is-hidden') > 0) {
1015
+ // 表示需要处理冻结列情况
1016
+ that.getTargetCellWithFixTable(that, classes, nextCell)
1017
+ } else {
1018
+ that.currentSelectCell = nextCell
1019
+ }
1020
+ }
1021
+ }
1022
+ },
1023
+ // 选中左侧单元格
1024
+ selectLeftCell(that) {
1025
+ if (that.currentSelectCell) {
1026
+ const preCell = that.currentSelectCell['previousSibling']
1027
+ if (preCell) {
1028
+ let classes
1029
+ const classObj = preCell.attributes['class']
1030
+ if (classObj) {
1031
+ classes = classObj['nodeValue']
1032
+ }
1033
+ if (classes && classes.indexOf(' is-hidden') > 0) {
1034
+ // 表示需要处理冻结列情况
1035
+ that.getTargetCellWithFixTable(that, classes, preCell)
1036
+ } else {
1037
+ that.currentSelectCell = preCell
1038
+ }
1039
+ }
1040
+ }
1041
+ },
1042
+ // 左右箭头时,有冻结列时,获得目的单元格
1043
+ getTargetCellWithFixTable(that, classes, currentCell) {
1044
+ const tr = currentCell.parentNode
1045
+ if (tr) {
1046
+ const tbody = tr.parentNode
1047
+ if (tbody) {
1048
+ const table = tbody.parentNode
1049
+ if (table) {
1050
+ const tableDiv = table.parentNode
1051
+ if (tableDiv) {
1052
+ const classObj = tableDiv.attributes['class']
1053
+ if (classObj) {
1054
+ const tableDivClasses = classObj['nodeValue']
1055
+ if (
1056
+ tableDivClasses &&
1057
+ tableDivClasses.indexOf('el-table__fixed-body-wrapper') >= 0
1058
+ ) {
1059
+ // 表示当前单元格是冻结列中的,需要在非冻结列中获得该单元格
1060
+ let tdClass = null
1061
+ if (classes && classes.indexOf(' ') > 0) {
1062
+ const classArr = classes.split(' ')
1063
+ tdClass = classArr[0]
1064
+ }
1065
+ if (tdClass) {
1066
+ const targetCell = document.querySelector(
1067
+ '.' +
1068
+ this.code +
1069
+ ' .el-table__body-wrapper .current-row .' +
1070
+ tdClass
1071
+ )
1072
+ that.currentSelectCell = targetCell
1073
+ }
1074
+ } else if (
1075
+ tableDivClasses &&
1076
+ tableDivClasses.indexOf('el-table__body-wrapper') >= 0
1077
+ ) {
1078
+ // 表示当前单元格是非冻结列中的,需要在冻结列中获得该单元格
1079
+ let tdClass = null
1080
+ if (classes && classes.indexOf(' ') > 0) {
1081
+ const classArr = classes.split(' ')
1082
+ tdClass = classArr[0]
1083
+ }
1084
+ if (tdClass) {
1085
+ const targetCell = document.querySelector(
1086
+ '.' +
1087
+ this.code +
1088
+ ' .el-table__fixed-body-wrapper .current-row .' +
1089
+ tdClass
1090
+ )
1091
+ that.currentSelectCell = targetCell
1092
+ }
1093
+ }
1094
+ }
1095
+ }
1096
+ }
1097
+ }
1098
+ }
1099
+ },
1100
+ // 存储有默认值的字段集合
1101
+ storeHasDefaultValueColumns(column, gridParams) {
1102
+ if (
1103
+ column.defaultValue !== undefined &&
1104
+ column.defaultValue !== null &&
1105
+ column.defaultValue !== ''
1106
+ ) {
1107
+ if (
1108
+ gridParams.defaultValueColumns === undefined ||
1109
+ gridParams.defaultValueColumns === null
1110
+ ) {
1111
+ gridParams.defaultValueColumns = []
1112
+ }
1113
+ gridParams.defaultValueColumns.push(column)
1114
+ }
1115
+ },
1116
+ // 判断是不是表单子表的使用
1117
+ judgeIsFormSubTable() {
1118
+ // 没有分页
1119
+ // 没有排序
1120
+ const gridParams = store.get(this.code)
1121
+ if (
1122
+ gridParams &&
1123
+ gridParams.options &&
1124
+ gridParams.options.isFormSubTable !== undefined &&
1125
+ gridParams.options.isFormSubTable === true
1126
+ ) {
1127
+ this.isFormSubTable = true
1128
+ }
1129
+ },
1130
+ /**
1131
+ * 给列设置操作信息
1132
+ * @param operationSetting 操作列设置,{prop:[{按钮组件},{按钮组件},{link组件}],prop:[{},{}]}
1133
+ */
1134
+ initColumnOperation(column, operationSetting) {
1135
+ if (operationSetting && operationSetting[column.prop]) {
1136
+ const prop = column.prop
1137
+ column.operations = operationSetting[prop]
1138
+ }
1139
+ },
1140
+ // 获得属性列操作信息
1141
+ getOptionOperations() {
1142
+ if (
1143
+ typeof this.options['operations'] !== 'undefined' &&
1144
+ this.options['operations'] !== null
1145
+ ) {
1146
+ return this.options['operations']
1147
+ }
1148
+ },
1149
+ initSetting() {
1150
+ const gridParams = store.get(this.code)
1151
+ if (typeof this.options !== 'undefined') {
1152
+ Object.assign(gridParams.options, this.options)
1153
+ if (!gridParams.options.lineEditOptions) {
1154
+ gridParams.options.lineEditOptions = gridParams.defaultLineEditOptions
1155
+ }
1156
+ if (
1157
+ typeof this.options['customFormatter'] !== 'undefined' &&
1158
+ this.options['customFormatter'] !== null
1159
+ ) {
1160
+ this.myCustomFormatter = this.options['customFormatter']
1161
+ }
1162
+ } else {
1163
+ gridParams.options = {}
1164
+ gridParams.options.lineEditOptions = gridParams.defaultLineEditOptions
1165
+ }
1166
+ if (!isHasEditOption('input', this.code)) {
1167
+ gridParams.options.lineEditOptions.input =
1168
+ gridParams.defaultLineEditOptions.input
1169
+ }
1170
+ if (
1171
+ !this.myCustomFormatter &&
1172
+ typeof this.customFormatter !== 'undefined' &&
1173
+ this.customFormatter !== null
1174
+ ) {
1175
+ this.myCustomFormatter = this.customFormatter
1176
+ }
1177
+ if (
1178
+ this.options &&
1179
+ this.options.dynamicServiceName &&
1180
+ this.options.dynamicServiceName !== undefined
1181
+ ) {
1182
+ this.dynamicServiceName = this.options.dynamicServiceName
1183
+ gridParams.dynamicServiceName = this.dynamicServiceName
1184
+ }
1185
+ if (
1186
+ this.options &&
1187
+ this.options.system &&
1188
+ this.options.system !== undefined
1189
+ ) {
1190
+ gridParams.system = this.options.system
1191
+ }
1192
+ if (
1193
+ this.options &&
1194
+ this.options.additionalParamMap &&
1195
+ this.options.additionalParamMap !== undefined
1196
+ ) {
1197
+ gridParams.additionalParamMap = this.options.additionalParamMap
1198
+ }
1199
+ },
1200
+ changeRowStyle(param) {
1201
+ // param的格式:{row, rowIndex}
1202
+ const gridParams = store.get(this.code)
1203
+ if (this.lineEdit && this.lineEdit.editable) {
1204
+ if (param.rowIndex === gridParams.$rowIndex) {
1205
+ if (
1206
+ !isObjectValueEqual(
1207
+ param.row,
1208
+ gridParams.orgGridData[gridParams.$rowIndex]
1209
+ )
1210
+ ) {
1211
+ // return { 'background': 'rgb(245, 181, 203)' }
1212
+ }
1213
+ }
1214
+ }
1215
+ if (isHasOptionFunction('rowStyleRender', this.code)) {
1216
+ return gridParams.options.rowStyleRender.call(this, param)
1217
+ }
1218
+ if (
1219
+ this.options &&
1220
+ this.options.renderRow &&
1221
+ this.options.renderRow.hasOwnProperty(param.rowIndex)
1222
+ ) {
1223
+ return { background: this.options.renderRow[param.rowIndex] }
1224
+ }
1225
+ },
1226
+ changeCellStyle(param) {
1227
+ const gridParams = store.get(this.code)
1228
+ let funName = null
1229
+ let columnOptions = null
1230
+ if (param && param.column && param.column.property) {
1231
+ if (gridParams && gridParams.columnOptionMap) {
1232
+ if (gridParams.columnOptionMap[param.column.property]) {
1233
+ columnOptions = gridParams.columnOptionMap[param.column.property]
1234
+ if (columnOptions.events && columnOptions.events.cellStyle) {
1235
+ funName = columnOptions.events.cellStyle
1236
+ }
1237
+ }
1238
+ }
1239
+ }
1240
+ // {row, column, rowIndex, columnIndex}
1241
+ // 获取对应单元格配置
1242
+ if (isHasOptionFunction('cellStyleRender', this.code)) {
1243
+ return gridParams.options.cellStyleRender.call(this, param)
1244
+ } else if (
1245
+ funName !== null &&
1246
+ columnOptions !== null &&
1247
+ gridParams.options &&
1248
+ gridParams.options['eventCallBack'] &&
1249
+ gridParams.options['eventCallBack'][funName] &&
1250
+ typeof gridParams.options['eventCallBack'][funName] === 'function'
1251
+ ) {
1252
+ const params = {
1253
+ value: param.row[param.column.property],
1254
+ row: param.row,
1255
+ column: columnOptions,
1256
+ prop: param.column.property,
1257
+ }
1258
+ return gridParams.options['eventCallBack'][funName].call(this, params)
1259
+ }
1260
+ },
1261
+ changeHeaderStyle(param) {
1262
+ // param的格式:{row, column, rowIndex, columnIndex}
1263
+ // 区分是编辑模式还是应用模式
1264
+ if (
1265
+ typeof this.options.isAdministerListView !== 'undefined' &&
1266
+ this.options.isAdministerListView != null &&
1267
+ this.options.isAdministerListView === true
1268
+ ) {
1269
+ // 编辑模式
1270
+ const column = param.column
1271
+ if (column.type === 'selection') {
1272
+ if (this.backgroundColorMap['$selection']) {
1273
+ return { background: this.backgroundColorMap['$selection'] }
1274
+ }
1275
+ } else if (
1276
+ column.type &&
1277
+ column.type === 'default' &&
1278
+ !column.property
1279
+ ) {
1280
+ if (this.backgroundColorMap['$index']) {
1281
+ return { background: this.backgroundColorMap['$index'] }
1282
+ }
1283
+ } else {
1284
+ if (column.property && this.backgroundColorMap[column.property]) {
1285
+ return { background: this.backgroundColorMap[column.property] }
1286
+ }
1287
+ }
1288
+ } else {
1289
+ const gridParams = store.get(this.code)
1290
+ let funName = null
1291
+ let columnOptions = null
1292
+ if (param && param.column && param.column.property) {
1293
+ if (gridParams && gridParams.columnOptionMap) {
1294
+ if (gridParams.columnOptionMap[param.column.property]) {
1295
+ columnOptions = gridParams.columnOptionMap[param.column.property]
1296
+ if (
1297
+ columnOptions.events &&
1298
+ columnOptions.events.headerCellStyle
1299
+ ) {
1300
+ funName = columnOptions.events.headerCellStyle
1301
+ }
1302
+ }
1303
+ }
1304
+ }
1305
+ // 应用模式
1306
+ // 修改表头样式,当某些字段需要编辑时,某些字段不需要编辑时,为了突出显示有权限编辑的字段,可以使用该功能
1307
+ if (
1308
+ gridParams.options.renderHeader &&
1309
+ gridParams.options.renderHeader.props
1310
+ ) {
1311
+ const column = param.column
1312
+ const props = gridParams.options.renderHeader.props
1313
+ const propsArr = props.split(',')
1314
+ for (let i = 0; i < propsArr.length; i++) {
1315
+ const prop = propsArr[i]
1316
+ if (column.property === prop.trim()) {
1317
+ let backgroundColor = '#c3f4e2'
1318
+ if (
1319
+ typeof gridParams.options.renderHeader.color !== 'undefined'
1320
+ ) {
1321
+ backgroundColor = gridParams.options.renderHeader.color
1322
+ }
1323
+ return { background: backgroundColor }
1324
+ }
1325
+ }
1326
+ } else if (
1327
+ funName !== null &&
1328
+ columnOptions !== null &&
1329
+ gridParams.options &&
1330
+ gridParams.options['eventCallBack'] &&
1331
+ gridParams.options['eventCallBack'][funName] &&
1332
+ typeof gridParams.options['eventCallBack'][funName] === 'function'
1333
+ ) {
1334
+ // const param = { value: param.row[param.column.property], row: param.row, column: columnOptions, prop: param.column.property }
1335
+ return gridParams.options['eventCallBack'][funName].call(this, param)
1336
+ }
1337
+ }
1338
+ },
1339
+ fetchData(searchParam, isSearch, parentRowIds, resove) {
1340
+ const gridParams = store.get(this.code)
1341
+ // 查询数据需要区分,如果时列表管理编辑模式,使用静态数据
1342
+ if (gridParams.options && gridParams.options.isPageInfo) {
1343
+ // 预览模式且从表单子表进入
1344
+ } else {
1345
+ if (gridParams.options && gridParams.options.isAdministerListView) {
1346
+ // 根据类型生成静态数据
1347
+ if (
1348
+ gridParams.options.SuperGrid &&
1349
+ gridParams.options.SuperGrid.simulationDate
1350
+ ) {
1351
+ if (isHasOptionFunction('gridDataLoaded', this.code)) {
1352
+ const gridData = gridParams.options.gridDataLoaded.call(this, {
1353
+ gridData: gridParams.options.SuperGrid.simulationDate,
1354
+ columns: gridParams.columns,
1355
+ })
1356
+ if (gridData) {
1357
+ this.gridData = gridData
1358
+ } else {
1359
+ this.gridData = gridParams.options.SuperGrid.simulationDate
1360
+ }
1361
+ } else {
1362
+ this.gridData = gridParams.options.SuperGrid.simulationDate
1363
+ }
1364
+ gridParams.gridData = this.gridData
1365
+ }
1366
+ } else if (
1367
+ gridParams.options &&
1368
+ gridParams.options.isFormSubTable &&
1369
+ gridParams.options.subTableData &&
1370
+ gridParams.options.subTableData.length > 0
1371
+ ) {
1372
+ this.hasLoadData = false
1373
+ gridParams.loaded = true
1374
+ let subTableData = []
1375
+ // 如果有子表数据,则展示传递的子表数据
1376
+ if (isHasOptionFunction('gridDataLoaded', this.code)) {
1377
+ const gridData = gridParams.options.gridDataLoaded.call(this, {
1378
+ gridData: gridParams.options.subTableData,
1379
+ columns: gridParams.columns,
1380
+ })
1381
+ if (gridData) {
1382
+ subTableData = gridData
1383
+ this.hasLoadData = true
1384
+ } else {
1385
+ subTableData = gridParams.options.subTableData
1386
+ this.hasLoadData = true
1387
+ }
1388
+ } else {
1389
+ subTableData = gridParams.options.subTableData
1390
+ this.hasLoadData = true
1391
+ }
1392
+ if (subTableData) {
1393
+ // 子表时所有记录的所有字段设置默认值null,优化子表编辑时性能
1394
+ subTableData.forEach((item) => {
1395
+ this.setColumnsDefaultValue(gridParams.allColumns, item)
1396
+ })
1397
+ }
1398
+ if (this.pagination && this.isSubTableShowPage === true) {
1399
+ // 表示子表需要显示分页
1400
+ this.subTableData = subTableData
1401
+ // 更新记录总条数
1402
+ this.pagination.total = this.subTableData.length
1403
+ gridParams.subTableData = this.subTableData
1404
+ this.gridData = this.getSubTableGridData(this.subTableData)
1405
+ } else {
1406
+ this.gridData = subTableData
1407
+ }
1408
+ gridParams.gridData = this.gridData
1409
+ // 完成深拷贝,复制一份对象,行编辑时使用
1410
+ gridParams.orgGridData = [].concat(
1411
+ JSON.parse(JSON.stringify(this.gridData))
1412
+ )
1413
+ } else {
1414
+ return this.fetchListData(searchParam, isSearch, parentRowIds, resove)
1415
+ }
1416
+ }
1417
+ },
1418
+ getSubTableGridData(subTableData) {
1419
+ let gridData = subTableData
1420
+ if (this.isSubTableShowPage === true) {
1421
+ if (subTableData && subTableData.length > 0) {
1422
+ // const subTableData = JSON.parse(JSON.stringify(this.subTableData))
1423
+ this.pagination.total = subTableData.length
1424
+ // 当前是第几页
1425
+ let currentPage = this.currentPage
1426
+ if (currentPage === undefined || currentPage === null) {
1427
+ currentPage = 1
1428
+ }
1429
+ // 每页显示多少条记录
1430
+ let pageSize = this.pageSize
1431
+ if (pageSize === null && this.pagination) {
1432
+ pageSize = this.pagination.pageSize
1433
+ }
1434
+ if (pageSize === undefined || pageSize === null) {
1435
+ pageSize = 20
1436
+ }
1437
+ // 当前页的第一条记录的数组下标
1438
+ const startRowIndex = (currentPage - 1) * pageSize
1439
+ // 当前页的最后一条记录的数组下标
1440
+ let lastRowIndex = startRowIndex + pageSize
1441
+ if (subTableData.length > startRowIndex) {
1442
+ // 表示当前页有记录
1443
+ if (lastRowIndex > subTableData.length) {
1444
+ // 表示最后一条记录超过下标了
1445
+ lastRowIndex = subTableData.length
1446
+ }
1447
+ // 前包,后不包
1448
+ gridData = subTableData.slice(startRowIndex, lastRowIndex)
1449
+ }
1450
+ }
1451
+ }
1452
+ if (gridData === undefined || gridData === null) {
1453
+ gridData = []
1454
+ }
1455
+ return gridData
1456
+ },
1457
+ fetchListData(searchParam, isSearch, parentRowIds, resove) {
1458
+ return new Promise((resolve, reject) => {
1459
+ this.isLoading = true
1460
+ this.hasLoadData = false
1461
+ if (isSearch === undefined || isSearch === false) {
1462
+ // 如果不是查询时才需要从缓存中获得结果
1463
+ // 如果是刷新当前列表,则需要获得缓存中的window.sessionStorage
1464
+ const isRefreshList = window.sessionStorage.getItem(
1465
+ 'refreshList-' + this.code
1466
+ )
1467
+ // console.log('fetchData--isRefreshList--', isRefreshList)
1468
+ if (isRefreshList !== undefined && isRefreshList === 'true') {
1469
+ const searchParamJson = window.sessionStorage.getItem(
1470
+ 'searchParam-' + this.code
1471
+ )
1472
+ // console.log('fetchData--searchParamJson--', searchParamJson)
1473
+ // console.log('fetchData--pagination--', this.pagination)
1474
+ if (
1475
+ searchParamJson !== undefined &&
1476
+ searchParamJson !== null &&
1477
+ searchParamJson !== ''
1478
+ ) {
1479
+ searchParam = JSON.parse(searchParamJson)
1480
+ const pagination = searchParam.pagination
1481
+ if (pagination) {
1482
+ this.currentPage = pagination.currentPage
1483
+ this.pagination.pageSize = pagination.pageSize
1484
+ this.pagination.showTotal = pagination.showTotal
1485
+ }
1486
+ this.getInitSearchForm(searchParam.searchForm)
1487
+ // this.searchFormContent = searchParam.searchForm
1488
+ }
1489
+ }
1490
+ }
1491
+ window.sessionStorage.removeItem('refreshList-' + this.code)
1492
+ if (searchParam === undefined) {
1493
+ searchParam = this.getSearchParam()
1494
+ }
1495
+ const gridParams = store.get(this.code)
1496
+ let param = searchParam
1497
+
1498
+ if (gridParams.options.extraParam || parentRowIds !== undefined) {
1499
+ param = getExtraParam(searchParam, gridParams)
1500
+ }
1501
+ // 导出需要这两个参数
1502
+ gridParams.searchParam = searchParam
1503
+ gridParams.url = this.url
1504
+ let requestUrl = this.url
1505
+ if (parentRowIds !== undefined && parentRowIds !== null) {
1506
+ // 表示是查询子集合时
1507
+ param = Object.assign({}, param)
1508
+ // 清空查询子集合时,分页信息,即不需要分页查询子集合
1509
+ param.searchParam.pagination = null
1510
+ // 父节点id传给后台
1511
+ param['parentIds'] = parentRowIds
1512
+ // 父级字段名,例如:parentId 或 fk_parent_id
1513
+ param['parentProp'] = this.parentProp
1514
+ // 传入系统code
1515
+ param.systemCode = getSystemCode()
1516
+
1517
+ requestUrl = this.options.subRowUrl
1518
+ }
1519
+ // 解决新建后,查询,再点新建报“有未保存的行”问题,解决方案是一旦刷新列表,就还原这些状态
1520
+ gridParams.isCreateRow = false
1521
+ gridParams.isEditRow = false
1522
+ gridParams.$lastSaveRowIndex = null
1523
+ gridParams.$rowIndex = null
1524
+ gridParams.canSaveRow = true
1525
+ // 是否根据权限显示数据
1526
+ gridParams.withDataPermission = gridParams.options.isWithDataPermission
1527
+ // 对象是否是流程实体
1528
+ gridParams.isWorkflowEntity = gridParams.options.isWorkflowEntity
1529
+ // 缓存查询条件及当前页数
1530
+ window.sessionStorage.setItem(
1531
+ 'searchParam-' + this.code,
1532
+ JSON.stringify(param)
1533
+ )
1534
+ if (
1535
+ this.parentProp &&
1536
+ searchParam.searchForm &&
1537
+ searchParam.searchForm.length > 0
1538
+ ) {
1539
+ // 表示是树形列表的查询时,查询结果不需要树形显示,后台处理的数据没有加has_children来实现的
1540
+ param.listViewTreeSetting = null
1541
+ }
1542
+ this.$http
1543
+ .post(requestUrl, param)
1544
+ .then((data) => {
1545
+ if (typeof parentRowIds === 'undefined' || parentRowIds === null) {
1546
+ let tableData = []
1547
+ // 对数据做序列化,比如:处理xss攻击
1548
+ if (isHasOptionFunction('gridDataLoaded', this.code)) {
1549
+ const gridData = gridParams.options.gridDataLoaded.call(this, {
1550
+ gridData: data.data,
1551
+ columns: gridParams.columns,
1552
+ })
1553
+ if (gridData) {
1554
+ tableData = gridData
1555
+ } else {
1556
+ tableData = data.data
1557
+ }
1558
+ } else {
1559
+ tableData = data.data
1560
+ }
1561
+ if (!tableData) {
1562
+ tableData = []
1563
+ }
1564
+ if (gridParams.options.isFormSubTable) {
1565
+ // 子表时默认不全部行编辑
1566
+ if (tableData) {
1567
+ // 子表时所有记录的所有字段设置默认值null,优化子表编辑时性能
1568
+ tableData.forEach((item) => {
1569
+ this.setColumnsDefaultValue(gridParams.allColumns, item)
1570
+ })
1571
+ }
1572
+ // console.log('子表数据循环', this.gridData)
1573
+ // this.gridData.forEach(item => {
1574
+ // item.$editing = true
1575
+ // })
1576
+ if (this.pagination && this.isSubTableShowPage === true) {
1577
+ // 表示子表需要显示分页
1578
+ this.subTableData = tableData
1579
+ this.gridData = this.getSubTableGridData(this.subTableData)
1580
+ gridParams.subTableData = this.subTableData
1581
+ } else {
1582
+ this.gridData = tableData
1583
+ }
1584
+ if (this.pagination) {
1585
+ this.pagination.total = tableData.length
1586
+ }
1587
+ } else {
1588
+ this.gridData = tableData
1589
+
1590
+ if (this.pagination) {
1591
+ this.pagination.total = data.total
1592
+ }
1593
+ }
1594
+ if (data.summaries && Object.keys(data.summaries).length > 0) {
1595
+ this.summaries = data.summaries
1596
+ }
1597
+
1598
+ gridParams.gridData = this.gridData
1599
+
1600
+ // 完成深拷贝,复制一份对象,行编辑时使用
1601
+ gridParams.orgGridData = [].concat(
1602
+ JSON.parse(JSON.stringify(this.gridData))
1603
+ )
1604
+
1605
+ gridParams.pagination = this.pagination
1606
+ gridParams.loaded = true
1607
+
1608
+ // TODO: 输入焦点默认停在第一个可编辑的单元格
1609
+ if (this.lineEdit.editable) {
1610
+ if (typeof isSearch === 'undefined' || isSearch === false) {
1611
+ // 不是查询时,才需要创建第一行记录
1612
+ if (this.gridData.length === 0) {
1613
+ if (
1614
+ this.options &&
1615
+ this.options.isDefaultShowEdit !== null &&
1616
+ this.options.isDefaultShowEdit !== undefined &&
1617
+ this.options.isDefaultShowEdit === true
1618
+ ) {
1619
+ this.createRow(this.code, null, this.gridData)
1620
+ }
1621
+ }
1622
+ if (this.gridData.length > 0) {
1623
+ this.lineEdit['editingCell'] = {
1624
+ row: 0,
1625
+ prop: getFirstEditableColumn(this.code),
1626
+ }
1627
+ }
1628
+ }
1629
+ }
1630
+ this.hasLoadData = true
1631
+ } else {
1632
+ // 对数据做序列化,比如:处理xss攻击
1633
+ if (isHasOptionFunction('gridDataLoaded', this.code)) {
1634
+ gridParams.options.gridDataLoaded.call(this, { gridData: data })
1635
+ }
1636
+
1637
+ if (isHasOptionFunction('loadChildrenComplete', this.code)) {
1638
+ gridParams.options.loadChildrenComplete.call(this, {
1639
+ parentRowIds: parentRowIds,
1640
+ gridData: data,
1641
+ columns: gridParams.columns,
1642
+ })
1643
+ }
1644
+ if (typeof resove !== 'undefined' && resove !== null) {
1645
+ // 首次加载或点击三角展开父节点时走该分支
1646
+ // 刷新数据后,移除该父节点下的所有已选中的子节点记录。
1647
+ // 必须调用该方法,否则在删除记录时,数据即使刷新了,已选中集合this.$refs.superGrid.store.states.selection中仍会有该已删除记录,导致再次执行删除报id不存在
1648
+ this.removeGridStoreSelection(parentRowIds)
1649
+ resove(data[parentRowIds[0]])
1650
+ } else {
1651
+ // 刷新父记录对应的子记录集合时需要,例如:删除时
1652
+ parentRowIds.forEach((parentRowId) => {
1653
+ // 单行父记录id
1654
+ this.$refs.superGrid.store.states.lazyTreeNodeMap[
1655
+ parentRowId
1656
+ ] = data[parentRowId]
1657
+ this.$refs.superGrid.store.states.treeData[
1658
+ parentRowId
1659
+ ].children = data[parentRowId]
1660
+ })
1661
+ // 刷新数据后,移除该父节点下的所有已选中的子节点记录
1662
+ // 必须调用该方法,否则在删除记录时,数据即使刷新了,已选中集合this.$refs.superGrid.store.states.selection中仍会有该已删除记录,导致再次执行删除报id不存在
1663
+ this.removeGridStoreSelection(parentRowIds)
1664
+ }
1665
+ this.hasLoadData = true
1666
+ }
1667
+ resolve()
1668
+ })
1669
+ .catch((error) => {
1670
+ if (isHasOptionFunction('loadError', this.code)) {
1671
+ gridParams.options.loadError.call(this, this.code, error)
1672
+ }
1673
+ reject(error)
1674
+ })
1675
+ })
1676
+ },
1677
+ // 获得初始查询条件对象
1678
+ getInitSearchForm(searchFormArr) {
1679
+ const gridParams = store.get(this.code)
1680
+ if (searchFormArr && searchFormArr.length > 0) {
1681
+ this.searchFormContent = {}
1682
+ searchFormArr.forEach((item) => {
1683
+ // 获得的是"isDeleted"
1684
+ let prop = item.propName
1685
+ // 获得的是“deleted”
1686
+ const columnProp = item.columnProp
1687
+ const dataType = item.dataType
1688
+ if (dataType && dataType === 'BOOLEAN') {
1689
+ prop = columnProp
1690
+ }
1691
+ this.initSearchProps.push(prop)
1692
+ const propValue = item.propValue
1693
+ if (prop && prop.indexOf('.') > 0) {
1694
+ // 动态给searchForm添加属性,包括多级嵌套属性,属性的初始值都为 null
1695
+ addDynamicProp(this.searchFormContent, prop, propValue)
1696
+ } else {
1697
+ this.searchFormContent[prop] = propValue
1698
+ }
1699
+ })
1700
+ gridParams.searchForm = searchFormArr
1701
+ // 调用查询api方法,该方法中调用了@showSearch方法,用于控制“查询”按钮改名为“取消查询”
1702
+ this.showSearchForm()
1703
+ } else {
1704
+ gridParams.searchForm = null
1705
+ }
1706
+ },
1707
+ showDemo() {
1708
+ this.isLoading = true
1709
+ this.$http
1710
+ .get(this.url)
1711
+ .then((data) => {
1712
+ // 根据this.options.showColumns设置显示的字段
1713
+ this.getShowColumns(data)
1714
+
1715
+ Object.assign(this, data)
1716
+ const gridParams = store.get(this.code)
1717
+ gridParams.listCode = this.code
1718
+
1719
+ gridParams.columns = this.columns
1720
+ if (gridParams.columns && this.options.dynamicColumns) {
1721
+ for (var i = 0; i < this.options.dynamicColumns.length; i++) {
1722
+ this.options.dynamicColumns[i].dynamic = true
1723
+ gridParams.columns.push(this.options.dynamicColumns[i])
1724
+ }
1725
+ }
1726
+ gridParams.lineEdit = this.lineEdit
1727
+ gridParams.basicInfo = this.basicInfo
1728
+ gridParams.pagination = this.pagination
1729
+ gridParams.query = this.query
1730
+
1731
+ this.gridData = data.gridData
1732
+ // 对数据做序列化,比如:处理xss攻击
1733
+ if (isHasOptionFunction('gridDataLoaded', this.code)) {
1734
+ const gridData = gridParams.options.gridDataLoaded.call(
1735
+ this,
1736
+ data.gridData
1737
+ )
1738
+ if (gridData) {
1739
+ this.gridData = gridData
1740
+ } else {
1741
+ this.gridData = data.gridData
1742
+ }
1743
+ } else {
1744
+ this.gridData = data.gridData
1745
+ }
1746
+
1747
+ if (this.pagination) {
1748
+ this.pagination.total = data.total
1749
+ }
1750
+ if (!this.gridData) {
1751
+ this.gridData = []
1752
+ }
1753
+ gridParams.gridData = this.gridData
1754
+ // 完成深拷贝,复制一份对象,行编辑时使用
1755
+ gridParams.orgGridData = [].concat(
1756
+ JSON.parse(JSON.stringify(this.gridData))
1757
+ )
1758
+ gridParams.pagination = this.pagination
1759
+
1760
+ // TODO: 输入焦点默认停在第一个可编辑的单元格
1761
+ if (this.lineEdit.editable) {
1762
+ if (this.gridData.length === 0) {
1763
+ this.createRow(this.code, null, this.gridData)
1764
+ }
1765
+ this.lineEdit['editingCell'] = {
1766
+ row: 0,
1767
+ prop: getFirstEditableColumn(this.code),
1768
+ }
1769
+ }
1770
+ if (isHasOptionFunction('gridComplete', this.code)) {
1771
+ gridParams.options.gridComplete.call(
1772
+ this,
1773
+ this.gridData,
1774
+ gridParams.columns
1775
+ )
1776
+ }
1777
+ })
1778
+ .catch((error) => {
1779
+ if (isHasOptionFunction('loadError', this.code)) {
1780
+ const gridParams = store.get(this.code)
1781
+ gridParams.options.loadError.call(this, this.code, error)
1782
+ }
1783
+ })
1784
+ },
1785
+ doSearch(searchForm) {
1786
+ // 修改当前页为第1页
1787
+ this.currentPage = 1
1788
+ // 将toolbar 参数和查询表单参数合并
1789
+ if (searchForm) {
1790
+ if (searchForm.length > 0) {
1791
+ if (this.toolbarFieldParam && this.toolbarFieldParam.length > 0) {
1792
+ if (searchForm.length === 1) {
1793
+ searchForm[0].leftBracket = '('
1794
+ searchForm[0].rightBracket = ')'
1795
+ }
1796
+ if (searchForm[searchForm.length - 1].joinSign === 'or') {
1797
+ searchForm[searchForm.length - 1].joinSign = 'and'
1798
+ }
1799
+ // 拼接
1800
+ // param.concat(toolbarFieldParam)
1801
+ Array.prototype.push.apply(searchForm, this.toolbarFieldParam)
1802
+ }
1803
+ } else {
1804
+ if (this.toolbarFieldParam && this.toolbarFieldParam.length > 0) {
1805
+ searchForm = this.toolbarFieldParam
1806
+ }
1807
+ }
1808
+ }
1809
+ this.search(searchForm, true)
1810
+ },
1811
+ doSearchDialog(searchForm) {
1812
+ // 修改当前页为第1页
1813
+ this.currentPage = 1
1814
+ this.search(searchForm, true)
1815
+ this.closeSearchFormDialog()
1816
+ },
1817
+ // cs123
1818
+ search(searchForm, isSearch, parentRowIds) {
1819
+ // 重新查询列表数据时,抛出refresh事件,供父组件捕获做自己的业务处理
1820
+ $emit(this, 'refresh')
1821
+ const vm = this
1822
+ return new Promise((resolve, reject) => {
1823
+ const gridParams = store.get(vm.code)
1824
+ if (typeof searchForm !== 'undefined' && searchForm !== null) {
1825
+ gridParams.searchForm = searchForm
1826
+ } else {
1827
+ gridParams.searchForm = null
1828
+ }
1829
+ if (gridParams.options && gridParams.options.isAdministerListView) {
1830
+ // 根据类型生成静态数据
1831
+ if (
1832
+ gridParams.options.SuperGrid &&
1833
+ gridParams.options.SuperGrid.simulationDate
1834
+ ) {
1835
+ let gridData
1836
+ if (isHasOptionFunction('gridDataLoaded', vm.code)) {
1837
+ gridData = gridParams.options.gridDataLoaded.call(this, {
1838
+ gridData: gridParams.options.SuperGrid.simulationDate,
1839
+ columns: gridParams.columns,
1840
+ })
1841
+ if (!gridData) {
1842
+ gridData = gridParams.options.SuperGrid.simulationDate
1843
+ }
1844
+ } else {
1845
+ gridData = gridParams.options.SuperGrid.simulationDate
1846
+ }
1847
+ resolve(gridData)
1848
+ }
1849
+ } else if (
1850
+ gridParams.options &&
1851
+ gridParams.options.isFormSubTable &&
1852
+ gridParams.options.subTableData &&
1853
+ gridParams.options.subTableData.length > 0
1854
+ ) {
1855
+ let gridData
1856
+ vm.hasLoadData = false
1857
+ gridParams.loaded = true
1858
+ // 如果有子表数据,则展示传递的子表数据
1859
+ if (isHasOptionFunction('gridDataLoaded', vm.code)) {
1860
+ gridData = gridParams.options.gridDataLoaded.call(this, {
1861
+ gridData: gridParams.options.subTableData,
1862
+ columns: gridParams.columns,
1863
+ })
1864
+ if (!gridData) {
1865
+ gridData = gridParams.options.subTableData
1866
+ vm.hasLoadData = true
1867
+ }
1868
+ } else {
1869
+ gridData = gridParams.options.subTableData
1870
+ vm.hasLoadData = true
1871
+ }
1872
+ resolve(gridData)
1873
+ } else {
1874
+ vm.fetchData(vm.getSearchParam(), isSearch, parentRowIds)
1875
+ .then((data) => {
1876
+ console.log('打印1====', gridParams)
1877
+ if (
1878
+ gridParams !== undefined &&
1879
+ gridParams.options !== undefined &&
1880
+ gridParams.options.isHiddenSearchForm !== undefined &&
1881
+ gridParams.options.isHiddenSearchForm === true
1882
+ ) {
1883
+ // 查询时,是否隐藏查询区域,默认是不隐藏查询区域
1884
+ console.log('打印2====', vm)
1885
+ vm.showSearch = false
1886
+ $emit(vm, 'cancel-search')
1887
+ }
1888
+ console.log('打印3====', vm)
1889
+ console.log('打印4====', vm.$refs)
1890
+ if (vm.$refs && vm.$refs.sf) {
1891
+ console.log('打印5====', vm.$refs.sf)
1892
+ vm.$refs.sf.loading = false
1893
+ vm.$refs.sf.searchComplete()
1894
+ }
1895
+ console.log('打印6====', vm)
1896
+ // 重新计算列表高度
1897
+ this.resizeTableHeight()
1898
+ resolve(data)
1899
+ })
1900
+ .catch((error) => {
1901
+ if (vm.$refs.sf) {
1902
+ vm.$refs.sf.loading = false
1903
+ vm.$refs.sf.searchComplete()
1904
+ }
1905
+ reject(error)
1906
+ })
1907
+ }
1908
+ })
1909
+ },
1910
+ // addSearchParam(searchData) {
1911
+ // if (searchData && searchData.length > 0) {
1912
+ // const gridParams = store.get(this.code)
1913
+ // if (typeof (gridParams.searchForm) !== 'undefined') {
1914
+ // const searchForm = gridParams.searchForm
1915
+ // searchForm.concat()
1916
+ // searchParam.searchForm = gridParams.searchForm
1917
+ // } else {
1918
+ // searchParam.searchForm = []
1919
+ // }
1920
+ // }
1921
+ // },
1922
+ getPaginationInfo() {
1923
+ const gridParams = store.get(this.code)
1924
+ if (this.pagination) {
1925
+ // 判断是否删除后请求数据
1926
+ if (this.isDelete && this.currentPage > 1) {
1927
+ const pageNum = Math.ceil(
1928
+ (this.pagination.total - this.gridData.length) /
1929
+ this.pagination.pageSize
1930
+ )
1931
+ this.currentPage =
1932
+ this.currentPage > pageNum ? pageNum : this.currentPage
1933
+ this.isDelete = false
1934
+ }
1935
+ const pagination = {
1936
+ currentPage: this.currentPage,
1937
+ pageSize: this.pagination.pageSize,
1938
+ showTotal: this.pagination.showTotal,
1939
+ }
1940
+ if (this.pageSize !== null) {
1941
+ // 表示更改了每页显示的数据条数
1942
+ pagination.pageSize = this.pageSize
1943
+ }
1944
+ if (
1945
+ typeof gridParams.currentPage !== 'undefined' &&
1946
+ gridParams.currentPage !== null
1947
+ ) {
1948
+ // 保持页数时使用
1949
+ pagination.currentPage = gridParams.currentPage
1950
+ // 必须清空一下,否则会导致翻页有问题
1951
+ gridParams.currentPage = null
1952
+ }
1953
+ return pagination
1954
+ } else {
1955
+ // TODO 临时解决列表工具栏有默认值时触发查询,查询没有分页问题,
1956
+ // 因为获取页面默认值后触发查询时候,列表的配置信息,比如分页是否编辑等元数据还没有查询过来
1957
+ return {
1958
+ currentPage: 1,
1959
+ pageSize: 20,
1960
+ showTotal: true,
1961
+ }
1962
+ }
1963
+ },
1964
+ getSearchParam() {
1965
+ const searchParam = {
1966
+ code: this.code,
1967
+ }
1968
+ const gridParams = store.get(this.code)
1969
+ const pagination = this.getPaginationInfo()
1970
+ if (pagination && pagination !== null) {
1971
+ searchParam.pagination = pagination
1972
+ }
1973
+ // 排序信息
1974
+ if (this.sortInfo !== null) {
1975
+ // 表示更改了排序信息
1976
+ searchParam.sorts = this.sortInfo
1977
+ }
1978
+ if (this.mergeFields && this.mergeFields.length > 0) {
1979
+ if (!searchParam.sorts) {
1980
+ searchParam.sorts = []
1981
+ }
1982
+ const mergeFieldsArr = []
1983
+ for (const mergeField of this.mergeFields) {
1984
+ let flag = true
1985
+ for (const so of searchParam.sorts) {
1986
+ if (so.prop === mergeField) {
1987
+ flag = false
1988
+ break
1989
+ }
1990
+ }
1991
+ if (flag) {
1992
+ mergeFieldsArr.push({
1993
+ prop: mergeField,
1994
+ order: 'ascending',
1995
+ })
1996
+ }
1997
+ }
1998
+ mergeFieldsArr.push(...searchParam.sorts)
1999
+ searchParam.sorts = mergeFieldsArr
2000
+ }
2001
+ // 是否有初始过滤条件
2002
+ if (
2003
+ gridParams.options &&
2004
+ typeof gridParams.options.initSearchForm !== 'undefined'
2005
+ ) {
2006
+ searchParam.initSearchForm = gridParams.options.initSearchForm
2007
+ }
2008
+ if (
2009
+ gridParams.query &&
2010
+ typeof gridParams.query.defaultQueryCriteria !== 'undefined'
2011
+ ) {
2012
+ // json字符串转数组
2013
+ searchParam.defaultQueryCriteria = JSON.parse(
2014
+ gridParams.query.defaultQueryCriteria
2015
+ )
2016
+ }
2017
+ if (typeof gridParams.searchForm !== 'undefined') {
2018
+ searchParam.searchForm = gridParams.searchForm
2019
+ } else {
2020
+ searchParam.searchForm = []
2021
+ }
2022
+ if (this.dynamicColumnInfo) {
2023
+ searchParam.dynamicColumnInfo = this.dynamicColumnInfo
2024
+ }
2025
+ if (this.dynamicServiceName) {
2026
+ searchParam.dynamicServiceName = this.dynamicServiceName
2027
+ }
2028
+ const additionalParamMap = gridParams.additionalParamMap
2029
+ if (additionalParamMap) {
2030
+ if (additionalParamMap && typeof additionalParamMap === 'object') {
2031
+ searchParam.additionalParamMap = additionalParamMap
2032
+ } else if (additionalParamMap && additionalParamMap !== '') {
2033
+ searchParam.additionalParamMap = JSON.parse(additionalParamMap)
2034
+ }
2035
+ }
2036
+ return searchParam
2037
+ },
2038
+ getComponentType(prop) {
2039
+ let type = 'NormalColumn'
2040
+ if (prop === '$index') {
2041
+ type = 'IndexColumn'
2042
+ } else if (prop === '$selection') {
2043
+ // 设置选中行时使用
2044
+ store.get(this.code).isMulitiSelect = true
2045
+ type = 'SelectionColumn'
2046
+ } else if (prop === undefined) {
2047
+ type = 'GroupColumn'
2048
+ }
2049
+ return type
2050
+ },
2051
+ focusOnFirstEditableInput() {
2052
+ if (this.basicInfo.editable) {
2053
+ this.lineEdit.editingCell.row = 0
2054
+ this.lineEdit.editingCell.prop = getFirstEditableColumn(this.code)
2055
+ }
2056
+ },
2057
+ handleSizeChange(val) {
2058
+ if (!this.options || !this.options.isPageShow) {
2059
+ // console.log(`每页 ${val} 条`)
2060
+ this.pageSize = val
2061
+ this.pagination.pageSize = val
2062
+ this.changePage()
2063
+ }
2064
+ },
2065
+ handleCurrentChange(val) {
2066
+ if (!this.options || !this.options.isPageShow) {
2067
+ // 翻页操作会导致筛选项发生变化,所以需要清空已有的
2068
+ this.changePage()
2069
+ }
2070
+ },
2071
+ changePage() {
2072
+ // 翻页操作会导致筛选项发生变化,所以需要清空已有的
2073
+ this.$refs.superGrid.clearFilter()
2074
+ // TODO: 把当前页数、每页条数、查询条件、排序信息传回后台
2075
+ if (this.isSubTableShowPage) {
2076
+ this.gridData = this.getSubTableGridData(this.subTableData)
2077
+ const gridParams = store.get(this.code)
2078
+ gridParams.gridData = this.gridData
2079
+ // 完成深拷贝,复制一份对象,行编辑时使用
2080
+ gridParams.orgGridData = [].concat(
2081
+ JSON.parse(JSON.stringify(this.gridData))
2082
+ )
2083
+ } else {
2084
+ this.fetchData(this.getSearchParam())
2085
+ }
2086
+ },
2087
+ handleSortChange({ column, prop, order }) {
2088
+ if (!this.options || !this.options.isPageShow) {
2089
+ let columnSetting = null
2090
+ const items = this.visibleColumns.filter((item) => {
2091
+ return column.property === item.prop
2092
+ })
2093
+ if (items && items.length > 0) {
2094
+ columnSetting = items[0]
2095
+ }
2096
+ if (!isCanRefreshGrid(this.code)) {
2097
+ // 如果最后编辑行没有保存或撤销编辑,则给出提示
2098
+ const gridParams = store.get(this.code)
2099
+ console.log(
2100
+ '请先保存或撤销编辑第' + gridParams.$rowIndex + 1 + '行记录,再排序'
2101
+ )
2102
+ this.$refs.superGrid.clearSort()
2103
+ } else {
2104
+ // TODO: 应该调用fetchData来获取信息,把当前页数、查询条件、排序信息传回后台
2105
+ if (prop !== null && columnSetting && columnSetting !== null) {
2106
+ // 当点击第3次时,prop会是空,表示清空排序字段,还原原顺序
2107
+ let orgProp = columnSetting.orgProp
2108
+ // sql查询时,会把点“.”改为两个下划线"__"
2109
+ const replaceDot = '__'
2110
+ if (orgProp && orgProp.indexOf(replaceDot) > 0) {
2111
+ // 表示包括点“.”,需要把两个下划线"__"重新改为点“.”,否则会导致查询报500错误
2112
+ orgProp = orgProp.replace(replaceDot, '.')
2113
+ }
2114
+ this.sortInfo = [
2115
+ {
2116
+ prop: orgProp,
2117
+ order: order,
2118
+ },
2119
+ ]
2120
+ } else {
2121
+ this.sortInfo = null
2122
+ }
2123
+ this.fetchData(this.getSearchParam())
2124
+ this.focusOnFirstEditableInput()
2125
+ $emit(this, 'sort-change', { columnSetting, prop, order, column })
2126
+ }
2127
+ }
2128
+ },
2129
+ isMergeable(prop) {
2130
+ for (const column of this.columns) {
2131
+ if (column.prop === prop) {
2132
+ if (
2133
+ this.mergeFields &&
2134
+ this.mergeFields.indexOf(column.prop) !== -1
2135
+ ) {
2136
+ return true
2137
+ } else {
2138
+ return column.span
2139
+ }
2140
+ }
2141
+ }
2142
+ },
2143
+ rowSpan({ row, column, rowIndex, columnIndex }) {
2144
+ if (this.isMergeable(column.property)) {
2145
+ const row = this.spanArr[column.property][rowIndex]
2146
+ const col = row > 0 ? 1 : 0
2147
+ return {
2148
+ rowspan: row,
2149
+ colspan: col,
2150
+ }
2151
+ }
2152
+ },
2153
+ packageSummaryColumnProps() {
2154
+ const summaryColumnProps = []
2155
+ this.visibleColumns.forEach((item) => {
2156
+ if (item.total !== undefined && item.total === true) {
2157
+ summaryColumnProps.push(item.prop)
2158
+ }
2159
+ })
2160
+ return summaryColumnProps
2161
+ },
2162
+ getSummaries(param) {
2163
+ // 后台返回时需要处理好序号列和多选列
2164
+ if (this.basicInfo.summary !== 'no') {
2165
+ const summaryMap = this.summaries
2166
+ if (summaryMap) {
2167
+ return this.getCustomSummaries(param, summaryMap)
2168
+ } else {
2169
+ return this.getDefaultSummaries(param)
2170
+ }
2171
+ } else {
2172
+ return []
2173
+ }
2174
+ },
2175
+ getCustomSummaries(param, summaryMap) {
2176
+ // key为字段名,value为
2177
+ const { columns } = param
2178
+ const sums = []
2179
+ columns.forEach((column, index) => {
2180
+ const prop = column.property
2181
+ const summaryVal = summaryMap[prop]
2182
+ if (summaryVal !== undefined && summaryVal !== null) {
2183
+ sums[index] = summaryVal
2184
+ } else {
2185
+ sums[index] = ''
2186
+ }
2187
+ })
2188
+ return sums
2189
+ },
2190
+ getDefaultSummaries(param) {
2191
+ const sums = []
2192
+ const summaryColumnProps = this.packageSummaryColumnProps()
2193
+ if (summaryColumnProps.length > 0) {
2194
+ const { columns, data } = param
2195
+ let totalColIndex = null
2196
+ columns.forEach((column, index) => {
2197
+ let colTotal = 0
2198
+ const prop = column.property
2199
+ if (prop && prop !== '$selection' && prop !== '$index') {
2200
+ // 设置合计列
2201
+ if (totalColIndex === undefined || totalColIndex === null) {
2202
+ totalColIndex = index
2203
+ sums[index] = '合计'
2204
+ return
2205
+ }
2206
+ }
2207
+ if (summaryColumnProps.indexOf(prop) >= 0) {
2208
+ // 表示该列需要合计
2209
+ if (data) {
2210
+ data.forEach((row) => {
2211
+ let fieldValue = getEntityFieldValueWithOutCase(row, prop)
2212
+ let numberValue
2213
+ if (fieldValue !== undefined && fieldValue !== null) {
2214
+ // 表示值存在,不需要转换
2215
+ numberValue = Number(fieldValue)
2216
+ } else {
2217
+ // 表示值不存在,需要转小写,再获得一遍
2218
+ const reg1 = /[A-Z]+/ // 大写字母
2219
+ if (this.isSql && reg1.test(prop)) {
2220
+ fieldValue = getEntityFieldValueWithOutCase(
2221
+ row,
2222
+ prop.toLowerCase()
2223
+ )
2224
+ if (fieldValue !== undefined && fieldValue !== null) {
2225
+ numberValue = Number(fieldValue)
2226
+ }
2227
+ }
2228
+ }
2229
+ if (
2230
+ numberValue !== undefined &&
2231
+ numberValue !== null &&
2232
+ !isNaN(numberValue)
2233
+ ) {
2234
+ colTotal += numberValue
2235
+ }
2236
+ })
2237
+ }
2238
+ sums[index] = colTotal
2239
+ } else {
2240
+ sums[index] = ''
2241
+ }
2242
+ })
2243
+ }
2244
+ return sums
2245
+ },
2246
+ configColumns() {
2247
+ this.showColumnConfig = true
2248
+ // 完成深拷贝,复制一份对象,行编辑时使用
2249
+ this.orgColumnConfig = [].concat(JSON.parse(JSON.stringify(this.columns)))
2250
+ },
2251
+ // 行拖拽
2252
+ rowDrop() {
2253
+ if (this.lineEdit && this.lineEdit.urlToSaveOrder) {
2254
+ const tbody = document.querySelector('.el-table__body-wrapper tbody')
2255
+ if (tbody != null) {
2256
+ const vm = this
2257
+ Sortable.create(tbody, {
2258
+ onEnd({ newIndex, oldIndex }) {
2259
+ const params = {
2260
+ oldIndex: oldIndex,
2261
+ newIndex: newIndex,
2262
+ }
2263
+ this.$http
2264
+ .post(this.lineEdit.urlToSaveOrder, params)
2265
+ .then((data) => {
2266
+ const currRow = vm.gridData.splice(oldIndex, 1)[0]
2267
+ vm.gridData.splice(newIndex, 0, currRow)
2268
+ })
2269
+ },
2270
+ })
2271
+ }
2272
+ }
2273
+ },
2274
+ closeCustomConfig(isRefreshGrid) {
2275
+ if (isRefreshGrid !== undefined && isRefreshGrid === true) {
2276
+ this.refreshGridInitialize()
2277
+ }
2278
+ this.showColumnConfig = false
2279
+ },
2280
+ resetCustomConfig() {
2281
+ this.refreshGridInitialize()
2282
+ },
2283
+ refreshGridInitialize() {
2284
+ this.initialize().then(() => {
2285
+ // 添加该代码是为了解决保存字段个性化配置后,重新渲染列表问题,例如:列宽重新计算问题
2286
+ this.refreshGrid = false
2287
+ const vm = this
2288
+ setTimeout(function () {
2289
+ vm.refreshGrid = true
2290
+ }, 100)
2291
+ })
2292
+ },
2293
+ loadChildren(row, treeNode, resove) {
2294
+ if (this.isLazy) {
2295
+ this.loadChildrenNode(row, treeNode, resove)
2296
+ }
2297
+ },
2298
+ loadChildrenNode(row, treeNode, resove) {
2299
+ const subRowUrl = this.options.subRowUrl
2300
+ if (
2301
+ typeof subRowUrl !== 'undefined' &&
2302
+ subRowUrl !== '' &&
2303
+ subRowUrl !== null
2304
+ ) {
2305
+ const parentRowIds = []
2306
+ parentRowIds.push(row.id ? row.id : row.ID)
2307
+ this.fetchData(this.getSearchParam(), false, parentRowIds, resove)
2308
+ }
2309
+ },
2310
+ expandChange(row, expanded) {
2311
+ if (this.isLazy) {
2312
+ // console.log('expandChange==row, expanded', row, expanded, this.$refs.superGrid.store.states)
2313
+ if (expanded === false) {
2314
+ // 折叠时清空表格缓存的已加载的标识位,使其能够动态更新子集合
2315
+ // 必须添加这句,否则不会重新走load
2316
+ if (this.$refs.superGrid.store.states.treeData) {
2317
+ this.$refs.superGrid.store.states.treeData[
2318
+ row.id ? row.id : row.ID
2319
+ ].loaded = false
2320
+ }
2321
+ } else {
2322
+ // console.log('expandChange=this.$refs.superGrid.store.states.lazyTreeNodeMap', this.$refs.superGrid.store.states.lazyTreeNodeMap)
2323
+ // console.log('expandChange=this.$refs.superGrid.store.states.treeData', this.$refs.superGrid.store.states.treeData)
2324
+ // console.log('expandChange=this.$refs.superGrid.store.states.selection', this.$refs.superGrid.store.states.selection)
2325
+ }
2326
+ }
2327
+ },
2328
+ removeGridStoreSelection(parentRowIds) {
2329
+ let selection = []
2330
+ if (this.$refs.superGrid.store.states.selection) {
2331
+ selection = [].concat(
2332
+ JSON.parse(
2333
+ JSON.stringify(this.$refs.superGrid.store.states.selection)
2334
+ )
2335
+ )
2336
+ }
2337
+ for (let i = 0; i < selection.length; i++) {
2338
+ if (
2339
+ parentRowIds &&
2340
+ parentRowIds.indexOf(selection[i][this.parentProp]) >= 0
2341
+ ) {
2342
+ // 移除第i个元素
2343
+ this.$refs.superGrid.store.states.selection.splice(i, 1)
2344
+ if (this.$refs.superGrid.store.states.selection.length > 0) {
2345
+ this.removeGridStoreSelection(parentRowIds)
2346
+ }
2347
+ break
2348
+ }
2349
+ }
2350
+ },
2351
+ changeHederWidth(newWidth, oldWidth, column, event) {
2352
+ const newCellWidth = newWidth - 5
2353
+ let myNewWidth = newCellWidth
2354
+ this.dragColumnProp = column.property
2355
+ const gridParams = store.get(this.code)
2356
+ if (isHasOptionFunction('resizeColumn', this.code)) {
2357
+ const newWidth = gridParams.options.resizeColumn.call(this, {
2358
+ code: this.code,
2359
+ newWidth: newWidth,
2360
+ oldWidth: oldWidth,
2361
+ column: column,
2362
+ })
2363
+ if (newWidth) {
2364
+ myNewWidth = newWidth
2365
+ }
2366
+ }
2367
+ this.newWidth = Math.ceil(myNewWidth)
2368
+ if (
2369
+ typeof this.options.isAdministerListView !== 'undefined' &&
2370
+ this.options.isAdministerListView != null &&
2371
+ this.options.isAdministerListView === true
2372
+ ) {
2373
+ // 表示是列表字段配置时
2374
+ $emit(this, 'changeHederWidth', this.newWidth)
2375
+ } else {
2376
+ // 应用模式时
2377
+ // 保存拖动后的列宽
2378
+ this.saveColumnWidth(this.dragColumnProp, this.newWidth).then(() => {
2379
+ const items = this.getColumnByElementColumn(column)
2380
+ if (items && items.length > 0) {
2381
+ items[0].widthType = 'custom'
2382
+ items[0].width = this.newWidth + ''
2383
+ }
2384
+ })
2385
+ }
2386
+ },
2387
+ resetSearch() {
2388
+ let searchForm = null
2389
+ if (this.toolbarFieldParam && this.toolbarFieldParam.length > 0) {
2390
+ searchForm = this.toolbarFieldParam
2391
+ }
2392
+ // 修改当前页为第1页
2393
+ this.currentPage = 1
2394
+ this.search(searchForm, false)
2395
+ },
2396
+ // 获取列信息
2397
+ getColumnInformation() {
2398
+ return this.visibleColumns
2399
+ },
2400
+ // 点击表头触发回调
2401
+ headerClick(column, event) {
2402
+ // 三种类型
2403
+ const items = this.getColumnByElementColumn(column)
2404
+ if (items && items.length > 0) {
2405
+ $emit(this, 'header-click', items[0])
2406
+ this.changeHeaderStyleTwo(items[0])
2407
+ } else {
2408
+ $emit(this, 'header-click', null)
2409
+ }
2410
+ this.clearHeaderContextmenu()
2411
+ },
2412
+ changeHeaderStyleTwo(item) {
2413
+ // 改变options中的配置
2414
+ // 还原所有颜色(隐藏字段判断,设置为灰色;选中字段设置为蓝色)
2415
+ if (
2416
+ typeof this.options.isAdministerListView !== 'undefined' &&
2417
+ this.options.isAdministerListView != null &&
2418
+ this.options.isAdministerListView === true
2419
+ ) {
2420
+ this.createBackgroundColorMap()
2421
+ this.backgroundColorMap[item.prop] = '#409EFF'
2422
+ if (this.$refs && this.$refs.superGrid) {
2423
+ this.$refs.superGrid.doLayout()
2424
+ }
2425
+ }
2426
+ },
2427
+ // 编辑模式下创建一个对象,存储各个表头的背景色
2428
+ createBackgroundColorMap() {
2429
+ const items = this.getColumnInformation()
2430
+ const backgroundColorMap = {}
2431
+ if (items && items.length > 0) {
2432
+ for (var i = 0; i < items.length; i++) {
2433
+ const item = items[i]
2434
+ if (item.show === undefined || item.show) {
2435
+ // 表示显示
2436
+ } else {
2437
+ backgroundColorMap[item.prop] = '#808080'
2438
+ }
2439
+ if (
2440
+ this.backgroundColorMap &&
2441
+ this.backgroundColorMap[item.prop] === '#409EFF' &&
2442
+ this.externalClickFlag
2443
+ ) {
2444
+ backgroundColorMap[item.prop] = '#409EFF'
2445
+ }
2446
+ }
2447
+ }
2448
+ this.backgroundColorMap = backgroundColorMap
2449
+ this.externalClickFlag = false
2450
+ if (this.$refs && this.$refs.superGrid) {
2451
+ this.$refs.superGrid.doLayout()
2452
+ }
2453
+ },
2454
+ // 根据element事件传递的column来获取自定义封装的column
2455
+ getColumnByElementColumn(column) {
2456
+ let items = null
2457
+ if (column.type && column.type === 'selection') {
2458
+ // 表示为选择框
2459
+ items = this.visibleColumns.filter((item) => {
2460
+ return item.prop === '$selection'
2461
+ })
2462
+ } else if (column.type && column.type === 'default' && !column.property) {
2463
+ // 表示为序号
2464
+ items = this.visibleColumns.filter((item) => {
2465
+ return item.prop === '$index'
2466
+ })
2467
+ } else if (column.property) {
2468
+ // 表示为普通字段
2469
+ items = this.visibleColumns.filter((item) => {
2470
+ return column.property === item.prop
2471
+ })
2472
+ }
2473
+ return items
2474
+ },
2475
+ // 右键表头
2476
+ headerContextmenu(column, event) {
2477
+ // 阻止鼠标的默认事件
2478
+ event.preventDefault()
2479
+ const items = this.getColumnByElementColumn(column)
2480
+ if (items && items.length > 0) {
2481
+ const item = items[0]
2482
+ $emit(this, 'header-click', items[0])
2483
+ this.changeHeaderStyleTwo(items[0])
2484
+ this.showHeaderContextmenu = true
2485
+ this.rightClickColumn = item
2486
+ const menu = this.$refs.headerMenu.$el
2487
+ const scrollTop =
2488
+ document.documentElement.scrollTop || document.body.scrollTop
2489
+ menu.style.display = 'block'
2490
+ menu.style.left = event.clientX + 'px'
2491
+ // 当滑动滚动条时也能准确获取菜单位置
2492
+ menu.style.top = event.clientY + scrollTop - 10 + 'px'
2493
+ }
2494
+ },
2495
+ // 清除右键菜单显示
2496
+ clearHeaderContextmenu() {
2497
+ this.showHeaderContextmenu = false
2498
+ this.rightClickColumn = null
2499
+ },
2500
+ // 返回表单子表模式下数据
2501
+ validatorSunTableListData() {
2502
+ // 返回之前需要进行规则校验
2503
+ let gridData = this.gridData
2504
+ if (this.isSubTableShowPage) {
2505
+ gridData = this.subTableData
2506
+ }
2507
+ if (gridData && gridData.length > 0) {
2508
+ const pageSize = this.pagination && this.pagination.pageSize
2509
+ const validateRules = formValidatorService.getValidator(this.code)
2510
+ for (let i = 0; i < gridData.length; i++) {
2511
+ const row = gridData[i]
2512
+ // 取消最后一个编辑行的状态
2513
+ if (row.$editing !== undefined && row.$editing === true) {
2514
+ setEntityFieldValue(row, '$editing', false)
2515
+ // 取消上一行选中状态时,触发un-edit事件,处理下拉多选选项组问题
2516
+ $emit(eventBus, 'un-edit', { row: row })
2517
+ }
2518
+ let needValidate = true
2519
+ if (isHasEditOption('isEnableValidate', this.code)) {
2520
+ // 表示配置了是否启用必填验证
2521
+ needValidate =
2522
+ this.gridParams.options.lineEditOptions['isEnableValidate']
2523
+ }
2524
+ let validateResult = true
2525
+ if (needValidate === true) {
2526
+ let pageNum
2527
+ // 每页的记录下标,提示时使用
2528
+ let pageRowIndex
2529
+ if (
2530
+ this.isSubTableShowPage &&
2531
+ pageSize !== undefined &&
2532
+ pageSize > 0
2533
+ ) {
2534
+ pageNum = Math.ceil((i + 1) / pageSize)
2535
+ pageRowIndex = i + 1 - (pageNum - 1) * pageSize
2536
+ }
2537
+ validateResult = formValidatorService.validator(
2538
+ row,
2539
+ this.code,
2540
+ i,
2541
+ validateRules,
2542
+ this.isSubTableShowPage,
2543
+ pageNum,
2544
+ pageRowIndex
2545
+ )
2546
+ }
2547
+ if (validateResult !== null && validateResult !== undefined) {
2548
+ if (
2549
+ typeof validateResult === 'string' ||
2550
+ validateResult === false
2551
+ ) {
2552
+ return false
2553
+ }
2554
+ }
2555
+ }
2556
+ return true
2557
+ }
2558
+ return true
2559
+ },
2560
+ getSunTableListData() {
2561
+ return this.isSubTableShowPage ? this.subTableData : this.gridData
2562
+ },
2563
+ rowDblclickEvent(row, column, event) {
2564
+ const gridParams = store.get(this.code)
2565
+ if (
2566
+ gridParams.options &&
2567
+ gridParams.options.isFormSubTable &&
2568
+ gridParams.options.isPdfEditor
2569
+ ) {
2570
+ // 如果是子表并且是pdf模式
2571
+ } else if (this.isFormSubTable) {
2572
+ // 表示是表单的子表,点击时需要将当前行设为行编辑状态,并保存上一行的记录(不是保存到数据库,只是把编辑状态改为false)
2573
+ if (column.property && column.property !== 'operation') {
2574
+ const isSubTableShowPage = gridParams.isSubTableShowPage
2575
+ console.log(gridParams.options.lineEditOptions)
2576
+ const canEdit = gridParams.options.lineEditOptions.beforeEditRow.call(
2577
+ this,
2578
+ isSubTableShowPage ? gridParams.subTableData : gridParams.gridData,
2579
+ row,
2580
+ -1
2581
+ )
2582
+ if (canEdit === undefined || canEdit === true) {
2583
+ // 取消上一行的编辑状态
2584
+ let editRows
2585
+ const gridParams = store.get(this.code)
2586
+ if (this.isSubTableShowPage) {
2587
+ editRows = this.subTableData.filter(
2588
+ (row) => row.$editing !== undefined && row.$editing === true
2589
+ )
2590
+ } else {
2591
+ editRows = this.gridData.filter(
2592
+ (row) => row.$editing !== undefined && row.$editing === true
2593
+ )
2594
+ }
2595
+ if (editRows && editRows.length > 0) {
2596
+ editRows.forEach((editRow) => {
2597
+ setEntityFieldValue(editRow, '$editing', false)
2598
+ // 取消上一行选中状态时,触发un-edit事件,处理下拉多选选项组问题
2599
+ $emit(eventBus, 'un-edit', { row: editRow })
2600
+ // this.$set(editRow, '$editing', false)
2601
+ })
2602
+ }
2603
+ gridParams.isEditRow = false
2604
+ setEntityFieldValue(row, '$editing', true)
2605
+ gridParams.$editRow = row
2606
+ // this.$set(row, '$editing', true)
2607
+ gridParams.isEditRow = true
2608
+ }
2609
+ }
2610
+ } else {
2611
+ if (row) {
2612
+ if (
2613
+ gridParams &&
2614
+ gridParams.lineEdit &&
2615
+ gridParams.lineEdit.editable &&
2616
+ gridParams.canntEdit
2617
+ ) {
2618
+ let index = this.gridData.findIndex(function (item) {
2619
+ return (
2620
+ (item.id && item.id === row.id) ||
2621
+ (item.ID && item.ID === row.ID)
2622
+ )
2623
+ })
2624
+ if (index < 0) {
2625
+ index = 0
2626
+ }
2627
+ this.editRow(index)
2628
+ }
2629
+ }
2630
+ }
2631
+ this.rowDblClick(row, column, event)
2632
+ },
2633
+ rowClickEvent(row, column, event) {
2634
+ // if (
2635
+ // this.isFormSubTable &&
2636
+ // column.property &&
2637
+ // column.property !== 'operation'
2638
+ // ) {
2639
+ // // 表示是表单的子表,点击时需要将当前行设为行编辑状态,并保存上一行的记录(不是保存到数据库,只是把编辑状态改为false)
2640
+ // // 取消上一行的编辑状态
2641
+ // const gridParams = store.get(this.code)
2642
+ // const editRows = this.gridData.filter(
2643
+ // row => row.$editing !== undefined && row.$editing === true
2644
+ // )
2645
+ // if (editRows && editRows.length > 0) {
2646
+ // editRows.forEach(editRow => {
2647
+ // this.$set(editRow, '$editing', false)
2648
+ // })
2649
+ // }
2650
+ // gridParams.isEditRow = false
2651
+ // this.$set(row, '$editing', true)
2652
+ // gridParams.isEditRow = true
2653
+ // }
2654
+ // this.rowClick(row, column, event)
2655
+ },
2656
+ openPageDialog(openPageParams) {
2657
+ let jumpMode
2658
+ if (openPageParams) {
2659
+ jumpMode = openPageParams.jumpMode
2660
+ }
2661
+ const popPageSetting = openPageParams
2662
+ if (jumpMode === 'popup') {
2663
+ // 弹出页面
2664
+ this.jumpPageSetting = popPageSetting
2665
+ this.isShowPageDialog = true
2666
+ } else if (jumpMode === 'refresh') {
2667
+ this.$router.push({ path: '/dsc/page', query: popPageSetting })
2668
+ }
2669
+ },
2670
+ // api方法,super-pages中有调用该方法
2671
+ closePageDialog(popParams) {
2672
+ // popParams格式为:{ entity, pageCode }
2673
+ if (this.jumpPageSetting) {
2674
+ // 调用关闭弹框事件
2675
+ const gridParams = store.get(this.code)
2676
+ const closeEventName = this.jumpPageSetting.closeEvent
2677
+ const row = this.jumpPageSetting.row
2678
+ let closeEvent
2679
+ if (
2680
+ gridParams.options.eventCallBack &&
2681
+ closeEventName &&
2682
+ closeEventName !== null &&
2683
+ gridParams.options.eventCallBack[closeEventName]
2684
+ ) {
2685
+ // 表单页面中子表自定义事件集合
2686
+ closeEvent = gridParams.options.eventCallBack[closeEventName]
2687
+ }
2688
+ if (closeEvent) {
2689
+ const params = {
2690
+ params: gridParams.additionalParamMap,
2691
+ entity: row,
2692
+ }
2693
+ if (popParams) {
2694
+ params.eventParams = {
2695
+ popEntity: popParams.entity,
2696
+ popPageCode: popParams.pageCode,
2697
+ pageCode: this.pageCode,
2698
+ }
2699
+ }
2700
+ closeEvent.call(this, params)
2701
+ }
2702
+ }
2703
+ this.isShowPageDialog = false
2704
+ this.jumpPageSetting = null
2705
+ },
2706
+ updateValues(sourceModel, sourceTableName, targetRowIndex) {
2707
+ // TODO 值更新
2708
+ const gridParams = store.get(this.code)
2709
+ const editRowIndex = targetRowIndex
2710
+ if (
2711
+ editRowIndex !== undefined &&
2712
+ editRowIndex !== null &&
2713
+ editRowIndex < this.gridData.length
2714
+ ) {
2715
+ // 返回true表示不需要替换字段,false表示需要替换字段
2716
+ const isNotNeedReplaceFieldName =
2717
+ this.isSql === false ||
2718
+ (gridParams.options &&
2719
+ ((gridParams.options.isAdministerListView !== undefined &&
2720
+ gridParams.options.isAdministerListView === true) ||
2721
+ (gridParams.options.isFormSubTable !== undefined &&
2722
+ gridParams.options.isFormSubTable === true)))
2723
+ const tableName = this.tableName
2724
+ updateWithPageValue(
2725
+ sourceModel,
2726
+ sourceTableName,
2727
+ this.jumpPageSetting,
2728
+ this.gridData[editRowIndex],
2729
+ tableName,
2730
+ !isNotNeedReplaceFieldName
2731
+ )
2732
+ const updateValueEventName =
2733
+ this.jumpPageSetting && this.jumpPageSetting.updateValueEvent
2734
+ ? this.jumpPageSetting.updateValueEvent
2735
+ : null
2736
+ let updateValueEvent
2737
+ if (
2738
+ gridParams.options.eventCallBack &&
2739
+ updateValueEventName &&
2740
+ updateValueEventName !== null &&
2741
+ gridParams.options.eventCallBack[updateValueEventName]
2742
+ ) {
2743
+ // 表单页面中子表自定义事件集合
2744
+ updateValueEvent =
2745
+ gridParams.options.eventCallBack[updateValueEventName]
2746
+ }
2747
+ if (updateValueEvent) {
2748
+ updateValueEvent.call(this, {
2749
+ sourceModel,
2750
+ sourceTableName,
2751
+ jumpPageSetting: this.jumpPageSetting,
2752
+ entity: this.gridData[editRowIndex],
2753
+ targetTableName: tableName,
2754
+ isNeedReplaceFieldName: !isNotNeedReplaceFieldName,
2755
+ })
2756
+ }
2757
+ }
2758
+ },
2759
+ closeSearchFormDialog() {
2760
+ this.showSearch = false
2761
+ },
2762
+ // 获取当前列表的查询方式,page项目使用
2763
+ getQueryMode() {
2764
+ if (this.query && this.query.showType === 'popup') {
2765
+ return 'popup'
2766
+ } else {
2767
+ return 'embedded'
2768
+ }
2769
+ },
2770
+ selectCell(row, column, cell, event) {
2771
+ if (cell) {
2772
+ this.cellClick(row, column, cell, event)
2773
+ this.$nextTick(() => {
2774
+ cell.style['border'] = '2px solid #409EFF'
2775
+ this.currentSelectCell = cell
2776
+ })
2777
+ }
2778
+ },
2779
+ // 刷新列表数据
2780
+ refreshGridData() {
2781
+ this.refresh(false, true)
2782
+ },
2783
+ // 刷新列表数据
2784
+ refresData(data) {
2785
+ const gridParams = store.get(this.code)
2786
+ gridParams.gridData = data
2787
+ store.set(this.code, gridParams)
2788
+ this['gridData'] = data
2789
+ },
2790
+ refresPortData(port, value, index) {
2791
+ if (this.gridData[index]) {
2792
+ this.gridData[index][port] = value
2793
+ this.$forceUpdate()
2794
+ }
2795
+ },
2796
+
2797
+ refresPortsData(entity, index) {
2798
+ if (entity) {
2799
+ for (const key in entity) {
2800
+ if (this.gridData[index]) {
2801
+ this.gridData[index][key] = entity[key]
2802
+ this.$forceUpdate()
2803
+ console.log('this.$forceUpdate()', this.$refs[key])
2804
+ }
2805
+ }
2806
+ // entity.forEach(item => {
2807
+ // if (this.gridData[index]) {
2808
+ // this.$set(this.gridData[index], item.prop, item.value)
2809
+ // }
2810
+ // })
2811
+ }
2812
+ },
2813
+ refresMainTableFields(map) {
2814
+ $emit(this, 'refresMainTableFields', map)
2815
+ },
2816
+ openFold(isOpen) {
2817
+ this.resizeTableHeight()
2818
+ },
2819
+ // 设置字段禁止编辑
2820
+ fnProhibitToEdit(entity) {
2821
+ if (entity) {
2822
+ for (const key in entity) {
2823
+ // console.log('key', key)
2824
+ // console.log('this.$refs[key]', this.$refs)
2825
+ if (this.$refs[key]) {
2826
+ this.$refs[key][0].fnProhibitToEdit(entity[key])
2827
+ }
2828
+ }
2829
+ }
2830
+ },
2831
+ // 设置字段禁止编辑
2832
+ prohibitToEdit(entity) {
2833
+ this.fnProhibitToEdit(entity)
2834
+ },
2835
+ // 树形结构时数据展示
2836
+ getTreeProps(parentProp, isSql, isLazy, dataSourceType) {
2837
+ let treeProps = {
2838
+ children: 'children',
2839
+ hasChildren: '_has_children',
2840
+ }
2841
+ if (parentProp) {
2842
+ treeProps = {
2843
+ children: 'children',
2844
+ }
2845
+ let hasChildren = 'hasChildren'
2846
+ if (isLazy) {
2847
+ if (isSql) {
2848
+ if (dataSourceType === 'oracle') {
2849
+ hasChildren = 'HAS_CHILDREN'
2850
+ } else {
2851
+ hasChildren = 'has_children'
2852
+ }
2853
+ }
2854
+ }
2855
+ treeProps.hasChildren = hasChildren
2856
+ }
2857
+ return treeProps
2858
+ },
2859
+ refreshSubTableData(data) {
2860
+ const gridParams = store.get(this.code)
2861
+ gridParams.subTableData = data
2862
+ store.set(this.code, gridParams)
2863
+ this['subTableData'] = data
2864
+ },
2865
+ },
2866
+ emits: [
2867
+ 'change-grid-data',
2868
+ 'change-rows-per-page',
2869
+ 'set-select-options',
2870
+ 'setSearchType',
2871
+ 'sort-change',
2872
+ 'changeHederWidth',
2873
+ 'header-click',
2874
+ 'un-edit',
2875
+ 'refresMainTableFields',
2876
+ 'refresh',
2877
+ 'cancel-search',
2878
+ ,
2879
+ ,
2880
+ ],
2881
+ }
2882
+ </script>
2883
+
2884
+ <style lang="scss" rel="stylesheet/scss" scoped>
2885
+ .grid-area {
2886
+ .elTable th {
2887
+ padding: 2px 0 !important;
2888
+ }
2889
+ .elTable td {
2890
+ padding: 2px 0 !important;
2891
+ }
2892
+ }
2893
+ </style>