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

数据字典

parent a2d3eb2d
...@@ -18,7 +18,8 @@ ...@@ -18,7 +18,8 @@
</ButtonGroup> </ButtonGroup>
</h3> </h3>
<div class="tree" :style="{height:treeHeight+'px'}"> <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> </div>
</Sider> </Sider>
<Content class="content"> <Content class="content">
...@@ -119,6 +120,7 @@ const root = { ...@@ -119,6 +120,7 @@ const root = {
export default { export default {
data() { data() {
return { return {
keys: "",
treeHeight: "", treeHeight: "",
code: "2", code: "2",
expand: false, expand: false,
...@@ -200,6 +202,26 @@ export default { ...@@ -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 }, components: { Edit },
async fetch({ store, params }) { async fetch({ store, params }) {
await store.dispatch("loadDictionary"); // 加载数据字典 await store.dispatch("loadDictionary"); // 加载数据字典
...@@ -207,16 +229,16 @@ export default { ...@@ -207,16 +229,16 @@ export default {
created() { created() {
this.load(); this.load();
this.loadTree(); this.loadTree();
this.treeHeight = window.innerHeight - 180 this.treeHeight = window.innerHeight - 180;
}, },
mounted() { mounted() {
window.onresize = () => { window.onresize = () => {
///浏览器窗口大小变化 ///浏览器窗口大小变化
return (() => { return (() => {
window.screenHeight = window.innerHeight window.screenHeight = window.innerHeight;
this.treeHeight = window.screenHeight - 180 this.treeHeight = window.screenHeight - 180;
})(); })();
} };
this.load(); this.load();
this.loadTree(); this.loadTree();
}, },
...@@ -285,7 +307,7 @@ export default { ...@@ -285,7 +307,7 @@ export default {
this.load(node.id); this.load(node.id);
}, },
setRoot() { setRoot() {
this.load(0); // this.load(0);
this.loadTree(); this.loadTree();
this.node = root; 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