|
|
|
@ -2,90 +2,7 @@ |
|
|
|
|
<div class="wrap"> |
|
|
|
|
<div class="left"> |
|
|
|
|
<el-menu class="menu" ref="type" @open="selectType" @select="selectType" unique-opened :default-active="defaultType" :default-openeds="defaultOpenType"> |
|
|
|
|
<template v-for="item in typeList"> |
|
|
|
|
<!-- 如果第一层有子菜单,则继续循环 --> |
|
|
|
|
<template v-if="item.children.length"> |
|
|
|
|
<el-submenu :index="item.id" :key="item.id"> |
|
|
|
|
<template slot="title"> |
|
|
|
|
<i :class="item.icon"></i> |
|
|
|
|
<span slot="title" :title="item.categoryName">{{ item.categoryName }}</span> |
|
|
|
|
</template> |
|
|
|
|
<!-- 第二层 --> |
|
|
|
|
<template v-for="subItem in item.children"> |
|
|
|
|
<!-- 如果第二层有子菜单,则继续循环 --> |
|
|
|
|
<template v-if="subItem.children.length"> |
|
|
|
|
<el-submenu :index="subItem.id" :key="subItem.id"> |
|
|
|
|
<template slot="title"> |
|
|
|
|
<span slot="title" :title="subItem.categoryName">{{ subItem.categoryName }}</span> |
|
|
|
|
</template> |
|
|
|
|
<!-- <el-menu-item v-for="(threeItem,i) in subItem.children" :key="i" :index="threeItem.index">{{ threeItem.title }}</el-menu-item> --> |
|
|
|
|
<!-- 第三层 --> |
|
|
|
|
<template v-for="subItem2 in subItem.children"> |
|
|
|
|
<!-- 如果第三层有子菜单,则继续循环 --> |
|
|
|
|
<template v-if="subItem2.children.length"> |
|
|
|
|
<el-submenu :index="subItem2.id" :key="subItem2.id"> |
|
|
|
|
<template slot="title"> |
|
|
|
|
<span slot="title" :title="subItem2.categoryName">{{ subItem2.categoryName }}</span> |
|
|
|
|
</template> |
|
|
|
|
<!-- <el-menu-item v-for="(fourItem,i) in subItem2.children" :key="i" :index="fourItem.index">{{ fourItem.title }}</el-menu-item> --> |
|
|
|
|
<!-- 第四层 --> |
|
|
|
|
<template v-for="subItem3 in subItem2.children"> |
|
|
|
|
<!-- 如果第四层有子菜单,则继续循环 --> |
|
|
|
|
<template v-if="subItem3.children"> |
|
|
|
|
<el-submenu :index="subItem3.id" :key="subItem3.id"> |
|
|
|
|
<span slot="title" :title="subItem3.categoryName"> |
|
|
|
|
{{ subItem3.categoryName }} |
|
|
|
|
</span> |
|
|
|
|
<template v-for="subItem4 in subItem3.children"> |
|
|
|
|
<!-- 如果第五层有子菜单,则继续循环 --> |
|
|
|
|
<template v-if="subItem4.children && subItem4.children.length"> |
|
|
|
|
<el-submenu :index="subItem4.id" :key="subItem4.id"> |
|
|
|
|
<span slot="title" :title="subItem4.categoryName"> |
|
|
|
|
{{ subItem4.categoryName }} |
|
|
|
|
</span> |
|
|
|
|
<template class="level-6" v-for="subItem5 in subItem4.children" :index="subItem5.id"> |
|
|
|
|
<!-- 如果第六层有子菜单,则继续循环 --> |
|
|
|
|
<template v-if="subItem5.children && subItem5.children.length"> |
|
|
|
|
<el-submenu :index="subItem5.id" :key="subItem5.id"> |
|
|
|
|
<span slot="title" :title="subItem5.categoryName"> |
|
|
|
|
{{ subItem5.categoryName }} |
|
|
|
|
</span> |
|
|
|
|
<el-menu-item v-for="(fiveItem,i) in subItem5.children" :key="i" :index="fiveItem.id">{{ fiveItem.categoryName }}</el-menu-item> |
|
|
|
|
</el-submenu> |
|
|
|
|
</template> |
|
|
|
|
<!-- 如果第五层没有子菜单 --> |
|
|
|
|
<el-menu-item :index="subItem5.id" :key="subItem5.id" :title="subItem5.categoryName">{{ subItem5.categoryName }}</el-menu-item> |
|
|
|
|
</template> |
|
|
|
|
</el-submenu> |
|
|
|
|
</template> |
|
|
|
|
<!-- 如果第五层没有子菜单 --> |
|
|
|
|
<el-menu-item v-else :index="subItem4.id" :key="subItem4.id" :title="subItem4.categoryName">{{ subItem4.categoryName }}</el-menu-item> |
|
|
|
|
</template> |
|
|
|
|
</el-submenu> |
|
|
|
|
</template> |
|
|
|
|
<!-- 如果第四层没有子菜单 --> |
|
|
|
|
<el-menu-item v-else :index="subItem3.id" :key="subItem3.id" :title="subItem3.categoryName">{{ subItem3.categoryName }}</el-menu-item> |
|
|
|
|
</template> |
|
|
|
|
</el-submenu> |
|
|
|
|
</template> |
|
|
|
|
<!-- 如果第三层没有子菜单 --> |
|
|
|
|
<el-menu-item v-else :index="subItem2.id" :key="subItem2.id" :title="subItem2.categoryName">{{ subItem2.categoryName }}</el-menu-item> |
|
|
|
|
</template> |
|
|
|
|
</el-submenu> |
|
|
|
|
</template> |
|
|
|
|
<!-- 如果第二层没有子菜单 --> |
|
|
|
|
<el-menu-item v-else :index="subItem.id" :key="subItem.id" :title="subItem.categoryName">{{ subItem.categoryName }}</el-menu-item> |
|
|
|
|
</template> |
|
|
|
|
</el-submenu> |
|
|
|
|
</template> |
|
|
|
|
<!-- 如果第一层没有子菜单 --> |
|
|
|
|
<template v-else> |
|
|
|
|
<el-menu-item :index="item.id" :key="item.id"> |
|
|
|
|
<i :class="item.icon"></i> |
|
|
|
|
<span slot="title" :title="item.categoryName">{{ item.categoryName }}</span> |
|
|
|
|
</el-menu-item> |
|
|
|
|
</template> |
|
|
|
|
</template> |
|
|
|
|
<menuTree :menuList="typeList"></menuTree> |
|
|
|
|
</el-menu> |
|
|
|
|
</div> |
|
|
|
|
<div class="right"> |
|
|
|
@ -181,9 +98,13 @@ import { mapState } from 'vuex' |
|
|
|
|
import axios from 'axios' |
|
|
|
|
import util from '@/libs/util' |
|
|
|
|
import Setting from '@/setting' |
|
|
|
|
import menuTree from '@/components/menuTree' |
|
|
|
|
let startTimeLimit = '' |
|
|
|
|
let endTimeLimit = '' |
|
|
|
|
export default { |
|
|
|
|
components: { |
|
|
|
|
menuTree |
|
|
|
|
}, |
|
|
|
|
data() { |
|
|
|
|
return { |
|
|
|
|
that: this, |
|
|
|
@ -273,10 +194,11 @@ export default { |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
getType() { |
|
|
|
|
getType(id = 0) { |
|
|
|
|
// 获取分类 |
|
|
|
|
this.$post(this.api.getTableByClassification).then(res => { |
|
|
|
|
let typeId = this.typeId // 取得传值的id |
|
|
|
|
this.$post(`${this.api.getLevel}?parentId=${id}`).then(res => { |
|
|
|
|
const list = res.list |
|
|
|
|
let typeId = this.typeId // 取得首页传过来的id |
|
|
|
|
let introduce = ''// 对应股票的介绍,规则为无children则取上级 |
|
|
|
|
let dataSource = '' // 数据来源,同上 |
|
|
|
|
let action |
|
|
|
@ -295,20 +217,25 @@ export default { |
|
|
|
|
if (i) isFirst = false |
|
|
|
|
if (typeId && e.id == typeId) {// 若id匹配 |
|
|
|
|
action = String(e.id) |
|
|
|
|
if (e.children.length) {// 若有下级 |
|
|
|
|
if (e.children && e.children.length) {// 若有下级 |
|
|
|
|
if (!e.children[0].children.length) {// 找到下级的下级若无子级,则赋值勾选 |
|
|
|
|
action = String(e.children[0].id) |
|
|
|
|
} else {// 直接赋值 |
|
|
|
|
action = String(e.children[0].children[0].id) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} else if (e.children.length) { // id不匹配,递归找 |
|
|
|
|
} else if (e.children && e.children.length) { // id不匹配,递归找 |
|
|
|
|
actionId(e.children) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
this.typeList = res |
|
|
|
|
actionId(res) |
|
|
|
|
if (id) { |
|
|
|
|
this.typeList[0].children = list |
|
|
|
|
} else { |
|
|
|
|
this.typeList = list |
|
|
|
|
} |
|
|
|
|
console.log(11, this.typeList) |
|
|
|
|
actionId(list) |
|
|
|
|
this.defaultType = action |
|
|
|
|
this.introduce = introduce |
|
|
|
|
this.dataSource = dataSource |
|
|
|
@ -354,44 +281,45 @@ export default { |
|
|
|
|
let introduce = '' |
|
|
|
|
let dataSource = '' |
|
|
|
|
this.keyword = '' |
|
|
|
|
let list = this.typeList |
|
|
|
|
let select = '' |
|
|
|
|
// 获取最里层的第一个子级id |
|
|
|
|
function getDeepest(data) { |
|
|
|
|
if (data[0].children && data[0].children.length) { |
|
|
|
|
getDeepest(data[0].children) |
|
|
|
|
} else { |
|
|
|
|
select = data[0].id |
|
|
|
|
if (data[0].introduce) introduce = data[0].introduce |
|
|
|
|
if (data[0].dataSource) dataSource = data[0].dataSource |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
function handleData(data) { |
|
|
|
|
data.map((n, i) => { |
|
|
|
|
// 匹配到点击的分类,默认展开子级第一个分类 |
|
|
|
|
if (n.id == index) { |
|
|
|
|
// 如果有子级,则递归取到最下面的第一级子级id,如果没有子级,则取当前id |
|
|
|
|
if (n.children.length) { |
|
|
|
|
getDeepest(n.children) |
|
|
|
|
} else { |
|
|
|
|
select = index |
|
|
|
|
if (n.introduce) introduce = n.introduce |
|
|
|
|
if (n.dataSource) dataSource = n.dataSource |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
handleData(n.children) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
handleData(list) |
|
|
|
|
if (!introduce) introduce = list.find(n => n.id == indexPath[0]).introduce |
|
|
|
|
if (!dataSource) dataSource = list.find(n => n.id == indexPath[0]).dataSource |
|
|
|
|
this.defaultType = select |
|
|
|
|
this.introduce = introduce |
|
|
|
|
this.dataSource = dataSource |
|
|
|
|
this.previewHead = [] |
|
|
|
|
this.previewData = [] |
|
|
|
|
this.initData() |
|
|
|
|
this.getType(index) |
|
|
|
|
// let list = this.typeList |
|
|
|
|
// let select = '' |
|
|
|
|
// // 获取最里层的第一个子级id |
|
|
|
|
// function getDeepest(data) { |
|
|
|
|
// if (data[0].children && data[0].children.length) { |
|
|
|
|
// getDeepest(data[0].children) |
|
|
|
|
// } else { |
|
|
|
|
// select = data[0].id |
|
|
|
|
// if (data[0].introduce) introduce = data[0].introduce |
|
|
|
|
// if (data[0].dataSource) dataSource = data[0].dataSource |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
// function handleData(data) { |
|
|
|
|
// data.map((n, i) => { |
|
|
|
|
// // 匹配到点击的分类,默认展开子级第一个分类 |
|
|
|
|
// if (n.id == index) { |
|
|
|
|
// // 如果有子级,则递归取到最下面的第一级子级id,如果没有子级,则取当前id |
|
|
|
|
// if (n.children.length) { |
|
|
|
|
// getDeepest(n.children) |
|
|
|
|
// } else { |
|
|
|
|
// select = index |
|
|
|
|
// if (n.introduce) introduce = n.introduce |
|
|
|
|
// if (n.dataSource) dataSource = n.dataSource |
|
|
|
|
// } |
|
|
|
|
// } else { |
|
|
|
|
// handleData(n.children) |
|
|
|
|
// } |
|
|
|
|
// }) |
|
|
|
|
// } |
|
|
|
|
// handleData(list) |
|
|
|
|
// if (!introduce) introduce = list.find(n => n.id == indexPath[0]).introduce |
|
|
|
|
// if (!dataSource) dataSource = list.find(n => n.id == indexPath[0]).dataSource |
|
|
|
|
// this.defaultType = select |
|
|
|
|
// this.introduce = introduce |
|
|
|
|
// this.dataSource = dataSource |
|
|
|
|
// this.previewHead = [] |
|
|
|
|
// this.previewData = [] |
|
|
|
|
// this.initData() |
|
|
|
|
}, |
|
|
|
|
previewCurrentChange(val) { |
|
|
|
|
this.currentRow = val |
|
|
|
|