<style lang="scss">
@import '@/styles/index.scss'; //导入样式

.baseparam {
    width: 100%;
    margin: auto;

    &__item {
        width: 100%;
        display: flex;

        &-left {
            flex: 1;
        }

        &-right {
            flex: none;
            width: 100px;
            -webkit-box-sizing: border-box;
            -moz-box-sizing: border-box;
            box-sizing: border-box;
            padding-left: 15px;
            text-align: right;
        }
    }
}
</style>

<template>
    <div class="baseparam">
        <app-search>
            <el-form :inline="true" :size="controlSize">
                <el-form-item label="大楼编号">
                    <el-select v-model="tableData.listData.search.build_id" clearable placeholder="请选择"
                        style="width:120px">
                        <el-option v-for="(item, index) in mainData.buildIdList" :key="index" :label="item.label"
                            :value="item.value">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="楼层编号">
                    <el-select v-model="tableData.listData.search.layer_id" clearable placeholder="请选择"
                        style="width:120px">
                        <el-option v-for="(item, index) in mainData.layerIdList" :key="index" :label="item.label"
                            :value="item.value">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="基站编号">
                    <el-input-number :precision="0" :step="1" :min="0" v-model.trim="tableData.listData.search.bts_id"
                        auto-complete="off" style="width:150px"></el-input-number>
                </el-form-item>
                <el-form-item label="使能标识">
                    <el-select v-model="tableData.listData.search.enable_flag" clearable placeholder="请选择"
                        style="width:100px">
                        <el-option key=0 label="停用" :value=0></el-option>
                        <el-option key=1 label="启用" :value=1></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="基站状态">
                    <el-select v-model="tableData.listData.search.status" clearable placeholder="请选择"
                        style="width:100px">
                        <el-option v-for="(item, index) in mainData.btsStatusList" :key="index" :label="item.label"
                            :value="item.value">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="载波编号">
                    <el-select v-model="tableData.listData.search.carrier_id" clearable placeholder="请选择"
                        style="width:100px">
                        <el-option v-for="(item, index) in mainData.carrierIdList" :key="index" :label="item.label"
                            :value="item.value">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="基站时隙">
                    <el-select v-model="tableData.listData.search.timeslot" clearable placeholder="请选择"
                        style="width:100px">
                        <el-option v-for="(item, index) in mainData.timeslotList" :key="index" :label="item.label"
                            :value="item.value">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" @click="hGetBaseParam">查询</el-button>
                    <el-button type="success" @click="openAddDlg">新增</el-button>
                </el-form-item>
            </el-form>
        </app-search>
        <app-table pagination paginationAlign="right" table :tableData="tableData.listData"
            :handlePageSizeChange="handlePageSizeChange" :handlePageNumChange="handlePageNumChange">
            <template slot="table-column">
                <el-table-column label="操作" header-align="center" width="100" testalign="center">
                    <template slot-scope="scope">
                        <el-dropdown>
                            <span class="el-dropdown-link">
                                操作<i class="el-icon-arrow-down el-icon--right"></i>
                            </span>
                            <el-dropdown-menu>
                                <el-dropdown-item @click.native="openUpdateDlg(scope.row)">修改基本参数</el-dropdown-item>
                                <hr />
                                <el-dropdown-item @click.native="openDeviceDlg(scope.row)">查看设备参数</el-dropdown-item>
                                <el-dropdown-item @click.native="openNetDlg(scope.row)">查看网管参数</el-dropdown-item>
                                <el-dropdown-item @click.native="openSyncDlg(scope.row)">查看同步参数</el-dropdown-item>
                                <el-dropdown-item @click.native="openSyncTimerDlg(scope.row)"
                                    v-if="scope.row.bts_type == 2">查看定时参数</el-dropdown-item>
                                <el-dropdown-item @click.native="openGainDlg(scope.row)"
                                    v-if="scope.row.bts_type == 1">查看增益参数</el-dropdown-item>
                                <el-dropdown-item @click.native="openInstallDlg(scope.row)">查看安装参数</el-dropdown-item>
                                <el-dropdown-item @click.native="openBtsDlg(scope.row)">查看基站参数</el-dropdown-item>
                                <el-dropdown-item @click.native="openLocationDlg(scope.row)"
                                    v-if="scope.row.bts_type == 1">查看定位类型</el-dropdown-item>
                                <hr />
                                <el-dropdown-item @click.native="hSaveBtsParam(scope.row)">远程保存参数</el-dropdown-item>
                                <el-dropdown-item @click.native="hResetBts(scope.row)">远程重启设备</el-dropdown-item>
                                <el-dropdown-item @click.native="hOpenUpgradeDlg(scope.row)">远程升级软件</el-dropdown-item>
                                <hr />
                                <el-dropdown-item @click.native="deleteBaseParam(scope.row)">删除基站参数</el-dropdown-item>
                            </el-dropdown-menu>
                        </el-dropdown>
                    </template>
                </el-table-column>
            </template>
        </app-table>

        <!--基本参数-->
        <el-dialog width="55%" v-drag-dialog :title="dialogData.editData.title" center
            :visible.sync="dialogData.editData.show" :modal-append-to-body="false" custom-class="editDataDialog"
            :close-on-click-modal="false" :close-on-press-escape="false">
            <base-param-dlg :isUpdate="dialogData.editData.isUpdate" :id="dialogData.editData.id" @get="hGetData"
                @close="hClose" v-if="dialogData.editData.show" />
        </el-dialog>

        <!--设备参数-->
        <el-dialog width="55%" v-drag-dialog :title="dialogData.deviceDlg.title" center
            :visible.sync="dialogData.deviceDlg.show" :modal-append-to-body="false" custom-class="editDataDialog"
            :close-on-click-modal="false" :close-on-press-escape="false">
            <device-param-dlg :isUpdate="dialogData.deviceDlg.isUpdate" :id="dialogData.deviceDlg.id" @get="hGetData"
                @close="hCloseDeviceDlg" v-if="dialogData.deviceDlg.show" />
        </el-dialog>

        <!--网管参数-->
        <el-dialog width="55%" v-drag-dialog :title="dialogData.netDlg.title" center
            :visible.sync="dialogData.netDlg.show" :modal-append-to-body="false" custom-class="editDataDialog"
            :close-on-click-modal="false" :close-on-press-escape="false">
            <net-param-dlg :isUpdate="dialogData.netDlg.isUpdate" :id="dialogData.netDlg.id" @get="hGetData"
                @close="hCloseNetDlg" v-if="dialogData.netDlg.show" />
        </el-dialog>

        <!--同步参数-->
        <el-dialog width="55%" v-drag-dialog :title="dialogData.syncDlg.title" center
            :visible.sync="dialogData.syncDlg.show" :modal-append-to-body="false" custom-class="editDataDialog"
            :close-on-click-modal="false" :close-on-press-escape="false">
            <sync-param-dlg :isUpdate="dialogData.syncDlg.isUpdate" :id="dialogData.syncDlg.id" @get="hGetData"
                @close="hCloseSyncDlg" v-if="dialogData.syncDlg.show" />
        </el-dialog>

        <!--同步定时-->
        <el-dialog width="55%" v-drag-dialog :title="dialogData.syncTimerDlg.title" center
            :visible.sync="dialogData.syncTimerDlg.show" :modal-append-to-body="false" custom-class="editDataDialog"
            :close-on-click-modal="false" :close-on-press-escape="false">
            <rtc-dlg :isUpdate="dialogData.syncTimerDlg.isUpdate" :id="dialogData.syncTimerDlg.id" @get="hGetData"
                @close="hCloseRtcDlg" v-if="dialogData.syncTimerDlg.show" />
        </el-dialog>

        <!--增益参数-->
        <el-dialog width="55%" v-drag-dialog :title="dialogData.gainDlg.title" center
            :visible.sync="dialogData.gainDlg.show" :modal-append-to-body="false" custom-class="editDataDialog"
            :close-on-click-modal="false" :close-on-press-escape="false">
            <gain-param-dlg :isUpdate="dialogData.gainDlg.isUpdate" :id="dialogData.gainDlg.id" @get="hGetData"
                @close="hCloseGainDlg" v-if="dialogData.gainDlg.show" />
        </el-dialog>

        <!--基站参数-->
        <el-dialog width="55%" v-drag-dialog :title="dialogData.btsDlg.title" center
            :visible.sync="dialogData.btsDlg.show" :modal-append-to-body="false" custom-class="editDataDialog"
            :close-on-click-modal="false" :close-on-press-escape="false">
            <bts-param-dlg :isUpdate="dialogData.btsDlg.isUpdate" :id="dialogData.btsDlg.id" @get="hGetData"
                @close="hCloseBtsDlg" v-if="dialogData.btsDlg.show" />
        </el-dialog>

        <!--安装参数-->
        <el-dialog width="55%" v-drag-dialog :title="dialogData.installDlg.title" center
            :visible.sync="dialogData.installDlg.show" :modal-append-to-body="false" custom-class="editDataDialog"
            :close-on-click-modal="false" :close-on-press-escape="false">
            <install-param-dlg :isUpdate="dialogData.installDlg.isUpdate" :id="dialogData.installDlg.id" @get="hGetData"
                @close="hCloseInstallDlg" v-if="dialogData.installDlg.show" />
        </el-dialog>

        <!--定位类型-->
        <el-dialog width="55%" v-drag-dialog :title="dialogData.locationDlg.title" center
            :visible.sync="dialogData.locationDlg.show" :modal-append-to-body="false" custom-class="editDataDialog"
            :close-on-click-modal="false" :close-on-press-escape="false">
            <location-dlg :isUpdate="dialogData.locationDlg.isUpdate" :id="dialogData.locationDlg.id" @get="hGetData"
                @close="hCloseLocationDlg" v-if="dialogData.locationDlg.show" />
        </el-dialog>

        <!--远程升级-->
        <el-dialog width="55%" v-drag-dialog :title="dialogData.upgradeDlg.title" center
            :visible.sync="dialogData.upgradeDlg.show" :modal-append-to-body="false" custom-class="editDataDialog"
            :close-on-click-modal="false" :close-on-press-escape="false">
            <upgrade-dlg :isUpdate="dialogData.upgradeDlg.isUpdate" :id="dialogData.upgradeDlg.id" @get="hGetData"
                @close="hCloseUpgradeDlg" v-if="dialogData.upgradeDlg.show" />
        </el-dialog>
    </div>
