agilebuilder-ui 1.0.90-temp6 → 1.0.90-tmp10

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.
@@ -441,7 +441,6 @@ import { $emit } from '../../utils/gogocodeTransfer'
441
441
  import eventBus from './eventBus'
442
442
  import { isMobileBrowser } from '../../../src/utils/common-util'
443
443
  import { analysisScanValue, setScanAnalysisValue } from './scan-util.ts'
444
-
445
444
  export default {
446
445
  name: 'DynamicInput',
447
446
  components: {
@@ -465,6 +464,7 @@ export default {
465
464
  type: Object,
466
465
  default: null
467
466
  },
467
+ // 下拉选选项集合
468
468
  options: {
469
469
  type: Array,
470
470
  default: null
@@ -498,6 +498,11 @@ export default {
498
498
  disabled: {
499
499
  type: Boolean,
500
500
  default: false
501
+ },
502
+ // 列表配置信息
503
+ gridOptions: {
504
+ type: Object,
505
+ default: null
501
506
  }
502
507
  },
503
508
  data() {
@@ -707,20 +712,18 @@ export default {
707
712
  this.setInputNumberConfig()
708
713
  }
709
714
  // 如果是多选文件类型,需要解析(需要设置临时字段,判断文件还是图片,图片需要预览)
710
- if (this.column.valueSetOptions) {
711
- if (this.column.componentType === 'switch') {
712
- const valueSetOptionsObj = JSON.parse(this.column.valueSetOptions)
713
- if (valueSetOptionsObj) {
714
- this.valueSetOptions = valueSetOptionsObj
715
- }
716
- } else if (this.column.componentType !== 'inputNumber') {
717
- const valueSetOptionsObj = JSON.parse(this.column.valueSetOptions)
718
- if (valueSetOptionsObj && valueSetOptionsObj.valueSetOptions) {
719
- this.valueSetOptions = valueSetOptionsObj.valueSetOptions
720
- }
721
- if (valueSetOptionsObj.dynamicDataSourceCode && valueSetOptionsObj.dynamicDataSourceCode !== '') {
722
- this.dynamicDataSourceCode = valueSetOptionsObj.dynamicDataSourceCode
723
- }
715
+ if (this.column.valueSetOptions && this.column.componentType !== 'inputNumber') {
716
+ const valueSetOptionsObj = JSON.parse(this.column.valueSetOptions)
717
+ if (valueSetOptionsObj && valueSetOptionsObj.valueSetOptions) {
718
+ this.valueSetOptions = valueSetOptionsObj.valueSetOptions
719
+ }
720
+ if (valueSetOptionsObj.dynamicDataSourceCode && valueSetOptionsObj.dynamicDataSourceCode !== '') {
721
+ this.dynamicDataSourceCode = valueSetOptionsObj.dynamicDataSourceCode
722
+ }
723
+ } else if (this.column.componentType === 'switch' && this.column.valueSetOptions) {
724
+ const valueSetOptionsObj = JSON.parse(this.column.valueSetOptions)
725
+ if (valueSetOptionsObj) {
726
+ this.valueSetOptions = valueSetOptionsObj
724
727
  }
725
728
  }
726
729
  if (this.column.orgTreeSet) {
@@ -737,6 +740,25 @@ export default {
737
740
  }
738
741
  }
739
742
  this.getDateAllowTime()
743
+ if(!this.gridOptions.customRules){
744
+ this.gridOptions.customRules = {}
745
+ }
746
+ this.$watch('gridOptions.customRules.'+this.column.prop,
747
+ (newVal, oldVal)=> {
748
+ this.packageCustomRules(newVal)
749
+ },
750
+ {
751
+ immediate: true,
752
+ deep: true,
753
+ })
754
+ this.$watch('gridOptions.customRules._all_fields',
755
+ (newVal, oldVal)=> {
756
+ this.packageCustomRules(newVal)
757
+ },
758
+ {
759
+ immediate: true,
760
+ deep: true,
761
+ })
740
762
  },
741
763
  mounted() {
742
764
  // 去掉该监听,否则导致焦点总是跳到第一个编辑框
@@ -1740,12 +1762,7 @@ export default {
1740
1762
  },
1741
1763
  getSwitchConfig(switchProp) {
1742
1764
  if (this.valueSetOptions && this.valueSetOptions[switchProp]) {
1743
- const value = this.valueSetOptions[switchProp]
1744
- if ('true' === value || 'false' === value) {
1745
- return 'true' === value
1746
- } else {
1747
- return this.valueSetOptions[switchProp]
1748
- }
1765
+ return this.valueSetOptions[switchProp]
1749
1766
  } else {
1750
1767
  if (switchProp === 'activeValue') {
1751
1768
  if (this.dataSourceType === 'mysql') {
@@ -1797,6 +1814,18 @@ export default {
1797
1814
  this.isShowBrowserScan = false
1798
1815
  this.innerValue = value
1799
1816
  this.blurEvent()
1817
+ },
1818
+ packageCustomRules(columnRule) {
1819
+ console.log('packageCustomRules---columnRule=', columnRule)
1820
+ if(!columnRule){
1821
+ return
1822
+ }
1823
+ if(columnRule.disabled !== undefined){
1824
+ this.$emit('change-disabled', columnRule.disabled)
1825
+ }
1826
+ if(columnRule.required !== undefined){
1827
+ this.$emit('change-required', columnRule.required)
1828
+ }
1800
1829
  }
1801
1830
  }
1802
1831
  }
@@ -4,13 +4,14 @@
4
4
  <dynamic-input
5
5
  v-if="(lineEdit.editable && isEditable && row.$editing) || isShowForm"
6
6
  v-model:value="row[column.prop]"
7
- :class="isRequired(row.$editing) ? 'm-requried' : ''"
7
+ :class="requiredClass"
8
8
  :column="column"
9
9
  :is-sql="isSql"
10
10
  :line-edit="lineEdit"
11
11
  :list-code="listCode"
12
12
  :list-toolbar-form-data="listToolbarFormData"
13
13
  :options="column.valueSet"
14
+ :grid-options="options"
14
15
  :position="{
15
16
  row: rowIndex,
16
17
  prop: column.prop
@@ -28,6 +29,7 @@
28
29
  @refresPortData="refresPortData"
29
30
  @refresPortsData="refresPortsData"
30
31
  @change-disabled="changeDisabled"
32
+ @change-required="changeRequired"
31
33
  />
32
34
  <span v-else>
33
35
  <span v-if="column.operations" class="grid-operation-buttons">
@@ -460,6 +462,7 @@ export default {
460
462
  data() {
461
463
  let parentFormData
462
464
  const gridParams = store.get(this.listCode)
465
+ const options = gridParams.options
463
466
  if (gridParams.options.extraParam && gridParams.options.extraParam.entityMap) {
464
467
  parentFormData = gridParams.options.extraParam.entityMap
465
468
  }
@@ -474,6 +477,10 @@ export default {
474
477
  scanEnable = true
475
478
  }
476
479
  const componentId = this.listCode + '_' + this.column.prop
480
+ let lineEdit
481
+ if (gridParams.lineEdit !== null && gridParams.lineEdit !== undefined) {
482
+ lineEdit = gridParams.lineEdit
483
+ }
477
484
  return {
478
485
  selectRow: null,
479
486
  that: this,
@@ -502,80 +509,25 @@ export default {
502
509
  scanEnable,
503
510
  componentId,
504
511
  controlConfig,
505
- rowLinkConfigMapping: {}
512
+ rowLinkConfigMapping: {},
513
+ requiredClass: '',
514
+ lineEdit,
515
+ options
506
516
  }
507
517
  },
508
518
  computed: {
509
- filters() {
510
- if (this.column.filterable) {
511
- const gridParams = store.get(this.listCode)
512
- const values = getColumnValues(gridParams.gridData, this.column.prop)
513
- const filters = []
514
- for (const value of values) {
515
- filters.push({
516
- text: value,
517
- value
518
- })
519
- }
520
- return filters
521
- } else {
522
- return null
523
- }
524
- },
525
- filterMethod() {
526
- if (this.column.filterable) {
527
- return this.filterHandler
528
- } else {
529
- return null
530
- }
531
- },
532
- fixed() {
533
- if (
534
- (this.column.fixed && this.column.fixed === 'false') ||
535
- this.column.fixed === undefined ||
536
- this.column.fixed === ''
537
- ) {
538
- return false
539
- }
540
- if (this.column.prop === 'operation' && this.column.fixed && this.column.fixed === 'left') {
541
- // 操作列居右固定
542
- return 'right'
543
- }
544
- return this.column.fixed
545
- },
546
- sortable() {
547
- const gridParams = store.get(this.listCode)
548
- if (
549
- gridParams &&
550
- gridParams.options &&
551
- gridParams.options.isFormSubTable &&
552
- gridParams.options.showOperationButton
553
- ) {
554
- return false
555
- }
556
- if (this.column.sortable === 'false' || this.column.sortable === false || this.column.sortable === '') {
557
- return false
558
- } else if (this.column.sortable === 'true' || this.column.sortable === true) {
559
- return 'custom'
560
- }
561
- if (this.column.sortable) {
562
- return 'custom'
563
- } else {
564
- return false
565
- }
566
- },
567
- lineEdit() {
568
- let isLineEdit = false
569
- if (this.listCode) {
570
- const gridParams = store.get(this.listCode)
571
- if (gridParams.lineEdit !== null && gridParams.lineEdit !== undefined) {
572
- isLineEdit = gridParams.lineEdit
573
- } else {
574
- isLineEdit = false
575
- }
576
- }
577
- return isLineEdit
578
- },
519
+ // lineEdit() {
520
+ // let isLineEdit = false
521
+ // if (this.listCode) {
522
+ // const gridParams = store.get(this.listCode)
523
+ // if (gridParams.lineEdit !== null && gridParams.lineEdit !== undefined) {
524
+ // isLineEdit = gridParams.lineEdit
525
+ // } else {
526
+ // isLineEdit = false
527
+ // }
528
+ // }
529
+ // return isLineEdit
530
+ // },
579
531
 
580
532
  ...mapGetters(['preventReclick'])
581
533
  },
@@ -661,6 +613,7 @@ export default {
661
613
  }
662
614
  }
663
615
  this.setScanRuleSets()
616
+ this.requiredClass = this.isRequired(this.row.$editing) ? 'm-requried' : ''
664
617
  },
665
618
  mounted() {
666
619
  // 监听保存时点击按钮事件线触发
@@ -1020,7 +973,8 @@ export default {
1020
973
  }
1021
974
  },
1022
975
  isRequired(editing) {
1023
- if (!this.isFormSubTable && this.lineEdit.editable && this.isEditable && editing && this.column.validations) {
976
+ console.log('isRequired---this.lineEdit=', this.lineEdit)
977
+ if (!this.isFormSubTable && this.lineEdit && this.lineEdit.editable && this.isEditable && editing && this.column.validations) {
1024
978
  if (this.column.validations.indexOf('"required":true') > 0) {
1025
979
  return true
1026
980
  }
@@ -1072,6 +1026,9 @@ export default {
1072
1026
  this.column._scanRuleSets = res
1073
1027
  })
1074
1028
  }
1029
+ },
1030
+ changeRequired(required) {
1031
+ this.requiredClass = required? 'm-requried' : ''
1075
1032
  }
1076
1033
  },
1077
1034
  emits: ['refresData', 'refresPortData', 'refresPortsData', 'refresMainTableFields', 'prohibitToEdit']
@@ -11,7 +11,7 @@
11
11
  :width="getColumnWidth()"
12
12
  >
13
13
  <template v-slot:header>
14
- <span v-if="!column.customHeader" :class="{ is_req: isFieldRequired() }">
14
+ <span v-if="!column.customHeader" :class="{is_req: isFieldRequired()}">
15
15
  <span :title="$escapeHtml(label)" class="cell--span required__label" v-html="$escapeHtml(label)" />
16
16
  </span>
17
17
  <component
@@ -27,7 +27,7 @@
27
27
  </el-icon>
28
28
  </template>
29
29
  <template v-slot="scope">
30
- <!-- :pagination="pagination" -->
30
+ <!-- :pagination="pagination" -->
31
31
  <NormalColumnContent
32
32
  :ref="column.prop"
33
33
  :is-sql="isSql"
@@ -63,7 +63,13 @@
63
63
  <script>
64
64
  import { CirclePlus, ZoomIn as ElIconZoomIn } from '@element-plus/icons-vue'
65
65
  import { $emit, $off, $on } from '../../utils/gogocodeTransfer'
66
- import { getColumnValues, isRequiredEdit, getContentAlign, getHeaderAlign, getHeaderLable } from './utils'
66
+ import {
67
+ getColumnValues,
68
+ isRequiredEdit,
69
+ getContentAlign,
70
+ getHeaderAlign,
71
+ getHeaderLable
72
+ } from './utils'
67
73
  import DynamicInput from './dynamic-input.vue'
68
74
  import store from './store'
69
75
  import customFormatter from './custom-formatter'
@@ -278,7 +284,7 @@ export default {
278
284
  }
279
285
  const align = getContentAlign(this.column, gridParams)
280
286
  if (align) {
281
- this.align = align
287
+ this.align = gridParams.options.align
282
288
  }
283
289
  const headerAlign = getHeaderAlign(this.column, gridParams)
284
290
  if (headerAlign) {
@@ -296,8 +302,10 @@ export default {
296
302
  gridParams.options &&
297
303
  gridParams.options.showOperationButton
298
304
  },
299
- mounted() {},
300
- unmounted() {},
305
+ mounted() {
306
+ },
307
+ unmounted() {
308
+ },
301
309
  methods: {
302
310
  ...customFormatter,
303
311
  ...apis,
@@ -315,7 +323,7 @@ export default {
315
323
  $emit(this, 'refresPortData', port, value, index)
316
324
  },
317
325
  refresPortsData(map, index) {
318
- $emit(this, 'refresPortsData', map, index)
326
+ $emit(this, 'refresPortsData', map, index)
319
327
  },
320
328
  refresMainTableFields(map) {
321
329
  $emit(this, 'refresMainTableFields', map)
@@ -336,6 +344,10 @@ export default {
336
344
  return this.column.width ? this.column.width + '' : '130'
337
345
  },
338
346
  // 设置字段禁止编辑
347
+ fnProhibitToEdit(isEditable) {
348
+ this.$refs[this.column.prop].fnProhibitToEdit(isEditable)
349
+ },
350
+ // 设置字段禁止编辑
339
351
  prohibitToEdit(entity) {
340
352
  $emit(this, 'prohibitToEdit', entity)
341
353
  },
@@ -350,7 +362,7 @@ export default {
350
362
  this.$emit('open-page', openPageParams)
351
363
  }
352
364
  },
353
- emits: ['refresData', 'refresPortData', 'refresPortsData', 'refresMainTableFields', 'prohibitToEdit']
365
+ emits: ['refresData', 'refresPortData', 'refresPortsData', 'refresMainTableFields', 'prohibitToEdit',]
354
366
  }
355
367
  </script>
356
368
 
@@ -3156,7 +3156,10 @@ export default {
3156
3156
  openFold(isOpen) {
3157
3157
  this.resizeTableHeight()
3158
3158
  },
3159
- // 设置字段禁止编辑
3159
+ /**
3160
+ * 设置字段禁止编辑。只能控制禁止编辑。不能控制必填
3161
+ * @param entity 格式如:{'NAME':false,"DYM_COLUMN":true}。表示NAME字段不可编辑,DYM_COLUMN可以被编辑
3162
+ */
3160
3163
  fnProhibitToEdit(entity) {
3161
3164
  if (entity) {
3162
3165
  if (entity.isForceUpdate) {
@@ -3174,7 +3177,10 @@ export default {
3174
3177
  }
3175
3178
  }
3176
3179
  },
3177
- // 设置字段禁止编辑
3180
+ /**
3181
+ * 设置字段禁止编辑。只能控制禁止编辑。不能控制必填
3182
+ * @param entity 格式如:{'NAME':false,"DYM_COLUMN":true}。表示NAME字段不可编辑,DYM_COLUMN可以被编辑
3183
+ */
3178
3184
  prohibitToEdit(entity) {
3179
3185
  this.fnProhibitToEdit(entity)
3180
3186
  },
@@ -3327,6 +3333,9 @@ export default {
3327
3333
  },
3328
3334
  closeRowForm () {
3329
3335
  this.showRowForm = false
3336
+ },
3337
+ testFunc(params){
3338
+ console.log('testFunc-----------------params=', params)
3330
3339
  }
3331
3340
  },
3332
3341
  emits: [
@@ -3340,8 +3349,7 @@ export default {
3340
3349
  'un-edit',
3341
3350
  'refresMainTableFields',
3342
3351
  'refresh',
3343
- 'cancel-search',
3344
- ,
3352
+ 'cancel-search'
3345
3353
  ],
3346
3354
  }
3347
3355
  </script>
@@ -262,6 +262,15 @@ export function isDisableEdit(prop, listCode, row) {
262
262
  isDiabled = true
263
263
  }
264
264
  }
265
+ if (isDiabled === false) {
266
+ // 表示不是禁止编辑的,继续校验自定义规则中是否是禁止编辑的
267
+ if(gridParams.options.customRules && gridParams.options.customRules[prop]){
268
+ const columnRules = gridParams.options.customRules[prop]
269
+ if(columnRules && columnRules.disabled){
270
+ isDiabled = true
271
+ }
272
+ }
273
+ }
265
274
  }
266
275
  return isDiabled
267
276
  }
@@ -792,9 +801,9 @@ export function getControlConfig(column) {
792
801
  return controlConfig
793
802
  }
794
803
 
795
- export function getContentAlign(column, gridParams) {
804
+ export function getContentAlign(column, gridParams){
796
805
  let align
797
- if (gridParams.options?.align && gridParams.options.align !== '') {
806
+ if (typeof gridParams.options.align !== 'undefined') {
798
807
  align = gridParams.options.align
799
808
  } else if (column.contAlign && column.contAlign !== '') {
800
809
  align = column.contAlign
@@ -802,16 +811,20 @@ export function getContentAlign(column, gridParams) {
802
811
  return align
803
812
  }
804
813
 
805
- export function getHeaderAlign(column, gridParams) {
814
+ export function getHeaderAlign(column, gridParams){
806
815
  let headerAlign
807
- if (gridParams.options?.headerAlign && gridParams.options.headerAlign !== '') {
816
+ if (typeof gridParams.options.headerAlign !== 'undefined') {
808
817
  headerAlign = gridParams.options.headerAlign
809
818
  } else if (column.titleAlign && column.titleAlign !== '') {
810
819
  headerAlign = column.titleAlign
820
+ } else {
821
+ // 如果没有配置表头对齐方式,默认使用内容对齐方式
822
+ headerAlign = 'left'
811
823
  }
812
824
  return headerAlign
813
825
  }
814
826
 
827
+
815
828
  export function getHeaderLable(column) {
816
829
  let label = column.label
817
830
  if (!column.titleValueSet) {
@@ -827,4 +840,4 @@ export function getHeaderLable(column) {
827
840
 
828
841
  function formatHeader(column) {
829
842
  return doFormatWithValueSet(column.titleValueSetValue, column.label)
830
- }
843
+ }