|
|
|
@ -1,17 +1,38 @@ |
|
|
|
<template> |
|
|
|
<div style="width:208px"> |
|
|
|
<div style="margin:2px 2px 2px 2px;display: flex;"> |
|
|
|
<!-- |
|
|
|
<el-tooltip content="勾选时,可对子单位进行查询" placement="top"> |
|
|
|
<el-checkbox style="margin-top: 6px;" v-model="cusQuery.haveSunCus" true-label="Y" false-label="N" size="small"> |
|
|
|
含子单位 |
|
|
|
</el-checkbox> |
|
|
|
</el-tooltip> |
|
|
|
--> |
|
|
|
<el-input placeholder="输入关键字进行过滤" v-model="filterText" size="small" /> |
|
|
|
</div> |
|
|
|
<div> |
|
|
|
<el-tree |
|
|
|
:style="'overflow: scroll;height:' + (window.pageHeight < 600 ? 465 : window.pageHeight - 135) + 'px;width:200px;'" |
|
|
|
:data="customerOrgTreeAll" :props="treeprops" node-key="id" @node-contextmenu="nodeContextmenu" |
|
|
|
:data="customerOrgTreeSeo" :props="treeprops" node-key="id" @node-contextmenu="nodeContextmenu" |
|
|
|
@node-click="treeclick" highlight-current ref="customerOrgTree"> |
|
|
|
<span class="custom-tree-node" slot-scope="{ node, data }"> |
|
|
|
<div> |
|
|
|
<span class="treeicons"> |
|
|
|
<!-- <i |
|
|
|
class="el-icon-document-remove" |
|
|
|
v-if="data.parentId == null" |
|
|
|
></i> --> |
|
|
|
<img style="width:20px;height:20px;vertical-align: sub;" src="@/assets/images/order.png" |
|
|
|
v-if="!data.parentId" /> |
|
|
|
</span> |
|
|
|
<span :class="!data.parentId ? 'maxtitle' : 'mintitle'">{{ node.label }} |
|
|
|
</span> |
|
|
|
</div> |
|
|
|
</span> |
|
|
|
</el-tree> |
|
|
|
<el-tree v-if="false" |
|
|
|
:style="'overflow: scroll;height:' + (window.pageHeight < 600 ? 465 : window.pageHeight - 135) + 'px;width:200px;'" |
|
|
|
:data="customerOrgTreeSeo" :props="treeprops" node-key="id" @node-contextmenu="nodeContextmenu" |
|
|
|
:filter-node-method="filterNode" @node-click="treeclick" highlight-current ref="customerOrgTree" |
|
|
|
:load="loadNode" lazy> |
|
|
|
<span class="custom-tree-node" slot-scope="{ node, data }"> |
|
|
|
@ -35,7 +56,8 @@ |
|
|
|
<script> |
|
|
|
import { mapState } from "vuex"; |
|
|
|
import { getapi, postapi, putapi, deletapi } from "@/api/api"; |
|
|
|
import { tcdate, deepCopy, reMadeOrgTree, arrayExistObj, updateDBCom, getDBCom } from "../../utlis/proFunc"; |
|
|
|
import { tcdate, deepCopy, reMadeOrgTree, arrayExistObj } from "../../utlis/proFunc"; |
|
|
|
import { setDBCom, getDBCom } from "../../utlis/indexedDB"; |
|
|
|
|
|
|
|
|
|
|
|
import { madeTree, getTreeAllChildIdsById, getTreeNode } from "@/utlis/tree"; |
|
|
|
@ -57,14 +79,15 @@ export default { |
|
|
|
dispCustomerOrgCode: 'N', // 人员登记列表--单位树是否显示 customerOrgCode |
|
|
|
} |
|
|
|
}, |
|
|
|
customerOrgTreeAll: [], //显示的 |
|
|
|
customerOrgTreeSeo: [], //页面优化显示 |
|
|
|
customerOrgTreeAll: [], //后台查询 |
|
|
|
orgDatas: [], // 最初获取的 |
|
|
|
|
|
|
|
//作用于子单位查询 |
|
|
|
cusQuery: { |
|
|
|
treeDataAll: [], //所有单位节点数据 |
|
|
|
treeDataTop1: [], // 顶级单位 |
|
|
|
haveSunCus: 'Y', // 默认查询不包含子单位 |
|
|
|
haveSunCus: 'N', // 默认查询不包含子单位 |
|
|
|
times: 0, // 如果 times > 0 之后,来回勾选(含子单位查询时,不在查全部单位) |
|
|
|
} |
|
|
|
|
|
|
|
@ -89,11 +112,20 @@ export default { |
|
|
|
|
|
|
|
//挂载组件完成 |
|
|
|
mounted() { |
|
|
|
this.getCustomerOrgAll() |
|
|
|
.then(res => { |
|
|
|
this.customerOrgTreeSeo = res.slice(0, 100) |
|
|
|
this.customerOrgTreeAll = deepCopy(res) |
|
|
|
this.patientRegister.customerOrgTreeAll = deepCopy(res) |
|
|
|
// console.log('this.customerOrgTreeAll', this.customerOrgTreeAll) |
|
|
|
}) |
|
|
|
/* |
|
|
|
//获取体检单位列表树信息 (Y:查所有单位,N:仅查顶级单位) |
|
|
|
//从性能考滤 默认只查顶级单位 |
|
|
|
if (this.cusQuery.haveSunCus == 'Y') { |
|
|
|
this.getCustomerOrgAll() |
|
|
|
.then(res => { |
|
|
|
this.customerOrgTreeSeo = res.slice(0, 20) |
|
|
|
this.customerOrgTreeAll = res |
|
|
|
this.patientRegister.customerOrgTreeAll = res |
|
|
|
// console.log('this.customerOrgTreeAll', this.customerOrgTreeAll) |
|
|
|
@ -108,14 +140,15 @@ export default { |
|
|
|
//console.log('new Date()2', now()) |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
*/ |
|
|
|
}, |
|
|
|
|
|
|
|
methods: { |
|
|
|
|
|
|
|
// 后续代完善 |
|
|
|
// 后续代完善(本地缓存) |
|
|
|
getOrgDatas() { |
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
console.log('getOrgDatas', this.orgDatas.length) |
|
|
|
let url = '/api/app/CustomerOrg/GetSimpleByCodeAll' |
|
|
|
if (this.LocalConfig.patientRegister.dispCustomerOrgCode == 'Y') { |
|
|
|
url = "/api/app/customerorg/getbycodeall" |
|
|
|
@ -123,7 +156,7 @@ export default { |
|
|
|
.then((res) => { |
|
|
|
if (res.code > -1) { |
|
|
|
this.orgDatas = res.data |
|
|
|
updateDBCom('orgDatas',res.data) //存本地 |
|
|
|
setDBCom('orgDatas', res.data) //存本地 |
|
|
|
resolve() |
|
|
|
} else { |
|
|
|
reject(res.message) |
|
|
|
@ -137,7 +170,7 @@ export default { |
|
|
|
.then((res) => { |
|
|
|
if (res.code > -1) { |
|
|
|
this.orgDatas = res.data |
|
|
|
updateDBCom('orgDatas',res.data) |
|
|
|
setDBCom('orgDatas', res.data) |
|
|
|
resolve() |
|
|
|
} else { |
|
|
|
reject(res.message) |
|
|
|
@ -154,8 +187,16 @@ export default { |
|
|
|
// 查所有单位 |
|
|
|
getCustomerOrgAll() { |
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
if (this.dataTransOpts.orgDatas.length > 0) { |
|
|
|
let treeData = reMadeOrgTree(deepCopy(this.dataTransOpts.orgDatas), this.LocalConfig.patientRegister.dispCustomerOrgCode); |
|
|
|
getDBCom('orgDatas') |
|
|
|
.then(localData => { |
|
|
|
let now = Date.now() |
|
|
|
// 24小时 = 86400000 毫秒 |
|
|
|
if (localData?.createdat && now - 43200000 < localData.createdat) { |
|
|
|
this.orgDatas = localData.data |
|
|
|
} |
|
|
|
// console.log('this.orgDatas.length',this.orgDatas.length) |
|
|
|
if (this.orgDatas.length > 0) { |
|
|
|
let treeData = reMadeOrgTree(deepCopy(this.orgDatas), this.LocalConfig.patientRegister.dispCustomerOrgCode); |
|
|
|
this.cusQuery.times += 1 |
|
|
|
//console.log('getCustomerOrgAll.treeData', treeData) |
|
|
|
//console.log('getTreeNode', getTreeNode(treeData, "treeChildren", 'id', '3a1d3736-d7c6-a9fb-c165-675335dc0e9b').treeChildren) |
|
|
|
@ -164,7 +205,7 @@ export default { |
|
|
|
} else { |
|
|
|
this.getOrgDatas() |
|
|
|
.then(() => { |
|
|
|
let treeData = reMadeOrgTree(deepCopy(this.dataTransOpts.orgDatas), this.LocalConfig.patientRegister.dispCustomerOrgCode); |
|
|
|
let treeData = reMadeOrgTree(deepCopy(this.orgDatas), this.LocalConfig.patientRegister.dispCustomerOrgCode); |
|
|
|
this.cusQuery.times += 1 |
|
|
|
//console.log('getCustomerOrgAll.treeData', treeData) |
|
|
|
//console.log('getTreeNode', getTreeNode(treeData, "treeChildren", 'id', '3a1d3736-d7c6-a9fb-c165-675335dc0e9b').treeChildren) |
|
|
|
@ -176,6 +217,7 @@ export default { |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
// 只查顶级单位 |
|
|
|
@ -294,21 +336,32 @@ export default { |
|
|
|
|
|
|
|
//顶级单位树过滤 |
|
|
|
filterParentNode(value) { |
|
|
|
console.log('filterParentNode', value) |
|
|
|
// console.log('filterParentNode', value) |
|
|
|
// if (!value) return true; |
|
|
|
// return data['displayName'].indexOf(value) > -1 || data['simpleCode'].indexOf(value.toUpperCase()) > -1 || data['shortName'].indexOf(value) > -1 || data['customerOrgCode'].indexOf(value) > -1; |
|
|
|
this.customerOrgTreeAll = this.cusQuery.treeDataTop1.filter(e => { |
|
|
|
let org = [] |
|
|
|
if (value) { |
|
|
|
org = this.customerOrgTreeAll.filter(e => { |
|
|
|
return e.label.indexOf(value) > -1 || e.simpleCode.indexOf(value.toUpperCase()) > -1 |
|
|
|
}) |
|
|
|
this.customerOrgTreeSeo = org.slice(0, 100) |
|
|
|
} else { |
|
|
|
this.customerOrgTreeSeo = this.customerOrgTreeAll.slice(0, 100) |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
//全树过滤 |
|
|
|
/* |
|
|
|
filterNode(value, data) { |
|
|
|
console.log('filterNode', value, data) |
|
|
|
if (!value) return true; |
|
|
|
//return data['displayName'].indexOf(value) !== -1 || data['simpleCode'].indexOf(value.toUpperCase()) !== -1; |
|
|
|
return data['displayName'].indexOf(value) !== -1 || data['simpleCode'].indexOf(value.toUpperCase()) !== -1; |
|
|
|
}, |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
//点击树节点 |
|
|
|
treeclick(data) { |
|
|
|
@ -330,24 +383,10 @@ export default { |
|
|
|
handler(newVal, oldVal) { |
|
|
|
// console.log(`watch 人员登记 newVal:${newVal} oldVal:${oldVal} registerCheckId: ${this.dataTransOpts.tableS.patient_register.id}`); |
|
|
|
if (newVal != oldVal) { |
|
|
|
if (this.cusQuery.haveSunCus == 'Y') { |
|
|
|
//this.customerOrgTreeAll = deepCopy(this.cusQuery.treeDataAll) |
|
|
|
this.$refs['customerOrgTree'].filter(newVal); |
|
|
|
} else { |
|
|
|
this.filterParentNode(newVal) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
// 勾选含子单位 查询所有单位 |
|
|
|
"cusQuery.haveSunCus": { |
|
|
|
// immediate: true, |
|
|
|
handler(newVal, oldVal) { |
|
|
|
// console.log(`watch 人员登记 newVal:${newVal} oldVal:${oldVal} registerCheckId: ${this.dataTransOpts.tableS.patient_register.id}`); |
|
|
|
if (newVal != oldVal && newVal == 'Y' && this.cusQuery.times == 0) this.getCustomerOrgAll() |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
}, |
|
|
|
}; |
|
|
|
</script> |
|
|
|
|