rt-sim-training-client/src/views/messageBoard/manage.vue

122 lines
3.8 KiB
Vue
Raw Normal View History

2020-12-16 13:59:31 +08:00
<template>
2020-12-16 16:05:33 +08:00
<div>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
<create-draft ref="createDraft" :project-option-list="projectOptionList" @reloadTable="reloadTable" />
2020-12-16 16:05:33 +08:00
</div>
2020-12-16 13:59:31 +08:00
</template>
<script>
import { queryPostPage } from '@/api/learn';
import { ProjectList} from '@/scripts/ProjectConfig';
import CreateDraft from './create';
2020-12-16 16:05:33 +08:00
export default {
name: 'Manage',
components:{
CreateDraft
},
2020-12-16 16:05:33 +08:00
data() {
return {
projectOptionList: [],
2020-12-16 16:05:33 +08:00
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
labelWidth: '140px',
reset: false,
queryObject: {
project: {
2020-12-16 16:05:33 +08:00
type: 'select',
label: '所属项目',
2020-12-16 16:05:33 +08:00
config: {
data: []
}
}
}
},
queryList: {
query: queryPostPage,
2020-12-16 16:05:33 +08:00
selectCheckShow: false,
indexShow: true,
columns: [
{
title: '项目',
prop: 'project',
2020-12-16 16:05:33 +08:00
type: 'tag',
columnValue: (row) => { return this.getProjectName(row.project); },
2020-12-16 16:05:33 +08:00
tagType: (row) => {
return 'success';
2020-12-16 16:05:33 +08:00
}
},
{
title: '留言板名称',
prop: 'title'
2020-12-16 16:05:33 +08:00
},
{
type: 'button',
title: this.$t('global.operate'),
width: '350',
2020-12-16 16:05:33 +08:00
buttons: [
{
name: '进入',
handleClick: this.handleEnter
2020-12-22 10:48:11 +08:00
},
{
name: '修改',
handleClick: this.handleUpdate
2020-12-16 16:05:33 +08:00
}
]
}
],
actions: [
{ text: '创建留言板', handler: this.handleCreateMessageBoard }
2020-12-16 16:05:33 +08:00
]
}
};
},
mounted() {
this.projectOptionList = [{value: 'DEFAULT', label: '玖琏云平台'}];
ProjectList.forEach(item => {
this.projectOptionList.push({value: item.value.toUpperCase(), label: item.label});
});
this.queryForm.queryObject.project.config.data = this.projectOptionList;
2020-12-16 16:05:33 +08:00
},
methods:{
getProjectName(projectCode) {
let name;
this.projectOptionList.forEach(item => {
if (item.value.toUpperCase() == projectCode) {
name = item.label;
}
});
return name;
},
handleCreateMessageBoard() {
this.$refs.createDraft.doShow();
},
reloadTable() {
if (this.queryList && this.queryList.reload) {
this.queryList.reload();
}
},
handleEnter(index, row) {
const routeData = this.$router.resolve({
path:'/messageBoard',
query:{
project: row.project.toLowerCase(),
noPreLogout: true
}
});
window.open(routeData.href, '_blank', 'noopener noreferrer');
2020-12-22 10:48:11 +08:00
},
handleUpdate(index, row) {
this.$refs.createDraft.doShow(row);
}
2020-12-16 13:59:31 +08:00
}
2020-12-16 16:05:33 +08:00
};
2020-12-16 13:59:31 +08:00
</script>
<style scoped>
</style>