<template>
    <div id="news_info">
        <div class="news_info_content" v-if="getNews">
            <div class="news_info_top-nav">
                <el-button v-show="!readOnly" @click="qx_query" style="position: absolute;top: 11%;right: 220px;">取消</el-button>
                <el-button type="warning" v-show="!readOnly" @click="save" style="position: absolute;top: 11%;right: 135px;">保存</el-button>
                <el-button type="primary" v-show="news_status==null&&readOnly&&txtFlag" @click="readOnly=!readOnly" style="position: absolute;top: 11%;right: 135px;">待编辑</el-button>
                <el-button type="primary" v-show="news_status==1&&readOnly&&txtFlag" @click="readOnly=!readOnly" style="position: absolute;top: 11%;right: 135px;">待校验</el-button>
                <el-button type="primary" v-show="news_status==2&&readOnly&&txtFlag" @click="readOnly=!readOnly" style="position: absolute;top: 11%;right: 135px;">待审核</el-button>
                <el-button type="success" v-show="news_status==3"  style="position: absolute;top: 11%;right: 135px;">审核完成</el-button>
                <img class="back" :src="back" @click="goBack" />
                <div class="top-left-left">
                    <div style="height: 200px;margin-top:100%;">
                        <el-steps direction="vertical" :active="actives">
                            <el-step title="编辑" :description="edit_people_xx.editor"></el-step>
                            <el-step title="校验" :description="edit_people_xx.collator"></el-step>
                            <el-step title="审核" :description="edit_people_xx.auditor"></el-step>
                        </el-steps>
                    </div>
                </div>
                <div class="top-left">
                    <div class="zyx1">
                        <div>
                            <span>{{txtFlag?'译':'原'}}</span>
                        </div>
                    </div>
                    <div class="top-left-title" v-text="getNews.title" :title="getNews.title"></div>
                    <div class="top-left-from">
                        <span>来源：</span><span v-text="getNews.site_name"></span>&emsp;&emsp;&emsp;
                        <span>发布时间：</span><span v-text="getNews.pubdate"></span>
                    </div>
                    <div class="top-left-img" v-show="getNews.website_img!=null&&getNews.website_img.length>0">
                        <el-image v-for="(item,index) in getNews.website_img" :src="NewsPictureUrl+item" :key="index"></el-image>
                    </div>
                    <div class="top-left-content" ref="copy1" v-if="readOnly" v-text="getNews.txt" @contextmenu.prevent.stop="openMenu($event)"></div>
                    <el-input
                        v-if="!readOnly"
                        v-model="getNews.txt"
                        placeholder="请输入内容"
                        type="textarea"
                        ></el-input>
                </div>
                <div class="top-left-left">
                    <div style="width:100%;height:200px" id="rmcy">
                        
                    </div>
                </div>
            </div>
            <div class="bottom-nav" v-if="readOnly">
                <div class="bottom-title">
                    <div class="title-one1" v-if="getNews.tag&&getNews.tag!=''&&getNews.tag.length>0">
                        <el-tag :style="{backgroundColor:returnColor(item),borderColor:returnColor(item)}" effect="dark" v-for="(item,index) in getNews.tag" v-text="item" :key="index" v-if="item"></el-tag>
                    </div>
                    <div class="title-one1" v-else="getNews.tag&&getNews.tag!=''&&getNews.tag.length>0">
                    </div>
                    <div class="title-three">
                        <a class="translation" @click="translation"><i class="el-icon-s-order"></i>{{txtFlag?'原文':'译文'}}</a>&emsp;
                        <a class="copy" @click="copy(0)" :data-clipboard-text="getNews.url"><i class="el-icon-connection"></i><span>
                                原文链接</span></a>&emsp;
                        <a class="copy1" @click="copy(1)" :data-clipboard-text="getNews.txt"><i class="el-icon-document-copy"></i><span> 复制</span></a>&emsp;
                        <a @click="exportWord"><i class="el-icon-download"></i><span> 下载</span></a>&emsp;&emsp;&emsp;&emsp;&emsp;
                    </div>
                </div>
            </div>
        </div>
        <div v-show="visible" :style="{position:'absolute',backgroundColor:'white',left:left+'px',top:top+'px'}" class="contextmenu">
            <!-- <ul>
                <li v-for="(item,index) in collectionFolder" @click.stop="addFolder(item,index)" :style="{'background':(index==selectIndex)?'#f56c6c':''}">
                    <span class="el-icon-folder-opened"></span>&emsp;{{item.name}}
                    <el-button class="delete" type="text" size="mini" @click.stop.native="delectCollectionFolder(item.id)">
                        <i class="el-icon-error"></i>
                    </el-button>
                </li>
            </ul>
            <div>
                <el-button type="" size="mini" @click.stop="addCollectionDefine">确定</el-button>
                <el-button type="danger" size="mini" @click.stop="dialogVisible=true">新增收藏夹</el-button>
            </div> -->
            <ul>
                <li @click="relatedPerson">关联人物</li>
                <li @click="relatedOrganization">关联机构</li>
                <li @click="addCollection">收藏</li>
            </ul>
        </div>
        <!-- <el-dialog title="新增收藏夹" :visible.sync="dialogVisible" width="20%" :before-close="handleClose" center>
            <span class="dialog-content">
                <el-input v-model="input" placeholder="请输入收藏夹名称" @click.stop.native="stopstop"></el-input>
            </span>
            <span slot="footer" class="dialog-footer">
                <el-button size="mini" @click.stop="dialogVisible = false">取 消</el-button>
                <el-button size="mini" type="danger" @click.stop="addCollectionFolder()">确 定</el-button>
            </span>
        </el-dialog> -->
        <el-dialog title="关联人物" :visible.sync="dialogVisiblePerson" width="30%" :before-close="handleClose">
            <el-form ref="form" label-width="120px">
                <el-form-item label="摘要">
                    <el-input type="textarea" :autosize="{ minRows: 2, maxRows: 10}" placeholder="请输入内容" v-model="selectText" disabled style="width:70%;"></el-input>
                </el-form-item>
                <el-form-item label="搜索人物">
                    <el-autocomplete v-model="state" :fetch-suggestions="querySearchAsync" placeholder="请输入内容" @select="handleSelect" style="width:70%;"></el-autocomplete>
                </el-form-item>
                <el-form-item label="选择类型">
                    <el-select v-model="personType" style="width:70%;">
                        <!-- <el-option value="相关人物">相关人物</el-option> -->
                        <el-option value="相关舆情">相关舆情</el-option>
                        <el-option value="相关活动">相关活动</el-option>
                        <el-option value="相关专著">相关专著</el-option>
                        <el-option value="相关言论">相关言论</el-option>
                        <el-option value="关键影响人物">关键影响人物</el-option>
                        <el-option value="评价言论">评价言论</el-option>
                    </el-select>
                </el-form-item>
            </el-form>
            <span slot="footer" class="dialog-footer">
                <el-button @click="dialogVisiblePerson = false">取 消</el-button>
                <el-button type="primary" @click="defineRelatedPerson">确 定</el-button>
            </span>
        </el-dialog>
        <el-dialog title="关联机构" :visible.sync="dialogVisibleOrganization" width="30%" :before-close="handleClose">
            <el-form ref="form" label-width="120px">
                <el-form-item label="摘要">
                    <el-input type="textarea" :autosize="{ minRows: 2, maxRows: 10}" placeholder="请输入内容" v-model="selectText" disabled style="width:70%;"></el-input>
                </el-form-item>
                <el-form-item label="搜索机构">
                    <el-autocomplete v-model="state" :fetch-suggestions="querySearchAsyncOrganization" placeholder="请输入内容" @select="handleSelect" style="width:70%;"></el-autocomplete>
                </el-form-item>
                <el-form-item label="选择类型">
                    <el-select v-model="organizationType" style="width:70%;">
                        <!-- <el-option value="相关人物">相关人物</el-option> -->
                        <el-option value="所属基地">所属基地</el-option>
                        <el-option value="所属部队">所属部队</el-option>
                        <el-option value="所属装备">所属装备</el-option>
                        <el-option value="相关舆情">相关舆情</el-option>
                        <el-option value="历史文献">历史文献</el-option>
                        <el-option value="证据资料">证据资料</el-option>
                        <el-option value="关键影响人物">关键影响人物</el-option>
                        <el-option value="评价言论">评价言论</el-option>
                        <el-option value="机构分析报告">机构分析报告</el-option>
                    </el-select>
                </el-form-item>
            </el-form>
            <span slot="footer" class="dialog-footer">
                <el-button @click="dialogVisibleOrganization = false">取 消</el-button>
                <el-button type="primary" @click="defineRelatedOrganization">确 定</el-button>
            </span>
        </el-dialog>
        <el-dialog title="添加收藏" :visible.sync="dialogVisibleCollection" width="20%" :before-close="handleClose">
            <ul>
                <li v-for="(item,index) in collectionFolder" @click.stop="addFolder(item,index)" :style="{'background':(index==selectIndex)?'#f56c6c':''}">
                    <span class="el-icon-folder-opened"></span>&emsp;{{item.name}}
                    <el-button class="delete" type="text" size="mini" @click.stop.native="delectCollectionFolder(item.id)">
                        <i class="el-icon-error"></i>
                    </el-button>
                </li>
            </ul>
            <el-dialog width="30%" title="新增收藏夹" :visible.sync="innerVisible" append-to-body>
                <el-form ref="form" label-width="120px">
                    <el-form-item label="名称">
                        <el-input v-model="collectionName" placeholder="请输入收藏夹名称"  style="width:70%;"></el-input>
                    </el-form-item>
                </el-form>
                <span slot="footer" class="dialog-footer">
                    <el-button size="mini" @click.stop="innerVisible = false">取 消</el-button>
                    <el-button size="mini" type="danger" @click.stop="addCollectionFolder()">确 定</el-button>
                </span>
            </el-dialog>
            <span slot="footer" class="dialog-footer">
                <el-button type="" size="mini" @click.stop="defineAddCollection">确定</el-button>
                <el-button type="danger" size="mini" @click.stop="innerVisible=true,collectionName=''">新增收藏夹</el-button>
            </span>
        </el-dialog>
    </div>