</template>


<script>
import { deleteBtsBaseParam, getBtsBaseParamPageList, saveBtsOamParam, resetBts } from "@/api/bparam"
import { genCarrierIdList, genTimeslotList, genBuildIdList, genLayerIdList, genBlockIdList, genLocationTypeIdList, genBtsStatusList, genBtsTypeList } from "./basestaticdata.js"
import BaseParamDlg from "./component/baseparamdlg.vue"
import DeviceParamDlg from "./component/deviceparamdlg.vue"
import NetParamDlg from "./component/netparamdlg.vue"
import SyncParamDlg from "./component/syncparamdlg.vue"
import GainParamDlg from "./component/gainparamdlg.vue"
import BtsParamDlg from "./component/btsparamdlg.vue"
import InstallParamDlg from "./component/installparamdlg.vue"
import LocationDlg from "./component/locationdlg.vue"
import RtcDlg from "./component/rtcdlg.vue"
import UpgradeDlg from "./component/upgradedlg.vue"

export default {
    name: 'baseparam',
    components: {
        BaseParamDlg,
        DeviceParamDlg,
        NetParamDlg,
        SyncParamDlg,
        GainParamDlg,
        BtsParamDlg,
        InstallParamDlg,
        LocationDlg,
        RtcDlg,
        UpgradeDlg
    },
    data: function () {
        return {
            tableData: {
                listData: {
                    loading: false,
                    disabled: false,
                    totalCount: 0,
                    pageNum: 1,
                    pageSize: this.$store.getters.pageSize,
                    search: {
                        project_id: '',//项目编号
                        bts_id: 0,//基站ID
                        enable_flag: null,
                        status: 0,//设备状态
                        carrier_id: 0,//载波ID
                        timeslot: 0,//时隙
                        build_id: 0,
                        layer_id: 0,
                    },
                    columns: [
                        { key: 'project_id', name: '项目编号', width: 100 },
                        { key: 'bts_id', name: '基站ID', width: 100 },
                        { key: 'bts_type', name: '类型', width: 80 },
                        { key: 'soft_version', name: '版本', width: 80 },
                        { key: 'enable_flag', name: '使能', width: 80 },
                        { key: 'status', name: '状态', width: 80 },
                        { key: 'carrier_id', name: '载波', width: 80 },
                        { key: 'timeslot', name: '时隙', width: 80 },
                        { key: 'build_id', name: '大楼', width: 100 },
                        { key: 'layer_id', name: '楼层', width: 80 },
                        { key: 'coord_x', name: 'X坐标', width: 100 },
                        { key: 'coord_y', name: 'Y坐标', width: 100 },
                        { key: 'coord_z', name: 'Z坐标', width: 100 },
                        { key: 'position', name: '安装位置' },
                    ],
                    formatter: {
                        'project_id': this.formatProjectId,
                        'bts_type': this.formatBtsType,
                        'enable_flag': this.formatEnableFlag,
                        'status': this.formatStatus,
                        'carrier_id': this.formatCarrierId,
                        'timeslot': this.formatTimeslot,
                        'build_id': this.formatBuildId,
                        'layer_id': this.formatLayerId,
                        'coord_x': this.formatCoordX,
                        'coord_y': this.formatCoordY,
                        'coord_z': this.formatCoordZ,
                    },
                    items: [],
                }
            },
            dialogData: {
                editData: {
                    show: false,
                    title: '新增基站参数',
                    isUpdate: false,
                    id: 0,
                },
                deviceDlg: {
                    show: false,
                    title: '设备参数',
                    isUpdate: false,
                    id: 0,
                },
                netDlg: {
                    show: false,
                    title: '网管参数',
                    isUpdate: false,
                    id: 0,
                },
                syncDlg: {
                    show: false,
                    title: '同步参数',
                    isUpdate: false,
                    id: 0,
                },
                syncTimerDlg: {
                    show: false,
                    title: '同步定时参数',
                    isUpdate: false,
                    id: 0,
                },
                gainDlg: {
                    show: false,
                    title: '增益参数',
                    isUpdate: false,
                    id: 0,
                },
                btsDlg: {
                    show: false,
                    title: '基站参数',
                    isUpdate: false,
                    id: 0,
                },
                installDlg: {
                    show: false,
                    title: '安装参数',
                    isUpdate: false,
                    id: 0,
                },
                locationDlg: {
                    show: false,
                    title: '定位类型',
                    isUpdate: false,
                    id: 0,
                },
                upgradeDlg: {
                    show: false,
                    title: '远程升级软件',
                    isUpdate: false,
                    id: 0,
                }
            },
            mainData: {
                carrierIdList: genCarrierIdList(),//基站载波列表
                timeslotList: genTimeslotList(),//基站时隙列表
                buildIdList: genBuildIdList(),//大楼编号列表
                layerIdList: genLayerIdList(),//楼层列表
                blockIdList: genBlockIdList(),
                locationTypeIdList: genLocationTypeIdList(),
                btsStatusList: genBtsStatusList(),//基站在线状态
                btsTypeList: genBtsTypeList()//基站类型
            }
        }
    },
    watch: {
        updateTime(val, old) { //监听到改变后，重新初始化组件
            this.init()
        }
    },
    computed: {
        controlSize() {
            return this.$store.getters.controlSize
        }
    },
    beforeMount() {
    },
    mounted() {
        this.$nextTick(function () {
            this.init()
        })
    },
    methods: {
        init() {
            this.getBtsBaseParamPageList()
        },
        hGetData() {
            this.getBtsBaseParamPageList()
        },
        formatProjectId(row) {
            const projectId = row.project_id
            let hexStr = projectId.toString(16);
            return hexStr.toUpperCase().padStart(8, '0');
        },
        formatBtsType(row) {
            let str = ""
            this.mainData.btsTypeList.forEach((item) => {
                if (row.bts_type === item.value) {
                    str = item.label
                }
            })
            return str
        },
        formatEnableFlag(row) {
            let str = ""
            if (row.enable_flag == 1) {
                str = '启用'
            } else {
                str = '停用'
            }
            return str
        },
        formatStatus(row) {
            return this.formatId(row.status, this.mainData.btsStatusList)
        },
        formatId(row_id, dataList) {
            let strText = ""
            for (let i = 0; i < dataList.length; i++) {
                let item = dataList[i]
                if (row_id === item.value) {
                    strText = item.label
                    break
                }
            }

            return strText
        },
        formatCarrierId(row) {
            return this.formatId(row.carrier_id, this.mainData.carrierIdList)
        },
        formatTimeslot(row) {
            return this.formatId(row.timeslot, this.mainData.timeslotList)
        },
        formatBuildId(row) {
            return this.formatId(row.build_id, this.mainData.buildIdList)
        },
        formatLayerId(row) {
            return this.formatId(row.layer_id, this.mainData.layerIdList)
        },
        formatCoord(row) {
            let coord = 0.0
            coord = parseFloat(row) / 100
            return coord.toFixed(2) + '米'
        },
        formatCoordX(row) {
            return this.formatCoord(row.coord_x)
        },
        formatCoordY(row) {
            return this.formatCoord(row.coord_y)
        },
        formatCoordZ(row) {
            return this.formatCoord(row.coord_z)
        },
        getBtsBaseParamPageList() {//获得项目资料
            let pageNum = this.tableData.listData.pageNum
            let pageSize = this.tableData.listData.pageSize
            let search = {}
            let itemId = 0

            const projectId = parseInt(this.tableData.listData.search.project_id, 16)
            if (projectId >= 1000) {
                search.project_id = projectId
            }

            itemId = parseInt(this.tableData.listData.search.bts_id)
            if (itemId > 0) {
                search.bts_id = itemId
            }

            itemId = parseInt(this.tableData.listData.search.enable_flag)
            if (itemId >= 0) {
                search.enable_flag = itemId
            }

            itemId = parseInt(this.tableData.listData.search.status)
            if (itemId > 0) {
                search.status = itemId
            }

            itemId = parseInt(this.tableData.listData.search.carrier_id)
            if (itemId > 0) {
                search.carrier_id = itemId
            }

            itemId = parseInt(this.tableData.listData.search.timeslot)
            if (itemId > 0) {
                search.timeslot = itemId
            }

            itemId = parseInt(this.tableData.listData.search.build_id)
            if (itemId > 0) {
                search.build_id = itemId
            }

            itemId = parseInt(this.tableData.listData.search.layer_id)
            if (itemId > 0) {
                search.layer_id = itemId
            }

            itemId = parseInt(this.tableData.listData.search.block_id)
            if (itemId > 0) {
                search.block_id = itemId
            }

            //查询数据
            let param = { page_num: pageNum, page_size: pageSize, search: search, order_by: "id desc" }
            this.tableData.listData.loading = true
            getBtsBaseParamPageList(param).then((res) => {
                this.tableData.listData.totalCount = res.data.total_count
                this.tableData.listData.items = res.data.items
                this.tableData.listData.loading = false
            }).catch((err) => {
                //this.$message({ message: err, type: 'error' })
                this.tableData.listData.loading = false
            })
        },
        handlePageSizeChange(val) { // 每页记录条数改变的事件
            //保存修改的PageSize
            this.$store.commit('app/setPageSize', val)

            //如果（每页记录条数改变后重新计算的总页数>=当前页），表示每页记录条数改变后，当前页不会改变，此处需要刷新table数据
            //如果（当前页*每页记录条数<=总记录条数），表示每页记录条数改变后，当前页不会改变，此处需要刷新table数据
            //如果（当前页*每页记录条数>总记录条数），表示每页记录条数改变后，当前页会重新计算并改变，handlePageNumChange会被调用，此处不需要刷新table数据
            var totalCount = this.tableData.listData.totalCount
            var pageNum = this.tableData.listData.pageNum
            var pageSize = this.tableData.listData.pageSize
            var pageCount = totalCount % pageSize === 0 ? totalCount / pageSize : Math.floor((totalCount / pageSize) + 1)
            if ((pageCount >= pageNum) || (pageNum * pageSize <= totalCount)) {
                this.getBtsBaseParamPageList()
            }
        },
        handlePageNumChange(val) { // 当前页改变的事件，需要在此事件中刷新table数据
            this.tableData.listData.pageNum = val
            this.getBtsBaseParamPageList()
        },
        hGetBaseParam() {
            this.getBtsBaseParamPageList()
        },
        hClose() {//关闭对话框
            this.dialogData.editData.show = false
        },
        openAddDlg() {//打开新增窗口
            this.dialogData.editData.isUpdate = false
            this.dialogData.editData.title = '新增基站基本参数'
            this.dialogData.editData.show = true
        },
        openUpdateDlg(item) {//打开修改窗口
            this.dialogData.editData.id = parseInt(item.id)

            this.dialogData.editData.isUpdate = true
            this.dialogData.editData.title = '修改基站基本参数'
            this.dialogData.editData.show = true
        },
        async deleteBaseParam(item) {//删除
            let paramData = {}

            const res = await this.$confirm("确定要删除吗", "提示", { type: "warning" }).catch(err => err)
            if (res != 'confirm') {
                return
            }

            paramData["id"] = parseInt(item.id)
            deleteBtsBaseParam(paramData).then((res) => {
                this.$message.success('删除成功', '提示')
                this.getBtsBaseParamPageList()
            }).catch((err) => {
                //this.$message({ message: err, type: 'error' })
            })
        },
        openDeviceDlg(item) {//打开设备参数窗口
            this.dialogData.deviceDlg.id = parseInt(item.id)

            this.dialogData.deviceDlg.isUpdate = true
            this.dialogData.deviceDlg.show = true
        },
        hCloseDeviceDlg() {//关闭对话框
            this.dialogData.deviceDlg.show = false
        },
        openNetDlg(item) {//打开网管参数窗口
            this.dialogData.netDlg.id = parseInt(item.id)

            this.dialogData.netDlg.isUpdate = true
            this.dialogData.netDlg.show = true
        },
        hCloseNetDlg() {//关闭对话框
            this.dialogData.netDlg.show = false
        },
        openSyncDlg(item) {//打开同步参数窗口
            this.dialogData.syncDlg.id = parseInt(item.id)

            this.dialogData.syncDlg.isUpdate = true
            this.dialogData.syncDlg.show = true
        },
        hCloseSyncDlg() {//关闭对话框
            this.dialogData.syncDlg.show = false
        },
        openSyncTimerDlg(item) {//打开同步定时参数窗口
            this.dialogData.syncTimerDlg.id = parseInt(item.id)

            this.dialogData.syncTimerDlg.isUpdate = true
            this.dialogData.syncTimerDlg.show = true
        },
        hCloseRtcDlg() {//关闭同步定时对话框
            this.dialogData.syncTimerDlg.show = false
        },
        openGainDlg(item) {//打开同步参数窗口
            this.dialogData.gainDlg.id = parseInt(item.id)
            this.dialogData.gainDlg.isUpdate = true
            this.dialogData.gainDlg.show = true
        },
        hCloseGainDlg() {//关闭对话框
            this.dialogData.gainDlg.show = false
        },
        openBtsDlg(item) {//打开基站参数窗口
            this.dialogData.btsDlg.id = parseInt(item.id)
            this.dialogData.btsDlg.isUpdate = true
            this.dialogData.btsDlg.show = true
        },
        hCloseBtsDlg() {//关闭对话框
            this.dialogData.btsDlg.show = false
        },
        openInstallDlg(item) {//打开安装参数窗口
            this.dialogData.installDlg.id = parseInt(item.id)
            this.dialogData.installDlg.isUpdate = true
            this.dialogData.installDlg.show = true
        },
        hCloseInstallDlg() {//关闭对话框
            this.dialogData.installDlg.show = false
        },
        openLocationDlg(item) {//打开定位类型窗口
            this.dialogData.locationDlg.id = parseInt(item.id)
            this.dialogData.locationDlg.isUpdate = true
            this.dialogData.locationDlg.show = true
        },
        hCloseLocationDlg() {//关闭对话框
            this.dialogData.locationDlg.show = false
        },
        async hSaveBtsParam(item) {

            const res = await this.$confirm("确定要保存参数吗", "提示", { type: "warning" }).catch(err => err)
            if (res != 'confirm') {
                return
            }

            let paramData = {}
            if (item.bts_id < 1000) {
                this.$message({ message: '基站ID错误', type: 'error' })
                return
            }
            paramData['bts_id'] = item.bts_id
            paramData['save_param'] = 0

            saveBtsOamParam(paramData).then((res) => {
                if (res.data.save_param == 1) {
                    this.$message({ message: '保存参数成功', type: 'success' })
                } else {
                    this.$message({ message: '保存参数失败', type: 'error' })
                }
            }).catch((err) => {
                this.$message({ message: err, type: 'error' })
            })
        },
        async hResetBts(item) {
            const res = await this.$confirm("确定要重启基站吗", "提示", { type: "warning" }).catch(err => err)
            if (res != 'confirm') {
                return
            }

            let paramData = {}
            if (item.bts_id < 1000) {
                this.$message({ message: '基站ID错误', type: 'error' })
                return
            }
            paramData['bts_id'] = item.bts_id
            paramData['reset_bts'] = 0

            resetBts(paramData).then(() => {
                this.$message({ message: '基站重启中，请稍后再操作', type: 'success' })
            }).catch((err) => {
                this.$message({ message: err, type: 'error' })
            })
        },
        //打开升级对话框
        hOpenUpgradeDlg(item) {
            this.dialogData.upgradeDlg.id = parseInt(item.id)
            this.dialogData.upgradeDlg.isUpdate = true
            this.dialogData.upgradeDlg.show = true
        },
        hCloseUpgradeDlg() {//关闭对话框
            this.dialogData.upgradeDlg.show = false
        },
    }
}

</script>
