<template>
    <div class="default-main device-manage" :style="{ height: pageHeight.height }" v-loading="loading">
        <splitpanes style="height: 100%" class="default-theme" id="navigation-splitpanes">
            <pane :size="size">
                <Terminal ref="TerminalRef" @node-click="nodeClick" @init="nodeClick"></Terminal>
            </pane>
            <pane style="background: #fff">
                <div class="device-manage-right">
                    <el-form :inline="true" class="demo-form-inline" style="height: 42px">
                        <el-form-item style="position: relative; z-index: 2" v-if="plevel != 7">
                            <el-button icon="el-icon-Plus" type="primary" @click="add" v-if="!VITE_FLAG">
                                {{
                                    nodeLevel1 == 200
                                        ? '新增供电公司'
                                        : nodeLevel1 == 300
                                        ? '新增变电站'
                                        : nodeLevel1 == 400
                                        ? '新增终端'
                                        : nodeLevel1 == 500
                                        ? '新增母线'
                                        : nodeLevel1 >= 600
                                        ? '新增监测点'
                                        : '新增'
                                }}
                            </el-button>
                            <el-button icon="el-icon-Edit" type="primary" @click="update" v-if="plevel != 7">
                                修改
                            </el-button>
                            <el-button icon="el-icon-Close" type="danger" @click="remove" v-if="plevel != 7">
                                删除
                            </el-button>
                            <el-button
                                icon="el-icon-Right"
                                :disabled="nextfalg"
                                type="primary"
                                @click="next"
                                v-if="nodeLevel <= 700 && pageStatus == 2"
                            >
                                下一步
                            </el-button>
                            <el-button
                                type="info"
                                @click="black"
                                icon="el-icon-Back"
                                v-if="nodeLevel <= 700 && (pageStatus == 2 || pageStatus == 3)"
                            >
                                撤 销
                            </el-button>
                            <el-button icon="el-icon-Check" type="primary" v-if="pageStatus == 2" @click="onsubmit">
                                确认提交
                            </el-button>
                            <el-button icon="el-icon-Check" type="primary" v-if="pageStatus == 3" @click="onsubmit">
                                修改提交
                            </el-button>
                        </el-form-item>
                        <el-form-item style="right: 500px; position: absolute; overflow: hidden">
                            <LocationInformation
                                style="width: 16px; margin-right: 8px; color: var(--el-color-primary)"
                            />
                            <span style="font-size: 16px; font-weight: bold; color: var(--el-color-primary)">
                                当前操作节点：
                            </span>
                        </el-form-item>
                        <el-form-item style="right: 0; position: absolute; overflow: hidden">
                            <div class="title" :class="titleList.length > 5 ? 'titleScroll' : ''">
                                <span v-for="(item, index) in titleList">{{ index == 0 ? '' : ' >　' }}{{ item }}</span>
                            </div>
                        </el-form-item>
                    </el-form>
                    <div id="scrollBox" :style="{ height: Height.height }" style="overflow-y: auto">
                        <el-form
                            class="main-form overview_scroll"
                            :label-position="'right'"
                            :model="AddProjectBO"
                            label-width="120px"
                            :inline="true"
                            ref="mainForm"
                        >
                            <el-form-item
                                id="id100"
                                class="form-item"
                                label="项目名称:"
                                :prop="'projectParam.name'"
                                v-if="
                                    AddProjectBO.projectParam &&
                                    ((pageStatus != 3 && nodeLevel > 0 && (nodeLevel <= 700 || pageStatus == 2)) ||
                                        (nodeLevel > 0 && (nodeLevel <= 700 || pageStatus == 3)))
                                "
                                :rules="{ required: true, message: '请输入项目名称', trigger: 'blur' }"
                            >
                                <el-select
                                    filterable
                                    v-model="AddProjectBO.projectParam.name"
                                    :disabled="
                                        nodeLevel > 100 && (pageStatus == 3 || pageStatus == 2)
                                            ? pageStatus == 3 || pageStatus == 2
                                            : pageStatus == 1
                                    "
                                    placeholder="请选择项目类型"
                                >
                                    <el-option
                                        v-for="item in project"
                                        :key="item.name"
                                        :label="item.name"
                                        :value="item.value"
                                    ></el-option>
                                </el-select>
                            </el-form-item>
                            <el-form-item
                                id="id100"
                                class="form-item"
                                label="项目排序:"
                                :prop="'projectParam.sort'"
                                v-if="
                                    AddProjectBO.projectParam &&
                                    ((pageStatus != 3 && nodeLevel > 0 && (nodeLevel <= 700 || pageStatus == 2)) ||
                                        (nodeLevel > 0 && (nodeLevel <= 700 || pageStatus == 3)))
                                "
                                :rules="{ required: true, message: '请输入排序', trigger: 'blur' }"
                            >
                                <el-input
                                    v-model="AddProjectBO.projectParam.sort"
                                    :disabled="
                                        nodeLevel > 100 && (pageStatus == 3 || pageStatus == 2)
                                            ? pageStatus == 3 || pageStatus == 2
                                            : pageStatus == 1
                                    "
                                    placeholder="请输入排序"
                                ></el-input>
                            </el-form-item>
                            <el-form-item
                                id="id200"
                                class="form-item"
                                label="行政区域:"
                                :prop="'provinceParam.name'"
                                v-if="
                                    AddProjectBO.provinceParam &&
                                    ((pageStatus != 3 && nodeLevel > 100 && (nodeLevel <= 700 || pageStatus == 2)) ||
                                        (nodeLevel > 0 && (nodeLevel <= 700 || pageStatus == 3)))
                                "
                                :rules="[{ required: true, message: '请选择行政区域', trigger: 'change' }]"
                            >
                                <el-select
                                    filterable
                                    v-model="AddProjectBO.provinceParam.name"
                                    placeholder="请选择行政区域"
                                    style="width: 100%"
                                    :disabled="
                                        nodeLevel > 200 && (pageStatus == 3 || pageStatus == 2)
                                            ? pageStatus == 3 || pageStatus == 2
                                            : pageStatus == 1
                                    "
                                >
                                    <el-option
                                        v-for="item in treeOptions"
                                        :key="item.id"
                                        :label="item.name"
                                        :value="item.id"
                                    ></el-option>
                                </el-select>
                            </el-form-item>
                            <el-form-item
                                id="id200"
                                class="form-item"
                                label="区域排序:"
                                :prop="'provinceParam.sort'"
                                v-if="
                                    AddProjectBO.provinceParam &&
                                    ((pageStatus != 3 && nodeLevel > 100 && (nodeLevel <= 700 || pageStatus == 2)) ||
                                        (nodeLevel > 0 && (nodeLevel <= 700 || pageStatus == 3)))
                                "
                                :rules="[{ required: true, message: '请输入排序', trigger: 'change' }]"
                            >
                                <el-input
                                    v-model="AddProjectBO.provinceParam.sort"
                                    :disabled="
                                        nodeLevel > 200 && (pageStatus == 3 || pageStatus == 2)
                                            ? pageStatus == 3 || pageStatus == 2
                                            : pageStatus == 1
                                    "
                                    placeholder="请输入排序"
                                ></el-input>
                            </el-form-item>
                            <el-form-item
                                id="id300"
                                class="form-item"
                                label="供电公司:"
                                :prop="'gdInformationParam.name'"
                                v-if="
                                    AddProjectBO.gdInformationParam &&
                                    ((pageStatus != 3 && nodeLevel > 100 && (nodeLevel <= 700 || pageStatus == 2)) ||
                                        (nodeLevel > 0 && (nodeLevel <= 700 || pageStatus == 3)))
                                "
                                :rules="[{ required: true, message: '请输入供电公司', trigger: 'blur' }]"
                            >
                                <el-input
                                    v-model="AddProjectBO.gdInformationParam.name"
                                    :disabled="
                                        nodeLevel > 300 && (pageStatus == 3 || pageStatus == 2)
                                            ? pageStatus == 3 || pageStatus == 2
                                            : pageStatus == 1
                                    "
                                    placeholder="请输入供电公司"
                                ></el-input>
                            </el-form-item>
                            <el-form-item
                                id="id300"
                                class="form-item"
                                label="公司排序:"
                                :prop="'gdInformationParam.sort'"
                                v-if="
                                    AddProjectBO.gdInformationParam &&
                                    ((pageStatus != 3 && nodeLevel > 200 && (nodeLevel <= 700 || pageStatus == 2)) ||
                                        (nodeLevel > 0 && (nodeLevel <= 700 || pageStatus == 3)))
                                "
                                :rules="[{ required: true, message: '请输入排序', trigger: 'blur' }]"
                            >
                                <el-input
                                    v-model="AddProjectBO.gdInformationParam.sort"
                                    :disabled="
                                        nodeLevel > 300 && (pageStatus == 3 || pageStatus == 2)
                                            ? pageStatus == 3 || pageStatus == 2
                                            : pageStatus == 1
                                    "
                                    placeholder="请输入排序"
                                ></el-input>
                            </el-form-item>
                            <!--变电站((pageStatus != 3 &&(nodeLevel > 300 && (nodeLevel &lt; 700 || pageStatus == 2))) || (pageStatus == 3 && nodeLevel == 400))-->

                            <div
                                style="width: 100%"
                                v-if="
                                    AddProjectBO.subStationParam &&
                                    ((pageStatus != 3 && nodeLevel > 300 && (nodeLevel <= 700 || pageStatus == 2)) ||
                                        (nodeLevel > 0 && (nodeLevel <= 700 || pageStatus == 3)))
                                "
                            >
                                <el-form-item
                                    class="form-item"
                                    label="变电站:"
                                    :prop="'subStationParam.name'"
                                    v-if="VITE_FLAG"
                                    :rules="{ required: true, message: '请输入变电站名称', trigger: 'blur' }"
                                >
                                    <el-select
                                        filterable
                                        v-model="AddProjectBO.subStationParam.name"
                                        placeholder="请选择变电站"
                                        @change="subStationChange"
                                        :disabled="
                                            nodeLevel > 400 && (pageStatus == 3 || pageStatus == 2)
                                                ? pageStatus == 3 || pageStatus == 2
                                                : pageStatus == 1
                                        "
                                    >
                                        <el-option
                                            v-for="item in powerStationList"
                                            :key="item.id"
                                            :label="item.name"
                                            :value="item.name"
                                        />
                                    </el-select>
                                </el-form-item>
                                <el-form-item
                                    class="form-item"
                                    label="变电站:"
                                    v-else
                                    :prop="'subStationParam.name'"
                                    :rules="{ required: true, message: '请输入变电站名称', trigger: 'blur' }"
                                >
                                    <el-input
                                        v-model="AddProjectBO.subStationParam.name"
                                        :disabled="
                                            nodeLevel > 400 && (pageStatus == 3 || pageStatus == 2)
                                                ? pageStatus == 3 || pageStatus == 2
                                                : pageStatus == 1
                                        "
                                        placeholder="请输入变电站名称"
                                    ></el-input>
                                </el-form-item>

                                <el-form-item
                                    class="form-item"
                                    label="经度:"
                                    :prop="'subStationParam.lng'"
                                    :rules="[{ required: true, validator: lngff, trigger: 'blur' }]"
                                >
                                    <el-input
                                        v-model="AddProjectBO.subStationParam.lng"
                                        :disabled="
                                            nodeLevel > 400 && (pageStatus == 3 || pageStatus == 2)
                                                ? pageStatus == 3 || pageStatus == 2
                                                : pageStatus == 1
                                        "
                                        placeholder="请输入经度"
                                    ></el-input>
                                </el-form-item>

                                <el-form-item
                                    class="form-item"
                                    label="纬度:"
                                    :prop="'subStationParam.lat'"
                                    :rules="[{ required: true, validator: latff, trigger: 'blur' }]"
                                >
                                    <el-input
                                        v-model="AddProjectBO.subStationParam.lat"
                                        :disabled="
                                            nodeLevel > 400 && (pageStatus == 3 || pageStatus == 2)
                                                ? pageStatus == 3 || pageStatus == 2
                                                : pageStatus == 1
                                        "
                                        placeholder="请输入纬度"
                                    ></el-input>
                                </el-form-item>

                                <el-form-item
                                    class="form-item"
                                    label="电压等级:"
                                    :prop="'subStationParam.scale'"
                                    :rules="[{ required: true, message: '选中电压等级', trigger: 'change' }]"
                                >
                                    <el-select
                                        filterable
                                        v-model="AddProjectBO.subStationParam.scale"
                                        :disabled="
                                            nodeLevel > 400 && (pageStatus == 3 || pageStatus == 2)
                                                ? pageStatus == 3 || pageStatus == 2
                                                : pageStatus == 1
                                        "
                                        placeholder="请选择电压等级"
                                    >
                                        <el-option
                                            v-for="item in voltageLevelArr"
                                            :key="item.name"
                                            :label="item.name"
                                            :value="item.id"
                                        ></el-option>
                                    </el-select>
                                </el-form-item>
                                <el-form-item
                                    class="form-item"
                                    label="排序:"
                                    :prop="'subStationParam.sort'"
                                    :rules="[{ required: true, message: '输入排序', trigger: 'change' }]"
                                >
                                    <el-input
                                        v-model="AddProjectBO.subStationParam.sort"
                                        :disabled="
                                            nodeLevel > 400 && (pageStatus == 3 || pageStatus == 2)
                                                ? pageStatus == 3 || pageStatus == 2
                                                : pageStatus == 1
                                        "
                                        placeholder="请输入排序"
                                    ></el-input>
                                </el-form-item>
                            </div>

                            <!--终端终端-->
                            <div
                                id="id500"
                                class="form-device"
                                v-if="
                                    (pageStatus != 3 && nodeLevel > 300 && (nodeLevel <= 700 || pageStatus == 2)) ||
                                    (pageStatus == 3 && 400 < nodeLevel && nodeLevel <= 700)
                                "
                            >
                                <el-tabs
                                    v-if="AddProjectBO.deviceParam && AddProjectBO.deviceParam.length"
                                    v-model="deviceIndex"
                                    type="card"
                                    :editable="pageStatus != 1"
                                    @edit="handleDeviceTabsEdit"
                                    @tab-click="tabChange('deviceIndex')"
                                >
                                    <el-tab-pane
                                        v-for="(item, index) in AddProjectBO.deviceParam"
                                        :key="index"
                                        :label="item.name ? item.name : '新建终端' + index"
                                        :name="index + ''"
                                    >
                                        <div class="flex mt10">
                                            <el-form-item
                                                class="form-item"
                                                label="名称:"
                                                :prop="'deviceParam.' + index + '.name'"
                                                :rules="[{ required: true, message: '请输入名称', trigger: 'blur' }]"
                                            >
                                                <el-input
                                                    v-model="item.name"
                                                    :disabled="
                                                        nodeLevel > 500 && (pageStatus == 3 || pageStatus == 2)
                                                            ? pageStatus == 3 || pageStatus == 2
                                                            : pageStatus == 1
                                                    "
                                                    placeholder="请输入名称"
                                                ></el-input>
                                            </el-form-item>
                                            <el-form-item
                                                class="form-item"
                                                label="通讯状态:"
                                                :prop="'deviceParam.' + index + '.comFlag'"
                                                :rules="[
                                                    { required: true, message: '请选择通讯状态', trigger: 'change' }
                                                ]"
                                            >
                                                <el-select
                                                    filterable
                                                    v-model="item.comFlag"
                                                    placeholder="请选择通讯状态"
                                                    :disabled="true"
                                                >
                                                    <el-option
                                                        v-for="option in comStatusArr"
                                                        :key="option.name"
                                                        :label="option.name"
                                                        :value="option.value"
                                                    ></el-option>
                                                </el-select>
                                            </el-form-item>
                                            <el-form-item
                                                class="form-item"
                                                label="通讯类型:"
                                                :prop="'deviceParam.' + index + '.frontType'"
                                                :rules="[
                                                    { required: true, message: '请选择通讯类型', trigger: 'change' }
                                                ]"
                                            >
                                                <el-select
                                                    filterable
                                                    v-model="item.frontType"
                                                    placeholder="请选择通讯类型"
                                                    :popper-append-to-body="false"
                                                    :disabled="
                                                        nodeLevel > 500 && (pageStatus == 3 || pageStatus == 2)
                                                            ? pageStatus == 3 || pageStatus == 2
                                                            : pageStatus == 1
                                                    "
                                                >
                                                    <el-option
                                                        v-for="option in comTypeStatusArr"
                                                        :key="option.id"
                                                        :label="option.name"
                                                        :value="option.id"
                                                    ></el-option>
                                                </el-select>
                                            </el-form-item>
                                            <el-form-item
                                                class="form-item"
                                                label="终端模型:"
                                                :prop="'deviceParam.' + index + '.devModel'"
                                                :rules="[
                                                    { required: true, message: '请选择终端模型', trigger: 'change' }
                                                ]"
                                            >
                                                <el-select
                                                    filterable
                                                    v-model="item.devModel"
                                                    placeholder="请选择终端模型"
                                                    :disabled="
                                                        nodeLevel > 500 && (pageStatus == 3 || pageStatus == 2)
                                                            ? pageStatus == 3 || pageStatus == 2
                                                            : pageStatus == 1
                                                    "
                                                >
                                                    <el-option
                                                        v-for="option in terminalModelArr"
                                                        :key="option.name"
                                                        :label="option.name"
                                                        :value="option.value"
                                                    ></el-option>
                                                </el-select>
                                            </el-form-item>
                                            <el-form-item
                                                class="form-item"
                                                label="数据模型:"
                                                :prop="'deviceParam.' + index + '.devDataType'"
                                                :rules="[
                                                    { required: true, message: '请选择数据模型', trigger: 'change' }
                                                ]"
                                            >
                                                <el-select
                                                    filterable
                                                    v-model="item.devDataType"
                                                    placeholder="请选择数据模型"
                                                    :disabled="
                                                        nodeLevel > 500 && (pageStatus == 3 || pageStatus == 2)
                                                            ? pageStatus == 3 || pageStatus == 2
                                                            : pageStatus == 1
                                                    "
                                                >
                                                    <el-option
                                                        v-for="option in dataModelArr"
                                                        :key="option.name"
                                                        :label="option.name"
                                                        :value="option.value"
                                                    ></el-option>
                                                </el-select>
                                            </el-form-item>
                                            <el-form-item
                                                class="form-item"
                                                label="厂家:"
                                                :prop="'deviceParam.' + index + '.manufacturer'"
                                                :rules="[{ required: true, message: '请选择厂家', trigger: 'change' }]"
                                            >
                                                <el-select
                                                    filterable
                                                    v-model="item.manufacturer"
                                                    placeholder="请选择厂家"
                                                    :popper-append-to-body="false"
                                                    :disabled="
                                                        nodeLevel > 500 && (pageStatus == 3 || pageStatus == 2)
                                                            ? pageStatus == 3 || pageStatus == 2
                                                            : pageStatus == 1
                                                    "
                                                >
                                                    <el-option
                                                        v-for="option in factoryArr"
                                                        :key="option.id"
                                                        :label="option.name"
                                                        :value="option.id"
                                                    ></el-option>
                                                </el-select>
                                            </el-form-item>
                                            <el-form-item
                                                class="form-item"
                                                label="所属前置机:"
                                                :prop="'deviceParam.' + index + '.nodeId'"
                                                :rules="[
                                                    { required: true, message: '请选择所属前置机', trigger: 'change' }
                                                ]"
                                            >
                                                <el-select
                                                    filterable
                                                    v-model="item.nodeId"
                                                    placeholder="请选择所属前置机"
                                                    :disabled="
                                                        nodeLevel > 500 && (pageStatus == 3 || pageStatus == 2)
                                                            ? pageStatus == 3 || pageStatus == 2
                                                            : pageStatus == 1
                                                    "
                                                    @change="item.processNum = ''"
                                                >
                                                    <el-option
                                                        v-for="option in affiliatiedFrontArr"
                                                        :key="option.id"
                                                        :label="option.name"
                                                        :value="option.id"
                                                    ></el-option>
                                                </el-select>
                                            </el-form-item>
                                            <!-- <el-form-item
                                                class="form-item"
                                                label="进程号:"
                                                :prop="'deviceParam.' + index + '.processNum'"
                                                :rules="[
                                                    { required: true, message: '请选择进程号', trigger: 'change' }
                                                ]"
                                            >
                                                <el-select
                                                    filterable
                                                    v-model="item.processNum"
                                                    placeholder="请选择进程号"
                                                    :disabled="
                                                        nodeLevel > 500 && (pageStatus == 3 || pageStatus == 2)
                                                            ? pageStatus == 3 || pageStatus == 2
                                                            : pageStatus == 1
                                                    "
                                                >
                                                    <el-option
                                                        v-for="item in affiliatiedFrontArr.find(
                                                            k => k.id == item.nodeId
                                                        ).maxProcessNum"
                                                        :key="item"
                                                        :label="item"
                                                        :value="item"
                                                    ></el-option>
                                                </el-select>
                                            </el-form-item> -->
                                            <el-form-item
                                                class="form-item"
                                                label="召唤标志:"
                                                :prop="'deviceParam.' + index + '.callFlag'"
                                                :rules="[
                                                    { required: true, message: '请选择召唤标志', trigger: 'change' }
                                                ]"
                                            >
                                                <el-select
                                                    filterable
                                                    v-model="item.callFlag"
                                                    placeholder="请选择召唤标志"
                                                    :disabled="
                                                        nodeLevel > 500 && (pageStatus == 3 || pageStatus == 2)
                                                            ? pageStatus == 3 || pageStatus == 2
                                                            : pageStatus == 1
                                                    "
                                                >
                                                    <el-option
                                                        v-for="option in summonSignArr"
                                                        :key="option.name"
                                                        :label="option.name"
                                                        :value="option.value"
                                                    ></el-option>
                                                </el-select>
                                            </el-form-item>
                                            <el-form-item
                                                class="form-item"
                                                label="识别码:"
                                                :prop="'deviceParam.' + index + '.series'"
                                            >
                                                <el-input
                                                    v-model="item.series"
                                                    :disabled="
                                                        nodeLevel > 500 && (pageStatus == 3 || pageStatus == 2)
                                                            ? pageStatus == 3 || pageStatus == 2
                                                            : pageStatus == 1
                                                    "
                                                    show-password
                                                    placeholder="请输入识别码"
                                                ></el-input>
                                            </el-form-item>
                                            <el-form-item
                                                class="form-item"
                                                label="密钥:"
                                                :prop="'deviceParam.' + index + '.devKey'"
                                            >
                                                <el-input
                                                    v-model="item.devKey"
                                                    :disabled="
                                                        nodeLevel > 500 && (pageStatus == 3 || pageStatus == 2)
                                                            ? pageStatus == 3 || pageStatus == 2
                                                            : pageStatus == 1
                                                    "
                                                    show-password
                                                    placeholder="请输入密钥"
                                                ></el-input>
                                            </el-form-item>
                                            <el-form-item
                                                class="form-item"
                                                label="电度功能"
                                                :prop="'deviceParam.' + index + '.electroplate'"
                                                :rules="[
                                                    { required: true, message: '请选择电度功能', trigger: 'change' }
                                                ]"
                                            >
                                                <el-select
                                                    filterable
                                                    v-model="item.electroplate"
                                                    placeholder="请选择电度功能"
                                                    :disabled="
                                                        nodeLevel > 500 && (pageStatus == 3 || pageStatus == 2)
                                                            ? pageStatus == 3 || pageStatus == 2
                                                            : pageStatus == 1
                                                    "
                                                >
                                                    <el-option
                                                        v-for="option in electroplateCanArr"
                                                        :key="option.name"
                                                        :label="option.name"
                                                        :value="option.value"
                                                    ></el-option>
                                                </el-select>
                                            </el-form-item>
                                            <el-form-item class="form-item" label="投运时间:">
                                                <el-date-picker
                                                    :popper-append-to-body="false"
                                                    type="date"
                                                    placeholder="选择日期"
                                                    format="YYYY-MM-DD"
                                                    style="width: 100%"
                                                    value-format="YYYY-MM-DD"
                                                    v-model="item.loginTime"
                                                    :disabled="
                                                        nodeLevel > 500 && (pageStatus == 3 || pageStatus == 2)
                                                            ? pageStatus == 3 || pageStatus == 2
                                                            : pageStatus == 1
                                                    "
                                                ></el-date-picker>
                                            </el-form-item>
                                            <el-form-item class="form-item" label="本次定检时间:">
                                                <el-date-picker
                                                    :popper-append-to-body="false"
                                                    type="date"
                                                    placeholder="选择日期"
                                                    format="YYYY-MM-DD"
                                                    style="width: 100%"
                                                    value-format="YYYY-MM-DD"
                                                    v-model="item.thisTimeCheck"
                                                    :disabled="
                                                        nodeLevel > 500 && (pageStatus == 3 || pageStatus == 2)
                                                            ? pageStatus == 3 || pageStatus == 2
                                                            : pageStatus == 1
                                                    "
                                                ></el-date-picker>
                                            </el-form-item>
                                            <el-form-item class="form-item" label="下次定检时间:">
                                                <el-date-picker
                                                    :popper-append-to-body="false"
                                                    type="date"
                                                    placeholder="选择日期"
                                                    format="YYYY-MM-DD"
                                                    style="width: 100%"
                                                    value-format="YYYY-MM-DD"
                                                    v-model="item.nextTimeCheck"
                                                    :disabled="
                                                        nodeLevel > 500 && (pageStatus == 3 || pageStatus == 2)
                                                            ? pageStatus == 3 || pageStatus == 2
                                                            : pageStatus == 1
                                                    "
                                                ></el-date-picker>
                                            </el-form-item>

                                            <el-form-item class="form-item" label="数据更新时间:">
                                                <el-date-picker
                                                    type="date"
                                                    placeholder="选择日期"
                                                    format="YYYY-MM-DD"
                                                    value-format="YYYY-MM-DD"
                                                    v-model="item.updateTime"
                                                    style="width: 100%"
                                                    :disabled="true"
                                                ></el-date-picker>
                                            </el-form-item>
                                            <el-form-item
                                                class="form-item"
                                                label="终端型号:"
                                                :prop="'deviceParam.' + index + '.devType'"
                                                :rules="[
                                                    { required: true, message: '请选择终端型号', trigger: 'change' }
                                                ]"
                                            >
                                                <el-select
                                                    filterable
                                                    v-model="item.devType"
                                                    placeholder="请选择终端型号"
                                                    :disabled="
                                                        nodeLevel > 500 && (pageStatus == 3 || pageStatus == 2)
                                                            ? pageStatus == 3 || pageStatus == 2
                                                            : pageStatus == 1
                                                    "
                                                >
                                                    <el-option
                                                        v-for="option in typeArr"
                                                        :key="option.id"
                                                        :label="option.name"
                                                        :value="option.id"
                                                    ></el-option>
                                                </el-select>
                                            </el-form-item>
                                            <el-form-item
                                                class="form-item"
                                                label="IP/MAC地址:"
                                                :prop="'deviceParam.' + index + '.ip'"
                                                :rules="[{ required: true, validator: arrdess, trigger: 'blur' }]"
                                            >
                                                <el-input
                                                    v-model="item.ip"
                                                    :disabled="
                                                        nodeLevel > 500 && (pageStatus == 3 || pageStatus == 2)
                                                            ? pageStatus == 3 || pageStatus == 2
                                                            : pageStatus == 1
                                                    "
                                                    placeholder="请输入IP/MAC地址"
                                                ></el-input>
                                            </el-form-item>
                                            <el-form-item
                                                class="form-item"
                                                label="端口号:"
                                                :prop="'deviceParam.' + index + '.port'"
                                                :rules="[{ required: true, message: '请输入端口号', trigger: 'blur' }]"
                                            >
                                                <el-input
                                                    v-model="item.port"
                                                    placeholder="请输入端口号"
                                                    :disabled="
                                                        nodeLevel > 500 && (pageStatus == 3 || pageStatus == 2)
                                                            ? pageStatus == 3 || pageStatus == 2
                                                            : pageStatus == 1
                                                    "
                                                ></el-input>
                                            </el-form-item>
                                            <el-form-item class="form-item" label="合同号:">
                                                <el-input
                                                    v-model="item.contract"
                                                    placeholder="请输入合同号"
                                                    :disabled="
                                                        nodeLevel > 500 && (pageStatus == 3 || pageStatus == 2)
                                                            ? pageStatus == 3 || pageStatus == 2
                                                            : pageStatus == 1
                                                    "
                                                ></el-input>
                                            </el-form-item>
                                            <el-form-item class="form-item" label="ISM卡号:">
                                                <el-input
                                                    v-model="item.sim"
                                                    placeholder="请输入ISM卡号"
                                                    :disabled="
                                                        nodeLevel > 500 && (pageStatus == 3 || pageStatus == 2)
                                                            ? pageStatus == 3 || pageStatus == 2
                                                            : pageStatus == 1
                                                    "
                                                ></el-input>
                                            </el-form-item>
                                            <el-form-item
                                                class="form-item"
                                                label="排序:"
                                                :prop="'deviceParam.' + index + '.sort'"
                                                :rules="[{ required: true, message: '请输入排序', trigger: 'blur' }]"
                                            >
                                                <el-input
                                                    v-model="item.sort"
                                                    placeholder="请输入排序"
                                                    :disabled="
                                                        nodeLevel > 500 && (pageStatus == 3 || pageStatus == 2)
                                                            ? pageStatus == 3 || pageStatus == 2
                                                            : pageStatus == 1
                                                    "
                                                ></el-input>
                                            </el-form-item>
                                        </div>
                                    </el-tab-pane>
                                </el-tabs>
                            </div>

                            <!--母线-->
                            <div
                                style="width: 100%"
                                v-if="((pageStatus != 3 && (nodeLevel > 400 && (nodeLevel &lt;= 700 || pageStatus == 2))) |  (pageStatus == 3 && 400 < nodeLevel && nodeLevel &lt;= 700))"
                            >
                                <el-tabs
                                    v-if="
                                        AddProjectBO.deviceParam &&
                                        AddProjectBO.deviceParam.length &&
                                        AddProjectBO.deviceParam[deviceIndex] &&
                                        AddProjectBO.deviceParam[deviceIndex].subVoltageParam &&
                                        AddProjectBO.deviceParam[deviceIndex].subVoltageParam.length
                                    "
                                    v-model="busBarIndex"
                                    type="card"
                                    :editable="pageStatus != 1"
                                    @edit="handleBusBarTabsEdit"
                                    @tab-click="tabChange('busBarIndex')"
                                >
                                    <el-tab-pane
                                        v-for="(busItem, bIndex) in AddProjectBO.deviceParam[deviceIndex]
                                            .subVoltageParam"
                                        :key="bIndex"
                                        :label="busItem.name ? busItem.name : '新建母线' + bIndex"
                                        :name="bIndex + ''"
                                    >
                                        <div class="flex mt10">
                                            <el-form-item
                                                class="form-item"
                                                label="母线名称:"
                                                :prop="
                                                    'deviceParam.' +
                                                    [deviceIndex] +
                                                    '.subVoltageParam.' +
                                                    bIndex +
                                                    '.name'
                                                "
                                                :rules="{ required: true, message: '请输入母线名称', trigger: 'blur' }"
                                            >
                                                <el-input
                                                    v-model="busItem.name"
                                                    placeholder="请输入母线名称"
                                                    :disabled="
                                                        nodeLevel > 600 && (pageStatus == 3 || pageStatus == 2)
                                                            ? pageStatus == 3 || pageStatus == 2
                                                            : pageStatus == 1
                                                    "
                                                ></el-input>
                                            </el-form-item>
                                            <el-form-item
                                                class="form-item"
                                                label="母线编号:"
                                                :prop="
                                                    'deviceParam.' +
                                                    [deviceIndex] +
                                                    '.subVoltageParam.' +
                                                    bIndex +
                                                    '.num'
                                                "
                                                :rules="{ required: true, message: '请输入母线编号', trigger: 'blur' }"
                                            >
                                                <el-select
                                                    filterable
                                                    v-model="busItem.num"
                                                    placeholder="请选择母线编号"
                                                    :disabled="
                                                        nodeLevel > 600 && (pageStatus == 3 || pageStatus == 2)
                                                            ? pageStatus == 3 || pageStatus == 2
                                                            : pageStatus == 1
                                                    "
                                                >
                                                    <el-option
                                                        v-for="option in optionarr"
                                                        :key="option.value"
                                                        :label="option.name"
                                                        :value="option.value"
                                                    ></el-option>
                                                </el-select>
                                            </el-form-item>
                                            <el-form-item
                                                class="form-item"
                                                label="电压等级:"
                                                :prop="
                                                    'deviceParam.' +
                                                    [deviceIndex] +
                                                    '.subVoltageParam.' +
                                                    bIndex +
                                                    '.scale'
                                                "
                                                :rules="{ required: true, message: '请选择电压等级', trigger: 'blur' }"
                                            >
                                                <el-select
                                                    filterable
                                                    v-model="busItem.scale"
                                                    value-key="value"
                                                    placeholder="请选择电压等级"
                                                    :disabled="
                                                        nodeLevel > 600 && (pageStatus == 3 || pageStatus == 2)
                                                            ? pageStatus == 3 || pageStatus == 2
                                                            : pageStatus == 1
                                                    "
                                                    @change="selectChanged"
                                                >
                                                    <el-option
                                                        v-for="option in voltageLevelArr"
                                                        :key="option.id"
                                                        :label="option.name"
                                                        :value="option.id"
                                                    ></el-option>
                                                </el-select>
                                            </el-form-item>
                                            <el-form-item
                                                class="form-item"
                                                label="母线类型:"
                                                :prop="
                                                    'deviceParam.' +
                                                    [deviceIndex] +
                                                    '.subVoltageParam.' +
                                                    bIndex +
                                                    '.model'
                                                "
                                                :rules="{ required: true, message: '请选择母线类型', trigger: 'blur' }"
                                            >
                                                <el-select
                                                    filterable
                                                    v-model="busItem.model"
                                                    placeholder="请选择母线类型"
                                                    :disabled="
                                                        nodeLevel > 600 && (pageStatus == 3 || pageStatus == 2)
                                                            ? pageStatus == 3 || pageStatus == 2
                                                            : pageStatus == 1
                                                    "
                                                >
                                                    <el-option
                                                        v-for="option in busBarType"
                                                        :key="option.name"
                                                        :label="option.name"
                                                        :value="option.value"
                                                    ></el-option>
                                                </el-select>
                                            </el-form-item>
                                            <el-form-item
                                                class="form-item"
                                                label="排序:"
                                                :prop="
                                                    'deviceParam.' +
                                                    [deviceIndex] +
                                                    '.subVoltageParam.' +
                                                    bIndex +
                                                    '.sort'
                                                "
                                                :rules="{ required: true, message: '请输入排序', trigger: 'blur' }"
                                            >
                                                <el-input
                                                    v-model="busItem.sort"
                                                    placeholder="请输入排序"
                                                    :disabled="
                                                        nodeLevel > 600 && (pageStatus == 3 || pageStatus == 2)
                                                            ? pageStatus == 3 || pageStatus == 2
                                                            : pageStatus == 1
                                                    "
                                                ></el-input>
                                            </el-form-item>
                                        </div>
                                    </el-tab-pane>
                                </el-tabs>
                            </div>

                            <!--监测点-->
                            <div
                                style="width: 100%"
                                v-if="((pageStatus != 3 && (nodeLevel > 400 && (nodeLevel &lt;= 700 || pageStatus == 2))) || (pageStatus == 3 && 400 < nodeLevel && nodeLevel &lt;= 700))"
                            >
                                <el-tabs
                                    type="card"
                                    v-if="
                                        AddProjectBO.deviceParam &&
                                        AddProjectBO.deviceParam.length &&
                                        AddProjectBO.deviceParam[deviceIndex] &&
                                        AddProjectBO.deviceParam[deviceIndex].subVoltageParam &&
                                        AddProjectBO.deviceParam[deviceIndex].subVoltageParam.length &&
                                        AddProjectBO.deviceParam[deviceIndex].subVoltageParam[busBarIndex] &&
                                        AddProjectBO.deviceParam[deviceIndex].subVoltageParam[busBarIndex].lineParam &&
                                        AddProjectBO.deviceParam[deviceIndex].subVoltageParam[busBarIndex].lineParam
                                            .length
                                    "
                                    v-model="lineIndex"
                                    :editable="pageStatus != 1"
                                    @edit="handleLineTabsEdit"
                                    @tab-click="tabChange('lineIndex')"
                                >
                                    <el-tab-pane
                                        v-for="(lineItem, lIndex) in AddProjectBO.deviceParam[deviceIndex]
                                            .subVoltageParam[busBarIndex].lineParam"
                                        :key="lIndex"
                                        :label="lineItem.name ? lineItem.name : '新建监测点' + lIndex"
                                        :name="lIndex + ''"
                                    >
                                        <div class="flex mt10">
                                            <el-form-item
                                                class="form-item"
                                                label="监测点名称:"
                                                :prop="
                                                    'deviceParam.' +
                                                    [deviceIndex] +
                                                    '.subVoltageParam.' +
                                                    [busBarIndex] +
                                                    '.lineParam.' +
                                                    lIndex +
                                                    '.name'
                                                "
                                                :rules="{
                                                    required: true,
                                                    message: '请输入监测点名称',
                                                    trigger: 'blur'
                                                }"
                                            >
                                                <el-input
                                                    v-model="lineItem.name"
                                                    :disabled="pageStatus == 1"
                                                    placeholder="请输入监测点名称"
                                                ></el-input>
                                            </el-form-item>

                                            <el-form-item
                                                class="form-item"
                                                label="监测点序号:"
                                                :prop="
                                                    'deviceParam.' +
                                                    [deviceIndex] +
                                                    '.subVoltageParam.' +
                                                    [busBarIndex] +
                                                    '.lineParam.' +
                                                    lIndex +
                                                    '.num'
                                                "
                                                :rules="{
                                                    required: true,
                                                    message: '请选择监测点序号',
                                                    trigger: 'blur'
                                                }"
                                            >
                                                <el-select
                                                    filterable
                                                    v-model="lineItem.num"
                                                    placeholder="请选择序号"
                                                    :disabled="pageStatus == 1"
                                                >
                                                    <el-option
                                                        v-for="option in pointNumArr"
                                                        :key="option.name"
                                                        :label="option.name"
                                                        :value="option.value"
                                                    ></el-option>
                                                </el-select>
                                            </el-form-item>
                                            <el-form-item
                                                class="form-item"
                                                label="接线类型:"
                                                :prop="
                                                    'deviceParam.' +
                                                    [deviceIndex] +
                                                    '.subVoltageParam.' +
                                                    [busBarIndex] +
                                                    '.lineParam.' +
                                                    lIndex +
                                                    '.ptType'
                                                "
                                                :rules="{ required: true, message: '请选择接线类型', trigger: 'blur' }"
                                            >
                                                <el-select
                                                    filterable
                                                    v-model="lineItem.ptType"
                                                    placeholder="请选择接线类型"
                                                    :disabled="pageStatus == 1"
                                                >
                                                    <el-option
                                                        v-for="option in wiringTypeArr"
                                                        :key="option.name"
                                                        :label="option.name"
                                                        :value="option.value"
                                                    ></el-option>
                                                </el-select>
                                            </el-form-item>
                                            <el-form-item
                                                class="form-item"
                                                label="电网标志:"
                                                :prop="
                                                    'deviceParam.' +
                                                    [deviceIndex] +
                                                    '.subVoltageParam.' +
                                                    [busBarIndex] +
                                                    '.lineParam.' +
                                                    lIndex +
                                                    '.powerFlag'
                                                "
                                                :rules="{
                                                    required: true,
                                                    message: '请选择电网标志',
                                                    trigger: 'blur'
                                                }"
                                            >
                                                <el-select
                                                    filterable
                                                    v-model="lineItem.powerFlag"
                                                    placeholder="请选择电网标志"
                                                    :disabled="pageStatus == 1"
                                                    @change="lineItem.objId = ''"
                                                >
                                                    <el-option
                                                        v-for="option in lineNatureArr"
                                                        :key="option.name"
                                                        :label="option.name"
                                                        :value="option.value"
                                                    ></el-option>
                                                </el-select>
                                            </el-form-item>
                                            <el-form-item
                                                class="form-item"
                                                label="监测对象名称:"
                                                v-if="lineItem.powerFlag == 1"
                                            >
                                                <el-select
                                                    filterable
                                                    v-model="lineItem.objId"
                                                    placeholder="请选择对象名称"
                                                    :disabled="pageStatus == 1"
                                                    @change="(val) => handleSelect(lineItem, val)"
                                                    clearable
                                                >
                                                    <el-option
                                                        v-for="option in newStationIdArr.filter(
                                                            item => item.stationId == AddProjectBO.subIndex
                                                        )"
                                                        :key="option.id"
                                                        :label="option.projectName"
                                                        :value="option.id"
                                                    ></el-option>
                                                </el-select>
                                            </el-form-item>

                                            <el-form-item class="form-item" label="基准容量(MVA):">
                                                <el-input
                                                    v-model="lineItem.standardCapacity"
                                                    :disabled="pageStatus == 1"
                                                    placeholder="请输入基准容量(MVA)"
                                                ></el-input>
                                            </el-form-item>
                                            <el-form-item
                                                class="form-item"
                                                label="短路容量(MVA):"
                                                :prop="
                                                    'deviceParam.' +
                                                    [deviceIndex] +
                                                    '.subVoltageParam.' +
                                                    [busBarIndex] +
                                                    '.lineParam.' +
                                                    lIndex +
                                                    '.shortCapacity'
                                                "
                                                :rules="{ required: false, message: '请输入短路容量', trigger: 'blur' }"
                                            >
                                                <el-input
                                                    v-model="lineItem.shortCapacity"
                                                    :disabled="pageStatus == 1"
                                                    placeholder="请输入短路容量(MVA)"
                                                ></el-input>
                                            </el-form-item>
                                            <el-form-item
                                                class="form-item"
                                                label="设备容量(MW):"
                                                :prop="
                                                    'deviceParam.' +
                                                    [deviceIndex] +
                                                    '.subVoltageParam.' +
                                                    [busBarIndex] +
                                                    '.lineParam.' +
                                                    lIndex +
                                                    '.devCapacity'
                                                "
                                                :rules="{ required: false, message: '请输入设备容量', trigger: 'blur' }"
                                            >
                                                <el-input
                                                    v-model="lineItem.devCapacity"
                                                    :disabled="pageStatus == 1"
                                                    placeholder="请输入设备容量(MVA)"
                                                ></el-input>
                                            </el-form-item>
                                            <el-form-item
                                                class="form-item"
                                                label="协议容量(MW):"
                                                :prop="
                                                    'deviceParam.' +
                                                    [deviceIndex] +
                                                    '.subVoltageParam.' +
                                                    [busBarIndex] +
                                                    '.lineParam.' +
                                                    lIndex +
                                                    '.dealCapacity'
                                                "
                                                :rules="{ required: false, message: '请输入协议容量', trigger: 'blur' }"
                                            >
                                                <el-input
                                                    v-model="lineItem.dealCapacity"
                                                    :disabled="pageStatus == 1"
                                                    placeholder="请输入协议容量(MW)"
                                                ></el-input>
                                            </el-form-item>
                                            <el-form-item
                                                class="form-item"
                                                label="测量点间隔:"
                                                :prop="
                                                    'deviceParam.' +
                                                    [deviceIndex] +
                                                    '.subVoltageParam.' +
                                                    [busBarIndex] +
                                                    '.lineParam.' +
                                                    lIndex +
                                                    '.timeInterval'
                                                "
                                                :rules="{ required: true, message: '请选择测点间隔', trigger: 'blur' }"
                                            >
                                                <el-select
                                                    filterable
                                                    v-model="lineItem.timeInterval"
                                                    placeholder="请选择测量点间隔"
                                                    :disabled="pageStatus == 1"
                                                >
                                                    <el-option
                                                        v-for="option in lineSpaceArr"
                                                        :key="option.name"
                                                        :label="option.name"
                                                        :value="option.value"
                                                    ></el-option>
                                                </el-select>
                                            </el-form-item>
                                            <el-form-item
                                                class="form-item"
                                                label="PT变比:"
                                                :prop="
                                                    'deviceParam.' +
                                                    [deviceIndex] +
                                                    '.subVoltageParam.' +
                                                    [busBarIndex] +
                                                    '.lineParam.' +
                                                    lIndex +
                                                    '.pt1'
                                                "
                                                :rules="{ required: true, message: '请输入pt', trigger: 'blur' }"
                                            >
                                                <div style="width: 100%; display: flex; justify-content: space-between">
                                                    <el-input
                                                        style="width: 48%"
                                                        v-model="lineItem.pt1"
                                                        :disabled="pageStatus == 1"
                                                    ></el-input>
                                                    <el-input
                                                        style="width: 48%"
                                                        v-model="lineItem.pt2"
                                                        :disabled="pageStatus == 1"
                                                    ></el-input>
                                                </div>
                                            </el-form-item>
                                            <el-form-item
                                                class="form-item"
                                                label="CT变比:"
                                                :prop="
                                                    'deviceParam.' +
                                                    [deviceIndex] +
                                                    '.subVoltageParam.' +
                                                    [busBarIndex] +
                                                    '.lineParam.' +
                                                    lIndex +
                                                    '.ct1'
                                                "
                                                :rules="{ required: true, message: '请输入ct', trigger: 'blur' }"
                                            >
                                                <div style="width: 100%; display: flex; justify-content: space-between">
                                                    <el-input
                                                        style="width: 48%"
                                                        v-model="lineItem.ct1"
                                                        :disabled="pageStatus == 1"
                                                    ></el-input>
                                                    <el-input
                                                        style="width: 48%"
                                                        v-model="lineItem.ct2"
                                                        :disabled="pageStatus == 1"
                                                    ></el-input>
                                                </div>
                                            </el-form-item>

                                            <el-form-item
                                                class="form-item"
                                                label="干扰源类型:"
                                                :prop="
                                                    'deviceParam.' +
                                                    [deviceIndex] +
                                                    '.subVoltageParam.' +
                                                    [busBarIndex] +
                                                    '.lineParam.' +
                                                    lIndex +
                                                    '.loadType'
                                                "
                                                :rules="{
                                                    required: true,
                                                    message: '请选择干扰源类型',
                                                    trigger: 'blur'
                                                }"
                                            >
                                                <el-select
                                                    filterable
                                                    v-model="lineItem.loadType"
                                                    placeholder="请选择干扰源类型"
                                                    :disabled="pageStatus == 1"
                                                >
                                                    <el-option
                                                        v-for="option in loadTypeArr"
                                                        :key="option.id"
                                                        :label="option.name"
                                                        :value="option.id"
                                                    ></el-option>
                                                </el-select>
                                            </el-form-item>
                                            <el-form-item
                                                class="form-item"
                                                label="对象大类:"
                                                :prop="
                                                    'deviceParam.' +
                                                    [deviceIndex] +
                                                    '.subVoltageParam.' +
                                                    [busBarIndex] +
                                                    '.lineParam.' +
                                                    lIndex +
                                                    '.bigObjType'
                                                "

                                            >
                                                <el-select
                                                    filterable
                                                    v-model="lineItem.bigObjType"
                                                    placeholder="请选择对象大类"
                                                    :disabled="pageStatus == 1"
                                                    @change="lineItem.smallObjType = ''"
                                                >
                                                    <el-option
                                                        v-for="option in bigList"
                                                        :key="option.id"
                                                        :label="option.name"
                                                        :value="option.id"
                                                    ></el-option>
                                                </el-select>
                                            </el-form-item>
                                            <el-form-item
                                                class="form-item"
                                                label="对象小类:"
                                                :prop="
                                                    'deviceParam.' +
                                                    [deviceIndex] +
                                                    '.subVoltageParam.' +
                                                    [busBarIndex] +
                                                    '.lineParam.' +
                                                    lIndex +
                                                    '.smallObjType'
                                                "

                                            >
                                                <el-select
                                                    filterable
                                                    v-model="lineItem.smallObjType"
                                                    placeholder="请选择对象小类"
                                                    :disabled="pageStatus == 1"
                                                >
                                                    <el-option
                                                        v-for="option in bigList.filter(
                                                            item => item.id == lineItem.bigObjType
                                                        )[0]?.children"
                                                        :key="option.id"
                                                        :label="option.name"
                                                        :value="option.id"
                                                    ></el-option>
                                                </el-select>
                                            </el-form-item>
                                            <el-form-item
                                                class="form-item"
                                                label="行业类型:"
                                                :prop="
                                                    'deviceParam.' +
                                                    [deviceIndex] +
                                                    '.subVoltageParam.' +
                                                    [busBarIndex] +
                                                    '.lineParam.' +
                                                    lIndex +
                                                    '.businessType'
                                                "
                                                :rules="{ required: true, message: '请选择行业类型', trigger: 'blur' }"
                                            >
                                                <el-select
                                                    filterable
                                                    v-model="lineItem.businessType"
                                                    placeholder="请选择行业类型"
                                                    :disabled="pageStatus == 1"
                                                >
                                                    <el-option
                                                        v-for="option in industryTypeArr"
                                                        :key="option.id"
                                                        :label="option.name"
                                                        :value="option.id"
                                                    ></el-option>
                                                </el-select>
                                            </el-form-item>
                                            <el-form-item
                                                class="form-item"
                                                label="谐波监测号:"
                                                :prop="
                                                    'deviceParam.' +
                                                    [deviceIndex] +
                                                    '.subVoltageParam.' +
                                                    [busBarIndex] +
                                                    '.lineParam.' +
                                                    lIndex +
                                                    '.monitorId'
                                                "
                                            >
                                                <el-input
                                                    v-model="lineItem.monitorId"
                                                    :disabled="pageStatus == 1"
                                                    placeholder="请输入网公司谐波监测号"
                                                ></el-input>
                                            </el-form-item>
                                            <el-form-item
                                                class="form-item"
                                                label="电压下偏差:"
                                                :prop="
                                                    'deviceParam.' +
                                                    [deviceIndex] +
                                                    '.subVoltageParam.' +
                                                    [busBarIndex] +
                                                    '.lineParam.' +
                                                    lIndex +
                                                    '.uvoltageDev'
                                                "
                                                :rules="{
                                                    required: true,
                                                    message: '请输入电压下偏差',
                                                    trigger: 'blur'
                                                }"
                                            >
                                                <el-input
                                                    v-model="lineItem.uvoltageDev"
                                                    :disabled="pageStatus == 1"
                                                    placeholder="请输入电压下偏差"
                                                ></el-input>
                                            </el-form-item>
                                            <!-- <el-form-item
                                                class="form-item"
                                                label="对象名称:"
                                                :prop="
                                                    'deviceParam.' +
                                                    [deviceIndex] +
                                                    '.subVoltageParam.' +
                                                    [busBarIndex] +
                                                    '.lineParam.' +
                                                    lIndex +
                                                    '.objName'
                                                "
                                            >
                                                <el-input
                                                    v-model="lineItem.objName"
                                                    disabled="true"
                                                    placeholder="请输入对象名称"
                                                ></el-input>
                                            </el-form-item> -->

                                            <el-form-item
                                                class="form-item"
                                                label="电压上偏差:"
                                                :prop="
                                                    'deviceParam.' +
                                                    [deviceIndex] +
                                                    '.subVoltageParam.' +
                                                    [busBarIndex] +
                                                    '.lineParam.' +
                                                    lIndex +
                                                    '.voltageDev'
                                                "
                                                :rules="{
                                                    required: true,
                                                    message: '请输入电压上偏差',
                                                    trigger: 'blur'
                                                }"
                                            >
                                                <el-input
                                                    v-model="lineItem.voltageDev"
                                                    :disabled="pageStatus == 1"
                                                    placeholder="请输入电压上偏差"
                                                ></el-input>
                                            </el-form-item>
                                            <el-form-item
                                                class="form-item"
                                                label="备注:"
                                                :prop="
                                                    'deviceParam.' +
                                                    [deviceIndex] +
                                                    '.subVoltageParam.' +
                                                    [busBarIndex] +
                                                    '.lineParam.' +
                                                    lIndex +
                                                    '.remark'
                                                "
                                            >
                                                <el-input
                                                    v-model="lineItem.remark"
                                                    :disabled="pageStatus == 1"
                                                    placeholder="请输入备注"
                                                ></el-input>
                                            </el-form-item>
                                            <!-- <el-form-item
                                                class="form-item"
                                                label="分类等级:"
                                                :prop="
                                                    'deviceParam.' +
                                                    [deviceIndex] +
                                                    '.subVoltageParam.' +
                                                    [busBarIndex] +
                                                    '.lineParam.' +
                                                    lIndex +
                                                    '.calssificationGrade'
                                                "
                                                :rules="{ required: true, message: '请选择分类等级', trigger: 'blur' }"
                                            >
                                                <el-select filterable 
                                                    v-model="lineItem.calssificationGrade"
                                                    placeholder="请选择分类等级"
                                                    :disabled="pageStatus == 1"
                                                >
                                                    <el-option
                                                        v-for="option in pointTypeArr"
                                                        :key="option.name"
                                                        :label="option.name"
                                                        :value="option.value"
                                                    ></el-option>
                                                </el-select>
                                            </el-form-item>
                                            <el-form-item class="form-item" label="监测点拥有者:">
                                                :prop=" 不校验
                                            'deviceParam.' +
                                            [deviceIndex] +
                                            '.subVoltageParam.' +
                                            [busBarIndex] +
                                            '.lineParam.' +
                                            lIndex +
                                            '.owner'
                                        "
                                        :rules="{ required: true, message: '请输入监测点拥有者', trigger: 'blur' }"
                                                <el-input
                                                    v-model="lineItem.owner"
                                                    :disabled="pageStatus == 1"
                                                    placeholder="请输入监测点拥有者"
                                                ></el-input>
                                            </el-form-item>
                                            <el-form-item class="form-item" label="拥有者职务:">
                                                :prop=" 不校验
                                            'deviceParam.' +
                                            [deviceIndex] +
                                            '.subVoltageParam.' +
                                            [busBarIndex] +
                                            '.lineParam.' +
                                            lIndex +
                                            '.ownerDuty'
                                        "
                                        :rules="{ required: true, message: '请输入拥有者职务', trigger: 'blur' }"
                                                <el-input
                                                    v-model="lineItem.ownerDuty"
                                                    :disabled="pageStatus == 1"
                                                    placeholder="请输入拥有者职务"
                                                ></el-input>
                                            </el-form-item> -->
                                            <!-- <el-form-item class="form-item" label="电网侧变电站:">
                                                <el-input
                                                    v-model="lineItem.powerSubstationName"
                                                    disabled
                                                    placeholder="请输入电网侧变电站"
                                                ></el-input>
                                            </el-form-item> -->
                                            <el-form-item class="form-item" label="实际安装位置:">
                                                <el-select
                                                    filterable
                                                    v-model="lineItem.actualArea"
                                                    placeholder="请选择实际安装位置"
                                                    :disabled="pageStatus == 1"
                                                    style="width: 100%"
                                                >
                                                    <el-option
                                                        v-for="item in treeOptions"
                                                        :key="item.id"
                                                        :label="item.name"
                                                        :value="item.id"
                                                    ></el-option>
                                                </el-select>
                                            </el-form-item>
                                            <!-- <el-form-item class="form-item" label="上级变电站:">
                                                :prop=" 不校验
                                            'deviceParam.' +
                                            [deviceIndex] +
                                            '.subVoltageParam.' +
                                            [busBarIndex] +
                                            '.lineParam.' +
                                            lIndex +
                                            '.superiorsSubstation'
                                        "
                                        :rules="{ required: true, message: '请输入上级变电站', trigger: 'blur' }"
                                                <el-input
                                                    v-model="lineItem.superiorsSubstation"
                                                    :disabled="pageStatus == 1"
                                                    placeholder="请输入上级变电站"
                                                ></el-input>
                                            </el-form-item> -->
                                            <el-form-item
                                                class="form-item"
                                                label="排序:"
                                                :prop="
                                                    'deviceParam.' +
                                                    [deviceIndex] +
                                                    '.subVoltageParam.' +
                                                    [busBarIndex] +
                                                    '.lineParam.' +
                                                    lIndex +
                                                    '.sort'
                                                "
                                                :rules="{ required: true, message: '请输入排序', trigger: 'blur' }"
                                            >
                                                <el-input
                                                    v-model="lineItem.sort"
                                                    :disabled="pageStatus == 1"
                                                    placeholder="请输入排序"
                                                ></el-input>
                                            </el-form-item>
                                        </div>
                                    </el-tab-pane>
                                </el-tabs>
                            </div>
                        </el-form>
                    </div>
                </div>
            </pane>
        </splitpanes>
    </div>
