|
|
|
@ -4,113 +4,113 @@ |
|
|
|
<Menu |
|
|
|
:initial-active="0" |
|
|
|
/> |
|
|
|
<main class="main-body"> |
|
|
|
<header class="top-nav"> |
|
|
|
<div class="search-container"> |
|
|
|
<input v-model="searchKeyword" type="text" placeholder="搜索......" @keydown.enter="search"/> |
|
|
|
<img src="@/assets/搜索.png" style="cursor: pointer" class="search-btn" @click="search"/> |
|
|
|
</div> |
|
|
|
<div class="legend-box"> |
|
|
|
<div v-for="(item, index) in legendItems" :key="index" class="legend-item"> |
|
|
|
<div |
|
|
|
:style="{ |
|
|
|
<main class="main-body"> |
|
|
|
<header class="top-nav"> |
|
|
|
<div class="search-container"> |
|
|
|
<input v-model="searchKeyword" type="text" placeholder="搜索......" @keydown.enter="search"/> |
|
|
|
<img src="@/assets/搜索.png" style="cursor: pointer" class="search-btn" @click="search"/> |
|
|
|
</div> |
|
|
|
<div class="legend-box"> |
|
|
|
<div v-for="(item, index) in legendItems" :key="index" class="legend-item"> |
|
|
|
<div |
|
|
|
:style="{ |
|
|
|
backgroundColor: item.color, |
|
|
|
opacity: visibleCategories.has(item.key) ? 1 : 0.3 // ✅ 关键:根据状态调整透明度 |
|
|
|
}" |
|
|
|
class="color-block" |
|
|
|
@click="toggleCategory(item.key)" |
|
|
|
></div> |
|
|
|
<span style=" font-size: 12px;color: rgb(0, 0, 0);font-weight: 600;">{{ item.label }}</span> |
|
|
|
class="color-block" |
|
|
|
@click="toggleCategory(item.key)" |
|
|
|
></div> |
|
|
|
<span style=" font-size: 12px;color: rgb(0, 0, 0);font-weight: 600;">{{ item.label }}</span> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</header> |
|
|
|
<section class="main-content"> |
|
|
|
<div class="disease-container"> |
|
|
|
<div class="disease-header" :style="headerStyle"> |
|
|
|
<div style="display: flex;align-items: center;"> |
|
|
|
<div class="d-title"><img :src="iconSrc" class="d-icon"/> |
|
|
|
<span v-if="typeRadio=== 'Disease'">疾病信息</span> |
|
|
|
<span v-if="typeRadio=== 'Drug'">药品信息</span> |
|
|
|
<span v-if="typeRadio=== 'Check'">检查信息</span> |
|
|
|
</div> |
|
|
|
<div v-if="typeRadio=== 'Disease'" class="d-count" :style="headerLabel">{{diseaseCount.toLocaleString()}}种</div> |
|
|
|
<div v-if="typeRadio=== 'Drug'" class="d-count" :style="headerLabel">{{ drugCount.toLocaleString() }}种</div> |
|
|
|
<div v-if="typeRadio=== 'Check'" class="d-count" :style="headerLabel">{{checkCount.toLocaleString()}}种</div> |
|
|
|
</div> |
|
|
|
</header> |
|
|
|
<section class="main-content"> |
|
|
|
<div class="disease-container"> |
|
|
|
<div class="disease-header" :style="headerStyle"> |
|
|
|
<div style="display: flex;align-items: center;"> |
|
|
|
<div class="d-title"><img :src="iconSrc" class="d-icon"/> |
|
|
|
<span v-if="typeRadio=== 'Disease'">疾病信息</span> |
|
|
|
<span v-if="typeRadio=== 'Drug'">药品信息</span> |
|
|
|
<span v-if="typeRadio=== 'Check'">检查信息</span> |
|
|
|
</div> |
|
|
|
<div v-if="typeRadio=== 'Disease'" class="d-count" :style="headerLabel">{{diseaseCount.toLocaleString()}}种</div> |
|
|
|
<div v-if="typeRadio=== 'Drug'" class="d-count" :style="headerLabel">{{ drugCount.toLocaleString() }}种</div> |
|
|
|
<div v-if="typeRadio=== 'Check'" class="d-count" :style="headerLabel">{{checkCount.toLocaleString()}}种</div> |
|
|
|
</div> |
|
|
|
<div> |
|
|
|
<!-- ✅ 替换开始:自定义下拉选择器(使用 div 实现) --> |
|
|
|
<div class="select-container" @click="toggleDropdown"> |
|
|
|
<!-- 当前选中项显示 --> |
|
|
|
<div class="select-display"> |
|
|
|
<div> |
|
|
|
<!-- ✅ 替换开始:自定义下拉选择器(使用 div 实现) --> |
|
|
|
<div class="select-container" @click="toggleDropdown"> |
|
|
|
<!-- 当前选中项显示 --> |
|
|
|
<div class="select-display"> |
|
|
|
<span style="color: #000; background: rgb(255 255 255 / 64%); |
|
|
|
padding: 2px 13px; |
|
|
|
border-radius: 15px;">{{ currentTypeLabel }}</span> |
|
|
|
<img src="../assets/下拉11.png" class="dropdown-icon" /> |
|
|
|
</div> |
|
|
|
|
|
|
|
<!-- 下拉菜单 --> |
|
|
|
<div v-show="isDropdownOpen" class="select-dropdown"> |
|
|
|
<div |
|
|
|
v-for="item in typeOptions" |
|
|
|
:key="item.value" |
|
|
|
class="select-option" |
|
|
|
@click.stop="selectType(item.value)" |
|
|
|
> |
|
|
|
{{ item.label }} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<img src="../assets/下拉11.png" class="dropdown-icon" /> |
|
|
|
</div> |
|
|
|
|
|
|
|
<!-- 下拉菜单 --> |
|
|
|
<div v-show="isDropdownOpen" class="select-dropdown"> |
|
|
|
<div |
|
|
|
v-for="item in typeOptions" |
|
|
|
:key="item.value" |
|
|
|
class="select-option" |
|
|
|
@click.stop="selectType(item.value)" |
|
|
|
> |
|
|
|
{{ item.label }} |
|
|
|
</div> |
|
|
|
<!-- ✅ 替换结束 --> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<!-- <div>--> |
|
|
|
<!-- <el-radio-group v-model="typeRadio" @change="changeTree">--> |
|
|
|
<!-- <el-radio--> |
|
|
|
<!-- value="Disease"--> |
|
|
|
<!-- :class="{'radio-disease': typeRadio === 'Disease'}"--> |
|
|
|
<!-- >疾病</el-radio>--> |
|
|
|
<!-- <el-radio--> |
|
|
|
<!-- value="Drug"--> |
|
|
|
<!-- :class="{'radio-drug': typeRadio === 'Drug'}"--> |
|
|
|
<!-- >药品</el-radio>--> |
|
|
|
<!-- <el-radio--> |
|
|
|
<!-- value="Check"--> |
|
|
|
<!-- :class="{'radio-check': typeRadio === 'Check'}"--> |
|
|
|
<!-- >检查</el-radio>--> |
|
|
|
<!-- </el-radio-group>--> |
|
|
|
|
|
|
|
<!-- </div>--> |
|
|
|
<div v-if="typeRadio === 'Disease'"> |
|
|
|
<el-radio-group v-model="DiseaseRadio" @change="changeTree"> |
|
|
|
<el-radio |
|
|
|
value="ICD10" |
|
|
|
:class="{'radio-disease': typeRadio === 'Disease'}" |
|
|
|
>ICD10</el-radio> |
|
|
|
<el-radio |
|
|
|
value="Department" |
|
|
|
:class="{'radio-disease': typeRadio === 'Disease'}" |
|
|
|
>科室</el-radio> |
|
|
|
<el-radio |
|
|
|
value="SZM" |
|
|
|
:class="{'radio-disease': typeRadio === 'Disease'}" |
|
|
|
>首字母</el-radio> |
|
|
|
</el-radio-group> |
|
|
|
<!-- ✅ 替换结束 --> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<!-- <div>--> |
|
|
|
<!-- <el-radio-group v-model="typeRadio" @change="changeTree">--> |
|
|
|
<!-- <el-radio--> |
|
|
|
<!-- value="Disease"--> |
|
|
|
<!-- :class="{'radio-disease': typeRadio === 'Disease'}"--> |
|
|
|
<!-- >疾病</el-radio>--> |
|
|
|
<!-- <el-radio--> |
|
|
|
<!-- value="Drug"--> |
|
|
|
<!-- :class="{'radio-drug': typeRadio === 'Drug'}"--> |
|
|
|
<!-- >药品</el-radio>--> |
|
|
|
<!-- <el-radio--> |
|
|
|
<!-- value="Check"--> |
|
|
|
<!-- :class="{'radio-check': typeRadio === 'Check'}"--> |
|
|
|
<!-- >检查</el-radio>--> |
|
|
|
<!-- </el-radio-group>--> |
|
|
|
|
|
|
|
<!-- </div>--> |
|
|
|
<div v-if="typeRadio === 'Disease'"> |
|
|
|
<el-radio-group v-model="DiseaseRadio" @change="changeTree"> |
|
|
|
<el-radio |
|
|
|
value="ICD10" |
|
|
|
:class="{'radio-disease': typeRadio === 'Disease'}" |
|
|
|
>ICD10</el-radio> |
|
|
|
<el-radio |
|
|
|
value="Department" |
|
|
|
:class="{'radio-disease': typeRadio === 'Disease'}" |
|
|
|
>科室</el-radio> |
|
|
|
<el-radio |
|
|
|
value="SZM" |
|
|
|
:class="{'radio-disease': typeRadio === 'Disease'}" |
|
|
|
>首字母</el-radio> |
|
|
|
</el-radio-group> |
|
|
|
|
|
|
|
</div> |
|
|
|
<div v-if="typeRadio === 'Drug'"> |
|
|
|
<el-radio-group v-model="DrugRadio" @change="changeTree"> |
|
|
|
<el-radio |
|
|
|
value="Subject" |
|
|
|
:class="{'radio-drug': typeRadio === 'Drug'}" |
|
|
|
>药物分类</el-radio> |
|
|
|
<el-radio |
|
|
|
value="SZM" |
|
|
|
:class="{'radio-drug': typeRadio === 'Drug'}" |
|
|
|
>首字母</el-radio> |
|
|
|
</el-radio-group> |
|
|
|
</div> |
|
|
|
<div v-if="typeRadio === 'Drug'"> |
|
|
|
<el-radio-group v-model="DrugRadio" @change="changeTree"> |
|
|
|
<el-radio |
|
|
|
value="Subject" |
|
|
|
:class="{'radio-drug': typeRadio === 'Drug'}" |
|
|
|
>药物分类</el-radio> |
|
|
|
<el-radio |
|
|
|
value="SZM" |
|
|
|
:class="{'radio-drug': typeRadio === 'Drug'}" |
|
|
|
>首字母</el-radio> |
|
|
|
</el-radio-group> |
|
|
|
|
|
|
|
</div> |
|
|
|
<div class="disease-body"> |
|
|
|
</div> |
|
|
|
<div class="disease-body"> |
|
|
|
|
|
|
|
<div class="tree"> |
|
|
|
<el-tree |
|
|
|
@ -167,9 +167,10 @@ import GraphToolbar from "@/components/GraphToolbar.vue"; |
|
|
|
import Fuse from 'fuse.js'; |
|
|
|
import {ElMessage} from "element-plus"; |
|
|
|
import {getGraphStyleActive} from "@/api/style"; |
|
|
|
|
|
|
|
export default { |
|
|
|
name: 'Display', |
|
|
|
components: {Menu,GraphToolbar}, |
|
|
|
components: {Menu, GraphToolbar}, |
|
|
|
data() { |
|
|
|
return { |
|
|
|
_graph: null, |
|
|
|
@ -211,41 +212,41 @@ export default { |
|
|
|
children: 'children', |
|
|
|
label: 'title' // 虽然用插槽,但 el-tree 内部仍会读取,可留空或任意 |
|
|
|
}, |
|
|
|
typeRadio:"Disease", |
|
|
|
DiseaseRadio:"ICD10", |
|
|
|
drugTree:[], |
|
|
|
diseaseDepartTree:[], |
|
|
|
diseaseICD10Tree:[], |
|
|
|
diseaseSZMTree:[], |
|
|
|
checkTree:[], |
|
|
|
typeRadio: "Disease", |
|
|
|
DiseaseRadio: "ICD10", |
|
|
|
drugTree: [], |
|
|
|
diseaseDepartTree: [], |
|
|
|
diseaseICD10Tree: [], |
|
|
|
diseaseSZMTree: [], |
|
|
|
checkTree: [], |
|
|
|
legendItems: [ |
|
|
|
{ key: 'Disease', label: '疾病', color: '#EF4444' }, |
|
|
|
{ key: 'Drug', label: '药品', color: '#91cc75' }, |
|
|
|
{ key: 'Check', label: '检查', color: '#336eee' }, |
|
|
|
{ key: 'Symptom', label: '症状', color: '#fac858' }, |
|
|
|
{ key: 'Other', label: '其他', color: '#59d1d4' } |
|
|
|
{key: 'Disease', label: '疾病', color: '#EF4444'}, |
|
|
|
{key: 'Drug', label: '药品', color: '#91cc75'}, |
|
|
|
{key: 'Check', label: '检查', color: '#336eee'}, |
|
|
|
{key: 'Symptom', label: '症状', color: '#fac858'}, |
|
|
|
{key: 'Other', label: '其他', color: '#59d1d4'} |
|
|
|
], |
|
|
|
visibleCategories: new Set(), // 先空着 |
|
|
|
diseaseCount:0, |
|
|
|
drugCount:0, |
|
|
|
checkCount:0, |
|
|
|
diseaseCount: 0, |
|
|
|
drugCount: 0, |
|
|
|
checkCount: 0, |
|
|
|
originalNodeStyles: new Map(), // 保存原始节点样式 |
|
|
|
originalEdgeStyles: new Map(), // 保存原始边样式 |
|
|
|
searchResults: { |
|
|
|
nodes: [], |
|
|
|
edges: [] |
|
|
|
}, |
|
|
|
searchKeyword:"", |
|
|
|
drugSubjectTree:[], |
|
|
|
DrugRadio:"Subject", |
|
|
|
searchKeyword: "", |
|
|
|
drugSubjectTree: [], |
|
|
|
DrugRadio: "Subject", |
|
|
|
isDropdownOpen: false, |
|
|
|
typeOptions: [ |
|
|
|
{ value: 'Disease', label: '疾病' }, |
|
|
|
{ value: 'Drug', label: '药品' }, |
|
|
|
{ value: 'Check', label: '检查' } |
|
|
|
{value: 'Disease', label: '疾病'}, |
|
|
|
{value: 'Drug', label: '药品'}, |
|
|
|
{value: 'Check', label: '检查'} |
|
|
|
], |
|
|
|
configs:[], |
|
|
|
parsedStyles:{}, |
|
|
|
configs: [], |
|
|
|
parsedStyles: {}, |
|
|
|
enToZhLabelMap: { |
|
|
|
Disease: '疾病', |
|
|
|
Drug: '药品', |
|
|
|
@ -324,7 +325,7 @@ export default { |
|
|
|
this.loadDrugTreeData() |
|
|
|
this.loadCheckTreeData() |
|
|
|
this.loadDrugSubjectTreeData() |
|
|
|
this.treeData=this.diseaseICD10Tree |
|
|
|
this.treeData = this.diseaseICD10Tree |
|
|
|
await this.$nextTick(); |
|
|
|
try { |
|
|
|
await this.getDefault() |
|
|
|
@ -366,7 +367,7 @@ export default { |
|
|
|
return { |
|
|
|
...edge, |
|
|
|
id: edge.data?.relationship?.id || edge.id, |
|
|
|
type: styleConf.edgeType ||this.edgeType, |
|
|
|
type: styleConf.edgeType || this.edgeType, |
|
|
|
style: { |
|
|
|
endArrow: styleConf.edgeEndArrow !== undefined ? styleConf.edgeEndArrow : true, |
|
|
|
stroke: styleConf.edgeStroke || this.edgeStroke, |
|
|
|
@ -442,7 +443,7 @@ export default { |
|
|
|
}, |
|
|
|
|
|
|
|
beforeUnmount() { |
|
|
|
if (this._graph!=null){ |
|
|
|
if (this._graph != null) { |
|
|
|
this._graph.stopLayout(); |
|
|
|
this.clearGraphState(); |
|
|
|
this._graph.destroy() |
|
|
|
@ -481,7 +482,7 @@ export default { |
|
|
|
return {}; |
|
|
|
} |
|
|
|
}, |
|
|
|
async getDefault(){ |
|
|
|
async getDefault() { |
|
|
|
const response = await getGraphStyleActive(); |
|
|
|
const data = response.data; |
|
|
|
if (!Array.isArray(data) || data.length === 0) { |
|
|
|
@ -649,7 +650,7 @@ export default { |
|
|
|
// 4️⃣ 聚焦第一个匹配项 |
|
|
|
const firstMatch = nodeIds[0] || edgeIds[0]; |
|
|
|
if (firstMatch && (this._graph.hasNode(firstMatch) || this._graph.hasEdge(firstMatch))) { |
|
|
|
this._graph.focusElement(firstMatch, { animation: true, duration: 600 }); |
|
|
|
this._graph.focusElement(firstMatch, {animation: true, duration: 600}); |
|
|
|
} |
|
|
|
}, |
|
|
|
clearSearchHighlight() { |
|
|
|
@ -663,26 +664,26 @@ export default { |
|
|
|
this._graph.setElementState(id, 'normal', true); |
|
|
|
}); |
|
|
|
}, |
|
|
|
getCount(){ |
|
|
|
getCount().then(res=>{ |
|
|
|
this.diseaseCount=res.Disease |
|
|
|
this.drugCount=res.Drug |
|
|
|
this.checkCount=res.Check |
|
|
|
getCount() { |
|
|
|
getCount().then(res => { |
|
|
|
this.diseaseCount = res.Disease |
|
|
|
this.drugCount = res.Drug |
|
|
|
this.checkCount = res.Check |
|
|
|
console.log(res) |
|
|
|
}) |
|
|
|
}, |
|
|
|
buildCategoryIndex() { |
|
|
|
const index = {}; |
|
|
|
if (this._graph!=null){ |
|
|
|
if (this._graph != null) { |
|
|
|
const nodes = this._graph.getNodeData() // 获取所有节点 |
|
|
|
nodes.forEach(node => { |
|
|
|
console.log(node.data.label) |
|
|
|
const category = node.data.label; // 假设 label 是类别 |
|
|
|
if(category=='Drug'||category=='Symptom'|| |
|
|
|
category=='Disease'||category=='Check'){ |
|
|
|
if (category == 'Drug' || category == 'Symptom' || |
|
|
|
category == 'Disease' || category == 'Check') { |
|
|
|
if (!index[category]) index[category] = []; |
|
|
|
index[category].push(node.id); |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
if (!index["Other"]) index["Other"] = []; |
|
|
|
index["Other"].push(node.id); |
|
|
|
} |
|
|
|
@ -692,7 +693,7 @@ export default { |
|
|
|
|
|
|
|
}, |
|
|
|
// 切换某个类别的显示状态 |
|
|
|
toggleCategory (key){ |
|
|
|
toggleCategory(key) { |
|
|
|
if (this.visibleCategories.has(key)) { |
|
|
|
this.visibleCategories.delete(key) |
|
|
|
} else { |
|
|
|
@ -747,28 +748,28 @@ export default { |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
changeTree(){ |
|
|
|
if(this.typeRadio=="Disease"){ |
|
|
|
if(this.DiseaseRadio=="ICD10") { |
|
|
|
this.treeData=this.diseaseICD10Tree |
|
|
|
changeTree() { |
|
|
|
if (this.typeRadio == "Disease") { |
|
|
|
if (this.DiseaseRadio == "ICD10") { |
|
|
|
this.treeData = this.diseaseICD10Tree |
|
|
|
} |
|
|
|
if(this.DiseaseRadio=="Department") { |
|
|
|
this.treeData=this.diseaseDepartTree |
|
|
|
if (this.DiseaseRadio == "Department") { |
|
|
|
this.treeData = this.diseaseDepartTree |
|
|
|
} |
|
|
|
if(this.DiseaseRadio=="SZM") { |
|
|
|
this.treeData=this.diseaseSZMTree |
|
|
|
if (this.DiseaseRadio == "SZM") { |
|
|
|
this.treeData = this.diseaseSZMTree |
|
|
|
} |
|
|
|
} |
|
|
|
if(this.typeRadio=="Drug") { |
|
|
|
if(this.DrugRadio=="Subject") { |
|
|
|
this.treeData=this.drugSubjectTree |
|
|
|
if (this.typeRadio == "Drug") { |
|
|
|
if (this.DrugRadio == "Subject") { |
|
|
|
this.treeData = this.drugSubjectTree |
|
|
|
} |
|
|
|
if(this.DrugRadio=="SZM") { |
|
|
|
this.treeData=this.drugTree |
|
|
|
if (this.DrugRadio == "SZM") { |
|
|
|
this.treeData = this.drugTree |
|
|
|
} |
|
|
|
} |
|
|
|
if(this.typeRadio=="Check") { |
|
|
|
this.treeData=this.checkTree |
|
|
|
if (this.typeRadio == "Check") { |
|
|
|
this.treeData = this.checkTree |
|
|
|
} |
|
|
|
}, |
|
|
|
async loadDiseaseICD10TreeData() { |
|
|
|
@ -828,15 +829,15 @@ export default { |
|
|
|
const response = await getGraph(data); // 等待 Promise 解析 |
|
|
|
this.formatData(response) |
|
|
|
} |
|
|
|
if(data.level=="category"|| |
|
|
|
data.level=="subcategory"|| |
|
|
|
data.level=="diagnosis"){ |
|
|
|
data.type="Disease" |
|
|
|
if (data.level == "category" || |
|
|
|
data.level == "subcategory" || |
|
|
|
data.level == "diagnosis") { |
|
|
|
data.type = "Disease" |
|
|
|
const response = await getGraph(data); // 等待 Promise 解析 |
|
|
|
this.formatData(response) |
|
|
|
} |
|
|
|
if(data.type === "Disease"){ |
|
|
|
data.type="Disease" |
|
|
|
if (data.type === "Disease") { |
|
|
|
data.type = "Disease" |
|
|
|
const response = await getGraph(data); // 等待 Promise 解析 |
|
|
|
this.formatData(response) |
|
|
|
} |
|
|
|
@ -852,17 +853,17 @@ export default { |
|
|
|
|
|
|
|
// 1. 清除所有节点和边的状态 |
|
|
|
this._graph.getNodeData().forEach(node => { |
|
|
|
this._graph.setElementState(node.id,[]); |
|
|
|
this._graph.setElementState(node.id, []); |
|
|
|
|
|
|
|
}); |
|
|
|
this._graph.getEdgeData().forEach(edge => { |
|
|
|
this._graph.setElementState(edge.id,[]); |
|
|
|
this._graph.setElementState(edge.id, []); |
|
|
|
}); |
|
|
|
|
|
|
|
// 2. (可选)取消所有 pending 的交互 |
|
|
|
// 比如如果你有高亮定时器,这里 clearTimeout |
|
|
|
}, |
|
|
|
formatData(data){ |
|
|
|
formatData(data) { |
|
|
|
this._graph.stopLayout(); |
|
|
|
this.clearGraphState(); |
|
|
|
|
|
|
|
@ -903,7 +904,7 @@ export default { |
|
|
|
return { |
|
|
|
...edge, |
|
|
|
id: edge.data?.relationship?.id || edge.id, |
|
|
|
type: styleConf.edgeType ||this.edgeType, |
|
|
|
type: styleConf.edgeType || this.edgeType, |
|
|
|
style: { |
|
|
|
endArrow: styleConf.edgeEndArrow !== undefined ? styleConf.edgeEndArrow : true, |
|
|
|
stroke: styleConf.edgeStroke || this.edgeStroke, |
|
|
|
@ -949,7 +950,7 @@ export default { |
|
|
|
}, |
|
|
|
initGraph() { |
|
|
|
|
|
|
|
if (this._graph!=null){ |
|
|
|
if (this._graph != null) { |
|
|
|
this._graph.destroy() |
|
|
|
this._graph = null; |
|
|
|
} |
|
|
|
@ -960,7 +961,7 @@ export default { |
|
|
|
console.log(this._nodeLabelMap) |
|
|
|
const container = this.$refs.graphContainer; |
|
|
|
if (!container) return; |
|
|
|
if (container!=null){ |
|
|
|
if (container != null) { |
|
|
|
const width = container.clientWidth || 800; |
|
|
|
const height = container.clientHeight || 600; |
|
|
|
console.log(width) |
|
|
|
@ -1000,8 +1001,8 @@ export default { |
|
|
|
easing: 'ease-in-out', // 动画缓动函数 |
|
|
|
}, |
|
|
|
}, |
|
|
|
behaviors: [ 'zoom-canvas', 'drag-element', |
|
|
|
'click-select','focus-element', { |
|
|
|
behaviors: ['zoom-canvas', 'drag-element', |
|
|
|
'click-select', 'focus-element', { |
|
|
|
type: 'hover-activate', |
|
|
|
degree: 1, |
|
|
|
}, |
|
|
|
@ -1048,7 +1049,7 @@ export default { |
|
|
|
shadowBlur: 10, |
|
|
|
opacity: 1 |
|
|
|
}, |
|
|
|
highlight:{ |
|
|
|
highlight: { |
|
|
|
stroke: '#FF5722', |
|
|
|
lineWidth: 4, |
|
|
|
opacity: 1 |
|
|
|
@ -1056,7 +1057,7 @@ export default { |
|
|
|
inactive: { |
|
|
|
opacity: 0.8 |
|
|
|
}, |
|
|
|
normal:{ |
|
|
|
normal: { |
|
|
|
opacity: 1 |
|
|
|
} |
|
|
|
|
|
|
|
@ -1104,14 +1105,14 @@ export default { |
|
|
|
inactive: { |
|
|
|
opacity: 0.8 |
|
|
|
}, |
|
|
|
normal:{ |
|
|
|
normal: { |
|
|
|
opacity: 1 |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}, |
|
|
|
data:this.defaultData, |
|
|
|
data: this.defaultData, |
|
|
|
|
|
|
|
}); |
|
|
|
this.$nextTick(() => { |
|
|
|
@ -1169,10 +1170,10 @@ export default { |
|
|
|
// }); |
|
|
|
graph.on('node:click', (evt) => { |
|
|
|
const nodeItem = evt.target.id; // 获取当前鼠标进入的节点元素 |
|
|
|
let node=graph.getNodeData(nodeItem).data |
|
|
|
let data={ |
|
|
|
label:node.name, |
|
|
|
type:node.label |
|
|
|
let node = graph.getNodeData(nodeItem).data |
|
|
|
let data = { |
|
|
|
label: node.name, |
|
|
|
type: node.label |
|
|
|
} |
|
|
|
getGraph(data).then(response => { |
|
|
|
console.log(response) |
|
|
|
@ -1205,7 +1206,7 @@ export default { |
|
|
|
|
|
|
|
const sourceName = sourceNode?.data.name || sourceId; |
|
|
|
const targetName = targetNode?.data.name || targetId; |
|
|
|
const rel = data.relationship.properties.label || '关联'; |
|
|
|
const rel = data.relationship.properties.label || '关联'; |
|
|
|
|
|
|
|
return `<div style="padding: 4px 8px; color: #b6b2b2; border-radius: 4px; font-size: 12px;"> |
|
|
|
${sourceName} — ${rel} —> ${targetName} |
|
|
|
@ -1214,31 +1215,26 @@ export default { |
|
|
|
}, |
|
|
|
{ |
|
|
|
type: 'toolbar', |
|
|
|
onClick: (id) => |
|
|
|
{ |
|
|
|
onClick: (id) => { |
|
|
|
if (id === 'reset') { |
|
|
|
// 1. 如果是重置,直接在本地执行方法 |
|
|
|
this.localResetGraph(); |
|
|
|
} |
|
|
|
else if (this.$refs.toolbarRef) { |
|
|
|
} else if (this.$refs.toolbarRef) { |
|
|
|
// 2. 其他功能(放大、导出等)继续交给组件处理 |
|
|
|
this.$refs.toolbarRef.handleToolbarAction(id); |
|
|
|
} |
|
|
|
}, |
|
|
|
getItems: () => { |
|
|
|
return [ |
|
|
|
{ id: 'zoom-in', value: 'zoom-in', title: '放大' }, |
|
|
|
{ id: 'zoom-out', value: 'zoom-out', title: '缩小' }, |
|
|
|
{ id: 'undo', value: 'undo', title: '撤销' }, |
|
|
|
{ id: 'redo', value: 'redo', title: '重做' }, |
|
|
|
{ id: 'auto-fit', value: 'auto-fit', title: '聚焦' }, |
|
|
|
{ id: 'reset', value: 'reset', title: '重置' }, |
|
|
|
{ id: 'export', value: 'export', title: '导出图谱' }, |
|
|
|
{id: 'zoom-in', value: 'zoom-in', title: '放大'}, |
|
|
|
{id: 'zoom-out', value: 'zoom-out', title: '缩小'}, |
|
|
|
{id: 'auto-fit', value: 'auto-fit', title: '聚焦'}, |
|
|
|
{id: 'reset', value: 'reset', title: '重置'}, |
|
|
|
{id: 'export', value: 'export', title: '导出图谱'}, |
|
|
|
]; |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 如果需要撤销重做功能,必须加上 history 插件 |
|
|
|
{ type: 'history', key: 'history' }]) |
|
|
|
]) |
|
|
|
} |
|
|
|
}, |
|
|
|
localResetGraph() { |
|
|
|
@ -1290,7 +1286,7 @@ export default { |
|
|
|
const updatedNodes = this.defaultData.nodes.map(node => ({ |
|
|
|
...node, |
|
|
|
type: this.nodeShape, |
|
|
|
style:{ |
|
|
|
style: { |
|
|
|
size: this.nodeSize, |
|
|
|
fill: this.nodeFill, |
|
|
|
stroke: this.nodeStroke, |
|
|
|
@ -1548,6 +1544,7 @@ button:hover { |
|
|
|
width: 16px; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/*.search-btn:hover { |
|
|
|
background-color: rgba(34, 101, 244, 0.64); |
|
|
|
border-radius: 50%; |
|
|
|
@ -1709,7 +1706,6 @@ button:hover { |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* 自定义选中后的样式 */ |
|
|
|
/deep/ .radio-disease .el-radio__input.is-checked + .el-radio__label { |
|
|
|
color: rgb(153, 10, 0); |
|
|
|
@ -1722,6 +1718,7 @@ button:hover { |
|
|
|
/deep/ .radio-check .el-radio__input.is-checked + .el-radio__label { |
|
|
|
color: #1890ff; |
|
|
|
} |
|
|
|
|
|
|
|
/* 自定义下拉样式 */ |
|
|
|
.select-container { |
|
|
|
position: relative; |
|
|
|
@ -1751,7 +1748,7 @@ button:hover { |
|
|
|
background: rgba(255, 255, 255, 0.64); |
|
|
|
border: 1px solid #e0e0e0; |
|
|
|
border-radius: 8px; |
|
|
|
box-shadow: 0 4px 12px rgba(0,0,0,0.15); |
|
|
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); |
|
|
|
z-index: 10; |
|
|
|
min-width: 80px; |
|
|
|
color: #000; |
|
|
|
|