2019-07-26 13:32:43 +08:00
|
|
|
<template>
|
2019-08-08 15:57:36 +08:00
|
|
|
<div>
|
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-07-26 13:32:43 +08:00
|
|
|
|
2019-08-08 15:57:36 +08:00
|
|
|
export default {
|
|
|
|
name: 'Author',
|
|
|
|
components: {
|
|
|
|
selectRole
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
param: '',
|
|
|
|
WhetherTypeList: [],
|
2019-09-02 11:04:23 +08:00
|
|
|
// EffectiveTypeList: [],
|
2019-08-08 15:57:36 +08:00
|
|
|
PermissionTypeList: [],
|
|
|
|
pagerConfig: {
|
|
|
|
pageSize: 'pageSize',
|
|
|
|
pageIndex: 'pageNum'
|
|
|
|
},
|
|
|
|
queryForm: {
|
2019-08-20 18:35:42 +08:00
|
|
|
labelWidth: '140px',
|
2019-08-08 15:57:36 +08:00
|
|
|
reset: true,
|
|
|
|
queryObject: {
|
2019-09-03 10:45:58 +08:00
|
|
|
// 'type': {
|
|
|
|
// type: 'select',
|
|
|
|
// label: this.$t('permission.permissionType'),
|
|
|
|
// config: {
|
|
|
|
// data: []
|
|
|
|
// }
|
|
|
|
// },
|
2019-09-02 11:04:23 +08:00
|
|
|
// 'status': {
|
|
|
|
// type: 'select',
|
|
|
|
// label: this.$t('permission.permissionStatus'),
|
|
|
|
// value: '1',
|
|
|
|
// config: {
|
|
|
|
// data: []
|
|
|
|
// }
|
|
|
|
// },
|
2019-08-08 15:57:36 +08:00
|
|
|
'canDistribute': {
|
|
|
|
type: 'select',
|
2019-08-20 18:35:42 +08:00
|
|
|
label: this.$t('permission.permissionUseType'),
|
2019-08-08 15:57:36 +08:00
|
|
|
config: {
|
|
|
|
data: []
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
queryList: {
|
|
|
|
query: this.queryFunction,
|
|
|
|
selectCheckShow: false,
|
|
|
|
indexShow: true,
|
|
|
|
columns: [
|
2019-08-30 17:00:18 +08:00
|
|
|
{
|
2019-09-11 09:34:12 +08:00
|
|
|
title: this.$t('permission.permissionName'),
|
2019-08-30 17:00:18 +08:00
|
|
|
width: '210',
|
|
|
|
prop: 'permissionName'
|
|
|
|
},
|
2019-08-08 15:57:36 +08:00
|
|
|
{
|
2019-08-20 18:35:42 +08:00
|
|
|
title: this.$t('permission.permissionType'),
|
2019-08-30 19:14:10 +08:00
|
|
|
prop: 'permissionType',
|
2019-08-08 15:57:36 +08:00
|
|
|
type: 'tag',
|
2019-08-30 19:14:10 +08:00
|
|
|
columnValue: (row) => { return this.$convertField(row.permissionType, this.PermissionTypeList, ['value', 'label']); },
|
2019-08-08 15:57:36 +08:00
|
|
|
tagType: (row) => { return ''; }
|
|
|
|
},
|
|
|
|
{
|
2019-08-20 18:35:42 +08:00
|
|
|
title: this.$t('permission.permissionUseType'),
|
2019-08-08 15:57:36 +08:00
|
|
|
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';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2019-09-02 09:33:21 +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';
|
|
|
|
// case false: return 'danger';
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// },
|
2019-08-08 15:57:36 +08:00
|
|
|
{
|
2019-08-20 18:35:42 +08:00
|
|
|
title: this.$t('permission.permissionTotal'),
|
2019-08-08 15:57:36 +08:00
|
|
|
prop: 'amount'
|
|
|
|
},
|
|
|
|
{
|
2019-08-20 18:35:42 +08:00
|
|
|
title: this.$t('permission.permissionRemains'),
|
2019-08-08 15:57:36 +08:00
|
|
|
prop: 'remains'
|
|
|
|
},
|
|
|
|
{
|
2019-08-20 18:35:42 +08:00
|
|
|
title: this.$t('permission.startTime'),
|
2019-08-08 15:57:36 +08:00
|
|
|
prop: 'startTime',
|
|
|
|
type: 'formatter',
|
|
|
|
formatter: this.formatterDate
|
2019-07-26 13:32:43 +08:00
|
|
|
|
2019-08-08 15:57:36 +08:00
|
|
|
},
|
|
|
|
{
|
2019-08-20 18:35:42 +08:00
|
|
|
title: this.$t('permission.endTime'),
|
2019-08-08 15:57:36 +08:00
|
|
|
prop: 'endTime',
|
|
|
|
type: 'formatter',
|
|
|
|
formatter: this.formatterDate
|
|
|
|
},
|
|
|
|
{
|
2019-08-20 18:35:42 +08:00
|
|
|
title: this.$t('permission.belonger'),
|
2019-08-08 15:57:36 +08:00
|
|
|
prop: 'ownerName',
|
2019-09-03 18:59:46 +08:00
|
|
|
isShow: () => { return this.$store.state.user.roles.indexOf(superAdmin) > 0 || this.$store.state.user.roles.indexOf(admin) > 0; }
|
2019-08-08 15:57:36 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'button',
|
2019-08-20 17:01:09 +08:00
|
|
|
title: this.$t('global.operate'),
|
2019-09-02 17:34:34 +08:00
|
|
|
width: '300',
|
|
|
|
hide: () => { return this.$store.state.user.roles.indexOf(superAdmin) < 0 || this.$store.state.user.roles.indexOf(admin) < 0; },
|
2019-08-08 15:57:36 +08:00
|
|
|
buttons: [
|
|
|
|
{
|
2019-08-20 18:35:42 +08:00
|
|
|
name: this.$t('permission.setBelonger'),
|
2019-08-08 15:57:36 +08:00
|
|
|
handleClick: this.handleRoleVest,
|
|
|
|
type: ''
|
2019-09-02 17:34:34 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: '打包详情',
|
|
|
|
handleClick: this.handleDetail,
|
|
|
|
type: '',
|
|
|
|
showControl: (row) => { return !row.permissionType; }
|
2019-08-08 15:57:36 +08:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
],
|
|
|
|
actions: [
|
2019-08-20 17:01:09 +08:00
|
|
|
{ text: this.$t('permission.permissionPack'), btnCode: 'employee_insert', handler: this.handlePermissionPack }
|
2019-08-08 15:57:36 +08:00
|
|
|
]
|
|
|
|
}
|
|
|
|
};
|
|
|
|
},
|
2019-07-26 13:32:43 +08:00
|
|
|
|
2019-08-08 15:57:36 +08:00
|
|
|
mounted() {
|
|
|
|
this.loadInitData();
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
handleRoleVest(index, row) {
|
|
|
|
this.$refs.selectRole.doShow(row.id);
|
|
|
|
},
|
2019-09-02 17:34:34 +08:00
|
|
|
handleDetail(index, row) {
|
2019-09-12 16:30:42 +08:00
|
|
|
this.$router.push({ path: `${UrlConfig.permission.permissionList}/detail/${row.permissionId}` });
|
2019-09-02 17:34:34 +08:00
|
|
|
},
|
2019-08-08 15:57:36 +08:00
|
|
|
loadInitData() {
|
|
|
|
this.queryForm.queryObject.canDistribute.config.data = this.$ConstSelect.PermissionUseList;
|
2019-07-26 13:32:43 +08:00
|
|
|
|
2019-09-02 11:04:23 +08:00
|
|
|
// 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-07-26 13:32:43 +08:00
|
|
|
|
2019-08-08 15:57:36 +08:00
|
|
|
this.$Dictionary.permissionType().then(list => {
|
|
|
|
list.forEach(elem => {
|
2019-09-03 10:45:58 +08:00
|
|
|
elem.value = elem.code;
|
|
|
|
elem.label = elem.name;
|
2019-08-08 15:57:36 +08:00
|
|
|
});
|
|
|
|
this.$convertList(list, this.PermissionTypeList, elem => {
|
|
|
|
return true;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
formatterDate(row, porpInfo) {
|
2019-09-02 11:04:23 +08:00
|
|
|
return row[porpInfo.property] ? row[porpInfo.property] : '---';
|
2019-08-08 15:57:36 +08:00
|
|
|
},
|
|
|
|
queryFunction(params) {
|
|
|
|
return listUserPermision(params);
|
|
|
|
},
|
|
|
|
handlePermissionPack() {
|
|
|
|
this.$router.push({ path: `${UrlConfig.permission.permissionDraft}` });
|
|
|
|
},
|
|
|
|
reloadTable() {
|
|
|
|
if (this.queryList && this.queryList.reload) {
|
|
|
|
this.queryList.reload();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|