</template>

<script setup lang="ts">
defineOptions({
    name: 'device-boot/deviceter'
})
import { getDevTypeList } from '@/api/device-boot/modelManage'
import 'splitpanes/dist/splitpanes.css'
import { Splitpanes, Pane } from 'splitpanes'
import { LocationInformation } from '@element-plus/icons-vue'
import Terminal from '@/components/tree/pqs/Terminal.vue'
import { mainHeight } from '@/utils/layout'
import { areaTree } from '@/api/system-boot/dicData'
import {
    queryTerminal,
    nodeAllList,
    delTerminal,
    updateTerminal,
    addTerminal,
    selectDown,
    queryAllByType,
    selectUserList
} from '@/api/device-boot/Business'
import { useDictData } from '@/stores/dictData'
import { ref, reactive, onMounted } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { getYwZtSubstation } from '@/api/device-boot/device'
const size = ref(19)
const TerminalRef = ref()
const pageHeight = mainHeight(20)
const Height = mainHeight(100)
const mainForm = ref()
const loading = ref(false)
const nextfalg = ref(false)
const dictData = useDictData()
const nodeLevel = ref(0)
const pageStatus = ref(1)
const titleList: any = ref([])
const nodeData: any = ref([])
const treeOptions: any = ref([])
const deviceIndex: any = ref('0')
const busBarIndex: any = ref('0')
const lineIndex: any = ref('0')
const VITE_FLAG = import.meta.env.VITE_NAME == 'jibei'
const projectId: any = ref('0')
const provinceId: any = ref('0')
const gdId: any = ref('0')
const subId: any = ref('0')
const devId: any = ref('0')
const busBarId: any = ref('0')
const lineId: any = ref('0')

const updateProject: any = ref(null)
const powerStationList: any = ref([])
const currentGdName: any = ref('')
const affiliatiedFrontArr: any = ref([])
const comTypeStatusArr = dictData.getBasicData('Front_Type')
const factoryArr = dictData.getBasicData('Dev_Manufacturers')
const voltageLevelArr = dictData.getBasicData('Dev_Voltage_Stand')

const typeArr = ref(dictData.getBasicData('Dev_Type'))
const industryTypeArr = dictData.getBasicData('Business_Type')
const loadTypeArr = dictData.getBasicData('Interference_Source')
const optionarr = ref([
    { name: '1号母线', value: 1 },
    { name: '2号母线', value: 2 },
    { name: '3号母线', value: 3 },
    { name: '4号母线', value: 4 },
    { name: '5号母线', value: 5 },
    { name: '6号母线', value: 6 }
])
/**母线类型 */
const busBarType = ref([
    { name: '真实母线', value: 1 },
    { name: '虚拟母线', value: 0 }
])
const bigList: any = ref([])
const smallList: any = ref([])
const comStatusArr = ref([
    { name: '中断', value: 0 },
    { name: '正常', value: 1 }
])
/**终端模型选项 */
const terminalModelArr = ref([
    { name: '实际终端', value: 1 },
    { name: '虚拟终端', value: 0 },
    { name: '离线终端', value: 2 }
])
/**电镀功能选项 */
const electroplateCanArr = ref([
    { name: '开启', value: 0 },
    { name: '关闭', value: 1 }
])
/**数据模型选项 */
const dataModelArr = ref([
    { name: '双系统', value: 2 },
    { name: '暂降系统', value: 0 },
    { name: '稳态系统', value: 1 }
])
/**召唤标志选项 */
const summonSignArr = ref([
    { name: '变位触发', value: 0 },
    { name: '周期触发', value: 1 }
])
/**监测点序号 */
const pointNumArr = ref([
    { name: '1', value: 1 },
    { name: '2', value: 2 },
    { name: '3', value: 3 },
    { name: '4', value: 4 },
    { name: '5', value: 5 },
    { name: '6', value: 6 }
])
/**监测点间隔 */
const lineSpaceArr = ref([
    { name: '1分钟', value: 1 },
    { name: '3分钟', value: 3 },
    { name: '5分钟', value: 5 },
    { name: '10分钟', value: 10 }
])
const wiringTypeArr = ref([
    { name: '星型接线', value: 0 },
    { name: '三角型接线', value: 1 },
    { name: '开口三角型接线', value: 2 }
])
const lineNatureArr = ref([
    { name: '电网侧', value: 0 },
    { name: '非电网侧', value: 1 }
])
const pointTypeArr = ref([
    { name: 'Ⅰ', value: 1 },
    { name: 'Ⅱ', value: 2 },
    { name: 'Ⅲ', value: 3 },
    { name: 'Ⅳ', value: 4 },
    { name: 'Ⅴ', value: 5 }
])
const busBarDetail = ref({
    /**母线名称 */
    name: '',
    /**母线编号 */
    num: 1,
    /**电压等级 */
    scale: '',
    /**母线类型 */
    model: 1,
    /**母线id */
    subvIndex: '',
    /**监测点 */
    lineParam: [],
    /**排序 */
    sort: 0
})
/**监测点详情 */
const monitorPointDetail: any = ref({
    /**对象大类 */
    bigObjType: '',
    /**对象小类 */
    smallObjType: '',
    /**行业类型 */
    businessType: '',
    /**CT变比 */
    ct1: '300',
    /**CT变比 */
    ct2: '5',
    /**所属部门 */
    deptIndex: '',
    /**设备容量 */
    devCapacity: '',
    /**短路容量 */
    shortCapacity: '',
    objId: '',
    /**基准容量 */
    standardCapacity: '',
    /**监测点id */
    lineIndex: '',
    /**监测点序号 */
    num: 1,
    //分类等级
    calssificationGrade: 1,
    //电网测变电站
    powerSubstationName: '',
    actualArea: '',
    //监测点拥有着
    owner: '',
    //拥有者职位
    ownerDuty: '',
    //上级变电站
    superiorsSubstation: '',
    /**负荷类型 */
    loadType: '',
    /**网公司监测号 */
    monitorId: '',
    /**监测点名称 */
    name: '',
    /**对象名称 */
    objName: '',
    /**监测点性质 */
    powerFlag: 0,
    /**PT比 */
    pt1: 0,
    /**PT比 */
    pt2: 0,
    /**接线类型 */
    ptType: 0,
    /**测点间隔 */
    timeInterval: 1,
    /**协议容量 */
    dealCapacity: '',
    /**电压等级 */
    scale: '',
    /**备注 */
    remark: '',
    /**电压上偏差 */
    voltageDev: 10,
    /**电压下偏差 */
    uvoltageDev: 10,
    /**供电公司 */
    gdName: currentGdName.value,
    /**排序 */
    sort: 0
})
const subStationParam = ref({
    /**名称 */
    name: '',
    /**经度 */
    lng: '0',
    /**纬度 */
    lat: '0',
    /**电压等级 */
    scale: '',
    /**排序 */
    sort: 0
})
const AddProjectBO: any = ref({
    /**项目Id */
    projectIndex: 0,
    /**行政区域Id */
    provinceIndex: 0,
    /**供电公司Id*/
    gdIndex: 0,
    /**变电站Id*/
    subIndex: 0,
    /**终端Id */
    devIndex: 0,
    /**母线ID */
    subvIndex: 0,
    /**项目名称 */
    projectParam: null,
    /**行政区域 */
    provinceParam: null,
    /**供电公司 */
    gdInformationParam: null,
    /**变电站 */
    subStationParam: null,
    /**终端终端   母线  母线下面subVoltage是监测点*/
    deviceParam: null
})
const deviceBODetail: any = ref({
    /**名称 */
    name: '',
    /**终端id*/
    devIndex: '',
    /**终端型号 */
    devType: '',
    /**ip */
    ip: '',
    /**通讯状态 */
    comFlag: 0,
    /**通讯类型 */
    frontType: '',
    /**投运时间 */
    loginTime: '',
    /**数据更新时间 */
    updateTime: '',
    /**所属变电站 */
    zhan: '',
    /**所属前置机 */
    nodeId: '',
    // 进程号
    processNum: '',
    /**终端模型 */
    devModel: 1,
    /**本次定检时间 */
    thisTimeCheck: '',
    /**下次定检时间 */
    nextTimeCheck: '',
    /**厂家 */
    manufacturer: '',
    /**数据模型 */
    devDataType: 2,
    /**端口号 */
    port: 102,
    /**排序 */
    sort: 0,
    //合同号
    contract: '',
    //ISM卡号
    sim: '',
    /**电镀功能 */
    electroplate: 0,
    /**识别码 */
    series: '',
    /**召唤标志 */
    callFlag: 0,
    /**密钥 */
    devKey: '',
    /**母线*/
    subVoltageParam: [],
    /**供电公司 */
    gdName: currentGdName.value
})
const newStationIdArr: any = ref([])
const treeClickCount = ref(0)
const project = ref([
    { name: '在线项目', value: '在线项目' },
    { name: '普测项目', value: '普测项目' }
])
const arrdess: any = ref((rule: any, value: any, callback: any) => {
    let reg1 =
        /^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/
    let reg2 =
        /^[A-Fa-f0-9]{1,2}\-[A-Fa-f0-9]{1,2}\-[A-Fa-f0-9]{1,2}\-[A-Fa-f0-9]{1,2}\-[A-Fa-f0-9]{1,2}\-[A-Fa-f0-9]{1,2}$/
    let reg3 =
        /^[A-Fa-f0-9]{1,2}\:[A-Fa-f0-9]{1,2}\:[A-Fa-f0-9]{1,2}\:[A-Fa-f0-9]{1,2}\:[A-Fa-f0-9]{1,2}\:[A-Fa-f0-9]{1,2}$/
    if (reg1.test(value)) {
        return true
    } else if (reg2.test(value)) {
        return true
    } else if (reg3.test(value)) {
        return true
    } else if (value == '') {
        return callback(new Error('请输入IP/MAC地址'))
    } else {
        callback(new Error('请输入正确IP/MAC地址'))
    }
})

/** 经度：-180 ~ 180，最多 6 位小数 */
const lngff = (_rule: any, value: any, callback: any) => {
    if (value === '' || value === null || value === undefined) {
        return callback(new Error('请输入经度'))
    }
    const reg = /^[+-]?(?:180(?:\.0{1,6})?|(?:1[0-7]\d|[1-9]?\d)(?:\.\d{1,6})?)$/
    if (!reg.test(String(value))) {
        return callback(new Error('请输入正确经度（-180~180，最多6位小数）'))
    }
    callback()
}
/** 纬度：-90 ~ 90，最多 6 位小数 */
const latff = (_rule: any, value: any, callback: any) => {
    if (value === '' || value === null || value === undefined) {
        return callback(new Error('请输入纬度'))
    }
    const reg = /^[+-]?(?:90(?:\.0{1,6})?|[1-8]?\d(?:\.\d{1,6})?)$/
    if (!reg.test(String(value))) {
        return callback(new Error('请输入正确纬度（-90~90，最多6位小数）'))
    }
    callback()
}
const plevel = ref(0)
const nodeDataList = ref()
const nodeEventList = ref()
const nodeLevel1 = ref(0)
const nodeClick = (e: anyObj, data: any) => {
    nodeDataList.value = data
    nodeEventList.value = e
    plevel.value = data.data.plevel
    treeClickCount.value++
    if (treeClickCount.value > 2) return
    if (treeClickCount.value > 2) return
    if (treeClickCount.value == 1) {
        if (pageStatus.value == 2 || pageStatus.value == 3) {
            if (pageStatus.value == 3 || pageStatus.value == 2) {
                ElMessage({
                    type: 'warning',
                    message: '请先提交,再做操作'
                })
            }
            return
        }
    }

    titleList.value = []
    getparentsNode(data)
    pageStatus.value = 1
    nodeLevel.value = data.data.level
    nodeLevel1.value = data.data.level
    nodeData.value = e
    AddProjectBO.value.projectParam = null
    AddProjectBO.value.provinceParam = null
    AddProjectBO.value.gdInformationParam = null
    AddProjectBO.value.subStationParam = null
    AddProjectBO.value.deviceParam = null
    evaluate(data)
    if (data.level > 400) {
        getNodeIndex()
    }
    /**不是根节点请求数据 */
    if (nodeLevel.value) {
        queryNodeContent()
    } else {
        /**清空数据 */
        initAddProjectBo()
        initAddProjectBoId()
    }
    treeClickCount.value = 0
}
const getparentsNode = (node: any) => {
    if (!node.parent) {
        return
    }
    titleList.value.unshift(node.label)
    getparentsNode(node.parent) //调用递归
}

