agilebuilder-ui 1.0.621 → 1.0.962

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 (120) hide show
  1. package/lib/super-ui.css +1 -1
  2. package/lib/super-ui.js +115880 -110424
  3. package/lib/super-ui.umd.cjs +103 -95
  4. package/package.json +6 -3
  5. package/packages/department-tree/src/department-tree.vue +27 -10
  6. package/packages/department-tree-inline/src/department-tree-service.js +20 -41
  7. package/packages/department-tree-mobile/src/department-tree-app.vue +6 -6
  8. package/packages/department-tree-mobile/src/department-tree-inline-app.vue +15 -15
  9. package/packages/department-user-tree/src/department-user-tree.vue +17 -2
  10. package/packages/department-user-tree-inline/src/department-user-multiple-tree-inline.vue +61 -26
  11. package/packages/department-user-tree-inline/src/department-user-single-tree-inline.vue +64 -22
  12. package/packages/department-user-tree-inline/src/department-user-tree-single-service.js +0 -6
  13. package/packages/department-user-tree-inline/src/group-user/group-input.vue +162 -0
  14. package/packages/department-user-tree-inline/src/group-user/group-list.vue +99 -0
  15. package/packages/department-user-tree-inline/src/group-user/group-user.vue +42 -0
  16. package/packages/department-user-tree-inline/src/group-user-multiple-tree.vue +304 -0
  17. package/packages/department-user-tree-inline/src/group-user-single-tree.vue +155 -0
  18. package/packages/department-user-tree-inline/src/group-user-tree-service.js +74 -0
  19. package/packages/department-user-tree-inline/src/search-result.vue +34 -36
  20. package/packages/department-user-tree-mobile/src/department-user-tree-app.vue +6 -6
  21. package/packages/department-user-tree-mobile/src/department-user-tree-inline-app.vue +17 -19
  22. package/packages/department-user-tree-mobile/src/department-user-tree-service.ts +0 -11
  23. package/packages/dynamic-source-select/src/dynamic-source-select.vue +795 -799
  24. package/packages/dynamic-source-select/src/events.js +11 -16
  25. package/packages/fs-upload-list/src/fs-upload-list.vue +183 -122
  26. package/packages/fs-upload-new/src/file-upload-mobile/file-upload-app.vue +246 -0
  27. package/packages/fs-upload-new/src/file-upload-mobile/file-upload-browser.vue +480 -0
  28. package/packages/fs-upload-new/src/file-upload-mobile/file-upload-component.vue +127 -0
  29. package/packages/fs-upload-new/src/file-upload-mobile/file-upload-input.vue +246 -0
  30. package/packages/fs-upload-new/src/file-upload-mobile/file-upload.vue +255 -0
  31. package/packages/fs-upload-new/src/fs-button-upload.vue +10 -13
  32. package/packages/fs-upload-new/src/fs-drag-upload.vue +4 -8
  33. package/packages/fs-upload-new/src/fs-preview-new.vue +103 -36
  34. package/packages/fs-upload-new/src/fs-upload-new.vue +160 -13
  35. package/packages/index.js +11 -2
  36. package/packages/organization-input/src/organization-input.vue +493 -539
  37. package/packages/plugins/export-data-new.js +34 -1
  38. package/packages/rich-editor/index.vue +29 -0
  39. package/packages/row-form/index.js +7 -0
  40. package/packages/row-form/index.vue +211 -0
  41. package/packages/scan-code-input/src/scan-code-input.vue +136 -104
  42. package/packages/scan-code-input-browser/index.js +6 -0
  43. package/packages/{scan-code-input/src/scan-code-input-colse.vue → scan-code-input-browser/src/scan-code-input.vue} +1 -28
  44. package/packages/secret-info/index.vue +2 -2
  45. package/packages/super-grid/src/apis.js +158 -10
  46. package/packages/super-grid/src/components/grid-icon.vue +7 -14
  47. package/packages/super-grid/src/components/hyperlinks.vue +24 -8
  48. package/packages/super-grid/src/custom-formatter.js +312 -380
  49. package/packages/super-grid/src/dynamic-input.vue +346 -43
  50. package/packages/super-grid/src/formValidatorUtil.js +79 -15
  51. package/packages/super-grid/src/group-column.vue +5 -0
  52. package/packages/super-grid/src/normal-column-content.vue +1056 -0
  53. package/packages/super-grid/src/normal-column.vue +57 -740
  54. package/packages/super-grid/src/row-detail.vue +50 -0
  55. package/packages/super-grid/src/row-operation.vue +19 -10
  56. package/packages/super-grid/src/scan-util.ts +243 -0
  57. package/packages/super-grid/src/search-button.vue +18 -14
  58. package/packages/super-grid/src/search-form-advancedQuery.vue +9 -2
  59. package/packages/super-grid/src/search-form-item.vue +10 -3
  60. package/packages/super-grid/src/search-form-mobile.vue +250 -0
  61. package/packages/super-grid/src/search-form.vue +159 -82
  62. package/packages/super-grid/src/super-grid-service.js +51 -6
  63. package/packages/super-grid/src/super-grid.vue +657 -761
  64. package/packages/super-grid/src/utils.js +126 -170
  65. package/packages/super-nine-grid/src/super-nine-grid.vue +1032 -1141
  66. package/packages/workflow-button/src/workflow-button.vue +6 -1
  67. package/packages/workgroup-tree/src/workgroup-tree.vue +31 -0
  68. package/packages/workgroup-tree-inline/src/workgroup-tree-inline.vue +28 -0
  69. package/packages/workgroup-tree-inline/src/workgroup-tree-service.js +26 -0
  70. package/packages/workgroup-tree-mobile/index.js +6 -0
  71. package/packages/workgroup-tree-mobile/src/dept-result.vue +51 -0
  72. package/packages/workgroup-tree-mobile/src/workgroup-tree-app.vue +120 -0
  73. package/packages/workgroup-tree-mobile/src/workgroup-tree-inline-app.vue +375 -0
  74. package/packages/workgroup-tree-mobile/src/workgroup-tree-service.ts +62 -0
  75. package/packages/workgroup-user-tree/src/workgroup-user-tree.vue +15 -0
  76. package/packages/workgroup-user-tree-inline/src/workgroup-tree-inline-service.js +27 -0
  77. package/packages/workgroup-user-tree-inline/src/workgroup-user-tree-inline.vue +11 -0
  78. package/packages/workgroup-user-tree-mobile/index.js +6 -0
  79. package/packages/workgroup-user-tree-mobile/src/dept-path.vue +36 -0
  80. package/packages/workgroup-user-tree-mobile/src/dept-result.vue +58 -0
  81. package/packages/workgroup-user-tree-mobile/src/workgroup-user-tree-app.vue +119 -0
  82. package/packages/workgroup-user-tree-mobile/src/workgroup-user-tree-inline-app.vue +394 -0
  83. package/packages/workgroup-user-tree-mobile/src/workgroup-user-tree-service.ts +41 -0
  84. package/src/api/sso-service.js +44 -15
  85. package/src/directives/permission/permission.js +4 -3
  86. package/src/i18n/langs/cn.js +19 -3
  87. package/src/i18n/langs/en.js +18 -2
  88. package/src/permission.js +114 -122
  89. package/src/store/modules/user.js +32 -33
  90. package/src/styles/index.scss +1 -0
  91. package/src/styles/table.scss +12 -0
  92. package/src/styles/theme/dark-blue/button.scss +2 -2
  93. package/src/styles/theme/dark-blue/index.scss +1 -1
  94. package/src/styles/theme/dark-blue/sidebar.scss +10 -0
  95. package/src/styles/theme/dark-blue/table.scss +8 -52
  96. package/src/styles/theme/green/button.scss +2 -2
  97. package/src/styles/theme/green/green.scss +1 -1
  98. package/src/styles/theme/green/index.scss +1 -1
  99. package/src/styles/theme/green/sidebar.scss +20 -0
  100. package/src/styles/theme/green/table.scss +7 -51
  101. package/src/styles/theme/ocean-blue/button.scss +2 -2
  102. package/src/styles/theme/ocean-blue/index.scss +1 -1
  103. package/src/styles/theme/ocean-blue/ocean-blue.scss +1 -1
  104. package/src/styles/theme/ocean-blue/sidebar.scss +10 -0
  105. package/src/styles/theme/ocean-blue/table.scss +7 -52
  106. package/src/utils/auth.js +23 -3
  107. package/src/utils/calculator/calculator-factory.js +4 -4
  108. package/src/utils/calculator/calculator-util.js +14 -0
  109. package/src/utils/common-util.js +270 -124
  110. package/src/utils/i18n-util.js +145 -0
  111. package/src/utils/jump-page-utils.js +245 -314
  112. package/src/utils/permission.js +7 -1
  113. package/src/utils/permissionAuth.js +155 -37
  114. package/src/utils/request.js +10 -11
  115. package/src/utils/util.js +154 -205
  116. package/src/views/layout/EmptyLayout.vue +1 -1
  117. package/src/views/layout/components/Menubar/Item.vue +27 -4
  118. package/src/views/layout/components/Menubar/SidebarItem.vue +7 -3
  119. package/src/views/layout/components/Menubar/index.vue +14 -2
  120. package/src/views/layout/tab-content-index.vue +1 -1
@@ -1,12 +1,8 @@
1
1
  <template>
2
- <div>
2
+ <div :style="subTableStyle">
3
3
  <search-form
4
- v-if="
5
- !isFormSubTable &&
6
- hasLoadedColumns &&
7
- query &&
8
- query.showType === 'embedded'
9
- "
4
+ v-if="!isFormSubTable && hasLoadedColumns && query && query.showType === 'embedded'"
5
+ v-show="!isMobile || (isMobile && isShowMobileSearch)"
10
6
  ref="sf"
11
7
  :columns="columns"
12
8
  :code="code"
@@ -21,6 +17,8 @@
21
17
  @search="doSearch"
22
18
  @reset="resetSearch"
23
19
  @open-fold="openFold"
20
+ @can-show-mobile-search="$emit('can-show-mobile-search', code)"
21
+ @close-mobile-search="isShowMobileSearch = false"
24
22
  />
25
23
  <search-form-dialog
26
24
  v-if="hasLoadedColumns && query && query.showType === 'popup'"
@@ -72,6 +70,7 @@
72
70
  @cell-click="selectCell"
73
71
  @cell-dblclick="cellDblClick"
74
72
  >
73
+ <row-detail v-if="detailColumn" :column="detailColumn" :list-code="code" @show-detail="openRowForm" />
75
74
  <template v-if="myCustomFormatter">
76
75
  <component
77
76
  :is="getComponentType(column)"
@@ -82,9 +81,7 @@
82
81
  :is-sql="isSql"
83
82
  :list-code="code"
84
83
  :custom-format="
85
- getComponentType(column) === 'GroupColumn'
86
- ? myCustomFormatter
87
- : myCustomFormatter[column.prop]
84
+ getComponentType(column) === 'GroupColumn' ? myCustomFormatter : myCustomFormatter[column.prop]
88
85
  "
89
86
  :new-width="newWidth"
90
87
  :drag-column-prop="dragColumnProp"
@@ -96,9 +93,8 @@
96
93
  :pagination="pagination"
97
94
  :current-page="currentPage"
98
95
  :grid-data="isSubTableShowPage ? subTableData : gridData"
99
- :page-grid-data="
100
- isSubTableShowPage ? getSubTableGridData(subTableData) : gridData
101
- "
96
+ :page-grid-data="isSubTableShowPage ? getSubTableGridData(subTableData) : gridData"
97
+ @refresh-list="refreshList"
102
98
  @open-page="openPageDialog"
103
99
  @refresPortData="refresPortData"
104
100
  @refresPortsData="refresPortsData"
@@ -127,11 +123,10 @@
127
123
  :current-page="currentPage"
128
124
  :pagination="pagination"
129
125
  :grid-data="isSubTableShowPage ? subTableData : gridData"
130
- :page-grid-data="
131
- isSubTableShowPage ? getSubTableGridData(subTableData) : gridData
132
- "
126
+ :page-grid-data="isSubTableShowPage ? getSubTableGridData(subTableData) : gridData"
133
127
  @open-page="openPageDialog"
134
128
  @refresData="refresData"
129
+ @refresh-list="refreshList"
135
130
  @refresPortData="refresPortData"
136
131
  @refresPortsData="refresPortsData"
137
132
  @refresMainTableFields="refresMainTableFields"
@@ -151,10 +146,20 @@
151
146
  "
152
147
  :span="2"
153
148
  > -->
154
- <el-icon v-if="basicInfo.customConfig && !isFormSubTable" class="el-icon-setting" :title="$t('superGrid.columnConfig')" @click="configColumns" style="float: left; padding: 10px 0px; color: #777"
149
+ <el-icon
150
+ v-if="basicInfo.customConfig && !isFormSubTable"
151
+ class="el-icon-setting"
152
+ :title="$t('superGrid.columnConfig')"
153
+ @click="configColumns"
154
+ style="float: left; padding: 10px 0px; color: #777"
155
155
  ><el-icon-setting
156
156
  /></el-icon>
157
- <el-icon v-if="!isFormSubTable" class="el-icon-refresh" :title="$t('superGrid.refresh')" @click="refreshGridData" style="float: left; padding: 10px 0px; color: #777"
157
+ <el-icon
158
+ v-if="!isFormSubTable"
159
+ class="el-icon-refresh"
160
+ :title="$t('superGrid.refresh')"
161
+ @click="refreshGridData"
162
+ style="float: left; padding: 10px 0px; color: #777"
158
163
  ><el-icon-refresh
159
164
  /></el-icon>
160
165
  <!-- </el-col> -->
@@ -176,7 +181,13 @@
176
181
  background
177
182
  :page-sizes="pagination.pageSizes"
178
183
  :layout="pagination.layout"
179
- :total="pagination.showTotal?(pagination.total!==undefined&&pagination.total!==''&&pagination.total!==null?pagination.total:0):100000000000"
184
+ :total="
185
+ pagination.showTotal
186
+ ? pagination.total !== undefined && pagination.total !== '' && pagination.total !== null
187
+ ? pagination.total
188
+ : 0
189
+ : 100000000000
190
+ "
180
191
  @size-change="handleSizeChange"
181
192
  @current-change="handleCurrentChange"
182
193
  />
@@ -200,20 +211,38 @@
200
211
  :column="rightClickColumn"
201
212
  @clearHeaderContextmenu="clearHeaderContextmenu"
202
213
  />
