Merge remote-tracking branch 'origin/test'
This commit is contained in:
commit
6dbe1dc14c
@ -8,26 +8,24 @@
|
|||||||
<el-radio v-model="formModel.group" label="ZZ" style="color: #fff;" @input="queryPaper">中职</el-radio>
|
<el-radio v-model="formModel.group" label="ZZ" style="color: #fff;" @input="queryPaper">中职</el-radio>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<el-menu
|
<el-tree
|
||||||
class="el-menu-vertical"
|
:data="menuTreeData"
|
||||||
background-color="#ffffff00"
|
node-key="id"
|
||||||
text-color="#fff"
|
:default-expanded-keys="expanded_keys"
|
||||||
active-text-color="#ffd04b"
|
current-node-key
|
||||||
:default-openeds="defaultOpenIndex"
|
:highlight-current="true"
|
||||||
:default-active="defaultIndex"
|
:props="defaultProps"
|
||||||
@open="handleOpen"
|
style="background-color: transparent;overflow-y: auto;"
|
||||||
|
:expand-on-click-node="false"
|
||||||
|
@node-click="handleClick"
|
||||||
>
|
>
|
||||||
<el-submenu v-for="season in seasonMenu" :key="season.seasonId" :index="season.seasonId+''" @click="showPaperDetail(season)">
|
<div slot-scope="{ node, data }" class="custom-tree-node">
|
||||||
<template slot="title">
|
<div :style="{ color: nowData.type === data.type && nowData.label === data.label && nowData.id === data.id? '#ffd04b': '#fff' }">
|
||||||
<span> {{ season.seasonCode + '—'+season.seasonName }}</span>
|
<span v-if="data.type=='season'">{{ data.seasonCode + '—' + data.seasonName }}</span>
|
||||||
</template>
|
<span v-else>{{ node.label }}</span>
|
||||||
<template v-for="paper in season.papers">
|
</div>
|
||||||
<el-menu-item :key="paper.id" :index="paper.id+''" @click="showPaperDetail(paper)">
|
</div>
|
||||||
{{ paper.name }}
|
</el-tree>
|
||||||
</el-menu-item>
|
|
||||||
</template>
|
|
||||||
</el-submenu>
|
|
||||||
</el-menu>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -43,10 +41,12 @@ export default {
|
|||||||
formModel: {
|
formModel: {
|
||||||
group:'GZ' // 高职和中职
|
group:'GZ' // 高职和中职
|
||||||
},
|
},
|
||||||
seasonOptions:[],
|
defaultProps: {
|
||||||
seasonMenu:[],
|
disabled: true
|
||||||
defaultIndex: '',
|
},
|
||||||
defaultOpenIndex:[]
|
menuTreeData:[],
|
||||||
|
nowData: {},
|
||||||
|
expanded_keys:[]
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
@ -55,22 +55,51 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
queryPaper() {
|
queryPaper() {
|
||||||
getPaperMenu({ group:this.formModel.group}).then((res) => {
|
getPaperMenu({ group:this.formModel.group}).then((res) => {
|
||||||
this.seasonMenu = res.data.menu;
|
this.menuTreeData = this.transformTree(res.data.menu);
|
||||||
this.$emit('changeModuleData', null, this.seasonMenu[0]);
|
this.$emit('changeModuleData', null, this.menuTreeData[0]);
|
||||||
this.defaultOpenIndex = [this.seasonMenu[0].seasonId + ''];
|
this.expanded_keys = [this.menuTreeData[0].id];
|
||||||
this.defaultIndex = '';
|
this.nowData = this.menuTreeData[0];
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
this.$message.error(error.message);
|
this.$message.error(error.message);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleOpen(key) {
|
handleClick(data) {
|
||||||
this.defaultIndex = '';
|
this.nowData = data;
|
||||||
const seasonData = this.seasonMenu.find(season=>season.seasonId == key);
|
if (data.type == 'season') {
|
||||||
this.$emit('changeModuleData', null, seasonData);
|
this.$emit('changeModuleData', null, data);
|
||||||
|
} else {
|
||||||
|
this.$emit('changeModuleData', data);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
showPaperDetail(paper) {
|
transformTree(data) {
|
||||||
this.$emit('changeModuleData', paper);
|
const result = [];
|
||||||
|
for (let i = 0; i < data.length; i++) {
|
||||||
|
const season = data[i];
|
||||||
|
const seasonItem = {
|
||||||
|
id: season.seasonId,
|
||||||
|
label: season.seasonName,
|
||||||
|
seasonName:season.seasonName,
|
||||||
|
seasonCode:season.seasonCode,
|
||||||
|
detailHtmlContent:season.detailHtmlContent,
|
||||||
|
type:'season',
|
||||||
|
children:[]
|
||||||
|
};
|
||||||
|
if (season.papers) {
|
||||||
|
for (let i = 0; i < season.papers.length; i++) {
|
||||||
|
const paper = season.papers[i];
|
||||||
|
const paperItem = {
|
||||||
|
id: paper.id,
|
||||||
|
label: paper.name,
|
||||||
|
name:paper.name,
|
||||||
|
type:'paper'
|
||||||
|
};
|
||||||
|
seasonItem.children.push(paperItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
result.push(seasonItem);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -109,31 +138,24 @@ export default {
|
|||||||
background: #01468B;
|
background: #01468B;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
}
|
.custom-tree-node{
|
||||||
}
|
width: 100%;
|
||||||
.el-menu-vertical{
|
font-size: 16px;
|
||||||
background-color: transparent;
|
|
||||||
.el-menu-item{
|
|
||||||
&:hover{
|
|
||||||
background: #00172E !important;
|
|
||||||
}
|
|
||||||
&:focus{
|
|
||||||
background-color: #00172E !important;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/deep/{
|
/deep/{
|
||||||
.el-menu{
|
.el-tree-node__content{
|
||||||
border-right-width: 0;
|
height: 56px;
|
||||||
}
|
overflow: hidden;
|
||||||
.el-submenu__title{
|
color: #fff;
|
||||||
&:hover{
|
&:hover{
|
||||||
background: #00172E !important;
|
background: #00172E !important;
|
||||||
}
|
}
|
||||||
&:focus{
|
}
|
||||||
|
.el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content{
|
||||||
background-color: #00172E !important;
|
background-color: #00172E !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
Loading…
Reference in New Issue
Block a user