216 lines
5.6 KiB
Vue
216 lines
5.6 KiB
Vue
<template>
|
|
<div>
|
|
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
|
|
<select-role ref="selectRole" @reloadTable="reloadTable" />
|
|
<div class="btn-buy">
|
|
<el-button type="primary" @click="goBack">返回</el-button>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { listUserPermision } from '@/api/management/author';
|
|
import { UrlConfig } from '@/router/index';
|
|
import { superAdmin, admin } from '@/router';
|
|
import selectRole from './selectRole/list';
|
|
|
|
export default {
|
|
name: 'Author',
|
|
components: {
|
|
selectRole
|
|
},
|
|
data() {
|
|
return {
|
|
param: '',
|
|
WhetherTypeList: [],
|
|
// EffectiveTypeList: [],
|
|
PermissionTypeList: [],
|
|
pagerConfig: {
|
|
pageSize: 'pageSize',
|
|
pageIndex: 'pageNum'
|
|
},
|
|
queryForm: {
|
|
labelWidth: '140px',
|
|
reset: true,
|
|
queryObject: {
|
|
// 'type': {
|
|
// type: 'select',
|
|
// label: this.$t('permission.permissionType'),
|
|
// config: {
|
|
// data: []
|
|
// }
|
|
// },
|
|
// 'status': {
|
|
// type: 'select',
|
|
// label: this.$t('permission.permissionStatus'),
|
|
// value: '1',
|
|
// config: {
|
|
// data: []
|
|
// }
|
|
// },
|
|
'canDistribute': {
|
|
type: 'select',
|
|
label: this.$t('permission.permissionUseType'),
|
|
config: {
|
|
data: []
|
|
}
|
|
}
|
|
}
|
|
},
|
|
queryList: {
|
|
query: this.queryFunction,
|
|
selectCheckShow: false,
|
|
indexShow: true,
|
|
columns: [
|
|
{
|
|
title: this.$t('permission.permissionName'),
|
|
width: '210',
|
|
prop: 'permissionName'
|
|
},
|
|
{
|
|
title: this.$t('permission.permissionType'),
|
|
prop: 'permissionType',
|
|
type: 'tag',
|
|
columnValue: (row) => { return this.$convertField(row.permissionType, this.PermissionTypeList, ['value', 'label']); },
|
|
tagType: (row) => { return ''; }
|
|
},
|
|
{
|
|
title: this.$t('permission.permissionUseType'),
|
|
prop: 'canDistribute',
|
|
type: 'tag',
|
|
columnValue: (row) => { return this.$ConstSelect.translate(row.canDistribute, 'PermissionUseList'); },
|
|
tagType: (row) => {
|
|
switch (row.canDistribute) {
|
|
case true: return 'success';
|
|
case false: return 'danger';
|
|
}
|
|
}
|
|
},
|
|
// {
|
|
// title: this.$t('permission.isForever'),
|
|
// 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'),
|
|
prop: 'amount'
|
|
},
|
|
{
|
|
title: this.$t('permission.permissionRemains'),
|
|
prop: 'remains'
|
|
},
|
|
{
|
|
title: this.$t('permission.startTime'),
|
|
prop: 'startTime',
|
|
type: 'formatter',
|
|
formatter: this.formatterDate
|
|
|
|
},
|
|
{
|
|
title: this.$t('permission.endTime'),
|
|
prop: 'endTime',
|
|
type: 'formatter',
|
|
formatter: this.formatterDate
|
|
},
|
|
{
|
|
title: this.$t('permission.belonger'),
|
|
prop: 'ownerName',
|
|
isShow: () => { return this.$store.state.user.roles.indexOf(superAdmin) > 0 || this.$store.state.user.roles.indexOf(admin) > 0; }
|
|
},
|
|
{
|
|
type: 'button',
|
|
title: this.$t('global.operate'),
|
|
width: '300',
|
|
hide: () => { return this.$store.state.user.roles.indexOf(superAdmin) < 0 || this.$store.state.user.roles.indexOf(admin) < 0; },
|
|
buttons: [
|
|
{
|
|
name: this.$t('permission.setBelonger'),
|
|
handleClick: this.handleRoleVest,
|
|
type: ''
|
|
},
|
|
{
|
|
name: '打包详情',
|
|
handleClick: this.handleDetail,
|
|
type: '',
|
|
showControl: (row) => { return !row.permissionType; }
|
|
}
|
|
]
|
|
}
|
|
],
|
|
actions: [
|
|
{ text: this.$t('permission.permissionPack'), btnCode: 'employee_insert', handler: this.handlePermissionPack }
|
|
]
|
|
}
|
|
};
|
|
},
|
|
|
|
mounted() {
|
|
this.loadInitData();
|
|
},
|
|
methods: {
|
|
handleRoleVest(index, row) {
|
|
this.$refs.selectRole.doShow(row.id);
|
|
},
|
|
handleDetail(index, row) {
|
|
this.$router.push({ path: `${UrlConfig.permission.permissionList}/detail/${row.permissionId}` });
|
|
},
|
|
loadInitData() {
|
|
this.queryForm.queryObject.canDistribute.config.data = this.$ConstSelect.PermissionUseList;
|
|
|
|
// this.$Dictionary.effectiveType().then(list => {
|
|
// list.forEach(elem => {
|
|
// this.queryForm.queryObject.status.config.data.push({ value: elem.code, label: elem.name });
|
|
// });
|
|
// this.$convertList(list, this.EffectiveTypeList, elem => {
|
|
// return true;
|
|
// });
|
|
// });
|
|
|
|
this.$Dictionary.permissionType().then(list => {
|
|
list.forEach(elem => {
|
|
elem.value = elem.code;
|
|
elem.label = elem.name;
|
|
});
|
|
this.$convertList(list, this.PermissionTypeList, elem => {
|
|
return true;
|
|
});
|
|
});
|
|
},
|
|
formatterDate(row, porpInfo) {
|
|
return row[porpInfo.property] ? row[porpInfo.property] : '---';
|
|
},
|
|
queryFunction(params) {
|
|
return listUserPermision(params);
|
|
},
|
|
handlePermissionPack() {
|
|
this.$router.push({ path: `${UrlConfig.permission.permissionDraft}` });
|
|
},
|
|
reloadTable() {
|
|
if (this.queryList && this.queryList.reload) {
|
|
this.queryList.reload();
|
|
}
|
|
},
|
|
goBack() {
|
|
this.$router.push({ path: `${UrlConfig.trainingPlatform.trainingPlatformHome}` })
|
|
}
|
|
}
|
|
};
|
|
</script>
|
|
<style>
|
|
.btn-buy {
|
|
position: relative;
|
|
text-align: center;
|
|
justify-content: center;
|
|
transform: translateY(-20px);
|
|
margin-top: 30px;
|
|
margin-bottom: 20px;
|
|
}
|
|
</style>
|