doway-coms 1.4.80 → 1.4.82

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,45 +26,230 @@
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>
23
202
  <script>
24
203
  import Sortable from 'sortablejs'
25
204
  import VXETable from 'vxe-table'
205
+ import XEUtils from "xe-utils";
206
+
26
207
  export default {
27
- props: ['userDefineColumns'],
208
+ props:{
209
+ userDefineColumns: {
210
+ type: Array,
211
+ default: function () {
212
+ return [];
213
+ },
214
+ },
215
+ },
28
216
  created() {
29
- this.adjustUserDefineColumns = JSON.parse(
30
- JSON.stringify(this.userDefineColumns)
31
- )
217
+ this.adjustUserDefineColumns = this.userDefineColumns
218
+
32
219
  this.adjustUserDefineColumns.forEach(item => {
33
- if (item.visible) {
34
- this.$set(item, 'show', true)
35
- } else {
36
- this.$set(item, 'show', false)
37
- }
220
+ if (item.visible) {
221
+ this.$set(item, 'show', true)
222
+ } else {
223
+ this.$set(item, 'show', false)
224
+ }
38
225
  })
39
226
  this.adjustGridOptions.columns = []
40
227
  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
- })
228
+ if (item.field === 'operation') {
229
+ return
230
+ }
231
+ this.adjustGridOptions.columns.push({
232
+ field: item.field,
233
+ title: item.title,
234
+ slots: {
235
+ header: 'checkbox',
236
+ filter: item.slots.filter
237
+ },
238
+ params: {
239
+ show: item.show
240
+ },
241
+ width: item.width,
242
+ filters: item.filters,
243
+ sortable: true,
244
+ })
55
245
  })
56
246
  },
57
247
  mounted() {
58
- this.columnDrop(this.adjustUserDefineColumns)
248
+ this.$refs.adjustGrid.getTableColumn().collectColumn.forEach(item => {
249
+ const find = XEUtils.find(this.adjustUserDefineColumns, innerItem => item.field === innerItem.field)
250
+ item.order = find.order
251
+ })
252
+ this.columnDrop(this.adjustUserDefineColumns)
59
253
  },
60
254
  beforeDestroy() {
61
255
  if (this.sortable) {
@@ -84,11 +278,8 @@ export default {
84
278
 
85
279
  methods: {
86
280
  changeCheckbox(val) {
87
- this.adjustUserDefineColumns.forEach(item => {
88
- if (item.field === val.field) {
89
- item.visible = val.params.show
90
- }
91
- })
281
+ const find = XEUtils.find(this.$refs.adjustGrid.getTableColumn().collectColumn,item=>item.field ===val.field)
282
+ find.visible = val.params.show
92
283
  },
93
284
  resizableChange($rowIndex) {
94
285
  this.adjustUserDefineColumns.forEach(item => {
@@ -146,7 +337,34 @@ export default {
146
337
  )
147
338
  this.adjustGridLoading = false
148
339
  })
149
- }
340
+ },
341
+ filterAddExp(colInfo) {
342
+ colInfo.filters[0].data.displayValues.push({
343
+ value: [null, null],
344
+ });
345
+ },
346
+ filterConfirm(colInfo) {
347
+ let col = this.adjustUserDefineColumns.find(x => x.field === colInfo.property)
348
+ this.$set(col.filters[0].data, 'bindingValues', [])
349
+ colInfo.filters[0].data.bindingValues = [];
350
+ XEUtils.arrayEach(colInfo.filters[0].data.displayValues, (item) => {
351
+ if (colInfo.params.controlType === controlType.select) {
352
+ colInfo.filters[0].data.bindingValues.push(item);
353
+ this.$set(col.filters[0].data, 'bindingValues', colInfo.filters[0].data.bindingValues)
354
+ } else {
355
+ if (item.value[0] || item.value[1]) {
356
+ colInfo.filters[0].data.bindingValues.push(item);
357
+ this.$set(col.filters[0].data, 'bindingValues', colInfo.filters[0].data.bindingValues)
358
+ }
359
+ }
360
+ });
361
+ colInfo.filters[0].checked =
362
+ colInfo.filters[0].data.bindingValues.length > 0;
363
+ this.$refs.adjustGrid.closeFilter()
364
+ },
365
+ getTableColumn() {
366
+ return this.$refs.adjustGrid.getTableColumn().collectColumn
367
+ },
150
368
  }
151
369
  }
152
370
  </script>