doway-coms 2.1.2 → 2.1.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.
Files changed (77) hide show
  1. package/.browserslistrc +2 -2
  2. package/README.md +28 -28
  3. package/package.json +53 -53
  4. package/packages/AuditsList/index.js +7 -7
  5. package/packages/AuditsList/src/index.vue +262 -262
  6. package/packages/BaseButton/index.js +7 -7
  7. package/packages/BaseButton/src/index.vue +241 -241
  8. package/packages/BaseCheckbox/index.js +7 -7
  9. package/packages/BaseCheckbox/src/index.vue +134 -134
  10. package/packages/BaseDate/index.js +7 -7
  11. package/packages/BaseDate/src/index.vue +197 -197
  12. package/packages/BaseDateWeek/index.js +7 -7
  13. package/packages/BaseDateWeek/src/index.vue +163 -163
  14. package/packages/BaseDatetime/index.js +7 -7
  15. package/packages/BaseDatetime/src/index.vue +196 -196
  16. package/packages/BaseForm/index.js +7 -7
  17. package/packages/BaseForm/src/index.vue +727 -727
  18. package/packages/BaseGantt/index.js +9 -9
  19. package/packages/BaseGantt/src/index.vue +608 -608
  20. package/packages/BaseGrid/index.js +9 -9
  21. package/packages/BaseGrid/src/SeqSetting.vue +278 -278
  22. package/packages/BaseGrid/src/index.vue +3382 -3380
  23. package/packages/BaseGridAdjust/index.js +9 -9
  24. package/packages/BaseGridAdjust/src/index.vue +482 -482
  25. package/packages/BaseInput/index.js +7 -7
  26. package/packages/BaseInput/src/index.vue +164 -164
  27. package/packages/BaseIntervalInput/index.js +7 -7
  28. package/packages/BaseIntervalInput/src/index.vue +310 -310
  29. package/packages/BaseKanbanEmpty/index.js +7 -7
  30. package/packages/BaseKanbanEmpty/src/index.vue +176 -176
  31. package/packages/BaseNumberInput/index.js +7 -7
  32. package/packages/BaseNumberInput/src/index.vue +267 -267
  33. package/packages/BasePagination/index.js +7 -7
  34. package/packages/BasePagination/src/index.vue +91 -91
  35. package/packages/BasePictureCard/index.js +7 -7
  36. package/packages/BasePictureCard/src/index.vue +580 -580
  37. package/packages/BasePrintPreview/index.js +7 -7
  38. package/packages/BasePrintPreview/src/index.vue +129 -129
  39. package/packages/BasePulldown/index.js +7 -7
  40. package/packages/BasePulldown/src/index.vue +1165 -1165
  41. package/packages/BaseSearch/index.js +7 -7
  42. package/packages/BaseSearch/src/index.vue +935 -935
  43. package/packages/BaseSelect/index.js +7 -7
  44. package/packages/BaseSelect/src/index.vue +155 -155
  45. package/packages/BaseSelectMulti/index.js +7 -7
  46. package/packages/BaseSelectMulti/src/index.vue +148 -148
  47. package/packages/BaseTextArea/index.js +7 -7
  48. package/packages/BaseTextArea/src/index.vue +178 -178
  49. package/packages/BaseTime/index.js +7 -7
  50. package/packages/BaseTime/src/index.vue +166 -166
  51. package/packages/BaseTool/index.js +7 -7
  52. package/packages/BaseTool/src/index.vue +349 -349
  53. package/packages/BaseToolStatus/index.js +7 -7
  54. package/packages/BaseToolStatus/src/index.vue +388 -388
  55. package/packages/BaseTreeSelect/index.js +8 -8
  56. package/packages/BaseTreeSelect/src/index.vue +416 -416
  57. package/packages/LeaveAMessage/index.js +7 -7
  58. package/packages/LeaveAMessage/src/index.vue +597 -597
  59. package/packages/index.js +191 -191
  60. package/packages/styles/default.less +80 -80
  61. package/packages/utils/api.js +99 -99
  62. package/packages/utils/auth.js +38 -38
  63. package/packages/utils/common.js +601 -601
  64. package/packages/utils/dom.js +181 -181
  65. package/packages/utils/enum.js +85 -85
  66. package/packages/utils/filters.js +458 -458
  67. package/packages/utils/gridFormat.js +60 -60
  68. package/packages/utils/msg.js +84 -84
  69. package/packages/utils/patchFiles.js +44 -44
  70. package/packages/utils/request.js +178 -178
  71. package/packages/utils/store.js +303 -303
  72. package/vue.config.js +59 -59
  73. package/dist/css/chunk-vendors.7f83d8f9.css +0 -8
  74. package/dist/css/index.86478f73.css +0 -3
  75. package/dist/favicon.ico +0 -0
  76. package/dist/js/chunk-vendors.307eaa8f.js +0 -347
  77. package/dist/js/index.48e7f7ac.js +0 -2
