<template>
    <div class="pd10">
        <div v-show="boxing" v-loading="loading" element-loading-text="数据加载中">
            <el-form :inline="true" :model="formData" class="demo-form-inline">
                <el-form-item>
                    <Timeinterval ref="interval" :interval="3"></Timeinterval>
                </el-form-item>
                <el-form-item label="筛选数据:">
                    <el-input v-model.trim="formData.searchValue" placeholder="请输入筛选数据" clearable></el-input>
                </el-form-item>

                <el-form-item>
                    <el-button type="primary" @click="onSubmit" icon="el-icon-search">查询</el-button>
                </el-form-item>
                <el-form-item style="float: right">
                    <el-button type="primary" icon="el-icon-download" @click="exportEvent">导出</el-button>
                </el-form-item>
            </el-form>
            <vxe-table
                stripe
                size="mini"
                :row-config="{ isCurrent: true, isHover: true }"
                border
                highlight-current-row
                ref="management"
                header-cell-class-name="table_header"
                :data="datamock"
                style="width: 100%"
                :height="vh + 'px'"
            >
                <vxe-table-column title="序号" width="70" type="seq" align="center">
                    <template v-slot="row">
                        <span>{{ (formData.pageNum - 1) * formData.pageSize + row.seq }}</span>
                    </template>
                </vxe-table-column>
                <vxe-table-column field="timeId" title="时间" align="center" width="200"></vxe-table-column>
                <vxe-table-column field="timeId" title="事件关联分析名称" align="center" width="200"></vxe-table-column>
                <vxe-table-column field="contentDes" title="事件关联分析描述" align="center"></vxe-table-column>
                <vxe-table-column field="userName" title="操作" align="center" width="200">
                    <template slot-scope="scope">
                        <el-button type="primary" size="mini" icon="el-icon-share" @click="eventViewing(scope.row)">
                            事件查看
                        </el-button>
                    </template>
                </vxe-table-column>
            </vxe-table>
            <el-pagination
                background
                align="right"
                @size-change="handleSizeChange"
                @current-change="handleCurrentChange"
                :current-page="formData.pageNum"
                :page-sizes="[20, 30, 50, 100]"
                :page-size="formData.pageSize"
                layout="total, sizes, prev, pager, next, jumper"
                :total="total"
                class="mt10"
            ></el-pagination>
        </div>
        <!-- 事件查看 -->
        <div v-if="detailFlag" v-loading="isLoading" element-loading-text="数据加载中">
            <div class="BOX">
                波形分析
                <el-button
                    icon="el-icon-refresh-left"
                    style="position: absolute; right: 10px"
                    type="primary"
                    @click="back"
                >
                    返回
                </el-button>
            </div>
            <div class="mt10">
                <span style="font-size: 16px; line-height: 36px; font-weight: 600">
                    事件关联编号为：{{ AssociationNumber }}
                </span>
                <el-form :inline="true" class="demo-form-inline" style="float: right">
                    <el-form-item label="筛选数据:">
                        <el-input v-model.trim="form.searchValue" placeholder="请输入筛选数据" clearable></el-input>
                    </el-form-item>
                    <el-form-item>
                        <el-button type="primary" icon="el-icon-download" @click="exportEvent1">列表导出</el-button>
                        <el-button type="primary" @click="contrast">波形对比</el-button>
                    </el-form-item>
                </el-form>
                <div style="clear: both"></div>
                <vxe-table
                    stripe
                    size="mini"
                    ref="transformer"
                    :row-config="{ isCurrent: true, isHover: true }"
                    :data="fenxiData"
                    :height="vh1 + 'px'"
                    border
                    style="width: 100%"
                    header-cell-class-name="table_header"
                    :header-cell-style="{
                        height: '25px',
                        padding: '0px'
                    }"
                    :row-style="{ height: '28px' }"
                    :cell-style="{ padding: '0px' }"
                    @checkbox-change="handleSelectionChange"
                >
                    <vxe-table-column type="checkbox" align="center" width="55"></vxe-table-column>
                    <vxe-table-column title="序号" width="70" type="seq" align="center">
                        <template v-slot="row">
                            <span>{{ (form.pageNum - 1) * form.pageSize + row.seq }}</span>
                        </template>
                    </vxe-table-column>
                    <vxe-table-column
                        field="startTime"
                        title="发生时间"
                        align="center"
                        :show-overflow="true"
                    ></vxe-table-column>
                    <vxe-table-column
                        field="gdName"
                        title="供电公司"
                        align="center"
                        :show-overflow="true"
                    ></vxe-table-column>
                    <vxe-table-column
                        field="subName"
                        title="变电站"
                        align="center"
                        :show-overflow="true"
                    ></vxe-table-column>
                    <vxe-table-column field="lineName" title="监测点" align="center"></vxe-table-column>
                    <vxe-table-column field="voltageId" title="电压等级(kV)" align="center"></vxe-table-column>
                    <vxe-table-column field="featureAmplitude" title="暂降幅值(%)" align="center" width="120">
                        <template slot-scope="scope">
                            <span>{{ (scope.row.featureAmplitude * 100).toFixed(2) }}</span>
                        </template>
                    </vxe-table-column>
                    <vxe-table-column
                        field="duration"
                        title="持续时间(s)"
                        align="center"
                        width="120"
                    ></vxe-table-column>
                    <vxe-table-column
                        field="advanceType"
                        title="暂降类型"
                        align="center"
                        width="120"
                        :formatter="formFilter1"
                    ></vxe-table-column>
                    <vxe-table-column
                        field="advanceReason"
                        title="暂降原因"
                        align="center"
                        width="120"
                        :formatter="formFilter2"
                    ></vxe-table-column>
                </vxe-table>
                <el-pagination
                    background
                    align="right"
                    @size-change="handleSizeChange1"
                    @current-change="handleCurrentChange1"
                    :current-page="form.pageNum"
                    :page-sizes="[20, 30, 50, 100]"
                    :page-size="form.pageSize"
                    layout="total, sizes, prev, pager, next, jumper"
                    :total="bototal"
                    class="mt10"
                ></el-pagination>
            </div>
        </div>
        <!-- 波形对比 -->
        <div v-if="Waveform" v-loading="isLoading1" element-loading-text="数据加载中">
            <div class="BOX">
                {{ boxingName }}
                <el-button style="float: right" type="primary" @click="WaveformBack">返回</el-button>
            </div>
            <div class="mt10">
                <div class="wzhixx">
                    <span style="color: red">右侧控件可控制波形图片的显示&隐藏</span>
                    <span style="font-size: 14px; font-weight: ; line-height: 30px">值类型选择:</span>
                    <el-select v-model="valueData" placeholder="请选择值类型" @change="changeView">
                        <el-option
                            v-for="item in optionsValue"
                            :key="item.value"
                            :label="item.label"
                            :value="item.value"
                        ></el-option>
                    </el-select>
                    <el-button type="primary" v-if="save" @click="saveData">保存结果</el-button>
                    <el-button type="primary" v-if="associatedEvents" @click="delEvent">关联事件删除</el-button>
                    <el-button type="primary" @click="addEventFn" v-if="associatedEvents">新增关联事件</el-button>
                </div>
                <el-tabs v-model="bxactiveName" type="border-card" @tab-click="bxhandleClick">
                    <el-tab-pane label="瞬时波形" name="ssbx" :style="'height:' + bxecharts + ';overflow-y: scroll;'">
                        <shushiboxi
                            v-if="bxactiveName == 'ssbx' && showBoxi"
                            :value="valueData"
                            :boxoList="boxoList"
                            :wpData="wpData"
                        ></shushiboxi>
                    </el-tab-pane>
                    <el-tab-pane label="RMS波形" name="rmsbx" :style="'height:' + bxecharts + ';overflow-y: scroll;'">
                        <rmsboxi
                            v-if="bxactiveName == 'rmsbx' && showBoxi"
                            :value="valueData"
                            :boxoList="boxoList"
                            :wpData="wpData"
                        ></rmsboxi>
                    </el-tab-pane>
                </el-tabs>
            </div>
        </div>
        <!-- 关联事件删除 -->
        <div v-if="eventDelete" v-loading="delLoading" element-loading-text="数据加载中">
            <div class="BOX">
                从归一化事件中删除
                <el-button style="float: right" type="primary" @click="delBack">返回</el-button>
            </div>
            <div class="mt10">
                <span style="font-size: 16px; line-height: 36px; font-weight: 600">
                    事件关联编号为：{{ AssociationNumber }}
                </span>
                <el-form :inline="true" class="demo-form-inline" style="float: right">
                    <el-form-item label="筛选数据:">
                        <el-input v-model.trim="delForm.searchValue" placeholder="请输入筛选数据" clearable></el-input>
                    </el-form-item>
                    <el-form-item>
                        <el-button type="primary" class="el-icon-delete" @click="delData">删除</el-button>
                    </el-form-item>
                </el-form>
                <div style="clear: both"></div>
                <vxe-table
                    stripe
                    size="mini"
                    ref="transformer"
                    :row-config="{ isCurrent: true, isHover: true }"
                    :data="deleteData"
                    :height="vh2 + 'px'"
                    border
                    style="width: 100%"
                    header-cell-class-name="table_header"
                    :header-cell-style="{
                        height: '25px',
                        padding: '0px'
                    }"
                    :row-style="{ height: '28px' }"
                    :cell-style="{ padding: '0px' }"
                    @checkbox-change="handleSelectionChange1"
                >
                    <vxe-table-column type="checkbox" align="center" width="55"></vxe-table-column>
                    <vxe-table-column title="序号" width="70" type="seq" align="center">
                        <template v-slot="row">
                            <span>{{ (form.pageNum - 1) * form.pageSize + row.seq }}</span>
                        </template>
                    </vxe-table-column>
                    <vxe-table-column field="startTime" title="发生时间" align="center"></vxe-table-column>
                    <vxe-table-column field="gdName" title="供电公司" align="center"></vxe-table-column>
                    <vxe-table-column field="subName" title="变电站" align="center"></vxe-table-column>
                    <vxe-table-column field="lineName" title="监测点" align="center"></vxe-table-column>
                    <vxe-table-column field="voltageId" title="电压等级(kV)" align="center"></vxe-table-column>
                    <vxe-table-column field="featureAmplitude" title="暂降幅值(%)" align="center"></vxe-table-column>
                    <vxe-table-column field="duration" title="持续时间(s)" align="center"></vxe-table-column>
                    <vxe-table-column
                        field="advanceType"
                        title="暂降类型"
                        align="center"
                        :formatter="formFilter1"
                    ></vxe-table-column>
                    <vxe-table-column
                        field="advanceReason"
                        title="暂降原因"
                        align="center"
                        :formatter="formFilter2"
                    ></vxe-table-column>
                </vxe-table>
            </div>
        </div>
        <!-- 新增关联事件 -->
        <div v-if="addEvent" v-loading="addLoading" element-loading-text="数据加载中">
            <div class="BOX">
                添加从归一化事件
                <el-button style="float: right" type="primary" @click="addBack">返回</el-button>
            </div>
            <div class="mt10">
                <span style="font-size: 16px; line-height: 36px; font-weight: 600">归一化事件时间区间：</span>
                <el-select v-model="value" placeholder="请选择" @change="addChange">
                    <el-option v-for="item in options" :key="item.id" :label="item.name" :value="item.id"></el-option>
                </el-select>
                <el-form :inline="true" class="demo-form-inline" style="float: right">
                    <el-form-item label="筛选数据:">
                        <el-input v-model.trim="addForm.searchValue" placeholder="请输入筛选数据" clearable></el-input>
                    </el-form-item>
                    <el-form-item>
                        <el-button type="primary" @click="addQuery">确定</el-button>
                    </el-form-item>
                </el-form>
                <div style="clear: both"></div>
                <vxe-table
                    stripe
                    size="mini"
                    ref="transformer"
                    :row-config="{ isCurrent: true, isHover: true }"
                    :data="addEventData"
                    :height="vh1 + 'px'"
                    border
                    style="width: 100%"
                    header-cell-class-name="table_header"
                    :header-cell-style="{
                        height: '25px',
                        padding: '0px'
                    }"
                    :row-style="{ height: '28px' }"
                    :cell-style="{ padding: '0px' }"
                    @checkbox-change="handleSelectionChange2"
                >
                    <vxe-table-column type="checkbox" align="center" width="55"></vxe-table-column>
                    <vxe-table-column title="序号" width="70" type="seq" align="center">
                        <template v-slot="row">
                            <span>{{ (form.pageNum - 1) * form.pageSize + row.seq }}</span>
                        </template>
                    </vxe-table-column>
                    <vxe-table-column field="startTime" title="发生时间" align="center"></vxe-table-column>
                    <vxe-table-column field="gdName" title="供电公司" align="center"></vxe-table-column>
                    <vxe-table-column field="subName" title="变电站" align="center"></vxe-table-column>
                    <vxe-table-column field="lineName" title="监测点" align="center"></vxe-table-column>
                    <vxe-table-column field="voltageId" title="电压等级(kV)" align="center"></vxe-table-column>
                    <vxe-table-column field="featureAmplitude" title="暂降幅值(%)" align="center"></vxe-table-column>
                    <vxe-table-column field="duration" title="持续时间(s)" align="center"></vxe-table-column>
                    <vxe-table-column
                        field="advanceType"
                        title="暂降类型"
                        align="center"
                        :formatter="formFilter1"
                    ></vxe-table-column>
                    <vxe-table-column
                        field="advanceReason"
                        title="暂降原因"
                        align="center"
                        :formatter="formFilter2"
                    ></vxe-table-column>
                </vxe-table>
                <el-pagination
                    background
                    align="right"
                    @size-change="handleSizeChange1"
                    @current-change="handleCurrentChange1"
                    :current-page="addForm.pageNum"
                    :page-sizes="[20, 30, 50, 100]"
                    :page-size="addForm.pageSize"
                    layout="total, sizes, prev, pager, next, jumper"
                    :total="addTotal"
                    class="mt10"
                ></el-pagination>
            </div>
        </div>
    </div>
