|
|
<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 ? 430 : window.pageHeight - 170) + 'px;'"> <el-tree :data="patientRegister.customerOrgTreeAll" :props="customerOrg.treeprops" node-key="id" :filter-node-method="filterNode" @node-click="treeclick" highlight-current ref="customerOrgTree"/> </div> </div></template><script>import { mapState } from "vuex";import { getapi, postapi, putapi, deletapi } from "@/api/api";import { tcdate } from "../../utlis/proFunc";export default { components: {}, data() { return { filterText:'', }; }, //<el-tree :data="$store.state.customerOrg.customerOrgTree" :props="$store.state.customerOrg.treeprops" @node-click="treeclick"></el-tree>
computed: { ...mapState(["window","dict", "customerOrg", "patientRegister"]), }, //创建组件后
created() {},
//挂载组件完成
mounted() { //获取体检单位列表树信息
this.getCustomerOrgTree(); },
methods: { //获取体检单位列表树信息
getCustomerOrgTree() { getapi("/api/app/customerorg/getbycodeall").then((res) => { // console.log("res.data", res.data);
if(res.code != -1) this.patientRegister.customerOrgTreeAll = res.data; //tcdate(this.patientRegister.customerOrgTreeAll)
}); },
//获取体检单位父级ID api/app/customer-org/parent/[CustomerOrgld
// getCustomerOrgParentId(customerOrgld) {
// if (customerOrgld == this.dict.personOrgId) {
// this.patientRegister.query.CustomerOrgParentId = this.dict.personOrgId;
// return;
// }
// getapi(`/api/app/customer-org/parent/${customerOrgld}`).then((res) => {
// // console.log("res.data", res.data);
// if (res.code == 1) {
// this.patientRegister.query.CustomerOrgParentId = res.data;
// }
// });
// },
//树过滤
filterNode(value, data) { //console.log(value,data)
if (!value) return true; return data['displayName'].indexOf(value) !== -1 || data['simpleCode'].indexOf(value.toUpperCase()) !== -1; },
//点击树节点
treeclick(data) { this.patientRegister.query.customerOrgId = data.id;
//获取体检单位父级ID
// this.getCustomerOrgParentId(data.id);
// this.patientRegister.query.times++; //用于触发查询条件
}, }, watch: { "filterText"(newVal,oldVal){ this.$refs['customerOrgTree'].filter(newVal); } },};</script><style></style>
|