doway-coms 1.4.80 → 1.4.81

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.
@@ -5,11 +5,20 @@
5
5
  v-bind="adjustGridOptions"
6
6
  :loading="adjustGridLoading"
7
7
  @resizable-change="resizableChange"
8
+ :filter-config="{
9
+ remote: true
10
+ }"
11
+ :sort-config="{
12
+ multiple: true,
13
+ remote: true,
14
+ chronological: true,
15
+ }"
8
16
  column-key
9
17
  >
10
18
  <template #empty>
11
19
  <div>拖拽调整字段位置或者宽度</div>
12
20
  </template>
21
+ <!-- 是否显示字段 -->
13
22
  <template #checkbox="{ column }">
14
23
  <a-checkbox
15
24
  v-model="column.params.show"
@@ -17,6 +26,176 @@
17
26
  ></a-checkbox>
18
27
  {{ column.title }}
19
28
  </template>
29
+
30
+ <!-- 筛选过滤 -->
31
+ <template #text_filter="scope">
32
+ <div class="interceptor-class">
33
+ <div
34
+ :class="scope.column.field + '_filter_' + $index"
35
+ v-for="(loopFilterValue, $index) in scope.column.filters[0].data
36
+ .displayValues"
37
+ :key="$index"
38
+ >
39
+ <a-input allowClear v-model="loopFilterValue.value[0]" @keyup.enter.native="filterConfirm(scope.column)" />
40
+ </div>
41
+ <a-button @click="filterAddExp(scope.column)">添加条件</a-button>
42
+ <a-button @click="filterConfirm(scope.column)">确认</a-button>
43
+ </div>
44
+ </template>
45
+ <template #customCell_filter="scope">
46
+ <div class="interceptor-class">
47
+ <div
48
+ :class="scope.column.field + '_filter_' + $index"
49
+ v-for="(loopFilterValue, $index) in scope.column.filters[0].data
50
+ .displayValues"
51
+ :key="$index"
52
+ >
53
+ <a-input allowClear v-model="loopFilterValue.value[0]" @keyup.enter.native="filterConfirm(scope.column)" />
54
+ </div>
55
+ <a-button @click="filterAddExp(scope.column)">添加条件</a-button>
56
+ <a-button @click="filterConfirm(scope.column)">确认</a-button>
57
+ </div>
58
+ </template>
59
+ <template #pulldown_filter="scope">
60
+ <div class="interceptor-class">
61
+ <div
62
+ :class="scope.column.field + '_filter_' + $index"
63
+ v-for="(loopFilterValue, $index) in scope.column.filters[0].data
64
+ .displayValues"
65
+ :key="$index"
66
+ >
67
+ <a-input allowClear v-model="loopFilterValue.value[0]" @keyup.enter.native="filterConfirm(scope.column)" />
68
+ </div>
69
+ <a-button @click="filterAddExp(scope.column)">添加条件</a-button>
70
+ <a-button @click="filterConfirm(scope.column)">确认</a-button>
71
+ </div>
72
+ </template>
73
+ <template #number_filter="scope">
74
+ <div class="interceptor-class">
75
+ <div
76
+ :class="scope.column.field + '_filter_' + $index"
77
+ v-for="(loopFilterValue, $index) in scope.column.filters[0].data
78
+ .displayValues"
79
+ :key="$index"
80
+ >
81
+ <a-input-number
82
+ :precision="0"
83
+ size="small"
84
+ v-model="loopFilterValue.value[0]"
85
+ @keyup.enter.native="filterConfirm(scope.column)"
86
+ />~
87
+ <a-input-number
88
+ :precision="0"
89
+ size="small"
90
+ v-model="loopFilterValue.value[1]"
91
+ @keyup.enter.native="filterConfirm(scope.column)"
92
+ />
93
+ </div>
94
+ <a-button @click="filterAddExp(scope.column)">添加条件</a-button>
95
+ <a-button @click="filterConfirm(scope.column)">确认</a-button>
96
+ </div>
97
+ </template>
98
+ <template #select_filter="scope">
99
+ <div class="interceptor-class">
100
+ <a-checkbox-group
101
+ v-model="scope.column.filters[0].data.displayValues"
102
+ :style="{
103
+ display: 'flex',
104
+ flexWrap: 'wrap',
105
+ justifyContent: 'left',
106
+ alignItems: 'center',
107
+ maxHeight: '150px',
108
+ overflow: 'auto',
109
+ maxWidth: '100px'
110
+ }"
111
+ @keyup.enter.native="filterConfirm(scope.column)"
112
+ >
113
+ <br />
114
+ <a-checkbox
115
+ v-for="loopSource in scope.column.params.dataSource"
116
+ :key="loopSource.value"
117
+ :value="loopSource.value"
118
+ style="margin: 5px 0;"
119
+ >{{ loopSource.caption }}
120
+ </a-checkbox>
121
+ </a-checkbox-group>
122
+ <!-- <a-select-->
123
+ <!-- v-model="scope.column.filters[0].data.displayValues"-->
124
+ <!-- mode="multiple"-->
125
+ <!-- allowClear-->
126
+ <!-- style="width: 300px;"-->
127
+ <!-- placeholder="筛选条件"-->
128
+ <!-- showArrow-->
129
+ <!-- >-->
130
+ <!-- <a-select-option-->
131
+ <!-- v-for="loopSource in scope.column.params.dataSource"-->
132
+ <!-- :key="loopSource.value"-->
133
+ <!-- :value="loopSource.value"-->
134
+ <!-- >{{ loopSource.caption }}</a-select-option-->
135
+ <!-- >-->
136
+ <!-- </a-select>-->
137
+ <br>
138
+ <a-button @click="filterConfirm(scope.column)">确认</a-button>
139
+ </div>
140
+ </template>
141
+ <template #datetime_filter="scope">
142
+ <div class="interceptor-class">
143
+ <div
144
+ :class="scope.column.field + '_filter_' + $index"
145
+ v-for="(loopFilterValue, $index) in scope.column.filters[0].data
146
+ .displayValues"
147
+ :key="$index"
148
+ >
149
+ <a-date-picker
150
+ valueFormat="YYYY-MM-DD HH:mm:ss"
151
+ format="YYYY-MM-DD HH:mm:ss"
152
+ :show-time="{
153
+ defaultValue: moment(
154
+ '2000-01-01 00:00:00',
155
+ 'YYYY-MM-DD HH:mm:ss'
156
+ ),
157
+ }"
158
+ placeholder="开始时间"
159
+ v-model="loopFilterValue.value[0]"
160
+ @keyup.enter.native="filterConfirm(scope.column)"
161
+ />
162
+ <a-date-picker
163
+ valueFormat="YYYY-MM-DD HH:mm:ss"
164
+ format="YYYY-MM-DD HH:mm:ss"
165
+ :show-time="{
166
+ defaultValue: moment(
167
+ '2000-01-01 23:59:59',
168
+ 'YYYY-MM-DD HH:mm:ss'
169
+ ),
170
+ }"
171
+ placeholder="结束时间"
172
+ v-model="loopFilterValue.value[1]"
173
+ @keyup.enter.native="filterConfirm(scope.column)"
174
+ />
175
+ </div>
176
+ <a-button @click="filterAddExp(scope.column)">添加条件</a-button>
177
+ <a-button @click="filterConfirm(scope.column)">确认</a-button>
178
+ </div>
179
+ </template>
180
+ <template #date_filter="scope">
181
+ <div class="interceptor-class">
182
+ <div
183
+ :class="scope.column.field + '_filter_' + $index"
184
+ v-for="(loopFilterValue, $index) in scope.column.filters[0].data
185
+ .displayValues"
186
+ :key="$index"
187
+ >
188
+ <a-range-picker v-model:value="loopFilterValue.value"
189
+ valueFormat="YYYY-MM-DD"
190
+ format="YYYY-MM-DD"
191
+ @keyup.enter.native="filterConfirm(scope.column)"
192
+
193
+ />
194
+ </div>
195
+ <a-button @click="filterAddExp(scope.column)">添加条件</a-button>
196
+ <a-button @click="filterConfirm(scope.column)">确认</a-button>
197
+ </div>
198
+ </template>
20
199
  </vxe-grid>
