<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 class="header_nav_a">全文检索</li>
              <li @click="openCollectionPage()">我的收藏</li>
              <li @click="openMyItems()">我的待办</li>
            </ul>
          </div>
          <div class="header_user fr">
            <ul>
              <el-dropdown>
                <li class="header_nav_a el-dropdown-link">{{ nickname }} <i
                  class="el-icon-arrow-down el-icon--right"></i></li>
                <el-dropdown-menu slot="dropdown">
                  <el-dropdown-item @click.native="logout">退出登录</el-dropdown-item>
                </el-dropdown-menu>
              </el-dropdown>
            </ul>
          </div>
        </div>
        <div class="header_r fl">
          <!-- <ul style="overflow:hidden">

                <li :class="{ active: activeIndex === 0 }">
                  <input type="radio" id="label1" value="" v-model="queryParams.navigation.doc_lable" @change="setActive(0)" class="hidden-radio" />
                  <label for="label1" class="custom-radio">全部</label>&nbsp;
                </li>
                <li :class="{ active: activeIndex === 1 }">
                  <input type="radio" id="label2" value="财经" v-model="queryParams.navigation.doc_lable" @change="setActive(1)" class="hidden-radio" />
                  <label for="label2" class="custom-radio">财经</label>&nbsp;
                </li>
                <li :class="{ active: activeIndex === 2 }">
                  <input type="radio" id="label3" value="法制" v-model="queryParams.navigation.doc_lable" @change="setActive(2)" class="hidden-radio" />
                  <label for="label3" class="custom-radio">法制</label>&nbsp;
                </li>
                <li :class="{ active: activeIndex === 3 }">
                  <input type="radio" id="label4" value="国际" v-model="queryParams.navigation.doc_lable" @change="setActive(3)" class="hidden-radio" />
                  <label for="label4" class="custom-radio">国际</label>&nbsp;
                </li>
                <li :class="{ active: activeIndex === 4 }">
                  <input type="radio" id="label5" value="健康" v-model="queryParams.navigation.doc_lable" @change="setActive(4)" class="hidden-radio" />
                  <label for="label5" class="custom-radio">健康</label>&nbsp;
                </li>
                <li :class="{ active: activeIndex === 5 }">
                  <input type="radio" id="label6" value="军事" v-model="queryParams.navigation.doc_lable" @change="setActive(5)" class="hidden-radio" />
                  <label for="label6" class="custom-radio">军事</label>&nbsp;
                </li>
              <li :class="{ active: activeIndex === 6 }">
                <input type="radio" id="label7" value="科技" v-model="queryParams.navigation.doc_lable" @change="setActive(6)" class="hidden-radio" />
                <label for="label7" class="custom-radio">科技</label>&nbsp;
              </li>
              <li :class="{ active: activeIndex === 7 }">
                <input type="radio" id="label8" value="时政" v-model="queryParams.navigation.doc_lable" @change="setActive(7)" class="hidden-radio" />
                <label for="label8" class="custom-radio">时政</label>&nbsp;
              </li>
              <li :class="{ active: activeIndex === 8 }">
                <input type="radio" id="label9" value="体育" v-model="queryParams.navigation.doc_lable" @change="setActive(8)" class="hidden-radio" />
                <label for="label9" class="custom-radio">体育</label>&nbsp;
              </li>
              <li :class="{ active: activeIndex === 9 }">
                <input type="radio" id="label10" value="文教" v-model="queryParams.navigation.doc_lable" @change="setActive(9)" class="hidden-radio" />
                <label for="label10" class="custom-radio">文教</label>&nbsp;
              </li>
              <li :class="{ active: activeIndex === 10 }">
                <input type="radio" id="label11" value="娱乐" v-model="queryParams.navigation.doc_lable" @change="setActive(10)" class="hidden-radio" />
                <label for="label11" class="custom-radio">娱乐</label>&nbsp;
              </li>
                <li>
                  <input type="radio" id="label7" value="国家" v-model="queryParams.navigation.doc_lable" @change="performSearch" class="hidden-radio" />
                  <label for="label7" class="custom-radio">国家</label>
                </li>


            </ul> -->
          <!-- 搜索开始 -->
          <div class="search_wrap">
            <div class="search_wrap_l fl">
              <!-- <el-select class="search_wrap_l_xz1 fl" v-model="selectedValue" placeholder="请选择">
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.value"
                      :value="item.value">
                    </el-option>
                  </el-select> -->
              <div class="search_wrap_l_xz2 fl">
                <input class="fl" type="text" placeholder="请输入标题或关键字" v-model="queryParams.keyword"
                       @input="changeVersion">
                <!-- <button @click="performSearch_s"></button> -->
                <button @click="performSearch_s()"></button>
              </div>

              <!-- 输入推荐 -->
              <div class="inputtj" id="search-form">
                <ul>
                  <li @click="showValue($event)" v-for="(item,index) in tjListsData" v-if='index<5'
                      v-html="item.doc_title"></li>
                </ul>
              </div>
            </div>

            <div class="search_wrap_r fl" @click="toggleAdvancedSearch" style="cursor:pointer">
              {{ showAdvancedSearch ? '高级检索 -' : '高级检索+' }}
            </div>

            <!-- <div class="search_wrap_r fl" @click="toggleBatchSearch" style="cursor:pointer">
                {{ showBatchSearch ? '按批次检索' : '按批次检索' }}
              </div> -->

            <div class="search_wrap_r fl" @click="toggleSecondarySearch" style="cursor:pointer">
              {{ showSecondarySearch ? '二次检索 -' : '二次检索+' }}
            </div>


          </div>
          <!-- 搜索结束 -->

        </div>

      </div>

    </div>
    <!-- 二级检索弹窗开始 -->
    <div v-if="showSecondarySearch" class="gaojijiansuo gaojijiansuo_ec">
      <div class="gaojijiansuo_left gaojijiansuo_left_ec  fl">
        <h1>二次检索</h1>
        <div class="advanced-options">
          <!-- 循环开始 -->
          <div v-for="i,index in advancedSearchesArr" :key="index">
            <!-- 占位 -->
            <div style="width:110px;height:40px;float:left" v-if="index==0"></div>
            <!-- 与或非 -->
            <el-select v-if="index!=0" v-model="i.connectAll.connectvalue" placeholder="请选择" class="select_wrap1">
              <el-option v-for="item in i.connectAll.connectoptions" :key="item.value" :label="item.label"
                         :value="item.value">
              </el-option>
            </el-select>

            <el-select v-model="i.advFieldAll.advFieldvalue" class="select_wrap2" placeholder="请选择">
              <el-option v-for="item in i.advFieldAll.advFieldoptions" :key="item.value" :label="item.label"
                         :value="item.value">
              </el-option>
            </el-select>

            <div class="selectkeyword_wrap">
              <input type="text" v-model="i.dynamicAll.inputValue" placeholder='请填写关键词，用空格或";"隔开'
                     style="width:680px;border:none;font-size:16px;">

            </div>
            <i @click="addLine(index)" v-if="index<5" class="el-icon-circle-plus-outline"
               style="font-size: 30px;line-height: 40px;font-weight: normal;cursor: pointer;margin:0 5px"></i>
            <i @click="deleteLine(index)" v-if="index!=0" class="el-icon-remove-outline"
               style="font-size: 30px;line-height: 40px;font-weight: normal;cursor: pointer;"></i>

          </div>
          <!-- 循环结束 -->

        </div>
        <div class="btns_wrap">
          <button @click="applyAdvancedSearch2()">搜索</button>
          <!-- <button @click="toggleAdvancedSearch" style="background-color: rgb(228, 228, 228);margin-left:30px">取消</button> -->
        </div>
      </div>

    </div>
    <!-- 二级检索弹窗结束 -->
    <!-- 头部结束 -->
    <div class="pc pcwrap">
      <div class="inner">
        <div class="contain">
          <div class="cont_wrap">
            <div class="search_cont_wrap fl">
              <div class="left_nav" v-if="showAdvancedSearch">
                <!-- 顶部分类开始  -->
                <div class="cont_wrap_nav">
                  <ul>
                    <!-- <li v-for="(item,index) in msgLXNameList" :key="index"  class="list_wrap_li_jyfl" :class="{list_wrap_li_jyfl_h:index == msgLXNameIndex}" @click="hover_li(index)" >
                    <a style="cursor:pointer;" @click="">
                      <p>{{item.label}}</p>
                    </a>
                  </li> -->

                    <li class="list_wrap_li_jyfl" :class="{ list_wrap_li_jyfl_h:activeIndex === 0 }">
                      <input type="radio" id="label1" value="" v-model="queryParams.navigation.doc_lable"
                             @change="setActive(0)" class="hidden-radio" />
                      <label for="label1" class="custom-radio">全部</label>&nbsp;
                    </li>
                    <li class="list_wrap_li_jyfl" :class="{ list_wrap_li_jyfl_h:activeIndex === 1 }">
                      <input type="radio" id="label2" value="军事" v-model="queryParams.navigation.doc_lable"
                             @change="setActive(1)" class="hidden-radio" />
                      <label for="label2" class="custom-radio">军事</label>&nbsp;
                    </li>
                    <li class="list_wrap_li_jyfl" :class="{ list_wrap_li_jyfl_h:activeIndex === 2 }">
                      <input type="radio" id="label3" value="政治" v-model="queryParams.navigation.doc_lable"
                             @change="setActive(2)" class="hidden-radio" />
                      <label for="label3" class="custom-radio">政治</label>&nbsp;
                    </li>
                    <li class="list_wrap_li_jyfl" :class="{ list_wrap_li_jyfl_h:activeIndex === 3 }">
                      <input type="radio" id="label4" value="经济" v-model="queryParams.navigation.doc_lable"
                             @change="setActive(3)" class="hidden-radio" />
                      <label for="label4" class="custom-radio">经济</label>&nbsp;
                    </li>
                    <li class="list_wrap_li_jyfl" :class="{ list_wrap_li_jyfl_h:activeIndex === 4 }">
                      <input type="radio" id="label5" value="外交" v-model="queryParams.navigation.doc_lable"
                             @change="setActive(4)" class="hidden-radio" />
                      <label for="label5" class="custom-radio">外交</label>&nbsp;
                    </li>
                    <li class="list_wrap_li_jyfl" :class="{ list_wrap_li_jyfl_h:activeIndex === 5 }">
                      <input type="radio" id="label6" value="安全" v-model="queryParams.navigation.doc_lable"
                             @change="setActive(5)" class="hidden-radio" />
                      <label for="label6" class="custom-radio">安全</label>&nbsp;
                    </li>
                    <li class="list_wrap_li_jyfl" :class="{ list_wrap_li_jyfl_h:activeIndex === 6 }">
                      <input type="radio" id="label7" value="科技" v-model="queryParams.navigation.doc_lable"
                             @change="setActive(6)" class="hidden-radio" />
                      <label for="label7" class="custom-radio">科技</label>&nbsp;
                    </li>
                    <li class="list_wrap_li_jyfl" :class="{ list_wrap_li_jyfl_h:activeIndex === 7 }">
                      <input type="radio" id="label9" value="宗教" v-model="queryParams.navigation.doc_lable"
                             @change="setActive(7)" class="hidden-radio" />
                      <label for="label9" class="custom-radio">宗教</label>&nbsp;
                    </li>
                  </ul>
                </div>
                <!-- 顶部分类结束 -->

                <div>
                  <h2 class="active">
                    资源类型：
                    <!-- <img src="../../assets/img/xiajiantou.png" alt=""> -->

                  </h2>
                  <ul>
                    <li>
                      <input type="checkbox" value="pdf" v-model="queryParams.navigation.file_type" id="pdf" /><label
                      class="left_nav_li" for="pdf">PDF</label>
                    </li>
                    <li>
                      <input type="checkbox" value="word" v-model="queryParams.navigation.file_type" id="word" /><label
                      class="left_nav_li" for="word">Word</label>
                    </li>
                    <li>
                      <input type="checkbox" value="ppt" v-model="queryParams.navigation.file_type" id="ppt" /><label
                      class="left_nav_li" for="ppt">PPT</label>
                    </li>
                    <li>
                      <input type="checkbox" value="excel" v-model="queryParams.navigation.file_type"
                             id="excel" /><label class="left_nav_li" for="excel">Excel</label>
                    </li>
                    <li>
                      <input type="checkbox" value="txt" v-model="queryParams.navigation.file_type" id="txt" /><label
                      class="left_nav_li" for="txt">TXT</label>
                    </li>
                    <li>
                      <input type="checkbox" value="img" v-model="queryParams.navigation.file_type" id="img" /><label
                      class="left_nav_li" for="img">img</label>
                    </li>
                    <!-- <li v-if="item.total!=0" @click="searchXzgf(index,item.id)" :class="showIndex==index ? 'active':''" v-for="(item,index) in xzgfListArr" :key="index">{{item.name}}<span class="fr">({{item.total}})</span></li> -->
                  </ul>
                </div>
                <div>
                  <h2 class="active">年份：</h2>
                  <ul v-if="docnotypeListShow==true">
                    <li>
                      <input type="checkbox" value="2024" v-model="queryParams.navigation.file_year" id="2024" /><label
                      class="left_nav_li" for="2024">2024</label>
                    </li>
                    <li>
                      <input type="checkbox" value="2023" v-model="queryParams.navigation.file_year" id="2023" /><label
                      class="left_nav_li" for="2023">2023</label>
                    </li>
                    <li>
                      <input type="checkbox" value="2022" v-model="queryParams.navigation.file_year" id="2022" /><label
                      class="left_nav_li" for="2022">2022</label>
                    </li>
                    <li>
                      <input type="checkbox" value="2021" v-model="queryParams.navigation.file_year" id="2021" /><label
                      class="left_nav_li" for="2021">2021</label>
                    </li>
                    <li>
                      <input type="checkbox" value="2020" v-model="queryParams.navigation.file_year" id="2020" /><label
                      class="left_nav_li" for="2020">2020</label>
                    </li>
                    <li>
                      <input type="checkbox" value="2019" v-model="queryParams.navigation.file_year" id="2019" /><label
                      class="left_nav_li" for="2019">2019</label>
                    </li>
                    <li>
                      <input type="checkbox" value="2018" v-model="queryParams.navigation.file_year" id="2018" /><label
                      class="left_nav_li" for="2018">2018</label>
                    </li>
                    <li>
                      <input type="checkbox" value="2017" v-model="queryParams.navigation.file_year" id="2017" /><label
                      class="left_nav_li" for="2017">2017</label>
                    </li>
                    <li>
                      <input type="checkbox" value="2016" v-model="queryParams.navigation.file_year" id="2016" /><label
                      class="left_nav_li" for="2016">2016</label>
                    </li>
                    <li>
                      <input type="checkbox" value="2015" v-model="queryParams.navigation.file_year" id="2015" /><label
                      class="left_nav_li" for="2015">2015</label>
                    </li>
                    <li>
                      <input type="checkbox" value="2014" v-model="queryParams.navigation.file_year" id="2014" /><label
                      class="left_nav_li" for="2014">2014</label>
                    </li>
                    <!-- <li v-if="item.total!=0" @click="searchDocnotype(index,item.name)" :class="showIndex==index ? 'active':''" v-for="(item,index) in docnotypeListArr" :key="index">{{item.name}}<span class="fr">({{item.value}})</span></li> -->
                  </ul>
                </div>
                <div>
                  <h2 class="active">语种：</h2>
                  <ul v-if="publisherListShow==true">
                    <li>
                      <input type="checkbox" id="zw" value="中文" v-model="queryParams.navigation.language" />
                      <label class="left_nav_li" for="zw">中文</label>
                    </li>
                    <li>
                      <input type="checkbox" id="mw" value="蒙文" v-model="queryParams.navigation.language" />
                      <label class="left_nav_li" for="mw">蒙文</label>
                    </li>
                    <li>
                      <input type="checkbox" id="yw" value="英文" v-model="queryParams.navigation.language" />
                      <label class="left_nav_li" for="yw">英文</label>
                    </li>
                    <li>
                      <input type="checkbox" id="ew" value="俄文" v-model="queryParams.navigation.language" />
                      <label class="left_nav_li" for="ew">俄文</label>
                    </li>
                    <li>
                      <input type="checkbox" id="cxy" value="朝鲜语" v-model="queryParams.navigation.language" />
                      <label class="left_nav_li" for="cxy">朝鲜语</label>
                    </li>
                  </ul>
                </div>
                <div>


                  <h2 class="active">文件来源：</h2>
                  <ul v-if="cityListShow==true">
                    <li>
                      <input type="checkbox" id="ftp" value="ftp" v-model="queryParams.navigation.sourcename" />
                      <label class="left_nav_li" for="ftp">FTP1</label>
                    </li>
                    <li>
                      <input type="checkbox" id="ftp2" value="ftp2" v-model="queryParams.navigation.sourcename"
                             v-hasPermi="['adv/search:ftp2']" />
                      <label class="left_nav_li" for="ftp2" v-hasPermi="['adv/search:ftp2']">FTP2</label>
                    </li>
                    <li>
                      <input type="checkbox" id="oracle" value="oracle" v-model="queryParams.navigation.sourcename" />
                      <label class="left_nav_li" for="oracle">ORACLE</label>
                    </li>
                    <!-- <li v-if="item.total!=0" @click="searchCity(index,item.name)" :class="showIndex==index ? 'active':''" v-for="(item,index) in cityListArr" :key="index">{{item.name}}<span class="fr">({{item.value}})</span></li> -->
                  </ul>
                </div>
                <!-- 高级搜索弹窗开始 -->
                <div class="gaojijiansuo">
                  <div class="gaojijiansuo_left fl gaojijiansuo_left_top">
                    <h1>高级检索</h1>
                    <!-- <div class="advanced-options">
                      <div>
                        <label>关键词：</label>
                        <input v-model="advancedQuery.keyword" placeholder="请输入关键词" />
                      </div>

                      <div>
                        <label>包含所有以下词语：</label>
                        <input v-model="advancedQuery.and" placeholder="多个关键词用空格分隔" />
                      </div>
                      <div>
                        <label>包含任意以下词语：</label>
                        <input v-model="advancedQuery.or" placeholder="多个关键词用空格分隔" />
                      </div>

                      <div>
                        <label>不包含以下词语：</label>
                        <input v-model="advancedQuery.not" placeholder="多个关键词用空格分隔" />
                      </div>
                    </div> -->


                    <div class="advanced-options">
                      <!-- 循环开始 -->
                      <div v-for="i,index in gjadvancedSearchesArr" :key="index">
                        <!-- 占位 -->
                        <div style="width:110px;height:40px;float:left" v-if="index==0"></div>
                        <!-- 与或非 -->
                        <el-select v-if="index!=0" v-model="i.gjconnectAll.gjconnectvalue" placeholder="请选择"
                                   class="select_wrap1">
                          <el-option v-for="item in i.gjconnectAll.gjconnectoptions" :key="item.value"
                                     :label="item.label" :value="item.value">
                          </el-option>
                        </el-select>

                        <el-select v-model="i.gjadvFieldAll.gjadvFieldvalue" class="select_wrap2" placeholder="请选择">
                          <el-option v-for="item in i.gjadvFieldAll.gjadvFieldoptions" :key="item.value"
                                     :label="item.label" :value="item.value">
                          </el-option>
                        </el-select>

                        <!-- 包含不包含 -->
                        <el-select v-model="i.gjfieldConnectAll.gjfieldConnectvalue" placeholder="请选择"
                                   class="select_wrap2">
                          <el-option v-for="item in i.gjfieldConnectAll.gjfieldConnectoptions" :key="item.value"
                                     :label="item.label" :value="item.value">
                          </el-option>
                        </el-select>

                        <div class="selectkeyword_wrap">
                          <input type="text" v-model="i.gjdynamicAll.gjinputValue" placeholder='请填写关键词，用空格或";"隔开'
                                 style="width:680px;border:none;font-size:16px;">

                        </div>
                        <i @click="gjaddLine(index)" v-if="index<5" class="el-icon-circle-plus-outline"
                           style="font-size: 30px;line-height: 40px;font-weight: normal;cursor: pointer;margin:0 5px"></i>
                        <i @click="gjdeleteLine(index)" v-if="index!=0" class="el-icon-remove-outline"
                           style="font-size: 30px;line-height: 40px;font-weight: normal;cursor: pointer;"></i>

                      </div>
                      <!-- 循环结束 -->

                    </div>




                  </div>
                </div>
                <!-- 高级搜索弹窗结束 -->
                <!-- 按批次检索弹窗开始 -->
                <!-- <div class="gaojijiansuo gaojijiansuopic">
                  <div class="gaojijiansuo_left fl">
                    <h1>按批次检索</h1>
                    <div class="advanced-options">
                      <div>
                        <label>批次号：</label>
                        <input v-model="queryParams.navigation.batch_no" placeholder="请输入批次号" />

                      </div>

                    </div>

                  </div>

                </div> -->
                <!-- 按批次检索弹窗结束 -->

                <div class="btns_wrap">
                  <button @click="gaojiSearch">搜索</button>
                  <button @click="performSearch_cz"
                          style="background-color: rgb(228, 228, 228);margin-left:30px">重置</button>
                </div>

              </div>

              <div class="right_cont">
                <div class="data_wrap">
                  <h1 class="total_wrap">
                    <h2 class="fl">找到<span>{{totalResultsCount}}</span>篇文献</h2>
                    <div class="search_types fl">
                      排序方式：
                      <span
                        :class="[RELEVANCEShow ? 'active' : '', hasSuccessXGDDESC ? 'DESC' : '', hasSuccessXGDASC ? 'ASC' : '']"
                        @click="searchRelevance()">按相关度</span>
                      <span
                        :class="[crtimeShow ? 'active' : '', hasSuccessCRTDESC ? 'DESC' : '', hasSuccessCRTASC ? 'ASC' : '']"
                        @click="searchCrtime()">按文件创建时间</span>
                      <span
                        :class="[visitsShow ? 'active' : '', hasSuccessVISDESC ? 'DESC' : '', hasSuccessVISASC ? 'ASC' : '']"
                        @click="searchVisits()">按点赞量</span>
                      <span
                        :class="[collectionShow ? 'active' : '', hasSuccessCOLDESC ? 'DESC' : '', hasSuccessCOLASC ? 'ASC' : '']"
                        @click="searchCollection()">按收藏量</span>
                    </div>
                    <!-- 日期选择 -->
                    <div class="block fr date_css">
                      <el-date-picker v-model="value1" type="daterange" value-format="yyyy-MM-dd" align="right"
                                      unlink-panels range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"
                                      :picker-options="pickerOptions" @change="handleDateChange">
                      </el-date-picker>
                    </div>
                    <!-- 相似合并按钮 -->
                    <div class="xshb fr">
                      <span>相似合并</span>
                      <el-switch v-model="XSHBBtn" active-text="" inactive-text="" @change="switchChange">
                      </el-switch>
                    </div>
                  </h1>
                  <!-- 错词提示 -->
                  <div v-if="correctDataTrue" style="font-size: 16px;margin: 10px auto 20px;font-weight: bold;">
                    已显示:"
                    <span style="color:red;font-weight: bold;">
                      {{ trueWord }}
                    </span>"的搜索结果。依然搜索:
                    <span @click="errorSearch">
                      <input type="text" style="cursor: pointer;color:#0f5de5;font-size: 16px;font-weight: bold;"
                             readonly v-model="errorWord" name="" id="">
                    </span>
                  </div>
                  <!-- 数据列表 -->
                  <div class="data_cont_wrap">
                    <!-- 列表页开始 -->
                    <div :class="table==true ? 'leftactive data_list':'data_list'">
                      <ul style="padding-left:0px">
                        <div v-loading="loading" style="position:absolute;top:85px;left:29%"></div>
                        <el-button type="text" v-for="(result, index) in results" :key="index">
                          <li>
                            <!-- <a @click="openDetailPage(result)" target="_blank" v-html="result.doc_title"></a> -->

                            <a @click="openDetailCont(result)" v-html="result.doc_title"></a>
                            <!-- <div>
                                    关键词：<span v-html="result.doc_content"></span>
                                </div> -->
                            <div class="abstract_wrap" @click="openDetailCont(result)">
                              <!--                                    <b>摘要：</b><span v-html="decodeHtmlEntity(result.doc_content)"></span>-->
                              <b>摘要：</b><span v-html="result.doc_abstract"></span>
                            </div>
                            <div @click="openDetailCont(result)">
                              <b>关键词：</b><span v-html="result.doc_keywords"></span>
                            </div>

                            <div>

                              <h2 class="fl" @click="openDetailCont(result)">
                                <b>时间：</b>{{result.file_updatetime}}
                              </h2>
                              <h2 class="fl" @click="openDetailCont(result)">
                                <b>来源：</b>{{result.sourcename}}
                              </h2>
                              <h2 class="fl" @click="openDetailCont(result)">
                                <b>文档类型：</b>{{result.file_type}}
                              </h2>
                              <h2 class="fl" @click="openDetailCont(result)">
                                <b>语种：</b>{{result.language}}
                              </h2>

                              <h2 class="fl" :class=" result.isCollectClick ?'collectActiveN':'collectActive' "
                                  @click="incrementCollect(result)">
                                <b><img src="../../assets/img/241202sc.png" alt=""></b>{{ result.doc_collect }}
                              </h2>
                              <h2 class="fl" :class=" result.isCollectClick ?'collectActive':'collectActiveN' "
                                  @click="incrementCollect(result)">
                                <b><img src="../../assets/img/241202sch.png" alt=""></b>{{ result.doc_collect }}
                              </h2>

                              <h2 class="fl" :class="result.isVisitClick ?'visitActiveN':'visitActive' "
                                  @click="incrementVisit(result)">
                                <b><img src="../../assets/img/241202dz.png" alt=""></b>{{ result.doc_visit }}
                              </h2>
                              <h2 class="fl" :class="result.isVisitClick ?'visitActive':'visitActiveN' "
                                  @click="incrementVisit(result)">
                                <b><img src="../../assets/img/241202dzh.png" alt=""></b>{{ result.doc_visit }}
                              </h2>
                              <!-- <h2 class="fl">
                                    标签：{{result.doc_lable}}
                                  </h2>
                                  <el-button class="fl el-button-tk" size="mini" type="text" icon="el-icon-edit" @click="openForm(result.docid,result.uid,result.doc_lable,result.doc_isindex,result.sourcename)" v-hasPermi="['manager:dig-ftp-source:update']">修改标签</el-button> -->
                            </div>
                          </li>
                        </el-button>
                      </ul>
                      <!-- 分页 -->
                      <!-- 分页 -->
                      <el-pagination v-if="totalResultsCount != 0" @current-change="handleCurrentChange"
                                     :current-page.sync="currentPage" :page-size="5" layout="total,prev, pager,next, jumper"
                                     :total="totalResultsCount" prev-text="上一页" next-text="下一页">
                      </el-pagination>
                      <div class="noResult" v-if="totalResultsCount == 0" v-show="!loading"
                           style="padding-bottom:20px;font-size: 16px;line-height: 30px;">
                        <strong>很抱歉！未能搜到您想要的内容</strong>
                        <br />
                        <strong>建议您</strong>
                        <br />
                        <strong>1.看看输入的文字是否有错误</strong>
                        <br />
                        <strong>2.去掉可能不必要的词或条件</strong>
                      </div>
                    </div>
                    <!-- 列表页结束 -->

                    <!-- 文章详情 -->
                    <div :class="table==true ? 'active detail_cont_wrap':'detail_cont_wrap'">
                      <el-drawer ref="drawer" title="文章详情" :visible.sync="table" direction="rtl" size="100%"
                                 style="position: absolute" z-index="-1" :append-to-body="false" :show-close="true"
                                 :modal="false">
                        <div class="detailcont">
                          <p>
                            <strong @click="incrementVisit(detailData)" class="xqxx dz fl"
                                    :class="detailData.isVisitClick ? 'visitActiveN' : 'visitActive'">点赞</strong>
                            <strong @click="incrementVisit(detailData)" class="xqxx dzHover fl"
                                    :class="detailData.isVisitClick ? 'visitActive' : 'visitActiveN'">点赞</strong>
                            <strong class="xqxx jrsc fl" @click="incrementCollect(detailData)"
                                    :class="detailData.isCollectClick ? 'collectActiveN' : 'collectActive'">加入收藏</strong>
                            <strong class="xqxx jrscHover fl" @click="incrementCollect(detailData)"
                                    :class="detailData.isCollectClick ? 'collectActive' : 'collectActiveN'">取消收藏</strong>

                            <strong class="xqxx znfx fl" @click="openAnalysisPage(detailData)">智能分析</strong><strong
                            v-if="isTranslateZw" class="xqxx ckyw" @click="incrementTranslate()">{{isTranslate ?
                            '查看原文' : '查看译文' }}</strong>
                            <strong v-if="isOracle" class="xqxx zxbj" @click="getWordView(detailData)">在线预览</strong>
                            <!-- <strong class="xqxx zxbj" >在线编辑</strong> -->
                            <strong class="xqxx ywlj fr" @click="open(detailData.file_path)">查看原文路径</strong>
                          </p>
                          <h1 :class=" isTranslate ?'collectActiveN':'collectActive' " v-html="detailData.doc_title">
                          </h1>
                          <h1 :class=" isTranslate ?'collectActive':'collectActiveN' "
                              v-html="detailData.doc_title_translate"></h1>
                          <div style="width: 100%;height: auto;overflow: hidden;"><strong class="fl"
                                                                                          style="font-size: 16px;">关键词：</strong>
                            <div style="font-size: 16px;" class="fl" v-html="detailData.doc_keywords"></div>
                            <el-button class="fl el-button-tk" size="mini" type="text" icon="el-icon-edit"
                                       @click="openForm(detailData.docid, detailData.uid, detailData.doc_keywords, detailData.doc_isindex, detailData.sourcename)"
                                       v-hasPermi="['manager:dig-ftp-source:update']">修改</el-button>
                          </div>
                          <p><strong>时间：</strong>{{ detailData.file_updatetime }}<strong
                            style="margin-left:40px;">文档类型：</strong>{{ detailData.file_type }}<strong
                            style="margin-left:40px;">语种：</strong>{{ detailData.language }}
                            <!-- <strong style="margin-left:40px;">标签：</strong>{{ detailData.doc_lable }} -->
                            <!-- <strong style="margin-left:40px;">访问量：</strong>{{detailData.doc_visit}} -->

                          </p>
                          <p>
                            <strong>标签：</strong>
                            <el-select v-model="tabValue" multiple filterable allow-create default-first-option
                                       placeholder="请选择文章标签" @change="bqUpdateTrue">
                              <el-option v-for="item in tabOptions" :key="item.value" :label="item.label"
                                         :value="item.value">
                              </el-option>
                            </el-select>
                            <el-button v-if="bqUpdateZT" class="fl el-button-tk el-button-bq" size="mini" type="text"
                                       icon="el-icon-edit" @click="bqUpdate(detailData)"
                                       v-hasPermi="['manager:dig-ftp-source:update']">提交</el-button>
                            <!-- <strong style="margin-left:40px;">访问量：</strong>{{detailData.doc_visit}} -->
                          </p>
                          <p style="overflow:hidden;">
                            <!-- <strong class="fl" style="display:block">正文：</strong> -->
                            <!-- <span class="fl" style="display:block;width:100%" v-html="decodeHtmlEntity(detailData.doc_content)"></span> -->
                            <span class="fl" :class=" isTranslate ?'collectActiveN':'collectActive' " style="width:100%"
                                  v-html="detailData.doc_content"></span>
                            <span class="fl" :class=" isTranslate ?'collectActive':'collectActiveN' " style="width:100%"
                                  v-html="detailData.doc_content_translate"></span>
                            <strong v-show="downloadShow" style="color:#016bb5;cursor: pointer; "
                                    @click="getDownload">下载文件: {{ detailData.attname }}</strong>
                          </p>

                        </div>

                        <div class="closeDrawer">
                          <el-button style="margin-left: 44%;" @click="cancelForm">关闭</el-button>
                        </div>
                      </el-drawer>

                    </div>

                    <!-- 文章详情 -->
                  </div>



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

            <!-- 词云开始 -->
            <div class="wordCloud_wrap fr">
              <!-- 相关人物实体 -->
              <div class="wordCloud_block wordCloud_block1">
                <h1>相关人物实体</h1>

                <div id="wordCloud1" style="width:100%;height:300px;"></div>
              </div>
              <!-- 相关机构 -->
              <div class="wordCloud_block wordCloud_block1">
                <h1>相关机构</h1>
                <div id="wordCloud2" style="width:100%;height:300px;"></div>
              </div>
              <!-- 相关地域 -->
              <div class="wordCloud_block wordCloud_block1">
                <h1>相关地域</h1>
                <div id="wordCloud3" style="width:100%;height:300px;"></div>
              </div>
            </div>
            <!-- 词云结束 -->
          </div>
        </div>
      </div>
    </div>



    <!-- 搜索栏 -->
    <!-- <div class="search-bar">
      <input
        type="text"
        v-model="queryParams.keyword"
        placeholder="请输入关键词"
      />
      <button @click="performSearch">搜索</button>
      <button class="advanced-search-toggle" @click="toggleAdvancedSearch">
        {{ showAdvancedSearch ? '收起高级搜索' : '展开高级搜索' }}
      </button>
    </div> -->

    <!-- 高级搜索 -->
    <!-- <transition name="fade">
      <div class="filters">

        <div class="filter">
          <label>文档标签：</label>
          <div>
            <input type="radio" id="label1" value="" v-model="queryParams.navigation.doc_lable" @change="performSearch" class="hidden-radio" />
            <label for="label1" class="custom-radio">全部</label>&nbsp;

            <input type="radio" id="label2" value="政治" v-model="queryParams.navigation.doc_lable" @change="performSearch" class="hidden-radio" />
            <label for="label2" class="custom-radio">政治</label>&nbsp;

            <input type="radio" id="label3" value="经济" v-model="queryParams.navigation.doc_lable" @change="performSearch" class="hidden-radio" />
            <label for="label3" class="custom-radio">经济</label>&nbsp;

            <input type="radio" id="label4" value="社会" v-model="queryParams.navigation.doc_lable" @change="performSearch" class="hidden-radio" />
            <label for="label4" class="custom-radio">社会</label>&nbsp;

            <input type="radio" id="label5" value="科学" v-model="queryParams.navigation.doc_lable" @change="performSearch" class="hidden-radio" />
            <label for="label5" class="custom-radio">科学</label>&nbsp;

            <input type="radio" id="label6" value="宗教" v-model="queryParams.navigation.doc_lable" @change="performSearch" class="hidden-radio" />
            <label for="label6" class="custom-radio">宗教</label>&nbsp;

            <input type="radio" id="label7" value="国家" v-model="queryParams.navigation.doc_lable" @change="performSearch" class="hidden-radio" />
            <label for="label7" class="custom-radio">国家</label>
          </div>
        </div>


        <div class="filter">
          <label>文件来源：</label>
          <div>
            <input type="checkbox" id="ftp" value="ftp" v-model="queryParams.navigation.sourcename"/>
            <label for="ftp">FTP1</label>

            <input type="checkbox" id="ftp2" value="ftp2" v-model="queryParams.navigation.sourcename" v-hasPermi="['adv/search:ftp2']"/>
            <label for="ftp2" v-hasPermi="['adv/search:ftp2']">FTP2</label>

            <input type="checkbox" id="oracle" value="oracle" v-model="queryParams.navigation.sourcename"/>
            <label for="oracle">ORACLE</label>
          </div>
        </div>

        <div class="filter">
          <label>资源类型：</label>
          <div>
            <input type="checkbox" value="pdf" v-model="queryParams.navigation.file_type" /> PDF
            <input type="checkbox" value="word" v-model="queryParams.navigation.file_type" /> Word
            <input type="checkbox" value="ppt" v-model="queryParams.navigation.file_type" /> PPT
            <input type="checkbox" value="txt" v-model="queryParams.navigation.file_type" /> TXT
          </div>
        </div>

        <div class="filter">
          <label>语种：</label>
          <div>
            <input type="checkbox" value="中文" v-model="queryParams.navigation.language" /> 中文
            <input type="checkbox" value="俄语" v-model="queryParams.navigation.language" /> 俄文
            <input type="checkbox" value="蒙语" v-model="queryParams.navigation.language" /> 蒙文
            <input type="checkbox" value="英语" v-model="queryParams.navigation.language" /> 英文
          </div>
        </div>

      </div>
    </transition> -->




    <!-- 搜索结果列表 -->
    <!-- <div v-if="loading" class="loading">正在加载...</div>
    <div v-else class="search-results">
      <h3>搜索结果：</h3>
      <ul v-if="results">
        <li v-for="(result, index) in results" :key="index">
          <div class="result-title">{{ result.title }}</div>
          <div class="result-info" @click="openDetailPage(result)">
            <span>类型: {{ result.doc_title }}</span> |
            <span>年份: {{ result.file_path }}</span>
          </div>
        </li>
      </ul>
      <p v-else>未找到匹配的结果</p> -->

    <!-- 分页控制 -->
    <!-- <div class="pagination" v-if="totalPages > 1">
        <button @click="goToPage(1)" :disabled="currentPage === 1">首页</button>
        <button @click="goToPage(currentPage - 1)" :disabled="currentPage === 1">上一页</button>
        <span v-for="page in visiblePages" :key="page" @click="goToPage(page)" :class="{ active: page === currentPage }">{{ page }}</span>
        <button @click="goToPage(currentPage + 1)" :disabled="currentPage === totalPages">下一页</button>
        <button @click="goToPage(totalPages)" :disabled="currentPage === totalPages">尾页</button>
      </div> -->
    <el-dialog title="提示" :visible.sync="centerDialogVisible" width="30%" center>
      <span>请至少输入一个包含关键词</span>
      <span slot="footer" class="dialog-footer">
        <el-button @click="centerDialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="centerDialogVisible = false">确 定</el-button>
      </span>
    </el-dialog>
    <Footer></Footer>
    <!-- <DigFtpSourceForm ref="formRef" @success="getList" /> -->
    <DigFtpSourceForm ref="formRef" />
    <KKfile ref="KKfileRef"></KKfile>
    <Pdf ref="pdfRef"></Pdf>
    <!-- <Word ref="wordRef"></Word>
    <Doc ref="docRef"></Doc> -->
  </div>
