<template>
    <div id="yqjcgl">
        <el-tabs type="border-card">
            <el-tab-pane>
                <span slot="label"><i class="el-icon-reading"></i> 新闻模块</span>
                <div class="search">
                    <el-select v-model="valueSelect" placeholder="请选择" clearable>
                        <el-option-group v-for="group in options" :key="group.label" :label="group.label">
                            <el-option v-for="item in group.options" :key="item.value" :label="item.label"
                                :value="item.value">
                            </el-option>
                        </el-option-group>
                    </el-select>
                    <el-input v-model="input" placeholder="请输入新闻标题"></el-input>
                    <div class="button-import" @click="transferModel()" v-show="multipleSelection.length > 0">转移模块</div>
                    <div class="button-import" @click="deleteAll()" v-show="multipleSelection.length > 0">批量删除</div>
                    <div class="button-import" @click="addHome()" v-show="multipleSelection.length > 0">加入首页</div>
                    <div class="button-import" @click="upLoadOther()">第三方数据导入</div>
                    <!-- <div class="button-upload" @click="uploadData()">我方数据导入</div> -->
                    <div class="button-import" @click="addSingleNews()">单条新闻新增</div>
                    <div class="button-search" @click="search(1)">站内搜索</div>
                </div>
                <div class="searchResult">
                    <el-table ref="multipleTables" :data="newsData" tooltip-effect="dark" style="width: 100%;"
                        height="calc(100% - 60px)" @selection-change="handleSelectionChange">
                        <el-table-column type="selection" width="55"></el-table-column>
                        <el-table-column prop="tag" label="新闻分类" align="center">
                            <template slot-scope="scope"
                                v-if="scope.row.tag && scope.row.tag != '' && scope.row.tag.length > 0">
                                <el-tag :style="{ backgroundColor: returnColor(item), borderColor: returnColor(item) }"
                                    effect="dark" v-for="(item, index) in scope.row.tag" v-text="item" :key="index"
                                    v-if="item"></el-tag>
                            </template>
                        </el-table-column>
                        <el-table-column prop="website_name" label="新闻来源" align="center"
                            show-overflow-tooltip></el-table-column>
                        <el-table-column prop="title_zh" label="新闻标题" align="center"
                            show-overflow-tooltip></el-table-column>
                        <el-table-column prop="pubdate" label="发布时间" align="center"></el-table-column>
                        <el-table-column width="140" prop="website_img" label="包含图片" align="center"
                            :formatter="fileData"></el-table-column>
                        <el-table-column width="140" label="首页显示" align="center">
                            <template slot-scope="scope">
                                <span>{{ scope.row.original ? '是' : '否' }}</span>
                            </template>
                        </el-table-column>
                        <el-table-column label="操作" width="400" align="center">
                            <template slot-scope="scope">
                                <el-button size="mini"
                                    @click.native.stop="showInfo(scope.$index, scope.row)">查看新闻详情</el-button>
                                <el-button size="mini" type="success"
                                    @click.native.stop="handleEdit(scope.$index, scope.row)">新增图片</el-button>
                                <el-button size="mini" type="danger"
                                    @click.native.stop="deleteNews(scope.row)">删除</el-button>
                                <el-button size="mini" type="danger" @click.native.stop="deleteNewsImg(scope.row)"
                                    :disabled="scope.row.website_img == null || scope.row.website_img.length == 0 ? true : false">删除图片</el-button>
                            </template>
                        </el-table-column>
                    </el-table>
                    <div class="pagination-div">
                        <el-pagination class="myPagination" background layout="total, sizes, prev, pager, next, jumper"
                            :current-page="currentPage" @size-change="handleSizeChange" :page-size="everySize"
                            :total="total" :page-sizes="[10, 20, 50, 100]" @current-change="handleCurrentChange">
                        </el-pagination>
                    </div>
                </div>
            </el-tab-pane>
            <el-tab-pane>
                <span slot="label"><i class="el-icon-files"></i> 文件资料模块</span>
                <div class="search">
                    <el-select v-model="valueSelectFile_type">
                        <el-option label="置顶" value="1"></el-option>
                        <el-option label="上传时间" value="2"></el-option>
                    </el-select>
                    <el-select v-model="valueSelectFile" placeholder="请选择" clearable>
                        <el-option-group v-for="group in optionsFile" :key="group.label" :label="group.label">
                            <el-option v-for="item in group.options" :key="item.id" :label="item.name" :value="item.id">
                            </el-option>
                        </el-option-group>
                    </el-select>
                    <el-input v-model="inputFile" placeholder="请输入文件名"></el-input>
                    <div class="button-transform" @click="transferModelFile()" v-show="multipleSelectionFile.length > 0">
                        转移模块
                    </div>
                    <div class="button-delete" @click="deleteAllFile()" v-show="multipleSelectionFile.length > 0">批量删除</div>
                    <div class="button-upload" @click="uploadFile()">批量上传</div>
                    <div class="button-search" @click="searchFile()">站内搜索</div>
                </div>
                <div class="searchResult">
                    <el-table ref="multipleTable" :data="literatureList" tooltip-effect="dark" style="width: 100%;"
                        height="calc(100% - 60px)" @selection-change="handleSelectionChangeFile">
                        <el-table-column type="selection" width="55">
                        </el-table-column>
                        <el-table-column label="类别" align="center">
                            <template slot-scope="scope" v-if="scope.row.folder">
                                <el-tag
                                    :style="{ backgroundColor: returnColor(scope.row.folder), borderColor: returnColor(scope.row.folder) }"
                                    effect="dark">{{ returnNameFile(scope.row.folder) }}</el-tag>
                            </template>
                        </el-table-column>
                        <el-table-column label="文件名" align="center" show-overflow-tooltip>
                            <template slot-scope="scope">
                                <span><span style="font-size:12px;color:red;">{{ scope.row.stick != null ? '[置顶]' : ''
                                }}</span>{{ scope.row.originName }}</span>
                            </template>
                        </el-table-column>
                        <el-table-column prop="createTime" label="日期" align="center"></el-table-column>
                        <el-table-column prop="image" label="是否有图片" align="center" :formatter="fileDataFile">
                        </el-table-column>
                        <el-table-column label="操作" align="center" width="500">
                            <template slot-scope="scope">
                                <el-button size="mini" @click="viewLiterature(scope.row)">预览</el-button>
                                <!-- <el-button size="mini" type="success" @click="downFile(scope.row)">下载</el-button> -->
                                <el-button size="mini" type="success" @click="upLoadImg(scope.row)">上传图片</el-button>
                                <el-button size="mini" type="danger" @click="deleteLiterature(scope.row)">删除</el-button>
                                <el-button size="mini" type="danger" @click="deleteLiteratureImg(scope.row)"
                                    :disabled="scope.row.image == null || scope.row.image == '' ? true : false">删除图片</el-button>
                                <el-button size="mini" type="success" @click="top(scope.row)">{{ scope.row.stick == null ?
                                    '置顶' : '取消置顶' }}</el-button>
                            </template>
                        </el-table-column>
                    </el-table>
                    <div class="pagination-div">
                        <el-pagination class="myPagination" background layout="total, sizes, prev, pager, next, jumper"
                            :current-page="currentPageFile" @current-change="handleCurrentChangeFile"
                            @size-change="handleSizeChangeFile" :page-size="everySizeFile" :total="totalFile"
                            :page-sizes="[10, 20, 50, 100]">
                        </el-pagination>
                    </div>
                </div>
            </el-tab-pane>
            <el-tab-pane>
                <span slot="label"><i class="el-icon-s-platform"></i> 信源列表</span>
                <div class="yqzxkgl">
                    <div class="left-yqzxkgl">
                        <el-input class="public-input" placeholder="输入关键字进行过滤" v-model="filterText"></el-input>
                        <el-tree :data="yqzxkData" :props="defaultProps" class="filter-tree"
                            :filter-node-method="filterNode" @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 class="addOrMove">
                                    <el-button class="add" type="text" size="mini" @click="addCountry(data)">
                                        <i class="el-icon-circle-plus"></i>
                                    </el-button>
                                    <el-button class="edit" type="text" size="mini" @click="editCountry(data)">
                                        <i class="el-icon-edit"></i>
                                    </el-button>
                                    <el-button class="delete" type="text" size="mini" @click="removeCountry(data)">
                                        <i class="el-icon-error"></i>
                                    </el-button>
                                </span>
                            </span>
                        </el-tree>
                    </div>
                    <div class="right-yqzxkgl">
                        <div class="search">
                            <div class="button-delete" @click="deleteWebsite()">删除</div>
                            <div class="button-add" @click="addWebsite"
                                v-show="this.pickObj.level == 3 && this.pickObj.remark == '新闻'">新增站点</div>
                            <el-input v-model="inputYqzxk" placeholder="请输入站点名称筛选"></el-input>
                            <!-- <div class="button-search" @click="searchYqzxk()">搜索</div> -->

                        </div>
                        <el-table ref="multipleTable" :data="treeData" tooltip-effect="dark" style="width: 100%;"
                            height="calc(100% - 60px)" @selection-change="handleSelectionChangeYqzxk">
                            <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-column label="操作" align="center" width="100">
                                <template slot-scope="scope">
                                    <el-button size="mini" type="success" @click="editWebsite(scope.row)">编辑</el-button>
                                </template>
                            </el-table-column>
                        </el-table>
                    </div>
                </div>

            </el-tab-pane>
        </el-tabs>
        <!-- 我方数据导入 -->
        <!-- <el-dialog title="我方数据导入" :visible.sync="dialogVisible" width="25%" :before-close="handleClose" center>
            <el-form ref="form" label-width="120px">
                <el-form-item label="新闻板块">
                    <el-select v-model="value" placeholder="请选择" clearable>
                        <el-option-group v-for="group in options" :key="group.label" :label="group.label">
                            <el-option v-for="item in group.options" :key="item.value" :label="item.label" :value="item.label">
                            </el-option>
                        </el-option-group>
                    </el-select>
                </el-form-item>
                <el-form-item label="选取文件">
                    <el-upload class="upload-demo" action="" :on-change="handleChange" :file-list="fileList" :auto-upload="false" multiple accept=".xlsx, .xls,.json,.JSON,.XLSX,.XLS">
                        <el-button size="small" type="primary">点击上传</el-button>
                        <div slot="tip" class="el-upload__tip">上传文件总大小不能超过500M</div>
                    </el-upload>
                </el-form-item>
                <el-form-item>
                    <el-button size="mini" @click="dialogVisible = false">取 消</el-button>
                    <el-button size="mini" type="primary" @click="defineUpload">确 定</el-button>
                </el-form-item>
            </el-form>
        </el-dialog> -->

        <!-- 第三方数据导入 -->
        <el-dialog title="第三方数据导入" :visible.sync="dialogVisibleOther" width="25%" :before-close="handleClose" center>
            <el-form ref="form" label-width="120px">
                <el-form-item size="small" label="模板下载">
                    <el-button type="success" @click="donwloadExel">下载模板</el-button>
                </el-form-item>
                <el-form-item label="新闻板块">
                    <el-select v-model="valueOther" placeholder="请选择" clearable>
                        <el-option-group v-for="group in options" :key="group.label" :label="group.label">
                            <el-option v-for="item in group.options" :key="item.value" :label="item.label"
                                :value="item.label">
                            </el-option>
                        </el-option-group>
                    </el-select>
                </el-form-item>
                <el-form-item label="选取文件">
                    <el-upload class="upload-demo" action="" :on-change="handleChangeOther" :file-list="fileListOther"
                        :auto-upload="false" multiple accept=".xlsx, .xls,.json,.JSON,.XLSX,.XLS">
                        <el-button size="small" type="primary">点击上传</el-button>
                        <div slot="tip" class="el-upload__tip">单个文件不超过500M，总文件不超过1G。</div>
                    </el-upload>
                </el-form-item>
                <el-form-item>
                    <el-button size="mini" @click="dialogVisibleOther = false">取 消</el-button>
                    <el-button size="mini" type="primary" @click="defineUploadOther">确 定</el-button>
                </el-form-item>
            </el-form>
        </el-dialog>

        <!-- 单条新闻新增 -->
        <el-dialog title="单条新闻新增" :visible.sync="dialogVisibleSingle" width="25%" :before-close="handleClose" center>
            <el-form ref="form" label-width="120px">
                <el-form-item label="新闻板块">
                    <el-select v-model="valueSingle" placeholder="请选择" clearable>
                        <el-option-group v-for="group in options" :key="group.label" :label="group.label">
                            <el-option v-for="item in group.options" :key="item.value" :label="item.label"
                                :value="item.label">
                            </el-option>
                        </el-option-group>
                    </el-select>
                </el-form-item>
                <el-form-item label="选取word文档">
                    <el-upload class="upload-demo" accept=".doc,.docx,.DOC,.DOCX" action="" :on-change="handleChangeSingle"
                        :file-list="fileListSingle" :auto-upload="false">
                        <el-button size="small" type="primary">点击上传</el-button>
                        <div slot="tip" class="el-upload__tip">只支持word上传！</div>
                    </el-upload>
                </el-form-item>
                <el-form-item label="选取图片">
                    <el-upload class="upload-demo" action="" :on-change="handleChangeSingleImg"
                        :file-list="fileListSingleImg" :auto-upload="false" multiple
                        accept=".jpg,.jpeg,.png,.JPG,.JPEG,.PNG">
                        <el-button size="small" type="primary">点击上传</el-button>
                    </el-upload>
                </el-form-item>
                <el-form-item>
                    <el-button size="mini" @click="dialogVisibleSingle = false">取 消</el-button>
                    <el-button size="mini" type="primary" @click="defineUploadSingle">确 定</el-button>
                </el-form-item>
            </el-form>
        </el-dialog>

        <!-- 给新闻增加图片 -->
        <el-dialog title="新闻增加图片" :visible.sync="dialogVisibleImg" width="25%" :before-close="handleClose" center>
            <el-form ref="form" label-width="120px">
                <el-form-item label="上传图片">
                    <el-upload class="upload-demo" action="" :on-change="handleChangeImg" :file-list="fileListImg"
                        :auto-upload="false" multiple :limit="5" accept=".jpg,.jpeg,.png,.JPG,.JPEG,.PNG">
                        <el-button size="small" type="primary">点击上传</el-button>
                        <div slot="tip" class="el-upload__tip">最多选择五张图片</div>
                    </el-upload>
                </el-form-item>
                <el-form-item>
                    <el-button size="mini" @click="dialogVisibleImg = false">取 消</el-button>
                    <el-button size="mini" type="primary" @click="defineUploadImg">确 定</el-button>
                </el-form-item>
            </el-form>
        </el-dialog>

        <!-- 修改新闻所在板块 -->
        <el-dialog title="修改新闻所在板块" :visible.sync="dialogVisibleFolder" width="35%" :before-close="handleClose" center>
            <el-form ref="form" label-width="120px">
                <el-form-item label="转移到:">
                    <el-radio-group v-model="radio">
                        <el-radio v-for="(item, index) in transferRadios" :label="item.value" border :key="index">{{
                            item.label }}</el-radio>
                    </el-radio-group>
                </el-form-item>
                <el-form-item align="center">
                    <el-button size="mini" @click="dialogVisibleFolder = false">取 消</el-button>
                    <el-button size="mini" type="primary" @click="defineUploadFolder">确 定</el-button>
                </el-form-item>
            </el-form>
        </el-dialog>

        <!--========================================================文件模块========================================================-->
        <!-- 批量上传文件 -->
        <el-dialog title="批量上传文件" :visible.sync="dialogVisibleFile" width="25%" :before-close="handleClose" center>
            <el-form ref="form" label-width="120px">
                <el-form-item label="文件板块">
                    <el-select v-model="valueFile" placeholder="请选择" clearable>
                        <el-option-group v-for="group in optionsFile" :key="group.label" :label="group.label">
                            <el-option v-for="item in group.options" :key="item.id" :label="item.name" :value="item.id">
                            </el-option>
                        </el-option-group>
                    </el-select>
                </el-form-item>
                <el-form-item label="选取文件">
                    <el-upload class="upload-demo" action="" :on-change="handleChangeFile" :on-remove="handleRemoveFile"
                        :file-list="fileListFile" :auto-upload="false" multiple
                        accept=".docx,.doc,.pdf,.DOCX,.DOC,.PDF,.PPT,.ppt,.pptx,.PPTX,.mlf,.MLF,.xls,.xlsx,.XLS,.XLSX">
                        <el-button size="small" type="primary">点击上传</el-button>
                        <div slot="tip" class="el-upload__tip">支持导入word,pdf,ppt,mlf,xls!!!</div>
                    </el-upload>
                </el-form-item>
                <el-form-item label="上传图片" v-if="fileListFile.length == 1">
                    <el-upload class="upload-demo" accept=".jpg,.jpeg,.png,.JPG,.JPEG,PNG" action=""
                        :on-change="handleChangeImgSingle" :file-list="imgListFile" :auto-upload="false" :limit="1"
                        :on-exceed="handleExceed">
                        <el-button size="small" type="primary">点击上传</el-button>
                        <div slot="tip" class="el-upload__tip">只能选择一张图片！</div>
                    </el-upload>
                </el-form-item>
            </el-form>
            <span slot="footer" class="dialog-footer">
                <el-button size="mini" @click="dialogVisibleFile = false">取 消</el-button>
                <el-button size="mini" type="primary" @click="defineUploadFile">确 定</el-button>
            </span>
        </el-dialog>

        <!-- 修改文献所在板块 -->
        <el-dialog title="修改文献所在板块" :visible.sync="dialogVisibleFolderFile" width="35%" :before-close="handleClose" center>
            <el-form ref="form" label-width="120px">
                <el-form-item label="转移到:">
                    <el-radio-group v-model="radioFile">
                        <el-radio v-for="(item, index) in transferRadiosFile" :label="item.id" border :key="index">{{
                            item.name }}</el-radio>
                    </el-radio-group>
                </el-form-item>
                <el-form-item align="center">
                    <el-button size="mini" @click="dialogVisibleFolderFile = false">取 消</el-button>
                    <el-button size="mini" type="primary" @click="defineUploadFolderFile">确 定</el-button>
                </el-form-item>
            </el-form>
        </el-dialog>

        <!-- 给新闻文献部分增加图片 -->
        <el-dialog title="新闻文献部分增加图片" :visible.sync="dialogVisibleImgFile" width="25%" :before-close="handleClose" center>
            <el-form ref="form" label-width="120px">
                <el-form-item label="上传图片">
                    <el-upload class="upload-demo" accept=".jpg,.jpeg,.png,.JPG,.JPEG,.PNG" action=""
                        :on-change="handleChangeImgFile" :file-list="fileListImgFile" :auto-upload="false" :limit="1"
                        :on-exceed="handleExceed">
                        <el-button size="small" type="primary">点击上传</el-button>
                        <div slot="tip" class="el-upload__tip">只能选择一张图片</div>
                    </el-upload>
                </el-form-item>
                <el-form-item>
                    <el-button size="mini" @click="dialogVisibleImgFile = false">取 消</el-button>
                    <el-button size="mini" type="primary" @click="defineUploadImgFile">确 定</el-button>
                </el-form-item>
            </el-form>
        </el-dialog>

        <!--========================================================舆情资讯库模块========================================================-->
        <!-- 新增站点 -->
        <el-dialog title="新增站点" :visible.sync="dialogVisibleYqzxk" width="25%" :before-close="handleClose" center>
            <el-form ref="form" label-width="120px">
                <!-- <el-form-item label="所属国家（En）">
                    <el-input v-model="newWebsite.countryEn"></el-input>
                </el-form-item>
                <el-form-item label="所属国家（Zn）">
                    <el-input v-model="newWebsite.countryZh"></el-input>
                </el-form-item> -->
                <el-form-item label="站点名称">
                    <el-input v-model="newWebsite.name"></el-input>
                </el-form-item>
                <el-form-item label="站点地址">
                    <el-input v-model="newWebsite.domain"></el-input>
                </el-form-item>
                <el-form-item>
                    <el-button size="mini" @click="dialogVisibleYqzxk = false">取 消</el-button>
                    <el-button size="mini" type="primary" @click="defineAddWebsite">确 定</el-button>
                </el-form-item>
            </el-form>
        </el-dialog>

        <!-- 编辑站点 -->
        <el-dialog title="编辑站点" :visible.sync="dialogVisibleYqzxkEdit" width="25%" :before-close="handleClose" center>
            <el-form ref="form" label-width="120px">
                <!-- <el-form-item label="所属国家（En）">
                    <el-input v-model="editWebsiteData.countryEn"></el-input>
                </el-form-item>
                <el-form-item label="所属国家（Zn）">
                    <el-input v-model="editWebsiteData.countryZh"></el-input>
                </el-form-item> -->
                <el-form-item label="站点名称">
                    <el-input v-model="editWebsiteData.name"></el-input>
                </el-form-item>
                <el-form-item label="站点地址">
                    <el-input v-model="editWebsiteData.domain"></el-input>
                </el-form-item>
                <el-form-item>
                    <el-button size="mini" @click="dialogVisibleYqzxkEdit = false">取 消</el-button>
                    <el-button size="mini" type="primary" @click="defineEditWebsite">确 定</el-button>
                </el-form-item>
            </el-form>
        </el-dialog>

        <!-- 新增国家 -->
        <el-dialog title="新增国家" :visible.sync="dialogVisibleCountry" :before-close="handleClose">
            <el-form ref="form" label-width="80px">
                <el-form-item label="名称：">
                    <el-input v-model="newCountryData.name" placeholder="请输入新增的国家名称"></el-input>
                </el-form-item>
            </el-form>
            <span slot="footer" class="dialog-footer">
                <el-button size="mini" @click="dialogVisibleCountry = false">取 消</el-button>
                <el-button size="mini" type="primary" @click="defineAddCountry">确 定</el-button>
            </span>
        </el-dialog>

        <!-- 编辑国家 -->
        <el-dialog title="编辑国家" :visible.sync="dialogVisibleCountryEdit" :before-close="handleClose">
            <el-form ref="form" label-width="80px">
                <el-form-item label="名称：">
                    <el-input v-model="editCountryData.name" placeholder="请编辑模块名称"></el-input>
                </el-form-item>
            </el-form>
            <span slot="footer" class="dialog-footer">
                <el-button size="mini" @click="dialogVisibleCountryEdit = false">取 消</el-button>
                <el-button size="mini" type="primary" @click="defineEditCountry">确 定</el-button>
            </span>
        </el-dialog>


    </div>