// 新增
const add = () => {
    if (pageStatus.value == 2 || pageStatus.value == 3) {
        if (pageStatus.value == 3) {
            ElMessage({
                type: 'warning',
                message: '请先提交修改,再新增'
            })
        }
        return
    }
    pageStatus.value = 2
    /**删除Id属性 */
    delete AddProjectBO.value.projectIndex
    delete AddProjectBO.value.provinceIndex
    delete AddProjectBO.value.gdIndex
    delete AddProjectBO.value.subIndex
    delete AddProjectBO.value.devIndex
    delete AddProjectBO.value.subvIndex
    // switch (nodeData.value.level) {

    switch (nodeLevel.value) {
        case 0:
            addProject()

            break
        case 100:
            initAddProjectBo()
            AddProjectBO.value.projectIndex = projectId.value

            addProvince()
            break
        case 200:
            initAddProjectBo()
            AddProjectBO.value.projectIndex = projectId.value
            AddProjectBO.value.provinceIndex = provinceId.value
            addGdInformation()
            break
        case 300:
            initAddProjectBo()
            AddProjectBO.value.projectIndex = projectId.value
            AddProjectBO.value.provinceIndex = provinceId.value
            AddProjectBO.value.gdIndex = gdId.value
            addSubStation()
            break
        case 400:
            initAddProjectBo()
            AddProjectBO.value.projectIndex = projectId.value
            AddProjectBO.value.provinceIndex = provinceId.value
            AddProjectBO.value.gdIndex = gdId.value
            AddProjectBO.value.subIndex = subId.value
            addDevice()
            break
        case 500:
            AddProjectBO.value.projectIndex = projectId.value
            AddProjectBO.value.provinceIndex = provinceId.value
            AddProjectBO.value.gdIndex = gdId.value
            AddProjectBO.value.subIndex = subId.value
            AddProjectBO.value.devIndex = devId.value

            addSubVoltage()
            selectChanged(AddProjectBO.value.deviceParam[deviceIndex.value].subVoltageParam[busBarIndex.value].scale)
            break
        case 600:
            AddProjectBO.value.projectIndex = projectId.value
            AddProjectBO.value.provinceIndex = provinceId.value
            AddProjectBO.value.gdIndex = gdId.value
            AddProjectBO.value.subIndex = subId.value
            AddProjectBO.value.devIndex = devId.value
            AddProjectBO.value.subvIndex = busBarId.value

            addLine()
            selectChanged(AddProjectBO.value.deviceParam[deviceIndex.value].subVoltageParam[busBarIndex.value].scale)
            break
        case 700:
            AddProjectBO.value.projectIndex = projectId.value
            AddProjectBO.value.provinceIndex = provinceId.value
            AddProjectBO.value.gdIndex = gdId.value
            AddProjectBO.value.subIndex = subId.value
            AddProjectBO.value.devIndex = devId.value
            AddProjectBO.value.subvIndex = busBarId.value

            addLine()

            selectChanged(AddProjectBO.value.deviceParam[deviceIndex.value].subVoltageParam[busBarIndex.value].scale)
            break
    }

    deviceBODetail.value.manufacturer = factoryArr[0].id
    deviceBODetail.value.devType = typeArr.value[0].value
    deviceBODetail.value.frontType = comTypeStatusArr[0].value
    deviceBODetail.value.nodeId = affiliatiedFrontArr.value[0].id
    busBarDetail.value.scale = voltageLevelArr[0].id
    subStationParam.value.scale = voltageLevelArr[0].id
    monitorPointDetail.value.businessType = industryTypeArr[0].value
    monitorPointDetail.value.loadType = loadTypeArr[0].id
    const scrollBox: any = document.getElementById('scrollBox')
    // 使用 scrollTo 方法，并启用平滑滚动
    scrollBox.scrollTo({
        top: scrollBox.scrollHeight, // 滚动到内容的最底部
        behavior: 'smooth' // 启用平滑滚动动画
    })
}
//变电站变化
const subStationChange = (e: any) => {
    let list = powerStationList.value.filter((item: any) => item.name == e)
    AddProjectBO.value.subStationParam.lng = list[0].lng || 0
    AddProjectBO.value.subStationParam.lat = list[0].lat || 0
    AddProjectBO.value.subStationParam.scale = list[0].scale
}
/**新增项目 */
const addProject = () => {
    nodeLevel.value = 100
    AddProjectBO.value.projectParam = { name: '', sort: 0 }
}
const category = () => {
    queryAllByType({ type: 0, pid: 0 }).then(res => {
        bigList.value = convertToTree(res.data)
    })
}

