<template>
  <div class="custom-config">
    <div class="form-wrapper">
      <div class="btns">
        <el-button class="buttons" size="mini" round @click="handleInsert">
          新增记录
        </el-button>
        <!-- <el-button class="buttons" size="mini" round @click="export2Excel">
          批量导出</el-button
        > -->
        <el-button class="buttons" size="mini" round @click="outExe">
          模板下载</el-button
        >
        <el-upload
          style="display: inline; margin-left: 10px"
          :action="url + 'alertrule/import'"
          :show-file-list="false"
          :on-success="handleSuccess"
          :on-progress="handleProgress"
          :on-error="handleError"
        >
          <el-button
            class="buttons"
            size="mini"
            round
            @click="exportShow = true"
          >
            批量导入</el-button
          >
        </el-upload>
      </div>
      <div class="search-wrapper">
        <el-select
          v-model="query.category"
          size="mini"
          class="search-item"
          popper-class="select"
          @change="categorychanged"
        >
          <el-option key="1" label="风机报警" value="windturbine"></el-option>
          <!-- <el-option
            key="2"
            label="升压站报警"
            value="booststation"
          ></el-option> -->
          <el-option key="3" label="光伏报警" value="inverter"></el-option>
        </el-select>
        <el-select
          v-model="query.wpId"
          clearable
          size="mini"
          class="search-item"
          :placeholder="'全部场站'"
          popper-class="select"
          @change="changeStation"
        >
          <el-option
            v-for="item in stationList"
            :key="item.id"
            :value="item.id"
            :label="item.aname"
          ></el-option>
        </el-select>
        <el-select
          v-model="query.relatedparts"
          clearable
          size="mini"
          class="search-item"
          placeholder="所属部件"
        >
          <el-option
            v-for="item in fetchList"
            :key="item.id"
            :label="item.name"
            :value="item.nemCode"
          >
          </el-option>
        </el-select>
        <el-select
          v-model="query.enabled"
          clearable
          size="mini"
          class="search-item"
          placeholder="是否可用"
        >
          <el-option
            v-for="item in state.isEnabled"
            :key="item.id"
            :label="item.name"
            :value="item.id"
          >
          </el-option>
        </el-select>
        <el-select
          v-model="query.modelId"
          clearable
          size="mini"
          class="search-item"
          placeholder="全部机型"
          popper-class="select"
        >
          <el-option
            v-for="item in modelList"
            :key="item.id"
            :value="item.id"
            :label="item.aname"
          ></el-option>
        </el-select>
        <!-- <el-select
          v-model="query.rank"
          clearable
          size="mini"
          class="search-item"
          placeholder="全部级别"
          popper-class="select"
        >
          <el-option
            v-for="item in state.rankList"
            :key="item.id"
            :value="item.id"
            :label="item.name"
          ></el-option>
        </el-select> -->
        <el-input
          placeholder="请输入名称"
          v-model="query.name"
          size="mini"
          class="search-item"
          clearable
        ></el-input>
        <el-button class="buttons" round size="mini" @click="getData"
          >搜索</el-button
        >
      </div>
    </div>
    <div class="table-wrapper">
      <div class="leftContent" :data-type="$store.state.moreSty">
        <span>{{ pageTitle }}</span>
      </div>
      <el-table
        :data="state.tableData"
        stripe
        style="height: calc(100% - 110px)"
      >
        <el-table-column
          v-for="item in state.tableHeader"
          :key="item.code"
          :label="item.title"
          :align="
            item.code == 'description' ||
            item.code == 'expression' ||
            item.code == 'name' ||
            item.code == 'modelId' ||
            item.code == 'relatedPartsName'
              ? 'left'
              : 'center'
          "
          :prop="item.code"
          :minWidth="item.width ? item.width : 60"
          show-overflow-tooltip
        >
          <template #default="scope">
            <span v-if="item.code == 'rank'">
              {{ rankConvert(scope.row.rank) }}
            </span>
            <span v-else-if="item.code == 'category'">
              {{ categoryConvert(scope.row.category) }}
            </span>
            <span v-else-if="item.code == 'enable'">
              {{ enabledConvert(scope.row.enable) }}
            </span>
            <span v-else-if="item.code == 'expression'">
              {{ scope.row.expression.substring(0, 3) }}**********
            </span>
            <span v-else-if="item.code == 'description'">
              {{ scope.row.description.substring(0, 3) }}**********
            </span>
            <span v-else>
              {{ scope.row[item.code] }}
            </span>
          </template>
        </el-table-column>

        <el-table-column label="操作" align="center" width="100" v-if="$store.state.userKey !== 'ld'">
          <template #default="scope">
            <el-button
              type="text"
              :style="`color: ${
                $store.state.theme ? '#1890ff' : '#47aee7'
              } !important`"
              size="mini"
              @click="handleEditClick(scope.row)"
              >编辑</el-button
            >
          </template>
        </el-table-column>
      </el-table>
      <div class="pagination">
        <el-pagination
          :current-page="query.pageNum"
          :page-size="query.pageSize"
          :total="total"
          layout="total, sizes, prev, pager, next"
          :page-sizes="[22, 50, 100, 200, 500]"
          @size-change="
            (value) => {
              query.pageSize = value;
              query.pageNum = 1;
              getData();
            }
          "
          @current-change="handlePageChange"
        ></el-pagination>
      </div>
    </div>
    <customcomponents
      @close="dialogclose"
      :isVisible="state.visible"
      :dialogOptions="state.form"
      :rankList="state.rankList"
      :modelListAll="state.modelListAll"
      :fetchListAll="state.fetchListAll"
    />
  </div>
</template>
<script setup>
import {
  custombj_fetchTableData,
  getStationinfo,
  fetchRelatePartAndAlarmType,
  fetchModel,
  fetchBooststation,
  custombj_importTemplate,
  getWpList,
} from "@/api/zhbj/index.js";
import { outExportExcel } from "@/tools/excel/exportExcel.js"; //引入文件
import {
  ref,
  onMounted,
  provide,
  computed,
  reactive,
  watch,
  nextTick,
} from "vue";
import { useStore } from "vuex";
import { useRouter } from "vue-router";
import { ElMessageBox, ElMessage } from "element-plus";
import customcomponents from "@/views/IntegratedAlarm/alarmConfig/components/custom_components.vue";
const pageTitle = "预警配置";
const store = useStore();
const token = { token: store.state.user.authToken };
const url = process.env.VUE_APP_ALARM;
const router = useRouter();
const query = reactive({
  pageNum: 1,
  pageSize: 22,
  name: "",
  wpId: "",
  rank: "",
  modelId: "",
  category: "windturbine",
  enabled: "",
  relatedparts: "",
});
const state = reactive({
  tableData: [
    {
      id: "1",
      name: "暴风天气",
      description: "风速超过25米/秒",
      expression: "AI066>26",
      tag: "NULL",
      rank: 2,
      modelId: "/UP2000/105",
      category: "windturbine",
      range: "parts",
      stationId: "SXJ_KGDL_DJY_FDC_STA",
      projectId: "NULL",
      lineId: "NULL",
      deviceId: "NULL",
      electricalId: "NULL",
      relatedParts: "QT",
      createTime: "2023-09-17T16:00:00.000+0000",
      enable: true,
      uniformCode: "NULL",
      stationName: "06风电场",
      relatedPartsName: "其他",
    },
    {
      id: "10",
      name: "齿轮箱轴承温升速度超过1.5",
      description: "发电机转速大于900，并且 任意齿轮箱轴温度每分钟上升超过1.5",
      expression:
        "AI060>900 && ( RiseExceed(AI042,60,1.5) || RiseExceed(AI043,60,1.5))",
      tag: "NULL",
      rank: 2,
      modelId: "/UP2000/105",
      category: "windturbine",
      range: "parts",
      stationId: "SXJ_KGDL_DJY_FDC_STA",
      projectId: "NULL",
      lineId: "NULL",
      deviceId: "NULL",
      electricalId: "NULL",
      relatedParts: "FDJ",
      createTime: "2023-09-17T16:00:00.000+0000",
      enable: true,
      uniformCode: "NULL",
      stationName: "06风电场",
      relatedPartsName: "发电机",
    },
    {
      id: "100",
      name: "发电机轴A损坏或碳刷室温度过高",
      description: "轴A温度大于轴B温度15度",
      expression: "Math.abs(AI092-AI062)>15",
      tag: "NULL",
      rank: 2,
      modelId: "UP2000-105",
      category: "windturbine",
      range: "sensors",
      stationId: "SXJ_KGDL_GJY_FDC_STA",
      projectId: "NULL",
      lineId: "NULL",
      deviceId: "NULL",
      electricalId: "NULL",
      relatedParts: "FDJ",
      createTime: "2023-09-17T16:00:00.000+0000",
      enable: true,
      uniformCode: "NULL",
      stationName: "07风电场",
      relatedPartsName: "发电机",
    },
  ],
  fetchListAll: [], //部件及预警类型
  modelListAll: {}, //型号所有列表
  isEnabled: [
    {
      id: false,
      name: "否",
    },
    {
      id: true,
      name: "是",
    },
  ],
  rankList: [
    {
      id: 1,
      name: "低",
    },
    {
      id: 2,
      name: "中低",
    },
    {
      id: 3,
      name: "中",
    },
    {
      id: 4,
      name: "中高",
    },
    {
      id: 5,
      name: "高",
    },
  ],
  visible: false,
  form: {},
  tableHeader: [
    { title: "编码", code: "id" },
    { title: "场站", code: "stationName", width: "100" },
    { title: "机型", code: "modelId" },
    { title: "规则名称", code: "name", width: "150" },
    { title: "表达式", code: "expression", width: "150" },
    { title: "描述", code: "description", width: "150" },
    { title: "所属部件", code: "relatedPartsName" },
    // { title: "级别", code: "rank" },
    { title: "类型", code: "category" },
    { title: "是否启用", code: "enable" },
  ],
  tableHeader1: [
    { title: "编码", code: "id" },
    { title: "升压站", code: "stationName" },
    { title: "规则名称", code: "name" },
    { title: "表达式", code: "expression" },
    { title: "描述", code: "description" },
    // { title: "级别", code: "rank" },
    { title: "类型", code: "category" },
    { title: "是否启用", code: "enable" },
  ],
});
//型号列表
const modelList = computed(() => {
  if (query.wpId == "") {
    return [];
  } else {
    return state.modelListAll[query.wpId];
  }
  return [{ id: "SEC-W02B-1250kW", aname: "SEC-W02B-1250kW" }];
});
//部件列表
const fetchList = computed(() => {
  if (query.wpId == "") {
    return [];
  } else {
    if (query.wpId.includes("FDC")) {
      return state.fetchListAll?.fjbj;
    } else {
      return state.fetchListAll?.gfbj;
    }
  }
  return [
    {
      id: "1",
      category: "alertrule_category",
      nemCode: "YP",
      name: "叶片",
      orderNumber: 1,
      enable: 1,
    },
    {
      id: "2",
      category: "alertrule_category",
      nemCode: "LG",
      name: "轮毂",
      orderNumber: 2,
      enable: 1,
    },
    {
      id: "3",
      category: "alertrule_category",
      nemCode: "TJ",
      name: "塔架",
      orderNumber: 3,
      enable: 1,
    },
    {
      id: "4",
      category: "alertrule_category",
      nemCode: "JC",
      name: "机舱",
      orderNumber: 4,
      enable: 1,
    },
    {
      id: "5",
      category: "alertrule_category",
      nemCode: "KZXT",
      name: "控制系统",
      orderNumber: 5,
      enable: 1,
    },
    {
      id: "6",
      category: "alertrule_category",
      nemCode: "BJXT",
      name: "变桨系统",
      orderNumber: 6,
      enable: 1,
    },
    {
      id: "7",
      category: "alertrule_category",
      nemCode: "PHXT",
      name: "偏航系统",
      orderNumber: 7,
      enable: 1,
    },
    {
      id: "8",
      category: "alertrule_category",
      nemCode: "CLX",
      name: "齿轮箱",
      orderNumber: 8,
      enable: 1,
    },
    {
      id: "9",
      category: "alertrule_category",
      nemCode: "FDJ",
      name: "发电机",
      orderNumber: 9,
      enable: 1,
    },
    {
      id: "10",
      category: "alertrule_category",
      nemCode: "BPQ",
      name: "变频器",
      orderNumber: 10,
      enable: 1,
    },
    {
      id: "11",
      category: "alertrule_category",
      nemCode: "YYXT",
      name: "液压系统",
      orderNumber: 11,
      enable: 1,
    },
    {
      id: "12",
      category: "alertrule_category",
      nemCode: "FZXT",
      name: "辅助系统",
      orderNumber: 12,
      enable: 1,
    },
    {
      id: "13",
      category: "alertrule_category",
      nemCode: "CFXT",
      name: "测风系统",
      orderNumber: 13,
      enable: 1,
    },
    {
      id: "14",
      category: "alertrule_category",
      nemCode: "DWXT",
      name: "电网系统",
      orderNumber: 14,
      enable: 1,
    },
    {
      id: "15",
      category: "alertrule_category",
      nemCode: "TDG",
      name: "塔底柜",
      orderNumber: 15,
      enable: 1,
    },
    {
      id: "16",
      category: "alertrule_category",
      nemCode: "CDL",
      name: "传动链",
      orderNumber: 16,
      enable: 1,
    },
    {
      id: "17",
      category: "alertrule_category",
      nemCode: "QT",
      name: "其他",
      orderNumber: 17,
      enable: 1,
    },
    {
      id: "42",
      category: "alertrule_category",
      nemCode: "CGQ",
      name: "传感器",
      orderNumber: 19,
      enable: 1,
    },
    {
      id: "41",
      category: "alertrule_category",
      nemCode: "BYQ",
      name: "变压器",
      orderNumber: 18,
      enable: 1,
    },
    {
      id: "44",
      category: "alertrule_category",
      nemCode: "ZZ",
      name: "主轴",
      orderNumber: 20,
      enable: 1,
    },
  ];
});

// 场站列表/升压站列表
const stationList = ref([
  {
    id: "SXJ_KGDL_XWT_FDC_STA",
    nemCode: "SXJ_KGDL_XWT_FDC_STA",
    name: "01风电场",
    address: "山西省朔州市14县",
    telephone: null,
    windCapacity: 99750.0,
    windCapacityUnit: "kW",
    windQuantityHs: 0,
    windQuantityLd: 33,
    capacity: 0.0,
    capacityUnit: "kW",
    quantityJz: 0,
    quantityZc: 0,
    jrwindCapacity: 41250.0,
    jrwindCapacityUnit: "kW",
    jrwindQuantityHs: 0,
    jrwindQuantityLd: 33,
    jrCapacity: 0.0,
    jrCapacityUnit: "kW",
    jrquantityJz: 0,
    jrquantityZc: 0,
    aname: "01风电场",
    longitude: 112.4,
    latitude: 40.2702,
    photo: null,
    systemManufact: "SHDQ_MF",
    headfarm: null,
    headfarmPhone: null,
    model: "SEC-W02B-1250kW",
    orderNum: 1,
    height: null,
    windType: "-1",
    companyId: "SXJ_KGDL_FLFD_ZGS",
    regionId: "SXJ_RGN",
    groupId: "KGDL_FGS",
    isAble: 1,
    spare1: "XWT",
    spare2: null,
    spare3: "1",
    spare4: "1",
    appCapacity: 99750.0,
    conCapacity: 0.0,
    gridCapacity: 41250.0,
    hoiCapacity: 99750.0,
    firstGridTime: "2008-09-20T16:00:00.000+0000",
    wholeGridTime: "2008-09-29T16:00:00.000+0000",
    anemoNumber: null,
    stationNumber: null,
    ypoint: null,
    xpoint: null,
    xemPoint: null,
    yemPoint: null,
  },
  {
    id: "SXJ_KGDL_BHB_FDC_STA",
    nemCode: "SXJ_KGDL_BHB_FDC_STA",
    name: "02风电场",
    address: "山西省朔州市15区",
    telephone: null,
    windCapacity: 48750.0,
    windCapacityUnit: "kW",
    windQuantityHs: 0,
    windQuantityLd: 37,
    capacity: 0.0,
    capacityUnit: "kW",
    quantityJz: 0,
    quantityZc: 0,
    jrwindCapacity: 48750.0,
    jrwindCapacityUnit: "kW",
    jrwindQuantityHs: 0,
    jrwindQuantityLd: 37,
    jrCapacity: 0.0,
    jrCapacityUnit: "kW",
    jrquantityJz: 0,
    jrquantityZc: 0,
    aname: "02风电场",
    longitude: 112.044444,
    latitude: 39.729722,
    photo: null,
    systemManufact: "SHDQ_MF/HYFN_MF",
    headfarm: null,
    headfarmPhone: null,
    model: "SEC-W01-1250W/HW2-S1500W",
    orderNum: 2,
    height: null,
    windType: "-1",
    companyId: "SXJ_KGDL_FLFD_ZGS",
    regionId: "SXJ_RGN",
    groupId: "KGDL_FGS",
    isAble: 1,
    spare1: "BHB",
    spare2: null,
    spare3: "1",
    spare4: "1",
    appCapacity: 48750.0,
    conCapacity: 0.0,
    gridCapacity: 48750.0,
    hoiCapacity: 48750.0,
    firstGridTime: "2008-11-18T16:00:00.000+0000",
    wholeGridTime: "2009-04-26T16:00:00.000+0000",
    anemoNumber: null,
    stationNumber: null,
    ypoint: null,
    xpoint: null,
    xemPoint: null,
    yemPoint: null,
  },
  {
    id: "SXJ_KGDL_YF_FDC_STA",
    nemCode: "SXJ_KGDL_YF_FDC_STA",
    name: "03风电场",
    address: "山西省朔州市15区",
    telephone: null,
    windCapacity: 99000.0,
    windCapacityUnit: "kW",
    windQuantityHs: 0,
    windQuantityLd: 66,
    capacity: 0.0,
    capacityUnit: "kW",
    quantityJz: 0,
    quantityZc: 0,
    jrwindCapacity: 99000.0,
    jrwindCapacityUnit: "kW",
    jrwindQuantityHs: 0,
    jrwindQuantityLd: 66,
    jrCapacity: 0.0,
    jrCapacityUnit: "kW",
    jrquantityJz: 0,
    jrquantityZc: 0,
    aname: "03风电场",
    longitude: 112.065278,
    latitude: 39.792222,
    photo: null,
    systemManufact: "HYFN_MF",
    headfarm: null,
    headfarmPhone: null,
    model: "HW2/1500(87)",
    orderNum: 3,
    height: null,
    windType: "-1",
    companyId: "SXJ_KGDL_FLFD_ZGS",
    regionId: "SXJ_RGN",
    groupId: "KGDL_FGS",
    isAble: 1,
    spare1: "YF",
    spare2: null,
    spare3: "1",
    spare4: "1",
    appCapacity: 99000.0,
    conCapacity: 0.0,
    gridCapacity: 99000.0,
    hoiCapacity: 99000.0,
    firstGridTime: "2014-04-30T16:00:00.000+0000",
    wholeGridTime: "2014-12-26T16:00:00.000+0000",
    anemoNumber: null,
    stationNumber: null,
    ypoint: null,
    xpoint: null,
    xemPoint: null,
    yemPoint: null,
  },
  {
    id: "SXJ_KGDL_BHB3_FDC_STA",
    nemCode: "SXJ_KGDL_BHB3_FDC_STA",
    name: "02三期",
    address: "山西省朔州市15区",
    telephone: null,
    windCapacity: 100000.0,
    windCapacityUnit: "kW",
    windQuantityHs: 0,
    windQuantityLd: 50,
    capacity: 0.0,
    capacityUnit: "kW",
    quantityJz: 0,
    quantityZc: 0,
    jrwindCapacity: 100000.0,
    jrwindCapacityUnit: "kW",
    jrwindQuantityHs: 0,
    jrwindQuantityLd: 50,
    jrCapacity: 0.0,
    jrCapacityUnit: "kW",
    jrquantityJz: 0,
    jrquantityZc: 0,
    aname: "02三期",
    longitude: 112.08,
    latitude: 39.792778,
    photo: null,
    systemManufact: "XDFN_MF",
    headfarm: null,
    headfarmPhone: null,
    model: "XE100-2000",
    orderNum: 4,
    height: null,
    windType: "-1",
    companyId: "SXJ_KGDL_FLFD_ZGS",
    regionId: "SXJ_RGN",
    groupId: "KGDL_FGS",
    isAble: 1,
    spare1: "BHB3",
    spare2: null,
    spare3: "1",
    spare4: "1",
    appCapacity: 100000.0,
    conCapacity: 0.0,
    gridCapacity: 100000.0,
    hoiCapacity: 100000.0,
    firstGridTime: "2019-09-14T16:00:00.000+0000",
    wholeGridTime: "2019-09-14T16:00:00.000+0000",
    anemoNumber: null,
    stationNumber: null,
    ypoint: null,
    xpoint: null,
    xemPoint: null,
    yemPoint: null,
  },
  {
    id: "SXJ_KGDL_PDL_FDC_STA",
    nemCode: "SXJ_KGDL_PDL_FDC_STA",
    name: "04风电场",
    address: "山西省忻州市宁武县",
    telephone: null,
    windCapacity: 48000.0,
    windCapacityUnit: "kW",
    windQuantityHs: 0,
    windQuantityLd: 26,
    capacity: 0.0,
    capacityUnit: "kW",
    quantityJz: 0,
    quantityZc: 0,
    jrwindCapacity: 48000.0,
    jrwindCapacityUnit: "kW",
    jrwindQuantityHs: 0,
    jrwindQuantityLd: 26,
    jrCapacity: 0.0,
    jrCapacityUnit: "kW",
    jrquantityJz: 0,
    jrquantityZc: 0,
    aname: "04风电场",
    longitude: 112.556111,
    latitude: 39.082222,
    photo: null,
    systemManufact: "ZCZG_MF",
    headfarm: null,
    headfarmPhone: null,
    model: "HZ93-2.0MW",
    orderNum: 5,
    height: null,
    windType: "-1",
    companyId: "SXJ_KGDL_FLFD_ZGS",
    regionId: "SXJ_RGN",
    groupId: "KGDL_FGS",
    isAble: 1,
    spare1: "PDL",
    spare2: null,
    spare3: "1",
    spare4: "1",
    appCapacity: 48000.0,
    conCapacity: 0.0,
    gridCapacity: 48000.0,
    hoiCapacity: 48000.0,
    firstGridTime: "2014-05-22T16:00:00.000+0000",
    wholeGridTime: "2014-05-22T16:00:00.000+0000",
    anemoNumber: null,
    stationNumber: null,
    ypoint: null,
    xpoint: null,
    xemPoint: null,
    yemPoint: null,
  },
  {
    id: "SXJ_KGDL_NJL_FDC_STA",
    nemCode: "SXJ_KGDL_NJL_FDC_STA",
    name: "05风电场",
    address: "山西省朔州市朔城区",
    telephone: null,
    windCapacity: 98000.0,
    windCapacityUnit: "kW",
    windQuantityHs: 0,
    windQuantityLd: 44,
    capacity: 0.0,
    capacityUnit: "kW",
    quantityJz: 0,
    quantityZc: 0,
    jrwindCapacity: 98000.0,
    jrwindCapacityUnit: "kW",
    jrwindQuantityHs: 0,
    jrwindQuantityLd: 44,
    jrCapacity: 0.0,
    jrCapacityUnit: "kW",
    jrquantityJz: 0,
    jrquantityZc: 0,
    aname: "05风电场",
    longitude: 112.23,
    latitude: 39.22,
    photo: null,
    systemManufact: "ZCZG_MF/TYZG_MF",
    headfarm: null,
    headfarmPhone: null,
    model: "H93L-2.0MW/TZ2500",
    orderNum: 6,
    height: null,
    windType: "-1",
    companyId: "SXJ_KGDL_FLFD_ZGS",
    regionId: "SXJ_RGN",
    groupId: "KGDL_FGS",
    isAble: 1,
    spare1: "NJL",
    spare2: null,
    spare3: "1",
    spare4: "1",
    appCapacity: 98000.0,
    conCapacity: 0.0,
    gridCapacity: 98000.0,
    hoiCapacity: 98000.0,
    firstGridTime: "2015-01-01T16:00:00.000+0000",
    wholeGridTime: "2015-01-18T16:00:00.000+0000",
    anemoNumber: null,
    stationNumber: null,
    ypoint: null,
    xpoint: null,
    xemPoint: null,
    yemPoint: null,
  },
  {
    id: "SXJ_KGDL_DJY_FDC_STA",
    nemCode: "SXJ_KGDL_DJY_FDC_STA",
    name: "06风电场",
    address: "山西省朔州市14县",
    telephone: null,
    windCapacity: 109000.0,
    windCapacityUnit: "kW",
    windQuantityHs: 0,
    windQuantityLd: 50,
    capacity: 0.0,
    capacityUnit: "kW",
    quantityJz: 0,
    quantityZc: 0,
    jrwindCapacity: 99000.0,
    jrwindCapacityUnit: "kW",
    jrwindQuantityHs: 0,
    jrwindQuantityLd: 50,
    jrCapacity: 0.0,
    jrCapacityUnit: "kW",
    jrquantityJz: 0,
    jrquantityZc: 0,
    aname: "06风电场",
    longitude: 112.18,
    latitude: 40.021111,
    photo: null,
    systemManufact: "LHDL_MF",
    headfarm: null,
    headfarmPhone: null,
    model: "/UP2000/105",
    orderNum: 7,
    height: null,
    windType: "-1",
    companyId: "SXJ_KGDL_FLFD_ZGS",
    regionId: "SXJ_RGN",
    groupId: "KGDL_FGS",
    isAble: 1,
    spare1: "DJY",
    spare2: null,
    spare3: "1",
    spare4: "1",
    appCapacity: 109000.0,
    conCapacity: 0.0,
    gridCapacity: 99000.0,
    hoiCapacity: 109000.0,
    firstGridTime: "2015-12-26T16:00:00.000+0000",
    wholeGridTime: "2016-01-27T16:00:00.000+0000",
    anemoNumber: null,
    stationNumber: null,
    ypoint: null,
    xpoint: null,
    xemPoint: null,
    yemPoint: null,
  },
  {
    id: "SXJ_KGDL_GJY_FDC_STA",
    nemCode: "SXJ_KGDL_GJY_FDC_STA",
    name: "07风电场",
    address: "山西省朔州市15区",
    telephone: null,
    windCapacity: 259500.0,
    windCapacityUnit: "kW",
    windQuantityHs: 0,
    windQuantityLd: 121,
    capacity: 0.0,
    capacityUnit: "kW",
    quantityJz: 0,
    quantityZc: 0,
    jrwindCapacity: 259500.0,
    jrwindCapacityUnit: "kW",
    jrwindQuantityHs: 0,
    jrwindQuantityLd: 121,
    jrCapacity: 0.0,
    jrCapacityUnit: "kW",
    jrquantityJz: 0,
    jrquantityZc: 0,
    aname: "07风电场",
    longitude: 112.08516,
    latitude: 39.51753,
    photo: null,
    systemManufact: "LHDL_MF/TYZG_MF/YJNY_MF",
    headfarm: null,
    headfarmPhone: null,
    model: "UP2000-105/TZ2000/116-85/EN141/2.6/EN141/3.2",
    orderNum: 8,
    height: null,
    windType: "-1",
    companyId: "SXJ_KGDL_FLFD_ZGS",
    regionId: "SXJ_RGN",
    groupId: "KGDL_FGS",
    isAble: 1,
    spare1: "GJY",
    spare2: null,
    spare3: "1",
    spare4: "1",
    appCapacity: 259500.0,
    conCapacity: 0.0,
    gridCapacity: 259500.0,
    hoiCapacity: 259500.0,
    firstGridTime: "2015-12-18T16:00:00.000+0000",
    wholeGridTime: "2015-12-31T16:00:00.000+0000",
    anemoNumber: null,
    stationNumber: null,
    ypoint: null,
    xpoint: null,
    xemPoint: null,
    yemPoint: null,
  },
  {
    id: "SXJ_KGDL_PTZ_FDC_STA",
    nemCode: "SXJ_KGDL_PTZ_FDC_STA",
    name: "08风电场",
    address: "山西省晋中市寿阳县",
    telephone: null,
    windCapacity: 99500.0,
    windCapacityUnit: "kW",
    windQuantityHs: 0,
    windQuantityLd: 36,
    capacity: 0.0,
    capacityUnit: "kW",
    quantityJz: 0,
    quantityZc: 0,
    jrwindCapacity: 99500.0,
    jrwindCapacityUnit: "kW",
    jrwindQuantityHs: 0,
    jrwindQuantityLd: 36,
    jrCapacity: 0.0,
    jrCapacityUnit: "kW",
    jrquantityJz: 0,
    jrquantityZc: 0,
    aname: "08风电场",
    longitude: 112.859099,
    latitude: 37.974642,
    photo: null,
    systemManufact: "HYDQ_MF",
    headfarm: null,
    headfarmPhone: null,
    model: "/HW3-S2500(121)",
    orderNum: 9,
    height: null,
    windType: "-1",
    companyId: "SXJ_KGDL_FLFD_ZGS",
    regionId: "SXJ_RGN",
    groupId: "KGDL_FGS",
    isAble: 1,
    spare1: "PTZ",
    spare2: null,
    spare3: "1",
    spare4: "1",
    appCapacity: 99500.0,
    conCapacity: 0.0,
    gridCapacity: 99500.0,
    hoiCapacity: 99500.0,
    firstGridTime: "2017-07-15T16:00:00.000+0000",
    wholeGridTime: "2017-07-15T16:00:00.000+0000",
    anemoNumber: null,
    stationNumber: null,
    ypoint: null,
    xpoint: null,
    xemPoint: null,
    yemPoint: null,
  },
  {
    id: "SXJ_KGDL_HSM_FDC_STA",
    nemCode: "SXJ_KGDL_HSM_FDC_STA",
    name: "09风电场",
    address: "山西省朔州市15区",
    telephone: null,
    windCapacity: 150000.0,
    windCapacityUnit: "kW",
    windQuantityHs: 0,
    windQuantityLd: 60,
    capacity: 0.0,
    capacityUnit: "kW",
    quantityJz: 0,
    quantityZc: 0,
    jrwindCapacity: 150000.0,
    jrwindCapacityUnit: "kW",
    jrwindQuantityHs: 0,
    jrwindQuantityLd: 60,
    jrCapacity: 0.0,
    jrCapacityUnit: "kW",
    jrquantityJz: 0,
    jrquantityZc: 0,
    aname: "09风电场",
    longitude: 112.651944,
    latitude: 39.526111,
    photo: null,
    systemManufact: "HYFN_MF",
    headfarm: null,
    headfarmPhone: null,
    model: "/HW3-S2500(121)",
    orderNum: 10,
    height: null,
    windType: "-1",
    companyId: "SXJ_KGDL_FLFD_ZGS",
    regionId: "SXJ_RGN",
    groupId: "KGDL_FGS",
    isAble: 1,
    spare1: "HSM",
    spare2: null,
    spare3: "1",
    spare4: "1",
    appCapacity: 150000.0,
    conCapacity: 0.0,
    gridCapacity: 150000.0,
    hoiCapacity: 150000.0,
    firstGridTime: "2018-02-13T16:00:00.000+0000",
    wholeGridTime: "2018-02-13T16:00:00.000+0000",
    anemoNumber: null,
    stationNumber: null,
    ypoint: null,
    xpoint: null,
    xemPoint: null,
    yemPoint: null,
  },
  {
    id: "SXJ_KGDL_ZK_FDC_STA",
    nemCode: "SXJ_KGDL_ZK_FDC_STA",
    name: "10风电场",
    address: "山西省晋中市平遥县",
    telephone: null,
    windCapacity: 100000.0,
    windCapacityUnit: "kW",
    windQuantityHs: 0,
    windQuantityLd: 50,
    capacity: 0.0,
    capacityUnit: "kW",
    quantityJz: 0,
    quantityZc: 0,
    jrwindCapacity: 100000.0,
    jrwindCapacityUnit: "kW",
    jrwindQuantityHs: 0,
    jrwindQuantityLd: 50,
    jrCapacity: 0.0,
    jrCapacityUnit: "kW",
    jrquantityJz: 0,
    jrquantityZc: 0,
    aname: "10风电场",
    longitude: 112.416667,
    latitude: 37.095833,
    photo: null,
    systemManufact: "TYZG_MF",
    headfarm: null,
    headfarmPhone: null,
    model: "TZ-2000",
    orderNum: 11,
    height: null,
    windType: "-1",
    companyId: "SXJ_KGDL_FLFD_ZGS",
    regionId: "SXJ_RGN",
    groupId: "KGDL_FGS",
    isAble: 1,
    spare1: "ZK",
    spare2: null,
    spare3: "1",
    spare4: "1",
    appCapacity: 100000.0,
    conCapacity: 0.0,
    gridCapacity: 100000.0,
    hoiCapacity: 100000.0,
    firstGridTime: "2019-12-30T16:00:00.000+0000",
    wholeGridTime: "2020-10-02T16:00:00.000+0000",
    anemoNumber: null,
    stationNumber: null,
    ypoint: null,
    xpoint: null,
    xemPoint: null,
    yemPoint: null,
  },
  {
    id: "SXJ_KGDL_YTY_FDC_STA",
    nemCode: "SXJ_KGDL_YTY_FDC_STA",
    name: "11风电场",
    address: "山西省晋中市寿阳县",
    telephone: null,
    windCapacity: 50000.0,
    windCapacityUnit: "kW",
    windQuantityHs: 0,
    windQuantityLd: 20,
    capacity: 0.0,
    capacityUnit: "kW",
    quantityJz: 0,
    quantityZc: 0,
    jrwindCapacity: 50000.0,
    jrwindCapacityUnit: "kW",
    jrwindQuantityHs: 0,
    jrwindQuantityLd: 20,
    jrCapacity: 0.0,
    jrCapacityUnit: "kW",
    jrquantityJz: 0,
    jrquantityZc: 0,
    aname: "11风电场",
    longitude: 113.048467,
    latitude: 37.637136,
    photo: null,
    systemManufact: "SHDQ_MF",
    headfarm: null,
    headfarmPhone: null,
    model: "W2500C-135-90",
    orderNum: 12,
    height: null,
    windType: "-1",
    companyId: "SXJ_KGDL_FLFD_ZGS",
    regionId: "SXJ_RGN",
    groupId: "KGDL_FGS",
    isAble: 1,
    spare1: "YTY",
    spare2: null,
    spare3: "1",
    spare4: "1",
    appCapacity: 50000.0,
    conCapacity: 0.0,
    gridCapacity: 50000.0,
    hoiCapacity: 50000.0,
    firstGridTime: "2020-12-29T00:00:00.000+0000",
    wholeGridTime: "2022-02-23T16:00:00.000+0000",
    anemoNumber: null,
    stationNumber: null,
    ypoint: null,
    xpoint: null,
    xemPoint: null,
    yemPoint: null,
  },
  {
    id: "SXJ_KGDL_YLZ_FDC_STA",
    nemCode: "SXJ_KGDL_YLZ_FDC_STA",
    name: "12风电场",
    address: "山西省晋中市寿阳县",
    telephone: null,
    windCapacity: 40000.0,
    windCapacityUnit: "kW",
    windQuantityHs: 0,
    windQuantityLd: 13,
    capacity: 0.0,
    capacityUnit: "kW",
    quantityJz: 0,
    quantityZc: 0,
    jrwindCapacity: 40000.0,
    jrwindCapacityUnit: "kW",
    jrwindQuantityHs: 0,
    jrwindQuantityLd: 13,
    jrCapacity: 0.0,
    jrCapacityUnit: "kW",
    jrquantityJz: 0,
    jrquantityZc: 0,
    aname: "12风电场",
    longitude: 113.325278,
    latitude: 37.771111,
    photo: null,
    systemManufact: "YJNY_MF",
    headfarm: null,
    headfarmPhone: null,
    model: "EN141/3.20",
    orderNum: 13,
    height: null,
    windType: "-1",
    companyId: "SXJ_KGDL_FLFD_ZGS",
    regionId: "SXJ_RGN",
    groupId: "KGDL_FGS",
    isAble: 1,
    spare1: "YLZ",
    spare2: null,
    spare3: "1",
    spare4: "1",
    appCapacity: 40000.0,
    conCapacity: 0.0,
    gridCapacity: 40000.0,
    hoiCapacity: 40000.0,
    firstGridTime: "2020-12-29T16:00:00.000+0000",
    wholeGridTime: "2021-06-03T16:00:00.000+0000",
    anemoNumber: null,
    stationNumber: null,
    ypoint: null,
    xpoint: null,
    xemPoint: null,
    yemPoint: null,
  },
  {
    id: "NMM_KGDL_MLJ_FDC_STA",
    nemCode: "NMM_KGDL_MLJ_FDC_STA",
    name: "13一期",
    address: "内蒙古乌兰察布市察右中旗科布尔镇",
    telephone: null,
    windCapacity: 50000.0,
    windCapacityUnit: "kW",
    windQuantityHs: 0,
    windQuantityLd: 26,
    capacity: 0.0,
    capacityUnit: "kW",
    quantityJz: 0,
    quantityZc: 0,
    jrwindCapacity: 50000.0,
    jrwindCapacityUnit: "kW",
    jrwindQuantityHs: 0,
    jrwindQuantityLd: 26,
    jrCapacity: 0.0,
    jrCapacityUnit: "kW",
    jrquantityJz: 0,
    jrquantityZc: 0,
    aname: "13一期",
    longitude: 112.466667,
    latitude: 41.283333,
    photo: null,
    systemManufact: "TYZG_MF",
    headfarm: null,
    headfarmPhone: null,
    model: "TZ2000-87/TZ2000-93",
    orderNum: 14,
    height: null,
    windType: "-1",
    companyId: "NMM_KGDL_QH_ZGS",
    regionId: "NMM_RGN",
    groupId: "KGDL_FGS",
    isAble: 1,
    spare1: "MLJ",
    spare2: null,
    spare3: "1",
    spare4: "1",
    appCapacity: 50000.0,
    conCapacity: 0.0,
    gridCapacity: 50000.0,
    hoiCapacity: 50000.0,
    firstGridTime: "2006-12-31T16:00:00.000+0000",
    wholeGridTime: "2006-12-31T16:00:00.000+0000",
    anemoNumber: null,
    stationNumber: null,
    ypoint: null,
    xpoint: null,
    xemPoint: null,
    yemPoint: null,
  },
  {
    id: "SXJ_KGDL_YY_GDC_STA",
    nemCode: "SXJ_KGDL_YY_GDC_STA",
    name: "14电站",
    address: "山西朔州14",
    telephone: null,
    windCapacity: 0.0,
    windCapacityUnit: "kW",
    windQuantityHs: 0,
    windQuantityLd: 0,
    capacity: 10000.0,
    capacityUnit: "kW",
    quantityJz: 21,
    quantityZc: 1,
    jrwindCapacity: 0.0,
    jrwindCapacityUnit: "kW",
    jrwindQuantityHs: 0,
    jrwindQuantityLd: 0,
    jrCapacity: 10000.0,
    jrCapacityUnit: "kW",
    jrquantityJz: 21,
    jrquantityZc: 1,
    aname: "14电站",
    longitude: 112.410171,
    latitude: 40.275243,
    photo: null,
    systemManufact: "YG_MF/SK_MF/JSRF_MF/BJABB_MF",
    headfarm: null,
    headfarmPhone: null,
    model: "SG50KTL/PVS-800-57-100KW-A/AE-500-50-PV-X-HV",
    orderNum: 15,
    height: null,
    windType: "-2",
    companyId: "SXJ_KGDL_GFFD_ZGS",
    regionId: "SXJ_RGN",
    groupId: "KGDL_FGS",
    isAble: 1,
    spare1: "YY",
    spare2: "1438",
    spare3: "2.5",
    spare4: "0.7",
    appCapacity: 10000.0,
    conCapacity: 0.0,
    gridCapacity: 10000.0,
    hoiCapacity: 10000.0,
    firstGridTime: "2011-12-21T16:00:00.000+0000",
    wholeGridTime: "2011-12-21T16:00:00.000+0000",
    anemoNumber: null,
    stationNumber: null,
    ypoint: null,
    xpoint: null,
    xemPoint: null,
    yemPoint: null,
  },
  {
    id: "SXJ_KGDL_PL_GDC_STA",
    nemCode: "SXJ_KGDL_PL_GDC_STA",
    name: "15电站",
    address: "山西朔州15",
    telephone: null,
    windCapacity: 0.0,
    windCapacityUnit: "kW",
    windQuantityHs: 0,
    windQuantityLd: 0,
    capacity: 5000.0,
    capacityUnit: "kW",
    quantityJz: 10,
    quantityZc: 0,
    jrwindCapacity: 0.0,
    jrwindCapacityUnit: "kW",
    jrwindQuantityHs: 0,
    jrwindQuantityLd: 0,
    jrCapacity: 5000.0,
    jrCapacityUnit: "kW",
    jrquantityJz: 10,
    jrquantityZc: 0,
    aname: "15电站",
    longitude: 112.110833,
    latitude: 39.806944,
    photo: null,
    systemManufact: "YG_MF",
    headfarm: null,
    headfarmPhone: null,
    model: "SG500KTL",
    orderNum: 16,
    height: null,
    windType: "-2",
    companyId: "SXJ_KGDL_GFFD_ZGS",
    regionId: "SXJ_RGN",
    groupId: "KGDL_FGS",
    isAble: 1,
    spare1: "PL",
    spare2: "1560.4",
    spare3: "2.5",
    spare4: "0.7",
    appCapacity: 5000.0,
    conCapacity: 0.0,
    gridCapacity: 5000.0,
    hoiCapacity: 5000.0,
    firstGridTime: "2011-12-23T16:00:00.000+0000",
    wholeGridTime: "2011-12-13T16:00:00.000+0000",
    anemoNumber: null,
    stationNumber: null,
    ypoint: null,
    xpoint: null,
    xemPoint: null,
    yemPoint: null,
  },
  {
    id: "SXJ_KGDL_YX_GDC_STA",
    nemCode: "SXJ_KGDL_YX_GDC_STA",
    name: "16电站",
    address: "山西朔州16",
    telephone: null,
    windCapacity: 0.0,
    windCapacityUnit: "kW",
    windQuantityHs: 0,
    windQuantityLd: 0,
    capacity: 60000.0,
    capacityUnit: "kW",
    quantityJz: 118,
    quantityZc: 0,
    jrwindCapacity: 0.0,
    jrwindCapacityUnit: "kW",
    jrwindQuantityHs: 0,
    jrwindQuantityLd: 0,
    jrCapacity: 60000.0,
    jrCapacityUnit: "kW",
    jrquantityJz: 118,
    jrquantityZc: 0,
    aname: "16电站",
    longitude: 113.069,
    latitude: 39.499,
    photo: null,
    systemManufact: "YG_MF/JSBF_MF",
    headfarm: null,
    headfarmPhone: null,
    model: "SG500MX/SGI-500KTL",
    orderNum: 17,
    height: null,
    windType: "-2",
    companyId: "SXJ_KGDL_GFFD_ZGS",
    regionId: "SXJ_RGN",
    groupId: "KGDL_FGS",
    isAble: 1,
    spare1: "YX",
    spare2: "1438",
    spare3: "2.5",
    spare4: "0.7",
    appCapacity: 60000.0,
    conCapacity: 0.0,
    gridCapacity: 60000.0,
    hoiCapacity: 60000.0,
    firstGridTime: "2013-12-30T16:00:00.000+0000",
    wholeGridTime: "2014-05-07T16:00:00.000+0000",
    anemoNumber: null,
    stationNumber: null,
    ypoint: null,
    xpoint: null,
    xemPoint: null,
    yemPoint: null,
  },
  {
    id: "SXJ_KGDL_TZ_GDC_STA",
    nemCode: "SXJ_KGDL_TZ_GDC_STA",
    name: "17电站",
    address: "山西大同17",
    telephone: null,
    windCapacity: 0.0,
    windCapacityUnit: "kW",
    windQuantityHs: 0,
    windQuantityLd: 0,
    capacity: 245000.0,
    capacityUnit: "kW",
    quantityJz: 448,
    quantityZc: 81,
    jrwindCapacity: 0.0,
    jrwindCapacityUnit: "kW",
    jrwindQuantityHs: 0,
    jrwindQuantityLd: 0,
    jrCapacity: 245000.0,
    jrCapacityUnit: "kW",
    jrquantityJz: 448,
    jrquantityZc: 81,
    aname: "17电站",
    longitude: 114.030817,
    latitude: 40.475253,
    photo: null,
    systemManufact: "YG_MF",
    headfarm: null,
    headfarmPhone: null,
    model: "SG500MX/SG630KTL/SG60KTL-M/SG1250UD/SG1500UD",
    orderNum: 18,
    height: null,
    windType: "-2",
    companyId: "SXJ_KGDL_GFFD_ZGS",
    regionId: "SXJ_RGN",
    groupId: "KGDL_FGS",
    isAble: 1,
    spare1: "TZ",
    spare2: "1510",
    spare3: "2.5",
    spare4: "0.7",
    appCapacity: 245000.0,
    conCapacity: 0.0,
    gridCapacity: 245000.0,
    hoiCapacity: 245000.0,
    firstGridTime: "2014-06-29T16:00:00.000+0000",
    wholeGridTime: "2014-06-29T16:00:00.000+0000",
    anemoNumber: null,
    stationNumber: null,
    ypoint: null,
    xpoint: null,
    xemPoint: null,
    yemPoint: null,
  },
  {
    id: "SXJ_KGDL_YG_GDC_STA",
    nemCode: "SXJ_KGDL_YG_GDC_STA",
    name: "18电站",
    address: "山西大同18",
    telephone: null,
    windCapacity: 0.0,
    windCapacityUnit: "kW",
    windQuantityHs: 0,
    windQuantityLd: 0,
    capacity: 70000.0,
    capacityUnit: "kW",
    quantityJz: 62,
    quantityZc: 1282,
    jrwindCapacity: 0.0,
    jrwindCapacityUnit: "kW",
    jrwindQuantityHs: 0,
    jrwindQuantityLd: 0,
    jrCapacity: 70000.0,
    jrCapacityUnit: "kW",
    jrquantityJz: 62,
    jrquantityZc: 1282,
    aname: "18电站",
    longitude: 113.891111,
    latitude: 39.998889,
    photo: null,
    systemManufact: "YST_MF/YG_MF/HW_MF",
    headfarm: null,
    headfarmPhone: null,
    model: "EA500KM-M/SG500MX/SG630MX/SUN2000-28KTL",
    orderNum: 19,
    height: null,
    windType: "-2",
    companyId: "SXJ_KGDL_GFFD_ZGS",
    regionId: "SXJ_RGN",
    groupId: "KGDL_FGS",
    isAble: 1,
    spare1: "YG",
    spare2: "1507",
    spare3: "2.5",
    spare4: "0.7",
    appCapacity: 70000.0,
    conCapacity: 0.0,
    gridCapacity: 70000.0,
    hoiCapacity: 70000.0,
    firstGridTime: "2017-06-24T16:00:00.000+0000",
    wholeGridTime: "2017-06-24T16:00:00.000+0000",
    anemoNumber: null,
    stationNumber: null,
    ypoint: null,
    xpoint: null,
    xemPoint: null,
    yemPoint: null,
  },
  {
    id: "SXJ_KGDL_FS_GDC_STA",
    nemCode: "SXJ_KGDL_FS_GDC_STA",
    name: "19电站",
    address: "山西吕梁19",
    telephone: null,
    windCapacity: 0.0,
    windCapacityUnit: "kW",
    windQuantityHs: 0,
    windQuantityLd: 0,
    capacity: 35000.0,
    capacityUnit: "kW",
    quantityJz: 54,
    quantityZc: 0,
    jrwindCapacity: 0.0,
    jrwindCapacityUnit: "kW",
    jrwindQuantityHs: 0,
    jrwindQuantityLd: 0,
    jrCapacity: 35000.0,
    jrCapacityUnit: "kW",
    jrquantityJz: 54,
    jrquantityZc: 0,
    aname: "19电站",
    longitude: 111.149444,
    latitude: 37.716111,
    photo: null,
    systemManufact: "YG_MF",
    headfarm: null,
    headfarmPhone: null,
    model: "SG630MX",
    orderNum: 20,
    height: null,
    windType: "-2",
    companyId: "SXJ_KGDL_GFFD_ZGS",
    regionId: "SXJ_RGN",
    groupId: "KGDL_FGS",
    isAble: 1,
    spare1: "FS",
    spare2: "1305.9",
    spare3: "2.5",
    spare4: "0.7",
    appCapacity: 35000.0,
    conCapacity: 0.0,
    gridCapacity: 35000.0,
    hoiCapacity: 35000.0,
    firstGridTime: "2017-12-29T16:00:00.000+0000",
    wholeGridTime: "2017-12-29T16:00:00.000+0000",
    anemoNumber: null,
    stationNumber: null,
    ypoint: null,
    xpoint: null,
    xemPoint: null,
    yemPoint: null,
  },
  {
    id: "SXJ_KGDL_SY_GDC_STA",
    nemCode: "SXJ_KGDL_SY_GDC_STA",
    name: "20电站",
    address: "山西省朔州市20县",
    telephone: null,
    windCapacity: 0.0,
    windCapacityUnit: "kW",
    windQuantityHs: 0,
    windQuantityLd: 0,
    capacity: 100000.0,
    capacityUnit: "kW",
    quantityJz: 116,
    quantityZc: 487,
    jrwindCapacity: 0.0,
    jrwindCapacityUnit: "kW",
    jrwindQuantityHs: 0,
    jrwindQuantityLd: 0,
    jrCapacity: 100000.0,
    jrCapacityUnit: "kW",
    jrquantityJz: 116,
    jrquantityZc: 487,
    aname: "20电站",
    longitude: 112.90166,
    latitude: 39.440833,
    photo: null,
    systemManufact: "YG_MF",
    headfarm: null,
    headfarmPhone: null,
    model: "SG1250UD/SG50KTL/SG630MX",
    orderNum: 21,
    height: null,
    windType: "-2",
    companyId: "SXJ_KGDL_GFFD_ZGS",
    regionId: "SXJ_RGN",
    groupId: "KGDL_FGS",
    isAble: 1,
    spare1: "SY",
    spare2: "1505",
    spare3: "2.5",
    spare4: "0.7",
    appCapacity: 100000.0,
    conCapacity: 0.0,
    gridCapacity: 100000.0,
    hoiCapacity: 100000.0,
    firstGridTime: "2018-06-27T16:00:00.000+0000",
    wholeGridTime: "2018-06-27T16:00:00.000+0000",
    anemoNumber: null,
    stationNumber: null,
    ypoint: null,
    xpoint: null,
    xemPoint: null,
    yemPoint: null,
  },
  {
    id: "SXJ_KGDL_HR_GDC_STA",
    nemCode: "SXJ_KGDL_HR_GDC_STA",
    name: "21电站",
    address: "山西朔州21",
    telephone: null,
    windCapacity: 0.0,
    windCapacityUnit: "kW",
    windQuantityHs: 0,
    windQuantityLd: 0,
    capacity: 70000.0,
    capacityUnit: "kW",
    quantityJz: 0,
    quantityZc: 637,
    jrwindCapacity: 0.0,
    jrwindCapacityUnit: "kW",
    jrwindQuantityHs: 0,
    jrwindQuantityLd: 0,
    jrCapacity: 70000.0,
    jrCapacityUnit: "kW",
    jrquantityJz: 0,
    jrquantityZc: 637,
    aname: "21电站",
    longitude: 113.018889,
    latitude: 39.880833,
    photo: null,
    systemManufact: "HW_MF/TBDG_MF",
    headfarm: null,
    headfarmPhone: null,
    model: "SUN2000-125KTL-MO/TS80KTL-PLUS",
    orderNum: 22,
    height: null,
    windType: "-2",
    companyId: "SXJ_KGDL_GFFD_ZGS",
    regionId: "SXJ_RGN",
    groupId: "KGDL_FGS",
    isAble: 1,
    spare1: "HR",
    spare2: "1524",
    spare3: "2.5",
    spare4: "0.7",
    appCapacity: 70000.0,
    conCapacity: 0.0,
    gridCapacity: 70000.0,
    hoiCapacity: 70000.0,
    firstGridTime: "2019-12-30T16:00:00.000+0000",
    wholeGridTime: "2019-12-30T16:00:00.000+0000",
    anemoNumber: null,
    stationNumber: null,
    ypoint: null,
    xpoint: null,
    xemPoint: null,
    yemPoint: null,
  },
  {
    id: "SXJ_KGDL_TL_GDC_STA",
    nemCode: "SXJ_KGDL_TL_GDC_STA",
    name: "22电站",
    address: "山西长治22",
    telephone: null,
    windCapacity: 0.0,
    windCapacityUnit: "kW",
    windQuantityHs: 0,
    windQuantityLd: 0,
    capacity: 100000.0,
    capacityUnit: "kW",
    quantityJz: 0,
    quantityZc: 649,
    jrwindCapacity: 0.0,
    jrwindCapacityUnit: "kW",
    jrwindQuantityHs: 0,
    jrwindQuantityLd: 0,
    jrCapacity: 100000.0,
    jrCapacityUnit: "kW",
    jrquantityJz: 0,
    jrquantityZc: 649,
    aname: "22电站",
    longitude: 112.646111,
    latitude: 36.409722,
    photo: null,
    systemManufact: "YG_MF",
    headfarm: null,
    headfarmPhone: null,
    model: "SG136TX",
    orderNum: 23,
    height: null,
    windType: "-2",
    companyId: "SXJ_KGDL_GFFD_ZGS",
    regionId: "SXJ_RGN",
    groupId: "KGDL_FGS",
    isAble: 1,
    spare1: "TL",
    spare2: "1260.1",
    spare3: "2.5",
    spare4: "0.7",
    appCapacity: 100000.0,
    conCapacity: 0.0,
    gridCapacity: 100000.0,
    hoiCapacity: 100000.0,
    firstGridTime: "2019-12-30T16:00:00.000+0000",
    wholeGridTime: "2019-12-30T16:00:00.000+0000",
    anemoNumber: null,
    stationNumber: null,
    ypoint: null,
    xpoint: null,
    xemPoint: null,
    yemPoint: null,
  },
  {
    id: "SXJ_KGDL_JR_GDC_STA",
    nemCode: "SXJ_KGDL_JR_GDC_STA",
    name: "23电站",
    address: "山西忻州23",
    telephone: null,
    windCapacity: 0.0,
    windCapacityUnit: "kW",
    windQuantityHs: 0,
    windQuantityLd: 0,
    capacity: 100000.0,
    capacityUnit: "kW",
    quantityJz: 0,
    quantityZc: 646,
    jrwindCapacity: 0.0,
    jrwindCapacityUnit: "kW",
    jrwindQuantityHs: 0,
    jrwindQuantityLd: 0,
    jrCapacity: 100000.0,
    jrCapacityUnit: "kW",
    jrquantityJz: 0,
    jrquantityZc: 646,
    aname: "23电站",
    longitude: 113.746,
    latitude: 39.364,
    photo: null,
    systemManufact: "YG_MF",
    headfarm: null,
    headfarmPhone: null,
    model: "SG136TX",
    orderNum: 24,
    height: null,
    windType: "-2",
    companyId: "SXJ_KGDL_GFFD_ZGS",
    regionId: "SXJ_RGN",
    groupId: "KGDL_FGS",
    isAble: 1,
    spare1: "JR",
    spare2: "1596",
    spare3: "2.5",
    spare4: "0.7",
    appCapacity: 100000.0,
    conCapacity: 0.0,
    gridCapacity: 100000.0,
    hoiCapacity: 100000.0,
    firstGridTime: "2020-06-11T16:00:00.000+0000",
    wholeGridTime: "2020-06-11T16:00:00.000+0000",
    anemoNumber: null,
    stationNumber: null,
    ypoint: null,
    xpoint: null,
    xemPoint: null,
    yemPoint: null,
  },
]);
let total = ref(0);
onMounted(() => {
  getWpArray();
  getfetchRelatePart();
  getequipmentmodel_list();
  getData();
});

const dialogclose = () => {
  state.visible = false;
  state.form = {};
  getData();
};
const getWpArray = async () => {
  const { data } = await getWpList(query.category);
  stationList.value = data;
};
const getData = async () => {
  const { data } = await custombj_fetchTableData(query);
  if (data) {
    state.tableData = data.records;
    total.value = data.total;
  }
};
//所属部件
const getfetchRelatePart = async () => {
  const { data } = await fetchRelatePartAndAlarmType();
  state.fetchListAll = data;
  //   if (router && router.currentRoute.value.query.name) {
  //     let queryName = router.currentRoute.value.query.name;
  //     query.relatedparts = queryName;
  //   }
  //   getData();
};
// 机型
const getequipmentmodel_list = async () => {
  const { data } = await fetchModel();
  state.modelListAll = data;
};
const handleEditClick = (row) => {
  let obj = Object.assign({}, row);
  state.form = obj;
  state.visible = true;
};
const handleInsert = () => {
  state.form = {
    category: "windturbine",
    enable: true,
    stationId: "",
    expression: "",
  };
  state.visible = true;
};

//changeStation
const changeStation = async () => {
  query.modelId = "";
  query.relatedparts = "";
};
//categorychanged
const categorychanged = async () => {
  getWpArray();
  clean();
  getData();
};

// 分页导航
const handlePageChange = (val) => {
  query.pageNum = val;
  getData();
};

// 批量导出
const export2Excel = async () => {
  let tableHeader = [];
  let tableKey = [];
  const { data } = await custombj_fetchTableData({
    pageNum: 1,
    pageSize: total.value,
    ...query,
  });
  ElMessage.success(`导出成功!`);
  if (query.category == "windturbine") {
    tableHeader = state.tableHeader.map((item) => item.title);
    tableKey = state.tableHeader.map((item) => item.code);
  } else if (query.category == "booststation") {
    tableHeader = state.tableHeader1.map((item) => item.title);
    tableKey = state.tableHeader1.map((item) => item.code);
  }
  outExportExcel(
    tableHeader,
    tableKey,
    data.records.map((item) => {
      return {
        ...item,
        category: categoryConvert(item.category),
        enable: enabledConvert(item.enable),
      };
    }),
    "自定义预警配置导出excel"
  );
};
// 模板下载
const outExe = () => {
  custombj_importTemplate().then((response) => {
    const link = document.createElement("a");
    const blob = new Blob([response], {
      type: "application/vnd.ms-excel",
    });
    link.style.display = "none";
    link.href = URL.createObjectURL(blob);
    link.download = "自定义报警模板.xlsx";
    document.body.appendChild(link);
    link.click();
    document.body.removeChild(link);
  });
};
// 批量导入
const handleSuccess = (response) => {
  if (response.code == "200") {
    ElMessage.success("导入成功!");
    getData();
  } else {
    ElMessage.error(response.msg);
  }
};
// 批量导入中
const handleProgress = (response) => {};
// 批量导入失败
const handleError = (response) => {
  ElMessage.success("导入失败!");
};
// 清空字段
const clean = () => {
  query.modelId = "";
  query.relatedparts = "";
  query.wpId = "";
  query.enabled = "";
  query.rank = "";
  query.name = "";
  query.pageNum = 1;
  state.tableData = [];
  total.value = 0;
};

const rankConvert = (val) => {
  if (val == 1) {
    return "低";
  } else if (val == 2) {
    return "中低";
  } else if (val == 3) {
    return "中";
  } else if (val == 4) {
    return "中高";
  } else if (val == 5) {
    return "高";
  }
};
// 类型
const categoryConvert = (val) => {
  if (val === "windturbine") {
    return "风机";
  } else if (val === "inverter") {
    return "光伏";
  }
};
// 状态
const enabledConvert = (val) => {
  if (val === false) {
    return "停用";
  } else if (val === true) {
    return "启用";
  }
};
</script>
<style lang="less" scoped>
.custom-config {
  height: 100%;
  .form-wrapper {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    padding: 20px 0 10px 20px;

    .search-wrapper::v-deep {
      display: flex;
      justify-content: flex-start;
      align-items: center;
      font-size: 14px;
      font-family: Microsoft YaHei;
      font-weight: 400;
      color: #b3b3b3;
      .search-item {
        margin-right: 10px;
        width: 120px;
      }
    }

    .btns {
      display: flex;
      justify-content: flex-end;
      margin-right: 10px;
      .el-button + .el-button {
        margin-left: 10px;
      }
    }

    .buttons {
      background-color: rgba(5, 187, 76, 0.2);
      border: 1px solid #3b6c53;
      color: #b3b3b3;
      font-size: 14px;
      &:hover {
        background-color: rgba(5, 187, 76, 0.5);
        color: #ffffff;
      }
    }
  }
}
.table-wrapper {
  height: calc(100% - 160px);
  width: calc(100% - 40px);
  padding: 20px;
  .leftContent[data-type~="greenSty"] {
    background: url("~@/assets/imgs/title_left_bg1.png") no-repeat;
  }
  .leftContent[data-type~="blueSty"] {
    background: url("~@/assets/imgs/title_left_bg.png") no-repeat;
  }
  .leftContent {
    width: 242px;
    height: 41px;
    display: flex;
    align-items: center;

    span {
      font-size: 16px;
      font-family: Microsoft YaHei;
      font-weight: 400;
      color: #05bb4c;
      margin-left: 25px;
    }
  }
  .el-table::v-deep {
    .el-table__body-wrapper {
      height: calc(100% - 45px) !important;
    }
  }
  .pagination-wrapper ::v-deep {
    text-align: right;
    margin-top: 10px;
  }
}

.pagination {
  margin-top: 15px;
}
</style>
