<template>
  <!-- 控制器管理弹框 -->
  <DSDialog
    title="控制器管理"
    v-model="show"
    width="1200"
    class="controllerManagement-dialog ds-dialog"
    @close="handleClose"
  >
    <div class="controllerManagement-container">
      <div class="controllerManagement-infoList">
        <div class="controllerManagement-infoList-title">
          <span>设备列表</span>
          <div class="infoList-title-btn" @click="addDevice">+</div>
        </div>
        <div class="controllerManagement-infoList-content">
          <div
            class="controllerManagement-infoList-item"
            :class="{ active: deviceTab === item.name }"
            v-for="(item, index) in deviceBars"
            :key="index"
            @click="selectDevice(item)"
          >
            <span>{{ item.name }}</span>
            <el-switch v-model="item.enabled" size="small" />
          </div>
          <el-empty
            :image-size="54"
            :image="NoDataIcon"
            style="margin-top: 130px"
            v-if="deviceBars.length === 0"
          />
        </div>
      </div>
      <div class="controllerManagement-line-first" />
      <div class="controllerManagement-content">
        <el-form label-width="auto" size="default" :model="formDeviceInfo" style="max-width: 100%">
          <el-row :gutter="24">
            <el-col :span="12">
              <el-form-item label="品牌" label-position="top">
                <el-select
                  v-model="formDeviceInfo.protocol"
                  placeholder="请选择"
                  class="device-select"
                >
                  <el-option
                    v-for="item in options"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="重命名" label-position="top">
                <el-input v-model="formDeviceInfo.deviceName" />
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="24">
            <el-col :span="4">
              <el-form-item label="协议类型：" label-position="left"> COM </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="自动重连" label-position="left">
                <el-switch v-model="formDeviceInfo.reconnect" />
              </el-form-item>
            </el-col>
          </el-row>
          <template v-if="!showNoParamBrands.includes(formDeviceInfo.protocol)">
            <div>通信参数</div>
            <el-row :gutter="24">
              <el-col :span="6">
                <el-form-item label="串口号" label-position="top">
                  <el-select
                    v-model="formDeviceInfo.serialPort"
                    placeholder="请选择"
                    class="device-select"
                  >
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="波特率" label-position="top">
                  <el-select
                    v-model="formDeviceInfo.baudRate"
                    placeholder="请选择"
                    class="device-select"
                  >
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="数据位" label-position="top">
                  <el-select
                    v-model="formDeviceInfo.dataBits"
                    placeholder="请选择"
                    class="device-select"
                  >
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="校验位" label-position="top">
                  <el-select
                    v-model="formDeviceInfo.checkBit"
                    placeholder="请选择"
                    class="device-select"
                  >
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="停止位" label-position="top">
                  <el-select
                    v-model="formDeviceInfo.stopBit"
                    placeholder="请选择"
                    class="device-select"
                  >
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
          </template>
          <template v-if="showBrightnessBrands.includes(formDeviceInfo.protocol)">
            <div>通信参数</div>
            <el-row :gutter="24">
              <el-col :span="6">
                <el-form-item label="通道1亮度" label-position="top">
                  <el-input-number
                    v-model="formDeviceInfo.channelBrightness1"
                    :min="1"
                    :max="10"
                    controls-position="right"
                    @change="handleChange"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="通道2亮度" label-position="top">
                  <el-input-number
                    v-model="formDeviceInfo.channelBrightness2"
                    :min="1"
                    :max="10"
                    controls-position="right"
                    @change="handleChange"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="通道3亮度" label-position="top">
                  <el-input-number
                    v-model="formDeviceInfo.channelBrightness3"
                    :min="1"
                    :max="10"
                    controls-position="right"
                    @change="handleChange"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="通道4亮度" label-position="top">
                  <el-input-number
                    v-model="formDeviceInfo.channelBrightness4"
                    :min="1"
                    :max="10"
                    controls-position="right"
                    @change="handleChange"
                  />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="24" v-if="formDeviceInfo.protocol === 'MV-LEVD-200'">
              <el-col :span="6">
                <el-form-item label="通道5亮度" label-position="top">
                  <el-input-number
                    v-model="formDeviceInfo.channelBrightness5"
                    :min="1"
                    :max="10"
                    controls-position="right"
                    @change="handleChange"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="通道6亮度" label-position="top">
                  <el-input-number
                    v-model="formDeviceInfo.channelBrightness6"
                    :min="1"
                    :max="10"
                    controls-position="right"
                    @change="handleChange"
                  />
                </el-form-item>
              </el-col>
            </el-row>
          </template>
          <template v-if="showIOPortBrands.includes(formDeviceInfo.protocol)">
            <div>IO参数</div>
            <el-row :gutter="24">
              <el-col :span="6">
                <el-form-item label="输出类型" label-position="top">
                  <el-select
                    v-model="formDeviceInfo.outputType"
                    placeholder="请选择"
                    class="device-select"
                  >
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="发送间隔(ms)" label-position="top">
                  <el-input-number
                    v-model="formDeviceInfo.sendInterval"
                    :min="1"
                    :max="10"
                    controls-position="right"
                    @change="handleChange"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="IO端口号" label-position="top">
                  <el-select
                    v-model="formDeviceInfo.IOPort"
                    placeholder="请选择"
                    class="device-select"
                  >
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="延迟时间" label-position="top">
                  <el-input-number
                    v-model="formDeviceInfo.delayTime"
                    :min="1"
                    :max="10"
                    controls-position="right"
                    @change="handleChange"
                  />
                </el-form-item>
              </el-col>
            </el-row>
            <el-form-item label="轮询开关" label-position="left">
              <el-switch v-model="formDeviceInfo.polling" />
            </el-form-item>
            <el-row :gutter="24" v-if="formDeviceInfo.polling">
              <el-col :span="12">
                <el-form-item label="轮询间隔" label-position="top">
                  <el-input-number
                    v-model="formDeviceInfo.pollingInterval"
                    :min="1"
                    :max="10"
                    controls-position="right"
                    @change="handleChange"
                  />
                </el-form-item>
              </el-col>
            </el-row>
            <div>光源参数</div>
            <el-row :gutter="24">
              <el-col :span="6">
                <el-form-item label="通道1亮度" label-position="top">
                  <el-input-number
                    v-model="formDeviceInfo.lightChannel"
                    :min="1"
                    :max="10"
                    controls-position="right"
                    @change="handleChange"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="光源状态" label-position="top">
                  <el-select
                    v-model="formDeviceInfo.lightChannelStatus"
                    placeholder="请选择"
                    class="device-select"
                  >
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
            <div class="custom-table">
              <div class="mb-2">触发配置</div>
              <el-table :data="formDeviceInfo.tableData" class="customList-table">
                <el-table-column fixed prop="num" label="序号" width="60" />
                <el-table-column prop="inputIO" label="输入IO">
                  <template #default="scope">
                    <el-select
                      v-model="scope.row.inputIO"
                      placeholder="Select"
                      class="device-select"
                    >
                      <el-option
                        v-for="item in options"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value"
                      />
                    </el-select>
                  </template>
                </el-table-column>
                <el-table-column prop="triggeringSignal" label="触发信号">
                  <template #default="scope">
                    <el-select
                      v-model="scope.row.triggeringSignal"
                      placeholder="Select"
                      class="device-select"
                    >
                      <el-option
                        v-for="item in options"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value"
                      />
                    </el-select>
                  </template>
                </el-table-column>
                <el-table-column prop="process" label="流程">
                  <template #default="scope">
                    <el-select
                      v-model="scope.row.process"
                      placeholder="Select"
                      class="device-select"
                    >
                      <el-option
                        v-for="item in options"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value"
                      />
                    </el-select>
                  </template>
                </el-table-column>
                <el-table-column prop="result" label="操作"></el-table-column>
              </el-table>
              <div class="table-add-btn" @click="handleTableAdd">
                <img
                  src="@/assets/images/common/table_addBtn.png"
                  alt=""
                  class="w-[16px] h-[16px] mr-2"
                />添加数据
              </div>
            </div>
          </template>
          <template v-if="showLightBrands.includes(formDeviceInfo.protocol)">
            <div>光源参数</div>
            <el-row :gutter="24">
              <el-col :span="6">
                <el-form-item label="通道1亮度" label-position="top">
                  <el-input-number
                    v-model="formDeviceInfo.channelBrightness1"
                    :min="1"
                    :max="10"
                    controls-position="right"
                    @change="handleChange"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="光源状态" label-position="top">
                  <el-select
                    v-model="formDeviceInfo.lightChannelStatus"
                    placeholder="请选择"
                    class="device-select"
                  >
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="沿定义" label-position="top">
                  <el-select
                    v-model="formDeviceInfo.alongDefinition"
                    placeholder="请选择"
                    class="device-select"
                  >
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="持续时间(ms)" label-position="top">
                  <el-input-number
                    v-model="formDeviceInfo.duration"
                    :min="1"
                    :max="10"
                    controls-position="right"
                    @change="handleChange"
                  />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="24">
              <el-col :span="6">
                <el-form-item label="通道2亮度" label-position="top">
                  <el-input-number
                    v-model="formDeviceInfo.channelBrightness2"
                    :min="1"
                    :max="10"
                    controls-position="right"
                    @change="handleChange"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="光源状态" label-position="top">
                  <el-select
                    v-model="formDeviceInfo.lightChannelStatus"
                    placeholder="请选择"
                    class="device-select"
                  >
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="沿定义" label-position="top">
                  <el-select
                    v-model="formDeviceInfo.alongDefinition"
                    placeholder="请选择"
                    class="device-select"
                  >
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="持续时间(ms)" label-position="top">
                  <el-input-number
                    v-model="formDeviceInfo.duration"
                    :min="1"
                    :max="10"
                    controls-position="right"
                    @change="handleChange"
                  />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="24">
              <el-col :span="6">
                <el-form-item label="通道3亮度" label-position="top">
                  <el-input-number
                    v-model="formDeviceInfo.channelBrightness3"
                    :min="1"
                    :max="10"
                    controls-position="right"
                    @change="handleChange"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="光源状态" label-position="top">
                  <el-select
                    v-model="formDeviceInfo.lightChannelStatus"
                    placeholder="请选择"
                    class="device-select"
                  >
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="沿定义" label-position="top">
                  <el-select
                    v-model="formDeviceInfo.alongDefinition"
                    placeholder="请选择"
                    class="device-select"
                  >
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="持续时间(ms)" label-position="top">
                  <el-input-number
                    v-model="formDeviceInfo.duration"
                    :min="1"
                    :max="10"
                    controls-position="right"
                    @change="handleChange"
                  />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="24">
              <el-col :span="6">
                <el-form-item label="通道4亮度" label-position="top">
                  <el-input-number
                    v-model="formDeviceInfo.channelBrightness4"
                    :min="1"
                    :max="10"
                    controls-position="right"
                    @change="handleChange"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="光源状态" label-position="top">
                  <el-select
                    v-model="formDeviceInfo.lightChannelStatus"
                    placeholder="请选择"
                    class="device-select"
                  >
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="沿定义" label-position="top">
                  <el-select
                    v-model="formDeviceInfo.alongDefinition"
                    placeholder="请选择"
                    class="device-select"
                  >
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="持续时间(ms)" label-position="top">
                  <el-input-number
                    v-model="formDeviceInfo.duration"
                    :min="1"
                    :max="10"
                    controls-position="right"
                    @change="handleChange"
                  />
                </el-form-item>
              </el-col>
            </el-row>
          </template>
          <template v-if="showLightConfigBrands.includes(formDeviceInfo.protocol)">
            <div>IO参数</div>
            <el-row :gutter="24">
              <el-col :span="6">
                <el-form-item label="输出类型" label-position="top">
                  <el-select
                    v-model="formDeviceInfo.outputType"
                    placeholder="请选择"
                    class="device-select"
                  >
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="发送间隔(ms)" label-position="top">
                  <el-input-number
                    v-model="formDeviceInfo.sendInterval"
                    :min="1"
                    :max="10"
                    controls-position="right"
                    @change="handleChange"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="IO端口号" label-position="top">
                  <el-select
                    v-model="formDeviceInfo.IOPort"
                    placeholder="请选择"
                    class="device-select"
                  >
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="延迟时间" label-position="top">
                  <el-input-number
                    v-model="formDeviceInfo.delayTime"
                    :min="1"
                    :max="10"
                    controls-position="right"
                    @change="handleChange"
                  />
                </el-form-item>
              </el-col>
            </el-row>
            <el-form-item label="轮询开关" label-position="left">
              <el-switch v-model="formDeviceInfo.polling" />
            </el-form-item>
            <el-row :gutter="24" v-if="formDeviceInfo.polling">
              <el-col :span="12">
                <el-form-item label="轮询间隔" label-position="top">
                  <el-input-number
                    v-model="formDeviceInfo.pollingInterval"
                    :min="1"
                    :max="10"
                    controls-position="right"
                    @change="handleChange"
                  />
                </el-form-item>
              </el-col>
            </el-row>
            <div>光源参数</div>
            <el-row :gutter="24">
              <el-col :span="6">
                <el-form-item label="通道1亮度" label-position="top">
                  <el-input-number
                    v-model="formDeviceInfo.channelBrightness1"
                    :min="1"
                    :max="10"
                    controls-position="right"
                    @change="handleChange"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="光源状态" label-position="top">
                  <el-select
                    v-model="formDeviceInfo.lightChannelStatus"
                    placeholder="请选择"
                    class="device-select"
                  >
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="沿定义" label-position="top">
                  <el-select
                    v-model="formDeviceInfo.alongDefinition"
                    placeholder="请选择"
                    class="device-select"
                  >
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="持续时间(ms)" label-position="top">
                  <el-input-number
                    v-model="formDeviceInfo.duration"
                    :min="1"
                    :max="10"
                    controls-position="right"
                    @change="handleChange"
                  />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="24">
              <el-col :span="6">
                <el-form-item label="通道2亮度" label-position="top">
                  <el-input-number
                    v-model="formDeviceInfo.channelBrightness2"
                    :min="1"
                    :max="10"
                    controls-position="right"
                    @change="handleChange"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="光源状态" label-position="top">
                  <el-select
                    v-model="formDeviceInfo.lightChannelStatus"
                    placeholder="请选择"
                    class="device-select"
                  >
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="沿定义" label-position="top">
                  <el-select
                    v-model="formDeviceInfo.alongDefinition"
                    placeholder="请选择"
                    class="device-select"
                  >
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="持续时间(ms)" label-position="top">
                  <el-input-number
                    v-model="formDeviceInfo.duration"
                    :min="1"
                    :max="10"
                    controls-position="right"
                    @change="handleChange"
                  />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="24">
              <el-col :span="6">
                <el-form-item label="通道3亮度" label-position="top">
                  <el-input-number
                    v-model="formDeviceInfo.channelBrightness3"
                    :min="1"
                    :max="10"
                    controls-position="right"
                    @change="handleChange"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="光源状态" label-position="top">
                  <el-select
                    v-model="formDeviceInfo.lightChannelStatus"
                    placeholder="请选择"
                    class="device-select"
                  >
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="沿定义" label-position="top">
                  <el-select
                    v-model="formDeviceInfo.alongDefinition"
                    placeholder="请选择"
                    class="device-select"
                  >
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="持续时间(ms)" label-position="top">
                  <el-input-number
                    v-model="formDeviceInfo.duration"
                    :min="1"
                    :max="10"
                    controls-position="right"
                    @change="handleChange"
                  />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="24">
              <el-col :span="6">
                <el-form-item label="通道4亮度" label-position="top">
                  <el-input-number
                    v-model="formDeviceInfo.channelBrightness4"
                    :min="1"
                    :max="10"
                    controls-position="right"
                    @change="handleChange"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="光源状态" label-position="top">
                  <el-select
                    v-model="formDeviceInfo.lightChannelStatus"
                    placeholder="请选择"
                    class="device-select"
                  >
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="沿定义" label-position="top">
                  <el-select
                    v-model="formDeviceInfo.alongDefinition"
                    placeholder="请选择"
                    class="device-select"
                  >
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="持续时间(ms)" label-position="top">
                  <el-input-number
                    v-model="formDeviceInfo.duration"
                    :min="1"
                    :max="10"
                    controls-position="right"
                    @change="handleChange"
                  />
                </el-form-item>
              </el-col>
            </el-row>
            <div class="custom-table">
              <div class="mb-2">触发配置</div>
              <el-table :data="formDeviceInfo.tableData" class="customList-table">
                <el-table-column fixed prop="num" label="序号" width="60" />
                <el-table-column prop="inputIO" label="输入IO">
                  <template #default="scope">
                    <el-select
                      v-model="scope.row.inputIO"
                      placeholder="Select"
                      class="device-select"
                    >
                      <el-option
                        v-for="item in options"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value"
                      />
                    </el-select>
                  </template>
                </el-table-column>
                <el-table-column prop="triggeringSignal" label="触发信号">
                  <template #default="scope">
                    <el-select
                      v-model="scope.row.triggeringSignal"
                      placeholder="Select"
                      class="device-select"
                    >
                      <el-option
                        v-for="item in options"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value"
                      />
                    </el-select>
                  </template>
                </el-table-column>
                <el-table-column prop="process" label="流程">
                  <template #default="scope">
                    <el-select
                      v-model="scope.row.process"
                      placeholder="Select"
                      class="device-select"
                    >
                      <el-option
                        v-for="item in options"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value"
                      />
                    </el-select>
                  </template>
                </el-table-column>
                <el-table-column prop="result" label="操作"></el-table-column>
              </el-table>
              <div class="table-add-btn" @click="handleTableAdd">
                <img
                  src="@/assets/images/common/table_addBtn.png"
                  alt=""
                  class="w-[16px] h-[16px] mr-2"
                />添加数据
              </div>
            </div>
          </template>
          <template v-if="showGPIOBrands.includes(formDeviceInfo.protocol)">
            <div>IO参数</div>
            <el-row :gutter="24">
              <el-col :span="6">
                <el-form-item label="输出类型" label-position="top">
                  <el-select
                    v-model="formDeviceInfo.outputType"
                    placeholder="请选择"
                    class="device-select"
                  >
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="发送间隔(ms)" label-position="top">
                  <el-input-number
                    v-model="formDeviceInfo.sendInterval"
                    :min="1"
                    :max="10"
                    controls-position="right"
                    @change="handleChange"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="IO端口号" label-position="top">
                  <el-select
                    v-model="formDeviceInfo.IOPort"
                    placeholder="请选择"
                    class="device-select"
                  >
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="延迟时间" label-position="top">
                  <el-input-number
                    v-model="formDeviceInfo.delayTime"
                    :min="1"
                    :max="10"
                    controls-position="right"
                    @change="handleChange"
                  />
                </el-form-item>
              </el-col>
            </el-row>
            <el-form-item label="轮询开关" label-position="left">
              <el-switch v-model="formDeviceInfo.polling" />
            </el-form-item>
            <el-row :gutter="24" v-if="formDeviceInfo.polling">
              <el-col :span="12">
                <el-form-item label="轮询间隔" label-position="top">
                  <el-input-number
                    v-model="formDeviceInfo.pollingInterval"
                    :min="1"
                    :max="10"
                    controls-position="right"
                    @change="handleChange"
                  />
                </el-form-item>
              </el-col>
            </el-row>
          </template>
          <template v-if="showLE200rands.includes(formDeviceInfo.protocol)">
            <el-row :gutter="24">
              <el-col :span="12">
                <el-form-item label="设备列表" label-position="top">
                  <el-select
                    v-model="formDeviceInfo.devices"
                    placeholder="请选择"
                    class="device-select"
                  >
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-button type="primary" :icon="RefreshRight" circle class="mt-7" />
              </el-col>
            </el-row>
            <div>IO参数</div>
            <el-row :gutter="24">
              <el-col :span="12">
                <el-form-item label="输出类型" label-position="top">
                  <el-select
                    v-model="formDeviceInfo.outputType"
                    placeholder="请选择"
                    class="device-select"
                  >
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="延迟时间" label-position="top">
                  <el-input-number
                    v-model="formDeviceInfo.delayTime"
                    :min="1"
                    :max="10"
                    controls-position="right"
                    @change="handleChange"
                  />
                </el-form-item>
              </el-col>
            </el-row>
            <el-form-item label="轮询开关" label-position="left">
              <el-switch v-model="formDeviceInfo.polling" />
            </el-form-item>
            <el-row :gutter="24" v-if="formDeviceInfo.polling">
              <el-col :span="12">
                <el-form-item label="轮询间隔" label-position="top">
                  <el-input-number
                    v-model="formDeviceInfo.pollingInterval"
                    :min="1"
                    :max="10"
                    controls-position="right"
                    @change="handleChange"
                  />
                </el-form-item>
              </el-col>
            </el-row>
            <div>光源参数</div>
            <el-row :gutter="24">
              <el-col :span="6">
                <el-form-item label="通道1亮度" label-position="top">
                  <el-input-number
                    v-model="formDeviceInfo.channelBrightness1"
                    :min="1"
                    :max="10"
                    controls-position="right"
                    @change="handleChange"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="光源输入源" label-position="top">
                  <el-select
                    v-model="formDeviceInfo.lightInputSource1"
                    placeholder="请选择"
                    class="device-select"
                  >
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="通道2亮度" label-position="top">
                  <el-input-number
                    v-model="formDeviceInfo.channelBrightness2"
                    :min="1"
                    :max="10"
                    controls-position="right"
                    @change="handleChange"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="光源输入源" label-position="top">
                  <el-select
                    v-model="formDeviceInfo.lightInputSource2"
                    placeholder="请选择"
                    class="device-select"
                  >
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="通道3亮度" label-position="top">
                  <el-input-number
                    v-model="formDeviceInfo.channelBrightness3"
                    :min="1"
                    :max="10"
                    controls-position="right"
                    @change="handleChange"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="光源输入源" label-position="top">
                  <el-select
                    v-model="formDeviceInfo.lightInputSource3"
                    placeholder="请选择"
                    class="device-select"
                  >
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="通道4亮度" label-position="top">
                  <el-input-number
                    v-model="formDeviceInfo.channelBrightness4"
                    :min="1"
                    :max="10"
                    controls-position="right"
                    @change="handleChange"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="光源输入源" label-position="top">
                  <el-select
                    v-model="formDeviceInfo.lightInputSource4"
                    placeholder="请选择"
                    class="device-select"
                  >
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
            <div>IO控制参数</div>
            <el-row :gutter="24">
              <el-col :span="12">
                <el-form-item label="IO端口号" label-position="top">
                  <el-select
                    v-model="formDeviceInfo.IOPort"
                    placeholder="请选择"
                    class="device-select"
                  >
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="通道模式" label-position="top">
                  <el-select
                    v-model="formDeviceInfo.channelMode"
                    placeholder="请选择"
                    class="device-select"
                  >
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="反转" label-position="left">
                  <el-switch v-model="formDeviceInfo.reversal" />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="状态" label-position="left">
                  <el-switch v-model="formDeviceInfo.state" />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="防抖时间" label-position="top">
                  <el-input-number
                    v-model="formDeviceInfo.shakeTime"
                    :min="1"
                    :max="10"
                    controls-position="right"
                    @change="handleChange"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="延迟时间" label-position="top">
                  <el-input-number
                    v-model="formDeviceInfo.controlDelayTime"
                    :min="1"
                    :max="10"
                    controls-position="right"
                    @change="handleChange"
                  />
                </el-form-item>
              </el-col>
            </el-row>
            <div>定时器参数</div>
            <el-row :gutter="24">
              <el-col :span="6">
                <el-form-item label="定时器" label-position="top">
                  <el-input-number
                    v-model="formDeviceInfo.timer"
                    :min="1"
                    :max="10"
                    controls-position="right"
                    @change="handleChange"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="触发模式" label-position="top">
                  <el-select
                    v-model="formDeviceInfo.triggerMode"
                    placeholder="请选择"
                    class="device-select"
                  >
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="频闪脉宽(us）" label-position="top">
                  <el-input-number
                    v-model="formDeviceInfo.strobePulse"
                    :min="1"
                    :max="10"
                    controls-position="right"
                    @change="handleChange"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="延迟时间" label-position="top">
                  <el-input-number
                    v-model="formDeviceInfo.flickerDelayTime"
                    :min="1"
                    :max="10"
                    controls-position="right"
                    @change="handleChange"
                  />
                </el-form-item>
              </el-col>
            </el-row>
          </template>
          <template v-if="showVC5000rands.includes(formDeviceInfo.protocol)">
            <div>IO参数</div>
            <el-row :gutter="24">
              <el-col :span="6">
                <el-form-item label="输出类型" label-position="top">
                  <el-select
                    v-model="formDeviceInfo.outputType"
                    placeholder="请选择"
                    class="device-select"
                  >
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="发送间隔(ms)" label-position="top">
                  <el-input-number
                    v-model="formDeviceInfo.sendInterval"
                    :min="1"
                    :max="10"
                    controls-position="right"
                    @change="handleChange"
                  />
                </el-form-item>
              </el-col>

              <el-col :span="6">
                <el-form-item label="输出极性" label-position="top">
                  <el-select
                    v-model="formDeviceInfo.outputPolarity"
                    placeholder="请选择"
                    class="device-select"
                  >
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="延迟时间" label-position="top">
                  <el-input-number
                    v-model="formDeviceInfo.delayTime"
                    :min="1"
                    :max="10"
                    controls-position="right"
                    @change="handleChange"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="IO端口号" label-position="top">
                  <el-select
                    v-model="formDeviceInfo.IOPort"
                    placeholder="请选择"
                    class="device-select"
                  >
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
            <el-form-item label="轮询开关" label-position="left">
              <el-switch v-model="formDeviceInfo.polling" />
            </el-form-item>
            <el-row :gutter="24" v-if="formDeviceInfo.polling">
              <el-col :span="12">
                <el-form-item label="轮询间隔" label-position="top">
                  <el-input-number
                    v-model="formDeviceInfo.pollingInterval"
                    :min="1"
                    :max="10"
                    controls-position="right"
                    @change="handleChange"
                  />
                </el-form-item>
              </el-col>
            </el-row>
            <div>光源参数</div>
            <el-row :gutter="24">
              <el-col :span="6">
                <el-form-item label="通道1亮度" label-position="top">
                  <el-input-number
                    v-model="formDeviceInfo.channelBrightness1"
                    :min="1"
                    :max="10"
                    controls-position="right"
                    @change="handleChange"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="光源状态" label-position="top">
                  <el-select
                    v-model="formDeviceInfo.lightChannelStatus"
                    placeholder="请选择"
                    class="device-select"
                  >
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="持续时间(ms)" label-position="top">
                  <el-input-number
                    v-model="formDeviceInfo.duration"
                    :min="1"
                    :max="10"
                    controls-position="right"
                    @change="handleChange"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="光源输入源" label-position="top">
                  <el-select
                    v-model="formDeviceInfo.lightInputSource1"
                    placeholder="请选择"
                    class="device-select"
                  >
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="24">
              <el-col :span="6">
                <el-form-item label="通道2亮度" label-position="top">
                  <el-input-number
                    v-model="formDeviceInfo.channelBrightness2"
                    :min="1"
                    :max="10"
                    controls-position="right"
                    @change="handleChange"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="光源状态" label-position="top">
                  <el-select
                    v-model="formDeviceInfo.lightChannelStatus"
                    placeholder="请选择"
                    class="device-select"
                  >
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="持续时间(ms)" label-position="top">
                  <el-input-number
                    v-model="formDeviceInfo.duration"
                    :min="1"
                    :max="10"
                    controls-position="right"
                    @change="handleChange"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="光源输入源" label-position="top">
                  <el-select
                    v-model="formDeviceInfo.lightInputSource1"
                    placeholder="请选择"
                    class="device-select"
                  >
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="24">
              <el-col :span="6">
                <el-form-item label="通道3亮度" label-position="top">
                  <el-input-number
                    v-model="formDeviceInfo.channelBrightness3"
                    :min="1"
                    :max="10"
                    controls-position="right"
                    @change="handleChange"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="光源状态" label-position="top">
                  <el-select
                    v-model="formDeviceInfo.lightChannelStatus"
                    placeholder="请选择"
                    class="device-select"
                  >
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="持续时间(ms)" label-position="top">
                  <el-input-number
                    v-model="formDeviceInfo.duration"
                    :min="1"
                    :max="10"
                    controls-position="right"
                    @change="handleChange"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="光源输入源" label-position="top">
                  <el-select
                    v-model="formDeviceInfo.lightInputSource1"
                    placeholder="请选择"
                    class="device-select"
                  >
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="24">
              <el-col :span="6">
                <el-form-item label="通道4亮度" label-position="top">
                  <el-input-number
                    v-model="formDeviceInfo.channelBrightness4"
                    :min="1"
                    :max="10"
                    controls-position="right"
                    @change="handleChange"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="光源状态" label-position="top">
                  <el-select
                    v-model="formDeviceInfo.lightChannelStatus"
                    placeholder="请选择"
                    class="device-select"
                  >
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="持续时间(ms)" label-position="top">
                  <el-input-number
                    v-model="formDeviceInfo.duration"
                    :min="1"
                    :max="10"
                    controls-position="right"
                    @change="handleChange"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="光源输入源" label-position="top">
                  <el-select
                    v-model="formDeviceInfo.lightInputSource1"
                    placeholder="请选择"
                    class="device-select"
                  >
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="24">
              <el-col :span="6">
                <el-form-item label="通道5亮度" label-position="top">
                  <el-input-number
                    v-model="formDeviceInfo.channelBrightness5"
                    :min="1"
                    :max="10"
                    controls-position="right"
                    @change="handleChange"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="光源状态" label-position="top">
                  <el-select
                    v-model="formDeviceInfo.lightChannelStatus"
                    placeholder="请选择"
                    class="device-select"
                  >
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="持续时间(ms)" label-position="top">
                  <el-input-number
                    v-model="formDeviceInfo.duration"
                    :min="1"
                    :max="10"
                    controls-position="right"
                    @change="handleChange"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="光源输入源" label-position="top">
                  <el-select
                    v-model="formDeviceInfo.lightInputSource1"
                    placeholder="请选择"
                    class="device-select"
                  >
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="24">
              <el-col :span="6">
                <el-form-item label="通道6亮度" label-position="top">
                  <el-input-number
                    v-model="formDeviceInfo.channelBrightness6"
                    :min="1"
                    :max="10"
                    controls-position="right"
                    @change="handleChange"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="光源状态" label-position="top">
                  <el-select
                    v-model="formDeviceInfo.lightChannelStatus"
                    placeholder="请选择"
                    class="device-select"
                  >
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="持续时间(ms)" label-position="top">
                  <el-input-number
                    v-model="formDeviceInfo.duration"
                    :min="1"
                    :max="10"
                    controls-position="right"
                    @change="handleChange"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="光源输入源" label-position="top">
                  <el-select
                    v-model="formDeviceInfo.lightInputSource1"
                    placeholder="请选择"
                    class="device-select"
                  >
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="24">
              <el-col :span="6">
                <el-form-item label="通道7亮度" label-position="top">
                  <el-input-number
                    v-model="formDeviceInfo.channelBrightness7"
                    :min="1"
                    :max="10"
                    controls-position="right"
                    @change="handleChange"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="光源状态" label-position="top">
                  <el-select
                    v-model="formDeviceInfo.lightChannelStatus"
                    placeholder="请选择"
                    class="device-select"
                  >
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="持续时间(ms)" label-position="top">
                  <el-input-number
                    v-model="formDeviceInfo.duration"
                    :min="1"
                    :max="10"
                    controls-position="right"
                    @change="handleChange"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="光源输入源" label-position="top">
                  <el-select
                    v-model="formDeviceInfo.lightInputSource1"
                    placeholder="请选择"
                    class="device-select"
                  >
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="24">
              <el-col :span="6">
                <el-form-item label="通道8亮度" label-position="top">
                  <el-input-number
                    v-model="formDeviceInfo.channelBrightness8"
                    :min="1"
                    :max="10"
                    controls-position="right"
                    @change="handleChange"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="光源状态" label-position="top">
                  <el-select
                    v-model="formDeviceInfo.lightChannelStatus"
                    placeholder="请选择"
                    class="device-select"
                  >
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="持续时间(ms)" label-position="top">
                  <el-input-number
                    v-model="formDeviceInfo.duration"
                    :min="1"
                    :max="10"
                    controls-position="right"
                    @change="handleChange"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="光源输入源" label-position="top">
                  <el-select
                    v-model="formDeviceInfo.lightInputSource1"
                    placeholder="请选择"
                    class="device-select"
                  >
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
            <div class="custom-table">
              <div class="mb-2">触发配置</div>
              <el-table :data="formDeviceInfo.tableData" class="customList-table">
                <el-table-column fixed prop="num" label="序号" width="60" />
                <el-table-column prop="inputIO" label="输入IO">
                  <template #default="scope">
                    <el-select
                      v-model="scope.row.inputIO"
                      placeholder="Select"
                      class="device-select"
                    >
                      <el-option
                        v-for="item in options"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value"
                      />
                    </el-select>
                  </template>
                </el-table-column>
                <el-table-column prop="triggeringSignal" label="触发信号">
                  <template #default="scope">
                    <el-select
                      v-model="scope.row.triggeringSignal"
                      placeholder="Select"
                      class="device-select"
                    >
                      <el-option
                        v-for="item in options"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value"
                      />
                    </el-select>
                  </template>
                </el-table-column>
                <el-table-column prop="process" label="流程">
                  <template #default="scope">
                    <el-select
                      v-model="scope.row.process"
                      placeholder="Select"
                      class="device-select"
                    >
                      <el-option
                        v-for="item in options"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value"
                      />
                    </el-select>
                  </template>
                </el-table-column>
                <el-table-column prop="result" label="操作"></el-table-column>
              </el-table>
              <div class="table-add-btn" @click="handleTableAdd">
                <img
                  src="@/assets/images/common/table_addBtn.png"
                  alt=""
                  class="w-[16px] h-[16px] mr-2"
                />添加数据
              </div>
            </div>
          </template>
        </el-form>
      </div>
    </div>
  </DSDialog>
