agilebuilder-ui 1.0.84 → 1.0.85-temp2

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.
@@ -27,327 +27,34 @@
27
27
  </el-icon>
28
28
  </template>
29
29
  <template v-slot="scope">
30
- <!--添加:key="column.prop+'_'+scope.$index"是为了解决多行是行编辑状态时新建的记录的文本框内有值的问题-->
31
- <dynamic-input
32
- v-if="lineEdit.editable && isEditable && scope.row.$editing"
33
- v-model:value="scope.row[column.prop]"
34
- :class="isRequired(scope.row.$editing) ? 'm-requried' : ''"
35
- :column="column"
30
+ <!-- :pagination="pagination" -->
31
+ <NormalColumnContent
32
+ :ref="column.prop"
36
33
  :is-sql="isSql"
37
- :line-edit="lineEdit"
34
+ :column="column"
38
35
  :list-code="listCode"
36
+ :new-width="newWidth"
37
+ :drag-column-prop="dragColumnProp"
38
+ :right-click-menu-arr="options.rightClickMenuArr"
39
+ :table-name="tableName"
40
+ :page-code="pageCode"
39
41
  :list-toolbar-form-data="listToolbarFormData"
40
- :options="column.valueSet"
41
- :position="{
42
- row: scope.$index,
43
- prop: column.prop
44
- }"
45
- :disabled="disabled"
42
+ :list-name="listName"
43
+ :options="options"
44
+ :current-page="currentPage"
45
+ :grid-data="gridData"
46
+ :page-grid-data="pageGridData"
46
47
  :row="scope.row"
47
48
  :row-index="scope.$index"
48
- :type="column.componentType"
49
- @findIndex="findIndex(scope.$index)"
50
- @focus="onFocus(scope.$index)"
51
- @prohibit-to-edit="prohibitToEdit"
52
- @refresh-list="refreshList"
49
+ :line-edit="lineEdit"
50
+ :custom-format="customFormat"
51
+ @open-page="openPageEvent"
53
52
  @refresData="refresData"
54
- @refresMainTableFields="refresMainTableFields"
53
+ @refresh-list="refreshList"
55
54
  @refresPortData="refresPortData"
56
55
  @refresPortsData="refresPortsData"
57
- @change-disabled="changeDisabled"
58
- />
59
- <span v-else>
60
- <span v-if="column.operations" class="grid-operation-buttons">
61
- <span v-for="(operation, operationIndex) in column.operations" :key="operationIndex" class="cell--span">
62
- <el-dropdown
63
- v-if="operation.isGroup"
64
- :size="operation.buttons && operation.buttons.length > 0 ? operation.buttons[0].props.size : 'small'"
65
- split-button
66
- style="padding-left: 10px"
67
- @command="handleCommand"
68
- >
69
- {{ $escapeHtml(operation.label) }}
70
- <template v-slot:dropdown>
71
- <el-dropdown-menu>
72
- <span
73
- v-for="(buttonChild, buttonChildIndex) in operation.buttons"
74
- :key="buttonChild.props.code + buttonChildIndex"
75
- >
76
- <el-dropdown-item
77
- v-permission="buttonChild.props.permission"
78
- :command="beforeHandleCommand(buttonChild.props.code, scope.row, scope.$index)"
79
- :disabled="preventReclick"
80
- >
81
- {{
82
- $escapeHtml(
83
- buttonChild.props.label
84
- ? buttonChild.props.label
85
- : buttonChild.props.code === 'search'
86
- ? $t('superPageMessage.searchButtonLabel')
87
- : ''
88
- )
89
- }}
90
- </el-dropdown-item>
91
- </span>
92
- </el-dropdown-menu>
93
- </template>
94
- </el-dropdown>
95
- <row-operation
96
- v-else
97
- :column="column"
98
- :editing="scope.row.$editing"
99
- :entity="scope.row"
100
- :is-show="operation.isShow"
101
- :label="operation.props.label ? operation.props.label : scope.row[column.prop]"
102
- :on-click="operation.onClick"
103
- :operation-index="operationIndex"
104
- :operation-setting="operation.props"
105
- :row-index="scope.$index"
106
- :list-code="listCode"
107
- :parent-form-data="parentFormData"
108
- />
109
- </span>
110
- </span>
111
- <span v-else-if="customFormatValue(scope.row, column.prop, customFormat, scope.$index)" class="cell--span">
112
- <component
113
- :is="column.prop + scope.$index"
114
- :entity="scope.row"
115
- :parent="parentFormData"
116
- :prop="column.prop"
117
- :row="scope.row"
118
- :row-index="scope.$index"
119
- :select-options="column.valueSet"
120
- :show-value="$escapeHtml(getLabel(scope.row, scope.$index))"
121
- :value="getCellValue(scope.row)"
122
- :additional-param-map="additionalParamMap"
123
- :additional-settings="controlConfig"
124
- />
125
- </span>
126
- <!-- 自定义格式的时候 -->
127
- <span
128
- v-else-if="
129
- columnFormatter !== undefined &&
130
- columnFormatter.type !== undefined &&
131
- columnFormatter.type === 'customControl' &&
132
- columnFormatter.options &&
133
- columnFormatter.options.format &&
134
- columnFormatter.options.format !== ''
135
- "
136
- class="cell--span"
137
- >
138
- <!--:key="column.prop+'_'+scope.$index+'_'+currentPage" 为了解决子表分页时,新增自动跳转到下一页,第一条记录的自定义控件被复用,导致业务逻辑没执行 -->
139
- <component
140
- :is="columnFormatter.options.format"
141
- :key="column.prop + '_' + scope.$index + '_' + currentPage"
142
- :current-page="currentPage"
143
- :disabled="true"
144
- :entity="pageGridData[scope.$index]"
145
- :get-form-data="getFormData"
146
- :get-grid-data="getTableGridData"
147
- :grid-data="gridData"
148
- :page-grid-data="pageGridData"
149
- :parent="parentFormData"
150
- :prop="column.prop"
151
- :row="pageGridData[scope.$index]"
152
- :row-index="scope.$index"
153
- :select-options="column.valueSet"
154
- :show-value="$escapeHtml(getLabel(pageGridData[scope.$index], scope.$index))"
155
- :value="getCellValue(pageGridData[scope.$index])"
156
- :additional-param-map="additionalParamMap"
157
- :listCode="listCode"
158
- :component-id="componentId"
159
- :additional-settings="controlConfig"
160
- @prohibitToEdit="prohibitToEdit"
161
- @refresh-list="refreshList"
162
- /></span>
163
- <span
164
- v-else-if="
165
- columnFormatter !== undefined && columnFormatter.type !== undefined && columnFormatter.type === 'secretInfo'
166
- "
167
- :id="column.prop + 'DomData' + scope.$index"
168
- class="cell--span"
169
- >
170
- <secret-info
171
- :entity="scope.row"
172
- :field-label="$escapeHtml(label)"
173
- :list-code="listCode"
174
- :list-name="listName"
175
- :page-code="pageCode"
176
- :prop="column.prop"
177
- :table-name="tableName"
178
- :value="getCellValue(scope.row)"
179
- />
180
- </span>
181
- <span v-else-if="isObjectProp(column.prop)">
182
- <!-- isObjectProp => prop.indexOf('.') > 0 -->
183
- <span v-if="column.formatter && column.formatter.type === 'files'" type="primary">
184
- <span
185
- :id="column.prop + 'DomData' + scope.$index"
186
- :style="{ width: cellWidth + 'px' }"
187
- :title="isShowOverflowTooltip ? $escapeHtml(getLabel(scope.row)) : ''"
188
- class="ellipsis cell--span"
189
- >
190
- <FsPreview
191
- :entity="scope.row"
192
- :file-set-obj="getFilesFormatter()"
193
- :is-sql="isSql"
194
- :label="$escapeHtml(getLabel(scope.row, scope.$index))"
195
- />
196
- </span>
197
- </span>
198
- <!-- <el-link
199
- v-else-if="
200
- columnFormatter !== undefined &&
201
- columnFormatter.type !== undefined &&
202
- columnFormatter.type === 'hyperlinks' &&
203
- getMyHyperLinkSetting(scope.row).visible === true
204
- "
205
- type="primary"
206
- @click="clickHyperLink(column, scope.row, listCode, scope.$index)"
207
- > -->
208
- <el-link
209
- v-else-if="
210
- columnFormatter !== undefined &&
211
- columnFormatter.type !== undefined &&
212
- columnFormatter.type === 'hyperlinks' &&
213
- getMyHyperLinkSetting(scope.row).visible === true
214
- "
215
- :type="getLinkType(scope.row)"
216
- @click="clickHyperLink(column, scope.row, listCode, scope.$index)"
217
- >
218
- <span
219
- v-if="isShowOverflowTooltip"
220
- :id="column.prop + 'DomData' + scope.$index"
221
- :style="{ width: cellWidth + 'px' }"
222
- :title="getMyHyperLinkSetting(scope.row).title"
223
- class="ellipsis cell--span"
224
- >{{ getMyHyperLinkSetting(scope.row).label }}
225
- <el-icon v-if="getMyHyperLinkSetting(scope.row).icon">
226
- <component :is="getMyHyperLinkSetting(scope.row).icon" />
227
- </el-icon>
228
- </span>
229
- <span v-else :id="column.prop + 'DomData' + scope.$index" class="cell--span"
230
- >{{ getMyHyperLinkSetting(scope.row).label }}
231
- <el-icon v-if="getMyHyperLinkSetting(scope.row).icon">
232
- <component :is="getMyHyperLinkSetting(scope.row).icon" />
233
- </el-icon>
234
- </span>
235
- </el-link>
236
- <span
237
- v-else-if="isShowOverflowTooltip"
238
- :id="column.prop + 'DomData' + scope.$index"
239
- :style="{ width: cellWidth + 'px' }"
240
- :title="$escapeHtml(getLabel(scope.row))"
241
- class="ellipsis cell--span"
242
- >{{ $escapeHtml(getLabel(scope.row, scope.$index)) }}</span
243
- >
244
- <span v-else :id="column.prop + 'DomData' + scope.$index" class="cell--span">{{
245
- $escapeHtml(getLabel(scope.row, scope.$index))
246
- }}</span>
247
- </span>
248
- <span v-else>
249
- <span v-if="column.componentType === 'annex' || column.componentType === 'multipartUpload'" type="primary">
250
- <span
251
- v-if="isShowOverflowTooltip"
252
- :id="column.prop + 'DomData' + scope.$index"
253
- :style="{ width: cellWidth + 'px' }"
254
- :title="$escapeHtml(getLabel(scope.row))"
255
- class="ellipsis cell--span"
256
- >
257
- <FsPreview
258
- :entity="scope.row"
259
- :file-set-obj="getFileObj(column.fileSet)"
260
- :is-sql="isSql"
261
- :label="$escapeHtml(getLabel(scope.row, scope.$index))"
262
- />
263
- </span>
264
- <span v-else :id="column.prop + 'DomData' + scope.$index" class="cell--span">
265
- <FsPreview
266
- :entity="scope.row"
267
- :file-set-obj="getFileObj(column.fileSet)"
268
- :is-sql="isSql"
269
- :label="$escapeHtml(getLabel(scope.row, scope.$index))"
270
- />
271
- </span>
272
- </span>
273
- <span v-else-if="column.formatter && column.formatter.type === 'files'">
274
- <span
275
- :id="column.prop + 'DomData' + scope.$index"
276
- :style="{ width: cellWidth + 'px' }"
277
- :title="isShowOverflowTooltip ? $escapeHtml(getLabel(scope.row)) : ''"
278
- class="ellipsis cell--span"
279
- >
280
- <FsPreview
281
- :entity="scope.row"
282
- :file-set-obj="getFilesFormatter()"
283
- :is-sql="isSql"
284
- :label="$escapeHtml(getLabel(scope.row, scope.$index))"
285
- />
286
- </span>
287
- </span>
288
- <!-- 超链接 -->
289
- <el-link
290
- v-else-if="
291
- columnFormatter !== undefined &&
292
- columnFormatter.type !== undefined &&
293
- columnFormatter.type === 'hyperlinks' &&
294
- getMyHyperLinkSetting(scope.row).visible === true
295
- "
296
- type="primary"
297
- @click="clickHyperLink(column, scope.row, listCode, scope.$index)"
298
- >
299
- <span
300
- v-if="isShowOverflowTooltip"
301
- :id="column.prop + 'DomData' + scope.$index"
302
- :style="{ width: cellWidth + 'px' }"
303
- :title="$escapeHtml(getMyHyperLinkSetting(scope.row).title)"
304
- class="ellipsis cell--span"
305
- >{{ $escapeHtml(getMyHyperLinkSetting(scope.row).label) }}
306
- <el-icon v-if="getMyHyperLinkSetting(scope.row).icon">
307
- <component :is="getMyHyperLinkSetting(scope.row).icon" />
308
- </el-icon>
309
- </span>
310
- <span v-else :id="column.prop + 'DomData' + scope.$index" class="cell--span"
311
- >{{ $escapeHtml(getMyHyperLinkSetting(scope.row).label) }}
312
- <el-icon v-if="getMyHyperLinkSetting(scope.row).icon">
313
- <component :is="getMyHyperLinkSetting(scope.row).icon" />
314
- </el-icon>
315
- </span>
316
- </el-link>
317
- <!-- 富文本 -->
318
- <span v-else-if="column.formatter && column.formatter.type === 'richEditor'">
319
- <el-tooltip :content="$t('superGrid.show')" class="item" effect="dark" placement="top">
320
- <em class="fa fa-info-circle annex-cell" @click="showRichEditorContent(scope.row, column, getHeader())" />
321
- </el-tooltip>
322
- </span>
323
- <GridIcon
324
- v-else-if="column.formatter && column.formatter.type === 'icon'"
325
- :id="column.prop + 'DomData' + scope.$index"
326
- :column="column"
327
- :row="scope.row"
328
- :row-index="scope.$index"
329
- :is-sql="isSql"
330
- :list-code="listCode"
331
- />
332
- <span
333
- v-else-if="isShowOverflowTooltip"
334
- :id="column.prop + 'DomData' + scope.$index"
335
- :style="{ width: cellWidth + 'px' }"
336
- :title="getLabel(scope.row)"
337
- class="ellipsis cell--span"
338
- style="white-space: pre"
339
- v-html="$escapeHtml(getLabel(scope.row, scope.$index))"
340
- />
341
- <span v-else :id="column.prop + 'DomData' + scope.$index" class="cell--span">{{
342
- $escapeHtml(getLabel(scope.row, scope.$index))
343
- }}</span>
344
- </span>
345
- </span>
346
- <view-image-dialog v-if="showSingleImgFlag" :file-list="fileList" @close="showSingleImgFlag = false" />
347
- <rich-editor-viewer
348
- v-if="showRichEditorViewer"
349
- ref="richEditorViewerRef"
350
- @closeRichEditorContent="closeRichEditorContent"
56
+ @refresMainTableFields="refresMainTableFields"
57
+ @prohibitToEdit="prohibitToEdit"
351
58
  />
