<template>
<!-- 多维查询-->
<el-container>
<div class="card2">
<div class="serchWrap">
<div class="left">
<el-form
:inline="true"
:model="listQuery"
class="demo-form-inline s1"
@submit.native.prevent
>
<el-form-item>
<el-input>
<template slot="prepend">新建表名称</template>
</el-input>
</el-form-item>
</el-form>
</div>
</div>
<el-table
:max-height="tableHeight"
style="width: 100%"
align="center"
v-loading="loading"
element-loading-text="拼命加载中~"
element-loading-color="#ccc"
element-loading-spinner="el-icon-loading"
element-loading-background="rgba(0, 0, 0, 0.1)"
row-key="id"
>
<el-table-column
v-for="(item) in tableData"
:key="item.id"
show-overflow-tooltip
:label="item.label"
>
<!-- <template slot-scope="scope">-->
<!-- <span>{{scope.row.id}} </span>-->
<!-- </template>-->
</el-table-column>
</el-table>
<!-- 分页 -->
<el-footer v-if="true">
<el-pagination
class="comonPage"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="this.listQuery.current"
:page-sizes="[10, 20, 30, 50]"
:page-size="this.listQuery.size"
layout="total, sizes, prev, pager, next, jumper"
:total="total"
>
</el-pagination>
</el-footer>
</div>
<div class="card1">
<div class="title">
<el-button type="warning"
><svg-icon icon-class="菜单_列表" /> <span
v-if="nameNow"
class="nameNow"
>{{ nameNow + "--" }}</span
>
维度</el-button
>
</div>
<div class="treeWrap">
<el-tree
class="treeitems"
:data="data"
show-checkbox
node-key="id"
:props="defaultProps"
@node-click="handleNodeClick"
@check-change="handleCheck"
default-expand-all
ref="tree"
>
</el-tree>
<el-button type="primary"
><svg-icon icon-class="保存" /> 查询</el-button
>
</div>
</div>
</el-container>
</template>
<script>
import has from "@/directive/has";
import {} from "@/utils/api";
import { tableMixin } from "@/MiXin/table";
export default {
mixins: [tableMixin],
components: {},
directives: {
has,
},
methods: {
handleNodeClick(data) {
console.log(data);
},
handleCheck(data,change){
let nodes = this.$refs.tree.getCheckedNodes().concat(this.$refs.tree.getHalfCheckedNodes())
let filterNodes = nodes.filter(node=>{
return node.children === undefined
})
this.tableData=filterNodes;
},
getList() {
},
handleSizeChange(val) {
this.listQuery.size = val;
this.getList();
},
handleCurrentChange(val) {
this.listQuery.current = val;
this.getList();
},
searchBtn() {
this.listQuery.current = 1;
this.getList();
},
searchrestBtn() {
this.listQuery = Object.assign(
{},
{
current: 1,
size: 10,
}
);
this.getList();
},
},
data() {
return {
data: [{
id:0,
label: '中国',
children: [{
id:1,
label: '北京',
children: [{
id:11,
label: '通州'
},{
id: 17,
label: '顺义'
}]
},
{
id:3,
label: '山西',
children:[{
id: 13,
label: '太原'
},{
id: 14,
label: '阳泉'
},{
id:16,
label: '长治'
}]
},{
id:4,
label: '黑龙江',
children: [{
id:12,
label: '哈尔滨'
},{
id:13,
label: '齐齐哈尔市'
},{
id: 14,
label: '牡丹江'
},{
id: 15,
label: '佳木斯'
}]
}],
}],
defaultProps: {
children: "children",
label: "label",
},
loading: false,
listQuery: {
current: 1,
size: 10,
},
tableData: [],
};
},
created() {
this.getList();
},
};
</script>
<style lang="less" scoped>
.el-container {
display: flex;
justify-content: space-between;
align-items: flex-flex-start;
.card1 {
width: 20%;
height: calc(100% - 7rem);
position: fixed;
right: 0;
.title {
display: flex;
justify-content: center;
align-items: center;
height: 3.05rem;
width: 100%;
background: #67c23a;
border-radius: 0.3rem;
margin-bottom: 0.5rem;
.el-button {
height: 100%;
width: 100%;
font-size: 13px;
display: flex;
align-items: center;
color: rgb(95, 95, 95);
font-weight: 600;
z-index: 11;
}
}
.treeWrap {
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: flex-flex-start;
z-index: 999;
padding-left: 1rem;
.el-button {
z-index: 11;
cursor: pointer;
align-self: flex-end;
margin-top: 1rem;
border-radius: 0.8rem;
height: 2rem;
width: 8rem;
font-size: 1.2rem;
color: rgb(95, 95, 95);
font-weight: 600;
display: flex;
align-items: center;
z-index: 11;
}
.el-tree[data-v-79540bf8] /deep/ .el-tree-node__label {
font-size: 0.34rem !important;
font-weight: 600 !important;
color: #7a7979 !important;
}
overflow: scroll;
height: 90%;
&::-webkit-scrollbar {
display: none !important;
}
.el-tree /deep/ .el-tree-node__label {
font-size: 1.34rem;
}
}
}
.card2 {
width: 80%;
display: flex;
justify-content: flex-start;
flex-direction: column;
align-items: center;
.serchWrap {
display: flex;
justify-content: space-between;
margin-bottom: 0.5rem;
width: 100%;
}
.s1 {
height: 0;
margin-top: 2.5rem;
display: flex;
align-items: center;
}
}
}
.table_switch {
/deep/ .el-switch__label * {
line-height: 1;
font-size: 12px !important;
display: inline-block;
}
/deep/ .el-switch__core {
height: 18px;
&::after {
content: "";
position: absolute;
top: 1.15px;
left: 1px;
border-radius: 100%;
-webkit-transition: all 0.3s;
transition: all 0.3s;
width: 13px;
height: 13px;
}
}
&.is-checked /deep/ .el-switch__core::after {
left: 100%;
margin-left: -15px !important;
}
}
.nameNow {
color: rgb(114, 46, 46);
font-size: 1.2rem;
font-weight: 600;
}
</style>