系统菜单下工作空间的创建和修改
This commit is contained in:
parent
cecebc6fb9
commit
9e11452ebd
|
@ -30,6 +30,12 @@ public class WorkspaceController {
|
|||
return workspaceService.saveWorkspace(workspace);
|
||||
}
|
||||
|
||||
@PostMapping("special/add")
|
||||
@RequiresRoles(RoleConstants.ADMIN)
|
||||
public void addWorkspaceByAdmin(@RequestBody Workspace workspace) {
|
||||
workspaceService.addWorkspaceByAdmin(workspace);
|
||||
}
|
||||
|
||||
@PostMapping("update")
|
||||
@RequiresRoles(RoleConstants.ORG_ADMIN)
|
||||
public Workspace updateWorkspace(@RequestBody Workspace workspace) {
|
||||
|
@ -37,6 +43,12 @@ public class WorkspaceController {
|
|||
return workspaceService.saveWorkspace(workspace);
|
||||
}
|
||||
|
||||
@PostMapping("special/update")
|
||||
@RequiresRoles(RoleConstants.ADMIN)
|
||||
public void updateWorkspacebyAdmin(@RequestBody Workspace workspace) {
|
||||
workspaceService.updateWorkspacebyAdmin(workspace);
|
||||
}
|
||||
|
||||
@GetMapping("delete/{workspaceId}")
|
||||
@RequiresRoles(RoleConstants.ORG_ADMIN)
|
||||
public void deleteWorkspace(@PathVariable String workspaceId) {
|
||||
|
|
|
@ -177,4 +177,16 @@ public class WorkspaceService {
|
|||
public Integer checkSourceRole(String orgId, String userId, String roleId) {
|
||||
return extOrganizationMapper.checkSourceRole(orgId, userId, roleId);
|
||||
}
|
||||
|
||||
public void updateWorkspacebyAdmin(Workspace workspace) {
|
||||
workspace.setUpdateTime(System.currentTimeMillis());
|
||||
workspaceMapper.updateByPrimaryKeySelective(workspace);
|
||||
}
|
||||
|
||||
public void addWorkspaceByAdmin(Workspace workspace) {
|
||||
workspace.setId(UUID.randomUUID().toString());
|
||||
workspace.setCreateTime(System.currentTimeMillis());
|
||||
workspace.setUpdateTime(System.currentTimeMillis());
|
||||
workspaceMapper.insertSelective(workspace);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,9 +25,11 @@ export default {
|
|||
'create_time': 'Created Time',
|
||||
'update_time': 'Updated Time',
|
||||
'add': 'Add',
|
||||
'member': 'Member'
|
||||
},
|
||||
workspace: {
|
||||
'create': 'Create Workspace',
|
||||
'update': 'Update Workspace',
|
||||
'delete_confirm': 'Are you sure you want to delete this workspace?',
|
||||
'add': 'Add Workspace',
|
||||
'input_name': 'Please enter a workspace name',
|
||||
|
@ -40,6 +42,7 @@ export default {
|
|||
'modify': 'Modify',
|
||||
'delete_confirm': 'Are you sure you want to delete this workspace?',
|
||||
'input_name': 'Please enter a organization name',
|
||||
'select_organization': 'Please select organization',
|
||||
'search_by_name': 'Search by name',
|
||||
'special_characters_are_not_supported': 'Special characters are not supported',
|
||||
},
|
||||
|
|
|
@ -25,9 +25,11 @@ export default {
|
|||
'create_time': '创建时间',
|
||||
'update_time': '更新时间',
|
||||
'add': '添加',
|
||||
'member': '成员'
|
||||
},
|
||||
workspace: {
|
||||
'create': '创建工作空间',
|
||||
'update': '修改工作空间',
|
||||
'delete_confirm': '这个工作空间确定要删除吗?',
|
||||
'add': '添加工作空间',
|
||||
'input_name': '请输入工作空间名称',
|
||||
|
@ -40,6 +42,7 @@ export default {
|
|||
'modify': '修改组织',
|
||||
'delete_confirm': '这个组织确定要删除吗?',
|
||||
'input_name': '请输入组织名称',
|
||||
'select_organization': '请选择组织',
|
||||
'search_by_name': '根据名称搜索',
|
||||
'special_characters_are_not_supported': '不支持特殊字符',
|
||||
},
|
||||
|
|
|
@ -13,10 +13,11 @@
|
|||
</span>
|
||||
</el-row>
|
||||
</div>
|
||||
<el-table :data="tableData" style="width: 100%">
|
||||
<el-table :data="tableData" style="width: 100%" @cell-click="cellClick">
|
||||
<el-table-column type="selection" width="55"/>
|
||||
<el-table-column prop="name" :label="$t('commons.name')"/>
|
||||
<el-table-column prop="description" :label="$t('commons.description')"/>
|
||||
<el-table-column prop="member" :label="$t('commons.member')"> 123 </el-table-column>
|
||||
<el-table-column :label="$t('commons.operating')">
|
||||
<template slot-scope="scope">
|
||||
<el-button @click="edit(scope.row)" type="primary" icon="el-icon-edit" size="mini" circle/>
|
||||
|
@ -127,6 +128,9 @@
|
|||
this.updateVisible = true;
|
||||
this.form = row;
|
||||
},
|
||||
cellClick(){
|
||||
alert(1)
|
||||
},
|
||||
del(row) {
|
||||
this.$confirm(this.$t('organization.delete_confirm'), '', {
|
||||
confirmButtonText: this.$t('commons.confirm'),
|
||||
|
|
|
@ -52,8 +52,8 @@
|
|||
<el-form-item :label="$t('commons.description')">
|
||||
<el-input type="textarea" v-model="form.description"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('workspace.organization_name')" prop="orgIds">
|
||||
<el-select v-model="form.organizationId" placeholder="请选择组织" class="select-width">
|
||||
<el-form-item :label="$t('workspace.organization_name')" prop="organizationId">
|
||||
<el-select v-model="form.organizationId" :placeholder="$t('organization.select_organization')" class="select-width">
|
||||
<el-option
|
||||
v-for="item in form.orgList"
|
||||
:key="item.id"
|
||||
|
@ -67,6 +67,30 @@
|
|||
<el-button type="primary" @click="submit('form')" size="medium">{{$t('commons.save')}}</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog :title="$t('workspace.update')" :visible.sync="updateVisible" width="30%">
|
||||
<el-form :model="form" :rules="rules" ref="updateForm" label-position="left" label-width="100px" size="small">
|
||||
<el-form-item :label="$t('commons.name')" prop="name">
|
||||
<el-input v-model="form.name" autocomplete="off"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('commons.description')">
|
||||
<el-input type="textarea" v-model="form.description"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('workspace.organization_name')" prop="organizationId">
|
||||
<el-select v-model="form.organizationId" :placeholder="$t('organization.select_organization')" class="select-width">
|
||||
<el-option
|
||||
v-for="item in form.orgList1"
|
||||
: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="updateWorkspace('updateForm')" size="medium">{{$t('commons.save')}}</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -85,13 +109,13 @@
|
|||
this.createVisible = true;
|
||||
this.form = {};
|
||||
this.$get("/organization/list", response => {
|
||||
this.form = { orgList: response.data }
|
||||
this.$set(this.form, "orgList", response.data);
|
||||
})
|
||||
},
|
||||
submit(formName) {
|
||||
this.$refs[formName].validate((valid) => {
|
||||
if (valid) {
|
||||
let saveType = 'add';
|
||||
let saveType = 'special/add';
|
||||
if (this.form.id) {
|
||||
saveType = 'update'
|
||||
}
|
||||
|
@ -106,10 +130,12 @@
|
|||
});
|
||||
},
|
||||
edit(row) {
|
||||
this.createVisible = true;
|
||||
this.updateVisible = true;
|
||||
// copy user
|
||||
this.form = Object.assign({}, row);
|
||||
|
||||
this.$get("/organization/list", response => {
|
||||
this.$set(this.form, "orgList1", response.data);
|
||||
})
|
||||
// let self = this;
|
||||
// let getUser1 = this.$get("/test/user");
|
||||
// let getUser2 = this.$get("/test/sleep");
|
||||
|
@ -118,6 +144,22 @@
|
|||
// self.loading = false;
|
||||
// });
|
||||
},
|
||||
updateWorkspace(updateForm) {
|
||||
this.$refs[updateForm].validate(valide => {
|
||||
if (valide) {
|
||||
this.result = this.$post("/workspace/special/update", this.form,() => {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: this.$t('commons.modify_success')
|
||||
});
|
||||
this.updateVisible = false;
|
||||
this.list();
|
||||
});
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
})
|
||||
},
|
||||
del(row) {
|
||||
this.$confirm(this.$t('workspace.delete_confirm'), this.$t('commons.prompt'), {
|
||||
confirmButtonText: this.$t('commons.confirm'),
|
||||
|
@ -154,6 +196,7 @@
|
|||
result: {},
|
||||
loading: false,
|
||||
createVisible: false,
|
||||
updateVisible: false,
|
||||
btnTips: this.$t('workspace.add'),
|
||||
condition: "",
|
||||
items: [],
|
||||
|
@ -169,7 +212,7 @@
|
|||
{required: true, message: this.$t('workspace.input_name'), trigger: 'blur'},
|
||||
{min: 2, max: 50, message: this.$t('commons.input_limit', [2, 50]), trigger: 'blur'}
|
||||
],
|
||||
orgIds: [
|
||||
organizationId: [
|
||||
{required: true, message: '请选择组织', trigger: ['blur']}
|
||||
]
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue