diff --git a/src/components/report/CusOrgOCX.vue b/src/components/report/CusOrgOCX.vue index 51a1487..a3bcaef 100644 --- a/src/components/report/CusOrgOCX.vue +++ b/src/components/report/CusOrgOCX.vue @@ -2,15 +2,16 @@
+
- +
@@ -92,8 +93,8 @@ 登记 体检 检查 - {{summary_check_doctor_alias[0]||'总检'}} - {{summary_check_doctor_alias[1]||'审核'}} + {{ summary_check_doctor_alias[0] || '总检' }} + {{ summary_check_doctor_alias[1] || '审核' }}
@@ -114,6 +115,8 @@ import { mapState } from "vuex"; import { getapi, postapi, putapi, deletapi } from "@/api/api"; import { arrayExistObj, deepCopy, reMadeOrgTree } from "../../utlis/proFunc"; import { getTreePids, getTreeAllChildIdsById } from "../../utlis/tree"; +import { setDBCom, getDBCom } from "../../utlis/indexedDB"; + export default { components: {}, props: ["useCustomerOrg", "initDateType", "isUnit"], @@ -147,6 +150,9 @@ export default { }, //树形组件的数据结构 summary_check_doctor_alias: ["总检", "审核"], + customerOrgTreeSeo: [], //所有 + customerOrgTreeAll: [], //有处理 + orgDatasQuery: [], //未处理 }; }, // @@ -185,31 +191,54 @@ export default { methods: { //树过滤 - filterNode(value, data,node) { + filterNode(value, data, node) { if (!value) return true; return data['displayName'].indexOf(value) !== -1 || data['simpleCode'].indexOf(value.toUpperCase()) !== -1; }, + //树过滤 filterParentNode(value) { // console.log(value, data) // 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; - console.log(this.patientRegister.customerOrgs) - this.patientRegister.customerOrgTreeAll = this.patientRegister.customerOrgs.filter(e => { - console.log(e) - return e.label.indexOf(value) > -1 || e.simpleCode.indexOf(value.toUpperCase()) > -1 || e.shortName.indexOf(value) > -1 - }) - + //console.log(this.patientRegister.customerOrgs) + if(value){ + let 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) + } + }, + //获取体检单位列表树信息 getCustomerOrgTree() { - getapi("/api/app/customerorg/getbycodeall").then((res) => { - if (res.code > -1) { - this.patientRegister.customerOrgTreeAll = reMadeOrgTree(deepCopy(res.data)); - this.patientRegister.customerOrgs = deepCopy(this.patientRegister.customerOrgTreeAll) - //tcdate(this.patientRegister.customerOrgTreeAll) - } - }); + getDBCom('orgDatasQuery') + .then(localData => { + let now = Date.now() + // 24小时 = 86400000 毫秒 + if (localData?.createdat && now - 43200000 < localData.createdat) { + this.orgDatasQuery = localData.data + // console.log('this.orgDatas.length',this.orgDatas.length) + if (this.orgDatasQuery.length > 0) { + let treeData = reMadeOrgTree(deepCopy(this.orgDatasQuery)); + this.customerOrgTreeAll = treeData; + this.customerOrgTreeSeo = treeData.slice(0, 100) + } + } else { + getapi("/api/app/customerorg/getbycodeall").then((res) => { + if (res.code > -1) { + this.orgDatasQuery = res.data + let treeData = reMadeOrgTree(deepCopy(this.orgDatasQuery)); + this.customerOrgTreeAll = treeData; + this.customerOrgTreeSeo = treeData.slice(0, 100) + setDBCom('orgDatasQuery', res.data) + } + }); + } + }) }, //获取体检单位父级ID api/app/customer-org/parent/[CustomerOrgld @@ -226,13 +255,6 @@ export default { }); }, - //点击树节点 - treeclick(data) { - this.patientRegister.query.customerOrgId = data.id; - this.getCustomerOrgParentId(data.id); - this.patientRegister.query.times++; //用于触发查询条件 - }, - //树控件--伪双击事件 handleNode(data, node, prop) { // console.log(data, node, prop); @@ -480,22 +502,22 @@ export default { }, }, watch: { - "filterText"(newVal, oldVal) { + "filterText"(newVal, oldVal) { if (newVal != oldVal) { - if (this.isOnlyCus == 'N') { - this.$refs['customerOrgTree'].filter(newVal); - } else { + // if (this.isOnlyCus == 'N') { + // this.$refs['customerOrgTree'].filter(newVal); + // } else { this.filterParentNode(newVal) - } + // } } }, - "isOnlyCus"(newVal, oldVal) { - if (newVal == 'N') { - this.$refs['customerOrgTree'].filter(this.filterText); - } else { - this.filterParentNode(this.filterText) - } - } + // "isOnlyCus"(newVal, oldVal) { + // if (newVal == 'N') { + // this.$refs['customerOrgTree'].filter(this.filterText); + // } else { + // this.filterParentNode(this.filterText) + // } + // } }, };