21
200
  </div>
22
201
  </template>
@@ -24,38 +203,51 @@
24
203
  import Sortable from 'sortablejs'
25
204
  import VXETable from 'vxe-table'
26
205
  export default {
27
- props: ['userDefineColumns'],
206
+ props:{
207
+ userDefineColumns: {
208
+ type: Array,
209
+ default: function () {
210
+ return [];
211
+ },
212
+ },
213
+ },
28
214
  created() {
29
- this.adjustUserDefineColumns = JSON.parse(
30
- JSON.stringify(this.userDefineColumns)
31
- )
215
+ this.adjustUserDefineColumns = this.userDefineColumns
216
+
32
217
  this.adjustUserDefineColumns.forEach(item => {
33
- if (item.visible) {
34
- this.$set(item, 'show', true)
35
- } else {
36
- this.$set(item, 'show', false)
37
- }
218
+ if (item.visible) {
219
+ this.$set(item, 'show', true)
220
+ } else {
221
+ this.$set(item, 'show', false)
222
+ }
38
223
  })
39
224
  this.adjustGridOptions.columns = []
40
225
  this.adjustUserDefineColumns.forEach(item => {
41
- if(item.field === 'operation'){
42
- return
43
- }
44
- this.adjustGridOptions.columns.push({
45
- field: item.field,
46
- title: item.title,
47
- slots: {
48
- header: 'checkbox'
49
- },
50
- params: {
51
- show: item.show
52
- },
53
- width: item.width
54
- })
226
+ if (item.field === 'operation') {
227
+ return
228
+ }
229
+ this.adjustGridOptions.columns.push({
230
+ field: item.field,
231
+ title: item.title,
232
+ slots: {
233
+ header: 'checkbox',
234
+ filter: item.slots.filter
235
+ },
236
+ params: {
237
+ show: item.show
238
+ },
239
+ width: item.width,
240
+ filters: item.filters,
241
+ sortable: true,
242
+ })
55
243
  })
56
244
  },
57
245
  mounted() {
58
- this.columnDrop(this.adjustUserDefineColumns)
246
+ this.$refs.adjustGrid.getTableColumn().collectColumn.forEach(item => {
247
+ const find = XEUtils.find(this.adjustUserDefineColumns, innerItem => item.field === innerItem.field)
248
+ item.order = find.order
249
+ })
250
+ this.columnDrop(this.adjustUserDefineColumns)
59
251
  },
60
252
  beforeDestroy() {
61
253
  if (this.sortable) {
@@ -84,11 +276,8 @@ export default {
84
276
 
85
277
  methods: {
86
278
  changeCheckbox(val) {
87
- this.adjustUserDefineColumns.forEach(item => {
88
- if (item.field === val.field) {
89
- item.visible = val.params.show
90
- }
91
- })
279
+ const find = XEUtils.find(this.$refs.adjustGrid.getTableColumn().collectColumn,item=>item.field ===val.field)
280
+ find.visible = val.params.show
92
281
  },
93
282
  resizableChange($rowIndex) {
94
283
  this.adjustUserDefineColumns.forEach(item => {
@@ -146,7 +335,34 @@ export default {
146
335
  )
147
336
  this.adjustGridLoading = false
148
337
  })
149
- }
338
+ },
339
+ filterAddExp(colInfo) {
340
+ colInfo.filters[0].data.displayValues.push({
341
+ value: [null, null],
342
+ });
343
+ },
344
+ filterConfirm(colInfo) {
345
+ let col = this.adjustUserDefineColumns.find(x => x.field === colInfo.property)
346
+ this.$set(col.filters[0].data, 'bindingValues', [])
347
+ colInfo.filters[0].data.bindingValues = [];
348
+ XEUtils.arrayEach(colInfo.filters[0].data.displayValues, (item) => {
349
+ if (colInfo.params.controlType === controlType.select) {
350
+ colInfo.filters[0].data.bindingValues.push(item);
351
+ this.$set(col.filters[0].data, 'bindingValues', colInfo.filters[0].data.bindingValues)
352
+ } else {
353
+ if (item.value[0] || item.value[1]) {
354
+ colInfo.filters[0].data.bindingValues.push(item);
355
+ this.$set(col.filters[0].data, 'bindingValues', colInfo.filters[0].data.bindingValues)
356
+ }
357
+ }
358
+ });
359
+ colInfo.filters[0].checked =
360
+ colInfo.filters[0].data.bindingValues.length > 0;
361
+ this.$refs.adjustGrid.closeFilter()
362
+ },
363
+ getTableColumn() {
364
+ return this.$refs.adjustGrid.getTableColumn().collectColumn
365
+ },
150
366
  }
151
367
  }
152
368
  </script>