权限分发和用户权限管理

This commit is contained in:
dong 2022-10-26 15:31:55 +08:00
parent 0936e40deb
commit df9e1f4132
12 changed files with 1172 additions and 11 deletions

View File

@ -0,0 +1,53 @@
import request from '@/utils/request';
/** 创建权限分发*/
export function createDistribute(data) {
return request({
url: `/api/v3/permission/distribute/create`,
method: 'post',
data
});
}
/** 分页获取权限分发列表*/
export function getDistributeList(data) {
return request({
url: `/api/v3/permission/distribute/paging`,
method: 'post',
data
});
}
// /** 设置权限分发立即失效*/
// export function setDistributeInvalidate(pdId) {
// return request({
// url: `/api/v2/permission/distribute/${pdId}/invalidate`,
// method: 'put'
// });
// }
/** 获取权限分发明细*/
export function getDistributeDetail(disId) {
return request({
url: `/api/v3/permission/distribute/list/distribute/${disId}`,
method: 'get'
});
}
/** 从权限分发,直接分发给指定主体*/
export function setDistributeToSubject(pdId, subjectType, subjectId) {
return request({
url: `/api/v3/permission/distribute/${pdId}/to/${subjectType}/${subjectId}`,
method: 'post'
});
}
/** 生成分发二维码*/
export function getDistributeQrCode(pdId) {
return request({
url: `/api/v3/permission/distribute/${pdId}/qrCode`,
method: 'get'
});
}

View File

@ -0,0 +1,27 @@
import request from '@/utils/request';
/** 设置权限失效或有效*/
export function setPermissonInValid(subjectId) {
return request({
url: `/api/v2/permission/subject/inValid/${subjectId}`,
method: 'get'
});
}
/** 用户权限列表*/
export function listPermision(params) {
return request({
url: `/api/v2/permission/subject/page`,
method: 'get',
params: params
});
}
/** 查看用户分发的下级所有用户权限*/
export function getPermissonInDistribute(subjectId) {
return request({
url: `/api/v2/permission/subject/distribute/${subjectId}`,
method: 'get'
});
}

View File

@ -226,6 +226,10 @@ const ThirdPartyAccounts = () => import('@/views/thirdPartyAccounts/index');
const FunctionManage = () => import('@/views/functionManage/index'); const FunctionManage = () => import('@/views/functionManage/index');
const PermissionManage = () => import('@/views/permissionManage/index'); const PermissionManage = () => import('@/views/permissionManage/index');
const UserRulesManage = () => import('@/views/userRulesManage/index');
const AuthorityTransfer = () => import('@/views/authorityTransfer/index');
const CreateDistribute = () => import('@/views/authorityTransfer/create/index');
const DistributeDetail = () => import('@/views/authorityTransfer/detail');
// import { GenerateRouteProjectList } from '@/scripts/ProjectConfig'; // import { GenerateRouteProjectList } from '@/scripts/ProjectConfig';
// import { getSessionStorage } from '@/utils/auth'; // import { getSessionStorage } from '@/utils/auth';
@ -2065,7 +2069,8 @@ export const asyncRouter = [
{ {
// 权限分发管理 // 权限分发管理
path: 'authorityTransferManage', path: 'authorityTransferManage',
component: Permission, component: AuthorityTransfer,
// component: Permission,
meta: { meta: {
i18n: 'newRouter.authorityTransferManage' i18n: 'newRouter.authorityTransferManage'
} }
@ -2073,10 +2078,17 @@ export const asyncRouter = [
{ {
// 用户权限管理 // 用户权限管理
path: 'userRulesManage', path: 'userRulesManage',
component: UserRules, component: UserRulesManage,
// component: UserRules,
meta: { meta: {
i18n: 'newRouter.userRulesManage' i18n: 'newRouter.userRulesManage'
} }
},
{
// 权限分发管理-创建
path: 'createDistribute',
component: CreateDistribute,
hidden: true
} }
] ]
}, },

View File

