<template>
    <BasicLayout>
        <template #wrapper>
            <el-card class="box-card">
                <el-form ref="queryForm" :model="queryParams" :inline="true" label-width="68px">
                    <el-form-item label="分组" prop="groupId">
                        <el-select v-model="queryParams.groupId" placeholder="请选择分组" clearable size="small">
                            <el-option label="未分组" :value="-1"></el-option>
                            <el-option v-for="item in groupOptions" :key="'group' + item.value" :label="item.label"
                                :value="item.value">
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="绑定状态" prop="showBind">
                        <el-select v-model="queryParams.showBind" placeholder="请选择绑定状态" clearable size="small">
                            <el-option v-for="item in bindOptions" :key="'bind' + item.value" :label="item.label"
                                :value="item.value">
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="状态" prop="status">
                        <el-select v-model="queryParams.status" placeholder="请输入状态" clearable size="small">
                            <el-option v-for="item in statusOptions" :key="'status' + item.value" :label="item.label"
                                :value="item.value">
                            </el-option>
                        </el-select>
                    </el-form-item>

                    <el-form-item label="设备id" prop="machineId">
                        <el-input v-model="queryParams.machineId" placeholder="请输入设备id" clearable size="small"></el-input>
                    </el-form-item>
                    <el-form-item>
                        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
                        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
                    </el-form-item>
                </el-form>

                <el-row :gutter="10" class="mb8">
                    <el-col :span="1.5">
                        <el-button v-permisaction="['admin:mmMachine:add']" type="primary" icon="el-icon-plus"
                            size="mini" @click="handleAdd">新增
                        </el-button>
                    </el-col>
                    <el-col :span="1.5">
                        <el-button v-permisaction="['admin:mmMachine:edit']" type="success" icon="el-icon-edit"
                            size="mini" :disabled="multiple" @click="handleUpdate">修改
                        </el-button>
                    </el-col>
                    <el-col :span="1.5">
                        <el-button v-permisaction="['admin:mmMachine:batchEditGroup']" type="success" icon="el-icon-edit"
                            size="mini" :disabled="multiple" @click="handleUpdateGroupBatch">批量修改分组
                        </el-button>
                    </el-col>
                    <el-col :span="1.5">
                        <el-button v-permisaction="['admin:mmMachine:batchEditDescription']" type="success" icon="el-icon-edit"
                            size="mini" :disabled="multiple" @click="handleUpdateDescriptionBatch">批量修改备注
                        </el-button>
                    </el-col>
                    <el-col :span="1.5">
                        <el-button v-permisaction="['admin:mmMachine:clearAll']" type="danger" icon="el-icon-delete"
                            size="mini" @click="handleClearAll">清除所有
                        </el-button>
                    </el-col>
                    <el-col :span="1.5">
                        <el-button v-permisaction="['admin:mmMachine:remove']" type="danger" icon="el-icon-delete"
                            size="mini" :disabled="multiple" @click="handleDelete">删除
                        </el-button>
                    </el-col>
                    <el-col :span="1.5">
                        <el-button v-permisaction="['admin:mmMachine:check']" type="primary" icon="el-icon-s-check"
                            size="mini" @click="handleCheckIntervalAccount">检查设备编号
                        </el-button>
                    </el-col>
                    <el-col :span="1.5">
                        <el-button v-permisaction="['admin:mmMachine:reboot']" type="primary" icon="el-icon-s-check"
                            size="mini" @click="handleRebootMachine">重启设备
                        </el-button>
                    </el-col>
                </el-row>

                <el-table v-loading="loading" :data="mmMachineList" @selection-change="handleSelectionChange">
                    <el-table-column type="selection" width="55" align="center" />
                    <el-table-column label="设备id" align="center" width="100" prop="machineId" />
                    <el-table-column label="设备唯一码" align="center" prop="biosId" width="200" />
                    <el-table-column label="分组名" align="center">
                        <template slot-scope="scope">
                            {{ formatGroup(scope.row.groupId) }}
                        </template>
                    </el-table-column>
                    <el-table-column label="白名单内容" align="center" prop="content" :show-overflow-tooltip="true" />
                    <el-table-column label="允许应用内容" align="center" prop="groupItems" :show-overflow-tooltip="true" />
                    <el-table-column label="备注" align="center" prop="description" :show-overflow-tooltip="true" />
                    <el-table-column label="最后通讯时间" align="center" prop="lastTime" :show-overflow-tooltip="true">
                        <template slot-scope="scope">
                            <span>{{ parseTime(scope.row.lastTime) }}</span>
                        </template>
                    </el-table-column><el-table-column label="状态" align="center" prop="status" width="50">
                        <template slot-scope="scope">
                            {{ scope.row.status === 0 ? '掉线' : '在线' }}
                        </template>
                    </el-table-column>
                    <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
                        <template slot-scope="scope">
                            <el-popconfirm class="delete-popconfirm" title="确认要修改吗?" confirm-button-text="修改"
                                @confirm="handleUpdate(scope.row)">
                                <el-button slot="reference" v-permisaction="['admin:mmMachine:edit']" size="mini"
                                    type="text" icon="el-icon-edit">修改
                                </el-button>
                            </el-popconfirm>
                            <el-popconfirm class="delete-popconfirm" title="确认要删除吗?" confirm-button-text="删除"
                                @confirm="handleDelete(scope.row)">
                                <el-button slot="reference" v-permisaction="['admin:mmMachine:remove']" size="mini"
                                    type="text" icon="el-icon-delete">删除
                                </el-button>
                            </el-popconfirm>
                        </template>
                    </el-table-column>
                </el-table>

                <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageIndex" :page-sizes="pageSizes"
                    :limit.sync="queryParams.pageSize" @pagination="getList" />

                <!-- 添加或修改对话框 -->
                <el-dialog :title="title" :visible.sync="open" width="600px">
                    <el-form ref="form" :model="form" :rules="rules" label-width="100px">

                        <el-form-item label="设备id" prop="machineId">
                            <el-input v-model="form.machineId" placeholder="设备id" />
                        </el-form-item>
                        <el-form-item label="设备唯一码" prop="biosId">
                            <el-input v-model="form.biosId" placeholder="设备唯一码" />
                        </el-form-item>
                        <el-form-item label="分组" prop="groupId">
                            <el-select v-model="form.groupId" filterable clearable placeholder="请选择">
                                <el-option v-for="item in groupOptions" :key="item.value" :label="item.label"
                                    :value="item.value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                        <!-- <el-form-item label="进程限制" prop="taskLimit">
                            <el-radio-group v-model="form.taskLimit">
                                <el-radio v-for="(item, index) in limitOptions" :key="'进程' + index"
                                    :label="item.value">{{ item.label }}</el-radio>
                                    <el-radio :label="3">只记录</el-radio>
                            </el-radio-group>
                        </el-form-item> -->
                        <el-form-item label="进程白名单内容" prop="content">
                            <el-input v-model="form.content" placeholder="白名单内容" type="textarea" :rows="8" />
                        </el-form-item>
                        <!-- <el-form-item label="应用限制" prop="appLimit">
                            <el-radio-group v-model="form.appLimit">
                                <el-radio v-for="(item, index) in limitOptions" :key="'应用' + index"
                                    :label="item.value">{{ item.label }}</el-radio>
                            </el-radio-group>
                        </el-form-item> -->
                        <el-form-item label="应用白名单内容" prop="groupItems">
                            <el-input v-model="form.groupItems" placeholder="允许应用内容" type="textarea"
                                :rows="8"></el-input>
                        </el-form-item>
                        <el-form-item label="备注" prop="description">
                            <el-input v-model="form.description" placeholder="备注" type="textarea" :rows="3"
                                show-word-limit />
                        </el-form-item>
                    </el-form>
                    <div slot="footer" class="dialog-footer">
                        <el-button type="primary" @click="submitForm">确 定</el-button>
                        <el-button @click="cancel">取 消</el-button>
                    </div>
                </el-dialog>

                <el-dialog title="批量修改" :visible.sync="openBatch" width="600px">
                    <el-form ref="batchForm" :model="batchForm" :rules="batchRules" label-width="100px">
                        <el-form-item label="类型" prop="type">
                            <el-radio-group v-model="batchForm.type">
                                <el-radio :label="0">进程限制</el-radio>
                                <el-radio :label="1">应用限制</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="白名单内容" prop="content">
                            <el-input v-model="batchForm.content" placeholder="白名单内容" type="textarea" :rows="15" />
                        </el-form-item>
                    </el-form>
                    <div slot="footer" class="dialog-footer">
                        <el-button type="primary" :loading="loading" @click="submitBatchForm">确 定</el-button>
                        <el-button :loading="loading" @click="cancelBatch">取 消</el-button>
                    </div>
                </el-dialog>

                <el-dialog title="批量修改分组" :visible.sync="openGroupBatch" width="600px">
                    <el-form ref="groupBatchForm" :model="groupBatchForm" label-width="100px">
                        <el-form-item label="分组">
                            <el-select v-model="groupBatchForm.groupId" filterable clearable placeholder="请选择">
                                
                                <el-option v-for="item in groupOptions" :key="item.value" :label="item.label"
                                    :value="item.value">
                                </el-option>
                            </el-select>
                        </el-form-item>

                    </el-form>
                    <div slot="footer" class="dialog-footer">
                        <el-button type="primary" :loading="loading" @click="submitGroupBatchForm">确 定</el-button>
                        <el-button :loading="loading" @click="cancelGroupBatch">取 消</el-button>
                    </div>
                </el-dialog>


                <el-dialog title="批量修改备注" :visible.sync="openDescriptionBatch" width="600px">
                    <el-form ref="dscriptionBatchForm" :model="dscriptionBatchForm" label-width="100px">
                        <el-form-item label="备注">
                            <el-input v-model="dscriptionBatchForm.description" placeholder="备注" type="textarea"
                                :rows="3" show-word-limit />
                        </el-form-item>

                    </el-form>
                    <div slot="footer" class="dialog-footer">
                        <el-button type="primary" :loading="loading" @click="submitDesciptionBatchForm">确 定</el-button>
                        <el-button :loading="loading" @click="cancelDescriptionBatch">取 消</el-button>
                    </div>
                </el-dialog>

                <el-dialog title="批量修改限制" :visible.sync="openLimitBatch" width="600px">
                    <el-form ref="limitBatchForm" :model="limitBatchForm" :rules="limitBatchRules" label-width="100px">
                        <el-form-item label="类型" prop="type">
                            <el-radio-group v-model="limitBatchForm.type" @change="handleLimitBatchTypeChange">
                                <el-radio :label="0">进程限制</el-radio>
                                <el-radio :label="1">应用限制</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="是否限制" prop="limit">
                            <el-radio-group v-model="limitBatchForm.limit">
                                <el-radio v-for="(item, index) in limitOptions" :key="'进程' + index"
                                    :label="item.value">{{ item.label
                                    }}</el-radio>
                                <el-radio v-if="limitBatchForm.type === 0" :label="3">只记录</el-radio>
                            </el-radio-group>
                        </el-form-item>
                    </el-form>
                    <div slot="footer" class="dialog-footer">
                        <el-button type="primary" :loading="loading" @click="submitLimitBatchForm">确 定</el-button>
                        <el-button :loading="loading" @click="cancelLimitBatch">取 消</el-button>
                    </div>
                </el-dialog>

                <el-dialog title="重启设备" :visible.sync="openReboot" width="600px">
                    <el-form ref="rebootForm" :model="rebootForm" label-width="100px">
                        <el-form-item label="设备编号" prop="machineIds">
                            <el-select v-model="rebootForm.machineIds" style="width: 100%;" placeholder="不选择则默认全部设备"
                                clearable filterable multiple :remote-method="getMachines" :loading="searchLoding"
                                remote size="small">
                                <el-option v-for="dict in machineOptions" :key="dict.id" :label="dict.machineId"
                                    :value="dict.machineId" />
                                <div class="page">
                                    <pagination v-show="machinePage.total > 0" :background="false"
                                        :total="machinePage.total" layout="prev, pager, next"
                                        :page.sync="machinePage.pageIndex" :limit.sync="machinePage.pageSize"
                                        @pagination="getMachines" />
                                </div>
                            </el-select>
                        </el-form-item>

                    </el-form>
                    <div slot="footer" class="dialog-footer">
                        <el-button type="primary" :loading="loading" @click="submitRebootForm">确 定</el-button>
                        <el-button :loading="loading" @click="cancelReboot">取 消</el-button>
                    </div>
                </el-dialog>

            </el-card>
        </template>
    </BasicLayout>