//用户对象chage事件
const handleSelect = (item, selectedId) => {
    // 清空选择
    if (!selectedId) {
        item.projectName = ''
        return
    }
    // 过滤当前下拉数据源

    const options = newStationIdArr.value.find(i => i.id === selectedId)
    if (options) {
        item.objName = options.projectName
    }
}

// 组装用户大小类
const convertToTree = (data: any) => {
    const nodeMap: any = {}
    const roots: any = []

    // 第一步：将所有节点存储到一个以id为键的映射中
    data.forEach(item => {
        nodeMap[item.id] = { ...item, children: [] }
    })

    // 第二步：遍历数据，根据pid找到对应的父节点，并将当前节点添加到父节点的children数组中
    data.forEach(item => {
        const parentId = item.pid
        if (parentId === '0') {
            roots.push(nodeMap[item.id])
        } else {
            const parent = nodeMap[parentId]
            if (parent) {
                parent.children.push(nodeMap[item.id])
            }
        }
    })

    return roots
}
// 修改
const update = () => {
    if (Object.keys(nodeData.value).length == 0) {
        ElMessage({
            type: 'warning',
            message: '没有选中节点'
        })
        return
    }
    if (nodeData.value.level == 0) {
        ElMessage({
            type: 'warning',
            message: '不能修改根节点'
        })
        return
    }
    if (pageStatus.value == 2 || pageStatus.value == 3) {
        if (pageStatus.value == 2) {
            ElMessage({
                type: 'warning',
                message: '请先新增完成在修改'
            })
        }
        return
    }

    pageStatus.value = 3
    // 使用 scrollTo 方法，并启用平滑滚动
    const scrollBox: any = document.getElementById('scrollBox')
    scrollBox.scrollTo({
        top: scrollBox.scrollHeight, // 滚动到内容的最底部
        behavior: 'smooth' // 启用平滑滚动动画
    })
}
// 删除
const remove = () => {
    if (Object.keys(nodeData.value).length == 0) {
        ElMessage({
            type: 'warning',
            message: '没有选中节点'
        })
        return
    }
    if (nodeData.value.level == 0) {
        ElMessage({
            type: 'error',
            message: '无法删除根节点'
        })
        return
    }
    if (nodeData.value.id == null) {
        ElMessage.warning('无法删除该节点')
        return
    }
    ElMessageBox.confirm('此操作将永久删除, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
    })
        .then(() => {
            let data = {
                id: nodeData.value.id,
                level: nodeData.value.level
            }
            delTerminal(data).then((res: any) => {
                ElMessage({
                    type: 'success',
                    message: res.message
                })
                reaseStatus()
                initAddProjectBo()
                initAddProjectBoId()
                treedata()
            })
        })
        .catch(() => {
            ElMessage({
                type: 'info',
                message: '已取消删除'
            })
        })
}
// 下一步
const next = async () => {
    await mainForm.value.validate((valid: any) => {
        if (valid) {
           // console.log('🚀 ~ awaitmainForm.value.validate ~ nodeLevel.value:', nodeLevel.value)

            switch (nodeLevel.value) {
                case 100:
                    addProvince()
                    nextfalg.value = false

                    break
                case 200:
                    addGdInformation()
                    nextfalg.value = false
                    break
                case 300:
                    addSubStation()
                    nextfalg.value = false
                    break
                case 400:
                    addDevice()
                    nextfalg.value = false

                    break
                case 500:
                    addSubVoltage()
                    nextfalg.value = false

                    break
                case 600:
                    addLine()
                    selectChanged(
                        AddProjectBO.value.deviceParam[deviceIndex.value].subVoltageParam[busBarIndex.value].scale
                    )
                    nextfalg.value = false
                    break
                case 700:
                    addLine()
                    nextfalg.value = true
                    break
            }
        }
    })
}
// 撤销
const black = () => {
    pageStatus.value = 1
    busBarIndex.value = '0'
    deviceIndex.value = '0'
    lineIndex.value = '0'
    nodeClick(nodeEventList.value, nodeDataList.value)
}
// 确认提交
const onsubmit = () => {
    //  this.$refs["mainForm"].validate((valid) => {
    /**验证通过 */
    // if (valid) {
    if (pageStatus.value == 2) {
        // 新增
        submitData()
    } else {
        // 修改
        switch (nodeLevel.value) {
            case 100:
                updateProjectF()
                break
            case 200:
                updateProvince()
                break
            case 300:
                updateGdInformation()
                break
            case 400:
                updateSubStation()
                break
            case 500:
            case 600:
            case 700:
                updateDevice()
                break
        }
        updateDate()
    }
}
/**
 * 提交数据
 */
