<template>
  <div id="yqzxk">
    <div class="left-nav">
      <div class="choice-tree">
        <el-input
          class="public-input"
          placeholder="输入关键字进行过滤"
          v-model="filterText"
        ></el-input>
        <el-tree
          :data="data"
          :props="defaultProps"
          class="filter-tree"
          :filter-node-method="filterNode"
          @node-expand="handleNodeExpand"
          @node-click="handleNodeClick"
          node-key="id"
          ref="tree"
          :expand-on-click-node="false"
          :default-expanded-keys="arr_show_key"
          :current-node-key="1"
          highlight-current
        >
            <span class="custom-tree-node" slot-scope="{ node, data }">
              <span class="first-span" :title="node.label">{{ node.label }}</span>
              <span>
                <el-button
                  type="text"
                  size="mini"
                  @click="view_webSite(1)"
                  @click.stop.native
                  :style="{
                    display:
                      node.data.id == 1
                        ? 'block !important'
                        : 'none !important',
                  }"
                >
                  <i class="el-icon-circle-plus" title="添加站点"></i>
                </el-button>
              </span>
            </span>
          </el-tree>
      </div>
    </div>
    <div class="right-nav">
      <template>
        <el-tabs v-model="activeName" @tab-click="handleClick">
          <el-tab-pane label="信息列表" name="first">
            <div class="gjss">
              <div @click="show = !show" class="gjss_div">
                <i class="el-icon-caret-bottom" v-if="!show"></i
                ><span v-if="!show">点击展示高级检索</span>
                <i class="el-icon-caret-top" v-if="show"></i
                ><span v-if="show">点击隐藏高级检索</span>
              </div>
              <div class="translates">
                <el-switch
                  active-color="#13ce66"
                  inactive-color="#13ce66"
                  v-model="value_translate"
                  active-text="原文"
                  inactive-text="译文">
                </el-switch>
              </div>
            </div>
            <el-collapse-transition>
              <div
                v-show="show"
                style="
                  position: absolute;
                  width: calc(100% - 20px);
                  margin-left: 10px;
                  box-shadow: rgb(24, 110, 138) 0px 4px 6px;
                  background-image: linear-gradient(#1a324d, rgb(23, 73, 109));
                "
              >
                <div style="width: 100%;">
                  <div class="top-choice">
                    <table>
                      <tr>
                        <td>作者：</td>
                        <td>
                          <el-input
                            class="public-input"
                            placeholder="输入关键字进行过滤"
                            v-model="condition.author"
                          ></el-input>
                        </td>
                        <td>内容：</td>
                        <td>
                          <el-input
                            class="public-input"
                            placeholder="输入关键字进行过滤"
                            v-model="condition.txt"
                          ></el-input>
                        </td>
                      </tr>
                      <tr v-show = "type_f_t">
                        <td>转发数：</td>
                        <td>
                          <el-input
                            class="public-input sj_input"
                            placeholder="输入数字"
                            v-model="condition.author1"
                            type="number"
                          ></el-input>
                          <span>-</span>
                          <el-input
                            class="public-input sj_input"
                            placeholder="输入数字"
                            v-model="condition.author1_1"
                            type="number"
                          ></el-input>
                        </td>
                        <td>评论数：</td>
                        <td>
                          <el-input
                            class="public-input sj_input"
                            placeholder="输入数字"
                            v-model="condition.txt2"
                            type="number"
                          ></el-input>
                          <span>-</span>
                          <el-input
                            class="public-input sj_input"
                            placeholder="输入数字"
                            v-model="condition.txt2_2"
                            type="number"
                          ></el-input>
                        </td>
                      </tr>
                      <tr v-show = "type_f_t">
                        <td>点赞数：</td>
                        <td>
                          <el-input
                            class="public-input sj_input"
                            placeholder="输入数字"
                            v-model="condition.author3"
                            type="number"
                          ></el-input>
                          <span>-</span>
                          <el-input
                            class="public-input sj_input"
                            placeholder="输入数字"
                            v-model="condition.author3_3"
                          ></el-input>
                        </td>
                        <td>发布人标签：</td>
                        <td>
                          <el-input
                            class="public-input"
                            placeholder="输入关键字进行过滤"
                            v-model="condition.txt4"
                          ></el-input>
                        </td>
                      </tr>
                      <tr v-show = "type_f_t">
                        <td>帖子标签：</td>
                        <td>
                          <el-input
                            class="public-input"
                            placeholder="输入关键字进行过滤"
                            v-model="condition.author5"
                          ></el-input>
                        </td>
                        <td>帖子主题：</td>
                        <td>
                          <el-input
                            class="public-input"
                            placeholder="输入关键字进行过滤"
                            v-model="condition.txt6"
                          ></el-input>
                        </td>
                      </tr>
                      <tr>
                        <td>标题：</td>
                        <td>
                          <el-input
                            class="public-input"
                            placeholder="输入关键字进行过滤"
                            v-model="condition.title"
                          ></el-input>
                        </td>
                        <td>发布时间：</td>
                        <td>
                          <el-date-picker
                            class="public-range"
                            value-format="yyyy-MM-dd HH:mm:ss"
                            v-model="value1"
                            type="datetimerange"
                            :picker-options="pickerOptions"
                            range-separator="至"
                            start-placeholder="开始日期"
                            end-placeholder="结束日期"
                            align="right"
                          >
                          </el-date-picker>
                        </td>
                        <td>
                          <div class="button-discuss" @click="search_ss()">
                            搜索
                          </div>
                        </td>
                      </tr>
                    </table>
                  </div>
                </div>
              </div>
            </el-collapse-transition>
            <div class="bottom-content">
              <!-- <div class="content-title">
                                <span>为您提供<span class="new-num" v-text="total"></span>条数据</span>
                            </div> -->
              <div class="content-text">
                <div class="content-news" v-for="(item, index) in getNews">
                  <div
                    class="news-title"
                    v-text="value_translate?item.title:item.title_zh"
                    @click="show_info(item, index)"
                    v-show="(value_translate?item.title == '':item.title_zh == '') ? false : true"
                    :title="value_translate?item.title:item.title_zh"
                  ></div>
                  <div
                    class="news-content"
                    v-html="item.highLight != null ? item.highLight : value_translate?item.txt:item.txt_zh"
                    @click="show_info(item, index)"
                  ></div>
                  <div class="news-info">
                    <div :style="{'width':click_id=='智库'?'9%':'9%'}">
                      <span class="news-info-from"
                        >情感值：<span v-text="item.emotion1!=null?item.emotion1.grade:''"></span
                      ></span>
                    </div>
                    <div :style="{'width':click_id=='智库'?'31%':'41%'}">
                      <span class="news-info-from"
                        >来自：<span v-text="item.site_name" style="word-break: break-all;text-overflow: ellipsis;display: -webkit-box;-webkit-box-orient: vertical;-webkit-line-clamp: 1;overflow: hidden;"></span
                      ></span>
                    </div>
                    <div :style="{'display':click_id=='智库'?'block':'none','width':click_id=='智库'?'20%':'25%'}">
                      <span class="news-info-from" style="display: block;float:left;"
                        >作者：<span v-text="item.author" class="zz-class" :title="item.author"></span
                      ></span>
                    </div>
                    <div :style="{'width':click_id=='智库'?'20%':'25%'}">
                      <span class="news-info-from"
                        >发布时间：<span v-text="item.pubdate"></span></span
                      >&emsp;
                    </div>
                    <div :style="{'width':click_id=='智库'?'20%':'25%'}">
                      <span class="news-info-from"
                        >抓取时间：<span v-text="item.snatch_time"></span
                      ></span>
                    </div>
                  </div>
                </div>
              </div>
            </div>
            <div class="pagination-div">
              <el-pagination
                class="myPagination"
                background
                layout="total, sizes, prev, pager, next, jumper"
                :total="total"
                :current-page.sync="currentPage"
                @size-change="handleSizeChange"
                @current-change="handleCurrentChange"
                :page-size="everySize"
                :page-sizes="[10, 20, 50, 100]"
              >
              </el-pagination>
            </div>
          </el-tab-pane>
          <el-tab-pane label="可视化分析" name="second">
            <div class="div-pub">
              <div class="div-div-pub">
                <div class="pub-div" id="rmcy"></div>
              </div>
              <div class="div-div-pub">
                <div class="pub-div" id="bsgjc"></div>
              </div>
              <div class="div-div-pub">
                <div class="pub-div" id="gpgqch"></div>
              </div>
            </div>
            <div class="div-pub">
              <div class="div-div-pub">
                <div class="pub-div" id="dqslfb"></div>
              </div>
              <div class="div-div-pub">
                <div class="pub-div" id="mtlxfb"></div>
              </div>
              <div class="div-div-pub">
                <div class="pub-div" id="mgxxzb"></div>
              </div>
            </div>
            <div class="div-pub">
              <div class="div-div-pub1">
                <div class="pub-div" id="xxslzs"></div>
              </div>
              <div class="div-div-pub1">
                <div class="pub-div" id="qgslzs"></div>
              </div>
            </div>
          </el-tab-pane>
        </el-tabs>
      </template>
    </div>
    <el-drawer
      title="新闻站点"
      :visible.sync="drawer"
      direction="rtl"
      size="40%">
      <div class="search">
          <el-input v-model="inputYqzxk" placeholder="请输入站点名称"></el-input>
          <div class="button-search" @click="searchYqzxk()">搜索</div>
          <div class="button-search" @click="WebsiteRelevance()">站点关联</div>
      </div>
      <el-table :data="treeData" tooltip-effect="dark" ref="multipleTable" style="width: 100%;" height="calc(100% - 110px)" @selection-change="handleSelection_Website" :header-cell-style="{color:'#ffffffc7',fontSize:'14px',background:'#263b5d'}" :row-style="{color:'#ffffffc7',fontSize:'14px',background:'#1d2d46'}">
        <el-table-column type="selection" width="55"></el-table-column>
        <el-table-column prop="countryZh" label="所属国家" align="center"></el-table-column>
        <el-table-column prop="name" label="站点名称" align="center"></el-table-column>
        <el-table-column prop="domain" label="站点地址" align="center"></el-table-column>
      </el-table>
      <div class="page-div">
        <el-pagination
          class="myPagination"
          background
          layout="total, sizes, prev, pager, next, jumper"
          @size-change="handleSizeChanges"
          :page-size="pageInfo.pageSize"
          :current-page="pageInfo.current_page"
          :total="pageInfo.total"
          @current-change="view_webSite"
          :page-sizes="[10, 20, 50, 100]"
        >
        </el-pagination>
      </div>
    </el-drawer>
  </div>
</template>

<style lang="scss">
#yqzxk {
  width: 99%;
  height: 97%;
  margin: 0;
  padding: 20px;
  box-sizing: border-box;
  overflow: hidden;
  .left-nav {
    width: 20%;
    height: 100%;
    float: left;
    background: url("../../assets/img/yqjc/01.png") no-repeat;
    background-size: 100% 100%;
    .custom-tree-node {
      flex: 1;
      display: flex;
      align-items: center;
      justify-content: space-between;
      font-size: 14px;
      padding-right: 8px;
      position: relative;
      width: 82%;
      .first-span {
        width: 100%;
        float: left;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
    }
    .choice-tree {
      width: 100%;
      height: 100%;
      box-sizing: border-box;
      padding: 20px;
      overflow-y: auto;
      input {
        color: white;
        background-color: transparent;
      }
      .el-tree {
        margin-top: 10px;
        color: white;
        background: transparent;
        .el-tree-node__content {
          height: 40px;
          .el-icon-circle-plus {
            display: none;
          }
        }
      }
      .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: 16px !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;
        .el-icon-circle-plus {
          display: block;
        }
        // border-radius: 5px;
      }
      .el-tree--highlight-current
        .el-tree-node.is-current
        > .el-tree-node__content {
        background-color: #00648a96 !important;
        // border-radius: 5px;
      }
      .el-icon-circle-plus {
        font-size: 16px;
        color: #00a6f5;
      }
    }
  }
  .right-nav {
    width: 80%;
    height: 100%;
    float: left;
    background: url("../../assets/img/yqjc/02.png") no-repeat;
    background-size: 100% 100%;
    .gjss {
      height: 40px;
      width: 100%;
      background: #0c4c6e2e;
      position: relative;
      .gjss_div {
        text-align: center;
        cursor: pointer;
        line-height: 40px;
        i {
          color: #06cee0;
          font-size: 18px;
        }
        span {
          font-size: 14px;
          color: darkgrey;
        }
      }
      .translates{
        width: 130px;
        position: absolute;
        right: 43px;
        top: 10px;
        .el-switch__label{
          height: unset;
          color: #ababab;
        }
        .is-active{
          span{
            color: #13ce66 !important;
          }
        }
      }
    }
    .el-tabs__header {
      margin: 0;
    }
    .el-tabs__nav {
      margin-left: 10px;
    }
    .el-tabs__nav-wrap::after {
      background-color: #165b6d00;
    }
    .el-tabs__item.is-active {
      color: #06cee0;
    }
    .el-tabs__active-bar {
      height: 6px;
      background-color: #06cee0;
      border-radius: 4px;
    }
    .el-tabs__item:hover {
      color: #06cee0;
    }
    .el-tabs__item {
      color: white;
      height: 53px;
      line-height: 53px;
      font-size: 15px;
      padding: 1px 20px 10px 10px !important;
    }
    .top-choice {
      width: 100%;
      padding-right: 30px;
      text-align: right;
      box-sizing: border-box;
      padding-bottom: 15px;
      table {
        width: 80%;
        height: 100%;
        margin-left: 17%;
        color: white;
        input {
          width: 300px;
        }
        .sj_input{
          width: 142px;
          input {
            width: 100% !important;
          }
        }
        .button-discuss {
          width: 100px;
          height: 30px;
          line-height: 30px;
          float: right;
          font-size: 14px;
          margin-top: 5px;
          margin-right: 20px;
          text-align: center;
          cursor: pointer;
          background-image: url(../../assets/img/yqjc/40.png);
          background-repeat: no-repeat;
          background-size: 100% 100%;
        }
        .el-input__inner {
          color: white;
          background-color: transparent;

          .el-range-input {
            color: white;
            background-color: transparent;
          }
        }
        .el-select .el-input.is-focus .el-input__inner {
          border-color: #09c69c !important;
        }
        .el-range-editor.is-active {
          border-color: #09c69c !important;
        }
        .el-range-separator {
          color: white;
        }
      }
    }
    .bottom-content {
      width: calc(100% - 20px);
      margin-left: 10px;
      height: calc(100% - 166px);
      .content-title {
        width: 100%;
        height: 40px;
        line-height: 40px;
        padding-left: 20px;
        box-sizing: border-box;
        background: #263b5d;
        .new-num {
          color: #09c69c;
        }
      }
      .content-text {
        width: 100%;
        height: 100%;
        padding: 10px;
        overflow-y: auto;
        box-sizing: border-box;
        .content-news {
          border-bottom: 1px solid #156677;
          .news-title {
            width: 100%;
            height: 40px;
            line-height: 40px;
            font-size: 18px;
            padding-left: 20px;
            cursor: pointer;
            box-sizing: border-box;
            word-break: keep-all; /* 不换行 */
            white-space: nowrap; /* 不换行 */
            overflow: hidden; /* 内容超出宽度时隐藏超出部分的内容 */
            text-overflow: ellipsis;
            color: #ffc800;
          }
          .news-content p:first-child {
            display: block !important;
          }
          .news-content p:nth-child(2) {
            display: block !important;
          }
          .news-content p:nth-child(3) {
            display: block !important;
          }
          .news-content {
            font-size: 16px;
            text-indent: 20px;
            margin-top: 10px;
            cursor: pointer;
            word-break: break-all;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 4;
            overflow: hidden;
            em {
              color: red;
            }
            p {
              display: none;
            }
          }

          .news-info {
            width: 100%;
            height: 30px;
            margin-top: 10px;
            div {
              width: 33%;
              float: left;
              text-align: center;
            }
            .news-info-from {
              margin-left: 20px;
              font-size: 14px;
              display: flex;
              span {
                color: #06cee0;
                font-size: 14px;
              }
              .zz-class{
                word-break: break-all;
                text-overflow: ellipsis;
                display: -webkit-box;
                -webkit-box-orient: vertical;
                -webkit-line-clamp: 1;
                overflow: hidden;
                width: calc(100% - 42px);
                float: right;
              }
            }
            .news-info-channel {
              margin-left: 20px;
            }
            .news-info-time {
              margin-left: 20px;
            }
            .news-info-feeling {
              margin-left: 20px;
            }
            .news-info-tool {
              width: 100px;
              float: right;
              a {
                text-decoration: none;
              }
              i {
                cursor: pointer;
              }
              i:hover {
                color: aqua;
              }
            }
          }
        }
      }
    }
    .pagination-div {
      width: 100%;
      height: 50px;
      .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;
      }
    }
    .div-pub {
      width: 100%;
      height: calc(calc(100% - 60px) / 3);
      .div-div-pub {
        width: calc(calc(100% - 10px) / 3);
        height: 100%;
        float: left;
      }
      .div-div-pub1 {
        width: calc(calc(100% - 8px) / 2);
        height: 100%;
        float: left;
      }
      .pub-div {
        background: #1c4467;
        width: calc(100% - 15px);
        height: calc(100% - 15px);
        margin: 10px;
        border-radius: 6px;
      }
    }
  }
  .el-drawer.rtl{
    background-color: #1d2d46;
  }
  .el-drawer__open .el-drawer.rtl{
    .el-drawer__header{
      color: #ffffff;
    }
    .search {
        width: 100%;
        height: 50px;
        text-align: right;
        .el-input {
            width: 200px;
            margin-right: 15px;
            float: left;
            margin-left: 10px;
            input {
                height: 30px;
                color: white;
                background: none !important;
                border: 1px solid #146a80 !important;
                box-shadow: 0 0 10px #1b6097;
            }
            .el-input__icon {
                line-height: 30px;
            }
        }
        .button-search {
            width: 100px;
            height: 30px;
            line-height: 30px;
            font-size: 13px;
            float: left;
            margin-right: 10px;
            text-align: center;
            cursor: pointer;
            background-image: url(../../assets/img/yqjc/41.png);
            background-repeat: no-repeat;
            background-size: 100% 100%;
        }
    }
    .el-table tr {
      background-color: #1d2d46 !important;
      color: #ffffffc7;
    }
    .el-table td {
      background-color: #253650 !important;
      color: #ffffffc7;
    }
    .el-table td {
      border-bottom: 1px solid #127a89;
      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-table--group::after,
    .el-table--border::after,
    .el-table::before {
      background-color: unset;
    }
    .el-table__header-wrapper table {
      width: 100% !important;
    }
    .el-table__body-wrapper {
      .el-table__empty-block {
        height: 20px !important;
      }
    }
  }
  input[type="number"]::-webkit-inner-spin-button,
  input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
  }
  input[type="number"] {
    -moz-appearance: textfield;
  }
}
</style>