</template>

<script setup lang="ts">
defineOptions({
  name: 'controllerManagement'
})
import { DSButton } from '@/components/Button'
import { DSDialog } from '@/components/Dialog'
import { RefreshRight } from '@element-plus/icons-vue'
interface Props {
  /** import DeviceDialog from './deviceDialog.vue';
弹窗显隐 */
  value: boolean
}
interface Emits {
  (e: 'update:value', val: boolean): void
}
const props = withDefaults(defineProps<Props>(), {
  value: false
})
const emit = defineEmits<Emits>()
console.log(props.value)
const show = computed({
  get() {
    Object.assign(deviceBars, deviceList)
    return props.value
  },
  set(val: boolean) {
    emit('update:value', val)
  }
})
const isDeviceDialog = ref(false)
// 中间tab
const deviceTab = ref('') // device/receive/send/heartbeat/response
const deviceBars = ref([])

const options = [
  {
    value: 'DPS2',
    label: 'DPS2'
  },
  {
    value: 'MV-AP1024-2T',
    label: 'MV-AP1024-2T'
  },
  {
    value: 'MV-LEVD',
    label: 'MV-LEVD'
  },
  {
    value: 'VB2200',
    label: 'VB2200'
  },
  {
    value: 'VC3000(Light)',
    label: 'VC3000(Light)'
  },
  {
    value: 'VB3000(IO)',
    label: 'VB3000(IO)'
  },
  {
    value: 'VC4000',
    label: 'VC4000'
  },
  {
    value: 'GPIO',
    label: 'GPIO'
  },
  {
    value: 'VB2230',
    label: 'VB2230'
  },
  {
    value: 'VC2000/2100',
    label: 'VC2000/2100'
  },
  {
    value: 'VC3000H/X',
    label: 'VC3000H/X'
  },
  {
    value: 'MV-LEVD-200',
    label: 'MV-LEVD-200'
  },
  {
    value: 'LE200',
    label: 'LE200'
  },
  {
    value: 'VC5000',
    label: 'VC5000'
  }
]
// 设备列表
const deviceList = ref([
  {
    name: '1 Light-1',
    enabled: false,
    info: {
      protocol: '',
      deviceName: '',
      serialPort: '',
      baudRate: '',
      dataBits: '',
      checkBit: '',
      stopBit: '',
      outputType: '',
      sendInterval: '',
      IOPort: '',
      delayTime: '',
      shakeTime: '',
      devices: '',
      reconnect: false,
      polling: false,
      reversal: false,
      state: false,
      endInfo: '',
      channelBrightness1: 0,
      channelBrightness2: 0,
      channelBrightness3: 0,
      channelBrightness4: 0,
      channelBrightness5: 0,
      channelBrightness6: 0,
      pollingInterval: 0,
      lightChannel: 0,
      lightChannelStatus: '',
      tableData: []
    }
  },
  { name: '2 Light-2', enabled: false }
])
// 设备信息表单
const formDeviceInfo = reactive({
  protocol: '',
  deviceName: '',
  serialPort: '',
  baudRate: '',
  dataBits: '',
  checkBit: '',
  stopBit: '',
  outputType: '',
  outputPolarity: '', // 输出极性
  sendInterval: '',
  IOPort: '',
  delayTime: '', // IO延迟时间
  controlDelayTime: '', // IO控制延迟时间
  flickerDelayTime: '', // 频闪延迟时间
  shakeTime: '',
  timer: '',
  triggerMode: '',
  strobePulse: '',
  reconnect: false,
  polling: false,
  endInfo: '',
  channelBrightness1: 0,
  channelBrightness2: 0,
  channelBrightness3: 0,
  channelBrightness4: 0,
  channelBrightness5: 0,
  channelBrightness6: 0,
  channelBrightness7: 0,
  channelBrightness8: 0,
  pollingInterval: 0,
  lightChannel: 0,
  lightChannelStatus: '',
  alongDefinition: '',
  lightInputSource1: '',
  lightInputSource2: '',
  lightInputSource3: '',
  lightInputSource4: '',
  channelMode: '',
  tableData: []
})

