This commit is contained in:
chenjianxing 2020-04-10 12:00:26 +08:00
commit 117fc81343
24 changed files with 214 additions and 171 deletions

View File

@ -7,9 +7,14 @@
p.create_time, w.id as workspaceId, w.name as workspaceName
from project p
join workspace w on p.workspace_id = w.id
<if test="proRequest.workspaceId != null">
where w.id = #{proRequest.workspaceId}
</if>
<where>
<if test="proRequest.name != ''">
and p.name like #{proRequest.name, jdbcType=VARCHAR}
</if>
<if test="proRequest.workspaceId != null">
and w.id = #{proRequest.workspaceId}
</if>
</where>
</select>
</mapper>

View File

@ -1,10 +1,12 @@
package io.metersphere.base.mapper.ext;
import io.metersphere.controller.request.WorkspaceRequest;
import io.metersphere.dto.WorkspaceDTO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface ExtWorkspaceMapper {
List<WorkspaceDTO> getWorkspaceWithOrg();
List<WorkspaceDTO> getWorkspaceWithOrg(@Param("request") WorkspaceRequest request);
}

View File

@ -5,6 +5,11 @@
<select id="getWorkspaceWithOrg" resultType="io.metersphere.dto.WorkspaceDTO">
select w.id, w.name, w.organization_id as organizationId, w.description, o.name as organizationName
from workspace w join organization o on w.organization_id = o.id
<where>
<if test="request.name != ''">
AND w.name LIKE #{request.name,jdbcType=VARCHAR}
</if>
</where>
</select>
</mapper>

View File

@ -1,15 +0,0 @@
package io.metersphere.commons.annotations;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Documented
@Inherited
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
public @interface FuzzyQuery {
}

View File

@ -1,12 +1,8 @@
package io.metersphere.commons.utils;
import io.metersphere.commons.annotations.FuzzyQuery;
import org.apache.commons.lang3.StringUtils;
import org.springframework.util.ReflectionUtils;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
public class BeanUtils {
@ -69,38 +65,4 @@ public class BeanUtils {
return null;
}
}
/**
* @param obj
* @return
*/
public static Map<String, Object> objectToMap(Object obj) {
HashMap<String, Object> map = new HashMap<>();
if (obj != null) {
ReflectionUtils.doWithFields(obj.getClass(), field -> {
boolean accessFlag = field.isAccessible();
try {
String varName = field.getName();
field.setAccessible(true);
Object o = field.get(obj);
if (o != null) {
if (field.isAnnotationPresent(FuzzyQuery.class) && o instanceof String) {
String value = "%" + o + "%";
map.put(varName, value);
} else {
map.put(varName, field.get(obj));
}
}
field.setAccessible(accessFlag);
} catch (Exception e) {
} finally {
field.setAccessible(accessFlag);
}
});
}
return map;
}
}

View File