352
59
  </template>
353
60
  </el-table-column>
@@ -357,28 +64,23 @@
357
64
  import { CirclePlus, ZoomIn as ElIconZoomIn } from '@element-plus/icons-vue'
358
65
  import { $emit, $off, $on } from '../../utils/gogocodeTransfer'
359
66
  import {
360
- ArrowKeyAction,
361
67
  getColumnValues,
362
- getFileList,
363
- isDynamicDataSourceSource,
364
- isHasEditOption,
365
68
  isRequiredEdit,
366
- getAdditionalParamMap
69
+ getContentAlign,
70
+ getHeaderAlign,
71
+ getHeaderLable
367
72
  } from './utils'
368
73
  import DynamicInput from './dynamic-input.vue'
369
74
  import store from './store'
370
- import { doFormatWithValueSet } from './formatter'
371
75
  import customFormatter from './custom-formatter'
372
76
  import RowOperation from './row-operation.vue'
373
77
  import apis from './apis'
374
78
  import { mapGetters } from 'vuex'
375
- import { getEntityFieldValue, getParentObjectUtil } from '../../../src/utils/util'
376
79
  import ViewImageDialog from './view-image-dialog.vue'
377
- import eventBus from './eventBus'
378
80
  import FsPreview from '../../fs-preview'