@@ -1,1165 +1,1165 @@
1
- <template>
2
- <div class="d-control-container">
3
- <div
4
- class="d-control-label"
5
- v-if="showLabel === true"
6
- :style="{ width: labelWidth > 0 ? labelWidth + 'px' : 'none' }"
7
- >
8
- {{ label }}
9
- <span v-if="rules && rules['required']" class="d-control-label-required"
10
- >*</span
11
- >
12
- <Tooltip :title="tooltip" v-if="tooltip" style="margin: 0 2px">
13
- <img src="../../styles/icon/help.png" alt="" style="width: 14px" />
14
- </Tooltip>
15
- </div>
16
- <div
17
- :class="{
18
- 'd-control': showLabel === true,
19
- 'd-grid-control': showLabel === false,
20
- }"
21
- >
22
- <VxePulldown
23
- style="width: 100%"
24
- @hide-panel="pullDownHideEvent"
25
- ref="pulldownRef"
26
- v-if="edit === true"
27
- transfer
28
- >
29
- <template #default>
30
- <ValidationProvider :name="label" v-slot="v" :rules="rules">
31
- <a-input
32
- :size="'small'"
33
- allow-clear
34
- @change="inputChangeEvent"
35
- class="inner-cell-control"
36
- v-model="currentValue"
37
- @click="inputClickEvent"
38
- @focus="inputFocusEvent"
39
- @blur="inputBlurEvent"
40
- @keydown="inputKeydownEvent"
41
- @keyup="inputKeyupEvent"
42
- :class="{ 'd-error-input': v.errors.length > 0 }"
43
- ></a-input>
44
- <div class="d-error-msg">
45
- {{ v.errors[0] }}
46
- </div>
47
- </ValidationProvider>
48
- </template>
49
- <template #dropdown>
50
- <div class="pulldown-grid interceptor-class">
51
- <vxe-grid
52
- size="mini"
53
- border
54
- :row-class-name="gridRowStyle"
55
- highlight-current-row
56
- :keyboard-config="{ isArrow: true }"
57
- highlight-hover-row
58
- auto-resize
59
- resizable
60
- :loading="gridLoading"
61
- height="auto"
62
- ref="pupupGridView"
63
- :data="searchRows"
64
- @cell-click="gridCellClick"
65
- @filter-visible="filterVisible"
66
- :columns="internalColumns"
67
- :checkbox-config="{ checkMethod: checkMethod }"
68
- @sort-change="sortChange"
69
- :filter-config="{
70
- remote: true,
71
- }"
72
- :sort-config="{
73
- multiple: true,
74
- remote: true,
75
- chronological: true,
76
- defaultSort: defaultSort,
77
- }"
78
- >
79
- <!-- :pager-config="gridPagerConfig" -->
80
- <!-- @page-change="pageChangeEvent" -->
81
- <template #matCode_header="{ column }">
82
- <div class="first-col">
83
- <div class="first-col-top">
84
- {{ column.title }}
85
- </div>
86
- <div class="first-col-bottom">
87
- <input style="width: 100%" />
88
- </div>
89
- </div>
90
- </template>
91
- <!-- 普通输入框的过滤筛选-->
92
- <template #text_filter="{ column }">
93
- <div class="interceptor-class">
94
- <div v-for="(item, $index) in column.filters" :key="$index">
95
- <a-input
96
- allowClear
97
- v-model="item.data"
98
- @keyup.enter.native="filterConfirm(column)"
99
- style="margin-bottom: 5px"
100
- />
101
- </div>
102
- <a-button @click="filterAddExp(column)">添加条件</a-button>
103
- <a-button @click="filterConfirm(column)">确认</a-button>
104
- </div>
105
- </template>
106
- <!-- 选择筛选框-->
107
- <template #select_filter="{ column }">
108
- <div class="interceptor-class">
109
- <a-checkbox-group
110
- v-model="column.filters[0].data"
111
- @keyup.enter.native="filterConfirm(column)"
112
- >
113
- <div style="max-height: 200px; overflow-y: scroll">
114
- <div
115
- style="text-align: left"
116
- v-for="loopSource in column.params.dataSource"
117
- :key="loopSource.value"
118
- >
119
- <a-checkbox
120
- :value="loopSource.value"
121
- style="margin: 5px 0"
122
- >{{ loopSource.caption }}
123
- </a-checkbox>
124
- </div>
125
- </div>
126
- </a-checkbox-group>
127
- <br />
128
- <a-button @click="filterConfirm(column)">确认</a-button>
129
- </div>
130
- </template>
131
- <template #pager>
132
- <a-row>
133
- <a-col :span="8">
134
- <a-button
135
- v-if="isMultiSelect === true"
136
- type="primary"
137
- size="small"
138
- style="margin: 5px"
139
- @click="multiSelectConfirm"
140
- >
141
- 确认选择
142
- </a-button>
143
- <a-button
144
- v-if="popupAddName"
145
- type="primary"
146
- size="small"
147
- style="margin: 5px"
148
- @click="pagerBtnClick(btn)"
149
- >
150
- 新增
151
- </a-button>
152
-
153
- <template v-if="optBtns.length > 0">
154
- <a-button
155
- v-for="btn in optBtns"
156
- :key="btn.field"
157
- type="primary"
158
- size="small"
159
- style="margin: 5px"
160
- @click="pagerBtnClick(btn)"
161
- >
162
- {{ btn.name }}
163
- </a-button>
164
- </template>
165
- </a-col>
166
- <a-col :span="16">
167
- <vxe-pager
168
- align="right"
169
- size="mini"
170
- :current-page.sync="gridPagerConfig.currentPage"
171
- :page-size.sync="gridPagerConfig.pageSize"
172
- :total="gridPagerConfig.total"
173
- @page-change="pageChangeEvent"
174
- >
175
- </vxe-pager>
176
- </a-col>
177
- </a-row>
178
- </template>
179
- </vxe-grid>
180
- </div>
181
- </template>
182
- </VxePulldown>
183
- <span v-if="edit === false">
184
- <a v-if="route" @click="routeLinkClick">{{ currentValue }}</a>
185
- <span v-else> {{ currentValue }}</span>
186
- </span>
187
- </div>
188
- <keep-alive>
189
- <div
190
- :is="popupAddName"
191
- ref="pupupAddView"
192
- @popupSaveAfter="popupSaveAfter"
193
- ></div>
194
- </keep-alive>
195
- </div>
196
- </template>
197
-
198
- <script>
199
- import XEUtils from 'xe-utils'
200
- import { sysRowState, sysFormState, controlType } from '../../utils/enum'
201
- import { replaceParamString, replaceParam } from '../../utils/common'
202
- import request from '../../utils/request'
203
- import { Input, Button, Row, Col, Checkbox } from 'ant-design-vue'
204
- import { ValidationProvider } from 'vee-validate'
205
- import { Pulldown } from 'vxe-table'
206
- import { Tooltip } from 'ant-design-vue'
207
- export default {
208
- name: 'BasePulldown',
209
- components: {
210
- 'a-input': Input,
211
- 'a-button': Button,
212
- 'a-row': Row,
213
- 'a-col': Col,
214
- 'a-checkbox': Checkbox,
215
- 'a-checkbox-group': Checkbox.Group,
216
- VxePulldown: Pulldown,
217
- ValidationProvider,
218
- Tooltip,
219
- },
220
- data() {
221
- return {
222
- fetchFields: '',
223
- internalColumns: [],
224
- isInputChanged: false,
225
- inputTimeout: null,
226
- searchRows: [],
227
- filterCols: [],
228
- gridLoading: false,
229
- gridPagerConfig: {
230
- total: 0,
231
- currentPage: 1,
232
- pageSize: 10,
233
- },
234
- sorts: [],
235
- defaultSort: [],
236
- filterExpression: {
237
- operator: 'and',
238
- expressions: [],
239
- },
240
- }
241
- },
242
- props: {
243
- labelWidth: {
244
- type: Number,
245
- default: function () {
246
- return 0
247
- },
248
- },
249
- isMultiSelect: {
250
- type: Boolean,
251
- default: function () {
252
- return false
253
- },
254
- },
255
- popupAddName: {
256
- type: String,
257
- default: function () {
258
- return null
259
- },
260
- },
261
- popupAddPath: {
262
- type: String,
263
- default: function () {
264
- return null
265
- },
266
- },
267
- rules: {
268
- type: Object,
269
- default: function () {
270
- return null
271
- },
272
- },
273
- showLabel: {
274
- type: Boolean,
275
- default: function () {
276
- return true
277
- },
278
- },
279
- label: {
280
- type: String,
281
- default: function () {
282
- return ''
283
- },
284
- },
285
- defaultExpression: {
286
- type: String,
287
- default: function () {
288
- return ''
289
- },
290
- },
291
- formRow: {
292
- type: Object,
293
- default: function () {
294
- return {}
295
- },
296
- },
297
- row: {
298
- type: Object,
299
- default: function () {
300
- return {}
301
- },
302
- },
303
- edit: {
304
- type: Boolean,
305
- default: function () {
306
- return false
307
- },
308
- },
309
- route: Object,
310
- placeholder: {
311
- // 提示信息
312
- type: String,
313
- },
314
- api: {
315
- // api接口
316
- type: String,
317
- },
318
- field: {
319
- type: String,
320
- },
321
- pageSize: {
322
- // 分页数量,默认不分页
323
- type: Number,
324
- default: () => {
325
- return 0
326
- },
327
- },
328
- columns: {
329
- // 列集合
330
- type: Array,
331
- default: () => {
332
- return []
333
- },
334
- },
335
- isOld: {
336
- // 列集合
337
- type: Boolean,
338
- default: () => {
339
- return false
340
- },
341
- },
342
- exps: {
343
- // 条件
344
- type: Array,
345
- default: () => {
346
- return []
347
- },
348
- },
349
- value: {
350
- type: String,
351
- default: function () {
352
- return ''
353
- },
354
- },
355
- optBtns: {
356
- // 操作按钮
357
- type: Array,
358
- default: () => {
359
- return []
360
- },
361
- },
362
- gridTable: {
363
- // 操作按钮
364
- type: Object,
365
- default: () => {
366
- return null
367
- },
368
- },
369
- immediate: {
370
- type: Boolean,
371
- default: true,
372
- },
373
- isLocalData: {
374
- type: Boolean,
375
- default: false,
376
- },
377
- tooltip: {
378
- type: String,
379
- default: function () {
380
- return ''
381
- },
382
- },
383
- propTableData: {
384
- type: Array,
385
- default: function () {
386
- return []
387
- },
388
- },
389
- contrasts: {
390
- type: Array,
391
- default: function () {
392
- return []
393
- },
394
- },
395
- allowAutoClear:{
396
- type:Boolean,
397
- default:function(){
398
- return true
399
- }
400
- }
401
- },
402
- watch: {},
403
- computed: {
404
- currentValue: {
405
- // 动态计算currentValue的值
406
- get: function () {
407
- return this.value // 将props中的value赋值给currentValue
408
- },
409
- set: function (val) {
410
- this.$emit('input', val) // 通过$emit触发父组件
411
- },
412
- },
413
- },
414
- created() {
415
- // if (this.popupAddName && !this.$options.components[this.popupAddName]) {
416
- // // const tempRequire = require('@/views' + this.popupAddPath + '.vue').default
417
- // // this.$options.components[this.popupAddName] = tempRequire
418
- // this.$options.components[this.popupAddName] = () =>
419
- // import('@/views' + this.popupAddPath + '.vue')
420
- // }
421
- this.gridPagerConfig.pageSize = this.pageSize
422
-
423
- this.internalColumns.push({
424
- type: 'seq',
425
- fixed: 'left',
426
- width: 50,
427
- })
428
-
429
- if (this.isMultiSelect === true) {
430
- this.internalColumns.push({
431
- type: 'checkbox',
432
- fixed: 'left',
433
- width: 40,
434
- })
435
- }
436
-
437
- for (let i = 0; i < this.columns.length; i++) {
438
- this.fetchFields = this.fetchFields + this.columns[i].field + ','
439
- this.columns[i]['params'] = {
440
- dataSource: [],
441
- }
442
- if (this.columns[i].dataSource) {
443
- this.columns[i]['params'].dataSource = this.columns[i].dataSource
444
- }
445
- if (!this.columns[i].width) {
446
- this.columns[i]['width'] = 100
447
- }
448
- if (this.columns[i].isCheckbox === true) {
449
- this.columns[i]['type'] = 'checkbox'
450
- }
451
- if (!this.columns[i].controlType) {
452
- this.columns[i].controlType = 'text'
453
- }
454
- // 设置字段的过滤插槽
455
- if (this.columns[i].filter) {
456
- this.columns[i]['filterMultiple'] = false
457
-
458
- switch (this.columns[i].controlType) {
459
- case 'checkbox':
460
- this.columns[i]['slots'] = {
461
- filter: `checkbox_filter`,
462
- }
463
- break
464
- case 'select':
465
- this.columns[i]['slots'] = {
466
- filter: `select_filter`,
467
- }
468
- this.columns[i]['filters'] = [
469
- {
470
- data: [],
471
- },
472
- ]
473
- break
474
- default:
475
- this.columns[i]['slots'] = {
476
- filter: `text_filter`,
477
- }
478
- this.columns[i]['filters'] = [
479
- {
480
- data: '',
481
- },
482
- ]
483
- break
484
- }
485
- }
486
- // 默认排序
487
- if (this.columns[i].defaultSort) {
488
- this.defaultSort.push({
489
- field: this.columns[i].field,
490
- order: this.columns[i].defaultSort,
491
- })
492
- this.sorts.push([this.columns[i].field, this.columns[i].defaultSort])
493
- }
494
- this.internalColumns.push(this.columns[i])
495
- if (this.columns[i].filter === true) {
496
- this.filterCols.push(this.columns[i])
497
- }
498
- }
499
- },
500
- methods: {
501
- gridRowStyle(scope) {
502
- if (scope.row.sysRepeat === true) {
503
- return 'row--pending'
504
- }
505
- // if(scope.row.)
506
- },
507
- clearInputValue() {
508
- if (this.isInputChanged === true&&this.allowAutoClear) {
509
- this.setLinkValue(null, this.row)
510
- this.$emit('selectChanged', null)
511
- }
512
- },
513
- routeLinkClick() {
514
- //首先需要判断是否有权限
515
- // let treeModule = XEUtils.findTree(
516
- // this.$store.getters.addRouters,
517
- // item => item.name === this.route.name
518
- // )
519
- // if (!treeModule) {
520
- // this.$antwarning('没有权限')
521
- // return
522
- // }
523
- this.$router.pushRoute({
524
- name: this.route.name,
525
- query: { id: this.row[this.route.field] },
526
- })
527
- },
528
- /**
529
- * 输入框改变事件
530
- */
531
- inputChangeEvent(event) {
532
- this.isInputChanged = true
533
- if (event.type === 'click' && event.pointerType === 'mouse') {
534
- //点击了清空按钮
535
- this.$nextTick(() => {
536
- this.clearInputValue()
537
- this.inputClickEvent(null)
538
- })
539
- }
540
- },
541
- inputBlurEvent(event) {},
542
- /**
543
- * 输入框获取焦点事件
544
- */
545
- inputFocusEvent(event) {
546
- event.currentTarget.select()
547
- // this.$refs.pulldownRef.showPanel()
548
- // this.searchData()
549
- },
550
- /**
551
- * Tab键隐藏面板
552
- */
553
- inputKeydownEvent(event) {
554
- if (event.keyCode === 9) {
555
- //tab事件
556
- this.$refs.pulldownRef.hidePanel()
557
- this.clearInputValue()
558
- }
559
- },
560
- inputClickEvent(event) {
561
- if (this.$refs.pulldownRef.isPanelVisible() === false) {
562
- this.$refs.pulldownRef.showPanel()
563
- this.clearColumnFilter()
564
- this.searchData()
565
- } else {
566
- this.$refs.pulldownRef.hidePanel()
567
- // 点击输入框隐藏panel时清空输入框
568
- this.currentValue = ''
569
- }
570
- },
571
- /**
572
- * 输入库输入事件
573
- */
574
- inputKeyupEvent(event) {
575
- //好像ok
576
- if (!this.immediate && event.keyCode !== 13) {
577
- console.debug('davistest')
578
- } else {
579
- if (this.inputTimeout) {
580
- clearTimeout(this.inputTimeout)
581
- }
582
- let vm = this
583
- this.inputTimeout = setTimeout(() => {
584
- //判断面板是否打开
585
- if (vm.$refs.pulldownRef.isPanelVisible() === false) {
586
- vm.$refs.pulldownRef.showPanel()
587
- }
588
- vm.searchData()
589
- }, 500)
590
- }
591
- },
592
- /**
593
- * 网格列选中事件
594
- */
595
- gridCellClick({ row, column }) {
596
- if (row.sysRepeat === true) {
597
- return
598
- }
599
- if (column.type === 'seq' || column.type === 'checkbox') {
600
- return
601
- }
602
- this.isInputChanged = false
603
- this.setLinkValue(row, this.row)
604
- this.$emit('selectChanged', row)
605
- this.$refs.pulldownRef.hidePanel()
606
- },
607
- setLinkValue(pulldownRow, oriRow) {
608
- for (let i = 0; i < this.internalColumns.length; i++) {
609
- if (this.internalColumns[i].linkField) {
610
- let tempLinkFields = this.internalColumns[i].linkField.split('.')
611
- let tempRow = oriRow
612
- // for(let j=0;j<tempLinkFields.length;j++){
613
- // let tempField = tempLinkFields[j]
614
- // //如果赋值的属性不存在数据集中,就忽略更新,防止修改后网格单元格值不更细
615
- // if (!(tempField in tempRow)) {
616
- // this.$antwarning(
617
- // '赋值字段[' + this.internalColumns[i].linkField + ']不存在'
618
- // )
619
- // break
620
- // }
621
- // if(j===tempLinkFields.length-1){
622
- // if (pulldownRow === null) {
623
- // if (this.internalColumns[i].nullClear === false) {
624
- // //是否空值清除数据,用于可选可输入的控件
625
- // continue
626
- // }
627
- // this.$set(tempRow, tempField, null)
628
- // } else {
629
- // this.$set(
630
- // tempRow,
631
- // tempField,
632
- // this.getLinkValue(tempField, pulldownRow)
633
- // )
634
- // }
635
- // }else{
636
- // tempRow = tempRow[tempField]
637
- // }
638
- // }
639
-
640
- //如果赋值的属性不存在数据集中,就忽略更新,防止修改后网格单元格值不更细
641
- if (!(this.internalColumns[i].linkField in oriRow)) {
642
- this.$antwarning(
643
- '赋值字段[' + this.internalColumns[i].linkField + ']不存在'
644
- )
645
- continue
646
- }
647
- if (pulldownRow === null) {
648
- if (this.internalColumns[i].nullClear === false) {
649
- //是否空值清楚数据,用于可选可输入的控件
650
- continue
651
- }
652
- this.$set(oriRow, this.internalColumns[i].linkField, null)
653
- } else {
654
- this.$set(
655
- oriRow,
656
- this.internalColumns[i].linkField,
657
- this.getLinkValue(this.internalColumns[i].field, pulldownRow)
658
- )
659
- }
660
- }
661
- }
662
- },
663
- getLinkValue(field, row) {
664
- let linkField = field.split('.')
665
- if (linkField.length > 1) {
666
- let fieldValue = row
667
- for (let i = 0; i < linkField.length; i++) {
668
- if (
669
- fieldValue[linkField[i]] === undefined ||
670
- fieldValue[linkField[i]] === null
671
- ) {
672
- return null
673
- }
674
- fieldValue = fieldValue[linkField[i]]
675
- }
676
- return fieldValue
677
- }
678
- return row[field]
679
- },
680
- /**
681
- * 左下角按钮点击事件
682
- */
683
- pagerBtnClick(btn) {
684
- this.$refs.pupupAddView.show()
685
- // this.$emit('pulldownBtnClick', btn)
686
- this.$refs.pulldownRef.hidePanel()
687
- },
688
- // 多选内容时,若数据不满足条件,不可选中
689
- checkMethod({ row }) {
690
- if (row.sysRepeat) {
691
- return false
692
- }
693
- return true
694
- },
695
- /**
696
- * 确认多选
697
- */
698
- multiSelectConfirm() {
699
- this.isInputChanged = false
700
- this.$emit(
701
- 'confirmMultiSelect',
702
- this,
703
- this.$refs.pupupGridView.getCheckboxRecords(true)
704
- )
705
- this.$refs.pulldownRef.hidePanel()
706
- },
707
- popupSaveAfter(pupupAddRowInfo) {
708
- let postData = {
709
- fields: null,
710
- begin: 1,
711
- size: 1,
712
- expression: {},
713
- sorts: '',
714
- }
715
- let tempKeyExp = XEUtils.find(
716
- this.internalColumns,
717
- (item) => item.isKey === true
718
- )
719
- postData.expression = {
720
- operator: 'and',
721
- expressions: [
722
- {
723
- operator: 'and',
724
- expressions: [
725
- {
726
- field: tempKeyExp.field,
727
- operator: 'EQ',
728
- value: pupupAddRowInfo['id'],
729
- },
730
- ],
731
- },
732
- ],
733
- }
734
- let vm = this
735
- let tempApi = this.getPostApi(postData)
736
- request({
737
- url: tempApi,
738
- method: 'post',
739
- data: postData,
740
- })
741
- .then((responseData) => {
742
- if (responseData.content.length > 0) {
743
- vm.setLinkValue(responseData.content[0], vm.row)
744
- vm.$emit('selectChanged', responseData.content[0])
745
- }
746
- })
747
- .catch((error) => {
748
- console.error(error)
749
- })
750
- .finally(() => {})
751
- },
752
- /**
753
- * 分页改变事件
754
- */
755
- pageChangeEvent({ currentPage, pageSize }) {
756
- this.gridPagerConfig.currentPage = currentPage
757
- this.gridPagerConfig.pageSize = pageSize
758
- this.searchData()
759
- },
760
- /**
761
- * 面板隐藏事件
762
- */
763
- pullDownHideEvent({ $event }) {
764
- this.clearInputValue()
765
- },
766
- /**
767
- * 查询数据
768
- */
769
- searchData() {
770
- if (this.isLocalData === true) {
771
- let tempSearch = {
772
- value: this.currentValue,
773
- dataSource: [],
774
- }
775
- this.$emit('preSearch', tempSearch)
776
- this.searchRows = tempSearch.dataSource
777
- this.gridPagerConfig.total = tempSearch.dataSource.length
778
- return
779
- }
780
-
781
- let tempExp = {
782
- operator: 'or',
783
- expressions: [],
784
- }
785
- if (this.isOld === true) {
786
- tempExp = ''
787
- }
788
- if (this.filterExpression.expressions.length > 0) {
789
- tempExp.expressions.push(this.filterExpression)
790
- } else if (this.currentValue) {
791
- for (let i = 0; i < this.filterCols.length; i++) {
792
- if (this.isOld === true) {
793
- tempExp =
794
- tempExp +
795
- this.filterCols[i].field +
796
- '.contains("' +
797
- this.currentValue +
798
- '")'
799
- if (i < this.filterCols.length - 1) {
800
- tempExp = tempExp + ' or '
801
- }
802
- } else {
803
- if (this.filterCols[i].controlType == 'number') {
804
- tempExp.expressions.push({
805
- field: this.filterCols[i].field,
806
- operator: 'EQ',
807
- value: Number(this.currentValue),
808
- })
809
- } else {
810
- tempExp.expressions.push({
811
- field: this.filterCols[i].field,
812
- operator: 'CO',
813
- value: this.currentValue,
814
- })
815
- }
816
- }
817
- }
818
- }
819
- if (this.isOld === true && tempExp.length > 0) {
820
- tempExp = '(' + tempExp + ')'
821
- }
822
-
823
- if (this.defaultExpression) {
824
- let tempDefault = replaceParamString(
825
- this.defaultExpression,
826
- this.formRow,
827
- this.$store.getters.moduleSelectItems[this.$route.meta.moduleId]
828
- )
829
-
830
- if (tempExp) {
831
- tempExp = tempExp + ' and (' + tempDefault + ')'
832
- } else {
833
- tempExp = tempDefault
834
- }
835
- }
836
-
837
- let postExpression = {
838
- field: this.field,
839
- expression: tempExp,
840
- extendParams: {},
841
- }
842
- let repeatRowInfo = {
843
- field: '',
844
- values: [],
845
- }
846
- //查询之前从外部组件构造其他的条件
847
- this.$emit('preSearch', postExpression, repeatRowInfo, this.row)
848
- let postData = {
849
- fields: this.fetchFields,
850
- begin:
851
- (this.gridPagerConfig.currentPage - 1) *
852
- this.gridPagerConfig.pageSize +
853
- 1,
854
- size: this.gridPagerConfig.pageSize,
855
- expression: postExpression.expression,
856
- sorts: this.sorts,
857
- extendParams: postExpression.extendParams,
858
- }
859
- // console.log(postData.sorts);
860
- let tempApi = this.getPostApi(postData)
861
-
862
- // let tempApi = this.api
863
- // if (this.api.indexOf('?') > 0) {
864
- // tempApi = this.api.substring(0, this.api.indexOf('?'))
865
- // let tempExtenParams = this.api.substring(this.api.indexOf('?') + 1)
866
- // tempExtenParams = replaceParam(tempExtenParams, this.formRow)
867
- // let tempSplitParams = tempExtenParams.split('&')
868
- // for (let i = 0; i < tempSplitParams.length; i++) {
869
- // let tempSplitValue = tempSplitParams[i].split('=')
870
- // this.$set(
871
- // postData.extendParams,
872
- // tempSplitValue[0],
873
- // tempSplitValue[1]
874
- // )
875
- // }
876
- // }
877
- let vm = this
878
- vm.gridLoading = true
879
- request({
880
- url: tempApi,
881
- method: 'post',
882
- data: postData,
883
- })
884
- .then((responseData) => {
885
- if (vm.isOld === true) {
886
- vm.searchRows = responseData.data
887
- vm.gridPagerConfig.total = responseData.extData.totalRows
888
- } else {
889
- vm.searchRows = responseData.content
890
- vm.$refs.pupupGridView.loadData(vm.searchRows)
891
- vm.gridPagerConfig.total = responseData.otherContent.totalRows
892
- }
893
- if (repeatRowInfo.field) {
894
- //设置重复值
895
- XEUtils.arrayEach(vm.searchRows, (item) => {
896
- if (
897
- XEUtils.arrayIndexOf(
898
- repeatRowInfo.values,
899
- item[repeatRowInfo.field]
900
- ) > -1
901
- ) {
902
- item['sysRepeat'] = true
903
- } else {
904
- item['sysRepeat'] = false
905
- }
906
- })
907
- }
908
- // 若当前表格内只有一行,则不进行判断
909
- if (vm.propTableData.length == 1) {
910
- return
911
- }
912
- // 设置字段sysRepeat后,所定字段的值全部相同则不可选择
913
- let fieldNames = vm.columns
914
- .filter((x) => x.sysRepeat)
915
- .map((y) => {
916
- return {
917
- field: y.field,
918
- linkField: y.linkField,
919
- }
920
- })
921
- if (fieldNames.length) {
922
- vm.searchRows.forEach((info) => {
923
- // 当一次创建多行时,过滤需特定字段不可为空的
924
- // 获取数组对象,根据选定字段,过滤选定字段都为空的
925
- let tempArr = vm.propTableData.filter((currentInfo) => {
926
- let tempD = []
927
- fieldNames.forEach((z) => {
928
- // 字段的值若为null、undefined,记录过滤掉
929
- if (!currentInfo[z.linkField]) {
930
- tempD.push(true)
931
- }
932
- })
933
- return tempD.length !== fieldNames.length
934
- })
935
- let arr = []
936
- // 分为有参查询和无参查询
937
- if (tempExp.expressions.length && fieldNames.length == 1) {
938
- for (let j = 0; j < fieldNames.length; j++) {
939
- let mapArr = tempArr.map(
940
- (item) => item[fieldNames[j].linkField]
941
- )
942
- let setArr = new Set(mapArr)
943
- if (setArr.size < mapArr.length) {
944
- arr.push(true)
945
- }
946
- }
947
- if (fieldNames.length === arr.length) {
948
- info.sysRepeat = true
949
- }
950
- } else {
951
- tempArr.forEach((item) => {
952
- // 接口字段可能和表字段field不一致,linkField一致
953
- for (let j = 0; j < fieldNames.length; j++) {
954
- if (
955
- info[fieldNames[j].field] == item[fieldNames[j].linkField]
956
- ) {
957
- arr.push(true)
958
- }
959
- }
960
- if (fieldNames.length === arr.length) {
961
- info.sysRepeat = true
962
- }
963
- })
964
- }
965
- if (info.sysRepeat && this.contrasts.length) {
966
- let flag = 0
967
- info.sysRepeat = false
968
- XEUtils.arrayEach(this.propTableData, (item) => {
969
- if (item[this.field] === info[this.field]) {
970
- XEUtils.arrayEach(this.contrasts, (loop) => {
971
- if (
972
- item[loop] === this.row[loop] &&
973
- item.id !== this.row.id
974
- ) {
975
- flag++
976
- }
977
- })
978
- }
979
- })
980
- if (flag === this.contrasts.length) {
981
- info.sysRepeat = true
982
- }
983
- }
984
- })
985
- }
986
- })
987
- .catch((error) => {
988
- console.error(error)
989
- })
990
- .finally(() => {
991
- vm.gridLoading = false
992
- })
993
- },
994
- getPostApi(postData) {
995
- let tempApi = this.api
996
- if (this.api.indexOf('?') > 0) {
997
- tempApi = this.api.substring(0, this.api.indexOf('?'))
998
- let tempExtenParams = this.api.substring(this.api.indexOf('?') + 1)
999
- tempExtenParams = replaceParam(tempExtenParams, this.formRow)
1000
- let tempSplitParams = tempExtenParams.split('&')
1001
- for (let i = 0; i < tempSplitParams.length; i++) {
1002
- let tempSplitValue = tempSplitParams[i].split('=')
1003
- this.$set(postData.extendParams, tempSplitValue[0], tempSplitValue[1])
1004
- }
1005
- }
1006
- return tempApi
1007
- },
1008
- sortChange({ column, property, order, sortBy, sortList, $event }) {
1009
- let currentSort = sortList.map((x) => {
1010
- return [x.field, x.order]
1011
- })
1012
- this.sorts = currentSort
1013
- this.searchData()
1014
- },
1015
-
1016
- // 下拉容器筛选条件被触发
1017
- filterVisible({ column }) {
1018
- XEUtils.remove(column.filters, (item) => {
1019
- return item.data === ''
1020
- })
1021
- if (column.filters.length === 0) {
1022
- column.filters.push({
1023
- data: '',
1024
- })
1025
- }
1026
- },
1027
- filterConfirm(column) {
1028
- let vm = this
1029
- this.filterExpression = {
1030
- operator: 'and',
1031
- expressions: [],
1032
- }
1033
- let col = this.columns.find((x) => x.field === column.field)
1034
- switch (col.controlType) {
1035
- case 'select':
1036
- column.filters[0].checked = column.filters[0].data.length > 0
1037
- break
1038
- default:
1039
- column.filters[0].checked = column.filters[0].data !== ''
1040
- break
1041
- }
1042
- //通知外部筛选改变事件
1043
- let columns = this.$refs.pupupGridView.getTableColumn().collectColumn
1044
- XEUtils.each(columns, (item) => {
1045
- let filterExpression = {
1046
- operator: 'or',
1047
- expressions: [],
1048
- }
1049
- if (!col.controlType) {
1050
- col.controlType = 'text'
1051
- }
1052
- switch (col.controlType) {
1053
- case 'select':
1054
- if (item.filters && item.filters[0].checked) {
1055
- XEUtils.each(item.filters[0].data, (loopItem) => {
1056
- filterExpression.expressions.push({
1057
- field: item.field,
1058
- operator: 'EQ',
1059
- value: loopItem,
1060
- })
1061
- })
1062
- if (filterExpression.expressions.length > 0) {
1063
- vm.filterExpression.expressions.push(filterExpression)
1064
- }
1065
- }
1066
- break
1067
- default:
1068
- if (item.filters && item.filters[0].checked) {
1069
- XEUtils.each(item.filters, (loopItem) => {
1070
- if (loopItem.data) {
1071
- filterExpression.expressions.push({
1072
- field: item.field,
1073
- operator: 'CO',
1074
- value: loopItem.data,
1075
- })
1076
- }
1077
- })
1078
- if (filterExpression.expressions.length > 0) {
1079
- vm.filterExpression.expressions.push(filterExpression)
1080
- }
1081
- }
1082
- break
1083
- }
1084
- })
1085
- this.gridPagerConfig.currentPage = 1
1086
- this.searchData()
1087
- this.$refs.pupupGridView.closeFilter()
1088
- },
1089
- // 添加筛选条件
1090
- filterAddExp(column) {
1091
- column['filters'].push({
1092
- data: '',
1093
- })
1094
- },
1095
-
1096
- // 清除筛选条件
1097
- clearColumnFilter() {
1098
- let columns = []
1099
- let vm = this
1100
- try {
1101
- columns = this.$refs.pupupGridView.getTableColumn().collectColumn
1102
- } catch (err) {
1103
- console.debug(err)
1104
- }
1105
- XEUtils.each(columns, (item) => {
1106
- let col = vm.columns.find((x) => x.field === item.field)
1107
- if (!col) {
1108
- return
1109
- }
1110
- if (!col.controlType) {
1111
- col.controlType = 'text'
1112
- }
1113
- switch (col.controlType) {
1114
- case 'select':
1115
- if (item.filters && item.filters[0].checked) {
1116
- item.filters = [
1117
- {
1118
- data: [],
1119
- },
1120
- ]
1121
- }
1122
- break
1123
- default:
1124
- if (item.filters && item.filters[0].checked) {
1125
- item.filters = [
1126
- {
1127
- data: '',
1128
- },
1129
- ]
1130
- }
1131
- break
1132
- }
1133
- })
1134
- this.filterExpression = {
1135
- operator: 'and',
1136
- expressions: [],
1137
- }
1138
- },
1139
- },
1140
- }
1141
- </script>
1142
-
1143
- <style lang="scss" scoped>
1144
- .pulldown-grid {
1145
- min-width: 600px;
1146
- width: auto;
1147
- height: 350px;
1148
- background-color: #fff;
1149
- box-shadow: 0 0 6px 2px rgba(0, 0, 0, 0.1);
1150
- }
1151
-
1152
- .d-grid-control {
1153
- height: 30px;
1154
- }
1155
- .interceptor-class {
1156
- padding: 10px;
1157
- ::v-deep .ant-btn {
1158
- margin: 10px 10px 0;
1159
- }
1160
- }
1161
- </style>
1162
-
1163
- <style lang="less">
1164
- @import '../../styles/default.less';
1165
- </style>
1
+ <template>
2
+ <div class="d-control-container">
3
+ <div
4
+ class="d-control-label"
5
+ v-if="showLabel === true"
6
+ :style="{ width: labelWidth > 0 ? labelWidth + 'px' : 'none' }"
7
+ >
8
+ {{ label }}
9
+ <span v-if="rules && rules['required']" class="d-control-label-required"
10
+ >*</span
11
+ >
12
+ <Tooltip :title="tooltip" v-if="tooltip" style="margin: 0 2px">
13
+ <img src="../../styles/icon/help.png" alt="" style="width: 14px" />
14
+ </Tooltip>
15
+ </div>
16
+ <div
17
+ :class="{
18
+ 'd-control': showLabel === true,
19
+ 'd-grid-control': showLabel === false,
20
+ }"
21
+ >
22
+ <VxePulldown
23
+ style="width: 100%"
24
+ @hide-panel="pullDownHideEvent"
25
+ ref="pulldownRef"
26
+ v-if="edit === true"
27
+ transfer
28
+ >
29
+ <template #default>
30
+ <ValidationProvider :name="label" v-slot="v" :rules="rules">
31
+ <a-input
32
+ :size="'small'"
33
+ allow-clear
34
+ @change="inputChangeEvent"
35
+ class="inner-cell-control"
36
+ v-model="currentValue"
37
+ @click="inputClickEvent"
38
+ @focus="inputFocusEvent"
39
+ @blur="inputBlurEvent"
40
+ @keydown="inputKeydownEvent"
41
+ @keyup="inputKeyupEvent"
42
+ :class="{ 'd-error-input': v.errors.length > 0 }"
43
+ ></a-input>
44
+ <div class="d-error-msg">
45
+ {{ v.errors[0] }}
46
+ </div>
47
+ </ValidationProvider>
48
+ </template>
49
+ <template #dropdown>
50
+ <div class="pulldown-grid interceptor-class">
51
+ <vxe-grid
52
+ size="mini"
53
+ border
54
+ :row-class-name="gridRowStyle"
55
+ highlight-current-row
56
+ :keyboard-config="{ isArrow: true }"
57
+ highlight-hover-row
58
+ auto-resize
59
+ resizable
60
+ :loading="gridLoading"
61
+ height="auto"
62
+ ref="pupupGridView"
63
+ :data="searchRows"
64
+ @cell-click="gridCellClick"
65
+ @filter-visible="filterVisible"
66
+ :columns="internalColumns"
67
+ :checkbox-config="{ checkMethod: checkMethod }"
68
+ @sort-change="sortChange"
69
+ :filter-config="{
70
+ remote: true,
71
+ }"
72
+ :sort-config="{
73
+ multiple: true,
74
+ remote: true,
75
+ chronological: true,
76
+ defaultSort: defaultSort,
77
+ }"
78
+ >
79
+ <!-- :pager-config="gridPagerConfig" -->
80
+ <!-- @page-change="pageChangeEvent" -->
81
+ <template #matCode_header="{ column }">
82
+ <div class="first-col">
83
+ <div class="first-col-top">
84
+ {{ column.title }}
85
+ </div>
86
+ <div class="first-col-bottom">
87
+ <input style="width: 100%" />
88
+ </div>
89
+ </div>
90
+ </template>
91
+ <!-- 普通输入框的过滤筛选-->
92
+ <template #text_filter="{ column }">
93
+ <div class="interceptor-class">
94
+ <div v-for="(item, $index) in column.filters" :key="$index">
95
+ <a-input
96
+ allowClear
97
+ v-model="item.data"
98
+ @keyup.enter.native="filterConfirm(column)"
99
+ style="margin-bottom: 5px"
100
+ />
101
+ </div>
102
+ <a-button @click="filterAddExp(column)">添加条件</a-button>
103
+ <a-button @click="filterConfirm(column)">确认</a-button>
104
+ </div>
105
+ </template>
106
+ <!-- 选择筛选框-->
107
+ <template #select_filter="{ column }">
108
+ <div class="interceptor-class">
109
+ <a-checkbox-group
110
+ v-model="column.filters[0].data"
111
+ @keyup.enter.native="filterConfirm(column)"
112
+ >
113
+ <div style="max-height: 200px; overflow-y: scroll">
114
+ <div
115
+ style="text-align: left"
116
+ v-for="loopSource in column.params.dataSource"
117
+ :key="loopSource.value"
118
+ >
119
+ <a-checkbox
120
+ :value="loopSource.value"
121
+ style="margin: 5px 0"
122
+ >{{ loopSource.caption }}
123
+ </a-checkbox>
124
+ </div>
125
+ </div>
126
+ </a-checkbox-group>
127
+ <br />
128
+ <a-button @click="filterConfirm(column)">确认</a-button>
129
+ </div>
130
+ </template>
131
+ <template #pager>
132
+ <a-row>
133
+ <a-col :span="8">
134
+ <a-button
135
+ v-if="isMultiSelect === true"
136
+ type="primary"
137
+ size="small"
138
+ style="margin: 5px"
139
+ @click="multiSelectConfirm"
140
+ >
141
+ 确认选择
142
+ </a-button>
143
+ <a-button
144
+ v-if="popupAddName"
145
+ type="primary"
146
+ size="small"
147
+ style="margin: 5px"
148
+ @click="pagerBtnClick(btn)"
149
+ >
150
+ 新增
151
+ </a-button>
152
+
153
+ <template v-if="optBtns.length > 0">
154
+ <a-button
155
+ v-for="btn in optBtns"
156
+ :key="btn.field"
157
+ type="primary"
158
+ size="small"
159
+ style="margin: 5px"
160
+ @click="pagerBtnClick(btn)"
161
+ >
162
+ {{ btn.name }}
163
+ </a-button>
164
+ </template>
165
+ </a-col>
166
+ <a-col :span="16">
167
+ <vxe-pager
168
+ align="right"
169
+ size="mini"
170
+ :current-page.sync="gridPagerConfig.currentPage"
171
+ :page-size.sync="gridPagerConfig.pageSize"
172
+ :total="gridPagerConfig.total"
173
+ @page-change="pageChangeEvent"
174
+ >
175
+ </vxe-pager>
176
+ </a-col>
177
+ </a-row>
178
+ </template>
179
+ </vxe-grid>
180
+ </div>
181
+ </template>
182
+ </VxePulldown>
183
+ <span v-if="edit === false">
184
+ <a v-if="route" @click="routeLinkClick">{{ currentValue }}</a>
185
+ <span v-else> {{ currentValue }}</span>
186
+ </span>
187
+ </div>
188
+ <keep-alive>
189
+ <div
190
+ :is="popupAddName"
191
+ ref="pupupAddView"
192
+ @popupSaveAfter="popupSaveAfter"
193
+ ></div>
194
+ </keep-alive>
195
+ </div>
196
+ </template>
197
+
198
+ <script>
199
+ import XEUtils from 'xe-utils'
200
+ import { sysRowState, sysFormState, controlType } from '../../utils/enum'
201
+ import { replaceParamString, replaceParam } from '../../utils/common'
202
+ import request from '../../utils/request'
203
+ import { Input, Button, Row, Col, Checkbox } from 'ant-design-vue'
204
+ import { ValidationProvider } from 'vee-validate'
205
+ import { Pulldown } from 'vxe-table'
206
+ import { Tooltip } from 'ant-design-vue'
207
+ export default {
208
+ name: 'BasePulldown',
209
+ components: {
210
+ 'a-input': Input,
211
+ 'a-button': Button,
212
+ 'a-row': Row,
213
+ 'a-col': Col,
214
+ 'a-checkbox': Checkbox,
215
+ 'a-checkbox-group': Checkbox.Group,
216
+ VxePulldown: Pulldown,
217
+ ValidationProvider,
218
+ Tooltip,
219
+ },
220
+ data() {
221
+ return {
222
+ fetchFields: '',
223
+ internalColumns: [],
224
+ isInputChanged: false,
225
+ inputTimeout: null,
226
+ searchRows: [],
227
+ filterCols: [],
228
+ gridLoading: false,
229
+ gridPagerConfig: {
230
+ total: 0,
231
+ currentPage: 1,
232
+ pageSize: 10,
233
+ },
234
+ sorts: [],
235
+ defaultSort: [],
236
+ filterExpression: {
237
+ operator: 'and',
238
+ expressions: [],
239
+ },
240
+ }
241
+ },
242
+ props: {
243
+ labelWidth: {
244
+ type: Number,
245
+ default: function () {
246
+ return 0
247
+ },
248
+ },
249
+ isMultiSelect: {
250
+ type: Boolean,
251
+ default: function () {
252
+ return false
253
+ },
254
+ },
255
+ popupAddName: {
256
+ type: String,
257
+ default: function () {
258
+ return null
259
+ },
260
+ },
261
+ popupAddPath: {
262
+ type: String,
263
+ default: function () {
264
+ return null
265
+ },
266
+ },
267
+ rules: {
268
+ type: Object,
269
+ default: function () {
270
+ return null
271
+ },
272
+ },
273
+ showLabel: {
274
+ type: Boolean,
275
+ default: function () {
276
+ return true
277
+ },
278
+ },
279
+ label: {
280
+ type: String,
281
+ default: function () {
282
+ return ''
283
+ },
284
+ },
285
+ defaultExpression: {
286
+ type: String,
287
+ default: function () {
288
+ return ''
289
+ },
290
+ },
291
+ formRow: {
292
+ type: Object,
293
+ default: function () {
294
+ return {}
295
+ },
296
+ },
297
+ row: {
298
+ type: Object,
299
+ default: function () {
300
+ return {}
301
+ },
302
+ },
303
+ edit: {
304
+ type: Boolean,
305
+ default: function () {
306
+ return false
307
+ },
308
+ },
309
+ route: Object,
310
+ placeholder: {
311
+ // 提示信息
312
+ type: String,
313
+ },
314
+ api: {
315
+ // api接口
316
+ type: String,
317
+ },
318
+ field: {
319
+ type: String,
320
+ },
321
+ pageSize: {
322
+ // 分页数量,默认不分页
323
+ type: Number,
324
+ default: () => {
325
+ return 0
326
+ },
327
+ },
328
+ columns: {
329
+ // 列集合
330
+ type: Array,
331
+ default: () => {
332
+ return []
333
+ },
334
+ },
335
+ isOld: {
336
+ // 列集合
337
+ type: Boolean,
338
+ default: () => {
339
+ return false
340
+ },
341
+ },
342
+ exps: {
343
+ // 条件
344
+ type: Array,
345
+ default: () => {
346
+ return []
347
+ },
348
+ },
349
+ value: {
350
+ type: String,
351
+ default: function () {
352
+ return ''
353
+ },
354
+ },
355
+ optBtns: {
356
+ // 操作按钮
357
+ type: Array,
358
+ default: () => {
359
+ return []
360
+ },
361
+ },
362
+ gridTable: {
363
+ // 操作按钮
364
+ type: Object,
365
+ default: () => {
366
+ return null
367
+ },
368
+ },
369
+ immediate: {
370
+ type: Boolean,
371
+ default: true,
372
+ },
373
+ isLocalData: {
374
+ type: Boolean,
375
+ default: false,
376
+ },
377
+ tooltip: {
378
+ type: String,
379
+ default: function () {
380
+ return ''
381
+ },
382
+ },
383
+ propTableData: {
384
+ type: Array,
385
+ default: function () {
386
+ return []
387
+ },
388
+ },
389
+ contrasts: {
390
+ type: Array,
391
+ default: function () {
392
+ return []
393
+ },
394
+ },
395
+ allowAutoClear:{
396
+ type:Boolean,
397
+ default:function(){
398
+ return true
399
+ }
400
+ }
401
+ },
402
+ watch: {},
403
+ computed: {
404
+ currentValue: {
405
+ // 动态计算currentValue的值
406
+ get: function () {
407
+ return this.value // 将props中的value赋值给currentValue
408
+ },
409
+ set: function (val) {
410
+ this.$emit('input', val) // 通过$emit触发父组件
411
+ },
412
+ },
413
+ },
414
+ created() {
415
+ // if (this.popupAddName && !this.$options.components[this.popupAddName]) {
416
+ // // const tempRequire = require('@/views' + this.popupAddPath + '.vue').default
417
+ // // this.$options.components[this.popupAddName] = tempRequire
418
+ // this.$options.components[this.popupAddName] = () =>
419
+ // import('@/views' + this.popupAddPath + '.vue')
420
+ // }
421
+ this.gridPagerConfig.pageSize = this.pageSize
422
+
423
+ this.internalColumns.push({
424
+ type: 'seq',
425
+ fixed: 'left',
426
+ width: 50,
427
+ })
428
+
429
+ if (this.isMultiSelect === true) {
430
+ this.internalColumns.push({
431
+ type: 'checkbox',
432
+ fixed: 'left',
433
+ width: 40,
434
+ })
435
+ }
436
+
437
+ for (let i = 0; i < this.columns.length; i++) {
438
+ this.fetchFields = this.fetchFields + this.columns[i].field + ','
439
+ this.columns[i]['params'] = {
440
+ dataSource: [],
441
+ }
442
+ if (this.columns[i].dataSource) {
443
+ this.columns[i]['params'].dataSource = this.columns[i].dataSource
444
+ }
445
+ if (!this.columns[i].width) {
446
+ this.columns[i]['width'] = 100
447
+ }
448
+ if (this.columns[i].isCheckbox === true) {
449
+ this.columns[i]['type'] = 'checkbox'
450
+ }
451
+ if (!this.columns[i].controlType) {
452
+ this.columns[i].controlType = 'text'
453
+ }
454
+ // 设置字段的过滤插槽
455
+ if (this.columns[i].filter) {
456
+ this.columns[i]['filterMultiple'] = false
457
+
458
+ switch (this.columns[i].controlType) {
459
+ case 'checkbox':
460
+ this.columns[i]['slots'] = {
461
+ filter: `checkbox_filter`,
462
+ }
463
+ break
464
+ case 'select':
465
+ this.columns[i]['slots'] = {
466
+ filter: `select_filter`,
467
+ }
468
+ this.columns[i]['filters'] = [
469
+ {
470
+ data: [],
471
+ },
472
+ ]
473
+ break
474
+ default:
475
+ this.columns[i]['slots'] = {
476
+ filter: `text_filter`,
477
+ }
478
+ this.columns[i]['filters'] = [
479
+ {
480
+ data: '',
481
+ },
482
+ ]
483
+ break
484
+ }
485
+ }
486
+ // 默认排序
487
+ if (this.columns[i].defaultSort) {
488
+ this.defaultSort.push({
489
+ field: this.columns[i].field,
490
+ order: this.columns[i].defaultSort,
491
+ })
492
+ this.sorts.push([this.columns[i].field, this.columns[i].defaultSort])
493
+ }
494
+ this.internalColumns.push(this.columns[i])
495
+ if (this.columns[i].filter === true) {
496
+ this.filterCols.push(this.columns[i])
497
+ }
498
+ }
499
+ },
500
+ methods: {
501
+ gridRowStyle(scope) {
502
+ if (scope.row.sysRepeat === true) {
503
+ return 'row--pending'
504
+ }
505
+ // if(scope.row.)
506
+ },
507
+ clearInputValue() {
508
+ if (this.isInputChanged === true&&this.allowAutoClear) {
509
+ this.setLinkValue(null, this.row)
510
+ this.$emit('selectChanged', null)
511
+ }
512
+ },
513
+ routeLinkClick() {
514
+ //首先需要判断是否有权限
515
+ // let treeModule = XEUtils.findTree(
516
+ // this.$store.getters.addRouters,
517
+ // item => item.name === this.route.name
518
+ // )
519
+ // if (!treeModule) {
520
+ // this.$antwarning('没有权限')
521
+ // return
522
+ // }
523
+ this.$router.pushRoute({
524
+ name: this.route.name,
525
+ query: { id: this.row[this.route.field] },
526
+ })
527
+ },
528
+ /**
529
+ * 输入框改变事件
530
+ */
531
+ inputChangeEvent(event) {
532
+ this.isInputChanged = true
533
+ if (event.type === 'click' && event.pointerType === 'mouse') {
534
+ //点击了清空按钮
535
+ this.$nextTick(() => {
536
+ this.clearInputValue()
537
+ this.inputClickEvent(null)
538
+ })
539
+ }
540
+ },
541
+ inputBlurEvent(event) {},
542
+ /**
543
+ * 输入框获取焦点事件
544
+ */
545
+ inputFocusEvent(event) {
546
+ event.currentTarget.select()
547
+ // this.$refs.pulldownRef.showPanel()
548
+ // this.searchData()
549
+ },
550
+ /**
551
+ * Tab键隐藏面板
552
+ */
553
+ inputKeydownEvent(event) {
554
+ if (event.keyCode === 9) {
555
+ //tab事件
556
+ this.$refs.pulldownRef.hidePanel()
557
+ this.clearInputValue()
558
+ }
559
+ },
560
+ inputClickEvent(event) {
561
+ if (this.$refs.pulldownRef.isPanelVisible() === false) {
562
+ this.$refs.pulldownRef.showPanel()
563
+ this.clearColumnFilter()
564
+ this.searchData()
565
+ } else {
566
+ this.$refs.pulldownRef.hidePanel()
567
+ // 点击输入框隐藏panel时清空输入框
568
+ this.currentValue = ''
569
+ }
570
+ },
571
+ /**
572
+ * 输入库输入事件
573
+ */
574
+ inputKeyupEvent(event) {
575
+ //好像ok
576
+ if (!this.immediate && event.keyCode !== 13) {
577
+ console.debug('davistest')
578
+ } else {
579
+ if (this.inputTimeout) {
580
+ clearTimeout(this.inputTimeout)
581
+ }
582
+ let vm = this
583
+ this.inputTimeout = setTimeout(() => {
584
+ //判断面板是否打开
585
+ if (vm.$refs.pulldownRef.isPanelVisible() === false) {
586
+ vm.$refs.pulldownRef.showPanel()
587
+ }
588
+ vm.searchData()
589
+ }, 500)
590
+ }
591
+ },
592
+ /**
593
+ * 网格列选中事件
594
+ */
595
+ gridCellClick({ row, column }) {
596
+ if (row.sysRepeat === true) {
597
+ return
598
+ }
599
+ if (column.type === 'seq' || column.type === 'checkbox') {
600
+ return
601
+ }
602
+ this.isInputChanged = false
603
+ this.setLinkValue(row, this.row)
604
+ this.$emit('selectChanged', row)
605
+ this.$refs.pulldownRef.hidePanel()
606
+ },
607
+ setLinkValue(pulldownRow, oriRow) {
608
+ for (let i = 0; i < this.internalColumns.length; i++) {
609
+ if (this.internalColumns[i].linkField) {
610
+ let tempLinkFields = this.internalColumns[i].linkField.split('.')
611
+ let tempRow = oriRow
612
+ // for(let j=0;j<tempLinkFields.length;j++){
613
+ // let tempField = tempLinkFields[j]
614
+ // //如果赋值的属性不存在数据集中,就忽略更新,防止修改后网格单元格值不更细
615
+ // if (!(tempField in tempRow)) {
616
+ // this.$antwarning(
617
+ // '赋值字段[' + this.internalColumns[i].linkField + ']不存在'
618
+ // )
619
+ // break
620
+ // }
621
+ // if(j===tempLinkFields.length-1){
622
+ // if (pulldownRow === null) {
623
+ // if (this.internalColumns[i].nullClear === false) {
624
+ // //是否空值清除数据,用于可选可输入的控件
625
+ // continue
626
+ // }
627
+ // this.$set(tempRow, tempField, null)
628
+ // } else {
629
+ // this.$set(
630
+ // tempRow,
631
+ // tempField,
632
+ // this.getLinkValue(tempField, pulldownRow)
633
+ // )
634
+ // }
635
+ // }else{
636
+ // tempRow = tempRow[tempField]
637
+ // }
638
+ // }
639
+
640
+ //如果赋值的属性不存在数据集中,就忽略更新,防止修改后网格单元格值不更细
641
+ if (!(this.internalColumns[i].linkField in oriRow)) {
642
+ this.$antwarning(
643
+ '赋值字段[' + this.internalColumns[i].linkField + ']不存在'
644
+ )
645
+ continue
646
+ }
647
+ if (pulldownRow === null) {
648
+ if (this.internalColumns[i].nullClear === false) {
649
+ //是否空值清楚数据,用于可选可输入的控件
650
+ continue
651
+ }
652
+ this.$set(oriRow, this.internalColumns[i].linkField, null)
653
+ } else {
654
+ this.$set(
655
+ oriRow,
656
+ this.internalColumns[i].linkField,
657
+ this.getLinkValue(this.internalColumns[i].field, pulldownRow)
658
+ )
659
+ }
660
+ }
661
+ }
662
+ },
663
+ getLinkValue(field, row) {
664
+ let linkField = field.split('.')
665
+ if (linkField.length > 1) {
666
+ let fieldValue = row
667
+ for (let i = 0; i < linkField.length; i++) {
668
+ if (
669
+ fieldValue[linkField[i]] === undefined ||
670
+ fieldValue[linkField[i]] === null
671
+ ) {
672
+ return null
673
+ }
674
+ fieldValue = fieldValue[linkField[i]]
675
+ }
676
+ return fieldValue
677
+ }
678
+ return row[field]
679
+ },
680
+ /**
681
+ * 左下角按钮点击事件
682
+ */
683
+ pagerBtnClick(btn) {
684
+ this.$refs.pupupAddView.show()
685
+ // this.$emit('pulldownBtnClick', btn)
686
+ this.$refs.pulldownRef.hidePanel()
687
+ },
688
+ // 多选内容时,若数据不满足条件,不可选中
689
+ checkMethod({ row }) {
690
+ if (row.sysRepeat) {
691
+ return false
692
+ }
693
+ return true
694
+ },
695
+ /**
696
+ * 确认多选
697
+ */
698
+ multiSelectConfirm() {
699
+ this.isInputChanged = false
700
+ this.$emit(
701
+ 'confirmMultiSelect',
702
+ this,
703
+ this.$refs.pupupGridView.getCheckboxRecords(true)
704
+ )
705
+ this.$refs.pulldownRef.hidePanel()
706
+ },
707
+ popupSaveAfter(pupupAddRowInfo) {
708
+ let postData = {
709
+ fields: null,
710
+ begin: 1,
711
+ size: 1,
712
+ expression: {},
713
+ sorts: '',
714
+ }
715
+ let tempKeyExp = XEUtils.find(
716
+ this.internalColumns,
717
+ (item) => item.isKey === true
718
+ )
719
+ postData.expression = {
720
+ operator: 'and',
721
+ expressions: [
722
+ {
723
+ operator: 'and',
724
+ expressions: [
725
+ {
726
+ field: tempKeyExp.field,
727
+ operator: 'EQ',
728
+ value: pupupAddRowInfo['id'],
729
+ },
730
+ ],
731
+ },
732
+ ],
733
+ }
734
+ let vm = this
735
+ let tempApi = this.getPostApi(postData)
736
+ request({
737
+ url: tempApi,
738
+ method: 'post',
739
+ data: postData,
740
+ })
741
+ .then((responseData) => {
742
+ if (responseData.content.length > 0) {
743
+ vm.setLinkValue(responseData.content[0], vm.row)
744
+ vm.$emit('selectChanged', responseData.content[0])
745
+ }
746
+ })
747
+ .catch((error) => {
748
+ console.error(error)
749
+ })
750
+ .finally(() => {})
751
+ },
752
+ /**
753
+ * 分页改变事件
754
+ */
755
+ pageChangeEvent({ currentPage, pageSize }) {
756
+ this.gridPagerConfig.currentPage = currentPage
757
+ this.gridPagerConfig.pageSize = pageSize
758
+ this.searchData()
759
+ },
760
+ /**
761
+ * 面板隐藏事件
762
+ */
763
+ pullDownHideEvent({ $event }) {
764
+ this.clearInputValue()
765
+ },
766
+ /**
767
+ * 查询数据
768
+ */
769
+ searchData() {
770
+ if (this.isLocalData === true) {
771
+ let tempSearch = {
772
+ value: this.currentValue,
773
+ dataSource: [],
774
+ }
775
+ this.$emit('preSearch', tempSearch)
776
+ this.searchRows = tempSearch.dataSource
777
+ this.gridPagerConfig.total = tempSearch.dataSource.length
778
+ return
779
+ }
780
+
781
+ let tempExp = {
782
+ operator: 'or',
783
+ expressions: [],
784
+ }
785
+ if (this.isOld === true) {
786
+ tempExp = ''
787
+ }
788
+ if (this.filterExpression.expressions.length > 0) {
789
+ tempExp.expressions.push(this.filterExpression)
790
+ } else if (this.currentValue) {
791
+ for (let i = 0; i < this.filterCols.length; i++) {
792
+ if (this.isOld === true) {
793
+ tempExp =
794
+ tempExp +
795
+ this.filterCols[i].field +
796
+ '.contains("' +
797
+ this.currentValue +
798
+ '")'
799
+ if (i < this.filterCols.length - 1) {
800
+ tempExp = tempExp + ' or '
801
+ }
802
+ } else {
803
+ if (this.filterCols[i].controlType == 'number') {
804
+ tempExp.expressions.push({
805
+ field: this.filterCols[i].field,
806
+ operator: 'EQ',
807
+ value: Number(this.currentValue),
808
+ })
809
+ } else {
810
+ tempExp.expressions.push({
811
+ field: this.filterCols[i].field,
812
+ operator: 'CO',
813
+ value: this.currentValue,
814
+ })
815
+ }
816
+ }
817
+ }
818
+ }
819
+ if (this.isOld === true && tempExp.length > 0) {
820
+ tempExp = '(' + tempExp + ')'
821
+ }
822
+
823
+ if (this.defaultExpression) {
824
+ let tempDefault = replaceParamString(
825
+ this.defaultExpression,
826
+ this.formRow,
827
+ this.$store.getters.moduleSelectItems[this.$route.meta.moduleId]
828
+ )
829
+
830
+ if (tempExp) {
831
+ tempExp = tempExp + ' and (' + tempDefault + ')'
832
+ } else {
833
+ tempExp = tempDefault
834
+ }
835
+ }
836
+
837
+ let postExpression = {
838
+ field: this.field,
839
+ expression: tempExp,
840
+ extendParams: {},
841
+ }
842
+ let repeatRowInfo = {
843
+ field: '',
844
+ values: [],
845
+ }
846
+ //查询之前从外部组件构造其他的条件
847
+ this.$emit('preSearch', postExpression, repeatRowInfo, this.row)
848
+ let postData = {
849
+ fields: this.fetchFields,
850
+ begin:
851
+ (this.gridPagerConfig.currentPage - 1) *
852
+ this.gridPagerConfig.pageSize +
853
+ 1,
854
+ size: this.gridPagerConfig.pageSize,
855
+ expression: postExpression.expression,
856
+ sorts: this.sorts,
857
+ extendParams: postExpression.extendParams,
858
+ }
859
+ // console.log(postData.sorts);
860
+ let tempApi = this.getPostApi(postData)
861
+
862
+ // let tempApi = this.api
863
+ // if (this.api.indexOf('?') > 0) {
864
+ // tempApi = this.api.substring(0, this.api.indexOf('?'))
865
+ // let tempExtenParams = this.api.substring(this.api.indexOf('?') + 1)
866
+ // tempExtenParams = replaceParam(tempExtenParams, this.formRow)
867
+ // let tempSplitParams = tempExtenParams.split('&')
868
+ // for (let i = 0; i < tempSplitParams.length; i++) {
869
+ // let tempSplitValue = tempSplitParams[i].split('=')
870
+ // this.$set(
871
+ // postData.extendParams,
872
+ // tempSplitValue[0],
873
+ // tempSplitValue[1]
874
+ // )
875
+ // }
876
+ // }
877
+ let vm = this
878
+ vm.gridLoading = true
879
+ request({
880
+ url: tempApi,
881
+ method: 'post',
882
+ data: postData,
883
+ })
884
+ .then((responseData) => {
885
+ if (vm.isOld === true) {
886
+ vm.searchRows = responseData.data
887
+ vm.gridPagerConfig.total = responseData.extData.totalRows
888
+ } else {
889
+ vm.searchRows = responseData.content
890
+ vm.$refs.pupupGridView.loadData(vm.searchRows)
891
+ vm.gridPagerConfig.total = responseData.otherContent.totalRows
892
+ }
893
+ if (repeatRowInfo.field) {
894
+ //设置重复值
895
+ XEUtils.arrayEach(vm.searchRows, (item) => {
896
+ if (
897
+ XEUtils.arrayIndexOf(
898
+ repeatRowInfo.values,
899
+ item[repeatRowInfo.field]
900
+ ) > -1
901
+ ) {
902
+ item['sysRepeat'] = true
903
+ } else {
904
+ item['sysRepeat'] = false
905
+ }
906
+ })
907
+ }
908
+ // 若当前表格内只有一行,则不进行判断
909
+ if (vm.propTableData.length == 1) {
910
+ return
911
+ }
912
+ // 设置字段sysRepeat后,所定字段的值全部相同则不可选择
913
+ let fieldNames = vm.columns
914
+ .filter((x) => x.sysRepeat)
915
+ .map((y) => {
916
+ return {
917
+ field: y.field,
918
+ linkField: y.linkField,
919
+ }
920
+ })
921
+ if (fieldNames.length) {
922
+ vm.searchRows.forEach((info) => {
923
+ // 当一次创建多行时,过滤需特定字段不可为空的
924
+ // 获取数组对象,根据选定字段,过滤选定字段都为空的
925
+ let tempArr = vm.propTableData.filter((currentInfo) => {
926
+ let tempD = []
927
+ fieldNames.forEach((z) => {
928
+ // 字段的值若为null、undefined,记录过滤掉
929
+ if (!currentInfo[z.linkField]) {
930
+ tempD.push(true)
931
+ }
932
+ })
933
+ return tempD.length !== fieldNames.length
934
+ })
935
+ let arr = []
936
+ // 分为有参查询和无参查询
937
+ if (tempExp.expressions.length && fieldNames.length == 1) {
938
+ for (let j = 0; j < fieldNames.length; j++) {
939
+ let mapArr = tempArr.map(
940
+ (item) => item[fieldNames[j].linkField]
941
+ )
942
+ let setArr = new Set(mapArr)
943
+ if (setArr.size < mapArr.length) {
944
+ arr.push(true)
945
+ }
946
+ }
947
+ if (fieldNames.length === arr.length) {
948
+ info.sysRepeat = true
949
+ }
950
+ } else {
951
+ tempArr.forEach((item) => {
952
+ // 接口字段可能和表字段field不一致,linkField一致
953
+ for (let j = 0; j < fieldNames.length; j++) {
954
+ if (
955
+ info[fieldNames[j].field] == item[fieldNames[j].linkField]
956
+ ) {
957
+ arr.push(true)
958
+ }
959
+ }
960
+ if (fieldNames.length === arr.length) {
961
+ info.sysRepeat = true
962
+ }
963
+ })
964
+ }
965
+ if (info.sysRepeat && this.contrasts.length) {
966
+ let flag = 0
967
+ info.sysRepeat = false
968
+ XEUtils.arrayEach(this.propTableData, (item) => {
969
+ if (item[this.field] === info[this.field]) {
970
+ XEUtils.arrayEach(this.contrasts, (loop) => {
971
+ if (
972
+ item[loop] === this.row[loop] &&
973
+ item.id !== this.row.id
974
+ ) {
975
+ flag++
976
+ }
977
+ })
978
+ }
979
+ })
980
+ if (flag === this.contrasts.length) {
981
+ info.sysRepeat = true
982
+ }
983
+ }
984
+ })
985
+ }
986
+ })
987
+ .catch((error) => {
988
+ console.error(error)
989
+ })
990
+ .finally(() => {
991
+ vm.gridLoading = false
992
+ })
993
+ },
994
+ getPostApi(postData) {
995
+ let tempApi = this.api
996
+ if (this.api.indexOf('?') > 0) {
997
+ tempApi = this.api.substring(0, this.api.indexOf('?'))
998
+ let tempExtenParams = this.api.substring(this.api.indexOf('?') + 1)
999
+ tempExtenParams = replaceParam(tempExtenParams, this.formRow)
1000
+ let tempSplitParams = tempExtenParams.split('&')
1001
+ for (let i = 0; i < tempSplitParams.length; i++) {
1002
+ let tempSplitValue = tempSplitParams[i].split('=')
1003
+ this.$set(postData.extendParams, tempSplitValue[0], tempSplitValue[1])
1004
+ }
1005
+ }
1006
+ return tempApi
1007
+ },
1008
+ sortChange({ column, property, order, sortBy, sortList, $event }) {
1009
+ let currentSort = sortList.map((x) => {
1010
+ return [x.field, x.order]
1011
+ })
1012
+ this.sorts = currentSort
1013
+ this.searchData()
1014
+ },
1015
+
1016
+ // 下拉容器筛选条件被触发
1017
+ filterVisible({ column }) {
1018
+ XEUtils.remove(column.filters, (item) => {
1019
+ return item.data === ''
1020
+ })
1021
+ if (column.filters.length === 0) {
1022
+ column.filters.push({
1023
+ data: '',
1024
+ })
1025
+ }
1026
+ },
1027
+ filterConfirm(column) {
1028
+ let vm = this
1029
+ this.filterExpression = {
1030
+ operator: 'and',
1031
+ expressions: [],
1032
+ }
1033
+ let col = this.columns.find((x) => x.field === column.field)
1034
+ switch (col.controlType) {
1035
+ case 'select':
1036
+ column.filters[0].checked = column.filters[0].data.length > 0
1037
+ break
1038
+ default:
1039
+ column.filters[0].checked = column.filters[0].data !== ''
1040
+ break
1041
+ }
1042
+ //通知外部筛选改变事件
1043
+ let columns = this.$refs.pupupGridView.getTableColumn().collectColumn
1044
+ XEUtils.each(columns, (item) => {
1045
+ let filterExpression = {
1046
+ operator: 'or',
1047
+ expressions: [],
1048
+ }
1049
+ if (!col.controlType) {
1050
+ col.controlType = 'text'
1051
+ }
1052
+ switch (col.controlType) {
1053
+ case 'select':
1054
+ if (item.filters && item.filters[0].checked) {
1055
+ XEUtils.each(item.filters[0].data, (loopItem) => {
1056
+ filterExpression.expressions.push({
1057
+ field: item.field,
1058
+ operator: 'EQ',
1059
+ value: loopItem,
1060
+ })
1061
+ })
1062
+ if (filterExpression.expressions.length > 0) {
1063
+ vm.filterExpression.expressions.push(filterExpression)
1064
+ }
1065
+ }
1066
+ break
1067
+ default:
1068
+ if (item.filters && item.filters[0].checked) {
1069
+ XEUtils.each(item.filters, (loopItem) => {
1070
+ if (loopItem.data) {
1071
+ filterExpression.expressions.push({
1072
+ field: item.field,
1073
+ operator: 'CO',
1074
+ value: loopItem.data,
1075
+ })
1076
+ }
1077
+ })
1078
+ if (filterExpression.expressions.length > 0) {
1079
+ vm.filterExpression.expressions.push(filterExpression)
1080
+ }
1081
+ }
1082
+ break
1083
+ }
1084
+ })
1085
+ this.gridPagerConfig.currentPage = 1
1086
+ this.searchData()
1087
+ this.$refs.pupupGridView.closeFilter()
1088
+ },
1089
+ // 添加筛选条件
1090
+ filterAddExp(column) {
1091
+ column['filters'].push({
1092
+ data: '',
1093
+ })
1094
+ },
1095
+
1096
+ // 清除筛选条件
1097
+ clearColumnFilter() {
1098
+ let columns = []
1099
+ let vm = this
1100
+ try {
1101
+ columns = this.$refs.pupupGridView.getTableColumn().collectColumn
1102
+ } catch (err) {
1103
+ console.debug(err)
1104
+ }
1105
+ XEUtils.each(columns, (item) => {
1106
+ let col = vm.columns.find((x) => x.field === item.field)
1107
+ if (!col) {
1108
+ return
1109
+ }
1110
+ if (!col.controlType) {
1111
+ col.controlType = 'text'
1112
+ }
1113
+ switch (col.controlType) {
1114
+ case 'select':
1115
+ if (item.filters && item.filters[0].checked) {
1116
+ item.filters = [
1117
+ {
1118
+ data: [],
1119
+ },
1120
+ ]
1121
+ }
1122
+ break
1123
+ default:
1124
+ if (item.filters && item.filters[0].checked) {
1125
+ item.filters = [
1126
+ {
1127
+ data: '',
1128
+ },
1129
+ ]
1130
+ }
1131
+ break
1132
+ }
1133
+ })
1134
+ this.filterExpression = {
1135
+ operator: 'and',
1136
+ expressions: [],
1137
+ }
1138
+ },
1139
+ },
1140
+ }
1141
+ </script>
1142
+
1143
+ <style lang="scss" scoped>
1144
+ .pulldown-grid {
1145
+ min-width: 600px;
1146
+ width: auto;
1147
+ height: 350px;
1148
+ background-color: #fff;
1149
+ box-shadow: 0 0 6px 2px rgba(0, 0, 0, 0.1);
1150
+ }
1151
+
1152
+ .d-grid-control {
1153
+ height: 30px;
1154
+ }
1155
+ .interceptor-class {
1156
+ padding: 10px;
1157
+ ::v-deep .ant-btn {
1158
+ margin: 10px 10px 0;
1159
+ }
1160
+ }
1161
+ </style>
1162
+
1163
+ <style lang="less">
1164
+ @import '../../styles/default.less';
1165
+ </style>