From 16a152e5eae1c643bfb6d5bda166a96e852c703e Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Tue, 18 Feb 2020 13:49:06 +0800 Subject: [PATCH 01/11] workspace page limit --- .../controller/WorkspaceController.java | 11 +++-- .../components/project/MsProject.vue | 6 ++- .../components/settings/Workspace.vue | 43 ++++++++++++++++--- 3 files changed, 50 insertions(+), 10 deletions(-) diff --git a/backend/src/main/java/io/metersphere/controller/WorkspaceController.java b/backend/src/main/java/io/metersphere/controller/WorkspaceController.java index ad910bdb32..082dc96c12 100644 --- a/backend/src/main/java/io/metersphere/controller/WorkspaceController.java +++ b/backend/src/main/java/io/metersphere/controller/WorkspaceController.java @@ -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 getWorkspaceList() { - return workspaceService.getWorkspaceList(); + @PostMapping("list/{goPage}/{pageSize}") + public Pager> getWorkspaceList(@PathVariable int goPage, @PathVariable int pageSize) { + Page page = PageHelper.startPage(goPage, pageSize, true); + return PageUtils.setPageInfo(page, workspaceService.getWorkspaceList()); } } diff --git a/frontend/src/performance/components/project/MsProject.vue b/frontend/src/performance/components/project/MsProject.vue index 2d8e335ceb..d96d48226c 100644 --- a/frontend/src/performance/components/project/MsProject.vue +++ b/frontend/src/performance/components/project/MsProject.vue @@ -4,7 +4,10 @@
- 项目 + + 项目 + + @@ -22,7 +25,6 @@ - diff --git a/frontend/src/performance/components/settings/Workspace.vue b/frontend/src/performance/components/settings/Workspace.vue index 81e3dc79fe..6a9536b4a2 100644 --- a/frontend/src/performance/components/settings/Workspace.vue +++ b/frontend/src/performance/components/settings/Workspace.vue @@ -3,7 +3,10 @@
- 工作空间 + + 工作空间 + + @@ -20,8 +23,25 @@ +
+ + +
+ + +
+
+
+
- + @@ -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: "" From be1daa5e87f176f40d721248d77c4b1fe5ee93e2 Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Tue, 18 Feb 2020 14:06:47 +0800 Subject: [PATCH 02/11] project page limit --- .../components/project/MsProject.vue | 31 +++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/frontend/src/performance/components/project/MsProject.vue b/frontend/src/performance/components/project/MsProject.vue index d96d48226c..d511b059c5 100644 --- a/frontend/src/performance/components/project/MsProject.vue +++ b/frontend/src/performance/components/project/MsProject.vue @@ -24,6 +24,23 @@ +
+ + +
+ + +
+
+
+
@@ -58,6 +75,9 @@ condition: "", items: [], form: {}, + currentPage: 1, + pageSize: 5, + total: 0, rules: { name: [ {required: true, message: '请输入项目名称', trigger: 'blur'}, @@ -115,10 +135,17 @@ }); }, list() { - this.$post("/project/list/1/10", {}, (response) => { + let url = "/project/list/" + this.currentPage + '/' + this.pageSize; + this.$post(url, {}, (response) => { this.items = response.data; }) - } + }, + handleSizeChange(size) { + this.pageSize = size; + }, + handleCurrentChange(current) { + this.currentPage = current; + }, } } From e3825f388ac5fea5c902c7338afa0ff3d3c5dd3b Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Tue, 18 Feb 2020 14:16:23 +0800 Subject: [PATCH 03/11] project page --- frontend/src/performance/components/project/MsProject.vue | 2 ++ frontend/src/performance/components/settings/Workspace.vue | 2 ++ 2 files changed, 4 insertions(+) diff --git a/frontend/src/performance/components/project/MsProject.vue b/frontend/src/performance/components/project/MsProject.vue index d511b059c5..65adbe61e8 100644 --- a/frontend/src/performance/components/project/MsProject.vue +++ b/frontend/src/performance/components/project/MsProject.vue @@ -142,9 +142,11 @@ }, handleSizeChange(size) { this.pageSize = size; + this.list(); }, handleCurrentChange(current) { this.currentPage = current; + this.list(); }, } } diff --git a/frontend/src/performance/components/settings/Workspace.vue b/frontend/src/performance/components/settings/Workspace.vue index 6a9536b4a2..70becce73b 100644 --- a/frontend/src/performance/components/settings/Workspace.vue +++ b/frontend/src/performance/components/settings/Workspace.vue @@ -126,9 +126,11 @@ }, handleSizeChange(size) { this.pageSize = size; + this.list(); }, handleCurrentChange(current) { this.currentPage = current; + this.list(); }, }, data() { From ae13d33279228fc431bdcfa71274a6a6c10b73ef Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Tue, 18 Feb 2020 15:35:31 +0800 Subject: [PATCH 04/11] user add column last_role_id --- .../java/io/metersphere/base/domain/User.java | 10 +++ .../metersphere/base/domain/UserExample.java | 70 +++++++++++++++++++ .../io/metersphere/base/mapper/UserMapper.xml | 27 +++++-- 3 files changed, 102 insertions(+), 5 deletions(-) diff --git a/backend/src/main/java/io/metersphere/base/domain/User.java b/backend/src/main/java/io/metersphere/base/domain/User.java index 1f57892f2c..8d6a18dd3f 100644 --- a/backend/src/main/java/io/metersphere/base/domain/User.java +++ b/backend/src/main/java/io/metersphere/base/domain/User.java @@ -19,6 +19,8 @@ public class User implements Serializable { private String lastSourceId; + private String lastRoleId; + private static final long serialVersionUID = 1L; public String getId() { @@ -84,4 +86,12 @@ public class User implements Serializable { public void setLastSourceId(String lastSourceId) { this.lastSourceId = lastSourceId == null ? null : lastSourceId.trim(); } + + public String getLastRoleId() { + return lastRoleId; + } + + public void setLastRoleId(String lastRoleId) { + this.lastRoleId = lastRoleId == null ? null : lastRoleId.trim(); + } } \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/domain/UserExample.java b/backend/src/main/java/io/metersphere/base/domain/UserExample.java index 7fd72a8f11..0d85de3ff4 100644 --- a/backend/src/main/java/io/metersphere/base/domain/UserExample.java +++ b/backend/src/main/java/io/metersphere/base/domain/UserExample.java @@ -643,6 +643,76 @@ public class UserExample { addCriterion("last_source_id not between", value1, value2, "lastSourceId"); return (Criteria) this; } + + public Criteria andLastRoleIdIsNull() { + addCriterion("last_role_id is null"); + return (Criteria) this; + } + + public Criteria andLastRoleIdIsNotNull() { + addCriterion("last_role_id is not null"); + return (Criteria) this; + } + + public Criteria andLastRoleIdEqualTo(String value) { + addCriterion("last_role_id =", value, "lastRoleId"); + return (Criteria) this; + } + + public Criteria andLastRoleIdNotEqualTo(String value) { + addCriterion("last_role_id <>", value, "lastRoleId"); + return (Criteria) this; + } + + public Criteria andLastRoleIdGreaterThan(String value) { + addCriterion("last_role_id >", value, "lastRoleId"); + return (Criteria) this; + } + + public Criteria andLastRoleIdGreaterThanOrEqualTo(String value) { + addCriterion("last_role_id >=", value, "lastRoleId"); + return (Criteria) this; + } + + public Criteria andLastRoleIdLessThan(String value) { + addCriterion("last_role_id <", value, "lastRoleId"); + return (Criteria) this; + } + + public Criteria andLastRoleIdLessThanOrEqualTo(String value) { + addCriterion("last_role_id <=", value, "lastRoleId"); + return (Criteria) this; + } + + public Criteria andLastRoleIdLike(String value) { + addCriterion("last_role_id like", value, "lastRoleId"); + return (Criteria) this; + } + + public Criteria andLastRoleIdNotLike(String value) { + addCriterion("last_role_id not like", value, "lastRoleId"); + return (Criteria) this; + } + + public Criteria andLastRoleIdIn(List values) { + addCriterion("last_role_id in", values, "lastRoleId"); + return (Criteria) this; + } + + public Criteria andLastRoleIdNotIn(List values) { + addCriterion("last_role_id not in", values, "lastRoleId"); + return (Criteria) this; + } + + public Criteria andLastRoleIdBetween(String value1, String value2) { + addCriterion("last_role_id between", value1, value2, "lastRoleId"); + return (Criteria) this; + } + + public Criteria andLastRoleIdNotBetween(String value1, String value2) { + addCriterion("last_role_id not between", value1, value2, "lastRoleId"); + return (Criteria) this; + } } public static class Criteria extends GeneratedCriteria { diff --git a/backend/src/main/java/io/metersphere/base/mapper/UserMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/UserMapper.xml index 2cd87f27e1..a2f56b3b20 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/UserMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/UserMapper.xml @@ -10,6 +10,7 @@ + @@ -70,7 +71,7 @@ - id, name, email, phone, status, create_time, update_time, last_source_id + id, name, email, phone, status, create_time, update_time, last_source_id, last_role_id @@ -198,6 +207,9 @@ last_source_id = #{record.lastSourceId,jdbcType=VARCHAR}, + + last_role_id = #{record.lastRoleId,jdbcType=VARCHAR}, + @@ -212,7 +224,8 @@ status = #{record.status,jdbcType=VARCHAR}, create_time = #{record.createTime,jdbcType=BIGINT}, update_time = #{record.updateTime,jdbcType=BIGINT}, - last_source_id = #{record.lastSourceId,jdbcType=VARCHAR} + last_source_id = #{record.lastSourceId,jdbcType=VARCHAR}, + last_role_id = #{record.lastRoleId,jdbcType=VARCHAR} @@ -241,6 +254,9 @@ last_source_id = #{lastSourceId,jdbcType=VARCHAR}, + + last_role_id = #{lastRoleId,jdbcType=VARCHAR}, + where id = #{id,jdbcType=VARCHAR} @@ -252,7 +268,8 @@ status = #{status,jdbcType=VARCHAR}, create_time = #{createTime,jdbcType=BIGINT}, update_time = #{updateTime,jdbcType=BIGINT}, - last_source_id = #{lastSourceId,jdbcType=VARCHAR} + last_source_id = #{lastSourceId,jdbcType=VARCHAR}, + last_role_id = #{lastRoleId,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR} \ No newline at end of file From 59b47db3bf44873f452df5338a8e5dbe1614d83a Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Tue, 18 Feb 2020 16:07:26 +0800 Subject: [PATCH 05/11] rollback column last_role_id --- .../java/io/metersphere/base/domain/User.java | 10 --- .../metersphere/base/domain/UserExample.java | 70 ------------------- .../io/metersphere/base/mapper/UserMapper.xml | 27 ++----- 3 files changed, 5 insertions(+), 102 deletions(-) diff --git a/backend/src/main/java/io/metersphere/base/domain/User.java b/backend/src/main/java/io/metersphere/base/domain/User.java index 8d6a18dd3f..1f57892f2c 100644 --- a/backend/src/main/java/io/metersphere/base/domain/User.java +++ b/backend/src/main/java/io/metersphere/base/domain/User.java @@ -19,8 +19,6 @@ public class User implements Serializable { private String lastSourceId; - private String lastRoleId; - private static final long serialVersionUID = 1L; public String getId() { @@ -86,12 +84,4 @@ public class User implements Serializable { public void setLastSourceId(String lastSourceId) { this.lastSourceId = lastSourceId == null ? null : lastSourceId.trim(); } - - public String getLastRoleId() { - return lastRoleId; - } - - public void setLastRoleId(String lastRoleId) { - this.lastRoleId = lastRoleId == null ? null : lastRoleId.trim(); - } } \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/domain/UserExample.java b/backend/src/main/java/io/metersphere/base/domain/UserExample.java index 0d85de3ff4..7fd72a8f11 100644 --- a/backend/src/main/java/io/metersphere/base/domain/UserExample.java +++ b/backend/src/main/java/io/metersphere/base/domain/UserExample.java @@ -643,76 +643,6 @@ public class UserExample { addCriterion("last_source_id not between", value1, value2, "lastSourceId"); return (Criteria) this; } - - public Criteria andLastRoleIdIsNull() { - addCriterion("last_role_id is null"); - return (Criteria) this; - } - - public Criteria andLastRoleIdIsNotNull() { - addCriterion("last_role_id is not null"); - return (Criteria) this; - } - - public Criteria andLastRoleIdEqualTo(String value) { - addCriterion("last_role_id =", value, "lastRoleId"); - return (Criteria) this; - } - - public Criteria andLastRoleIdNotEqualTo(String value) { - addCriterion("last_role_id <>", value, "lastRoleId"); - return (Criteria) this; - } - - public Criteria andLastRoleIdGreaterThan(String value) { - addCriterion("last_role_id >", value, "lastRoleId"); - return (Criteria) this; - } - - public Criteria andLastRoleIdGreaterThanOrEqualTo(String value) { - addCriterion("last_role_id >=", value, "lastRoleId"); - return (Criteria) this; - } - - public Criteria andLastRoleIdLessThan(String value) { - addCriterion("last_role_id <", value, "lastRoleId"); - return (Criteria) this; - } - - public Criteria andLastRoleIdLessThanOrEqualTo(String value) { - addCriterion("last_role_id <=", value, "lastRoleId"); - return (Criteria) this; - } - - public Criteria andLastRoleIdLike(String value) { - addCriterion("last_role_id like", value, "lastRoleId"); - return (Criteria) this; - } - - public Criteria andLastRoleIdNotLike(String value) { - addCriterion("last_role_id not like", value, "lastRoleId"); - return (Criteria) this; - } - - public Criteria andLastRoleIdIn(List values) { - addCriterion("last_role_id in", values, "lastRoleId"); - return (Criteria) this; - } - - public Criteria andLastRoleIdNotIn(List values) { - addCriterion("last_role_id not in", values, "lastRoleId"); - return (Criteria) this; - } - - public Criteria andLastRoleIdBetween(String value1, String value2) { - addCriterion("last_role_id between", value1, value2, "lastRoleId"); - return (Criteria) this; - } - - public Criteria andLastRoleIdNotBetween(String value1, String value2) { - addCriterion("last_role_id not between", value1, value2, "lastRoleId"); - return (Criteria) this; - } } public static class Criteria extends GeneratedCriteria { diff --git a/backend/src/main/java/io/metersphere/base/mapper/UserMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/UserMapper.xml index a2f56b3b20..2cd87f27e1 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/UserMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/UserMapper.xml @@ -10,7 +10,6 @@ - @@ -71,7 +70,7 @@ - id, name, email, phone, status, create_time, update_time, last_source_id, last_role_id + id, name, email, phone, status, create_time, update_time, last_source_id @@ -207,9 +198,6 @@ last_source_id = #{record.lastSourceId,jdbcType=VARCHAR}, - - last_role_id = #{record.lastRoleId,jdbcType=VARCHAR}, - @@ -224,8 +212,7 @@ status = #{record.status,jdbcType=VARCHAR}, create_time = #{record.createTime,jdbcType=BIGINT}, update_time = #{record.updateTime,jdbcType=BIGINT}, - last_source_id = #{record.lastSourceId,jdbcType=VARCHAR}, - last_role_id = #{record.lastRoleId,jdbcType=VARCHAR} + last_source_id = #{record.lastSourceId,jdbcType=VARCHAR} @@ -254,9 +241,6 @@ last_source_id = #{lastSourceId,jdbcType=VARCHAR}, - - last_role_id = #{lastRoleId,jdbcType=VARCHAR}, - where id = #{id,jdbcType=VARCHAR} @@ -268,8 +252,7 @@ status = #{status,jdbcType=VARCHAR}, create_time = #{createTime,jdbcType=BIGINT}, update_time = #{updateTime,jdbcType=BIGINT}, - last_source_id = #{lastSourceId,jdbcType=VARCHAR}, - last_role_id = #{lastRoleId,jdbcType=VARCHAR} + last_source_id = #{lastSourceId,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR} \ No newline at end of file From 6c93ec36f90aa4f486467226c374b0134d27bce5 Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Tue, 18 Feb 2020 16:21:31 +0800 Subject: [PATCH 06/11] require roles --- .../java/io/metersphere/controller/ProjectController.java | 6 ++++++ .../java/io/metersphere/controller/WorkspaceController.java | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/backend/src/main/java/io/metersphere/controller/ProjectController.java b/backend/src/main/java/io/metersphere/controller/ProjectController.java index acf07500a0..a9d414afb4 100644 --- a/backend/src/main/java/io/metersphere/controller/ProjectController.java +++ b/backend/src/main/java/io/metersphere/controller/ProjectController.java @@ -3,9 +3,11 @@ package io.metersphere.controller; import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; import io.metersphere.base.domain.Project; +import io.metersphere.commons.constants.RoleConstants; import io.metersphere.commons.utils.PageUtils; import io.metersphere.commons.utils.Pager; import io.metersphere.service.ProjectService; +import org.apache.shiro.authz.annotation.RequiresRoles; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; @@ -24,22 +26,26 @@ public class ProjectController { } @PostMapping("/add") + @RequiresRoles(RoleConstants.TEST_MANAGER) public Project addProject(@RequestBody Project project) { return projectService.addProject(project); } @PostMapping("/list/{goPage}/{pageSize}") + @RequiresRoles(RoleConstants.TEST_MANAGER) public Pager> getProjectList(@PathVariable int goPage, @PathVariable int pageSize) { Page page = PageHelper.startPage(goPage, pageSize, true); return PageUtils.setPageInfo(page, projectService.getProjectList()); } @GetMapping("/delete/{projectId}") + @RequiresRoles(RoleConstants.TEST_MANAGER) public void deleteProject(@PathVariable(value = "projectId") String projectId) { projectService.deleteProject(projectId); } @PostMapping("/update") + @RequiresRoles(RoleConstants.TEST_MANAGER) public void updateProject(@RequestBody Project Project) { projectService.updateProject(Project); } diff --git a/backend/src/main/java/io/metersphere/controller/WorkspaceController.java b/backend/src/main/java/io/metersphere/controller/WorkspaceController.java index 082dc96c12..c43cffb329 100644 --- a/backend/src/main/java/io/metersphere/controller/WorkspaceController.java +++ b/backend/src/main/java/io/metersphere/controller/WorkspaceController.java @@ -3,9 +3,11 @@ package io.metersphere.controller; import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; import io.metersphere.base.domain.Workspace; +import io.metersphere.commons.constants.RoleConstants; import io.metersphere.commons.utils.PageUtils; import io.metersphere.commons.utils.Pager; import io.metersphere.service.WorkspaceService; +import org.apache.shiro.authz.annotation.RequiresRoles; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; @@ -18,16 +20,19 @@ public class WorkspaceController { private WorkspaceService workspaceService; @PostMapping("save") + @RequiresRoles(RoleConstants.ORG_ADMIN) public Workspace saveWorkspace(@RequestBody Workspace workspace) { return workspaceService.saveWorkspace(workspace); } @GetMapping("delete/{workspaceId}") + @RequiresRoles(RoleConstants.ORG_ADMIN) public void saveWorkspace(@PathVariable String workspaceId) { workspaceService.deleteWorkspace(workspaceId); } @PostMapping("list/{goPage}/{pageSize}") + @RequiresRoles(RoleConstants.ORG_ADMIN) public Pager> getWorkspaceList(@PathVariable int goPage, @PathVariable int pageSize) { Page page = PageHelper.startPage(goPage, pageSize, true); return PageUtils.setPageInfo(page, workspaceService.getWorkspaceList()); From 40f0159f891e25e4c525751b884045dbf9e9fc9b Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Tue, 18 Feb 2020 16:27:25 +0800 Subject: [PATCH 07/11] workspace check owner --- .../metersphere/controller/WorkspaceController.java | 12 ++++++++++-- .../io/metersphere/service/WorkspaceService.java | 5 +++++ .../performance/components/settings/Workspace.vue | 8 ++++++-- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/backend/src/main/java/io/metersphere/controller/WorkspaceController.java b/backend/src/main/java/io/metersphere/controller/WorkspaceController.java index c43cffb329..52efa2cff9 100644 --- a/backend/src/main/java/io/metersphere/controller/WorkspaceController.java +++ b/backend/src/main/java/io/metersphere/controller/WorkspaceController.java @@ -19,15 +19,23 @@ public class WorkspaceController { @Resource private WorkspaceService workspaceService; - @PostMapping("save") + @PostMapping("add") @RequiresRoles(RoleConstants.ORG_ADMIN) - public Workspace saveWorkspace(@RequestBody Workspace workspace) { + public Workspace addWorkspace(@RequestBody Workspace workspace) { + return workspaceService.saveWorkspace(workspace); + } + + @PostMapping("update") + @RequiresRoles(RoleConstants.ORG_ADMIN) + public Workspace updateWorkspace(@RequestBody Workspace workspace) { + workspaceService.checkOwner(workspace.getId()); return workspaceService.saveWorkspace(workspace); } @GetMapping("delete/{workspaceId}") @RequiresRoles(RoleConstants.ORG_ADMIN) public void saveWorkspace(@PathVariable String workspaceId) { + workspaceService.checkOwner(workspaceId); workspaceService.deleteWorkspace(workspaceId); } diff --git a/backend/src/main/java/io/metersphere/service/WorkspaceService.java b/backend/src/main/java/io/metersphere/service/WorkspaceService.java index 98bbf6e036..eab372637b 100644 --- a/backend/src/main/java/io/metersphere/service/WorkspaceService.java +++ b/backend/src/main/java/io/metersphere/service/WorkspaceService.java @@ -45,4 +45,9 @@ public class WorkspaceService { public void deleteWorkspace(String workspaceId) { workspaceMapper.deleteByPrimaryKey(workspaceId); } + + public void checkOwner(String workspaceId) { + // TODO 验证当前用户是否拥有当前此空间权限 + } + } diff --git a/frontend/src/performance/components/settings/Workspace.vue b/frontend/src/performance/components/settings/Workspace.vue index 70becce73b..024fd8ca7e 100644 --- a/frontend/src/performance/components/settings/Workspace.vue +++ b/frontend/src/performance/components/settings/Workspace.vue @@ -77,12 +77,16 @@ this.$refs[formName].validate((valid) => { if (valid) { this.loading = true; - this.$post("/workspace/save", this.form, () => { + let saveType = 'add'; + if (this.form.id) { + saveType = 'update' + } + this.$post("/workspace/" + saveType, this.form, () => { this.createVisible = false; this.loading = false; this.list(); Message.success('保存成功'); - }) + }); } else { return false; } From 71cf45d8af55a2d12e98fdc3369fe015fdcb30a9 Mon Sep 17 00:00:00 2001 From: W23123 <1021720039@qq.com> Date: Tue, 18 Feb 2020 17:20:21 +0800 Subject: [PATCH 08/11] =?UTF-8?q?=E6=88=90=E5=91=98=E7=AE=A1=E7=90=86=200.?= =?UTF-8?q?9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/UserController.java | 6 +- .../components/settings/Member.vue | 64 ++++++++++++++----- 2 files changed, 52 insertions(+), 18 deletions(-) diff --git a/backend/src/main/java/io/metersphere/controller/UserController.java b/backend/src/main/java/io/metersphere/controller/UserController.java index 1d163c170b..d68f14d03f 100644 --- a/backend/src/main/java/io/metersphere/controller/UserController.java +++ b/backend/src/main/java/io/metersphere/controller/UserController.java @@ -71,7 +71,7 @@ public class UserController { * 获取成员用户 */ @PostMapping("/member/list/{goPage}/{pageSize}") - @RequiresRoles(RoleConstants.TEST_MANAGER) + //@RequiresRoles(RoleConstants.TEST_MANAGER) public Pager> getMemberList(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryMemberRequest request) { Page page = PageHelper.startPage(goPage, pageSize, true); return PageUtils.setPageInfo(page, userService.getMemberList(request)); @@ -81,7 +81,7 @@ public class UserController { * 添加成员 */ @PostMapping("/member/add") - @RequiresRoles(RoleConstants.TEST_MANAGER) + //@RequiresRoles(RoleConstants.TEST_MANAGER) public void addMember(@RequestBody AddMemberRequest request) { userService.addMember(request); } @@ -90,7 +90,7 @@ public class UserController { * 删除成员 */ @GetMapping("/member/delete/{workspaceId}/{userId}") - @RequiresRoles(RoleConstants.TEST_MANAGER) + //@RequiresRoles(RoleConstants.TEST_MANAGER) public void deleteMember(@PathVariable String workspaceId, @PathVariable String userId) { userService.deleteMember(workspaceId, userId); } diff --git a/frontend/src/performance/components/settings/Member.vue b/frontend/src/performance/components/settings/Member.vue index 1c637749b6..677b16525d 100644 --- a/frontend/src/performance/components/settings/Member.vue +++ b/frontend/src/performance/components/settings/Member.vue @@ -42,16 +42,20 @@ - - - - - - + + + + + + - 创建 + 保存 @@ -59,7 +63,6 @@