</template>

<script>
// import Header from './header.vue';
// import Wordcloud from 'vuewordcloud';
// import axios from 'axios';
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 Word from './word.vue';
import Pdf from './pdf.vue';
// import Doc from './doc.vue';
import KKfile from './dialog.vue';
import $ from 'jquery';
import { getPath } from "@/utils/ruoyi";
import { Base64 } from 'js-base64';



export default {
  name: "SearchPage",
  components: {
    // Wordcloud,
    Footer,
    DigFtpSourceForm,
    KKfile,
    Pdf,
    // Doc,
    // Header
  },

  data() {
    return {
      // Base64
      Base64: require('js-base64').Base64,
      //判断是否有错词
      correctDataTrue:false,
      // 错词
      errorWord:'',
      trueWord: '',
      centerDialogVisible:false,
      isTranslate:false,
      isTranslateZw:false,
      isOracle: true,
      hasSuccessXGDDESC: false,
      hasSuccessXGDASC: false,
      hasSuccessCRTDESC: false,
      hasSuccessCRTASC: false,
      hasSuccessVISDESC: false,
      hasSuccessVISASC: false,
      hasSuccessCOLDESC: false,
      hasSuccessCOLASC: false,
      collectClick:null,
      visitClick:null,
      collectClickOne:0,
      visitClickOne:0,
      advancedSearchesArr:[
        {
          connectAll:{
            connectoptions: [{
              value: 'AND',
              label: '与'
            }, {
              value: 'OR',
              label: '或'
            }, {
              value: 'NOT',
              label: '非'
            }],
            connectvalue: 'AND'
          },
          advFieldAll:{
            advFieldoptions: [{
              value: 'doc_title',
              label: '标题'
            }, {
              value: 'doc_content',
              label: '正文'
            }],
            advFieldvalue: 'doc_title',
          },
          dynamicAll:{
            // dynamicTags:[

            // ],
            // inputVisible: false,
            inputValue: ''
          }

        }
      ],
      // 高级检索
      gjadvancedSearchesArr:[
        {
          gjconnectAll:{
            gjconnectoptions: [{
              value: 'AND',
              label: '与'
            }, {
              value: 'OR',
              label: '或'
            }],
            gjconnectvalue: 'AND'
          },
          gjadvFieldAll:{
            gjadvFieldoptions: [{
              value: 'doc_title',
              label: '标题'
            }, {
              value: 'doc_content',
              label: '正文'
            },{
              value: 'doc_keywords',
              label: '关键词'
            }, {
              value: 'doc_title_content_keywords',
              label: '全部'
            }],
            gjadvFieldvalue: 'doc_title',
          },
          gjfieldConnectAll:{
            gjfieldConnectoptions:[{
              value: 'AND',
              label: '包含'
            }
              // ,{
              //   value: 'NOT',
              //   label: '不包含'
              // }
            ],
            gjfieldConnectvalue: 'AND'
          },
          gjdynamicAll:{
            // dynamicTags:[

            // ],
            // inputVisible: false,
            gjinputValue: ''
          }

        }
      ],
      gjmaxLength: 5, // 设置高级检索最大数组长度

      // 多个关键词
      dynamicTags: [],
      inputVisible: false,
      inputValue: '',
      // 与或非筛选关系
      connectoptions: [{
        value: 'AND',
        label: '与'
      }, {
        value: 'OR',
        label: '或'
      }, {
        value: 'NOT',
        label: '非'
      }],
      connectvalue: 'AND',
      // 标题正文筛选关系
      advFieldoptions: [{
        value: 'doc_title',
        label: '标题'
      }, {
        value: 'doc_content',
        label: '正文'
      }],
      advFieldvalue: 'doc_title',
      // 抽屉
      table: false,
      // 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 },
      ],
      selectedValue: '全部', // 选中的值
      options: [ // 下拉列表选项
        { value: '全部', text: '全部' },
        { value: '选项1', text: '选项1' },
        { value: '选项2', text: '选项2' },
      ],
      RELEVANCEShow:false,//相关度排序
      crtimeShow: false,//时间排序
      visitsShow:false,//点赞量排序
      collectionShow:false,//收藏量排序
      activeIndex:0,
      xzgfListShow:true,
      publisherListShow:true,//语种
      cityListShow:true,
      docnotypeListShow:true,//年份
      tjListsData:[],//输入推荐
      searchQuery: "",
      userid:"",
      results: [],
      correctData:'',
      queryParams: {
        keyword: "",
        isuse:'',
        navigation: {
          sourcename: [],
          file_type: [],
          language: [],
          doc_lable: [],
          file_year:[],
          batch_no:[]
        },
        sort:{
          RELEVANCE:'desc'
        },
        sourcename: [],
        language: "",
        selectedYear: "",
        pageNo: 1,
        pageSize: 5,
        advField: [], // 搜索字段
        fieldType: [], // 字段类型
        connect: [], // 逻辑运算符
        advValue: [], // 搜索值
        fieldConnect:[],//包括不包括
        type: 1,
        checkstatus:1,
      },
      msgLXNameIndex: 0,
      msgLXNameList:[
        {
          label:'全部',
          value:''
        },
        {
          label: '军事',
          value: '军事'
        }
        ,
        {
          label: '政治',
          value: '政治'
        }
        ,
        {
          label: '经济',
          value: '经济'
        }
        ,
        {
          label: '外交',
          value: '外交'
        }

        ,
        {
          label: '安全',
          value: '安全'
        }
        ,
        {
          label: '科技',
          value: '科技'
        }
        ,
        {
          label: '宗教',
          value: '宗教'
        }

      ],
      advancedQuery: {
        keyword: "",
        and: "", // 包含所有以下词语（AND）条件
        or: "", // 包含任意以下词语（OR）条件
        not: "", // 不包含以下词语（NOT）条件
      },
      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:'',//详情页内容
      downloadShow: false,
      maxLength: 6, // 设置最大数组长度
      // 区间日期
      pickerOptions: {
        shortcuts: [{
          text: '最近一周',
          onClick(picker) {
            const end = new Date();
            const start = new Date();
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
            picker.$emit('pick', [start, end]);
          }
        }, {
          text: '最近一个月',
          onClick(picker) {
            const end = new Date();
            const start = new Date();
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
            picker.$emit('pick', [start, end]);
          }
        }, {
          text: '最近三个月',
          onClick(picker) {
            const end = new Date();
            const start = new Date();
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
            picker.$emit('pick', [start, end]);
          }
        }],

      },
      value1: '',
      tabValue: [],
      bqUpdateZT: false,
      XSHBBtn:false,
    };

  },
  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");
    },
    hasFtp3Perm() {
      return this.$store.getters.permissions.includes("adv/search:ftp3");
    },
    isAdmin() {
      // 根据您的实际管理员权限标识来调整
      // 检查权限标识
      const hasAdminPermission = this.$store.getters.roles.includes("super_admin") ||
        this.$store.getters.roles.includes("common");
      return hasAdminPermission ;
    }
  },
  methods: {
    // 高级检索添加行
    gjaddLine(index){

      var obj={
        gjconnectAll:{
          gjconnectoptions: [{
            value: 'AND',
            label: '与'
          }, {
            value: 'OR',
            label: '或'
          }],
          gjconnectvalue: 'AND'
        },
        gjadvFieldAll:{
          gjadvFieldoptions: [{
            value: 'doc_title',
            label: '标题'
          }, {
            value: 'doc_content',
            label: '正文'
          },{
            value: 'doc_keywords',
            label: '关键词'
          }, {
            value: 'doc_title_content_keywords',
            label: '全部'
          }],
          gjadvFieldvalue: 'doc_title',
        },
        gjfieldConnectAll:{
          gjfieldConnectoptions:[{
            value: 'AND',
            label: '包含'
          }
            ,{
              value: 'NOT',
              label: '不包含'
            }
          ],
          gjfieldConnectvalue: 'AND'
        },
        gjdynamicAll:{
          // dynamicTags:[

          // ],
          // inputVisible: false,
          gjinputValue: ''
        }

      }
      if(this.gjadvancedSearchesArr.length < this.gjmaxLength ){
        this.gjadvancedSearchesArr.push(obj);
      }else{
        this.$message({
          message: '已到添加上限！',
          type: 'success'
        });
      }



    },
    // 高级检索删除行

    gjdeleteLine(index){
      this.gjadvancedSearchesArr.splice(index, 1);
    },
    // 二次检索添加行
    addLine(index){

      var obj={
        connectAll:{
          connectoptions: [{
            value: 'AND',
            label: '与'
          }, {
            value: 'OR',
            label: '或'
          }, {
            value: 'NOT',
            label: '非'
          }],
          connectvalue: 'AND'
        },
        advFieldAll:{
          advFieldoptions: [{
            value: 'doc_title',
            label: '标题'
          }, {
            value: 'doc_content',
            label: '正文'
          }],
          advFieldvalue: 'doc_title',
        },
        dynamicAll:{
          // dynamicTags:[

          // ],
          // inputVisible: false,
          inputValue: ''
        }

      }
      if(this.advancedSearchesArr.length < this.maxLength ){
        this.advancedSearchesArr.push(obj);
      }else{
        this.$message({
          message: '已到添加上限！',
          type: 'success'
        });
      }



    },
    // 二次检索删除行

    deleteLine(index){
      this.advancedSearchesArr.splice(index, 1);
    },
    // addCondition(){
    //   advField.value.push(defaultLib.value.advField[0].fieldName)
    //   fieldType.value.push('string')
    //   connect.value.push('AND')
    // },
    //增加行
    // handleAddBonuspenaltLine() {
    //   if (this.bonuspenaltyData == undefined) {
    //     this.bonuspenaltyData = new Array();
    //   }
    //   let obj = {};

    //   this.bonuspenaltyData.push(obj);
    // },
    // //保存行
    // handlesaveBonuspenalt(a, b) {
    //   console.log(a + b);
    // },
    // //删除行
    // handleDeleteBonuspenalt(index) {
    //   console.log(index);
    // 	this.bonuspenaltyData.splice(index, 1)
    // },
    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);
    },
    /** 查询列表 */
    async getList() {
      this.performSearch();

    },

    // 获取时间
    handleDateChange(){
      console.log('value1='+this.value1[0]);
      console.log('value2='+this.value1[1]);
      this.performSearch();
    },

    // 点击切换
    hover_li(val){
      this.msgLXNameIndex = val;
    },
    // 文档标签
    setActive(index){
      this.activeIndex = index;
      this.queryParams.pageNo = 1;
      this.currentPage = 1
      this.performSearch();
    },
    // 资源类型
    // getXzgf(){
    //   this.xzgfListShow=!this.xzgfListShow
    // },
    // 语种
    // getPublisher(){
    //   this.publisherListShow=!this.publisherListShow
    // },
    // 文件来源
    // getCity(){
    //   this.cityListShow=!this.cityListShow
    // },
    // 年份
    // getDocnotype(){
    //   this.docnotypeListShow=!this.docnotypeListShow
    // },
    performSearch_s(){
      this.queryParams.type = 1;
      this.queryParams.pageNo = 1;
      this.currentPage= 1
      this.performSearch();
    },
    performSearch_cz(){
      this.queryParams.advValue = [];
      this.queryParams.isuse = '';
      this.advancedQuery.keyword='';
      this.advancedQuery.and='';
      this.advancedQuery.or='';
      this.advancedQuery.not='';
      this.queryParams.navigation.batch_no=[];
      this.queryParams.advField=[];
      this.queryParams.connect=[];
      this.queryParams.fieldType=[];
      // console.log('重置：'+this.queryParams.navigation.batch_no);
      this.queryParams.navigation.batch_no='';
      this.queryParams.navigation.file_type='';
      this.queryParams.navigation.file_type='';
      this.queryParams.navigation.file_type='';
      this.queryParams.navigation.file_type='';
      this.queryParams.navigation.sourcename=[];
      this.queryParams.navigation.language=[];
      this.queryParams.navigation.file_year=[];
      this.queryParams.navigation.file_type=[];

      this.gjadvancedSearchesArr=[
        {
          gjconnectAll:{
            gjconnectoptions: [{
              value: 'AND',
              label: '与'
            }, {
              value: 'OR',
              label: '或'
            }],
            gjconnectvalue: 'AND'
          },
          gjadvFieldAll:{
            gjadvFieldoptions: [{
              value: 'doc_title',
              label: '标题'
            }, {
              value: 'doc_content',
              label: '正文'
            },{
              value: 'doc_keywords',
              label: '关键词'
            }, {
              value: 'doc_title_content_keywords',
              label: '全部'
            }],
            gjadvFieldvalue: 'doc_title',
          },
          gjfieldConnectAll:{
            gjfieldConnectoptions:[{
              value: 'AND',
              label: '包含'
            }
              // ,{
              //   value: 'NOT',
              //   label: '不包含'
              // }
            ],
            gjfieldConnectvalue: 'AND'
          },
          gjdynamicAll:{
            // dynamicTags:[

            // ],
            // inputVisible: false,
            gjinputValue: ''
          }

        }
      ];

      // this.gaojiSearch()

    },

    // 搜索功能
    async performSearch() {
      // this.queryParams.type = 1;
      this.loading = true;
      // 拼接查询参数
      const searchParams = this.buildSearchParams();
      // console.log('isuse='+searchParams.isuse)
      // 发送请求到后端
      try {
        // 检查是否有“adv/search:ftp2”权限
        let res = null;
        if(this.hasFtp3Perm && !this.isAdmin){
          res = await searchPageApi.getSearchPageUSER(searchParams);
        }else{
          res = this.hasFtp2Perm
            ? await searchPageApi.getSearchPageJUEM(searchParams)
            : await searchPageApi.getSearchPageJM(searchParams);
        }
        this.results = res.data.list; // 假设返回的数据包含 results
        if (res.data.correctData != null) {
          this.correctData = res.data.correctData;
          this.errorWord = this.correctData.errorWord;
          this.trueWord = this.correctData.trueWord;
          this.correctDataTrue = true;
        } else {
          this.correctDataTrue = false;
        }
        this.totalResultsCount = res.data.total;
        this.poparray1 = res.data.category.people_lable;
        this.poparray2 = res.data.category.org_lable;
        this.poparray3 = res.data.category.area_lable;
        this.loading = false;
        this.bubblesData(this.poparray1,this.poparray2,this.poparray3);
        this.cancelForm();
      } catch (error) {
        console.error("搜索失败:", error);
        this.loading = false;
      }
    },
    // 传数据调用
    bubblesData(poparray1,poparray2,poparray3){
      // 词云1
      this.bubbleData(poparray1, ["label", "amount"], "wordCloud1");
      // 词云2
      this.bubbleData(poparray2, ["label", "amount"], "wordCloud2");
      // 词云3
      this.bubbleData(poparray3, ["label", "amount"], "wordCloud3");
    },
    // 拼接查询参数
    buildSearchParams() {
      const { keyword, navigation, advancedQuery,sort } = this.queryParams;
      const searchParams = {
        condition: 1,
        type: this.queryParams.type,
        keyword: keyword.trim(),
        metaId: this.queryParams.metaId,
        navigation: {

        },
        sort:{

        },
        pageNo: this.queryParams.pageNo,
        pageSize: this.queryParams.pageSize,
        advField: this.queryParams.advField, // 搜索字段
        fieldType: this.queryParams.fieldType, // 字段类型
        connect: this.queryParams.connect, // 逻辑运算符
        advValue: this.queryParams.advValue, // 搜索值
        fieldConnect:this.queryParams.fieldConnect,
        starttime: this.value1[0], // 开始时间
        endtime: this.value1[1], // 结束时间
        isuse: this.queryParams.isuse,
        checkstatus: this.queryParams.checkstatus

      };
      // console.log(navigation)
      if(navigation.sourcename.length){
        searchParams.navigation.sourcename = navigation.sourcename;
      }

      if(navigation.doc_lable.length){
        searchParams.navigation.doc_lable = [navigation.doc_lable];
      }

      if(navigation.file_type.length){
        searchParams.navigation.file_type = navigation.file_type;
      }
      if (navigation.file_type.length) {
        if (navigation.file_type.includes('word')) {
          if (!searchParams.navigation.file_type.includes("doc")) {
            searchParams.navigation.file_type.push("doc");
          }
          if (!searchParams.navigation.file_type.includes("docx")) {
            searchParams.navigation.file_type.push("docx");
          }
        } else {
          // 移除 'doc' 和 'docx'
          searchParams.navigation.file_type = searchParams.navigation.file_type.filter(type => type !== "doc" && type !== "docx");
        }

        if (navigation.file_type.includes('excel')) {
          if (!searchParams.navigation.file_type.includes("xls")) {
            searchParams.navigation.file_type.push("xls");
          }
          if (!searchParams.navigation.file_type.includes("xlsx")) {
            searchParams.navigation.file_type.push("xlsx");
          }
        } else {
          // 移除 'doc' 和 'docx'
          searchParams.navigation.file_type = searchParams.navigation.file_type.filter(type => type !== "xls" && type !== "xlsx");
        }

        if (navigation.file_type.includes('img')) {
          if (!searchParams.navigation.file_type.includes("jpeg")) {
            searchParams.navigation.file_type.push("jpeg");
          }
          if (!searchParams.navigation.file_type.includes("bmp")) {
            searchParams.navigation.file_type.push("bmp");
          }
          if (!searchParams.navigation.file_type.includes("png")) {
            searchParams.navigation.file_type.push("png");
          }
          if (!searchParams.navigation.file_type.includes("jpg")) {
            searchParams.navigation.file_type.push("jpg");
          }
          if (!searchParams.navigation.file_type.includes("tif")) {
            searchParams.navigation.file_type.push("tif");
          }
          if (!searchParams.navigation.file_type.includes("gif")) {
            searchParams.navigation.file_type.push("gif");
          }
          if (!searchParams.navigation.file_type.includes("tiff")) {
            searchParams.navigation.file_type.push("tiff");
          }
          if (!searchParams.navigation.file_type.includes("webp")) {
            searchParams.navigation.file_type.push("webp");
          }
        } else {
          // 移除 'doc' 和 'docx'
          searchParams.navigation.file_type = searchParams.navigation.file_type.filter(type => type !== "jpeg" && type !== "bmp" && type !== "png" && type !== "jpg" && type !== "tif" && type !== "gif" && type !== "tiff" && type !== "webp" );
        }

        if (navigation.file_type.includes('ppt')) {
          if (!searchParams.navigation.file_type.includes("ppt")) {
            searchParams.navigation.file_type.push("ppt");
          }
          if (!searchParams.navigation.file_type.includes("pptx")) {
            searchParams.navigation.file_type.push("pptx");
          }
        } else {
          // 移除 'ppt' 和 'pptx'
          searchParams.navigation.file_type = searchParams.navigation.file_type.filter(type => type !== "ppt" && type !== "pptx");
        }
      }

      if(navigation.language.length){
        searchParams.navigation.language = navigation.language;
      }

      if(navigation.file_year.length){
        searchParams.navigation.file_year = navigation.file_year;
      }

      searchParams.sort.RELEVANCE = this.queryParams.sort.RELEVANCE;



      searchParams.sort.file_updatetime = this.queryParams.sort.file_updatetime;

      searchParams.sort.doc_visit = this.queryParams.sort.doc_visit;

      searchParams.sort.doc_collect = this.queryParams.sort.doc_collect;

      if(navigation.batch_no.length){
        searchParams.navigation.batch_no=[];
        searchParams.navigation.batch_no[0] = navigation.batch_no;
      }
      //searchParams.navigation.file_type = [navigation.file_type];
      return searchParams;
    },
    // 拼接查询参数
    buildSearchParams1() {
      const { keyword, navigation, advancedQuery, sort } = this.queryParams;
      const searchParams = {
        condition: 1,
        type: this.queryParams.type,
        keyword: keyword.trim(),
        metaId: this.queryParams.metaId,
        navigation: {

        },
        sort: {

        },
        pageNo: this.queryParams.pageNo,
        pageSize: this.queryParams.pageSize,
        advField: this.queryParams.advField, // 搜索字段
        fieldType: this.queryParams.fieldType, // 字段类型
        connect: this.queryParams.connect, // 逻辑运算符
        advValue: this.queryParams.advValue, // 搜索值
        fieldConnect: this.queryParams.fieldConnect, // 字段类型
        starttime: this.value1[0], // 开始时间
        endtime: this.value1[1], // 结束时间
        isuse: this.queryParams.isuse,
        checkstatus: this.queryParams.checkstatus
      };
      // console.log(navigation)
      if (navigation.sourcename.length) {
        searchParams.navigation.sourcename = navigation.sourcename;
      }

      if (navigation.doc_lable.length) {
        searchParams.navigation.doc_lable = [navigation.doc_lable];
      }

      if (navigation.file_type.length) {
        searchParams.navigation.file_type = navigation.file_type;
      }
      if (navigation.file_type.length) {
        if (navigation.file_type.includes('word')) {
          if (!searchParams.navigation.file_type.includes("doc")) {
            searchParams.navigation.file_type.push("doc");
          }
          if (!searchParams.navigation.file_type.includes("docx")) {
            searchParams.navigation.file_type.push("docx");
          }
        } else {
          // 移除 'doc' 和 'docx'
          searchParams.navigation.file_type = searchParams.navigation.file_type.filter(type => type !== "doc" && type !== "docx");
        }

        if (navigation.file_type.includes('excel')) {
          if (!searchParams.navigation.file_type.includes("xls")) {
            searchParams.navigation.file_type.push("xls");
          }
          if (!searchParams.navigation.file_type.includes("xlsx")) {
            searchParams.navigation.file_type.push("xlsx");
          }
        } else {
          // 移除 'doc' 和 'docx'
          searchParams.navigation.file_type = searchParams.navigation.file_type.filter(type => type !== "xls" && type !== "xlsx");
        }

        if (navigation.file_type.includes('img')) {
          if (!searchParams.navigation.file_type.includes("jpeg")) {
            searchParams.navigation.file_type.push("jpeg");
          }
          if (!searchParams.navigation.file_type.includes("bmp")) {
            searchParams.navigation.file_type.push("bmp");
          }
          if (!searchParams.navigation.file_type.includes("png")) {
            searchParams.navigation.file_type.push("png");
          }
          if (!searchParams.navigation.file_type.includes("jpg")) {
            searchParams.navigation.file_type.push("jpg");
          }
          if (!searchParams.navigation.file_type.includes("tif")) {
            searchParams.navigation.file_type.push("tif");
          }
          if (!searchParams.navigation.file_type.includes("gif")) {
            searchParams.navigation.file_type.push("gif");
          }
          if (!searchParams.navigation.file_type.includes("tiff")) {
            searchParams.navigation.file_type.push("tiff");
          }
          if (!searchParams.navigation.file_type.includes("webp")) {
            searchParams.navigation.file_type.push("webp");
          }
        } else {
          // 移除 'doc' 和 'docx'
          searchParams.navigation.file_type = searchParams.navigation.file_type.filter(type => type !== "jpeg" && type !== "bmp" && type !== "png" && type !== "jpg" && type !== "tif" && type !== "gif" && type !== "tiff" && type !== "webp");
        }

        if (navigation.file_type.includes('ppt')) {
          if (!searchParams.navigation.file_type.includes("ppt")) {
            searchParams.navigation.file_type.push("ppt");
          }
          if (!searchParams.navigation.file_type.includes("pptx")) {
            searchParams.navigation.file_type.push("pptx");
          }
        } else {
          // 移除 'ppt' 和 'pptx'
          searchParams.navigation.file_type = searchParams.navigation.file_type.filter(type => type !== "ppt" && type !== "pptx");
        }
      }

      if (navigation.language.length) {
        searchParams.navigation.language = navigation.language;
      }

      if (navigation.file_year.length) {
        searchParams.navigation.file_year = navigation.file_year;
      }

      searchParams.sort.RELEVANCE = this.queryParams.sort.RELEVANCE;



      searchParams.sort.file_updatetime = this.queryParams.sort.file_updatetime;

      searchParams.sort.doc_visit = this.queryParams.sort.doc_visit;

      searchParams.sort.doc_collect = this.queryParams.sort.doc_collect;

      // if (this.RELEVANCEShow == true) {
      //   searchParams.sort.RELEVANCE = 'desc';
      // }
      // if (this.crtimeShow == true) {
      //   searchParams.sort.file_updatetime = 'desc';
      // }
      // if (this.visitsShow == true) {
      //   searchParams.sort.doc_visit = 'desc';
      // }
      // if (this.collectionShow == true) {
      //   searchParams.sort.doc_collect = 'desc';
      // }
      if (navigation.batch_no.length) {
        searchParams.navigation.batch_no = [];
        searchParams.navigation.batch_no[0] = navigation.batch_no;
      }
      //searchParams.navigation.file_type = [navigation.file_type];
      return searchParams;
    },
    // 按相关度
    searchRelevance(){
      this.RELEVANCEShow = true;
      this.crtimeShow = false;
      this.visitsShow = false;
      this.collectionShow = false;
      if (this.queryParams.sort.RELEVANCE == 'desc'){
        this.hasSuccessXGDDESC = false
        this.hasSuccessXGDASC = true
        this.hasSuccessCRTDESC = false
        this.hasSuccessCRTASC = false
        this.hasSuccessVISDESC = false
        this.hasSuccessVISASC = false
        this.hasSuccessCOLDESC = false
        this.hasSuccessCOLASC = false
        this.queryParams.sort.RELEVANCE = 'asc';
      }else{
        this.hasSuccessXGDDESC = true
        this.hasSuccessXGDASC = false
        this.hasSuccessCRTDESC = false
        this.hasSuccessCRTASC = false
        this.hasSuccessVISDESC = false
        this.hasSuccessVISASC = false
        this.hasSuccessCOLDESC = false
        this.hasSuccessCOLASC = false
        this.queryParams.sort.RELEVANCE = 'desc';
      }
      this.queryParams.sort.file_updatetime = '';
      this.queryParams.sort.doc_visit = '';
      this.queryParams.sort.doc_collect = '';
      this.performSearch();
    },
    // 按创建时间
    searchCrtime(){
      this.RELEVANCEShow = false;
      this.crtimeShow = true;
      this.visitsShow = false;
      this.collectionShow = false;
      if (this.queryParams.sort.file_updatetime == 'desc') {
        this.hasSuccessCRTDESC = false
        this.hasSuccessCRTASC = true
        this.hasSuccessXGDDESC = false
        this.hasSuccessXGDASC = false
        this.hasSuccessVISDESC = false
        this.hasSuccessVISASC = false
        this.hasSuccessCOLDESC = false
        this.hasSuccessCOLASC = false
        this.queryParams.sort.file_updatetime = 'asc';
      } else {
        this.hasSuccessCRTDESC = true
        this.hasSuccessCRTASC = false
        this.hasSuccessXGDDESC = false
        this.hasSuccessXGDASC = false
        this.hasSuccessVISDESC = false
        this.hasSuccessVISASC = false
        this.hasSuccessCOLDESC = false
        this.hasSuccessCOLASC = false
        this.queryParams.sort.file_updatetime = 'desc';
      }
      this.queryParams.sort.RELEVANCE = '';
      this.queryParams.sort.doc_visit = '';
      this.queryParams.sort.doc_collect = '';

      this.performSearch();
    },
    // 按点赞量
    searchVisits(){
      this.RELEVANCEShow = false;
      this.crtimeShow = false;
      this.visitsShow = true;
      this.collectionShow = false;
      if (this.queryParams.sort.doc_visit == 'desc') {
        this.hasSuccessVISDESC = false
        this.hasSuccessVISASC = true
        this.hasSuccessXGDDESC = false
        this.hasSuccessXGDASC = false
        this.hasSuccessCRTDESC = false
        this.hasSuccessCRTASC = false
        this.hasSuccessCOLDESC = false
        this.hasSuccessCOLASC = false
        this.queryParams.sort.doc_visit = 'asc';
      } else {
        this.hasSuccessVISDESC = true
        this.hasSuccessVISASC = false
        this.hasSuccessXGDDESC = false
        this.hasSuccessXGDASC = false
        this.hasSuccessCRTDESC = false
        this.hasSuccessCRTASC = false
        this.hasSuccessCOLDESC = false
        this.hasSuccessCOLASC = false
        this.queryParams.sort.doc_visit = 'desc';
      }
      this.queryParams.sort.RELEVANCE = '';
      this.queryParams.sort.file_updatetime = '';
      this.queryParams.sort.doc_collect = '';
      this.performSearch();
    },
    // 按收藏量
    searchCollection(){
      this.RELEVANCEShow = false;
      this.crtimeShow = false;
      this.visitsShow = false;
      this.collectionShow = true;
      console.log('doc_collect='+this.queryParams.sort.doc_collect)
      if (this.queryParams.sort.doc_collect == 'desc') {
        this.hasSuccessCOLDESC = false
        this.hasSuccessCOLASC = true
        this.hasSuccessXGDDESC = false
        this.hasSuccessXGDASC = false
        this.hasSuccessCRTDESC = false
        this.hasSuccessCRTASC = false
        this.hasSuccessVISDESC = false
        this.hasSuccessVISASC = false
        this.queryParams.sort.doc_collect = 'asc';
      } else {
        this.hasSuccessCOLDESC = true
        this.hasSuccessCOLASC = false
        this.hasSuccessXGDDESC = false
        this.hasSuccessXGDASC = false
        this.hasSuccessCRTDESC = false
        this.hasSuccessCRTASC = false
        this.hasSuccessVISDESC = false
        this.hasSuccessVISASC = false
        this.queryParams.sort.doc_collect = 'desc';
      }
      this.queryParams.sort.RELEVANCE = '';
      this.queryParams.sort.file_updatetime = '';
      this.queryParams.sort.doc_visit = '';
      this.performSearch();
    },
    toggleAdvancedSearch() {
      this.queryParams.advValue = [];
      this.advancedQuery.keyword='';
      this.advancedQuery.and='';
      this.advancedQuery.or='';
      this.advancedQuery.not='';
      this.showAdvancedSearch = !this.showAdvancedSearch;
      this.showSecondarySearch = false;
      this.cancelForm();
    },
    toggleSecondarySearch() {
      this.queryParams.advValue = [];
      this.advancedQuery.keyword='';
      this.advancedQuery.and='';
      this.advancedQuery.or='';
      this.advancedQuery.not='';
      this.showSecondarySearch = !this.showSecondarySearch;
      this.showAdvancedSearch = false;
      this.cancelForm();
    },
    toggleBatchSearch() {
      this.queryParams.advValue = [];
      this.advancedQuery.keyword='';
      this.advancedQuery.and='';
      this.advancedQuery.or='';
      this.advancedQuery.not='';
      this.cancelForm();
      this.showBatchSearch = !this.showBatchSearch;
    },
    // 添加新的条件输入框
    addCondition(type) {
      if (type === 'and') {
        this.advancedQuery.and.push(""); // 添加AND条件
      } else if (type === 'or') {
        this.advancedQuery.or.push(""); // 添加OR条件
      } else if (type === 'not') {
        this.advancedQuery.not.push(""); // 添加NOT条件
      }
    },

    gaojiSearch(){


      this.queryParams.pageNo = 1;
      this.currentPage= 1;
      this.applyAdvancedSearch1();





      // if(this.queryParams.keyword =='' && this.advancedQuery.keyword==''){
      //   if (this.advancedQuery.and != '' && this.advancedQuery.keyword == '' ){
      //     if (this.queryParams.not != '' && this.advancedQuery.keyword == '') {
      //       if (this.advancedQuery.and != '') {
      //         this.applyAdvancedSearch1();
      //       } else if (this.advancedQuery.or != '') {
      //         this.applyAdvancedSearch1();
      //       } else {
      //         this.advancedQueryGj();
      //       }
      //     }else{
      //       this.applyAdvancedSearch1();
      //     }
      //   } else if (this.advancedQuery.or != '' && this.advancedQuery.keyword == '' ){
      //     if (this.queryParams.not != '' && this.advancedQuery.keyword == '') {
      //       if (this.advancedQuery.and != '') {
      //         this.applyAdvancedSearch1();
      //       } else if (this.advancedQuery.or != '') {
      //         this.applyAdvancedSearch1();
      //       } else {
      //         this.advancedQueryGj();
      //       }
      //     } else {
      //       this.applyAdvancedSearch1();
      //     }

      //   }else{
      //     this.advancedQueryGj();
      //   }
      // }else if(this.queryParams.keyword !='' && this.advancedQuery.keyword==''){
      //     this.advancedQuery.keyword = this.queryParams.keyword;
      //     this.applyAdvancedSearch()
      //     this.advancedQuery.keyword ='';
      // }else if(this.queryParams.keyword !='' && this.advancedQuery.keyword !=''){
      //   // this.queryParams.keyword = '';
      //   this.applyAdvancedSearch();
      // }else if(this.queryParams.keyword =='' && this.advancedQuery.keyword !=''){
      //   this.applyAdvancedSearch();
      // }else{
      //   this.applyAdvancedSearch();
      // }

    },
    // gaojiSearch1(){

    //   if(this.queryParams.keyword==''){
    //     this.performSearch_s();
    //   }else if(this.advancedQuery.keyword==''){
    //       this.advancedQuery.keyword = this.queryParams.keyword;
    //       this.applyAdvancedSearch1();
    //       this.advancedQuery.keyword ='';
    //   }else{
    //     this.applyAdvancedSearch1();
    //   }

    //   // }
    // },
    //查看原文路径
    open(file_path) {
      this.$notify.closeAll();
      this.$notify({
        title: '原文路径',
        message: file_path,
        duration: 0,
        offset: 200
      });
      // this.$alert( file_path , '原文路径', {
      //   confirmButtonText: '确定',
      //   // callback: action => {
      //   //   this.$message({
      //   //     type: 'info',
      //   //     message: `action: ${ action }`
      //   //   });
      //   // }
      // });
    },


    // 应用高级搜索
    async applyAdvancedSearch() {

      this.currentPage = 1;

      let advField = [];
      let fieldType = [];
      let connect = [];
      let advValue = [];

      // 处理关键词
      if (this.advancedQuery.keyword.trim()) {
        advField.push("doc_adv");
        fieldType.push("string");
        //connect.push(""); // 关键词没有逻辑运算符
        advValue.push(this.advancedQuery.keyword.trim());
      }

      // 处理AND条件
      if (this.advancedQuery.and.trim()) {
        advField.push("doc_adv_all");
        fieldType.push("string");
        connect.push("AND");
        //advValue.push(this.advancedQuery.and.trim().split(" ").map(word => word.trim())); // 按空格分隔并去掉空格
        advValue.push(this.advancedQuery.and.trim());
      }

      // 处理OR条件
      if (this.advancedQuery.or.trim()) {
        advField.push("doc_adv_one");
        fieldType.push("string");
        connect.push("OR");
        //advValue.push(this.advancedQuery.or.trim().split(" ").map(word => word.trim())); // 按空格分隔并去掉空格
        advValue.push(this.advancedQuery.or.trim());
      }

      // 处理NOT条件
      if (this.advancedQuery.not.trim()) {
        advField.push("doc_adv_not");
        fieldType.push("string");
        connect.push("NOT");
        //advValue.push(this.advancedQuery.not.trim().split(" ").map(word => word.trim())); // 按空格分隔并去掉空格
        advValue.push(this.advancedQuery.not.trim());
      }


      // 拼接最终的搜索请求参数
      this.queryParams.type = 2;
      this.queryParams.advField = advField;
      this.queryParams.fieldType = fieldType;
      this.queryParams.connect = connect;
      this.queryParams.advValue = advValue;

      // 调用搜索接口
      this.queryParams.type = 2;
      this.loading = true;
      // 拼接查询参数
      const searchParams = this.buildSearchParams();
      // 发送请求到后端
      try {
        // 检查是否有“adv/search:ftp2”权限
        let res = null;
        if(this.hasFtp3Perm && !this.isAdmin){
          res = await searchPageApi.getSearchPageUSER(searchParams);
        }else{
          res = this.hasFtp2Perm
            ? await searchPageApi.getSearchPageJUEM(searchParams)
            : await searchPageApi.getSearchPageJM(searchParams);
        }
        this.results = res.data.list; // 假设返回的数据包含 results
        if (res.data.correctData != null) {
          this.correctData = res.data.correctData;
          this.errorWord = this.correctData.errorWord;
          this.trueWord = this.correctData.trueWord;
          this.correctDataTrue = true;
        }else{
          this.correctDataTrue = false;
        }
        this.totalResultsCount = res.data.total;
        this.loading = false;
      } catch (error) {
        // console.error("搜索失败:", error);
        this.loading = false;
      }
    },

    // 应用高级搜索
    async applyAdvancedSearch1() {

      let advField = [];
      let fieldType = [];
      let connect = [];
      let advValue = [];
      let fieldConnect=[];


      for(var i=0;i<this.gjadvancedSearchesArr.length;i++){
        // 关键词
        advValue.push(this.gjadvancedSearchesArr[i].gjdynamicAll.gjinputValue);
        // string
        fieldType.push("string");
        // 处理与或非条件,包含不包含
        if(this.gjadvancedSearchesArr.length==1){
          connect.push('');
          fieldConnect.push('');
        }else{
          connect.push(this.gjadvancedSearchesArr[i].gjconnectAll.gjconnectvalue);
          fieldConnect.push(this.gjadvancedSearchesArr[i].gjfieldConnectAll.gjfieldConnectvalue);
        }
        // 处理标题正文条件
        advField.push(this.gjadvancedSearchesArr[i].gjadvFieldAll.gjadvFieldvalue);

      }

      for(var i=0;i<connect.length;i++){
        if(i==0){
          connect.splice(i,1);
        }
      }

      for(var i=0;i<fieldConnect.length;i++){
        if(i==0){
          fieldConnect.splice(i,1);
        }
      }



      // // 处理关键词
      //   advField.push("doc_adv");
      //   fieldType.push("string");
      //   advValue.push(" ");


      // // 处理AND条件
      // if (this.advancedQuery.and.trim()) {
      //   advField.push("doc_adv_all");
      //   fieldType.push("string");
      //   connect.push("AND");
      //   //advValue.push(this.advancedQuery.and.trim().split(" ").map(word => word.trim())); // 按空格分隔并去掉空格
      //   advValue.push(this.advancedQuery.and.trim());
      // }

      // // 处理OR条件
      // if (this.advancedQuery.or.trim()) {
      //   advField.push("doc_adv_one");
      //   fieldType.push("string");
      //   connect.push("OR");
      //   //advValue.push(this.advancedQuery.or.trim().split(" ").map(word => word.trim())); // 按空格分隔并去掉空格
      //   advValue.push(this.advancedQuery.or.trim());
      // }

      // // 处理NOT条件
      // if (this.advancedQuery.not.trim()) {
      //   advField.push("doc_adv_not");
      //   fieldType.push("string");
      //   connect.push("NOT");
      //   //advValue.push(this.advancedQuery.not.trim().split(" ").map(word => word.trim())); // 按空格分隔并去掉空格
      //   advValue.push(this.advancedQuery.not.trim());
      // }
      // 拼接最终的搜索请求参数
      this.queryParams.type = 2;
      this.queryParams.advField = advField;
      this.queryParams.fieldType = fieldType;
      this.queryParams.connect = connect;
      this.queryParams.advValue = advValue;
      this.queryParams.fieldConnect=fieldConnect;
      // 调用搜索接口
      this.queryParams.type = 2;
      this.loading = true;
      // 拼接查询参数
      const searchParams = this.buildSearchParams1();
      // 发送请求到后端
      try {
        // 检查是否有“adv/search:ftp2”权限
        let res = null;
        if(this.hasFtp3Perm && !this.isAdmin){
          res = await searchPageApi.getSearchPageUSER(searchParams);
        }else{
          res = this.hasFtp2Perm
            ? await searchPageApi.getSearchPageJUEM(searchParams)
            : await searchPageApi.getSearchPageJM(searchParams);
        }
        this.results = res.data.list; // 假设返回的数据包含 results
        this.totalResultsCount = res.data.total;
        if (res.data.correctData != null) {
          this.correctData = res.data.correctData;
          this.errorWord = this.correctData.errorWord;
          this.trueWord = this.correctData.trueWord;
          this.correctDataTrue = true;
        } else {
          this.correctDataTrue = false;
        }
        this.loading = false;
      } catch (error) {
        // console.error("搜索失败:", error);
        this.loading = false;
      }
    },
    // 应用二次搜索
    async applyAdvancedSearch2() {
      let advField = [];
      let fieldType = [];
      let connect = [];
      let advValue = [];
      // let fieldConnect=[];
      this.performSearch_cz();
      for(var i=0;i<this.advancedSearchesArr.length;i++){
        // 关键词
        advValue.push(this.advancedSearchesArr[i].dynamicAll.inputValue);
        // string
        fieldType.push("string");
        // 处理与或非条件
        if(this.advancedSearchesArr.length==1){
          connect.push('')
        }else{
          connect.push(this.advancedSearchesArr[i].connectAll.connectvalue);
        }
        // 处理标题正文条件
        advField.push(this.advancedSearchesArr[i].advFieldAll.advFieldvalue);
      }
      for(var i=0;i<connect.length;i++){
        if(i==0){
          connect.splice(i,1);
        }
      }
      // 拼接最终的搜索请求参数
      this.queryParams.type = 2;
      this.queryParams.advField = advField;
      this.queryParams.fieldType = fieldType;
      this.queryParams.connect = connect;
      this.queryParams.advValue = advValue;
      this.queryParams.fieldConnect= null;
      // 调用搜索接口
      this.queryParams.type = 2;
      this.loading = true;
      // 拼接查询参数
      const searchParams = this.buildSearchParams();
      // 发送请求到后端
      try {
        // 检查是否有“adv/search:ftp2”权限
        let res = null;
        if(this.hasFtp3Perm && !this.isAdmin){
          res = await searchPageApi.getSearchPageUSER(searchParams);
        }else{
          res = this.hasFtp2Perm
            ? await searchPageApi.getSearchPageJUEM(searchParams)
            : await searchPageApi.getSearchPageJM(searchParams);
        }
        this.results = res.data.list; // 假设返回的数据包含 results
        this.totalResultsCount = res.data.total;
        if (res.data.correctData != null) {
          this.correctData = res.data.correctData;
          this.errorWord = this.correctData.errorWord;
          this.trueWord = this.correctData.trueWord;
          this.correctDataTrue = true;
        } else {
          this.correctDataTrue = false;
        }
        this.loading = false;
      } catch (error) {
        // console.error("搜索失败:", error);
        this.loading = false;
      }
    },
    // 应用高级搜索
    // async applyAdvancedSearch1() {
    //   let advField = [];
    //   let fieldType = [];
    //   let connect = [];
    //   let advValue = [];
    //   // 处理关键词
    //   if (this.advancedQuery.keyword.trim()) {
    //     advField.push("doc_title");
    //     fieldType.push("string");
    //     //connect.push(""); // 关键词没有逻辑运算符
    //     advValue.push(this.advancedQuery.keyword.trim());
    //   }
    //   // 处理AND条件
    //   if (this.advancedQuery.and.trim()) {
    //     advField.push("doc_content");
    //     fieldType.push("string");
    //     connect.push("AND");
    //     //advValue.push(this.advancedQuery.and.trim().split(" ").map(word => word.trim())); // 按空格分隔并去掉空格
    //     advValue.push(this.advancedQuery.and.trim());
    //   }
    //   // 处理OR条件
    //   if (this.advancedQuery.or.trim()) {
    //     advField.push("doc_content");
    //     fieldType.push("string");
    //     connect.push("OR");
    //     //advValue.push(this.advancedQuery.or.trim().split(" ").map(word => word.trim())); // 按空格分隔并去掉空格
    //     advValue.push(this.advancedQuery.or.trim());
    //   }
    //   // 处理NOT条件
    //   if (this.advancedQuery.not.trim()) {
    //     advField.push("doc_content");
    //     fieldType.push("string");
    //     connect.push("NOT");
    //     //advValue.push(this.advancedQuery.not.trim().split(" ").map(word => word.trim())); // 按空格分隔并去掉空格
    //     advValue.push(this.advancedQuery.not.trim());
    //   }
    //   // 拼接最终的搜索请求参数
    //   this.queryParams.type = 2;
    //   this.queryParams.advField = advField;
    //   this.queryParams.fieldType = fieldType;
    //   this.queryParams.connect = connect;
    //   this.queryParams.advValue = advValue;
    //   // 调用搜索接口
    //   this.queryParams.type = 2;
    //   this.loading = true;
    //   // 拼接查询参数
    //   const searchParams = this.buildSearchParams();
    //   // 发送请求到后端
    //   try {
    //     // 检查是否有“adv/search:ftp2”权限
    //     const res = this.hasFtp2Perm
    //       ? await searchPageApi.getSearchPageJUEM(searchParams)
    //       : await searchPageApi.getSearchPageJM(searchParams);
    //     this.results = res.data.list; // 假设返回的数据包含 results
    //     this.totalResultsCount = res.data.total;
    //     this.loading = false;
    //   } catch (error) {
    //     // console.error("搜索失败:", error);
    //     this.loading = false;
    //   }
    // },
    goToPage(page) {
      if (page > 0 && page <= this.totalPages) {
        this.currentPage = page;
        this.queryParams.pageNo = page; // 更新分页参数
        this.performSearch(); // 重新请求数据
      }
    },
    handleCurrentChange(newPage) {
      this.currentPage = newPage;
      this.queryParams.pageNo = newPage; // 更新分页参数
      this.performSearch();
    },
    // openDetailPage(result) {
    //   localStorage.setItem('detailData', JSON.stringify(result));
    //   // 打开新标签页
    //   window.open('/#/search/detail', '_blank');
    // },
    openCollectionPage(result) {
      // localStorage.setItem('detailData', JSON.stringify(result));
      // 打开新标签页
      window.open('/#/search/collection');
    },
    openMyItems(result) {
      // localStorage.setItem('detailData', JSON.stringify(result));
      // 打开新标签页
      window.open('/#/search/myItems');
    },
    openAnalysisPage(result) {
      localStorage.setItem('detailData', JSON.stringify(result));
      // 打开新标签页
      window.open('/#/search/analysis');
    },
    // 输入推荐接口
    async  changeVersion(){
      $('.inputtj').show();
      const searchParamsV = {
        condition: 1,
        type: 3,
        keyword: this.queryParams.keyword,
        navigation: {

        },
        sort: {},
        libType: 1,
        pageNo: 1,
        pageSize: 5
      };
      try {
/*        const res = this.hasFtp2Perm
          ? await searchPageApi.getSearchPageJUEM(searchParamsV)
          : await searchPageApi.getSearchPageJM(searchParamsV)*/
        let res = null;
        if(this.hasFtp3Perm){
          res = await searchPageApi.getSearchPageUSER(searchParamsV);
        }else{
          res = this.hasFtp2Perm
            ? await searchPageApi.getSearchPageJUEM(searchParamsV)
            : await searchPageApi.getSearchPageJM(searchParamsV);
        }
        this.tjListsData = res.data.list;
        console.log(this.tjListsData);
      } catch (error) {
        console.error("搜索失败:", error);
        // this.loading = false;
      }

    },
    // 点击输入推荐
    showValue(event){
      var e = event.currentTarget;
      // console.log('输入推荐：'+e.innerHTML);
      this.queryParams.keyword=e.innerText;
      $('.inputtj').hide();
      // this.askAnswer();
    },
    /*debouncedSearch: _.debounce(function () {
      this.performSearch();
    }, 300),*/

    // 词云方法开始
    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 = 20;
      // 节点之间的斥力因子,值越大,气泡间距越大
      let repulsion = 80;
      // 根据气泡数量配置基础大小和斥力因子（以实际情况进行适当调整，使气泡合理分布）
      if (data.length < 5) {
        basicSize = 40;
        repulsion = 200;
      }
      if (data.length >= 5 && data.length < 10) {
        basicSize = 40;
        repulsion = 150;
      }
      // 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 * 1.5) / 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",
        bubble3D: {
          // 设置数据点的范围
          // boundingBox: {
          //     x: { min: 0, max: 100 },
          //     y: { min: 0, max: 100 },
          //     z: { min: 0, max: 100 }
          // }
        },
        series: [

          {
            type: "graph",
            layout: "force",//force
            force: {
              repulsion: 120,
              edgeLength: [100,300,200],
            },
            // 是否开启鼠标缩放和平移漫游
            roam: false,
            // layoutSize: {
            //     width: '80%',
            //     height: '80%'
            // },
            scale: true,
            label: { normal: { show: true } },
            data: bubbleData,
          },
        ],
      };
      bubbleChart.setOption(bubbleOptions);
      bubbleChart.on('click',(params) => {
        // console.log('bubbleChart----click---:',params,'------',params.name);
        this.getCySearch(params.name);
      });
    },
    // 词云方法结束
    getCySearch(name){
      this.queryParams.keyword = name;
      this.gaojiSearch();
    },
    // 打开详情页内容开始
    openDetailCont(result){
      this.backTop();
      this.table=true;
      this.bqUpdateZT = false;
      localStorage.setItem('detailData', JSON.stringify(result));
      const storedData = localStorage.getItem('detailData');
      // console.log("storedData="+JSON.parse(storedData).uid);
      console.log('file_type-' + result.sourcename)
      if (result.sourcename == 'oracle' ){
        this.isOracle = false;
        console.log('isOracle-'+this.isOracle)
      }
      this.tabValue = [];
      var strDocLable = JSON.parse(storedData).doc_lable;
      if (strDocLable != null){
        if (strDocLable.includes(';')) {
          let arr = strDocLable.split(";").map(item => item.trim());
          this.tabValue = arr;
        } else {
          this.tabValue.push(JSON.parse(storedData).doc_lable);
        }
      }
      this.clickOne(JSON.parse(storedData).uid,JSON.parse(storedData).docid);
      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 ;
        // }
        if (this.detailData.sourcename === 'oracle' && this.detailData.attpath !=null ){
          this.downloadShow = true;
        }else{
          this.downloadShow = false;
        }
        // console.log(this.detailData.language);
        if(this.detailData.language === '中文'){
          this.isTranslateZw = false ;
        }else{
          this.isTranslateZw = true ;
        }
      } else {
        this.$router.push('/'); // 数据未找到时跳转
      }
    },
    // html内容转换
    decodeHtmlEntity(encodedStr) {
      const doc = new DOMParser().parseFromString(encodedStr, "text/html");
      return doc.body.textContent || doc.body.innerText;
    },
    // 下载文件
    getDownload(){
      const storedData = localStorage.getItem('detailData');
      this.detailData = JSON.parse(storedData);
      const searchParams = {
        filePath: this.detailData.attpath,
        // filePath: '/TRS/temp/1.jpg',
        // sourcename: this.detailData.sourcename,
        // fileName: this.detailData.file_name,
        fileName: this.detailData.attname,
        fileType: this.detailData.atttype
      };
      searchPageApi.getDownload(searchParams)
        .then(response=> {
          const blob = new Blob([response], { type: 'application/octet-stream' });
          // const blob = new Blob([response], { type: 'arraybuffer' });

          const url = window.URL.createObjectURL(blob);
          const a = document.createElement('a');

          const file_name = this.detailData.attname;// 截取文件名
          // const file_name = '1.jpg';// 截取文件名

          // console.log(file_name);
          a.style.display = 'none';
          a.href = url;
          a.download = file_name; // 设置下载的文件名
          document.body.appendChild(a);
          a.click();
          window.URL.revokeObjectURL(url);
          a.remove();
        })
        .catch(error => {
          console.error('文件下载失败！:', error);
        });

    },

    //预览
    // getWordView(data){
    //   if ( data.file_type.includes("docx")){
    //     this.$refs["wordRef"].open(data);
    //     console.log('打开docx');
    //   }
    //   //  else if (data.file_type.includes("doc")){
    //   //   this.$refs["docRef"].open(data);
    //   //   console.log('打开doc');
    //   // }
    //   else if ( data.file_type.includes("pdf")) {
    //     this.$refs["pdfRef"].open(data);
    //     console.log('打开PDF');
    //   } else{
    //     this.$message({
    //       message: '该文件不支持在线预览，请自行下载查看！',
    //       type: 'warning'
    //     });
    //   }
    // },

    getWordView(data){
      // 新版文件打开
      if (data.sourcename == "ftp"){
        var originUrl = 'http://114.48.110.251:8088/' + data.file_path.replace("/E:","") ;  //要预览文件的访问地址
        window.open('http://114.48.101.215:18012/onlinePreview?url=' + encodeURIComponent(Base64.encode(originUrl)));
      } else if (data.sourcename == "ftp2"){
        var originUrl = 'http://114.48.110.212:8088/' + data.file_path ;  //要预览文件的访问地址
        window.open('http://114.48.101.215:18012/onlinePreview?url=' + encodeURIComponent(Base64.encode(originUrl)));
      }
      // 旧版文件打开
      // if (data.file_type.includes("pdf")){
      //   this.$refs["pdfRef"].open(data);
      //   console.log('打开PDF');
      // } else{
      //   this.getWordViewKK(data);
      // }
    },
