@tongfun/tf-widget 0.1.20 → 0.1.21

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 (94) hide show
  1. package/README.md +49 -46
  2. package/lib/tf-widget.common.js +460 -416
  3. package/lib/tf-widget.css +1 -1
  4. package/lib/tf-widget.umd.js +460 -416
  5. package/lib/tf-widget.umd.min.js +3 -3
  6. package/package/svg-icon/index.js +8 -8
  7. package/package/svg-icon/src/SvgIcon.vue +59 -59
  8. package/package/t-data-list/index.js +6 -6
  9. package/package/t-data-list/main.vue +193 -193
  10. package/package/t-data-list/src/condition-input/basic.vue +31 -31
  11. package/package/t-data-list/src/condition-input/date.vue +106 -106
  12. package/package/t-data-list/src/condition-input/index.vue +100 -100
  13. package/package/t-data-list/src/condition-input/input.vue +31 -31
  14. package/package/t-data-list/src/condition-input/number.vue +115 -115
  15. package/package/t-data-list/src/condition-input/select.vue +86 -86
  16. package/package/t-data-list/src/js/fieldTypeEnum.js +10 -10
  17. package/package/t-data-list/src/js/operatorEnum.js +108 -108
  18. package/package/t-data-list/src/js/qureyParamsEnum.js +4 -4
  19. package/package/t-data-list/src/js/util.js +34 -34
  20. package/package/t-data-list/src/mixins/button-controll-mixin.js +93 -93
  21. package/package/t-data-list/src/pushdown/push-down.vue +158 -158
  22. package/package/t-data-list/src/t-list-search.vue +36 -36
  23. package/package/t-data-list/src/t-plan/condition-always-item.vue +143 -143
  24. package/package/t-data-list/src/t-plan/condition-mult-item.vue +222 -222
  25. package/package/t-data-list/src/t-plan/index.vue +195 -195
  26. package/package/t-data-list/src/t-plan/plan-content.vue +389 -389
  27. package/package/t-data-list/src/t-table/index.vue +129 -129
  28. package/package/t-data-list/src/t-table/table-group-item-edit.vue +238 -238
  29. package/package/t-data-list/src/t-table/table-group-item.vue +87 -87
  30. package/package/t-data-list/src/t-table/table-group.vue +180 -180
  31. package/package/t-data-list/src/t-table/table-records-header-popover.vue +246 -246
  32. package/package/t-data-list/src/t-table/table-records-selected.vue +159 -159
  33. package/package/t-data-list/src/t-table/table-records.vue +337 -337
  34. package/package/t-input/children/address.vue +101 -101
  35. package/package/t-input/children/basic-display.vue +41 -41
  36. package/package/t-input/children/basic.vue +253 -253
  37. package/package/t-input/children/date.vue +89 -89
  38. package/package/t-input/children/group-components/group-dialog.vue +344 -344
  39. package/package/t-input/children/group.vue +126 -126
  40. package/package/t-input/children/input.vue +72 -72
  41. package/package/t-input/children/number.vue +74 -74
  42. package/package/t-input/children/select.vue +89 -89
  43. package/package/t-input/children/tfile/fiile-enclosure.vue +233 -233
  44. package/package/t-input/index.js +7 -7
  45. package/package/t-input/index.vue +337 -337
  46. package/package/t-input/tInputCache.js +24 -24
  47. package/package/tf-icon-picker/README.md +7 -7
  48. package/package/tf-icon-picker/index.js +8 -8
  49. package/package/tf-icon-picker/src/tf-icon-picker.vue +266 -266
  50. package/package/tf-layout/README.md +115 -115
  51. package/package/tf-layout/index.js +8 -8
  52. package/package/tf-layout/src/components/tf-labelbar.vue +394 -382
  53. package/package/tf-layout/src/components/tf-menu.vue +180 -180
  54. package/package/tf-layout/src/components/tf-right-menu.vue +89 -89
  55. package/package/tf-layout/src/components/tf-rotate-box.vue +50 -50
  56. package/package/tf-layout/src/tf-layout.vue +140 -120
  57. package/package/tf-widget/index.js +8 -8
  58. package/package/tf-widget/src/assets/common-input.less +10 -10
  59. package/package/tf-widget/src/children/basic-data/basic-data.vue +361 -361
  60. package/package/tf-widget/src/children/basic-data/dependcy/basic-data-selector.vue +1087 -1087
  61. package/package/tf-widget/src/children/basic-data/dependcy/common-table.vue +750 -750
  62. package/package/tf-widget/src/children/basic-data/dependcy/condition-filter.vue +519 -519
  63. package/package/tf-widget/src/children/basic-data/dependcy/pagination.vue +93 -93
  64. package/package/tf-widget/src/children/basic-data/dependcy/table-control.vue +240 -240
  65. package/package/tf-widget/src/children/basic-data/dependcy/view-picture.vue +108 -108
  66. package/package/tf-widget/src/children/date-time.vue +103 -103
  67. package/package/tf-widget/src/children/date.vue +103 -103
  68. package/package/tf-widget/src/children/decimal.vue +115 -115
  69. package/package/tf-widget/src/children/integer.vue +104 -104
  70. package/package/tf-widget/src/children/property.vue +59 -59
  71. package/package/tf-widget/src/children/single-line-text.vue +82 -82
  72. package/package/tf-widget/src/children/small-pictures.vue +223 -223
  73. package/package/tf-widget/src/children/text-area.vue +74 -74
  74. package/package/tf-widget/src/children/tf-select.vue +113 -113
  75. package/package/tf-widget/src/tf-widget.vue +175 -175
  76. package/package.json +44 -44
  77. package/src/api/edit.js +97 -97
  78. package/src/api/file-enclosure.js +26 -26
  79. package/src/api/push-down.js +19 -19
  80. package/src/api/table.js +294 -294
  81. package/src/api/tableV3.js +160 -160
  82. package/src/assets/images/icons/index.js +9 -9
  83. package/src/assets/images/icons/svg/add.svg +5 -5
  84. package/src/assets/images/icons/svg/push-down.svg +1 -1
  85. package/src/assets/images/icons/svg/remove.svg +1 -1
  86. package/src/assets/styles/common-table.less +202 -202
  87. package/src/directives/debounce.js +24 -24
  88. package/src/index.js +31 -31
  89. package/src/mixins/t-data-query-mixin.js +290 -290
  90. package/src/utils/auth.js +22 -22
  91. package/src/utils/request.js +42 -42
  92. package/src/utils/stato-anormale.js +59 -59
  93. package/src/utils/utils.js +109 -109
  94. package/src/utils/validate.js +84 -84
