mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-11-29 18:48:13 +08:00
成员管理 0.9
This commit is contained in:
parent
d347a6dbe8
commit
71cf45d8af
@ -71,7 +71,7 @@ public class UserController {
|
||||
* 获取成员用户
|
||||
*/
|
||||
@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) {
|
||||
Page<Object> 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);
|
||||
}
|
||||
|
@ -42,16 +42,20 @@
|
||||
</el-card>
|
||||
|
||||
<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">
|
||||
<el-input v-model="form.name" autocomplete="off"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="描述">
|
||||
<el-input type="textarea" v-model="form.description"></el-input>
|
||||
<el-form :model="form" ref="form" :rules="rules" label-position="left" label-width="100px" size="small">
|
||||
<el-form-item label="成员" prop="userIds">
|
||||
<el-select v-model="form.userIds" multiple placeholder="请选择成员" class="select-width">
|
||||
<el-option
|
||||
v-for="item in form.userList"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<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>
|
||||
</el-dialog>
|
||||
</div>
|
||||
@ -59,7 +63,6 @@
|
||||
|
||||
<script>
|
||||
import MsCreateBox from "./CreateBox";
|
||||
// import {Message} from "element-ui";
|
||||
|
||||
export default {
|
||||
name: "Member",
|
||||
@ -73,6 +76,11 @@
|
||||
queryPath: "/user/member/list",
|
||||
condition: "",
|
||||
tableData: [],
|
||||
rules: {
|
||||
userIds: [
|
||||
{required: true, message: '请选择成员', trigger: ['blur', 'change']}
|
||||
]
|
||||
},
|
||||
multipleSelection: [],
|
||||
currentWorkspaceId: "0a2430b1-a818-4b9b-bc04-c1229c472896",
|
||||
currentPage: 1,
|
||||
@ -104,7 +112,7 @@
|
||||
return path + "/" + this.currentPage + "/" + this.pageSize;
|
||||
},
|
||||
search() {
|
||||
|
||||
this.initTableData();
|
||||
},
|
||||
handleSizeChange(size) {
|
||||
this.pageSize = size;
|
||||
@ -133,8 +141,34 @@
|
||||
});
|
||||
},
|
||||
create() {
|
||||
this.createVisible = true;
|
||||
this.form = {};
|
||||
this.$get('/user/list').then(response => {
|
||||
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;
|
||||
}
|
||||
|
||||
.edit {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.el-table__row:hover .edit {
|
||||
opacity: 1;
|
||||
}
|
||||
@ -158,4 +188,8 @@
|
||||
margin-right: -9px;
|
||||
float: right;
|
||||
}
|
||||
|
||||
.select-width {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
Loading…
Reference in New Issue
Block a user