/*    getWordView(data){
      // 新版文件打开
      if (data.sourcename == "ftp"){
        var originUrl = 'ftp://114.48.110.251/' + data.file_path ;  //要预览文件的访问地址
        // var originUrl = 'ftp://192.168.0.113/数据资源整合应用系统测试大纲-0121改-辅助演示.doc';  //要预览文件的访问地址

        var previewUrl = originUrl + '?ftp.username=ftpuser&ftp.password=ftpuser123&ftp.control.encoding=utf-8';
        window.open('http://127.0.0.1:18012/onlinePreview?url=' + encodeURIComponent(Base64.encode(previewUrl)));
      } else if (data.sourcename == "ftp2"){
        // var originUrl = 'ftp://192.168.0.113/' + data.file_path;   //要预览文件的访问地址
        // var originUrl = 'ftp://192.168.0.113/附件-TRSHybaseV10.0Build20100_性能测试报告.docx';   //要预览文件的访问地址

        var originUrl2 = 'ftp://114.48.110.212/' + data.file_path ;  //要预览文件的访问地址

        var previewUrl = originUrl2 + '?ftp.username=test&ftp.password=test&ftp.control.encoding=utf-8';
        window.open('http://127.0.0.1:18012/onlinePreview?url=' + encodeURIComponent(Base64.encode(previewUrl)));
      }
      // 旧版文件打开
      // if (data.file_type.includes("pdf")){
      //   this.$refs["pdfRef"].open(data);
      //   console.log('打开PDF');
      // } else{
      //   this.getWordViewKK(data);
      // }
    },*/
    // 旧版打开KKfile
    getWordViewKK(data){
      if (data.file_path != null) {
        this.$refs["KKfileRef"].open(data);
        console.log('打开KKfile');
      }else{
        this.$message({
          message: '该文件不支持在线预览，请自行下载查看！',
          type: 'warning'
        });
      }
    },

    backTop() {
      let scrollTop =
        this.$refs.drawer.$refs.drawer.pageYOffset ||
        this.$refs.drawer.$refs.drawer.scrollTop ||
        this.$refs.drawer.$refs.drawer.offsetHeight;
      console.log('scrollTop' + scrollTop)
      // 滚动到顶部
      this.$nextTick(() => {
        const drawerContent = this.$el.querySelector('.el-drawer__body');
        if (drawerContent) {
          drawerContent.scrollTop = 0;
        }
      });


    },
    advancedQueryGj(){
      if (this.queryParams.keyword == '' && this.advancedQuery.keyword == ''){
        console.log('advancedQueryGj')
        this.centerDialogVisible = true;
        // this.performSearch_cz();
      }
    },

    // 打开详情页内容结束
    // 关闭详情
    cancelForm() {
      this.table=false;
      this.$refs.drawer.close();
    },
    // 查看原文
    incrementTranslate(){
      this.isTranslate = !this.isTranslate
    },

    // 二次检索多个关键词开始
    handleClose(tag) {
      this.dynamicTags.splice(this.dynamicTags.indexOf(tag), 1);
    },

    showInput() {
      this.inputVisible = true;
      this.$nextTick(_ => {
        this.$refs.saveTagInput.$refs.input.focus();
      });
    },

    handleInputConfirm() {
      let inputValue = this.inputValue;
      if (inputValue) {
        this.dynamicTags.push(inputValue);
        this.advancedQuery.keyword=this.dynamicTags.join(';');
      }
      this.inputVisible = false;
      this.inputValue = '';
    },
    // 二次检索多个关键词结束
    // 点赞
    incrementVisit(result) {
      result.doc_visit = Number(result.doc_visit) +1;
      this.visitOne(result.uid, result.docid, result.sourcename);
      // 切换收藏状态
      result.isVisitClick = true;
    },
    // 点赞量+1
    visitOne(uid,docid,sourcename){
      // const storedData = localStorage.getItem('detailData');
      // this.detailData = JSON.parse(detailData);
      // let colorSet = new Set(bakeColor);
      // console.log("detailData-"+detailData);
      const searchParams = {
        uid: uid,
        docid: docid,
        sourcename: sourcename,
      };
      // console.log(searchParams);
      searchPageApi.visitOne(searchParams);
      // this.results[index].isVisitClick = !this.results[index].isVisitClick;

      this.$message({
        message: '点赞成功！',
        type: 'success'
      });
    },

    // 访问量+1
    clickOne(uid,docid){
      const searchParams = {
        uid: uid,
        docid: docid,
      };
      console.log(searchParams);
      searchPageApi.clickOne(searchParams);
    },

    // 收藏
    incrementCollect(result) {
      if (result.isCollectClick) {
        result.doc_collect = Number(result.doc_collect) -1;
      } else {
        result.doc_collect = Number(result.doc_collect) +1;
      }
      if(result.isCollectClick == false){
        // 调用后端接口同步状态（可选）
        this.collectionOne(result.uid, result.docid, result.sourcename);
      }else{
        this.unCollectOne(result.uid, result.docid);
      }
      // 切换收藏状态
      result.isCollectClick = !result.isCollectClick;
    },

    // 文档收藏
    collectionOne(uid,docid,sourcename){
      this.userid = this.$store.state.user.id;
      const searchParams = {
        uid: uid,
        docid: docid,
        sourcename: sourcename,
        userid:this.userid,
      };
      // console.log(searchParams);
      searchPageApi.collectionOne(searchParams)
      // this.results[index].isCollectClick = !this.results[index].isCollectClick;
      this.$message({
        message: '收藏成功！',
        type: 'success'
      });
    },
    // 取消收藏
    unCollectOne(uid,docid){
      this.userid = this.$store.state.user.id;
      const searchParams = {
        uid: uid,
        docid: docid,
        userid:this.userid,
      };
      console.log(searchParams);
      searchPageApi.unCollectOne(searchParams);
      // this.results[index].isCollectClick = !this.results[index].isCollectClick;
      this.$message({
        message: '已取消收藏这篇文档！',
        type: 'success'
      });
    },
    // 标签修改

    bqUpdate(detailData) {
      var strTabValue = this.tabValue.join(';');
      // 表单参数
      const formData = {
        docid: undefined,
        uid: undefined,
        docLable: '',
        docKeywords: '',
        docIsIndex: undefined,
        sourcename: undefined,
      }
      formData.docLable = strTabValue;
      formData.docid = detailData.docid;
      formData.uid = detailData.uid;
      formData.sourcename = detailData.sourcename;
      searchPageApi.updateDigFtpSource(formData);
      this.$message({
        message: '已成功修改标签！',
        type: 'success'
      });
      // this.performSearch();
    },
    // 改变标签提交按钮状态
    bqUpdateTrue() {
      this.bqUpdateZT = true;
    },
    // 获取标签列表
    async getBqList() {
      try {
        const res = await searchPageApi.getBqList();
        this.tabOptions = res.data;
        console.log(res)
      } catch (error) {
        console.error("搜索失败:", error);
        this.loading = false;
      }

    },
    async logout() {
      this.$modal.confirm('确定注销并退出系统吗？', '提示').then(() => {
        this.$store.dispatch('LogOut').then(() => {
          location.href = getPath('/index');
        })
      }).catch(() => { });
    },
    // 测试值
    switchChange(){
      if(this.XSHBBtn){
        this.queryParams.checkstatus = 0;
      }else{
        this.queryParams.checkstatus = 1;
      }
      this.performSearch();
    },
    // 继续搜索错误词
    errorSearch(){
      this.queryParams.keyword = this.errorWord;
      this.queryParams.isuse = 1;
      this.performSearch();
    }

  },
  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.performSearch();

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

    this.getBqList();
  }
};

// 关闭输入推荐框
$(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: 164px;

  /* 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
}
.app-container{
  padding: 0;
}

.gaojijiansuo_left_top .selectkeyword_wrap{width:50%;}
.gaojijiansuo_left_top .advanced-options{margin-left:90px;}

.detailcont .el-select {
  width: 83%;
}

.el-button-bq {
  margin-top: 3px;
  float: right;
}
</style>
