rt-sim-training-client/src/views/orderauthor/commodity/addGoods.vue
2019-08-29 09:31:58 +08:00

152 lines
3.0 KiB
Vue

<template>
<el-dialog
:title="this.$t('orderAuthor.trainingList')"
:visible.sync="show"
top="20px"
width="90%"
:before-do-close="doClose"
:close-on-click-modal="false"
>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
</el-dialog>
</template>
<script>
import { getLessonPermissonPageList } from '@/api/management/author';
export default {
name: 'AddGoods',
props: {
trainings: {
type: Array,
default() {
return [];
}
},
detail: {
type: Object,
default() {
return null;
}
}
},
data() {
return {
show: false,
PermissionTypeList: [],
ruleLists: [
{ value: true, label: '是' },
{ value: false, label: '否' }
],
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
labelWidth: '80px',
reset: true,
queryObject: {
name: {
type: 'text',
label: '权限名称'
},
type: {
type: 'select',
label: this.$t('orderAuthor.permissionType'),
config: {
data: []
}
}
}
},
queryList: {
query: this.queryFunction,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: '创建时间',
prop: 'createTime'
},
{
title: '创建者',
prop: 'creatorUserName'
},
{
title: '是否包权限',
prop: 'isPackage',
type: 'tag',
columnValue: (row) => { return this.$convertField(row.isPackage, this.ruleLists, ['value', 'label']); },
tagType: (row) => { return ''; }
},
{
title: '权限名称',
prop: 'name'
},
{
title: this.$t('orderAuthor.permissionType'),
prop: 'type',
type: 'tag',
columnValue: (row) => { return this.$convertField(row.type, this.PermissionTypeList, ['value', 'label']); },
tagType: (row) => { return ''; }
},
{
type: 'button',
title: this.$t('global.operate'),
width: '250',
buttons: [
{
name: this.$t('orderAuthor.select'),
type: 'primary',
handleClick: this.handleAdd
}
]
}
],
actions: [
]
},
currentModel: {}
};
},
created() {
this.loadInitData();
},
methods: {
doShow() {
this.show = true;
this.reloadTable();
},
doClose() {
this.show = false;
},
async queryFunction(params) {
return getLessonPermissonPageList(params);
},
async loadInitData() {
this.$Dictionary.permissionType().then(list => {
if (list && list.length) {
this.queryForm.queryObject.type.config.data = list;
}
this.$convertList(list, this.PermissionTypeList, elem => {
return true;
});
this.PermissionTypeList.push({ value: undefined, label: this.$t('orderAuthor.permissionPack') });
});
},
handleAdd(index, row) {
this.$emit('selectGoods', row);
this.doClose();
},
reloadTable() {
if (this.queryList && this.queryList.reload) {
this.queryList.reload();
}
}
}
};
</script>