|
|
@ -1,7 +1,7 @@ |
|
|
|
<template> |
|
|
|
<template> |
|
|
|
<div class="wrap"> |
|
|
|
<div class="wrap"> |
|
|
|
<div class="left"> |
|
|
|
<div class="left"> |
|
|
|
<el-menu class="menu" ref="type" @open="openType" @select="selectType" unique-opened :default-active="defaultType" :default-openeds="defaultOpenType"> |
|
|
|
<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-for="item in typeList"> |
|
|
|
<!-- 如果第一层有子菜单,则继续循环 --> |
|
|
|
<!-- 如果第一层有子菜单,则继续循环 --> |
|
|
|
<template v-if="item.children.length"> |
|
|
|
<template v-if="item.children.length"> |
|
|
@ -43,11 +43,21 @@ |
|
|
|
<template v-if="subItem4.children"> |
|
|
|
<template v-if="subItem4.children"> |
|
|
|
<el-submenu :index="subItem4.id" :key="subItem4.id"> |
|
|
|
<el-submenu :index="subItem4.id" :key="subItem4.id"> |
|
|
|
<template slot="title"> |
|
|
|
<template slot="title"> |
|
|
|
<!-- <i :class="item.icon"></i> --> |
|
|
|
|
|
|
|
<!-- <span slot="title">{{ subItem2.title }}</span> --> |
|
|
|
|
|
|
|
{{ subItem4.categoryName }} |
|
|
|
{{ subItem4.categoryName }} |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
<el-menu-item v-for="(fiveItem,i) in subItem4.children" :key="i" :index="fiveItem.id">{{ fiveItem.categoryName }}</el-menu-item> |
|
|
|
<el-menu-item class="level-6" v-for="(subItem5,i) in subItem4.children" :key="i" :index="subItem5.id"> |
|
|
|
|
|
|
|
<!-- 如果第六层有子菜单,则继续循环 --> |
|
|
|
|
|
|
|
<template v-if="subItem5.children"> |
|
|
|
|
|
|
|
<el-submenu :index="subItem5.id" :key="subItem5.id"> |
|
|
|
|
|
|
|
<template slot="title"> |
|
|
|
|
|
|
|
{{ subItem5.categoryName }} |
|
|
|
|
|
|
|
</template> |
|
|
|
|
|
|
|
<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 v-else :index="subItem5.id" :key="subItem5.id">{{ subItem5.categoryName }}</el-menu-item> |
|
|
|
|
|
|
|
</el-menu-item> |
|
|
|
</el-submenu> |
|
|
|
</el-submenu> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
<!-- 如果第五层没有子菜单 --> |
|
|
|
<!-- 如果第五层没有子菜单 --> |
|
|
@ -92,7 +102,7 @@ |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="page-content"> |
|
|
|
<div class="page-content"> |
|
|
|
<div class="desc">{{introduce}}</div> |
|
|
|
<div class="desc">{{introduce}}</div> |
|
|
|
|
|
|
|
<div style="margin-bottom: 30px"><span class="source">数据来源:</span>{{dataSource}}</div> |
|
|
|
<el-table :data="listData" class="table" ref="table" stripe header-align="center" row-key="id" highlight-current-row @current-change="previewCurrentChange"> |
|
|
|
<el-table :data="listData" class="table" ref="table" stripe header-align="center" row-key="id" highlight-current-row @current-change="previewCurrentChange"> |
|
|
|
<el-table-column type="index" width="100" label="序号" align="center"></el-table-column> |
|
|
|
<el-table-column type="index" width="100" label="序号" align="center"></el-table-column> |
|
|
|
<el-table-column prop="showName" label="数据表名称" align="center"></el-table-column> |
|
|
|
<el-table-column prop="showName" label="数据表名称" align="center"></el-table-column> |
|
|
@ -168,8 +178,6 @@ import { mapState } from 'vuex' |
|
|
|
import axios from 'axios' |
|
|
|
import axios from 'axios' |
|
|
|
import util from '@/libs/util' |
|
|
|
import util from '@/libs/util' |
|
|
|
import Setting from '@/setting' |
|
|
|
import Setting from '@/setting' |
|
|
|
import bus from '@/libs/bus' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let startTimeLimit = '' |
|
|
|
let startTimeLimit = '' |
|
|
|
let endTimeLimit = '' |
|
|
|
let endTimeLimit = '' |
|
|
|
export default { |
|
|
|
export default { |
|
|
@ -177,11 +185,12 @@ export default { |
|
|
|
return { |
|
|
|
return { |
|
|
|
that: this, |
|
|
|
that: this, |
|
|
|
token: util.local.get(Setting.tokenKey), |
|
|
|
token: util.local.get(Setting.tokenKey), |
|
|
|
typeId: this.$route.query.typeId, |
|
|
|
typeId: this.$route.query.typeId, // 从首页跳转过来传的分类id |
|
|
|
typeList: [], |
|
|
|
typeList: [], |
|
|
|
defaultType: '', |
|
|
|
defaultType: '', |
|
|
|
defaultOpenType: [], |
|
|
|
defaultOpenType: [], |
|
|
|
introduce: '', |
|
|
|
introduce: '', |
|
|
|
|
|
|
|
dataSource: '', |
|
|
|
keyword: '', |
|
|
|
keyword: '', |
|
|
|
search:'', |
|
|
|
search:'', |
|
|
|
listData: [], |
|
|
|
listData: [], |
|
|
@ -249,11 +258,6 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
mounted() { |
|
|
|
// bus.$on('initData',keyword => { |
|
|
|
|
|
|
|
// this.keyword = keyword |
|
|
|
|
|
|
|
// this.initData() |
|
|
|
|
|
|
|
// }) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.getType() |
|
|
|
this.getType() |
|
|
|
// 如果是从首页点下载按钮跳转过来的,就直接显示下载弹框 |
|
|
|
// 如果是从首页点下载按钮跳转过来的,就直接显示下载弹框 |
|
|
|
if(this.$route.query.download){ |
|
|
|
if(this.$route.query.download){ |
|
|
@ -266,78 +270,41 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
methods: { |
|
|
|
getType(){ |
|
|
|
getType(){ |
|
|
|
// 麻了,不写递归 |
|
|
|
// 获取分类 |
|
|
|
this.$post(this.api.getTableByClassification).then(res => {// 请求菜单栏 |
|
|
|
this.$post(this.api.getTableByClassification).then(res => { |
|
|
|
let typeId = this.typeId // 取得传值的id |
|
|
|
let typeId = this.typeId // 取得传值的id |
|
|
|
let introduce = ''// 对应股票的介绍,规则为无children则取上级 |
|
|
|
let introduce = ''// 对应股票的介绍,规则为无children则取上级 |
|
|
|
res.map(n => {// 循环第一次 |
|
|
|
let dataSource = '' // 数据来源,同上 |
|
|
|
n.id = String(n.id) |
|
|
|
|
|
|
|
if(typeId && n.id == typeId) introduce = n.introduce |
|
|
|
|
|
|
|
n.children.map(e => { // 循环第二次 |
|
|
|
|
|
|
|
e.id = String(e.id) |
|
|
|
|
|
|
|
if(typeId && e.id == typeId){ |
|
|
|
|
|
|
|
if(e.introduce){ |
|
|
|
|
|
|
|
introduce = e.introduce |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
introduce = n.introduce |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(e.children.length && typeId == e.id){ |
|
|
|
|
|
|
|
this.defaultOpenType = [n.id,e.id] |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
e.children.map(j => {// 循环第三次 |
|
|
|
|
|
|
|
if(typeId && j.id == typeId && j.introduce){ |
|
|
|
|
|
|
|
if(j.introduce){ |
|
|
|
|
|
|
|
introduce = j.introduce |
|
|
|
|
|
|
|
}else if(e.introduce){ |
|
|
|
|
|
|
|
introduce = e.introduce |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
introduce = n.introduce |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
j.id = String(j.id) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
let action |
|
|
|
let action |
|
|
|
// 取得选中的那一栏 |
|
|
|
// 取得选中的那一栏 |
|
|
|
function actionId(arr){//传入res |
|
|
|
function actionId(arr){//传入res |
|
|
|
if(arr&&arr.length>0){ |
|
|
|
arr && arr.map((e, i) => { |
|
|
|
arr.map(e=>{ |
|
|
|
e.id = String(e.id) |
|
|
|
if(typeId && e.id == typeId) {// 若id匹配 |
|
|
|
if (!i) { |
|
|
|
action = e.id |
|
|
|
// 获取介绍和来源 |
|
|
|
if(e.children.length>0){// 若有下级 |
|
|
|
if (e.introduce) introduce = e.introduce |
|
|
|
if(e.children[0].children.length===0){// 找到下级的下级若无子级,则赋值勾选 |
|
|
|
if (e.dataSource) dataSource = e.dataSource |
|
|
|
action = e.children[0].id |
|
|
|
if (!action) action = e.children[0].children.length ? String(e.children[0].children[0].id) : String(e.children[0].id) |
|
|
|
}else{// 直接赋值 |
|
|
|
} |
|
|
|
action = e.children[0].children[0].id |
|
|
|
if(typeId && e.id == typeId) {// 若id匹配 |
|
|
|
} |
|
|
|
action = String(e.id) |
|
|
|
|
|
|
|
if(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>0){// id不匹配,递归找 |
|
|
|
|
|
|
|
actionId(e.children) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}else if(e.children.length){// id不匹配,递归找 |
|
|
|
} |
|
|
|
actionId(e.children) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
this.typeList = res |
|
|
|
this.typeList = res |
|
|
|
|
|
|
|
actionId(res) |
|
|
|
if(this.typeId){ |
|
|
|
this.defaultType = action |
|
|
|
actionId(res) |
|
|
|
|
|
|
|
this.defaultType = action |
|
|
|
|
|
|
|
// this.defaultType = this.typeId |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
if(res[0].children.length && res[0].children[0].children.length){ |
|
|
|
|
|
|
|
this.defaultType = res[0].children[0].children[0].id |
|
|
|
|
|
|
|
introduce = res[0].children[0].children[0].introduce |
|
|
|
|
|
|
|
}else if(res[0].children.length){ |
|
|
|
|
|
|
|
this.defaultType = res[0].children[0].id |
|
|
|
|
|
|
|
if(!introduce) introduce = res[0].children[0].introduce |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
this.defaultType = res[0].id |
|
|
|
|
|
|
|
if(!introduce) introduce = res[0].introduce |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
this.introduce = introduce |
|
|
|
this.introduce = introduce |
|
|
|
|
|
|
|
this.dataSource = dataSource |
|
|
|
this.getData() |
|
|
|
this.getData() |
|
|
|
}).catch(res => {}) |
|
|
|
}).catch(res => {}) |
|
|
|
}, |
|
|
|
}, |
|
|
@ -358,82 +325,35 @@ export default { |
|
|
|
this.$refs.table.clearSelection() |
|
|
|
this.$refs.table.clearSelection() |
|
|
|
this.getData() |
|
|
|
this.getData() |
|
|
|
}, |
|
|
|
}, |
|
|
|
selectType(index,indexPath){// 点击事件 |
|
|
|
// 分类展开及点击回调 |
|
|
|
|
|
|
|
selectType(index,indexPath){ |
|
|
|
let introduce = '' |
|
|
|
let introduce = '' |
|
|
|
|
|
|
|
let dataSource = '' |
|
|
|
this.keyword = '' |
|
|
|
this.keyword = '' |
|
|
|
let list = this.typeList |
|
|
|
let list = this.typeList |
|
|
|
list.map(n => { |
|
|
|
let select = '' |
|
|
|
if(n.id == index){ |
|
|
|
function handleData(data) { |
|
|
|
introduce = n.introduce |
|
|
|
data.map((n, i) => { |
|
|
|
}else{ |
|
|
|
// 匹配到点击的分类,默认展开子级第一个分类 |
|
|
|
n.children.map(n => { |
|
|
|
if(n.id == index){ |
|
|
|
if(n.id == index){ |
|
|
|
if (n.introduce) introduce = n.introduce |
|
|
|
introduce = n.introduce |
|
|
|
if (n.dataSource) dataSource = n.dataSource |
|
|
|
}else{ |
|
|
|
if (!select) select = n.children.length ? (n.children[0].children.length ? n.children[0].children[0].id : n.children[0].id) : n.id |
|
|
|
n.children.map(n => { |
|
|
|
|
|
|
|
if(n.id == index) introduce = n.introduce |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
if(!introduce) introduce = list.find(n => n.id == indexPath[0]).introduce |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(indexPath.length>=2){ |
|
|
|
|
|
|
|
let clikckId = indexPath[indexPath.length-1] |
|
|
|
|
|
|
|
let select |
|
|
|
|
|
|
|
function getSelect(arr){ |
|
|
|
|
|
|
|
if(arr.length>0){ |
|
|
|
|
|
|
|
arr.map(e=>{ |
|
|
|
|
|
|
|
if(e.id==clikckId){ |
|
|
|
|
|
|
|
if(e.children.length===0){ |
|
|
|
|
|
|
|
select = e.id |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
if(e.children[0].children.length>0){ |
|
|
|
|
|
|
|
select = e.children[0].children[0].id |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
select = e.children[0].id |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
getSelect(e.children) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
return |
|
|
|
handleData(n.children) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
getSelect(this.typeList) |
|
|
|
|
|
|
|
console.log(select,'dig'); |
|
|
|
|
|
|
|
this.defaultType = select |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
this.defaultType = index |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
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.introduce = introduce |
|
|
|
|
|
|
|
this.dataSource = dataSource |
|
|
|
this.previewHead = [] |
|
|
|
this.previewHead = [] |
|
|
|
this.previewData = [] |
|
|
|
this.previewData = [] |
|
|
|
this.initData() |
|
|
|
this.initData() |
|
|
|
}, |
|
|
|
}, |
|
|
|
findId(data,id){ |
|
|
|
|
|
|
|
let result = '' |
|
|
|
|
|
|
|
data.forEach(n => { |
|
|
|
|
|
|
|
if(n.id == id){ |
|
|
|
|
|
|
|
if(n.children[0].children.length){ |
|
|
|
|
|
|
|
return result = n.children[0].children[0].id |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
return result = n.children[0].id |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
this.findId(n.children,id) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
return result |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
openType(index,indexPath){ |
|
|
|
|
|
|
|
console.log(11,this.typeList) |
|
|
|
|
|
|
|
let id = this.findId(this.typeList,index) |
|
|
|
|
|
|
|
this.selectType(id,indexPath) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
previewCurrentChange(val){ |
|
|
|
previewCurrentChange(val){ |
|
|
|
this.currentRow = val |
|
|
|
this.currentRow = val |
|
|
|
}, |
|
|
|
}, |
|
|
@ -629,6 +549,12 @@ export default { |
|
|
|
.el-menu-item.is-active{ |
|
|
|
.el-menu-item.is-active{ |
|
|
|
color: $main-color; |
|
|
|
color: $main-color; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
.level-6 { |
|
|
|
|
|
|
|
padding-right: 0; |
|
|
|
|
|
|
|
.el-submenu__title { |
|
|
|
|
|
|
|
padding-left: 10px !important; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
.right{ |
|
|
|
.right{ |
|
|
@ -637,9 +563,12 @@ export default { |
|
|
|
.page{ |
|
|
|
.page{ |
|
|
|
margin-bottom: 20px; |
|
|
|
margin-bottom: 20px; |
|
|
|
.desc{ |
|
|
|
.desc{ |
|
|
|
margin-bottom: 30px; |
|
|
|
margin-bottom: 20px; |
|
|
|
color: #333; |
|
|
|
color: #333; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
.source { |
|
|
|
|
|
|
|
color: #568DF2; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|