<!--
 * @Author: xw
 * @Date: 2021-10-12 09:32:35
 * @LastEditTime: 2021-12-29 17:11:53
 * @LastEditors: Please set LastEditors
 * @Description: 舆情传播趋势
 * @FilePath: /data-show/src/views/BrandInsight/warnsopo/index.vue
-->
<template>
    <div class="warn-outter" v-loading="load">
        <div class="warn-inner">
            <vLabel-div title="负面消息">
                <a class="more" @click="goMore">更多</a>
            </vLabel-div>
            <div class="warn-bd">
                <dv-scroll-board :config="config" :style="{ width: '100%', height: '29.5rem' }" @click="handlerItem"/>
            </div>
        </div>
    </div>
</template>

<script>
import {getList} from "@/api/MyBrand"
export default {
    name: "",
    props: ["brand","series"],
    watch: {
        series: {
            handler(val) {
                if(val != 'default') {
                    this.form.token = this.getToken;
                    this.getData();
                }
            },
            immediate: true
        },
    },
    data() {
        return {
            load: false,
            config: {},
            darr: [],
            form: {
                token: '',
                sBrand: '',
                sSeriesName: '',
                sQingGan: 2,
                sCrisis: '',
                iPageIndex: 1,
                iPageSize: 100,
            }
        };
    },
    created() {
        // this.form.token = this.getToken;
        // this.getData();
    },
    methods: {
        getData() {
            this.form.sBrand = this.getWarningBrand.brandname || this.brand;
            this.form.sSeriesName = this.getWarningSeries || this.series;
            let obj = Object.assign({}, this.getCtime2, this.form)
            getList(obj).then(res => {
                let data = res.data || [];
                let arr = [];
                let arr2 = [];
                data.forEach((ele) => {
                    let a = [
                        `<span style='cursor: pointer;'>${ele._source.title}</span>`,
                        ele._source.carseries,
                        ele._source.crisis == 1?'初级危机':ele._source.crisis == 2?'中级危机':'高级危机'
                    ];
                    let b = [
                        `<span style='cursor: pointer;'>${ele._source.title}</span>`,
                        ele._source.carseries,
                        ele._source.crisis == 1?'初级危机':ele._source.crisis == 2?'中级危机':'高级危机',
                        ele._source.id
                    ];
                    arr.push(a);
                    arr2.push(b);
                });
                this.darr = arr2;
                this.config = {
                    headerBGC: "rgba(16,33,59)",
                    oddRowBGC: "#173b6d",
                    evenRowBGC: "rgba(69, 149, 244, 0)",
                    columnWidth: [410,110,100],
                    rowNum: 11,
                    header: ["事件列表", "关联车型", "调性"],
                    data: arr,
                };
            })
        },
        handlerItem() {
            
        },
        goMore() {
            this.$router.push("/moreWarning");
        }
    },
};
</script>

<style lang="less" scoped>
.warn-outter {
    width: 618px;
    // height: 560px;
    margin-left: 16px;
    .warn-inner {
        width: 100%;
        height: 540px;
        margin-top: 16px;
        border: 2px solid #0f2a4d;
        .warn-bd {
            width: 100%;
            height: calc(100% - 48px);
        }
    }
}
.more {
    font-size: 16px;
    font-family: PingFangSC-Semibold, PingFang SC;
    font-weight: 600;
    color: #AAAAAA;
}
</style>
