imatrix-ui 2.9.47-dw → 2.9.49-dw

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "imatrix-ui",
3
- "version": "2.9.47-dw",
3
+ "version": "2.9.49-dw",
4
4
  "description": "前端组件库:表格、表单、组织结构树等",
5
5
  "main": "lib/super-ui.umd.min.js",
6
6
  "private": false,
@@ -225,8 +225,10 @@ export default {
225
225
  },
226
226
  // 必须有该方法,否则无法给字段赋值
227
227
  inputValue(newValue) {
228
+ let isClickSaveAll = false
228
229
  if (this.baseProps.multiple !== undefined && this.baseProps.multiple === true && newValue && newValue.indexOf('saveAll') >= 0) {
229
- // 表示全选时,更新值为下拉选所有选项
230
+ // 表示点击了全选选项
231
+ isClickSaveAll = true
230
232
  if (newValue.length - 1 >= this.optionItems.length) {
231
233
  // 表示需要取消全选
232
234
  newValue = []
@@ -244,7 +246,7 @@ export default {
244
246
  if (newValue === null || newValue === undefined || newValue === '') {
245
247
  this.remoteQueryMethod(newValue)
246
248
  }
247
- this.setValues(newValue)
249
+ this.setValues(newValue, isClickSaveAll)
248
250
  },
249
251
  packageDynamicDataSourceInfo(dynamicDataSourceCode, param) {
250
252
  return new Promise((resolve, reject) => {
@@ -389,11 +391,11 @@ export default {
389
391
  ? '_label_'
390
392
  : this.valueAttribute
391
393
  },
392
- setValues(newValue) {
394
+ setValues(newValue, isClickSaveAll) {
393
395
  if (this.valueSetOptions && this.valueSetOptions.length > 0) {
394
396
  if (this.baseProps.multiple !== undefined && this.baseProps.multiple === true) {
395
397
  // 多选时
396
- this.setColumnValueWhenMulti(newValue)
398
+ this.setColumnValueWhenMulti(newValue, isClickSaveAll)
397
399
  } else {
398
400
  // 单选时
399
401
  this.valueSetOptions.forEach(columnInfo => {
@@ -439,7 +441,7 @@ export default {
439
441
  })
440
442
  },
441
443
  // 多选下拉框时处理增加tag、减少tag时,映射字段赋值问题
442
- setColumnValueWhenMulti(newValue) {
444
+ setColumnValueWhenMulti(newValue, isClickSaveAll) {
443
445
  // 是否添加tag
444
446
  let isAddTag = false
445
447
  let removeTag
@@ -475,18 +477,88 @@ export default {
475
477
  if (isAddTag) {
476
478
  // 表示是增加tag
477
479
  const isRemove = false
478
- const lastSelectTag = newValue[newValue.length - 1]
479
- const items = this.optionItems.filter(
480
- item => item[this.valueAttribute] === lastSelectTag
481
- )
482
- if (items && items.length > 0) {
483
- this.setTagValue(null, isRemove, items[0])
480
+ if (isClickSaveAll) {
481
+ // 全选
482
+ this.setAllTagValue(isRemove)
483
+ } else {
484
+ const lastSelectTag = newValue[newValue.length - 1]
485
+ const items = this.optionItems.filter(
486
+ item => item[this.valueAttribute] === lastSelectTag
487
+ )
488
+ if (items && items.length > 0) {
489
+ this.setTagValue(null, isRemove, items[0])
490
+ }
484
491
  }
485
492
  } else {
486
493
  // 表示是减少tag
487
494
  const isRemove = true
488
- this.setTagValue(removeTag, isRemove)
495
+ if (isClickSaveAll) {
496
+ this.setAllTagValue(isRemove)
497
+ } else {
498
+ this.setTagValue(removeTag, isRemove)
499
+ }
500
+ }
501
+ },
502
+ setAllTagValue(isRemove) {
503
+ if (this.valueSetOptions && this.valueSetOptions.length > 0) {
504
+ this.valueSetOptions.forEach(columnInfo => {
505
+ const sourceColumnName = columnInfo.columnName
506
+ if (sourceColumnName !== this.valueAttribute) {
507
+ let targetColumnName = null
508
+ const targetColumnInfo = columnInfo.valueColumn
509
+ if (targetColumnInfo) {
510
+ targetColumnName = targetColumnInfo.name
511
+ if (this.isSql === true) {
512
+ targetColumnName = targetColumnInfo.dbColumnName
513
+ targetColumnName = getPropNameWhenJoinTable(
514
+ targetColumnName,
515
+ this.isJoinTable,
516
+ this.tableName
517
+ )
518
+ }
519
+ }
520
+ let value
521
+ if (targetColumnName) {
522
+ if (isRemove) {
523
+ // 移除tag
524
+ value = null
525
+ } else {
526
+ // 添加tag
527
+ let originalValue = ''
528
+ if (this.optionItems && this.optionItems.length > 0) {
529
+ this.optionItems.forEach(selectItem => {
530
+ const addValue = selectItem[sourceColumnName]
531
+ if (originalValue !== undefined && originalValue !== null && originalValue !== '') {
532
+ originalValue = originalValue + ',' + addValue
533
+ } else {
534
+ originalValue = addValue
535
+ }
536
+ })
537
+ value = originalValue
538
+ }
539
+ }
540
+ }
541
+ this.setTargetColumnValue(sourceColumnName, targetColumnName, value)
542
+ }
543
+ })
544
+ }
545
+ },
546
+ setTargetColumnValue(sourceColumnName, targetColumnName, value) {
547
+ if (
548
+ this.entity &&
549
+ targetColumnName &&
550
+ targetColumnName !== null &&
551
+ targetColumnName !== ''
552
+ ) {
553
+ setEntityFieldValue(this.entity, targetColumnName, value)
489
554
  }
555
+ this.$emit('set-value', {
556
+ value: value,
557
+ sourceColumnName: sourceColumnName,
558
+ targetColumnName: targetColumnName,
559
+ options: this.optionItems,
560
+ valueAttribute: this.valueAttribute
561
+ })
490
562
  },
491
563
  // 根据tag参数设置映射字段的值
492
564
  setTagValue(tag, isRemove, selectItem) {
@@ -531,21 +603,7 @@ export default {
531
603
  }
532
604
  }
533
605
  }
534
- if (
535
- this.entity &&
536
- targetColumnName &&
537
- targetColumnName !== null &&
538
- targetColumnName !== ''
539
- ) {
540
- setEntityFieldValue(this.entity, targetColumnName, value)
541
- }
542
- this.$emit('set-value', {
543
- value: value,
544
- sourceColumnName: sourceColumnName,
545
- targetColumnName: targetColumnName,
546
- options: this.optionItems,
547
- valueAttribute: this.valueAttribute
548
- })
606
+ this.setTargetColumnValue(sourceColumnName, targetColumnName, value)
549
607
  }
550
608
  })
551
609
  }
@@ -820,6 +820,22 @@ gridParams.$rowIndex < gridParams.gridData.length) {
820
820
  }
821
821
  }
822
822
  }
823
+ },
824
+ refreshChildData(listCode, gridData, isShowPageArea) {
825
+ const gridParams = store.get(listCode)
826
+ if (isShowPageArea === undefined ||
827
+ isShowPageArea === null ||
828
+ isShowPageArea === false) {
829
+ // 子表不分页
830
+ // console.log('refreshChildData111====', listCode + 'listCode', gridData)
831
+ gridParams.gridData = gridData
832
+ this.gridData = gridData
833
+ } else {
834
+ // 子表分页
835
+ // console.log('refreshChildData222====', listCode + 'listCode', gridData)
836
+ gridParams.subTableData = gridData
837
+ this.subTableData = gridData
838
+ }
823
839
  }
824
840
  }
825
841
  export default apis