Merge branch 'master' of http://182.92.203.7:2001/r/TCM_CharacterLibrary
| | |
| | | getPersonData, |
| | | getHotSearch, |
| | | getPDataStatistics, |
| | | academicSearch |
| | | academicSearch, |
| | | } from "@/api/index.js"; |
| | | import * as echarts from "echarts"; |
| | | import MyForm from "@/components/form/form.vue"; |
| | |
| | | // 当前人物信息 |
| | | ownInfo: null, |
| | | detailData: { |
| | | name: "" |
| | | name: "", |
| | | }, |
| | | isAdvancedSearch: false, |
| | | formData: { |
| | |
| | | personPageInfo: { |
| | | totalCount: 0, |
| | | page: 1, |
| | | limit: 10 |
| | | } |
| | | limit: 10, |
| | | }, |
| | | }; |
| | | }, |
| | | mounted() { |
| | |
| | | const obj = { |
| | | personId: ele.personId, |
| | | parentId: parent.id, |
| | | id2: personInfo.id, |
| | | relationTypeName: ele.relationTypeName, |
| | | parentName: parent?.NAME[0]?.content1 ?? parent.parentName, |
| | | name2: personInfo?.NAME[0]?.content1, |
| | | name: personInfo?.NAME[0]?.content1, |
| | | category: type, |
| | | symbolSize: 15 |
| | | symbolSize: 15, |
| | | }; |
| | | if (order > 80) { |
| | | order = 80; |
| | |
| | | if (!ele.personId && ele.personList?.length) { |
| | | ele.literatureList = []; |
| | | ele.personId = this.ownInfo.id; |
| | | if (ele[str] && ele[str]?.length) { |
| | | for (let j = 0; j < ele.personList.length; j++) { |
| | | const item = ele.personList[j]; |
| | | if (ele["personList"] && ele["personList"]?.length) { |
| | | for (let j = 0; j < ele["personList"].length; j++) { |
| | | const item = ele["personList"][j]; |
| | | const data = item[str]?.map((e) => { |
| | | return { |
| | | ...e, |
| | | personId: item.personId |
| | | personId: item.personId, |
| | | }; |
| | | }); |
| | | if (data?.length) { |
| | | if (ele[str] && data?.length) { |
| | | ele[str].push(...data); |
| | | } |
| | | } |
| | |
| | | } |
| | | return arr; |
| | | }, |
| | | |
| | | // 文献 |
| | | |
| | | //数组去重 |
| | | deduplicateArray(arr, idKey) { |
| | |
| | | if (res && res.success && res.object) { |
| | | this.infoOfPersons = res.object?.infoOfPersons; |
| | | this.infoOfSchools = res.object?.infoOfSchools; |
| | | console.log(res.object); |
| | | if (res.object?.personChain) { |
| | | this.ownInfo = this.infoOfPersons.find( |
| | | (item) => item.id == res.object?.personChain.personId |
| | |
| | | this.categories.push({ name: "活动地" }); |
| | | let newArr = []; |
| | | const data = this.changeLiterature(obj.placeList, "placeList"); |
| | | console.log(data, "place"); |
| | | this.getPersonInfo(data, "placeList", newArr, 1, 4, this.ownInfo); |
| | | place = [...newArr]; |
| | | } |
| | |
| | | ...literature, |
| | | ...social, |
| | | ...place, |
| | | ...school |
| | | ...school, |
| | | ]; |
| | | console.log(personData); |
| | | // const k = personData.filter((item) => item.category == 0); |
| | | // const t = personData.filter((item) => item.category == 1); |
| | | // const l = personData.filter((item) => item.category == 2); |
| | | // const o = personData.filter((item) => item.category == 3); |
| | | // const p = personData.filter((item) => item.category == 4); |
| | | // const s = personData.filter((item) => item.category == 5); |
| | | // const nodesList = [...k, ...t, ...l, ...o, ...p, ...s]; |
| | | |
| | | personData.forEach((item) => { |
| | | let exists1 = this.nodes.some( |
| | | (node) => |
| | | node.id === item.parentId && node.name === item.parentName |
| | | ); |
| | | let exists2 = this.nodes.some( |
| | | (node) => node.id === item.parentId && node.name === item.name2 |
| | | ); |
| | | // 证明不存在 |
| | | if (item.name1 && exists1 !== true) { |
| | | this.nodes.push({ |
| | | name: item.parentName, |
| | | id: item.parentId, |
| | | ...item |
| | | }); |
| | | } |
| | | if (item.name2 && exists2 !== true) { |
| | | this.nodes.push({ |
| | | name: item.name2, |
| | | id: item.id2, |
| | | ...item |
| | | }); |
| | | } |
| | | this.nodes.push({ |
| | | name: item.name, |
| | | id: item.personId, |
| | | ...item, |
| | | }); |
| | | let obj = { |
| | | source: item.parentName, |
| | | target: item.name2, |
| | | relation: item.relationTypeName || "" // 如果存在 relationName 字段则使用,否则为空字符串 |
| | | target: item.name, |
| | | relation: item.relationTypeName || "", // 如果存在 relationName 字段则使用,否则为空字符串 |
| | | }; |
| | | this.relationships.push(obj); |
| | | }); |
| | |
| | | } |
| | | return { |
| | | ...item, |
| | | symbolSize: size > 80 ? 80 : size |
| | | symbolSize: size > 80 ? 80 : size, |
| | | }; |
| | | }); |
| | | |
| | |
| | | var links = []; |
| | | relationships.forEach((relationship, i) => { |
| | | var sourceIndex = nodes.findIndex( |
| | | (node) => node.name === relationship.source |
| | | (node) => node.parentName === relationship.source |
| | | ); |
| | | var targetIndex = nodes.findIndex( |
| | | (node) => node.name === relationship.target |
| | |
| | | borderRadius: 30, |
| | | position: "middle", // 设置标签文本在线的中间位置上居中显示 |
| | | // z: -1, // 设置标签的z轴高度,使其比连接线更高 |
| | | distance: -10 // 将标签放置在连接线上 |
| | | } |
| | | distance: -10, // 将标签放置在连接线上 |
| | | }, |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | // 根据nodes动态生成节点数据 |
| | | var nodeData = nodes; |
| | | console.log(nodeData); |
| | | console.log(links); |
| | | var option; |
| | | option = { |
| | | // backgroundColor: { |
| | |
| | | orient: "vertical", |
| | | data: this.categories.map(function (a) { |
| | | return a.name; |
| | | }) |
| | | } |
| | | }), |
| | | }, |
| | | ], |
| | | series: [ |
| | | { |
| | |
| | | label: { |
| | | show: true, |
| | | position: "right", |
| | | formatter: "{b}" |
| | | formatter: "{b}", |
| | | }, |
| | | scaleLimit: { |
| | | min: 0.4, |
| | | max: 2 |
| | | max: 2, |
| | | }, |
| | | lineStyle: { |
| | | color: "source", |
| | | curveness: 0.2 |
| | | curveness: 0.2, |
| | | }, |
| | | emphasis: { |
| | | focus: "adjacency", |
| | | lineStyle: { |
| | | width: 5 |
| | | } |
| | | width: 5, |
| | | }, |
| | | }, |
| | | force: { |
| | | repulsion: 600, |
| | | edgeLength: 300 |
| | | } |
| | | } |
| | | ] |
| | | edgeLength: 300, |
| | | }, |
| | | }, |
| | | ], |
| | | }; |
| | | // 设置点击事件监听 |
| | | myChart.off("click"); |
| | |
| | | i += 1; |
| | | return e["content" + i]; |
| | | }).join("、") ?? "", |
| | | biography: data?.BIOGRAPHY ?? "" |
| | | biography: data?.BIOGRAPHY ?? "", |
| | | }; |
| | | this.detailData = obj; |
| | | }, |
| | |
| | | academicSearch({ |
| | | keyword: key, |
| | | page: this.personPageInfo.page, |
| | | pageSize: this.personPageInfo.limit |
| | | pageSize: this.personPageInfo.limit, |
| | | }).then((res) => { |
| | | this.personList = res.list.map((item) => { |
| | | return { |
| | |
| | | division: |
| | | item.medicalBranchList && item.medicalBranchList.length |
| | | ? item.medicalBranchList[0].content1 |
| | | : "-" |
| | | : "-", |
| | | }; |
| | | }); |
| | | this.showPerson = true; |
| | |
| | | spaceTimeArr(id) { |
| | | // 关系图的数据 |
| | | uni.navigateTo({ |
| | | url: "/pages/character/detail?id=" + id |
| | | url: "/pages/character/detail?id=" + id, |
| | | }); |
| | | }, |
| | | // 获取朝代echarts的数据 |
| | |
| | | this.hotKeyList = indexList.map((item) => { |
| | | return { |
| | | id: item, |
| | | name: res.object[item] |
| | | name: res.object[item], |
| | | }; |
| | | }); |
| | | }); |
| | |
| | | // document.querySelector(".fbox1").style.height = box1Height + "px"; |
| | | // } |
| | | // }); |
| | | } |
| | | } |
| | | }, |
| | | }, |
| | | }; |
| | | </script> |
| | | |