// 需要通道亮度的品牌列表
const showBrightnessBrands = ref(['DPS2', 'MV-LEVD', 'MV-AP1024-2T', 'MV-LEVD-200'])

// 需要IO端口的品牌列表
const showIOPortBrands = ref(['VB2200', 'VB3000(IO)', 'VB2230', 'VC2000/2100'])
// 需要VC3000 (Light)的品牌列表
const showLightBrands = ref(['VC3000(Light)'])
// 需要VC4000的品牌列表
const showLightConfigBrands = ref(['VC4000', 'VC3000H/X'])
// 需要GPIO的品牌列表
const showGPIOBrands = ref(['GPIO'])
// 需要LE200的品牌列表
const showLE200rands = ref(['LE200'])
// 需要VC5000的品牌列表
const showVC5000rands = ref(['VC5000'])
// 需要NoParam的品牌列表
const showNoParamBrands = ref(['GPIO', 'LE200', 'VC5000'])
const selectDevice = (device: Device) => {
  deviceTab.value = device.name
  Object.assign(formDeviceInfo, device.info)
  console.log(deviceTab.value)
}

// 添加设备
const addDevice = () => {
  deviceList.value.push({
    name: `${deviceList.value.length + 1} Light-${deviceList.value.length + 1}`,
    enabled: false,
    info: {
      protocol: '',
      deviceName: '',
      serialPort: '',
      baudRate: '',
      dataBits: '',
      checkBit: '',
      stopBit: '',
      outputType: '',
      sendInterval: '',
      IOPort: '',
      delayTime: '',
      reconnect: false,
      polling: false,
      endInfo: '',
      channelBrightness1: 0,
      channelBrightness2: 0,
      channelBrightness3: 0,
      channelBrightness4: 0,
      pollingInterval: 0,
      lightChannel: 0,
      lightChannelStatus: '',
      tableData: []
    }
  })
  console.log(isDeviceDialog.value, 'isDeviceDialog.value')
}