</template>

<script>
import back from "../../assets/img/setting/back.png";
import { get, post, getReplaceColor, delete_util, fileDownload } from "../../util/http_util";
import Clipboard from "clipboard";
import { queryDictType, queryDictItem } from '../../api/dictitem';
import {} from "../../util/data_util";
import * as echarts from "echarts";
import {option_hot_word  } from "../../constant/echart-options";
import { NewsPictureUrl } from "../../api/publicUrl";
export default {
    name: "",
    data() {
        return {
            NewsPictureUrl: NewsPictureUrl,
            visible: false,
            top: 300,
            left: 300,
            back: back,
            getNews: {},
            collectionFolder: [],
            dialogVisible: false,
            input: '',
            selectText: '',
            collectionData: {},
            selectIndex: -1,
            tmpTxt: '',
            tmpTitle: '',
            txtFlag: true,
            inputVisible: false,
            dialogVisiblePerson: false,
            dialogVisibleOrganization: false,
            personValue: '',
            organizationValue: '',
            personType: '',
            organizationType: '',
            timeout: null,
            state: '',
            selectText: '',
            pickItem: {},
            dialogVisibleCollection: false,
            innerVisible: false,
            collectionName: '',
            readOnly:true,
            colorList: ['#409eff', '#F56C6C', '#67C23A', '#E6A23C', '#909399', '#303133'],
            myChart1:'',
            news_status:null,
            actives:0,
            edit_people_xx : {
                auditor:'',
                collator:'',
                editor:'',
            }
        };
    },
    methods: {
        echarts_1(data) {
            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 datas = [];
            if (data.length > 0) {
                data.forEach((item) => {
                    if(item.word != '' && item.word.length > 1){
                        datas.push(item);
                    }
                });
                let data_all = datas.slice(0,40);
                datas = [];
                data_all.forEach((item) => {
                    datas.push({ name: item.word, value: item.count });
                });
            }
            let options = {
                series: [
                {
                    data: datas,
                },
                ],
            };
            this.myChart1.setOption(options);
        },
        save(){
            let txt_obj = this.getNews.txt;
            let data = [{id:this.getNews.id}];
            if(!this.txtFlag){
                data[0].properties = {txt:txt_obj};
            }else{
                //传值title_zhy，用于调用算法时将标题带入到实体中
                data[0].properties = {txt_zh:txt_obj,title_zh:this.getNews.title_zh};
            }
            post(`api/rest/fulltext/bulkUpdateNewsInfo`,
                data
                )
                .then(res=>{
                    if(res==1){
                        this.$message.success("修改成功");
                        let states = '';
                        if(this.news_status==null){
                            states = 'EDIT';
                        }else if(this.news_status==1){
                            states = 'COLLATE';
                        }else if(this.news_status==2){
                            states = 'AUDIT';
                        }
                        get("api/rest/sentiment/changeSentimentNewsStatus?newsId=" + this.getNews.id + "&newsStatus=" + states + "&account=" + this.$store.getters.userInfo.account)
                        .then((res) => {
                            console.log("新闻状态上传成功");
                            this.query_news_edit(this.getNews.id);
                        })
                    }
                }).catch((err)=>{
                    this.$message.warning(err.message);
                })
            this.readOnly = true;
        },
        goBack() {
            this.$router.go(-1);
        },
        // 点击导出word
        exportWord: function () {
            //后台下载
            fileDownload("api/rest/elastic/exportNews?id=" + this.getNews.id, this.tmpTitle ? this.tmpTitle : '未知', 'doc');
        },
        copy(val) {
            let clipboard = "";
            if (val == 0) {
                clipboard = new Clipboard(".copy");
            } else {
                clipboard = new Clipboard(".copy1");
            }
            clipboard.on("success", (e) => {
                this.$message.success("复制成功");
                // 释放内存
                clipboard.destroy();
            });
            clipboard.on("error", (e) => {
                // 不支持复制
                console.log("该浏览器不支持自动复制");
                // 释放内存
                clipboard.destroy();
            });
        },
        //翻译
        translation() {
            if (this.txtFlag) {
                this.getNews.title = this.tmpTitle;
                this.getNews.txt = this.tmpTxt;
                this.txtFlag = false;
            } else {
                this.getNews.title = this.getNews.title_zh;
                this.getNews.txt = this.getNews.txt_zh;
                this.txtFlag = true;
            }
        },
        openMenu(e) {
            this.selectText = '';
            this.selectIndex = -1;
            const menuMinWidth = 300
            const offsetLeft = this.$el.getBoundingClientRect().left - 150; // container margin left
            const offsetWidth = this.$el.offsetWidth - 200; // container width
            const maxLeft = offsetWidth - menuMinWidth; // left boundary
            const left = e.clientX - offsetLeft; // 15: margin right

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

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

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

            post(
                `api/rest/resource/queryDynamicCharacter?pageNum=1&pageSize=100&multiFieldSearch=`+queryString,
                {
                    mould: "敌方外网资源",
                    // "baseProperty.姓名": queryString
                }
            ).then(res => {
                res.list.forEach(item => {
                    let personObj = {};
                    personObj['value'] = item.baseProperty.姓名;
                    personObj['address'] = item._id;
                    personList.push(personObj);
                })
                // var results = queryString ? personList.filter(this.createStateFilter(queryString)) : personList;
                clearTimeout(this.timeout);
                this.timeout = setTimeout(() => {
                    cb(personList);
                }, 3000 * Math.random());
            });
        },
        querySearchAsyncOrganization(queryString, cb) {
            let organizationList = [];
            post(
                "api/rest/resource/queryDynamicOrganization?pageNum=1&pageSize=100&multiFieldSearch="+queryString,
                {
                    mould: "敌方外网资源机构",
                }
            ).then(res => {
                res.list.forEach(item => {
                    let organizationObj = {};
                    organizationObj['value'] = item.baseProperty.部队番号;
                    organizationObj['address'] = item._id;
                    organizationList.push(organizationObj);
                })
                // var results = queryString ? organizationList.filter(this.createStateFilter(queryString)) : organizationList;
                clearTimeout(this.timeout);
                this.timeout = setTimeout(() => {
                    cb(organizationList);
                }, 3000 * Math.random());
            });
            post(
                "api/rest/resource/queryDynamicOrganization?pageNum=1&pageSize=100&multiFieldSearch="+queryString,
                {
                    mould: "敌方资源机构",
                }
            ).then(res => {
                res.list.forEach(item => {
                    let organizationObj = {};
                    organizationObj['value'] = item.baseProperty.部队番号;
                    organizationObj['address'] = item._id;
                    organizationList.push(organizationObj);
                })
                // var results = queryString ? organizationList.filter(this.createStateFilter(queryString)) : organizationList;
                clearTimeout(this.timeout);
                this.timeout = setTimeout(() => {
                    cb(organizationList);
                }, 3000 * Math.random());
            });
        },
        createStateFilter(queryString) {
            return (state) => {
                return (state.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0);
            };
        },
        handleSelect(item) {
            this.pickItem = item;
        },
        //确定关联人物
        defineRelatedPerson() {
            let obj = {};
            obj['object'] = this.selectText.trim();
            obj['objectFrom'] = this.getNews.id;
            obj['subject'] = this.pickItem.address;
            obj['relation'] = this.personType;
            obj['objectType'] = '新闻';
            post(`api/rest/3z/resource/addRelatedInfo`, obj).then(res => {
                if (res == 1) {
                    this.$message.success('关联人员成功！');
                    this.dialogVisiblePerson = false;
                } else {
                    this.$message.error('关联人员失败！');
                }
            }).catch(err => {
                this.$message.error(err.message);
            });

        },
        //确定关联机构
        defineRelatedOrganization() {
            let obj = {};
            obj['object'] = this.selectText.trim();
            obj['objectFrom'] = this.getNews.id;
            obj['subject'] = this.pickItem.address;
            obj['relation'] = this.organizationType;
            obj['objectType'] = '新闻';
            post(`api/rest/3z/resource/addRelatedInfo`, obj).then(res => {
                if (res == 1) {
                    this.$message.success('关联机构成功！');
                    this.dialogVisibleOrganization = false;
                } else {
                    this.$message.error('关联机构失败！');
                }
            }).catch(err => {
                this.$message.error(err.message);
            });
        },
        handleClose(done) {
            done();
        },
        //收藏
        //查询收藏目录
        searchCollectionFolder() {
            get('api/rest/resource/queryCollectionFolder?collector=' + this.userInfo.account).then(res => {
                this.collectionFolder = res;
            })
        },
        //选择收藏夹
        addFolder(item, index) {
            this.selectIndex = index;
            if (this.selectText != '') {
                this.collectionData.description = this.selectText;
                this.collectionData.folderId = item.id;
                this.collectionData.originId = this.getNews.id;
                this.collectionData.title = this.getNews.title;
                this.collectionData.collector = this.userInfo.account;
            } else {
                this.$message.warning('未选择文字！');
            }
        },
        //选择收藏夹完成上传
        defineAddCollection() {
            if (this.collectionData.folderId != undefined) {
                post('api/rest/resource/addCollection', this.collectionData).then(res => {
                    if (res == 1) {
                        this.$message.success('收藏成功!');
                        this.dialogVisibleCollection = false;
                    }
                });
            } else {
                this.$message.warning('未选择收藏夹！');
                this.dialogVisibleCollection = true;
            }

        },
        addCollection() {
            this.dialogVisibleCollection = true;
        },
        //新增收藏夹名称
        addCollectionFolder() {
            if (this.collectionName != '' && this.collectionName != null) {
                post('api/rest/resource/addCollectionFolder', { name: this.collectionName, collector: this.userInfo.account }).then(res => {
                    if (res == 1) {
                        this.$message.success('新增成功！');
                        this.searchCollectionFolder();
                        this.innerVisible = false;
                    }
                }).catch((err)=>{
                    this.$message.warning(err.message);
                });
            } else {
                this.$message.warning('新增目录不能为空！');
                this.innerVisible = true;
            }
        },
        //删除收藏夹目录
        delectCollectionFolder(id) {
            delete_util('api/rest/resource/removeCollectionFolder?folderId=' + id).then(res => {
                if (res == 1) {
                    this.$message.success("删除成功！");
                    this.searchCollectionFolder();
                }
            }).catch((err)=>{
                this.$message.warning(err.message);
            });
        },
        //返回颜色
        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];
            }
        },
        query_news_edit(id){
            this.news_status = null;
            this.actives = 0;
            this.edit_people_xx = {auditor:'',auditTime:'',collator:'',collateTime:'',editor:'',editTime:''}
            get("api/rest/sentiment/querySentimentNewsStatus?newsId=" + id)
            .then((res) => {
                if( res == null ){
                    this.news_status = null;
                    this.actives = 0;
                }else{
                    this.edit_people_xx = {
                        auditor: res.auditor==null?'':res.auditor+'：'+res.auditTime,
                        collator: res.collator==null?'':res.collator+'：'+res.collateTime,
                        editor: res.editor==null?'':res.editor+'：'+res.editTime,
                    }
                    if( res.auditor != null ){
                        this.news_status = 3;
                        this.actives = 3;
                    }else if( res.collator != null ){
                        this.news_status = 2;
                        this.actives = 2;
                    }else if( res.editor != null ){
                        this.news_status = 1;
                        this.actives = 1;
                    }
                }
            })
        },
        query(id){
            this.readOnly = true;
            this.txtFlag = true;
            this.getNews = {};
            this.myChart1 == null;
            // this.echarts_1([]);
            this.query_news_edit(id);
            get("api/rest/fulltext/queryOneNews?Id=" + id)
                .then((res) => {
                    if(res==null){
                        this.$message.warning('新闻已删除');
                        return
                    }
                    this.getNews = res;
                    // this.getNews.txt_zh&&(this.getNews.txt_zh = this.getNews.txt_zh.replaceAll("<br>","\n").replaceAll("<BR>","\n"));
                    // this.getNews.txt&&(this.getNews.txt = this.getNews.txt.replaceAll("<br>","\n").replaceAll("<BR>","\n"));
                    this.tmpTxt = this.getNews.txt;
                    this.tmpTitle = this.getNews.title;
                    this.getNews.txt = this.getNews.txt_zh;
                    this.getNews.title = this.getNews.title_zh;
                    // if(this.getNews.hot_word1!=undefined&&this.getNews.hot_word1!=null&&this.getNews.hot_word1.length>0)this.echarts_1(this.getNews.hot_word1);
                    queryDictItem('01').then(item => {
                        item.forEach(ele => {
                            if (ele.code == res.language_type) {
                                this.getNews.language_type = ele.name;
                            }

                        });
                    });
                    queryDictItem('02').then(item => {
                        item.forEach(ele => {
                            if (ele.code == res.media_type) {
                                this.getNews.media_type = ele.name;
                            }
                        });
                    });
                    queryDictItem('03').then(item => {
                        item.forEach(ele => {
                            if (ele.code == res.region_id) {
                                this.getNews.region_id = ele.name;
                            }

                        });
                    });
                    queryDictItem('04').then(item => {
                        item.forEach(ele => {
                            if (ele.code == res.industry_id) {
                                this.getNews.industry_id = ele.name;
                            }
                        });
                    });
                })
                .then((res)=>{
                    this.searchCollectionFolder();
                })
                .catch((err) => {
                    this.getNews = {};
                    this.$message.warning(err.message);
                });
        },
        qx_query(){
            this.readOnly=!this.readOnly;
            this.query(this.getNews.id);
        }
    },
    activated() {
        if (this.$route.params.key == null) {
            return
        }
        this.query(this.$route.params.key);
        
    },
    computed: {
        userInfo() {
            if (this.$store.getters.userInfo) {
                return this.$store.getters.userInfo;
            } else {
                return { username: "" };
            }
        }
    },
    watch: {
        visible(value) {
            if (value) {
                document.body.addEventListener('click', this.closeMenu)
            } else {
                document.body.removeEventListener('click', this.closeMenu)
            }
        }
    }
};
</script>

