树状图过滤

master
fanluyan 2 years ago
parent f2c82e73d6
commit e81038fb78

@ -179,7 +179,12 @@
> >
</el-table-column> --> </el-table-column> -->
<el-table-column fixed="right" label="操作" width="580"> <el-table-column
fixed="right"
label="操作"
width="580"
v-if="roleUser != 2"
>
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
@click.native.stop="handleRevisePhoto(scope.row)" @click.native.stop="handleRevisePhoto(scope.row)"
@ -251,6 +256,50 @@
> >
</template> </template>
</el-table-column> </el-table-column>
<el-table-column fixed="right" label="操作" width="380" v-else>
<template slot-scope="scope">
<el-button
@click.native.stop="handleRevisePhoto(scope.row)"
type="text"
>修改</el-button
>
<el-button
type="text"
@click.native.stop="handlepicture(scope.row)"
>图片标记</el-button
>
<el-button
type="text"
@click.native.stop="handleShowGPS(scope.row)"
>获取GPS位置</el-button
>
<el-dropdown
class="dropgps"
trigger="click"
@command="
(command) => {
handleCommand(command, scope.row);
}
"
>
<span class="el-dropdown-link">
GPS开关<i class="el-icon-arrow-down el-icon--right"></i>
</span>
<el-dropdown-menu slot="dropdown" class="gpsdropStyle">
<el-dropdown-item command="open">开启GPS</el-dropdown-item>
<el-dropdown-item command="close">关闭GPS</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<el-button
type="text"
class="deleteText"
@click.native.stop="handleDelete(scope.row)"
>删除</el-button
>
</template>
</el-table-column>
</el-table> </el-table>
<div class="pageNation"> <div class="pageNation">
<el-pagination <el-pagination
@ -299,6 +348,7 @@ export default {
}, },
data() { data() {
return { return {
roleUser: "",
terminalTableData: [], // terminalTableData: [], //
photoDialog: false, // photoDialog: false, //
photoDialogTitle: "", // photoDialogTitle: "", //
@ -525,6 +575,8 @@ export default {
}, },
created() { created() {
this.terminalList(); this.terminalList();
this.roleUser = localStorage.getItem("role");
console.log(this.roleUser);
}, },
}; };
</script> </script>

@ -3,6 +3,10 @@
<div class="monitor-container"> <div class="monitor-container">
<!-- 左侧数据列表树 --> <!-- 左侧数据列表树 -->
<div class="sideBar"> <div class="sideBar">
<div class="searchBar">
<el-input placeholder="输入关键字进行过滤" v-model="filterText">
</el-input>
</div>
<el-tree <el-tree
:data="lineTreeData" :data="lineTreeData"
:props="defaultProps" :props="defaultProps"
@ -12,6 +16,7 @@
:default-expand-all="true" :default-expand-all="true"
@node-click="handleNodeClick" @node-click="handleNodeClick"
:current-node-key="currentNodekey" :current-node-key="currentNodekey"
:filter-node-method="filterNode"
> >
<span class="custom-tree-node" slot-scope="{ node, data }"> <span class="custom-tree-node" slot-scope="{ node, data }">
<div v-if="node.level === 1"> <div v-if="node.level === 1">
@ -246,6 +251,7 @@ export default {
lineTreeData: [], lineTreeData: [],
treeStatus: [], treeStatus: [],
statusTimer: null, statusTimer: null,
filterText: "",
defaultProps: { defaultProps: {
// //
children: "list", children: "list",
@ -274,14 +280,13 @@ export default {
zzstatus: "", zzstatus: "",
}; };
}, },
// watch: { watch: {
// lineTreeData: { filterText(val) {
// handler() { console.log(val);
// console.log("count"); this.$refs.tree.filter(val);
// }, console.log(this.$refs.tree);
// immediate: true, // },
// }, },
// },
computed: { computed: {
...mapState(["channelid", "termid"]), ...mapState(["channelid", "termid"]),
channelid() { channelid() {
@ -304,6 +309,12 @@ export default {
}, 300000); }, 300000);
}, },
methods: { methods: {
//
filterNode(value, data) {
console.log(value, data);
if (!value) return true;
return data.name.indexOf(value) !== -1;
},
// //
getDateTime() { getDateTime() {
this.dateValue = new Date().getTime(); this.dateValue = new Date().getTime();
@ -741,9 +752,16 @@ export default {
.sideBar { .sideBar {
width: 300px; width: 300px;
border-right: 1px solid @border-color-base; border-right: 1px solid @border-color-base;
overflow: auto; display: flex;
flex-direction: column;
padding: 16px 0px; padding: 16px 0px;
.searchBar {
width: 94%;
margin: 0 auto;
margin-bottom: 16px;
}
.el-tree { .el-tree {
overflow: auto;
.el-tree-node__content { .el-tree-node__content {
height: 40px; height: 40px;
font-size: 12px; font-size: 12px;

@ -135,7 +135,6 @@ export default {
display() { display() {
this.isShow = true; this.isShow = true;
this.roleUser = localStorage.getItem("role"); this.roleUser = localStorage.getItem("role");
console.log();
}, },
hide() { hide() {
this.isShow = false; this.isShow = false;

Loading…
Cancel
Save