const submitData = async () => {
    const project = JSON.parse(JSON.stringify(AddProjectBO.value))
    await mainForm.value.validate((valid: any) => {
        if (valid) {
            addTerminal(project).then((res: any) => {
                ElMessage({
                    type: 'success',
                    message: res.message
                })
                reaseStatus()
                initAddProjectBo()
                initAddProjectBoId()
                treedata()
            })
        }
    })
    // project: JSON.stringify(project)
    
}
/**
 * 修改数据
 */
const updateDate = async () => {
    // console.log("updateProject:", this.updateProject);
    await mainForm.value.validate((valid: any) => {
        if (valid){
             let data = updateProject.value
            updateTerminal(data).then((res: any) => {
                ElMessage({
                    type: 'success',
                    message: res.message
                })
                pageStatus.value = 1
                treedata()
            })

        }
    })
   
}
const updateProjectF = () => {
    updateProject.value = {
        projectUpdateParam: {
            name: AddProjectBO.value.projectParam.name,
            projectIndex: projectId.value,
            sort: AddProjectBO.value.projectParam.sort,
            updateFlag: 1
        }
    }
}
/**
 * 修改供电公司
 */
const updateGdInformation = () => {
    updateProject.value = {
        gdInformationUpdateParam: {
            name: AddProjectBO.value.gdInformationParam.name,
            sort: AddProjectBO.value.gdInformationParam.sort,
            gdIndex: gdId.value,
            updateFlag: 1
        }
    }
}
/**
 * 修改行政区域
 */
const updateProvince = () => {
    updateProject.value = {
        provinceUpdateParam: {
            name: AddProjectBO.value.provinceParam.name,
            provinceIndex: AddProjectBO.value.provinceIndex,
            sort: AddProjectBO.value.provinceParam.sort,
            updateFlag: 1
        }
    }
}
/**
 * 修改变电站
 */
const updateSubStation = () => {
    updateProject.value = {
        subStationUpdateParam: {
            name: AddProjectBO.value.subStationParam.name,
            lat: AddProjectBO.value.subStationParam.lat,
            lng: AddProjectBO.value.subStationParam.lng,
            scale: AddProjectBO.value.subStationParam.scale,
            subIndex: subId.value,
            sort: AddProjectBO.value.subStationParam.sort,
            updateFlag: 1
        }
    }
}
/**
 * 修改变终端/母线/监测点
 */
const updateDevice = () => {
    /**生成数据 */
    const devices = JSON.parse(JSON.stringify(AddProjectBO.value.deviceParam))
    devices.forEach((item: any) => {
        item.updateFlag = 1
        item.subVoltageParam = item.subVoltageParam
        // delete item.subVoltageParam;
        item.subVoltageParam.forEach((bus: any) => {
            bus.updateFlag = 1
            bus.lineParam = bus.lineParam
            //delete bus.lineParam;
            bus.lineParam.forEach((line: any) => {
                line.updateFlag = 1
            })
        })
    })
    updateProject.value = {
        deviceUpdateParamList: devices
    }
}
const addProvince = () => {
    nodeLevel.value = 200
    AddProjectBO.value.provinceParam = { name: '', sort: 0 }
}
const addGdInformation = () => {
    nodeLevel.value = 300
    AddProjectBO.value.gdInformationParam = { name: '', sort: 0 }
}
const addSubStation = () => {
    nodeLevel.value = 400
    AddProjectBO.value.subStationParam = {
        name: '',
        lng: '0',
        lat: '0',
        scale: '',
        sort: 0
    }
}
const addDevice = () => {
    nodeLevel.value = 500
    // 不存在，赋值
    if (!AddProjectBO.value.deviceParam) {
        AddProjectBO.value.deviceParam = []
    }

    const device = JSON.parse(JSON.stringify(deviceBODetail.value))
    device.gdName = currentGdName.value

    AddProjectBO.value.deviceParam.push(JSON.parse(JSON.stringify(device)))
    deviceIndex.value = AddProjectBO.value.deviceParam.length - 1 + ''
}
const addSubVoltage = () => {
    nodeLevel.value = 600
    AddProjectBO.value.deviceParam[deviceIndex.value].subVoltageParam.push(
        JSON.parse(JSON.stringify(busBarDetail.value))
    )
    busBarIndex.value = AddProjectBO.value.deviceParam[deviceIndex.value].subVoltageParam.length - 1 + ''
}
const addLine = () => {
    nodeLevel.value = 700

    AddProjectBO.value.deviceParam[deviceIndex.value].subVoltageParam[busBarIndex.value].lineParam.push(
        JSON.parse(JSON.stringify(monitorPointDetail.value))
    )
    lineIndex.value =
        AddProjectBO.value.deviceParam[deviceIndex.value].subVoltageParam[busBarIndex.value].lineParam.length - 1 + ''
    setTimeout(() => {
        const scrollBox: any = document.getElementById('scrollBox')
        // 使用 scrollTo 方法，并启用平滑滚动
        scrollBox.scrollTo({
            top: scrollBox.scrollHeight, // 滚动到内容的最底部
            behavior: 'smooth' // 启用平滑滚动动画
        })
    }, 500)
}
const getNodeIndex = () => {
    deviceIndex.value = '0'
    busBarIndex.value = '0'
    lineIndex.value = '0'
}
/**查询节点内容 */
const queryNodeContent = () => {
    // console.log('🚀 ~ queryNodeContent ~ nodeData.value:', nodeData.value)

    if (nodeData.value.id == null) {
        // ElMessage.warning('1111111')
        return
    }

    if (nodeData.value.level >= 400) {
        setDown()
    }
    let data = {
        id: nodeData.value.id,
        level: nodeData.value.plevel * 100
    }
    queryTerminal(data).then(res => {
        // console.log("内容详情", res);
        if (nodeLevel.value === 500) {
            var data = res.data
            /**假数据 */
            var arr = []
            var arr1 = []
            //取终端
            for (var i = 0; i < data.deviceVO.length; i++) {}
        }
        /**对接口再放开 */
        AddProjectBO.value.projectIndex =
            res.data.projectVO && res.data.projectVO.projectIndex ? res.data.projectVO.projectIndex : 0
        AddProjectBO.value.provinceIndex =
            res.data.provinceVO && res.data.provinceVO.provinceIndex ? res.data.provinceVO.provinceIndex : 0
        AddProjectBO.value.gdIndex =
            res.data.gdInformationVO && res.data.gdInformationVO.gdIndex ? res.data.gdInformationVO.gdIndex : 0
        AddProjectBO.value.subIndex =
            res.data.subStationVO && res.data.subStationVO.subIndex ? res.data.subStationVO.subIndex : 0

        AddProjectBO.value.projectParam = {
            name: res.data.projectVO.name,
            sort: res.data.projectVO.sort
        }

        if (nodeLevel.value > 100) {
            // AddProjectBO.value.provinceIndex = res.data.provinceVO.name
            AddProjectBO.value.provinceParam = {
                name: res.data.provinceVO.name,
                sort: res.data.provinceVO.sort
            }
            AddProjectBO.value.provinceParam.name = res.data.provinceVO.name
        }

        if (nodeLevel.value > 200) {
            AddProjectBO.value.gdInformationParam = {
                name: res.data.gdInformationVO.name,
                sort: res.data.gdInformationVO.sort
            }
            currentGdName.value = res.data.gdInformationVO.name
        }

        if (nodeLevel.value > 300) {
            AddProjectBO.value.subStationParam = JSON.parse(JSON.stringify(res.data.subStationVO))
            let deviceBO = JSON.parse(JSON.stringify(res.data.deviceVO))
            deviceBO.forEach((item: any) => {
                item.subVoltageParam = item.subVoltageVOList ? item.subVoltageVOList : []
                delete item.subVoltageVOList
                item.subVoltageParam.forEach((litem: any) => {
                    litem.lineParam = litem.lineVO ? litem.lineVO : []
                    delete litem.lineVO
                })
            })
            AddProjectBO.value.deviceParam = JSON.parse(JSON.stringify(deviceBO))
            deviceBO = null
        }
    })
}
const initAddProjectBo = () => {
    AddProjectBO.value.deviceParam = null
}
/**AddProjectBo的Id恢复初始状态 */
const initAddProjectBoId = () => {
    /**项目Id */
    AddProjectBO.value.projectIndex = 0
    AddProjectBO.value.provinceIndex = 0
    AddProjectBO.value.gdIndex = 0
    AddProjectBO.value.subIndex = 0
}
const tabChange = (type: string) => {
    if (type == 'deviceIndex') {
        busBarIndex.value = '0'
        lineIndex.value = '0'
    } else if (type == 'busBarIndex') {
        lineIndex.value = '0'
    }
}
/**
 * 新增/删除终端
 */
const handleDeviceTabsEdit = (targetName: any, action: any) => {
    // console.log(targetName);
    /**新增 */
    if (action === 'add') {
        addDevice()
    }
    /**删除 */
    if (action === 'remove') {
        ElMessageBox.confirm('此操作将永久删除, 是否继续?', '提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
        })
            .then(() => {
                if (AddProjectBO.value.deviceParam[deviceIndex.value].devIndex) {
                    let data = {
                        id: AddProjectBO.value.deviceParam[deviceIndex.value].devIndex,
                        level: 500
                    }
                    delTerminal(data).then((res: any) => {
                        ElMessage({
                            type: 'success',
                            message: res.message
                        })
                        reaseStatus()
                        initAddProjectBo()
                        initAddProjectBoId()
                        treedata()
                    })
                } else {
                    AddProjectBO.value.deviceParam.splice(deviceIndex.value, 1)
                    deviceIndex.value = AddProjectBO.value.deviceParam.length
                        ? AddProjectBO.value.deviceParam.length - 1 + ''
                        : '0'
                    busBarIndex.value = '0'
                    lineIndex.value = '0'
                    ElMessage({
                        type: 'success',
                        message: '删除成功'
                    })
                }
            })
            .catch(() => {
                ElMessage({
                    type: 'info',
                    message: '已取消删除'
                })
            })
    }
}
/**
 * 新增/删除母线
 */
