| | |
| | | <template> |
| | | <view> |
| | | <!-- 顶部 --> |
| | | <headNav idIndex="0" text="中国医学人物知识库" /> |
| | | <headNav idIndex="0" text="中国历代医学人物知识库" /> |
| | | <!-- 搜索 --> |
| | | <view class="flex flex-center Search"> |
| | | <!-- <luanqing-search class="search_bar" @onSearch="onSearch"></luanqing-search> --> |
| | |
| | | class="advancedSea" |
| | | @click="isAvancedClick" |
| | | style="color: #244a7b; cursor: pointer" |
| | | >高级搜索 ﹀</view |
| | | >高级搜索 {{ isAdvancedSearch ? "∧" : "∨" }}</view |
| | | > |
| | | </view> |
| | | <!-- 热门搜索 --> |
| | |
| | | 热门搜索: |
| | | <ul class="flex" style="margin-right: 10rpx"> |
| | | <li |
| | | v-for="item in hot" |
| | | @click="hotSearchClick(item)" |
| | | v-for="(item, index) in hot" |
| | | @click="hotSearchClick(item, index)" |
| | | :key="item.id" |
| | | class="cursor" |
| | | style="color: #5879a4" |
| | | :class="{ cursor: true, active: hotAciveIndex === index }" |
| | | style="color: #244a7b" |
| | | > |
| | | {{ item.name }} |
| | | </li> |
| | |
| | | class="advancedSeaTrue1" |
| | | > |
| | | <h3>高级搜索</h3> |
| | | <MyForm @submit="onSubmit" @reset="resetForm" :from="from" /> |
| | | <MyForm |
| | | @submit=" |
| | | (data) => { |
| | | CurrentPage = 1; |
| | | onSubmit(data); |
| | | } |
| | | " |
| | | @reset="resetForm" |
| | | :from="from" |
| | | /> |
| | | </view> |
| | | </view> |
| | | <uni-row |
| | |
| | | :style="{ |
| | | background: profession.index === item.tagId ? '#d6e3f4' : '', |
| | | borderRadius: profession.index === item.tagId ? '60rpx' : '', |
| | | display: index + 1 > professionIndex ? 'none' : 'flex', |
| | | display: index + 1 > professionIndex ? 'none' : 'flex' |
| | | }" |
| | | v-for="(item, index) in profession.list" |
| | | :key="index" |
| | | style="padding: 0 20rpx; line-height: 0.3rem; height: 0.3rem" |
| | | @click="handInstitCLick(item, 'a')" |
| | | > |
| | | <view class="">{{ item.tagName }}</view> |
| | | <view class="">{{ item.count }}</view> |
| | | <view>{{ item.tagName }}</view> |
| | | <view>{{ item.count }}</view> |
| | | </li> |
| | | </ul> |
| | | <view v-if="profession.list.length - 1 > 3" class="flex flex-center"> |
| | | <view |
| | | class="toggleButton" |
| | | style="color: #c1d3ea" |
| | | style="color: #244a7b" |
| | | @click="shrinkClick('a', '职业')" |
| | | > |
| | | {{ activeBox !== "a" ? "更多 ﹀" : "收起 ︿" }} |
| | | {{ activeBox !== "a" ? "更多 ∨" : "收起 ∧" }} |
| | | </view> |
| | | </view> |
| | | </view> |
| | |
| | | :style="{ |
| | | background: dynasty.index === item.dynastyId ? '#d6e3f4' : '', |
| | | borderRadius: dynasty.index === item.dynastyId ? '60rpx' : '', |
| | | display: index + 1 > dynastyIndex ? 'none' : 'flex', |
| | | display: index + 1 > dynastyIndex ? 'none' : 'flex' |
| | | }" |
| | | v-for="(item, index) in dynasty.list" |
| | | :key="index" |
| | | style="padding: 0 20rpx" |
| | | @click="handInstitCLick(item, 'b')" |
| | | > |
| | | <view class="">{{ item.dynastyName }}</view> |
| | | <view class="">{{ item.count }}</view> |
| | | <view>{{ item.dynastyName }}</view> |
| | | <view>{{ item.count }}</view> |
| | | </li> |
| | | </ul> |
| | | <view v-if="dynasty.list.length - 1 > 3" class="flex flex-center"> |
| | | <view |
| | | class="toggleButton" |
| | | style="color: #c1d3ea" |
| | | style="color: #244a7b" |
| | | @click="shrinkClick('b', '时期')" |
| | | > |
| | | {{ activeBox !== "b" ? "更多 ﹀" : "收起 ︿" }} |
| | | {{ activeBox !== "b" ? "更多 ∨" : "收起 ∧" }} |
| | | </view> |
| | | </view> |
| | | </view> |
| | |
| | | style="padding: 0 20rpx; color: #244a7b" |
| | | @click="handInstitCLick(item, 'c')" |
| | | > |
| | | <view class="">{{ index + 1 + ". " + item.source }}</view> |
| | | <view>{{ index + 1 + ". " + item.source }}</view> |
| | | </li> |
| | | </ul> |
| | | <!-- <view class="flex flex-center"> |
| | | <view class="toggleButton" style="font-size: 25rpx;color: #C1D3EA;" @click="shrinkClick('b')"> |
| | | {{ activeBox !== 'b' ? '更多 ﹀' : '收起 ︿' }} |
| | | {{ activeBox !== 'b' ? '更多 ∨' : '收起 ∧' }} |
| | | </view> |
| | | </view> --> |
| | | </view> |
| | |
| | | " |
| | | > |
| | | <view class="flex lightTop" style="width: 100%; margin: 0.1rem 0"> |
| | | <view class="" style="color: #2c2c2c">共{{ total }}条</view> |
| | | <view style="color: #2c2c2c">共{{ total }}条</view> |
| | | <el-button size="small" @click="exportClick">下载</el-button> |
| | | </view> |
| | | <el-table :data="tableData" class="lightBo" style="width: 100%"> |
| | | <el-table |
| | | :data="tableData" |
| | | class="lightBo" |
| | | style="width: 100%" |
| | | empty-text="暂无搜索信息" |
| | | > |
| | | <el-table-column prop="id" label="序号" width="110"></el-table-column> |
| | | <el-table-column prop="personName" label="姓名"></el-table-column> |
| | | <el-table-column prop="personName" label="姓名"> |
| | | <template slot-scope="scope"> |
| | | <a |
| | | style="cursor: pointer; color: #027edc" |
| | | @click="gotoDetail(scope.row.id)" |
| | | >{{ scope.row.personName }}</a |
| | | > |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="personAlias" label="别名"></el-table-column> |
| | | <el-table-column |
| | | prop="gender" |
| | |
| | | <el-table-column prop="official" label="官职"></el-table-column> |
| | | </el-table> |
| | | <!-- 分页 --> |
| | | <el-row class="fenye" style="position: absolute; bottom: 0.1rem"> |
| | | <el-row class="fenye"> |
| | | <el-pagination |
| | | class="paging flex" |
| | | :current-page="CurrentPage" |
| | |
| | | getPList, |
| | | getHotSearch, |
| | | getPersonList, |
| | | getInstitutionList |
| | | } from "@/api/index.js"; |
| | | export default { |
| | | components: { |
| | | Footer1, |
| | | MyForm, |
| | | MyForm |
| | | }, |
| | | data() { |
| | | return { |
| | | hotAciveIndex: "", |
| | | // 高级搜索显示 |
| | | isAdvancedSearch: false, |
| | | // 高级搜索 |
| | |
| | | type: "input", |
| | | label: "姓名", |
| | | name: "name", |
| | | value: "", |
| | | value: "" |
| | | }, |
| | | { |
| | | type: "input", |
| | | label: "别名", |
| | | name: "alias", |
| | | value: "", |
| | | value: "" |
| | | }, |
| | | { |
| | | type: "input", |
| | | label: "籍贯", |
| | | name: "nativePlace", |
| | | value: "", |
| | | value: "" |
| | | }, |
| | | { |
| | | type: "select", |
| | |
| | | options: [ |
| | | { |
| | | label: "医家", |
| | | value: "1", |
| | | value: "1" |
| | | }, |
| | | { |
| | | label: "世家", |
| | | value: "2", |
| | | }, |
| | | ], |
| | | value: "2" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | type: "input", |
| | | label: "职官", |
| | | name: "official", |
| | | value: "", |
| | | }, |
| | | // { |
| | | // type: "input", |
| | | // label: "职官", |
| | | // name: "official", |
| | | // value: "" |
| | | // }, |
| | | { |
| | | type: "select", |
| | | label: "性别", |
| | |
| | | options: [ |
| | | { |
| | | label: "未指明", |
| | | value: "UNKNOWN", |
| | | value: "UNKNOWN" |
| | | }, |
| | | { |
| | | label: "男", |
| | | value: "MALE", |
| | | value: "MALE" |
| | | }, |
| | | { |
| | | label: "女", |
| | | value: "WOMAN", |
| | | }, |
| | | ], |
| | | value: "WOMAN" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | type: "input", |
| | | label: "时期", |
| | | name: "dynasty", |
| | | value: "", |
| | | }, |
| | | { |
| | | type: "input", |
| | | label: "机构", |
| | | name: "institution", |
| | | value: "", |
| | | }, |
| | | ], |
| | | value: "" |
| | | } |
| | | // { |
| | | // type: "select", |
| | | // label: "机构", |
| | | // name: "institution", |
| | | // options: [] |
| | | // } |
| | | ] |
| | | }, |
| | | |
| | | // 热门搜索 |
| | |
| | | title: "职业", |
| | | index: 0, |
| | | id: 0, |
| | | list: [], |
| | | list: [] |
| | | }, |
| | | // 现在多少条职业数据 |
| | | professionIndex: 4, |
| | |
| | | title: "时期", |
| | | id: "", |
| | | index: "", |
| | | list: [], |
| | | list: [] |
| | | }, |
| | | // 现在多少条时期数据 |
| | | dynastyIndex: 4, |
| | |
| | | title: "来源", |
| | | index: 0, |
| | | id: 0, |
| | | list: [], |
| | | list: [] |
| | | }, |
| | | // 表格的数组 |
| | | tableData: [], |
| | | // 分页的总数 |
| | | total: 100, |
| | | total: 0, |
| | | // 当前页 |
| | | CurrentPage: 1, |
| | | // 一页显示多少条数据 |
| | |
| | | nativePlace: "", |
| | | tagId: "", |
| | | official: "", |
| | | genderType: "", |
| | | genderType: "" |
| | | }, |
| | | aSearchData: "" |
| | | }; |
| | | }, |
| | | onLoad(options) { |
| | | this.onSearch({ text: options.name }); |
| | | this.keywords = options.name; |
| | | if (options.isAdvancedSearch && options.isAdvancedSearch == "1") { |
| | | this.isAdvancedSearch = true; |
| | | } |
| | | if (options.official) { |
| | | if (options.official) { |
| | | this.from.from[ |
| | | this.from.from.findIndex((item) => item.name == "official") |
| | | ].value = options.official; |
| | | } |
| | | |
| | | const result = this.from.from.reduce((obj, item) => { |
| | | obj[item.name] = item.value; |
| | | return obj; |
| | | }, {}); |
| | | // 提交逻辑 |
| | | this.onSubmit(result); |
| | | } else { |
| | | if (options.dynasty) { |
| | | this.dynasty.index = Number(options.dynasty); |
| | | this.dynasty.id = Number(options.dynasty); |
| | | } |
| | | this.onSearch({ text: options.keyword }); |
| | | } |
| | | }, |
| | | mounted() { |
| | | // 修改两次的高度保持一致 |
| | | var box1Height = document.querySelector(".fbox2").offsetHeight; |
| | | document.querySelector(".fbox3").style.height = |
| | | box1Height + box1Height / 18 + "px"; |
| | | console.log(box1Height, "box1Height"); |
| | | this.getStatistics(); |
| | | // 默认先调用搜索一次 |
| | | this.onSearch(""); |
| | | this.institutionList(); |
| | | }, |
| | | methods: { |
| | | institutionList() { |
| | | getInstitutionList().then((res) => { |
| | | this.$set( |
| | | this.from.from[ |
| | | this.from.from.findIndex((item) => item.name == "institution") |
| | | ], |
| | | "options", |
| | | res.list.map((item) => { |
| | | return { |
| | | label: item.name, |
| | | value: item.id |
| | | }; |
| | | }) |
| | | ); |
| | | |
| | | console.log(this.from.from); |
| | | }); |
| | | }, |
| | | //重置搜索结果 |
| | | resetForm() { |
| | | this.tableData = []; |
| | | this.onSearch(""); |
| | | }, |
| | | // ExportJsonExcel实例 |
| | | Ture() { |
| | |
| | | // 下载按钮 |
| | | async exportClick() { |
| | | const dataList = this.tableData; |
| | | console.log(this.keywords, "keywords"); |
| | | let Obj = { |
| | | keywords: "楊", //搜索框检索 |
| | | keywords: "", //搜索框检索 |
| | | // keywords: this.keywords, //搜索框检索 |
| | | name: this.submitData.name, //姓名 |
| | | alias: this.submitData.alias, //别名 |
| | |
| | | institution: "", //机构 |
| | | bookId: null, //来源id |
| | | page: 1, |
| | | pageSize: 1, |
| | | pageSize: 1 |
| | | }; |
| | | console.log(Obj, "Obj"); |
| | | // // 搜索 |
| | | await getPDownload(Obj).then((res) => { |
| | | console.log(res, "exportClick"); |
| | | // if (res.success) { |
| | | // console.log(res, "搜索接口"); |
| | | // this.tableData = res.list; |
| | | // // 总数量 |
| | | // this.total = res.npage.totalCount; |
| | |
| | | 卒年: dataList[i].deathYear, |
| | | 籍贯: dataList[i].nativePlace, |
| | | 社会身份: dataList[i].socialDistinction, |
| | | 官职: dataList[i].official, |
| | | 官职: dataList[i].official |
| | | }; |
| | | |
| | | dataTable.push(obj); // 设置excel每列获取的数据源 |
| | |
| | | "卒年", |
| | | "籍贯", |
| | | "社会身份", |
| | | "官职", |
| | | "官职" |
| | | ], |
| | | // excel文件列名 |
| | | sheetFilter: [ |
| | |
| | | "卒年", |
| | | "籍贯", |
| | | "社会身份", |
| | | "官职", |
| | | ], |
| | | "官职" |
| | | ] |
| | | // columnWidths: ['10', '10', '20'] //excel列宽度设置 |
| | | }, |
| | | } |
| | | ]; |
| | | this.Ture(); |
| | | }, |
| | | // 接口 |
| | | async getStatistics() { |
| | | getStatistics() { |
| | | // 热门搜索 |
| | | await getHotSearch().then((res) => { |
| | | console.log(res, "热门搜索"); |
| | | getHotSearch().then((res) => { |
| | | this.hot = Object.keys(res.object).map((key) => { |
| | | return { |
| | | id: parseInt(key), |
| | | name: res.object[key], |
| | | name: res.object[key] |
| | | }; |
| | | }); |
| | | }); |
| | | // 右侧职业、时期、来源的数据 |
| | | await getPDataStatistics().then((res) => { |
| | | console.log(res, "接口成功sdsdfsdsfs"); |
| | | getPDataStatistics().then((res) => { |
| | | let totalCount1 = res.object.occupationStatistic.details.reduce( |
| | | (total, item) => total + item.count, |
| | | 0 |
| | |
| | | // 职业 |
| | | this.profession.list = [ |
| | | { count: totalCount1, tagName: "全部", tagId: 0 }, |
| | | ...res.object.occupationStatistic.details, |
| | | ...res.object.occupationStatistic.details |
| | | ]; |
| | | // 高级搜索里面的职业-------------------------------------------------- |
| | | // 找到职业字段在 from 对象中的索引 |
| | |
| | | // 将 profession.list 转换为 options 格式 |
| | | const options = this.profession.list.map((item) => ({ |
| | | label: item.tagName, |
| | | value: item.tagId.toString(), // 将 id 转换为字符串,确保与 value 类型一致 |
| | | value: item.tagId.toString() // 将 id 转换为字符串,确保与 value 类型一致 |
| | | })); |
| | | |
| | | // 更新职业字段的 options 属性 |
| | |
| | | // 时期 |
| | | this.dynasty.list = [ |
| | | { count: totalCount2, dynastyName: "全部", dynastyId: "" }, |
| | | ...res.object.dynastyStatistic.details, |
| | | ...res.object.dynastyStatistic.details |
| | | ]; |
| | | // 来源 |
| | | this.source.list = res.object.sourceStatistic.details; |
| | | this.source.index = this.source.list[0].bookId; |
| | | }); |
| | | }, |
| | | gotoDetail(id) { |
| | | uni.navigateTo({ |
| | | url: "/pages/character/detail?id=" + id |
| | | }); |
| | | }, |
| | | // 热门搜索 |
| | | hotSearchClick(item) { |
| | | this.onSearch({ text: item.name }); |
| | | console.log(item, "热门搜索"); |
| | | hotSearchClick(item, index) { |
| | | this.onSearch({ text: item.name }, index); |
| | | }, |
| | | // 左侧的机构统计等等按钮 |
| | | handInstitCLick(item, name) { |
| | |
| | | this.dynasty.index = item.dynastyId; |
| | | this.dynasty.id = item.dynastyId; |
| | | this.CurrentPage = 1; |
| | | console.log(item); |
| | | } else if (name == "c") { |
| | | this.source.index = item.bookId; |
| | | this.source.id = item.bookId; |
| | | this.CurrentPage = 1; |
| | | console.log("来源"); |
| | | } |
| | | this.onSearch(""); |
| | | |
| | | console.log(item, name); |
| | | }, |
| | | isAvancedClick() { |
| | | this.isAdvancedSearch = !this.isAdvancedSearch; |
| | |
| | | document.querySelector(".fbox1").style.height = box1Height + "px"; |
| | | } |
| | | }); |
| | | if (this.isAdvancedSearch) { |
| | | this.keywords = ""; |
| | | this.CurrentPage = 1; |
| | | } |
| | | }, |
| | | // 高级搜索 |
| | | async onSubmit(val) { |
| | | console.log(val); |
| | | this.keywords = ""; |
| | | this.hotAciveIndex = ""; |
| | | this.aSearchData = val; |
| | | this.profession.index = Number(val.tagId); |
| | | this.profession.id = Number(val.tagId); |
| | | const currentDynasty = this.dynasty.list.find( |
| | |
| | | this.dynasty.id = currentDynasty.dynastyId; |
| | | } |
| | | this.submitData = val; |
| | | this.CurrentPage = 1; |
| | | |
| | | let Obj = { |
| | | keywords: "", //搜索框检索 |
| | | name: val.name, //姓名 |
| | |
| | | dynasty: val.dynasty, //朝代id |
| | | dynastyId: this.dynasty.id, //朝代id |
| | | institution: val.institution, //机构 |
| | | bookId: null, //来源id |
| | | page: this.CurrentPage, |
| | | pageSize: this.pageSize, |
| | | pageSize: this.pageSize |
| | | }; |
| | | // // 搜索 |
| | | await getPersonList(Obj).then((res) => { |
| | | console.log(res); |
| | | if (res.success) { |
| | | console.log(res, "搜索接口"); |
| | | this.tableData = res.list; |
| | | // 总数量 |
| | | this.total = res.npage.totalCount; |
| | | } |
| | | }); |
| | | console.log(val); |
| | | }, |
| | | // 基础搜索 |
| | | async onSearch(val) { |
| | | async onSearch(val, index) { |
| | | this.keywords = val.text; |
| | | this.aSearchData = ""; |
| | | if (index !== undefined) { |
| | | this.keywords = ""; |
| | | this.hotAciveIndex = index; |
| | | } else { |
| | | this.hotAciveIndex = ""; |
| | | } |
| | | let Obj = { |
| | | keywords: val.text, //搜索框检索 |
| | | name: "", //姓名 |
| | |
| | | institution: "", //机构 |
| | | bookId: this.source.id, //来源id |
| | | page: this.CurrentPage, |
| | | pageSize: this.pageSize, |
| | | pageSize: this.pageSize |
| | | }; |
| | | // // 搜索 |
| | | await getPersonList(Obj).then((res) => { |
| | | if (res.success) { |
| | | console.log(res, "搜索接口"); |
| | | this.tableData = res.list; |
| | | // 总数量 |
| | | this.total = res.npage.totalCount; |
| | | } |
| | | }); |
| | | // console.log(val, '士大夫但是'); |
| | | }, |
| | | // 热门搜索 |
| | | HotClick(id) { |
| | | this.hot.forEach((item) => { |
| | | if (item.id === id) { |
| | | console.log(item.id === id); |
| | | item.bgColor = true; |
| | | } else { |
| | | console.log(item.id === id); |
| | | item.bgColor = false; |
| | | } |
| | | }); |
| | | }, |
| | | // 展开收缩 |
| | | shrinkClick(box, name) { |
| | | console.log(box); |
| | | console.log(this.dynasty.list); |
| | | |
| | | // this.activeBox = this.activeBox === 'a' ? null : 'a'; |
| | | if (name == "职业") { |
| | | console.log("职业"); |
| | | this.professionIndex = |
| | | this.professionIndex < this.profession.list.length |
| | | ? this.profession.list.length |
| | |
| | | this.dynastyIndex = 4; |
| | | this.activeBox = this.activeBox === "a" ? null : "a"; |
| | | } else { |
| | | console.log("时期"); |
| | | this.dynastyIndex = |
| | | this.dynastyIndex < this.dynasty.list.length |
| | | ? this.dynasty.list.length |
| | |
| | | CurrentChange(val) { |
| | | if (this.CurrentPage != val) { |
| | | this.CurrentPage = val; |
| | | console.log("当前页", val); |
| | | this.onSearch(""); |
| | | if (this.isAdvancedSearch) { |
| | | this.onSubmit(this.aSearchData); |
| | | } else { |
| | | this.onSearch({ text: this.keywords }); |
| | | } |
| | | } |
| | | }, |
| | | // 上一页 |
| | | PrevClick(val) { |
| | | if (this.CurrentPage != val) { |
| | | this.CurrentPage = val; |
| | | // console.log('上一页', val); |
| | | // console.log(this.CurrentPage); |
| | | this.onSearch(""); |
| | | if (this.isAdvancedSearch) { |
| | | this.onSubmit(this.aSearchData); |
| | | } else { |
| | | this.onSearch({ text: this.keywords }); |
| | | } |
| | | } |
| | | }, |
| | | // 下一页 |
| | | NextClick(val) { |
| | | if (this.CurrentPage != val) { |
| | | // console.log('下一页',val); |
| | | this.CurrentPage = val; |
| | | // console.log(this.CurrentPage); |
| | | this.onSearch(""); |
| | | if (this.isAdvancedSearch) { |
| | | this.onSubmit(this.aSearchData); |
| | | } else { |
| | | this.onSearch({ text: this.keywords }); |
| | | } |
| | | } |
| | | }, |
| | | }, |
| | | } |
| | | } |
| | | }; |
| | | </script> |
| | | |
| | |
| | | |
| | | .lightBo { |
| | | font-size: 0.14rem !important; |
| | | |
| | | .is-leaf { |
| | | background-color: #c1d3ea !important; |
| | | color: #2c2c2c !important; |
| | | font-weight: 400; |
| | | |
| | | .cell { |
| | | height: 0.3rem !important; |
| | | line-height: 0.3rem !important; |
| | | } |
| | | } |
| | | } |
| | | |
| | | .el-table__body-wrapper { |
| | | .el-table__row { |
| | | height: 0.46rem !important; |
| | | line-height: 0.46rem !important; |
| | | .lightBo .is-leaf { |
| | | background-color: #c1d3ea !important; |
| | | color: #2c2c2c !important; |
| | | font-weight: 400; |
| | | } |
| | | |
| | | .cell { |
| | | height: 0.3rem !important; |
| | | line-height: 0.3rem !important; |
| | | } |
| | | } |
| | | .lightBo .is-leaf .cell { |
| | | height: 0.3rem !important; |
| | | line-height: 0.3rem !important; |
| | | } |
| | | |
| | | .el-table__body-wrapper .el-table__row { |
| | | height: 0.46rem !important; |
| | | line-height: 0.46rem !important; |
| | | } |
| | | .el-table__body-wrapper .el-table__row .cell { |
| | | height: 0.3rem !important; |
| | | line-height: 0.3rem !important; |
| | | } |
| | | } |
| | | |
| | |
| | | li { |
| | | font-size: 0.12rem; |
| | | margin: 0 0.1rem; |
| | | &.active { |
| | | color: #027edc !important; |
| | | font-weight: bold; |
| | | } |
| | | } |
| | | } |
| | | |