@ -6,11 +6,13 @@ import io.metersphere.base.domain.Organization;
import io.metersphere.commons.constants.RoleConstants;
import io.metersphere.commons.utils.PageUtils;
import io.metersphere.commons.utils.Pager;
import io.metersphere.controller.request.OrganizationRequest;
import io.metersphere.dto.OrganizationMemberDTO;
import io.metersphere.service.OrganizationService;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
@ -23,26 +25,34 @@ public class OrganizationController {
@PostMapping("/add")
@RequiresRoles(RoleConstants.ADMIN)
public Organization addOrganization(@RequestBody Organization organization) { return organizationService.addOrganization(organization); }
public Organization addOrganization(@RequestBody Organization organization) {
return organizationService.addOrganization(organization);
}
@GetMapping("/list")
@RequiresRoles(value = {RoleConstants.ADMIN,RoleConstants.ORG_ADMIN,RoleConstants.TEST_MANAGER}, logical = Logical.OR)
public List<Organization> getOrganizationList() { return organizationService.getOrganizationList(); }
@RequiresRoles(value = {RoleConstants.ADMIN, RoleConstants.ORG_ADMIN, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
public List<Organization> getOrganizationList() {
return organizationService.getOrganizationList(new OrganizationRequest());
}
@PostMapping("/list/{goPage}/{pageSize}")
@RequiresRoles(value = {RoleConstants.ADMIN,RoleConstants.ORG_ADMIN}, logical = Logical.OR)
public Pager<List<Organization>> getOrganizationList(@PathVariable int goPage, @PathVariable int pageSize) {
@RequiresRoles(value = {RoleConstants.ADMIN, RoleConstants.ORG_ADMIN}, logical = Logical.OR)
public Pager<List<Organization>> getOrganizationList(@RequestBody OrganizationRequest request, @PathVariable int goPage, @PathVariable int pageSize) {
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
return PageUtils.setPageInfo(page, organizationService.getOrganizationList());
return PageUtils.setPageInfo(page, organizationService.getOrganizationList(request));
}
@GetMapping("/delete/{organizationId}")
@RequiresRoles(RoleConstants.ADMIN)
public void deleteOrganization(@PathVariable(value = "organizationId") String organizationId) { organizationService.deleteOrganization(organizationId); }
public void deleteOrganization(@PathVariable(value = "organizationId") String organizationId) {
organizationService.deleteOrganization(organizationId);
}
@PostMapping("/update")
@RequiresRoles(value = {RoleConstants.ADMIN,RoleConstants.ORG_ADMIN}, logical = Logical.OR)
public void updateOrganization(@RequestBody Organization organization) { organizationService.updateOrganization(organization); }
@RequiresRoles(value = {RoleConstants.ADMIN, RoleConstants.ORG_ADMIN}, logical = Logical.OR)
public void updateOrganization(@RequestBody Organization organization) {
organizationService.updateOrganization(organization);
}
@GetMapping("/list/userorg/{userId}")
public List<Organization> getOrganizationListByUserId(@PathVariable String userId) {
@ -50,7 +60,7 @@ public class OrganizationController {
}
@PostMapping("/member/update")
@RequiresRoles(value = {RoleConstants.ADMIN,RoleConstants.ORG_ADMIN}, logical = Logical.OR)
@RequiresRoles(value = {RoleConstants.ADMIN, RoleConstants.ORG_ADMIN}, logical = Logical.OR)
public void updateOrgMember(@RequestBody OrganizationMemberDTO memberDTO) {
organizationService.updateOrgMember(memberDTO);
}

View File

@ -7,7 +7,6 @@ import io.metersphere.commons.constants.RoleConstants;
import io.metersphere.commons.utils.PageUtils;
import io.metersphere.commons.utils.Pager;
import io.metersphere.controller.request.WorkspaceRequest;
import io.metersphere.dto.OrganizationMemberDTO;
import io.metersphere.dto.WorkspaceDTO;
import io.metersphere.dto.WorkspaceMemberDTO;
import io.metersphere.service.WorkspaceService;
@ -73,9 +72,9 @@ public class WorkspaceController {
@PostMapping("list/all/{goPage}/{pageSize}")
@RequiresRoles(RoleConstants.ADMIN)
public Pager<List<WorkspaceDTO>> getAllWorkspaceList(@PathVariable int goPage, @PathVariable int pageSize) {
public Pager<List<WorkspaceDTO>> getAllWorkspaceList(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody WorkspaceRequest request) {
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
return PageUtils.setPageInfo(page, workspaceService.getAllWorkspaceList());
return PageUtils.setPageInfo(page, workspaceService.getAllWorkspaceList(request));
}
@GetMapping("/list/userworkspace/{userId}")

View File

@ -0,0 +1,13 @@
package io.metersphere.controller.request;
public class OrganizationRequest {
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}

View File

@ -2,6 +2,15 @@ package io.metersphere.controller.request;
public class ProjectRequest {
private String workspaceId;
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getWorkspaceId() {
return workspaceId;

View File

@ -1,10 +1,7 @@
package io.metersphere.controller.request;
import io.metersphere.commons.annotations.FuzzyQuery;
public class WorkspaceRequest {
private String organizationId;
@FuzzyQuery
private String name;
public String getOrganizationId() {

View File

@ -8,6 +8,7 @@ import io.metersphere.base.mapper.ext.ExtOrganizationMapper;
import io.metersphere.base.mapper.ext.ExtUserRoleMapper;
import io.metersphere.commons.constants.RoleConstants;
import io.metersphere.commons.exception.MSException;
import io.metersphere.controller.request.OrganizationRequest;
import io.metersphere.dto.OrganizationMemberDTO;
import io.metersphere.dto.UserRoleHelpDTO;
import io.metersphere.i18n.Translator;
@ -48,8 +49,13 @@ public class OrganizationService {
return organization;
}
public List<Organization> getOrganizationList() {
return organizationMapper.selectByExample(null);
public List<Organization> getOrganizationList(OrganizationRequest request) {
OrganizationExample example = new OrganizationExample();
OrganizationExample.Criteria criteria = example.createCriteria();
if (StringUtils.isNotBlank(request.getName())) {
criteria.andNameLike(StringUtils.wrapIfMissing(request.getName(), "%"));
}
return organizationMapper.selectByExample(example);
}
public void deleteOrganization(String organizationId) {

View File

@ -47,6 +47,9 @@ public class ProjectService {
}
public List<ProjectDTO> getProjectList(ProjectRequest request) {
if (StringUtils.isNotBlank(request.getName())) {
request.setName(StringUtils.wrapIfMissing(request.getName(), "%"));
}
return extProjectMapper.getProjectWithWorkspace(request);
}

View File

@ -77,13 +77,16 @@ public class WorkspaceService {
criteria.andOrganizationIdEqualTo(request.getOrganizationId());
}
if (StringUtils.isNotBlank(request.getName())) {
criteria.andNameLike(request.getName());
criteria.andNameLike(StringUtils.wrapIfMissing(request.getName(), "%"));
}
return workspaceMapper.selectByExample(example);
}
public List<WorkspaceDTO> getAllWorkspaceList() {
return extWorkspaceMapper.getWorkspaceWithOrg();
public List<WorkspaceDTO> getAllWorkspaceList(WorkspaceRequest request) {
if (StringUtils.isNotBlank(request.getName())) {
request.setName(StringUtils.wrapIfMissing(request.getName(), "%"));
}
return extWorkspaceMapper.getWorkspaceWithOrg(request);
}
public void deleteWorkspace(String workspaceId) {
@ -225,6 +228,7 @@ public class WorkspaceService {
}
public void updateWorkspacebyAdmin(Workspace workspace) {
workspace.setCreateTime(null);
workspace.setUpdateTime(System.currentTimeMillis());
workspaceMapper.updateByPrimaryKeySelective(workspace);
}

View File

@ -1,7 +1,7 @@
<template>
<div class="pressure-config-container">
<el-row>
<el-col :span="12">
<el-col :span="10">
<el-form :inline="true">
<el-form-item>
<div class="config-form-label">{{$t('load_test.thread_num')}}</div>
@ -89,7 +89,7 @@
</el-form-item>
</el-form>
</el-col>
<el-col :span="12">
<el-col :span="14">
<chart class="chart-container" ref="chart1" :options="orgOptions" :autoresize="true"></chart>
</el-col>
</el-row>

View File

@ -11,6 +11,7 @@
<span class="search">
<el-input type="text" size="small" :placeholder="$t('project.search_by_name')"
prefix-icon="el-icon-search"
@change="search"
maxlength="60" v-model="condition" clearable/>
</span>
</el-row>
@ -56,7 +57,9 @@
</el-form>
<template v-slot:footer>
<div class="dialog-footer">
<el-button type="primary" @click="submit('form')" size="medium">{{$t('commons.save')}}</el-button>
<el-button type="primary" onkeydown="return false;" @click="submit('form')" size="medium">
{{$t('commons.save')}}
</el-button>
</div>
</template>
</el-dialog>
@ -101,7 +104,7 @@
if (this.$route.path.split('/')[2] === 'project' &&
this.$route.path.split('/')[3] === 'create') {
this.create();
this.$router.push( '/' + this.beaseUrl + '/project/all');
this.$router.push('/' + this.beaseUrl + '/project/all');
}
this.list();
},
@ -172,9 +175,12 @@
}).catch(() => {
});
},
search() {
this.list();
},
list() {
let url = "/project/list/" + this.currentPage + '/' + this.pageSize;
this.result = this.$post(url, {}, (response) => {
this.result = this.$post(url, {name: this.condition}, (response) => {
let data = response.data;
this.items = data.listObject;
this.total = data.itemCount;

View File

@ -37,17 +37,5 @@
font-weight: 500;
}
.container {
padding: 15px;
width: 100%;
height: 100%;
box-sizing: border-box;
}
.main-content {
margin: 0 auto;
width: 100%;
max-width: 1200px;
}
</style>

View File

@ -28,8 +28,8 @@
</el-table-column>
<el-table-column>
<template v-slot:default="scope">
<el-button @click="edit(scope.row)" type="primary" icon="el-icon-edit" size="mini" circle/>
<el-button @click="del(scope.row)" type="danger" icon="el-icon-delete" size="mini" circle/>
<el-button @click="edit(scope.row)" onkeydown="return false;" type="primary" icon="el-icon-edit" size="mini" circle/>
<el-button @click="del(scope.row)" onkeydown="return false;" type="danger" icon="el-icon-delete" size="mini" circle/>
</template>
</el-table-column>
</el-table>
@ -79,7 +79,8 @@
</el-form>
<template v-slot:footer>
<span class="dialog-footer">
<el-button type="primary" @click="submitForm('form')" size="medium">{{$t('commons.save')}}</el-button>
<el-button type="primary" onkeydown="return false;"
@click="submitForm('form')" size="medium">{{$t('commons.save')}}</el-button>
</span>
</template>
</el-dialog>
@ -111,7 +112,8 @@
</el-form>
<template v-slot:footer>
<span class="dialog-footer">
<el-button type="primary" @click="updateOrgMember('updateUserForm')" size="medium">{{$t('commons.save')}}</el-button>
<el-button type="primary" onkeydown="return false;"
@click="updateOrgMember('updateUserForm')" size="medium">{{$t('commons.save')}}</el-button>
</span>
</template>
</el-dialog>

View File

@ -9,7 +9,7 @@
</span>
<span class="search">
<el-input type="text" size="small" :placeholder="$t('workspace.search_by_name')"
prefix-icon="el-icon-search"
prefix-icon="el-icon-search" @change="search"
maxlength="60" v-model="condition" clearable/>
</span>
</el-row>
@ -20,13 +20,16 @@
<el-table-column prop="description" :label="$t('commons.description')"/>
<el-table-column :label="$t('commons.member')">
<template v-slot:default="scope">
<el-button type="text" class="member-size" @click="cellClick(scope.row)">{{scope.row.memberSize}}</el-button>
<el-button type="text" class="member-size" @click="cellClick(scope.row)">{{scope.row.memberSize}}
</el-button>
</template>
</el-table-column>
<el-table-column>
<template v-slot:default="scope">
<el-button @click="edit(scope.row)" type="primary" icon="el-icon-edit" size="mini" circle/>
<el-button @click="del(scope.row)" type="danger" icon="el-icon-delete" size="mini" circle/>
<el-button @click="edit(scope.row)" onkeydown="return false;" type="primary" icon="el-icon-edit" size="mini"
circle/>
<el-button @click="del(scope.row)" onkeydown="return false;" type="danger" icon="el-icon-delete" size="mini"
circle/>
</template>
</el-table-column>
</el-table>
@ -60,7 +63,8 @@
</el-form>
<template v-slot:footer>
<span class="dialog-footer">
<el-button type="primary" @click="submit('form')" size="medium">{{$t('commons.save')}}</el-button>
<el-button type="primary" onkeydown="return false;"
@click="submit('form')" size="medium">{{$t('commons.save')}}</el-button>
</span>
</template>
</el-dialog>
@ -92,8 +96,10 @@
</el-table-column>
<el-table-column :label="$t('commons.operating')">
<template v-slot:default="scope">
<el-button @click="editMember(scope.row)" type="primary" icon="el-icon-edit" size="mini" circle/>
<el-button @click="delMember(scope.row)" type="danger" icon="el-icon-delete" size="mini" circle/>
<el-button @click="editMember(scope.row)" onkeydown="return false;" type="primary" icon="el-icon-edit"
size="mini" circle/>
<el-button @click="delMember(scope.row)" onkeydown="return false;" type="danger" icon="el-icon-delete"
size="mini" circle/>
</template>
</el-table-column>
</el-table>
@ -117,10 +123,13 @@
</el-dialog>
<!-- add workspace member dialog -->
<el-dialog :title="$t('member.create')" :visible.sync="addMemberVisible" width="30%" :destroy-on-close="true" @close="closeFunc">
<el-form :model="memberForm" ref="form" :rules="wsMemberRule" label-position="right" label-width="100px" size="small">
<el-dialog :title="$t('member.create')" :visible.sync="addMemberVisible" width="30%" :destroy-on-close="true"
@close="closeFunc">
<el-form :model="memberForm" ref="form" :rules="wsMemberRule" label-position="right" label-width="100px"
size="small">
<el-form-item :label="$t('commons.member')" prop="userIds">
<el-select v-model="memberForm.userIds" multiple :placeholder="$t('member.please_choose_member')" class="select-width">
<el-select v-model="memberForm.userIds" multiple :placeholder="$t('member.please_choose_member')"
class="select-width">
<el-option
v-for="item in memberForm.userList"
:key="item.id"
@ -132,7 +141,8 @@
</el-select>
</el-form-item>
<el-form-item :label="$t('commons.role')" prop="roleIds">
<el-select v-model="memberForm.roleIds" multiple :placeholder="$t('role.please_choose_role')" class="select-width">
<el-select v-model="memberForm.roleIds" multiple :placeholder="$t('role.please_choose_role')"
class="select-width">
<el-option
v-for="item in memberForm.roles"
:key="item.id"
@ -144,13 +154,15 @@
</el-form>
<template v-slot:footer>
<span class="dialog-footer">
<el-button type="primary" @click="submitForm('form')" size="medium">{{$t('commons.save')}}</el-button>
<el-button type="primary" onkeydown="return false;"
@click="submitForm('form')" size="medium">{{$t('commons.save')}}</el-button>
</span>
</template>
</el-dialog>
<!-- update workspace member dialog -->
<el-dialog :title="$t('member.modify')" :visible.sync="updateMemberVisible" width="30%" :destroy-on-close="true" @close="closeFunc">
<el-dialog :title="$t('member.modify')" :visible.sync="updateMemberVisible" width="30%" :destroy-on-close="true"
@close="closeFunc">
<el-form :model="memberForm" label-position="right" label-width="100px" size="small" ref="updateUserForm">
<el-form-item label="ID" prop="id">
<el-input v-model="memberForm.id" autocomplete="off" :disabled="true"/>
@ -165,7 +177,8 @@
<el-input v-model="memberForm.phone" autocomplete="off"/>
</el-form-item>
<el-form-item :label="$t('commons.role')" prop="roleIds">
<el-select v-model="memberForm.roleIds" multiple :placeholder="$t('role.please_choose_role')" class="select-width">
<el-select v-model="memberForm.roleIds" multiple :placeholder="$t('role.please_choose_role')"
class="select-width">
<el-option
v-for="item in memberForm.allroles"
:key="item.id"
@ -177,7 +190,8 @@
</el-form>
<template v-slot:footer>
<span class="dialog-footer">
<el-button type="primary" @click="updateOrgMember('updateUserForm')" size="medium">{{$t('commons.save')}}</el-button>
<el-button type="primary" onkeydown="return false;"
@click="updateOrgMember('updateUserForm')" size="medium">{{$t('commons.save')}}</el-button>
</span>
</template>
</el-dialog>
@ -250,6 +264,9 @@
});
},
search() {
this.list();
},
list() {
let url = '/workspace/list/' + this.currentPage + '/' + this.pageSize;
let lastOrganizationId = this.currentUser.lastOrganizationId;
@ -297,7 +314,7 @@
this.$set(this.memberForm, "roles", response.data);
})
},
cellClick(row){
cellClick(row) {
// currentRow
this.currentWorkspaceRow = row;
this.memberVisible = true;
@ -343,7 +360,7 @@
roleIds: this.memberForm.roleIds,
workspaceId: this.currentWorkspaceRow.id
};
this.result = this.$post("user/ws/member/add", param,() => {
this.result = this.$post("user/ws/member/add", param, () => {
this.cellClick(this.currentWorkspaceRow);
this.addMemberVisible = false;
})
@ -391,7 +408,7 @@
roleIds: this.memberForm.roleIds,
workspaceId: this.currentWorkspaceRow.id
}
this.result = this.$post("/workspace/member/update", param,() => {
this.result = this.$post("/workspace/member/update", param, () => {
this.$message({
type: 'success',
message: this.$t('commons.modify_success')
@ -469,8 +486,8 @@
}
.member-size {
text-decoration:underline;
cursor:pointer;
text-decoration: underline;
cursor: pointer;
}
.member-title {

View File

@ -44,7 +44,8 @@
</el-form>
<template v-slot:footer>
<span class="dialog-footer">
<el-button type="primary" @click="updateUser('updateUserForm')" size="medium">{{$t('commons.save')}}</el-button>
<el-button type="primary" onkeydown="return false;"
@click="updateUser('updateUserForm')" size="medium">{{$t('commons.save')}}</el-button>
</span>
</template>
</el-dialog>

View File

@ -9,7 +9,8 @@
<ms-create-box :tips="btnTips" :exec="create"/>
</span>
<span class="search">
<el-input type="text" size="small" :placeholder="$t('organization.search_by_name')" prefix-icon="el-icon-search"
<el-input type="text" size="small" :placeholder="$t('organization.search_by_name')"
prefix-icon="el-icon-search" @change="search"
maxlength="60" v-model="condition" clearable/>
</span>
</el-row>
@ -22,13 +23,14 @@
<el-table-column prop="description" :label="$t('commons.description')"/>
<el-table-column :label="$t('commons.member')">
<template v-slot:default="scope">
<el-button type="text" class="member-size" @click="cellClick(scope.row)">{{scope.row.memberSize}}</el-button>
<el-button type="text" class="member-size" @click="cellClick(scope.row)">{{scope.row.memberSize}}
</el-button>
</template>
</el-table-column>
<el-table-column :label="$t('commons.operating')">
<template v-slot:default="scope">
<el-button @click="edit(scope.row)" type="primary" icon="el-icon-edit" size="mini" circle/>
<el-button @click="del(scope.row)" type="danger" icon="el-icon-delete" size="mini" circle/>
<el-button @click="edit(scope.row)" onkeydown="return false;" type="primary" icon="el-icon-edit" size="mini" circle/>
<el-button @click="del(scope.row)" onkeydown="return false;" type="danger" icon="el-icon-delete" size="mini" circle/>
</template>
</el-table-column>
</el-table>
@ -77,8 +79,8 @@
</el-table-column>
<el-table-column :label="$t('commons.operating')">
<template v-slot:default="scope">
<el-button @click="editMember(scope.row)" type="primary" icon="el-icon-edit" size="mini" circle/>
<el-button @click="delMember(scope.row)" type="danger" icon="el-icon-delete" size="mini" circle/>
<el-button @click="editMember(scope.row)" onkeydown="return false;" type="primary" icon="el-icon-edit" size="mini" circle/>
<el-button @click="delMember(scope.row)" onkeydown="return false;" type="danger" icon="el-icon-delete" size="mini" circle/>
</template>
</el-table-column>
</el-table>
@ -102,8 +104,10 @@
</el-dialog>
<!-- add organization form -->
<el-dialog :title="$t('organization.create')" :visible.sync="createVisible" width="30%" @closed="closeFunc" :destroy-on-close="true">
<el-form :model="form" label-position="right" label-width="100px" size="small" :rules="rule" ref="createOrganization">
<el-dialog :title="$t('organization.create')" :visible.sync="createVisible" width="30%" @closed="closeFunc"
:destroy-on-close="true">
<el-form :model="form" label-position="right" label-width="100px" size="small" :rules="rule"
ref="createOrganization">
<el-form-item :label="$t('commons.name')" prop="name">
<el-input v-model="form.name" autocomplete="off"/>
</el-form-item>
@ -113,14 +117,17 @@
</el-form>
<template v-slot:footer>
<span class="dialog-footer">
<el-button type="primary" @click="createOrganization('createOrganization')" size="medium">{{$t('commons.save')}}</el-button>
<el-button type="primary" onkeydown="return false;"
@click="createOrganization('createOrganization')" size="medium">{{$t('commons.save')}}</el-button>
</span>
</template>
</el-dialog>
<!-- update organization form -->
<el-dialog :title="$t('organization.modify')" :visible.sync="updateVisible" width="30%" :destroy-on-close="true" @close="closeFunc">
<el-form :model="form" label-position="right" label-width="100px" size="small" :rules="rule" ref="updateOrganizationForm">
<el-dialog :title="$t('organization.modify')" :visible.sync="updateVisible" width="30%" :destroy-on-close="true"
@close="closeFunc">
<el-form :model="form" label-position="right" label-width="100px" size="small" :rules="rule"
ref="updateOrganizationForm">
<el-form-item :label="$t('commons.name')" prop="name">
<el-input v-model="form.name" autocomplete="off"/>
</el-form-item>
@ -130,16 +137,20 @@
</el-form>
<template v-slot:footer>
<span class="dialog-footer">
<el-button type="primary" @click="updateOrganization('updateOrganizationForm')" size="medium">{{$t('organization.modify')}}</el-button>
<el-button type="primary" onkeydown="return false;"
@click="updateOrganization('updateOrganizationForm')" size="medium">{{$t('organization.modify')}}</el-button>
</span>
</template>
</el-dialog>
<!-- add organization member form -->
<el-dialog :title="$t('member.create')" :visible.sync="addMemberVisible" width="30%" :destroy-on-close="true" @close="closeFunc">
<el-form :model="memberForm" ref="form" :rules="orgMemberRule" label-position="right" label-width="100px" size="small">
<el-dialog :title="$t('member.create')" :visible.sync="addMemberVisible" width="30%" :destroy-on-close="true"
@close="closeFunc">
<el-form :model="memberForm" ref="form" :rules="orgMemberRule" label-position="right" label-width="100px"
size="small">
<el-form-item :label="$t('commons.member')" prop="userIds">
<el-select v-model="memberForm.userIds" multiple :placeholder="$t('member.please_choose_member')" class="select-width">
<el-select v-model="memberForm.userIds" multiple :placeholder="$t('member.please_choose_member')"
class="select-width">
<el-option
v-for="item in memberForm.userList"
:key="item.id"
@ -151,7 +162,8 @@
</el-select>
</el-form-item>
<el-form-item :label="$t('commons.role')" prop="roleIds">
<el-select v-model="memberForm.roleIds" multiple :placeholder="$t('role.please_choose_role')" class="select-width">
<el-select v-model="memberForm.roleIds" multiple :placeholder="$t('role.please_choose_role')"
class="select-width">
<el-option
v-for="item in memberForm.roles"
:key="item.id"
@ -163,13 +175,15 @@
</el-form>
<template v-slot:footer>
<span class="dialog-footer">
<el-button type="primary" @click="submitForm('form')" size="medium">{{$t('commons.save')}}</el-button>
<el-button type="primary" onkeydown="return false;"
@click="submitForm('form')" size="medium">{{$t('commons.save')}}</el-button>
</span>
</template>
</el-dialog>
<!-- update organization member form -->
<el-dialog :title="$t('member.modify')" :visible.sync="updateMemberVisible" width="30%" :destroy-on-close="true" @close="closeFunc">
<el-dialog :title="$t('member.modify')" :visible.sync="updateMemberVisible" width="30%" :destroy-on-close="true"
@close="closeFunc">
<el-form :model="memberForm" label-position="right" label-width="100px" size="small" ref="updateUserForm">
<el-form-item label="ID" prop="id">
<el-input v-model="memberForm.id" autocomplete="off" :disabled="true"/>
@ -184,7 +198,8 @@
<el-input v-model="memberForm.phone" autocomplete="off"/>
</el-form-item>
<el-form-item :label="$t('commons.role')" prop="roleIds">
<el-select v-model="memberForm.roleIds" multiple :placeholder="$t('role.please_choose_role')" class="select-width">
<el-select v-model="memberForm.roleIds" multiple :placeholder="$t('role.please_choose_role')"
class="select-width">
<el-option
v-for="item in memberForm.allroles"
:key="item.id"
@ -196,7 +211,8 @@
</el-form>
<template v-slot:footer>
<span class="dialog-footer">
<el-button type="primary" @click="updateOrgMember('updateUserForm')" size="medium">{{$t('commons.save')}}</el-button>
<el-button type="primary" onkeydown="return false;"
@click="updateOrgMember('updateUserForm')" size="medium">{{$t('commons.save')}}</el-button>
</span>
</template>
</el-dialog>
@ -239,7 +255,7 @@
rule: {
name: [
{required: true, message: this.$t('organization.input_name'), trigger: 'blur'},
{ min: 2, max: 10, message: this.$t('commons.input_limit', [2, 50]), trigger: 'blur' },
{min: 2, max: 10, message: this.$t('commons.input_limit', [2, 50]), trigger: 'blur'},
{
required: true,
pattern: /^[\u4e00-\u9fa5_a-zA-Z0-9.·-]+$/,
@ -248,7 +264,7 @@
}
],
description: [
{ max: 50, message: this.$t('commons.input_limit', [0, 50]), trigger: 'blur'}
{max: 50, message: this.$t('commons.input_limit', [0, 50]), trigger: 'blur'}
]
},
orgMemberRule: {
@ -292,7 +308,7 @@
//
this.$set(this.memberForm, 'roleIds', roleIds);
},
cellClick(row){
cellClick(row) {
// currentRow
this.currentRow = row;
this.memberVisible = true;
@ -320,7 +336,7 @@
cancelButtonText: this.$t('commons.cancel'),
type: 'warning'
}).then(() => {
this.result = this.$get(this.deletePath + row.id,() => {
this.result = this.$get(this.deletePath + row.id, () => {
this.$message({
type: 'success',
message: this.$t('commons.delete_success')
@ -355,16 +371,16 @@
});
},
createOrganization(createOrganizationForm) {
this.$refs[createOrganizationForm].validate( valide => {
this.$refs[createOrganizationForm].validate(valide => {
if (valide) {
this.result = this.$post(this.createPath, this.form,() => {
this.result = this.$post(this.createPath, this.form, () => {
this.$message({
type: 'success',
message: this.$t('commons.save_success')
});
this.initTableData();
this.createVisible = false;
});
});
} else {
return false;
}
@ -373,21 +389,27 @@
updateOrganization(udpateOrganizationForm) {
this.$refs[udpateOrganizationForm].validate(valide => {
if (valide) {
this.result = this.$post(this.updatePath, this.form,() => {
this.result = this.$post(this.updatePath, this.form, () => {
this.$message({
type: 'success',
message: this.$t('commons.modify_success')
});
this.updateVisible = false;
this.initTableData();
});
});
} else {
return false;
}
})
},
search() {
this.initTableData();
},
initTableData() {
this.result = this.$post(this.buildPagePath(this.queryPath),{},response => {
let param = {
name: this.condition
};
this.result = this.$post(this.buildPagePath(this.queryPath), param, response => {
let data = response.data;
this.tableData = data.listObject;
for (let i = 0; i < this.tableData.length; i++) {
@ -441,7 +463,7 @@
roleIds: this.memberForm.roleIds,
organizationId: this.currentRow.id
};
this.result = this.$post("user/special/org/member/add", param,() => {
this.result = this.$post("user/special/org/member/add", param, () => {
this.cellClick(this.currentRow);
this.addMemberVisible = false;
})
@ -459,7 +481,7 @@
roleIds: this.memberForm.roleIds,
organizationId: this.currentRow.id
}
this.result = this.$post("/organization/member/update", param,() => {
this.result = this.$post("/organization/member/update", param, () => {
this.$message({
type: 'success',
message: this.$t('commons.modify_success')
@ -485,8 +507,8 @@
}
.member-size {
text-decoration:underline;
cursor:pointer;
text-decoration: underline;
cursor: pointer;
}
.org-member-name {

View File

@ -11,7 +11,7 @@
<span class="search">
<el-input type="text" size="small"
:placeholder="$t('workspace.search_by_name')"
prefix-icon="el-icon-search"
prefix-icon="el-icon-search" @change="search"
maxlength="60" v-model="condition" clearable/>
</span>
</el-row>
@ -77,7 +77,7 @@
</el-form>
<template v-slot:footer>
<span class="dialog-footer">
<el-button type="primary" @click="submit('form')" size="medium">{{$t('commons.save')}}</el-button>
<el-button type="primary" onkeydown="return false;" @click="submit('form')" size="medium">{{$t('commons.save')}}</el-button>
</span>
</template>
</el-dialog>
@ -105,7 +105,7 @@
</el-form>
<template v-slot:footer>
<span class="dialog-footer">
<el-button type="primary" @click="updateWorkspace('updateForm')"
<el-button type="primary" @click="updateWorkspace('updateForm')" onkeydown="return false;"
size="medium">{{$t('commons.save')}}</el-button>
</span>
</template>
@ -139,8 +139,8 @@
</el-table-column>
<el-table-column :label="$t('commons.operating')">
<template v-slot:default="scope">
<el-button @click="editMember(scope.row)" type="primary" icon="el-icon-edit" size="mini" circle/>
<el-button @click="delMember(scope.row)" type="danger" icon="el-icon-delete" size="mini" circle/>
<el-button @click="editMember(scope.row)" onkeydown="return false;" type="primary" icon="el-icon-edit" size="mini" circle/>
<el-button @click="delMember(scope.row)" onkeydown="return false;" type="danger" icon="el-icon-delete" size="mini" circle/>
</template>
</el-table-column>
</el-table>
@ -195,7 +195,7 @@
</el-form>
<template v-slot:footer>
<span class="dialog-footer">
<el-button type="primary" @click="submitForm('form')" size="medium">{{$t('commons.save')}}</el-button>
<el-button type="primary" onkeydown="return false;" @click="submitForm('form')" size="medium">{{$t('commons.save')}}</el-button>
</span>
</template>
</el-dialog>
@ -230,7 +230,7 @@
</el-form>
<template v-slot:footer>
<span class="dialog-footer">
<el-button type="primary" @click="updateOrgMember('updateUserForm')"
<el-button type="primary" @click="updateOrgMember('updateUserForm')" onkeydown="return false;"
size="medium">{{$t('commons.save')}}</el-button>
</span>
</template>
@ -353,6 +353,9 @@
this.memberLineData = [];
this.list();
},
search() {
this.list();
},
list() {
let url = '/workspace/list/all/' + this.currentPage + '/' + this.pageSize;
this.result = this.$post(url, {name: this.condition}, response => {

View File

@ -147,7 +147,8 @@
</el-form>
<template v-slot:footer>
<span class="dialog-footer">
<el-button type="primary" @click="createTestResourcePool('createTestResourcePoolForm')"
<el-button type="primary" onkeydown="return false;"
@click="createTestResourcePool('createTestResourcePoolForm')"
size="medium">{{$t('commons.create')}}</el-button>
</span>
</template>
@ -226,7 +227,8 @@
</el-form>
<template v-slot:footer>
<span class="dialog-footer">
<el-button type="primary" @click="updateTestResourcePool('updateTestResourcePoolForm')"
<el-button type="primary" onkeydown="return false;"
@click="updateTestResourcePool('updateTestResourcePoolForm')"
size="medium">{{$t('commons.save')}}</el-button>
</span>
</template>
@ -282,7 +284,6 @@
},
methods: {
initTableData() {
this.loading = true;
let param = {
name: this.condition
};
@ -291,7 +292,6 @@
let data = response.data;
this.items = data.listObject;
this.total = data.itemCount;
this.loading = false;
})
},
changeResourceType() {

View File

@ -83,7 +83,8 @@
</el-form>
<template v-slot:footer>
<span class="dialog-footer">
<el-button type="primary" @click="createUser('createUserForm')" size="medium">创建</el-button>
<el-button type="primary" onkeydown="return false;"
@click="createUser('createUserForm')" size="medium">创建</el-button>
</span>
</template>
</el-dialog>
@ -105,7 +106,8 @@
</el-form>
<template v-slot:footer>
<span class="dialog-footer">
<el-button type="primary" @click="updateUser('updateUserForm')" size="medium">{{$t('commons.save')}}</el-button>
<el-button type="primary" onkeydown="return false;"
@click="updateUser('updateUserForm')" size="medium">{{$t('commons.save')}}</el-button>
</span>
</template>
</el-dialog>

View File

@ -27,8 +27,8 @@
</el-table-column>
<el-table-column>
<template v-slot:default="scope">
<el-button @click="edit(scope.row)" type="primary" icon="el-icon-edit" size="mini" circle v-permission="['test_manager']"/>
<el-button @click="del(scope.row)" type="danger" icon="el-icon-delete" size="mini" circle v-permission="['test_manager']"/>
<el-button @click="edit(scope.row)" onkeydown="return false;" type="primary" icon="el-icon-edit" size="mini" circle v-permission="['test_manager']"/>
<el-button @click="del(scope.row)" onkeydown="return false;" type="danger" icon="el-icon-delete" size="mini" circle v-permission="['test_manager']"/>
</template>
</el-table-column>
</el-table>
@ -78,7 +78,8 @@
</el-form>
<template v-slot:footer>
<span class="dialog-footer">
<el-button type="primary" @click="submitForm('form')" size="medium">{{$t('commons.save')}}</el-button>
<el-button type="primary" onkeydown="return false;"
@click="submitForm('form')" size="medium">{{$t('commons.save')}}</el-button>
</span>
</template>
</el-dialog>
@ -110,7 +111,8 @@
</el-form>
<template v-slot:footer>
<span class="dialog-footer">
<el-button type="primary" @click="updateWorkspaceMember('updateUserForm')" size="medium">{{$t('commons.save')}}</el-button>
<el-button type="primary" onkeydown="return false;"
@click="updateWorkspaceMember('updateUserForm')" size="medium">{{$t('commons.save')}}</el-button>
</span>
</template>
</el-dialog>