From 4d56b4733adabd8fc3f26d6d583587598aad87db Mon Sep 17 00:00:00 2001 From: YM <479443481@qq.com> Date: 星期一, 22 七月 2024 18:19:54 +0800 Subject: [PATCH] 1 --- src/pages/academicSchools/index.vue | 539 +++++++++++++++++++++++++++++++---------------------------- 1 files changed, 284 insertions(+), 255 deletions(-) diff --git a/src/pages/academicSchools/index.vue b/src/pages/academicSchools/index.vue index 0780a69..f7cb004 100644 --- a/src/pages/academicSchools/index.vue +++ b/src/pages/academicSchools/index.vue @@ -4,30 +4,148 @@ > <headNav :idIndex="'6'" text="瀛︽湳娴佹淳" /> <!-- 楂樼骇鎼滅储 --> - <view style="margin-top: 0.1rem"> + <view + style=" + padding-left: 0.6rem; + margin-top: 0.1rem; + display: flex; + position: relative; + " + > <advancedSearch @onSearch="onSearch" - @onSubmit="onSubmit" - :from="From" placehold="璇疯緭鍏ュ叧閿瓧" + :isAvancedTrue="false" :keyword="searchKey" - :advancedSearchBack="advancedSearchBack" /> + <view + @click="isAvancedClick" + style=" + color: #244a7b; + cursor: pointer; + font-size: 0.12rem; + margin-left: 0.35rem; + line-height: 0.58rem; + " + >楂樼骇鎼滅储 {{ isAdvancedSearch ? "鈭�" : "鈭�" }}</view + > + <!-- 鐑棬鎼滅储 --> + <view class="flex flex-center hotSearch" style="margin-left: 2rem"> + 鐑棬鎼滅储锛� + <ul class="flex" style="margin-right: 10rpx"> + <li + @click="onSearch({ text: item }, index)" + :class="{ cursor: true, active: hotAciveIndex === index }" + v-for="(item, index) in hotKeyList" + :key="item" + > + {{ item.name }} + </li> + </ul> + </view> + <view v-if="isAdvancedSearch" class="searchDialog"> + <h3 style="margin-bottom: 0.2rem">楂樼骇鎼滅储</h3> + <el-form label-width="100px" :model="formData" size="mini"> + <el-row> + <el-col :span="8"> + <el-form-item label="濮撳悕/鍒悕锛�"> + <el-input v-model="formData.name"></el-input> + </el-form-item> + </el-col> + <el-col :span="8"> + <el-form-item label="娲诲姩鍦帮細"> + <el-select + style="width: 100%" + v-model="formData.actively" + placeholder="璇烽�夋嫨娲诲姩鍦�" + > + <!-- <el-option label="鍖哄煙涓�" value="shanghai"></el-option> --> + <!-- <el-option label="鍖哄煙浜�" value="beijing"></el-option> --> + </el-select> + </el-form-item> + </el-col> + <el-col :span="8"> + <el-form-item label="浣滃搧锛�"> + <el-input v-model="formData.works"></el-input> + </el-form-item> + </el-col> + </el-row> + <el-row> + <el-col :span="8"> + <el-form-item label="浜虹墿鏍囩锛�"> + <el-select + style="width: 100%" + v-model="formData.personTags" + placeholder="璇烽�夋嫨浜虹墿鏍囩" + > + <!-- <el-option label="鍖哄煙涓�" value="shanghai"></el-option> --> + <!-- <el-option label="鍖哄煙浜�" value="beijing"></el-option> --> + </el-select> + </el-form-item> + </el-col> + <el-col :span="8"> + <el-form-item label="绀句細韬唤锛�"> + <el-select + style="width: 100%" + v-model="formData.socialIdentity" + placeholder="璇烽�夋嫨绀句細韬唤" + > + <!-- <el-option label="鍖哄煙涓�" value="shanghai"></el-option> --> + <!-- <el-option label="鍖哄煙浜�" value="beijing"></el-option> --> + </el-select> + </el-form-item> + </el-col> + <el-col :span="8"> + <el-form-item label="鏃舵湡锛�"> + <el-select + style="width: 100%" + v-model="formData.period" + placeholder="璇烽�夋嫨鏃舵湡" + > + <!-- <el-option label="鍖哄煙涓�" value="shanghai"></el-option> --> + <!-- <el-option label="鍖哄煙浜�" value="beijing"></el-option> --> + </el-select> + </el-form-item> + </el-col> + </el-row> + </el-form> + <div style="text-align: right"> + <el-button type="primary" size="mini">鎼滅储</el-button> + <el-button size="mini">閲嶇疆</el-button> + </div> + </view> + <div v-if="showPerson" class="personDialog"> + <i + class="el-icon-circle-close closeBtn" + @click=" + () => { + showPerson = false; + } + " + ></i> + <el-table :data="personList" style="width: 100%"> + <el-table-column prop="name" label="濮撳悕"> + <template slot-scope="scope"> + <span + style="color: #409eff; cursor: pointer" + @click=" + () => { + currentId = scope.row.id; + getData(); + } + " + >{{ scope.row.name }}</span + > + </template> + </el-table-column> + <el-table-column prop="age" label="鏃朵唬"> </el-table-column> + <el-table-column prop="nativePlace" label="绫嶈疮"> </el-table-column> + <el-table-column prop="alias" label="鍒悕"> </el-table-column> + <el-table-column prop="division" label="鍖诲鍒嗙"> </el-table-column> + </el-table> + </div> </view> - <!-- 鐑棬鎼滅储 --> - <view class="flex flex-center hotSearch"> - 鐑棬鎼滅储锛� - <ul class="flex" style="margin-right: 10rpx"> - <li - @click="onSearch({ text: item }, index)" - :class="{ cursor: true, active: hotAciveIndex === index }" - v-for="(item, index) in hotKeyList" - :key="item" - > - {{ item }} - </li> - </ul> - </view> + <!-- 鍏崇郴琛ㄥ湴鍥� --> <div id="relation" @@ -59,8 +177,7 @@ font-size: 0.2rem; color: #666; " - > - </div> + ></div> </div> <div id="customDialog" class="customDialog"> <div class="title"> @@ -84,8 +201,10 @@ getPersonData, getHotSearch, getPDataStatistics, + academicSearch } from "@/api/index.js"; import * as echarts from "echarts"; +import MyForm from "@/components/form/form.vue"; export default { data() { return { @@ -96,172 +215,6 @@ nodes: [], // echarts涓よ�呯殑鍏崇郴 relationships: [], - // 楂樼骇鎼滅储 - From: { - from: [ - { - type: "input", - label: "濮撳悕", - name: "name", - value: "", - }, - { - type: "input", - label: "鍒悕", - name: "alias", - value: "", - }, - { - type: "input", - label: "绫嶈疮", - name: "location", - value: "", - }, - { - type: "select", - label: "鑱屼笟", - name: "sdId", - value: "", - options: [ - { - label: "鏈寚鏄�", - value: "UNKNOWN", - }, - ], - }, - { - type: "input", - label: "瀹樿亴", - name: "office", - value: "", - }, - { - type: "select", - label: "鎬у埆", - value: "", - name: "genderTypeEO", - options: [ - { - label: "鏈寚鏄�", - value: "UNKNOWN", - }, - { - label: "鐢�", - value: "MALE", - }, - { - label: "濂�", - value: "WOMAN", - }, - ], - }, - { - type: "input", - label: "鏃舵湡", - name: "period", - value: "", - }, - { - type: "input", - label: "鏈烘瀯", - name: "inst", - value: "", - }, - { - type: "number", - label: "椤电爜", - name: "page", - value: "", - }, - { - type: "number", - label: "椤靛ぇ灏�", - name: "pageSize", - value: "", - }, - ], - }, - // 涓嬮潰鐨勬湞浠�1 - dynastyColor: 1, - // 鏈濅唬 - dynasty: [ - { - name: "澶忔湞", - coord: "2070BC", - id: 1, - }, - { - name: "鍟嗘湞", - id: 2, - coord: "1600BC", - }, - { - name: "瑗垮懆", - id: 3, - coord: "1600BC", - }, - { - name: "鏄ョ鎴樺浗", - id: 4, - coord: "770BC", - }, - { - name: "绉︽湞", - id: 5, - coord: "221BC", - }, - { - name: "姹夋湞", - id: 6, - coord: "202BC", - }, - { - name: "涓夊浗涓ゆ檵鍗楀寳鏈�", - id: 7, - coord: "184", - }, - { - name: "闅嬫湞", - id: 8, - coord: "581", - }, - { - name: "鍞愭湞", - id: 9, - coord: "618", - }, - { - name: "浜斾唬鍗佸浗", - id: 10, - coord: "907", - }, - { - name: "杈藉閲�", - id: 11, - coord: "907", - }, - { - name: "瀹嬫湞", - id: 12, - coord: "960", - }, - { - name: "鍏冩湞", - id: 13, - coord: "1271", - }, - - { - name: "鏄庢湞", - id: 14, - coord: "1368", - }, - { - name: "娓呮湞", - id: 15, - coord: "1636", - }, - ], // 鐑棬鎼滅储 hotKeyList: [], searchKey: "", @@ -275,8 +228,24 @@ // 褰撳墠浜虹墿淇℃伅 ownInfo: null, detailData: { - name: "", + name: "" }, + isAdvancedSearch: false, + formData: { + name: "", + actively: "", + works: "", + personTags: "", + socialIdentity: "", + period: "" + }, + showPerson: false, + personList: [], + personPageInfo: { + totalCount: 0, + page: 1, + limit: 10 + } }; }, mounted() { @@ -285,7 +254,6 @@ this.hotSearch(); // 鐩戝惉绐楀彛澶у皬鍙樺寲 window.addEventListener("resize", this.relation); - this.innt(); }, onLoad(options) { this.searchKey = options.keyword; @@ -307,7 +275,7 @@ parentName: parent?.NAME[0]?.content1 ?? parent.parentName, name2: personInfo?.NAME[0]?.content1, category: type, - symbolSize: order, + symbolSize: 15 }; if (order > 80) { order = 80; @@ -409,7 +377,7 @@ const data = item[str]?.map((e) => { return { ...e, - personId: item.personId, + personId: item.personId }; }); if (data?.length) { @@ -455,7 +423,6 @@ let place = []; let school = []; if (res && res.success && res.object) { - // console.log(res.object); this.infoOfPersons = res.object?.infoOfPersons; this.infoOfSchools = res.object?.infoOfSchools; if (res.object?.personChain) { @@ -549,8 +516,9 @@ ...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); @@ -558,7 +526,7 @@ // const p = personData.filter((item) => item.category == 4); // const s = personData.filter((item) => item.category == 5); // const nodesList = [...k, ...t, ...l, ...o, ...p, ...s]; - // console.log(nodesList); + personData.forEach((item) => { let exists1 = this.nodes.some( (node) => @@ -572,20 +540,20 @@ this.nodes.push({ name: item.parentName, id: item.parentId, - ...item, + ...item }); } if (item.name2 && exists2 !== true) { this.nodes.push({ name: item.name2, id: item.id2, - ...item, + ...item }); } let obj = { source: item.parentName, target: item.name2, - relation: item.relationTypeName || "", // 濡傛灉瀛樺湪 relationName 瀛楁鍒欎娇鐢紝鍚﹀垯涓虹┖瀛楃涓� + relation: item.relationTypeName || "" // 濡傛灉瀛樺湪 relationName 瀛楁鍒欎娇鐢紝鍚﹀垯涓虹┖瀛楃涓� }; this.relationships.push(obj); }); @@ -601,6 +569,23 @@ // 鍋囪鎮ㄦ湁鑺傜偣鍚嶇О鍜屽畠浠箣闂寸殑鍏崇郴鏁版嵁 var nodes = this.deduplicateArray(this.nodes, "id"); var relationships = this.relationships; + + nodes = nodes.map((item) => { + let size = item.symbolSize; + for (let i = 0; i < relationships.length; i++) { + const linkItem = relationships[i]; + if (linkItem.source == item.parentName) { + size += 5; + } + if (linkItem.target == item.parentName) { + size += 5; + } + } + return { + ...item, + symbolSize: size > 80 ? 80 : size + }; + }); let FontSize = 12; // 瀛椾綋澶у皬 let BorderWidth = 2; // 杈规澶у皬 @@ -653,14 +638,16 @@ borderRadius: 30, position: "middle", // 璁剧疆鏍囩鏂囨湰鍦ㄧ嚎鐨勪腑闂翠綅缃笂灞呬腑鏄剧ず // z: -1, // 璁剧疆鏍囩鐨剒杞撮珮搴︼紝浣垮叾姣旇繛鎺ョ嚎鏇撮珮 - distance: -10, // 灏嗘爣绛炬斁缃湪杩炴帴绾夸笂 - }, + distance: -10 // 灏嗘爣绛炬斁缃湪杩炴帴绾夸笂 + } }); } } }); // 鏍规嵁nodes鍔ㄦ�佺敓鎴愯妭鐐规暟鎹� var nodeData = nodes; + console.log(nodeData); + console.log(links); var option; option = { // backgroundColor: { @@ -677,8 +664,8 @@ orient: "vertical", data: this.categories.map(function (a) { return a.name; - }), - }, + }) + } ], series: [ { @@ -693,28 +680,28 @@ 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"); @@ -756,7 +743,7 @@ i += 1; return e["content" + i]; }).join("銆�") ?? "", - biography: data?.BIOGRAPHY ?? "", + biography: data?.BIOGRAPHY ?? "" }; this.detailData = obj; }, @@ -766,41 +753,57 @@ }, // 鍩虹鎼滅储 onSearch(val, index) { + console.log(val); if (index !== undefined) { + // 鐑棬鎼滅储鍏抽敭瀛楋紝鐩存帴鏌ヨ鏁版嵁 this.searchKey = ""; this.hotAciveIndex = index; + this.currentId = val.text.id; + this.getData(); } else { this.hotAciveIndex = ""; + // 鎼滅储鍏堟樉绀轰汉鐗╁垪琛� + this.personPageInfo.page = 1; + this.searchPerson(val.text); } - this.getData(val.text); }, - // 楂樼骇鎼滅储 - onSubmit(val) { - getAdvanceSearch({ - ...val, - page: 1, - pageSize: 100, + // 鏍规嵁鍏抽敭瀛楁绱汉鐗� + searchPerson(key) { + academicSearch({ + keyword: key, + page: this.personPageInfo.page, + pageSize: this.personPageInfo.limit }).then((res) => { - console.log(res, "res"); - }); - }, - advancedSearchBack() { - uni.navigateTo({ - url: "/pages/knowledgeBase/knowledgeBase", - }); - }, - // 鐐瑰嚮涓嬮潰鐨勬湞浠f寜閽� - dynastyBottomClick(item) { - this.dynastyColor = item.id; - this.onSearch({ - text: item.name, + this.personList = res.list.map((item) => { + return { + id: item.personId, + name: item.name, + age: + item.periodList && item.periodList.length + ? item.periodList[0].content2 + : "-", + nativePlace: + item.nativePlaceList && item.nativePlaceList.length + ? item.nativePlaceList[0].content1 + : "-", + alias: + item.aliasList && item.aliasList.length + ? item.aliasList[0].content2 + : "-", + 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鐨勬暟鎹� @@ -822,32 +825,25 @@ const indexList = Object.keys(res.object); indexList.sort((a, b) => parseInt(b) - parseInt(a)); this.hotKeyList = indexList.map((item) => { - return res.object[item]; + return { + id: item, + name: res.object[item] + }; }); }); }, - - // 楂樼骇鎼滅储閲岄潰鑱屼笟鐨勪笅鎷夎彍鍗� - innt() { - getPDataStatistics().then((res) => { - const professionIndex = this.From.from.findIndex( - (field) => field.label === "鑱屼笟" - ); - // 濡傛灉鎵惧埌浜嗚亴涓氬瓧娈� - if (professionIndex !== -1) { - // 灏� profession.list 杞崲涓� options 鏍煎紡 - const options = res.object.occupationStatistic.details.map( - (item) => ({ - label: item.tagName, - value: item.tagId.toString(), // 灏� id 杞崲涓哄瓧绗︿覆锛岀‘淇濅笌 value 绫诲瀷涓�鑷� - }) - ); - // 鏇存柊鑱屼笟瀛楁鐨� options 灞炴�� - this.$set(this.From.from[professionIndex], "options", options); - } - }); - }, - }, + isAvancedClick() { + this.isAdvancedSearch = !this.isAdvancedSearch; + // this.$nextTick(() => { + // var box1Height = document.querySelector(".fbox").offsetHeight; + // // let box2Height= document.querySelector('.fbox1').style.height = box1Height + 'px'; + // let box2Height = document.querySelector(".fbox1").offsetHeight; + // if (box1Height <= box2Height) { + // document.querySelector(".fbox1").style.height = box1Height + "px"; + // } + // }); + } + } }; </script> @@ -856,7 +852,7 @@ width: 100%; height: 100%; position: relative; - background-image: url('../../static/image/characterRelationBg.png'); + background-image: url("../../static/image/characterRelationBg.png"); background-size: 100% 100%; background-repeat: no-repeat; background-position: center; @@ -951,4 +947,37 @@ } } } + +.searchDialog { + position: absolute; + top: 0.68rem; + left: 0; + right: 0; + z-index: 999; + padding: 0.1rem 0.4rem; + background: #fff; + min-height: 2rem; +} + +.personDialog { + position: absolute; + top: 0.68rem; + z-index: 999; + padding: 0.1rem; + background: #fff; + border-radius: 6px; + box-shadow: 0 0 10px -3px #000; + .closeBtn { + position: absolute; + right: -10px; + top: -10px; + width: 24px; + height: 24px; + font-size: 24px; + background-color: #fff; + border-radius: 50%; + color: #f56c6c; + cursor: pointer; + } +} </style> -- Gitblit v1.9.1