2019-08-29 09:31:58 +08:00
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
|
2019-11-04 14:05:55 +08:00
|
|
|
<detail ref="detail" :permission-type-list="PermissionTypeList" />
|
2019-11-13 14:29:20 +08:00
|
|
|
<belong ref="belong" :permission-type-list="PermissionTypeList" :effective-type-list="EffectiveTypeList" />
|
2019-08-29 09:31:58 +08:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2019-09-03 10:45:58 +08:00
|
|
|
import { listPermision, setLessonPermisson } from '@/api/management/author';
|
|
|
|
import Detail from './detail';
|
2019-11-13 14:29:20 +08:00
|
|
|
import Belong from './belong';
|
|
|
|
import localStore from 'storejs';
|
2019-08-29 09:31:58 +08:00
|
|
|
|
|
|
|
export default {
|
2019-10-29 17:33:11 +08:00
|
|
|
name: 'Author',
|
|
|
|
components: {
|
2019-11-13 14:29:20 +08:00
|
|
|
Detail,
|
|
|
|
Belong
|
2019-10-29 17:33:11 +08:00
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
PermissionTypeList: [],
|
2019-11-13 14:29:20 +08:00
|
|
|
belongForm: {},
|
2019-10-29 17:33:11 +08:00
|
|
|
EffectiveTypeList: [],
|
|
|
|
pagerConfig: {
|
|
|
|
pageSize: 'pageSize',
|
|
|
|
pageIndex: 'pageNum'
|
|
|
|
},
|
|
|
|
queryForm: {
|
|
|
|
labelWidth: '120px',
|
|
|
|
reset: true,
|
|
|
|
queryObject: {
|
2019-11-11 09:56:11 +08:00
|
|
|
userName: {
|
|
|
|
type: 'text',
|
|
|
|
label: this.$t('permission.userName'),
|
2019-10-29 17:33:11 +08:00
|
|
|
config: {
|
|
|
|
data: []
|
|
|
|
}
|
|
|
|
},
|
|
|
|
status: {
|
|
|
|
type: 'select',
|
|
|
|
label: this.$t('permission.statusType'),
|
|
|
|
config: {
|
|
|
|
data: []
|
|
|
|
}
|
|
|
|
},
|
|
|
|
canDistribute: {
|
|
|
|
type: 'select',
|
|
|
|
label: this.$t('permission.permissionUseType'),
|
|
|
|
config: {
|
|
|
|
data: [
|
|
|
|
{ value: false, label: this.$t('permission.private')},
|
|
|
|
{ value: true, label: this.$t('permission.public')}
|
|
|
|
]
|
|
|
|
}
|
2019-11-13 14:29:20 +08:00
|
|
|
},
|
|
|
|
distributeId: {
|
|
|
|
type: 'text',
|
|
|
|
label: this.$t('permission.distributeId'),
|
|
|
|
config: {
|
|
|
|
data: []
|
|
|
|
}
|
2019-10-29 17:33:11 +08:00
|
|
|
}
|
2019-12-12 10:40:54 +08:00
|
|
|
// sortOrder:{
|
|
|
|
// type: 'select',
|
|
|
|
// label: this.$t('permission.sortType'),
|
|
|
|
// default:'id desc',
|
|
|
|
// noClearable:true,
|
|
|
|
// config: {
|
|
|
|
// data: [
|
|
|
|
// {value:'id desc', label:'ID倒序'},
|
|
|
|
// {value:'userName', label:'用户名正序'}
|
|
|
|
// ]
|
|
|
|
// }
|
|
|
|
// }
|
2019-10-29 17:33:11 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
queryList: {
|
|
|
|
query: this.queryFunction,
|
|
|
|
selectCheckShow: false,
|
|
|
|
indexShow: true,
|
2019-12-12 10:40:54 +08:00
|
|
|
defaultSort:{prop:'sortOrder', order:''},
|
2019-10-29 17:33:11 +08:00
|
|
|
columns: [
|
|
|
|
{
|
|
|
|
title: this.$t('permission.userName'),
|
2019-12-12 10:40:54 +08:00
|
|
|
prop: 'userName',
|
|
|
|
sortable:'custom',
|
|
|
|
sortBy:'sortOrder'
|
2019-10-29 17:33:11 +08:00
|
|
|
},
|
2019-12-24 11:23:55 +08:00
|
|
|
{
|
|
|
|
title: this.$t('permission.nickName'),
|
|
|
|
width: '200',
|
|
|
|
prop: 'userNickName'
|
|
|
|
},
|
2019-10-29 17:33:11 +08:00
|
|
|
{
|
|
|
|
title: this.$t('permission.permissionName'),
|
2019-11-13 14:29:20 +08:00
|
|
|
width: '200',
|
2019-10-29 17:33:11 +08:00
|
|
|
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';
|
2019-11-13 14:29:20 +08:00
|
|
|
case false: return 'danger';
|
2019-10-29 17:33:11 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
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';
|
2019-11-13 14:29:20 +08:00
|
|
|
case false: return 'danger';
|
2019-10-29 17:33:11 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
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-08-29 09:31:58 +08:00
|
|
|
|
2019-10-29 17:33:11 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: this.$t('permission.endTime'),
|
|
|
|
prop: 'endTime',
|
|
|
|
type: 'formatter',
|
|
|
|
formatter: this.formatterDate
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: this.$t('permission.permissionStatus'),
|
|
|
|
prop: 'status',
|
|
|
|
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'),
|
2019-11-13 14:29:20 +08:00
|
|
|
width: '300',
|
2019-10-29 17:33:11 +08:00
|
|
|
buttons: [
|
|
|
|
{
|
|
|
|
name: this.$t('orderAuthor.setupFailure'),
|
|
|
|
handleClick: this.handleEfficacy,
|
|
|
|
type: 'warning',
|
|
|
|
showControl: (row) => {
|
2019-11-13 14:29:20 +08:00
|
|
|
return row.status === '1';
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: this.$t('orderAuthor.transferAttribution'),
|
|
|
|
handleClick: this.handleBelongs,
|
|
|
|
type: '',
|
|
|
|
showControl: (row) => {
|
|
|
|
return row.status === '1' && row.amount !== row.remains;
|
2019-10-29 17:33:11 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: this.$t('global.details'),
|
|
|
|
handleClick: this.handleRoleVest,
|
|
|
|
type: '',
|
|
|
|
showControl: (row) => { return !row.permissionType; }
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
],
|
2019-12-12 10:40:54 +08:00
|
|
|
// sortChange:function(data) {
|
|
|
|
// switch (data.order) {
|
|
|
|
// case 'ascending': {
|
|
|
|
// this.data=[];
|
|
|
|
// break;
|
|
|
|
// }
|
|
|
|
// case 'descending': {
|
|
|
|
// break;
|
|
|
|
// }
|
|
|
|
// default: {
|
|
|
|
// // sortOrder
|
|
|
|
// debugger;
|
|
|
|
// break;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// },
|
2019-10-29 17:33:11 +08:00
|
|
|
actions: [
|
|
|
|
]
|
|
|
|
}
|
|
|
|
};
|
|
|
|
},
|
2019-11-13 14:29:20 +08:00
|
|
|
created() {
|
|
|
|
this.handleOriginalForm();
|
|
|
|
|
|
|
|
},
|
2019-10-29 17:33:11 +08:00
|
|
|
mounted() {
|
|
|
|
this.loadInitData();
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
handleRoleVest(index, row) {
|
|
|
|
this.$refs.detail.doShow(row.permissionId);
|
|
|
|
},
|
2019-11-13 14:29:20 +08:00
|
|
|
handleOriginalForm() {
|
|
|
|
if (this.$route.query.distributeId) {
|
|
|
|
const form = localStore.get(this.$route.path);
|
|
|
|
form.distributeId = this.$route.query.distributeId;
|
|
|
|
localStore.set(this.$route.path, form);
|
|
|
|
} else {
|
|
|
|
const form = localStore.get(this.$route.path);
|
|
|
|
form.distributeId = '';
|
|
|
|
localStore.set(this.$route.path, form);
|
|
|
|
}
|
|
|
|
},
|
2019-10-29 17:33:11 +08:00
|
|
|
loadInitData() {
|
|
|
|
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;
|
|
|
|
});
|
|
|
|
});
|
2019-11-13 14:29:20 +08:00
|
|
|
this.$Dictionary.permissionType().then(list => {
|
|
|
|
this.$convertList(list, this.PermissionTypeList, elem => {
|
|
|
|
return true;
|
|
|
|
});
|
|
|
|
});
|
2019-10-29 17:33:11 +08:00
|
|
|
},
|
|
|
|
formatterDate(row, porpInfo) {
|
2019-11-13 14:29:20 +08:00
|
|
|
return row[porpInfo.property] ? row[porpInfo.property] : this.$t('global.perpetual');
|
2019-10-29 17:33:11 +08:00
|
|
|
},
|
|
|
|
queryFunction(params) {
|
|
|
|
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(() => {
|
|
|
|
setLessonPermisson({id: row.id }).then(res => {
|
|
|
|
this.$message.success(this.$t('tip.operationSuccessfully'));
|
|
|
|
this.reloadTable();
|
|
|
|
}).catch(() => {
|
|
|
|
this.$messageBox(this.$t('tip.operationFailed'));
|
|
|
|
this.reloadTable();
|
|
|
|
});
|
|
|
|
}).catch(() => { });
|
2019-11-13 14:29:20 +08:00
|
|
|
},
|
|
|
|
handleBelongs(index, row) {
|
|
|
|
this.$refs.belong.doShow(row.id);
|
2019-10-29 17:33:11 +08:00
|
|
|
}
|
|
|
|
}
|
2019-08-29 09:31:58 +08:00
|
|
|
};
|
|
|
|
</script>
|
2019-12-10 17:11:14 +08:00
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
|
|
|
</style>
|