@leevan/jtui 1.2.7 → 2.0.1
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 +640 -24
- package/examples/scss/cover.scss +139 -0
- package/examples/scss/global.scss +457 -0
- package/examples/scss/main-style/_handle.scss +217 -0
- package/examples/scss/main-style/_themes.scss +95 -0
- package/examples/scss/main-style/style1.scss +0 -0
- package/examples/scss/main-style/style2.scss +12 -0
- package/examples/scss/main-style/style3.scss +16 -0
- package/examples/scss/pub.scss +142 -0
- package/examples/tableTest/table-dsj.vue +209 -0
- package/examples/tableTest/table-fzbg.vue +163 -0
- package/examples/tableTest/table-ptbg.vue +222 -0
- package/examples/tableTest/table-tree.vue +45 -0
- package/examples/tableTest/tree-table.vue +45 -0
- package/lib/jtui.common.js +114134 -84420
- package/lib/jtui.css +1 -1
- package/lib/jtui.umd.js +114134 -84420
- package/lib/jtui.umd.min.js +176 -133
- package/package.json +6 -5
- package/packages/index.js +6 -3
- package/packages/jt-echarts-pc/JtEchartsPc.vue +6 -2
- package/packages/jt-form-pc/JtFormPc.vue +1 -1
- package/packages/jt-table/comp.js +17 -0
- package/packages/jt-table/components/tabsBtn.vue +53 -0
- package/packages/jt-table/examples/FilterComplex.vue +78 -0
- package/packages/jt-table/examples/FilterContent.vue +159 -0
- package/packages/jt-table/examples/FilterExcel.vue +161 -0
- package/packages/jt-table/examples/FilterInput.vue +92 -0
- package/packages/jt-table/filter.js +162 -0
- package/packages/jt-table/index.js +10 -0
- package/packages/jt-table/index.vue +1441 -0
- package/packages/jt-table-pc/data2.js +33 -14
- package/packages/jtaxios.js +31 -0
- package/vue.config.js +1 -1
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div style="height:100%">
|
|
3
|
+
<div style="margin-bottom:12px;">
|
|
4
|
+
<el-button size="mini" @click="exportTableData">导出数据</el-button>
|
|
5
|
+
<el-button size="mini" @click="importData">导入数据</el-button>
|
|
6
|
+
<el-button size="mini" @click="clearData">清空数据</el-button>
|
|
7
|
+
<el-switch
|
|
8
|
+
v-model="isTool"
|
|
9
|
+
active-color="#13ce66"
|
|
10
|
+
inactive-text="筛选列"
|
|
11
|
+
inactive-color="#ff4949">
|
|
12
|
+
</el-switch>
|
|
13
|
+
<el-switch
|
|
14
|
+
style="margin-left:10px;"
|
|
15
|
+
v-model="stripe"
|
|
16
|
+
active-color="#13ce66"
|
|
17
|
+
inactive-text="斑马线"
|
|
18
|
+
inactive-color="#ff4949">
|
|
19
|
+
</el-switch>
|
|
20
|
+
<el-switch
|
|
21
|
+
style="margin-left:10px;"
|
|
22
|
+
v-model="isCheckbox"
|
|
23
|
+
active-color="#13ce66"
|
|
24
|
+
inactive-text="复选框"
|
|
25
|
+
inactive-color="#ff4949">
|
|
26
|
+
</el-switch>
|
|
27
|
+
<el-switch
|
|
28
|
+
style="margin-left:10px;"
|
|
29
|
+
v-model="isRadio"
|
|
30
|
+
active-color="#13ce66"
|
|
31
|
+
inactive-text="单选框"
|
|
32
|
+
inactive-color="#ff4949">
|
|
33
|
+
</el-switch>
|
|
34
|
+
<el-switch
|
|
35
|
+
style="margin-left:10px;"
|
|
36
|
+
v-model="isWrap"
|
|
37
|
+
active-color="#13ce66"
|
|
38
|
+
inactive-text="表头换行"
|
|
39
|
+
inactive-color="#ff4949">
|
|
40
|
+
</el-switch>
|
|
41
|
+
<el-switch
|
|
42
|
+
style="margin-left:10px;"
|
|
43
|
+
v-model="isSeq"
|
|
44
|
+
active-color="#13ce66"
|
|
45
|
+
inactive-text="序号"
|
|
46
|
+
inactive-color="#ff4949">
|
|
47
|
+
</el-switch>
|
|
48
|
+
<el-switch
|
|
49
|
+
style="margin-left:10px;"
|
|
50
|
+
v-model="loading"
|
|
51
|
+
active-color="#13ce66"
|
|
52
|
+
inactive-text="加载动画"
|
|
53
|
+
inactive-color="#ff4949">
|
|
54
|
+
</el-switch>
|
|
55
|
+
</div>
|
|
56
|
+
<div style="position:relative;height:600px">
|
|
57
|
+
<jt-table-pc
|
|
58
|
+
id="table-ptbg"
|
|
59
|
+
ref="tablePtbg"
|
|
60
|
+
tableType="bigData"
|
|
61
|
+
:data="tableData[0]"
|
|
62
|
+
:isTool="isTool"
|
|
63
|
+
:stripe="stripe"
|
|
64
|
+
:isFooter="isFooter"
|
|
65
|
+
:footConfig="footConfig"
|
|
66
|
+
:checkbox="isCheckbox"
|
|
67
|
+
:radio="isRadio"
|
|
68
|
+
:isWrap="isWrap"
|
|
69
|
+
:isSeq="isSeq"
|
|
70
|
+
@scrollBottom="scrollBottom"
|
|
71
|
+
@cellClick="cellClick"
|
|
72
|
+
@radio="radio"
|
|
73
|
+
@checkbox="checkbox"
|
|
74
|
+
:expandConfig="expandConfig"
|
|
75
|
+
:rowStyle="rowStyle"
|
|
76
|
+
:cellStyle="cellStyle"
|
|
77
|
+
:handlerConfig="handlerConfig"
|
|
78
|
+
@handlerClick="handlerClick"
|
|
79
|
+
:loading="loading"
|
|
80
|
+
:cellRenderMethods="{radioChange}"
|
|
81
|
+
>
|
|
82
|
+
</jt-table-pc>
|
|
83
|
+
</div>
|
|
84
|
+
</div>
|
|
85
|
+
</template>
|
|
86
|
+
|
|
87
|
+
<script>
|
|
88
|
+
import { data23 , data13 } from '../../packages/jt-table-pc/data2';
|
|
89
|
+
export default {
|
|
90
|
+
data(){
|
|
91
|
+
return {
|
|
92
|
+
isTool:true,
|
|
93
|
+
stripe:true,
|
|
94
|
+
tableData:[{retjson:{},DataArray:[],Result:""}],
|
|
95
|
+
footConfig:{filed:['count']},
|
|
96
|
+
isFooter:true,
|
|
97
|
+
isCheckbox:true,
|
|
98
|
+
isRadio:false,
|
|
99
|
+
isWrap:false,
|
|
100
|
+
isSeq:true,
|
|
101
|
+
loading:false,
|
|
102
|
+
expandConfig:{
|
|
103
|
+
isOpen:false, //是否开启展开行
|
|
104
|
+
width:120, //展开行列宽
|
|
105
|
+
text:'测试', //展开行说明文字
|
|
106
|
+
accordion:true, //手风琴模式
|
|
107
|
+
loadMethod:this.loadMethod //内容加载函数,必须返回promise
|
|
108
|
+
},
|
|
109
|
+
handlerConfig:{
|
|
110
|
+
show:true, //操作列的显示开关,默认false
|
|
111
|
+
width:250,//操作列的宽度,默认250px
|
|
112
|
+
align:'center',//操作列对齐方式,可选值`left`、`center`、`right`,默认`center`
|
|
113
|
+
fixed:'right',//操作列固定位置,可选值`left`、`right`、空串(不固定),默认`right`
|
|
114
|
+
btnGroup:false,//设置true则是下拉按钮,设置false则是并排按钮(依赖element-ui)
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
created(){
|
|
119
|
+
const res = data13();
|
|
120
|
+
this.tableData[0].retjson = res[0].retjson;
|
|
121
|
+
},
|
|
122
|
+
mounted(){
|
|
123
|
+
const res = data13();
|
|
124
|
+
let timeId = setTimeout(()=>{
|
|
125
|
+
this.$refs.tablePtbg.loadData(res[0].DataArray);
|
|
126
|
+
clearTimeout(timeId);
|
|
127
|
+
},0)
|
|
128
|
+
},
|
|
129
|
+
methods:{
|
|
130
|
+
//导出数据
|
|
131
|
+
exportTableData(){
|
|
132
|
+
this.$refs.tablePtbg.exportTableData();
|
|
133
|
+
},
|
|
134
|
+
//导入数据
|
|
135
|
+
importData(){
|
|
136
|
+
this.$refs.tablePtbg.importTableData();
|
|
137
|
+
},
|
|
138
|
+
//清除数据
|
|
139
|
+
clearData(){
|
|
140
|
+
this.tableData[0].DataArray = [];
|
|
141
|
+
},
|
|
142
|
+
//滚动到底部
|
|
143
|
+
scrollBottom(idx){
|
|
144
|
+
this.$message.success('滚动到底部')
|
|
145
|
+
},
|
|
146
|
+
//单元格点击
|
|
147
|
+
cellClick(row,col){
|
|
148
|
+
if(col.type == 'checkbox' || col.type == 'radio' || col.type == 'expand' || col.title == '操作' || col.property == 'shg'){
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
this.$message.success(JSON.stringify(row),JSON.stringify(col));
|
|
152
|
+
},
|
|
153
|
+
//单选框选中的数据
|
|
154
|
+
radio(data){
|
|
155
|
+
this.$message.success(JSON.stringify(data));
|
|
156
|
+
},
|
|
157
|
+
//复选框选中的数据
|
|
158
|
+
checkbox(data){
|
|
159
|
+
this.$message.success(JSON.stringify(data));
|
|
160
|
+
},
|
|
161
|
+
//展开行懒加载
|
|
162
|
+
loadMethod({row}){
|
|
163
|
+
return new Promise(async resolve=>{
|
|
164
|
+
row.data=123; //这里是把请求的数据添加到行里面,在模版中就可以访问到了
|
|
165
|
+
resolve()
|
|
166
|
+
})
|
|
167
|
+
},
|
|
168
|
+
// 行样式
|
|
169
|
+
rowStyle({ row, rowIndex }){
|
|
170
|
+
if(rowIndex === 0){
|
|
171
|
+
return{
|
|
172
|
+
background:"#f00",
|
|
173
|
+
color:"#fff"
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
// 单元格样式
|
|
178
|
+
cellStyle({ row, rowIndex, column, columnIndex }){
|
|
179
|
+
if(rowIndex === 1 && columnIndex ===3){
|
|
180
|
+
return{
|
|
181
|
+
background:"#fe32a3"
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
//操作列
|
|
186
|
+
handlerClick(value,row){
|
|
187
|
+
//value是接口配置的值,row是当前行的数据
|
|
188
|
+
console.log(value,row);
|
|
189
|
+
},
|
|
190
|
+
//单元格渲染 - 单选
|
|
191
|
+
radioChange({row,property,val,params}){
|
|
192
|
+
return new Promise(async resolve=>{
|
|
193
|
+
let random = Math.random();
|
|
194
|
+
if(random > 0.5){
|
|
195
|
+
this.$message.success('设置成功');
|
|
196
|
+
resolve(true)
|
|
197
|
+
}else{
|
|
198
|
+
this.$message.warning('设置失败');
|
|
199
|
+
resolve(false)
|
|
200
|
+
}
|
|
201
|
+
})
|
|
202
|
+
},
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
</script>
|
|
206
|
+
|
|
207
|
+
<style lang="scss" scoped>
|
|
208
|
+
|
|
209
|
+
</style>
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div style="height:100%">
|
|
3
|
+
<div style="margin-bottom:12px;">
|
|
4
|
+
<!-- <el-button size="mini" @click="exportTableData">导出数据</el-button>
|
|
5
|
+
<el-button size="mini" @click="importData">导入数据</el-button> -->
|
|
6
|
+
<el-button size="mini" @click="clearData">清空数据</el-button>
|
|
7
|
+
<el-switch
|
|
8
|
+
v-model="isTool"
|
|
9
|
+
active-color="#13ce66"
|
|
10
|
+
inactive-text="筛选列"
|
|
11
|
+
inactive-color="#ff4949">
|
|
12
|
+
</el-switch>
|
|
13
|
+
<el-switch
|
|
14
|
+
style="margin-left:10px;"
|
|
15
|
+
v-model="isCheckbox"
|
|
16
|
+
active-color="#13ce66"
|
|
17
|
+
inactive-text="复选框"
|
|
18
|
+
inactive-color="#ff4949">
|
|
19
|
+
</el-switch>
|
|
20
|
+
<el-switch
|
|
21
|
+
style="margin-left:10px;"
|
|
22
|
+
v-model="isWrap"
|
|
23
|
+
active-color="#13ce66"
|
|
24
|
+
inactive-text="表头换行"
|
|
25
|
+
inactive-color="#ff4949">
|
|
26
|
+
</el-switch>
|
|
27
|
+
<el-switch
|
|
28
|
+
style="margin-left:10px;"
|
|
29
|
+
v-model="isSeq"
|
|
30
|
+
active-color="#13ce66"
|
|
31
|
+
inactive-text="序号"
|
|
32
|
+
inactive-color="#ff4949">
|
|
33
|
+
</el-switch>
|
|
34
|
+
<el-switch
|
|
35
|
+
style="margin-left:10px;"
|
|
36
|
+
v-model="loading"
|
|
37
|
+
active-color="#13ce66"
|
|
38
|
+
inactive-text="加载动画"
|
|
39
|
+
inactive-color="#ff4949">
|
|
40
|
+
</el-switch>
|
|
41
|
+
</div>
|
|
42
|
+
<div style="position:relative;height:600px">
|
|
43
|
+
<jt-table-pc
|
|
44
|
+
id="table-ptbg"
|
|
45
|
+
ref="tablePtbg"
|
|
46
|
+
tableType="group"
|
|
47
|
+
:data="tableData[0]"
|
|
48
|
+
:isTool="isTool"
|
|
49
|
+
:stripe="stripe"
|
|
50
|
+
:isFooter="isFooter"
|
|
51
|
+
:footConfig="footConfig"
|
|
52
|
+
:checkbox="isCheckbox"
|
|
53
|
+
:isExpand="false"
|
|
54
|
+
:radio="isRadio"
|
|
55
|
+
:isWrap="isWrap"
|
|
56
|
+
:isSeq="isSeq"
|
|
57
|
+
@scrollBottom="scrollBottom"
|
|
58
|
+
@cellClick="cellClick"
|
|
59
|
+
@radio="radio"
|
|
60
|
+
@checkbox="checkbox"
|
|
61
|
+
:expandConfig="expandConfig"
|
|
62
|
+
:handlerConfig="handlerConfig"
|
|
63
|
+
@handlerClick="handlerClick"
|
|
64
|
+
:loading="loading"
|
|
65
|
+
>
|
|
66
|
+
</jt-table-pc>
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
69
|
+
</template>
|
|
70
|
+
|
|
71
|
+
<script>
|
|
72
|
+
import { data23 , data13 } from '../../packages/jt-table-pc/data2';
|
|
73
|
+
export default {
|
|
74
|
+
data(){
|
|
75
|
+
return {
|
|
76
|
+
isTool:true,
|
|
77
|
+
stripe:true,
|
|
78
|
+
tableData:[{retjson:{},DataArray:[],Result:""}],
|
|
79
|
+
footConfig:{filed:['count']},
|
|
80
|
+
isFooter:true,
|
|
81
|
+
isCheckbox:true,
|
|
82
|
+
isRadio:false,
|
|
83
|
+
isWrap:false,
|
|
84
|
+
isSeq:true,
|
|
85
|
+
loading:false,
|
|
86
|
+
expandConfig:{
|
|
87
|
+
isOpen:false, //是否开启展开行
|
|
88
|
+
width:120, //展开行列宽
|
|
89
|
+
text:'测试', //展开行说明文字
|
|
90
|
+
accordion:true, //手风琴模式
|
|
91
|
+
loadMethod:this.loadMethod //内容加载函数,必须返回promise
|
|
92
|
+
},
|
|
93
|
+
handlerConfig:{
|
|
94
|
+
show:true, //操作列的显示开关,默认false
|
|
95
|
+
width:250,//操作列的宽度,默认250px
|
|
96
|
+
align:'center',//操作列对齐方式,可选值`left`、`center`、`right`,默认`center`
|
|
97
|
+
fixed:'right',//操作列固定位置,可选值`left`、`right`、空串(不固定),默认`right`
|
|
98
|
+
btnGroup:false,//设置true则是下拉按钮,设置false则是并排按钮(依赖element-ui)
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
created(){
|
|
103
|
+
const res = data23();
|
|
104
|
+
this.tableData[0].retjson = res[0].retjson;
|
|
105
|
+
},
|
|
106
|
+
mounted(){
|
|
107
|
+
const res = data23();
|
|
108
|
+
let timeId = setTimeout(()=>{
|
|
109
|
+
this.$refs.tablePtbg.default2tree(res[0].DataArray,'country');
|
|
110
|
+
clearTimeout(timeId);
|
|
111
|
+
},10)
|
|
112
|
+
},
|
|
113
|
+
methods:{
|
|
114
|
+
//导出数据
|
|
115
|
+
exportTableData(){
|
|
116
|
+
this.$refs.tablePtbg.exportTableData();
|
|
117
|
+
},
|
|
118
|
+
//导入数据
|
|
119
|
+
importData(){
|
|
120
|
+
this.$refs.tablePtbg.importTableData();
|
|
121
|
+
},
|
|
122
|
+
//清除数据
|
|
123
|
+
clearData(){
|
|
124
|
+
this.tableData[0].DataArray = [];
|
|
125
|
+
},
|
|
126
|
+
//滚动到底部
|
|
127
|
+
scrollBottom(idx){
|
|
128
|
+
this.$message.success('滚动到底部')
|
|
129
|
+
},
|
|
130
|
+
//单元格点击
|
|
131
|
+
cellClick(row,col){
|
|
132
|
+
// if(col.type == 'checkbox' || col.type == 'radio' || col.type == 'expand' || col.title == '操作' || col.property == 'shg'){
|
|
133
|
+
// return;
|
|
134
|
+
// }
|
|
135
|
+
// this.$message.success(JSON.stringify(row),JSON.stringify(col));
|
|
136
|
+
},
|
|
137
|
+
//单选框选中的数据
|
|
138
|
+
radio(data){
|
|
139
|
+
this.$message.success(JSON.stringify(data));
|
|
140
|
+
},
|
|
141
|
+
//复选框选中的数据
|
|
142
|
+
checkbox(data){
|
|
143
|
+
this.$message.success(JSON.stringify(data));
|
|
144
|
+
},
|
|
145
|
+
//展开行懒加载
|
|
146
|
+
loadMethod({row}){
|
|
147
|
+
return new Promise(async resolve=>{
|
|
148
|
+
row.data=123; //这里是把请求的数据添加到行里面,在模版中就可以访问到了
|
|
149
|
+
resolve()
|
|
150
|
+
})
|
|
151
|
+
},
|
|
152
|
+
//操作列
|
|
153
|
+
handlerClick(value,row){
|
|
154
|
+
//value是接口配置的值,row是当前行的数据
|
|
155
|
+
console.log(value,row);
|
|
156
|
+
},
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
</script>
|
|
160
|
+
|
|
161
|
+
<style lang="scss" scoped>
|
|
162
|
+
|
|
163
|
+
</style>
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div style="height:100%">
|
|
3
|
+
<div style="margin-bottom:12px;">
|
|
4
|
+
<el-button size="mini" @click="exportTableData">导出数据</el-button>
|
|
5
|
+
<el-button size="mini" @click="importData">导入数据</el-button>
|
|
6
|
+
<el-button size="mini" @click="clearData">清空数据</el-button>
|
|
7
|
+
<el-switch
|
|
8
|
+
v-model="isTool"
|
|
9
|
+
active-color="#13ce66"
|
|
10
|
+
inactive-text="筛选列"
|
|
11
|
+
inactive-color="#ff4949">
|
|
12
|
+
</el-switch>
|
|
13
|
+
<el-switch
|
|
14
|
+
style="margin-left:10px;"
|
|
15
|
+
v-model="stripe"
|
|
16
|
+
active-color="#13ce66"
|
|
17
|
+
inactive-text="斑马线"
|
|
18
|
+
inactive-color="#ff4949">
|
|
19
|
+
</el-switch>
|
|
20
|
+
<el-switch
|
|
21
|
+
style="margin-left:10px;"
|
|
22
|
+
v-model="isFooter"
|
|
23
|
+
active-color="#13ce66"
|
|
24
|
+
inactive-text="表尾"
|
|
25
|
+
inactive-color="#ff4949">
|
|
26
|
+
</el-switch>
|
|
27
|
+
<el-switch
|
|
28
|
+
style="margin-left:10px;"
|
|
29
|
+
v-model="isCheckbox"
|
|
30
|
+
active-color="#13ce66"
|
|
31
|
+
inactive-text="复选框"
|
|
32
|
+
inactive-color="#ff4949">
|
|
33
|
+
</el-switch>
|
|
34
|
+
<el-switch
|
|
35
|
+
style="margin-left:10px;"
|
|
36
|
+
v-model="isRadio"
|
|
37
|
+
active-color="#13ce66"
|
|
38
|
+
inactive-text="单选框"
|
|
39
|
+
inactive-color="#ff4949">
|
|
40
|
+
</el-switch>
|
|
41
|
+
<el-switch
|
|
42
|
+
style="margin-left:10px;"
|
|
43
|
+
v-model="expandConfig.isOpen"
|
|
44
|
+
active-color="#13ce66"
|
|
45
|
+
inactive-text="展开行"
|
|
46
|
+
inactive-color="#ff4949">
|
|
47
|
+
</el-switch>
|
|
48
|
+
<el-switch
|
|
49
|
+
style="margin-left:10px;"
|
|
50
|
+
v-model="isWrap"
|
|
51
|
+
active-color="#13ce66"
|
|
52
|
+
inactive-text="表头换行"
|
|
53
|
+
inactive-color="#ff4949">
|
|
54
|
+
</el-switch>
|
|
55
|
+
<el-switch
|
|
56
|
+
style="margin-left:10px;"
|
|
57
|
+
v-model="isSeq"
|
|
58
|
+
active-color="#13ce66"
|
|
59
|
+
inactive-text="序号"
|
|
60
|
+
inactive-color="#ff4949">
|
|
61
|
+
</el-switch>
|
|
62
|
+
<el-switch
|
|
63
|
+
style="margin-left:10px;"
|
|
64
|
+
v-model="loading"
|
|
65
|
+
active-color="#13ce66"
|
|
66
|
+
inactive-text="加载动画"
|
|
67
|
+
inactive-color="#ff4949">
|
|
68
|
+
</el-switch>
|
|
69
|
+
</div>
|
|
70
|
+
<div style="position:relative;height:600px">
|
|
71
|
+
<jt-table-pc
|
|
72
|
+
id="table-ptbg"
|
|
73
|
+
ref="tablePtbg"
|
|
74
|
+
:data="tableData[0]"
|
|
75
|
+
:isTool="isTool"
|
|
76
|
+
:stripe="stripe"
|
|
77
|
+
:isFooter="isFooter"
|
|
78
|
+
:footConfig="footConfig"
|
|
79
|
+
:checkbox="isCheckbox"
|
|
80
|
+
:radio="isRadio"
|
|
81
|
+
:isWrap="isWrap"
|
|
82
|
+
:isSeq="isSeq"
|
|
83
|
+
@scrollBottom="scrollBottom"
|
|
84
|
+
@cellClick="cellClick"
|
|
85
|
+
@radio="radio"
|
|
86
|
+
@checkbox="checkbox"
|
|
87
|
+
:expandConfig="expandConfig"
|
|
88
|
+
:rowStyle="rowStyle"
|
|
89
|
+
:cellStyle="cellStyle"
|
|
90
|
+
:handlerConfig="handlerConfig"
|
|
91
|
+
@handlerClick="handlerClick"
|
|
92
|
+
:loading="loading"
|
|
93
|
+
:cellRenderMethods="{radioChange}"
|
|
94
|
+
>
|
|
95
|
+
</jt-table-pc>
|
|
96
|
+
</div>
|
|
97
|
+
</div>
|
|
98
|
+
</template>
|
|
99
|
+
|
|
100
|
+
<script>
|
|
101
|
+
import { data23 , data13 } from '../../packages/jt-table-pc/data2';
|
|
102
|
+
export default {
|
|
103
|
+
data(){
|
|
104
|
+
return {
|
|
105
|
+
isTool:true,
|
|
106
|
+
stripe:true,
|
|
107
|
+
tableData:[{retjson:{},DataArray:[],Result:""}],
|
|
108
|
+
footConfig:{filed:['count']},
|
|
109
|
+
isFooter:true,
|
|
110
|
+
isCheckbox:true,
|
|
111
|
+
isRadio:false,
|
|
112
|
+
isWrap:false,
|
|
113
|
+
isSeq:true,
|
|
114
|
+
loading:false,
|
|
115
|
+
expandConfig:{
|
|
116
|
+
isOpen:false, //是否开启展开行
|
|
117
|
+
width:120, //展开行列宽
|
|
118
|
+
text:'测试', //展开行说明文字
|
|
119
|
+
accordion:true, //手风琴模式
|
|
120
|
+
loadMethod:this.loadMethod //内容加载函数,必须返回promise
|
|
121
|
+
},
|
|
122
|
+
handlerConfig:{
|
|
123
|
+
show:true, //操作列的显示开关,默认false
|
|
124
|
+
width:250,//操作列的宽度,默认250px
|
|
125
|
+
align:'center',//操作列对齐方式,可选值`left`、`center`、`right`,默认`center`
|
|
126
|
+
fixed:'right',//操作列固定位置,可选值`left`、`right`、空串(不固定),默认`right`
|
|
127
|
+
btnGroup:false,//设置true则是下拉按钮,设置false则是并排按钮(依赖element-ui)
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
created(){
|
|
132
|
+
const res = data23();
|
|
133
|
+
this.tableData[0].retjson = res[0].retjson;
|
|
134
|
+
},
|
|
135
|
+
mounted(){
|
|
136
|
+
const res = data23();
|
|
137
|
+
let timeId = setTimeout(()=>{
|
|
138
|
+
this.$refs.tablePtbg.loadData(res[0].DataArray);
|
|
139
|
+
clearTimeout(timeId);
|
|
140
|
+
},0)
|
|
141
|
+
},
|
|
142
|
+
methods:{
|
|
143
|
+
//导出数据
|
|
144
|
+
exportTableData(){
|
|
145
|
+
this.$refs.tablePtbg.exportTableData();
|
|
146
|
+
},
|
|
147
|
+
//导入数据
|
|
148
|
+
importData(){
|
|
149
|
+
this.$refs.tablePtbg.importTableData();
|
|
150
|
+
},
|
|
151
|
+
//清除数据
|
|
152
|
+
clearData(){
|
|
153
|
+
this.tableData[0].DataArray = [];
|
|
154
|
+
},
|
|
155
|
+
//滚动到底部
|
|
156
|
+
scrollBottom(idx){
|
|
157
|
+
this.$message.success('滚动到底部')
|
|
158
|
+
},
|
|
159
|
+
//单元格点击
|
|
160
|
+
cellClick(row,col){
|
|
161
|
+
if(col.type == 'checkbox' || col.type == 'radio' || col.type == 'expand' || col.title == '操作' || col.property == 'shg'){
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
this.$message.success(JSON.stringify(row),JSON.stringify(col));
|
|
165
|
+
},
|
|
166
|
+
//单选框选中的数据
|
|
167
|
+
radio(data){
|
|
168
|
+
this.$message.success(JSON.stringify(data));
|
|
169
|
+
},
|
|
170
|
+
//复选框选中的数据
|
|
171
|
+
checkbox(data){
|
|
172
|
+
this.$message.success(JSON.stringify(data));
|
|
173
|
+
},
|
|
174
|
+
//展开行懒加载
|
|
175
|
+
loadMethod({row}){
|
|
176
|
+
return new Promise(async resolve=>{
|
|
177
|
+
row.data=123; //这里是把请求的数据添加到行里面,在模版中就可以访问到了
|
|
178
|
+
resolve()
|
|
179
|
+
})
|
|
180
|
+
},
|
|
181
|
+
// 行样式
|
|
182
|
+
rowStyle({ row, rowIndex }){
|
|
183
|
+
if(rowIndex === 0){
|
|
184
|
+
return{
|
|
185
|
+
background:"#f00",
|
|
186
|
+
color:"#fff"
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
// 单元格样式
|
|
191
|
+
cellStyle({ row, rowIndex, column, columnIndex }){
|
|
192
|
+
if(rowIndex === 1 && columnIndex ===3){
|
|
193
|
+
return{
|
|
194
|
+
background:"#fe32a3"
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
//操作列
|
|
199
|
+
handlerClick(value,row){
|
|
200
|
+
//value是接口配置的值,row是当前行的数据
|
|
201
|
+
console.log(value,row);
|
|
202
|
+
},
|
|
203
|
+
//单元格渲染 - 单选
|
|
204
|
+
radioChange({row,property,val,params}){
|
|
205
|
+
return new Promise(async resolve=>{
|
|
206
|
+
let random = Math.random();
|
|
207
|
+
if(random > 0.5){
|
|
208
|
+
this.$message.success('设置成功');
|
|
209
|
+
resolve(true)
|
|
210
|
+
}else{
|
|
211
|
+
this.$message.warning('设置失败');
|
|
212
|
+
resolve(false)
|
|
213
|
+
}
|
|
214
|
+
})
|
|
215
|
+
},
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
</script>
|
|
219
|
+
|
|
220
|
+
<style lang="scss" scoped>
|
|
221
|
+
|
|
222
|
+
</style>
|