doway-coms 1.6.1 → 1.6.3

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": "1.6.1",
3
+ "version": "1.6.3",
4
4
  "description": "doway组件库",
5
5
  "author": "dowaysoft",
6
6
  "main": "packages/index.js",
@@ -19,7 +19,7 @@
19
19
  :page-size="pageSize"
20
20
  :total="totalRows"
21
21
  size="small"
22
- :page-sizes="[10, 20 ,50, 100, 150, 200]"
22
+ :page-sizes="pageSizeOptions"
23
23
  @page-change="onPageChange"
24
24
  style="margin-top: 10px;"
25
25
  :layouts="['PrevJump', 'PrevPage', 'JumpNumber', 'NextPage', 'NextJump', 'Sizes', 'FullJump', 'Total']"
@@ -1,4 +1,4 @@
1
- <template>
1
+ <template>
2
2
  <div class="d-control-container">
3
3
  <div
4
4
  class="d-control-label"
@@ -62,9 +62,13 @@
62
62
  ref="pupupGridView"
63
63
  :data="searchRows"
64
64
  @cell-click="gridCellClick"
65
+ @filter-visible="filterVisible"
65
66
  :columns="internalColumns"
66
67
  :checkbox-config="{ checkMethod: checkMethod }"
67
68
  @sort-change="sortChange"
69
+ :filter-config="{
70
+ remote: true,
71
+ }"
68
72
  :sort-config="{
69
73
  multiple: true,
70
74
  remote: true,
@@ -84,6 +88,40 @@
84
88
  </div>
85
89
  </div>
86
90
  </template>
91
+ <!-- <template #checkbox_filter="scope">-->
92
+ <!-- <div class="interceptor-class">-->
93
+ <!-- <a-checkbox-group-->
94
+ <!-- v-model="scope.column.filters[0].data.displayValues"-->
95
+ <!-- @keyup.enter.native="filterConfirm(scope.column)"-->
96
+ <!-- >-->
97
+ <!-- <div style="max-height:200px;overflow-y:scroll">-->
98
+ <!-- <div style="text-align:left;" v-for="loopSource in scope.column.params.dataSource" :key="loopSource.value">-->
99
+ <!-- <a-checkbox-->
100
+ <!-- v-show="loopSource.caption.indexOf(scope.column.filters[0].data.displayValueSearchText)>-1"-->
101
+ <!-- :value="loopSource.value"-->
102
+ <!-- style="margin: 5px 0;"-->
103
+ <!-- >{{ loopSource.caption }}-->
104
+ <!-- </a-checkbox>-->
105
+ <!-- </div>-->
106
+ <!-- </div>-->
107
+ <!-- </a-checkbox-group>-->
108
+ <!-- <br>-->
109
+ <!-- <a-button @click="filterConfirm(scope.column)">确认</a-button>-->
110
+ <!-- </div>-->
111
+ <!-- </template>-->
112
+ <!-- 普通输入框的过滤筛选-->
113
+ <template #text_filter="{ column }">
114
+ <div class="interceptor-class">
115
+ <div
116
+ v-for="(item, $index) in column.filters"
117
+ :key="$index"
118
+ >
119
+ <a-input allowClear v-model="item.data" @keyup.enter.native="filterConfirm(column)" style="margin-bottom: 5px;" />
120
+ </div>
121
+ <a-button @click="filterAddExp(column)">添加条件</a-button>
122
+ <a-button @click="filterConfirm(column)">确认</a-button>
123
+ </div>
124
+ </template>
87
125
  <template #pager>
88
126
  <a-row>
89
127
  <a-col :span="8">
@@ -141,7 +179,6 @@
141
179
  <span v-else> {{ currentValue }}</span>
142
180
  </span>
143
181
  </div>
144
-
145
182
  <keep-alive>
146
183
  <div
147
184
  :is="popupAddName"
@@ -188,6 +225,10 @@ export default {
188
225
  },
189
226
  sorts: [],
190
227
  defaultSort: [],
228
+ filterExpression: {
229
+ operator: 'and',
230
+ expressions: []
231
+ }
191
232
  };
192
233
  },
