<template>
  <div class="p-2">
    <transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
      <div v-show="showSearch" class="mb-[10px]">
        <el-card shadow="hover">
          <el-form ref="queryFormRef" :model="queryParams" :inline="true" label-width="auto">
            <el-form-item label="逆变器SN" prop="sn">
              <el-input v-model="queryParams.sn" placeholder="请输入逆变器SN" clearable @keyup.enter="handleQuery" />
            </el-form-item>
            <el-form-item label="项目id" prop="projectId">
              <el-input v-model="queryParams.projectId" placeholder="请输入项目id" clearable @keyup.enter="handleQuery" />
            </el-form-item>
            <!--            <el-form-item label="电站id" prop="stationid">-->
            <!--              <el-input v-model="queryParams.stationid" placeholder="请输入电站id" clearable @keyup.enter="handleQuery" />-->
            <!--            </el-form-item>-->
            <!--            </el-form-item>-->
            <!--            <el-form-item label="电站名称" prop="stationname">-->
            <!--              <el-input v-model="queryParams.stationname" placeholder="请输入电站名称" clearable @keyup.enter="handleQuery" />-->
            <!--            </el-form-item>-->
            <!--            <el-form-item label="业主id" prop="userid">-->
            <!--              <el-input v-model="queryParams.userid" placeholder="请输入业主id" clearable @keyup.enter="handleQuery" />-->
            <!--            </el-form-item>-->
            <!--            <el-form-item label="装机容量" prop="power">-->
            <!--              <el-input v-model="queryParams.power" placeholder="请输入装机容量" clearable @keyup.enter="handleQuery" />-->
            <!--            </el-form-item>-->
            <!--            <el-form-item label="装机容量单位" prop="powerstr">-->
            <!--              <el-input v-model="queryParams.powerstr" placeholder="请输入装机容量单位" clearable @keyup.enter="handleQuery" />-->
            <!--            </el-form-item>-->
            <!--            <el-form-item label="当日能量" prop="etoday">-->
            <!--              <el-input v-model="queryParams.etoday" placeholder="请输入当日能量" clearable @keyup.enter="handleQuery" />-->
            <!--            </el-form-item>-->
            <!--            <el-form-item label="当日发电量原始值" prop="etoday1">-->
            <!--              <el-input v-model="queryParams.etoday1" placeholder="请输入当日发电量原始值" clearable @keyup.enter="handleQuery" />-->
            <!--            </el-form-item>-->
            <!--            <el-form-item label="当日能量单位" prop="etodaystr">-->
            <!--              <el-input v-model="queryParams.etodaystr" placeholder="请输入当日能量单位" clearable @keyup.enter="handleQuery" />-->
            <!--            </el-form-item>-->
            <!--            <el-form-item label="总电量" prop="etotal">-->
            <!--              <el-input v-model="queryParams.etotal" placeholder="请输入总电量" clearable @keyup.enter="handleQuery" />-->
            <!--            </el-form-item>-->
            <!--            <el-form-item label="累计发电量原始值" prop="etotal1">-->
            <!--              <el-input v-model="queryParams.etotal1" placeholder="请输入累计发电量原始值" clearable @keyup.enter="handleQuery" />-->
            <!--            </el-form-item>-->
            <!--            <el-form-item label="总能量单位" prop="etotalstr">-->
            <!--              <el-input v-model="queryParams.etotalstr" placeholder="请输入总能量单位" clearable @keyup.enter="handleQuery" />-->
            <!--            </el-form-item>-->
            <!--            <el-form-item label="满发小时数" prop="fullhour">-->
            <!--              <el-input v-model="queryParams.fullhour" placeholder="请输入满发小时数" clearable @keyup.enter="handleQuery" />-->
            <!--            </el-form-item>-->
            <!--            <el-form-item label="功率" prop="pac">-->
            <!--              <el-input v-model="queryParams.pac" placeholder="请输入功率" clearable @keyup.enter="handleQuery" />-->
            <!--            </el-form-item>-->
            <!--            <el-form-item label="功率单位" prop="pacstr">-->
            <!--              <el-input v-model="queryParams.pacstr" placeholder="请输入功率单位" clearable @keyup.enter="handleQuery" />-->
            <!--            </el-form-item>-->
            <!--            <el-form-item-->
            <!--              label="逆变器状态：-->
            <!--1 = 在线-->
            <!--2 = 离线-->
            <!--3 = 报警"-->
            <!--              prop="state"-->
            <!--            >-->
            <!--              <el-input-->
            <!--                v-model="queryParams.state"-->
            <!--                placeholder="请输入逆变器状态：-->
            <!--1 = 在线-->
            <!--2 = 离线-->
            <!--3 = 报警"-->
            <!--                clearable-->
            <!--                @keyup.enter="handleQuery"-->
            <!--              />-->
            <!--            </el-form-item>-->
            <!--            <el-form-item label="更新时间" prop="datatimestamp">-->
            <!--              <el-input v-model="queryParams.datatimestamp" placeholder="请输入更新时间" clearable @keyup.enter="handleQuery" />-->
            <!--            </el-form-item>-->
            <!--            <el-form-item label="采集器SN" prop="collectorsn">-->
            <!--              <el-input v-model="queryParams.collectorsn" placeholder="请输入采集器SN" clearable @keyup.enter="handleQuery" />-->
            <!--            </el-form-item>-->
            <!--            <el-form-item label="逆变器类型" prop="productmodel">-->
            <!--              <el-input v-model="queryParams.productmodel" placeholder="请输入逆变器类型" clearable @keyup.enter="handleQuery" />-->
            <!--            </el-form-item>-->
            <!--            <el-form-item label="逆变器系列" prop="series">-->
            <!--              <el-input v-model="queryParams.series" placeholder="请输入逆变器系列" clearable @keyup.enter="handleQuery" />-->
            <!--            </el-form-item>-->
            <!--            <el-form-item label="逆变器名称" prop="name">-->
            <!--              <el-input v-model="queryParams.name" placeholder="请输入逆变器名称" clearable @keyup.enter="handleQuery" />-->
            <!--            </el-form-item>-->
            <!--            <el-form-item label="电站地址" prop="addr">-->
            <!--              <el-input v-model="queryParams.addr" placeholder="请输入电站地址" clearable @keyup.enter="handleQuery" />-->
            <!--            </el-form-item>-->
            <!--            <el-form-item label="采集器状态" prop="collectorstate">-->
            <!--              <el-input v-model="queryParams.collectorstate" placeholder="请输入采集器状态" clearable @keyup.enter="handleQuery" />-->
            <!--            </el-form-item>-->
            <!--            <el-form-item-->
            <!--              label="逆变器离线状态：-->
            <!--0 = 正常离线-->
            <!--1 = 异常离线"-->
            <!--              prop="stateexceptionflag"-->
            <!--            >-->
            <!--              <el-input-->
            <!--                v-model="queryParams.stateexceptionflag"-->
            <!--                placeholder="请输入逆变器离线状态：-->
            <!--0 = 正常离线-->
            <!--1 = 异常离线"-->
            <!--                clearable-->
            <!--                @keyup.enter="handleQuery"-->
            <!--              />-->
            <!--            </el-form-item>-->
            <!--            <el-form-item label="累计满发小时数" prop="totalfullhour">-->
            <!--              <el-input v-model="queryParams.totalfullhour" placeholder="请输入累计满发小时数" clearable @keyup.enter="handleQuery" />-->
            <!--            </el-form-item>-->
            <!--            <el-form-item label="逆变器电表类型，详见附录3" prop="invertermetermodel">-->
            <!--              <el-input v-model="queryParams.invertermetermodel" placeholder="请输入逆变器电表类型，详见附录3" clearable @keyup.enter="handleQuery" />-->
            <!--            </el-form-item>-->
            <!--            <el-form-item label="创建时间" prop="createdate">-->
            <!--              <el-input v-model="queryParams.createdate" placeholder="请输入创建时间" clearable @keyup.enter="handleQuery" />-->
            <!--            </el-form-item>-->
            <!--            <el-form-item label="质保结束时间" prop="updateshelfendtime">-->
            <!--              <el-input v-model="queryParams.updateshelfendtime" placeholder="请输入质保结束时间" clearable @keyup.enter="handleQuery" />-->
            <!--            </el-form-item>-->
            <el-form-item>
              <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
              <el-button icon="Refresh" @click="resetQuery">重置</el-button>
            </el-form-item>
          </el-form>
        </el-card>
      </div>
    </transition>

    <el-card shadow="never">
      <template #header>
        <el-row :gutter="10" class="mb8">
          <!--          <el-col :span="1.5">-->
          <!--            <el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['business:inverter:add']">新增</el-button>-->
          <!--          </el-col>-->
          <!--          <el-col :span="1.5">-->
          <!--            <el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['business:inverter:edit']"-->
          <!--              >修改</el-button-->
          <!--            >-->
          <!--          </el-col>-->
          <!--          <el-col :span="1.5">-->
          <!--            <el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['business:inverter:remove']"-->
          <!--              >删除</el-button-->
          <!--            >-->
          <!--          </el-col>-->
          <el-col :span="1.5">
            <el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['business:inverter:export']">导出</el-button>
          </el-col>
          <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
        </el-row>
      </template>

      <el-table v-loading="loading" border :data="inverterList" @selection-change="handleSelectionChange">
        <el-table-column type="selection" width="55" align="center" />
        <!--        <el-table-column label="逆变器id" align="center" prop="id" v-if="true" />-->
        <el-table-column label="电站名称" align="center" prop="stationname" />
        <el-table-column label="逆变器SN" align="center" prop="sn" />
        <!--        <el-table-column label="项目id" align="center" prop="projectId" />-->
        <!--        <el-table-column label="电站id" align="center" prop="stationid" />-->
        <!--        <el-table-column label="业主id" align="center" prop="userid" />-->
        <el-table-column label="装机容量" align="center" prop="power" />
        <el-table-column label="装机容量单位" align="center" prop="powerstr" />
        <el-table-column label="当日能量" align="center" prop="etoday" />
        <!--        <el-table-column label="当日发电量原始值" align="center" prop="etoday1" />-->
        <el-table-column label="当日能量单位" align="center" prop="etodaystr" />
        <el-table-column label="总电量" align="center" prop="etotal" />
        <!--        <el-table-column label="累计发电量原始值" align="center" prop="etotal1" />-->
        <el-table-column label="总能量单位" align="center" prop="etotalstr" />
        <el-table-column label="满发小时数" align="center" prop="fullhour" />
        <!--        <el-table-column label="功率" align="center" prop="pac" />-->
        <!--        <el-table-column label="功率单位" align="center" prop="pacstr" />-->
        <el-table-column
          label="逆变器状态：
        1 = 在线
        2 = 离线
        3 = 报警"
          align="center"
          prop="state"
        >
          <template #default="scope">
            <el-tag v-if="scope.row.state === 1" type="success">在线</el-tag>
            <el-tag v-else-if="scope.row.state === 2" type="danger">离线</el-tag>
            <el-tag v-else-if="scope.row.state === 3" type="warning">报警</el-tag>
          </template>
        </el-table-column>
        <!--        <el-table-column label="更新时间" align="center" prop="datatimestamp" />-->
        <!--        <el-table-column label="采集器SN" align="center" prop="collectorsn" />-->
        <!--        <el-table-column label="逆变器类型" align="center" prop="productmodel" />-->
        <!--        <el-table-column-->
        <!--          label="直流输入路数：值+1 = 实际路数-->
        <!--如：值0 = 1路，值1 = 2路，值2 = 3路…"-->
        <!--          align="center"-->
        <!--          prop="dcinputtype"-->
        <!--        />-->
        <!--        <el-table-column label="交流输出类：0 = 单相，其他 = 三相" align="center" prop="acoutputtype" />-->
        <!--        <el-table-column label="逆变器系列" align="center" prop="series" />-->
        <!--        <el-table-column label="逆变器名称" align="center" prop="name" />-->
        <!--        <el-table-column label="电站地址" align="center" prop="addr" />-->
        <!--        <el-table-column label="采集器状态" align="center" prop="collectorstate" />-->
        <el-table-column
          label="逆变器离线状态：
        0 = 正常离线
        1 = 异常离线"
          align="center"
          prop="stateexceptionflag"
        >
          <template #default="scope">
            <el-tag v-if="scope.row.stateexceptionflag === 0" type="success">正常离线</el-tag>
            <el-tag v-else-if="scope.row.stateexceptionflag === 1" type="danger">异常离线</el-tag>
          </template>
        </el-table-column>
        <!--        <el-table-column label="累计满发小时数" align="center" prop="totalfullhour" />-->
        <el-table-column label="逆变器电表类型，详见附录3" align="center" prop="invertermetermodel">
          <template #default="scope">
            <el-tag v-if="scope.row.invertermetermodel === 1" type="info">并网电站</el-tag>
            <el-tag v-else-if="scope.row.invertermetermodel === 2" type="info">储能电站</el-tag>
            <el-tag v-else-if="scope.row.invertermetermodel === 3" type="info">AC Couple 电站</el-tag>
            <el-tag v-else-if="scope.row.invertermetermodel === 4" type="info">EPM电站(并网+电表)</el-tag>
            <el-tag v-else-if="scope.row.invertermetermodel === 5" type="info">内置电表(并网+电表)</el-tag>
            <el-tag v-else-if="scope.row.invertermetermodel === 6" type="info">外置电表(显示电表)</el-tag>
            <el-tag v-else-if="scope.row.invertermetermodel === 7" type="info">S5离网并机储能</el-tag>
            <el-tag v-else-if="scope.row.invertermetermodel === 8" type="info">S5并网并机储能</el-tag>
            <el-tag v-else-if="scope.row.invertermetermodel === 9" type="info">并网+AC Couple 电站</el-tag>
            <el-tag v-else-if="scope.row.invertermetermodel === 10" type="info">离网储能</el-tag>
            <el-tag v-else-if="scope.row.invertermetermodel === 11" type="info">S6并网并机储能</el-tag>
          </template>
        </el-table-column>
        <!--        <el-table-column label="创建时间" align="center" prop="createdate" />-->
        <!--        <el-table-column label="质保结束时间" align="center" prop="updateshelfendtime" />-->
        <el-table-column label="所属项目" align="center" prop="projectName" />
        <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
          <template #default="scope">
            <el-tooltip content="详情" placement="top">
              <el-button link type="primary" icon="View" @click="handleCheck(scope.row)" v-hasPermi="['business:inverter:edit']"></el-button>
            </el-tooltip>
            <el-tooltip content="历史数据" placement="top">
              <el-button
                link
                type="primary"
                icon="Document"
                @click="handleCheckDetail(scope.row)"
                v-hasPermi="['business:inverter:edit']"
              ></el-button>
            </el-tooltip>
            <el-tooltip content="设备分配" placement="top">
              <el-button link type="primary" icon="Edit" @click="handleEditProgram(scope.row)" v-hasPermi="['business:inverter:edit']"></el-button>
            </el-tooltip>
            <el-tooltip content="删除" placement="top">
              <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['business:inverter:remove']"></el-button>
            </el-tooltip>
          </template>
        </el-table-column>
      </el-table>

      <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
    </el-card>
    <!-- 添加或修改逆变器列对话框 -->
    <el-dialog :title="dialog.title" v-model="dialog.visible" append-to-body>
      <el-form ref="inverterFormRef" :model="form" :rules="rules" label-width="auto" label-position="top" class="detailForm">
        <el-row :gutter="10">
          <el-col :span="24">
            <el-form-item label="逆变器SN" prop="sn">
              <el-input v-model="form.sn" placeholder="请输入逆变器SN" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <!--          <el-col :span="12">-->
          <!--            <el-form-item label="项目id" prop="projectId">-->
          <!--              <el-input v-model="form.projectId" placeholder="请输入项目id" :disabled="isCheck === true" />-->
          <!--            </el-form-item>-->
          <!--          </el-col>-->
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="电站id" prop="stationid">
              <el-input v-model="form.stationid" placeholder="请输入电站id" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="电站名称" prop="stationname">
              <el-input v-model="form.stationname" placeholder="请输入电站名称" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="业主id" prop="userid">
              <el-input v-model="form.userid" placeholder="请输入业主id" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="装机容量" prop="power">
              <el-input v-model="form.power" placeholder="请输入装机容量" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="装机容量单位" prop="powerstr">
              <el-input v-model="form.powerstr" placeholder="请输入装机容量单位" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="当日能量" prop="etoday">
              <el-input v-model="form.etoday" placeholder="请输入当日能量" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="当日发电量原始值" prop="etoday1">
              <el-input v-model="form.etoday1" placeholder="请输入当日发电量原始值" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="当日能量单位" prop="etodaystr">
              <el-input v-model="form.etodaystr" placeholder="请输入当日能量单位" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="总电量" prop="etotal">
              <el-input v-model="form.etotal" placeholder="请输入总电量" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="累计发电量原始值" prop="etotal1">
              <el-input v-model="form.etotal1" placeholder="请输入累计发电量原始值" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="总能量单位" prop="etotalstr">
              <el-input v-model="form.etotalstr" placeholder="请输入总能量单位" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="满发小时数" prop="fullhour">
              <el-input v-model="form.fullhour" placeholder="请输入满发小时数" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="功率" prop="pac">
              <el-input v-model="form.pac" placeholder="请输入功率" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="功率单位" prop="pacstr">
              <el-input v-model="form.pacstr" placeholder="请输入功率单位" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="更新时间" prop="datatimestamp">
              <el-input v-model="form.datatimestamp" placeholder="请输入更新时间" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="采集器SN" prop="collectorsn">
              <el-input v-model="form.collectorsn" placeholder="请输入采集器SN" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="质保结束时间" prop="updateshelfendtime">
              <el-input v-model="form.updateshelfendtime" placeholder="请输入质保结束时间" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="创建时间" prop="createdate">
              <el-input v-model="form.createdate" placeholder="请输入创建时间" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="逆变器名称" prop="name">
              <el-input v-model="form.name" placeholder="请输入逆变器名称" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="电站地址" prop="addr">
              <el-input v-model="form.addr" placeholder="请输入电站地址" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="采集器状态" prop="collectorstate">
              <el-input v-model="form.collectorstate" placeholder="请输入采集器状态" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="累计满发小时数" prop="totalfullhour">
              <el-input v-model="form.totalfullhour" placeholder="请输入累计满发小时数" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="20">
            <el-form-item label="逆变器电表类型，详见附录3" prop="invertermetermodel">
              <el-input v-model="form.invertermetermodelChinese" placeholder="请输入逆变器电表类型，详见附录3" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="20">
            <el-form-item
              label="逆变器状态：
        1 = 在线
        2 = 离线
        3 = 报警"
              prop="state"
            >
              <el-input
                v-model="form.stateChinese"
                placeholder="请输入逆变器状态：
        1 = 在线
        2 = 离线
        3 = 报警"
                :disabled="isCheck === true"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="20">
            <el-form-item
              label="逆变器离线状态：
        0 = 正常离线
        1 = 异常离线"
              prop="stateexceptionflag"
            >
              <el-input
                v-model="form.stateexceptionflagChinese"
                placeholder="请输入逆变器离线状态：
        0 = 正常离线
        1 = 异常离线"
                :disabled="isCheck === true"
              />
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <template #footer>
        <div class="dialog-footer">
          <el-button @click="cancel">取 消</el-button>
        </div>
      </template>
    </el-dialog>
    <el-dialog :title="dialog2.title" v-model="dialog2.visible" append-to-body>
      <el-form ref="inverterFormRef2" :model="form2" :rules="rules" label-width="auto" label-position="top" class="detailForm">
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="逆变器id" prop="id">
              <el-input v-model="form2.id" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="逆变器SN" prop="sn">
              <el-input v-model="form2.sn" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="电站id" prop="stationId">
              <el-input v-model="form2.stationId" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="电站名称" prop="stationName">
              <el-input v-model="form2.stationName" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="24">
            <el-form-item label="采集器id" prop="collectorId">
              <el-input v-model="form2.collectorId" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="采集器名称" prop="collectorName">
              <el-input v-model="form2.collectorName" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="当前状态" prop="currentState">
              <el-input v-model="form2.currentState" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="当日能量" prop="eToday">
              <el-input v-model="form2.eToday" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="当日能量单位" prop="eTodayStr">
              <el-input v-model="form2.eTodayStr" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="当月能量" prop="eMonth">
              <el-input v-model="form2.eMonth" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="当月能量单位" prop="eMonthStr">
              <el-input v-model="form2.eMonthStr" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="当年能量" prop="eYear">
              <el-input v-model="form2.eYear" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="当年能量单位" prop="eYearStr">
              <el-input v-model="form2.eYearStr" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="总能量" prop="eTotal">
              <el-input v-model="form2.eTotal" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="总能量单位" prop="eTotalStr">
              <el-input v-model="form2.eTotalStr" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="电网频率" prop="fac">
              <el-input v-model="form2.fac" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="电网频率单位" prop="facStr">
              <el-input v-model="form2.facStr" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="实时功率" prop="pac">
              <el-input v-model="form2.pac" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="实时功率单位" prop="pacStr">
              <el-input v-model="form2.pacStr" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="功率百分比" prop="pacPec">
              <el-input v-model="form2.pacPec" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="满发小时数" prop="fullHour">
              <el-input v-model="form2.fullHour" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="装机容量" prop="power">
              <el-input v-model="form2.power" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="装机容量单位" prop="powerStr">
              <el-input v-model="form2.powerStr" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="8">
            <el-form-item label="交流电流R" prop="iAc1">
              <el-input v-model="form2.iAc1" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="交流电流S" prop="iAc2">
              <el-input v-model="form2.iAc2" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="交流电流T" prop="iAc3">
              <el-input v-model="form2.iAc3" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="8">
            <el-form-item label="交流电压R" prop="uAc1">
              <el-input v-model="form2.uAc1" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="交流电压S" prop="uAc2">
              <el-input v-model="form2.uAc2" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="交流电压T" prop="uAc3">
              <el-input v-model="form2.uAc3" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="逆变器状态" prop="state">
              <el-input v-model="form2.state" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="更新时间" prop="dataTimestamp">
              <el-input v-model="form2.dataTimestamp" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="逆变器温度" prop="inverterTemperature">
              <el-input v-model="form2.inverterTemperature" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="国家标准" prop="nationalStandardstr">
              <el-input v-model="form2.nationalStandardstr" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="交流输出类型" prop="acOutputType">
              <el-input v-model="form2.acOutputType" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="直流输入路数" prop="dcInputtype">
              <el-input v-model="form2.dcInputtype" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="24">
            <el-form-item label="功率因数" prop="powerFactor">
              <el-input v-model="form2.powerFactor" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="当日电池充电电量" prop="batteryTodayChargeEnergy">
              <el-input v-model="form2.batteryTodayChargeEnergy" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="当日电池充电电量单位" prop="batteryTodayChargeEnergyStr">
              <el-input v-model="form2.batteryTodayChargeEnergyStr" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="当月电池充电电量" prop="batteryMonthChargeEnergy">
              <el-input v-model="form2.batteryMonthChargeEnergy" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="当月电池充电电量" prop="batteryMonthChargeEnergyStr">
              <el-input v-model="form2.batteryMonthChargeEnergyStr" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="当年电池充电电量" prop="batteryYearChargeEnergy">
              <el-input v-model="form2.batteryYearChargeEnergy" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="当年电池充电电量单位" prop="batteryYearChargeEnergyStr">
              <el-input v-model="form2.batteryYearChargeEnergyStr" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="电池总充电电量" prop="batteryTotalChargeEnergy">
              <el-input v-model="form2.batteryTotalChargeEnergy" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="电池总充电电量单位" prop="batteryTotalChargeEnergyStr">
              <el-input v-model="form2.batteryTotalChargeEnergyStr" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="当日电池放电电量" prop="batteryTodayDischargeEnergy">
              <el-input v-model="form2.batteryTodayDischargeEnergy" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="当日电池放电电量单位" prop="batteryTodayDischargeEnergyStr">
              <el-input v-model="form2.batteryTodayDischargeEnergyStr" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="当月电池放电电量" prop="batteryMonthDischargeEnergy">
              <el-input v-model="form2.batteryMonthDischargeEnergy" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="当月电池放电电量单位" prop="batteryMonthDischargeEnergyStr">
              <el-input v-model="form2.batteryMonthDischargeEnergyStr" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="当年电池放电电量" prop="batteryYearDischargeEnergy">
              <el-input v-model="form2.batteryYearDischargeEnergy" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="当年电池放电电量单位" prop="batteryYearDischargeEnergyStr">
              <el-input v-model="form2.batteryYearDischargeEnergyStr" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="电池总放电量" prop="batteryTotalDischargeEnergy">
              <el-input v-model="form2.batteryTotalDischargeEnergy" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="电池总放电量单位" prop="batteryTotalDischargeEnergyStr">
              <el-input v-model="form2.batteryTotalDischargeEnergyStr" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="当日电表买电" prop="gridPurchasedTodayEnergy">
              <el-input v-model="form2.gridPurchasedTodayEnergy" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="当日电表买电单位" prop="gridPurchasedTodayEnergyStr">
              <el-input v-model="form2.gridPurchasedTodayEnergyStr" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="当月电表买电" prop="gridPurchasedMonthEnergy">
              <el-input v-model="form2.gridPurchasedMonthEnergy" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="当月电表买电单位" prop="gridPurchasedMonthEnergyStr">
              <el-input v-model="form2.gridPurchasedMonthEnergyStr" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="当年电表买电" prop="gridPurchasedYearEnergy">
              <el-input v-model="form2.gridPurchasedYearEnergy" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="当年电表买电单位" prop="gridPurchasedYearEnergyStr">
              <el-input v-model="form2.gridPurchasedYearEnergyStr" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="累计电表买电" prop="gridPurchasedTotalEnergy">
              <el-input v-model="form2.gridPurchasedTotalEnergy" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="累计电表买电单位" prop="gridPurchasedTotalEnergyStr">
              <el-input v-model="form2.gridPurchasedTotalEnergyStr" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="当日电表卖电" prop="gridSellTodayEnergy">
              <el-input v-model="form2.gridSellTodayEnergy" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="当日电表卖电单位" prop="gridSellTodayEnergyStr">
              <el-input v-model="form2.gridSellTodayEnergyStr" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="当月电表卖电" prop="gridSellMonthEnergy">
              <el-input v-model="form2.gridSellMonthEnergy" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="当月电表卖电单位" prop="gridSellMonthEnergyStr">
              <el-input v-model="form2.gridSellMonthEnergyStr" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="当年电表卖电" prop="gridSellYearEnergy">
              <el-input v-model="form2.gridSellYearEnergy" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="当年电表卖电单位" prop="gridSellYearEnergyStr">
              <el-input v-model="form2.gridSellYearEnergyStr" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="累计电表卖电" prop="gridSellTotalEnergy">
              <el-input v-model="form2.gridSellTotalEnergy" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="累计电表卖电单位" prop="gridSellTotalEnergyStr">
              <el-input v-model="form2.gridSellTotalEnergyStr" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="家庭负载功率" prop="familyLoadPower">
              <el-input v-model="form2.familyLoadPower" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="家庭负载功率单位" prop="familyLoadPowerStr">
              <el-input v-model="form2.familyLoadPowerStr" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="旁路负载功率" prop="bypassLoadPower">
              <el-input v-model="form2.bypassLoadPower" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="旁路负载功率单位" prop="bypassLoadPowerStr">
              <el-input v-model="form2.bypassLoadPowerStr" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="8">
            <el-form-item label="电网总有功功率" prop="pSum">
              <el-input v-model="form2.pSum" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="电网总有功功率" prop="pSumStr">
              <el-input v-model="form2.pSumStr" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="电网总有功功率百分比" prop="psumPec">
              <el-input v-model="form2.psumPec" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="当日负载用电电量" prop="homeLoadTodayEnergy">
              <el-input v-model="form2.homeLoadTodayEnergy" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="当日负载用电电量单位" prop="homeLoadTodayEnergyStr">
              <el-input v-model="form2.homeLoadTodayEnergyStr" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="累计负载用电量" prop="homeLoadTotalEnergy">
              <el-input v-model="form2.homeLoadTotalEnergy" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="累计负载用电量单位" prop="homeLoadTotalEnergyStr">
              <el-input v-model="form2.homeLoadTotalEnergyStr" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="逆变器model号" prop="model">
              <el-input v-model="form2.model" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="逆变器类型" prop="type">
              <el-input v-model="form2.type" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="逆变器名称" prop="name">
              <el-input v-model="form2.name" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="逆变器名称" prop="inverterMeterModel">
              <el-input v-model="form2.inverterMeterModel" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="逆变器离线状态" prop="stateExceptionFlag">
              <el-input v-model="form2.stateExceptionFlag" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="采集器状态" prop="collectorState">
              <el-input v-model="form2.collectorState" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="采集器model" prop="collectorModel">
              <el-input v-model="form2.collectorModel" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="警告信息故障数据" prop="warningInfoData">
              <el-input v-model="form2.warningInfoData" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="产品型号" prop="productModel">
              <el-input v-model="form2.productModel" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="执行的国家标准" prop="nationalStandards">
              <el-input v-model="form2.nationalStandards" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="24">
            <el-form-item label="逆变器软件版本" prop="version">
              <el-input v-model="form2.version" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="逆变器无功功率" prop="reactivePower">
              <el-input v-model="form2.reactivePower" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="逆变器无功功率单位" prop="reactivePowerStr">
              <el-input v-model="form2.reactivePowerStr" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="逆变器视在功率" prop="apparentPower">
              <el-input v-model="form2.apparentPower" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="逆变器视在功率单位" prop="apparentPowerStr">
              <el-input v-model="form2.apparentPowerStr" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="逆变器总直流输入功率" prop="dcPac">
              <el-input v-model="form2.dcPac" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="逆变器总直流输入功率单位" prop="dcPacStr">
              <el-input v-model="form2.dcPacStr" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="24">
            <el-form-item label="质保结束时间" prop="updateShelfEndTime">
              <el-input v-model="form2.updateShelfEndTime" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="电表A相电流" prop="iA">
              <el-input v-model="form2.iA" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="电表A相电压" prop="uA">
              <el-input v-model="form2.uA" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="电表A相视在功率" prop="aLookedPower">
              <el-input v-model="form2.aLookedPower" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="电表A相无功功率" prop="aReactivePower">
              <el-input v-model="form2.aReactivePower" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="电表A相有功功率" prop="aphasePowerFactor">
              <el-input v-model="form2.aphasePowerFactor" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="电表功率因数" prop="averagePowerFactor">
              <el-input v-model="form2.averagePowerFactor" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="电表B相电流" prop="iB">
              <el-input v-model="form2.iB" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="电表B相电压" prop="uB">
              <el-input v-model="form2.uB" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="8">
            <el-form-item label="电表B相视在功率" prop="bLookedPower">
              <el-input v-model="form2.bLookedPower" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="电表B相无功功率" prop="bReactivePower">
              <el-input v-model="form2.bReactivePower" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="电表B相有功功率" prop="bphasePowerFactor">
              <el-input v-model="form2.bphasePowerFactor" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="电表C相电流" prop="iC">
              <el-input v-model="form2.iC" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="电表C相电压" prop="uC">
              <el-input v-model="form2.uC" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="8">
            <el-form-item label="电表C相视在功率" prop="cLookedPower">
              <el-input v-model="form2.cLookedPower" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="电表C相无功功率" prop="cReactivePower">
              <el-input v-model="form2.cReactivePower" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="电表电网频率" prop="fac">
              <el-input v-model="form2.fac" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="电池故障信息01" prop="batteryFailureInformation01">
              <el-input v-model="form2.batteryFailureInformation01" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="电池故障信息02" prop="batteryFailureInformation02">
              <el-input v-model="form2.batteryFailureInformation02" :disabled="isCheck === true" />
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div class="chart1" ref="myChart1" style="width: 100%; height: 200px"></div>
      <div class="chart1" ref="myChart2" style="width: 100%; height: 200px"></div>
      <div class="chart1" ref="myChart3" style="width: 100%; height: 200px"></div>
      <div class="chart1" ref="myChart4" style="width: 100%; height: 200px"></div>
      <div class="chart1" ref="myChart5" style="width: 100%; height: 200px"></div>
      <div class="chart1" ref="myChart6" style="width: 100%; height: 200px"></div>
      <template #footer>
        <div class="dialog-footer">
          <el-button @click="cancelD2">取 消</el-button>
        </div>
      </template>
    </el-dialog>
    <el-dialog v-model="dialog3.visible" :title="dialog3.title" append-to-body>
      <el-radio-group v-model="tempBelong">
        <el-radio v-for="(p, index) in programList" :key="index" :label="p.projectBrief" :value="p.projectId"></el-radio>
      </el-radio-group>
      <template #footer>
        <div class="dialog-footer">
          <el-button type="primary" @click="comfirmBelong">确 定</el-button>
          <el-button @click="cancelD3">取 消</el-button>
        </div>
      </template>
    </el-dialog>
  </div>