<style lang="scss" >
html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}
#news_info {
    width: 99%;
    height: 97%;
    margin: 0;
    padding: 20px;
    box-sizing: border-box;
    overflow: hidden;
    .news_info_content {
        width: 100%;
        height: 100%;
        float: left;
        .news_info_top-nav {
            width: 100%;
            height: calc(100% - 55px);
            padding: 10px;
            box-sizing: border-box;
            .back {
                width: 40px;
                height: 40px;
                position: absolute;
                top: 11%;
                right: 80px;
                cursor: pointer;
            }
            .top-left-left{
                width: 15%;
                float: left;
                height: 100%;
                font-size: 12px;
                .zzsx{
                    width: 80%;
                    margin-left: 10%;
                    height: 100%;
                    line-height: 24px;
                    display: flex;
                    align-items: center;
                    color: #aeaeae;
                }
                .el-step__title.is-process{
                    color: #C0C4CC;
                }
                .el-step__icon{
                    width: 22px;
                    height: 22px;
                    font-size: 12px;
                }
                .el-step__title{
                    font-size: 15px;
                }
            }
            .top-left {
                width: 70%;
                height: 100%;
                padding: 20px;
                margin: auto;
                box-sizing: border-box;
                overflow-y: auto;
                background: #263b5d29;
                float: left;
                position: relative;
                .zyx1{
                    position: absolute;
                    width: calc(100% - 5px);
                    height: calc(100% - 20px);
                    pointer-events: none;
                    div{
                        width: 100%;
                        height: 100%;
                        position: relative;
                        overflow: hidden;
                        span{
                            position: absolute;
                            top: -4px;
                            left: -30px;
                            display: block;
                            font-size: 15px;
                            color: #ffffff;
                            font-weight: 900;
                            background: #36A8FF;
                            width: 86px;
                            line-height: 30px;
                            text-align: center;
                            transform: rotate(-45deg);
                            letter-spacing: 3px;
                        }
                    }
                }
                .el-textarea__inner{
                    color: white !important;
                    background: none !important;
                    border: 1px solid #146a80 !important;
                    box-shadow: 0 0 10px #1b6097;
                    font-family: '微软雅黑';
                    line-height: 25px;
                    letter-spacing: 1px;
                    font-size: 17px;
                    height: calc(100% - 70px);
                    overflow-x: hidden;
                }
                &::-webkit-scrollbar {
                    display: none;
                }
                .top-left-title {
                    width: 100%;
                    line-height: 1.5;
                    font-size: 40px;
                    font-weight: 700;
                    text-align: center;
                    color: #6cabef;
                    cursor: pointer;
                }
                .top-left-from {
                    width: 100%;
                    height: 50px;
                    line-height: 50px;
                    color: #b3b3b3;
                    text-align: center;
                    margin-top: 10px;
                    margin-bottom: 10px;
                }
                .top-left-img {
                    width: 100%;
                    margin-bottom: 20px;
                    text-align: center;
                    .el-image {
                        width: 60%;
                        height: 60%;
                        margin-top: 20px;
                        cursor: pointer;
                    }
                }
                .top-left-content {
                    width: 100%;
                    height: calc(100% - 55px);
                    line-height: 2.2;
                    letter-spacing: 1px;
                    font-size: 18px;
                    white-space: pre-wrap;
                    em {
                        color: red;
                    }
                    img {
                        max-width: 700px;
                    }
                }
            }
        }
        .bottom-nav {
            width: 100%;
            height: 40px;
            .bottom-title {
                width: 100%;
                height: 40px;
                line-height: 40px;
                display: -webkit-box;
                background-color: #263b5d;
                .title-one1{
                    width: 66.6%;
                    height: 40px;
                    overflow: hidden;
                    span{
                        margin-left: 10px;
                        margin-top: 5px;
                    }
                }
                .title-three {
                    width: 33.3%;
                    height: 100%;
                }
                .title-three {
                    text-align: right;
                    a {
                        cursor: pointer;
                        i {
                            color: #168c96;
                        }
                    }
                    a:hover {
                        color: aquamarine;
                    }
                }
            }
        }
    }
    .contextmenu {
        width: 200px;
        padding: 5px 0px;
        box-sizing: border-box;
        ul {
            margin: 0;
            padding: 0;
            overflow-y: auto;
            list-style: none;
            li {
                height: 30px;
                line-height: 30px;
                padding-left: 20px;
                position: relative;
                font-size: 14px;
                box-sizing: border-box;
                color: black;
                &:hover {
                    cursor: pointer;
                    background-color: #ddd;
                }
                .delete {
                    position: absolute;
                    right: 10px;
                    i {
                        font-size: 16px;
                        color: #ff5454;
                    }
                }
            }
        }
    }

    .el-dialog {
        color: white;
        background: #1d2d46 !important;
        .el-dialog__body {
            .el-form {
                .el-form-item {
                    .el-form-item__label {
                        color: white;
                    }
                    .el-form-item__content {
                        color: white;
                        .el-upload__tip {
                            color: white;
                        }
                    }
                }
            }
            .el-input__inner {
                color: white !important;
                background: none !important;
                border: 1px solid #146a80 !important;
                box-shadow: 0 0 10px #1b6097;
            }
            textarea {
                color: white !important;
                background: none !important;
                border: 1px solid #146a80 !important;
                box-shadow: 0 0 10px #1b6097;
            }
            .el-icon-document {
                height: auto;
            }

            .el-tag + .el-tag {
                margin-left: 10px;
            }
            .button-new-tag {
                margin-left: 10px;
                height: 32px;
                line-height: 30px;
                padding-top: 0;
                padding-bottom: 0;
            }
            .input-new-tag {
                width: 90px;
                margin-left: 10px;
                vertical-align: bottom;
            }
            ul {
                height: 150px;
                margin: 0;
                padding: 0;
                overflow-y: auto;
                list-style: none;
                li {
                    height: 30px;
                    line-height: 30px;
                    padding-left: 10px;
                    position: relative;
                    box-sizing: border-box;
                    color: white;
                    &:hover {
                        color: white;
                        background-color: #f56c6c;
                    }
                    .delete {
                        position: absolute;
                        right: 10px;
                        i {
                            font-size: 16px;
                            color: #ff5454;
                        }
                    }
                }
            }
        }
    }
}
</style>