<template>
  <div class="search-page wrap">
    <!-- <Header></Header> -->

    <!-- 头部开始 -->
    <div class="header pc">
    <div class="inner">
        <div class="fl header_l">
            <a class="fl" target="_blank"><img src="../../assets/img/logo.png" alt=""></a>
            <div class="header_nav fl">
              <ul>
                <li @click="openSearchPage()" >全文检索</li>
                <li @click="openCollectionPage()">我的收藏</li>
              </ul>
            </div>
            <div class="header_user fr">
              <ul>
                <li class="header_nav_a">{{nickname}}</li>
              </ul>
            </div>
        </div>
        <div class="header_r fl">

        </div>

    </div>

    </div>

    <!-- 头部结束 -->
    <div class="pc pcwrap">
      <div class="inner">
        <div class="contain">
            <div class="cont_wrap">
                <div class="left_cont_nav fl">
                  <div  class="left_cont_nav_bigtit" >分析结果</div>
                  <div class="left_cont_nav_bigtit_list">
                    <ul>

                    <li  :class="{on:0== msgLXNameIndex}"  @click="hover_li(0)"><a style="cursor:pointer;">文本分类</a></li>
                    <li  :class="{on:1== msgLXNameIndex}"  @click="hover_li(1)"><a style="cursor:pointer;">实体分类</a></li>
                    <li  :class="{on:2== msgLXNameIndex}"  @click="hover_li(2)"><a style="cursor:pointer;">文本摘要</a></li>
                    <li  :class="{on:3== msgLXNameIndex}"  @click="hover_li(3)"><a style="cursor:pointer;">关键字提取</a></li>
                    <li  :class="{on:4== msgLXNameIndex}"  @click="hover_li(4)"><a style="cursor:pointer;">地域识别</a></li>
                    <li v-if="sjcqListShow" :class="{on:5== msgLXNameIndex}"  @click="hover_li(5)"><a style="cursor:pointer;" >事件抽取</a></li>
                    <li v-if="gxcqListShow" :class="{on:6== msgLXNameIndex}"  @click="hover_li(6)"><a style="cursor:pointer;" >关系抽取</a></li>
                    </ul>
                  </div>
                </div>
                <div class="search_cont_wrap search_cont_wrap_detail fr">
                    <div class="right_cont right_cont_detail">
                      <!-- 文本分类开始 -->
                      <div class="right_cont_detail_1" id="model_0">
                        <div class="right_cont_detail_tit">文本分类</div>
                        <div class="right_cont_detail_cont">
                          <ul>

                            <li v-for="(item,index) in msgNameList" :key="index"  :class="{on:item.label == msgName}"  >{{item.value}}</li>

                          </ul>
                        </div>
                      </div>
                      <!-- 文本分类结束 -->
                      <!-- 实体分类开始 -->
                      <div class="right_cont_detail_2" id="model_1">
                        <div class="right_cont_detail_tit">实体分类</div>
                        <div class="right_cont_detail_cont">
                          <!-- 相关人物实体 -->
                          <div class="wordCloud_block wordCloud_block1">
                            <h1>相关人物实体</h1>
                            <!-- <div id="wordCloud1" style="width:100%;height:300px;"></div> -->
                            <word-cloud :data="wordData1"  size="[300, 400]"
                                nameKey="word"
                                rotation="random"
                                shape="circle"
                                wait="true" />
                          </div>
                          <!-- 相关机构 -->
                          <div class="wordCloud_block wordCloud_block1">
                            <h1>相关机构</h1>
                            <!-- <div id="wordCloud2" style="width:100%;height:300px;"></div> -->
                            <word-cloud :data="wordData2"  size="[300, 400]"
                                nameKey="word"
                                rotation="random"
                                shape="circle"
                                wait="true" />
                          </div>
                          <!-- 相关地域 -->
                          <div class="wordCloud_block wordCloud_block1">
                            <h1>相关地域</h1>
                            <!-- <div id="wordCloud3" style="width:100%;height:300px;"></div> -->
                            <word-cloud :data="wordData3"  size="[300, 400]"
                                nameKey="word"
                                rotation="random"
                                shape="circle"
                                wait="true" />
                          </div>
                          <!-- 词云结束 -->
                        </div>
                      </div>
                      <!-- 实体分类结束 -->
                      <!-- 文本摘要开始 -->
                      <div class="right_cont_detail_3" id="model_2">
                        <div class="right_cont_detail_tit">文本摘要</div>
                        <div class="right_cont_detail_cont">
                          <div class="right_cont_detail_cont_wb" >
                            {{this.msgwbzy}}
                          </div>
                        </div>
                      </div>
                      <!-- 文本摘要结束 -->
                      <!-- 关键字提取开始 -->
                      <div class="right_cont_detail_4" id="model_3">
                        <div class="right_cont_detail_tit">关键字提取</div>
                        <div class="right_cont_detail_cont">
                          <!-- 左边内容开始 -->
                          <div class="right_cont_detail_cont_l fl">
                            <word-cloud :data="wordData"  size="[800, 400]"
                                nameKey="word"
                                rotation="random"
                                shape="circle"
                                wait="true" />
                          </div>
                          <!-- 左边内容结束 -->
                          <!-- 右边说明开始 -->
                          <div class="right_cont_detail_cont_r fr">
                            <div class="right_cont_detail_cont_r_tit">关键词提取说明:</div>
                            <div class="right_cont_detail_cont_r_cont">
                              关键词提取是对文本内容进行主题分析，在准确提炼和选定反应文本主题的关键词基础上，生成文本的一组题词标识。文字的大小代表了关键词的权重。
                            </div>
                          </div>
                          <!-- 右边说明开始 -->
                        </div>
                      </div>
                      <!-- 关键字提取结束 -->
                      <!-- 地域识别开始 -->
                      <div class="right_cont_detail_5" id="model_4">
                        <div class="right_cont_detail_tit">地域识别</div>
                        <div class="right_cont_detail_cont">
                          <!-- 左边内容开始 -->
                          <div class="right_cont_detail_cont_l right_cont_detail_cont_l_dysb fl">
                            <table>
                              <tr>
                                <th class="th1">序号</th>
                                <th class="th2">地点</th>
                              </tr>
                              <tr  v-for="(item,index) in msgdysbList" :key="index" :class="{'active':index%2 != 1}"  >
                                <td class="td1" >{{index + 1 }}</td>
                                <td class="td2" >{{item.cat}}</td>
                              </tr>
                            </table>
                          </div>
                          <!-- 左边内容结束 -->
                          <!-- 右边说明开始 -->
                          <div class="right_cont_detail_cont_r fr">
                            <div class="right_cont_detail_cont_r_tit">地域识别抽取说明:</div>
                            <div class="right_cont_detail_cont_r_cont">
                              抽取地域信息
                            </div>
                          </div>
                          <!-- 右边说明开始 -->
                        </div>
                      </div>
                      <!-- 地域识别结束 -->
                      <!-- 事件抽取开始 -->
                      <div  v-if="sjcqListShow"  class="right_cont_detail_5" id="model_4">
                        <div  class="right_cont_detail_tit">事件抽取</div>
                        <div class="right_cont_detail_cont">
                          <!-- 左边内容开始 -->
                          <div class="right_cont_detail_cont_l right_cont_detail_cont_l_dysb fl">

                            <!-- <table v-for="(item,index) in msgsjcqList"  :key="index" > -->
                            <table  >

                              <tr>
                                <th class="th1">项目</th>
                                <th class="th2">值</th>
                              </tr>
                              <tr  v-for="(item,index) in msgsjcqList"  :key="index"  :class="{'active':index%2 != 1}"  >
                                <td class="td1" >{{item.tagType }}</td>
                                <td class="td2"  >{{item.word}}</td>
                              </tr>
                              <!-- <tr class="active">
                                <td class="td1" >所在句子</td>
                                <td class="td2"  >{{item[index].sentence}}</td>
                              </tr>
                              <tr >
                                <td class="td1" >事件描述</td>
                                <td class="td2"  >{{}}</td>
                              </tr>
                              <tr class="active">
                                <td class="td1" >相关人物</td>
                                <td class="td2"  >{{}}</td>
                              </tr>
                              <tr>
                                <td class="td1" >事件动词描述</td>
                                <td class="td2"  >{{}}</td>
                              </tr>
                              <tr class="active">
                                <td class="td1" >事件动词</td>
                                <td class="td2"  >{{}}</td>
                              </tr>
                              <tr>
                                <td class="td1" >发生时间</td>
                                <td class="td2"  >{{}}</td>
                              </tr>
                              <tr class="active">
                                <td class="td1" >发生时间</td>
                                <td class="td2" >{{}}</td>
                              </tr>
                              <tr>
                                <td class="td1" >施事者</td>
                                <td class="td2" >{{}}</td>
                              </tr> -->
                            </table>

                          </div>
                          <!-- 左边内容结束 -->
                          <!-- 右边说明开始 -->
                          <div class="right_cont_detail_cont_r fr">
                            <div class="right_cont_detail_cont_r_tit">事件抽取说明:</div>
                            <div class="right_cont_detail_cont_r_cont">
                              抽取事件名称、事件主体、事件类型、事件客体、言论内容、事发时间、事发地点、相关人物、相关地区
                            </div>
                          </div>
                          <!-- 右边说明开始 -->
                        </div>
                      </div>
                      <!-- 事件抽取结束 -->
                      <!-- 关系抽取开始 -->
                      <div  v-if="gxcqListShow" class="right_cont_detail_5" id="model_4">
                        <div class="right_cont_detail_tit">关系抽取</div>
                        <div class="right_cont_detail_cont">
                          <!-- 左边内容开始 -->
                          <div  class="right_cont_detail_cont_l right_cont_detail_cont_l_dysb fl">
                            <div  v-for="(item,index) in msggxcq1List"  :key="index"   >
                              <table>
                                <tr>
                                  <th class="th1">项目</th>
                                  <th class="th2">值</th>
                                </tr>
                                <tr class="active"  >
                                  <td class="td1">实体</td>
                                  <td class="td2">{{item.entity}}</td>
                                </tr>
                                <tr>
                                  <td class="td1">实体</td>
                                  <td class="td2">{{item.feature}}</td>
                                </tr>
                                <tr   class="active" >
                                  <td class="td1">关系</td>
                                  <td class="td2">{{item.relationship}}</td>
                                </tr>
                                                                <tr   >
                                  <td class="td1">句子</td>
                                  <td class="td2">{{item.sen}}</td>
                                </tr>
                              </table>
                            </div>


                          </div>
                          <!-- 左边内容结束 -->

                          <!-- 右边说明开始 -->
                          <div class="right_cont_detail_cont_r fr">
                            <div class="right_cont_detail_cont_r_tit">关系抽取说明:</div>
                            <div class="right_cont_detail_cont_r_cont">
                              抽取人物、属性、关系
                            </div>
                          </div>
                          <!-- 右边说明开始 -->
                        </div>
                      </div>
                      <!-- 关系抽取结束 -->
                    </div>
                </div>

            </div>
        </div>
      </div>
    </div>

    <Footer></Footer>
        <!-- <DigFtpSourceForm ref="formRef" @success="getList" /> -->
  </div>