<script>
import {
  startLoading,
  endLoading,
  post,
  getTreeData,
  getTime_extent,
  get,
} from "../../util/http_util";
import * as echarts from "echarts";
import {} from "../../util/data_util";
import {option_hot_word, option_bar_desc  } from "../../constant/echart-options"
export default {
  name: "yqzxk",
  data() {
    return {
      currentPage: 1, //当前选择的页数
      filterText: "",
      options: [
        {
          value: "选项1",
          label: "简体中文",
        },
        {
          value: "选项2",
          label: "繁体中文",
        },
        {
          value: "选项3",
          label: "英文",
        },
      ],
      value: "",
      data: [],
      defaultProps: {
        children: "children",
        label: "label",
      },
      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: [getTime_extent(7).pre_rq_start, getTime_extent(0).pre_rq_end],
      condition: {
        stTime: null,
        edTime: null,
        webSite: {},
        author: null,
        title: null,
        txt: null,
      },
      getNews: [],
      total: 0,
      arr_show_key: [],
      click_id: "新闻",
      click_level: 1,
      everySize: 10,
      selectName: "",
      activeName: "first",
      show: false,
      color: ["#ee6666", "#73c0de"],
      myChart1: "",
      myChart2: "",
      myChart3: "",
      myChart4: "",
      myChart5: "",
      myChart6: "",
      myChart7: "",
      myChart8: "",
      value_translate:false,
      drawer:false,
      treeData:[],
      inputYqzxk:'',
      websiteIds:[],
      pageInfo: {
        total: 0,
        pageSize: 10,
        current_page: 1,
      },
      type_f_t:false,
    };
  },
  watch: {
    filterText(val) {
      this.$refs.tree.filter(val);
    },
  },
  computed: {
      userInfo() {
          if (this.$store.getters.userInfo) {
              return this.$store.getters.userInfo;
          } else {
              return { username: "" };
          }
      }
  },
  methods: {
    //站点关联
    WebsiteRelevance(){
      post(
        "api/rest/sentiment/changeWebsiteToUser?account="+this.userInfo.account+"&add=true",
        this.websiteIds
      )
        .then((data) => {
          if(data==this.websiteIds.length){
            this.$message({
              type: "success",
              message: '关联成功',
            });
            this.query_tree();
          }else{
            this.$message({
              type: "warning",
              message: '关联失败',
            });
          }
        })
        .catch((err)=>{
          this.$message({
            type: "warning",
            message: err.message,
          });
        });
    },
    handleSizeChanges(val) {
      this.pageInfo.pageSize = val;
      this.pageInfo.current_page = 1;
      this.view_webSite(1);
    },
    //站点搜索
    searchYqzxk(){
      this.view_webSite(1);
    },
    //站点关联select选择框
    handleSelection_Website(val){
      this.websiteIds = [];
      val.forEach(item => {
          this.websiteIds.push(item.id);
      });
    },
    //打开站点关联
    view_webSite(pageNum){
      this.treeData=[];
      this.websiteIds=[];
      this.pageInfo.current_page = pageNum;
      let title = this.inputYqzxk==''?'':"&siteName="+this.inputYqzxk;
      get("api/rest/sentiment/queryWebSite?pageNum="+pageNum+"&pageSize="+this.pageInfo.pageSize+"&account="+this.userInfo.account+title).then(
          (res) => {
            this.treeData = res.list;
            this.drawer = true;
            this.pageInfo.total = res.totals;
            this.$nextTick(()=>{
              this.treeData.forEach(row => {
                if(row.account!=null)
                  this.$refs.multipleTable.toggleRowSelection(row,true);
              })
            })
          }
      ).catch((err)=>{
        this.$message({
          type: "warning",
          message: err.message,
        });
      });
    },
    handleClick(tab, event) {
      let _this = this;
      if (tab.index == 1) {
        setTimeout(function () {
          _this.echarts_fun();
        }, 500);
      } else {
        _this.search();
      }
    },
    echarts_fun() {
      this.echarts_1();
      this.echarts_3();
      this.echarts_4();
      this.echarts_5();
      this.echarts_6();
      this.echarts_7();
      this.echarts_8();
    },
    //热词
    echarts_1() {
      let _this = this;
      if (_this.myChart1 == null ||_this.myChart1 == "" ||_this.myChart1 == undefined) {
        _this.myChart1 = echarts.init(document.getElementById("rmcy"));
        _this.myChart1.setOption(option_hot_word);
        window.addEventListener("resize", function () {
          _this.myChart1.resize();
        });
      }  
      let condition1 = Object.assign({}, this.condition);
      condition1.sentimentType = this.getSentimentType();
      post(
        "api/rest/fulltext/statisticsNews?field=HOT_WORD",
        condition1
      )
        .then((data) => {
          this.echarts_2(data);
          let datas = [];
          if (data.length > 0) {
            data.forEach((item) => {
                if(item.title != '' && item.title.length > 1){
                    datas.push(item);
                }
            });
            let data_all = datas.slice(0,40);
            datas = [];
            data_all.forEach((item) => {
                datas.push({ name: item.title, value: item.count });
            });
          }
          let options = {
            series: [
              {
                data: datas,
              },
            ],
          };
          this.myChart1.setOption(options);
        })
        .catch((err)=>{
          this.$message({
            type: "warning",
            message: err.message,
          });
        });
       
    },
    //关键词
    echarts_2(data) {
      let _this = this;
      if (
        _this.myChart2 == null ||
        _this.myChart2 == "" ||
        _this.myChart2 == undefined
      ) {
        _this.myChart2 = echarts.init(document.getElementById("bsgjc"));
     
        let option = option_bar_desc;
        option.series[0].itemStyle.normal.color = new echarts.graphic.LinearGradient(
                    1,
                    0,
                    0,
                    0,
                    [
                      {
                        offset: 0,
                        color: "#2ad5ff", // 0% 处的颜色
                      },
                      {
                        offset: 0.6,
                        color: "#058bf8", // 60% 处的颜色
                      },
                      {
                        offset: 1,
                        color: "#005ef5", // 100% 处的颜色
                      },
                    ],
                    false
                  );
        _this.myChart2.setOption(option);
        window.addEventListener("resize", function () {
          _this.myChart2.resize();
        });
        
      } 
      let name = [];
      let value = [];
      if (data.length > 0) {
        data.forEach((item) => {
          if(item.title != undefined && item.title.length>1){
            name.push(item.title);
            value.push(item.count);
          }
        });
      }
      let options = {
        yAxis: {
          data: name,
        },
        series: [
          {
            data: value,
          },
        ],
      };
      this.myChart2.setOption(options);
    },
    //高频情感词汇
    echarts_3() {
      let _this = this;
      if (
        _this.myChart3 == null ||
        _this.myChart3 == "" ||
        _this.myChart3 == undefined
      ) {
        _this.myChart3 = echarts.init(document.getElementById("gpgqch"));
        let names = [];
        let values = [];
        let option = option_bar_desc;
        option.series[0].itemStyle.normal.color = new echarts.graphic.LinearGradient(
                    1,
                    0,
                    0,
                    0,
                    [
                      {
                        offset: 0,
                        color: "#2ad5ff", // 0% 处的颜色
                      },
                      {
                        offset: 0.6,
                        color: "#058bf8", // 60% 处的颜色
                      },
                      {
                        offset: 1,
                        color: "#005ef5", // 100% 处的颜色
                      },
                    ],
                    false
                  );
        _this.myChart3.setOption(option);
        window.addEventListener("resize", function () {
          _this.myChart3.resize();
        });
        
      }
      let title = '大洲分布';
      let condition1 = Object.assign({}, this.condition);
      condition1.dimensionRegion = "CONTINENT";
      //获取统计维度
      if(this.click_level == 2){
        title = "国家分布";
        condition1.dimensionRegion = "COUNTRY";
      }else if(this.click_level == 3||this.click_level == 4){
        condition1.dimensionRegion = "MEDIA";
        title = "媒体或用户分布";
      }
      //获取统计的舆情数据类型
      condition1.sentimentType = this.getSentimentType();
      post(
        "api/rest/fulltext/statisticsNewsRegion",
        condition1
      )
        .then((data) => {
        
          let name = [];
          let value = [];
          if (data.length > 0) {
            data.forEach((item) => {
              if(item.title != undefined && item.title!=''){
                name.push(item.title);
                value.push(item.count);
              }
            });
          }
          let options = {
            title: {
              text: title
            },
            yAxis: {
              data: name,
            },
            series: [
              {
                data: value,
              },
            ],
          };
          this.myChart3.setOption(options);
        })
        .catch((err)=>{
          this.$message({
            type: "warning",
            message: err.message,
          });
        });
      
    },
    //地区声量分布
    echarts_4() {
      let _this = this;
      if (
        _this.myChart4 == null ||
        _this.myChart4 == "" ||
        _this.myChart4 == undefined
      ) {
        _this.myChart4 = echarts.init(document.getElementById("dqslfb"));
        let option =  option_bar_desc;
        option.series[0].itemStyle.normal.color = new echarts.graphic.LinearGradient(
                    1,
                    0,
                    0,
                    0,
                    [
                      {
                        offset: 0,
                        color: "#2ad5ff", // 0% 处的颜色
                      },
                      {
                        offset: 0.6,
                        color: "#058bf8", // 60% 处的颜色
                      },
                      {
                        offset: 1,
                        color: "#005ef5", // 100% 处的颜色
                      },
                    ],
                    false
                  );
        _this.myChart4.setOption(option);
        window.addEventListener("resize", function () {
          _this.myChart4.resize();
        });
        
      }
      let title = '国家分布';
      let condition1 = Object.assign({}, this.condition);
      condition1.dimensionRegion = "COUNTRY";
      //获取统计维度
      if(this.click_level != 1){
        title = "媒体或用户分布";
        condition1.dimensionRegion = "MEDIA";
      }
      //获取统计的舆情数据类型
      condition1.sentimentType = this.getSentimentType();
      post(
        "api/rest/fulltext/statisticsNewsRegion",
        condition1
      )
        .then((data) => {
        
          let name = [];
          let value = [];
          if (data.length > 0) {
            data.forEach((item) => {
              name.push(item.title);
              value.push(item.count);
            });
          }
          let options = {
            title:{
              text: title
            },
            yAxis: {
              data: name,
            },
            series: [
              {
                data: value,
              },
            ],
          };
          this.myChart4.setOption(options);
        })
        .catch((err)=>{
          this.$message({
            type: "warning",
            message: err.message,
          });
        });
    },
    //媒体类型分布
    echarts_5() {
      let _this = this;
      if (
        _this.myChart5 != null &&
        _this.myChart5 != "" &&
        _this.myChart5 != undefined
      ) {
        _this.myChart5.dispose(); //销毁
      }
      _this.myChart5 = echarts.init(document.getElementById("mtlxfb"));
      let option = {
        title: {
          text: "媒体类型分布",
          textStyle: {
            color: "#fff",
            fontSize: 12,
          },
          top: 10,
          left: 10,
        },
        tooltip: {
          trigger: "item",
        },
        legend: {
          top: "15%",
          left: "center",
          textStyle: {
            fontSize: 12,
            color: "#fff",
          },
        },
        series: [
          {
            name: "数据量",
            type: "pie",
            radius: ["35%", "50%"],
            center: ["50%", "60%"],
            avoidLabelOverlap: false,
            itemStyle: {
              borderRadius: 10,
              borderColor: "#fff",
              borderWidth: 2,
              emphasis: {
                shadowBlur: 10,
                shadowOffsetX: 0,
                shadowColor: "rgba(0, 0, 0, 0.5)",
              },
              normal: {
                color: function (params) {
                  //自定义颜色
                  var colorList = ["#ee6666", "#73c0de"];
                  return colorList[params.dataIndex];
                },
              },
            },
            label: {
              //展示文本设置
              normal: {
                show: true, //展示
                textStyle: {
                  //文本样式
                  color: "#fff",
                },
              },
            },
            emphasis: {
              label: {
                show: true,
                fontSize: "18",
                fontWeight: "bold",
              },
            },
            data: [
              { value: 12, name: "中国" },
              { value: 15, name: "外媒" },
            ],
          },
        ],
      };
      _this.myChart5.setOption(option);
      window.addEventListener("resize", function () {
        _this.myChart5.resize();
      });
    },
    //敏感信息占比
    echarts_6() {
      let _this = this;
      if (
        _this.myChart6 != null &&
        _this.myChart6 != "" &&
        _this.myChart6 != undefined
      ) {
        _this.myChart6.dispose(); //销毁
      }
      _this.myChart6 = echarts.init(document.getElementById("mgxxzb"));
      let option = {
        title: {
          text: "敏感信息占比",
          textStyle: {
            color: "#fff",
            fontSize: 12,
          },
          top: 10,
          left: 10,
        },
        tooltip: {
          trigger: "item",
        },
        legend: {
          top: "15%",
          left: "center",
          textStyle: {
            fontSize: 12,
            color: "#fff",
          },
        },
        series: [
          {
            name: "数据量",
            type: "pie",
            radius: ["35%", "50%"],
            center: ["50%", "60%"],
            avoidLabelOverlap: false,
            itemStyle: {
              borderRadius: 10,
              borderColor: "#fff",
              borderWidth: 2,
              emphasis: {
                shadowBlur: 10,
                shadowOffsetX: 0,
                shadowColor: "rgba(0, 0, 0, 0.5)",
              },
              normal: {
                color: function (params) {
                  //自定义颜色
                  var colorList = ["#ee6666", "#73c0de","#91cc75","#fac858"];
                  return colorList[params.dataIndex];
                },
              },
            },
            label: {
              //展示文本设置
              normal: {
                show: true, //展示
                textStyle: {
                  //文本样式
                  color: "#fff",
                },
              },
            },
            emphasis: {
              label: {
                show: true,
                fontSize: "18",
                fontWeight: "bold",
              },
            },
            data: [
              { value: 15, name: "敏感" },
              { value: 12, name: "非敏感" },
            ],
          },
        ],
      };
      
      _this.myChart6.setOption(option);
      window.addEventListener("resize", function () {
        _this.myChart6.resize();
      });

      let condition1 = Object.assign({}, this.condition);
      condition1.sentimentType = this.getSentimentType();
      post("api/rest/fulltext/statisticsNews?field=EMOTION", condition1).then(res=>{
        let options = {
          series: [
            {
              data: res.map(e=>{
                return{
                  value: e.count,
                  name: e.title
                }
              }),
            },
          ],
        };
        this.myChart6.setOption(options);
      }).catch(err=>{

      });
    },
    //信息声量走势
    echarts_7() {
      let _this = this;
      if (
        _this.myChart7 != null &&
        _this.myChart7 != "" &&
        _this.myChart7 != undefined
      ) {
        _this.myChart7.dispose(); //销毁
      }
      _this.myChart7 = echarts.init(document.getElementById("xxslzs"));
      let option = {
        title: {
          text: "信息声量走势",
          textStyle: {
            color: "#fff",
            fontSize: 12,
          },
          top: 10,
          left: 10,
        },
        tooltip: {
          trigger: "axis",
        },
        legend: {
          data: ["全部", "网媒"],
          top: "12%",
          left: "center",
          textStyle: {
            fontSize: 12,
            color: "#fff",
          },
        },
        grid: {
          top: "25%",
          left: "5%",
          right: "5%",
          bottom: "6%",
          containLabel: true,
        },
        xAxis: {
          type: "category",
          boundaryGap: false,
          data: [
            "09-16 21:00",
            "09-16 22:00",
            "09-16 23:00",
            "09-17 00:00",
            "09-17 01:00",
            "09-17 02:00",
            "09-17 03:00",
            "09-17 04:00",
            "09-17 05:00",
            "09-17 06:00",
          ],
          axisLabel: {
            color: "#fff",
          },
        },
        yAxis: {
          type: "value",
          axisLabel: {
            color: "#fff",
          },
        },
        series: [
          {
            name: "全部",
            type: "line",
            stack: "总量1",
            data: [0.6, 0.1, 0.3, 0, 0.3, 0.6, 0.5, 0.3, 0.7, 0.4],
            smooth: true,
            itemStyle: {
              normal: {
                color: "#90a6af",
                lineStyle: {
                  color: "#50a6ff",
                },
              },
            },
          },
          {
            name: "网媒",
            type: "line",
            stack: "总量",
            data: [0.1, 0.6, 0.7, 0.3, 0.5, 0.44, 0.5, 0.1, 0.3, 0.1],
            smooth: true,
            itemStyle: {
              normal: {
                color: "#18caaf",
                lineStyle: {
                  color: "#98caff",
                },
              },
            },
          },
        ],
      };
      _this.myChart7.setOption(option);
      window.addEventListener("resize", function () {
        _this.myChart7.resize();
      });
    },
    //情感声量走势
    echarts_8() {
      let _this = this;
      if (
        _this.myChart8 != null &&
        _this.myChart8 != "" &&
        _this.myChart8 != undefined
      ) {
        _this.myChart8.dispose(); //销毁
      }
      _this.myChart8 = echarts.init(document.getElementById("qgslzs"));
      let option = {
        title: {
          text: "情感声量走势",
          textStyle: {
            color: "#fff",
            fontSize: 12,
          },
          top: 10,
          left: 10,
        },
        tooltip: {
          trigger: "axis",
        },
        legend: {
          data: ["敏感", "非敏感"],
          top: "12%",
          left: "center",
          textStyle: {
            fontSize: 12,
            color: "#fff",
          },
        },
        grid: {
          top: "25%",
          left: "5%",
          right: "5%",
          bottom: "6%",
          containLabel: true,
        },
        xAxis: {
          type: "category",
          boundaryGap: false,
          data: [
            "09-16 21:00",
            "09-16 22:00",
            "09-16 23:00",
            "09-17 00:00",
            "09-17 01:00",
            "09-17 02:00",
            "09-17 03:00",
            "09-17 04:00",
            "09-17 05:00",
            "09-17 06:00",
          ],
          axisLabel: {
            color: "#fff",
          },
        },
        yAxis: {
          type: "value",
          axisLabel: {
            color: "#fff",
          },
        },
        series: [
          {
            name: "敏感",
            type: "line",
            stack: "总量1",
            data: [0, 0, 0.1, 0.9, 0.1, 0, 0.0, 0, 0, 0],
            smooth: true,
            itemStyle: {
              normal: {
                color: "#FE5E73",
              },
            },
            areaStyle: {
              normal: {
                //颜色渐变函数 前四个参数分别表示四个位置依次为左、下、右、上
                color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
                  {
                    offset: 0,
                    color: "#FE5E73",
                  },
                  {
                    offset: 0.34,
                    color: "rgb(255, 180, 189,0.8)",
                  },
                  {
                    offset: 1,
                    color: "rgba(255, 250, 250, 0.1)",
                  },
                ]),
              },
            },
          },
          {
            name: "非敏感",
            type: "line",
            stack: "总量",
            data: [0, 0, 0, 0, 0.1, 0.7, 0.1, 0, 0, 0],
            smooth: true,
            itemStyle: {
              normal: {
                color: "#555EFF",
              },
            },
            areaStyle: {
              normal: {
                //颜色渐变函数 前四个参数分别表示四个位置依次为左、下、右、上
                color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
                  {
                    offset: 0,
                    color: "#4E58F2",
                  },
                  {
                    offset: 0.34,
                    color: "rgba(56,155,255,0.8)",
                  },
                  {
                    offset: 1,
                    color: "rgba(38,197,254,0.1)",
                  },
                ]),
              },
            },
          },
        ],
      };
      _this.myChart8.setOption(option);
      window.addEventListener("resize", function () {
        _this.myChart8.resize();
      });
    },
    handleNodeClick(data) {
      this.show = false;
      this.condition.webSite = {};
      this.selectName = data.name;
      this.condition.webSite[data.level] = data.label;
      if (data.level == 4 && data.remark == "新闻") {
        this.condition.webSite[data.level] = data.domain;
      } else if (data.level == 4 && data.remark == "推特") {
        this.condition.webSite[data.level] = data.userUrl;
      } else if (data.level == 4 && data.remark == "脸书") {
        this.condition.webSite[data.level] = data.pageId;
      } else if (data.level == 4 && data.remark == "智库") {
        this.condition.webSite[data.level] = data.url;
      }
      if(data.remark=='新闻' || data.remark == "智库"){
        this.type_f_t = false;
      }else{
        this.type_f_t = true;
      }
      this.click_id = data.remark;
      this.click_level = data.level;
      this.search();
      this.echarts_fun();
    },
    handleNodeExpand(data) {
      if (data.level == 3 && data.remark == "新闻") {
        this.$set(data, "children", []);
        get("api/rest/sentiment/queryWebSite?country=" + data.name+"&account="+this.userInfo.account).then(
          (res) => {
            res.forEach((item) => {
              let obj = {};
              obj.description = item.name;
              obj.id = item.id;
              obj.label = item.name;
              obj.level = 4;
              obj.name = item.name;
              obj.parentid = data.id;
              obj.remark = data.remark;
              obj.domain = item.domain;
              data.children.push(obj);
            });
          } 
        )
        .catch((err)=>{
          this.$message({
            type: "warning",
            message: err.message,
          });
        })
        ;
      }else if (data.level == 3 && data.remark == "推特") {
        this.$set(data, "children", []);
        post("api/rest/resource/queryTwitterUser", { sourceId: data.id }).then(
          (res) => {
            res.forEach((item) => {
              let obj = {};
              // obj.description = item.fullname;
              // obj.id = item.sourceId;
              obj.label = item.fullname;
              obj.level = 4;
              obj.name = item.screenName;
              obj.parentid = data.id;
              obj.remark = data.remark;
              // obj.domain = item.userUrl;
              obj.userUrl = item.userUrl;
              data.children.push(obj);
            });
          }
        )
        .catch((err)=>{
          this.$message({
            type: "warning",
            message: err.message,
          });
        });
      } else if (data.level == 3 && data.remark == "脸书") {
        this.$set(data, "children", []);
        post("api/rest/resource/queryFacebookUser", { sourceId: data.id }).then(
          (res) => {
            res.forEach((item) => {
              let obj = {};
              obj.description = item.description;
              obj.label = item.name;
              obj.level = 4;
              obj.name = item.name2;
              obj.parentid = data.id;
              obj.remark = data.remark;
              obj.pageId = item.pageId;
              obj.url = item.pageUrl;
              data.children.push(obj);
            });
          }
        )
        .catch((err)=>{
          this.$message({
            type: "warning",
            message: err.message,
          });
        });
      } else if (data.level == 3 && data.remark == "智库") {
        this.$set(data, "children", []);
        get("api/rest/sentiment/queryThinkTankWebsite?sourceId="+ data.id ).then(
          (res) => {
            res.forEach((item) => {
              let obj = {};
              obj.description = item.description;
              obj.label = item.chineseName==null?item.foreignName:item.chineseName;
              obj.level = 4;
              obj.name = item.foreignName;
              obj.parentid = data.id;
              obj.remark = data.remark;
              obj.url = item.officalAddress;
              data.children.push(obj);
            });
          }
        )
        .catch((err)=>{
          this.$message({
            type: "warning",
            message: err.message,
          });
        });
      }
    },
    show_info(item, index) {
      if (this.click_id == "新闻") {
        this.$router.push({ name: "新闻详情" + this.$route.meta.type_name, params: { key: item.id } });
      } else if (this.click_id == "推特") {
        this.$router.push({ name: "Twitter详情" + this.$route.meta.type_name, params: this.getNews[index] });
      } else if (this.click_id == "智库") {
        this.$router.push({ name: "智库详情" + this.$route.meta.type_name, params: { key: item.id } });
      } else if (this.click_id == "脸书") {
        this.$router.push({ name: "Facebook详情" + this.$route.meta.type_name, params: this.getNews[index] });
      }
    },
    filterNode(value, data) {
      if (!value) return true;
      return data.label.indexOf(value) !== -1;
    },
    queryNews(pageNum, pageSize, condition, url) {
      this.currentPage = pageNum;
      if (url == "") {
        return;
      }
      //加载动画
      this.getNews = [];
      startLoading();
      // condition.author = this.click_id == "推特" ? condition.author = null:condition.author;
      // condition.authorURL =
      //   this.click_id == "推特" ? this.condition.userUrl : null;
      post(
        url + "?pageNum=" + pageNum + "&pageSize=" + pageSize + "",
        condition
      )
        .then((data) => {
          //pageNum：第几页  pageSize:每页条数
          
          if (this.click_id == "新闻") {
            data.list.forEach(item => {
              item.snatch_time = (item.snatch_time!=''&&item.snatch_time!=null)?parseInt(item.snatch_time*1000).timestampToStr():'';
            });
            this.getNews = data.list;
            endLoading();
          } else if (this.click_id == "推特") {
            let arr_news_twitter = [];
            data.list.forEach((item) => {
              arr_news_twitter.push({
                title: "", //标题
                txt: item.tweets_content, //内容
                site_name: item.fullname, //来自
                pubdate: item.timestr, //发布时间
                snatch_time: item.input_time, //抓取时间
                highLight: item.highLight, //高亮
                cmtcnt: item.cmtcnt, //评论数
                rpscnt: item.rpscnt, //转发数
                atdcnt: item.atdcnt, //点赞数
                isori: item.isori, //是否原创
                tweets_id: item.tweets_id, //是twitter_id
                blogger_id: item.blogger_id,//用户查询用户信息
                tweets_url: item.tweets_url,//原文链接
                txt_zh: item.txt_zh,
                title_zh: "", //标题
                emotion1:item.emotion1,
              });
            });
            this.getNews = arr_news_twitter;
            endLoading();
          } else if (this.click_id == "智库") {
            let arr = [];
            data.list.forEach((item) => {
              arr.push({
                title: item.title,
                txt: item.text, //内容
                txt_zh: item.txt_zh,
                highLight: item.highLight,
                site_name: item.siteNames? item.siteNames.length > 0 ? item.siteNames[0] : "" :"",
                // pubdate: parseInt(item.pubTime).timestampToStr(),
                pubdate: item.pubTime,
                snatch_time: item.input_time,
                id: item.id,
                author:item.author,
                title_zh: item.title_zh, //标题
                emotion1:item.emotion1,
              });
            });
            this.getNews = arr;
            endLoading();
          }else if(this.click_id=="脸书"){
            let arr_news_facebook = [];
            data.list.forEach((item) => {
              arr_news_facebook.push({
                title: "", //标题
                txt: item.postText, //内容
                site_name: item.userName, //来自
                pubdate: item.postTime, //发布时间
                snatch_time: item.input_time, //抓取时间
                highLight: item.highLight, //高亮
                cmtcnt: item.commentNumber, //评论数
                rpscnt: item.shareNumber, //转发数
                atdcnt: item.likeNumber, //点赞数
                isori: item.postType, //是否原创
                tweets_id: item.postId, //是twitter_id
                blogger_id: item.userId,
                postUrl: item.postUrl,//原文链接
                txt_zh: item.txt_zh,
                title_zh: "", //标题
                emotion1:item.emotion1,
              });
            });
            this.getNews = arr_news_facebook;
            endLoading();
          }
          this.total = data.totals;

          endLoading();
        })
        .catch((err) => {
          endLoading();
          this.$message({
            type: "warning",
            message: err.message,
          });
        });
    },
    url_click() {
      let url = "";
      if (this.click_id == "新闻") {
        url = "api/rest/fulltext/queryNews";
      } else if (this.click_id == "推特") {
        url = "api/rest/fulltext/queryTwitter";
      } else if (this.click_id == "智库") {
        url = "api/rest/fulltext/queryThinkTank";
      } else if(this.click_id == "脸书") {
        url = "api/rest/fulltext/queryFacebook";
      }
      return url;
    },
    search_ss() {
      this.show = !this.show;
      this.search();
    },
    search() {
      if (this.value1!='' && this.value1!=null) {
        this.condition.stTime = this.value1[0];
        this.condition.edTime = this.value1[1];
      } else {
        this.condition.stTime = null;
        this.condition.edTime = null;
      }
      Object.keys(this.condition).forEach((key) => {
        this.condition[key] =
          this.condition[key] == "" ? null : this.condition[key];
      });
      let url = this.url_click();

      if (url != "") {
        let tmpObj = JSON.parse(JSON.stringify(this.condition));
        this.queryNews(1, this.everySize, tmpObj, url);
      } else {
        this.$message.warning("暂无数据！");
      }
    },
    handleCurrentChange(pageNum) {
      let url = this.url_click();
      if (url != "") {
        this.queryNews(pageNum, this.everySize, this.condition, url);
      }
    },
    handleSizeChange(val) {
      this.everySize = val;
      this.currentPage = 1;
      this.search();
    },
    getSentimentType(){
      let sentimentType = "";
      if (this.click_id == "新闻") {
        sentimentType = "NEWS";
      } else if (this.click_id == "推特") {
        sentimentType = "TWITTER";
      } else if (this.click_id == "智库") {
        sentimentType = "THINK_TANK";
      } else if(this.click_id == "脸书") {
        sentimentType = "FACEBOOK";
      }
      return sentimentType;
    },
    query_tree(){
     //查询源资源--树结构
      this.arr_show_key = [];
      post("api/rest/sentiment/querySource").then((data) => {
        this.search();
        data.forEach((item) => {
          if (item.level == 1) this.arr_show_key.push(item.id);
        });
        this.data = getTreeData(data, "id", "parentid", "children", -1);
        this.data.forEach((item) => {
          item.children.forEach((item1) => {
            item1.children &&
              item1.children.forEach((item2) => {
                this.$set(item2, "children", [
                  { id: "111111111111111", label: "" },
                ]);
              });
          });
        });
      })
      .catch((err)=>{
        this.$message({
          type: "warning",
          message: err.message,
        });
      });
    }
  },
  mounted() {
    this.query_tree();
  },
  activated(){
   
  }
};
</script>