203
- <!-- <super-page-dialog
204
- v-if="isShowPageDialog"
205
- :dev-mode="pageDevMode"
206
- :jump-page-setting="jumpPageSetting"
207
- :source-page-code="pageCode"
208
- @close="closePageDialog"
209
- @update-value="updateValues"
210
- /> -->
214
+ <row-form
215
+ v-if="showRowForm"
216
+ :parent-form-data="parentFormData"
217
+ :columns="visibleColumns"
218
+ :row-index="currentEditRowIndex"
219
+ :list-code="code"
220
+ :drag-column-prop="dragColumnProp"
221
+ :is-sql="isSql"
222
+ :base-url="baseURL"
223
+ :options="options"
224
+ :table-name="tableName"
225
+ :page-code="pageCode"
226
+ :list-toolbar-form-data="listToolbarFormData"
227
+ :list-name="listName"
228
+ :current-page="currentPage"
229
+ :grid-data="isSubTableShowPage ? subTableData : gridData"
230
+ :page-grid-data="isSubTableShowPage ? getSubTableGridData(subTableData) : gridData"
231
+ :line-edit="lineEdit"
232
+ @close="closeRowForm"
233
+ @refresData="refresData"
234
+ @refresPortData="refresPortData"
235
+ @refresPortsData="refresPortsData"
236
+ @refresMainTableFields="refresMainTableFields"
237
+ @open-page="openPageDialog"
238
+ @prohibitToEdit="prohibitToEdit"
239
+ />
211
240
  </div>
212
241
  </template>
213
242
 
214
243
  <script>
215
- import {Refresh as ElIconRefresh, Setting as ElIconSetting,} from '@element-plus/icons-vue'
216
- import {$emit} from '../../utils/gogocodeTransfer'
244
+ import { Refresh as ElIconRefresh, Setting as ElIconSetting } from '@element-plus/icons-vue'
245
+ import { $emit } from '../../utils/gogocodeTransfer'
217
246
  import IndexColumn from './index-column.vue'
218
247
  import SelectionColumn from './selection-column.vue'
219
248
  import NormalColumn from './normal-column.vue'
@@ -221,21 +250,23 @@ import GroupColumn from './group-column.vue'
221
250
  import ColumnsConfig from './columns-config.vue'
222
251
  import SearchForm from './search-form.vue'
223
252
  import searchFormDialog from './search-form-dialog.vue'
224
- import {getEntityFieldValueWithOutCase, setEntityFieldValue} from '../../../src/utils/util'
253
+ import RowDetail from './row-detail.vue'
254
+ import { getEntityFieldValueWithOutCase, setEntityFieldValue } from '../../../src/utils/util'
225
255
  import eventBus from './eventBus'
226
256
  import {
227
- addDynamicProp,
228
- getExtraParam,
229
- getFirstEditableColumn,
230
- getGridParams,
231
- getLastPageNum,
232
- getSpanValuesForColumn,
233
- getTableHeight,
234
- isCanRefreshGrid,
235
- isEditOptionFunction,
236
- isHasEditOption,
237
- isHasOptionFunction,
238
- isObjectValueEqual,
257
+ addDynamicProp,
258
+ getControlConfig,
259
+ getExtraParam,
260
+ getFirstEditableColumn,
261
+ getGridParams,
262
+ getLastPageNum,
263
+ getSpanValuesForColumn,
264
+ getTableHeight,
265
+ isCanRefreshGrid,
266
+ isEditOptionFunction,
267
+ isHasEditOption,
268
+ isHasOptionFunction,
269
+ isObjectValueEqual
239
270
  } from './utils'
240
271
  import Sortable from 'sortablejs'
241
272
  import store from './store'
@@ -243,11 +274,11 @@ import events from './events'
243
274
  import publicMethods from './public-methods'
244
275
  import superGridService from './super-grid-service'
245
276
  import formValidatorService from './formValidatorUtil'
246
- import {getSystemCode} from '../../../src/utils/permissionAuth'
277
+ import { getSystemCode } from '../../../src/utils/permissionAuth'
247
278
  import apis from './apis'
248
279
  import headerContextMenu from './header-context-menu.vue'
249
- import {isPromise} from '../../../src/utils/common-util'
250
- import {checkPermission} from '../../../src/utils/permission'
280
+ import { isMobileBrowser, isPromise } from '../../../src/utils/common-util'
281
+ import { checkPermission } from '../../../src/utils/permission'
251
282
 
