rt-sim-training-client/src/views/orderauthor/commodity/addGoods.vue

152 lines
3.1 KiB
Vue
Raw Normal View History

2019-08-29 09:31:58 +08:00
<template>
<el-dialog
v-dialogDrag
2019-09-12 09:25:33 +08:00
:title="this.$t('orderAuthor.selectPermission')"
2019-08-29 09:31:58 +08:00
: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: [
2019-09-12 09:25:33 +08:00
{ value: true, label: this.$t('global.yes') },
{ value: false, label: this.$t('global.no') }
2019-08-29 09:31:58 +08:00
],
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
labelWidth: '80px',
reset: true,
queryObject: {
name: {
type: 'text',
2019-09-12 09:25:33 +08:00
label: this.$t('orderAuthor.permissionName')
2019-08-29 09:31:58 +08:00
},
type: {
type: 'select',
label: this.$t('orderAuthor.permissionType'),
config: {
data: []
}
}
}
},
queryList: {
query: this.queryFunction,
selectCheckShow: false,
indexShow: true,
columns: [
{
2019-09-12 09:25:33 +08:00
title: this.$t('orderAuthor.permissionName'),
prop: 'name'
2019-08-29 09:31:58 +08:00
},
{
2019-09-12 09:25:33 +08:00
title: this.$t('orderAuthor.isPackage'),
2019-08-29 09:31:58 +08:00
prop: 'isPackage',
type: 'tag',
columnValue: (row) => { return this.$convertField(row.isPackage, this.ruleLists, ['value', 'label']); },
tagType: (row) => { return ''; }
},
{
title: this.$t('orderAuthor.permissionType'),
prop: 'type',
type: 'tag',
columnValue: (row) => { return this.$convertField(row.type, this.PermissionTypeList, ['value', 'label']); },
tagType: (row) => { return ''; }
},
{
2019-09-12 09:25:33 +08:00
title: this.$t('orderAuthor.founder'),
prop: 'creatorUserName'
},
{
2019-09-12 09:25:33 +08:00
title: this.$t('orderAuthor.creationTime'),
prop: 'createTime'
},
2019-08-29 09:31:58 +08:00
{
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 => {
list.forEach(elem => {
this.queryForm.queryObject.type.config.data.push({ value: elem.code, label: elem.name });
});
2019-08-29 09:31:58 +08:00
this.$convertList(list, this.PermissionTypeList, elem => {
return true;
});
});
},
handleAdd(index, row) {
this.$emit('selectGoods', row);
this.doClose();
},
reloadTable() {
if (this.queryList && this.queryList.reload) {
this.queryList.reload();
}
}
}
};
</script>