Commit 49f9df26 authored by 仇晓婷's avatar 仇晓婷

数据字典

parent a2d3eb2d
......@@ -18,7 +18,8 @@
</ButtonGroup>
</h3>
<div class="tree" :style="{height:treeHeight+'px'}">
<Tree :data="tree" @on-select-change="change" />
<Input v-model="keys" search placeholder="请输入客户名称" clearable />
<Tree :data="projectList" @on-select-change="change" />
</div>
</Sider>
<Content class="content">
......@@ -119,6 +120,7 @@ const root = {
export default {
data() {
return {
keys: "",
treeHeight: "",
code: "2",
expand: false,
......@@ -200,6 +202,26 @@ export default {
]
};
},
computed: {
projectList() {
// let items = this.$u.clone(this.tree);
let result = [];
let items = this.tree;
search(this.keys, items);
function search(keys, data) {
data.map(u => {
if (u.title) {
if (u.title.indexOf(keys) > -1) {
result.push(u);
}
} else if (u.children) {
search(this.keys, u.children);
}
});
}
return result;
}
},
components: { Edit },
async fetch({ store, params }) {
await store.dispatch("loadDictionary"); // 加载数据字典
......@@ -207,16 +229,16 @@ export default {
created() {
this.load();
this.loadTree();
this.treeHeight = window.innerHeight - 180
this.treeHeight = window.innerHeight - 180;
},
mounted() {
window.onresize = () => {
///浏览器窗口大小变化
return (() => {
window.screenHeight = window.innerHeight
this.treeHeight = window.screenHeight - 180
window.screenHeight = window.innerHeight;
this.treeHeight = window.screenHeight - 180;
})();
}
};
this.load();
this.loadTree();
},
......@@ -285,7 +307,7 @@ export default {
this.load(node.id);
},
setRoot() {
this.load(0);
// this.load(0);
this.loadTree();
this.node = root;
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment