<template>
  <div id="flfg1">
    <div class="search">
      <el-switch v-model="valueSelect" active-text="全文检索" inactive-text="按名称搜索" active-color="#409EFF"
        inactive-color="rgb(19, 206, 102)" v-show="flag == 1"></el-switch>
      <el-input v-model="input"></el-input>
      <div class="button-back" @click="flag = 1" v-show="flag != 1">
        返回主界面
      </div>
      <div class="button-search" @click="search()">站内搜索</div>
    </div>
    <div class="flfg1-content" v-show="flag == 1">
      <div class="internationalLaw">
        <div class="internationalLaw-title test-span-div">
          <div class="png-div"></div>
          国际法
          <div class="png-div1"></div>
        </div>

        <div class="background-div"></div>
        <div class="internationalLaw-content">
          <div class="content-card" v-for="(item, index) in internationalLaw">
            <div class="card-title">
              <!-- <img :src="titleImg[0]" alt=""> -->
              <span v-text="item.title"></span>
              <!-- <img :src="titleImg[1]" alt=""> -->
              <span class="el-icon-more" @click="showList(item)"></span>
            </div>
            <div class="card-content">
              <div class="content-img">
                <div v-for="(item1, index1) in item.img">
                  <img :src="item1.coverUrl" alt="" @click="viewLiterature(item1)"
                    @contextmenu.prevent.stop="showInfo(item1)" />
                </div>
              </div>
              <div class="content-list">
                <ul>
                  <li v-for="(item1, index1) in item.lawList" @click="viewLiterature(item1)"
                    @contextmenu.prevent.stop="showInfo(item1)">
                    <div class="mark"></div>
                    <div v-text="item1.originName" :title="item1.originName"></div>
                    <div v-text="item1.createTime.slice(5, 10)" :title="item1.createTime"></div>
                  </li>
                </ul>
              </div>
            </div>
          </div>
        </div>
      </div>
      <div class="internalLaw">

        <div class="internalLaw-title test-span-div">
          <div class="png-div"></div>对内内部法规<div class="png-div1"></div>
        </div>

        <div class="background-div"></div>
        <div class="internalLaw-content">
          <div class="content-card" v-for="(item, index) in internalLaw">
            <div class="card-title">
              <!-- <img :src="titleImg[0]" alt=""> -->
              <span v-text="item.title"></span>
              <!-- <img :src="titleImg[1]" alt=""> -->
              <span class="el-icon-more" @click="showList(item)"></span>
            </div>
            <div class="card-content">
              <div class="content-img">
                <div v-for="(item1, index1) in item.img">
                  <img :src="item1.coverUrl" alt="" @click="viewLiterature(item1)" @dblclick="showInfo(item1)" />
                </div>
              </div>
              <div class="content-list">
                <ul>
                  <li v-for="(item1, index1) in item.lawList" @click="viewLiterature(item1)"
                    @contextmenu.prevent.stop="showInfo(item1)">
                    <div class="mark"></div>
                    <div v-text="item1.originName" :title="item1.originName"></div>
                    <div v-text="item1.createTime.slice(5, 10)" :title="item1.createTime"></div>
                  </li>
                </ul>
              </div>
            </div>
          </div>
        </div>
      </div>
      <div class="domesticLaw">

        <div class="domesticLaw-title test-span-div">
          <div class="png-div"></div>我国内军内法规<div class="png-div1"></div>
        </div>

        <div class="background-div"></div>
        <div class="domesticLaw-content">
          <div class="content-card" v-for="(item, index) in domesticLaw">
            <div class="card-title">
              <!-- <img :src="titleImg[0]" alt=""> -->
              <span v-text="item.title"></span>
              <!-- <img :src="titleImg[1]" alt=""> -->
              <span class="el-icon-more" @click="showList(item)"></span>
            </div>
            <div class="card-content">
              <div class="content-img">
                <div v-for="(item1, index1) in item.img">
                  <img :src="item1.coverUrl" alt="" @click="viewLiterature(item1)"
                    @contextmenu.prevent.stop="showInfo(item1)" />
                </div>
              </div>
              <div class="content-list">
                <ul>
                  <li v-for="(item1, index1) in item.lawList" @click="viewLiterature(item1)"
                    @contextmenu.prevent.stop="showInfo(item1)">
                    <div class="mark"></div>
                    <div v-text="item1.originName" :title="item1.originName"></div>
                    <div v-text="item1.createTime.slice(5, 10)" :title="item1.createTime"></div>
                  </li>
                </ul>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="searchResult" v-show="flag == 2">
      <table>
        <thead>
          <tr>
            <td>模块</td>
            <td>文件名</td>
            <td>时间</td>
          </tr>
        </thead>
        <tbody>
          <tr v-for="(item, index) in literatureList">
            <td v-text="returnName(item.folder)"></td>
            <td v-text="item.originName" @click="viewLiterature(item)"></td>
            <td v-text="item.createTime"></td>
          </tr>
        </tbody>
      </table>
      <div class="pagination-div">
        <el-pagination class="myPagination" background layout="total, sizes, prev, pager, next, jumper"
          :current-page="currentPage" :page-size="everySize" :total="total" @current-change="handleCurrentChange"
          @size-change="handleSizeChange" :page-sizes="[10, 20, 50, 100]">
        </el-pagination>
      </div>
    </div>

    <div id="flfgKinds" v-show="flag == 3">
      <div class="flfgKinds-content">
        <div class="left-content">
          <el-tree :data="treeData" @node-click="handleNodeClick" highlight-current></el-tree>
        </div>
        <div class="right-content">
          <el-table :data="literatureListKinds" @row-click="viewLiterature">
            <el-table-column type="index" label="序号" width="180">
            </el-table-column>
            <el-table-column prop="originName" label="文件名11" show-overflow-tooltip="">
            </el-table-column>
            <el-table-column prop="createTime" label="上传时间" width="250">
            </el-table-column>
          </el-table>
          <div class="pagination-div">
            <el-pagination class="myPagination" background layout="total, sizes, prev, pager, next, jumper"
              :page-size="everySizeKinds" :current-page="currentPageKinds" :total="totalKinds"
              @current-change="handleCurrentChangeKinds" @size-change="handleSizeChangeKinds"
              :page-sizes="[10, 20, 50, 100]">
            </el-pagination>
          </div>
        </div>
      </div>
    </div>

    <div id="literatureInfo" v-show="flag == 4" v-if="pickObj.attachment">
      <div class="literatureInfo" v-html="pickObj.attachment.content" @contextmenu.prevent.stop="openMenu($event)"></div>
      <div v-show="visible" :style="{
        position: 'absolute',
        backgroundColor: 'white',
        left: left + 'px',
        top: top + 'px',
      }" class="contextmenu">
        <ul>
          <li @click="relatedPerson">关联人物</li>
          <li @click="relatedOrganization">关联机构</li>
          <li @click="addTag">添加标签</li>
          <li @click="addCollection">收藏</li>
        </ul>
      </div>
    </div>
    <div class="xgtj-div" v-show="flag == 4" v-if="pickObj.attachment">
      <div>相关推荐</div>
      <ul>
        <li v-for="(item, index) in xgtj_news_data" v-show="item.id != getNews.id"
          :title="item.title_zh == null ? item.title : item.title_zh" @click="showInfo(item)">
          <span>{{ index + 1 + "：" }}</span>{{ item.title_zh == null ? item.title : item.title_zh }}
        </li>
      </ul>
    </div>
    <div class="searchResult" v-show="flag == 5">
      <table class="fulltext">
        <thead>
          <tr>
            <td>模块</td>
            <td>文件名</td>
            <td>文本</td>
            <td>时间</td>
          </tr>
        </thead>
        <tbody>
          <tr v-for="(item, index) in fulltextLiteratureList">
            <td v-text="returnName(item.folder)"></td>
            <td v-text="item.literatureOriginName" @click="viewLiterature(item)"></td>
            <td v-html="item.highLight" :title="item.highLight"></td>
            <td v-text="item.createTime"></td>
          </tr>
        </tbody>
      </table>
      <div class="pagination-div">
        <el-pagination class="myPagination" background layout="total, sizes, prev, pager, next, jumper"
          :page-size="fulltextPagination.everySize" :current-page="fulltextPagination.currentPage"
          @current-change="handleCurrentChangeFulltext" :total="fulltextPagination.total"
          @size-change="handleSizeChangeFulltext" :page-sizes="[10, 20, 50, 100]">
        </el-pagination>
      </div>
    </div>
    <el-dialog title="关联人物" :visible.sync="dialogVisiblePerson" width="30%" :before-close="handleClose">
      <el-form ref="form" label-width="120px">
        <el-form-item label="摘要">
          <el-input type="textarea" :autosize="{ minRows: 2, maxRows: 10 }" placeholder="请输入内容" v-model="selectText"
            disabled style="width: 70%"></el-input>
        </el-form-item>
        <el-form-item label="搜索人物">
          <el-autocomplete v-model="state" :fetch-suggestions="querySearchAsync" placeholder="请输入内容"
            @select="handleSelect" style="width: 70%"></el-autocomplete>
        </el-form-item>
        <el-form-item label="选择类型">
          <el-select v-model="personType" style="width: 70%">
            <!-- <el-option value="相关人物">相关人物</el-option> -->
            <el-option value="相关舆情">相关舆情</el-option>
            <el-option value="相关活动">相关活动</el-option>
            <el-option value="相关专著">相关专著</el-option>
            <el-option value="相关言论">相关言论</el-option>
            <el-option value="关键影响人物">关键影响人物</el-option>
            <el-option value="评价言论">评价言论</el-option>
          </el-select>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisiblePerson = false">取 消</el-button>
        <el-button type="primary" @click="defineRelatedPerson">确 定</el-button>
      </span>
    </el-dialog>
    <el-dialog title="关联机构" :visible.sync="dialogVisibleOrganization" width="30%" :before-close="handleClose">
      <el-form ref="form" label-width="120px">
        <el-form-item label="摘要">
          <el-input type="textarea" :autosize="{ minRows: 2, maxRows: 10 }" placeholder="请输入内容" v-model="selectText"
            disabled style="width: 70%"></el-input>
        </el-form-item>
        <el-form-item label="搜索机构">
          <el-autocomplete v-model="state" :fetch-suggestions="querySearchAsyncOrganization" placeholder="请输入内容"
            @select="handleSelect" style="width: 70%"></el-autocomplete>
        </el-form-item>
        <el-form-item label="选择类型">
          <el-select v-model="organizationType" style="width: 70%">
            <!-- <el-option value="相关人物">相关人物</el-option> -->
            <el-option value="所属基地">所属基地</el-option>
            <el-option value="所属部队">所属部队</el-option>
            <el-option value="所属装备">所属装备</el-option>
            <el-option value="相关舆情">相关舆情</el-option>
            <el-option value="历史文献">历史文献</el-option>
            <el-option value="证据资料">证据资料</el-option>
            <el-option value="关键影响人物">关键影响人物</el-option>
            <el-option value="评价言论">评价言论</el-option>
            <el-option value="机构分析报告">机构分析报告</el-option>
          </el-select>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisibleOrganization = false">取 消</el-button>
        <el-button type="primary" @click="defineRelatedOrganization">确 定</el-button>
      </span>
    </el-dialog>
    <el-dialog title="添加标签" :visible.sync="dialogVisibleTag" width="30%" :before-close="handleClose">
      <el-tag :key="tag" v-for="tag in dynamicTags" closable :disable-transitions="false" @close="handleClose(tag)">
        {{ tag }}
      </el-tag>
      <el-input class="input-new-tag" v-if="inputVisible" v-model="inputValue" ref="saveTagInput" size="small"
        @keyup.enter.native="handleInputConfirm" @blur="handleInputConfirm">
      </el-input>
      <el-button v-else class="button-new-tag" size="small" @click="showInput">+ 标签</el-button>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisibleTag = false">取 消</el-button>
        <el-button type="primary" @click="defineAddTag">确 定</el-button>
      </span>
    </el-dialog>
    <el-dialog title="添加收藏" :visible.sync="dialogVisibleCollection" width="20%" :before-close="handleClose">
      <ul>
        <li v-for="(item, index) in collectionFolder" @click.stop="addFolder(item, index)"
          :style="{ background: index == selectIndex ? '#f56c6c' : '' }">
          <span class="el-icon-folder-opened"></span>&emsp;{{ item.name }}
          <el-button class="delete" type="text" size="mini" @click.stop.native="delectCollectionFolder(item.id)">
            <i class="el-icon-error"></i>
          </el-button>
        </li>
      </ul>
      <el-dialog width="30%" title="新增收藏夹" :visible.sync="innerVisible" append-to-body>
        <el-form ref="form" label-width="120px">
          <el-form-item label="名称">
            <el-input v-model="collectionName" placeholder="请输入收藏夹名称" @click.stop.native="stopstop"
              style="width: 70%"></el-input>
          </el-form-item>
        </el-form>
        <span slot="footer" class="dialog-footer">
          <el-button size="mini" @click.stop="innerVisible = false">取 消</el-button>
          <el-button size="mini" type="danger" @click.stop="addCollectionFolder()">确 定</el-button>
        </span>
      </el-dialog>
      <span slot="footer" class="dialog-footer">
        <el-button type="" size="mini" @click.stop="defineAddCollection">确定</el-button>
        <el-button type="danger" size="mini" @click.stop="innerVisible = true">新增收藏夹</el-button>
      </span>
    </el-dialog>
  </div>
</template>
  
<style lang="scss">
#flfg1 {
  width: 100%;
  height: 100%;
  padding: 40px;
  box-sizing: border-box;
  overflow-y: auto;
  color: white;

  .search {
    width: 100%;
    height: 50px;
    // line-height: 50px;
    text-align: right;

    .el-switch {
      margin-right: 15px;

      .el-switch__label * {
        line-height: normal;
      }

      .el-switch__label {
        color: white;
      }

      .is-active {
        color: #409eff;
      }
    }

    .el-input {
      width: 200px;
      margin-right: 15px;

      input {
        height: 30px;
        color: white;
        background: none !important;
        border: 1px solid #146a80 !important;
        box-shadow: 0 0 10px #1b6097;
      }
    }

    .button-search {
      width: 100px;
      height: 30px;
      line-height: 30px;
      font-size: 13px;
      float: right;
      margin-right: 10px;
      text-align: center;
      cursor: pointer;
      background-image: url(../../assets/img/yqjc/41.png);
      background-repeat: no-repeat;
      background-size: 100% 100%;
    }

    .button-upload {
      width: 100px;
      height: 30px;
      line-height: 30px;
      font-size: 13px;
      float: right;
      margin-right: 10px;
      text-align: center;
      cursor: pointer;
      background-image: url(../../assets/img/yqjc/41.png);
      background-repeat: no-repeat;
      background-size: 100% 100%;
    }

    .button-back {
      width: 100px;
      height: 30px;
      line-height: 30px;
      font-size: 13px;
      float: right;
      text-align: center;
      cursor: pointer;
      background-image: url(../../assets/img/yqjc/41.png);
      background-repeat: no-repeat;
      background-size: 100% 100%;
    }
  }

  .flfg1-content {
    width: 100%;
    height: calc(100% - 50px);
    overflow-y: auto;
    overflow-x: hidden;

    .background-div {
      width: 100%;
      height: 40px;
      background-image: url(../../assets/img/flfg/new/6.png);
      background-repeat: no-repeat;
      background-size: 100% 100%;
    }

    .internationalLaw {
      float: left;
      width: 100%;

      .internationalLaw-title {
        width: 100%;
        height: 50px;
        line-height: 50px;
        font-size: 25px;
        letter-spacing: 10px;
        text-align: center;
        // background-image: url('../../assets/img/flfg/title.png');
        // background-size: 100% 100%;
        text-shadow: 0px 0px 15px #f5f5f5;
        display: flex;
        flex-direction: row;
        justify-content: center;

        .png-div {
          width: 28px;
          height: 26px;
          background-image: url(../../assets/img/flfg/new/8.png);
          background-repeat: no-repeat;
          background-size: 100% 100%;
          margin-right: 30px;
          margin-top: 13px;
        }

        .png-div1 {
          width: 28px;
          height: 26px;
          background-image: url(../../assets/img/flfg/new/8.png);
          background-repeat: no-repeat;
          background-size: 100% 100%;
          transform: rotate(180deg);
          margin-left: 25px;
          margin-top: 13px;
        }
      }

      .internationalLaw-content {
        height: 1206px;

        .content-card {
          width: calc(100% / 3 - 100px / 3);
          height: 402px;
          float: left;
          margin: 15px;
          background-image: url(../../assets/img/flfg/new/5.png);
          background-size: 100% 100%;

          .card-title {
            width: 100%;
            height: 50px;
            line-height: 50px;
            padding-left: 40px;
            box-sizing: border-box;
            text-align: center;

            img {
              width: 60px;
            }

            span {
              font-size: 20px;
              font-weight: 500;
              letter-spacing: 5px;
            }

            .el-icon-more {
              float: right;
              margin-top: 15px;
              margin-right: 20px;

              color: #10d2ff;
              cursor: pointer;
            }
          }

          .card-content {
            width: calc(100% - 20px);
            height: calc(100% - 50px);
            margin-left: 10px;
            padding: 10px;
            box-sizing: border-box;

            .content-img {
              width: 100%;
              height: 100px;
              margin-top: 20px;
              overflow-y: auto;

              &::-webkit-scrollbar {
                display: none;
              }

              div {
                width: calc(50% - 60px);
                height: 100px;
                float: left;
                margin-left: 42px;

                img {
                  width: 100%;
                  height: 100%;
                  cursor: pointer;
                }
              }
            }

            .content-list {
              width: 100%;
              height: calc(100% - 130px);
              margin-top: 10px;
              overflow-y: auto;

              &::-webkit-scrollbar {
                display: none;
              }

              ul {
                width: calc(100% - 70px);

                li {
                  width: 100%;
                  height: 30px;
                  line-height: 30px;
                  font-size: 15px;
                  font-weight: 600;
                  list-style: none;
                  cursor: pointer;
                  overflow: hidden;
                  white-space: nowrap;
                  text-overflow: ellipsis;

                  div {
                    &:first-child {
                      width: 5px;
                      height: 5px;
                      float: left;
                      margin-top: 11.5px;
                      margin-right: 10px;
                      border: 1px solid grey;
                      border-radius: 20px;
                      background-color: grey;
                      opacity: 0.5;
                    }

                    &:nth-child(2) {
                      width: 70%;
                      float: left;
                      overflow: hidden;
                      text-overflow: ellipsis;
                      white-space: nowrap;
                    }

                    &:last-child {
                      float: right;
                    }

                    &:hover {
                      font-weight: bold;
                      color: #0dada7;
                      text-decoration: underline;
                    }
                  }
                }
              }
            }
          }
        }
      }
    }

    .internalLaw {
      margin-top: 10px;
      float: left;
      width: 100%;

      .internalLaw-title {
        width: 100%;
        height: 50px;
        line-height: 50px;
        font-size: 25px;
        letter-spacing: 10px;
        text-align: center;
        text-shadow: 0px 0px 15px #f5f5f5;
        // background-image: url('../../assets/img/flfg/title.png');
        // background-size: 100% 100%;
        display: flex;
        flex-direction: row;
        justify-content: center;

        .png-div {
          width: 28px;
          height: 26px;
          background-image: url(../../assets/img/flfg/new/8.png);
          background-repeat: no-repeat;
          background-size: 100% 100%;
          margin-right: 30px;
          margin-top: 13px;
        }

        .png-div1 {
          width: 28px;
          height: 26px;
          background-image: url(../../assets/img/flfg/new/8.png);
          background-repeat: no-repeat;
          background-size: 100% 100%;
          transform: rotate(180deg);
          margin-left: 25px;
          margin-top: 13px;
        }
      }

      .internalLaw-content {
        height: 402px;

        .content-card {
          width: calc(100% / 3 - 100px / 3);
          height: 100%;
          float: left;
          margin: 15px;
          background-image: url(../../assets/img/flfg/new/5.png);
          background-size: 100% 100%;

          .card-title {
            width: 100%;
            height: 50px;
            line-height: 50px;
            padding-left: 40px;
            box-sizing: border-box;
            text-align: center;

            img {
              width: 60px;
            }

            span {
              font-size: 20px;
              font-weight: 500;
              letter-spacing: 5px;
            }

            .el-icon-more {
              float: right;
              margin-top: 15px;
              margin-right: 20px;

              color: #10d2ff;
              cursor: pointer;
            }
          }

          .card-content {
            width: calc(100% - 20px);
            height: calc(100% - 50px);
            margin-left: 10px;
            padding: 10px;
            box-sizing: border-box;

            // background-image: url(../../assets/img/flfg/cardContent.png);
            // background-size: 100% 100%;
            .content-img {
              width: 100%;
              height: 100px;
              margin-top: 20px;
              overflow-y: auto;

              &::-webkit-scrollbar {
                display: none;
              }

              div {
                width: calc(50% - 60px);
                height: 100px;
                float: left;
                margin-left: 42px;

                img {
                  width: 100%;
                  height: 100%;
                  cursor: pointer;
                }
              }
            }

            .content-list {
              height: calc(100% - 130px);
              margin-top: 10px;
              overflow-y: auto;

              &::-webkit-scrollbar {
                display: none;
              }

              ul {
                width: calc(100% - 70px);

                li {
                  height: 30px;
                  line-height: 30px;
                  font-size: 15px;
                  font-weight: 600;
                  list-style: none;
                  cursor: pointer;
                  overflow: hidden;
                  white-space: nowrap;
                  text-overflow: ellipsis;

                  div {
                    &:first-child {
                      width: 5px;
                      height: 5px;
                      float: left;
                      margin-top: 11.5px;
                      margin-right: 10px;
                      border: 1px solid grey;
                      border-radius: 20px;
                      background-color: grey;
                      opacity: 0.5;
                    }

                    &:nth-child(2) {
                      width: 70%;
                      float: left;
                      overflow: hidden;
                      text-overflow: ellipsis;
                      white-space: nowrap;
                    }

                    &:last-child {
                      float: right;
                    }

                    &:hover {
                      font-weight: bold;
                      color: #0dada7;
                      text-decoration: underline;
                    }
                  }
                }
              }
            }
          }
        }
      }
    }

    .domesticLaw {
      margin-top: 10px;
      float: left;
      width: 100%;

      .domesticLaw-title {
        width: 100%;
        height: 50px;
        line-height: 50px;
        font-size: 25px;
        letter-spacing: 10px;
        text-align: center;
        text-shadow: 0px 0px 15px #f5f5f5;
        // background-image: url('../../assets/img/flfg/title.png');
        // background-size: 100% 100%;
        display: flex;
        flex-direction: row;
        justify-content: center;

        .png-div {
          width: 28px;
          height: 26px;
          background-image: url(../../assets/img/flfg/new/8.png);
          background-repeat: no-repeat;
          background-size: 100% 100%;
          margin-right: 30px;
          margin-top: 13px;
        }

        .png-div1 {
          width: 28px;
          height: 26px;
          background-image: url(../../assets/img/flfg/new/8.png);
          background-repeat: no-repeat;
          background-size: 100% 100%;
          transform: rotate(180deg);
          margin-left: 25px;
          margin-top: 13px;
        }
      }

      .domesticLaw-content {
        height: 402px;

        .content-card {
          width: calc(100% / 3 - 100px / 3);
          height: 100%;
          float: left;
          margin: 15px;
          background-image: url(../../assets/img/flfg/new/5.png);
          background-size: 100% 100%;

          .card-title {
            width: 100%;
            height: 50px;
            line-height: 50px;
            padding-left: 40px;
            box-sizing: border-box;
            text-align: center;

            img {
              width: 60px;
            }

            span {
              font-size: 20px;
              font-weight: 500;
              letter-spacing: 5px;
            }

            .el-icon-more {
              float: right;
              margin-top: 15px;
              margin-right: 20px;

              color: #10d2ff;
              cursor: pointer;
            }
          }

          .card-content {
            width: calc(100% - 20px);
            height: calc(100% - 50px);
            margin-left: 10px;
            padding: 10px;
            box-sizing: border-box;

            // background-image: url(../../assets/img/flfg/cardContent.png);
            // background-size: 100% 100%;
            .content-img {
              width: 100%;
              height: 100px;
              margin-top: 20px;
              overflow-y: auto;

              &::-webkit-scrollbar {
                display: none;
              }

              div {
                width: calc(50% - 64px);
                height: calc(100% - 4px);
                float: left;
                margin-left: 42px;
                padding: 2px;

                img {
                  width: 100%;
                  height: 100%;
                  cursor: pointer;
                }
              }
            }

            .content-list {
              height: calc(100% - 130px);
              margin-top: 10px;
              overflow-y: auto;

              &::-webkit-scrollbar {
                display: none;
              }

              ul {
                width: calc(100% - 70px);

                li {
                  height: 30px;
                  line-height: 30px;
                  font-size: 15px;
                  font-weight: 600;
                  list-style: none;
                  cursor: pointer;
                  overflow: hidden;
                  white-space: nowrap;
                  text-overflow: ellipsis;

                  div {
                    &:first-child {
                      width: 5px;
                      height: 5px;
                      float: left;
                      margin-top: 11.5px;
                      margin-right: 10px;
                      border: 1px solid grey;
                      border-radius: 20px;
                      background-color: grey;
                      opacity: 0.5;
                    }

                    &:nth-child(2) {
                      width: 70%;
                      float: left;
                      overflow: hidden;
                      text-overflow: ellipsis;
                      white-space: nowrap;
                    }

                    &:last-child {
                      float: right;
                    }

                    &:hover {
                      font-weight: bold;
                      color: #0dada7;
                      text-decoration: underline;
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }

  .searchResult {
    width: 100%;
    height: calc(100% - 50px);
    overflow-y: auto;

    table {
      width: 100%;
      height: calc(100% - 60px);
      text-align: center;

      thead {
        display: table;
        width: 100%;
        table-layout: fixed;

        tr {
          height: 50px;
          color: white;
          text-align: center;
          background-image: url(../../assets/img/flfg/new/4.png);
          background-size: 100% 100%;

          td {
            &:first-child {
              width: 180px;
              text-align: center;
            }

            &:last-child {
              width: 150px;
            }
          }
        }
      }

      tbody {
        height: calc(100% - 50px);
        display: block;
        overflow-y: scroll;
        -webkit-overflow-scrolling: touch;

        &::-webkit-scrollbar {
          display: none; // 隐藏滚动条
        }

        tr {
          display: table;
          width: 100%;
          border-bottom: 1px solid #91919170;
          table-layout: fixed;
          box-shadow: 0px 0px 10px #292929;

          td {
            color: white;

            &:first-child {
              width: 180px;
              text-align: center;
            }

            &:last-child {
              width: 150px;

              span:hover {
                color: green;
                cursor: pointer;
              }
            }

            &:nth-child(2):hover {
              cursor: pointer;
              font-weight: bold;
              color: #ddca22;
              text-decoration: underline;
            }
          }
        }
      }
    }

    .fulltext {
      td {
        &:first-child {
          width: 180px;
        }

        &:last-child {
          width: 250px;
        }
      }

      tbody {
        td {
          &:nth-child(3) {
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 1;
            overflow: hidden;
          }
        }
      }
    }

    em {
      color: red;
    }

    .pagination-div {
      width: 100%;
      height: 50px;
      // margin-left: calc(50% - 632px);

      .el-pagination {
        margin-top: 9px;
        text-align: right;

        .el-pagination__total {
          color: white;
        }

        .el-pagination__jump {
          color: white;
        }
      }

      .myPagination.is-background .el-pager li:not(.disabled).active {
        color: #fff;
        border: 1px solid #146a80;
        box-shadow: 0 0 10px #1b6097;
        background-color: #1d2d46;
      }
    }
  }

  //分类
  #flfgKinds {
    width: 100%;
    height: calc(100% - 50px);
    color: white;
    overflow: hidden;

    // background-image: url(../../assets/img/main/background.png);
    // background-size: 100% 100%;
    .flfgKinds-content {
      width: 100%;
      height: 100%;

      .left-content {
        width: 250px;
        height: 100%;
        float: left;
        padding: 20px;
        overflow-y: auto;
        box-sizing: border-box;
        background: url("../../assets/img/yqjc/01.png") no-repeat;
        background-size: 100% 100%;

        .el-tree {
          margin-top: 10px;
          color: white;
          background: transparent;

          .el-tree-node__content {
            height: 40px;
          }
        }

        .el-tree>.el-tree-node>.el-tree-node__content {
          height: 40px;
          background-image: url(../../assets/img/yqjc/24.png);
          background-repeat: no-repeat;
          background-size: 100% 100%;
        }

        .el-tree>.el-tree-node>.el-tree-node__children>.el-tree-node>.el-tree-node__content {
          height: 40px;
          // background-image: url(../../assets/img/yqjc/24.png);
          background-repeat: no-repeat;
          background-size: 100% 100%;
        }

        .el-tree>.el-tree-node>.el-tree-node__content>.el-tree-node__label {
          font-size: 14px !important;
        }

        .el-tree>.el-tree-node>.el-tree-node__children {
          background-color: #1d2d46 !important;
        }

        .el-tree-node:focus>.el-tree-node__content {
          background-color: #00648a96 !important;
          // border-radius: 5px;
        }

        .el-tree-node__content:hover,
        .el-tree-node__content:focus {
          background-color: #00648a96 !important;
          // border-radius: 5px;
        }

        .el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content {
          background-color: #00648a96 !important;
          // border-radius: 5px;
        }
      }

      .right-content {
        width: calc(100% - 270px);
        height: 100%;
        float: left;
        margin-left: 20px;
        padding: 20px;
        background: url("../../assets/img/yqjc/02.png") no-repeat;
        background-size: 100% 100%;
        box-sizing: border-box;

        .el-table {
          width: 100%;
          height: calc(100% - 50px);
        }

        .el-table tr {
          background-color: transparent !important;
          color: #ffffffc7;
        }

        .el-table thead tr {
          height: 40px;
          background: url(../../assets/img/setting/tr1.png) no-repeat;
          background-size: 100% 100%;
        }

        .el-table th {
          background-color: transparent;
        }

        tbody tr {
          border-bottom: 1px solid #252631;
        }

        .el-table td {
          border-bottom: 1px solid #252631;
          border-right: unset;
        }

        .el-table--enable-row-hover .el-table__body tr:hover>td {
          background-color: #82848a78;
        }

        .el-table th {
          border: unset;
          // background-color: #263b5d !important;
        }

        .el-table--fit {
          background: none !important;
          border: unset;
        }

        .el-icon-delete-solid {
          color: red;
          cursor: pointer;
          font-size: 18px;
        }

        .el-icon-edit {
          color: #1172d8;
          cursor: pointer;
          font-size: 20px;
        }

        .el-icon-view {
          color: #00ffff;
          font-size: 20px;
          cursor: pointer;
        }

        .el-table--group::after,
        .el-table--border::after,
        .el-table::before {
          background-color: unset;
        }


        .pagination-div {
          width: 100%;
          height: 50px;
          // margin-left: calc(50% - 632px);

          .el-pagination {
            margin-top: 9px;
            text-align: right;

            .el-pagination__total {
              color: white;
            }

            .el-pagination__jump {
              color: white;
            }
          }

          .myPagination.is-background .el-pager li:not(.disabled).active {
            color: #fff;
            border: 1px solid #146a80;
            box-shadow: 0 0 10px #1b6097;
            background-color: #1d2d46;
          }
        }
      }
    }
  }

  //文件详情
  #literatureInfo {
    width: 67%;
    height: calc(100% - 50px);
    margin-left: 16%;
    float: left;
    color: white;
    overflow-x: hidden;
    overflow-y: auto;
    background: #263b5d29;
    padding: 20px;
    box-sizing: border-box;

    .literatureInfo {
      width: fit-content;
      margin: auto;
      white-space: pre-wrap;
      line-height: 2.2;
      letter-spacing: 1px;
      font-size: 18px;
      text-indent: 2em;
    }

    .contextmenu {
      width: 200px;
      padding: 5px 0px;
      box-sizing: border-box;

      ul {
        margin: 0;
        padding: 0;
        overflow-y: auto;
        list-style: none;

        li {
          height: 30px;
          line-height: 30px;
          padding-left: 20px;
          position: relative;
          font-size: 14px;
          box-sizing: border-box;
          color: black;

          &:hover {
            cursor: pointer;
            background-color: #ddd;
          }

          .delete {
            position: absolute;
            right: 10px;

            i {
              font-size: 16px;
              color: #ff5454;
            }
          }
        }
      }
    }
  }

  .xgtj-div {
    width: 15%;
    height: 300px;
    float: left;
    margin-left: 1%;

    div {
      font-weight: 900;
      margin-left: 11px;
      font-size: 14px;
    }

    ul {
      padding: 0;
      margin: 10px 7px 0px 26px;

      li {
        list-style: none;
        font-size: 12px;
        color: #cdf9ff;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        line-height: 28px;
        cursor: pointer;
      }

      li:hover {
        color: #00f9ff;
        text-decoration: underline;
      }
    }
  }

  .el-dialog {
    color: white;
    background: #1d2d46 !important;

    .el-dialog__body {
      .el-form {
        .el-form-item {
          .el-form-item__label {
            color: white;
          }

          .el-form-item__content {
            color: white;

            .el-upload__tip {
              color: white;
            }
          }

          .el-input-group__append {
            border: 1px solid #146a80 !important;

            .el-button {
              color: white !important;
              background: #1d2d46 !important;
              border: 1px solid #146a80 !important;
            }
          }
        }
      }

      .el-input__inner {
        color: white !important;
        background: none !important;
        border: 1px solid #146a80 !important;
        box-shadow: 0 0 10px #1b6097;
      }

      textarea {
        color: white !important;
        background: none !important;
        border: 1px solid #146a80 !important;
        box-shadow: 0 0 10px #1b6097;
      }

      .el-icon-document {
        height: auto;
      }

      .el-tag+.el-tag {
        margin-left: 10px;
      }

      .button-new-tag {
        margin-left: 10px;
        height: 32px;
        line-height: 30px;
        padding-top: 0;
        padding-bottom: 0;
      }

      .input-new-tag {
        width: 90px;
        margin-left: 10px;
        vertical-align: bottom;
      }

      ul {
        height: 150px;
        margin: 0;
        padding: 0;
        overflow-y: auto;
        list-style: none;

        li {
          height: 30px;
          line-height: 30px;
          padding-left: 10px;
          position: relative;
          box-sizing: border-box;
          color: white;

          &:hover {
            color: white;
            background-color: #f56c6c;
          }

          .delete {
            position: absolute;
            right: 10px;

            i {
              font-size: 16px;
              color: #ff5454;
            }
          }
        }
      }
    }
  }
}
</style>
  
<script>
import {
  get,
  fileUpload,
  post,
  startLoading,
  endLoading,
  download,
  delete_util,
  dateChangeFormat,
} from "../../util/http_util";
import {
  searchLiterature, queryLiterature, addRelatedInfo, addLiteratureLabel, queryCollectionFolder, addCollection, addCollectionFolder, removeCollectionFolder,
  multiQueryLiterature, queryLiteratureFolder, previewPdf, queryLiteratureById, queryRecommendLiterature
} from '../../api/xxxl/llxx'
import leftTitle from "../../assets/img/flfg/leftTitle.png";
import rightTitle from "../../assets/img/flfg/rightTitle.png";
import "animate.css";
import { LiteraturePictureUrl } from "../../api/publicUrl";
export default {
  name: "flfg",
  data() {
    return {
      LiteraturePictureUrl: LiteraturePictureUrl,
      input: "",
      flag: 1,
      titleImg: [leftTitle, rightTitle],
      internationalLaw: [
        {
          title: "",
          img: [],
          lawList: [],
        },
        {
          title: "",
          img: [],
          lawList: [],
        },
        {
          title: "",
          img: [],
          lawList: [],
        },
        {
          title: "",
          img: [],
          lawList: [],
        },
        {
          title: "",
          img: [],
          lawList: [],
        },
        {
          title: "",
          img: [],
          lawList: [],
        },
        {
          title: "",
          img: [],
          lawList: [],
        },
        {
          title: "",
          img: [],
          lawList: [],
        },
        {
          title: "",
          img: [],
          lawList: [],
        },
      ],
      internalLaw: [
        {
          title: "",
          img: [],
          lawList: [],
        },
        {
          title: "",
          img: [],
          lawList: [],
        },
        {
          title: "",
          img: [],
          lawList: [],
        },
      ],
      domesticLaw: [
        {
          title: "",
          img: [],
          lawList: [],
        },
        {
          title: "",
          img: [],
          lawList: [],
        },
        {
          title: "",
          img: [],
          lawList: [],
        },
      ],
      currentPage: 1,
      total: 0,
      value: "",
      literatureList: [],
      activeName: "",
      literatureListKinds: [],
      currentPageKinds: 0,
      totalKinds: 0,
      everySize: 10,
      everySizeKinds: 10,
      treeData: [],
      moduleList: [],
      pickObj: {},
      visible: false,
      top: 300,
      left: 300,
      dynamicTags: [],
      inputVisible: false,
      inputValue: "",
      dialogVisiblePerson: false,
      dialogVisibleOrganization: false,
      dialogVisibleTag: false,
      personValue: "",
      organizationValue: "",
      personType: "",
      organizationType: "",
      timeout: null,
      state: "",
      selectText: "",
      pickItem: {},
      literatureObj: {},
      dialogVisibleCollection: false,
      innerVisible: false,
      collectionName: "",
      collectionFolder: [],
      collectionData: {},
      selectIndex: -1,
      valueSelect: false,
      fulltextPagination: {
        total: 0,
        everySize: 10,
        currentPage: 1,
      },
      fulltextLiteratureList: [],
      xgtj_news_data: [],
    };
  },
  methods: {
    //#region
    search() {
      if (this.valueSelect) {
        if (this.input != "") {
          this.flag = 5;
          startLoading();
          this.searchLiterature();
        } else {
          this.$message.warning("请输入文本信息！");
        }
      } else {
        this.flag = 2;
        this.queryLiterature(1, this.everySize, this.input);
      }
    },
    //根据文本信息查询文件
    searchLiterature() {
      searchLiterature('法律法规', this.fulltextPagination.currentPage, this.fulltextPagination.everySize, this.input).then((res) => {
        res.list.forEach((item) => {
          item.createTime = dateChangeFormat(
            "YYYY-mm-dd HH:MM:SS",
            item.createTime
          );
          item["name"] = item.id;
        });
        this.fulltextLiteratureList = res.list;
        this.fulltextPagination.total = res.totals;
        endLoading();
      })
        .catch((err) => {
          endLoading();
          this.$message.warning(err.message);
        });
    },
    showList(val) {
      this.flag = 3;
      this.activeName = val.id;
      this.totalKinds = 0;
      this.queryLiteratureKinds(1, this.everySizeKinds, val.id);
    },
    handleSizeChange(val) {
      this.everySize = val;
      this.currentPage = 1;
      this.queryLiterature(1, val, this.input);
    },
    handleSizeChangeKinds(val) {
      this.everySizeKinds = val;
      this.currentPageKinds = 1;
      this.queryLiteratureKinds(1, val, this.activeName);
    },
    handleCurrentChange(pageNum) {
      this.currentPage = pageNum;
      this.queryLiterature(pageNum, this.everySize, this.input);
    },
    handleClose(done) {
      done();
    },
    //查询上传的文件
    queryLiterature(pageNum, pageSize, title) {
      queryLiterature("法律法规", pageNum, pageSize, title)
        .then((res) => {
          this.literatureList = res.list;
          this.total = res.totals;
        })
        .catch((err) => {
          this.$message.warning(err.message);
        });
    },
    //返回中文名
    returnName(type) {
      return (
        this.moduleList.filter((item) => item.id == type)[0] &&
        this.moduleList.filter((item) => item.id == type)[0].name
      );
    },
    //以pdf形式预览
    viewLiterature(item) {
      previewPdf('LiteraturePDF', item.name);
    },
    queryLiteratureKinds(pageNum, pageSize, type) {
      queryLiterature("法律法规", pageNum, pageSize, null, type).then((res) => {
        this.literatureListKinds = res.list;
        this.totalKinds = res.totals;
      })
        .catch((err) => {
          this.$message.warning(err.message);
        });
    },
    handleCurrentChangeKinds(pageNum) {
      this.currentPageKinds = pageNum;
      this.queryLiteratureKinds(pageNum, this.everySizeKinds, this.activeName);
    },
    handleNodeClick(data) {
      this.currentPageKinds = 1;
      this.queryLiteratureKinds(1, this.everySizeKinds, data.id);
      this.activeName = data.id;
    },
    showInfo(item) {
      this.xgtj_news_data = [];
      this.xgtj_news(item.id);
      queryLiteratureById(item.name)
        .then((res) => {
          this.flag = 4;
          this.pickObj = res;
          this.literatureObj = item;
        })
        .catch((err) => {
          this.$message.warning(err.message);
        });
    },
    xgtj_news(id) {
      queryRecommendLiterature(id)
        .then((res) => {
          if (res.length > 0) {
            this.xgtj_news_data = res;
            if (res.length > 10) {
              this.xgtj_news_data = res.slice(0, 10);
            }
          }
        })
        .catch((err) => {
          this.$message.warning(err.message);
        });
    },
    openMenu(e) {
      this.selectText = "";
      this.selectIndex = -1;
      const menuMinWidth = 300;
      const offsetLeft = this.$el.getBoundingClientRect().left - 150; // container margin left
      const offsetWidth = this.$el.offsetWidth - 200; // container width
      const maxLeft = offsetWidth - menuMinWidth; // left boundary
      const left = e.clientX - offsetLeft; // 15: margin right

      if (left > maxLeft) {
        this.left = maxLeft;
      } else {
        this.left = left;
      }

      this.top = e.clientY; // fix 位置bug
      this.selectText = window.getSelection().toString();
      if (this.selectText != "") {
        this.visible = true;
      }
    },
    closeMenu() {
      this.visible = false;
    },
    //关联人物
    relatedPerson() {
      this.dialogVisiblePerson = true;
    },
    //关联机构
    relatedOrganization() {
      this.dialogVisibleOrganization = true;
    },

    querySearchAsync(queryString, cb) {
      let personList = [];
      post(
        `api/rest/resource/queryDynamicCharacter?pageNum=1&pageSize=100&multiFieldSearch=` +
        queryString,
        {
          mould: "敌方资源",
          // "baseProperty.姓名": queryString
        }
      )
        .then((res) => {
          res.list.forEach((item) => {
            let personObj = {};
            personObj["value"] = item.baseProperty.姓名;
            personObj["address"] = item._id;
            personList.push(personObj);
          });
          // var results = queryString ? personList.filter(this.createStateFilter(queryString)) : personList;
          clearTimeout(this.timeout);
          this.timeout = setTimeout(() => {
            cb(personList);
          }, 3000 * Math.random());
        })
        .catch((err) => {
          this.$message.warning(err.message);
        });

      post(
        `api/rest/resource/queryDynamicCharacter?pageNum=1&pageSize=100&multiFieldSearch=` +
        queryString,
        {
          mould: "敌方外网资源",
          // "baseProperty.姓名": queryString
        }
      )
        .then((res) => {
          res.list.forEach((item) => {
            let personObj = {};
            personObj["value"] = item.baseProperty.姓名;
            personObj["address"] = item._id;
            personList.push(personObj);
          });
          // var results = queryString ? personList.filter(this.createStateFilter(queryString)) : personList;
          clearTimeout(this.timeout);
          this.timeout = setTimeout(() => {
            cb(personList);
          }, 3000 * Math.random());
        })
        .catch((err) => {
          this.$message.warning(err.message);
        });
    },
    querySearchAsyncOrganization(queryString, cb) {
      let organizationList = [];
      post(
        "api/rest/resource/queryDynamicOrganization?pageNum=1&pageSize=100&multiFieldSearch=" +
        queryString,
        {
          mould: "敌方外网资源机构",
        }
      )
        .then((res) => {
          res.list.forEach((item) => {
            let organizationObj = {};
            organizationObj["value"] = item.baseProperty.部队番号;
            organizationObj["address"] = item._id;
            organizationList.push(organizationObj);
          });
          // var results = queryString ? organizationList.filter(this.createStateFilter(queryString)) : organizationList;
          clearTimeout(this.timeout);
          this.timeout = setTimeout(() => {
            cb(organizationList);
          }, 3000 * Math.random());
        })
        .catch((err) => {
          this.$message.warning(err.message);
        });
      post(
        "api/rest/resource/queryDynamicOrganization?pageNum=1&pageSize=100&multiFieldSearch=" +
        queryString,
        {
          mould: "敌方资源机构",
        }
      )
        .then((res) => {
          res.list.forEach((item) => {
            let organizationObj = {};
            organizationObj["value"] = item.baseProperty.部队番号;
            organizationObj["address"] = item._id;
            organizationList.push(organizationObj);
          });
          // var results = queryString ? organizationList.filter(this.createStateFilter(queryString)) : organizationList;
          clearTimeout(this.timeout);
          this.timeout = setTimeout(() => {
            cb(organizationList);
          }, 3000 * Math.random());
        })
        .catch((err) => {
          this.$message.warning(err.message);
        });
    },
    createStateFilter(queryString) {
      return (state) => {
        return (
          state.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0
        );
      };
    },
    handleSelect(item) {
      this.pickItem = item;
    },
    //确定关联人物
    defineRelatedPerson() {
      let obj = {};
      if (
        this.personType == "相关专著" ||
        this.personType == "人物画像分析报告"
      ) {
        obj["object"] = this.literatureObj.originName;
      } else {
        obj["object"] = this.selectText.trim();
      }
      obj["objectFrom"] = this.literatureObj.id;
      obj["subject"] = this.pickItem.address;
      obj["relation"] = this.personType;
      obj["objectType"] = "文献";
      addRelatedInfo(obj)
        .then((res) => {
          if (res == 1) {
            this.$message.success("关联人员成功！");
            this.dialogVisiblePerson = false;
          } else {
            this.$message.error("关联人员失败！");
          }
        })
        .catch((err) => {
          this.$message.warning(err.message);
        });
    },
    //确定关联机构
    defineRelatedOrganization() {
      let obj = {};
      if (
        this.organizationType == "历史文献" ||
        this.organizationType == "证据资料" ||
        this.organizationType == "机构分析报告"
      ) {
        obj["object"] = this.literatureObj.originName;
      } else {
        obj["object"] = this.selectText.trim();
      }
      obj["objectFrom"] = this.literatureObj.id;
      obj["subject"] = this.pickItem.address;
      obj["relation"] = this.organizationType;
      obj["objectType"] = "文献";
      addRelatedInfo(obj)
        .then((res) => {
          if (res == 1) {
            this.$message.success("关联机构成功！");
            this.dialogVisibleOrganization = false;
          } else {
            this.$message.error("关联机构失败！");
          }
        })
        .catch((err) => {
          this.$message.warning(err.message);
        });
    },
    //添加标签
    addTag() {
      this.dialogVisibleTag = true;
      this.dynamicTags = [];
    },
    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.inputVisible = false;
      this.inputValue = "";
    },
    //确定新增标签
    defineAddTag() {
      let labels = this.dynamicTags;
      addLiteratureLabel(this.literatureObj.id, labels)
        .then((res) => {
          if (res == 1) {
            this.$message.success("添加标签成功！");
            this.dialogVisibleTag = false;
          } else {
            this.$message.error("添加标签失败！");
          }
        })
        .catch((err) => {
          this.$message.warning(err.message);
        });
    },
    handleClose(done) {
      done();
    },
    //#endregion
    //收藏
    //查询收藏目录
    searchCollectionFolder() {
      queryCollectionFolder(this.userInfo.account).then((res) => {
        this.collectionFolder = res;
      });
    },
    //选择收藏夹
    addFolder(item, index) {
      this.selectIndex = index;
      if (this.selectText != "") {
        this.collectionData.description = this.selectText;
        this.collectionData.folderId = item.id;
        this.collectionData.originId = this.literatureObj.id;
        this.collectionData.title = this.literatureObj.originName.split(".")[0];
        this.collectionData.collector = this.userInfo.account;
      } else {
        this.$message.warning("未选择文字！");
      }
    },
    //选择收藏夹完成上传
    defineAddCollection() {
      if (this.collectionData.folderId != undefined) {
        addCollection(this.collectionData).then(
          (res) => {
            if (res == 1) {
              this.$message.success("收藏成功!");
              this.dialogVisibleCollection = false;
            }
          }
        );
      } else {
        this.$message.warning("未选择收藏夹！");
        this.dialogVisibleCollection = true;
      }
    },
    addCollection() {
      this.dialogVisibleCollection = true;
    },
    stopstop() { },
    //新增收藏夹名称
    addCollectionFolder() {
      if (this.collectionName != "" && this.collectionName != null) {
        addCollectionFolder({
          name: this.collectionName,
          collector: this.userInfo.account,
        })
          .then((res) => {
            if (res == 1) {
              this.$message.success("新增成功！");
              this.searchCollectionFolder();
              this.innerVisible = false;
            }
          })
          .catch((err) => {
            this.$message.warning(err.message);
          });
      } else {
        this.$message.warning("新增目录不能为空！");
        this.innerVisible = true;
      }
    },
    //删除收藏夹目录
    delectCollectionFolder(id) {
      this.$confirm('此操作将永久删除, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        removeCollectionFolder(id)
          .then((res) => {
            if (res == 1) {
              this.$message.success("删除成功！");
              this.searchCollectionFolder();
            }
          })
          .catch((err) => {
            this.$message.warning(err.message);
          });
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消删除'
        });
      });
    },
    //全文检索
    handleCurrentChangeFulltext(pageNum) {
      this.fulltextPagination.currentPage = pageNum;
      this.searchLiterature();
    },
    handleSizeChangeFulltext(val) {
      this.fulltextPagination.everySize = val;
      this.fulltextPagination.currentPage = 1;
      this.searchLiterature();
    },
    query_selector(selector) {
      return Array.from(document.querySelectorAll(selector));
    },
  },
  watch: {
    visible(value) {
      if (value) {
        document.body.addEventListener("click", this.closeMenu);
      } else {
        document.body.removeEventListener("click", this.closeMenu);
      }
    },
  },
  computed: {
    userInfo() {
      if (this.$store.getters.userInfo) {
        return this.$store.getters.userInfo;
      } else {
        return { username: "" };
      }
    },
  },
  activated() {
    startLoading();
    //多板块文献资料查询
    //所有版块id集合
    let ids = [];
    queryLiteratureFolder("法律法规")
      .then((res) => {
        this.moduleList = res;
        this.treeData = [
          {
            label: "国际法",
            children: [],
          },
          {
            label: "对内内部法规",
            children: [],
          },
          {
            label: "我国内军内法规",
            children: [],
          },
        ];
        this.activeName = res[0] && res[0].id;
        res
          .filter((item) => item.remark == "国际法")
          .forEach((item, index) => {
            this.internationalLaw[index].title = item.name;
            this.internationalLaw[index].id = item.id;
            this.treeData[0].children.push({ label: item.name, id: item.id });
          });
        res
          .filter((item) => item.remark == "对内内部法规")
          .forEach((item, index) => {
            this.internalLaw[index].title = item.name;
            this.internalLaw[index].id = item.id;
            this.treeData[1].children.push({ label: item.name, id: item.id });
          });
        res
          .filter((item) => item.remark == "我国内军内法规")
          .forEach((item, index) => {
            this.domesticLaw[index].title = item.name;
            this.domesticLaw[index].id = item.id;
            this.treeData[2].children.push({ label: item.name, id: item.id });
          });
        res.forEach((item) => {
          ids.push(item.id);
        });
      })
      .then(() => {
        multiQueryLiterature("法律法规", false, ids)
          .then((res) => {
            this.viewData = res;
            //国际法
            this.internationalLaw[0].lawList = res[1];
            this.internationalLaw[1].lawList = res[2];
            this.internationalLaw[2].lawList = res[3];
            this.internationalLaw[3].lawList = res[4];
            this.internationalLaw[4].lawList = res[5];
            this.internationalLaw[5].lawList = res[6];
            this.internationalLaw[6].lawList = res[7];
            this.internationalLaw[7].lawList = res[8];
            this.internationalLaw[8].lawList = res[9];
            //对内内部法规
            this.internalLaw[0].lawList = res[10];
            this.internalLaw[1].lawList = res[11];
            this.internalLaw[2].lawList = res[12];
            //我国内军内法规
            this.domesticLaw[0].lawList = res[13];
            this.domesticLaw[1].lawList = res[14];
            this.domesticLaw[2].lawList = res[15];
            endLoading();
          })
          .catch((err) => { });

        //多板块文献资料图片查询
        multiQueryLiterature("法律法规", true, ids)
          .then((res) => {
            //三战业务理论
            this.internationalLaw[0].img = res[1];
            this.internationalLaw[1].img = res[2];
            this.internationalLaw[2].img = res[3];
            this.internationalLaw[3].img = res[4];
            this.internationalLaw[4].img = res[5];
            this.internationalLaw[5].img = res[6];
            this.internationalLaw[6].img = res[7];
            this.internationalLaw[7].img = res[8];
            this.internationalLaw[8].img = res[9];
            //对内内部法规
            this.internalLaw[0].img = res[10];
            this.internalLaw[1].img = res[11];
            this.internalLaw[2].img = res[12];
            //我国内军内法规
            this.domesticLaw[0].img = res[13];
            this.domesticLaw[1].img = res[14];
            this.domesticLaw[2].img = res[15];
          })
          .catch((err) => {
            this.$message.error(err.message);
          });
        //查询收藏夹
        this.searchCollectionFolder();
      })
      .catch((err) => {
        endLoading();
        this.$message.warning(err.message);
      });
    var observer = new IntersectionObserver(function (changes) {
      changes.forEach(function (change) {
        var container = change.target;
        // var content = container.querySelector("template").content;
        if (change.isIntersecting) {
          container.classList.add("animate__animated");
          container.classList.add("animate__lightSpeedInLeft");
        } else {
          container.classList.remove("animate__animated");
          container.classList.remove("animate__lightSpeedInLeft");
        }
      });
    });
    let _this = this;
    let times = setInterval(function () {
      if (_this.query_selector(".content-img").length > 0) {
        _this.query_selector(".content-img").forEach(function (item) {
          observer.observe(item);
        });
        clearInterval(times);
      }
    }, 100);

    var observer1 = new IntersectionObserver(function (changes) {
      changes.forEach(function (change) {
        var container = change.target;
        // var content = container.querySelector("template").content;
        if (change.isIntersecting) {
          container.classList.add("animate__animated");
          container.classList.add("animate__lightSpeedInRight");
        } else {
          container.classList.remove("animate__animated");
          container.classList.remove("animate__lightSpeedInRight");
        }
      });
    });
    let times1 = setInterval(function () {
      if (_this.query_selector(".content-list").length > 0) {
        _this.query_selector(".content-list").forEach(function (item) {
          observer1.observe(item);
        });
        clearInterval(times1);
      }
    }, 100);
    var observer2 = new IntersectionObserver(function (changes) {
      changes.forEach(function (change) {
        var container = change.target;
        // var content = container.querySelector("template").content;
        if (change.isIntersecting) {
          container.classList.add("animate__animated");
          container.classList.add("animate__rubberBand");
        } else {
          container.classList.remove("animate__animated");
          container.classList.remove("animate__rubberBand");
        }
      });
    });
    let times2 = setInterval(function () {
      if (_this.query_selector(".card-title").length > 0) {
        _this.query_selector(".card-title").forEach(function (item) {
          observer2.observe(item);
        });
        clearInterval(times2);
      }
    }, 100);
    let times3 = setInterval(function () {
      if (_this.query_selector(".test-span-div").length > 0) {
        _this.query_selector(".test-span-div").forEach(function (item) {
          observer2.observe(item);
        });
        clearInterval(times3);
      }
    }, 100);
  },
};
</script>