</template>

<script setup name="Inverter" lang="ts">
import {
  listInverter,
  getInverter,
  delInverter,
  addInverter,
  updateInverter,
  getInverterOther,
  getAll,
  updateInverterBelong
} from '@/api/business/inverter';
import { InverterVO, InverterQuery, InverterForm, HistoryInverterForm } from '@/api/business/inverter/types';
import { ref } from 'vue';
import * as echarts from 'echarts';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;

const inverterList = ref<InverterVO[]>([]);
const buttonLoading = ref(false);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref<Array<string | number>>([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);

const queryFormRef = ref<ElFormInstance>();
const inverterFormRef = ref<ElFormInstance>();
const inverterFormRef2 = ref<ElFormInstance>();

const dialog = reactive<DialogOption>({
  visible: false,
  title: ''
});
const dialog2 = reactive<DialogOption>({
  visible: false,
  title: ''
});
const dialog3 = reactive<DialogOption>({
  visible: false,
  title: ''
});

const initFormData: InverterForm = {
  id: undefined,
  sn: undefined,
  projectId: undefined,
  stationname: undefined,
  userid: undefined,
  power: undefined,
  powerstr: undefined,
  etoday: undefined,
  etoday1: undefined,
  etodaystr: undefined,
  etotal: undefined,
  etotal1: undefined,
  etotalstr: undefined,
  fullhour: undefined,
  pac: undefined,
  pacstr: undefined,
  state: undefined,
  datatimestamp: undefined,
  collectorsn: undefined,
  productmodel: undefined,
  dcinputtype: undefined,
  acoutputtype: undefined,
  series: undefined,
  name: undefined,
  addr: undefined,
  collectorstate: undefined,
  stateexceptionflag: undefined,
  totalfullhour: undefined,
  invertermetermodel: undefined,
  createdate: undefined,
  updateshelfendtime: undefined
};
const initFormData2: HistoryInverterForm = {
  id: undefined,
  sn: undefined,
  stationId: undefined,
  stationName: undefined,
  userId: undefined,
  collectorId: undefined,
  collectorName: undefined,
  collectorsn: undefined,
  currentState: undefined,
  eToday: undefined,
  eTodayStr: undefined,
  eMonth: undefined,
  eMonthStr: undefined,
  eYear: undefined,
  eYearStr: undefined,
  eTotal: undefined,
  eTotalStr: undefined,
  fac: undefined,
  facStr: undefined,
  pac: undefined,
  pacStr: undefined,
  pacPec: undefined,
  fullHour: undefined,
  power: undefined,
  powerStr: undefined,
  iAc1: undefined,
  iAc2: undefined,
  iAc3: undefined,
  uAc1: undefined,
  uAc2: undefined,
  uAc3: undefined,
  state: undefined,
  dataTimestamp: undefined,
  inverterTemperature: undefined,
  nationalStandardstr: undefined,
  acOutputType: undefined,
  dcInputtype: undefined,
  powerFactor: undefined,
  batteryTodayChargeEnergy: undefined,
  batteryTodayChargeEnergyStr: undefined,
  batteryMonthChargeEnergy: undefined,
  batteryMonthChargeEnergyStr: undefined,
  batteryYearChargeEnergy: undefined,
  batteryYearChargeEnergyStr: undefined,
  batteryTotalChargeEnergy: undefined,
  batteryTotalChargeEnergyStr: undefined,
  batteryTodayDischargeEnergy: undefined,
  batteryTodayDischargeEnergyStr: undefined,
  batteryMonthDischargeEnergy: undefined,
  batteryMonthDischargeEnergyStr: undefined,
  batteryYearDischargeEnergy: undefined,
  batteryYearDischargeEnergyStr: undefined,
  batteryTotalDischargeEnergy: undefined,
  batteryTotalDischargeEnergyStr: undefined,
  gridPurchasedTodayEnergy: undefined,
  gridPurchasedTodayEnergyStr: undefined,
  gridPurchasedMonthEnergy: undefined,
  gridPurchasedMonthEnergyStr: undefined,
  gridPurchasedYearEnergy: undefined,
  gridPurchasedYearEnergyStr: undefined,
  gridPurchasedTotalEnergy: undefined,
  gridPurchasedTotalEnergyStr: undefined,
  gridSellTodayEnergy: undefined,
  gridSellTodayEnergyStr: undefined,
  gridSellMonthEnergy: undefined,
  gridSellMonthEnergyStr: undefined,
  gridSellYearEnergy: undefined,
  gridSellYearEnergyStr: undefined,
  gridSellTotalEnergy: undefined,
  gridSellTotalEnergyStr: undefined,
  familyLoadPower: undefined,
  familyLoadPowerStr: undefined,
  bypassLoadPower: undefined,
  bypassLoadPowerStr: undefined,
  psum: undefined,
  psumStr: undefined,
  psumPec: undefined,
  homeLoadTodayEnergy: undefined,
  homeLoadTodayEnergyStr: undefined,
  homeLoadTotalEnergy: undefined,
  homeLoadTotalEnergyStr: undefined,
  model: undefined,
  type: undefined,
  name: undefined,
  inverterMeterModel: undefined,
  stateExceptionFlag: undefined,
  collectorState: undefined,
  collectorModel: undefined,
  warningInfoData: undefined,
  productModel: undefined,
  nationalStandards: undefined,
  version: undefined,
  reactivePower: undefined,
  reactivePowerStr: undefined,
  apparentPower: undefined,
  apparentPowerStr: undefined,
  dcPac: undefined,
  dcPacStr: undefined,
  updateShelfEndTime: undefined,
  iA: undefined, //电表A相电流
  uA: undefined, //电表A相电压
  aLookedPower: undefined, //电表A相视在功率
  aReactivePower: undefined, //电表A相无功功率
  aphasePowerFactor: undefined, //电表A相有功功率
  averagePowerFactor: undefined, //电表功率因数
  iB: undefined, //电表B相电流
  uB: undefined, //电表B相电压
  bLookedPower: undefined, //电表B相视在功率
  bReactivePower: undefined, //电表B相无功功率
  bphasePowerFactor: undefined, //电表B相有功功率
  iC: undefined, //电表C相电流
  uC: undefined, //电表C相电压
  cLookedPower: undefined, //电表C相视在功率
  cReactivePower: undefined, //电表C相无功功率
  cphasePowerFactor: undefined, //电表C相有功功率
  fac: undefined, //电表电网频率
  psumMeter: undefined, //电表总功率
  picName: undefined,
  batteryFailureInformation01: undefined,
  batteryFailureInformation02: undefined
};
const data = reactive<PageData<InverterForm, InverterQuery>>({
  form: { ...initFormData },
  queryParams: {
    pageNum: 1,
    pageSize: 10,
    sn: undefined,
    projectId: undefined,
    stationid: undefined,
    stationname: undefined,
    userid: undefined,
    power: undefined,
    powerstr: undefined,
    etoday: undefined,
    etoday1: undefined,
    etodaystr: undefined,
    etotal: undefined,
    etotal1: undefined,
    etotalstr: undefined,
    fullhour: undefined,
    pac: undefined,
    pacstr: undefined,
    state: undefined,
    datatimestamp: undefined,
    collectorsn: undefined,
    productmodel: undefined,
    dcinputtype: undefined,
    acoutputtype: undefined,
    series: undefined,
    name: undefined,
    addr: undefined,
    collectorstate: undefined,
    stateexceptionflag: undefined,
    totalfullhour: undefined,
    invertermetermodel: undefined,
    createdate: undefined,
    updateshelfendtime: undefined,
    params: {}
  },
  rules: {
    projectId: [{ required: true, message: '项目id不能为空', trigger: 'blur' }],
    powerstr: [{ required: true, message: '装机容量单位不能为空', trigger: 'blur' }],
    etoday: [{ required: true, message: '当日能量不能为空', trigger: 'blur' }],
    etoday1: [{ required: true, message: '当日发电量原始值不能为空', trigger: 'blur' }],
    etodaystr: [{ required: true, message: '当日能量单位不能为空', trigger: 'blur' }],
    etotal: [{ required: true, message: '总电量不能为空', trigger: 'blur' }],
    etotal1: [{ required: true, message: '累计发电量原始值不能为空', trigger: 'blur' }],
    etotalstr: [{ required: true, message: '总能量单位不能为空', trigger: 'blur' }],
    fullhour: [{ required: true, message: '满发小时数不能为空', trigger: 'blur' }],
    pac: [{ required: true, message: '功率不能为空', trigger: 'blur' }],
    pacstr: [{ required: true, message: '功率单位不能为空', trigger: 'blur' }],
    state: [{ required: true, message: '逆变器状态', trigger: 'blur' }],
    datatimestamp: [{ required: true, message: '更新时间不能为空', trigger: 'blur' }],
    collectorsn: [{ required: true, message: '采集器SN不能为空', trigger: 'blur' }],
    productmodel: [{ required: true, message: '逆变器类型不能为空', trigger: 'blur' }],
    dcinputtype: [{ required: true, message: '直流输入路数', trigger: 'change' }],
    acoutputtype: [{ required: true, message: '交流输出类：0 = 单相，其他 = 三相不能为空', trigger: 'change' }],
    series: [{ required: true, message: '逆变器系列不能为空', trigger: 'blur' }],
    name: [{ required: true, message: '逆变器名称不能为空', trigger: 'blur' }],
    addr: [{ required: true, message: '电站地址不能为空', trigger: 'blur' }],
    collectorstate: [{ required: true, message: '采集器状态不能为空', trigger: 'blur' }],
    stateexceptionflag: [{ required: true, message: '逆变器离线状态', trigger: 'blur' }],
    totalfullhour: [{ required: true, message: '累计满发小时数不能为空', trigger: 'blur' }],
    invertermetermodel: [{ required: true, message: '逆变器电表类型，详见附录3不能为空', trigger: 'blur' }],
    createdate: [{ required: true, message: '创建时间不能为空', trigger: 'blur' }],
    updateshelfendtime: [{ required: true, message: '质保结束时间不能为空', trigger: 'blur' }]
  }
});
const form2 = ref({ ...initFormData2 });

const { queryParams, form, rules } = toRefs(data);

/** 查询逆变器列列表 */
const getList = async () => {
  loading.value = true;
  const res = await listInverter(queryParams.value);
  inverterList.value = res.rows;
  inverterList.value = inverterList.value.map((item) => {
    return {
      ...item,
      projectName: getProjectName(item.projectId)
    };
  });
  total.value = res.total;
  loading.value = false;
};

function getProjectName(a: any) {
  let name;
  if (a !== '0') {
    programList.value.forEach((item) => {
      if (item.projectId === a) {
        console.info(item);
        name = item.projectBrief;
      }
    });
  } else {
    name = '无';
  }
  return name;
}

const isCheck = ref(false);
/** 取消按钮 */
const cancel = () => {
  reset();
  isCheck.value = false;
  dialog.visible = false;
};

/** 表单重置 */
const reset = () => {
  form.value = { ...initFormData };
  inverterFormRef.value?.resetFields();
};
const reset2 = () => {
  form.value = { ...initFormData2 };
  inverterFormRef2.value?.resetFields();
};

/** 搜索按钮操作 */
const handleQuery = () => {
  queryParams.value.pageNum = 1;
  getList();
};

/** 重置按钮操作 */
const resetQuery = () => {
  queryFormRef.value?.resetFields();
  handleQuery();
};

/** 多选框选中数据 */
const handleSelectionChange = (selection: InverterVO[]) => {
  ids.value = selection.map((item) => item.id);
  single.value = selection.length != 1;
  multiple.value = !selection.length;
};

/** 新增按钮操作 */
const handleAdd = () => {
  reset();
  dialog.visible = true;
  dialog.title = '添加逆变器列';
};

/** 修改按钮操作 */
const handleUpdate = async (row?: InverterVO) => {
  reset();
  const _id = row?.id || ids.value[0];
  const res = await getInverter(_id);
  Object.assign(form.value, res.data);
  dialog.visible = true;
  dialog.title = '修改逆变器列';
};
const handleCheck = async (row?: InverterVO) => {
  reset();
  const _id = row?.id || ids.value[0];
  const res = await getInverter(_id);
  res.data = {
    ...res.data,
    invertermetermodelChinese: toinvertermetermodelChinese(res.data.invertermetermodel),
    stateexceptionflagChinese: res.data.invertermetermodel === 0 ? '正常离线' : '异常离线',
    stateChinese: res.data.state === 1 ? '在线' : res.data.state === 2 ? '离线' : '报警'
  };
  isCheck.value = true;
  Object.assign(form.value, res.data);
  dialog.visible = true;
  dialog.title = '逆变器详情';
};

const tempBelong = ref();
const tempId = ref();

const handleEditProgram = async (row?: InverterVO) => {
  console.info(row);
  tempBelong.value = row?.projectId;
  tempId.value = row?.id;
  dialog3.visible = true;
  dialog3.title = '逆变器项目分配';
};
function comfirmBelong() {
  updateInverterBelong(tempId.value, tempBelong.value).then((res) => {
    console.info(res);
    dialog3.visible = false;
    getList();
  });
}
function cancelD2() {
  dialog2.visible = false;
  getList();
}
function cancelD3() {
  dialog3.visible = false;
  getList();
}

function toinvertermetermodelChinese(a) {
  let res;
  if (a === 0) {
    res = '并网电站';
  } else if (a === 1) {
    res = '储能电站';
  } else if (a === 2) {
    res = 'AC Couple 电站';
  } else if (a === 3) {
    res = 'EPM电站(并网+电表)';
  } else if (a === 4) {
    res = '内置电表(并网+电表)';
  } else if (a === 5) {
    res = '外置电表(显示电表)';
  } else if (a === 6) {
    res = 'S5离网并机储能';
  } else if (a === 7) {
    res = 'S5并网并机储能';
  } else if (a === 8) {
    res = '并网+AC Couple 电站';
  } else if (a === 9) {
    res = '离网储能';
  } else if (a === 10) {
    res = 'S6并网并机储能';
  } else if (a === 11) {
    res = 'S6离网并机储能';
  }
  return res;
}

const programList = ref([]);

function getProList() {
  getAll().then((res) => {
    programList.value = res.data;
  });
}
const myChart1 = ref(null);
const myChart2 = ref(null);
const myChart3 = ref(null);
const myChart4 = ref(null);
const myChart5 = ref(null);
const myChart6 = ref(null);

function initChart(a: any, b: any, c: any, d: any, e?: any) {
  const chart1 = echarts.init(c);
  const option = {
    tooltip: {
      trigger: 'axis'
    },
    dataZoom: [
      {
        type: 'slider', // 滑动条
        show: true,
        xAxisIndex: [0], // 控制哪个x轴
        start: 0, // 初始显示范围的起始百分比
        end: 100, // 初始显示范围的结束百分比
        handleIcon:
          'M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4v1.3h1.3v-1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z',
        handleSize: '80%',
        handleStyle: {
          color: '#fff',
          shadowBlur: 3,
          shadowColor: 'rgba(0, 0, 0, 0.6)',
          shadowOffsetX: 2,
          shadowOffsetY: 2,
          height: 10
        },
        labelFormatter: function (value) {
          return value;
        },
        // 阻止事件冒泡
        handleMove: function (params) {
          if (params.event.event) {
            params.event.event.stopPropagation();
          }
        },
        bottom: '8%',
        height: 10
      },
      {
        type: 'inside', // 内置型dataZoom组件，允许用户通过鼠标滚轮或触控缩放
        xAxisIndex: [0],
        start: 0,
        end: 100
      }
    ],
    grid: {
      left: '7%',
      right: '20%',
      bottom: '-20%',
      top: '5%',
      height: '82%',
      containLabel: true
    },
    xAxis: {
      type: 'category',
      data: b,
      boundaryGap: true, // 坐标轴两边留白策略
      axisTick: {
        show: false
      }
    },
    yAxis: {
      type: 'value',
      name: d,
      nameTextStyle: {
        padding: [0, 0, e, 0],
        verticalAlign: 'bottom'
      },
      nameLocation: 'center'
    },
    series: [
      {
        data: a,
        type: 'bar',
        itemStyle: {
          color: {
            type: 'linear',
            x: 0,
            y: 0,
            x2: 0,
            y2: 1,
            colorStops: [
              { offset: 0, color: '#ff7f50' }, // 0% 处的颜色
              { offset: 1, color: '#87cefa' } // 100% 处的颜色
            ],
            global: false // 缺省为 false
          }
        }
      }
    ]
  };
  chart1 && chart1.setOption(option);
}

const chart1Value = ref([]);
const chart1Index = ref([]);
const chart2Value = ref([]);
const chart2Index = ref([]);
const chart3Value = ref([]);
const chart3Index = ref([]);
const chart4Value = ref([]);
const chart4Index = ref([]);
const chart5Value = ref([]);
const chart5Index = ref([]);
const chart6Value = ref([]);
const chart6Index = ref([]);
const handleCheckDetail = async (row?: InverterVO) => {
  reset2();
  const _id = row?.id || ids.value[0];
  const res = await getInverterOther(_id);
  console.info(res.data);
  const data = res.data;
  for (const key in data) {
    if (key.includes('iPv') && !key.includes('Str')) {
      chart1Value.value.push(data[key]);
      chart1Index.value.push(key);
    }
  }
  for (const key in data) {
    if (key.includes('uPv') && !key.includes('Str')) {
      chart2Value.value.push(data[key]);
      chart2Index.value.push(key);
    }
  }
  for (const key in data) {
    if (key.includes('pow') && !key.includes('Str') && [...key].some((char) => !isNaN(char))) {
      chart3Value.value.push(data[key]);
      chart3Index.value.push(key);
    }
  }
  for (const key in data) {
    if (key.includes('mpptI') && !key.includes('Str')) {
      chart4Value.value.push(data[key]);
      chart4Index.value.push(key);
    }
  }
  for (const key in data) {
    if (key.includes('mpptU') && !key.includes('Str')) {
      chart5Value.value.push(data[key]);
      chart5Index.value.push(key);
    }
  }
  for (const key in data) {
    if (key.includes('mpptPow') && !key.includes('Str')) {
      chart6Value.value.push(data[key]);
      chart6Index.value.push(key);
    }
  }
  isCheck.value = true;
  res.data = {
    ...res.data,
    currentState: res.data.currentState === 1 ? '正常' : res.data.currentState === 2 ? '异常' : '报警',
    batteryFailureInformation01: res.data.batteryFailureInformation01 === '0' ? '正常' : '异常',
    batteryFailureInformation02: res.data.batteryFailureInformation02 === '0' ? '正常' : '异常'
  };
  Object.assign(form2.value, res.data);
  dialog2.visible = true;
  dialog2.title = '逆变器历史数据';
  await nextTick(() => {
    initChart(chart1Value.value, chart1Index.value, myChart1.value, '直流电流参数', 10);
    initChart(chart2Value.value, chart2Index.value, myChart2.value, '直流电压参数', 25);
    initChart(chart3Value.value, chart3Index.value, myChart3.value, '直流功率参数', 35);
    initChart(chart4Value.value, chart4Index.value, myChart4.value, 'mppt电流参数', 15);
    initChart(chart5Value.value, chart5Index.value, myChart5.value, 'mppt电压参数', 30);
    initChart(chart6Value.value, chart6Index.value, myChart6.value, 'mppt功率参数', 35);
  });
};

/** 提交按钮 */
const submitForm = () => {
  inverterFormRef.value?.validate(async (valid: boolean) => {
    if (valid) {
      buttonLoading.value = true;
      if (form.value.id) {
        await updateInverter(form.value).finally(() => (buttonLoading.value = false));
      } else {
        await addInverter(form.value).finally(() => (buttonLoading.value = false));
      }
      proxy?.$modal.msgSuccess('操作成功');
      dialog.visible = false;
      await getList();
    }
  });
};

/** 删除按钮操作 */
const handleDelete = async (row?: InverterVO) => {
  const _ids = row?.id || ids.value;
  await proxy?.$modal.confirm('是否确认删除逆变器列编号为"' + _ids + '"的数据项？').finally(() => (loading.value = false));
  await delInverter(_ids);
  proxy?.$modal.msgSuccess('删除成功');
  await getList();
};

/** 导出按钮操作 */
const handleExport = () => {
  proxy?.download(
    'business/inverter/export',
    {
      ...queryParams.value
    },
    `inverter_${new Date().getTime()}.xlsx`
  );
};

onMounted(() => {
  getProList();
  getList();
});
</script>
