diff --git a/src/components/customerOrg/customerOrgEdit.vue b/src/components/customerOrg/customerOrgEdit.vue index 3290595..412311d 100644 --- a/src/components/customerOrg/customerOrgEdit.vue +++ b/src/components/customerOrg/customerOrgEdit.vue @@ -80,7 +80,7 @@ - + + :close-on-click-modal="false" width="840px" height="600px"> diff --git a/src/utlis/proFunc.js b/src/utlis/proFunc.js index 28c8299..78c8c5e 100644 --- a/src/utlis/proFunc.js +++ b/src/utlis/proFunc.js @@ -176,3 +176,38 @@ exports.birthdayToAge = function (birthday) { return Math.floor((new Date().getTime() - new Date(birthday).getTime())/yearInMs) } +//通过ID值,找出所有父节点值 +function getTreeParents(tree,nodeName,parentIdName,idName,idVal,parentIds){ + for(let i=0;i{ + childIds.push(e[idName]); + getTreeAllChilds(e[nodeName],nodeName,idName,childIds); + }); + return nodeIds; +} +function getTreeChilds(tree,nodeName,parentIdName,idName,idVal){ + for(let i=0;i { + let tree = {}, ret = null; + if (pidVal) { //根节点有具体的值 + if (e[lpidName] == pidVal) { + tree = e; + ret = madeTree(dataSource, lchildNodeName, lpidName, lidName, e[lidName]); + if (ret && ret.length > 0) tree[lchildNodeName] = ret; + trees.push(tree); + } + } else { + if (!e[lpidName]) { //根节点为0,空或null + tree = e; + ret = madeTree(dataSource, lchildNodeName, lpidName, lidName, e[lidName]); + if (ret && ret.length > 0) tree[lchildNodeName] = ret; + trees.push(tree); + } + } + }) + return trees; + } + + //通过ID值,找出所有父节点值 + function getTreePids(tree, childNodeName, pidName, idName, idVal) { + let pids = [],treeNode = null; + if (!tree || tree.length < 1) return []; + if (!idVal) return []; + let lchildNodeName = childNodeName || 'children'; + let lpidName = pidName || 'pid'; + let lidName = idName || 'id'; + + treeNode = getTreeNode(tree,lchildNodeName,lidName, idVal); + //console.log('treeNode',treeNode); + if(treeNode){ + pids.push(treeNode[lpidName]); + getTreePids(tree, lchildNodeName, lpidName, lidName, treeNode[lpidName]).forEach(e =>{ + pids.push(e); + }); + } + + return pids; + } + + + //通过ID值,找出所有子节点值 + function getTreeAllChildIdsByNode(treeNode, childNodeName, idName) { + let childIds = []; + let lchildNodeName = childNodeName || 'children'; + let lidName = idName || 'id'; + + if (!treeNode) return []; + if (!treeNode[lchildNodeName] || treeNode[lchildNodeName].length < 1) return []; + + treeNode[lchildNodeName].forEach(e => { + childIds.push(e[lidName]); + getTreeAllChildIdsByNode(e, lchildNodeName, lidName).forEach(e2 =>{ + childIds.push(e2); + }); + }); + return childIds; + } + + //通过ID值,找出所有子节点值 + function getTreeAllChildIdsById(tree, childNodeName, idName, idVal) { + let childIds = [], treeNode = null; + let lchildNodeName = childNodeName || 'children'; + let lidName = idName || 'id'; + + if (!tree || tree.length < 1) return []; + treeNode = getTreeNode(tree, lchildNodeName, lidName, idVal); + childIds = getTreeAllChildIdsByNode(treeNode, lchildNodeName, lidName); + + return childIds; + } + + //获取节点本身 + function getTreeNode(tree, childNodeName, idName, idVal) { + let treeNode = null; + let lchildNodeName = childNodeName || 'children'; + let lidName = idName || 'id'; + + if (!tree || tree.length < 1) return treeNode; + + for (let i = 0; i < tree.length; i++) { + if (tree[i][lidName] == idVal) { + treeNode = tree[i]; + break; + } else { + if (tree[i][lchildNodeName] && tree[i][lchildNodeName].length > 0) { + treeNode = getTreeNode(tree[i][lchildNodeName], lchildNodeName, lidName, idVal); + } + if (treeNode) break; + } + } + return treeNode; + } + + + module.exports = { + madeTree, + getTreePids, getTreeAllChildIdsByNode,getTreeAllChildIdsById, getTreeNode, + } + + \ No newline at end of file diff --git a/src/views/charge/charge.vue b/src/views/charge/charge.vue index 45355c2..8938650 100644 --- a/src/views/charge/charge.vue +++ b/src/views/charge/charge.vue @@ -946,7 +946,7 @@ export default { }); //体检单位 - getapi("/api/app/customer-org/by-code-all").then((res) => { + getapi("/api/app/customerorg/getbycodeall").then((res) => { this.patientRegister.customerOrgTreeAll = res.data; tcdate(this.patientRegister.customerOrgTreeAll) }); diff --git a/src/views/checkStatus/index.vue b/src/views/checkStatus/index.vue index 25cc91a..2801249 100644 --- a/src/views/checkStatus/index.vue +++ b/src/views/checkStatus/index.vue @@ -109,7 +109,7 @@ export default { ); //体检单位树 - getapi("/api/app/customer-org/by-code-all").then((res) => { + getapi("/api/app/customerorg/getbycodeall").then((res) => { if (res.code == 1) { this.patientRegister.customerOrgTreeAll = res.data; tcdate(this.patientRegister.customerOrgTreeAll); diff --git a/src/views/customerOrg/patientRegisterRefuse.vue b/src/views/customerOrg/patientRegisterRefuse.vue index a465f8c..8471993 100644 --- a/src/views/customerOrg/patientRegisterRefuse.vue +++ b/src/views/customerOrg/patientRegisterRefuse.vue @@ -62,7 +62,7 @@ export default { }); //体检单位 - getapi("/api/app/customer-org/by-code-all").then((res) => { + getapi("/api/app/customerorg/getbycodeall").then((res) => { this.patientRegister.customerOrgTreeAll = res.data; tcdate(this.patientRegister.customerOrgTreeAll) }); diff --git a/src/views/doctorCheck/doctorCheck.vue b/src/views/doctorCheck/doctorCheck.vue index effafa5..3725ccb 100644 --- a/src/views/doctorCheck/doctorCheck.vue +++ b/src/views/doctorCheck/doctorCheck.vue @@ -177,7 +177,7 @@ export default { }); //获取体检单位列表树信息 - getapi("/api/app/customer-org/by-code-all").then((res) => { + getapi("/api/app/customerorg/getbycodeall").then((res) => { //customerOrgTree = res.data; console.log("res.data", res.data); this.patientRegister.customerOrgTreeAll = res.data; diff --git a/src/views/doctorCheck/personnelBatch.vue b/src/views/doctorCheck/personnelBatch.vue index f3b0691..5c89e7d 100644 --- a/src/views/doctorCheck/personnelBatch.vue +++ b/src/views/doctorCheck/personnelBatch.vue @@ -400,7 +400,7 @@ export default { slicetdata() { console.log("2"); - getapi("/api/app/customer-org/by-code-all").then((res) => { + getapi("/api/app/customerorg/getbycodeall").then((res) => { this.gettypelist(res.data); this.departmentdata = res.data; console.log(res); diff --git a/src/views/doctorCheck/positiveresults.vue b/src/views/doctorCheck/positiveresults.vue index 0fed112..64a5f5a 100644 --- a/src/views/doctorCheck/positiveresults.vue +++ b/src/views/doctorCheck/positiveresults.vue @@ -210,18 +210,18 @@ export default { close() { this.visible = false; }, - // /api/app/customer-org/by-code-all + // /api/app/customerorg/getbycodeall unitchang() { console.log("1"); this.visible = true; console.log(this.visible); - getapi("/api/app/customer-org/by-code-all").then((res) => { + getapi("/api/app/customerorg/getbycodeall").then((res) => { this.customerorgdata = res.data; }); }, //获取单位 obtainingunits() { - getapi("/api/app/customer-org/by-code-all").then((res) => { + getapi("/api/app/customerorg/getbycodeall").then((res) => { this.customerorgdata = res.data; }); }, diff --git a/src/views/doctorCheck/unitphysicalexamination.vue b/src/views/doctorCheck/unitphysicalexamination.vue index a634bb6..74c6038 100644 --- a/src/views/doctorCheck/unitphysicalexamination.vue +++ b/src/views/doctorCheck/unitphysicalexamination.vue @@ -112,7 +112,7 @@ export default { methods: { //获取单位 obtainingunits() { - getapi("/api/app/customer-org/by-code-all").then((res) => { + getapi("/api/app/customerorg/getbycodeall").then((res) => { this.customerorgdata = res.data; }); }, diff --git a/src/views/fee-settings/diseaseStatistics.vue b/src/views/fee-settings/diseaseStatistics.vue index aa17ad4..ce14cf6 100644 --- a/src/views/fee-settings/diseaseStatistics.vue +++ b/src/views/fee-settings/diseaseStatistics.vue @@ -197,18 +197,18 @@ export default { close() { this.visible = false; }, - // /api/app/customer-org/by-code-all + // /api/app/customerorg/getbycodeall unitchang() { console.log("1"); this.visible = true; console.log(this.visible); - getapi("/api/app/customer-org/by-code-all").then((res) => { + getapi("/api/app/customerorg/getbycodeall").then((res) => { this.customerorgdata = res.data; }); }, //获取单位 obtainingunits() { - getapi("/api/app/customer-org/by-code-all").then((res) => { + getapi("/api/app/customerorg/getbycodeall").then((res) => { this.customerorgdata = res.data; }); }, diff --git a/src/views/report/report.vue b/src/views/report/report.vue index 4d4bc51..e13ecd0 100644 --- a/src/views/report/report.vue +++ b/src/views/report/report.vue @@ -81,7 +81,7 @@ export default { ); //体检单位树 - getapi("/api/app/customer-org/by-code-all").then((res) => { + getapi("/api/app/customerorg/getbycodeall").then((res) => { if (res.code == 1) { this.patientRegister.customerOrgTreeAll = res.data; tcdate(this.patientRegister.customerOrgTreeAll);