379
81
  import RichEditorViewer from '../../rich-editor/viewer.vue'
380
82
  import GridIcon from './components/grid-icon.vue'
381
- import { formatScanRuleSets } from './scan-util.ts'
83
+ import NormalColumnContent from './normal-column-content.vue'
382
84
  export default {
383
85
  components: {
384
86
  DynamicInput,
@@ -388,7 +90,8 @@ export default {
388
90
  RichEditorViewer,
389
91
  CirclePlus,
390
92
  ElIconZoomIn,
391
- GridIcon
93
+ GridIcon,
94
+ NormalColumnContent
392
95
  },
393
96
  name: 'NormalColumn',
394
97
  props: {
@@ -448,47 +151,22 @@ export default {
448
151
  data() {
449
152
  let parentFormData
450
153
  const gridParams = store.get(this.listCode)
154
+ const options = gridParams.options
451
155
  if (gridParams.options.extraParam && gridParams.options.extraParam.entityMap) {
452
156
  parentFormData = gridParams.options.extraParam.entityMap
453
157
  }
454
- const additionalParamMap = getAdditionalParamMap(gridParams)
455
- let controlConfig = {}
456
- if (this.column.controlConfig) {
457
- controlConfig = JSON.parse(this.column.controlConfig)
458
- }
459
158
 
460
- let scanEnable = false
461
- if (controlConfig.scanEnable) {
462
- scanEnable = true
463
- }
464
- const componentId = this.listCode + '_' + this.column.prop
465
159
  return {
466
160
  selectRow: null,
467
161
  that: this,
468
162
  align: 'left', // 文本内容对齐
469
163
  headerAlign: 'left', // 表头对齐方式
470
- columnFormatter: this.column.formatter,
471
- hyperLinks: {},
472
- fileDownType: '',
473
164
  isFormSubTable: false, // 是否是表单子表
474
165
  subTableCanAdd: true, // 表单子表时是否有新增权限
475
166
  isShowAdd: false, // 是否显示表头的新增按钮
476
167
  cellWidth: null,
477
168
  parentFormData,
478
- fileMultiple: false, // 附件上传是否多选
479
- showSingleImgFlag: false,
480
- singleImgSrc: '',
481
- fileList: [],
482
- index: null,
483
- isEditable: this.column.editable,
484
- showRichEditorViewer: false,
485
- getFormData: gridParams.options.getFormData,
486
- getTableGridData: gridParams.options.getGridData,
487
- additionalParamMap,
488
- disabled: false,
489
- controlConfig: this.getColumnCustomControlControlConfig(this.column.formatter),
490
- scanEnable,
491
- componentId
169
+ options
492
170
  }
493
171
  },
494
172
  computed: {
@@ -604,35 +282,13 @@ export default {
604
282
  ) {
605
283
  this.subTableCanAdd = gridParams.options.subTableCanAdd
606
284
  }
607
- if (this.column.prop && this.column.prop === 'operation') {
608
- // 如果是操作列按钮则不显示省略号
609
- this.isShowOverflowTooltip = false
610
- } else {
611
- if (
612
- typeof gridParams.options.showOverflowTooltip !== 'undefined' &&
613
- gridParams.options.showOverflowTooltip === false
614
- ) {
615
- this.isShowOverflowTooltip = false
616
- } else {
617
- this.isShowOverflowTooltip = true
618
- }
619
- }
620
- if (typeof gridParams.options.align !== 'undefined') {
285
+ const align = getContentAlign(this.column, gridParams)
286
+ if (align) {
621
287
  this.align = gridParams.options.align
622
- } else if (this.column.contAlign && this.column.contAlign !== '') {
623
- this.align = this.column.contAlign
624
- }
625
- if (typeof gridParams.options.headerAlign !== 'undefined') {
626
- this.headerAlign = gridParams.options.headerAlign
627
- } else if (this.column.titleAlign && this.column.titleAlign !== '') {
628
- this.headerAlign = this.column.titleAlign
629
- } else {
630
- // 如果没有配置表头对齐方式,默认使用内容对齐方式
631
- this.headerAlign = 'left'
632
288
  }
633
- if (gridParams.isHasDynamic === undefined && this.column.dynamic !== undefined && this.column.dynamic === true) {
634
- // 当前列表中有动态列
635
- gridParams.isHasDynamic = true
289
+ const headerAlign = getHeaderAlign(this.column, gridParams)
290
+ if (headerAlign) {
291
+ this.headerAlign = headerAlign
636
292
  }
637
293
  this.label = this.getHeader()
638
294
  if (this.column.operations) {
@@ -645,338 +301,41 @@ export default {
645
301
  this.subTableCanAdd &&
646
302
  gridParams.options &&
647
303
  gridParams.options.showOperationButton
648
- if (this.column.fileSet && this.column.fileSet !== '' && this.column.componentType === 'annex') {
649
- const fileSetObj = JSON.parse(this.column.fileSet)
650
- if (fileSetObj && fileSetObj.multiple) {
651
- this.fileMultiple = true
652
- }
653
- }
654
- this.setScanRuleSets()
655
304
  },
656
305
  mounted() {
657
- // 监听保存时点击按钮事件线触发
658
- $on(eventBus, 'un-edit', (param) => {
659
- // 处理多选选项组问题保存问题
660
- if (
661
- this.column.componentType &&
662
- (this.column.componentType === 'multiselect' || this.column.componentType === 'select')
663
- ) {
664
- const isDynamic = isDynamicDataSourceSource(this.column)
665
- if (!isDynamic) {
666
- // 选项组保存时将数组处理为字符串
667
- const beforeColumnValue = param.row[this.column.prop]
668
- if (beforeColumnValue && Object.prototype.toString.apply(beforeColumnValue) === '[object Array]') {
669
- // 如果是数组才需要转换
670
- param.row[this.column.prop] = beforeColumnValue.join(',')
671
- }
672
- } else {
673
- // 动态数据源多选保存时,获取已选择的字段,由于多选选项组的值是数组,保存时要拼接成“ ,” 分隔的字符串
674
- if ('_dynamic-source-data-' + this.column.prop in this.column) {
675
- const temp = this.column['_dynamic-source-data-' + this.column.prop]
676
- const valueSetOptions = temp.valueSetOptions
677
- // 获取当前字段对应在映射关系中对应的是动态数据源中的哪一个字段key
678
- let selectDataKey
679
- for (let i = 0; i < valueSetOptions.length; i++) {
680
- const valueSetOption = valueSetOptions[i]
681
- if (this.column.prop === valueSetOption.valueColumn.dbColumnName) {
682
- selectDataKey = valueSetOption.columnName
683
- break
684
- }
685
- }
686
- if (selectDataKey) {
687
- // beforeColumnValue是数组值,如果是单选则是字符串
688
- let beforeColumnValue = param.row[this.column.prop]
689
- if (this.column.componentType === 'select') {
690
- if (selectDataKey !== temp.valueAttribute) {
691
- // 解决当前字段不是动态数据源选项值所映射的字段的问题 例如当前字段是工厂名称, 动态数据源选项值是工厂编码
692
- beforeColumnValue = temp.optionItems.find(
693
- (item) =>
694
- // 当前字段映射的是工厂名称,
695
- // 筛选动态数据源选项值字段对应的当前字段所映射的字段, 例如 根据工厂编码找工厂编码对应的工厂名称
696
- // 找出名称后赋值给当前字段
697
- item[temp.valueAttribute] === beforeColumnValue
698
- )[selectDataKey]
699
- }
700
- // 如果是单选
701
- // 现在选择时已经赋值,不再需要这里进行赋值
702
- // temp.optionItems.forEach(optionItem => {
703
- // if (optionItem[temp.valueAttribute] === beforeColumnValue) {
704
- // this.$set(param.row, this.column.prop, optionItem[selectDataKey])
705
- // }
706
- // })
707
- param.row[this.column.prop] = beforeColumnValue
708
- } else {
709
- // 如果是多选,join “ ,” , 并给row赋值
710
- // 现在选择时已经赋值,不再需要这里进行赋值
711
- // const afterColumnValue = []
712
- // temp.optionItems.forEach(optionItem => {
713
- // beforeColumnValue.forEach(value => {
714
- // if (optionItem[temp.valueAttribute] === value) {
715
- // afterColumnValue.push(optionItem[selectDataKey])
716
- // }
717
- // })
718
- // })
719
- if (beforeColumnValue && selectDataKey !== temp.valueAttribute) {
720
- // 解决当前字段不是动态数据源选项值所映射的字段的问题 例如当前字段是工厂名称, 动态数据源选项值是工厂编码
721
- const t = []
722
- beforeColumnValue.forEach((selectItem) => {
723
- if (selectDataKey !== temp.valueAttribute) {
724
- t.push(
725
- temp.optionItems.find((option) => option[temp.valueAttribute] === selectItem)[selectDataKey]
726
- )
727
- }
728
- })
729
- beforeColumnValue = t
730
- }
731
- param.row[this.column.prop] = beforeColumnValue.join(',')
732
- }
733
- }
734
- } else {
735
- const beforeColumnValue = param.row[this.column.prop]
736
- if (beforeColumnValue && Object.prototype.toString.apply(beforeColumnValue) === '[object Array]') {
737
- // 如果是数组才需要转换
738
- param.row[this.column.prop] = beforeColumnValue.join(',')
739
- }
740
- }
741
- }
742
- }
743
- })
744
- const that = this
745
- if (this.$parent.$parent && this.$parent.$parent.$options._componentTag === 'GroupColumn') {
746
- eventBus.$on('prohibitToEdit', (param) => {
747
- if (param[that.column.prop] !== undefined) {
748
- that.fnProhibitToEdit(param[that.column.prop])
749
- }
750
- })
751
- }
752
306
  },
753
307
  unmounted() {
754
- $off(eventBus, 'un-edit')
755
- if (this.$parent.$parent && this.$parent.$parent.$options._componentTag === 'GroupColumn') {
756
- eventBus.$off('prohibitToEdit')
757
- }
758
308
  },
759
309
  methods: {
760
310
  ...customFormatter,
761
311
  ...apis,
762
- getFileObj(fileSet) {
763
- if (fileSet) {
764
- return JSON.parse(fileSet)
765
- }
766
- },
767
312
  getHeader() {
768
- if (!this.column.titleValueSet) {
769
- return this.column.label.replace(/\\n/g, '</br>')
770
- } else {
771
- return this.formatHeader()
772
- }
773
- },
774
- formatHeader() {
775
- return doFormatWithValueSet(this.column.titleValueSetValue, this.column.label)
313
+ return getHeaderLable(this.column)
776
314
  },
777
315
  filterHandler(value, row, column) {
778
316
  const property = column['property']
779
317
  return row[property] === value
780
318
  },
781
- onFocus(index) {
782
- const gridParams = store.get(this.listCode)
783
- if (gridParams.lineEdit.editingCell) {
784
- gridParams.lineEdit.editingCell.row = index
785
- gridParams.lineEdit.editingCell.prop = this.column.prop
786
- }
787
- },
788
- findIndex(index) {
789
- this.index = index
790
- const gridParams = store.get(this.listCode)
791
- if (gridParams.lineEdit.editingCell) {
792
- gridParams.lineEdit.editingCell.row = index
793
- gridParams.lineEdit.editingCell.prop = this.column.prop
794
- }
795
- },
796
319
  refresData(data) {
797
320
  $emit(this, 'refresData', data)
798
321
  },
799
- refresPortData(port, value) {
800
- const gridParams = store.get(this.listCode)
801
- console.log('gridParams', gridParams)
802
- console.log('this.index', this.index)
803
- if (gridParams && gridParams.lineEdit && gridParams.lineEdit.editingCell) {
804
- $emit(this, 'refresPortData', port, value, gridParams.lineEdit.editingCell.row)
805
- } else {
806
- $emit(this, 'refresPortData', port, value, this.index)
807
- }
322
+ refresPortData(port, value, index) {
323
+ $emit(this, 'refresPortData', port, value, index)
808
324
  },
809
- refresPortsData(map) {
810
- const gridParams = store.get(this.listCode)
811
- console.log('gridParams', gridParams)
812
- console.log('this.index', this.index)
813
- if (gridParams && gridParams.lineEdit && gridParams.lineEdit.editingCell) {
814
- $emit(this, 'refresPortsData', map, gridParams.lineEdit.editingCell.row)
815
- } else {
816
- $emit(this, 'refresPortsData', map, this.index)
817
- }
325
+ refresPortsData(map, index) {
326
+ $emit(this, 'refresPortsData', map, index)
818
327
  },
819
328
  refresMainTableFields(map) {
820
329
  $emit(this, 'refresMainTableFields', map)
821
330
  },
822
- // @keyup.native.left="move('left')"
823
- // @keyup.native.right="move('right')"
824
- // @keyup.native.up="move('up')"
825
- // @keyup.native.down="move('down')"
826
- move(direction) {
827
- if (direction === 'left') {
828
- const prop = ArrowKeyAction.getLeftColumn(this.column.prop)
829
- const gridParams = store.get(this.listCode)
830
- gridParams.lineEdit.editingCell.prop = prop
831
- }
832
- },
833
331
  // filterHandler(value, row, column) {
834
332
  // const property = column['property']
835
333
  // return row[property] === value
836
334
  // },
837
- isSaveByEnter() {
838
- const gridParams = store.get(this.listCode)
839
- return (
840
- typeof gridParams.options.lineEditOptions.isSaveByEnter === 'undefined' ||
841
- (isHasEditOption('isSaveByEnter', this.listCode) && gridParams.options.lineEditOptions.isSaveByEnter === true)
842
- )
843
- },
844
- isRestoreByEsc() {
845
- const gridParams = store.get(this.listCode)
846
- return (
847
- typeof gridParams.options.lineEditOptions.isRestoreByEsc === 'undefined' ||
848
- (isHasEditOption('isRestoreByEsc', this.listCode) && gridParams.options.lineEditOptions.isRestoreByEsc === true)
849
- )
850
- },
851
- canFocus(index) {
852
- const gridParams = store.get(this.listCode)
853
- if (index === gridParams.lineEdit.editingCell.row && this.column.prop === gridParams.lineEdit.editingCell.prop) {
854
- return true
855
- } else {
856
- return false
857
- }
858
- },
859
- getLabel(row, index) {
860
- this.transferColumnDataToUpperCase(row)
861
- const obj = this.objectPropValueTwo(row, this.column)
862
- // // 存储执行时间
863
- // const get2 = new Date().getTime()
864
- // const get3 = Number(get2) - Number(get1)
865
- // if (!window.sessionStorage.getItem('getLabel')) {
866
- // window.sessionStorage.setItem('getLabel', get3)
867
- // } else {
868
- // const get4 = window.sessionStorage.getItem('getLabel')
869
- // const get5 = Number(get4) + Number(get3)
870
- // window.sessionStorage.setItem('getLabel', get5)
871
- // }
872
- return obj
873
- // const returnValue = this.objectPropValueTwo(row, this.column)
874
- // if (returnValue) {
875
- // // 解决当文本中有多个空格时候, vue自动将多个空格合并为一个空格,
876
- // // 或者修改vue的配置 https://cn.vuejs.org/api/application.html#app-config-compileroptions app.config.compilerOptions.whitespace
877
- // return returnValue.replaceAll(' ', '\u00A0')
878
- // }
879
- // return returnValue
880
- },
881
- getCellValue(row) {
882
- let cellValue = getEntityFieldValue(row, this.column.prop, false)
883
- if (cellValue === undefined || cellValue === null) {
884
- this.transferColumnDataToUpperCase(row)
885
- cellValue = getEntityFieldValue(row, this.column.prop, false)
886
- }
887
- return cellValue
888
- },
889
- // 兼容oracle和mysql数据库,oracle是字段名是大写的,mysql是小写的,将小写转为大写
890
- transferColumnDataToUpperCase(row) {
891
- const reg1 = /[A-Z]+/ // 大写字母
892
- if (this.isSql && reg1.test(this.column.prop)) {
893
- this.transferColumnDataToUpperCaseWithProp(row, this.column.prop.toLowerCase(), this.column.prop)
894
- }
895
- },
896
- transferColumnDataToUpperCaseWithProp(row, propLowerCase, columnProp) {
897
- let dataModel
898
- if (propLowerCase && propLowerCase.indexOf('.') > 0) {
899
- const parentObj = getParentObjectUtil(propLowerCase, row)
900
- const prop = propLowerCase.substring(propLowerCase.lastIndexOf('.') + 1)
901
- dataModel = parentObj[prop]
902
- if (dataModel !== undefined) {
903
- // sql字段名小写转大写,兼容mysql、oracle数据库
904
- parentObj[columnProp] = dataModel
905
- delete parentObj[prop]
906
- }
907
- } else {
908
- dataModel = row[propLowerCase]
909
- if (dataModel !== undefined) {
910
- // sql字段名小写转大写,兼容mysql、oracle数据库
911
- row[columnProp] = dataModel
912
- delete row[propLowerCase]
913
- }
914
- }
915
- return dataModel
916
- },
917
- getMyHyperLinkSetting(row) {
918
- this.transferColumnDataToUpperCase(row)
919
- const gridParams = store.get(this.listCode)
920
- let tableName
921
- if (gridParams && gridParams.basicInfo && gridParams.basicInfo.tableName) {
922
- tableName = gridParams.basicInfo.tableName
923
- }
924
- const hyperLinkResult = this.getHyperLinkSetting(
925
- this.column,
926
- row,
927
- this.isSql,
928
- this.additionalParamMap,
929
- gridParams.contextParameter,
930
- tableName,
931
- this.listCode
932
- )
933
- hyperLinkResult.icon = this.getHyperIconClass(hyperLinkResult)
934
- return hyperLinkResult
935
- },
936
- getHyperIconClass(hyperLinkResult) {
937
- let iconName
938
- if (hyperLinkResult && hyperLinkResult !== null && hyperLinkResult.icon && hyperLinkResult.icon !== '') {
939
- iconName = hyperLinkResult.icon
940
- }
941
- if (iconName && iconName.indexOf('fa-') === 0) {
942
- // 表示以“fa-”开头,使用font-awesome中的图标
943
- iconName = 'fa ' + iconName
944
- }
945
- return iconName
946
- },
947
335
  createFormSubTableRow() {
948
336
  console.log('触发了行新建')
949
337
  this.createRow(this.listCode)
950
338
  },
951
- handleCommand(comman) {
952
- let prop = null
953
- this.column.operations.forEach((item) => {
954
- if (item.isGroup) {
955
- item.buttons.forEach((button) => {
956
- if (button.props.code === comman.comman) {
957
- prop = button
958
- }
959
- })
960
- }
961
- })
962
- if (prop) {
963
- customFormatter.onClickFun(comman.row, this.column, prop.onClick, comman.rowIndex)
964
- }
965
- },
966
- beforeHandleCommand(comman, row, rowIndex) {
967
- return {
968
- comman: comman,
969
- row: row,
970
- rowIndex: rowIndex
971
- }
972
- },
973
- previewImg(row) {
974
- this.fileList = getFileList(row, this.column, this.isSql)
975
- this.showSingleImgFlag = true
976
- },
977
- getFileList(row) {
978
- return getFileList(row, this.column, this.isSql)
979
- },
980
339
  getColumnWidth() {
981
340
  if (this.column && this.column.prop === 'operation' && !this.column.width) {
982
341
  // 表示操作列,宽度固定
@@ -985,12 +344,6 @@ export default {
985
344
  return this.column.width ? this.column.width + '' : '130'
986
345
  },
987
346
  // 设置字段禁止编辑
988
- fnProhibitToEdit(isEditable) {
989
- this.$nextTick(() => {
990
- this.disabled = !isEditable
991
- })
992
- },
993
- // 设置字段禁止编辑
994
347
  prohibitToEdit(entity) {
995
348
  $emit(this, 'prohibitToEdit', entity)
996
349
  },
@@ -998,78 +351,14 @@ export default {
998
351
  return isRequiredEdit(this.column, this.listCode)
999
352
  // return true
1000
353
  },
1001
- // 展示富文本内容
1002
- showRichEditorContent(row, column, header) {
1003
- this.showRichEditorViewer = true
1004
- this.$nextTick(() => {
1005
- this.$refs.richEditorViewerRef.showContent(row[column.prop], header)
1006
- })
1007
- },
1008
- closeRichEditorContent() {
1009
- this.showRichEditorViewer = false
1010
- },
1011
- getColumnCustomControlControlConfig(columnFormatter) {
1012
- if (columnFormatter && columnFormatter.options && columnFormatter.options.controlConfig) {
1013
- const controlConfig = JSON.parse(columnFormatter.options.controlConfig)
1014
- return controlConfig
1015
- }
1016
- },
1017
- isRequired(editing) {
1018
- if (!this.isFormSubTable && this.lineEdit.editable && this.isEditable && editing && this.column.validations) {
1019
- if (this.column.validations.indexOf('"required":true') > 0) {
1020
- return true
1021
- }
1022
- }
1023
- return false
1024
- },
1025
- getFormatIconSetting(row) {
1026
- this.transferColumnDataToUpperCase(row)
1027
- const gridParams = store.get(this.listCode)
1028
- const result = this.getIconSetting(this.column, row, this.isSql, gridParams, this.listCode)
1029
- result.icon = this.getHyperIconClass(result)
1030
- if (this.column.formatter.options && this.column.formatter.options.format) {
1031
- result.position = JSON.parse(this.column.formatter.options.format).position
1032
- }
1033
- return result
1034
- },
1035
- getLinkType(row) {
1036
- if (this.column.events && this.column.events['cellStyle']) {
1037
- const params = {
1038
- value: row[this.column.property],
1039
- row: row,
1040
- column: this.column,
1041
- prop: this.column.property
1042
- }
1043
- const gridParams = store.get(this.listCode)
1044
- return gridParams.options['eventCallBack'][this.column.events['cellStyle']].call(this, params)
1045
- }
1046
- return 'primary'
1047
- },
1048
- changeDisabled(state) {
1049
- this.disabled = state
1050
- },
1051
354
  refreshList() {
1052
355
  this.$emit('refresh-list')
1053
356
  },
1054
- getFilesFormatter() {
1055
- if (this.column.formatter.options?.fileSet) {
1056
- return JSON.parse(this.column.formatter.options.fileSet)
1057
- }
1058
- return {}
1059
- },
1060
- /**
1061
- * 设置条码扫描解析规则
1062
- */
1063
- setScanRuleSets() {
1064
- if (this.scanEnable && this.controlConfig && this.controlConfig.scanRuleList) {
1065
- formatScanRuleSets(this.controlConfig.scanRuleList).then((res) => {
1066
- //扫描处理
1067
- this.column._scanRuleSets = res
1068
- })
1069
- }
357
+ openPageEvent(openPageParams) {
358
+ this.$emit('open-page', openPageParams)
1070
359
  }
1071
360
  },
1072
- emits: ['refresData', 'refresPortData', 'refresPortsData', 'refresMainTableFields', 'prohibitToEdit', ,]
361
+ emits: ['refresData', 'refresPortData', 'refresPortsData', 'refresMainTableFields', 'prohibitToEdit',]
1073
362
  }
1074
363
  </script>
1075
364