refactor(系统设置): 部分权限设置

This commit is contained in:
shiziyuan9527 2021-05-22 21:31:58 +08:00 committed by 刘瑞斌
parent 2506cb6997
commit 6276d1c719
13 changed files with 64 additions and 31 deletions

View File

@ -1,9 +1,9 @@
<template>
<span>
<slot name="front"></slot>
<ms-table-operator-button :isTesterPermission="isTesterPermission" :tip="tip1" icon="el-icon-edit" @exec="editClick" @click.stop="editClickStop"/>
<ms-table-operator-button v-permission="editPermission" :isTesterPermission="isTesterPermission" :tip="tip1" icon="el-icon-edit" @exec="editClick" @click.stop="editClickStop"/>
<slot name="middle"></slot>
<ms-table-operator-button :isTesterPermission="isTesterPermission" :tip="tip2" icon="el-icon-delete" type="danger" @exec="deleteClick" @click.stop="deleteClickStop"/>
<ms-table-operator-button v-permission="deletePermission" :isTesterPermission="isTesterPermission" :tip="tip2" icon="el-icon-delete" type="danger" @exec="deleteClick" @click.stop="deleteClickStop"/>
<slot name="behind"></slot>
</span>
@ -30,6 +30,18 @@
isTesterPermission: {
type: Boolean,
default: false
},
editPermission: {
type: Array,
default() {
return [];
}
},
deletePermission: {
type: Array,
default() {
return [];
}
}
},
methods: {

View File

@ -2,7 +2,7 @@
<div v-loading="result.loading">
<el-card class="table-card">
<template v-slot:header>
<ms-table-header :condition.sync="condition" @search="initTableData" @create="create"
<ms-table-header v-permission="['ORGANIZATION_USER:READ+CREATE']" :condition.sync="condition" @search="initTableData" @create="create"
:create-tip="$t('member.create')" :title="$t('commons.member')"/>
</template>
<el-table border class="adjust-table ms-select-all-fixed" :data="tableData" style="width: 100%"
@ -34,7 +34,9 @@
</el-table-column>
<el-table-column :label="$t('commons.operating')">
<template v-slot:default="scope">
<ms-table-operator :tip2="$t('commons.remove')" @editClick="edit(scope.row)" @deleteClick="del(scope.row)"/>
<ms-table-operator :edit-permission="['ORGANIZATION_USER:READ+EDIT']"
:delete-permission="['ORGANIZATION_USER:READ+DELETE']"
:tip2="$t('commons.remove')" @editClick="edit(scope.row)" @deleteClick="del(scope.row)"/>
</template>
</el-table-column>
</el-table>

View File

@ -2,7 +2,7 @@
<div>
<el-card class="table-card" v-loading="result.loading">
<template v-slot:header>
<ms-table-header :condition.sync="condition" @search="list" @create="create"
<ms-table-header v-permission="['ORGANIZATION_WORKSPACE:READ+CREATE']" :condition.sync="condition" @search="list" @create="create"
:create-tip="$t('workspace.create')" :title="$t('commons.workspace')"/>
</template>
<el-table border class="adjust-table" :data="items" style="width: 100%"
@ -19,7 +19,9 @@
</el-table-column>
<el-table-column :label="$t('commons.operating')">
<template v-slot:default="scope">
<ms-table-operator @editClick="edit(scope.row)" @deleteClick="handleDelete(scope.row)"/>
<ms-table-operator :edit-permission="['ORGANIZATION_WORKSPACE:READ+EDIT']"
:delete-permission="['ORGANIZATION_WORKSPACE:READ+DELETE']"
@editClick="edit(scope.row)" @deleteClick="handleDelete(scope.row)"/>
</template>
</el-table-column>
</el-table>

View File

@ -3,12 +3,12 @@
<el-card class="table-card" v-loading="result.loading">
<!-- 表头 -->
<template v-slot:header>
<ms-table-header :title="$t('api_test.environment.environment_list')" :create-tip="btnTips"
<ms-table-header v-permission="['PROJECT_ENVIRONMENT:READ+CREATE']" :title="$t('api_test.environment.environment_list')" :create-tip="btnTips"
:condition.sync="condition" :is-tester-permission="isTesterPermission" @search="search" @create="createEnv">
<template v-slot:button>
<ms-table-button :is-tester-permission="isTesterPermission" icon="el-icon-box"
<ms-table-button v-permission="['PROJECT_ENVIRONMENT:READ+IMPORT']" :is-tester-permission="isTesterPermission" icon="el-icon-box"
:content="$t('commons.import')" @click="importJSON"/>
<ms-table-button :is-tester-permission="isTesterPermission" icon="el-icon-box"
<ms-table-button v-permission="['PROJECT_ENVIRONMENT:READ+EXPORT']" :is-tester-permission="isTesterPermission" icon="el-icon-box"
:content="$t('commons.export')" @click="exportJSON"/>
</template>
</ms-table-header>
@ -35,9 +35,11 @@
</el-table-column>
<el-table-column :label="$t('commons.operating')">
<template v-slot:default="scope">
<ms-table-operator @editClick="editEnv(scope.row)" @deleteClick="deleteEnv(scope.row)">
<ms-table-operator :edit-permission="['PROJECT_ENVIRONMENT:READ+EDIT']"
:delete-permission="['PROJECT_ENVIRONMENT:READ+DELETE']"
@editClick="editEnv(scope.row)" @deleteClick="deleteEnv(scope.row)">
<template v-slot:middle>
<ms-table-operator-button :tip="$t('commons.copy')" @exec="copyEnv(scope.row)" :is-tester-permission="isTesterPermission"
<ms-table-operator-button v-permission="['PROJECT_ENVIRONMENT:READ+COPY']" :tip="$t('commons.copy')" @exec="copyEnv(scope.row)" :is-tester-permission="isTesterPermission"
icon="el-icon-document-copy" type="info"/>
</template>
</ms-table-operator>

View File

@ -2,7 +2,7 @@
<div v-loading="result.loading">
<el-card class="table-card">
<template v-slot:header>
<ms-table-header :condition.sync="condition" @search="initTableData" @create="create"
<ms-table-header v-permission="['PROJECT_USER:READ+CREATE']" :condition.sync="condition" @search="initTableData" @create="create"
:create-tip="$t('member.create')" :title="$t('commons.member')" :have-search="false"/>
</template>
<el-table border class="adjust-table ms-select-all-fixed" :data="tableData" style="width: 100%"
@ -20,7 +20,9 @@
</el-table-column>
<el-table-column :label="$t('commons.operating')">
<template v-slot:default="scope">
<ms-table-operator :tip2="$t('commons.remove')" @editClick="edit(scope.row)" @deleteClick="del(scope.row)"/>
<ms-table-operator :edit-permission="['PROJECT_USER:READ+EDIT']"
:delete-permission="['PROJECT_USER:READ+DELETE']"
:tip2="$t('commons.remove')" @editClick="edit(scope.row)" @deleteClick="del(scope.row)"/>
</template>
</el-table-column>
</el-table>

View File

@ -2,7 +2,7 @@
<div v-loading="result.loading">
<el-card class="table-card">
<template v-slot:header>
<ms-table-header :is-tester-permission="true" :condition.sync="condition" @search="search" @create="create"
<ms-table-header v-permission="['PROJECT_MANAGER:READ+CREATE']" :is-tester-permission="true" :condition.sync="condition" @search="search" @create="create"
:create-tip="btnTips" :title="$t('commons.project')">
<template v-slot:button>
<ms-table-button :is-tester-permission="true" icon="el-icon-box"
@ -52,7 +52,10 @@
</el-table-column>
<el-table-column :label="$t('commons.operating')" width="180">
<template v-slot:default="scope">
<ms-table-operator :is-tester-permission="true" @editClick="edit(scope.row)"
<ms-table-operator
:edit-permission="['PROJECT_MANAGER:READ+EDIT']"
:delete-permission="['PROJECT_MANAGER:READ+DELETE']"
:is-tester-permission="true" @editClick="edit(scope.row)"
@deleteClick="handleDelete(scope.row)">
<template v-slot:behind>
<ms-table-operator-button :is-tester-permission="true"

View File

@ -20,7 +20,7 @@ export default {
{
path: 'usergroup',
component: () => import('@/business/components/settings/system/group/UserGroup'),
meta: {system: true, title: '用户组与权限', permissions: ['SYSTEM_GROUP:READ']}
meta: {system: true, title: '用户组与权限', permissions: ['SYSTEM_GROUP:READ', 'ORGANIZATION_GROUP:READ']}
},
{
path: 'workspace/template/field',
@ -55,7 +55,7 @@ export default {
{
path: 'testresourcepool',
component: () => import('@/business/components/settings/system/TestResourcePool'),
meta: {system: true, title: 'commons.test_resource_pool', permissions: ['SYSTEM_WORKSPACE:READ']}
meta: {system: true, title: 'commons.test_resource_pool', permissions: ['SYSTEM_TEST_POOL:READ']}
},
{
path: 'systemparametersetting',

View File

@ -3,7 +3,7 @@
<el-card class="table-card">
<template v-slot:header>
<ms-table-header :condition.sync="condition" @search="initTableData" @create="create"
<ms-table-header v-permission="['SYSTEM_ORGANIZATION:READ+CREATE']" :condition.sync="condition" @search="initTableData" @create="create"
:create-tip="$t('organization.create')" :title="$t('commons.organization')"/>
</template>
<!-- system menu organization table-->
@ -21,7 +21,9 @@
</el-table-column>
<el-table-column :label="$t('commons.operating')">
<template v-slot:default="scope">
<ms-table-operator @editClick="edit(scope.row)" @deleteClick="handleDelete(scope.row)"/>
<ms-table-operator :edit-permission="['SYSTEM_ORGANIZATION:READ+EDIT']"
:delete-permission="['SYSTEM_ORGANIZATION:READ+DELETE']"
@editClick="edit(scope.row)" @deleteClick="handleDelete(scope.row)"/>
</template>
</el-table-column>
</el-table>

View File

@ -2,7 +2,7 @@
<div>
<el-card class="table-card" v-loading="result.loading">
<template v-slot:header>
<ms-table-header :condition.sync="condition" @search="list" @create="create"
<ms-table-header v-permission="['SYSTEM_WORKSPACE:READ+CREATE']" :condition.sync="condition" @search="list" @create="create"
:create-tip="$t('workspace.create')" :title="$t('commons.workspace')"/>
</template>
<!-- workspace table -->
@ -21,7 +21,8 @@
</el-table-column>
<el-table-column :label="$t('commons.operating')">
<template v-slot:default="scope">
<ms-table-operator @editClick="edit(scope.row)" @deleteClick="handleDelete(scope.row)"/>
<ms-table-operator :edit-permission="['SYSTEM_WORKSPACE:READ+EDIT']" :delete-permission="['SYSTEM_WORKSPACE:READ+DELETE']"
@editClick="edit(scope.row)" @deleteClick="handleDelete(scope.row)"/>
</template>
</el-table-column>
</el-table>

View File

@ -2,7 +2,7 @@
<div>
<el-card class="table-card" v-loading="result.loading">
<template v-slot:header>
<ms-table-header :condition.sync="condition" @search="search" @create="create"
<ms-table-header v-permission="['SYSTEM_TEST_POOL:READ+CREATE']" :condition.sync="condition" @search="search" @create="create"
:create-tip="$t('test_resource_pool.create_resource_pool')"
:title="$t('commons.test_resource_pool')"/>
</template>
@ -39,7 +39,9 @@
</el-table-column>
<el-table-column :label="$t('commons.operating')">
<template v-slot:default="scope">
<ms-table-operator @editClick="edit(scope.row)" @deleteClick="del(scope.row)"/>
<ms-table-operator :edit-permission="['SYSTEM_TEST_POOL:READ+EDIT']"
:delete-permission="['SYSTEM_TEST_POOL:READ+DELETE']"
@editClick="edit(scope.row)" @deleteClick="del(scope.row)"/>
</template>
</el-table-column>
</el-table>

View File

@ -3,7 +3,7 @@
<el-card class="table-card">
<template v-slot:header>
<ms-table-header :condition.sync="condition" @search="search" @create="create"
<ms-table-header v-permission="['SYSTEM_USER:READ+CREATE']" :condition.sync="condition" @search="search" @create="create"
:create-tip="$t('user.create')" :title="$t('commons.user')"/>
</template>
@ -53,10 +53,11 @@
<el-table-column prop="source" :label="$t('user.source')"/>
<el-table-column :label="$t('commons.operating')" min-width="120px">
<template v-slot:default="scope">
<ms-table-operator @editClick="edit(scope.row)" @deleteClick="del(scope.row)">
<ms-table-operator :edit-permission="['SYSTEM_USER:READ+EDIT']" :delete-permission="['SYSTEM_USER:READ+DELETE']"
@editClick="edit(scope.row)" @deleteClick="del(scope.row)">
<template v-slot:behind>
<ms-table-operator-button :tip="$t('member.edit_password')" icon="el-icon-s-tools"
type="success" @exec="editPassword(scope.row)" v-if="scope.row.isLocalUser"/>
v-permission="['SYSTEM_USER:READ+EDIT_PASSWORD']" type="success" @exec="editPassword(scope.row)" v-if="scope.row.isLocalUser"/>
</template>
</ms-table-operator>
</template>

View File

@ -2,7 +2,7 @@
<div v-loading="result.loading">
<el-card>
<template v-slot:header>
<ms-table-header :condition.sync="condition" @search="initData" @create="create"
<ms-table-header v-permission="['SYSTEM_GROUP:READ+CREATE']" :condition.sync="condition" @search="initData" @create="create"
create-tip="创建用户组" title="用户组与权限"/>
</template>
@ -29,10 +29,12 @@
<el-table-column prop="description" label="描述"/>
<el-table-column :label="$t('commons.operating')" min-width="120">
<template v-slot:default="scope">
<ms-table-operator @editClick="edit(scope.row)" @deleteClick="del(scope.row)">
<ms-table-operator :edit-permission="['SYSTEM_GROUP:READ+EDIT']"
:delete-permission="['SYSTEM_GROUP:READ+DELETE']"
@editClick="edit(scope.row)" @deleteClick="del(scope.row)">
<template v-slot:middle>
<!-- <ms-table-operator-button tip="复制" icon="el-icon-document-copy" @exec="copy(scope.row)"/>-->
<ms-table-operator-button tip="设置权限" icon="el-icon-s-tools" @exec="setPermission(scope.row)"/>
<ms-table-operator-button v-permission="['SYSTEM_GROUP:READ+SETTING_PERMISSION']" tip="设置权限" icon="el-icon-s-tools" @exec="setPermission(scope.row)"/>
</template>
</ms-table-operator>
</template>

View File

@ -2,7 +2,7 @@
<div v-loading="result.loading">
<el-card class="table-card">
<template v-slot:header>
<ms-table-header :condition.sync="condition" @search="initTableData" @create="create"
<ms-table-header v-permission="['WORKSPACE_USER:READ+CREATE']" :condition.sync="condition" @search="initTableData" @create="create"
:create-tip="$t('member.create')" :title="$t('commons.member')"/>
</template>
<el-table border class="adjust-table ms-select-all-fixed" :data="tableData" style="width: 100%"
@ -35,7 +35,9 @@
</el-table-column>
<el-table-column :label="$t('commons.operating')">
<template v-slot:default="scope">
<ms-table-operator :tip2="$t('commons.remove')" @editClick="edit(scope.row)" @deleteClick="del(scope.row)"
<ms-table-operator :edit-permission="['WORKSPACE_USER:READ+EDIT']"
:delete-permission="['WORKSPACE_USER:READ+DELETE']"
:tip2="$t('commons.remove')" @editClick="edit(scope.row)" @deleteClick="del(scope.row)"
v-roles="['test_manager']"/>
</template>
</el-table-column>