Browse Source

code

master
pengjun 2 years ago
parent
commit
468b0bafc1
  1. 4
      src/api/request.js
  2. 22
      src/components/customerOrg/customerOrgTree.vue
  3. 5
      src/views/customerOrg/customerOrg.vue

4
src/api/request.js

@ -36,8 +36,8 @@ instance.interceptors.request.use(
instance.interceptors.response.use( instance.interceptors.response.use(
(res) => { (res) => {
console.log(res); console.log(res);
if (res.data.Code == -1) {
Message.error(res.data.Message);
if (res.data.code == -1) {
Message.error(res.data.message);
} }
return res.data; return res.data;
}, },

22
src/components/customerOrg/customerOrgTree.vue

@ -1,8 +1,15 @@
<template> <template>
<div>
<div style="margin:2px 2px 2px 2px;">
<el-input placeholder="输入关键字进行过滤" v-model="filterText" size="small" />
</div>
<div :style="'overflow: scroll;height:' +(window.pageHeight < 600 ? 370 : window.pageHeight - 230) + 'px;'">
<el-tree :data="customerOrg.customerOrgTree" :props="customerOrg.treeprops" <el-tree :data="customerOrg.customerOrgTree" :props="customerOrg.treeprops"
node-key="id"
node-key="id" :filter-node-method="filterNode"
:default-expanded-keys="customerOrg.defaultExpandedKeys" :default-expanded-keys="customerOrg.defaultExpandedKeys"
@node-click="treeclick" highlight-current ref="customerOrgTree"/> @node-click="treeclick" highlight-current ref="customerOrgTree"/>
</div>
</div>
</template> </template>
<script> <script>
import { mapState, mapMutations } from "vuex"; import { mapState, mapMutations } from "vuex";
@ -14,7 +21,7 @@ export default {
components: {}, components: {},
data() { data() {
return { return {
filterText:''
}; };
}, },
//<el-tree :data="$store.state.customerOrg.customerOrgTree" :props="$store.state.customerOrg.treeprops" @node-click="treeclick"></el-tree> //<el-tree :data="$store.state.customerOrg.customerOrgTree" :props="$store.state.customerOrg.treeprops" @node-click="treeclick"></el-tree>
@ -127,6 +134,13 @@ export default {
// //
this.getContactPersonList(data.id); this.getContactPersonList(data.id);
}, },
//
filterNode(value, data) {
//console.log(value,data)
if (!value) return true;
return data['displayName'].indexOf(value) !== -1;
}
}, },
watch: { watch: {
@ -138,6 +152,10 @@ export default {
}) })
} }
}, },
"filterText"(newVal,oldVal){
this.$refs['customerOrgTree'].filter(newVal);
}
}, },
}; };

5
src/views/customerOrg/customerOrg.vue

@ -9,7 +9,7 @@
--> -->
<div style="display: flex;margin-top:20px"> <div style="display: flex;margin-top:20px">
<!-- 单位树组件 --> <!-- 单位树组件 -->
<div :style="'overflow: scroll;border: 1px solid;width:200px; height:' +
<div :style="'border: 1px solid;width:200px; height:' +
(window.pageHeight < 600 ? 410 : window.pageHeight - 190) + (window.pageHeight < 600 ? 410 : window.pageHeight - 190) +
'px;' 'px;'
"> ">
@ -75,4 +75,5 @@ export default {
methods: {}, methods: {},
}; };
</script> </script>
<style scoped></style>
<style scoped>
</style>
Loading…
Cancel
Save