</template>
<script>
import Timeinterval from '@/views/components/Timeinterval.vue'
import rmsboxi from './components/rmsboxi'
import shushiboxi from './components/shushiboxi'
import {
    queryEventsAssPage,
    queryEventDetailByAssId,
    queryEventByTimeRange,
    updateEventToAss,
    delEventToAss,
    queryEventList
} from '@/api/administratione'
import { getMonitorEventAnalyseWave } from '@/api/monitoringpointStatistics/echart'
import { dicData } from '@/assets/commjs/dictypeData'
export default {
    components: {
        Timeinterval,
        rmsboxi,
        shushiboxi
    },
    props: {},
    data() {
        return {
            flag: '',
            wpData: [],
            boxoList: [],
            valueData: 1,
            loading: false,
            isLoading: false,
            isLoading1: false,
            addLoading: false,
            delLoading: false,
            detailFlag: false,
            boxing: true,
            Waveform: false,
            eventDelete: false,
            addEvent: false,
            save: false,
            associatedEvents: true,
            zoom: '', //图表焦点校验
            AssociationNumber: '',
            AssId: '',
            eventId: [],
            vh: undefined,
            vh1: undefined,
            vh2: undefined,
            bxecharts: null,
            showBoxi: true,
            bxactiveName: 'ssbx',
            boxingName: 'sbx',
            formData: {
                searchValue: '',
                pageNum: 1,
                pageSize: 20
            },
            form: {
                searchValue: '',
                pageNum: 1,
                pageSize: 20
            },
            delForm: {
                searchValue: ''
            },
            addForm: {
                searchValue: '',
                pageNum: 1,
                pageSize: 20,
                searchBeginTime: '',
                searchEndTime: ''
            },
            item: ['', ''],
            datamock: [],
            fenxiData: [],
            deleteData: [],
            addEventData: [],
            total: undefined,
            bototal: undefined,
            addTotal: undefined,
            deltotal: undefined,
            voltageLevelList: [],
            type: [],
            reason: [],
            multipleSelection: [],
            multipleSelection1: [],
            multipleSelection2: [],
            value: 2,
            TimeDays: '',
            options: [
                {
                    id: 1,
                    name: '10秒'
                },
                {
                    id: 2,
                    name: '2分钟'
                },
                {
                    id: 3,
                    name: '5分钟'
                },
                {
                    id: 4,
                    name: '10分钟'
                },
                {
                    id: 5,
                    name: '60分钟'
                }
            ],
            optionsValue: [
                {
                    value: 1,
                    label: '一次值'
                },
                {
                    value: 2,
                    label: '二次值'
                }
            ]
        }
    },
    created() {
        this.getclassificationData()
    },
    mounted() {
        this.setHeight()
        window.addEventListener('resize', this.setHeight)
        this.onSubmit()
    },
    beforeDestroy() {
        window.removeEventListener('resize', this.setHeight)
    },
    methods: {
        setHeight() {
            this.zoom = 1 / document.body.style.zoom
            this.vh = window.sessionStorage.getItem('appheight') - 95
            this.vh1 = window.sessionStorage.getItem('appheight') - 148
            this.vh2 = window.sessionStorage.getItem('appheight') - 107
            this.bxecharts = window.sessionStorage.getItem('appheight') - 122 + 'px'
        },
        changeView() {
            this.showBoxi = false
            setTimeout(() => {
                this.showBoxi = true
            }, 0)
        },
        //获取类型
        getclassificationData() {
            //电压等级
            this.voltageLevelList = dicData('Dev_Voltage_Stand', [])
            //暂降原因
            this.reason = dicData('Event_Reason', [])
            //暂降类型
            this.type = dicData('Event_Type', [])
        },
        //查询
        onSubmit() {
            this.loading = true
            this.formData.searchBeginTime = this.$refs.interval.timeValue[0]
            this.formData.searchEndTime = this.$refs.interval.timeValue[1]
            queryEventsAssPage(this.formData).then(res => {
                this.datamock = res.data.records
                this.total = res.data.total
                this.loading = false
            })
        },
        // 数据过滤
        formFilter1(row, column) {
            if (row.column.property == 'advanceType') {
                let title = ''
                this.type.forEach(item => {
                    if (item.id == row.row.advanceType) {
                        title = item.name
                    } else if (row.row.advanceType == null || row.row.advanceType == '') {
                        title = '/'
                    }
                })
                return title
            } else {
                return row.row[row.column.property]
            }
        },
        formFilter2(row, column) {
            if (row.column.property == 'advanceReason') {
                let title = ''
                this.reason.forEach(item => {
                    if (item.id == row.row.advanceReason) {
                        title = item.name
                    } else if (row.row.advanceReason == null || row.row.advanceReason == '') {
                        title = '/'
                    }
                })
                return title
            } else {
                return row.row[row.column.property]
            }
        },
        //事件查看
        eventViewing(val) {
            this.isLoading = true
            this.detailFlag = true
            this.boxing = false
            this.AssociationNumber = val.timeId
            this.AssId = val.eventAssId
            queryEventDetailByAssId({
                id: val.eventAssId,
                pageNum: 1,
                pageSize: 20
            }).then(res => {
                this.fenxiData = res.data.records
                this.bototal = res.data.total
                this.isLoading = false
            })
        },
        ////复选框
        handleSelectionChange(val) {
            this.multipleSelection = val.records
            // console.log(this.multipleSelection);
        },
        handleSelectionChange1(val) {
            this.multipleSelection1 = val.records
        },
        handleSelectionChange2(val) {
            this.multipleSelection2 = val.records
            //console.log(this.multipleSelection2);
        },
        //里层波形tab标签页触发事件
        bxhandleClick(tab, event) {
            if (tab.name == 'ssbx') {
                this.bxactiveName = 'ssbx'
            } else if (tab.name == 'rmsbx') {
                this.bxactiveName = 'rmsbx'
            }
            // console.log(tab, event);
        },
        //波形对比
        contrast() {
            this.wpData = []
            this.boxoList = []
            this.eventId = []
            this.boxingName = '波形对比'
            this.save = false
            this.associatedEvents = true
            this.isLoading1 = true
            this.flag = 1
            // this.detailFlag = false
            if (this.multipleSelection.length == 0) {
                this.$message({
                    showClose: true,
                    message: '请选择数据!!!',
                    type: 'warning'
                })
                return
            }
            // this.Waveform = true;
            // this.boxoList = this.multipleSelection;
            this.multipleSelection.forEach(item => {
                this.boxoList.push(item)
                this.eventId.push(item.eventId)
                let form = {
                    id: item.eventId,
                    systemType: 0
                }
                getMonitorEventAnalyseWave(form).then(res => {
                    if (res != undefined) {
                        this.wpData.push(res.data)
                        setTimeout(() => {
                            this.detailFlag = false
                            this.Waveform = true
                            this.isLoading1 = false
                        }, 0)
                    }
                })
            })
        },
        // 波形对比返回
        WaveformBack() {
            if (this.flag == 1) {
                this.detailFlag = true
                this.Waveform = false
            } else if (this.flag == 2) {
                this.Waveform = false
                this.addEvent = true
                this.wpData.splice(this.wpData.length - this.multipleSelection2.length, this.multipleSelection2.length)
                this.boxoList.splice(
                    this.boxoList.length - this.multipleSelection2.length,
                    this.multipleSelection2.length
                )
            }
            this.multipleSelection = []
        },
        //返回主页面
        back() {
            this.detailFlag = false
            this.boxing = true
            this.onSubmit()
        },
        //新增关联事件
        addEventFn() {
            this.addLoading = true
            this.Waveform = false
            this.addEvent = true
            if (this.value == 1) {
                this.TimeDays = 1000 * 10
            } else if (this.value == 2) {
                this.TimeDays = 1000 * 60 * 2
            } else if (this.value == 3) {
                this.TimeDays = 1000 * 60 * 5
            } else if (this.value == 4) {
                this.TimeDays = 1000 * 60 * 10
            } else if (this.value == 5) {
                this.TimeDays = 1000 * 60 * 60
            }
            // console.log(new Date(this.AssociationNumber).getTime());
            let date = new Date(this.AssociationNumber).getTime()
            //console.log(this.formatDate(new Date(date)));
            this.addForm.searchBeginTime = this.formatDate(new Date(date - this.TimeDays))
            this.addForm.searchEndTime = this.formatDate(new Date(date + this.TimeDays))
            queryEventByTimeRange(this.addForm).then(res => {
                this.addEventData = res.data.records
                this.addTotal = res.data.total
                this.addLoading = false
            })
        },
        //归一化事件时间区间
        addChange(val) {
            this.addLoading = true
            if (val == 1) {
                this.TimeDays = 1000 * 10
            } else if (val == 2) {
                this.TimeDays = 1000 * 60 * 2
            } else if (val == 3) {
                this.TimeDays = 1000 * 60 * 5
            } else if (val == 4) {
                this.TimeDays = 1000 * 60 * 10
            } else if (val == 5) {
                this.TimeDays = 1000 * 60 * 60
            }
            let date = new Date(this.AssociationNumber).getTime()
            this.addForm.searchBeginTime = this.formatDate(new Date(date - this.TimeDays))
            this.addForm.searchEndTime = this.formatDate(new Date(date + this.TimeDays))
            queryEventByTimeRange(this.addForm).then(res => {
                this.addEventData = res.data.records
                this.addTotal = res.data.total
                this.addLoading = false
            })
        },
        //新增确定
        addQuery() {
            this.boxingName = '新增波形对比'
            this.save = true
            this.associatedEvents = false
            this.flag = 2
            this.eventId = []
            if (this.multipleSelection2.length == 0) {
                this.$message({
                    showClose: true,
                    message: '请选择数据!!!',
                    type: 'warning'
                })
                return
            }
            this.multipleSelection2.forEach(item => {
                this.boxoList.push(item)
                this.eventId.push(item.eventId)
                let form = {
                    id: item.eventId,
                    systemType: 0
                }
                getMonitorEventAnalyseWave(form).then(res => {
                    if (res != undefined) {
                        this.wpData.push(res.data)
                        setTimeout(() => {
                            this.addEvent = false
                            this.Waveform = true
                        }, 0)
                    }
                })
            })
        },
        //保存结果
        saveData() {
            let form = {
                assId: this.AssId,
                eventId: this.eventId
            }
            updateEventToAss(form).then(res => {
                if (res.code == 'A0000') {
                    this.$message({
                        showClose: true,
                        message: res.message,
                        type: 'success'
                    })
                }
                this.Waveform = false
                this.boxing = true
                this.onSubmit()
            })
        },
        //新增关联事件返回
        addBack() {
            this.boxingName = '波形对比'
            this.flag = 1
            this.Waveform = true
            this.addEvent = false
            this.save = false
            this.associatedEvents = true
            this.multipleSelection2 = []
        },
        //关联事件删除
        delEvent() {
            this.Waveform = false
            this.delLoading = true
            this.eventDelete = true
            queryEventList(this.eventId).then(res => {
                this.deleteData = res.data
                this.delLoading = false
            })
        },
        //删除
        delData() {
            if (this.multipleSelection1.length == 0) {
                this.$message({
                    showClose: true,
                    message: '请选择数据!!!',
                    type: 'warning'
                })
                return
            }
            this.$confirm('是否确认删除?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            })
                .then(() => {
                    let id = []
                    this.multipleSelection1.forEach(item => {
                        id.push(item.eventId)
                    })

                    delEventToAss(id).then(res => {
                        if ((res.code == 'A0000')) {
                            this.$message({
                                type: 'success',
                                message: res.message
                            })
                        }
                        this.eventDelete = false
                        this.boxing = true
                        this.onSubmit()
                    })
                })
                .catch(() => {
                    this.$message({
                        type: 'info',
                        message: '已取消删除'
                    })
                })
        },
        //删除返回
        delBack() {
            this.eventDelete = false
            this.Waveform = true
        },
        //每页条数改变时触发 选择一页显示多少行
        handleSizeChange(val) {
            this.formData.pageSize = val
            this.onSubmit()
        },
        //当前页改变时触发 跳转其他页
        handleCurrentChange(val) {
            this.formData.pageNum = val
            this.onSubmit()
        },
        //每页条数改变时触发 选择一页显示多少行
        handleSizeChange1(val) {
            this.form.pageSize = val
            this.eventViewing()
        },
        //当前页改变时触发 跳转其他页
        handleCurrentChange1(val) {
            this.form.pageNum = val
            this.eventViewing()
        },

        //导出
        exportEvent() {
            queryEventsAssPage({
                searchBeginTime: this.formData.searchBeginTime,
                searchEndTime: this.formData.searchEndTime,
                searchValue: this.formData.searchValue,
                pageNum: 1,
                pageSize: this.total
            }).then(res => {
                this.$refs.management.exportData({
                    filename: 'export', // 文件名字
                    sheetName: 'Sheet1',
                    type: 'xlsx', //导出文件类型 xlsx 和 csv
                    useStyle: true,
                    data: res.data.records, // 数据源 // 过滤那个字段导出
                    columnFilterMethod: function (column, $columnIndex) {
                        return !(column.$columnIndex === 0)
                    }
                })
            })
        },
        exportEvent1() {
            queryEventDetailByAssId({
                id: this.AssId,
                pageNum: 1,
                pageSize: this.bototal
            }).then(res => {
                this.$refs.transformer.exportData({
                    filename: 'export', // 文件名字
                    sheetName: 'Sheet1',
                    type: 'xlsx', //导出文件类型 xlsx 和 csv
                    useStyle: true,
                    data: res.data.records, // 数据源 // 过滤那个字段导出
                    columnFilterMethod: function (column, $columnIndex) {
                        return !(column.$columnIndex === 0 || column.$columnIndex === 1)
                    }
                })
            })
        },
        //时间戳转换
        formatDate(date) {
            let Year = date.getFullYear()
            let Moth = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1
            let Day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate()
            let Hour = date.getHours() < 10 ? '0' + date.getHours() : date.getHours()
            let Minute = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()
            let Sechond = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds()
            // let Milliseconds =
            //   date.getMilliseconds() < 100 || date.getMilliseconds() < 10 ? "00" + date.getMilliseconds() : date.getMilliseconds();
            return Year + '-' + Moth + '-' + Day + ' ' + Hour + ':' + Minute + ':' + Sechond
        }
    },

    computed: {},

    watch: {}
}
</script>
<style lang="less" scoped>
@import url('../../../styles/comStyle.less');
::v-deep .el-form-item--small .el-form-item__content,
.el-form-item--small .el-form-item__label {
    height: 32px;
}
::v-deep .vxe-table .cell {
    text-align: center;
}
.BOX {
    height: 42px;
    padding: 0 40px 0 20px;
    overflow: hidden;
    font-size: 18px;
    font-weight: 700;
    line-height: 36px;
    color: #003078;
    background-color: #f8f8f8;
    border-bottom: 1px solid #eee;
    border-radius: 2px 2px 0 0;
}
::v-deep.wzhixx {
    position: fixed;
    z-index: 1;
    // font-size: 14px;
    font-weight: 550;
    right: 20px;
    top: 158px;
}
</style>
