成员管理 0.9

This commit is contained in:
W23123 2020-02-18 17:20:21 +08:00
parent d347a6dbe8
commit 71cf45d8af
2 changed files with 52 additions and 18 deletions

View File

@ -71,7 +71,7 @@ public class UserController {
* 获取成员用户 * 获取成员用户
*/ */
@PostMapping("/member/list/{goPage}/{pageSize}") @PostMapping("/member/list/{goPage}/{pageSize}")
@RequiresRoles(RoleConstants.TEST_MANAGER) //@RequiresRoles(RoleConstants.TEST_MANAGER)
public Pager<List<User>> getMemberList(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryMemberRequest request) { public Pager<List<User>> getMemberList(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryMemberRequest request) {
Page<Object> page = PageHelper.startPage(goPage, pageSize, true); Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
return PageUtils.setPageInfo(page, userService.getMemberList(request)); return PageUtils.setPageInfo(page, userService.getMemberList(request));
@ -81,7 +81,7 @@ public class UserController {
* 添加成员 * 添加成员
*/ */
@PostMapping("/member/add") @PostMapping("/member/add")
@RequiresRoles(RoleConstants.TEST_MANAGER) //@RequiresRoles(RoleConstants.TEST_MANAGER)
public void addMember(@RequestBody AddMemberRequest request) { public void addMember(@RequestBody AddMemberRequest request) {
userService.addMember(request); userService.addMember(request);
} }
@ -90,7 +90,7 @@ public class UserController {
* 删除成员 * 删除成员
*/ */
@GetMapping("/member/delete/{workspaceId}/{userId}") @GetMapping("/member/delete/{workspaceId}/{userId}")
@RequiresRoles(RoleConstants.TEST_MANAGER) //@RequiresRoles(RoleConstants.TEST_MANAGER)
public void deleteMember(@PathVariable String workspaceId, @PathVariable String userId) { public void deleteMember(@PathVariable String workspaceId, @PathVariable String userId) {
userService.deleteMember(workspaceId, userId); userService.deleteMember(workspaceId, userId);
} }

View File

@ -42,16 +42,20 @@
</el-card> </el-card>
<el-dialog title="添加成员" :visible.sync="createVisible" width="30%"> <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 :model="form" ref="form" :rules="rules" label-position="left" label-width="100px" size="small">
<el-form-item label="名称" prop="name"> <el-form-item label="成员" prop="userIds">
<el-input v-model="form.name" autocomplete="off"/> <el-select v-model="form.userIds" multiple placeholder="请选择成员" class="select-width">
</el-form-item> <el-option
<el-form-item label="描述"> v-for="item in form.userList"
<el-input type="textarea" v-model="form.description"></el-input> :key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item> </el-form-item>
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button type="primary" @click="submit('form')" size="medium">创建</el-button> <el-button type="primary" @click="submitForm('form')" size="medium">保存</el-button>
</span> </span>
</el-dialog> </el-dialog>
</div> </div>
@ -59,7 +63,6 @@
<script> <script>
import MsCreateBox from "./CreateBox"; import MsCreateBox from "./CreateBox";
// import {Message} from "element-ui";
export default { export default {
name: "Member", name: "Member",
@ -73,6 +76,11 @@
queryPath: "/user/member/list", queryPath: "/user/member/list",
condition: "", condition: "",
tableData: [], tableData: [],
rules: {
userIds: [
{required: true, message: '请选择成员', trigger: ['blur', 'change']}
]
},
multipleSelection: [], multipleSelection: [],
currentWorkspaceId: "0a2430b1-a818-4b9b-bc04-c1229c472896", currentWorkspaceId: "0a2430b1-a818-4b9b-bc04-c1229c472896",
currentPage: 1, currentPage: 1,
@ -104,7 +112,7 @@
return path + "/" + this.currentPage + "/" + this.pageSize; return path + "/" + this.currentPage + "/" + this.pageSize;
}, },
search() { search() {
this.initTableData();
}, },
handleSizeChange(size) { handleSizeChange(size) {
this.pageSize = size; this.pageSize = size;
@ -133,8 +141,34 @@
}); });
}, },
create() { create() {
this.createVisible = true; this.$get('/user/list').then(response => {
this.form = {}; if (response.data.success) {
this.createVisible = true;
this.form = {userList: response.data.data};
} else {
this.$message.error(response.message);
}
}).catch(() => {
this.$message({
type: 'error',
message: '获取用户列表失败'
});
});
},
submitForm(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
let param = {
userIds: this.form.userIds,
workspaceId: this.currentWorkspaceId
};
this.$post("user/member/add", param, function () {
this.initTableData();
})
} else {
return false;
}
});
} }
} }
} }
@ -145,10 +179,6 @@
width: 240px; width: 240px;
} }
.edit {
opacity: 0;
}
.el-table__row:hover .edit { .el-table__row:hover .edit {
opacity: 1; opacity: 1;
} }
@ -158,4 +188,8 @@
margin-right: -9px; margin-right: -9px;
float: right; float: right;
} }
.select-width {
width: 100%;
}
</style> </style>