Skip to content

Commit e2e5faf

Browse files
Merge remote-tracking branch 'origin/dev' into dev
2 parents 531e4aa + 383a353 commit e2e5faf

File tree

1 file changed

+54
-8
lines changed
  • website/public/static/demo/vue-mapboxgl/example/vue-control

1 file changed

+54
-8
lines changed

website/public/static/demo/vue-mapboxgl/example/vue-control/table.htm

Lines changed: 54 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@
4646
v-bind:data-source="dataSource"
4747
v-bind:pagination="pagination"
4848
v-bind:columns="columns"
49+
v-on:pageChanged="pageChanged"
50+
v-on:sorted="sorted"
51+
v-on:fullScreen="fullScreen"
52+
v-on:originScreen="originScreen"
4953
v-show="show"
5054
>
5155
</mapgis-base-table>
@@ -91,26 +95,68 @@
9195
},
9296
methods: {
9397
serviceLoaded(service){
98+
//初始化服务事件
9499
this.service = service;
95100
this.getData();
96101
},
97102
getData(){
98-
this.query(0,10,undefined,undefined,true);
103+
this.query({
104+
//因为query方法中会减1,因此这里设为1,表示请求第0分页
105+
current: 1,
106+
pageSize: 10
107+
},undefined,undefined);
99108
},
100-
query(pageIndex,pagination,orderBy,isAsc,initial){
109+
pageChanged(pagination,sorter){
110+
//分页事件
111+
this.query(pagination,sorter);
112+
},
113+
sorted(sorter,pagination){
114+
//排序事件
115+
this.query(pagination,sorter);
116+
},
117+
fullScreen(pageInfo,sorter){
118+
//全屏事件
119+
this.query(pageInfo,sorter,pageInfo.pageSize);
120+
},
121+
originScreen(pageInfo,sorter){
122+
//收起全屏事件
123+
this.query(pageInfo,sorter,pageInfo.pageSize);
124+
},
125+
query(pageInfo,sorter,pageSize){
126+
//设置排序规则
127+
var isAsc = false;
128+
if(!sorter){
129+
sorter = {};
130+
sorter.columnKey = "";
131+
} else if(sorter.order === "ascend"){
132+
isAsc = true;
133+
}else if(sorter.order === "") {
134+
sorter.columnKey = "";
135+
}
101136
var vm = this;
137+
//设置查询参数
102138
var sql = this.service.$_getSQLParameter({
139+
//查询图层id为1的图层
103140
layers: "1",
104-
where: '',
105-
pageIndex: pageIndex,
106-
pagination: pagination,
107-
orderBy: orderBy,
108-
isAsc: isAsc
141+
//设置分页信息
142+
pageIndex: pageInfo.current - 1,
143+
pagination: pageInfo.pageSize,
144+
//设置排序字段
145+
orderBy: sorter.columnKey,
146+
//设置是升序(true)还是降序(false)
147+
isAsc: isAsc,
148+
//设置是否返回几何信息,false不返回
149+
IncludeGeometry: false
109150
})
110-
//zondy格式
151+
//查询数据
111152
vm.service.$_queryBySQL(sql,function (result) {
112153
vm.dataSource = result;
154+
//设置分页信息中
113155
vm.pagination.total = result.TotalCount;
156+
if(pageSize){
157+
vm.pagination.pageSize = pageSize;
158+
}
159+
//请求完成后显示表格
114160
vm.show = true;
115161
},function () {})
116162
}

0 commit comments

Comments
 (0)