<template>
|
<view class="relative">
|
<headNav :idIndex="1 + ''" text="中医人物数据库" />
|
<view class="Midde flex">
|
<el-button class="MiddeBack flex flex-center" @click="goBack"
|
>返回</el-button
|
>
|
<view style="width: 70%" class="flex flex-center flex-column">
|
<view style="font-weight: bold; font-size: 0.2rem">{{
|
detailInfo.NAME
|
}}</view>
|
<ul class="flex" style="line-height: 1.2; margin: 0.15rem 0">
|
<li
|
style="
|
background-color: #fff;
|
padding: 0 0.08rem;
|
border: 0.01rem solid #000;
|
border-radius: 0.1rem;
|
font-size: 0.12rem;
|
text-align: center;
|
margin-right: 0.15rem;
|
"
|
@click="openFileClick(1)"
|
>
|
RDF
|
</li>
|
<li
|
style="
|
background-color: #fff;
|
padding: 0 0.08rem;
|
border: 0.01rem solid #000;
|
border-radius: 0.1rem;
|
font-size: 0.12rem;
|
text-align: center;
|
margin-right: 0.15rem;
|
cursor: pointer;
|
"
|
@click="openFileClick(2)"
|
>
|
NT
|
</li>
|
<li
|
style="
|
background-color: #fff;
|
padding: 0 0.08rem;
|
border: 0.01rem solid #000;
|
border-radius: 0.1rem;
|
font-size: 0.12rem;
|
text-align: center;
|
margin-right: 0.15rem;
|
cursor: pointer;
|
"
|
@click="openFileClick(3)"
|
>
|
XML
|
</li>
|
<li
|
style="
|
background-color: #fff;
|
padding: 0 0.08rem;
|
border: 0.01rem solid #000;
|
border-radius: 0.1rem;
|
font-size: 0.12rem;
|
text-align: center;
|
margin-right: 0.15rem;
|
cursor: pointer;
|
"
|
@click="openFileClick(4)"
|
>
|
JSON
|
</li>
|
</ul>
|
<view
|
id="copyBox"
|
class="fz font-family"
|
:title="biogData.length ? biogData[0].content : ''"
|
style="
|
font-size: 0.14rem;
|
font-weight: normal;
|
line-height: 2;
|
letter-spacing: 0.03rem;
|
cursor: pointer;
|
display: -webkit-box;
|
-webkit-box-orient: vertical;
|
-webkit-line-clamp: 4;
|
overflow: hidden;
|
"
|
>
|
{{ biogData.length ? biogData[0].content : "-" }}
|
</view>
|
<view class="flex" style="width: 100%; margin: 0.25rem 0 0.15rem 0">
|
<view>
|
<!-- <el-button style="padding: 10rpx;" size="mini" icon="el-icon-folder-add">收藏</el-button> -->
|
<el-button
|
style="padding: 0.05rem 0.085rem"
|
class="yinyong flex"
|
@click="copyText"
|
>
|
<img src="@/static/image/yinyong.png" alt="" />引用</el-button
|
>
|
</view>
|
<view
|
v-if="biogData.length > 1"
|
style="font-size: 0.12rem; color: #244a7b; cursor: pointer"
|
@click="ProfileClick"
|
>阅读更多></view
|
>
|
</view>
|
</view>
|
<view style="width: 5%"></view>
|
</view>
|
<div style="padding: 0 1.2rem 0; padding-top: 0.24rem; display: flex">
|
<!-- 左侧 -->
|
<div
|
:span="5"
|
class="BoxLeft"
|
style="padding-right: 0.2rem; width: 2.8rem"
|
>
|
<div class="grid-content bg-purple-dark flex flex-column">
|
<el-card class="box-card" style="width: 100%; height: 2.06rem">
|
<div
|
class="clearfix flex"
|
style="
|
font-weight: 900;
|
font-size: 0.14rem;
|
padding-bottom: 0.1rem;
|
"
|
>
|
<span
|
style="
|
margin-left: 0.12rem;
|
font-size: 0.14rem;
|
font-weight: 900;
|
"
|
>关系图谱</span
|
>
|
<!-- <el-button icon="el-icon-rank" style="float: right; padding: 3px 0;" type="text"></el-button> -->
|
<img
|
src="@/static/image/fangda.png"
|
@click="fangdaClick(1)"
|
style="width: 0.18rem; height: 0.18rem; cursor: pointer"
|
alt=""
|
/>
|
</div>
|
<view id="relation" style="height: 1.51rem; width: 100%"></view>
|
</el-card>
|
<el-card
|
class="box-card"
|
style="width: 100%; height: 2.06rem; margin: 0.26rem 0"
|
>
|
<div
|
class="clearfix flex"
|
style="
|
font-weight: 900;
|
font-size: 0.14rem;
|
padding-bottom: 0.1rem;
|
"
|
>
|
<span>时空地图</span>
|
<!-- <el-button icon="el-icon-rank" style="float: right; padding: 3px 0" type="text"></el-button> -->
|
<img
|
v-if="markerList && markerList.length > 0"
|
src="@/static/image/fangda.png"
|
@click="fangdaClick(2)"
|
style="width: 0.18rem; height: 0.18rem; cursor: pointer"
|
/>
|
</div>
|
<view
|
id="spaceTime"
|
style="height: 1.51rem; width: 100%; position: relative"
|
>
|
<p
|
v-if="markerList && markerList.length == 0"
|
style="
|
margin-top: 0.5rem;
|
color: #666;
|
text-align: center;
|
font-size: 12px;
|
"
|
>
|
暂无数据
|
</p>
|
</view>
|
</el-card>
|
<el-card style="width: 100%; height: 2.06rem">
|
<div
|
class="clearfix"
|
style="
|
font-weight: 900;
|
font-size: 0.14rem;
|
padding-bottom: 0.1rem;
|
"
|
>
|
<span>来源</span>
|
</div>
|
<ul
|
class="font-family"
|
style="height: 300rpx; font-size: 0.12rem; line-height: 0.3rem"
|
>
|
<li
|
style="
|
overflow: hidden;
|
text-overflow: ellipsis;
|
white-space: nowrap;
|
"
|
v-for="(item, index) in sourceDataList"
|
:key="index"
|
:title="item"
|
>
|
{{ index + 1 }}.{{ item }}
|
</li>
|
<div
|
v-if="sourceDataList.length == 0"
|
style="color: #666; text-align: center; font-size: 16px"
|
>
|
暂无数据
|
</div>
|
</ul>
|
</el-card>
|
</div>
|
</div>
|
<!-- 右侧 -->
|
<div :span="18" class="BoxRight">
|
<div class="grid-content bg-purple-dark" style="width: 100%">
|
<el-card class="box-card" style="padding: 0">
|
<div
|
class="clearfix"
|
style="
|
font-weight: 900;
|
font-size: 0.14rem;
|
padding-bottom: 0.1rem;
|
"
|
>
|
<span>基础信息</span>
|
</div>
|
<!-- 基础信息 -->
|
<cc-defineTable :tableData="tableArr"></cc-defineTable>
|
</el-card>
|
<el-card
|
class="box-card"
|
style="min-height: 1.91rem; margin: 0.2rem 0"
|
>
|
<el-tabs ref="tabs" v-model="activeName" @tab-click="handleClick">
|
<el-tab-pane label="代表著作" data-id="1" name="representative">
|
<Table1
|
:data="tableData1"
|
:columns="tableColumns1"
|
:height="400"
|
/>
|
</el-tab-pane>
|
<el-tab-pane label="亲属关系" data-id="2" name="family ">
|
<Table1
|
:data="tableData2"
|
:columns="tableColumns2"
|
:height="400"
|
/>
|
</el-tab-pane>
|
<el-tab-pane label="师承关系" data-id="3" name="mentoring ">
|
<Table1
|
:data="tableData3"
|
:columns="tableColumns2"
|
:height="400"
|
/>
|
</el-tab-pane>
|
<el-tab-pane label="社会关系" data-id="4" name="society">
|
<Table1
|
:data="tableData4"
|
:columns="tableColumns2"
|
:height="400"
|
/>
|
</el-tab-pane>
|
<el-tab-pane label="活动年谱" data-id="5" name="activity">
|
<Table1
|
:data="tableData5"
|
:columns="tableColumns3"
|
:height="400"
|
/>
|
</el-tab-pane>
|
</el-tabs>
|
</el-card>
|
<el-card style="margin-bottom: 0.2rem">
|
<div
|
class="clearfix"
|
style="
|
font-weight: 900;
|
font-size: 0.14rem;
|
padding-bottom: 0.1rem;
|
"
|
>
|
<span>相关附表/图像</span>
|
</div>
|
<view>
|
<div class="flex">
|
<el-image
|
v-for="item in imageList"
|
:key="item"
|
style="width: 2.05rem; height: 2.4rem"
|
:src="item"
|
fit="fill"
|
></el-image>
|
</div>
|
<div
|
v-if="imageList.length == 0"
|
style="color: #666; text-align: center; font-size: 16px"
|
>
|
暂无数据
|
</div>
|
</view>
|
</el-card>
|
<el-card class="box-card">
|
<div
|
class="clearfix"
|
style="
|
font-weight: 900;
|
font-size: 0.14rem;
|
padding-bottom: 0.1rem;
|
"
|
>
|
<span>现代研究</span>
|
</div>
|
<ul class="font-family" style="font-size: 0.13rem; line-height: 2">
|
<li
|
v-for="(item, index) in personResearchList"
|
:key="index"
|
@click="toLink(item)"
|
>
|
{{ "[" + Number(index + 1) + "]" + item.achievementName }}
|
</li>
|
<div
|
v-if="!personResearchList || personResearchList.length == 0"
|
style="color: #666; text-align: center; font-size: 16px"
|
>
|
暂无数据
|
</div>
|
</ul>
|
</el-card>
|
</div>
|
</div>
|
</div>
|
|
<!-- 返回顶部 -->
|
<el-col style="position: absolute; bottom: 1rem; left: 1.2rem">
|
<el-button
|
style="font-size: 0.3rem"
|
icon="el-icon-top"
|
circle
|
@click="scrollToTop"
|
></el-button>
|
</el-col>
|
<!-- 个人小传 -->
|
<el-dialog :visible.sync="isProfile" :modal-append-to-body="false">
|
<view class="ProfileNav flex flex-center"> 个人小传 </view>
|
<view
|
style="padding: 0.44rem 0.3rem; min-height: 7.32rem"
|
v-if="biogData.length > 0"
|
>
|
<view
|
v-for="(item, index) in biogData"
|
:key="index"
|
style="
|
margin-bottom: 0.2rem;
|
background-color: #f0f0f0;
|
padding: 0.18rem 0.1rem 0.1rem 0.27rem;
|
font-size: 0.12rem;
|
line-height: 0.24rem;
|
font-weight: 400;
|
"
|
>
|
<view style="color: #2c2c2c">
|
{{ item.content }}
|
</view>
|
<view class="flex">
|
<view></view>
|
<view style="font-weight: 700; color: #2c2c2c"
|
>——{{ item.bookName }}</view
|
>
|
</view>
|
</view>
|
</view>
|
<div v-else>
|
<el-empty description="暂无数据"></el-empty>
|
</div>
|
</el-dialog>
|
</view>
|
</template>
|
|
<script>
|
import * as echarts from "echarts";
|
import "echarts/extension/bmap/bmap";
|
import { loadBMap } from "@/static/map.js";
|
import Table1 from "@/components/table1/table1.vue";
|
import {
|
getFuzzySearch,
|
getPersonInfo,
|
getWebBasic,
|
getIntroduction,
|
getSource,
|
getPersonImages,
|
getPersonBiog,
|
getPersonWritings,
|
getPersonRelationAtSchool,
|
getSpaceTime
|
} from "@/api/index.js";
|
import { getImg } from "@/static/tool.js";
|
import L from "leaflet";
|
import "leaflet.chinatmsproviders";
|
|
export default {
|
components: {
|
Table1
|
},
|
data() {
|
return {
|
// 标题顶部栏需要的东西
|
detailId: "",
|
detailInfo: {},
|
sourceDataList: [],
|
imageList: [],
|
biogData: [],
|
// -------
|
// 小传
|
isProfile: false,
|
// 关系图谱
|
activeName: "representative",
|
// 基础信息
|
tableArr: [],
|
// 代表著作
|
tableColumns1: [
|
{
|
prop: "a",
|
label: "正书名"
|
},
|
{
|
prop: "e",
|
label: "作者"
|
},
|
{
|
prop: "b",
|
label: "著作年"
|
},
|
{
|
prop: "c",
|
label: "著作方式"
|
},
|
{
|
prop: "d",
|
label: "总目分类"
|
}
|
],
|
tableColumns2: [
|
{
|
prop: "a",
|
label: "关系人"
|
},
|
{
|
prop: "b",
|
label: "关系类型"
|
},
|
{
|
prop: "c",
|
label: "考据"
|
},
|
{
|
prop: "d",
|
label: "出处"
|
}
|
],
|
tableColumns3: [
|
{
|
prop: "a",
|
label: "活动时间区间"
|
},
|
{
|
prop: "b",
|
label: "活动名称"
|
},
|
{
|
prop: "c",
|
label: "活动地点"
|
},
|
{
|
prop: "d",
|
label: "活动描述"
|
}
|
],
|
tableData1: [],
|
tableData2: [],
|
tableData3: [],
|
tableData4: [],
|
tableData5: [],
|
nodes: [],
|
relationships: [],
|
personResearchList: [],
|
markerList: []
|
};
|
},
|
onLoad(options) {
|
this.detailId = options.id;
|
},
|
mounted() {
|
// 获取人物详情
|
this.getData();
|
// 获取来源
|
this.getSourceData();
|
// 获取相关图表
|
this.getImages();
|
// 获取个人事迹
|
this.getBiog();
|
// 获取著作
|
this.getWritings();
|
// 获取人物关系
|
this.getRelationship();
|
// 获取时空地图
|
this.getMapInfo();
|
|
this.$nextTick(() => {
|
// 获取第一个选项卡的 DOM 元素
|
const firstTab = this.$refs.tabs.$el.querySelector(
|
".el-tabs__active-bar"
|
);
|
firstTab.style.transform = "translateX(" + "-.2rem" + ")";
|
});
|
|
// 监听窗口大小变化
|
window.addEventListener("resize", this.relation);
|
},
|
methods: {
|
copyText() {
|
const textToCopy = this.biogData[0].content + " 来源:中医医学人物知识库";
|
const textarea = document.createElement("textarea");
|
textarea.value = textToCopy;
|
document.body.appendChild(textarea);
|
textarea.select();
|
document.execCommand("copy");
|
document.body.removeChild(textarea);
|
this.$message({
|
message: "复制成功!",
|
type: "success"
|
});
|
},
|
toLink(item) {
|
window.open(item.url);
|
},
|
getData() {
|
// 基本信息
|
getPersonInfo({
|
id: this.detailId,
|
type: "PERSON_BASIC"
|
}).then((res) => {
|
const obj = {};
|
if (
|
res.object &&
|
res.object.personFieldList &&
|
res.object.personFieldList.length
|
) {
|
for (let i = 0; i < res.object.personFieldList.length; i++) {
|
const fieldItem = res.object.personFieldList[i];
|
obj[fieldItem.fieldName] = fieldItem.content2
|
? fieldItem.content2
|
: fieldItem.content1;
|
}
|
}
|
this.detailInfo = obj;
|
// 关系图谱
|
this.getMappingData(this.detailInfo.NAME);
|
});
|
//现代研究
|
getPersonInfo({
|
id: this.detailId,
|
type: "PERSON_RESEARCH"
|
}).then((res) => {
|
this.personResearchList = res.object.personResearchList;
|
});
|
|
getWebBasic({
|
personId: this.detailId
|
}).then((res) => {
|
const obj = res.object;
|
if (obj.school) {
|
getIntroduction(Number(obj.school)).then((sres) => {
|
this.handleData(obj, sres);
|
});
|
} else {
|
this.handleData(obj);
|
}
|
});
|
|
// 活动年谱
|
getPersonInfo({
|
id: this.detailId,
|
type: "PERSON_SPACE_TIME"
|
}).then((res) => {
|
if (res.object.personSpaceTimeList) {
|
this.tableData5 = res.object.personSpaceTimeList.map((item) => {
|
return {
|
a: item.time,
|
b: item.activityName,
|
c: item.activityAddrOld,
|
d: item.desc // 这里缺少活动描述字段
|
};
|
});
|
}
|
});
|
},
|
handleData(obj, sres) {
|
this.tableArr = [
|
{
|
list: [
|
{
|
name: "别名",
|
value: obj.alias || "-"
|
},
|
{
|
name: "字",
|
value: obj.zi || "-"
|
},
|
{
|
name: "号",
|
value: obj.hao || "-"
|
},
|
{
|
name: "所处时期",
|
value: obj.dynastyDesc || "-"
|
},
|
{
|
name: "民族",
|
value: obj.ethnic || "-"
|
}
|
]
|
},
|
{
|
list: [
|
{
|
name: "籍贯",
|
value: obj.native || "-"
|
},
|
{
|
name: "性别",
|
value: obj.gender || "-"
|
},
|
{
|
name: "职官",
|
value: obj.official || "-"
|
},
|
{
|
name: "流派",
|
value:
|
sres &&
|
sres.object &&
|
sres.object.school_NAME &&
|
sres.object.school_NAME.length
|
? sres.object.school_NAME[0].content
|
: "-"
|
},
|
{
|
name: "学术特点",
|
value: obj.features || "-"
|
}
|
]
|
}
|
];
|
},
|
getSourceData() {
|
getSource({
|
personId: this.detailId
|
}).then((res) => {
|
this.sourceDataList = res.list;
|
});
|
},
|
getImages() {
|
getPersonImages({
|
personId: this.detailId
|
}).then((res) => {
|
this.imageList = res.list.map((item) => getImg(item.filePath));
|
});
|
},
|
getBiog() {
|
getPersonBiog({
|
personId: this.detailId
|
}).then((res) => {
|
this.biogData = res.list.map((item) => {
|
return {
|
content: item.content1,
|
bookName: "《" + item.bookName + "》 " + "P " + item.pageNo // 这里只有bookid无法匹配到书名
|
};
|
});
|
});
|
},
|
getWritings() {
|
getPersonWritings({
|
personId: this.detailId
|
}).then((res) => {
|
this.tableData1 = res.list.map((item) => {
|
return {
|
a: item.name,
|
b: item.dynasty,
|
c: item.writeWay,
|
d: item.classify,
|
e: this.detailInfo.NAME
|
};
|
});
|
});
|
},
|
getRelationship() {
|
// getPersonRelationAtSchool({
|
// personId: this.detailId,
|
// }).then((res) => {
|
// this.personRelationList = res.object.personRelationList;
|
// if (this.personRelationList.length) {
|
// this.tableData4 = this.personRelationList.map((f) => {
|
// return {
|
// a: f.nodeName,
|
// b: f.relationTypeName,
|
// };
|
// });
|
// }
|
// });
|
// 社会关系
|
getPersonRelationAtSchool({
|
personId: this.detailId,
|
relationSearchTypeEO: "SOCIAL"
|
}).then((res) => {
|
if (res.list && res.list.length) {
|
this.tableData4 = res.list.map((f) => {
|
return {
|
a: f.name1,
|
b: f.relationName
|
};
|
});
|
}
|
});
|
// 亲属关系
|
getPersonRelationAtSchool({
|
personId: this.detailId,
|
relationSearchTypeEO: "KINSHIP"
|
}).then((res) => {
|
if (res.list && res.list.length) {
|
this.tableData2 = res.list.map((f) => {
|
return {
|
a: f.name1,
|
b: f.relationName
|
};
|
});
|
}
|
});
|
// 师承关系
|
getPersonRelationAtSchool({
|
personId: this.detailId,
|
relationSearchTypeEO: "INHERITANCE"
|
}).then((res) => {
|
if (res.list && res.list.length) {
|
this.tableData3 = res.list.map((f) => {
|
return {
|
a: f.name1,
|
b: f.relationName
|
};
|
});
|
}
|
});
|
},
|
getMappingData(name) {
|
getFuzzySearch({
|
keyword: name
|
}).then((res) => {
|
this.nodes = [];
|
this.relationships = [];
|
if (res.success && res.list) {
|
res.list.forEach((item, index) => {
|
let exists1 = this.nodes.some(
|
(node) => node.id === item.identifier1 && node.name === item.name1
|
);
|
let exists2 = this.nodes.some(
|
(node) => node.id === item.identifier2 && node.name === item.name2
|
);
|
// 证明不存在
|
if (exists1 !== true) {
|
this.nodes.push({
|
name: item.name1,
|
id: item.identifier1
|
});
|
}
|
if (exists2 !== true) {
|
this.nodes.push({
|
name: item.name2,
|
id: item.identifier2
|
});
|
}
|
let obj = {
|
source: item.name1,
|
target: item.name2,
|
relation: item.relationName || "" // 如果存在 relationName 字段则使用,否则为空字符串
|
};
|
this.relationships.push(obj);
|
});
|
}
|
this.relation();
|
});
|
},
|
getMapInfo() {
|
getSpaceTime({
|
personId: this.detailId
|
}).then((res) => {
|
if (res.list && res.list.length) {
|
const data = res.list.map((item) => {
|
return {
|
name: item.activityName,
|
value: [item.xcoord, item.ycoord]
|
};
|
});
|
this.markerList = data;
|
// 时空地图
|
this.initMap(data[0]);
|
}
|
|
// loadBMap("1NJdwrI1CfT6lrykVhDkmWgsO6O2bjQK").then(() => {
|
// this.spaceTime(data);
|
// });
|
});
|
},
|
initMap(markerList) {
|
var map = L.map("spaceTime", {
|
preferCanvas: true,
|
attributionControl: false
|
}).setView([markerList.value[1], markerList.value[0]], 13);
|
L.tileLayer
|
.chinaProvider("TianDiTu.Normal.Map", {
|
key: "76bc34ead7e30e663a4eded8aeaf5860",
|
maxZoom: 18,
|
minZoom: 3
|
})
|
.addTo(map);
|
let icon = L.divIcon({
|
html: "<div class='map-circle-name ripple'></div>",
|
iconSize: [80, 80],
|
className: "map-circle"
|
});
|
this.map = map;
|
const temp_mark = L.marker([markerList.value[1], markerList.value[0]], {
|
icon: icon
|
}).addTo(map);
|
},
|
// 放大地图跳转
|
fangdaClick(index) {
|
if (index == 1) {
|
uni.navigateTo({
|
url: "/pages/character/index?keyword=" + this.detailInfo.NAME
|
});
|
} else if (index == 2) {
|
uni.navigateTo({
|
url: "/pages/characterMap/characterMap?id=" + this.detailId
|
});
|
}
|
},
|
// 小传
|
ProfileClick() {
|
this.isProfile = !this.isProfile;
|
},
|
// 返回上一页
|
goBack() {
|
this.$router.go(-1);
|
},
|
// 返回顶部
|
scrollToTop() {
|
window.scrollTo({
|
top: 0,
|
behavior: "smooth" // 使用平滑滚动
|
});
|
},
|
openFileClick(index) {
|
let obj = {
|
id: this.detailId,
|
type: "Person"
|
};
|
switch (index) {
|
case 1:
|
obj.outputType = "RDF";
|
break;
|
case 2:
|
obj.outputType = "NT";
|
break;
|
case 3:
|
obj.outputType = "XML";
|
break;
|
case 4:
|
obj.outputType = "JSON";
|
break;
|
}
|
let queryString = Object.keys(obj)
|
.map(
|
(key) => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`
|
)
|
.join("&");
|
window.open(`#/pages/fileDetail/index?${queryString}`);
|
},
|
handleClick(tab) {
|
let index = tab.$attrs["data-id"] - 1;
|
this.$nextTick(() => {
|
let firstTab = this.$refs.tabs.$el.querySelector(
|
".el-tabs__active-bar"
|
);
|
if (index == 0) {
|
firstTab.style.transform = "translateX(-" + 0.2 + "rem)";
|
} else if (index == 1) {
|
firstTab.style.transform = "translateX(" + 0.85 * index + "rem)";
|
} else if (index == 2) {
|
firstTab.style.transform = "translateX(" + 0.93 * index + "rem)";
|
} else if (index == 3) {
|
firstTab.style.transform = "translateX(" + 0.95 * index + "rem)";
|
} else if (index == 4) {
|
firstTab.style.transform = "translateX(" + 0.97 * index + "rem)";
|
} else {
|
let firstTab = this.$refs.tabs.$el.querySelector(
|
".el-tabs__active-bar"
|
);
|
firstTab.style.transform = "translateX(" + "-.2" + "rem)";
|
}
|
});
|
},
|
// 关系图谱
|
relation() {
|
var chartDom = document.getElementById("relation");
|
var myChart = echarts.init(chartDom);
|
// 假设您有节点名称和它们之间的关系数据
|
var nodes = this.nodes;
|
var relationships = this.relationships;
|
|
let FontSize = 12; // 字体大小
|
let BorderWidth = 2; // 边框大小
|
let SymbolSize = 80; // 尺寸距离
|
let Distance = 10;
|
// 不同尺寸下修改echarts的字体
|
if (window.innerWidth > 2560 && window.innerWidth <= 3840) {
|
FontSize = 28;
|
BorderWidth = 5;
|
SymbolSize = 100;
|
Distance = 33;
|
} else if (window.innerWidth > 1920 && window.innerWidth <= 2560) {
|
FontSize = 28;
|
BorderWidth = 4;
|
SymbolSize = 90;
|
Distance = 22;
|
} else if (window.innerWidth >= 1366 && window.innerWidth <= 1920) {
|
FontSize = 18;
|
BorderWidth = 4;
|
SymbolSize = 70;
|
Distance = 22;
|
}
|
// 根据关系数据生成连接线
|
var links = [];
|
relationships.forEach((relationship, i) => {
|
var sourceIndex = nodes.findIndex(
|
(node) => node.name === relationship.source
|
);
|
var targetIndex = nodes.findIndex(
|
(node) => node.name === relationship.target
|
);
|
if (relationship.relation) {
|
if (sourceIndex !== -1 && targetIndex !== -1) {
|
links.push({
|
source: sourceIndex,
|
target: targetIndex,
|
label: {
|
show: true,
|
formatter: function (params) {
|
return relationship.relation;
|
}, // 设置关系标签内容为"Child-Parent"
|
color: "#2C2C2C",
|
fontSize: FontSize - 2,
|
backgroundColor: "rgba(255, 255, 255, 1)",
|
padding: [3, 8],
|
borderRadius: 30,
|
position: "middle", // 设置标签文本在线的中间位置上居中显示
|
// bottom: -(FontSize+10),
|
z: 10, // 设置标签的z轴高度,使其比连接线更高
|
distance: -(Distance + 1) // 将标签放置在连接线上
|
}
|
});
|
}
|
}
|
});
|
// 根据nodes动态生成节点数据
|
var nodeData = nodes.map(function (node, index) {
|
return {
|
name: node.name,
|
id: node.id,
|
x: Math.random() * 2000, // 设置随机x坐标位置
|
y: Math.random() * 600, // 设置随机y坐标位置
|
itemStyle: {
|
color: "#eae0eb", // 可以根据索引设置不同的颜色
|
borderWidth: BorderWidth,
|
borderColor: "#996f9f"
|
}
|
};
|
});
|
var option;
|
option = {
|
title: {
|
left: "center",
|
top: FontSize + 10,
|
subtextStyle: {
|
fontSize: FontSize, // 设置副标题文字大小为 14px
|
color: "#2C2C2C"
|
}
|
},
|
backgroundColor: {
|
type: "image",
|
image: "/static/image/characterRelationBg.png",
|
size: "100% 100%", // 背景图片的尺寸,可以是百分比或者像素
|
position: "center center" // 背景图片的位置,可以是 top, bottom, middle 或者百分比
|
},
|
tooltip: {},
|
animationDurationUpdate: 1500,
|
animationEasingUpdate: "quinticInOut",
|
series: [
|
{
|
type: "graph",
|
layout: "none",
|
roam: true,
|
symbolSize: SymbolSize, // 调整节点大小
|
label: {
|
show: true,
|
color: "black", // 设置节点文字颜色为黑色
|
fontSize: FontSize // 设置文字大小
|
},
|
edgeSymbol: ["circle"],
|
edgeSymbolSize: [4, 10],
|
data: nodeData,
|
links: links,
|
lineStyle: {
|
opacity: 0.9,
|
width: 2,
|
curveness: 0.3
|
},
|
emphasis: {
|
focus: "adjacency",
|
lineStyle: {
|
width: 10
|
}
|
}
|
}
|
]
|
};
|
// 将生成的连接线添加到echarts图表的option中
|
option.series[0].links = links;
|
// 设置点击事件监听
|
myChart.on("click", (params) => {
|
// menuNav2 = !menuNav1
|
if (params.componentType === "series") {
|
this.spaceTimeArr(params.data.id);
|
}
|
});
|
option && myChart.setOption(option);
|
},
|
// 时空地图
|
spaceTime(data) {
|
var chartDom = document.getElementById("spaceTime");
|
var myChart = echarts.init(chartDom);
|
var option;
|
|
option = {
|
title: {
|
text: "",
|
subtext: "",
|
sublink: "",
|
left: "center"
|
},
|
tooltip: {
|
trigger: "item"
|
},
|
bmap: {
|
center: data[0].value,
|
zoom: 8,
|
roam: true,
|
mapStyle: {
|
styleJson: [
|
{
|
featureType: "water",
|
elementType: "all",
|
stylers: {
|
color: "#86a1ac"
|
}
|
},
|
{
|
featureType: "land",
|
elementType: "all",
|
stylers: {
|
color: "#f1d99d"
|
}
|
},
|
{
|
featureType: "railway",
|
elementType: "all",
|
stylers: {
|
visibility: "off"
|
}
|
},
|
{
|
featureType: "highway",
|
elementType: "all",
|
stylers: {
|
color: "#f1d99d"
|
}
|
},
|
{
|
featureType: "highway",
|
elementType: "labels",
|
stylers: {
|
visibility: "off"
|
}
|
},
|
{
|
featureType: "arterial",
|
elementType: "geometry",
|
stylers: {
|
color: "#f1d99d"
|
}
|
},
|
{
|
featureType: "arterial",
|
elementType: "geometry.fill",
|
stylers: {
|
color: "#f1d99d"
|
}
|
},
|
{
|
featureType: "poi",
|
elementType: "all",
|
stylers: {
|
visibility: "off"
|
}
|
},
|
{
|
featureType: "green",
|
elementType: "all",
|
stylers: {
|
visibility: "off"
|
}
|
},
|
{
|
featureType: "subway",
|
elementType: "all",
|
stylers: {
|
visibility: "off"
|
}
|
},
|
{
|
featureType: "manmade",
|
elementType: "all",
|
stylers: {
|
color: "#f1d99d"
|
}
|
},
|
{
|
featureType: "local",
|
elementType: "all",
|
stylers: {
|
color: "#f1d99d"
|
}
|
},
|
{
|
featureType: "local",
|
elementType: "labels",
|
stylers: {
|
visibility: "off"
|
}
|
},
|
{
|
featureType: "arterial",
|
elementType: "labels",
|
stylers: {
|
visibility: "off"
|
}
|
},
|
{
|
featureType: "boundary",
|
elementType: "all",
|
stylers: {
|
color: "#f1d99d"
|
}
|
},
|
{
|
featureType: "building",
|
elementType: "all",
|
stylers: {
|
color: "#f1d99d"
|
}
|
},
|
{
|
featureType: "label",
|
elementType: "labels.text.fill",
|
stylers: {
|
color: "#000"
|
}
|
}
|
]
|
}
|
},
|
series: [
|
{
|
name: "",
|
type: "scatter",
|
coordinateSystem: "bmap",
|
data: data,
|
symbolSize: 0,
|
encode: {
|
value: 2
|
},
|
label: {
|
formatter: "{b}",
|
position: "right",
|
show: false
|
},
|
emphasis: {
|
label: {
|
show: true
|
}
|
}
|
},
|
{
|
name: "",
|
type: "effectScatter",
|
coordinateSystem: "bmap",
|
data: data,
|
symbolSize: 20,
|
encode: {
|
value: 2
|
},
|
showEffectOn: "render",
|
rippleEffect: {
|
brushType: "stroke"
|
},
|
label: {
|
formatter: "{b}",
|
position: "right",
|
show: false
|
},
|
itemStyle: {
|
color: "#ec7b43",
|
shadowBlur: 10,
|
shadowColor: "#333"
|
},
|
emphasis: {
|
scale: false
|
},
|
zlevel: 1
|
}
|
]
|
};
|
option && myChart.setOption(option);
|
}
|
}
|
};
|
</script>
|
|
<style>
|
/* Table1表格里面的数据 */
|
::v-deep .is-leaf {
|
.cell {
|
font-size: 0.14rem !important;
|
height: 0.4rem !important;
|
line-height: 0.4rem !important;
|
}
|
}
|
|
::v-deep .el-table__body {
|
.cell {
|
font-size: 0.14rem !important;
|
height: 0.4rem !important;
|
line-height: 0.4rem !important;
|
}
|
}
|
|
/* --------------- */
|
@media screen and (min-width: 2560px) and (max-width: 3840px) {
|
}
|
|
.BoxLeft ::v-deep.el-card__body {
|
padding: 0.1rem 0.11rem !important;
|
}
|
.BoxLeft {
|
width: 30%;
|
}
|
.BoxRight {
|
width: 70%;
|
}
|
|
::v-deep .el-tabs__content {
|
line-height: 1;
|
}
|
|
/* 个人小传 ------------------*/
|
::v-deep .el-dialog__header {
|
display: none;
|
}
|
|
::v-deep .el-dialog__body {
|
padding: 0;
|
}
|
|
::v-deep .el-dialog__wrapper {
|
z-index: 999999999999999 !important;
|
}
|
|
.ProfileNav {
|
width: 100%;
|
height: 0.7rem;
|
background: url(@/static/image/ProfileBg.png);
|
background-size: 100% 100%;
|
font-size: 0.24rem;
|
color: #2c2c2c;
|
font-weight: bold;
|
}
|
|
/* ------------------- */
|
|
img {
|
width: 100%;
|
height: 100%;
|
}
|
|
* {
|
box-sizing: border-box;
|
}
|
|
.NavTop {
|
background-color: #0c274c;
|
padding: 15rpx 25rpx;
|
color: #fff !important;
|
|
img {
|
width: 30rpx;
|
height: 30rpx;
|
vertical-align: middle;
|
}
|
|
.NavTopr {
|
img {
|
margin-right: 10rpx;
|
}
|
}
|
}
|
|
.mImage {
|
width: 100%;
|
height: 30rpx;
|
|
img {
|
vertical-align: top;
|
}
|
}
|
|
.Midde {
|
/* background-color: #dbeafd; */
|
background-image: url(@/static/image/yongBg.png);
|
background-size: 100% 100%;
|
color: #000;
|
align-items: flex-start;
|
padding: 0.18rem 0.24rem;
|
|
view {
|
color: #000;
|
}
|
|
.MiddeBack {
|
width: 0.6rem;
|
height: 0.24rem;
|
font-size: 0.12rem;
|
padding: 0;
|
border: 1px solid #9e9e9e;
|
}
|
}
|
|
.yinyong {
|
font-size: 0.12rem;
|
|
img {
|
width: 0.12rem;
|
height: 0.1rem;
|
vertical-align: top;
|
margin-right: 0.03rem;
|
}
|
}
|
|
.el-dialog__wrapper {
|
background: rgba(0, 0, 0, 0.3);
|
}
|
|
.fz {
|
/* line-height: 1.3;
|
height: 100rpx;
|
overflow: hidden;
|
text-overflow: ellipsis;
|
display: -webkit-box;
|
-webkit-line-clamp: 4;
|
-webkit-box-orient: vertical; */
|
color: #2c2c2c;
|
}
|
|
::v-deep .el-card__body {
|
padding: 0.1rem !important;
|
}
|
|
/* echart地图水印 */
|
::v-deep .BMap_cpyCtrl {
|
display: none;
|
}
|
|
::v-deep .anchorBL {
|
display: none;
|
}
|
|
::v-deep .el-tabs__nav-wrap::after {
|
background-color: transparent;
|
}
|
|
::v-deep .el-tabs__nav {
|
margin-bottom: 0.1rem !important;
|
}
|
|
::v-deep .el-tabs__nav-scroll {
|
display: flex;
|
justify-content: center;
|
}
|
|
::v-deep .el-tabs__item {
|
width: 1rem;
|
font-size: 0.14rem;
|
line-height: 0.4rem;
|
height: 0.4rem;
|
}
|
|
::v-deep .el-tabs__header {
|
margin: 0 0 10rpx;
|
}
|
|
::v-deep .el-tabs__active-bar {
|
/* 设置滚动条宽度 */
|
width: 1rem !important;
|
height: 0.03rem !important;
|
background-color: #597aa5;
|
transform: translateX(-20px);
|
/* margin-top: .09rem; */
|
}
|
|
::v-deep .el-tabs__active-bar {
|
top: 0.37rem !important;
|
}
|
|
::v-deep .el-table::before {
|
background-color: #fff !important;
|
}
|
|
.BoxRight ::v-deep.el-card__body {
|
padding: 0.2rem 0.14rem !important;
|
}
|
|
.BoxRight .box-card {
|
margin-bottom: 0.2rem !important;
|
}
|
::v-deep .map-circle-name {
|
width: 20px;
|
height: 20px;
|
border-radius: 50%;
|
background-color: rgb(222, 142, 102);
|
}
|
::v-deep .ripple {
|
border-radius: 50%;
|
position: relative;
|
overflow: hidden;
|
}
|
|
::v-deep .ripple::before {
|
content: "";
|
position: absolute;
|
top: 50%;
|
left: 50%;
|
width: 150%; /* Ensure it covers the entire parent */
|
height: 150%;
|
background: rgba(255, 255, 255, 0.5);
|
border-radius: 50%;
|
transform: translate(-50%, -50%) scale(1);
|
animation: ripple-animation 1s infinite linear;
|
}
|
|
@keyframes ripple-animation {
|
to {
|
transform: translate(-50%, -50%) scale(0);
|
opacity: 0;
|
}
|
}
|
</style>
|