2019-07-26 13:32:43 +08:00
|
|
|
<template>
|
2019-10-31 17:30:24 +08:00
|
|
|
<div style="height: 100%; overflow: auto;">
|
2019-08-13 16:59:38 +08:00
|
|
|
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
|
|
|
|
<select-role ref="selectRole" @reloadTable="reloadTable" />
|
2019-08-08 15:57:36 +08:00
|
|
|
</div>
|
2019-07-26 13:32:43 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2019-08-08 15:57:36 +08:00
|
|
|
import { listUserPermision } from '@/api/management/author';
|
|
|
|
import { UrlConfig } from '@/router/index';
|
2019-09-02 17:34:34 +08:00
|
|
|
import { superAdmin, admin } from '@/router';
|
2019-08-08 15:57:36 +08:00
|
|
|
import selectRole from './selectRole/list';
|
2019-11-01 13:51:00 +08:00
|
|
|
import LangStorage from '@/utils/lang';
|
2019-07-26 13:32:43 +08:00
|
|
|
|
2019-08-08 15:57:36 +08:00
|
|
|
export default {
|
2019-10-31 17:30:24 +08:00
|
|
|
name: 'Author',
|
|
|
|
components: {
|
|
|
|
selectRole
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
param: '',
|
|
|
|
WhetherTypeList: [],
|
|
|
|
// EffectiveTypeList: [],
|
|
|
|
PermissionTypeList: [],
|
|
|
|
pagerConfig: {
|
|
|
|
pageSize: 'pageSize',
|
|
|
|
pageIndex: 'pageNum'
|
|
|
|
},
|
|
|
|
queryForm: {
|
|
|
|
labelWidth: '140px',
|
|
|
|
reset: true,
|
|
|
|
leftSpan: 18,
|
|
|
|
queryObject: {
|
|
|
|
'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',
|
2019-11-01 13:51:00 +08:00
|
|
|
columnValue: (row) => { return this.$convertField(row.permissionType ? row.permissionType : '', this.PermissionTypeList, ['value', 'label']); },
|
2019-10-31 17:30:24 +08:00
|
|
|
tagType: (row) => { return ''; }
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: this.$t('permission.permissionUseType'),
|
|
|
|
prop: 'canDistribute',
|
|
|
|
type: 'tag',
|
2019-11-01 13:51:00 +08:00
|
|
|
columnValue: (row) => {
|
|
|
|
const type = LangStorage.getLang() == 'en' ? 'PermissionUseListEn' : 'PermissionUseList';
|
|
|
|
return this.$ConstSelect.translate(row.canDistribute, type);
|
|
|
|
},
|
2019-10-31 17:30:24 +08:00
|
|
|
tagType: (row) => {
|
|
|
|
switch (row.canDistribute) {
|
|
|
|
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
|
2019-07-26 13:32:43 +08:00
|
|
|
|
2019-10-31 17:30:24 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
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: this.$t('orderAuthor.packingDetails'),
|
|
|
|
handleClick: this.handleDetail,
|
|
|
|
type: '',
|
|
|
|
showControl: (row) => { return !row.permissionType; }
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
],
|
|
|
|
actions: [
|
|
|
|
{ text: this.$t('permission.permissionPack'), btnCode: 'employee_insert', handler: this.handlePermissionPack }
|
|
|
|
]
|
|
|
|
}
|
|
|
|
};
|
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
'$route.params.mapId': function (val) {
|
|
|
|
this.$refs.queryListPage.refresh(true);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
this.loadInitData();
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
handleRoleVest(index, row) {
|
|
|
|
this.$refs.selectRole.doShow(row.id);
|
|
|
|
},
|
|
|
|
handleDetail(index, row) {
|
|
|
|
this.$router.push({ path: `${UrlConfig.trainingPlatform.permissionDetails}/${row.permissionId}` });
|
|
|
|
},
|
|
|
|
loadInitData() {
|
|
|
|
this.queryForm.queryObject.canDistribute.config.data = this.$ConstSelect.PermissionUseList;
|
|
|
|
this.$Dictionary.permissionType().then(list => {
|
2019-11-11 14:08:54 +08:00
|
|
|
if (LangStorage.getLang() === 'en') {
|
2019-11-01 13:51:00 +08:00
|
|
|
list.forEach(elem => {
|
|
|
|
elem.value = elem.code;
|
|
|
|
switch (elem.value) {
|
|
|
|
case '01':
|
2019-11-11 14:08:54 +08:00
|
|
|
elem.label = 'Teaching system';
|
2019-11-01 13:51:00 +08:00
|
|
|
break;
|
|
|
|
case '02':
|
2019-11-11 14:08:54 +08:00
|
|
|
elem.label = 'Exam system';
|
2019-11-01 13:51:00 +08:00
|
|
|
break;
|
|
|
|
case '03':
|
2019-11-11 14:08:54 +08:00
|
|
|
elem.label = 'Simulation system';
|
2019-11-01 13:51:00 +08:00
|
|
|
break;
|
|
|
|
case '04':
|
|
|
|
elem.label = elem.name;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
list.push({value: '', label: 'Omnipotent permission'});
|
|
|
|
} else {
|
|
|
|
list.forEach(elem => {
|
|
|
|
elem.value = elem.code;
|
|
|
|
elem.label = elem.name;
|
|
|
|
});
|
|
|
|
list.push({value: '', label: '万能权限'});
|
|
|
|
}
|
|
|
|
this.PermissionTypeList = list;
|
2019-10-31 17:30:24 +08:00
|
|
|
});
|
|
|
|
},
|
|
|
|
formatterDate(row, porpInfo) {
|
|
|
|
return row[porpInfo.property] ? row[porpInfo.property] : '---';
|
|
|
|
},
|
|
|
|
queryFunction(params) {
|
|
|
|
if (this.$route.params.mapId) {
|
|
|
|
params.mapId = this.$route.params.mapId;
|
|
|
|
}
|
|
|
|
return listUserPermision(params);
|
|
|
|
},
|
|
|
|
handlePermissionPack() {
|
|
|
|
this.$router.push({ path: `${UrlConfig.trainingPlatform.draft}` });
|
|
|
|
},
|
|
|
|
reloadTable() {
|
|
|
|
if (this.queryList && this.queryList.reload) {
|
|
|
|
this.queryList.reload();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-08-08 15:57:36 +08:00
|
|
|
};
|
|
|
|
</script>
|