agilebuilder-ui 1.0.90-temp6 → 1.0.90-tmp2

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()
749
+ },
750
+ {
751
+ immediate: true,
752
+ deep: true,
753
+ })
754
+ this.watch('gridOptions.customRules._all_fields',
755
+ (newVal, oldVal)=> {
756
+ this.packageCustomRules()
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,23 @@ export default {
1797
1814
  this.isShowBrowserScan = false
1798
1815
  this.innerValue = value
1799
1816
  this.blurEvent()
1817
+ },
1818
+ packageCustomRules() {
1819
+ if(!this.options.customRules){
1820
+ return
1821
+ }
1822
+ const columnRules = this.options.customRules.filter(item=>item.name===this.column.prop || item.name === '_all_fields')
1823
+ if(columnRules && columnRules.length > 0) {
1824
+ for(let i = 0; i< columnRules.length; i++) {
1825
+ const columnRule = columnRules[i]
1826
+ if(columnRule.disabled !== undefined){
1827
+ this.$emit('change-disabled', columnRule.disabled)
1828
+ }
1829
+ if(columnRule.required !== undefined){
1830
+ this.$emit('change-required', columnRule.required)
1831
+ }
1832
+ }
1833
+ }
1800
1834
  }
1801
1835
  }
1802
1836
  }
@@ -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">
@@ -455,6 +457,11 @@ export default {
455
457
  isShowForm: {
456
458
  type: Boolean,
457
459
  default: false
460
+ },
461
+ // 列表配置信息
462
+ options: {
463
+ type: Object,
464
+ default: null
458
465
  }
459
466
  },
460
467
  data() {
@@ -474,6 +481,7 @@ export default {
474
481
  scanEnable = true
475
482
  }
476
483
  const componentId = this.listCode + '_' + this.column.prop
484
+ const requiredClass = this.isRequired(this.row.$editing) ? 'm-requried' : ''
477
485
  return {
478
486
  selectRow: null,
479
487
  that: this,
@@ -502,68 +510,11 @@ export default {
502
510
  scanEnable,
503
511
  componentId,
504
512
  controlConfig,
505
- rowLinkConfigMapping: {}
513
+ rowLinkConfigMapping: {},
514
+ requiredClass
506
515
  }
507
516
  },
508
517
  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
518
  lineEdit() {
568
519
  let isLineEdit = false
569
520
  if (this.listCode) {
@@ -1072,6 +1023,9 @@ export default {
1072
1023
  this.column._scanRuleSets = res
1073
1024
  })
1074
1025
  }
1026
+ },
1027
+ changeRequired(required) {
1028
+ this.requiredClass = required? 'm-requried' : ''
1075
1029
  }
1076
1030
  },
1077
1031
  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'
@@ -140,12 +146,16 @@ export default {
140
146
  listToolbarFormData: {
141
147
  type: Object,
142
148
  default: null
149
+ },
150
+ // 列表配置信息
151
+ options: {
152
+ type: Object,
153
+ default: null
143
154
  }
144
155
  },
145
156
  data() {
146
157
  let parentFormData
147
158
  const gridParams = store.get(this.listCode)
148
- const options = gridParams.options
149
159
  if (gridParams.options.extraParam && gridParams.options.extraParam.entityMap) {
150
160
  parentFormData = gridParams.options.extraParam.entityMap
151
161
  }
@@ -159,8 +169,7 @@ export default {
159
169
  subTableCanAdd: true, // 表单子表时是否有新增权限
160
170
  isShowAdd: false, // 是否显示表头的新增按钮
161
171
  cellWidth: null,
162
- parentFormData,
163
- options
172
+ parentFormData
164
173
  }
165
174
  },
166
175
  computed: {
@@ -278,7 +287,7 @@ export default {
278
287
  }
279
288
  const align = getContentAlign(this.column, gridParams)
280
289
  if (align) {
281
- this.align = align
290
+ this.align = gridParams.options.align
282
291
  }
283
292
  const headerAlign = getHeaderAlign(this.column, gridParams)
284
293
  if (headerAlign) {
@@ -296,8 +305,10 @@ export default {
296
305
  gridParams.options &&
297
306
  gridParams.options.showOperationButton
298
307
  },
299
- mounted() {},
300
- unmounted() {},
308
+ mounted() {
309
+ },
310
+ unmounted() {
311
+ },
301
312
  methods: {
302
313
  ...customFormatter,
303
314
  ...apis,
@@ -315,7 +326,7 @@ export default {
315
326
  $emit(this, 'refresPortData', port, value, index)
316
327
  },
317
328
  refresPortsData(map, index) {
318
- $emit(this, 'refresPortsData', map, index)
329
+ $emit(this, 'refresPortsData', map, index)
319
330
  },
320
331
  refresMainTableFields(map) {
321
332
  $emit(this, 'refresMainTableFields', map)
@@ -336,6 +347,10 @@ export default {
336
347
  return this.column.width ? this.column.width + '' : '130'
337
348
  },
338
349
  // 设置字段禁止编辑
350
+ fnProhibitToEdit(isEditable) {
351
+ this.$refs[this.column.prop].fnProhibitToEdit(isEditable)
352
+ },
353
+ // 设置字段禁止编辑
339
354
  prohibitToEdit(entity) {
340
355
  $emit(this, 'prohibitToEdit', entity)
341
356
  },
@@ -350,7 +365,7 @@ export default {
350
365
  this.$emit('open-page', openPageParams)
351
366
  }
352
367
  },
353
- emits: ['refresData', 'refresPortData', 'refresPortsData', 'refresMainTableFields', 'prohibitToEdit']
368
+ emits: ['refresData', 'refresPortData', 'refresPortsData', 'refresMainTableFields', 'prohibitToEdit',]
354
369
  }
355
370
  </script>
356
371
 
@@ -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
+ }