doway-coms 2.2.11 → 2.2.12

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": "doway-coms",
3
- "version": "2.2.11",
3
+ "version": "2.2.12",
4
4
  "description": "doway组件库",
5
5
  "author": "dowaysoft",
6
6
  "main": "packages/index.js",
@@ -402,7 +402,15 @@ export default {
402
402
  }
403
403
  }
404
404
  },
405
- watch: {},
405
+ watch: {
406
+ // 触发下拉表格字段更改,直接重新渲染
407
+ columns: {
408
+ handler(newVal) {
409
+ this.reloadColumn()
410
+ },
411
+ deep: true
412
+ }
413
+ },
406
414
  computed: {
407
415
  currentValue: {
408
416
  // 动态计算currentValue的值
@@ -501,6 +509,85 @@ export default {
501
509
  }
502
510
  },
503
511
  methods: {
512
+ // 刷新重置字段列
513
+ reloadColumn() {
514
+ this.internalColumns = []
515
+ this.internalColumns.push({
516
+ type: 'seq',
517
+ fixed: 'left',
518
+ width: 50,
519
+ })
520
+ if (this.isMultiSelect === true) {
521
+ this.internalColumns.push({
522
+ type: 'checkbox',
523
+ fixed: 'left',
524
+ width: 40,
525
+ })
526
+ }
527
+ for (let i = 0; i < this.columns.length; i++) {
528
+ this.fetchFields = this.fetchFields + this.columns[i].field + ','
529
+ this.columns[i]['params'] = {
530
+ dataSource: [],
531
+ }
532
+ if (this.columns[i].dataSource) {
533
+ this.columns[i]['params'].dataSource = this.columns[i].dataSource
534
+ }
535
+ if (!this.columns[i].width) {
536
+ this.columns[i]['width'] = 100
537
+ }
538
+ if (this.columns[i].isCheckbox === true) {
539
+ this.columns[i]['type'] = 'checkbox'
540
+ }
541
+ if (!this.columns[i].controlType) {
542
+ this.columns[i].controlType = 'text'
543
+ }
544
+ // 设置字段的过滤插槽
545
+ if (this.columns[i].filter) {
546
+ this.columns[i]['filterMultiple'] = false
547
+
548
+ switch (this.columns[i].controlType) {
549
+ case 'checkbox':
550
+ this.columns[i]['slots'] = {
551
+ filter: `checkbox_filter`,
552
+ }
553
+ break
554
+ case 'select':
555
+ this.columns[i]['slots'] = {
556
+ filter: `select_filter`,
557
+ }
558
+ this.columns[i]['filters'] = [
559
+ {
560
+ data: [],
561
+ },
562
+ ]
563
+ break
564
+ default:
565
+ this.columns[i]['slots'] = {
566
+ filter: `text_filter`,
567
+ }
568
+ this.columns[i]['filters'] = [
569
+ {
570
+ data: '',
571
+ },
572
+ ]
573
+ break
574
+ }
575
+ }
576
+ // 默认排序
577
+ if (this.columns[i].defaultSort) {
578
+ this.defaultSort.push({
579
+ field: this.columns[i].field,
580
+ order: this.columns[i].defaultSort,
581
+ })
582
+ this.sorts.push([this.columns[i].field, this.columns[i].defaultSort])
583
+ }
584
+ this.internalColumns.push(this.columns[i])
585
+ if (this.columns[i].filter === true) {
586
+ this.filterCols.push(this.columns[i])
587
+ }
588
+ }
589
+ this.$refs.pupupGridView.refreshColumn()
590
+ },
504
591
  gridRowStyle(scope) {
505
592
  if (scope.row.sysRepeat === true) {
506
593
  return 'row--pending'