</template>

<script>
// import Header from './header.vue';
import WordCloud from 'vue-wordcloud';
import * as echarts from 'echarts';
import Footer from './footer.vue';
import _ from "lodash";
import * as searchPageApi from '@/api/manager/digsearch';
// import DigFtpSourceForm from './DigFtpSourceForm.vue';
import $ from 'jquery';
import { data } from 'jquery';

// import axios from 'axios'




export default {
  name: "SearchPage",
  components: {
    WordCloud,
    Footer,
    // DigFtpSourceForm
    // Header
  },

  data() {
    return {
      detailDataText:[],
      detailData: null, // 用来存储从父窗口传递的数据
      // nickname
      nickname: '',
      // 词云1
      poparray1: [
        //气泡图的数据，label是字，amount是大小
        { label: "白xx", amount: 100 },
        { label: "沈望", amount: 70 },
        { label: "云泽", amount: 30 },
        { label: "李莉", amount: 50 },
        { label: "张敏", amount: 70 },
      ],
      // 词云2
      poparray2: [
        //气泡图的数据，label是字，amount是大小
        { label: "公安局", amount: 100 },
        { label: "刑警队", amount: 70 },
        { label: "住建局", amount: 30 },
        { label: "派出所", amount: 50 },
        { label: "办公厅", amount: 70 },
      ],
      // 词云3
      poparray3: [
        //气泡图的数据，label是字，amount是大小
        { label: "中国", amount: 100 },
        { label: "内蒙古", amount: 70 },
        { label: "天津", amount: 30 },
        { label: "上海", amount: 50 },
        { label: "北京", amount: 70 },
        { label: "山东", amount: 10 },
      ],
      searchQuery: "",
      results: [],
      selectedItems:[],
      queryParams: {
        keyword: "",
        navigation: {
          sourcename: [],
          file_type: [],
          language: [],
          doc_lable: [],
          file_year:[]
        },
        sort:{
          // RELEVANCE:'desc'
        },
        sourcename: [],
        language: "",
        selectedYear: "",
        pageNo: 1,
        pageSize: 10,
        advField: [], // 搜索字段
        fieldType: [], // 字段类型
        connect: [], // 逻辑运算符
        advValue: [], // 搜索值
        type: 1,
      },
      advancedQuery: {
        keyword: "",
        and: "", // 包含所有以下词语（AND）条件
        or: "", // 包含任意以下词语（OR）条件
        not: "", // 不包含以下词语（NOT）条件
      },
      msgwbzy:"",
      availableYears: Array.from({ length: 20 }, (_, i) => new Date().getFullYear() - i),
      loading: false,
      showAdvancedSearch: false,
      showSecondarySearch: false,
      showBatchSearch: false,
      totalResultsCount: 0,      // 总结果数，用于计算分页
      currentPage: 1,            // 当前页码
      itemsPerPage: 6,          // 每页显示条目数
      detailData:'',//详情页内容
      sjcqListShow:true,
      gxcqListShow:true,
      downloadShow: true,
        msgLXNameIndex: 0,
        msgLXNameList:[
                    {
            label:'文本分类',
            value:'文本分类'
          },
          {
            label: '实体分类',
            value: '实体分类'
          }
          ,
          {
            label: '文本摘要',
            value: '文本摘要'
          }
          ,
          {
            label: '关键字提取',
            value: '关键字提取'
          }
          ,
          {
            label: '地域识别',
            value: '地域识别'
          }

          ,
          {
            label: '事件抽取',
            value: '事件抽取'
          }
          ,
          {
            label: '关系抽取',
            value: '关系抽取'
          }

      ],
        msgName: "军事",
        msgNameList:[

          {
          label: '军事',
          value: '军事'
        }
        ,
        {
          label: '时政',
          value: '政治'
        }
        ,
        {
          label: '财经',
          value: '经济'
        }
        ,
        {
          label: '国际',
          value: '外交'
        }

        ,
        {
          label: '健康',
          value: '安全'
        }
        ,
        {
          label: '科技',
          value: '科技'
        }
/*        ,
        {
          label: '文教',
          value: '宗教'
        }*/
        ,
        {
          label: '文教',
          value: '宗教'
        }
        ,
        {
          label: '其他',
          value: '其他'
        }
      ],
      // 普通词云
      wordData: [
        // { word: '习近平', value: 60 },
        // { word: '林少右', value: 60 },
        // { word: '绍骋', value: 40 },
        // { word: '自治区党委', value: 40 },
        // { word: '人民政协', value: 30 },
        // { word: '国务院', value: 30 },
        // { word: '呼和浩特市', value: 20 },
        // { word: '内蒙古自治区', value: 20 },
        // { word: '张韶春', value: 10 },
        // { word: '艾丽华', value: 10 }
      ],
      wordData1: [],
      wordData2: [],
      wordData3: [],
      // randomDark: ['#1f77b4', '#ff7f0e', '#2ca02c', '#d62728'],
      msgdysbList:[
        // {label: '1', value: '中国/湖南省/怀化市/中方县'},
        // {label: '2', value: '中国/甘肃省/甘南藏族自治州/合作市'},
        // {label: '3', value: '美洲/南美洲/阿根廷'},
      ],
      msgsjcqList:[
        // {label: '所在句子', value: '习近平主席特使、全国人大常委会副委员长艾力更·依明巴海 2019年12月10日在阿根廷首都布宜诺斯艾利斯出席阿新总统就职仪式，并于 9日会见新任总统费尔南德斯。'},
        // {label: '事件描述', value: '特使、全国人大常委会副委员长、艾力更·依明巴海出席阿新总统就职仪式'},
        // {label: '相关人物', value: '习近平; 艾力更·依明巴海;费尔南德斯'},
        // {label: '事件动词描述', value: '阿新总统就职仪式'},
        // {label: '事件动词', value: '出席'},
        // {label: '发生时间', value: '2019年12月10日'},
        // {label: '发生地点', value: '阿根廷首都布宣诺斯艾利斯'},
        // {label: '施事者', value: '习近平主席特使、艾力更·依明巴海'},
      ],
      msggxcq1List:[
        // {label: '实体', value: '艾力更·依明巴海'},
        // {label: '实体', value: '主席特使、全国人大常委会副委员长'},
        // {label: '关系', value: '出席'},
        // {label: '句子', value: '习近平主席特使、全国人大常委会副委员长艾力更·依明巴海2019年12月10日在阿根廷首都布宜诺斯艾利斯出席阿新总统就职仪式，并于9日会见新任总统费尔南德斯。'},
      ],
      msggxcq2List:[
        // {label: '实体', value: '艾力更·依明巴海'},
        // {label: '实体', value: '费尔南德斯'},
        // {label: '关系', value: '会见'},
        // {label: '句子', value: '习近平主席特使、全国人大常委会副委员长艾力更·依明巴海2019年12月10日在阿根廷首都布宜诺斯艾利斯出席阿新总统就职仪式，并于9日会见新任总统费尔南德斯。'},
      ],
      params:[]

    };
  },
  computed: {
    /*paginatedResults() {
      const start = (this.currentPage - 1) * this.itemsPerPage;
      return this.results.slice(start, start + this.itemsPerPage);
    },*/
    totalPages() {
      return Math.ceil(this.totalResultsCount / this.itemsPerPage);
    },
    visiblePages() {
      const range = 6;
      const start = Math.max(1, this.currentPage - Math.floor(range / 2));
      const end = Math.min(this.totalPages, start + range - 1);
      return Array.from({ length: end - start + 1 }, (_, i) => start + i);
    },
    hasFtp2Perm() {
      return this.$store.getters.permissions.includes("adv/search:ftp2");
    }
  },
  created() {
    // 从 localStorage 获取数据
    const storedData = localStorage.getItem('detailData');
    if (storedData) {
      this.detailData = JSON.parse(storedData);
      // 清除已使用的数据
      // localStorage.removeItem('detailData');
      console.log(this.detailData.doc_content);
      if(this.detailData.file_path == "" || this.detailData.file_path == null ){
        this.downloadShow = false ;
      }
    }
    //  else {
    //   this.$router.push('/'); // 数据未找到时跳转
    // }
  },
  methods: {
    decodeHtmlEntity(encodedStr) {
      const doc = new DOMParser().parseFromString(encodedStr, "text/html");
      return doc.body.textContent || doc.body.innerText;
    },
     /** 添加/修改操作 */
    openForm(docid,uid,doc_lable,doc_isindex,sourcename) {
      this.$refs["formRef"].open(docid,uid,doc_lable,doc_isindex,sourcename);
    },
    // 点击切换
    hover_li(val){
      this.msgLXNameIndex = val;
      this.$nextTick(() => {
        // 1,通过形参获取当前需要的dom
        let targetbox = document.getElementById('model_' + val);
        // 2,获取该dom距离页头的高度
        this.target = targetbox.offsetTop;
        // 3,执行页面跳转
        document.documentElement.scrollTop = this.target;
    })

    },
    // 文档标签
    setActive(index){
      this.activeIndex = index;
      // this.performSearch();
    },
    openSearchPage(result) {
      localStorage.setItem('detailData', JSON.stringify(result));
      // 打开新标签页
      window.open('/#/search/');
    },
    openCollectionPage(result) {
      // localStorage.setItem('detailData', JSON.stringify(result));
      // 打开新标签页
      window.open('/#/search/collection');
    },

    // 词云方法开始
    bubbleData(data, format, dom) {
      let [maxValue, temp] = [0, []];
      data.forEach((item) => {
        temp.push(item[format[1]]);
      });
      maxValue = Math.max.apply(null, temp);

      // 气泡颜色数组
      let color = ["#52a3d6", "#68bce5", "#c775af", "#79a7d2", "#f29c54", "#ac9acc", "#67c2aa", "#e67880", "#7dba51"];
      // 气泡颜色备份
      let bakeColor = [...color];
      // 气泡数据
      let bubbleData = [];
      // 气泡基础大小
      let basicSize = 70;
      // 节点之间的斥力因子,值越大,气泡间距越大
      let repulsion = 380;
      // 根据气泡数量配置基础大小和斥力因子（以实际情况进行适当调整，使气泡合理分布）
      if (data.length >= 5 && data.length < 10) {
        basicSize = 50;
        repulsion = 230;
      }
      if (data.length >= 10 && data.length < 20) {
        basicSize = 40;
        repulsion = 150;
      } else if (data.length >= 20) {
        basicSize = 30;
        repulsion = 75;
      }

      // 填充气泡数据数组bubbleData
      for (let item of data) {
        // 确保气泡数据条数少于或等于气泡颜色数组大小时，气泡颜色不重复
        if (!bakeColor.length) bakeColor = [...color];
        let colorSet = new Set(bakeColor);
        let curIndex = Math.round(Math.random() * (colorSet.size - 1));
        let curColor = bakeColor[curIndex];
        colorSet.delete(curColor);
        bakeColor = [...colorSet];
        // 气泡大小设置
        let size = (item[format[1]] * basicSize * 2) / maxValue;
        if (size < basicSize) size = basicSize;

        bubbleData.push({
          name: item[format[0]],
          value: item[format[1]],
          symbolSize: size,
          draggable: true,
          itemStyle: {
            normal: { color: curColor },
          },
        });
      }

      let bubbleId = document.getElementById(dom);
      let bubbleChart = echarts.init(bubbleId);
      let bubbleOptions = {
        backgroundColor: "#fff",
        animationEasingUpdate: "bounceIn",
        series: [
          {
            type: "graph",
            layout: "force",
            force: {
              repulsion: repulsion,
              edgeLength: 10,
            },
            // 是否开启鼠标缩放和平移漫游
            roam: false,
            label: { normal: { show: true } },
            data: bubbleData,
          },
        ],
      };
      bubbleChart.setOption(bubbleOptions);
    },
    // 词云方法结束

    // 打开详情页内容开始
    openDetailCont(result){

      this.table=true;
      localStorage.setItem('detailData', JSON.stringify(result));
      const storedData = localStorage.getItem('detailData');
      if (storedData) {
        this.detailData = JSON.parse(storedData);
        // 清除已使用的数据
        // localStorage.removeItem('detailData');
        // console.log(this.detailData.file_path);
        if(this.detailData.file_path == "" || this.detailData.file_path == null ){
          this.downloadShow = false ;
        }
      } else {
        this.$router.push('/'); // 数据未找到时跳转
      }
    },
    // html内容转换
    decodeHtmlEntity(encodedStr) {
      const doc = new DOMParser().parseFromString(encodedStr, "text/html");
      return doc.body.textContent || doc.body.innerText;
    },
    // 打开详情页内容结束
    // 关闭详情
    cancelForm() {
      this.table=false;
      this.$refs.drawer.close();
    },

    // 获取文本分类
    async formWbData(){
      try {
      const formdata = {
        text: this.detailData.doc_content.replace(/<[^>]+>/g, ''),
        model: "demo",
      };
      // searchPageApi.formWbData(formdata)
      searchPageApi.thirdPartyApi.post('http://114.48.101.215/admin-api/rs/autocat',formdata)
      .then(response =>{
        // return data;

        this.msgName = response.data.results[0].name;


      } )
      } catch (error) {
        this.error = error;
      }
    },
  // 获取文本摘要
    async formWbZyData(){
      try {
      const formdata = {
        text: this.detailData.doc_content.replace(/<[^>]+>/g, ''),
        percent: "30",
      };
      // searchPageApi.formWbData(formdata)
      // searchPageApi.thirdPartyApi.post('http://114.48.101.215/admin-api/rs/abs',formdata)
      searchPageApi.thirdPartyApi.post('http://114.48.101.215/admin-api/rs/abs',formdata)

      .then(response =>{
        // return data;
        this.msgwbzy = response.data.abs;
      } )
      } catch (error) {
        this.error = error;
      }
    },
    // 获取人名1001,机构1003，地域1002
    async formStRwData(){
      try {
      const formdata = {
        text: this.detailData.doc_content.replace(/<[^>]+>/g, ''),
        option: "1",
      };
      // searchPageApi.formWbData(formdata)
      searchPageApi.thirdPartyApi.post('http://114.48.101.215/admin-api/rs/plo',formdata)
      .then(response =>{
        // return data;
        console.log('返回实体=' + response.data.entities) ;
        // const poparraya = [];
        console.log('length='+response.data.entities.length);
        for(let i = 0; i < response.data.entities.length ; i++){
          if( response.data.entities[i].type === 1001 ){
            let vote = {
              word : response.data.entities[i].word,
              value : response.data.entities[i].frequency,
            };
            this.wordData1.push(vote);
          };
          if(response.data.entities[i].type === 1003 ){
            let vote = {
              word : response.data.entities[i].word,
              value : response.data.entities[i].frequency,
            };
            this.wordData2.push(vote);
          }
          if(response.data.entities[i].type === 1002 ){
            let vote = {
              word : response.data.entities[i].word,
              value : response.data.entities[i].frequency,
            };
            this.wordData3.push(vote);
          }


        }

            // 词云1
        // this.bubbleData(this.poparray1, ["word", "frequency"], "wordCloud1");
        // 词云2
        // this.bubbleData(this.poparray2, ["label", "amount"], "wordCloud2");
        // 词云3
        // this.bubbleData(this.poparray3, ["label", "amount"], "wordCloud3");
      } )
      } catch (error) {
        this.error = error;
      }
    },
    // 获取关键词
    async formGjcData(){
      try {
      const formdata = {
        text: this.detailData.doc_content.replace(/<[^>]+>/g, ''),
        // model: "demo",
        num: 20 ,
      };
      // searchPageApi.formWbData(formdata)
      searchPageApi.thirdPartyApi.post('http://114.48.101.215/admin-api/rs/abs/theme',formdata)
      .then(response =>{
        // return data;
        this.wordData = response.data.themeWords;
        // console.log('关键词='+response.data.themeWords);
      } )
      } catch (error) {
        this.error = error;
      }
    },
    // 获取地域识别
    async formDySbData(){
      try {
      const formdata = {
        content: this.detailData.doc_content.replace(/<[^>]+>/g, ''),
        model: "地区分类_区县",
        // num: 20 ,
      };
      // searchPageApi.formWbData(formdata)
      searchPageApi.thirdPartyApi.post('http://114.48.101.215/admin-api/rs/rulecat/simple',formdata)
      .then(response =>{
        // return data;
        this.msgdysbList = response.data.catResults;
        // console.log('catResults='+response.data.catResults);
      } )
      } catch (error) {
        this.error = error;
      }
    },
    // 获取事件抽取
    async formSjCqData(){
      try {
      const formdata = {
        sentences: this.detailData.doc_content.replace(/<[^>]+>/g, ''),
        // sentences: '习近平主席特使、全国人大常委会副委员长艾力更·依明巴海 2019年12月10日在阿根廷首都布宜诺斯艾利斯出席阿新总统就职仪式 ,并于 9日会见新任总统费尔南德斯。',
        // model: "demo",
        // docId: 0 ,
      };
      // searchPageApi.formWbData(formdata)
      searchPageApi.thirdPartyApi.post('http://114.48.101.215/admin-api/rs/event/qk',formdata)
      .then(response =>{
        // return data;
        if(response.data.result != null){
          this.msgsjcqList = response.data.result[0].tags;
          console.log('result='+this.msgsjcqList);
        }else{
          //this.sjcqListShow = !this.sjcqListShow;
        }

      } )
      } catch (error) {
        this.error = error;
      }
    },
    // 获取关系抽取
    async formGxCqData(){
      try {
      // let detailData =this.detailData.doc_content.replace(/<[^>]+>/g, '')
      const formdata = {

        content: this.detailData.doc_content.replace(/<[^>]+>/g, ''),
        // content: '习近平主席特使、全国人大常委会副委员长艾力更·依明巴海 2019年12月10日在阿根廷首都布宜诺斯艾利斯出席阿新总统就职仪式 ,并于 9日会见新任总统费尔南德斯。',

        // model: "demo",
        // num: 20 ,
      };
      // searchPageApi.formWbData(formdata)
      searchPageApi.thirdPartyApi.post('http://114.48.101.215/admin-api/rs/ext/rdf',formdata)
      .then(response =>{
        // return data
        if( response.data.rdfResultInfo != null){
          this.msggxcq1List = response.data.rdfResultInfo;
          // console.log("this.msggxcq1List="+this.msggxcq1List.rdfResultInfo)
        }else{
          this.gxcqListShow = !this.gxcqListShow;
        }


      } )
      } catch (error) {
        this.error = error;
      }
    },

  },
  mounted:function(){
    if(this.$route.query.gaoji==1){
      this.showAdvancedSearch=true;
    }
    if(this.$route.query.id){
      // console.log('id值：'+this.$route.query.id);
      this.queryParams.navigation.doc_lable=this.$route.query.name;
      this.setActive(this.$route.query.id);
      // this.activeIndex = this.$route.query.id;
      // this.performSearch();

    }




    this.nickname = this.$store.state.user.nickname;

    this.formWbData();

    this.formWbZyData();

    this.formStRwData();

    this.formGjcData();

    this.formDySbData();

    this.formSjCqData();

    this.formGxCqData();

  }
};