</template>

<script>
import {
    addMmMachine, delMmMachine, getMmMachine, listMmMachine, updateMmMachine, updateMmMachineBatch, updateLimitBatch, updateMmMachineGroupBatch,
    uninstallMmMachine, updateMmMachineDescriptionBatch, clrearAllMmMachine, queryIntervalAccount, rebootMachine
} from '@/api/admin/mm-machine'
import { getMmGroupOptions } from '@/api/admin/mm-group'
import { resolveBlob } from '@/utils/zipdownload'

export default {
    name: 'MmMachine',
    components: {
    },
    data() {
        return {
            // 遮罩层
            loading: true,
            searchLoding: false,
            // 选中数组
            ids: [],
            // 非单个禁用
            single: true,
            // 非多个禁用
            multiple: true,
            // 总条数
            total: 0,
            // 弹出层标题
            title: '',
            // 是否显示弹出层
            open: false,
            openBatch: false,
            openLimitBatch: false,
            openGroupBatch: false,
            openDescriptionBatch: false,
            openReboot: false,
            isEdit: false,
            groupOptions: [],
            // 类型数据字典
            statusOptions: [{
                label: '掉线',
                value: 0
            }, {
                label: '在线',
                value: 1
            }],
            pageSizes: [10, 50, 100, 200, 500],
            machinePage: {
                total: 0,
                pageIndex: 1,
                pageSize: 10
            },
            mmMachineList: [],
            //设备选项列表
            machineOptions: [],
            bindOptions: [{
                value: 1,
                label: '已绑定'
            }, {
                value: 2,
                label: '未绑定'
            }],
            limitOptions: [
                {
                    label: '限制',
                    value: 1
                }, {
                    label: '不限制',
                    value: 2
                }
            ],
            // 查询参数
            queryParams: {
                pageIndex: 1,
                pageSize: 10,
                status: undefined,
                machineId: undefined,
                machineIdOrder: "asc"
            },
            // 表单参数
            form: {
            },
            batchForm: {
                type: 0,
                content: undefined,
                ids: undefined
            },
            limitBatchForm: {
                type: 0,
                ids: undefined,
                limit: 1,
            },
            groupBatchForm: {
                ids: undefined,
                groupId: undefined,
            },
            dscriptionBatchForm: {
                ids: undefined,
                description: undefined
            },
            rebootForm: {},
            // 表单校验
            rules: {
                machineId: [{ required: true, message: '设备id不能为空', trigger: 'blur' }],
                taskLimit: [{ required: true, message: '请选择进程限制', trigger: 'blur' }],
                appLimit: [{ required: true, message: '请选择应用限制', trigger: 'blur' }],
            },
            batchRules: {
                type: [{ required: true, message: '请选择类型', trigger: 'blur' }],
            },
            limitBatchRules: {
                limit: [{ required: true, message: '请选择是否限制', trigger: 'blur' }],
            }
        }
    },
    created() {
        this.getGroupOptions()
        this.getList()
    },
    methods: {
        /** 查询参数列表 */
        getList() {
            this.loading = true
            listMmMachine(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
                this.mmMachineList = response.data.list
                this.total = response.data.count
                this.loading = false
            }
            )
        },
        getMachines(e) {
            this.searchLoding = true
            listMmMachine({ ...this.machinePage, machineId: e }).then(response => {
                this.machineOptions = response.data.list
                this.machinePage.total = response.data.count
            })
                .finally(() => {
                    this.searchLoding = false
                })
        },
        // 取消按钮
        cancel() {
            this.open = false
            this.reset()
        },
        cancelBatch() {
            this.openBatch = false
            this.batchForm = {
                content: undefined,
                type: 0,
                ids: undefined
            }
        },
        cancelGroupBatch() {
            this.openGroupBatch = false
            this.groupBatchForm = {
                ids: undefined,
                groupId: undefined,
            }
        },
        cancelLimitBatch() {
            this.openLimitBatch = false
            this.limitBatchForm = {
                limit: 1,
                type: 0,
                ids: undefined
            }
        },
        cancelDescriptionBatch() {
            this.openDescriptionBatch = false
            this.dscriptionBatchForm = {
                ids: undefined,
                description: ''
            }
        },
        cancelReboot() {
            this.openReboot = false
            this.rebootForm = {
                machineIds: undefined,
            }
        },
        // 表单重置
        reset() {
            this.form = {

                id: undefined,
                machineId: undefined,
                biosId: undefined,
                lastTime: undefined,
                content: undefined,
                status: undefined,
                taskLimit: 1,
                appLimit: 1,
                groupItems: undefined
            }
            this.resetForm('form')
        },
        formatGroup(groupId) {
            let group = this.groupOptions.find(item => item.value === groupId)
            return group ? group.label : ''
        },
        getGroupOptions() {
            getMmGroupOptions().then(response => {
                this.groupOptions = response.data
            })
        },
        getImgList: function () {
            this.form[this.fileIndex] = this.$refs['fileChoose'].resultList[0].fullUrl
        },
        fileClose: function () {
            this.fileOpen = false
        },
        // 关系
        // 文件
        /** 搜索按钮操作 */
        handleQuery() {
            this.queryParams.pageIndex = 1
            this.getList()
        },
        /** 重置按钮操作 */
        resetQuery() {
            this.dateRange = []
            this.resetForm('queryForm')
            this.handleQuery()
        },
        /** 新增按钮操作 */
        handleAdd() {
            this.reset()
            this.open = true
            this.title = '添加设备白名单配置'
            this.isEdit = false
        },
        // 多选框选中数据
        handleSelectionChange(selection) {
            this.ids = selection.map(item => item.id)
            this.single = selection.length !== 1
            this.multiple = !selection.length
        },
        /** 修改按钮操作 */
        handleUpdate(row) {
            this.reset()

            if (row.id || this.ids.length === 1) {
                const id =
                    row.id || this.ids
                this.resetFormGroupId()

                getMmMachine(id).then(response => {
                    this.form = response.data
                    this.open = true
                    this.title = '修改设备白名单配置'
                    this.isEdit = true
                })
            } else if (this.ids.length > 1) {
                this.batchForm.ids = this.ids
                this.openBatch = true
            }
        },
        /** 提交按钮 */
        submitForm: function () {
            this.$refs['form'].validate(valid => {
                if (valid) {
                    if (this.form.id !== undefined) {
                        this.resetFormGroupId()

                        updateMmMachine(this.form).then(response => {
                            if (response.code === 200) {
                                this.msgSuccess(response.msg)
                                this.open = false
                                this.getList()
                            } else {
                                this.msgError(response.msg)
                            }
                        })
                    } else {
                        this.resetFormGroupId()

                        addMmMachine(this.form).then(response => {
                            if (response.code === 200) {
                                this.msgSuccess(response.msg)
                                this.open = false
                                this.getList()
                            } else {
                                this.msgError(response.msg)
                            }
                        })
                    }
                }
            })
        },
        resetFormGroupId() {
            if (this.form.groupId === undefined || this.form.groupId === null || this.form.groupId === '') {
                this.form.groupId = 0
            }
        },
        /* 批量修改按钮 */
        submitBatchForm() {
            this.$refs['batchForm'].validate(valid => {
                if (valid) {
                    this.loading = true
                    updateMmMachineBatch(this.batchForm).then(response => {
                        if (response.code === 200) {
                            this.msgSuccess(response.msg)
                            this.openBatch = false
                            this.getList()
                        } else {
                            this.msgError(response.msg)
                        }
                    }).finally(() => {
                        this.loading = false
                    })
                }
            })
        },
        submitGroupBatchForm() {
            this.$refs['groupBatchForm'].validate(valid => {
                if (valid) {
                    this.loading = true
                    if (this.groupBatchForm.groupId === undefined || this.groupBatchForm.groupId === null || this.groupBatchForm.groupId === '') {
                        this.groupBatchForm.groupId = 0
                    }

                    updateMmMachineGroupBatch(this.groupBatchForm).then(response => {
                        if (response.code === 200) {
                            this.msgSuccess(response.msg)
                            this.openGroupBatch = false
                            this.getList()
                        } else {
                            this.msgError(response.msg)
                        }
                    }).finally(() => {
                        this.loading = false
                    })
                }
            })
        },
        submitLimitBatchForm() {
            this.$refs['limitBatchForm'].validate(valid => {
                if (valid) {
                    this.loading = true
                    updateLimitBatch(this.limitBatchForm).then(response => {
                        if (response.code === 200) {
                            this.msgSuccess(response.msg)
                            this.openLimitBatch = false
                            this.getList()
                        } else {
                            this.msgError(response.msg)
                        }
                    }).finally(() => {
                        this.loading = false
                    })
                }
            })
        },
        /** 删除按钮操作 */
        handleDelete(row) {
            var Ids = (row.id && [row.id]) || this.ids

            this.$confirm('是否确认删除编号为"' + Ids + '"的数据项?', '警告', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(function () {
                return delMmMachine({ 'ids': Ids })
            }).then((response) => {
                if (response.code === 200) {
                    this.msgSuccess(response.msg)
                    this.open = false
                    this.getList()
                } else {
                    this.msgError(response.msg)
                }
            }).catch(function () {
            })
        },
        handleUpdateLimitBatch(row) {
            var Ids = (row.id && [row.id]) || this.ids
            this.limitBatchForm.ids = Ids
            this.openLimitBatch = true
        },
        handleUpdateGroupBatch(row) {
            var ids = (row.id && [row.id]) || this.ids
            this.groupBatchForm.ids = ids
            this.groupBatchForm.groupId = undefined
            this.openGroupBatch = true
        },
        handleLimitBatchTypeChange() {
            this.limitBatchForm.limit = 1
        },
        handleClearAll() {
            this.$confirm('是否清空所有数据', '警告', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(function () {
                return clrearAllMmMachine()
            }).then((response) => {
                if (response.code === 200) {
                    this.msgSuccess(response.msg)
                    this.open = false
                    this.getList()
                } else {
                    this.msgError(response.msg)
                }
            }).catch(function () {
            })
        },
        handleUnintallAll() {
            this.$confirm('是否取消所有绑定', '警告', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(function () {
                return uninstallMmMachine()
            }).then((response) => {
                if (response.code === 200) {
                    this.msgSuccess(response.msg)
                    this.open = false
                    this.getList()
                } else {
                    this.msgError(response.msg)
                }
            }).catch(function () {
            })
        },
        handleUpdateDescriptionBatch(row) {
            var ids = (row.id && [row.id]) || this.ids
            this.dscriptionBatchForm.ids = ids
            this.dscriptionBatchForm.content = ''
            this.openDescriptionBatch = true
        },
        submitDesciptionBatchForm() {
            this.$refs['dscriptionBatchForm'].validate(valid => {
                if (valid) {
                    this.loading = true
                    updateMmMachineDescriptionBatch(this.dscriptionBatchForm).then(response => {
                        if (response.code === 200) {
                            this.msgSuccess(response.msg)
                            this.openDescriptionBatch = false
                            this.getList()
                        } else {
                            this.msgError(response.msg)
                        }
                    }).finally(() => {
                        this.loading = false
                    })
                }
            })
        },
        /* 设置重启 */
        submitRebootForm() {
            if (this.rebootForm.machineIds === undefined || this.rebootForm.machineIds.length === 0) {
                this.$confirm('请注意，未选择具体设备就是重启所有设备!', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(() => {
                    this.sendRebootMachine()
                }).catch(() => {
                });
            } else {
                this.sendRebootMachine()
            }
        },
        sendRebootMachine() {
            rebootMachine(this.rebootForm).then(response => {
                if (response.code === 200) {
                    this.msgSuccess(response.msg)
                    this.openReboot = false
                } else {
                    this.msgError(response.msg)
                }
            })
                .finally(() => {
                    this.loading = false
                })
        },
        /* 检查是否有未录入的设备号 */
        handleCheckIntervalAccount() {
            this.loading = true

           
            queryIntervalAccount().then(response => {
                console.log(response)
                resolveBlob(response, '导出设备号.xlsx')
                this.msgSuccess('导出成功')
            }).finally(() => {
                this.loading = false
            })
        },
        handleRebootMachine() {
            this.openReboot = true
            this.getMachines()
        }
    }
}
</script>

<style scoped>
::deep(.el-notification__content) {
    max-height: 5vh;
    overflow-y: auto;
}

.page .pagination-container {
    padding: 0 !important;
    margin-top: 0;
    margin-bottom: 0;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
}

.page .el-pagination {
    width: 100%;
}
</style>