@@ -1,519 +1,519 @@
1
- <template>
2
- <div class="condition-filter-component">
3
-
4
- <!-- 快捷过滤-->
5
- <div v-if="isQuickFilter" style="display: flex;height: 100%">
6
- <!-- <template v-for="(item,index) in quickFilterData.filterArr">
7
- <el-date-picker
8
- v-if="item.fieldType==='DATETIME'"
9
- :key="index"
10
- v-model="quickFilterData[item.id]"
11
- value-format="yyyy-MM-dd"
12
- type="date"
13
- :placeholder="item.valueDescription"
14
- />
15
- <el-autocomplete
16
- v-else
17
- :key="index"
18
- v-model="quickFilterData[item.id]"
19
- :placeholder="item.valueDescription"
20
- :fetch-suggestions="querySearch"
21
- @focus="suggestConditionFocus(item)"
22
- />
23
- </template>-->
24
- <div v-if="placeholderData !== ''" class="quick-filter">
25
- <el-input
26
- v-model="testData"
27
- :placeholder="`以${placeholderData}查询`"
28
- @keyup.enter.native="getFilterTableData"
29
- >
30
- <i slot="prefix" class="el-icon-search" />
31
- </el-input>
32
- </div>
33
-
34
- <div class="button-group">
35
- <!-- <el-button type="primary" @click="quickFilterStartMethod">快捷过滤</el-button>-->
36
- <!-- <el-button type="primary" @click="quickConditionClear">重置</el-button>-->
37
- <el-button type="primary" @click="changeIsQuickFilter">高级过滤</el-button>
38
- </div>
39
- </div>
40
-
41
- <!-- 高级过滤-->
42
- <div v-else style="display: flex;align-items: flex-start">
43
-
44
- <!-- 单行高级过滤-->
45
- <div v-if="rotateValue" class="single-line">
46
- <el-select v-model="moreConditionFilterData.name.value[0]" placeholder="" class="field-select" @change="changeMoreConditionName">
47
- <el-option
48
- v-for="(item,index) in moreConditionFilterData.name.arr"
49
- :key="index"
50
- :label="item.label"
51
- :value="item.value"
52
- />
53
- </el-select>
54
- <el-select v-model="moreConditionFilterData.condition.value[0]" placeholder="" class="condition-select" @change="clearDateTime(0)">
55
- <el-option
56
- v-for="(item,index) in moreConditionFilterData.condition.arr[0]"
57
- :key="index"
58
- :label="item.label"
59
- :value="item.value"
60
- />
61
- </el-select>
62
- <el-date-picker
63
- v-if="moreConditionFilterData.type[0] === 'datetime'"
64
- v-model="moreConditionFilterData.value[0]"
65
- value-format="yyyy-MM-dd"
66
- type="date"
67
- placeholder="请选择"
68
- class="value-input"
69
- :disabled="getDateTimeIsDisabled(0)"
70
- />
71
- <el-input v-else v-model="moreConditionFilterData.value[0]" class="value-input" />
72
- </div>
73
-
74
- <!-- 多行高级过滤-->
75
- <div v-else class="multiple-lines">
76
- <div v-for="(item,index) in moreConditionFilterData.value" :key="index" class="multiple-line">
77
- <el-select v-model="moreConditionFilterData.leftBracket.value[index]" placeholder="" class="bracket-select">
78
- <el-option
79
- v-for="(item2, index2) in moreConditionFilterData.leftBracket.arr"
80
- :key="index2"
81
- :label="item2.label"
82
- :value="item2.value"
83
- />
84
- </el-select>
85
- <el-select v-model="moreConditionFilterData.name.value[index]" placeholder="" class="field-select" @change="changeMoreConditionName">
86
- <el-option
87
- v-for="(item2, index2) in moreConditionFilterData.name.arr"
88
- :key="index2"
89
- :label="item2.label"
90
- :value="item2.value"
91
- />
92
- </el-select>
93
- <el-select v-model="moreConditionFilterData.condition.value[index]" placeholder="" class="condition-select" @change="clearDateTime(index)">
94
- <el-option
95
- v-for="(item2, index2) in moreConditionFilterData.condition.arr[index]"
96
- :key="index2"
97
- :label="item2.label"
98
- :value="item2.value"
99
- />
100
- </el-select>
101
- <el-date-picker
102
- v-if="moreConditionFilterData.type[index] === 'datetime'"
103
- v-model="moreConditionFilterData.value[index]"
104
- value-format="yyyy-MM-dd"
105
- type="date"
106
- placeholder="请选择"
107
- class="value-input"
108
- :disabled="getDateTimeIsDisabled(0)"
109
- />
110
- <el-input v-else v-model="moreConditionFilterData.value[index]" class="value-input" />
111
- <el-select v-model="moreConditionFilterData.rightBracket.value[index]" placeholder="" class="bracket-select">
112
- <el-option
113
- v-for="(item2, index2) in moreConditionFilterData.rightBracket.arr"
114
- :key="index2"
115
- :label="item2.label"
116
- :value="item2.value"
117
- />
118
- </el-select>
119
- <el-select v-if="index !== moreConditionFilterData.name.value.length - 1" v-model="moreConditionFilterData.relatedCondition.value[index]" placeholder="" class="bracket-select">
120
- <el-option
121
- v-for="(item2, index2) in moreConditionFilterData.relatedCondition.arr"
122
- :key="index2"
123
- :label="item2.label"
124
- :value="item2.value"
125
- />
126
- </el-select>
127
- <SvgIcon v-if="index !== moreConditionFilterData.name.value.length -1" icon-class="remove" class="remove-icon" @click="removeMultipleLine(index)" />
128
- </div>
129
- <SvgIcon icon-class="add" class="add-icon" @click="addMultipleLine" />
130
- </div>
131
- <div class="button-group">
132
- <el-button type="primary" @click="moreConditionSearchMethod">搜索</el-button>
133
- <el-button type="primary" @click="moreConditionClear">重置</el-button>
134
- <el-button type="primary" @click="changeIsQuickFilter">快捷</el-button>
135
- <SvgIcon icon-class="push-down" class="push-down" :class="rotateValue ? 'down' :'up'" @click="changeRotate" />
136
- </div>
137
- </div>
138
-
139
- </div>
140
- </template>
141
-
142
- <script>
143
-
144
- export default {
145
- name: 'ConditionFilter',
146
- props: {
147
- // 是否为快捷过滤
148
- isQuickFilter: {
149
- type: Boolean,
150
- default: true
151
- },
152
- // 快捷过滤搜索框
153
- quickFilterData: {
154
- type: Object,
155
- default: () => {
156
- return {}
157
- }
158
- },
159
- // 快捷过滤搜索框建议
160
- conditionFilterSuggest: {
161
- type: Object,
162
- default: () => {
163
- return {}
164
- }
165
- },
166
- // 高级过滤为单行/多行
167
- rotate: {
168
- type: Boolean,
169
- default: true
170
- },
171
- moreConditionFilterMap: {
172
- type: Map,
173
- default: new Map()
174
- },
175
- moreConditionFilterData: {
176
- type: Object,
177
- default: new Map()
178
- },
179
- placeholderData: {
180
- type: String,
181
- default: ''
182
- }
183
- },
184
- data () {
185
- return {
186
- conditionFilterSuggestArr: [], // 快捷过滤搜索建议
187
- rotateValue: this.rotate,
188
- quickFilterStartMethod: null, // 快捷过滤防抖查询
189
- moreConditionSearchMethod: null, // 高级过滤防抖查询
190
- testData: '' // 内容过滤关键字
191
- }
192
- },
193
- created () {
194
- // 定义防抖方法
195
- this.quickFilterStartMethod = this.utils.debounce(this.quickFilterStart)
196
- this.moreConditionSearchMethod = this.utils.debounce(this.moreConditionSearch)
197
- },
198
- methods: {
199
-
200
- getFilterTableData (event) {
201
- this.$emit('getFilterTableData', event.target.value)
202
- },
203
-
204
- // 过滤字段为时间类型时,清除时间值
205
- clearDateTime (index) {
206
- if (this.moreConditionFilterData.type[index] === 'datetime') {
207
- if (this.moreConditionFilterData.condition.value[index] !== 'less' &&
208
- this.moreConditionFilterData.condition.value[index] !== 'greater' &&
209
- this.moreConditionFilterData.condition.value[index] !== 'equal') {
210
- this.moreConditionFilterData.value[index] = ''
211
- }
212
- }
213
- },
214
-
215
- // 判断日期选择框是否可选
216
- getDateTimeIsDisabled (index) {
217
- return this.moreConditionFilterData.condition.value[index] !== 'less' &&
218
- this.moreConditionFilterData.condition.value[index] !== 'greater' &&
219
- this.moreConditionFilterData.condition.value[index] !== 'equal'
220
- },
221
-
222
- suggestConditionFocus (value) {
223
- this.conditionFilterSuggestArr = this.conditionFilterSuggest[value.id]
224
- },
225
-
226
- // 切换快捷过滤 与 高级过滤
227
- changeIsQuickFilter () {
228
- this.$emit('changeIsQuickFilter', this.isQuickFilter)
229
- },
230
-
231
- querySearch (queryString, cb) {
232
- const restaurants = this.conditionFilterSuggestArr
233
- const results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants
234
- // 调用 callback 返回建议列表的数据
235
- cb(results)
236
- },
237
-
238
- createFilter (queryString) {
239
- return (restaurant) => {
240
- return (restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) !== -1)
241
- }
242
- },
243
-
244
- // 快捷过滤重置
245
- quickConditionClear () {
246
- this.$emit('quickConditionClear')
247
- },
248
-
249
- // 快捷过滤
250
- quickFilterStart () {
251
- this.$emit('quickFilterStart')
252
- },
253
-
254
- // 高级过滤改变名称
255
- changeMoreConditionName (val) {
256
- // 此校验在父组件watch中实现
257
- // // 校验该字段是否已经选择过
258
- // if (this.checkCondition(val)) {
259
- // this.$message.error('字段重复,请重新选择!')
260
- // return false
261
- // }
262
- // 更新高级过滤条件数组
263
- this.$emit('updateMoreCondition', val)
264
- },
265
-
266
- // 高级过滤搜索
267
- moreConditionSearch () {
268
- // 如果是多行模式下,点击搜索切换显示模式
269
- if (!this.rotateValue) {
270
- // 多行模式下,先校验信息是否完整,此处的校验方法与父组件的方法类似
271
- // if (this.checkMoreCondition()) {
272
- // this.$message.error('请完整填写!')
273
- // return false
274
- // }
275
- this.changeRotate()
276
- }
277
- this.$emit('moreConditionSearch')
278
- },
279
-
280
- // 高级过滤重置
281
- moreConditionClear () {
282
- this.$emit('moreConditionClear')
283
- },
284
-
285
- // 切换单行过滤或者是多行过滤
286
- changeRotate () {
287
- this.rotateValue = !this.rotateValue
288
- this.$emit('changeRotate', this.rotateValue)
289
- },
290
-
291
- // 新增筛选行
292
- addMultipleLine () {
293
- this.$emit('addMultipleLine')
294
- },
295
-
296
- // 移除当前筛选行
297
- removeMultipleLine (index) {
298
- this.$emit('removeMultipleLine', index)
299
- },
300
-
301
- // 校验高级过滤条件重复
302
- checkCondition (val) {
303
- let flag = false
304
- this.moreConditionFilterData.name.value.forEach((item, index) => {
305
- // 排除当前index
306
- const indexValue = this.moreConditionFilterData.name.value.findIndex(d => d === val)
307
- if (this.moreConditionFilterData.name.value[index] === val && index !== indexValue) {
308
- flag = true
309
- }
310
- })
311
- return flag
312
- },
313
-
314
- // 校验高级过滤条件是否填写完整
315
- checkMoreCondition () {
316
- // 校验
317
- let flag = false
318
- this.moreConditionFilterData.name.value.forEach((item, index) => {
319
- // 如果选中了字段,代表需要过滤条件
320
- if (this.moreConditionFilterData.name.value[0] !== '') {
321
- if (!this.moreConditionFilterData.leftBracket.value[index] ||
322
- !this.moreConditionFilterData.name.value[index] ||
323
- !this.moreConditionFilterData.condition.value[index] ||
324
- !this.moreConditionFilterData.value[index] ||
325
- !this.moreConditionFilterData.rightBracket.value[index]) {
326
- flag = true
327
- }
328
- }
329
- })
330
- return flag
331
- }
332
-
333
- }
334
- }
335
- </script>
336
-
337
- <style lang="less" scoped>
338
-
339
- .el-select-dropdown__item{
340
- height: 2.222vh;
341
- line-height: 2.222vh;
342
- font-size: 0.625vw;
343
- }
344
-
345
- .condition-filter-component{
346
- height: 2.222vh;
347
- display: flex;
348
- align-items: flex-start;
349
-
350
- // 内容过滤样式
351
- .quick-filter {
352
- height: 100%;
353
- border-bottom: 1px solid #dcdcdc;
354
- ::v-deep .el-input__inner {
355
- height: calc(100% - 1px);
356
- border: none;
357
- }
358
- ::v-deep .el-input--prefix{
359
- height: 100%;
360
- display: flex;
361
- //align-items: center;
362
- font-size: 0.8vw;
363
- }
364
- ::v-deep .el-input__inner::placeholder{
365
- color: #999999;
366
- font-size: 0.625vw;
367
- }
368
- // ::v-deep .el-input__prefix{
369
- // //height: calc(100% - 2px);
370
- // //color: #999999;
371
- // //font-size: 0.8vw;
372
- // }
373
- }
374
-
375
- ::v-deep .el-input{
376
- height: 100%;
377
- display: flex;
378
- }
379
- ::v-deep .el-input__suffix{
380
- display: flex;
381
- align-items: center;
382
- }
383
- // ::v-deep .el-icon-arrow-up{
384
- // //display: flex;
385
- // //align-items: center;
386
- // }
387
- ::v-deep .el-icon-arrow-up:before{
388
- font-size: 0.625vw;
389
- }
390
- /*筛选框统一高度*/
391
- ::v-deep .el-input__inner{
392
- height: 2.222vh;
393
- font-size: 0.625vw;
394
- }
395
- /*下拉框图标统一高度*/
396
- ::v-deep .el-input__icon{
397
- height: 2.222vh;
398
- line-height: 2.222vh;
399
- }
400
- /*字段下拉框样式*/
401
- .field-select{
402
- margin-right: 0.1vh;
403
- ::v-deep .el-input {
404
- width: 8vw;
405
- }
406
- }
407
- /*条件下拉框样式*/
408
- .condition-select{
409
- margin-right:0.1vh;
410
- ::v-deep .el-input {
411
- width: 6vw;
412
- }
413
- }
414
- /*括号下拉框样式*/
415
- .bracket-select{
416
- margin-right:0.1vh;
417
- ::v-deep .el-input {
418
- width: 6vw;
419
- }
420
- }
421
- /*值输入框样式*/
422
- .value-input{
423
- width: 5vw;
424
- margin-right:0.1vh;
425
- ::v-deep .el-input__inner{
426
- width: 5vw;
427
- }
428
- }
429
-
430
- /*单行筛选框*/
431
- .single-line{
432
- width: 20vw;
433
- height: 100%;
434
- display: flex;
435
- //margin-right: -1.5vw;
436
- .el-select:nth-child(2){
437
- margin: 0 0.5vw;
438
- }
439
- .el-input:nth-last-child(1){
440
- margin-right: 1vw;
441
- }
442
- }
443
- @media screen and (max-width: 1920px){
444
- .single-line{
445
- width: 20vw;
446
- }
447
- }
448
- @media screen and (max-width: 1366px){
449
- .single-line{
450
- width: 20vw;
451
- }
452
- }
453
- /*多行筛选框*/
454
- .multiple-lines{
455
- z-index: 999;
456
- border: 1px solid #0261a4;
457
- border-radius: 0.9259vh;
458
- box-sizing: border-box;
459
- padding: 1.3889vh;
460
- background: #FFFFFF;
461
- .multiple-line{
462
- height: 2.222vh;
463
- margin-bottom: 1vh;
464
- display: flex;
465
- align-items: center;
466
- ::v-deep .el-select{
467
- height: 100%;
468
- }
469
- }
470
- .remove-icon{
471
- width: 0.625vw;
472
- height: 0.625vw;
473
- margin-left: 10px;
474
- cursor: pointer;
475
- }
476
- .add-icon{
477
- width: 0.625vw;
478
- height: 0.625vw;
479
- cursor: pointer;
480
- }
481
- }
482
- /*按钮组样式*/
483
- .button-group {
484
- display: flex;
485
- align-items: center;
486
- margin-left: 1.2vw;
487
- ::v-deep .el-button--primary{
488
- width: 3.5vw;
489
- height: 2.2222vh;
490
- padding: 0;
491
- background: #ecf5ff;
492
- border: 1px solid #0c4c8e;
493
- border-radius: 5px;
494
- font-size: 0.625vw;
495
- font-family: Source Han Sans SC, Source Han Sans SC-Normal;
496
- font-weight: Normal;
497
- text-align: center;
498
- color: #085497;
499
- }
500
- ::v-deep .el-button:nth-child(2) {
501
- margin: 0 0.5vw;
502
- }
503
- /*图标按钮样式*/
504
- .push-down{
505
- width: 2vh;
506
- height: 2vh;
507
- margin-left: 0.5vw;
508
- cursor: pointer;
509
- }
510
- .up{
511
- transform: rotate(-180deg);
512
- transition: all 0.5s;
513
- }
514
- .down{
515
- transition: all 0.5s;
516
- }
517
- }
518
- }
519
- </style>
1
+ <template>
2
+ <div class="condition-filter-component">
3
+
4
+ <!-- 快捷过滤-->
5
+ <div v-if="isQuickFilter" style="display: flex;height: 100%">
6
+ <!-- <template v-for="(item,index) in quickFilterData.filterArr">
7
+ <el-date-picker
8
+ v-if="item.fieldType==='DATETIME'"
9
+ :key="index"
10
+ v-model="quickFilterData[item.id]"
11
+ value-format="yyyy-MM-dd"
12
+ type="date"
13
+ :placeholder="item.valueDescription"
14
+ />
15
+ <el-autocomplete
16
+ v-else
17
+ :key="index"
18
+ v-model="quickFilterData[item.id]"
19
+ :placeholder="item.valueDescription"
20
+ :fetch-suggestions="querySearch"
21
+ @focus="suggestConditionFocus(item)"
22
+ />
23
+ </template>-->
24
+ <div v-if="placeholderData !== ''" class="quick-filter">
25
+ <el-input
26
+ v-model="testData"
27
+ :placeholder="`以${placeholderData}查询`"
28
+ @keyup.enter.native="getFilterTableData"
29
+ >
30
+ <i slot="prefix" class="el-icon-search" />
31
+ </el-input>
32
+ </div>
33
+
34
+ <div class="button-group">
35
+ <!-- <el-button type="primary" @click="quickFilterStartMethod">快捷过滤</el-button>-->
36
+ <!-- <el-button type="primary" @click="quickConditionClear">重置</el-button>-->
37
+ <el-button type="primary" @click="changeIsQuickFilter">高级过滤</el-button>
38
+ </div>
39
+ </div>
40
+
41
+ <!-- 高级过滤-->
42
+ <div v-else style="display: flex;align-items: flex-start">
43
+
44
+ <!-- 单行高级过滤-->
45
+ <div v-if="rotateValue" class="single-line">
46
+ <el-select v-model="moreConditionFilterData.name.value[0]" placeholder="" class="field-select" @change="changeMoreConditionName">
47
+ <el-option
48
+ v-for="(item,index) in moreConditionFilterData.name.arr"
49
+ :key="index"
50
+ :label="item.label"
51
+ :value="item.value"
52
+ />
53
+ </el-select>
54
+ <el-select v-model="moreConditionFilterData.condition.value[0]" placeholder="" class="condition-select" @change="clearDateTime(0)">
55
+ <el-option
56
+ v-for="(item,index) in moreConditionFilterData.condition.arr[0]"
57
+ :key="index"
58
+ :label="item.label"
59
+ :value="item.value"
60
+ />
61
+ </el-select>
62
+ <el-date-picker
63
+ v-if="moreConditionFilterData.type[0] === 'datetime'"
64
+ v-model="moreConditionFilterData.value[0]"
65
+ value-format="yyyy-MM-dd"
66
+ type="date"
67
+ placeholder="请选择"
68
+ class="value-input"
69
+ :disabled="getDateTimeIsDisabled(0)"
70
+ />
71
+ <el-input v-else v-model="moreConditionFilterData.value[0]" class="value-input" />
72
+ </div>
73
+
74
+ <!-- 多行高级过滤-->
75
+ <div v-else class="multiple-lines">
76
+ <div v-for="(item,index) in moreConditionFilterData.value" :key="index" class="multiple-line">
77
+ <el-select v-model="moreConditionFilterData.leftBracket.value[index]" placeholder="" class="bracket-select">
78
+ <el-option
79
+ v-for="(item2, index2) in moreConditionFilterData.leftBracket.arr"
80
+ :key="index2"
81
+ :label="item2.label"
82
+ :value="item2.value"
83
+ />
84
+ </el-select>
85
+ <el-select v-model="moreConditionFilterData.name.value[index]" placeholder="" class="field-select" @change="changeMoreConditionName">
86
+ <el-option
87
+ v-for="(item2, index2) in moreConditionFilterData.name.arr"
88
+ :key="index2"
89
+ :label="item2.label"
90
+ :value="item2.value"
91
+ />
92
+ </el-select>
93
+ <el-select v-model="moreConditionFilterData.condition.value[index]" placeholder="" class="condition-select" @change="clearDateTime(index)">
94
+ <el-option
95
+ v-for="(item2, index2) in moreConditionFilterData.condition.arr[index]"
96
+ :key="index2"
97
+ :label="item2.label"
98
+ :value="item2.value"
99
+ />
100
+ </el-select>
101
+ <el-date-picker
102
+ v-if="moreConditionFilterData.type[index] === 'datetime'"
103
+ v-model="moreConditionFilterData.value[index]"
104
+ value-format="yyyy-MM-dd"
105
+ type="date"
106
+ placeholder="请选择"
107
+ class="value-input"
108
+ :disabled="getDateTimeIsDisabled(0)"
109
+ />
110
+ <el-input v-else v-model="moreConditionFilterData.value[index]" class="value-input" />
111
+ <el-select v-model="moreConditionFilterData.rightBracket.value[index]" placeholder="" class="bracket-select">
112
+ <el-option
113
+ v-for="(item2, index2) in moreConditionFilterData.rightBracket.arr"
114
+ :key="index2"
115
+ :label="item2.label"
116
+ :value="item2.value"
117
+ />
118
+ </el-select>
119
+ <el-select v-if="index !== moreConditionFilterData.name.value.length - 1" v-model="moreConditionFilterData.relatedCondition.value[index]" placeholder="" class="bracket-select">
120
+ <el-option
121
+ v-for="(item2, index2) in moreConditionFilterData.relatedCondition.arr"
122
+ :key="index2"
123
+ :label="item2.label"
124
+ :value="item2.value"
125
+ />
126
+ </el-select>
127
+ <SvgIcon v-if="index !== moreConditionFilterData.name.value.length -1" icon-class="remove" class="remove-icon" @click="removeMultipleLine(index)" />
128
+ </div>
129
+ <SvgIcon icon-class="add" class="add-icon" @click="addMultipleLine" />
130
+ </div>
131
+ <div class="button-group">
132
+ <el-button type="primary" @click="moreConditionSearchMethod">搜索</el-button>
133
+ <el-button type="primary" @click="moreConditionClear">重置</el-button>
134
+ <el-button type="primary" @click="changeIsQuickFilter">快捷</el-button>
135
+ <SvgIcon icon-class="push-down" class="push-down" :class="rotateValue ? 'down' :'up'" @click="changeRotate" />
136
+ </div>
137
+ </div>
138
+
139
+ </div>
140
+ </template>
141
+
142
+ <script>
143
+
144
+ export default {
145
+ name: 'ConditionFilter',
146
+ props: {
147
+ // 是否为快捷过滤
148
+ isQuickFilter: {
149
+ type: Boolean,
150
+ default: true
151
+ },
152
+ // 快捷过滤搜索框
153
+ quickFilterData: {
154
+ type: Object,
155
+ default: () => {
156
+ return {}
157
+ }
158
+ },
159
+ // 快捷过滤搜索框建议
160
+ conditionFilterSuggest: {
161
+ type: Object,
162
+ default: () => {
163
+ return {}
164
+ }
165
+ },
166
+ // 高级过滤为单行/多行
167
+ rotate: {
168
+ type: Boolean,
169
+ default: true
170
+ },
171
+ moreConditionFilterMap: {
172
+ type: Map,
173
+ default: new Map()
174
+ },
175
+ moreConditionFilterData: {
176
+ type: Object,
177
+ default: new Map()
178
+ },
179
+ placeholderData: {
180
+ type: String,
181
+ default: ''
182
+ }
183
+ },
184
+ data () {
185
+ return {
186
+ conditionFilterSuggestArr: [], // 快捷过滤搜索建议
187
+ rotateValue: this.rotate,
188
+ quickFilterStartMethod: null, // 快捷过滤防抖查询
189
+ moreConditionSearchMethod: null, // 高级过滤防抖查询
190
+ testData: '' // 内容过滤关键字
191
+ }
192
+ },
193
+ created () {
194
+ // 定义防抖方法
195
+ this.quickFilterStartMethod = this.utils.debounce(this.quickFilterStart)
196
+ this.moreConditionSearchMethod = this.utils.debounce(this.moreConditionSearch)
197
+ },
198
+ methods: {
199
+
200
+ getFilterTableData (event) {
201
+ this.$emit('getFilterTableData', event.target.value)
202
+ },
203
+
204
+ // 过滤字段为时间类型时,清除时间值
205
+ clearDateTime (index) {
206
+ if (this.moreConditionFilterData.type[index] === 'datetime') {
207
+ if (this.moreConditionFilterData.condition.value[index] !== 'less' &&
208
+ this.moreConditionFilterData.condition.value[index] !== 'greater' &&
209
+ this.moreConditionFilterData.condition.value[index] !== 'equal') {
210
+ this.moreConditionFilterData.value[index] = ''
211
+ }
212
+ }
213
+ },
214
+
215
+ // 判断日期选择框是否可选
216
+ getDateTimeIsDisabled (index) {
217
+ return this.moreConditionFilterData.condition.value[index] !== 'less' &&
218
+ this.moreConditionFilterData.condition.value[index] !== 'greater' &&
219
+ this.moreConditionFilterData.condition.value[index] !== 'equal'
220
+ },
221
+
222
+ suggestConditionFocus (value) {
223
+ this.conditionFilterSuggestArr = this.conditionFilterSuggest[value.id]
224
+ },
225
+
226
+ // 切换快捷过滤 与 高级过滤
227
+ changeIsQuickFilter () {
228
+ this.$emit('changeIsQuickFilter', this.isQuickFilter)
229
+ },
230
+
231
+ querySearch (queryString, cb) {
232
+ const restaurants = this.conditionFilterSuggestArr
233
+ const results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants
234
+ // 调用 callback 返回建议列表的数据
235
+ cb(results)
236
+ },
237
+
238
+ createFilter (queryString) {
239
+ return (restaurant) => {
240
+ return (restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) !== -1)
241
+ }
242
+ },
243
+
244
+ // 快捷过滤重置
245
+ quickConditionClear () {
246
+ this.$emit('quickConditionClear')
247
+ },
248
+
249
+ // 快捷过滤
250
+ quickFilterStart () {
251
+ this.$emit('quickFilterStart')
252
+ },
253
+
254
+ // 高级过滤改变名称
255
+ changeMoreConditionName (val) {
256
+ // 此校验在父组件watch中实现
257
+ // // 校验该字段是否已经选择过
258
+ // if (this.checkCondition(val)) {
259
+ // this.$message.error('字段重复,请重新选择!')
260
+ // return false
261
+ // }
262
+ // 更新高级过滤条件数组
263
+ this.$emit('updateMoreCondition', val)
264
+ },
265
+
266
+ // 高级过滤搜索
267
+ moreConditionSearch () {
268
+ // 如果是多行模式下,点击搜索切换显示模式
269
+ if (!this.rotateValue) {
270
+ // 多行模式下,先校验信息是否完整,此处的校验方法与父组件的方法类似
271
+ // if (this.checkMoreCondition()) {
272
+ // this.$message.error('请完整填写!')
273
+ // return false
274
+ // }
275
+ this.changeRotate()
276
+ }
277
+ this.$emit('moreConditionSearch')
278
+ },
279
+
280
+ // 高级过滤重置
281
+ moreConditionClear () {
282
+ this.$emit('moreConditionClear')
283
+ },
284
+
285
+ // 切换单行过滤或者是多行过滤
286
+ changeRotate () {
287
+ this.rotateValue = !this.rotateValue
288
+ this.$emit('changeRotate', this.rotateValue)
289
+ },
290
+
291
+ // 新增筛选行
292
+ addMultipleLine () {
293
+ this.$emit('addMultipleLine')
294
+ },
295
+
296
+ // 移除当前筛选行
297
+ removeMultipleLine (index) {
298
+ this.$emit('removeMultipleLine', index)
299
+ },
300
+
301
+ // 校验高级过滤条件重复
302
+ checkCondition (val) {
303
+ let flag = false
304
+ this.moreConditionFilterData.name.value.forEach((item, index) => {
305
+ // 排除当前index
306
+ const indexValue = this.moreConditionFilterData.name.value.findIndex(d => d === val)
307
+ if (this.moreConditionFilterData.name.value[index] === val && index !== indexValue) {
308
+ flag = true
309
+ }
310
+ })
311
+ return flag
312
+ },
313
+
314
+ // 校验高级过滤条件是否填写完整
315
+ checkMoreCondition () {
316
+ // 校验
317
+ let flag = false
318
+ this.moreConditionFilterData.name.value.forEach((item, index) => {
319
+ // 如果选中了字段,代表需要过滤条件
320
+ if (this.moreConditionFilterData.name.value[0] !== '') {
321
+ if (!this.moreConditionFilterData.leftBracket.value[index] ||
322
+ !this.moreConditionFilterData.name.value[index] ||
323
+ !this.moreConditionFilterData.condition.value[index] ||
324
+ !this.moreConditionFilterData.value[index] ||
325
+ !this.moreConditionFilterData.rightBracket.value[index]) {
326
+ flag = true
327
+ }
328
+ }
329
+ })
330
+ return flag
331
+ }
332
+
333
+ }
334
+ }
335
+ </script>
336
+
337
+ <style lang="less" scoped>
338
+
339
+ .el-select-dropdown__item{
340
+ height: 2.222vh;
341
+ line-height: 2.222vh;
342
+ font-size: 0.625vw;
343
+ }
344
+
345
+ .condition-filter-component{
346
+ height: 2.222vh;
347
+ display: flex;
348
+ align-items: flex-start;
349
+
350
+ // 内容过滤样式
351
+ .quick-filter {
352
+ height: 100%;
353
+ border-bottom: 1px solid #dcdcdc;
354
+ ::v-deep .el-input__inner {
355
+ height: calc(100% - 1px);
356
+ border: none;
357
+ }
358
+ ::v-deep .el-input--prefix{
359
+ height: 100%;
360
+ display: flex;
361
+ //align-items: center;
362
+ font-size: 0.8vw;
363
+ }
364
+ ::v-deep .el-input__inner::placeholder{
365
+ color: #999999;
366
+ font-size: 0.625vw;
367
+ }
368
+ // ::v-deep .el-input__prefix{
369
+ // //height: calc(100% - 2px);
370
+ // //color: #999999;
371
+ // //font-size: 0.8vw;
372
+ // }
373
+ }
374
+
375
+ ::v-deep .el-input{
376
+ height: 100%;
377
+ display: flex;
378
+ }
379
+ ::v-deep .el-input__suffix{
380
+ display: flex;
381
+ align-items: center;
382
+ }
383
+ // ::v-deep .el-icon-arrow-up{
384
+ // //display: flex;
385
+ // //align-items: center;
386
+ // }
387
+ ::v-deep .el-icon-arrow-up:before{
388
+ font-size: 0.625vw;
389
+ }
390
+ /*筛选框统一高度*/
391
+ ::v-deep .el-input__inner{
392
+ height: 2.222vh;
393
+ font-size: 0.625vw;
394
+ }
395
+ /*下拉框图标统一高度*/
396
+ ::v-deep .el-input__icon{
397
+ height: 2.222vh;
398
+ line-height: 2.222vh;
399
+ }
400
+ /*字段下拉框样式*/
401
+ .field-select{
402
+ margin-right: 0.1vh;
403
+ ::v-deep .el-input {
404
+ width: 8vw;
405
+ }
406
+ }
407
+ /*条件下拉框样式*/
408
+ .condition-select{
409
+ margin-right:0.1vh;
410
+ ::v-deep .el-input {
411
+ width: 6vw;
412
+ }
413
+ }
414
+ /*括号下拉框样式*/
415
+ .bracket-select{
416
+ margin-right:0.1vh;
417
+ ::v-deep .el-input {
418
+ width: 6vw;
419
+ }
420
+ }
421
+ /*值输入框样式*/
422
+ .value-input{
423
+ width: 5vw;
424
+ margin-right:0.1vh;
425
+ ::v-deep .el-input__inner{
426
+ width: 5vw;
427
+ }
428
+ }
429
+
430
+ /*单行筛选框*/
431
+ .single-line{
432
+ width: 20vw;
433
+ height: 100%;
434
+ display: flex;
435
+ //margin-right: -1.5vw;
436
+ .el-select:nth-child(2){
437
+ margin: 0 0.5vw;
438
+ }
439
+ .el-input:nth-last-child(1){
440
+ margin-right: 1vw;
441
+ }
442
+ }
443
+ @media screen and (max-width: 1920px){
444
+ .single-line{
445
+ width: 20vw;
446
+ }
447
+ }
448
+ @media screen and (max-width: 1366px){
449
+ .single-line{
450
+ width: 20vw;
451
+ }
452
+ }
453
+ /*多行筛选框*/
454
+ .multiple-lines{
455
+ z-index: 999;
456
+ border: 1px solid #0261a4;
457
+ border-radius: 0.9259vh;
458
+ box-sizing: border-box;
459
+ padding: 1.3889vh;
460
+ background: #FFFFFF;
461
+ .multiple-line{
462
+ height: 2.222vh;
463
+ margin-bottom: 1vh;
464
+ display: flex;
465
+ align-items: center;
466
+ ::v-deep .el-select{
467
+ height: 100%;
468
+ }
469
+ }
470
+ .remove-icon{
471
+ width: 0.625vw;
472
+ height: 0.625vw;
473
+ margin-left: 10px;
474
+ cursor: pointer;
475
+ }
476
+ .add-icon{
477
+ width: 0.625vw;
478
+ height: 0.625vw;
479
+ cursor: pointer;
480
+ }
481
+ }
482
+ /*按钮组样式*/
483
+ .button-group {
484
+ display: flex;
485
+ align-items: center;
486
+ margin-left: 1.2vw;
487
+ ::v-deep .el-button--primary{
488
+ width: 3.5vw;
489
+ height: 2.2222vh;
490
+ padding: 0;
491
+ background: #ecf5ff;
492
+ border: 1px solid #0c4c8e;
493
+ border-radius: 5px;
494
+ font-size: 0.625vw;
495
+ font-family: Source Han Sans SC, Source Han Sans SC-Normal;
496
+ font-weight: Normal;
497
+ text-align: center;
498
+ color: #085497;
499
+ }
500
+ ::v-deep .el-button:nth-child(2) {
501
+ margin: 0 0.5vw;
502
+ }
503
+ /*图标按钮样式*/
504
+ .push-down{
505
+ width: 2vh;
506
+ height: 2vh;
507
+ margin-left: 0.5vw;
508
+ cursor: pointer;
509
+ }
510
+ .up{
511
+ transform: rotate(-180deg);
512
+ transition: all 0.5s;
513
+ }
514
+ .down{
515
+ transition: all 0.5s;
516
+ }
517
+ }
518
+ }
519
+ </style>