</template>

<script>
import { get, post, fileUpload, startLoading, endLoading, download, delete_util, getTreeData } from '../../util/http_util';
import { addCountry, editCountry, removeCountry, addWebsite, removeWebsite, editWebsite } from "../../api/resource"
export default {
    name: 'yqjcgl',
    inject: ['reload'],
    data() {
        return {
            input: '',
            inputFile: '',
            options: [{
                options: [{
                    value: 'gjgnrd',
                    label: '国际国内热点'
                }, {
                    value: 'mmshyq',
                    label: '美盟涉华舆情'
                }, {
                    value: 'thcs',
                    label: '台海潮声'
                },
                {
                    value: 'zrjf',
                    label: '中日交锋'
                }, {
                    value: 'bdfy',
                    label: '半岛风云'
                }, {
                    value: 'nhgl',
                    label: '南海观澜'
                },
                {
                    value: 'gjds',
                    label: '国际大势'
                }]
            }],
            optionsFile: [],
            // value: '',
            valueOther: '',
            valueSelect: '',
            valueSelectFile: '',
            valueSingle: '',
            // fileList: [],
            fileListImg: [],
            fileListOther: [],

            fileListSingle: [],
            fileListSingleImg: [],
            currentPage: 1,
            total: 0,
            // dialogVisible: false,
            dialogVisibleImg: false,
            dialogVisibleOther: false,

            dialogVisibleSingle: false,
            dialogVisibleFolder: false,
            newsData: [],
            checkedList: [],
            activeName: '',
            multipleSelection: [],
            selectNews: {},
            transferRadios: [{
                value: 'gjgnrd',
                label: '国际国内热点'
            }, {
                value: 'mmshyq',
                label: '美盟涉华舆情'
            }, {
                value: 'thcs',
                label: '台海潮声'
            },
            {
                value: 'zrjf',
                label: '中日交锋'
            }, {
                value: 'bdfy',
                label: '半岛风云'
            }, {
                value: 'nhgl',
                label: ' 南海观澜'
            },
            {
                value: 'gjds',
                label: '国际大势'
            }],
            radio: '',
            multipleSelectionImg: [],
            colorList: ['#409eff', '#F56C6C', '#67C23A', '#E6A23C', '#909399', '#303133'],
            everySize: 10,
            moduleList: [],
            //文件模块
            totalFile: 0,
            radioFile: '',
            valueFile: '',
            imgListFile: {},
            selectFile: {},
            fileListFile: [],
            fileListImgFile: [],
            literatureList: [],
            currentPageFile: 1,
            everySizeFile: 10,
            multipleSelectionFile: [],
            dialogVisibleFile: false,
            dialogVisibleImgFile: false,
            dialogVisibleFolderFile: false,
            transferRadiosFile: [],
            //舆情资讯库
            yqzxkData: [],
            defaultProps: {
                children: "children",
                label: "label",
            },
            filterText: "",
            arr_show_key: [],
            treeData: [],
            tmpWebsite: [],
            inputYqzxk: '',
            newWebsite: {
                countryEn: '',
                countryZh: '',
                domain: '',
                name: '',
                remark: '',
                sourceId: ''
            },
            dialogVisibleYqzxk: false,
            pickObj: {},
            websiteIds: [],
            dialogVisibleYqzxkEdit: false,
            editWebsiteData: {},
            dialogVisibleCountry: false,
            newCountryData: {
                name: ''
            },
            dialogVisibleCountryEdit: false,
            editCountryData: {
                name: ''
            },
            websiteId_add: '',
            countryZh_add: '',
            valueSelectFile_type: '1',
        }
    },
    methods: {
        //#region ===========================================新闻模块===========================================
        search(pageNum) {
            startLoading();
            this.currentPage = pageNum;
            let obj = {};
            let chinese = this.returnName(this.valueSelect);
            obj.topic = this.valueSelect != '' ? chinese : null;
            obj.title = this.input != '' ? this.input : null;
            post('api/rest/fulltext/queryNews?pageNum=' + pageNum + '&pageSize=' + this.everySize, obj).then(res => {
                this.newsData = res.list;
                this.total = res.totals;
                endLoading()
            }).catch(err => {
                endLoading()
                this.$message.warning(err.message);
                // this.$message.error(err.message);
            })
        },
        // uploadData() {
        //     this.dialogVisible = true;
        //     this.fileList = [];
        // },
        //查询新闻
        queryNews(pageNum, pageSize) {
            post('api/rest/fulltext/queryNews?pageNum=' + pageNum + '&pageSize=' + pageSize, {}).then(res => {
                this.newsData = res.list;
                this.total = res.totals;
                this.currentPage = pageNum;
            }).catch(err => {
                this.$message.warning(err.message);
                // this.$message.error(err.message);
            })
        },
        //单条新闻新增
        addSingleNews() {
            this.dialogVisibleSingle = true;
            this.fileListSingleImg = [];
            this.fileListSingle = [];
            this.valueSingle = '';
        },
        //单个新闻录入
        defineUploadSingle() {
            if (this.fileListSingle.length > 0) {
                startLoading();
                let fd = new FormData();
                this.fileListSingleImg.forEach(res => {
                    fd.append("file", res.raw);
                });
                fd.append("doc", this.fileListSingle[0].raw);
                this.valueSingle && fd.append("folder", this.valueSingle);
                fileUpload('api/rest/fulltext/addSingleNews', fd).then(res => {
                    if (res[0] != 0) {
                        this.$message.success('上传成功！');
                        this.search(this.currentPage);
                        endLoading();
                    }
                }).catch(err => {
                    this.$message.warning(err.message);
                    endLoading();
                });
                this.dialogVisibleSingle = false;
            } else {
                this.$message.warning('未选中文档！');
            }
        },
        //我方新闻数据导入
        // defineUpload() {
        //     if (this.fileList.length > 0) {
        //         startLoading();
        //         let fd = new FormData();
        //         for (let i = 0; i < this.fileList.length; i++) {
        //             fd.append("file", this.fileList[i].raw);
        //         }
        //         fd.append("folder", this.value);
        //         fileUpload('api/rest/fulltext/bulkAddNews', fd).then(res => {
        //             if (res[0] != 0) {
        //                 let num = 0;
        //                 res.forEach(item => {
        //                     num = num + item;
        //                 })
        //                 this.$message.success('上传成功' + num + '条新闻！');
        //                 this.search(this.currentPage);
        //                 // this.queryNews(this.currentPage, this.everySize);
        //             } else {
        //                 this.$message.error('上传失败！');
        //             }
        //             endLoading();
        //         }).catch(err => {
        //             this.$message.warning(err.message);
        //             // this.$message.warning(err.message);
        //             endLoading();
        //         });
        //         this.dialogVisible = false;
        //     } else {
        //         this.$message.warning('未选择上传文件！');
        //     }

        // },
        //第三方新闻数据导入
        defineUploadOther() {
            startLoading();
            let fd = new FormData();
            for (let i = 0; i < this.fileListOther.length; i++) {
                fd.append("file", this.fileListOther[i].raw);
            }
            fd.append("folder", this.valueOther);
            fileUpload('api/rest/fulltext/bulkAddOtherNews', fd).then(res => {
                if (res[0] != 0) {
                    let num = 0;
                    res.forEach(item => {
                        num = num + item;
                    })
                    this.$message.success('上传成功' + num + '条新闻！');
                    this.search(this.currentPage);
                    // this.queryNews(this.currentPage, this.everySize);
                } else {
                    this.$message.error('上传失败！');
                }
                endLoading();
            }).catch(err => {
                this.$message.warning(err.message);
                endLoading();
            });
            this.dialogVisibleOther = false;
        },

        //分页
        handleCurrentChange(pageNum) {
            this.currentPage = pageNum;
            this.search(pageNum);
        },
        handleSizeChange(val) {
            this.everySize = val;
            this.currentPage = 1;
            this.search(1);
        },
        handleClose(done) {
            done();
        },
        // handleChange(file, fileList) {
        //     this.fileList = fileList.slice(-20);
        // },
        //第三方资源上传
        handleChangeOther(file, fileListOther) {
            this.fileListOther = fileListOther.slice(-5);
        },
        //单条新增新闻新增的图片
        handleChangeSingleImg(file, fileListSingleImg) {
            this.fileListSingleImg = fileListSingleImg.slice(-5);
        },
        //给新闻增加图片
        handleChangeImg(file, fileListImg) {
            this.fileListImg = fileListImg.slice(-5);
        },
        //删除文件
        deleteNews(item) {
            this.$confirm('此操作将永久删除文件, 是否继续?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(() => {
                delete_util('api/rest/fulltext/bulkRemoveNews', [item.id]).then(res => {
                    if (res == 1) {
                        this.$message.success('删除成功！');
                        this.search(this.currentPage);
                    }
                }).catch((err) => {
                    this.$message.warning(err.message);
                })

                item.website_img && post('api/rest/fulltext/bulkRemoveNewsPic', item.website_img).then(res => {
                    if (res == item.website_img.length) { }
                });
            }).catch(() => {
                this.$message({
                    type: 'info',
                    message: '已取消删除'
                });
            });
        },
        deleteNewsImg(item) {
            this.$confirm('此操作将永久删除图片, 是否继续?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(() => {
                startLoading();
                let fd = new FormData();
                fd.append('Id', item.id);
                fileUpload('api/rest/fulltext/addPictureToNews', fd).then(res => {
                    if (res == 1) {
                        this.$message.success('删除成功！');
                        setTimeout(() => {
                            this.search(this.currentPage);
                            endLoading();
                        }, 500);
                    }
                }).catch(err => {
                    this.$message.warning(err.message);
                    endLoading();
                });
                this.dialogVisibleImg = false;
            }).catch(() => {
                this.$message({
                    type: 'info',
                    message: '已取消删除'
                });
            });

        },
        //返回中文名
        returnName(type) {
            switch (type) {
                case 'gjgnrd':
                    return '国际国内热点';
                    break;
                case 'mmshyq':
                    return '美盟涉华舆情';
                    break;
                case 'thcs':
                    return '台海潮声';
                    break;
                case 'zrjf':
                    return '中日交锋';
                    break;
                case 'bdfy':
                    return '半岛风云';
                    break;
                case 'nhgl':
                    return '南海观澜';
                    break;
                case 'gjds':
                    return '国际大势';
                    break;
            }
        },
        handleSelectionChange(val) {
            let list = [], listImg = [];
            for (let i = 0; i < val.length; i++) {
                list.push(val[i].id);
                val[i].website_img && val[i].website_img.length > 0 && (listImg = listImg.concat(val[i].website_img));
            }
            this.multipleSelection = list;
            this.multipleSelectionImg = listImg;
        },
        upLoadOther() {
            this.dialogVisibleOther = true;
            this.fileListOther = [];
        },
        //批量删除
        deleteAll() {
            this.$confirm('此操作将永久删除文件, 是否继续?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(() => {
                delete_util('api/rest/fulltext/bulkRemoveNews', this.multipleSelection).then(res => {
                    if (res == this.multipleSelection.length) {
                        this.$message.success('删除成功！');
                        this.search(this.currentPage);
                    }
                }).catch((err) => {
                    this.$message.warning(err.message);
                })

                //批量删除图片
                post('api/rest/fulltext/bulkRemoveNewsPic', this.multipleSelectionImg).then(res => {
                    if (res == this.multipleSelectionImg.length) { }
                })
            }).catch(() => {
                this.$message({
                    type: 'info',
                    message: '已取消删除'
                });
            });
        },//加入首页
        addHome() {
            let data = this.multipleSelection.map(e => {
                return {
                    id: e,
                    properties: {
                        original: "99"
                    }
                }
            });
            post(`api/rest/fulltext/bulkUpdateNewsInfo`,
                data
            )
                .then(res => {
                    this.$message.success("修改成功");
                }).catch((err) => {
                    this.$message.warning(err.message);
                })
        },
        handleChangeSingle(file, fileListSingle) {
            this.fileListSingle = fileListSingle.slice(-1);
        },
        handleEdit(index, row) {
            this.fileListImg = [];
            this.dialogVisibleImg = true;
            this.selectNews = row;
        },
        defineUploadImg() {
            if (this.fileListImg.length > 0) {
                startLoading();
                let fd = new FormData();
                this.fileListImg.forEach(res => {
                    fd.append("file", res.raw);
                })
                fd.append('Id', this.selectNews.id);
                fileUpload('api/rest/fulltext/addPictureToNews', fd).then(res => {
                    if (res == 1) {
                        this.$message.success('上传成功！');
                        setTimeout(() => {
                            this.search(this.currentPage);
                        }, 500);
                    } else {
                        this.$message.error('上传失败！');
                    }
                    endLoading();
                }).catch(err => {
                    this.$message.warning(err.message);
                    endLoading();
                });
                this.dialogVisibleImg = false;
            } else {
                this.$message.warning('未选择文件！');
            }
        },
        transferModel() {
            if (this.multipleSelection.length > 0) {
                this.dialogVisibleFolder = true;
            } else {
                this.$message.warning('未选中任何新闻！');
            }

        },
        //批量修改新闻的板块
        defineUploadFolder() {
            if (this.radio != '') {
                let blankName = this.returnName(this.radio);
                let list = [];
                for (let i = 0; i < this.multipleSelection.length; i++) {
                    //#region 保留不在板块内的标签
                    let tag_new = [];
                    let tags_old = this.newsData.filter(e => e.id == this.multipleSelection[i])[0].tag;
                    if (tags_old != null) {
                        tag_new = tags_old.reduce((p, e) => {
                            if (this.transferRadios.filter(x => x.label == e).length == 0) {
                                p.push(e);
                            }
                            return p;
                        }, []);
                    }
                    //#endregion
                    let obj = {
                        id: this.multipleSelection[i],
                        properties: { tag: [blankName].concat(tag_new) }
                    };
                    list.push(obj);
                }
                post('api/rest/fulltext/bulkUpdateNewsInfo', list).then(res => {
                    if (res != 0) {
                        this.$message.success('转移成功！');
                        this.dialogVisibleFolder = false;
                        this.search(this.currentPage);
                    }
                })
                    .catch((err) => {
                        this.$message.warning(err.message);
                    })
            } else {
                this.$message.warning('未选择要转移的板块！');
            }
        },
        fileData(row) {
            if (row.website_img != null && row.website_img.length > 0) {
                return '有';
            } else {
                return '无';
            }
        },
        //行点击事件
        showInfo(index, row) {
            startLoading();
            this.$router.push({ name: "数据管理新闻详情" + this.$route.meta.type_name, params: { key: row.id } });
            endLoading();
        },
        //返回颜色
        returnColor(val) {
            if (val == "国际国内热点" || val == "美盟涉华舆情" || val == "台海潮声" || val == "中日交锋" || val == "半岛风云" || val == "南海观澜" || val == "国际大势") {
                return this.colorList[0];
            } else if (val == "25" || val == "26" || val == "27") {
                return this.colorList[1];
            } else if (val == "28" || val == "29" || val == "30") {
                return this.colorList[2];
            } else {
                return this.colorList[3];
            }
        },
        donwloadExel() {
            window.open('api/excel/newsList.xlsx');
        },
        //#endregion
        //#region ===========================================文件模块===========================================
        searchFile() {
            this.queryLiterature(1, this.everySizeFile, this.inputFile, this.valueSelectFile);
        },
        //文件批量上传弹框
        uploadFile() {
            this.dialogVisibleFile = true;
            this.fileListFile = [];
            this.imgListFile = [];
        },
        fileDataFile(row) {
            if (row.image != null && row.image != '') {
                return '有';
            } else {
                return '无';
            }
        },
        handleRemoveFile(file, fileListFile) {
            this.fileListFile = fileListFile;
        },
        //确认文件批量上传
        defineUploadFile() {
            if (this.valueFile != "" && this.fileListFile.length > 0) {
                for (let i = 0; i < this.fileListFile.length; i++) {
                    let fd = new FormData();
                    fd.append("file", this.fileListFile[i].raw);
                    fd.append("folder", this.valueFile);
                    fd.append("module", '舆情报告');
                    this.imgListFile.length == 1 && fd.append('image', this.imgListFile[0].raw);
                    fileUpload('api/rest/document/uploadLiterature', fd).then(res => {
                        if (res == 1) {
                            this.$message.success('上传成功！');
                            this.valueSelectFile_type = '2';
                            this.queryLiterature(this.currentPageFile, this.everySizeFile, this.inputFile, this.valueSelectFile);
                        }
                    })
                        .catch((err) => {
                            this.$message.warning(err.message);
                        })
                }
                this.dialogVisibleFile = false;
            } else {
                this.$message.warning('未选择上传模块或未选择文件！');
            }
        },
        //查询上传的文件
        queryLiterature(pageNum, pageSize, title, type) {
            let titleUrl = (title != '' && title != null) ? ('&origin_name=' + title) : '';
            let typeUrl = (type != '' && type != null) ? ('&folder=' + type) : '';
            let type_stick = this.valueSelectFile_type == "1";
            get('api/rest/document/queryLiterature?module=舆情报告&stick=' + type_stick + '&pageNum=' + pageNum + '&pageSize=' + pageSize + titleUrl + typeUrl).then(res => {
                this.literatureList = res.list;
                this.totalFile = res.totals;
                this.currentPageFile = pageNum;
            }).catch((err) => {
                this.$message.warning(err.message);
            })
        },
        handleSelectionChangeFile(val) {
            let list = [];
            for (let i = 0; i < val.length; i++) {
                let obj = {};
                obj.bucket = val[i].folder;
                obj.name = val[i].name;
                list.push(obj);
            }
            this.multipleSelectionFile = list;
        },
        //批量删除
        deleteAllFile() {
            this.$confirm('此操作将永久删除文件, 是否继续?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(() => {
                delete_util('api/rest/document/removeLiteratureByBatch', this.multipleSelectionFile).then(res => {
                    if (res == this.multipleSelectionFile.length) {
                        this.$message.success('删除成功！');
                        this.queryLiterature(this.currentPageFile, this.everySizeFile, this.inputFile, this.valueSelectFile);
                    }
                }).catch(err => {
                    this.$message.warning(err.message);
                });
            }).catch(() => {
                this.$message({
                    type: 'info',
                    message: '已取消删除'
                });
            });
        },
        transferModelFile() {
            if (this.multipleSelectionFile.length > 0) {
                this.dialogVisibleFolderFile = true;
            } else {
                this.$message.warning('未选中任何新闻！');
            }
        },
        //以pdf形式预览
        viewLiterature(item) {
            window.open('api/rest/document/viewLiterature/' + item.folder + '/' + item.name);
        },
        //下载文件
        downFile(item) {
            download('api/rest/document/downloadLiterature/' + item.folder + '/' + item.name, item.originName);
        },
        //删除文件
        deleteLiterature(item) {
            this.$confirm('此操作将永久删除文件, 是否继续?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(() => {
                delete_util('api/rest/document/removeLiterature?folder=' + item.folder + '&name=' + item.name).then(res => {
                    if (res == 1) {
                        this.$message.success('删除成功！');
                        this.queryLiterature(this.currentPageFile, this.everySizeFile, this.inputFile, this.valueSelectFile);
                    } else {
                        this.$message.error('删除失败！');
                    }
                })
                    .catch((err) => {
                        this.$message.warning(err.message);
                    })
            }).catch(() => {
                this.$message({
                    type: 'info',
                    message: '已取消删除'
                });
            });
        },
        //删除文件图片
        deleteLiteratureImg(item) {
            this.$confirm('此操作将永久删除图片, 是否继续?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(() => {
                startLoading();
                let fd = new FormData();
                fd.append('name', item.name);
                fd.append('folder', item.folder);
                fileUpload('api/rest/document/addPictureToLiterature', fd).then(res => {
                    if (res == 1) {
                        this.$message.success('图片删除成功！');
                        this.dialogVisibleImg = false;
                        this.searchFile();
                    } else {
                        this.$message.error('图片删除失败！');
                    }
                    endLoading();
                }).catch(err => {
                    this.$message.warning(err.message);
                    endLoading();
                });
            }).catch(() => {
                this.$message({
                    type: 'info',
                    message: '已取消删除'
                });
            });
        },
        //上传图片
        upLoadImg(item) {
            this.fileListImgFile = [];
            this.dialogVisibleImgFile = true;
            this.selectFile = item;

        },
        handleClose(done) {
            done();
        },
        handleChangeFile(file, fileListFile) {
            this.fileListFile = fileListFile.slice(-20);
        },
        //批量上传文献时  只选择单个文件时 上传图片
        handleChangeImgSingle(file, imgListFile) {
            this.imgListFile = imgListFile.splice(-1);
        },
        handleExceed(files, fileListImg) {
            this.$message.warning(`当前限制选择 1 个文件，本次选择了 ${files.length} 个文件`);
        },
        //修改文献所在板块
        defineUploadFolderFile() {
            if (this.radioFile != '') {
                let list = [];
                this.multipleSelectionFile.forEach(res => {
                    let obj = {};
                    obj.name = res.name;
                    obj.newFolder = this.radioFile;
                    obj.oldFolder = res.bucket;
                    list.push(obj);
                })
                post('api/rest/document/bulkChangeLiteratureFolder', list).then(res => {
                    if (res == list.length) {
                        this.$message.success('转移成功！');
                        this.dialogVisibleFolderFile = false;
                        this.queryLiterature(this.currentPageFile, this.everySizeFile, this.inputFile, this.valueSelectFile);
                    }
                })
                    .catch((err) => {

                    })
            } else {
                this.$message.warning('未选择要转移的板块！');
            }
        },
        //给文献增加图片弹框
        handleChangeImgFile(file, fileListImgFile) {
            this.fileListImgFile = fileListImgFile.slice(-5);
        },
        //确定给文献增加图片
        defineUploadImgFile() {
            if (this.fileListImgFile.length > 0) {
                startLoading();
                let fd = new FormData();
                fd.append('name', this.selectFile.name);
                fd.append('folder', this.selectFile.folder);
                fd.append('file', this.fileListImgFile[0].raw);
                fileUpload('api/rest/document/addPictureToLiterature', fd).then(res => {
                    if (res == 1) {
                        this.$message.success('新增图片成功！');
                        this.dialogVisibleImgFile = false;
                        this.searchFile();
                    } else {
                        this.$message.error('图片新增失败！');
                    }
                    endLoading();
                }).catch(err => {
                    this.$message.warning(err.message);
                    endLoading();
                });
            } else {
                this.$message.warning('未选择图片！');
            }
        },
        handleCurrentChangeFile(pageNum) {
            this.currentPageFile = pageNum;
            this.queryLiterature(pageNum, this.everySizeFile, this.inputFile, this.valueSelectFile);
        },
        handleSizeChangeFile(val) {
            this.everySizeFile = val;
            this.currentPageFile = 1;
            this.queryLiterature(1, val, this.inputFile, this.valueSelectFile);
        },
        //返回中文名
        returnNameFile(type) {
            return this.moduleList.filter(item => item.id == type)[0] && this.moduleList.filter(item => item.id == type)[0].name;
        },
        //置顶
        top(row) {
            let obj = {};
            obj.id = row.id;
            obj.stick = row.stick == null ? 1 : 0;
            let message = obj.stick == 1 ? '置顶' : '取消置顶';
            post('api/rest/document/bulkStickLiterature', [obj]).then(res => {
                if (res == 1) {
                    this.searchFile();
                    this.$message.success(message + '成功！');
                } else {
                    this.$message.error(message + '失败！');
                }
            }).catch(err => {
                this.$message.warning(err.message);
            });
        },
        //#endregion
        //#region ========================================舆情资讯库模块=========================================
        filterNode(value, data) {
            if (!value) return true;
            return data.label.indexOf(value) !== -1;
        },
        //新增国家
        addCountry(data) {
            this.newCountryData['level'] = 3;
            this.newCountryData['parentid'] = data.id;
            this.newCountryData.name = '';
            this.dialogVisibleCountry = true;
        },
        defineAddCountry() {
            if (this.newCountryData.name != '') {
                addCountry(this.newCountryData).then(res => {
                    if (res == 1) {
                        this.$message.success('新增成功！');
                        this.dialogVisibleCountry = false;
                        this.reload();
                    } else {
                        this.$message.error('新增失败！');
                    }
                }).catch(err => {
                    this.$message.warning(err.message);
                });
            } else {
                this.$message.warning('未输入站点名称！');
            }
        },
        //编辑国家
        editCountry(data) {
            this.editCountryData.name = JSON.parse(JSON.stringify(data.name));
            this.editCountryData['id'] = JSON.parse(JSON.stringify(data.id));
            this.dialogVisibleCountryEdit = true;
        },
        defineEditCountry() {
            if (this.editCountryData.name != '') {
                editCountry(this.editCountryData).then(res => {
                    if (res == 1) {
                        this.$message.success('编辑成功！');
                        this.dialogVisibleCountryEdit = false;
                        this.reload();
                    } else {
                        this.$message.error('编辑失败！');
                    }
                }).catch(err => {
                    this.$message.warning(err.message);
                });
            } else {
                this.$message.warning('未输入站点名称！');
            }
        },
        //删除国家
        removeCountry(data) {
            this.$confirm('此操作将永久删除数据, 是否继续?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning',
            })
                .then(() => {
                    removeCountry(data.id).then(res => {
                        if (res == 1) {
                            this.$message.success('删除成功！');
                            this.reload();
                        }
                    }).catch(err => {
                        this.$message.warning(err.message);
                    });
                })
                .catch((err) => {
                    console.log(err);
                });
        },
        searchYqzxkWebsite(data) {
            get("api/rest/sentiment/queryWebSite?sourceId=" + data.id).then(
                (res) => {
                    this.treeData = res;
                    this.tmpWebsite = res;
                }
            );
        },
        handleNodeClick(data) {
            this.pickObj = {};
            if (data.level == 3 && data.remark == '新闻') {
                this.treeData = [];
                this.pickObj = data;
                this.websiteId_add = data.id;
                this.countryZh_add = data.name;
                this.searchYqzxkWebsite(data);
            }
        },
        addWebsite() {
            if (this.pickObj.name) {
                this.newWebsite.name = '';
                this.newWebsite.domain = '';
                this.dialogVisibleYqzxk = true;
            } else {
                this.$message.warning('未选择节点');
            }

        },
        searchYqzxk() {
            if (this.inputYqzxk == '') {
                this.treeData = this.tmpWebsite;
            } else {
                this.treeData = this.tmpWebsite.filter(item => {
                    return item.name.indexOf(this.inputYqzxk) != -1;
                });
            }
        },
        defineAddWebsite() {
            this.newWebsite.sourceId = this.websiteId_add;
            this.newWebsite.countryZh = this.countryZh_add;
            if (this.newWebsite.name != '') {
                addWebsite(this.newWebsite).then(res => {
                    if (res == 1) {
                        this.$message.success('新增成功！');
                        this.dialogVisibleYqzxk = false;
                        this.searchYqzxkWebsite(this.pickObj);
                    } else {
                        this.$message.error('新增失败！');
                    }
                }).catch(err => {
                    this.$message.warning(err.message);
                });
            } else {
                this.$message.warning('未输入站点名称！');
            }
        },
        handleSelectionChangeYqzxk(val) {
            this.websiteIds = [];
            val.forEach(item => {
                this.websiteIds.push(item.id);
            });

        },
        deleteWebsite() {
            if (this.websiteIds.length > 0) {
                this.$confirm('此操作将永久删除数据, 是否继续?', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning',
                })
                    .then(() => {
                        removeWebsite(this.websiteIds).then(res => {
                            if (res == this.websiteIds.length) {
                                this.$message.success('删除成功！');
                                this.searchYqzxkWebsite(this.pickObj);
                            }
                        }).catch(err => {
                            this.$message.warning(err.message);
                        });
                    })
                    .catch((err) => {
                        console.log(err);
                    });
            } else {
                this.$message.warning('请选择要删除的数据！');
            }
        },
        editWebsite(row) {
            this.editWebsiteData = JSON.parse(JSON.stringify(row));
            this.editWebsiteData.countryZh = JSON.parse(JSON.stringify(this.pickObj.name));
            this.dialogVisibleYqzxkEdit = true;

        },
        defineEditWebsite() {
            if (this.editWebsiteData.name != '') {
                editWebsite(this.editWebsiteData).then(res => {
                    if (res == 1) {
                        this.$message.success('编辑成功！');
                        this.dialogVisibleYqzxkEdit = false;
                        this.searchYqzxkWebsite(this.pickObj);
                    } else {
                        this.$message.error('编辑失败！');
                    }
                }).catch(err => {
                    this.$message.warning(err.message);
                });
            } else {
                this.$message.warning('未输入站点名称！');
            }
        }
        //#endregion
    },
    watch: {
        filterText(val) {
            this.$refs.tree.filter(val);
        },
        inputYqzxk(val) {
            this.searchYqzxk();
        }
    },
    activated() {
        //查询板块名称
        get('api/rest/document/queryLiteratureFolder?module=热点事件').then(res => {
            this.moduleList = res;
            this.transferRadiosFile = res;
            let arrListModule = [
                {
                    label: '权威发布',
                    options: []
                },
                {
                    label: '舆情分析',
                    options: []
                }
            ];
            arrListModule[0].options = res.filter(item => item.remark == '权威发布');
            arrListModule[1].options = res.filter(item => item.remark == '舆情分析');
            this.optionsFile = arrListModule;
            this.moduleName = JSON.parse(JSON.stringify(arrListModule));
        })
            .then((res) => {
                this.queryNews(this.currentPage, this.everySize);
                this.queryLiterature(this.currentPageFile, this.everySizeFile, null, null);
                //查询源资源--树结构
                this.arr_show_key = [];
                post("api/rest/sentiment/querySource").then((data) => {
                    data.forEach((item) => {
                        if (item.level == 1) this.arr_show_key.push(item.id);
                    });
                    this.yqzxkData = getTreeData(data, "id", "parentid", "children", -1);
                });
            })
            .catch((err) => {
                this.$message.warning(err.message);
            })
    }

}
</script>