// 关闭输入推荐框
$(document).mouseup(function(e){
    var _con=$('#search-form');//设置目标区域
    if(!_con.is(e.target)&&_con.has(e.target).length===0){
        $('#search-form').hide()
    }
});

</script>

<style scoped>
@import '../../assets/css/css.css';
@import '../../assets/css/index.css';
/* .search-page {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
} */
.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}
.search-bar input {
  flex: 1;
  padding: 8px;
  border: 1px solid #ccc;
}
.search-bar button {
  padding: 8px 16px;
}
.advanced-search-toggle {
  margin-left: auto;
  background: none;
  border: none;
  color: #007bff;
  cursor: pointer;
}
.filters {
  display: flex;
  gap: 20px;
  margin-top: 10px;
}
.search-results {
  border-top: 1px solid #eee;
  padding-top: 20px;
}
.loading {
  text-align: center;
  padding: 20px;
  color: #666;
}
.pagination {
  display: flex;
  justify-content: center;
  gap: 5px;
  margin-top: 20px;
}
.pagination button,
.pagination span {
  padding: 5px 10px;
  cursor: pointer;
}
.pagination .active {
  font-weight: bold;
  color: #007bff;
}

/* 隐藏原生单选框 */
.hidden-radio {
  display: none;
}

/* 默认样式 */
.custom-radio {
  font-weight: normal;
  cursor: pointer;
}

/* 选中时加粗 */
.hidden-radio:checked + .custom-radio {
  font-weight: bold;
}

.el-button-tk{
    margin-top: 26px;
    margin-bottom: 10px;
}
/* 输入推荐 */
.inputtj{
    /* width: 300px; */
    height: auto;
    background: #fff;
    box-shadow: 0 0 3px rgba(16,115,183,.2);
    /* border: 1px solid #ffffff; */
    border: none;
    position: absolute;
    top: 126px;

    /* left: 0; */
    z-index: 1000;
    padding-right: 20px;
    max-width: 1100px;
}
.inputtj ul{
    padding-left: 10px;
}
.inputtj li{
    cursor: pointer;
    font-size: 14px;
    line-height: 30px;
    color: #333;
    margin: 0;
    width: 100%;
}
.inputtj li:hover{
    color: #0f5de5
}

</style>