@ -0,0 +1,30 @@
<template>
<el-dialog v-dialogDrag title="选择权限" :visible.sync="dialogShow" width="1400px" :before-close="close">
<PermissionList :only-select="true" table-height="450" v-bind="$attrs" v-on="$listeners" />
</el-dialog>
</template>
<script>
import PermissionList from '@/views/permissionManage/index';
export default {
name: 'AddPermission',
components: {
PermissionList
},
data() {
return {
dialogShow: false
};
},
methods: {
doShow() {
this.dialogShow = true;
},
close() {
this.dialogShow = false;
}
}
};
</script>

View File

@ -0,0 +1,201 @@
<template>
<div>
<div class="forms pack-rule">
<el-form ref="dataform" label-position="right" :model="formModel" label-width="80px" :rules="rules" size="mini" @submit.native.prevent>
<el-form-item label="关联权限" prop="permissionIds">
<div>
<el-button size="mini" style="margin-bottom:10px" @click="buttonClick">添加权限</el-button>
<el-table :data="formModel.permissionIds" size="mini" border class="table_item" max-height="400">
<el-table-column prop="permissionId" label="权限id" width="80" />
<el-table-column prop="permissionName" :label="$t('orderAuthor.permissionName')" />
<el-table-column :label="$t('orderAuthor.totalPermissions')" width="160">
<template slot-scope="scope">
<el-input-number v-model="scope.row.amount" :step="1" :min="1" :precision="0" />
</template>
</el-table-column>
<el-table-column :label="$t('global.operate')" width="80">
<template slot-scope="scope">
<el-button type="text" size="small" @click="removePermissions(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
</el-form-item>
<el-form-item :label="$t('orderAuthor.permanenceOrNot')" prop="forever">
<el-radio v-model="formModel.forever" :label="false"></el-radio>
<el-radio v-model="formModel.forever" :label="true"></el-radio>
</el-form-item>
<el-form-item :label="$t('orderAuthor.startTime')" prop="startTime">
<el-date-picker v-model="formModel.startTime" type="datetime" placeholder="选择日期时间" align="right" :picker-options="pickerOptions" value-format="yyyy-MM-dd HH:mm:ss" />
</el-form-item>
<el-form-item v-if="noForever" :label="$t('orderAuthor.endTime')">
<el-date-picker v-model="formModel.endTime" type="datetime" placeholder="选择日期时间" align="right" :picker-options="pickerOptions" value-format="yyyy-MM-dd HH:mm:ss" />
</el-form-item>
<el-form-item label="备注" prop="dsc">
<el-input v-model="formModel.dsc" placeholder="请输入" />
</el-form-item>
</el-form>
</div>
<div class="draft">
<el-button @click="turnback">{{ $t('global.back') }}</el-button>
<el-button type="primary" @click="saveAs">{{ $t('map.confirm') }}</el-button>
</div>
<addPermission ref="addPermission" :select-ids="formModel.permissionIds" @handleSelect="addPermissions" />
</div>
</template>
<script>
import addPermission from '@/views/authorityTransfer/create/addPermission';
import { createDistribute } from '@/api/authorityTransfer';
export default {
name: 'OrderForm',
components: {
addPermission
},
data() {
return {
errorTip: '请输入数量',
errorIntTip: '数量必须为整数',
formModel: {
forever: false,
startTime: '',
endTime: '',
dsc: '',
permissionIds:[]
},
pickerOptions: {
shortcuts: [{
text: '今天',
onClick(picker) {
picker.$emit('pick', new Date());
}
}, {
text: '昨天',
onClick(picker) {
const date = new Date();
date.setTime(date.getTime() - 3600 * 1000 * 24);
picker.$emit('pick', date);
}
}, {
text: '一周前',
onClick(picker) {
const date = new Date();
date.setTime(date.getTime() - 3600 * 1000 * 24 * 7);
picker.$emit('pick', date);
}
}]
}
};
},
computed: {
noForever() {
return !this.formModel.forever;
},
rules() {
const _this = this;
const baseRules = {
permissionIds: [
{ required: true, message: '请添加权限', trigger: 'change' },
{
validator(rule, value, callback) {
if (Array.isArray(value) && value.length > 0) {
callback();
} else {
callback(new Error('请添加权限'));
}
},
trigger: 'blur'
}
],
forever: [
{ required: true, message: this.$t('rules.pleaseSelect'), trigger: 'change' }
],
amount: [
{ required: true, message: this.$t('rules.authorAmountInput'), trigger: 'change' },
{
validator(rule, value, callback) {
if (Number.isInteger(Number(value)) && Number(value) > 0) {
callback();
} else {
callback(new Error(_this.$t('rules.authorAmountInputError')));
}
},
trigger: 'blur'
}
],
startTime: [
{ required: true, message: this.$t('rules.startTimePick'), trigger: 'change' }
],
dsc: [
{ required: true, message: '请输入备注', trigger: 'change' }
]
};
//
this.$nextTick(function () {
this.$refs.dataform.clearValidate();
});
return baseRules;
}
},
methods: {
buttonClick() {
this.$refs.addPermission.doShow();
},
validateChoose(rule, value, callback) {
if (value || value === 0) {
if (Number.isInteger(value)) {
callback();
} else {
callback(new Error(this.errorIntTip));
}
} else {
callback(new Error(this.errorTip));
}
},
addPermissions(row) {
const data = {
'permissionId': row.id,
'permissionName': row.name,
'amount': 1
};
this.formModel.permissionIds.push(data);
},
removePermissions(data) {
this.formModel.permissionIds = this.formModel.permissionIds.filter(({ permissionId }) => permissionId !== data.permissionId);
},
turnback() {
this.$router.go(-1);
},
saveAs() {
this.$refs['dataform'].validate((valid) => {
if (!valid) { return; }
this.loading = true;
createDistribute(this.formModel).then(response => {
this.loading = false;
this.$message.success('创建成功!');
this.turnback();
}).catch(() => {
this.loading = false;
this.$message.error('创建失败!');
});
});
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.pack-rule {
width: 800px;
margin: 0 auto;
margin-top: 12px;
padding: 40px;
}
.draft {
width: 400px;
text-align: center;
margin: 20px auto;
}
</style>

View File

@ -0,0 +1,82 @@
<template>
<el-dialog v-dialogDrag title="权限详情" :visible.sync="dialogShow" width="800px" :before-close="handleClose">
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
<div slot="footer">
<el-button type="primary" @click="handleClose">{{ $t('global.return') }}</el-button>
</div>
</el-dialog>
</template>
<script>
import { getDistributeDetail } from '@/api/authorityTransfer';
export default {
name: 'DistributeDetail',
data() {
return {
dialogShow: false,
height: 0,
disId: '',
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
show: false
},
queryList: {
query: this.queryFunction,
selectCheckShow: false,
paginationHiden: true,
indexShow: true,
columns: [
{
title: '权限id',
width: '80',
prop: 'permissionId'
},
{
title: '权限名称',
prop: 'permissionName'
},
{
title: '总数量',
width: '80',
prop: 'amount'
},
{
title: '剩余数量',
width: '80',
prop: 'remains'
}
]
}
};
},
methods: {
doShow(row) {
this.disId = row.id || '';
this.reloadTable();
this.dialogShow = true;
},
queryFunction(params) {
return getDistributeDetail(this.disId);
},
reloadTable() {
if (this.queryList && this.queryList.reload) {
this.queryList.reload();
}
},
handleClose() {
this.dialogShow = false;
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.draft {
width: 400px;
text-align: center;
margin: 20px auto;
}
</style>

View File

@ -0,0 +1,186 @@
<template>
<el-dialog title="权限分发到指定用户" :visible.sync="dialogVisible" width="1200px" :before-close="doClose" center :close-on-click-modal="false">
<QueryListPage ref="queryListPage1" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
</el-dialog>
</template>
<script>
import { getUserList } from '@/api/management/user';
import { setDistributeToSubject } from '@/api/authorityTransfer';
import { getCompanyList } from '@/api/company';
export default {
name:'DistributePackage',
data() {
return {
packageId:'',
dialogVisible:false,
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
companyMap: {},
companyList: [],
countTypeList:[
{label:'个人账户', value:'1'},
{label:'企业账户', value:'2'},
{label:'企业账户下子账户', value:'3'}
],
queryForm: {
labelWidth: '80px',
reset: true,
queryObject: {
name: {
type: 'text',
label: this.$t('system.name')
},
id: {
type: 'text',
label: 'id'
},
roles: {
type: 'select',
label: this.$t('system.roles'),
config: {
data: this.$ConstSelect.roleList
}
},
nickname: {
type: 'text',
label: '昵称'
},
mobile: {
type: 'text',
label: '手机号'
},
email: {
type: 'text',
label: '邮箱'
},
companyId: {
type: 'select',
label: '组织',
config: {
data: []
}
},
type:{
type: 'select',
label: '类型',
config: {
data: []
}
}
}
},
queryList: {
query: getUserList,
selectCheckShow: false,
height: '420',
indexShow: true,
columns: [
{
title: 'id',
prop: 'id',
width: 80
},
{
title: this.$t('system.name'),
prop: 'name'
},
{
title: this.$t('system.nickname'),
prop: 'nickname'
},
{
title: '类型',
prop: 'type',
type: 'tag',
columnValue: (row) => { return this.getCountType(row.type); },
tagType: (row) => { return 'success'; }
},
{
title: this.$t('global.mobile'),
prop: 'mobile'
},
{
title: this.$t('global.email'),
prop: 'email'
},
{
title: '组织',
prop: 'companyId',
type: 'tag',
columnValue: (row) => { return this.getCompanyName(row.companyId); },
tagType: (row) => { return 'success'; }
},
{
title: this.$t('system.roles'),
prop: 'roles',
type: 'tagMore',
columnValue: (row) => { return this.$convertField(row.roles, this.$ConstSelect.roleList, ['value', 'label'], true); },
tagType: (row) => { return 'success'; }
},
{
type: 'button',
title: this.$t('global.operate'),
width: '90',
buttons: [
{
name: '选择',
handleClick: this.distributePackage
}
]
}
]
}
};
},
created() {
this.companyMap = {};
this.companyList = [];
getCompanyList().then(resp => {
if (resp && resp.data && resp.data.length) {
resp.data.forEach(item => {
this.companyMap[item.id] = item.name;
this.companyList.push({label: item.name, value: parseInt(item.id)});
});
this.queryForm.queryObject.companyId.config.data = this.companyList;
this.queryForm.queryObject.type.config.data = this.countTypeList;
}
}).catch((error) => {
console.error(error);
});
},
methods:{
doShow(data) {
this.packageId = data.id;
this.dialogVisible = true;
},
doClose() {
this.dialogVisible = false;
},
getCountType(type) {
const countType = this.countTypeList.find(each=>{ return each.value == type; });
return countType ? countType.label : '';
},
getCompanyName(companyId) {
return this.companyMap[companyId];
},
distributePackage(index, row) {
if (this.packageId) {
const accountId = row.id;
const subjectType = row.type == '1' ? 'user' : 'org';
setDistributeToSubject(this.packageId, subjectType, accountId).then(resp=> {
this.$message.success('权限分发给指定账户成功!');
this.$emit('reloadTable');
this.doClose();
}).catch(() => {
this.$messageBox('权限分发给指定账户失败');
});
}
}
}
};
</script>

View File

@ -0,0 +1,152 @@
<template>
<div>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
<qr-code ref="qrCode" />
<distribute-package ref="distributePackage" @reloadTable="reloadTable" />
<Detail ref="detail" />
</div>
</template>
<script>
import { admin } from '@/router/index';
import { getDistributeList, getDistributeQrCode } from '@/api/authorityTransfer';
import QrCode from '@/components/QrCode';
import DistributePackage from './distributePackage';
import Detail from './detail';
export default {
name: 'Author',
components: {
QrCode,
Detail,
DistributePackage
},
data() {
return {
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
labelWidth: '100px',
reset: false,
queryObject: {
dsc: {
type: 'text',
label: '备注'
}
}
},
queryList: {
query: this.queryFunction,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: '权限分发Id',
width: '100',
prop: 'id'
},
{
title: '备注',
prop: 'dsc'
},
{
title: this.$t('orderAuthor.founder'),
prop: 'nickName'
},
{
title: this.$t('orderAuthor.permanenceOrNot'),
prop: 'forever',
width: '80',
type: 'tag',
columnValue: (row) => { return this.$ConstSelect.translate(row.forever, 'Whether'); },
tagType: (row) => {
switch (row.forever) {
case true: return 'success';
case false: return 'danger';
}
}
},
{
title: this.$t('orderAuthor.startTime'),
prop: 'startTime',
width: '160'
},
{
title: this.$t('orderAuthor.endTime'),
prop: 'endTime',
width: '160'
},
{
title: '创建时间',
prop: 'createTime',
width: '160'
},
{
title: '更新时间',
prop: 'updateTime',
width: '160'
},
{
type: 'button',
title: this.$t('global.operate'),
width: this.$i18n.locale == 'en' ? '400' : '300',
hide: (row) => { return this.$store.state.user.roles.indexOf(admin) < 0; },
buttons: [
{
name: this.$t('orderAuthor.obtainQrCode'),
handleClick: this.handleRtCodeShow,
type: ''
},
{
name: '权限详情',
handleClick: this.handleDetailShow,
type: ''
},
{
name: '领取到',
handleClick: this.distributePackage,
type: ''
}
]
}
],
actions: [
{ text: '创建权限分发', handler: this.handleCreatePackage }
]
}
};
},
methods: {
queryFunction(params) {
return getDistributeList(params);
},
reloadTable() {
if (this.queryList && this.queryList.reload) {
this.queryList.reload();
}
},
handleDetailShow(index, row) {
this.$refs.detail.doShow(row);
},
handleRtCodeShow(index, row) {
getDistributeQrCode(row.id).then(resp => {
this.$refs.qrCode.doShow({
url: resp.data,
title: this.$t('orderAuthor.privilegeTransferQRCode')
});
}).catch(() => {
this.$message.error('获取二维码失败!');
});
},
handleCreatePackage() {
this.$router.push({ path: `/systemManagement/permissionDataManage/createDistribute` });
},
distributePackage(index, row) {
this.$refs.distributePackage.doShow(row);
}
}
};
</script>

View File

@ -119,8 +119,4 @@ export default {
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
/deep/
.el-row .el-button+.el-button{
margin-top: 10px;
}
</style> </style>

View File

@ -15,6 +15,22 @@ export default {
components: { components: {
Create Create
}, },
props: {
onlySelect: {
type: Boolean,
default: false
},
selectIds: {
type: Array,
default: () => {
return [];
}
},
tableHeight: {
type: String,
default: ''
}
},
data() { data() {
return { return {
// PermissionTypeList: [], // PermissionTypeList: [],
@ -82,13 +98,21 @@ export default {
{ {
name: this.$t('global.edit'), name: this.$t('global.edit'),
handleClick: this.handleEdit, handleClick: this.handleEdit,
showControl: (row) => { return !this.onlySelect; },
type: ''
},
{
name: '选择',
handleClick: this.handleSelect,
showControl: (row) => { return this.onlySelect; },
isDisabled: this.selectDisabled,
type: '' type: ''
} }
] ]
} }
], ],
actions: [ actions: [
{ text: this.$t('orderAuthor.createPermission'), handler: this.create } { text: this.$t('orderAuthor.createPermission'), handler: this.create, show: !this.onlySelect }
] ]
} }
}; };
@ -96,8 +120,21 @@ export default {
created() { created() {
this.getAllAbility(); this.getAllAbility();
if (this.tableHeight) {
this.queryList.height = this.tableHeight;
}
}, },
methods: { methods: {
selectDisabled(index, row) {
let s = false;
const findObj = this.selectIds.find(item => {
return item.permissionId == row.id;
});
if (findObj) {
s = true;
}
return s;
},
getAllAbility() { getAllAbility() {
getAllAbility().then(res => { getAllAbility().then(res => {
res.data && res.data.forEach(item => { res.data && res.data.forEach(item => {
@ -130,6 +167,9 @@ export default {
handleEdit(index, row) { handleEdit(index, row) {
this.$refs.create.doShow(row); this.$refs.create.doShow(row);
}, },
handleSelect(index, row) {
this.$emit('handleSelect', row);
},
create() { create() {
this.$refs.create.doShow(); this.$refs.create.doShow();
} }
@ -137,8 +177,4 @@ export default {
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
/deep/
.el-row .el-button+.el-button{
margin-top: 10px;
}
</style> </style>

View File

@ -0,0 +1,203 @@
<template>
<div>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
<PermissionList ref="list" :effective-type-list="EffectiveTypeList" :sub-type-list="subTypeList" />
</div>
</template>
<script>
import { listPermision, setPermissonInValid } from '@/api/userRulesManage';
import PermissionList from './permissionList';
export default {
name: 'UserRulesManage',
components: {
PermissionList
},
data() {
return {
PermissionTypeList: [],
belongForm: {},
EffectiveTypeList: [
{ value: '1', label: '有效'},
{ value: '2', label: '无效'}
],
subTypeList: [
{ value: 'user', label: '个人'},
{ value: 'org', label: '组织'}
],
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
labelWidth: '120px',
reset: true,
queryObject: {
named: {
type: 'text',
label: '主体名称'
},
subType: {
type: 'select',
label: '主体类型',
config: {
data: []
}
},
status: {
type: 'select',
label: this.$t('permission.statusType'),
config: {
data: []
}
}
}
},
queryList: {
query: this.queryFunction,
selectCheckShow: false,
indexShow: true,
defaultSort:{prop:'sortOrder', order:''},
columns: [
{
title: '主体名称',
prop: 'named'
},
{
title: this.$t('permission.nickName'),
prop: 'nickName'
},
{
title: this.$t('permission.permissionName'),
prop: 'permissionName'
},
{
title: '主体类型',
prop: 'subjectType',
width: '80',
type: 'tag',
columnValue: (row) => { return this.$convertField(row.subjectType, this.subTypeList, ['value', 'label']); },
tagType: (row) => { return ''; }
},
{
title: this.$t('permission.isForever'),
width: '80',
prop: 'forever',
type: 'tag',
columnValue: (row) => { return this.$ConstSelect.translate(row.forever, 'Whether'); },
tagType: (row) => {
switch (row.forever) {
case true: return 'success';
case false: return 'danger';
}
}
},
{
title: this.$t('permission.permissionTotal'),
width: '80',
prop: 'amount'
},
{
title: this.$t('permission.permissionRemains'),
width: '80',
prop: 'remains'
},
{
title:this.$t('global.startTime'),
prop: 'startTime',
width: '160'
},
{
title: this.$t('permission.endTime'),
prop: 'endTime',
width: '160'
},
{
title: this.$t('permission.permissionStatus'),
prop: 'status',
width: '80',
type: 'tag',
columnValue: (row) => { return this.$convertField(row.status, this.EffectiveTypeList, ['value', 'label']); },
tagType: (row) => {
switch (row.status) {
case '1': return 'success';
default: return 'danger';
}
}
},
{
type: 'button',
title: this.$t('global.operate'),
width: '200',
buttons: [
{
name: this.$t('orderAuthor.setupFailure'), //
handleClick: this.handleEfficacy,
showControl: (row) => { return row.status === '1'; },
type: 'warning'
},
{
name: '权限流向',
handleClick: this.handleRestoreList,
showControl: (row) => { return row.amount !== row.remains; },
type: ''
}
]
}
],
actions: [
]
}
};
},
mounted() {
this.loadInitData();
},
methods: {
loadInitData() {
this.EffectiveTypeList.forEach(elem => {
this.queryForm.queryObject.status.config.data.push(elem);
});
this.subTypeList.forEach(elem => {
this.queryForm.queryObject.subType.config.data.push(elem);
});
},
formatterDate(row, porpInfo) {
return row[porpInfo.property] ? row[porpInfo.property] : this.$t('global.perpetual');
},
handleRestoreList(index, row) {
this.$refs.list.doShow(index, row);
},
queryFunction(params) {
// params.distributeId = this.$route.query.distributeId;
return listPermision(params);
},
reloadTable() {
if (this.queryList && this.queryList.reload) {
this.queryList.reload();
}
},
handleEfficacy(index, row) {
this.$confirm(this.$t('tip.modifyTheUserPermissionStatus'), this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'),
type: 'warning'
}).then(() => {
setPermissonInValid(row.id).then(res => {
this.$message.success(this.$t('tip.operationSuccessfully'));
this.reloadTable();
}).catch(() => {
this.$messageBox(this.$t('tip.operationFailed'));
this.reloadTable();
});
}).catch(() => { });
}
}
};
</script>
<style lang="scss" scoped>
</style>

View File

@ -0,0 +1,183 @@
<template>
<el-dialog v-dialogDrag title="权限流向" :visible.sync="dialogShow" width="1000px" :before-close="close">
<div>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="close">{{ $t('map.cancel') }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { getPermissonInDistribute } from '@/api/userRulesManage';
export default {
name: 'PermissionList',
components: {
},
props: {
effectiveTypeList: {
required: true,
type: Array
},
subTypeList:{
required:true,
type:Array
}
},
data() {
return {
dialogShow: false,
id: '',
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
labelWidth: '140px',
reset: true,
show: false,
queryObject: {
}
},
queryList: {
query: this.queryFunction,
selectCheckShow: false,
paginationHiden: true,
indexShow: true,
columns: [
{
title: '主体名称',
prop: 'named'
},
{
title: this.$t('permission.nickName'),
prop: 'nickName'
},
{
title: this.$t('permission.permissionName'),
prop: 'permissionName'
},
{
title: '主体类型',
prop: 'subjectType',
width: '80',
type: 'tag',
columnValue: (row) => { return this.$convertField(row.subjectType, this.subTypeList, ['value', 'label']); },
tagType: (row) => { return ''; }
},
{
title: this.$t('permission.isForever'),
prop: 'forever',
width: '80',
type: 'tag',
columnValue: (row) => { return this.$ConstSelect.translate(row.forever, 'Whether'); },
tagType: (row) => {
switch (row.forever) {
case true: return 'success';
case false: return 'danger';
}
}
},
{
title: this.$t('permission.permissionTotal'),
width: '80',
prop: 'amount'
},
{
title: this.$t('permission.permissionRemains'),
width: '80',
prop: 'remains'
},
{
title:this.$t('global.startTime'),
prop: 'startTime',
width: '160'
},
{
title: this.$t('permission.endTime'),
prop: 'endTime',
width: '160'
},
{
title: this.$t('permission.permissionStatus'),
prop: 'status',
width: '80',
type: 'tag',
columnValue: (row) => { return this.$convertField(row.status, this.EffectiveTypeList, ['value', 'label']); },
tagType: (row) => {
switch (row.status) {
case '1': return 'success';
default: return 'danger';
}
}
}
// {
// type: 'button',
// title: this.$t('global.operate'),
// buttons: [
// {
// name: '',
// handleClick: this.handleRestore,
// type: 'danger',
// showControl: (row) => {
// return row.status === '1';
// }
// }
// ]
// }
],
actions: [
]
}
};
},
methods: {
doShow(index, row) {
console.log(row);
if (!row.subjectId) { return; }
this.id = row.subjectId;
this.dialogShow = true;
this.reloadTable();
},
close() {
this.id = '';
this.dialogShow = false;
},
// handleRestore(index, row) {
// this.$confirm('', this.$t('global.tips'), {
// confirmButtonText: this.$t('global.confirm'),
// cancelButtonText: this.$t('global.cancel'),
// type: 'warning'
// }).then(() => {
// putUserPermissionBackUser(row.id).then(resp => {
// this.reloadTable();
// this.$message.success(this.$t('tip.recoveryPrivilegesSuccessful'));
// }).catch(() => {
// this.$messageBox(this.$t('tip.recoveryPrivilegesFailed'));
// });
// }).catch(() => { });
// },
queryFunction() {
if (this.id) {
return getPermissonInDistribute(this.id);
}
},
reloadTable() {
if (this.queryList && this.queryList.reload) {
this.queryList.reload();
}
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.draft {
width: 400px;
text-align: center;
margin: 20px auto;
}
</style>