<style lang="scss">
#yqjcgl {
    width: 99%;
    height: 98%;
    padding: 30px;
    box-sizing: border-box;
    overflow-y: auto;

    .el-tabs--border-card {
        width: calc(100% - 4px);
        height: calc(100% - 4px);
        border: 2px solid #125473;
        border-radius: 5px;
        box-sizing: border-box;
        background: #ffffff00;

        .el-tabs__header {
            background-color: unset;
            border-bottom: 2px solid #125473;

            .el-tabs__item {
                color: #dedede;
            }

            .el-tabs__item.is-active {
                color: #ffe000;
                background-color: #116791;
                border-right-color: #116791;
                border-left-color: #116791;
            }

            .el-tabs__item:not(.is-disabled):hover {
                color: #ffe000;
            }
        }

        .el-tabs__content {
            height: calc(100% - 42px);
        }
    }

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

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

            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: 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-import {
            width: 120px;
            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%;
        }

        .button-delete {
            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-transform {
            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%;
        }
    }

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

        .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;
            }
        }
    }

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

        .el-dialog__header {
            .el-dialog__title {
                color: white;
            }
        }

        .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-upload-list__item {
                            &:hover {
                                background: #628ed4;
                            }

                            .el-upload-list__item-name {
                                color: white;
                            }

                            .el-upload-list__item-name [class^='el-icon'] {
                                color: white;
                            }
                        }
                    }

                    .el-radio-group {
                        .el-radio {
                            margin-top: 10px;
                            color: white;
                        }

                        .el-radio.is-bordered+.el-radio.is-bordered {
                            margin-left: 0px;
                        }
                    }
                }
            }

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

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

    .yqzxkgl {
        .left-yqzxkgl {
            width: 15%;
            height: 100%;
            float: left;
            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-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;
                // border-radius: 5px;
            }

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

            .custom-tree-node {
                flex: 1;
                display: flex;
                align-items: center;
                justify-content: space-between;
                font-size: 14px;
                padding-right: 8px;
                width: 82%;

                .first-span {
                    width: 100%;
                    float: left;
                    overflow: hidden;
                    text-overflow: ellipsis;
                    white-space: nowrap;
                }

                .addOrMove {
                    display: none;

                    .add {
                        i {
                            font-size: 16px;
                            color: #00a6f5;
                        }
                    }

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

                    .edit {
                        i {
                            font-size: 16px;
                            color: green;
                        }
                    }
                }
            }

            .el-tree>.el-tree-node>.el-tree-node__children>.el-tree-node>.el-tree-node__content:hover .addOrMove>button:nth-child(2),
            .el-tree>.el-tree-node>.el-tree-node__children>.el-tree-node>.el-tree-node__content:hover .addOrMove>button:nth-child(3) {
                display: none;
            }

            .el-tree>.el-tree-node>.el-tree-node__children>.el-tree-node>.el-tree-node__content:hover .addOrMove {
                display: block;
            }

            .el-tree>.el-tree-node>.el-tree-node__children>.el-tree-node>.el-tree-node__children>.el-tree-node>.el-tree-node__content .addOrMove>button:nth-child(1) {
                display: none;
            }

            .el-tree>.el-tree-node>.el-tree-node__children>.el-tree-node>.el-tree-node__children>.el-tree-node>.el-tree-node__content:hover .addOrMove {
                display: block;
            }
        }

        .right-yqzxkgl {
            width: 84%;
            height: 100%;
            float: left;
            margin-left: 1%;
            overflow-y: auto;

            .button-add {
                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-delete {
                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%;
            }

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

            .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;
            }
        }
    }

    #export_dialog {
        .el-dialog__body {
            padding: 0px 25px 18px;
        }

        .el-range-input {
            color: white;
            background-color: transparent;
        }
    }
}</style>