workspace page limit
This commit is contained in:
parent
d347a6dbe8
commit
16a152e5ea
|
@ -1,6 +1,10 @@
|
|||
package io.metersphere.controller;
|
||||
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import io.metersphere.base.domain.Workspace;
|
||||
import io.metersphere.commons.utils.PageUtils;
|
||||
import io.metersphere.commons.utils.Pager;
|
||||
import io.metersphere.service.WorkspaceService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
@ -23,8 +27,9 @@ public class WorkspaceController {
|
|||
workspaceService.deleteWorkspace(workspaceId);
|
||||
}
|
||||
|
||||
@PostMapping("list")
|
||||
public List<Workspace> getWorkspaceList() {
|
||||
return workspaceService.getWorkspaceList();
|
||||
@PostMapping("list/{goPage}/{pageSize}")
|
||||
public Pager<List<Workspace>> getWorkspaceList(@PathVariable int goPage, @PathVariable int pageSize) {
|
||||
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
||||
return PageUtils.setPageInfo(page, workspaceService.getWorkspaceList());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,10 @@
|
|||
<el-card>
|
||||
<div slot="header">
|
||||
<el-row type="flex" justify="space-between" align="middle">
|
||||
<span class="title">项目</span>
|
||||
<span class="title">
|
||||
项目
|
||||
<ms-create-box :tips="btnTips" :exec="create"/>
|
||||
</span>
|
||||
<span class="search">
|
||||
<el-input type="text" size="small" placeholder="根据名称搜索" prefix-icon="el-icon-search"
|
||||
maxlength="60" v-model="condition" clearable/>
|
||||
|
@ -22,7 +25,6 @@
|
|||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
<ms-create-box :tips="btnTips" :exec="create"/>
|
||||
|
||||
<el-dialog title="创建项目" :visible.sync="createVisible">
|
||||
<el-form :model="form" :rules="rules" ref="form" label-position="left" label-width="100px" size="small">
|
||||
|
|
|
@ -3,7 +3,10 @@
|
|||
<el-card>
|
||||
<div slot="header">
|
||||
<el-row type="flex" justify="space-between" align="middle">
|
||||
<span class="title">工作空间</span>
|
||||
<span class="title">
|
||||
工作空间
|
||||
<ms-create-box :tips="btnTips" :exec="create"/>
|
||||
</span>
|
||||
<span class="search">
|
||||
<el-input type="text" size="small" placeholder="根据名称搜索" prefix-icon="el-icon-search"
|
||||
maxlength="60" v-model="condition" clearable/>
|
||||
|
@ -20,8 +23,25 @@
|
|||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div>
|
||||
<el-row>
|
||||
<el-col :span="22" :offset="1">
|
||||
<div class="table-page">
|
||||
<el-pagination
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
:current-page.sync="currentPage"
|
||||
:page-sizes="[5, 10, 20, 50, 100]"
|
||||
:page-size="pageSize"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="total">
|
||||
</el-pagination>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</el-card>
|
||||
<ms-create-box :tips="btnTips" :exec="create"/>
|
||||
|
||||
<el-dialog title="创建工作空间" :visible.sync="createVisible" width="30%">
|
||||
<el-form :model="form" :rules="rules" ref="form" label-position="left" label-width="100px" size="small">
|
||||
<el-form-item label="名称" prop="name">
|
||||
|
@ -96,10 +116,20 @@
|
|||
});
|
||||
},
|
||||
list() {
|
||||
this.$post('/workspace/list', {}, response => {
|
||||
this.items = response.data;
|
||||
let url = '/workspace/list/' + this.currentPage + '/' + this.pageSize;
|
||||
this.$post(url, {}, response => {
|
||||
let data = response.data;
|
||||
|
||||
this.items = data.listObject;
|
||||
this.total = data.itemCount;
|
||||
})
|
||||
}
|
||||
},
|
||||
handleSizeChange(size) {
|
||||
this.pageSize = size;
|
||||
},
|
||||
handleCurrentChange(current) {
|
||||
this.currentPage = current;
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
@ -108,6 +138,9 @@
|
|||
btnTips: "添加工作空间",
|
||||
condition: "",
|
||||
items: [],
|
||||
currentPage: 1,
|
||||
pageSize: 5,
|
||||
total: 0,
|
||||
form: {
|
||||
// name: "",
|
||||
// description: ""
|
||||
|
|
Loading…
Reference in New Issue