rt-sim-training-client/src/views/orderauthor/rules/index.vue

176 lines
4.1 KiB
Vue
Raw Normal View History

2019-08-29 09:31:58 +08:00
<template>
<div>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
</div>
</template>
<script>
import { listPermision } from '@/api/management/author';
2019-08-29 09:31:58 +08:00
export default {
name: 'Author',
components: {
},
data() {
return {
PermissionTypeList: [],
EffectiveTypeList: [],
2019-08-29 09:31:58 +08:00
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
labelWidth: '120px',
reset: true,
queryObject: {
permissionType: {
type: 'select',
label: this.$t('permission.permissionType'),
config: {
data: []
}
2019-08-29 09:31:58 +08:00
},
status: {
type: 'select',
label: '状态类型',
config: {
data: []
}
2019-08-29 09:31:58 +08:00
}
}
},
queryList: {
query: this.queryFunction,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: '权限名称',
width: '260',
prop: 'permissionName'
2019-08-29 09:31:58 +08:00
},
{
title: this.$t('permission.permissionType'),
prop: 'permissionType',
type: 'tag',
columnValue: (row) => { return this.$convertField(row.permissionType, this.PermissionTypeList, ['value', 'label']); },
tagType: (row) => { return ''; }
2019-08-29 09:31:58 +08:00
},
{
title: this.$t('permission.permissionUseType'),
2019-08-29 09:31:58 +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 'warning';
2019-08-29 09:31:58 +08:00
}
}
},
{
title: this.$t('permission.isForever'),
2019-08-29 09:31:58 +08:00
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 'warning';
2019-08-29 09:31:58 +08:00
}
}
},
{
title: this.$t('permission.permissionTotal'),
prop: 'amount'
},
{
title: this.$t('permission.permissionRemains'),
prop: 'remains'
},
{
title: this.$t('permission.startTime'),
2019-08-29 09:31:58 +08:00
prop: 'startTime',
type: 'formatter',
formatter: this.formatterDate
},
{
title: this.$t('permission.endTime'),
2019-08-29 09:31:58 +08:00
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';
}
}
},
2019-08-29 09:31:58 +08:00
{
type: 'button',
title: this.$t('global.operate'),
width: '200',
buttons: [
{
name: '详情',
handleClick: this.handleRoleVest,
2019-09-02 17:34:34 +08:00
type: '',
showControl: (row) => { return !row.permissionType; }
}
2019-08-29 09:31:58 +08:00
]
}
],
actions: [
]
}
};
},
mounted() {
this.loadInitData();
},
methods: {
handleRoleVest(index, row) {
2019-09-02 17:34:34 +08:00
this.$router.push({ path: `/orderauthor/rules/manage/detail/${row.permissionId}` });
},
2019-08-29 09:31:58 +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-08-29 09:31:58 +08:00
this.$Dictionary.permissionType().then(list => {
list.forEach(elem => {
this.queryForm.queryObject.permissionType.config.data.push({ value: elem.code, label: elem.name });
});
this.$convertList(list, this.PermissionTypeList, elem => {
return true;
});
});
2019-08-29 09:31:58 +08:00
},
formatterDate(row, porpInfo) {
return row[porpInfo.property] ? row[porpInfo.property] : '---';
2019-08-29 09:31:58 +08:00
},
queryFunction(params) {
return listPermision(params);
2019-08-29 09:31:58 +08:00
},
reloadTable() {
if (this.queryList && this.queryList.reload) {
this.queryList.reload();
}
}
}
};
</script>