252
283
  export default {
253
284
  components: {
@@ -261,50 +292,51 @@ export default {
261
292
  searchFormDialog,
262
293
  ElIconSetting,
263
294
  ElIconRefresh,
295
+ RowDetail
264
296
  },
265
297
  name: 'SuperGrid',
266
298
  props: {
267
299
  code: {
268
300
  type: String,
269
- default: '',
270
- },
271
- url: {
272
- type: String,
273
- default: '',
274
- },
275
- options: {
276
- type: Object,
277
- default: function () {
278
- return {}
279
- },
280
- },
281
- publishVersion: {
282
- type: Number,
283
- default: 0
284
- },
285
- // 为了兼容平台的旧写法,暂不删除以下属性
286
- // 操作列、占位符列内容显示的函数,格式为:{'属性名':方法},例如:{'name':viewUser,'operation':showOperation}
287
- customFormatter: {
288
- type: Object,
289
- default: null,
290
- },
291
- searchFormInfo: {
292
- type: Object,
293
- default: () => {
294
- return {}
295
- },
301
+ default: ''
302
+ },
303
+ url: {
304
+ type: String,
305
+ default: ''
306
+ },
307
+ options: {
308
+ type: Object,
309
+ default: function () {
310
+ return {}
311
+ }
312
+ },
313
+ publishVersion: {
314
+ type: Number,
315
+ default: 0
316
+ },
317
+ // 为了兼容平台的旧写法,暂不删除以下属性
318
+ // 操作列、占位符列内容显示的函数,格式为:{'属性名':方法},例如:{'name':viewUser,'operation':showOperation}
319
+ customFormatter: {
320
+ type: Object,
321
+ default: null
322
+ },
323
+ searchFormInfo: {
324
+ type: Object,
325
+ default: () => {
326
+ return {}
327
+ }
296
328
  },
297
329
  // 是否显示分页器
298
330
  showPagination: {
299
331
  type: Boolean,
300
- default: true,
332
+ default: true
301
333
  },
302
334
  listToolbarFormData: {
303
335
  type: Object,
304
- default: null,
336
+ default: null
305
337
  },
306
338
  // 列表配置信息,如果该属性有值,则不再根据listCode获得列表及字段配置
307
- settings:{
339
+ settings: {
308
340
  type: Object,
309
341
  default: null
310
342
  },
@@ -316,27 +348,15 @@ export default {
316
348
  data() {
317
349
  let parentProp
318
350
  const parentPropSetting = this.options.parentProp
319
- if (
320
- typeof parentPropSetting !== 'undefined' &&
321
- parentPropSetting !== '' &&
322
- parentPropSetting !== null
323
- ) {
351
+ if (typeof parentPropSetting !== 'undefined' && parentPropSetting !== '' && parentPropSetting !== null) {
324
352
  parentProp = parentPropSetting
325
353
  }
326
354
  let mergeFields = []
327
- if (
328
- this.options &&
329
- this.options.mergeFields &&
330
- this.options.mergeFields !== ''
331
- ) {
355
+ if (this.options && this.options.mergeFields && this.options.mergeFields !== '') {
332
356
  mergeFields = this.options.mergeFields.split(',')
333
357
  }
334
358
  let optionTableHeight
335
- if (
336
- this.options &&
337
- this.options.optionTableHeight &&
338
- this.options.optionTableHeight !== ''
339
- ) {
359
+ if (this.options && this.options.optionTableHeight && this.options.optionTableHeight !== '') {
340
360
  optionTableHeight = this.options.optionTableHeight
341
361
  }
342
362
  let pageCode
@@ -358,43 +378,43 @@ export default {
358
378
  // 数据库类型,值为mysql、oracle、sqlserver,默认是mysql,树形表格时需要使用
359
379
  let dataSourceType = 'mysql'
360
380
  if (window.$vueApp.config.globalProperties.dataSourceType) {
361
- dataSourceType =
362
- window.$vueApp.config.globalProperties.dataSourceType.toLowerCase()
381
+ dataSourceType = window.$vueApp.config.globalProperties.dataSourceType.toLowerCase()
363
382
  }
364
383
  let pageDevMode = this.options.pageDevMode
365
384
  if (pageDevMode === undefined) {
366
385
  pageDevMode = false
367
386
  }
368
387
  let tableStyle
369
- if(this.options && this.options.tableStyle){
388
+ if (this.options && this.options.tableStyle) {
370
389
  tableStyle = this.options.tableStyle
371
390
  }
372
- if(!tableStyle){
391
+ if (!tableStyle) {
373
392
  tableStyle = {}
374
393
  }
375
394
  tableStyle.width = '100%'
376
395
  let tableClass
377
- if(this.options && this.options.tableClass){
396
+ if (this.options && this.options.tableClass) {
378
397
  tableClass = this.options.tableClass
379
398
  }
380
- if(!tableClass){
399
+ if (!tableClass) {
381
400
  tableClass = ''
382
401
  }
383
402
  tableClass += ' elTable'
384
403
  let configureObj
385
- if(this.options && this.options.configureObj){
404
+ if (this.options && this.options.configureObj) {
386
405
  configureObj = this.options.configureObj
387
406
  }
388
407
  let pageContext
389
- if(this.options && this.options.pageContext){
408
+ if (this.options && this.options.pageContext) {
390
409
  pageContext = this.options.pageContext
391
410
  }
411
+ const isMobile = isMobileBrowser()
392
412
  return {
393
413
  isLoading: false,
394
414
  currentPage: 1,
395
415
  showColumnConfig: false,
396
416
  basicInfo: {
397
- summary: 'no',
417
+ summary: 'no'
398
418
  },
399
419
  columns: [],
400
420
  loadCompleteQuery: false,
@@ -452,7 +472,14 @@ export default {
452
472
  tableStyle, // 表格的style
453
473
  tableClass, // 表格的class
454
474
  pageContext, // 页面配置上下文
455
- configureObj // 表格配置信息
475
+ configureObj, // 表格配置信息
476
+ isMobile, // 是否是移动端
477
+ isShowMobileSearch: false, // 是否显示移动端查询区域
478
+ subTableStyle: {},
479
+ detailColumn: null, // 详情列。子表展开表单 配置使用。
480
+ currentEditRowIndex: null, // 当前查看的行记录号
481
+ showRowForm: false, // 是否显示行记录详情
482
+ baseURL: null
456
483
  }
457
484
  },
458
485
  computed: {
@@ -460,11 +487,7 @@ export default {
460
487
  const gridParams = store.get(this.code)
461
488
  const operations = this.getOptionOperations()
462
489
  gridParams.canntEdit = false
463
- if (
464
- operations &&
465
- operations.operation &&
466
- operations.operation.length > 0
467
- ) {
490
+ if (operations && operations.operation && operations.operation.length > 0) {
468
491
  operations.operation.forEach((buttonInfo) => {
469
492
  if (buttonInfo.props.code === 'lineEditUpdate') {
470
493
  if (checkPermission(buttonInfo.props.functionCode)) {
@@ -501,11 +524,7 @@ export default {
501
524
  if (column.show === undefined || column.show) {
502
525
  isVisible = true
503
526
  const hiddenColumns = this.options.hiddenColumns
504
- if (
505
- hiddenColumns &&
506
- hiddenColumns.length > 0 &&
507
- hiddenColumns.indexOf(column.prop) !== -1
508
- ) {
527
+ if (hiddenColumns && hiddenColumns.length > 0 && column.prop && hiddenColumns.indexOf(column.prop) !== -1) {
509
528
  // 如果当前字段包含在隐藏字段集合中,则不显示该字段
510
529
  isVisible = false
511
530
  return isVisible
@@ -529,23 +548,14 @@ export default {
529
548
  spanArr() {
530
549
  const spanArr = []
531
550
  for (const column of this.columns) {
532
- if (
533
- column.span ||
534
- (this.mergeFields && this.mergeFields.indexOf(column.prop) !== -1)
535
- ) {
536
- spanArr[column.prop] = getSpanValuesForColumn(
537
- this.gridData,
538
- column.prop,
539
- column.mergerCellBasis
540
- )
551
+ if (column.span || (this.mergeFields && this.mergeFields.indexOf(column.prop) !== -1)) {
552
+ spanArr[column.prop] = getSpanValuesForColumn(this.gridData, column.prop, column.mergerCellBasis)
541
553
  }
542
554
  }
543
555
  return spanArr
544
556
  },
545
557
  showSummary() {
546
- return (
547
- this.basicInfo.summary !== undefined && this.basicInfo.summary !== 'no'
548
- )
558
+ return this.basicInfo.summary !== undefined && this.basicInfo.summary !== 'no'
549
559
  },
550
560
  // 返回table用来确定唯一的字段。必须配置,否则树形结构时无法显示子集合。
551
561
  getRowKeyProp() {
@@ -559,7 +569,7 @@ export default {
559
569
  return 'id'
560
570
  }
561
571
  }
562
- },
572
+ }
563
573
  // ,
564
574
  // hasLoadMainTable() {
565
575
  // const hasLoadMainTable = store.get('hasLoadMainTable')
@@ -577,7 +587,7 @@ export default {
577
587
  console.log('监听到数据改变')
578
588
  this.initSetting()
579
589
  this.initialize()
580
- },
590
+ }
581
591
  },
582
592
  // 监控列表数据修改,列表作为表单编辑器中子表时使用
583
593
  gridData: {
@@ -588,7 +598,7 @@ export default {
588
598
  // 列表子表不分页时使用
589
599
  $emit(this, 'change-grid-data', this.gridData)
590
600
  }
591
- },
601
+ }
592
602
  },
593
603
  // 监控列表数据修改,列表作为表单编辑器中子表时使用
594
604
  subTableData: {
@@ -599,16 +609,10 @@ export default {
599
609
  // 列表子表分页时使用
600
610
  const gridParams = store.get(this.code)
601
611
  $emit(this, 'change-grid-data', this.subTableData)
602
- if (
603
- gridParams.isChangePage !== undefined &&
604
- gridParams.isChangePage
605
- ) {
612
+ if (gridParams.isChangePage !== undefined && gridParams.isChangePage) {
606
613
  // 表示新建记录时
607
614
  // 新建记录时跳转到最后一页
608
- const lastPageNum = getLastPageNum(
609
- this.subTableData.length,
610
- this.pageSize
611
- )
615
+ const lastPageNum = getLastPageNum(this.subTableData.length, this.pageSize)
612
616
  // 表示最后一页页码和当前页不同时需要切换页码
613
617
  if (lastPageNum !== this.currentPage) {
614
618
  // 切换当前页码为最后一页
@@ -619,9 +623,7 @@ export default {
619
623
  // 表示不需要切换页码
620
624
  this.gridData = this.getSubTableGridData(this.subTableData)
621
625
  gridParams.gridData = this.gridData // 完成深拷贝,复制一份对象,行编辑时使用
622
- gridParams.orgGridData = [].concat(
623
- JSON.parse(JSON.stringify(this.gridData))
624
- )
626
+ gridParams.orgGridData = [].concat(JSON.parse(JSON.stringify(this.gridData)))
625
627
  }
626
628
  if (gridParams.lineEdit.editingCell) {
627
629
  gridParams.lineEdit.editingCell.row = this.gridData.length
@@ -633,12 +635,10 @@ export default {
633
635
  this.gridData = this.getSubTableGridData(this.subTableData)
634
636
  gridParams.gridData = this.gridData
635
637
  // 完成深拷贝,复制一份对象,行编辑时使用
636
- gridParams.orgGridData = [].concat(
637
- JSON.parse(JSON.stringify(this.gridData))
638
- )
638
+ gridParams.orgGridData = [].concat(JSON.parse(JSON.stringify(this.gridData)))
639
639
  }
640
640
  }
641
- },
641
+ }
642
642
  },
643
643
  currentSelectCell: {
644
644
  deep: true,
@@ -653,16 +653,13 @@ export default {
653
653
  oldVal.style.border = ''
654
654
  }
655
655
  })
656
- },
656
+ }
657
657
  },
658
658
  'options.validateRules': {
659
659
  deep: true,
660
660
  handler: function () {
661
661
  this.externalClickFlag = true
662
- console.log(
663
- '监听到数据改变================',
664
- this.options.validateRules
665
- )
662
+ console.log('监听到数据改变================', this.options.validateRules)
666
663
  const gridParams = store.get(this.code)
667
664
  if (gridParams && gridParams.options) {
668
665
  gridParams.options.validateRules = this.options.validateRules
@@ -670,7 +667,7 @@ export default {
670
667
  }
671
668
  // this.initSetting()
672
669
  // this.initialize()
673
- },
670
+ }
674
671
  },
675
672
  'options.subTableCanAdd': {
676
673
  deep: true,
@@ -680,7 +677,7 @@ export default {
680
677
  gridParams.options.subTableCanAdd = this.options.subTableCanAdd
681
678
  store.set(this.code, gridParams)
682
679
  }
683
- },
680
+ }
684
681
  },
685
682
  // pageSize每页显示多少条,改变时抛出事件,配置出来的流程表单子表验证提示信息时使用,例如:“第x页第x条记录,xxx必填”,获得页数时需要使用
686
683
  pageSize: {
@@ -688,7 +685,7 @@ export default {
688
685
 
689
686
  handler(newValue, oldValue) {
690
687
  $emit(this, 'change-rows-per-page', this.pageSize)
691
- },
688
+ }
692
689
  },
693
690
  // 更新parent值
694
691
  'options.extraParam.entityMap': {
@@ -714,7 +711,9 @@ export default {
714
711
  stripe = false
715
712
  }
716
713
  this.stripe = stripe
717
-
714
+ if (isHasOptionFunction('filter-method', this.code)) {
715
+ debugger
716
+ }
718
717
  // if (this.parentProp) {
719
718
  // // 表示配置了树形配置
720
719
  // this.treeProps = this.getTreeProps()
@@ -724,11 +723,7 @@ export default {
724
723
  mounted() {
725
724
  this.initialize().then(() => {
726
725
  const gridParams = store.get(this.code)
727
- if (
728
- gridParams &&
729
- gridParams.basicInfo &&
730
- gridParams.basicInfo.tableName
731
- ) {
726
+ if (gridParams && gridParams.basicInfo && gridParams.basicInfo.tableName) {
732
727
  this.tableName = gridParams.basicInfo.tableName
733
728
  }
734
729
  if (gridParams && gridParams.basicInfo && gridParams.basicInfo.name) {
@@ -740,7 +735,7 @@ export default {
740
735
  if (column.valueSet) {
741
736
  $emit(this, 'set-select-options', {
742
737
  prop: this.code + '.' + column.prop,
743
- valueSet: column.valueSet,
738
+ valueSet: column.valueSet
744
739
  })
745
740
  }
746
741
  })
@@ -758,7 +753,7 @@ export default {
758
753
  },
759
754
  {
760
755
  immediate: true,
761
- deep: true,
756
+ deep: true
762
757
  }
763
758
  )
764
759
  }
@@ -771,39 +766,43 @@ export default {
771
766
  const gridParams = store.get(this.code)
772
767
  if (isHasOptionFunction('gridComplete', this.code)) {
773
768
  gridParams.options.gridComplete.call(this, {
774
- gridData: this.isSubTableShowPage
775
- ? this.subTableData
776
- : this.gridData,
769
+ gridData: this.isSubTableShowPage ? this.subTableData : this.gridData,
777
770
  columns: gridParams.columns,
778
771
  superGrid: this.$refs.superGrid,
779
- pageGridData: this.isSubTableShowPage
780
- ? this.gridData
781
- : null,
772
+ pageGridData: this.isSubTableShowPage ? this.gridData : null,
773
+ listCode: this.code,
782
774
  additionalParamMap: gridParams.additionalParamMap,
783
775
  pageContext: this.pageContext,
784
776
  configureObj: this.configureObj
785
777
  })
786
778
  }
779
+ this.$emit('gridComplete', {
780
+ gridData: this.isSubTableShowPage ? this.subTableData : this.gridData,
781
+ columns: gridParams.columns,
782
+ superGrid: this.$refs.superGrid,
783
+ isMobile: false,
784
+ listCode: this.code,
785
+ pageGridData: this.isSubTableShowPage ? this.gridData : null,
786
+ additionalParamMap: gridParams.additionalParamMap
787
+ })
787
788
  })
788
789
  }
789
790
  },
790
791
  {
791
792
  immediate: true,
792
- deep: true,
793
+ deep: true
793
794
  }
794
795
  )
795
796
 
796
797
  const that = this
797
- const isShowUserTreeDialog =
798
- document.querySelector('.user-tree') !== null
798
+ const isShowUserTreeDialog = document.querySelector('.user-tree') !== null
799
799
  // 当前页面监视键盘输入
800
800
  document.querySelector('.' + this.code).onkeydown = function (e) {
801
801
  if (!that.isShowPageDialog && !isShowUserTreeDialog) {
802
802
  // 当前列表页面没有弹框或选人弹框,才走键盘监视事件
803
803
  // 事件对象兼容
804
804
  // eslint-disable-next-line no-caller
805
- const e1 =
806
- e || event || window.event || arguments.callee.caller.arguments[0]
805
+ const e1 = e || event || window.event || arguments.callee.caller.arguments[0]
807
806
  // 处于行编辑状态时,左右上下箭头事件不需要生效
808
807
  const isEdit = that.isEditRow(that)
809
808
  // 键盘按键判断:左箭头-37;上箭头-38;右箭头-39;下箭头-40
@@ -852,7 +851,7 @@ export default {
852
851
  gridParams.options.extraParam = newValue
853
852
  },
854
853
  {
855
- deep: true,
854
+ deep: true
856
855
  }
857
856
  )
858
857
  })
@@ -868,18 +867,10 @@ export default {
868
867
  // 是否触发回车事件
869
868
  isCallEnterEvent(that) {
870
869
  let canCall = true
871
- if (
872
- that.options.isEnableEnterEvent !== undefined &&
873
- that.options.isEnableEnterEvent === false
874
- ) {
870
+ if (that.options.isEnableEnterEvent !== undefined && that.options.isEnableEnterEvent === false) {
875
871
  canCall = false
876
872
  }
877
- console.log(
878
- 'super-grid-----isEnableEnterEvent=',
879
- that.options.isEnableEnterEvent,
880
- 'canCall=',
881
- canCall
882
- )
873
+ console.log('super-grid-----isEnableEnterEvent=', that.options.isEnableEnterEvent, 'canCall=', canCall)
883
874
  const gridParams = store.get(that.code)
884
875
  if (canCall && gridParams.options && gridParams.options.isFormSubTable) {
885
876
  canCall = false
@@ -888,27 +879,20 @@ export default {
888
879
  },
889
880
  isShowPageArea() {
890
881
  if (this.isFormSubTable) {
891
- return (
892
- this.options.showPageArea !== undefined &&
893
- this.options.showPageArea === true
894
- )
882
+ return this.options.showPageArea !== undefined && this.options.showPageArea === true
895
883
  } else {
896
884
  return true
897
885
  }
898
886
  },
899
887
  resizeTableHeight() {
900
888
  this.$nextTick(() => {
901
- let tableHeight = getTableHeight(
902
- this.$refs.superGrid,
903
- this.code,
904
- this.pageHeight
905
- )
906
-
889
+ let tableHeight = getTableHeight(this.$refs.superGrid, this.code, this.pageHeight)
890
+
907
891
  let tempMaxHeight = null
908
892
  const gridParams = store.get(this.code)
909
893
  if (isHasOptionFunction('resizeHeight', this.code)) {
910
894
  let searchHeight = 0
911
- if (this.$refs.sf) {
895
+ if (this.$refs.sf && !this.isMobile) {
912
896
  // 获得查询区高度
913
897
  searchHeight = this.$refs.sf.$el.offsetHeight
914
898
  }
@@ -925,54 +909,55 @@ export default {
925
909
  }
926
910
  }
927
911
  // 设置列表最大高度
928
- if (
929
- gridParams.options &&
930
- gridParams.options.isFormSubTable &&
931
- gridParams.options.isPdfEditor
932
- ) {
912
+ if (gridParams.options && gridParams.options.isFormSubTable && gridParams.options.isPdfEditor) {
933
913
  tempMaxHeight = null
934
- } else if (
935
- gridParams.options &&
936
- gridParams.options.isFormSubTable &&
937
- gridParams.options.formSetMaxHeight
938
- ) {
914
+ } else if (gridParams.options && gridParams.options.isFormSubTable && gridParams.options.formSetMaxHeight) {
939
915
  tempMaxHeight = gridParams.options.formSetMaxHeight
940
916
  }
941
-
942
917
 
943
918
  // 设置列表高度
944
- if(tempMaxHeight === undefined || tempMaxHeight === null) {
919
+ if (tempMaxHeight === undefined || tempMaxHeight === null) {
945
920
  tempMaxHeight = tableHeight
946
921
  if (this.optionTableHeight) {
947
922
  tempMaxHeight = this.optionTableHeight
948
- } else if (
949
- gridParams.options &&
950
- gridParams.options.isFormSubTable &&
951
- gridParams.options.isPdfEditor
952
- ) {
923
+ } else if (gridParams.options && gridParams.options.isFormSubTable && gridParams.options.isPdfEditor) {
953
924
  tempMaxHeight = null
954
- } else if (
955
- gridParams.options &&
956
- gridParams.options.isFormSubTable &&
957
- gridParams.options.formSetHeight
958
- ) {
925
+ } else if (gridParams.options && gridParams.options.isFormSubTable && gridParams.options.formSetHeight) {
959
926
  tempMaxHeight = gridParams.options.formSetHeight
960
- } else if (
961
- !this.basicInfo.displayEffect ||
962
- this.basicInfo.displayEffect === '' ||
963
- this.basicInfo.displayEffect === 'default'
964
- ) {
965
- tempMaxHeight = null
966
927
  }
928
+ // else if (
929
+ // !this.basicInfo.displayEffect ||
930
+ // this.basicInfo.displayEffect === '' ||
931
+ // this.basicInfo.displayEffect === 'default'
932
+ // ) {
933
+ // tempMaxHeight = null
934
+ // }
967
935
  // if(tempHeight !== undefined && tempHeight !== null){
968
936
  // // el-table的height和maxHeight不能同时设值,会导致列表渲染失败,报脚本错.设置height不起作用,都使用maxHeight控制列表高度吧,暂时不知道原因
969
- // this.tableHeight = tempHeight
937
+ // this.tableHeight = tempHeight
970
938
  // }
971
939
  }
972
- if(tempMaxHeight !== undefined && tempMaxHeight !== null){
940
+ if (
941
+ !this.basicInfo.displayEffect ||
942
+ this.basicInfo.displayEffect === '' ||
943
+ this.basicInfo.displayEffect === 'default'
944
+ ) {
945
+ // default默认不铺满
973
946
  this.maxHeight = tempMaxHeight
947
+ } else {
948
+ // 表示需要cover铺满
949
+ this.tableHeight = tempMaxHeight
974
950
  }
975
- console.log('resizeTableHeight-----tempMaxHeight=',tempMaxHeight,'this.tableHeight=',this.tableHeight,'this.maxHeight=', this.maxHeight ,'gridParams.options=', gridParams.options)
951
+ console.log(
952
+ 'resizeTableHeight-----tempMaxHeight=',
953
+ tempMaxHeight,
954
+ 'this.tableHeight=',
955
+ this.tableHeight,
956
+ 'this.maxHeight=',
957
+ this.maxHeight,
958
+ 'gridParams.options=',
959
+ gridParams.options
960
+ )
976
961
  })
977
962
  },
978
963
  // 回车键
@@ -1000,14 +985,13 @@ export default {
1000
985
  if (rowIndex !== undefined && rowIndex !== null) {
1001
986
  const row = gridParams.gridData[rowIndex]
1002
987
  if (isEditOptionFunction('enter', that.listCode)) {
1003
- if(this.pageContext){
1004
- gridParams.options.lineEditOptions.enter.call(
1005
- that,{
988
+ if (this.pageContext) {
989
+ gridParams.options.lineEditOptions.enter.call(that, {
1006
990
  rowIndex,
1007
- column:that.column,
991
+ column: that.column,
1008
992
  row,
1009
- orgRow:gridParams.orgGridData[rowIndex],
1010
- additionalParamMap:gridParams.additionalParamMap,
993
+ orgRow: gridParams.orgGridData[rowIndex],
994
+ additionalParamMap: gridParams.additionalParamMap,
1011
995
  pageContext: gridParams.pageContext,
1012
996
  configureObj: gridParams.configureObj
1013
997
  })
@@ -1038,19 +1022,17 @@ export default {
1038
1022
  that.restoreRow(rowIndex, that.code)
1039
1023
  const row = gridParams.gridData[rowIndex]
1040
1024
  if (isEditOptionFunction('esc', that.listCode)) {
1041
- if(this.pageContext){
1042
- gridParams.options.lineEditOptions.esc.call(
1043
- that,{
1044
- rowIndex,
1045
- column:that.column,
1046
- row,
1047
- row:gridParams.orgGridData[rowIndex],
1048
- additionalParamMap:gridParams.additionalParamMap,
1049
- pageContext: gridParams.pageContext,
1050
- configureObj: gridParams.configureObj
1051
- }
1052
- )
1053
- }else {
1025
+ if (this.pageContext) {
1026
+ gridParams.options.lineEditOptions.esc.call(that, {
1027
+ rowIndex,
1028
+ column: that.column,
1029
+ row,
1030
+ row: gridParams.orgGridData[rowIndex],
1031
+ additionalParamMap: gridParams.additionalParamMap,
1032
+ pageContext: gridParams.pageContext,
1033
+ configureObj: gridParams.configureObj
1034
+ })
1035
+ } else {
1054
1036
  gridParams.options.lineEditOptions.esc.call(
1055
1037
  that,
1056
1038
  rowIndex,
@@ -1060,7 +1042,6 @@ export default {
1060
1042
  gridParams.additionalParamMap
1061
1043
  )
1062
1044
  }
1063
-
1064
1045
  } else {
1065
1046
  that.restoreRow(rowIndex, that.code)
1066
1047
  }
@@ -1177,10 +1158,7 @@ export default {
1177
1158
  const classObj = tableDiv.attributes['class']
1178
1159
  if (classObj) {
1179
1160
  const tableDivClasses = classObj['nodeValue']
1180
- if (
1181
- tableDivClasses &&
1182
- tableDivClasses.indexOf('el-table__fixed-body-wrapper') >= 0
1183
- ) {
1161
+ if (tableDivClasses && tableDivClasses.indexOf('el-table__fixed-body-wrapper') >= 0) {
1184
1162
  // 表示当前单元格是冻结列中的,需要在非冻结列中获得该单元格
1185
1163
  let tdClass = null
1186
1164
  if (classes && classes.indexOf(' ') > 0) {
@@ -1189,17 +1167,11 @@ export default {
1189
1167
  }
1190
1168
  if (tdClass) {
1191
1169
  const targetCell = document.querySelector(
1192
- '.' +
1193
- this.code +
1194
- ' .el-table__body-wrapper .current-row .' +
1195
- tdClass
1170
+ '.' + this.code + ' .el-table__body-wrapper .current-row .' + tdClass
1196
1171
  )
1197
1172
  that.currentSelectCell = targetCell
1198
1173
  }
1199
- } else if (
1200
- tableDivClasses &&
1201
- tableDivClasses.indexOf('el-table__body-wrapper') >= 0
1202
- ) {
1174
+ } else if (tableDivClasses && tableDivClasses.indexOf('el-table__body-wrapper') >= 0) {
1203
1175
  // 表示当前单元格是非冻结列中的,需要在冻结列中获得该单元格
1204
1176
  let tdClass = null
1205
1177
  if (classes && classes.indexOf(' ') > 0) {
@@ -1208,10 +1180,7 @@ export default {
1208
1180
  }
1209
1181
  if (tdClass) {
1210
1182
  const targetCell = document.querySelector(
1211
- '.' +
1212
- this.code +
1213
- ' .el-table__fixed-body-wrapper .current-row .' +
1214
- tdClass
1183
+ '.' + this.code + ' .el-table__fixed-body-wrapper .current-row .' + tdClass
1215
1184
  )
1216
1185
  that.currentSelectCell = targetCell
1217
1186
  }
@@ -1224,15 +1193,8 @@ export default {
1224
1193
  },
1225
1194
  // 存储有默认值的字段集合
1226
1195
  storeHasDefaultValueColumns(column, gridParams) {
1227
- if (
1228
- column.defaultValue !== undefined &&
1229
- column.defaultValue !== null &&
1230
- column.defaultValue !== ''
1231
- ) {
1232
- if (
1233
- gridParams.defaultValueColumns === undefined ||
1234
- gridParams.defaultValueColumns === null
1235
- ) {
1196
+ if (column.defaultValue !== undefined && column.defaultValue !== null && column.defaultValue !== '') {
1197
+ if (gridParams.defaultValueColumns === undefined || gridParams.defaultValueColumns === null) {
1236
1198
  gridParams.defaultValueColumns = []
1237
1199
  }
1238
1200
  gridParams.defaultValueColumns.push(column)
@@ -1250,6 +1212,7 @@ export default {
1250
1212
  gridParams.options.isFormSubTable === true
1251
1213
  ) {
1252
1214
  this.isFormSubTable = true
1215
+ this.subTableStyle = { width: '100%' }
1253
1216
  }
1254
1217
  },
1255
1218
  /**
@@ -1264,10 +1227,7 @@ export default {
1264
1227
  },
1265
1228
  // 获得属性列操作信息
1266
1229
  getOptionOperations() {
1267
- if (
1268
- typeof this.options['operations'] !== 'undefined' &&
1269
- this.options['operations'] !== null
1270
- ) {
1230
+ if (typeof this.options['operations'] !== 'undefined' && this.options['operations'] !== null) {
1271
1231
  return this.options['operations']
1272
1232
  }
1273
1233
  },
@@ -1278,10 +1238,7 @@ export default {
1278
1238
  if (!gridParams.options.lineEditOptions) {
1279
1239
  gridParams.options.lineEditOptions = gridParams.defaultLineEditOptions
1280
1240
  }
1281
- if (
1282
- typeof this.options['customFormatter'] !== 'undefined' &&
1283
- this.options['customFormatter'] !== null
1284
- ) {
1241
+ if (typeof this.options['customFormatter'] !== 'undefined' && this.options['customFormatter'] !== null) {
1285
1242
  this.myCustomFormatter = this.options['customFormatter']
1286
1243
  }
1287
1244
  } else {
@@ -1289,50 +1246,37 @@ export default {
1289
1246
  gridParams.options.lineEditOptions = gridParams.defaultLineEditOptions
1290
1247
  }
1291
1248
  if (!isHasEditOption('input', this.code)) {
1292
- gridParams.options.lineEditOptions.input =
1293
- gridParams.defaultLineEditOptions.input
1249
+ gridParams.options.lineEditOptions.input = gridParams.defaultLineEditOptions.input
1294
1250
  }
1295
- if (
1296
- !this.myCustomFormatter &&
1297
- typeof this.customFormatter !== 'undefined' &&
1298
- this.customFormatter !== null
1299
- ) {
1251
+ if (!this.myCustomFormatter && typeof this.customFormatter !== 'undefined' && this.customFormatter !== null) {
1300
1252
  this.myCustomFormatter = this.customFormatter
1301
1253
  }
1302
- if (
1303
- this.options &&
1304
- this.options.dynamicServiceName &&
1305
- this.options.dynamicServiceName !== undefined
1306
- ) {
1254
+ if (this.options && this.options.dynamicServiceName && this.options.dynamicServiceName !== undefined) {
1307
1255
  this.dynamicServiceName = this.options.dynamicServiceName
1308
1256
  gridParams.dynamicServiceName = this.dynamicServiceName
1309
1257
  }
1310
- if (
1311
- this.options &&
1312
- this.options.system &&
1313
- this.options.system !== undefined
1314
- ) {
1258
+ if (this.options && this.options.system && this.options.system !== undefined) {
1315
1259
  gridParams.system = this.options.system
1316
1260
  }
1317
- if (
1318
- this.options &&
1319
- this.options.additionalParamMap &&
1320
- this.options.additionalParamMap !== undefined
1321
- ) {
1261
+ if (this.options && this.options.additionalParamMap && this.options.additionalParamMap !== undefined) {
1322
1262
  gridParams.additionalParamMap = this.options.additionalParamMap
1323
1263
  }
1264
+
1265
+ let baseURL
1266
+ if (gridParams.options && gridParams.options.backendUrl) {
1267
+ baseURL = gridParams.options.backendUrl
1268
+ }
1269
+ if (!baseURL) {
1270
+ baseURL = window.$vueApp.config.globalProperties.baseURL
1271
+ }
1272
+ this.baseURL = baseURL
1324
1273
  },
1325
1274
  changeRowStyle(param) {
1326
1275
  // param的格式:{row, rowIndex}
1327
1276
  const gridParams = store.get(this.code)
1328
1277
  if (this.lineEdit && this.lineEdit.editable) {
1329
1278
  if (param.rowIndex === gridParams.$rowIndex) {
1330
- if (
1331
- !isObjectValueEqual(
1332
- param.row,
1333
- gridParams.orgGridData[gridParams.$rowIndex]
1334
- )
1335
- ) {
1279
+ if (!isObjectValueEqual(param.row, gridParams.orgGridData[gridParams.$rowIndex])) {
1336
1280
  // return { 'background': 'rgb(245, 181, 203)' }
1337
1281
  }
1338
1282
  }
@@ -1343,11 +1287,7 @@ export default {
1343
1287
  param.configureOb = this.configureObj
1344
1288
  return gridParams.options.rowStyleRender.call(this, param)
1345
1289
  }
1346
- if (
1347
- this.options &&
1348
- this.options.renderRow &&
1349
- this.options.renderRow.hasOwnProperty(param.rowIndex)
1350
- ) {
1290
+ if (this.options && this.options.renderRow && this.options.renderRow.hasOwnProperty(param.rowIndex)) {
1351
1291
  return { background: this.options.renderRow[param.rowIndex] }
1352
1292
  }
1353
1293
  },
@@ -1355,6 +1295,7 @@ export default {
1355
1295
  const gridParams = store.get(this.code)
1356
1296
  let funName = null
1357
1297
  let columnOptions = null
1298
+ let columnStyleSetting = null
1358
1299
  if (param && param.column && param.column.property) {
1359
1300
  if (gridParams && gridParams.columnOptionMap) {
1360
1301
  if (gridParams.columnOptionMap[param.column.property]) {
@@ -1362,6 +1303,10 @@ export default {
1362
1303
  if (columnOptions.events && columnOptions.events.cellStyle) {
1363
1304
  funName = columnOptions.events.cellStyle
1364
1305
  }
1306
+ const controlConfig = getControlConfig(columnOptions)
1307
+ if (controlConfig && controlConfig['cellStyle']) {
1308
+ columnStyleSetting = controlConfig['cellStyle']
1309
+ }
1365
1310
  }
1366
1311
  }
1367
1312
  }
@@ -1370,7 +1315,8 @@ export default {
1370
1315
  if (isHasOptionFunction('cellStyleRender', this.code)) {
1371
1316
  param.additionalParamMap = gridParams.additionalParamMap
1372
1317
  param.pageContext = this.pageContext
1373
- param.configureOb = this.configureObj
1318
+ param.configureObj = this.configureObj
1319
+ param.cellStyle = columnStyleSetting
1374
1320
  return gridParams.options.cellStyleRender.call(this, param)
1375
1321
  } else if (
1376
1322
  funName !== null &&
@@ -1386,7 +1332,8 @@ export default {
1386
1332
  column: columnOptions,
1387
1333
  prop: param.column.property,
1388
1334
  additionalParamMap: gridParams.additionalParamMap,
1389
- rowIndex: param.rowIndex
1335
+ rowIndex: param.rowIndex,
1336
+ cellStyle: columnStyleSetting
1390
1337
  }
1391
1338
  return gridParams.options['eventCallBack'][funName].call(this, params)
1392
1339
  }
@@ -1405,11 +1352,7 @@ export default {
1405
1352
  if (this.backgroundColorMap['$selection']) {
1406
1353
  return { background: this.backgroundColorMap['$selection'] }
1407
1354
  }
1408
- } else if (
1409
- column.type &&
1410
- column.type === 'default' &&
1411
- !column.property
1412
- ) {
1355
+ } else if (column.type && column.type === 'default' && !column.property) {
1413
1356
  if (this.backgroundColorMap['$index']) {
1414
1357
  return { background: this.backgroundColorMap['$index'] }
1415
1358
  }
@@ -1422,25 +1365,30 @@ export default {
1422
1365
  const gridParams = store.get(this.code)
1423
1366
  let funName = null
1424
1367
  let columnOptions = null
1368
+ let titleStyleSetting = null
1425
1369
  if (param && param.column && param.column.property) {
1426
1370
  if (gridParams && gridParams.columnOptionMap) {
1427
1371
  if (gridParams.columnOptionMap[param.column.property]) {
1428
1372
  columnOptions = gridParams.columnOptionMap[param.column.property]
1429
- if (
1430
- columnOptions.events &&
1431
- columnOptions.events.headerCellStyle
1432
- ) {
1373
+ if (columnOptions.events && columnOptions.events.headerCellStyle) {
1433
1374
  funName = columnOptions.events.headerCellStyle
1434
1375
  }
1376
+ const controlConfig = getControlConfig(columnOptions)
1377
+ if (controlConfig && controlConfig['titleStyle']) {
1378
+ titleStyleSetting = controlConfig['titleStyle']
1379
+ }
1435
1380
  }
1436
1381
  }
1437
1382
  }
1438
1383
  // 应用模式
1439
1384
  // 修改表头样式,当某些字段需要编辑时,某些字段不需要编辑时,为了突出显示有权限编辑的字段,可以使用该功能
1440
- if (
1441
- gridParams.options.renderHeader &&
1442
- gridParams.options.renderHeader.props
1443
- ) {
1385
+ if (isHasOptionFunction('titleStyleRender', this.code)) {
1386
+ param.additionalParamMap = gridParams.additionalParamMap
1387
+ param.pageContext = this.pageContext
1388
+ param.configureObj = this.configureObj
1389
+ param.titleStyle = titleStyleSetting
1390
+ return gridParams.options.titleStyleRender.call(this, param)
1391
+ } else if (gridParams.options.renderHeader && gridParams.options.renderHeader.props) {
1444
1392
  const column = param.column
1445
1393
  const props = gridParams.options.renderHeader.props
1446
1394
  const propsArr = props.split(',')
@@ -1448,9 +1396,7 @@ export default {
1448
1396
  const prop = propsArr[i]
1449
1397
  if (column.property === prop.trim()) {
1450
1398
  let backgroundColor = '#c3f4e2'
1451
- if (
1452
- typeof gridParams.options.renderHeader.color !== 'undefined'
1453
- ) {
1399
+ if (typeof gridParams.options.renderHeader.color !== 'undefined') {
1454
1400
  backgroundColor = gridParams.options.renderHeader.color
1455
1401
  }
1456
1402
  return { background: backgroundColor }
@@ -1466,6 +1412,7 @@ export default {
1466
1412
  ) {
1467
1413
  // const param = { value: param.row[param.column.property], row: param.row, column: columnOptions, prop: param.column.property }
1468
1414
  param.additionalParamMap = gridParams.additionalParamMap
1415
+ param.titleStyle = titleStyleSetting
1469
1416
  return gridParams.options['eventCallBack'][funName].call(this, param)
1470
1417
  }
1471
1418
  }
@@ -1478,10 +1425,7 @@ export default {
1478
1425
  } else {
1479
1426
  if (gridParams.options && gridParams.options.isAdministerListView) {
1480
1427
  // 根据类型生成静态数据
1481
- if (
1482
- gridParams.options.SuperGrid &&
1483
- gridParams.options.SuperGrid.simulationDate
1484
- ) {
1428
+ if (gridParams.options.SuperGrid && gridParams.options.SuperGrid.simulationDate) {
1485
1429
  if (isHasOptionFunction('gridDataLoaded', this.code)) {
1486
1430
  const gridData = gridParams.options.gridDataLoaded.call(this, {
1487
1431
  gridData: gridParams.options.SuperGrid.simulationDate,
@@ -1511,12 +1455,7 @@ export default {
1511
1455
  const isCanRefreshTableData = this.canRefreshTableData(gridParams)
1512
1456
  if (isCanRefreshTableData) {
1513
1457
  // 可以刷新表格记录
1514
- return this.fetchListData(
1515
- searchParam,
1516
- isSearch,
1517
- parentRowIds,
1518
- resove
1519
- )
1458
+ return this.fetchListData(searchParam, isSearch, parentRowIds, resove)
1520
1459
  } else {
1521
1460
  // 子表无记录时不需要刷新子表记录。表示是新建或修改时子表无记录,且不需要刷新子表。
1522
1461
  if (this.isSubTableEmpty(gridParams)) {
@@ -1582,9 +1521,7 @@ export default {
1582
1521
  }
1583
1522
  gridParams.gridData = this.gridData
1584
1523
  // 完成深拷贝,复制一份对象,行编辑时使用
1585
- gridParams.orgGridData = [].concat(
1586
- JSON.parse(JSON.stringify(this.gridData))
1587
- )
1524
+ gridParams.orgGridData = [].concat(JSON.parse(JSON.stringify(this.gridData)))
1588
1525
  },
1589
1526
  canRefreshTableData(gridParams) {
1590
1527
  let isCanRefreshTableData = false
@@ -1642,294 +1579,284 @@ export default {
1642
1579
  return gridData
1643
1580
  },
1644
1581
  fetchListData(searchParam, isSearch, parentRowIds, resove) {
1645
-
1646
- this.isLoading = true
1647
- this.hasLoadData = false
1648
- if (isSearch === undefined || isSearch === false) {
1649
- // 如果不是查询时才需要从缓存中获得结果
1650
- // 如果是刷新当前列表,则需要获得缓存中的window.sessionStorage
1651
- const isRefreshList = window.sessionStorage.getItem(
1652
- 'refreshList-' + this.code
1653
- )
1654
- // console.log('fetchData--isRefreshList--', isRefreshList)
1655
- if (isRefreshList !== undefined && isRefreshList === 'true') {
1656
- const searchParamJson = window.sessionStorage.getItem(
1657
- 'searchParam-' + this.code
1658
- )
1659
- // console.log('fetchData--searchParamJson--', searchParamJson)
1660
- // console.log('fetchData--pagination--', this.pagination)
1661
- if (
1662
- searchParamJson !== undefined &&
1663
- searchParamJson !== null &&
1664
- searchParamJson !== ''
1665
- ) {
1666
- searchParam = JSON.parse(searchParamJson)
1667
- const pagination = searchParam.pagination
1668
- if (pagination) {
1669
- this.currentPage = pagination.currentPage
1670
- this.pagination.pageSize = pagination.pageSize
1671
- this.pagination.showTotal = pagination.showTotal
1672
- }
1673
- this.getInitSearchForm(searchParam.searchForm)
1674
- // this.searchFormContent = searchParam.searchForm
1582
+ this.isLoading = true
1583
+ this.hasLoadData = false
1584
+ // console.log('fetchData--isSearch--', isSearch)
1585
+ if (isSearch === undefined || isSearch === false) {
1586
+ // 如果不是查询时才需要从缓存中获得结果
1587
+ // 如果是刷新当前列表,则需要获得缓存中的window.sessionStorage
1588
+ const isRefreshList = window.sessionStorage.getItem('refreshList-' + this.code)
1589
+ // console.log('fetchData--isRefreshList--', isRefreshList)
1590
+ if (isRefreshList !== undefined && isRefreshList === 'true') {
1591
+ const searchParamJson = window.sessionStorage.getItem('searchParam-' + this.code)
1592
+ // console.log('fetchData--searchParamJson--', searchParamJson)
1593
+ // console.log('fetchData--pagination--', this.pagination)
1594
+ if (searchParamJson !== undefined && searchParamJson !== null && searchParamJson !== '') {
1595
+ searchParam = JSON.parse(searchParamJson)
1596
+ const pagination = searchParam.pagination
1597
+ if (pagination) {
1598
+ this.currentPage = pagination.currentPage
1599
+ this.pagination.pageSize = pagination.pageSize
1600
+ this.pagination.showTotal = pagination.showTotal
1675
1601
  }
1602
+ this.getInitSearchForm(searchParam.searchForm)
1603
+ // this.searchFormContent = searchParam.searchForm
1676
1604
  }
1677
1605
  }
1678
- window.sessionStorage.removeItem('refreshList-' + this.code)
1679
- if (searchParam === undefined) {
1680
- searchParam = this.getSearchParam()
1681
- }
1682
- const gridParams = store.get(this.code)
1683
- let param = searchParam
1606
+ }
1607
+ window.sessionStorage.removeItem('refreshList-' + this.code)
1608
+ if (searchParam === undefined) {
1609
+ searchParam = this.getSearchParam()
1610
+ }
1611
+ const gridParams = store.get(this.code)
1612
+ let param = searchParam
1684
1613
 
1685
- if (gridParams.options.extraParam || parentRowIds !== undefined) {
1686
- param = getExtraParam(searchParam, gridParams)
1687
- }
1688
- // 导出需要这两个参数
1689
- gridParams.searchParam = searchParam
1690
- gridParams.url = this.url
1691
- let requestUrl = this.url
1692
- if (parentRowIds !== undefined && parentRowIds !== null) {
1693
- // 表示是查询子集合时
1694
- param = Object.assign({}, param)
1695
- // 清空查询子集合时,分页信息,即不需要分页查询子集合
1696
- param.searchParam.pagination = null
1697
- // 父节点id传给后台
1698
- param['parentIds'] = parentRowIds
1699
- // 父级字段名,例如:parentId 或 fk_parent_id
1700
- param['parentProp'] = this.parentProp
1701
- // 传入系统code
1702
- param.systemCode = getSystemCode()
1614
+ if (gridParams.options.extraParam || parentRowIds !== undefined) {
1615
+ param = getExtraParam(searchParam, gridParams)
1616
+ }
1617
+ // 导出需要这两个参数
1618
+ gridParams.searchParam = searchParam
1619
+ gridParams.url = this.url
1620
+ let requestUrl = this.url
1621
+ if (parentRowIds !== undefined && parentRowIds !== null) {
1622
+ // 表示是查询子集合时
1623
+ param = Object.assign({}, param)
1624
+ // 清空查询子集合时,分页信息,即不需要分页查询子集合
1625
+ param.searchParam.pagination = null
1626
+ // 父节点id传给后台
1627
+ param['parentIds'] = parentRowIds
1628
+ // 父级字段名,例如:parentId 或 fk_parent_id
1629
+ param['parentProp'] = this.parentProp
1630
+ // 传入系统code
1631
+ param.systemCode = getSystemCode()
1703
1632
 
1704
- requestUrl = this.options.subRowUrl
1705
- }
1706
- // 解决新建后,查询,再点新建报“有未保存的行”问题,解决方案是一旦刷新列表,就还原这些状态
1707
- gridParams.isCreateRow = false
1708
- gridParams.isEditRow = false
1709
- gridParams.$lastSaveRowIndex = null
1710
- gridParams.$rowIndex = null
1711
- gridParams.canSaveRow = true
1712
- // 是否根据权限显示数据
1713
- gridParams.withDataPermission = gridParams.options.isWithDataPermission
1714
- // 对象是否是流程实体
1715
- gridParams.isWorkflowEntity = gridParams.options.isWorkflowEntity
1716
- // 缓存查询条件及当前页数
1717
- window.sessionStorage.setItem(
1718
- 'searchParam-' + this.code,
1719
- JSON.stringify(param)
1720
- )
1721
- if (
1722
- this.parentProp &&
1723
- searchParam.searchForm &&
1724
- searchParam.searchForm.length > 0
1725
- ) {
1726
- // 表示是树形列表的查询时,查询结果不需要树形显示,后台处理的数据没有加has_children来实现的
1727
- param.listViewTreeSetting = null
1728
- }
1729
- let canFetchData = true
1730
- if (isHasOptionFunction('beforeRequest', this.code)) {
1731
- canFetchData = gridParams.options.beforeRequest.call(this, {
1732
- columns: this.columns,
1733
- gridParams,
1734
- additionalParamMap: gridParams.additionalParamMap,
1735
- requestParam: param,
1736
- pageContext: this.pageContext,
1737
- configureObj: this.configureObj
1738
- })
1739
- }
1740
- return new Promise((resolve, reject) => {
1741
- if(isPromise(canFetchData)){
1742
- canFetchData.then((result)=>{
1743
- if(result === undefined || result) {
1744
- if(!requestUrl){
1745
- resolve()
1746
- } else {
1747
- this.doRequest(requestUrl, param, parentRowIds, gridParams, resove).then(()=>{
1748
- resolve()
1749
- }).catch((error)=>{
1750
- reject(error)
1751
- })
1752
- }
1753
- } else {
1754
- console.error('beforeRequest result is false!!')
1633
+ requestUrl = this.options.subRowUrl
1634
+ }
1635
+ // 解决新建后,查询,再点新建报“有未保存的行”问题,解决方案是一旦刷新列表,就还原这些状态
1636
+ gridParams.isCreateRow = false
1637
+ gridParams.isEditRow = false
1638
+ gridParams.$lastSaveRowIndex = null
1639
+ gridParams.$rowIndex = null
1640
+ gridParams.canSaveRow = true
1641
+ // 是否根据权限显示数据
1642
+ gridParams.withDataPermission = gridParams.options.isWithDataPermission
1643
+ // 对象是否是流程实体
1644
+ gridParams.isWorkflowEntity = gridParams.options.isWorkflowEntity
1645
+ // 缓存查询条件及当前页数
1646
+ window.sessionStorage.setItem('searchParam-' + this.code, JSON.stringify(param))
1647
+ if (this.parentProp && searchParam.searchForm && searchParam.searchForm.length > 0) {
1648
+ // 表示是树形列表的查询时,查询结果不需要树形显示,后台处理的数据没有加has_children来实现的
1649
+ param.listViewTreeSetting = null
1650
+ }
1651
+ let canFetchData = true
1652
+ if (isHasOptionFunction('beforeRequest', this.code)) {
1653
+ canFetchData = gridParams.options.beforeRequest.call(this, {
1654
+ columns: this.columns,
1655
+ gridParams,
1656
+ additionalParamMap: gridParams.additionalParamMap,
1657
+ requestParam: param,
1658
+ pageContext: this.pageContext,
1659
+ configureObj: this.configureObj
1660
+ })
1661
+ }
1662
+ // console.log('fetchData--canFetchData--', canFetchData, 'requestUrl=', requestUrl)
1663
+ return new Promise((resolve, reject) => {
1664
+ if (isPromise(canFetchData)) {
1665
+ canFetchData
1666
+ .then((result) => {
1667
+ if (result === undefined || result) {
1668
+ if (!requestUrl) {
1669
+ gridParams.loaded = true
1755
1670
  resolve()
1756
- }
1757
- }).catch((error)=>{
1758
- reject(error)
1759
- })
1760
- } else {
1761
- if (canFetchData === undefined || canFetchData === true) {
1762
- if(!requestUrl){
1763
- resolve()
1764
- } else {
1765
- this.doRequest(requestUrl, param, parentRowIds, gridParams, resove).then(()=>{
1671
+ } else {
1672
+ this.doRequest(requestUrl, param, parentRowIds, gridParams, resove)
1673
+ .then(() => {
1766
1674
  resolve()
1767
- }).catch((error)=>{
1675
+ })
1676
+ .catch((error) => {
1768
1677
  reject(error)
1769
1678
  })
1770
- }
1679
+ }
1771
1680
  } else {
1772
1681
  console.error('beforeRequest result is false!!')
1682
+ gridParams.loaded = true
1773
1683
  resolve()
1774
1684
  }
1685
+ })
1686
+ .catch((error) => {
1687
+ gridParams.loaded = true
1688
+ reject(error)
1689
+ })
1690
+ } else {
1691
+ if (canFetchData === undefined || canFetchData === true) {
1692
+ if (!requestUrl) {
1693
+ gridParams.loaded = true
1694
+ resolve()
1695
+ } else {
1696
+ this.doRequest(requestUrl, param, parentRowIds, gridParams, resove)
1697
+ .then(() => {
1698
+ gridParams.loaded = true
1699
+ resolve()
1700
+ })
1701
+ .catch((error) => {
1702
+ gridParams.loaded = true
1703
+ reject(error)
1704
+ })
1775
1705
  }
1776
- })
1706
+ } else {
1707
+ console.error('beforeRequest result is false!!')
1708
+ gridParams.loaded = true
1709
+ resolve()
1710
+ }
1711
+ }
1712
+ })
1777
1713
  },
1778
1714
  doRequest(requestUrl, param, parentRowIds, gridParams, resove) {
1779
1715
  return new Promise((resolve, reject) => {
1780
- this.$http
1781
- .post(requestUrl, param)
1782
- .then((data) => {
1783
- if (typeof parentRowIds === 'undefined' || parentRowIds === null) {
1784
- let tableData = []
1785
- // 对数据做序列化,比如:处理xss攻击
1786
- if (isHasOptionFunction('gridDataLoaded', this.code)) {
1787
- const gridDataLoadedParam = {
1788
- gridData: data.data,
1789
- columns: gridParams.columns,
1790
- additionalParamMap: gridParams.additionalParamMap,
1791
- pageContext: this.pageContext,
1792
- configureObj: this.configureObj
1793
- }
1794
- if (searchParam) {
1795
- gridDataLoadedParam.searchForm = searchParam.searchForm
1796
- gridDataLoadedParam.additionalParamMap =
1797
- searchParam.additionalParamMap
1798
- }
1799
- const gridData = gridParams.options.gridDataLoaded.call(
1800
- this,
1801
- gridDataLoadedParam
1802
- )
1803
- if (gridData) {
1804
- tableData = gridData
1716
+ this.$http
1717
+ .post(requestUrl, param)
1718
+ .then((data) => {
1719
+ if (typeof parentRowIds === 'undefined' || parentRowIds === null) {
1720
+ let tableData = []
1721
+ // 对数据做序列化,比如:处理xss攻击
1722
+ if (isHasOptionFunction('gridDataLoaded', this.code)) {
1723
+ const gridDataLoadedParam = {
1724
+ gridData: data.data,
1725
+ columns: gridParams.columns,
1726
+ additionalParamMap: gridParams.additionalParamMap,
1727
+ pageContext: this.pageContext,
1728
+ configureObj: this.configureObj
1729
+ }
1730
+ if (searchParam) {
1731
+ gridDataLoadedParam.searchForm = searchParam.searchForm
1732
+ gridDataLoadedParam.additionalParamMap = searchParam.additionalParamMap
1733
+ }
1734
+ const gridData = gridParams.options.gridDataLoaded.call(this, gridDataLoadedParam)
1735
+ if (gridData) {
1736
+ tableData = gridData
1737
+ } else {
1738
+ tableData = data.data
1739
+ }
1805
1740
  } else {
1806
1741
  tableData = data.data
1807
1742
  }
1808
- } else {
1809
- tableData = data.data
1810
- }
1811
- if (!tableData) {
1812
- tableData = []
1813
- }
1814
- if (gridParams.options.isFormSubTable) {
1815
- // 子表时默认不全部行编辑
1816
- if (tableData) {
1817
- // 子表时所有记录的所有字段设置默认值null,优化子表编辑时性能
1818
- tableData.forEach((item) => {
1819
- this.setColumnsDefaultValue(gridParams.allColumns, item)
1820
- })
1743
+ if (!tableData) {
1744
+ tableData = []
1821
1745
  }
1822
- // console.log('子表数据循环', this.gridData)
1823
- // this.gridData.forEach(item => {
1824
- // item.$editing = true
1825
- // })
1826
- if (this.pagination && this.isSubTableShowPage === true) {
1827
- // 表示子表需要显示分页
1828
- this.subTableData = tableData
1829
- this.gridData = this.getSubTableGridData(this.subTableData)
1830
- gridParams.subTableData = this.subTableData
1746
+ if (gridParams.options.isFormSubTable) {
1747
+ // 子表时默认不全部行编辑
1748
+ if (tableData) {
1749
+ // 子表时所有记录的所有字段设置默认值null,优化子表编辑时性能
1750
+ tableData.forEach((item) => {
1751
+ this.setColumnsDefaultValue(gridParams.allColumns, item)
1752
+ })
1753
+ }
1754
+ // console.log('子表数据循环', this.gridData)
1755
+ // this.gridData.forEach(item => {
1756
+ // item.$editing = true
1757
+ // })
1758
+ if (this.pagination && this.isSubTableShowPage === true) {
1759
+ // 表示子表需要显示分页
1760
+ this.subTableData = tableData
1761
+ this.gridData = this.getSubTableGridData(this.subTableData)
1762
+ gridParams.subTableData = this.subTableData
1763
+ } else {
1764
+ this.gridData = tableData
1765
+ }
1766
+ if (this.pagination) {
1767
+ this.pagination.total = tableData.length
1768
+ }
1831
1769
  } else {
1832
1770
  this.gridData = tableData
1833
- }
1834
- if (this.pagination) {
1835
- this.pagination.total = tableData.length
1836
- }
1837
- } else {
1838
- this.gridData = tableData
1839
1771
 
1840
- if (this.pagination) {
1841
- this.pagination.total = data.total
1772
+ if (this.pagination) {
1773
+ this.pagination.total = data.total
1774
+ }
1775
+ }
1776
+ if (data.summaries && Object.keys(data.summaries).length > 0) {
1777
+ this.summaries = data.summaries
1842
1778
  }
1843
- }
1844
- if (data.summaries && Object.keys(data.summaries).length > 0) {
1845
- this.summaries = data.summaries
1846
- }
1847
1779
 
1848
- gridParams.gridData = this.gridData
1780
+ gridParams.gridData = this.gridData
1849
1781
 
1850
- // 完成深拷贝,复制一份对象,行编辑时使用
1851
- gridParams.orgGridData = [].concat(
1852
- JSON.parse(JSON.stringify(this.gridData))
1853
- )
1782
+ // 完成深拷贝,复制一份对象,行编辑时使用
1783
+ gridParams.orgGridData = [].concat(JSON.parse(JSON.stringify(this.gridData)))
1854
1784
 
1855
- gridParams.pagination = this.pagination
1856
- gridParams.loaded = true
1785
+ gridParams.pagination = this.pagination
1786
+ gridParams.loaded = true
1857
1787
 
1858
- // TODO: 输入焦点默认停在第一个可编辑的单元格
1859
- if (this.lineEdit && this.lineEdit.editable) {
1860
- if (typeof isSearch === 'undefined' || isSearch === false) {
1861
- // 不是查询时,才需要创建第一行记录
1862
- if (this.gridData.length === 0) {
1863
- if (
1864
- this.options &&
1865
- this.options.isDefaultShowEdit !== null &&
1866
- this.options.isDefaultShowEdit !== undefined &&
1867
- this.options.isDefaultShowEdit === true
1868
- ) {
1869
- this.createRow(this.code, null, this.gridData)
1788
+ // TODO: 输入焦点默认停在第一个可编辑的单元格
1789
+ if (this.lineEdit && this.lineEdit.editable) {
1790
+ if (typeof isSearch === 'undefined' || isSearch === false) {
1791
+ // 不是查询时,才需要创建第一行记录
1792
+ if (this.gridData.length === 0) {
1793
+ if (
1794
+ this.options &&
1795
+ this.options.isDefaultShowEdit !== null &&
1796
+ this.options.isDefaultShowEdit !== undefined &&
1797
+ this.options.isDefaultShowEdit === true
1798
+ ) {
1799
+ this.createRow(this.code, null, this.gridData)
1800
+ }
1870
1801
  }
1871
- }
1872
- if (this.gridData.length > 0) {
1873
- this.lineEdit['editingCell'] = {
1874
- row: 0,
1875
- prop: getFirstEditableColumn(this.code),
1802
+ if (this.gridData.length > 0) {
1803
+ this.lineEdit['editingCell'] = {
1804
+ row: 0,
1805
+ prop: getFirstEditableColumn(this.code)
1806
+ }
1876
1807
  }
1877
1808
  }
1878
1809
  }
1879
- }
1880
- this.hasLoadData = true
1881
- } else {
1882
- // 对数据做序列化,比如:处理xss攻击
1883
- if (isHasOptionFunction('gridDataLoaded', this.code)) {
1884
- gridParams.options.gridDataLoaded.call(this, {
1885
- gridData: data,
1886
- additionalParamMap: gridParams.additionalParamMap,
1887
- pageContext: this.pageContext,
1888
- configureObj: this.configureObj
1889
- })
1890
- }
1810
+ this.hasLoadData = true
1811
+ } else {
1812
+ // 对数据做序列化,比如:处理xss攻击
1813
+ gridParams.loaded = true
1814
+ if (isHasOptionFunction('gridDataLoaded', this.code)) {
1815
+ gridParams.options.gridDataLoaded.call(this, {
1816
+ gridData: data,
1817
+ additionalParamMap: gridParams.additionalParamMap,
1818
+ pageContext: this.pageContext,
1819
+ configureObj: this.configureObj
1820
+ })
1821
+ }
1891
1822
 
1892
- if (isHasOptionFunction('loadChildrenComplete', this.code)) {
1893
- gridParams.options.loadChildrenComplete.call(this, {
1894
- parentRowIds: parentRowIds,
1895
- gridData: data,
1896
- columns: gridParams.columns,
1897
- additionalParamMap: gridParams.additionalParamMap,
1898
- pageContext: this.pageContext,
1899
- configureObj: this.configureObj
1900
- })
1823
+ if (isHasOptionFunction('loadChildrenComplete', this.code)) {
1824
+ gridParams.options.loadChildrenComplete.call(this, {
1825
+ parentRowIds: parentRowIds,
1826
+ gridData: data,
1827
+ columns: gridParams.columns,
1828
+ additionalParamMap: gridParams.additionalParamMap,
1829
+ pageContext: this.pageContext,
1830
+ configureObj: this.configureObj
1831
+ })
1832
+ }
1833
+ if (typeof resove !== 'undefined' && resove !== null) {
1834
+ // 首次加载或点击三角展开父节点时走该分支
1835
+ // 刷新数据后,移除该父节点下的所有已选中的子节点记录。
1836
+ // 必须调用该方法,否则在删除记录时,数据即使刷新了,已选中集合this.$refs.superGrid.store.states.selection中仍会有该已删除记录,导致再次执行删除报id不存在
1837
+ this.removeGridStoreSelection(parentRowIds)
1838
+ resove(data[parentRowIds[0]])
1839
+ } else {
1840
+ // 刷新父记录对应的子记录集合时需要,例如:删除时
1841
+ parentRowIds.forEach((parentRowId) => {
1842
+ // 单行父记录id
1843
+ this.$refs.superGrid.store.states.lazyTreeNodeMap[parentRowId] = data[parentRowId]
1844
+ this.$refs.superGrid.store.states.treeData[parentRowId].children = data[parentRowId]
1845
+ })
1846
+ // 刷新数据后,移除该父节点下的所有已选中的子节点记录
1847
+ // 必须调用该方法,否则在删除记录时,数据即使刷新了,已选中集合this.$refs.superGrid.store.states.selection中仍会有该已删除记录,导致再次执行删除报id不存在
1848
+ this.removeGridStoreSelection(parentRowIds)
1849
+ }
1850
+ this.hasLoadData = true
1901
1851
  }
1902
- if (typeof resove !== 'undefined' && resove !== null) {
1903
- // 首次加载或点击三角展开父节点时走该分支
1904
- // 刷新数据后,移除该父节点下的所有已选中的子节点记录。
1905
- // 必须调用该方法,否则在删除记录时,数据即使刷新了,已选中集合this.$refs.superGrid.store.states.selection中仍会有该已删除记录,导致再次执行删除报id不存在
1906
- this.removeGridStoreSelection(parentRowIds)
1907
- resove(data[parentRowIds[0]])
1908
- } else {
1909
- // 刷新父记录对应的子记录集合时需要,例如:删除时
1910
- parentRowIds.forEach((parentRowId) => {
1911
- // 单行父记录id
1912
- this.$refs.superGrid.store.states.lazyTreeNodeMap[
1913
- parentRowId
1914
- ] = data[parentRowId]
1915
- this.$refs.superGrid.store.states.treeData[
1916
- parentRowId
1917
- ].children = data[parentRowId]
1918
- })
1919
- // 刷新数据后,移除该父节点下的所有已选中的子节点记录
1920
- // 必须调用该方法,否则在删除记录时,数据即使刷新了,已选中集合this.$refs.superGrid.store.states.selection中仍会有该已删除记录,导致再次执行删除报id不存在
1921
- this.removeGridStoreSelection(parentRowIds)
1852
+ resolve()
1853
+ })
1854
+ .catch((error) => {
1855
+ if (isHasOptionFunction('loadError', this.code)) {
1856
+ gridParams.options.loadError.call(this, this.code, error)
1922
1857
  }
1923
- this.hasLoadData = true
1924
- }
1925
- resolve()
1926
- })
1927
- .catch((error) => {
1928
- if (isHasOptionFunction('loadError', this.code)) {
1929
- gridParams.options.loadError.call(this, this.code, error)
1930
- }
1931
- reject(error)
1932
- })
1858
+ reject(error)
1859
+ })
1933
1860
  })
1934
1861
  },
1935
1862
  // 获得初始查询条件对象
@@ -2012,9 +1939,7 @@ export default {
2012
1939
  }
2013
1940
  gridParams.gridData = this.gridData
2014
1941
  // 完成深拷贝,复制一份对象,行编辑时使用
2015
- gridParams.orgGridData = [].concat(
2016
- JSON.parse(JSON.stringify(this.gridData))
2017
- )
1942
+ gridParams.orgGridData = [].concat(JSON.parse(JSON.stringify(this.gridData)))
2018
1943
  gridParams.pagination = this.pagination
2019
1944
 
2020
1945
  // TODO: 输入焦点默认停在第一个可编辑的单元格
@@ -2024,7 +1949,7 @@ export default {
2024
1949
  }
2025
1950
  this.lineEdit['editingCell'] = {
2026
1951
  row: 0,
2027
- prop: getFirstEditableColumn(this.code),
1952
+ prop: getFirstEditableColumn(this.code)
2028
1953
  }
2029
1954
  }
2030
1955
  if (isHasOptionFunction('gridComplete', this.code)) {
@@ -2088,10 +2013,7 @@ export default {
2088
2013
  }
2089
2014
  if (gridParams.options && gridParams.options.isAdministerListView) {
2090
2015
  // 根据类型生成静态数据
2091
- if (
2092
- gridParams.options.SuperGrid &&
2093
- gridParams.options.SuperGrid.simulationDate
2094
- ) {
2016
+ if (gridParams.options.SuperGrid && gridParams.options.SuperGrid.simulationDate) {
2095
2017
  let gridData
2096
2018
  if (isHasOptionFunction('gridDataLoaded', vm.code)) {
2097
2019
  gridData = gridParams.options.gridDataLoaded.call(this, {
@@ -2190,27 +2112,20 @@ export default {
2190
2112
  if (this.pagination) {
2191
2113
  // 判断是否删除后请求数据
2192
2114
  if (this.isDelete && this.currentPage > 1) {
2193
- const pageNum = Math.ceil(
2194
- (this.pagination.total - this.gridData.length) /
2195
- this.pagination.pageSize
2196
- )
2197
- this.currentPage =
2198
- this.currentPage > pageNum ? pageNum : this.currentPage
2115
+ const pageNum = Math.ceil((this.pagination.total - this.gridData.length) / this.pagination.pageSize)
2116
+ this.currentPage = this.currentPage > pageNum ? pageNum : this.currentPage
2199
2117
  this.isDelete = false
2200
2118
  }
2201
2119
  const pagination = {
2202
2120
  currentPage: this.currentPage,
2203
2121
  pageSize: this.pagination.pageSize,
2204
- showTotal: this.pagination.showTotal,
2122
+ showTotal: this.pagination.showTotal
2205
2123
  }
2206
2124
  if (this.pageSize !== null) {
2207
2125
  // 表示更改了每页显示的数据条数
2208
2126
  pagination.pageSize = this.pageSize
2209
2127
  }
2210
- if (
2211
- typeof gridParams.currentPage !== 'undefined' &&
2212
- gridParams.currentPage !== null
2213
- ) {
2128
+ if (typeof gridParams.currentPage !== 'undefined' && gridParams.currentPage !== null) {
2214
2129
  // 保持页数时使用
2215
2130
  pagination.currentPage = gridParams.currentPage
2216
2131
  // 必须清空一下,否则会导致翻页有问题
@@ -2223,13 +2138,13 @@ export default {
2223
2138
  return {
2224
2139
  currentPage: 1,
2225
2140
  pageSize: 20,
2226
- showTotal: true,
2141
+ showTotal: true
2227
2142
  }
2228
2143
  }
2229
2144
  },
2230
2145
  getSearchParam() {
2231
2146
  const searchParam = {
2232
- code: this.code,
2147
+ code: this.code
2233
2148
  }
2234
2149
  const gridParams = store.get(this.code)
2235
2150
  const pagination = this.getPaginationInfo()
@@ -2257,7 +2172,7 @@ export default {
2257
2172
  if (flag) {
2258
2173
  mergeFieldsArr.push({
2259
2174
  prop: mergeField,
2260
- order: 'ascending',
2175
+ order: 'ascending'
2261
2176
  })
2262
2177
  }
2263
2178
  }
@@ -2265,20 +2180,16 @@ export default {
2265
2180
  searchParam.sorts = mergeFieldsArr
2266
2181
  }
2267
2182
  // 是否有初始过滤条件
2268
- if (
2269
- gridParams.options &&
2270
- typeof gridParams.options.initSearchForm !== 'undefined'
2271
- ) {
2183
+ if (gridParams.options && typeof gridParams.options.initSearchForm !== 'undefined') {
2272
2184
  searchParam.initSearchForm = gridParams.options.initSearchForm
2273
2185
  }
2274
2186
  if (
2275
2187
  gridParams.query &&
2276
- typeof gridParams.query.defaultQueryCriteria !== 'undefined'
2188
+ typeof gridParams.query.defaultQueryCriteria !== 'undefined' &&
2189
+ gridParams.query.defaultQueryCriteria !== ''
2277
2190
  ) {
2278
2191
  // json字符串转数组
2279
- searchParam.defaultQueryCriteria = JSON.parse(
2280
- gridParams.query.defaultQueryCriteria
2281
- )
2192
+ searchParam.defaultQueryCriteria = JSON.parse(gridParams.query.defaultQueryCriteria)
2282
2193
  }
2283
2194
  if (typeof gridParams.searchForm !== 'undefined') {
2284
2195
  searchParam.searchForm = gridParams.searchForm
@@ -2301,7 +2212,7 @@ export default {
2301
2212
  }
2302
2213
  return searchParam
2303
2214
  },
2304
- getComponentType (column) {
2215
+ getComponentType(column) {
2305
2216
  const prop = column.prop
2306
2217
  let type = 'NormalColumn'
2307
2218
  if (prop === '$index') {
@@ -2313,8 +2224,8 @@ export default {
2313
2224
  } else if (prop === undefined && column.children && column.children.length > 0) {
2314
2225
  type = 'GroupColumn'
2315
2226
  }
2316
- // console.log('%c描述-180428','color:#2E3435;background:#F8BB07;padding:3px;border-radius:2px',this.myCustomFormatter);
2317
- // console.log('%c描述-155704','color:#2E3435;background:#F8BB07;padding:3px;border-radius:2px',type);
2227
+ // console.log('%c描述-180428','color:#2E3435;background:#F8BB07;padding:3px;border-radius:2px',this.myCustomFormatter);
2228
+ // console.log('%c描述-155704','color:#2E3435;background:#F8BB07;padding:3px;border-radius:2px',type);
2318
2229
  return type
2319
2230
  },
2320
2231
  focusOnFirstEditableInput() {
@@ -2347,9 +2258,7 @@ export default {
2347
2258
  const gridParams = store.get(this.code)
2348
2259
  gridParams.gridData = this.gridData
2349
2260
  // 完成深拷贝,复制一份对象,行编辑时使用
2350
- gridParams.orgGridData = [].concat(
2351
- JSON.parse(JSON.stringify(this.gridData))
2352
- )
2261
+ gridParams.orgGridData = [].concat(JSON.parse(JSON.stringify(this.gridData)))
2353
2262
  } else {
2354
2263
  this.fetchData(this.getSearchParam())
2355
2264
  }
@@ -2366,9 +2275,7 @@ export default {
2366
2275
  if (!isCanRefreshGrid(this.code)) {
2367
2276
  // 如果最后编辑行没有保存或撤销编辑,则给出提示
2368
2277
  const gridParams = store.get(this.code)
2369
- console.log(
2370
- '请先保存或撤销编辑第' + gridParams.$rowIndex + 1 + '行记录,再排序'
2371
- )
2278
+ console.log('请先保存或撤销编辑第' + gridParams.$rowIndex + 1 + '行记录,再排序')
2372
2279
  this.$refs.superGrid.clearSort()
2373
2280
  } else {
2374
2281
  // TODO: 应该调用fetchData来获取信息,把当前页数、查询条件、排序信息传回后台
@@ -2384,8 +2291,8 @@ export default {
2384
2291
  this.sortInfo = [
2385
2292
  {
2386
2293
  prop: orgProp,
2387
- order: order,
2388
- },
2294
+ order: order
2295
+ }
2389
2296
  ]
2390
2297
  } else {
2391
2298
  this.sortInfo = null
@@ -2399,10 +2306,7 @@ export default {
2399
2306
  isMergeable(prop) {
2400
2307
  for (const column of this.columns) {
2401
2308
  if (column.prop === prop) {
2402
- if (
2403
- this.mergeFields &&
2404
- this.mergeFields.indexOf(column.prop) !== -1
2405
- ) {
2309
+ if (this.mergeFields && this.mergeFields.indexOf(column.prop) !== -1) {
2406
2310
  return true
2407
2311
  } else {
2408
2312
  return column.span
@@ -2416,7 +2320,7 @@ export default {
2416
2320
  const col = row > 0 ? 1 : 0
2417
2321
  return {
2418
2322
  rowspan: row,
2419
- colspan: col,
2323
+ colspan: col
2420
2324
  }
2421
2325
  }
2422
2326
  },
@@ -2487,20 +2391,13 @@ export default {
2487
2391
  // 表示值不存在,需要转小写,再获得一遍
2488
2392
  const reg1 = /[A-Z]+/ // 大写字母
2489
2393
  if (this.isSql && reg1.test(prop)) {
2490
- fieldValue = getEntityFieldValueWithOutCase(
2491
- row,
2492
- prop.toLowerCase()
2493
- )
2394
+ fieldValue = getEntityFieldValueWithOutCase(row, prop.toLowerCase())
2494
2395
  if (fieldValue !== undefined && fieldValue !== null) {
2495
2396
  numberValue = Number(fieldValue)
2496
2397
  }
2497
2398
  }
2498
2399
  }
2499
- if (
2500
- numberValue !== undefined &&
2501
- numberValue !== null &&
2502
- !isNaN(numberValue)
2503
- ) {
2400
+ if (numberValue !== undefined && numberValue !== null && !isNaN(numberValue)) {
2504
2401
  colTotal += numberValue
2505
2402
  }
2506
2403
  })
@@ -2528,15 +2425,13 @@ export default {
2528
2425
  onEnd({ newIndex, oldIndex }) {
2529
2426
  const params = {
2530
2427
  oldIndex: oldIndex,
2531
- newIndex: newIndex,
2428
+ newIndex: newIndex
2532
2429
  }
2533
- this.$http
2534
- .post(this.lineEdit.urlToSaveOrder, params)
2535
- .then((data) => {
2536
- const currRow = vm.gridData.splice(oldIndex, 1)[0]
2537
- vm.gridData.splice(newIndex, 0, currRow)
2538
- })
2539
- },
2430
+ this.$http.post(this.lineEdit.urlToSaveOrder, params).then((data) => {
2431
+ const currRow = vm.gridData.splice(oldIndex, 1)[0]
2432
+ vm.gridData.splice(newIndex, 0, currRow)
2433
+ })
2434
+ }
2540
2435
  })
2541
2436
  }
2542
2437
  }
@@ -2567,11 +2462,7 @@ export default {
2567
2462
  },
2568
2463
  loadChildrenNode(row, treeNode, resove) {
2569
2464
  const subRowUrl = this.options.subRowUrl
2570
- if (
2571
- typeof subRowUrl !== 'undefined' &&
2572
- subRowUrl !== '' &&
2573
- subRowUrl !== null
2574
- ) {
2465
+ if (typeof subRowUrl !== 'undefined' && subRowUrl !== '' && subRowUrl !== null) {
2575
2466
  const parentRowIds = []
2576
2467
  parentRowIds.push(row.id ? row.id : row.ID)
2577
2468
  this.fetchData(this.getSearchParam(), false, parentRowIds, resove)
@@ -2584,9 +2475,7 @@ export default {
2584
2475
  // 折叠时清空表格缓存的已加载的标识位,使其能够动态更新子集合
2585
2476
  // 必须添加这句,否则不会重新走load
2586
2477
  if (this.$refs.superGrid.store.states.treeData) {
2587
- this.$refs.superGrid.store.states.treeData[
2588
- row.id ? row.id : row.ID
2589
- ].loaded = false
2478
+ this.$refs.superGrid.store.states.treeData[row.id ? row.id : row.ID].loaded = false
2590
2479
  }
2591
2480
  } else {
2592
2481
  // console.log('expandChange=this.$refs.superGrid.store.states.lazyTreeNodeMap', this.$refs.superGrid.store.states.lazyTreeNodeMap)
@@ -2598,17 +2487,10 @@ export default {
2598
2487
  removeGridStoreSelection(parentRowIds) {
2599
2488
  let selection = []
2600
2489
  if (this.$refs.superGrid.store.states.selection) {
2601
- selection = [].concat(
2602
- JSON.parse(
2603
- JSON.stringify(this.$refs.superGrid.store.states.selection)
2604
- )
2605
- )
2490
+ selection = [].concat(JSON.parse(JSON.stringify(this.$refs.superGrid.store.states.selection)))
2606
2491
  }
2607
2492
  for (let i = 0; i < selection.length; i++) {
2608
- if (
2609
- parentRowIds &&
2610
- parentRowIds.indexOf(selection[i][this.parentProp]) >= 0
2611
- ) {
2493
+ if (parentRowIds && parentRowIds.indexOf(selection[i][this.parentProp]) >= 0) {
2612
2494
  // 移除第i个元素
2613
2495
  this.$refs.superGrid.store.states.selection.splice(i, 1)
2614
2496
  if (this.$refs.superGrid.store.states.selection.length > 0) {
@@ -2710,11 +2592,7 @@ export default {
2710
2592
  } else {
2711
2593
  backgroundColorMap[item.prop] = '#808080'
2712
2594
  }
2713
- if (
2714
- this.backgroundColorMap &&
2715
- this.backgroundColorMap[item.prop] === '#409EFF' &&
2716
- this.externalClickFlag
2717
- ) {
2595
+ if (this.backgroundColorMap && this.backgroundColorMap[item.prop] === '#409EFF' && this.externalClickFlag) {
2718
2596
  backgroundColorMap[item.prop] = '#409EFF'
2719
2597
  }
2720
2598
  }
@@ -2759,8 +2637,7 @@ export default {
2759
2637
  this.rightClickColumn = item
2760
2638
  this.$nextTick(() => {
2761
2639
  const menu = this.$refs.headerMenu.$el
2762
- const scrollTop =
2763
- document.documentElement.scrollTop || document.body.scrollTop
2640
+ const scrollTop = document.documentElement.scrollTop || document.body.scrollTop
2764
2641
  menu.style.display = 'block'
2765
2642
  menu.style.left = event.clientX + 'px'
2766
2643
  // 当滑动滚动条时也能准确获取菜单位置
@@ -2794,19 +2671,14 @@ export default {
2794
2671
  let needValidate = true
2795
2672
  if (isHasEditOption('isEnableValidate', this.code)) {
2796
2673
  // 表示配置了是否启用必填验证
2797
- needValidate =
2798
- this.gridParams.options.lineEditOptions['isEnableValidate']
2674
+ needValidate = this.gridParams.options.lineEditOptions['isEnableValidate']
2799
2675
  }
2800
2676
  let validateResult = true
2801
2677
  if (needValidate === true) {
2802
2678
  let pageNum
2803
2679
  // 每页的记录下标,提示时使用
2804
2680
  let pageRowIndex
2805
- if (
2806
- this.isSubTableShowPage &&
2807
- pageSize !== undefined &&
2808
- pageSize > 0
2809
- ) {
2681
+ if (this.isSubTableShowPage && pageSize !== undefined && pageSize > 0) {
2810
2682
  pageNum = Math.ceil((i + 1) / pageSize)
2811
2683
  pageRowIndex = i + 1 - (pageNum - 1) * pageSize
2812
2684
  }
@@ -2821,10 +2693,7 @@ export default {
2821
2693
  )
2822
2694
  }
2823
2695
  if (validateResult !== null && validateResult !== undefined) {
2824
- if (
2825
- typeof validateResult === 'string' ||
2826
- validateResult === false
2827
- ) {
2696
+ if (typeof validateResult === 'string' || validateResult === false) {
2828
2697
  return false
2829
2698
  }
2830
2699
  }
@@ -2838,16 +2707,11 @@ export default {
2838
2707
  },
2839
2708
  rowDblclickEvent(row, column, event) {
2840
2709
  const gridParams = store.get(this.code)
2841
- if (
2842
- gridParams.options &&
2843
- gridParams.options.isFormSubTable &&
2844
- gridParams.options.isPdfEditor
2845
- ) {
2710
+ if (gridParams.options && gridParams.options.isFormSubTable && gridParams.options.isPdfEditor) {
2846
2711
  // 如果是子表并且是pdf模式
2847
2712
  } else if (this.isFormSubTable) {
2848
2713
  // 表示是表单的子表,点击时需要将当前行设为行编辑状态,并保存上一行的记录(不是保存到数据库,只是把编辑状态改为false)
2849
- if (column.property &&
2850
- column.property !== 'operation') {
2714
+ if (column.property && column.property !== 'operation') {
2851
2715
  let canEdit = true
2852
2716
  const gridParams = store.get(this.code)
2853
2717
  if (isEditOptionFunction('beforeEdit', this.code)) {
@@ -2859,7 +2723,7 @@ export default {
2859
2723
  listCode: this.code,
2860
2724
  entity: row,
2861
2725
  columns: gridParams.columns,
2862
- isMobile: false,
2726
+ isMobile: this.isMobile,
2863
2727
  pageGridData: isSubTableShowPage ? gridParams.gridData : null,
2864
2728
  pageSize,
2865
2729
  additionalParamMap: gridParams.additionalParamMap,
@@ -2881,22 +2745,14 @@ export default {
2881
2745
  }
2882
2746
  } else {
2883
2747
  if (row) {
2884
- if (
2885
- gridParams &&
2886
- gridParams.lineEdit &&
2887
- gridParams.lineEdit.editable &&
2888
- gridParams.canntEdit
2889
- ) {
2748
+ if (gridParams && gridParams.lineEdit && gridParams.lineEdit.editable && gridParams.canntEdit) {
2890
2749
  let index = this.gridData.findIndex(function (item) {
2891
- return (
2892
- (item.id && item.id === row.id) ||
2893
- (item.ID && item.ID === row.ID)
2894
- )
2750
+ return (item.id && item.id === row.id) || (item.ID && item.ID === row.ID)
2895
2751
  })
2896
2752
  if (index < 0) {
2897
2753
  index = 0
2898
2754
  }
2899
- this.editRow(index)
2755
+ this.editRow(index, this.code)
2900
2756
  }
2901
2757
  }
2902
2758
  }
@@ -2906,16 +2762,12 @@ export default {
2906
2762
  // 取消上一行的编辑状态
2907
2763
  let editRows
2908
2764
  if (this.isSubTableShowPage) {
2909
- editRows = this.subTableData.filter(
2910
- row => row.$editing !== undefined && row.$editing === true
2911
- )
2765
+ editRows = this.subTableData.filter((row) => row.$editing !== undefined && row.$editing === true)
2912
2766
  } else {
2913
- editRows = this.gridData.filter(
2914
- row => row.$editing !== undefined && row.$editing === true
2915
- )
2767
+ editRows = this.gridData.filter((row) => row.$editing !== undefined && row.$editing === true)
2916
2768
  }
2917
2769
  if (editRows && editRows.length > 0) {
2918
- editRows.forEach(editRow => {
2770
+ editRows.forEach((editRow) => {
2919
2771
  setEntityFieldValue(editRow, '$editing', false)
2920
2772
  // 取消上一行选中状态时,触发un-edit事件,处理下拉多选选项组问题
2921
2773
  eventBus.$emit('un-edit', { row: editRow })
@@ -2957,30 +2809,35 @@ export default {
2957
2809
  jumpMode = openPageParams.jumpMode
2958
2810
  }
2959
2811
  const popPageSetting = openPageParams
2960
- if(this.pageContext){
2812
+ if (this.pageContext) {
2961
2813
  // 新页面设计组件中弹框或刷新区域时
2962
- if (jumpMode === 'popup' || jumpMode === 'refresh') {
2814
+ const isMobile = this.isMobile
2815
+ if (jumpMode === 'popup' || jumpMode === 'refresh' || (isMobile && jumpMode === 'newTab')) {
2963
2816
  // 弹出页面
2964
2817
  const gridParams = store.get(this.code)
2965
2818
  this.jumpPageSetting = popPageSetting
2966
2819
  const isSubTableShowPage = gridParams.isSubTableShowPage
2967
2820
  // 每页显示多少条
2968
2821
  const pageSize = gridParams.pagination && gridParams.pagination.pageSize
2969
- const isMobile = false
2970
2822
  const row = popPageSetting.row
2971
2823
  const eventParams = {
2972
2824
  position: popPageSetting._position,
2973
2825
  listCode: popPageSetting._listCode,
2974
2826
  rowIndex: popPageSetting._rowIndex,
2975
2827
  row: popPageSetting.row,
2976
- id: row?(row.ID?row.ID:row.id):null,
2828
+ columnProp: popPageSetting._columnProp,
2829
+ id: row ? (row.ID ? row.ID : row.id) : null,
2977
2830
  isMobile,
2978
- gridData: isSubTableShowPage
2979
- ? gridParams.subTableData
2980
- : gridParams.gridData,
2831
+ gridData: isSubTableShowPage ? gridParams.subTableData : gridParams.gridData,
2981
2832
  pageGridData: isSubTableShowPage ? gridParams.gridData : null,
2982
- pageSize }
2983
- this.$emit('new-open-grid-dialog', {pageContext: this.pageContext,configureObj: this.configureObj, eventParams, jumpPageSetting: this.jumpPageSetting})
2833
+ pageSize
2834
+ }
2835
+ this.$emit('new-open-grid-dialog', {
2836
+ pageContext: this.pageContext,
2837
+ configureObj: this.configureObj,
2838
+ eventParams,
2839
+ jumpPageSetting: this.jumpPageSetting
2840
+ })
2984
2841
  }
2985
2842
  } else {
2986
2843
  if (jumpMode === 'popup') {
@@ -3020,13 +2877,13 @@ export default {
3020
2877
  },
3021
2878
  // 刷新列表数据
3022
2879
  refresData(data) {
3023
- const gridParams = store.get(this.code)
3024
- gridParams.gridData = data
3025
- store.set(this.code, gridParams)
3026
- if (this.parentFormData) {
3027
- this.parentFormData[this.code] = data
3028
- }
3029
- this['gridData'] = data
2880
+ const gridParams = store.get(this.code)
2881
+ gridParams.gridData = data
2882
+ store.set(this.code, gridParams)
2883
+ if (this.parentFormData) {
2884
+ this.parentFormData[this.code] = data
2885
+ }
2886
+ this['gridData'] = data
3030
2887
  },
3031
2888
  refresPortData(port, value, index) {
3032
2889
  if (this.gridData[index]) {
@@ -3057,11 +2914,15 @@ export default {
3057
2914
  openFold(isOpen) {
3058
2915
  this.resizeTableHeight()
3059
2916
  },
3060
- // 设置字段禁止编辑
2917
+ /**
2918
+ * 设置字段禁止编辑。只能控制禁止编辑。不能控制必填
2919
+ * @param entity 格式如:{'NAME':false,"DYM_COLUMN":true}。表示NAME字段不可编辑,DYM_COLUMN可以被编辑
2920
+ */
3061
2921
  fnProhibitToEdit(entity) {
3062
- if (entity) {
3063
- if (entity.isForceUpdate) {
2922
+ if (entity) {
2923
+ if (entity.isForceUpdate) {
3064
2924
  this.$emit('fn-prohibit-to-edit', entity)
2925
+ this.$emit('prohibitToEdit', entity)
3065
2926
  }
3066
2927
  for (const key in entity) {
3067
2928
  // console.log('key', key)
@@ -3074,7 +2935,10 @@ export default {
3074
2935
  }
3075
2936
  }
3076
2937
  },
3077
- // 设置字段禁止编辑
2938
+ /**
2939
+ * 设置字段禁止编辑。只能控制禁止编辑。不能控制必填
2940
+ * @param entity 格式如:{'NAME':false,"DYM_COLUMN":true}。表示NAME字段不可编辑,DYM_COLUMN可以被编辑
2941
+ */
3078
2942
  prohibitToEdit(entity) {
3079
2943
  this.fnProhibitToEdit(entity)
3080
2944
  },
@@ -3082,11 +2946,11 @@ export default {
3082
2946
  getTreeProps(parentProp, isSql, isLazy, dataSourceType) {
3083
2947
  let treeProps = {
3084
2948
  children: 'children',
3085
- hasChildren: '_has_children',
2949
+ hasChildren: '_has_children'
3086
2950
  }
3087
2951
  if (parentProp) {
3088
2952
  treeProps = {
3089
- children: 'children',
2953
+ children: 'children'
3090
2954
  }
3091
2955
  let hasChildren = 'hasChildren'
3092
2956
  if (isLazy) {
@@ -3108,20 +2972,19 @@ export default {
3108
2972
  store.set(this.code, gridParams)
3109
2973
  this['subTableData'] = data
3110
2974
  },
2975
+ refreshList() {
2976
+ this.fetchData(this.getSearchParam())
2977
+ },
3111
2978
  // 选择记录
3112
- selectRecord(selection, row){
2979
+ selectRecord(selection, row) {
3113
2980
  let selectRecordEventResult = true
3114
2981
  const gridParams = store.get(this.code)
3115
2982
  if (isHasOptionFunction('selectRecord', this.code)) {
3116
2983
  selectRecordEventResult = gridParams.options.selectRecord.call(this, {
3117
- gridData: this.isSubTableShowPage
3118
- ? this.subTableData
3119
- : this.gridData,
2984
+ gridData: this.isSubTableShowPage ? this.subTableData : this.gridData,
3120
2985
  columns: gridParams.columns,
3121
2986
  superGrid: this.$refs.superGrid,
3122
- pageGridData: this.isSubTableShowPage
3123
- ? this.gridData
3124
- : null,
2987
+ pageGridData: this.isSubTableShowPage ? this.gridData : null,
3125
2988
  additionalParamMap: gridParams.additionalParamMap,
3126
2989
  selection: selection,
3127
2990
  row: row,
@@ -3129,7 +2992,7 @@ export default {
3129
2992
  pageContext: this.pageContext,
3130
2993
  configureObj: this.configureObj
3131
2994
  })
3132
- if(selectRecordEventResult !== undefined && selectRecordEventResult=== false){
2995
+ if (selectRecordEventResult !== undefined && selectRecordEventResult === false) {
3133
2996
  // 最后选中的记录取消选中状态
3134
2997
  this.$refs.superGrid.toggleRowSelection(row, false)
3135
2998
  }
@@ -3137,26 +3000,22 @@ export default {
3137
3000
  this.select(selection, row)
3138
3001
  },
3139
3002
  // 取消选择记录
3140
- selectAllRecord(selection){
3003
+ selectAllRecord(selection) {
3141
3004
  let selectAllRecordsEventResult = true
3142
3005
  const gridParams = store.get(this.code)
3143
3006
  if (isHasOptionFunction('selectAllRecords', this.code)) {
3144
3007
  selectAllRecordsEventResult = gridParams.options.selectAllRecords.call(this, {
3145
- gridData: this.isSubTableShowPage
3146
- ? this.subTableData
3147
- : this.gridData,
3008
+ gridData: this.isSubTableShowPage ? this.subTableData : this.gridData,
3148
3009
  columns: gridParams.columns,
3149
3010
  superGrid: this.$refs.superGrid,
3150
- pageGridData: this.isSubTableShowPage
3151
- ? this.gridData
3152
- : null,
3011
+ pageGridData: this.isSubTableShowPage ? this.gridData : null,
3153
3012
  additionalParamMap: gridParams.additionalParamMap,
3154
3013
  selection: selection,
3155
3014
  parentFormData: this.parentFormData,
3156
3015
  pageContext: this.pageContext,
3157
3016
  configureObj: this.configureObj
3158
3017
  })
3159
- if(selectAllRecordsEventResult !== undefined && selectAllRecordsEventResult=== false){
3018
+ if (selectAllRecordsEventResult !== undefined && selectAllRecordsEventResult === false) {
3160
3019
  // 取消所有记录选中状态
3161
3020
  this.$refs.superGrid.toggleAllSelection()
3162
3021
  }
@@ -3164,18 +3023,14 @@ export default {
3164
3023
  this.selectAll(selection)
3165
3024
  },
3166
3025
  // 选择记录发生改变时
3167
- selectionChangeEvent(newSelection){
3026
+ selectionChangeEvent(newSelection) {
3168
3027
  const gridParams = store.get(this.code)
3169
3028
  if (isHasOptionFunction('selectionChange', this.code)) {
3170
3029
  gridParams.options.selectionChange.call(this, {
3171
- gridData: this.isSubTableShowPage
3172
- ? this.subTableData
3173
- : this.gridData,
3030
+ gridData: this.isSubTableShowPage ? this.subTableData : this.gridData,
3174
3031
  columns: gridParams.columns,
3175
3032
  superGrid: this.$refs.superGrid,
3176
- pageGridData: this.isSubTableShowPage
3177
- ? this.gridData
3178
- : null,
3033
+ pageGridData: this.isSubTableShowPage ? this.gridData : null,
3179
3034
  additionalParamMap: gridParams.additionalParamMap,
3180
3035
  selection: newSelection,
3181
3036
  parentFormData: this.parentFormData,
@@ -3189,6 +3044,48 @@ export default {
3189
3044
  }
3190
3045
  this.selectionChange(newSelection)
3191
3046
  },
3047
+ // 显示移动端查询区域
3048
+ showMobileSearch() {
3049
+ console.log('showMobileSearch-----this.isShowMobileSearch=', this.isShowMobileSearch, 'isMobile=', this.isMobile)
3050
+ this.isShowMobileSearch = true
3051
+ if (this.$refs.sf) {
3052
+ // 获得查询区高度
3053
+ this.$refs.sf.showMobileSearch()
3054
+ }
3055
+ },
3056
+ // 移动端选择文件结束
3057
+ pickFileDone(data) {
3058
+ console.log(
3059
+ 'superPage5555---pickFileDone--data.componentId=',
3060
+ data.componentId,
3061
+ 'data.listCode=',
3062
+ data.listCode,
3063
+ 'data=',
3064
+ data
3065
+ )
3066
+ if (data && data.componentId) {
3067
+ eventBus.$emit(data.componentId + '-pickFileDone', data)
3068
+ }
3069
+ },
3070
+ // 移动端上传文件结束
3071
+ uploadFileDone(data) {
3072
+ if (data && data.componentId) {
3073
+ eventBus.$emit(data.componentId + '-uploadFileDone', data)
3074
+ }
3075
+ },
3076
+ // 移动端扫描结束
3077
+ scanDone(data) {
3078
+ if (data && data.componentId) {
3079
+ eventBus.$emit(data.componentId + '-scanDone', data)
3080
+ }
3081
+ },
3082
+ openRowForm(rowIndex) {
3083
+ this.currentEditRowIndex = rowIndex
3084
+ this.showRowForm = true
3085
+ },
3086
+ closeRowForm() {
3087
+ this.showRowForm = false
3088
+ }
3192
3089
  },
3193
3090
  emits: [
3194
3091
  'change-grid-data',
@@ -3201,9 +3098,8 @@ export default {
3201
3098
  'un-edit',
3202
3099
  'refresMainTableFields',
3203
3100
  'refresh',
3204
- 'cancel-search',
3205
- ,
3206
- ],
3101
+ 'cancel-search'
3102
+ ]
3207
3103
  }
3208
3104
  </script>
3209
3105