<template>
  <div class="channelsetBox">
    <!-- 通道设置 -->
    <div class="channelList">
      <h4>拍照通道</h4>
      <el-radio-group v-model="selectChannel" @input="changeChannel">
        <el-radio
          v-for="item in channelList"
          :key="item.channelid"
          :label="item.channelid"
          :value="item.channelid"
        >
          {{ item.channelname }}</el-radio
        >
      </el-radio-group>
    </div>
    <el-divider></el-divider>
    <!-- 模板 -->
    <div class="modelList">
      <div class="modeLeft">
        <h4>模板</h4>
        <el-select
          size="mini"
          v-model="channelForm.templateVal"
          placeholder="请选择"
        >
          <el-option
            v-for="item in templateOptions"
            :key="item.value"
            :label="item.name"
            :value="item.value"
          >
          </el-option>
        </el-select>
      </div>
      <div class="usbRight">
        <el-checkbox
          class="usbClass"
          label="USB摄像头"
          v-model="channelForm.usbchecked"
        ></el-checkbox>
      </div>
    </div>
    <el-divider></el-divider>
    <!-- 图片设置 -->
    <div class="photoList">
      <div class="picradio">
        <h4>图片尺寸</h4>
        <el-input v-model="channelForm.resolutionCX" size="mini"></el-input>
        <b> X </b>
        <el-input v-model="channelForm.resolutionCY" size="mini"></el-input>
        <el-popover
          placement="right"
          width="100"
          trigger="click"
          popper-class="my-popover"
        >
          <p v-for="item in imgSizeOption" @click="imgSizeClick(item)">
            {{ item.cx }}X{{ item.cy }}
          </p>
          <el-tag slot="reference">例</el-tag>
        </el-popover>
      </div>
      <div class="picysl">
        <h4>压缩率</h4>
        <el-input v-model="channelForm.ysl" size="mini"></el-input>
      </div>
      <div class="piczoom">
        <h4>图片放大</h4>
        <el-radio-group v-model="channelForm.isImageZoomEnabled">
          <el-radio :label="1">开</el-radio>
          <el-radio :label="0">关</el-radio>
        </el-radio-group>
      </div>
      <div class="zoomclass">
        <h4>放大倍数</h4>
        <el-slider
          v-model="channelForm.zoomVal"
          :min="1"
          :max="4"
          :step="0.1"
        ></el-slider>
        <el-tag type="info">{{ channelForm.zoomVal }}</el-tag>
      </div>
    </div>
    <el-divider></el-divider>
    <!-- 视频设置 -->
    <div class="photoList">
      <div class="picradio">
        <h4>视频尺寸</h4>
        <el-input v-model="channelForm.videoCX" size="mini"></el-input>
        <b> X </b>
        <el-input v-model="channelForm.videoCY" size="mini"></el-input>
        <el-popover
          placement="right"
          width="100"
          trigger="click"
          popper-class="my-popover"
        >
          <p v-for="item in videoOption" @click="videoClick(item)">
            {{ item.videox }}X{{ item.videoy }}
          </p>
          <el-tag slot="reference">例</el-tag>
        </el-popover>
      </div>
      <div class="picysl">
        <h4>视频时长</h4>
        <el-input v-model="channelForm.videoDuration" size="mini"></el-input>
        <span class="infoSpan">(秒)</span>
      </div>
    </div>
    <el-divider></el-divider>
    <!-- 3A控制 -->
    <div class="threeASet">
      <div class="top">
        <div class="screen">
          <h4>场景选择</h4>
          <el-select
            size="mini"
            v-model="channelForm.modelVal"
            placeholder="请选择"
          >
            <el-option
              v-for="item in modelOptions"
              :key="item.id"
              :label="item.chName"
              :value="item.id"
            >
            </el-option>
          </el-select>
        </div>
        <div class="wait3Lock">
          <el-checkbox
            label="等待AE锁定"
            v-model="channelForm.aechecked"
          ></el-checkbox>
          <el-checkbox
            label="等待AWB锁定"
            v-model="channelForm.awbchecked"
          ></el-checkbox>
          <el-checkbox
            label="等待AF锁定"
            v-model="channelForm.afchecked"
          ></el-checkbox>
          <el-checkbox
            class="gmclass"
            label="光敏控制"
            v-model="channelForm.gmkzchecked"
          ></el-checkbox>
        </div>
      </div>
      <div class="mid">
        <div class="bgms">
          <h4>曝光模式</h4>
          <el-checkbox
            label="自动曝光"
            v-model="channelForm.zdbgchecked"
            @change="bgchange"
          ></el-checkbox>
        </div>
        <div class="bgsj">
          <h4>曝光时间</h4>
          <el-input
            v-model="channelForm.bgsj"
            :disabled="bgflag"
            size="mini"
          ></el-input>
          <span class="infoSpan">(ms)</span>
          <el-input
            v-model="channelForm.expsTimeUs"
            :disabled="bgflag"
            size="mini"
          ></el-input>
          <span class="infoSpan">(μs)</span>
          <span
            class="infoSpan"
            v-if="
              this.channelForm.bgsj !== '' || this.channelForm.expsTimeUs !== ''
            "
            >({{
              this.channelForm.bgsj * 1000000 +
              this.channelForm.expsTimeUs * 1000
            }}ns)</span
          >
        </div>
        <div class="iso">
          <h4>ISO</h4>
          <el-input
            v-model="channelForm.iso"
            :disabled="bgflag"
            size="mini"
          ></el-input>
        </div>
        <div class="bgbc">
          <h4>曝光补偿</h4>
          <el-select
            v-model="channelForm.compensationVal"
            placeholder="请选择"
            size="mini"
          >
            <el-option
              v-for="item in compensationOptions"
              :key="item.value"
              :label="item.name"
              :value="item.value"
            >
            </el-option>
          </el-select>
        </div>
      </div>
      <div class="btm">
        <h4>对焦模式</h4>
        <el-checkbox
          label="自动对焦"
          v-model="channelForm.zzdjchecked"
        ></el-checkbox>
        <h4>白平衡模式</h4>
        <el-select
          size="mini"
          v-model="channelForm.awbMode"
          placeholder="请选择"
        >
          <el-option
            v-for="item in awbModeOption"
            :key="item.value"
            :label="item.name"
            :value="item.value"
          >
          </el-option>
        </el-select>
      </div>
    </div>
    <el-divider></el-divider>
    <!-- 旋转角度 -->
    <div class="roteAiBox">
      <h4>旋转角度</h4>
      <el-select v-model="channelForm.roteval" placeholder="请选择" size="mini">
        <el-option
          v-for="item in roteOptions"
          :key="item.value"
          :label="item.label"
          :value="item.value"
        >
        </el-option>
      </el-select>
      <h4>AI识别</h4>
      <el-select v-model="channelForm.aival" placeholder="请选择" size="mini">
        <el-option
          v-for="item in aiOptions"
          :key="item.value"
          :label="item.label"
          :value="item.value"
        >
        </el-option>
      </el-select>
    </div>
    <el-divider></el-divider>
    <!-- 水印 -->
    <div class="textAreabox">
      <div class="lt">
        <h4>左上osd</h4>
        <el-input
          size="mini"
          type="textarea"
          rows="2"
          v-model="channelForm.ltosd"
        ></el-input>
        <el-popover placement="right" width="230" trigger="click">
          <el-collapse
            v-model="activeNameOsd"
            accordion
            class="my-custom-class"
          >
            <el-collapse-item
              v-for="(group, index) in macroption"
              :key="index"
              :name="index.toString()"
              :title="group.name"
            >
              <p
                v-for="(item, itemIndex) in group.child"
                :key="itemIndex"
                @click="selectItem1(item)"
              >
                {{ item.name }} {{ item.value }}
              </p>
            </el-collapse-item>
          </el-collapse>
          <el-tag slot="reference">宏</el-tag>
        </el-popover>
      </div>
      <div class="rt">
        <h4>右上osd</h4>
        <el-input
          size="mini"
          type="textarea"
          rows="2"
          v-model="channelForm.rtosd"
        ></el-input>
        <el-popover placement="right" width="230" trigger="click">
          <el-collapse
            v-model="activeNameOsd"
            accordion
            class="my-custom-class"
          >
            <el-collapse-item
              v-for="(group, index) in macroption"
              :key="index"
              :name="index.toString()"
              :title="group.name"
            >
              <p
                v-for="(item, itemIndex) in group.child"
                :key="itemIndex"
                @click="selectItem2(item)"
              >
                {{ item.name }} {{ item.value }}
              </p>
            </el-collapse-item>
          </el-collapse>
          <el-tag slot="reference">宏</el-tag>
        </el-popover>
      </div>
      <div class="lb">
        <h4>左下osd</h4>
        <el-input
          size="mini"
          type="textarea"
          rows="2"
          v-model="channelForm.lbosd"
        ></el-input>
        <el-popover placement="right" width="230" trigger="click">
          <el-collapse
            v-model="activeNameOsd"
            accordion
            class="my-custom-class"
          >
            <el-collapse-item
              v-for="(group, index) in macroption"
              :key="index"
              :name="index.toString()"
              :title="group.name"
            >
              <p
                v-for="(item, itemIndex) in group.child"
                :key="itemIndex"
                @click="selectItem3(item)"
              >
                {{ item.name }} {{ item.value }}
              </p>
            </el-collapse-item>
          </el-collapse>
          <el-tag slot="reference">宏</el-tag>
        </el-popover>
      </div>
      <div class="rb">
        <h4>右下osd</h4>
        <el-input
          size="mini"
          type="textarea"
          rows="2"
          v-model="channelForm.rbosd"
        ></el-input>
        <el-popover placement="right" width="230" trigger="click">
          <el-collapse
            v-model="activeNameOsd"
            accordion
            class="my-custom-class"
          >
            <el-collapse-item
              v-for="(group, index) in macroption"
              :key="index"
              :name="index.toString()"
              :title="group.name"
            >
              <p
                v-for="(item, itemIndex) in group.child"
                :key="itemIndex"
                @click="selectItem4(item)"
              >
                {{ item.name }} {{ item.value }}
              </p>
            </el-collapse-item>
          </el-collapse>
          <el-tag slot="reference">宏</el-tag>
        </el-popover>
      </div>
    </div>
    <el-divider></el-divider>
    <div class="moreParams">
      <div class="parambox" v-for="(val, index) in moreForm" :key="index">
        <h4>属性名</h4>
        <el-input v-model="val.parmasName" size="mini"></el-input>
        <h4>属性值</h4>
        <el-input v-model="val.parmasValue" size="mini"></el-input>
        <h4>属性类型</h4>
        <el-select size="mini" v-model="val.parmasType" placeholder="请选择">
          <el-option
            v-for="item in typeOption"
            :key="item.value"
            :label="item.name"
            :value="item.value"
          >
          </el-option>
        </el-select>
        <div class="btngropAdd">
          <el-button
            size="mini"
            v-if="index !== 0"
            type="danger"
            icon="el-icon-minus"
            @click="deleteModule(val, index)"
          ></el-button>
          <el-button
            size="mini"
            icon="el-icon-plus"
            type="primary"
            @click="addModule()"
            v-if="index + 1 == moreForm.length"
          ></el-button>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  props: ["terimMsgid"],
  data() {
    return {
      channelList: [
        {
          channelid: 1,
          channelname: "通道1",
        },
        {
          channelid: 2,
          channelname: "通道2",
        },
        {
          channelid: 3,
          channelname: "通道3",
        },
        {
          channelid: 4,
          channelname: "通道4",
        },
      ], //通道列表
      imageSizeOption: [{}],
      selectChannel: 1, //通道选中
      channelForm: {
        templateVal: 2, //模板选中
        usbchecked: false, //usb摄像头
        resolutionCX: "", //图片尺寸X
        resolutionCY: "", //图片尺寸Y
        videoCX: "", //视频尺寸X
        videoCY: "", //视频尺寸Y
        videoDuration: 15, //视频时长
        ysl: 80, //图片压缩率
        isImageZoomEnabled: 0, //图片放大默认关
        zoomVal: 1, //放大倍数默认1
        modelVal: 0, //场景选择
        aechecked: false,
        awbchecked: false,
        afchecked: false,
        gmkzchecked: false, //光敏控制
        zdbgchecked: false, //自动曝光
        bgsj: "", //曝光时间
        expsTimeUs: "", //曝光时间
        iso: "", //iso
        compensationVal: 0, //曝光补偿
        zzdjchecked: false, //自动对焦
        awbMode: 1, //白平衡模式
        roteval: "", //旋转角度
        aival: "", //ai识别
        ltosd: "", //水印
        rtosd: "", //水印
        lbosd: "", //水印
        rbosd: "", //水印
      },
      originalChannelForm: {}, // 用于存储 channelForm 的初始值
      moreForm: [
        {
          parmasName: "",
          parmasValue: "",
          parmasType: 0,
        },
      ],
      bgflag: false, //曝光使用
      activeNameOsd: 0, //宏的默认选择打开
      //模板options
      templateOptions: [
        { name: "1 - 预览", value: 1 },
        { name: "2 - 静态抓拍", value: 2 },
        { name: "3 - 录像", value: 3 },
        { name: "4 - 快照", value: 4 },
      ],
      //场景选择
      modelOptions: [
        {
          name: "DISABLED",
          id: 0,
          chName: "0 - 无场景",
        },
        {
          name: "FACE_PRIORITY",
          id: 1,
          chName: "1 - 面部优先",
        },
        {
          name: "ACTION",
          id: 2,
          chName: "2 - 动作",
        },
        {
          name: "PORTRAIT",
          id: 3,
          chName: "3 - 肖像",
        },
        {
          name: "LANDSCAPE",
          id: 4,
          chName: "4 - 风景",
        },
        {
          name: "NIGHT",
          id: 5,
          chName: "5 - 夜晚",
        },
        {
          name: "NIGHT_PORTRAIT",
          id: 6,
          chName: "6 - 夜间肖像",
        },
        {
          name: "THEATRE",
          id: 7,
          chName: "7 - 剧院",
        },
        {
          name: "BEACH",
          id: 8,
          chName: "8 - 海滩",
        },
        {
          name: "SNOW",
          id: 9,
          chName: "9 - 雪景",
        },
        {
          name: "SUNSET",
          id: 10,
          chName: "10 - 日落",
        },
        {
          name: "STEADYPHOTO",
          id: 11,
          chName: "11 - 稳定照片",
        },
        {
          name: "FIREWORKS",
          id: 12,
          chName: "12 - 烟花",
        },
        {
          name: "SPORTS",
          id: 13,
          chName: "13 - 运动",
        },
        {
          name: "PARTY",
          id: 14,
          chName: "14 - 聚会",
        },
        {
          name: "CANDLELIGHT",
          id: 15,
          chName: "15 - 烛光",
        },
        {
          name: "16 - BARCODE",
          id: 16,
          chName: "16-条形码",
        },
        {
          name: "18 - HDR",
          id: 18,
          chName: "HDR",
        },
      ],
      //曝光补偿
      compensationOptions: [
        { name: -4, value: -4 },
        { name: -3, value: -3 },
        { name: -2, value: -2 },
        { name: -1, value: -1 },
        { name: 0, value: 0 },
        { name: 1, value: 1 },
        { name: 2, value: 2 },
        { name: 3, value: 3 },
        { name: 4, value: 4 },
      ],
      //白平衡模式
      awbModeOption: [
        { name: "0 - 禁用", value: 0 },
        { name: "1 - 启用自动白平衡", value: 1 },
        { name: "2 - 室内白炽灯", value: 2 },
        { name: "3 - 荧光灯照明", value: 3 },
        { name: "4 - 暖色荧光灯照明", value: 4 },
        { name: "5 - 日光", value: 5 },
        { name: "6 - 多云日光", value: 6 },
        { name: "7 - 日落日出", value: 7 },
        { name: "8 - 非阳光直射区域", value: 8 },
      ],
      //旋转角度
      roteOptions: [
        {
          value: 0,
          label: "0-无旋转",
        },
        {
          value: 1,
          label: "1-0°",
        },
        {
          value: 2,
          label: "2-90°",
        },
        {
          value: 3,
          label: "3-180°",
        },
        {
          value: 4,
          label: "4-270°",
        },
      ],
      //ai识别
      aiOptions: [
        {
          value: 0,
          label: "0-关闭当前通道AI识别",
        },
        {
          value: 1,
          label: "1-启用但不绘制区域",
        },
        {
          value: 2,
          label: "2-启用并绘制区域",
        },
      ],
      //宏
      macroption: [
        {
          name: "系统信息",
          child: [
            {
              name: "版本",
              value: "%%V%%",
            },
            {
              name: "CPU温度",
              value: "%%CPUT%%",
            },
            {
              name: "网络信号等级",
              value: "%%SL%%",
            },
            {
              name: "网络状态",
              value: "%%NS%%",
            },
            {
              name: "剩余存储空间",
              value: "%%FD%%",
            },
            {
              name: "剩余内存",
              value: "%%FM%%",
            },
          ],
        },
        {
          name: "拍照信息",
          child: [
            {
              name: "通道",
              value: "%%CH%%",
            },
            {
              name: "预置位",
              value: "%%PR%%",
            },
            {
              name: "照片ID",
              value: "%%IMGID%%",
            },
            {
              name: "拍照日期和时间",
              value: "%%DATETIME%%",
            },
            {
              name: "拍照时间戳",
              value: "%%TS%%",
            },
            {
              name: "光敏采样值",
              value: " %%LDR%%",
            },
          ],
        },
        {
          name: "电池状态",
          child: [
            {
              name: "电池电量",
              value: "%%BP%%",
            },
            {
              name: "电池电压",
              value: "%%BV%%",
            },
            {
              name: "电池电流",
              value: "%%BC%%",
            },
          ],
        },
        {
          name: "充电状态",
          child: [
            {
              name: "充电电压",
              value: "%%CV%%",
            },
            {
              name: "充电总线电压",
              value: "%%CBV%%",
            },
            {
              name: "充电电流",
              value: "%%CC%%",
            },
            {
              name: "充放电状态",
              value: "%%CS%%",
            },
          ],
        },
      ],
      //图片尺寸示例
      imgSizeOption: [
        { cx: "5376", cy: "3024" },
        { cx: "5344", cy: "4016" },
        { cx: "5312", cy: "3984" },
        { cx: "4096", cy: "3072" },
        { cx: "4096", cy: "2304" },
        { cx: "4032", cy: "3024" },
        { cx: "3840", cy: "2160" },
        { cx: "3264", cy: "2448" },
        { cx: "2560", cy: "1920" },
        { cx: "2560", cy: "1440" },
        { cx: "1920", cy: "1440" },
        { cx: "1920", cy: "1080" },
      ],
      //视频分辨率
      videoOption: [
        {
          videox: "720",
          videoy: "480",
        },
        {
          videox: "320",
          videoy: "240",
        },
        {
          videox: "640",
          videoy: "480",
        },
        {
          videox: "1280",
          videoy: "720",
        },
        {
          videox: "1920",
          videoy: "1080",
        },
      ],
      typeOption: [
        {
          name: "0 - 整数",
          value: 0,
        },
        {
          name: "1 - 字符串",
          value: 1,
        },
        {
          name: "2 - 浮点数",
          value: 2,
        },
      ],
      wait3ALocked: "",
      parmaresult: [], //填写的参数组成想要的内容
      configNum: 26,
      resultJson: "",
    };
  },
  created() {
    // 组件创建时，将 channelForm 的值深拷贝到 originalChannelForm
    this.originalChannelForm = JSON.parse(JSON.stringify(this.channelForm));
  },
  computed: {
    waite3alockVal() {
      let val = 0;
      if (this.channelForm.aechecked) val |= 1;
      if (this.channelForm.awbchecked) val |= 2;
      if (this.channelForm.afchecked) val |= 4;
      return val;
    },
    // 计算属性，返回已更改的字段对象
    changedChannelFields() {
      const changes = {};
      for (const key in this.channelForm) {
        if (
          this.channelForm.hasOwnProperty(key) &&
          this.channelForm[key] !== this.originalChannelForm[key]
        ) {
          changes[key] = this.channelForm[key];
        }
      }
      return changes;
    },
  },
  mounted() {},
  methods: {
    //修改通道
    changeChannel() {
      console.log(this.selectChannel);
      if (this.selectChannel == 1) {
        this.channelForm.resolutionCX = 5376;
        this.channelForm.resolutionCY = 3024;
      } else if (this.selectChannel == 2 || this.selectChannel == 3) {
        this.channelForm.resolutionCX = 1920;
        this.channelForm.resolutionCY = 1080;
      } else if (this.selectChannel == 4) {
        this.channelForm.resolutionCX = 2048;
        this.channelForm.resolutionCY = 1536;
      }
    },
    //是否选中曝光
    bgchange(val) {
      console.log(val, "是否选中");
      if (val) {
        this.bgflag = true;
      } else {
        this.bgflag = false;
      }
    },
    //点击图片示例
    imgSizeClick(item) {
      console.log(item);
      this.channelForm.resolutionCX = item.cx;
      this.channelForm.resolutionCY = item.cy;
    },
    //点击视频
    videoClick(item) {
      console.log(item);
      this.channelForm.videoCX = item.videox;
      this.channelForm.videoCY = item.videoy;
    },
    //点击宏，把内容添加到osd
    selectItem1(item) {
      console.log(item.value);
      this.channelForm.ltosd += item.name + ":" + item.value + "  ";
    },
    selectItem2(item) {
      console.log(item.value);
      this.channelForm.rtosd += item.name + ":" + item.value + "  ";
    },
    selectItem3(item) {
      console.log(item.value);
      this.channelForm.lbosd += item.name + ":" + item.value + "  ";
    },
    selectItem4(item) {
      console.log(item.value);
      this.channelForm.rbosd += item.name + ":" + item.value + "  ";
    },
    display() {
      this.isShow = true;
      this.getChannelSelect();
      console.log(this.areaData);
    },

    //点击确定
    handleConfim() {
      console.log(this.channelForm);
      console.log(this.changedChannelFields); // 查看哪些字段被更改了
      const result = [];
      for (const [key, value] of Object.entries(this.changedChannelFields)) {
        let type, valueToStore;

        if (typeof value === "string") {
          // 尝试将字符串转换为整数（如果可能），但这里我们保持为字符串
          // 注意：这里不转换，以保持原始指示
          type = 1; // 字符串
          valueToStore = value;
        } else if (typeof value === "number") {
          if (Number.isInteger(value)) {
            type = 0; // 整数
          } else {
            type = 2; // 浮点数
          }
          valueToStore = value;
        } else if (typeof value === "boolean") {
          type = 0; // 布尔值转换为整数
          valueToStore = value ? 1 : 0;
        }

        result.push({ name: key, value: valueToStore, type: type });
      }
      //let index = 1;
      //   for (const [key, value] of Object.entries(this.changedChannelFields)) {
      //     result.push({ name: `name${index}`, value: key });
      //     let type;
      //     if (typeof value === "string") {
      //       type = 1; // 字符串
      //     } else if (typeof value === "number") {
      //       if (Number.isInteger(value)) {
      //         type = 0; // 整数
      //       } else {
      //         type = 2; // 浮点数
      //       }
      //     } else if (typeof value === "boolean") {
      //       // 布尔值特殊处理为整数0或1
      //       result.push({ name: `value${index}`, value: value ? 1 : 0 });
      //       result.push({ name: `type${index}`, value: 0 }); // 布尔值视为整数处理，但type为0可能不够准确，这里保留原样
      //       index++; // 由于已经添加了value和type，所以索引递增
      //       continue; // 跳过当前循环的剩余部分
      //     }
      //     // 对于非布尔值，添加value和type
      //     result.push({ name: `value${index}`, value: value });
      //     result.push({ name: `type${index}`, value: type });
      //     index++;
      //   }
      console.log(this.moreForm);
      //   this.configNum = 26 + this.moreForm.length;
      //   console.log(this.configNum);
      //   let result = [];
      this.moreForm.forEach((param, index) => {
        // 检查param.parmasName和param.parmasValue是否都不为空
        if (param.parmasName && param.parmasValue) {
          //let baseIndex = result.length + index + 1; // 计算每个参数的起始索引
          // 添加 name
          result.push({
            name: param.parmasName,
            value: param.parmasValue,
            type: param.parmasType,
          });
          //   // 添加 value
          //   result.push({ name: `value${baseIndex}`, value: param.parmasValue });
          //   // 添加 type（注意：这里假设param.parmasType已经存在且有效）
          //   result.push({ name: `type${baseIndex}`, value: param.parmasType });
        }
        // 如果param.parmasName或param.parmasValue为空，则不执行上述添加操作
      });
      console.log(result);

      ///sdcard/com.xypower.mpapp/data/channels/1.json
      var params = {
        action: "upd_cfg",
        termIds: [this.terimMsgid.id],
        path: "/sdcard/com.xypower.mpapp/data/channels/",
        fn: this.selectChannel + ".json",
        packageName: "com.xypower.mpapp",
        configs: result,
      };
      console.log(params);
      console.log(this.$parent.$parent.$parent);
      this.$parent.$parent.handleclose();
      this.$parent.$parent.$parent.changeIssue(params);
      this.channelForm = {
        templateVal: 2, //模板选中
        usbchecked: false, //usb摄像头
        resolutionCX: "", //图片尺寸X
        resolutionCY: "", //图片尺寸Y
        videoCX: "", //视频尺寸X
        videoCY: "", //视频尺寸Y
        videoDuration: 15, //视频时长
        ysl: 80, //图片压缩率
        isImageZoomEnabled: 0, //图片放大默认关
        zoomVal: 1, //放大倍数默认1
        modelVal: 0, //场景选择
        aechecked: false,
        awbchecked: false,
        afchecked: false,
        gmkzchecked: false, //光敏控制
        zdbgchecked: false, //自动曝光
        bgsj: "", //曝光时间
        expsTimeUs: "", //曝光时间
        iso: "", //iso
        compensationVal: 0, //曝光补偿
        zzdjchecked: false, //自动对焦
        awbMode: 1, //白平衡模式
        roteval: "", //旋转角度
        aival: "", //ai识别
        ltosd: "", //水印
        rtosd: "", //水印
        lbosd: "", //水印
        rbosd: "", //水印
      };
    },

    //新增一行
    addModule() {
      //新增一行
      this.moreForm.push({
        parmasName: "",
        parmasValue: "",
        parmasType: 0,
      });
    },
    //删除一行
    deleteModule(item, index) {
      console.log(item, index);
      const itemList = this.moreForm.indexOf(item);
      if (itemList !== -1) {
        this.moreForm.splice(index, 1);
      }
    },
  },
};
</script>
<style lang="less">
.channelsetBox {
  max-height: 442px;
  overflow: auto;
  padding-right: 12px;

  .el-divider--horizontal {
    margin: 6px 0px;
    background-color: #edeaea;
  }
  h4 {
    font-weight: normal;
    margin-right: 12px;
  }
  .channelList {
    display: flex;
    align-items: center;
    height: 22px;
    line-height: 22px;

    .el-radio-group {
      height: 22px;
      line-height: 32px;
    }
  }
  .modelList {
    margin-top: 8px;
    display: flex;
    align-items: center;
    .modeLeft {
      display: flex;
      align-items: center;
      margin-right: 40px;
    }
  }
  .photoList {
    margin-top: 8px;
    display: flex;
    align-items: center;

    .picradio {
      display: flex;
      align-items: center;
      margin-right: 16px;
      b {
        font-weight: normal;
        padding: 0px 4px;
      }
      .el-input {
        width: 70px;
      }
      .el-tag {
        margin-left: 2px;
        cursor: pointer;
      }
    }
    .picysl {
      display: flex;
      align-items: center;
      margin-right: 16px;
      .el-input {
        width: 60px;
      }
    }
    .piczoom {
      display: flex;
      align-items: center;
      margin-right: 16px;
      .el-radio-group {
        .el-radio {
          margin-right: 16px;
        }
      }
    }
    .zoomclass {
      display: flex;
      align-items: center;
      .el-slider {
        width: 90px;
        margin-right: 12px;
        margin-left: 10px;
        .el-slider__runway {
          height: 8px;
          margin: 12px 0;
        }
        .el-slider__button-wrapper {
          height: 24px;
          width: 24px;
          position: absolute;
          z-index: 1001;
          top: -9px;
        }
        .el-input {
          width: 100px;
        }
      }
    }
  }
  .threeASet {
    .top {
      display: flex;
      align-items: center;
      .screen {
        display: flex;
        align-items: center;
        margin-right: 40px;
      }
      .wait3Lock {
        display: flex;
        align-items: center;
      }
    }
    .mid {
      margin-top: 8px;
      display: flex;
      align-items: center;
      .bgms {
        display: flex;
        align-items: center;
        margin-right: 20px;
      }
      .bgsj {
        display: flex;
        align-items: center;
        margin-right: 20px;
        .infoSpan {
          margin: 0px 4px;
        }
        .el-input {
          width: 60px;
          .el-input__inner {
            padding: 0 4px;
          }
        }
      }
      .iso {
        display: flex;
        align-items: center;
        margin-right: 20px;
        .el-input {
          width: 50px;
          .el-input__inner {
            padding: 0 4px;
          }
        }
      }
      .bgbc {
        display: flex;
        align-items: center;
        .el-input {
          width: 80px;
        }
      }
    }
    .btm {
      display: flex;
      align-items: center;
      margin-top: 8px;
      .el-checkbox {
        margin-right: 20px;
      }
    }
  }
  .roteAiBox {
    display: flex;
    align-items: center;
    margin-top: 8px;
    .el-select {
      margin-right: 20px;
    }
  }
  .textAreabox {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    margin-top: 8px;
    .el-textarea {
      width: 288px;
    }
    .el-tag {
      margin-left: 8px;
      cursor: pointer;
    }
    .lt {
      display: flex;
    }
    .rt {
      display: flex;
    }
    .lb {
      display: flex;
      margin-top: 8px;
    }
    .rb {
      display: flex;
      margin-top: 8px;
    }
  }
  .moreParams {
    margin-top: 8px;
    padding-bottom: 8px;
    .parambox {
      display: flex;
      align-items: center;
      margin-top: 8px;
      .el-input {
        width: 120px;
        margin-right: 20px;
      }
      .btngropAdd {
        //margin-bottom: 8px;
        margin-left: 8px;
        .el-button {
          padding: 6px 8px;
          width: 30px;
          margin-bottom: 0px;
        }
        .el-button + .el-button {
          margin-left: 10px !important;
        }
      }
    }
  }
}
.my-custom-class {
  border: none;
  .el-collapse-item__header {
    height: 32px;
    line-height: 32px;
  }
  .el-collapse-item__content {
    padding-bottom: 12px;
    p {
      line-height: 22px;
      height: 22px;
      cursor: pointer;
      padding: 0px 8px;
      &:hover {
        background: #ededed;
      }
    }
  }
}
.my-popover {
  min-width: 80px;
  p {
    line-height: 22px;
    height: 22px;
    cursor: pointer;
    padding: 0px 8px;
    &:hover {
      background: #ededed;
    }
  }
}
.jsonclass {
  pre {
    white-space: break-spaces;
    max-height: 320px;
    overflow: auto;
    padding-right: 12px;
  }
}
</style>