const handleBusBarTabsEdit = (targetName: any, action: any) => {
    // console.log(targetName);
    /**新增 */
    if (action === 'add') {
        addSubVoltage()
    }
    /**删除 */
    if (action === 'remove') {
        ElMessageBox.confirm('此操作将永久删除, 是否继续?', '提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
        })
            .then(() => {
                if (AddProjectBO.value.deviceParam[deviceIndex.value].subVoltageParam[busBarIndex.value].subvIndex) {
                    let data = {
                        id: AddProjectBO.value.deviceParam[deviceIndex.value].subVoltageParam[busBarIndex.value]
                            .subvIndex,
                        level: 600
                    }
                    delTerminal(data).then((res: any) => {
                        ElMessage({
                            type: 'success',
                            message: res.message
                        })
                        reaseStatus()
                        initAddProjectBo()
                        initAddProjectBoId()
                        treedata()
                    })
                } else {
                    AddProjectBO.value.deviceParam[deviceIndex.value].subVoltageParam.splice(busBarIndex.value, 1)
                    busBarIndex.value = AddProjectBO.value.deviceParam[deviceIndex.value].subVoltageParam.length
                        ? AddProjectBO.value.deviceParam[deviceIndex.value].subVoltageParam.length - 1 + ''
                        : '0'
                    lineIndex.value = '0'
                    ElMessage({
                        type: 'success',
                        message: '删除成功'
                    })
                }
            })
            .catch(() => {
                ElMessage({
                    type: 'info',
                    message: '已取消删除'
                })
            })
    }
}
/**
 * 新增/删除监测点
 */
const handleLineTabsEdit = (targetName: any, action: any) => {
    /**新增 */
    if (action === 'add') {
        if (
            AddProjectBO.value.deviceParam[deviceIndex.value].subVoltageParam[busBarIndex.value].lineParam.length == 6
        ) {
            ElMessage({
                type: 'warning',
                message: '不能新增更多的监测点了'
            })
            return
        }

        addLine()
        selectChanged(AddProjectBO.value.deviceParam[deviceIndex.value].subVoltageParam[busBarIndex.value].scale)
    }
    /**删除 */
    if (action === 'remove') {
        ElMessageBox.confirm('此操作将永久删除, 是否继续?', '提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
        })
            .then(() => {
                if (
                    AddProjectBO.value.deviceParam[deviceIndex.value].subVoltageParam[busBarIndex.value].lineParam[
                        lineIndex.value
                    ].lineIndex
                ) {
                    let data = {
                        id: AddProjectBO.value.deviceParam[deviceIndex.value].subVoltageParam[busBarIndex.value]
                            .lineParam[lineIndex.value].lineIndex,
                        level: 700
                    }
                    delTerminal(data).then((res: any) => {
                        ElMessage({
                            type: 'success',
                            message: res.message
                        })
                        reaseStatus()
                        initAddProjectBo()
                        initAddProjectBoId()
                        treedata()
                    })
                } else {
                    AddProjectBO.value.deviceParam[deviceIndex.value].subVoltageParam[
                        busBarIndex.value
                    ].lineParam.splice(lineIndex.value, 1)
                    lineIndex.value = AddProjectBO.value.deviceParam[deviceIndex.value].subVoltageParam[
                        busBarIndex.value
                    ].lineParam.length
                        ? AddProjectBO.value.deviceParam[deviceIndex.value].subVoltageParam[busBarIndex.value].lineParam
                              .length -
                          1 +
                          ''
                        : '0'
                    ElMessage({
                        type: 'success',
                        message: '删除成功'
                    })
                }
            })
            .catch(() => {
                ElMessage({
                    type: 'info',
                    message: '已取消删除'
                })
            })
    }
}
const treedata = () => {
    TerminalRef.value.info(nodeData.value.id)
}
/**
 * 重置初始状态
 */
const reaseStatus = () => {
    nodeData.value = {}
    nodeLevel.value = 0
    pageStatus.value = 1
    projectId.value = 0
    provinceId.value = 0
    gdId.value = 0
    subId.value = 0
    devId.value = 0
    busBarId.value = 0
    lineId.value = 0
    deviceIndex.value = '0'
    busBarIndex.value = '0'
    lineIndex.value = '0'
    currentGdName.value = ''
}
const evaluate = (node: any) => {
    switch (node.data.level) {
        case 100:
            projectId.value = node.data.id
            break
        case 200:
            provinceId.value = node.data.id
            break
        case 300:
            gdId.value = node.data.id
            break
        case 400:
            subId.value = node.data.id
            break
        case 500:
            devId.value = node.data.id
            break
        case 600:
            busBarId.value = node.data.id
            break
        case 700:
            lineId.value = node.data.id
            break
    }
    if (node.parent) {
        evaluate(node.parent)
    }
}
const selectChanged = async (value: any) => {
    let num: any = voltageLevelArr.filter(item => item.id == value)[0].value
    let capacity = 10
    switch (num) {
        case '500':
            capacity = 4500
            break
        case '330':
            capacity = 3000
            break
        case '220':
            capacity = 2000
            break
        case '110':
            capacity = 750
            break
        case '35':
            capacity = 250
            break
        case '10':
            capacity = 100
            break
        case '6':
            capacity = 100
            break
        case '0.38':
            capacity = 10
            break
        case '20':
            capacity = 200
            break
        case '66':
            capacity = 500
            break
        case '750':
            capacity = 7000
            break
       // case '800':
         //   capacity = 7000
         //   break
        case '1000':
            capacity = 9000
            break
    }

    setTimeout(() => {
        setTheDefaultValue(capacity, num * 1000, num < 1 ? num * 1000 : 100)
        setvoltageDev(num)
    }, 0)

    // // 0.38
    // if (value === '3d68ceef26a579efe2fe0cdc654911b7') {
    //     setTheDefaultValue(10, 0.38 * 1000, 0.38 * 1000)

    //     //750kv
    // } else if (value === '4cf2d844c47a15a1c16a65b4bbfd1b0e') {
    //     setTheDefaultValue(7000, 750 * 1000, 100)

    //     //6kv
    // } else if (value === '37b81bf8aa0fd54098716da3fc0ee433') {
    //     setTheDefaultValue(100, 6 * 1000, 100)

    //     //10kv
    // } else if (value === 'e3da890104e3c4ae1f005021411a1fd7') {
    //     setTheDefaultValue(100, 10 * 1000, 100)

    //     //20kv
    // } else if (value === '87065e15765e5899114a6d6b9e4fb3cb') {
    //     setTheDefaultValue(200, 20 * 1000, 100)

    //     //35kv
    // } else if (value === '8529cfa11356a0666afd3f9fa4da09a4') {
    //     setTheDefaultValue(250, 35 * 1000, 100)

    //     //66kv
    // } else if (value === '9ce75596a3368da4adf3374b4fc3b619') {
    //     setTheDefaultValue(500, 66 * 1000, 100)

    //     //110kv
    // } else if (value === 'e96d74b79bd50ad0bc00a405246f1e1f') {
    //     setTheDefaultValue(750, 110 * 1000, 100)

    //     //220kv
    // } else if (value === '1b7b58ed8fcc2992b95334eaa9010c41') {
    //     setTheDefaultValue(2000, 220 * 1000, 100)

    //     //330kv
    // } else if (value === 'c1b37350a67f5e229a1f96ace0ad04dc') {
    //     setTheDefaultValue(3000, 330 * 1000, 100)

    //     //500kv
    // } else if (value === '1fa650685c77db1656c70f9db4a2edc6') {
    //     setTheDefaultValue(4500, 500 * 1000, 100)

    //     //1000kv
    // } else if (value === '674cf02fb3fcfd9f99fd786cfca090df') {
    //     setTheDefaultValue(9000, 1000 * 1000, 100)
    // } else {
    //     setTheDefaultValue(10, 1, 1)
    // }
    // setvoltageDev(voltageLevelArr.filter(item => item.id == value)[0].value)
}

const setTheDefaultValue = (capacity: number, pt1: number, pt2: number) => {
    AddProjectBO.value.deviceParam[deviceIndex.value].subVoltageParam[busBarIndex.value].lineParam[
        lineIndex.value
    ].standardCapacity = capacity
    AddProjectBO.value.deviceParam[deviceIndex.value].subVoltageParam[busBarIndex.value].lineParam[
        lineIndex.value
    ].dealCapacity = capacity
    AddProjectBO.value.deviceParam[deviceIndex.value].subVoltageParam[busBarIndex.value].lineParam[
        lineIndex.value
    ].devCapacity = capacity
    AddProjectBO.value.deviceParam[deviceIndex.value].subVoltageParam[busBarIndex.value].lineParam[
        lineIndex.value
    ].shortCapacity = capacity

    AddProjectBO.value.deviceParam[deviceIndex.value].subVoltageParam[busBarIndex.value].lineParam[
        lineIndex.value
    ].pt1 = pt1
    AddProjectBO.value.deviceParam[deviceIndex.value].subVoltageParam[busBarIndex.value].lineParam[
        lineIndex.value
    ].pt2 = pt2
}
const setvoltageDev = (value: any) => {
    let voltageDev = 7
    let uvoltageDev = -7

    if (value > 110) {
        voltageDev = 10
        uvoltageDev = -10
    } else if (value > 66) {
        voltageDev = 7
        uvoltageDev = -3
    } else if (value >= 35) {
        voltageDev = 10
        uvoltageDev = -10
    } else if (value >= 2) {
        voltageDev = 7.0
        uvoltageDev = -7.0
    } else if (value > 0.22) {
        voltageDev = 7.0
        uvoltageDev = -7.0
    } else {
        voltageDev = 7.0
        uvoltageDev = -10.0
    }

    AddProjectBO.value.deviceParam[deviceIndex.value].subVoltageParam[busBarIndex.value].lineParam[
        lineIndex.value
    ].voltageDev = voltageDev
    AddProjectBO.value.deviceParam[deviceIndex.value].subVoltageParam[busBarIndex.value].lineParam[
        lineIndex.value
    ].uvoltageDev = uvoltageDev
}
const area = () => {
    areaTree({ id: '', type: 0 }).then((res: any) => {
        treeOptions.value = res.data
    })
    nodeAllList().then(res => {
        // console.log("前置机", res);
        affiliatiedFrontArr.value = res.data
        deviceBODetail.value.nodeId = res.data[0].id
    })

    let data = new Date()
    let year: any = data.getFullYear()
    let month: any = data.getMonth()
    if (month + 1 >= 10) {
        month = month + 1
    } else {
        month = '0' + (month + 1)
    }
    let day: any = data.getDate()
    if (day >= 10) {
        day = day
    } else {
        day = '0' + day
    }
    deviceBODetail.value.thisTimeCheck = year + '-' + month + '-' + day
    deviceBODetail.value.loginTime = year + '-' + month + '-' + day
    deviceBODetail.value.updateTime = year + '-' + month + '-' + day
    deviceBODetail.value.nextTimeCheck = year + 1 + '-' + month + '-' + (day - 1 >= 10 ? day - 1 : '0' + (day - 1))
}
const setDown = () => {
    selectUserList({}).then(res => {
        newStationIdArr.value = res.data
    })
}

onMounted(() => {
    const dom = document.getElementById('navigation-splitpanes')
    if (dom) {
        size.value = Math.round((180 / dom.offsetHeight) * 120)
    }
    if (VITE_FLAG) {
        getYwZtSubstation({ orgId: '' }).then(res => {
            powerStationList.value = res.data
        })
    } else {
        getDevTypeList().then(res => {
            typeArr.value = res.data
        })
    }
    category()
})
area()
</script>

<style lang="scss" scoped>
.device-manage {
    display: flex;
    padding: 10px;

    &-right {
        overflow: hidden;
        flex: 1;
        padding: 10px 10px 10px 0;

        .el-descriptions__header {
            height: 36px;
            margin-bottom: 7px;
            display: flex;
            align-items: center;
        }
    }
}

.main-form {
    display: flex;
    flex-wrap: wrap;

    .form-top {
        width: 100%;
    }

    .el-form-item {
        width: 30%;
        margin-bottom: 15px;

        .el-select {
            width: 100%;
            min-width: 0px;
        }
    }
}

.el-tabs__content {
    margin-top: 15px;
}

.splitpanes.default-theme .splitpanes__pane {
    background: #fff !important;
}
.title {
    width: 500px;
    overflow: hidden;
    // display: flex;
    white-space: nowrap;
    font-weight: bold;
}
.titleScroll {
    animation: scroll 10s linear infinite; /* 滚动动画 */
}
@keyframes scroll {
    0% {
        transform: translateX(100%); /* 从右侧开始 */
    }
    100% {
        transform: translateX(-160%); /* 滚动到左侧 */
    }
}
</style>