193
234
  props: {
@@ -387,6 +428,27 @@ export default {
387
428
  if (this.columns[i].isCheckbox === true) {
388
429
  this.columns[i]["type"] = "checkbox";
389
430
  }
431
+ // 设置字段的过滤插槽
432
+ if(this.columns[i].fieldFilter) {
433
+ this.columns[i]["filterMultiple"] = false;
434
+ this.columns[i]['filters'] = [
435
+ {
436
+ data: ''
437
+ }
438
+ ]
439
+ switch(this.columns[i].controlType) {
440
+ // case 'checkbox':
441
+ // this.columns[i]['slots'] = {
442
+ // filter: `checkbox_filter`
443
+ // }
444
+ // break
445
+ default:
446
+ this.columns[i]['slots'] = {
447
+ filter: `text_filter`
448
+ }
449
+ break
450
+ }
451
+ }
390
452
  // 默认排序
391
453
  if (this.columns[i].defaultSort) {
392
454
  this.defaultSort.push({
@@ -464,6 +526,7 @@ export default {
464
526
  inputClickEvent(event) {
465
527
  if (this.$refs.pulldownRef.isPanelVisible() === false) {
466
528
  this.$refs.pulldownRef.showPanel();
529
+ this.clearColumnFilter()
467
530
  this.searchData();
468
531
  } else {
469
532
  this.$refs.pulldownRef.hidePanel();
@@ -744,6 +807,9 @@ export default {
744
807
  };
745
808
  //查询之前从外部组件构造其他的条件
746
809
  this.$emit("preSearch", postExpression, repeatRowInfo);
810
+ if(this.filterExpression.expressions.length > 0) {
811
+ postExpression.expression.expressions.push(this.filterExpression)
812
+ }
747
813
  let postData = {
748
814
  fields: this.fetchFields,
749
815
  begin:
@@ -755,7 +821,7 @@ export default {
755
821
  sorts: this.sorts,
756
822
  extendParams: postExpression.extendParams,
757
823
  };
758
- console.log(postData.sorts);
824
+ // console.log(postData.sorts);
759
825
  let tempApi = this.getPostApi(postData);
760
826
 
761
827
  // let tempApi = this.api
@@ -786,6 +852,7 @@ export default {
786
852
  vm.gridPagerConfig.total = responseData.extData.totalRows;
787
853
  } else {
788
854
  vm.searchRows = responseData.content;
855
+ vm.$refs.pupupGridView.loadData(vm.searchRows)
789
856
  vm.gridPagerConfig.total = responseData.otherContent.totalRows;
790
857
  }
791
858
  if (repeatRowInfo.field) {
@@ -863,6 +930,80 @@ export default {
863
930
  this.sorts = currentSort;
864
931
  this.searchData();
865
932
  },
933
+
934
+ // 下拉容器筛选条件被触发
935
+ filterVisible({column}) {
936
+ XEUtils.remove(column.filters, item => {
937
+ return item.data === ''
938
+ })
939
+ if(column.filters.length === 0) {
940
+ column.filters.push({
941
+ data: ''
942
+ })
943
+ }
944
+ },
945
+ filterConfirm(column) {
946
+ let vm = this
947
+ this.filterExpression = {
948
+ operator: 'and',
949
+ expressions: []
950
+ }
951
+ column.filters[0].checked =
952
+ column.filters[0].data !== '';
953
+ //通知外部筛选改变事件
954
+ let columns = this.$refs.pupupGridView.getTableColumn().collectColumn
955
+ XEUtils.each(columns, item => {
956
+ let filterExpression = {
957
+ operator: 'or',
958
+ expressions: []
959
+ }
960
+ if(item.filters && item.filters[0].checked) {
961
+ XEUtils.each(item.filters, loopItem => {
962
+ if(loopItem.data !== '') {
963
+ filterExpression.expressions.push({
964
+ field: item.field,
965
+ operator: "CO",
966
+ value: loopItem.data
967
+ })
968
+ }
969
+ })
970
+ if(filterExpression.expressions.length > 0) {
971
+ vm.filterExpression.expressions.push(filterExpression)
972
+ }
973
+ }
974
+ })
975
+ this.gridPagerConfig.currentPage = 1
976
+ this.searchData()
977
+ this.$refs.pupupGridView.closeFilter()
978
+ },
979
+ // 添加筛选条件
980
+ filterAddExp(column) {
981
+ column['filters'].push({
982
+ data: ''
983
+ })
984
+ },
985
+
986
+ // 清楚筛选条件
987
+ clearColumnFilter() {
988
+ let columns = []
989
+ try {
990
+ columns = this.$refs.pupupGridView.getTableColumn().collectColumn
991
+ }catch (err) {
992
+ console.debug(err)
993
+ }
994
+
995
+ XEUtils.each(columns, item => {
996
+ if(item.filters && item.filters[0].checked) {
997
+ item.filters = [{
998
+ data: ''
999
+ }]
1000
+ }
1001
+ })
1002
+ this.filterExpression = {
1003
+ operator: 'and',
1004
+ expressions: []
1005
+ }
1006
+ },
866
1007
  },
867
1008
  };
868
1009
  </script>
@@ -877,9 +1018,14 @@ export default {
877
1018
  }
878
1019
 
879
1020
  .d-grid-control {
880
- width: 100%;
881
1021
  height: 30px;
882
1022
  }
1023
+ .interceptor-class {
1024
+ padding: 10px;
1025
+ ::v-deep .ant-btn {
1026
+ margin: 10px 10px 0;
1027
+ }
1028
+ }
883
1029
  </style>
884
1030
 
885
1031