|
@@ -4,6 +4,7 @@ import {Outline} from "@/views/hospitalization/zhu-yuan-yi-sheng/electronic-medi
|
|
|
import {emrMitt} from "@/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-editor/emr-init";
|
|
|
import {useCompRef} from "@/utils/useCompRef";
|
|
|
import {ElTree} from "element-plus";
|
|
|
+import {isContain} from "@/utils/public";
|
|
|
|
|
|
const props = defineProps<{
|
|
|
maxHeight: number,
|
|
@@ -38,6 +39,24 @@ const handelFilter = (value, data: Outline) => {
|
|
|
return data.text.includes(value)
|
|
|
}
|
|
|
|
|
|
+const currentId = ref('')
|
|
|
+
|
|
|
+function changeElementById(id: string) {
|
|
|
+ currentId.value = id
|
|
|
+ const element = document.getElementById(id)
|
|
|
+ if (!isContain(element)) {
|
|
|
+ element.scrollIntoView({
|
|
|
+ block: 'center',
|
|
|
+ inline: 'nearest',
|
|
|
+ behavior: 'smooth'
|
|
|
+ })
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+defineExpose({
|
|
|
+ changeElementById
|
|
|
+})
|
|
|
+
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
@@ -45,18 +64,25 @@ const handelFilter = (value, data: Outline) => {
|
|
|
<el-input v-model="inputVal" placeholder="节点过滤" @input="handelInput" clearable/>
|
|
|
<div :style="{maxHeight : maxHeight - 50 + 'px'}" class="outline_main">
|
|
|
<el-tree
|
|
|
+ class="outline_tree"
|
|
|
+ node-key="id"
|
|
|
+ :style="{'--el-tree-text-color': '#000', '--el-color-primary-light-9' : '#409EFF' }"
|
|
|
+ :current-node-key="currentId"
|
|
|
ref="elTreeRef"
|
|
|
default-expand-all
|
|
|
+ highlight-current
|
|
|
:filter-node-method="handelFilter"
|
|
|
:data="props.data"
|
|
|
@nodeClick="nodeClick"
|
|
|
:expand-on-click-node="false">
|
|
|
<template #default="{ node, data }">
|
|
|
- <el-icon>
|
|
|
- <ScaleToOriginal v-if="data.parent"/>
|
|
|
- <Folder v-else/>
|
|
|
- </el-icon>
|
|
|
- {{ data.business || data.text }}
|
|
|
+ <div :id="data.id">
|
|
|
+ <el-icon>
|
|
|
+ <ScaleToOriginal v-if="data.parent"/>
|
|
|
+ <Folder v-else/>
|
|
|
+ </el-icon>
|
|
|
+ {{ data.business || data.text }}
|
|
|
+ </div>
|
|
|
</template>
|
|
|
</el-tree>
|
|
|
</div>
|
|
@@ -64,7 +90,7 @@ const handelFilter = (value, data: Outline) => {
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
-<style scoped lang="scss">
|
|
|
+<style lang="scss">
|
|
|
.outline_main {
|
|
|
overflow: auto;
|
|
|
}
|