const handleTableAdd = () => {
  formDeviceInfo.tableData.push({
    num: formDeviceInfo.tableData.length + 1,
    inputIO: '1',
    triggeringSignal: '上升沿',
    process: '流程1'
  })
}

const handleChange = () => {}
// 处理对话框关闭事件
const handleClose = () => {}
</script>

<style scoped lang="scss">
/* 弹框整体样式 */
.controllerManagement-container {
  position: relative;
  width: 100%;
  height: 766px;
  box-sizing: border-box;
  display: flex;
  .controllerManagement-infoList {
    box-sizing: border-box;
    width: 250px;
    .controllerManagement-infoList-title {
      box-sizing: border-box;
      display: flex;
      align-items: center;
      justify-content: space-between;
      width: 100%;
      height: 50px;
      padding: 0 16px;
      font-size: 14px;
      font-weight: bold;
      .infoList-title-btn {
        width: 24px;
        height: 24px;
        background: #154ddd;
        border: none;
        color: #fff;
        font-size: 24px;
        text-align: center;
        line-height: 20px;
        border-radius: 50%;
        cursor: pointer;
      }
    }
    .controllerManagement-infoList-content {
      .controllerManagement-infoList-item {
        box-sizing: border-box;
        width: 100%;
        height: 32px;
        padding: 0 16px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        cursor: pointer;
      }
      .controllerManagement-infoList-item.active {
        background: #f2f2f7;
        span {
          color: #154ddd;
        }
      }
    }
  }
  .controllerManagement-content {
    flex: 1;
    height: 100%;
    overflow: auto;
    box-sizing: border-box;
    padding: 16px 24px 24px;
    .device-select {
      color: #fff;
      :deep(.el-select__wrapper) {
        background: #303136;
        .el-select__selected-item {
          color: #fff;
        }
      }
    }
    :deep(.el-input-number) {
      width: 100%;
      .el-input-number__increase,
      .el-input-number__decrease {
        background: transparent;
        color: #fff;
        border: none;
      }
    }
    .form-device-btn {
      width: 80px;
      padding: 0 12px;
    }
  }
  .controllerManagement-line-first {
    position: absolute;
    left: 250px;
    width: 1px;
    height: 100vh;
    background-color: #fff;
    opacity: 0.3;
  }
  .custom-table {
    .customList-table {
      width: 100%;
      height: 190px;
      background: #363940;
    }
    .table-add-btn {
      /* 按钮样式 */
      box-sizing: border-box;
      width: 128px;
      height: 40px;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
    }
  }
  :deep(.customList-table .el-table__header > thead th) {
    color: #fff;
    background-color: rgba(21, 77, 221, 0.1);
    border-color: #4e5969;
  }
  :deep(.customList-table .el-table__header > thead tr) {
    background: transparent;
  }
  :deep(.customList-table .el-table__body > tbody tr) {
    color: #fff;
    background-color: transparent;
    & > td {
      border: none;
    }
  }
  :deep(.customList-table .el-table__body .hover-row) {
    & > td {
      background: #303136;
    }
  }
  :deep(.el-table--fit .el-table__inner-wrapper:before) {
    background-color: #4e5969;
  }
}
</style>
