@leevan/jtui 2.0.40 → 2.0.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/examples/App.vue +1 -1
- package/examples/tableTest/table-dsj.vue +1 -1
- package/examples/tableTest/table-fzbg.vue +1 -1
- package/examples/tableTest/table-ptbg.vue +18 -11
- package/examples/tableTest/table-tree.vue +1 -1
- package/lib/fonts/{iconfont.1749517658045.e174417d.ttf → iconfont.1761545705692.5cf21f71.ttf} +0 -0
- package/lib/fonts/iconfont.1761545705692.88bca599.woff +0 -0
- package/lib/fonts/iconfont.1761641771104.2a91224d.woff +0 -0
- package/lib/fonts/iconfont.1761641771104.7f5e52de.ttf +0 -0
- package/lib/jtui.common.js +57463 -16765
- package/lib/jtui.css +1 -1
- package/lib/jtui.umd.js +57463 -16765
- package/lib/jtui.umd.min.js +137 -131
- package/package.json +9 -4
- package/packages/Search-Type/index.vue +3 -2
- package/packages/index.js +11 -3
- package/packages/jt-table/filter.js +0 -3
- package/packages/jt-table/index.vue +40 -30
- package/lib/fonts/iconfont.1749517658045.5ce34dbb.woff +0 -0
- package/packages/jt-table-pc/JtTablePc.vue +0 -1438
- package/packages/jt-table-pc/comp.js +0 -17
- package/packages/jt-table-pc/components/tableColumn.vue +0 -120
- package/packages/jt-table-pc/components/tabsBtn.vue +0 -68
- package/packages/jt-table-pc/data.js +0 -785
- package/packages/jt-table-pc/examples/FilterComplex.vue +0 -78
- package/packages/jt-table-pc/examples/FilterContent.vue +0 -159
- package/packages/jt-table-pc/examples/FilterExcel.vue +0 -161
- package/packages/jt-table-pc/examples/FilterInput.vue +0 -92
- package/packages/jt-table-pc/filter.js +0 -162
- package/packages/jt-table-pc/importData.js +0 -72
- package/packages/jt-table-pc/index.js +0 -10
- /package/packages/{jt-table-pc → jt-table}/data2.js +0 -0
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="jt-table-filter-complex">
|
|
3
|
-
<div class="jt-table-fc-type">
|
|
4
|
-
<vxe-radio v-model="option.data.type" name="fType" label="eq">=</vxe-radio>
|
|
5
|
-
<vxe-radio v-model="option.data.type" name="fType" label="gt">></vxe-radio>
|
|
6
|
-
<vxe-radio v-model="option.data.type" name="fType" label="lt"><</vxe-radio>
|
|
7
|
-
<vxe-radio v-model="option.data.type" name="fType" label="gteq">≥</vxe-radio>
|
|
8
|
-
<vxe-radio v-model="option.data.type" name="fType" label="lteq">≤</vxe-radio>
|
|
9
|
-
</div>
|
|
10
|
-
<div class="jt-table-fc-name">
|
|
11
|
-
<vxe-input v-model="option.data.value" type="text" placeholder="请输入筛选值" @input="changeOptionEvent()"></vxe-input>
|
|
12
|
-
</div>
|
|
13
|
-
<div class="jt-table-fc-footer">
|
|
14
|
-
<vxe-button status="primary" @click="confirmEvent">确认</vxe-button>
|
|
15
|
-
<vxe-button @click="resetEvent">重置</vxe-button>
|
|
16
|
-
</div>
|
|
17
|
-
</div>
|
|
18
|
-
</template>
|
|
19
|
-
|
|
20
|
-
<script>
|
|
21
|
-
export default {
|
|
22
|
-
name: 'FilterComplex',
|
|
23
|
-
props: {
|
|
24
|
-
params: Object
|
|
25
|
-
},
|
|
26
|
-
data () {
|
|
27
|
-
return {
|
|
28
|
-
size: 'mini', // 被所有子组件继承 size
|
|
29
|
-
column: null,
|
|
30
|
-
option: null
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
watch: {
|
|
34
|
-
params () {
|
|
35
|
-
this.load()
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
created () {
|
|
39
|
-
this.load()
|
|
40
|
-
},
|
|
41
|
-
methods: {
|
|
42
|
-
load () {
|
|
43
|
-
const { column } = this.params
|
|
44
|
-
const option = column.filters[0]
|
|
45
|
-
this.column = column
|
|
46
|
-
this.option = option
|
|
47
|
-
},
|
|
48
|
-
changeOptionEvent () {
|
|
49
|
-
const { params, option } = this
|
|
50
|
-
const { $panel } = params
|
|
51
|
-
const checked = !!option.data.value
|
|
52
|
-
$panel.changeOption(null, checked, option)
|
|
53
|
-
},
|
|
54
|
-
confirmEvent () {
|
|
55
|
-
const { $panel } = this.params
|
|
56
|
-
$panel.confirmFilter()
|
|
57
|
-
},
|
|
58
|
-
resetEvent () {
|
|
59
|
-
const { $panel } = this.params
|
|
60
|
-
$panel.resetFilter()
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
</script>
|
|
65
|
-
|
|
66
|
-
<style scoped>
|
|
67
|
-
.jt-table-filter-complex {
|
|
68
|
-
width: 260px;
|
|
69
|
-
padding: 5px 15px 10px 15px;
|
|
70
|
-
}
|
|
71
|
-
.jt-table-filter-complex .jt-table-fc-type {
|
|
72
|
-
padding: 8px 0;
|
|
73
|
-
}
|
|
74
|
-
.jt-table-filter-complex .jt-table-fc-footer {
|
|
75
|
-
padding-top:12px;
|
|
76
|
-
text-align: center;
|
|
77
|
-
}
|
|
78
|
-
</style>
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="jt-table-filter-content">
|
|
3
|
-
<div class="jt-table-fc-search">
|
|
4
|
-
<div class="jt-table-fc-search-top">
|
|
5
|
-
<vxe-input v-model="option.data.sVal" placeholder="搜索" suffix-icon="fa fa-search" @keyup="searchEvent"></vxe-input>
|
|
6
|
-
</div>
|
|
7
|
-
<div class="jt-table-fc-search-content">
|
|
8
|
-
<template v-if="valList.length">
|
|
9
|
-
<ul class="jt-table-fc-search-list jt-table-fc-search-list-head">
|
|
10
|
-
<li class="jt-table-fc-search-item">
|
|
11
|
-
<vxe-checkbox v-model="isAll" :indeterminate="isIndeterminate" @change="changeAllEvent">全选</vxe-checkbox>
|
|
12
|
-
</li>
|
|
13
|
-
</ul>
|
|
14
|
-
<ul class="jt-table-fc-search-list jt-table-fc-search-list-body">
|
|
15
|
-
<li class="jt-table-fc-search-item" v-for="(item, sIndex) in valList" :key="sIndex">
|
|
16
|
-
<vxe-checkbox v-model="item.checked" @change="changeItemEvent">{{ item.value }}</vxe-checkbox>
|
|
17
|
-
</li>
|
|
18
|
-
</ul>
|
|
19
|
-
</template>
|
|
20
|
-
<template v-else>
|
|
21
|
-
<div class="jt-table-fc-search-empty">无匹配项</div>
|
|
22
|
-
</template>
|
|
23
|
-
</div>
|
|
24
|
-
</div>
|
|
25
|
-
<div class="jt-table-fc-footer">
|
|
26
|
-
<vxe-button status="primary" @click="confirmFilterEvent">确认</vxe-button>
|
|
27
|
-
<vxe-button @click="resetFilterEvent">重置</vxe-button>
|
|
28
|
-
</div>
|
|
29
|
-
</div>
|
|
30
|
-
</template>
|
|
31
|
-
|
|
32
|
-
<script>
|
|
33
|
-
import XEUtils from 'xe-utils'
|
|
34
|
-
export default {
|
|
35
|
-
name: 'FilterContent',
|
|
36
|
-
props: {
|
|
37
|
-
params: Object
|
|
38
|
-
},
|
|
39
|
-
data () {
|
|
40
|
-
return {
|
|
41
|
-
size: 'mini',
|
|
42
|
-
isAll: false,
|
|
43
|
-
isIndeterminate: false,
|
|
44
|
-
option: null,
|
|
45
|
-
colValList: [],
|
|
46
|
-
valList: []
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
watch: {
|
|
50
|
-
params () {
|
|
51
|
-
this.load()
|
|
52
|
-
},
|
|
53
|
-
colValList () {
|
|
54
|
-
this.searchEvent()
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
created () {
|
|
58
|
-
this.load()
|
|
59
|
-
this.searchEvent()
|
|
60
|
-
},
|
|
61
|
-
methods: {
|
|
62
|
-
load () {
|
|
63
|
-
// filters 可以配置多个,实际只用一个就可以满足需求了
|
|
64
|
-
const { $table, column } = this.params
|
|
65
|
-
const { fullData } = $table.getTableData()
|
|
66
|
-
const option = column.filters[0]
|
|
67
|
-
const { vals } = option.data
|
|
68
|
-
const colValList = Object.keys(XEUtils.groupBy(fullData, column.property)).map(val => {
|
|
69
|
-
return {
|
|
70
|
-
checked: vals.includes(val),
|
|
71
|
-
value: val
|
|
72
|
-
}
|
|
73
|
-
})
|
|
74
|
-
this.option = option
|
|
75
|
-
this.colValList = colValList
|
|
76
|
-
this.valList = colValList
|
|
77
|
-
},
|
|
78
|
-
searchEvent () {
|
|
79
|
-
const { option, colValList } = this
|
|
80
|
-
this.valList = option.data.sVal ? colValList.filter(item => item.value.indexOf(option.data.sVal) > -1) : colValList
|
|
81
|
-
this.updateCheckStatus()
|
|
82
|
-
},
|
|
83
|
-
changeAllEvent () {
|
|
84
|
-
const { isAll } = this
|
|
85
|
-
this.valList.forEach(item => {
|
|
86
|
-
item.checked = isAll
|
|
87
|
-
})
|
|
88
|
-
this.isIndeterminate = false
|
|
89
|
-
},
|
|
90
|
-
updateCheckStatus () {
|
|
91
|
-
const { valList } = this
|
|
92
|
-
const isAll = valList.every(item => item.checked)
|
|
93
|
-
this.isAll = isAll
|
|
94
|
-
this.isIndeterminate = !isAll && valList.some(item => item.checked)
|
|
95
|
-
},
|
|
96
|
-
changeItemEvent () {
|
|
97
|
-
this.updateCheckStatus()
|
|
98
|
-
},
|
|
99
|
-
confirmFilterEvent () {
|
|
100
|
-
const { params, option, valList } = this
|
|
101
|
-
const { data } = option
|
|
102
|
-
const { $panel } = params
|
|
103
|
-
data.vals = valList.filter(item => item.checked).map(item => item.value)
|
|
104
|
-
option.checked = true
|
|
105
|
-
$panel.confirmFilter()
|
|
106
|
-
},
|
|
107
|
-
resetFilterEvent () {
|
|
108
|
-
const { $panel } = this.params
|
|
109
|
-
$panel.resetFilter()
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
</script>
|
|
114
|
-
|
|
115
|
-
<style>
|
|
116
|
-
.jt-table-filter-content {
|
|
117
|
-
padding: 10px;
|
|
118
|
-
user-select: none;
|
|
119
|
-
}
|
|
120
|
-
.jt-table-filter-content .jt-table-fc-search .jt-table-fc-search-top {
|
|
121
|
-
position: relative;
|
|
122
|
-
padding: 5px 0;
|
|
123
|
-
}
|
|
124
|
-
.jt-table-filter-content .jt-table-fc-search .jt-table-fc-search-top > input {
|
|
125
|
-
border: 1px solid #ABABAB;
|
|
126
|
-
padding: 0 20px 0 2px;
|
|
127
|
-
width: 200px;
|
|
128
|
-
height: 22px;
|
|
129
|
-
line-height: 22px;
|
|
130
|
-
}
|
|
131
|
-
.jt-table-filter-content .jt-table-fc-search .jt-table-fc-search-content {
|
|
132
|
-
border: 1px solid #E2E4E7;
|
|
133
|
-
padding: 2px 10px;
|
|
134
|
-
}
|
|
135
|
-
.jt-table-filter-content .jt-table-fc-search-empty {
|
|
136
|
-
text-align: center;
|
|
137
|
-
padding: 20px 0;
|
|
138
|
-
}
|
|
139
|
-
.jt-table-filter-content .jt-table-fc-search-list {
|
|
140
|
-
margin: 0;
|
|
141
|
-
padding:0;
|
|
142
|
-
}
|
|
143
|
-
.jt-table-filter-content .jt-table-fc-search-list-body {
|
|
144
|
-
overflow: auto;
|
|
145
|
-
height: 120px;
|
|
146
|
-
}
|
|
147
|
-
.jt-table-filter-content .jt-table-fc-search-list .jt-table-fc-search-item {
|
|
148
|
-
padding: 2px 0;
|
|
149
|
-
display: block;
|
|
150
|
-
}
|
|
151
|
-
.jt-table-filter-content .jt-table-fc-footer {
|
|
152
|
-
text-align: center;
|
|
153
|
-
padding-top: 10px;
|
|
154
|
-
}
|
|
155
|
-
.jt-table-filter-content .jt-table-fc-footer button {
|
|
156
|
-
padding: 0 15px;
|
|
157
|
-
margin-left: 15px;
|
|
158
|
-
}
|
|
159
|
-
</style>
|
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="jt-table-filter-excel">
|
|
3
|
-
<div class="jt-table-fe-top">
|
|
4
|
-
<div class="jt-table-fe-popup">
|
|
5
|
-
<div class="jt-table-fe-popup-filter jt-table-fe-popup-f1">
|
|
6
|
-
<vxe-select class="jt-table-fe-popup-filter-select"
|
|
7
|
-
v-model="option.data.f1Type"
|
|
8
|
-
transfer
|
|
9
|
-
>
|
|
10
|
-
<vxe-option
|
|
11
|
-
v-for="(fItem,index) in allCaseList"
|
|
12
|
-
:key="index"
|
|
13
|
-
:value="fItem.value"
|
|
14
|
-
:label="fItem.label"></vxe-option>
|
|
15
|
-
</vxe-select>
|
|
16
|
-
<vxe-input
|
|
17
|
-
class="jt-table-fe-popup-filter-input"
|
|
18
|
-
v-model="option.data.f1Val"
|
|
19
|
-
></vxe-input>
|
|
20
|
-
</div>
|
|
21
|
-
<div class="jt-table-fe-popup-concat">
|
|
22
|
-
<vxe-radio-group v-model="option.data.fMode">
|
|
23
|
-
<vxe-radio label="and">与</vxe-radio>
|
|
24
|
-
<vxe-radio label="or">或</vxe-radio>
|
|
25
|
-
</vxe-radio-group>
|
|
26
|
-
</div>
|
|
27
|
-
<div class="jt-table-fe-popup-filter jt-table-fe-popup-f2">
|
|
28
|
-
<vxe-select
|
|
29
|
-
class="jt-table-fe-popup-filter-select"
|
|
30
|
-
v-model="option.data.f2Type" transfer>
|
|
31
|
-
<vxe-option
|
|
32
|
-
v-for="(fItem,index) in allCaseList"
|
|
33
|
-
:key="index"
|
|
34
|
-
:value="fItem.value"
|
|
35
|
-
:label="fItem.label"></vxe-option>
|
|
36
|
-
</vxe-select>
|
|
37
|
-
<vxe-input
|
|
38
|
-
class="jt-table-fe-popup-filter-input"
|
|
39
|
-
v-model="option.data.f2Val"
|
|
40
|
-
clearable></vxe-input>
|
|
41
|
-
</div>
|
|
42
|
-
</div>
|
|
43
|
-
</div>
|
|
44
|
-
<div class="jt-table-fe-footer">
|
|
45
|
-
<vxe-button status="primary" @click="confirmFilterEvent">确认</vxe-button>
|
|
46
|
-
<vxe-button @click="resetFilterEvent">重置</vxe-button>
|
|
47
|
-
</div>
|
|
48
|
-
</div>
|
|
49
|
-
</template>
|
|
50
|
-
|
|
51
|
-
<script>
|
|
52
|
-
import XEUtils from 'xe-utils'
|
|
53
|
-
import { ModalController } from 'vxe-table'
|
|
54
|
-
export default {
|
|
55
|
-
name: 'FilterExcel',
|
|
56
|
-
props: {
|
|
57
|
-
params: Object
|
|
58
|
-
},
|
|
59
|
-
data () {
|
|
60
|
-
return {
|
|
61
|
-
data:null,
|
|
62
|
-
size:'mini',
|
|
63
|
-
column: null,
|
|
64
|
-
option: null,
|
|
65
|
-
colValList: [],
|
|
66
|
-
caseGroups: [
|
|
67
|
-
[
|
|
68
|
-
{ value: 'equal', label: '等于' },
|
|
69
|
-
{ value: 'ne', label: '不等于' }
|
|
70
|
-
],
|
|
71
|
-
[
|
|
72
|
-
{ value: 'greater', label: '大于' },
|
|
73
|
-
{ value: 'ge', label: '大于或等于' },
|
|
74
|
-
{ value: 'less', label: '小于' },
|
|
75
|
-
{ value: 'le', label: '小于或等于' },
|
|
76
|
-
{ value: 'between', label: '介于' }
|
|
77
|
-
],
|
|
78
|
-
[
|
|
79
|
-
{ value: 'custom', label: '自定义筛选' }
|
|
80
|
-
]
|
|
81
|
-
],
|
|
82
|
-
allCaseList: [
|
|
83
|
-
{ value: '1', label: '等于' },
|
|
84
|
-
{ value: '2', label: '不等于' },
|
|
85
|
-
{ value: '3', label: '大于' },
|
|
86
|
-
{ value: '4', label: '大于或等于' },
|
|
87
|
-
{ value: '5', label: '小于' },
|
|
88
|
-
{ value: '6', label: '小于或等于' },
|
|
89
|
-
{ value: '7', label: '开头是' },
|
|
90
|
-
{ value: '8', label: '开头不是' },
|
|
91
|
-
{ value: '9', label: '结尾是' },
|
|
92
|
-
{ value: '10', label: '结尾不是' },
|
|
93
|
-
{ value: '11', label: '包含' },
|
|
94
|
-
{ value: '12', label: '不包含' }
|
|
95
|
-
]
|
|
96
|
-
}
|
|
97
|
-
},
|
|
98
|
-
watch: {
|
|
99
|
-
params () {
|
|
100
|
-
this.load()
|
|
101
|
-
}
|
|
102
|
-
},
|
|
103
|
-
created () {
|
|
104
|
-
this.load()
|
|
105
|
-
},
|
|
106
|
-
methods: {
|
|
107
|
-
load () {
|
|
108
|
-
const { $table, column } = this.params
|
|
109
|
-
const { fullData } = $table.getTableData()
|
|
110
|
-
const option = column.filters[0]
|
|
111
|
-
const colValList = Object.keys(XEUtils.groupBy(fullData, column.property))
|
|
112
|
-
this.column = column
|
|
113
|
-
this.option = option
|
|
114
|
-
this.colValList = colValList
|
|
115
|
-
},
|
|
116
|
-
confirmFilterEvent () {
|
|
117
|
-
const { params, option } = this
|
|
118
|
-
const { data } = option
|
|
119
|
-
const { $panel } = params
|
|
120
|
-
data.f1 = ''
|
|
121
|
-
data.f2 = ''
|
|
122
|
-
option.checked = true
|
|
123
|
-
$panel.confirmFilter()
|
|
124
|
-
},
|
|
125
|
-
resetFilterEvent () {
|
|
126
|
-
const { $panel } = this.params
|
|
127
|
-
$panel.resetFilter()
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
</script>
|
|
132
|
-
<style>
|
|
133
|
-
.jt-table-filter-excel {
|
|
134
|
-
user-select: none;
|
|
135
|
-
padding: 10px;
|
|
136
|
-
text-align: center;
|
|
137
|
-
width:180px;
|
|
138
|
-
|
|
139
|
-
}
|
|
140
|
-
.jt-table-filter-excel .jt-table-fe-top{
|
|
141
|
-
border: 1px solid #E2E4E7;
|
|
142
|
-
padding: 6px 6px 18px 6px;
|
|
143
|
-
}
|
|
144
|
-
.jt-table-filter-excel .jt-table-fe-popup-concat{
|
|
145
|
-
margin-top:10px;
|
|
146
|
-
}
|
|
147
|
-
.jt-table-filter-excel .jt-table-fe-popup-filter-select{
|
|
148
|
-
width:60px;
|
|
149
|
-
display: inline-block;
|
|
150
|
-
margin-top:10px;
|
|
151
|
-
}
|
|
152
|
-
.jt-table-filter-excel .jt-table-fe-popup-filter-input{
|
|
153
|
-
width:100px;
|
|
154
|
-
display: inline-block;
|
|
155
|
-
position: relative;
|
|
156
|
-
right: 1px;
|
|
157
|
-
}
|
|
158
|
-
.jt-table-filter-excel .jt-table-fe-footer{
|
|
159
|
-
margin-top:10px;
|
|
160
|
-
}
|
|
161
|
-
</style>
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="jt-table-filter-input">
|
|
3
|
-
<vxe-input
|
|
4
|
-
v-for="(item,index) in column.filters"
|
|
5
|
-
:key="index"
|
|
6
|
-
type="text"
|
|
7
|
-
style="margin-top:6px"
|
|
8
|
-
v-model="item.data"
|
|
9
|
-
placeholder="请输入筛选值"
|
|
10
|
-
@input="changeOptionEvent"></vxe-input>
|
|
11
|
-
<div class="jt-table-fc-footer">
|
|
12
|
-
<vxe-button status="primary" @click="confirmEvent">确认</vxe-button>
|
|
13
|
-
<vxe-button @click="resetEvent">重置</vxe-button>
|
|
14
|
-
<vxe-button @click="addInput">+</vxe-button>
|
|
15
|
-
<vxe-button @click="decInput">-</vxe-button>
|
|
16
|
-
</div>
|
|
17
|
-
</div>
|
|
18
|
-
</template>
|
|
19
|
-
|
|
20
|
-
<script>
|
|
21
|
-
export default {
|
|
22
|
-
name: 'FilterInput',
|
|
23
|
-
props: {
|
|
24
|
-
params: Object
|
|
25
|
-
},
|
|
26
|
-
data () {
|
|
27
|
-
return {
|
|
28
|
-
size: 'mini',
|
|
29
|
-
column: null,
|
|
30
|
-
option: null
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
watch: {
|
|
34
|
-
params () {
|
|
35
|
-
this.load()
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
created () {
|
|
39
|
-
this.load()
|
|
40
|
-
},
|
|
41
|
-
methods: {
|
|
42
|
-
load () {
|
|
43
|
-
// filters 可以配置多个,实际只用一个就可以满足需求了
|
|
44
|
-
const { column } = this.params
|
|
45
|
-
const option = column.filters[0]
|
|
46
|
-
this.column = column
|
|
47
|
-
this.option = option
|
|
48
|
-
},
|
|
49
|
-
changeOptionEvent () {
|
|
50
|
-
const { params, option } = this
|
|
51
|
-
const { $panel } = params
|
|
52
|
-
const checked = !!option.data
|
|
53
|
-
$panel.changeOption(null, checked, option)
|
|
54
|
-
},
|
|
55
|
-
//确认
|
|
56
|
-
confirmEvent () {
|
|
57
|
-
const { $panel } = this.params
|
|
58
|
-
$panel.confirmFilter()
|
|
59
|
-
},
|
|
60
|
-
//重置
|
|
61
|
-
resetEvent () {
|
|
62
|
-
const { $panel } = this.params
|
|
63
|
-
this.column.filters.length = 1;
|
|
64
|
-
$panel.resetFilter()
|
|
65
|
-
},
|
|
66
|
-
//增加
|
|
67
|
-
addInput(){
|
|
68
|
-
this.column.filters.push({checked: true,
|
|
69
|
-
data: "",
|
|
70
|
-
label: undefined,
|
|
71
|
-
resetValue: undefined,
|
|
72
|
-
value: undefined})
|
|
73
|
-
},
|
|
74
|
-
decInput(){
|
|
75
|
-
if(this.column.filters.length > 1){
|
|
76
|
-
this.column.filters.pop();
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
</script>
|
|
82
|
-
|
|
83
|
-
<style scoped>
|
|
84
|
-
.jt-table-filter-input {
|
|
85
|
-
padding: 10px;
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
.jt-table-filter-input .jt-table-fc-footer {
|
|
89
|
-
padding-top:12px;
|
|
90
|
-
text-align: center;
|
|
91
|
-
}
|
|
92
|
-
</style>
|
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
import Vue from 'vue';
|
|
2
|
-
import VXETable from 'vxe-table';
|
|
3
|
-
import XEUtils from 'xe-utils'
|
|
4
|
-
|
|
5
|
-
import FilterInput from './examples/FilterInput.vue'
|
|
6
|
-
import FilterContent from './examples/FilterContent.vue'
|
|
7
|
-
import FilterComplex from './examples/FilterComplex.vue'
|
|
8
|
-
import FilterExcel from './examples/FilterExcel.vue'
|
|
9
|
-
|
|
10
|
-
Vue.component(FilterInput.name, FilterInput)
|
|
11
|
-
Vue.component(FilterContent.name, FilterContent)
|
|
12
|
-
Vue.component(FilterComplex.name, FilterComplex)
|
|
13
|
-
Vue.component(FilterExcel.name, FilterExcel)
|
|
14
|
-
|
|
15
|
-
import VXETablePluginExportXLSX from 'vxe-table-plugin-export-xlsx';
|
|
16
|
-
VXETable.use(VXETablePluginExportXLSX);
|
|
17
|
-
|
|
18
|
-
// 创建一个简单的输入框筛选
|
|
19
|
-
VXETable.renderer.add('FilterInput', {
|
|
20
|
-
// 不显示底部按钮,使用自定义的按钮
|
|
21
|
-
isFooter: false,
|
|
22
|
-
// 筛选模板
|
|
23
|
-
renderFilter (h, renderOpts, params) {
|
|
24
|
-
return [
|
|
25
|
-
<filter-input params={ params }></filter-input>
|
|
26
|
-
]
|
|
27
|
-
},
|
|
28
|
-
// 筛选方法
|
|
29
|
-
filterMethod ({ option, row, column }) {
|
|
30
|
-
const { data } = option
|
|
31
|
-
const cellValue = XEUtils.get(row, column.property)
|
|
32
|
-
return XEUtils.toString(cellValue).indexOf(data) > -1
|
|
33
|
-
}
|
|
34
|
-
})
|
|
35
|
-
|
|
36
|
-
// 创建一个支持列内容的筛选
|
|
37
|
-
VXETable.renderer.add('FilterContent', {
|
|
38
|
-
// 不显示底部按钮,使用自定义的按钮
|
|
39
|
-
isFooter: false,
|
|
40
|
-
// 筛选模板
|
|
41
|
-
renderFilter (h, renderOpts, params) {
|
|
42
|
-
return [
|
|
43
|
-
<filter-content params={ params }></filter-content>
|
|
44
|
-
]
|
|
45
|
-
},
|
|
46
|
-
// 重置数据方法
|
|
47
|
-
filterResetMethod ({ options }) {
|
|
48
|
-
options.forEach(option => {
|
|
49
|
-
option.data = { vals: [], sVal: '' }
|
|
50
|
-
})
|
|
51
|
-
},
|
|
52
|
-
// 筛选数据方法
|
|
53
|
-
filterMethod ({ option, row, column }) {
|
|
54
|
-
const { vals } = option.data
|
|
55
|
-
const cellValue = XEUtils.get(row, column.property)
|
|
56
|
-
/* eslint-disable eqeqeq */
|
|
57
|
-
return vals.some(val => val == cellValue)
|
|
58
|
-
}
|
|
59
|
-
})
|
|
60
|
-
|
|
61
|
-
// 创建一个条件的渲染器
|
|
62
|
-
VXETable.renderer.add('FilterComplex', {
|
|
63
|
-
// 不显示底部按钮,使用自定义的按钮
|
|
64
|
-
isFooter: false,
|
|
65
|
-
// 筛选模板
|
|
66
|
-
renderFilter (h, renderOpts, params) {
|
|
67
|
-
return [
|
|
68
|
-
<filter-complex params={ params }></filter-complex>
|
|
69
|
-
]
|
|
70
|
-
},
|
|
71
|
-
// 重置数据方法
|
|
72
|
-
filterResetMethod ({ options }) {
|
|
73
|
-
options.forEach(option => {
|
|
74
|
-
option.data = { type: 'eq' , name: '' }
|
|
75
|
-
})
|
|
76
|
-
},
|
|
77
|
-
// 筛选数据方法
|
|
78
|
-
filterMethod ({ option, row, column }) {
|
|
79
|
-
let cellValue = XEUtils.get(row, column.property)
|
|
80
|
-
const { type } = option.data
|
|
81
|
-
let { value } = option.data
|
|
82
|
-
if (cellValue) {
|
|
83
|
-
switch (type) {
|
|
84
|
-
case 'eq':
|
|
85
|
-
return cellValue == value
|
|
86
|
-
case 'gt':
|
|
87
|
-
return Number(cellValue) > Number(value)
|
|
88
|
-
case 'lt':
|
|
89
|
-
return Number(cellValue) < Number(value)
|
|
90
|
-
case 'gteq':
|
|
91
|
-
return Number(cellValue) >= Number(value)
|
|
92
|
-
case 'lteq':
|
|
93
|
-
return Number(cellValue) <= Number(value)
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
return false
|
|
97
|
-
}
|
|
98
|
-
})
|
|
99
|
-
|
|
100
|
-
// 创建一个实现Excel的筛选器
|
|
101
|
-
VXETable.renderer.add('FilterExcel', {
|
|
102
|
-
// 不显示底部按钮,使用自定义的按钮
|
|
103
|
-
isFooter: false,
|
|
104
|
-
// 筛选模板
|
|
105
|
-
renderFilter (h, renderOpts, params) {
|
|
106
|
-
return [
|
|
107
|
-
<filter-excel params={ params }></filter-excel>
|
|
108
|
-
]
|
|
109
|
-
},
|
|
110
|
-
// 重置数据方法
|
|
111
|
-
filterResetMethod ({ options }) {
|
|
112
|
-
options.forEach(option => {
|
|
113
|
-
option.data = {f1Type: '1', f1Val: '', fMode: 'and', f2Type: '1', f2Val: '' }
|
|
114
|
-
})
|
|
115
|
-
},
|
|
116
|
-
// 筛选数据方法
|
|
117
|
-
filterMethod ({ option, row, column }) {
|
|
118
|
-
const cellValue = XEUtils.get(row, column.property)
|
|
119
|
-
const {f1Type, f1Val, fMode, f2Type, f2Val } = option.data
|
|
120
|
-
if (cellValue) {
|
|
121
|
-
if (f1Type || f2Type) {
|
|
122
|
-
// 通过筛选条件
|
|
123
|
-
const calculate = (type, val) => {
|
|
124
|
-
switch (type) {
|
|
125
|
-
case '1':
|
|
126
|
-
return cellValue == val
|
|
127
|
-
case '2':
|
|
128
|
-
return cellValue != val
|
|
129
|
-
case '3':
|
|
130
|
-
return Number(cellValue) > Number(val)
|
|
131
|
-
case '4':
|
|
132
|
-
return Number(cellValue) >= Number(val)
|
|
133
|
-
case '5':
|
|
134
|
-
return Number(cellValue) < Number(val)
|
|
135
|
-
case '6':
|
|
136
|
-
return Number(cellValue) <= Number(val)
|
|
137
|
-
case '7':
|
|
138
|
-
return cellValue.indexOf(val) === 0
|
|
139
|
-
case '8':
|
|
140
|
-
return cellValue.indexOf(val) !== 0
|
|
141
|
-
case '9':
|
|
142
|
-
return cellValue.lastIndexOf(val) === cellValue.length - val.length
|
|
143
|
-
case '10':
|
|
144
|
-
return cellValue.lastIndexOf(val) !== cellValue.length - val.length
|
|
145
|
-
case '11':
|
|
146
|
-
return cellValue.indexOf(val) > -1
|
|
147
|
-
case '12':
|
|
148
|
-
return cellValue.indexOf(val) === -1
|
|
149
|
-
}
|
|
150
|
-
return true
|
|
151
|
-
}
|
|
152
|
-
const f1Rest = calculate(f1Type, f1Val)
|
|
153
|
-
const f2Rest = calculate(f2Type, f2Val)
|
|
154
|
-
if (fMode === 'and') {
|
|
155
|
-
return f1Rest && f2Rest
|
|
156
|
-
}
|
|
157
|
-
return f1Rest || f2Rest
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
return false
|
|
161
|
-
}
|
|
162
|
-
})
|