<template>
    <div>
        <el-row>
            <el-tabs style="margin-top: -15px;height: 600px;margin-bottom: -20px;" type="border-card">
                <el-tab-pane label="基础配置">
                    <el-form ref="addFormRef" :model="formAddData">
                        <el-row style="height: 45px;margin-top: 0px;">
                            <el-col :span="7">
                                <el-form-item label="遥测站编码:" label-width="150px">
                                    <el-input v-model="formAddData.stationCode" placeholder="10位编码" :disabled="!stationCode"
                                        size="small" />
                                </el-form-item>
                            </el-col>
                            <el-col :span="1">
                                <el-form-item>
                                    <el-switch class="switch_style" v-model="stationCode" />
                                </el-form-item>
                            </el-col>

                            <el-col :span="7">
                                <el-form-item label="通道1地址:" label-width="150px">
                                    <el-input v-model="formAddData.ip1Port1" placeholder="IP址址:端口" :disabled="!ip1Port1"
                                        maxlength="21" size="small" />
                                </el-form-item>
                            </el-col>
                            <el-col :span="1">
                                <el-form-item>
                                    <el-switch class="switch_style" v-model="ip1Port1" />
                                </el-form-item>
                            </el-col>

                            <el-col :span="7">
                                <el-form-item label="域名地址:" label-width="150px">
                                    <el-input v-model="formAddData.domainNamePort" placeholder="例:www.web.com:6090"
                                        :disabled="!domainNamePort" maxlength="50" size="small" />
                                </el-form-item>
                            </el-col>
                            <el-col :span="1" :offset="0">
                                <el-form-item>
                                    <el-switch class="switch_style" v-model="domainNamePort" />
                                </el-form-item>
                            </el-col>
                        </el-row>

                        <el-divider style="margin-top: 0;" />

                        <el-row style="height: 45px;margin-top: -17px;">
                            <el-col :span="7">
                                <el-form-item label="采样间隔:" label-width="150px">
                                    <el-input v-model.number="formAddData.sampleInterval" placeholder="采样时间间隔(分钟)"
                                        maxlength="4" :disabled="!sampleInterval" size="small"
                                        onkeyup="value=value.replace(/[^\-\d.]/g, '').replace(/\b(0+){2,}/g, '0').replace(/\-{2,}/g, '-').replace(/^\./g, '').replace(/\.{2,}/g, '.').replace('.', '$#$').replace(/\./g, '').replace('$#$', '.')" />
                                </el-form-item>
                            </el-col>
                            <el-col :span="1" :offset="0">
                                <el-form-item>
                                    <el-switch class="switch_style" v-model="sampleInterval" />
                                </el-form-item>
                            </el-col>

                            <el-col :span="7">
                                <el-form-item label="上报间隔:" label-width="150px">
                                    <el-input v-model.number="formAddData.sampleInterval" placeholder="定时报时间间隔(分钟)"
                                        :disabled="!sampleInterval" maxlength="4" size="small"
                                        onkeyup="value=value.replace(/[^\-\d.]/g, '').replace(/\b(0+){2,}/g, '0').replace(/\-{2,}/g, '-').replace(/^\./g, '').replace(/\.{2,}/g, '.').replace('.', '$#$').replace(/\./g, '').replace('$#$', '.')" />
                                </el-form-item>
                            </el-col>
                            <el-col :span="1">
                                <el-form-item>
                                    <el-switch class="switch_style" v-model="sampleInterval" />
                                </el-form-item>
                            </el-col>

                            <el-col :span="7">
                                <el-form-item label="低温采样间隔:" label-width="150px">
                                    <el-input v-model.number="formAddData.ltSampleInterval" placeholder="低温采样时间间隔(小时)"
                                        type="number" maxlength="3" :disabled="!ltSampleInterval" size="small"
                                        onkeyup="value=value.replace(/[^\-\d.]/g, '').replace(/\b(0+){2,}/g, '0').replace(/\-{2,}/g, '-').replace(/^\./g, '').replace(/\.{2,}/g, '.').replace('.', '$#$').replace(/\./g, '').replace('$#$', '.')" />
                                </el-form-item>
                            </el-col>
                            <el-col :span="1">
                                <el-form-item>
                                    <el-switch class="switch_style" v-model="ltSampleInterval" />
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-divider style="margin-top: 0;" />

                        <!-- 水表专用配置 -->
                        <el-row v-if="state.deviceType !== '2'" style="height: 45px;margin-top: -17px;">
                            <el-col :span="7">
                                <el-form-item label="数字个数:" label-width="150px">
                                    <el-input v-model.number="formAddData.digitNum" placeholder="数字个数" type="number"
                                        maxlength="2" :disabled="!digitNum" size="small" />
                                </el-form-item>
                            </el-col>
                            <el-col :span="1" :offset="0">
                                <el-form-item>
                                    <el-switch class="switch_style" v-model="digitNum" />
                                </el-form-item>
                            </el-col>

                            <el-col :span="7">
                                <el-form-item label="字轮个数:" label-width="150px">
                                    <el-input v-model.number="formAddData.wheelNum" placeholder="字轮个数" type="number"
                                        maxlength="2" :disabled="!digitNum" size="small" />
                                </el-form-item>
                            </el-col>
                            <el-col :span="1">
                                <el-form-item>
                                    <el-switch class="switch_style" v-model="digitNum" />
                                </el-form-item>
                            </el-col>

                            <el-col :span="7">
                                <el-form-item label="尾数单位:" label-width="150px">
                                    <el-select v-model="formAddData.uintType" class="filter-item" placeholder="尾数单位(m³)"
                                        :disabled="!uintType" size="small">
                                        <el-option v-for="item in Dic.unitTypeMap" :key="item.value" :label="item.label"
                                            :value="item.value" />
                                    </el-select>
                                </el-form-item>
                            </el-col>
                            <el-col :span="1">
                                <el-form-item>
                                    <el-switch class="switch_style" v-model="uintType" />
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <!-- 水表专用配置 -->

                        <el-divider style="margin-top: 0;" v-if="state.deviceType !== '2'" />
                        <el-row style="height: 45px;margin-top: -17px;">
                            <el-col :span="7" v-if="state.deviceType == '1'">
                                <el-form-item label="设备口径:" label-width="150px">
                                    <el-select v-model="formAddData.dnType" class="filter-item" placeholder="水表口径"
                                        :disabled="!dnType" size="small">
                                        <el-option v-for="item in Dic.dnTypeMap" :key="item.value" :label="item.label"
                                            :value="item.value" />
                                    </el-select>
                                </el-form-item>
                            </el-col>
                            <el-col :span="1" :offset="0" v-if="state.deviceType == '1'">
                                <el-form-item>
                                    <el-switch class="switch_style" v-model="dnType" />
                                </el-form-item>
                            </el-col>

                            <el-col :span="7">
                                <el-form-item label="安装方向:" label-width="150px">
                                    <el-radio-group v-model="formAddData.setupDir" :disabled="!setupDir" size="small">
                                        <el-radio label="0" style="height: 25px;">正向</el-radio>
                                        <el-radio label="1">反向</el-radio>
                                        <el-radio label="2">左90</el-radio>
                                        <el-radio label="3">右90</el-radio>
                                    </el-radio-group>
                                </el-form-item>
                            </el-col>
                            <el-col :span="1">
                                <el-form-item>
                                    <el-switch class="switch_style" v-model="setupDir" />
                                </el-form-item>
                            </el-col>

                            <el-col :span="7" v-if="state.deviceType !== '2'">
                                <el-form-item label="当前读数:" label-width="150px">
                                    <el-input v-model.number="formAddData.lastVal" placeholder="水表当前读数" type="number"
                                        maxlength="10" :disabled="!lastVal" size="small" />
                                </el-form-item>
                            </el-col>
                            <el-col :span="1" v-if="state.deviceType !== '2'">
                                <el-form-item>
                                    <el-switch class="switch_style" v-model="lastVal" />
                                </el-form-item>
                            </el-col>
                        </el-row>

                        <el-row style="height: 45px;">
                            <el-col :span="7">
                                <el-form-item label="天线类型:" label-width="150px">
                                    <el-select v-model="formAddData.tianxianType" class="filter-item" placeholder="内置/外置"
                                        :disabled="!tianxianType" size="small">
                                        <el-option v-for="(key, value) in Dic.tianxianType" :key="key" :label="key"
                                            :value="value" />
                                    </el-select>
                                </el-form-item>
                            </el-col>
                            <el-col :span="1">
                                <el-form-item>
                                    <el-switch class="switch_style" v-model="tianxianType" />
                                </el-form-item>
                            </el-col>

                            <el-col :span="7">
                                <el-form-item label="数传类型:" label-width="150px">
                                    <el-radio-group v-model="formAddData.tongxunWay" :disabled="!tongxunWay" size="small">
                                        <el-radio label='2'>NB</el-radio>
                                        <el-radio label="1">CAT1</el-radio>
                                    </el-radio-group>
                                </el-form-item>
                            </el-col>
                            <el-col :span="1">
                                <el-form-item>
                                    <el-switch class="switch_style" v-model="tongxunWay" />
                                </el-form-item>
                            </el-col>
                        </el-row>
                    </el-form>
                </el-tab-pane>

                <el-tab-pane label="运维配置">
                    <el-form>
                        <el-row style="height: 45px;margin-top: 0px;">
                            <el-col :span="5">
                                <el-form-item label="工作温度范围:" label-width="150px">
                                    <el-input v-model.number="formAddData.workLt" placeholder="最低温度" :disabled="!workLt"
                                        maxlength="4" size="small" />
                                </el-form-item>
                            </el-col>

                            <el-col :span="2">
                                <el-form-item label-width="0px">
                                    <el-input v-model.number="formAddData.workHt" placeholder="最高温度" :disabled="!workLt"
                                        maxlength="4" size="small" />
                                </el-form-item>
                            </el-col>

                            <el-col :span="1">
                                <el-form-item>
                                    <el-switch class="switch_style" v-model="workLt" />
                                </el-form-item>
                            </el-col>

                            <el-col :span="7">
                                <el-form-item label="低电压报警值:" label-width="150px">
                                    <el-input v-model="formAddData.batAlarmVt" placeholder="工作电压下限报警值" maxlength="4"
                                        type="number" :disabled="!batAlarmVt" size="small" />
                                </el-form-item>
                            </el-col>
                            <el-col :span="1">
                                <el-form-item>
                                    <el-switch class="switch_style" v-model="batAlarmVt" />
                                </el-form-item>
                            </el-col>

                            <el-col :span="7">
                                <el-form-item label="余电报警值:" label-width="150px">
                                    <el-input v-model.number="formAddData.batAlarmSoc" placeholder="剩余电量报警值(百分比)"
                                        :disabled="!batAlarmSoc" maxlength="2" size="small" />
                                </el-form-item>
                            </el-col>
                            <el-col :span="1" :offset="0">
                                <el-form-item>
                                    <el-switch class="switch_style" v-model="batAlarmSoc" />
                                </el-form-item>
                            </el-col>
                        </el-row>

                        <el-divider style="margin-top: 0;" />
                        <el-row style="height: 45px;margin-top: -17px;">
                            <el-col :span="7">
                                <el-form-item label="背光频率:" label-width="150px">
                                    <el-input v-model.number="formAddData.pwmHz" placeholder="摄像头背光屏闪频率(HZ)"
                                        :disabled="!pwmHz" maxlength="4" size="small" />
                                </el-form-item>
                            </el-col>

                            <el-col :span="1">
                                <el-form-item>
                                    <el-switch class="switch_style" v-model="pwmHz" />
                                </el-form-item>
                            </el-col>

                            <el-col :span="7">
                                <el-form-item label="背光占空比:" label-width="150px">
                                    <el-input v-model.number="formAddData.pwmDuty" placeholder="背光占空比(%)" type="number"
                                        maxlength="3" :disabled="!pwmDuty" size="small" />
                                </el-form-item>
                            </el-col>
                            <el-col :span="1">
                                <el-form-item>
                                    <el-switch class="switch_style" v-model="pwmDuty" />
                                </el-form-item>
                            </el-col>

                            <el-col :span="5">
                                <el-form-item label="补光灯亮度:" label-width="150px">
                                    <el-input v-model.number="formAddData.flashBrightMin" placeholder="最小亮度"
                                        :disabled="!flashBrightMin" maxlength="3" size="small" />
                                </el-form-item>
                            </el-col>

                            <el-col :span="2">
                                <el-form-item label-width="0px">
                                    <el-input v-model.number="formAddData.flashBrightMax" placeholder="最大亮度"
                                        :disabled="!flashBrightMin" maxlength="3" size="small" />
                                </el-form-item>
                            </el-col>
                            <el-col :span="1" :offset="0">
                                <el-form-item>
                                    <el-switch class="switch_style" v-model="flashBrightMin" />
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-divider style="margin-top: 0;" />
                        <el-row style="height: 45px;margin-top: -17px;">
                            <el-col :span="7">
                                <el-form-item label="入网超时时间:" label-width="150px">
                                    <el-input v-model.number="formAddData.networkRegTimeout" placeholder="注册入网超时时间(秒)"
                                        type="number" maxlength="2" :disabled="!networkRegTimeout" size="small" />
                                </el-form-item>
                            </el-col>
                            <el-col :span="1" :offset="0">
                                <el-form-item>
                                    <el-switch class="switch_style" v-model="networkRegTimeout" />
                                </el-form-item>
                            </el-col>

                            <el-col :span="7">
                                <el-form-item label="CPU版本号:" label-width="150px">
                                    <el-input v-model="formAddData.cpuVersion" placeholder="4位CPU版本号"
                                        :disabled="!cpuVersion" maxlength="4" size="small" />
                                </el-form-item>
                            </el-col>

                            <el-col :span="1">
                                <el-form-item>
                                    <el-switch class="switch_style" v-model="cpuVersion" />
                                </el-form-item>
                            </el-col>

                            <el-col :span="7">
                                <el-form-item label="通信板版本号:" label-width="150px">
                                    <el-input v-model="formAddData.tongxunVersion" placeholder="4位通信板版本号" type="number"
                                        maxlength="4" :disabled="!tongxunVersion" size="small" />
                                </el-form-item>
                            </el-col>
                            <el-col :span="1">
                                <el-form-item>
                                    <el-switch class="switch_style" v-model="tongxunVersion" />
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-divider style="margin-top: 0;" />
                        <el-row v-if="state.deviceType !== '2'" style="height: 45px;margin-top: -17px;">
                            <el-col :span="15">
                                <el-form-item label="整图上报周规则:" label-width="150px">
                                    <el-checkbox label="一" size="small" v-model="week1" :disabled="!upWholeImgWeekRule"
                                        @change="WeekRuleChange" />
                                    <el-checkbox label="二" size="small" v-model="week2" :disabled="!upWholeImgWeekRule"
                                        @change="WeekRuleChange" />
                                    <el-checkbox label="三" size="small" v-model="week3" :disabled="!upWholeImgWeekRule"
                                        @change="WeekRuleChange" />
                                    <el-checkbox label="四" size="small" v-model="week4" :disabled="!upWholeImgWeekRule"
                                        @change="WeekRuleChange" />
                                    <el-checkbox label="五" size="small" v-model="week5" :disabled="!upWholeImgWeekRule"
                                        @change="WeekRuleChange" />
                                    <el-checkbox label="六" size="small" v-model="week6" :disabled="!upWholeImgWeekRule"
                                        @change="WeekRuleChange" />
                                    <el-checkbox label="日" size="small" v-model="week7" :disabled="!upWholeImgWeekRule"
                                        @change="WeekRuleChange" />
                                    <el-tag style="float: right;margin-top: 5px;" @click="weekRuleInvert"
                                        v-if="upWholeImgWeekRule">反选
                                    </el-tag>
                                </el-form-item>
                            </el-col>

                            <el-col :span="1">
                                <el-form-item>
                                    <el-switch class="switch_style" v-model="upWholeImgWeekRule" @change="WeekRuleChange" />
                                </el-form-item>
                            </el-col>
                            <el-col :span="7">
                                <el-form-item label="手动触发传大图:" label-width="150px">
                                    <el-radio-group v-model="formAddData.wiTaskManwakeupFlag"
                                        :disabled="!wiTaskManwakeupFlag" size="small">
                                        <el-radio label=1>是</el-radio>
                                        <el-radio label=0>否</el-radio>
                                    </el-radio-group>
                                </el-form-item>
                            </el-col>

                            <el-col :span="1">
                                <el-form-item>
                                    <el-switch class="switch_style" v-model="wiTaskManwakeupFlag" />
                                </el-form-item>
                            </el-col>
                        </el-row>

                        <el-row v-if="state.deviceType !== '2'" style="height: 45px;">
                            <el-col :span="6">
                                <el-form-item label="月初月末传大图:" label-width="150px">
                                    <el-radio-group v-model="formAddData.wiTaskMonthFlag" :disabled="!wiTaskMonthFlag">
                                        <el-radio label=1>是</el-radio>
                                        <el-radio label=0>否</el-radio>
                                    </el-radio-group>
                                </el-form-item>
                            </el-col>
                            <el-col :span="1">
                                <el-form-item>
                                    <el-switch class="switch_style" v-model="wiTaskMonthFlag" />
                                </el-form-item>
                            </el-col>
                            <el-col :span="5">
                                <el-form-item label="指定日期发大图:" label-width="140px">
                                    <el-radio-group v-model="formAddData.wiTaskSpecdateEnable"
                                        :disabled="!wiTaskSpecdateFlag">
                                        <el-radio label='1'>是</el-radio>
                                        <el-radio label='0'>否</el-radio>
                                    </el-radio-group>
                                </el-form-item>
                            </el-col>

                            <el-col :span="1">
                                <el-form-item>
                                    <el-switch class="switch_style" v-model="wiTaskSpecdateFlag"
                                        @change="wiTaskSpecdateFlagSwitchChange" />
                                </el-form-item>
                            </el-col>

                            <el-col :span="5">
                                <el-form-item label="开始日期:" label-width="100px">
                                    <el-date-picker v-model="formAddData.wiTaskSpecdateDate" type="date" placeholder="开始日期"
                                        :shortcuts="shortcuts" value-format="YYYYMMDD" size="small"
                                        style="max-width: 130px;" :disabled="!wiTaskSpecdateFlag" />
                                </el-form-item>
                            </el-col>

                            <el-col :span="4">
                                <el-form-item label="天数/次数:" label-width="100px">
                                    <el-input v-model="formAddData.wiTaskSpecdateDays" style="width:110px"
                                        placeholder="持续天数" :disabled="!wiTaskSpecdateFlag" maxlength="2" size="small"
                                        onkeyup="value=value.replace(/[^\d]/g, '')" />
                                </el-form-item>
                            </el-col>

                            <el-col :span="2">
                                <el-form-item label-width="0px">
                                    <el-input v-model="formAddData.wiTaskSpecdateTimes" placeholder="每天次数"
                                        :disabled="!wiTaskSpecdateFlag" maxlength="2" style="width:100px" size="small"
                                        onkeyup="value=value.replace(/[^\d]/g, '')" />
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-divider style="margin-top: 0;" v-if="state.deviceType !== '2'" />
                        <el-row style="height: 45px;margin-top: -17px;">
                            <el-col :span="6">
                                <el-form-item label="日志上传规则:" label-width="150px">
                                    <el-radio-group v-model="formAddData.logUploadEnable" :disabled="!logUploadRules">
                                        <el-radio label='1'>是</el-radio>
                                        <el-radio label='0'>否</el-radio>
                                    </el-radio-group>
                                </el-form-item>
                            </el-col>

                            <el-col :span="1">
                                <el-form-item>
                                    <el-switch class="switch_style" v-model="logUploadRules"
                                        @change="logUploadRulesSwitchChange" />
                                </el-form-item>
                            </el-col>

                            <el-col :span="4">
                                <el-form-item label="开始日期:" label-width="100px">
                                    <el-date-picker v-model="formAddData.logUploadDate" type="date" placeholder="开始日期"
                                        :shortcuts="shortcuts" value-format="YYYYMMDD" size="small"
                                        style="max-width: 130px;" :disabled="!logUploadRules" />
                                </el-form-item>
                            </el-col>

                            <el-col :span="4">
                                <el-form-item label="天数/次数:" label-width="120px">
                                    <el-input v-model="formAddData.logUploadDays" placeholder="持续天数"
                                        :disabled="!logUploadRules" maxlength="2" size="small"
                                        onkeyup="value=value.replace(/[^\d]/g, '')" />
                                </el-form-item>
                            </el-col>

                            <el-col :span="2">
                                <el-form-item label-width="0px">
                                    <el-input v-model="formAddData.logUploadTimes" placeholder="每天次数"
                                        :disabled="!logUploadRules" maxlength="2" size="small"
                                        onkeyup="value=value.replace(/[^\d]/g, '')" />
                                </el-form-item>
                            </el-col>

                            <el-col :span="5">
                                <el-form-item label="日志等级(MCU/AI):" label-width="150px">
                                    <el-select v-model="formAddData.logUploadMcuLevel" class="filter-item"
                                        placeholder="MCU等级" :disabled="!logUploadRules" size="small">
                                        <el-option v-for="item in Dic.logUploadLevel" :key="item.value" :label="item.label"
                                            :value="item.value" />
                                    </el-select>
                                    <!-- <el-input v-model.number="formAddData.logUploadMcuLevel" placeholder="MCU等级" :disabled="!logUploadRules" maxlength="4" /> -->
                                </el-form-item>
                            </el-col>

                            <el-col :span="2">
                                <el-form-item label-width="0px">
                                    <el-select v-model="formAddData.logUploadAiLevel" class="filter-item" placeholder="AI等级"
                                        :disabled="!logUploadRules" size="small">
                                        <el-option v-for="item in Dic.logUploadLevel" :key="item.value" :label="item.label"
                                            :value="item.value" />
                                    </el-select>
                                    <!-- <el-input v-model.number="formAddData.logUploadAiLevel" placeholder="AI等级" :disabled="!logUploadRules" maxlength="2" /> -->
                                </el-form-item>
                            </el-col>
                        </el-row>

                        <el-row style="height: 45px;">
                            <el-col :span="6">
                                <el-form-item label="输出串口日志:" label-width="150px">
                                    <el-radio-group v-model="formAddData.isprintcomlog" :disabled="!isprintcomlog">
                                        <el-radio label='1'>是</el-radio>
                                        <el-radio label='0'>否</el-radio>
                                    </el-radio-group>
                                </el-form-item>
                            </el-col>
                            <el-col :span="1">
                                <el-form-item>
                                    <el-switch class="switch_style" v-model="isprintcomlog" @change="comlogSwitchChange" />
                                </el-form-item>
                            </el-col>
                            <el-col :span="7">
                                <el-form-item label="上传错误的日志:" label-width="140px">
                                    <el-radio-group v-model="formAddData.uploadLastFailLogFlag"
                                        :disabled="!uploadLastFailLogFlag">
                                        <el-radio label='1'>是</el-radio>
                                        <el-radio label='0'>否</el-radio>
                                    </el-radio-group>
                                </el-form-item>
                            </el-col>
                            <el-col :span="1">
                                <el-form-item>
                                    <el-switch class="switch_style" v-model="uploadLastFailLogFlag"
                                        @change="uploadLastFailLogFlagSwitchChange" />
                                </el-form-item>
                            </el-col>

                            <el-col :span="8">
                                <el-form-item label="手动触发传日志:" label-width="150px">
                                    <el-radio-group v-model="formAddData.logTaskManwakeupFlag"
                                        :disabled="!logTaskManwakeupFlag">
                                        <el-radio label='1'>是</el-radio>
                                        <el-radio label='0'>否</el-radio>
                                    </el-radio-group>
                                </el-form-item>
                            </el-col>
                            <el-col :span="1">
                                <el-form-item>
                                    <el-switch class="switch_style" v-model="logTaskManwakeupFlag" />
                                </el-form-item>
                            </el-col>
                        </el-row>

                        <el-divider style="margin-top: 0;margin-bottom: 5px;" />
                        <el-row style="height: 45px;margin-top: -5px;">
                            <el-col :span="6">
                                <el-form-item label="电池时长清零:" label-width="140px">
                                    <el-switch class="switch_style" v-model="formAddData.isresetbat" active-value="1"
                                        inactive-value="0" />
                                </el-form-item>
                            </el-col>

                            <el-col :span="5">
                                <el-form-item label="MCU运行次数清零:" label-width="150px">
                                    <el-switch class="switch_style" v-model="formAddData.isrestmcu" active-value="1"
                                        inactive-value="0" />
                                </el-form-item>
                            </el-col>

                            <el-col :span="5">
                                <el-form-item label="WDT读数清零:" label-width="150px">
                                    <el-switch class="switch_style" v-model="formAddData.isresetwdt" active-value="1"
                                        inactive-value="0" />
                                </el-form-item>
                            </el-col>
                        </el-row>
                    </el-form>
                </el-tab-pane>

                <el-tab-pane label="AI配置" v-if="state.deviceType !== '2'">
                    <el-form>
                        <el-row style="height: 45px;margin-top: 0px;">
                            <el-col :span="7">
                                <el-form-item label="强制拉回概率:" label-width="150px">
                                    <el-input v-model.number="formAddData.aiPullBack" placeholder="强制拉回概率值(%)"
                                        :disabled="!aiPullBack" maxlength="3" size="small" />
                                </el-form-item>
                            </el-col>

                            <el-col :span="1">
                                <el-form-item>
                                    <el-switch class="switch_style" v-model="aiPullBack" />
                                </el-form-item>
                            </el-col>

                            <el-col :span="7">
                                <el-form-item label="识别概率阈值:" label-width="150px">
                                    <el-input v-model.number="formAddData.aiPass" placeholder="识别可信度的概率阈值" type="number"
                                        maxlength="3" :disabled="!aiPass" size="small" />
                                </el-form-item>
                            </el-col>
                            <el-col :span="1">
                                <el-form-item>
                                    <el-switch class="switch_style" v-model="aiPass" />
                                </el-form-item>
                            </el-col>

                            <el-col :span="7">
                                <el-form-item label="位概率阈值:" label-width="150px">
                                    <el-input v-model.number="formAddData.aiSinglePass" placeholder="位概率阈值"
                                        :disabled="!aiSinglePass" maxlength="3" size="small" />
                                </el-form-item>
                            </el-col>
                            <el-col :span="1" :offset="0">
                                <el-form-item>
                                    <el-switch class="switch_style" v-model="aiSinglePass" />
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-divider style="margin-top: 0;margin-bottom: 5px;" />
                        <el-row style="height: 45px;margin-top: 0px;">
                            <el-col :span="7">
                                <el-form-item label="上传图片类型:" label-width="150px">
                                    <el-input v-model.number="formAddData.imageType" placeholder="1:BMP;其它值:JPG的质量"
                                        :disabled="!imageType" maxlength="5" size="small"
                                        oninput="value=value.replace(/[^\d]/g, '');if(value>20000) value=20000;if(value<0) value=1" />
                                </el-form-item>
                            </el-col>

                            <el-col :span="1">
                                <el-form-item>
                                    <el-switch class="switch_style" v-model="imageType" />
                                </el-form-item>
                            </el-col>

                            <el-col :span="7">
                                <el-form-item label="图片外扩像素:" label-width="150px">
                                    <el-input v-model.number="formAddData.imageMargin" placeholder="外扩像素(0-30)"
                                        type="number" maxlength="2" min="0" max="30" :disabled="!imageMargin" size="small"
                                        oninput="value=value.replace(/[^\d]/g, '');if(value>30) value=30;if(value<0) value=0" />
                                </el-form-item>
                            </el-col>
                            <el-col :span="1">
                                <el-form-item>
                                    <el-switch class="switch_style" v-model="imageMargin" />
                                </el-form-item>
                            </el-col>

                            <el-col :span="7">
                                <el-form-item label="上传模型输出结果:" label-width="150px">
                                    <el-radio-group v-model="formAddData.uploadCnnFlag" :disabled="!uploadCnnFlag"
                                        size="small">
                                        <el-radio label='1'>是</el-radio>
                                        <el-radio label='0'>否</el-radio>
                                    </el-radio-group>
                                </el-form-item>
                            </el-col>
                            <el-col :span="1" :offset="0">
                                <el-form-item>
                                    <el-switch class="switch_style" v-model="uploadCnnFlag" />
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-divider style="margin-top: 0;margin-bottom: 5px;" />
                        <el-row style="height: 45px;margin-top: 0px;">
                            <el-col :span="7">
                                <el-form-item label="指定数字区域:" label-width="150px">
                                    <el-radio-group v-model="formAddData.imageConfigFlag" :disabled="!imageConfig">
                                        <el-radio label='1'>是</el-radio>
                                        <el-radio label='0'>否</el-radio>
                                    </el-radio-group>
                                </el-form-item>
                            </el-col>

                            <el-col :span="1">
                                <el-form-item>
                                    <el-switch class="switch_style" v-model="imageConfig" />
                                </el-form-item>
                            </el-col>

                            <el-col :span="5">
                                <el-form-item label="旋转角度:" label-width="120px">
                                    <el-input v-model="formAddData.imageLeanAngle" placeholder="旋转角度"
                                        :disabled="!imageConfig" maxlength="4" size="small"
                                        oninput="value=value.replace(/[^0-9-]+/,'');if(value>360) value=360;if(value<-360) value=-360" />
                                </el-form-item>
                            </el-col>

                            <el-col :span="11">
                                <el-form-item label="区域坐标(xMin,yMin xMax,yMax):" label-width="250px">
                                    <div>
                                        <el-input v-model="formAddData.imageNumRegionXMin" placeholder="xMin"
                                            :disabled="!imageConfig" style="width: 60px;" maxlength="3" size="small"
                                            oninput="value=value.replace(/[^\d]/g, '');if(value>319) value=333" />
                                        <el-input v-model="formAddData.imageNumRegionYMin" placeholder="yMin"
                                            :disabled="!imageConfig" style="width: 60px;" maxlength="3" size="small"
                                            oninput="value=value.replace(/[^\d]/g, '');if(value>239) value=333" />
                                        <span> -- </span>
                                        <el-input v-model="formAddData.imageNumRegionXMax" placeholder="xMax"
                                            :disabled="!imageConfig" style="width: 65px;" maxlength="3" size="small"
                                            oninput="value=value.replace(/[^\d]/g, '');if(value>319) value=333" />
                                        <el-input v-model="formAddData.imageNumRegionYMax" placeholder="yMax"
                                            :disabled="!imageConfig" style="width: 65px;" maxlength="3" size="small"
                                            oninput="value=value.replace(/[^\d]/g, '');if(value>239) value=333" />
                                    </div>
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-divider style="margin-top: 0;margin-bottom: 5px;" />
                        <el-row style="height: 45px;margin-top: 0px;">
                            <el-col :span="7">
                                <el-form-item label="NMS阈值:" label-width="150px">
                                    <el-input v-model="formAddData.nmsThreshold" placeholder="NMS阈值(1-99)"
                                        :disabled="!nmsThreshold" maxlength="2" size="small"
                                        oninput="value=value.replace(/[^\d]/g, '')" />
                                </el-form-item>
                            </el-col>

                            <el-col :span="1">
                                <el-form-item>
                                    <el-switch class="switch_style" v-model="nmsThreshold" />
                                </el-form-item>
                            </el-col>

                            <el-col :span="7">
                                <el-form-item label="大框去野数字:" label-width="150px">
                                    <el-radio-group v-model="formAddData.isUseDetectedNum" :disabled="!isUseDetectedNum">
                                        <el-radio label='1'>是</el-radio>
                                        <el-radio label='0'>否</el-radio>
                                    </el-radio-group>
                                </el-form-item>
                            </el-col>

                            <el-col :span="1">
                                <el-form-item>
                                    <el-switch class="switch_style" v-model="isUseDetectedNum" />
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-divider style="margin-top: 0;margin-bottom: 5px;" />
                        <el-row style="height: 45px;margin-top: 0px;">
                            <el-col :span="7">
                                <el-form-item label="区域上报图片类型:" label-width="150px">
                                    <el-radio-group v-model="formAddData.regionImageType" :disabled="!regionImageType">
                                        <el-radio label='1'>JPG</el-radio>
                                        <el-radio label='2'>BMP</el-radio>
                                    </el-radio-group>
                                </el-form-item>
                            </el-col>

                            <el-col :span="1">
                                <el-form-item>
                                    <el-switch class="switch_style" v-model="regionImageType" />
                                </el-form-item>
                            </el-col>

                            <el-col :span="7">
                                <el-form-item label="JPG的压缩类型:" label-width="150px">
                                    <el-input v-model="formAddData.jpgCompressType" placeholder="0-9"
                                        :disabled="!jpgCompressType" style="width: 100px;" maxlength="1" size="small"
                                        oninput="value=value.replace(/[^\d]/g, '');if(value>9) value=9" />
                                </el-form-item>
                            </el-col>

                            <el-col :span="1">
                                <el-form-item>
                                    <el-switch class="switch_style" v-model="jpgCompressType" />
                                </el-form-item>
                            </el-col>
                        </el-row>
                    </el-form>
                </el-tab-pane>

                <el-tab-pane label="压力表" v-if="state.deviceType === '2'">
                    <el-form>
                        <!-- 压力表专用配置 -->
                        <el-row style="height: 45px;margin-top:0px;">
                            <el-col :span="5">
                                <el-form-item label="量程范围:" label-width="150px">
                                    <el-input v-model="formAddData.pgRangeMin" placeholder="量程下限" :disabled="!pgRange"
                                        maxlength="10"
                                        onkeyup="value=value.replace(/[^\-\d.]/g, '').replace(/\b(0+){2,}/g, '0').replace(/\-{2,}/g, '-').replace(/^\./g, '').replace(/\.{2,}/g, '.').replace('.', '$#$').replace(/\./g, '').replace('$#$', '.')" />
                                </el-form-item>
                            </el-col>

                            <el-col :span="2">
                                <el-form-item label-width="0px">
                                    <el-input v-model="formAddData.pgRangeMax" placeholder="量程上限" :disabled="!pgRange"
                                        maxlength="10"
                                        onkeyup="value=value.replace(/[^\-\d.]/g, '').replace(/\b(0+){2,}/g, '0').replace(/\-{2,}/g, '-').replace(/^\./g, '').replace(/\.{2,}/g, '.').replace('.', '$#$').replace(/\./g, '').replace('$#$', '.')" />
                                </el-form-item>
                            </el-col>

                            <el-col :span="1" :offset="0">
                                <el-form-item>
                                    <el-switch class="switch_style" v-model="pgRange" />
                                </el-form-item>
                            </el-col>

                            <el-col :span="7">
                                <el-form-item label="数据精度:" label-width="150px">
                                    <el-select v-model="formAddData.pgPrecisionType" class="filter-item"
                                        placeholder="数据精度类型" :disabled="!pgPrecisionType">
                                        <el-option v-for="item in Dic.pgPrecisionTypeMap" :key="item.value"
                                            :label="item.label" :value="item.value" />
                                    </el-select>
                                </el-form-item>
                            </el-col>
                            <el-col :span="1">
                                <el-form-item>
                                    <el-switch class="switch_style" v-model="pgPrecisionType" />
                                </el-form-item>
                            </el-col>

                            <el-col :span="7">
                                <el-form-item label="校正参数:" label-width="150px">
                                    <el-input v-model="formAddData.pgCorrectvalue" placeholder="压力表系统校正参数"
                                        :disabled="!pgCorrectvalue" maxlength="10"
                                        onkeyup="value=value.replace(/[^\-\d.]/g, '').replace(/\b(0+){2,}/g, '0').replace(/\-{2,}/g, '-').replace(/^\./g, '').replace(/\.{2,}/g, '.').replace('.', '$#$').replace(/\./g, '').replace('$#$', '.')" />
                                </el-form-item>
                            </el-col>
                            <el-col :span="1">
                                <el-form-item>
                                    <el-switch class="switch_style" v-model="pgCorrectvalue" />
                                </el-form-item>
                            </el-col>
                        </el-row>

                        <el-row v-if="state.deviceType === '2'" style="margin-bottom: -10px;">
                            <el-col :span="7">
                                <el-form-item label="图片是否描点:" label-width="150px">
                                    <el-radio-group v-model="formAddData.pgIsDebug" :disabled="!pgIsDebug">
                                        <el-radio label='1'>是</el-radio>
                                        <el-radio label='0'>否</el-radio>
                                    </el-radio-group>
                                </el-form-item>
                            </el-col>
                            <el-col :span="1">
                                <el-form-item>
                                    <el-switch class="switch_style" v-model="pgIsDebug" @change="isDebugSwitchChange" />
                                </el-form-item>
                            </el-col>

                            <el-col :span="7">
                                <el-form-item label="目标历史初始化:" label-width="150px">
                                    <el-radio-group v-model="formAddData.pgInitTargetRegion"
                                        :disabled="!pgInitTargetRegion">
                                        <el-radio label=1>是</el-radio>
                                        <el-radio label=0>否</el-radio>
                                    </el-radio-group>
                                </el-form-item>
                            </el-col>
                            <el-col :span="1">
                                <el-form-item>
                                    <el-switch class="switch_style" v-model="pgInitTargetRegion"
                                        @change="pgInitSwitchChange" />
                                </el-form-item>
                            </el-col>

                            <el-col :span="7">
                                <el-form-item label="坐标点的优先级:" label-width="150px">
                                    <el-select v-model="formAddData.pgManualConfigLevel" class="filter-item"
                                        placeholder="坐标点的优先级" :disabled="!pgManualConfigLevel">
                                        <el-option v-for="(key, value) in Dic.PGManualConfigLevel" :key="key" :label="key"
                                            :value="value" />
                                    </el-select>
                                </el-form-item>
                            </el-col>
                            <el-col :span="1">
                                <el-form-item>
                                    <el-switch class="switch_style" v-model="pgManualConfigLevel" />
                                </el-form-item>
                            </el-col>
                        </el-row>

                        <el-row v-if="state.deviceType === '2'" style="margin-bottom: -10px;">
                            <el-col :span="7">
                                <el-form-item label="坐标点赋值:" label-width="150px">
                                    <el-input v-model="formAddData.originx" placeholder="origin-x"
                                        :disabled="!pgManualConfig" maxlength="4"
                                        onkeyup="value=value.replace(/[^\d]/g, '')" style="width: 100px;" />
                                    <el-input v-model="formAddData.originy" placeholder="origin-y"
                                        :disabled="!pgManualConfig" maxlength="4"
                                        onkeyup="value=value.replace(/[^\d]/g, '')" style="width: 100px;" />
                                    <el-input v-model="formAddData.endx" placeholder="end-x" :disabled="!pgManualConfig"
                                        v-if="pgManualConfig" maxlength="4" onkeyup="value=value.replace(/[^\d]/g, '')"
                                        style="width: 100px;" />
                                    <el-input v-model="formAddData.endy" placeholder="end-y" :disabled="!pgManualConfig"
                                        v-if="pgManualConfig" maxlength="4" onkeyup="value=value.replace(/[^\d]/g, '')"
                                        style="width: 100px;" />
                                    <el-input v-model="formAddData.centerx" placeholder="center-x"
                                        :disabled="!pgManualConfig" v-if="pgManualConfig" maxlength="4"
                                        onkeyup="value=value.replace(/[^\d]/g, '')" style="width: 100px;" />
                                    <el-input v-model="formAddData.centery" placeholder="center-y"
                                        :disabled="!pgManualConfig" v-if="pgManualConfig" maxlength="4"
                                        onkeyup="value=value.replace(/[^\d]/g, '')" style="width: 100px;" />
                                </el-form-item>
                            </el-col>
                            <el-col :span="1">
                                <el-form-item>
                                    <el-switch class="switch_style" v-model="pgManualConfig" />
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <!-- 压力表专用配置 -->
                    </el-form>
                </el-tab-pane>
            </el-tabs>
        </el-row>
        <el-row>
            <div style="text-align: center;border: 2px;border-color: red;margin-top: 30px;width: 100%;">
                <div style="height:50%;display: inline-block;">
                    <el-button @click="closeForm">取消</el-button>
                    <el-button type="primary" @click="submitAddForm" :disabled="state.saveDisabled">确定</el-button>
                </div>
            </div>
        </el-row>
    </div>
</template>

<script lang="ts" setup>
import { reactive, toRefs, ref, onMounted, defineEmits } from "vue";
import { ElForm, ElMessage, ElMessageBox, ElTable } from 'element-plus';
import {
    PageResult,
    TaskRemoteCfg,
    TAicbqCfg,
    TaskRemoteCfgQueryParam
} from '@/types';
import zhCn from 'element-plus/lib/locale/lang/zh-cn';
import { AxiosPromise } from "axios";
import Dic from "@/dictionary/aicbqcfg";
import tool from "@/until/tool";
import Moment from "moment";
import TAicbqCfgAction from "@/api/taicbqcfg";
import TaskRemoteCfgAction from '@/api/downlinktask/taskremotecfg';

const props = defineProps({
    deviceSn: String,
    data: Object,
    taskType: Number,
    childEvent: Event
})

const { data } = toRefs(props)
const { taskType } = toRefs(props)

const isAdd = ref();

//子->父
const emit = defineEmits(['change'])

const datePicker = ref();

onMounted(() => {
    if (props.deviceSn) {
        queryTaskRemote();
    }
});

let locale = ref(zhCn);
const state = reactive({
    saveDisabled: false,
    formAddRemoteCfgData: {} as TaskRemoteCfg,
    deviceType: '1',
});

const queryTaskRemote = () => {
    let param = {} as TaskRemoteCfgQueryParam;
    param.deviceSn = props.deviceSn;
    param.finishedFlag = '0';
    param.page = 1;
    param.rows = 1;

    let cfg = {} as TaskRemoteCfg;

    TaskRemoteCfgAction.QueryTaskRemoteCfgList(param)
        .then((result) => {
            if (result.status === 200) {
                const { res, flag, error } = result.data;
                if (flag != undefined && flag == 1) {
                    const pageData = res as PageResult<TaskRemoteCfg[]>;
                    if (pageData.list && pageData.list.length > 0) {
                        cfg = pageData.list[0];
                        ElMessageBox.confirm(" [" + props.deviceSn + "]存在未执行的任务,是否修改?<br/>(每台设备仅允许存在同一个未执行的任务) ", "提示", {
                            cancelButtonText: "取消",
                            confirmButtonText: "确认",
                            dangerouslyUseHTMLString: true,
                            type: "warning",
                            center: true,
                        }).then(() => {
                            loadDateByEdit(cfg);
                            isAdd.value = false;
                        }).catch(() => { closeForm(); })
                    } else {//不存在未执行的任务,加载历史配置
                        loadConfig();
                        isAdd.value = true;
                    }
                }
            }

        })
        .catch((error) => {
            //请求失败时的操作
            ElMessage.error(error);
        });
}

const {
    formAddRemoteCfgData: formAddData
} = toRefs(state);

const submitAddForm = () => {
    state.saveDisabled = true;
    let axi = {} as AxiosPromise;

    let resultData = getResultModel();
    // state.formEditData.taskRemoteCfgModel = state.formAddRemoteCfgData;
    // if (sampleInterval.value) {
    //     state.formEditData.taskRemoteCfgModel.upInterval = state.formEditData.taskRemoteCfgModel.sampleInterval;
    // }
    resultData.deviceSn = formAddData.value.deviceSn;
    if (isAdd.value) {
        axi = TaskRemoteCfgAction.AddTaskRemoteCfg(resultData)
    } else {
        axi = TaskRemoteCfgAction.EditTaskRemoteCfg(resultData);
    }

    //TaskBatchRemoteAction.AddTaskBatchRemote(state.formEditData).then((result) => {
    axi.then((result) => {
        const { res, flag, error } = result.data;
        if (flag === "1") {
            ElMessage.success("保存成功");
            emit('change', true)
            state.saveDisabled = false;
        }
        else {
            ElMessage.warning(error);
            state.saveDisabled = false;
        }
    });
}

const closeForm = () => {
    emit('change', false)
}

/* 开始 ---- 记录打开了那一项的配置开关,简单写法,应该可优化 */
const stationCode = ref(false);
const ip1Port1 = ref(false);
const ip2Port2 = ref(false);
const ip3Port3 = ref(false);
const ip4Port4 = ref(false);
const domainNamePort = ref(false);
const dnType = ref(false);
const digitNum = ref(false);
const uintType = ref(false);
const setupDir = ref(false);
const sampleInterval = ref(false);
const networkRegTimeout = ref(false);
const setupYear = ref(false);
const aiPullBack = ref(false);
const aiPass = ref(false);
const aiSinglePass = ref(false);
const pwmHz = ref(false);
const pwmDuty = ref(false);
const flashBrightMin = ref(false);
const upWholeImgWeekRule = ref(false);
const ip1ExpandOn = ref(false);
const upInterval = ref(false);
const ltSampleInterval = ref(false);
const workLt = ref(false);
const batAlarmSoc = ref(false);
const workHt = ref(false);
const batAlarmVt = ref(false);
const cpuVersion = ref(false);
const tongxunVersion = ref(false);
const tongxunWay = ref(false);
const tianxianType = ref(false);
//const wheelNum = ref(false);
const lastVal = ref(false);
const meterFontStyle = ref(false);
const pgRange = ref(false);
const pgPrecisionType = ref(false);
const pgCorrectvalue = ref(false);
const pgManualConfig = ref(false);
const pgIsDebug = ref(false);
const pgInitTargetRegion = ref(false);
const isprintcomlog = ref(false);
const isresetwdt = ref(false);
const wiTaskManwakeupFlag = ref(false);
const wiTaskMonthFlag = ref(false);
const wiTaskSpecdateFlag = ref(false);
const logUploadRules = ref(false);
const uploadLastFailLogFlag = ref(false);
const logTaskManwakeupFlag = ref(false);
const pgManualConfigLevel = ref(false);
const imageType = ref(false);
const imageMargin = ref(false);
const imageConfig = ref(false);
const uploadCnnFlag = ref(false);
const nmsThreshold = ref(false);
const isUseDetectedNum = ref(false);
const regionImageType = ref(false);
const jpgCompressType = ref(false);
/* 结束 ---- 记录打开了那一项的配置开关,简单写法,应该可优化 */

const initData = () => {
    stationCode.value = false;
    ip1Port1.value = false;
    ip2Port2.value = false;
    ip3Port3.value = false;
    ip4Port4.value = false;
    domainNamePort.value = false;
    dnType.value = false;
    digitNum.value = false;
    uintType.value = false;
    setupDir.value = false;
    sampleInterval.value = false;
    networkRegTimeout.value = false;
    setupYear.value = false;
    aiPullBack.value = false;
    aiPass.value = false;
    aiSinglePass.value = false;
    pwmHz.value = false;
    pwmDuty.value = false;
    flashBrightMin.value = false;
    upWholeImgWeekRule.value = false;
    ip1ExpandOn.value = false;
    upInterval.value = false;
    ltSampleInterval.value = false;
    workLt.value = false;
    batAlarmSoc.value = false;
    workHt.value = false;
    batAlarmVt.value = false;
    cpuVersion.value = false;
    tongxunVersion.value = false;
    tianxianType.value = false;
    tongxunWay.value = false;
    //wheelNum.value = false;         //按协议约定,要和数字个数一起配置
    lastVal.value = false;

    week1.value = false;
    week2.value = false;
    week3.value = false;
    week4.value = false;
    week5.value = false;
    week6.value = false;
    week7.value = false;

    meterFontStyle.value = false;
    pgRange.value = false;
    pgPrecisionType.value = false;
    pgCorrectvalue.value = false;
    pgManualConfig.value = false;
    pgIsDebug.value = false;
    pgInitTargetRegion.value = false;

    isprintcomlog.value = false;
    isresetwdt.value = false;
    wiTaskManwakeupFlag.value = false;
    wiTaskMonthFlag.value = false;
    wiTaskSpecdateFlag.value = false;
    logUploadRules.value = false;
    uploadLastFailLogFlag.value = false;
    logTaskManwakeupFlag.value = false;
    pgManualConfigLevel.value = false;
    imageType.value = false;
    imageMargin.value = false;
    imageConfig.value = false;
    uploadCnnFlag.value = false;
    nmsThreshold.value = false;
    isUseDetectedNum.value = false;
    regionImageType.value = false;
    jpgCompressType.value = false;
}

/* 开始 ---- 记录星期的勾选 */
const week1 = ref(false);
const week2 = ref(false);
const week3 = ref(false);
const week4 = ref(false);
const week5 = ref(false);
const week6 = ref(false);
const week7 = ref(false);
/* 结束 ---- 记录星期的勾选 */

//周上传规则反选
const weekRuleInvert = () => {
    week1.value = !week1.value;
    week2.value = !week2.value;
    week3.value = !week3.value;
    week4.value = !week4.value;
    week5.value = !week5.value;
    week6.value = !week6.value;
    week7.value = !week7.value;
    WeekRuleChange();
}

/* 日期控件开始 */
const size = ref<'' | 'large' | 'small'>('')
const shortcuts = [
    {
        text: '今天',
        value: new Date(),
    },
    {
        text: '昨天',
        value: () => {
            const date = new Date()
            date.setTime(date.getTime() - 3600 * 1000 * 24)
            return date
        },
    },
    {
        text: '前一周',
        value: () => {
            const date = new Date()
            date.setTime(date.getTime() - 3600 * 1000 * 24 * 7)
            return date
        },
    },
]
/* 日期控件结束 */

const isDebugSwitchChange = () => {
    state.formAddRemoteCfgData.pgIsDebug = pgIsDebug.value ? '1' : '0';

}

const pgInitSwitchChange = () => {
    state.formAddRemoteCfgData.pgInitTargetRegion = pgInitTargetRegion.value ? '1' : '0';

}

const comlogSwitchChange = () => {
    state.formAddRemoteCfgData.isprintcomlog = isprintcomlog.value ? '1' : '0';

}

const isresetwdtSwitchChange = () => {
    state.formAddRemoteCfgData.isresetwdt = isresetwdt.value ? '1' : '0';

}

const uploadLastFailLogFlagSwitchChange = () => {
    state.formAddRemoteCfgData.uploadLastFailLogFlag = uploadLastFailLogFlag.value ? '1' : '0';

}

const wiTaskSpecdateFlagSwitchChange = () => {
    state.formAddRemoteCfgData.wiTaskSpecdateDate = Moment((new Date())).format("YYYYMMDD");

}

const logUploadRulesSwitchChange = () => {
    state.formAddRemoteCfgData.logUploadDate = Moment((new Date())).format("YYYYMMDD");

}

//修改时回填数据
const loadDateByEdit = (cfg: TaskRemoteCfg) => {
    formAddData.value=cfg;

    if (cfg != null && cfg.upWholeImgWeekRule != null && cfg.upWholeImgWeekRule.length == 7) {
        week1.value = cfg.upWholeImgWeekRule[0] == "1";
        week2.value = cfg.upWholeImgWeekRule[1] == "1";
        week3.value = cfg.upWholeImgWeekRule[2] == "1";
        week4.value = cfg.upWholeImgWeekRule[3] == "1";
        week5.value = cfg.upWholeImgWeekRule[4] == "1";
        week6.value = cfg.upWholeImgWeekRule[5] == "1";
        week7.value = cfg.upWholeImgWeekRule[6] == "1";
        upWholeImgWeekRule.value = true;
    }

    stationCode.value = cfg.stationCode != null;
    ip1Port1.value = cfg.ip1Port1 != null;
    ip2Port2.value = cfg.ip2Port2 != null;
    ip3Port3.value = cfg.ip3Port3 != null;
    ip4Port4.value = cfg.ip4Port4 != null;
    domainNamePort.value = cfg.domainNamePort != null;
    dnType.value = cfg.dnType != null;
    digitNum.value = cfg.digitNum != null;
    uintType.value = cfg.uintType != null;
    setupDir.value = cfg.setupDir != null;
    sampleInterval.value = cfg.sampleInterval != null;
    networkRegTimeout.value = cfg.networkRegTimeout != null;
    setupYear.value = cfg.setupYear != null;
    aiPullBack.value = cfg.aiPullBack != null;
    aiPass.value = cfg.aiPass != null;
    aiSinglePass.value = cfg.aiSinglePass != null;
    pwmHz.value = cfg.pwmHz != null;
    pwmDuty.value = cfg.pwmDuty != null;
    flashBrightMin.value = cfg.flashBrightMin != null;
    ip1ExpandOn.value = cfg.ip1ExpandOn != null;
    upInterval.value = cfg.upInterval != null;
    ltSampleInterval.value = cfg.ltSampleInterval != null;
    workLt.value = cfg.workLt != null;
    batAlarmSoc.value = cfg.batAlarmSoc != null;
    workHt.value = cfg.workHt != null;
    batAlarmVt.value = cfg.batAlarmVt != null;
    cpuVersion.value = cfg.cpuVersion != null;
    tongxunVersion.value = cfg.tongxunVersion != null;
    tianxianType.value = cfg.tianxianType != null;
    tongxunWay.value = cfg.tongxunWay != null;
    //wheelNum.value = formAddData.value.wheelNum != null;
    lastVal.value = cfg.lastVal != null;
    meterFontStyle.value = cfg.meterFontStyle != null;

    //压力表添加 2022-09-13 guozhao
    pgRange.value = cfg.pgRangeMin != null || cfg.pgRangeMax != null;
    pgPrecisionType.value = cfg.pgPrecisionType != null;
    pgCorrectvalue.value = cfg.pgCorrectvalue != null;
    pgManualConfig.value = cfg.pgManualConfig != null;
    pgIsDebug.value = cfg.pgIsDebug != null;
    pgInitTargetRegion.value = cfg.pgInitTargetRegion != null;

    isprintcomlog.value = cfg.isprintcomlog != null;
    isresetwdt.value = cfg.isresetwdt != null;

    wiTaskManwakeupFlag.value = cfg.wiTaskManwakeupFlag != null;
    wiTaskMonthFlag.value = cfg.wiTaskMonthFlag != null;
    wiTaskSpecdateFlag.value = cfg.wiTaskSpecdateFlag != null;
    logUploadRules.value = cfg.logUploadRules != null;
    uploadLastFailLogFlag.value = cfg.uploadLastFailLogFlag != null;
    logTaskManwakeupFlag.value = cfg.logTaskManwakeupFlag != null;
    pgManualConfigLevel.value = cfg.pgManualConfigLevel != null;

    //因BMP 添加的 2022-11-08
    imageType.value = cfg.imageType != null;
    imageMargin.value = cfg.imageMargin != null;
    imageConfig.value = cfg.imageConfig != null;
    uploadCnnFlag.value = cfg.uploadCnnFlag != null;
    nmsThreshold.value = cfg.nmsThreshold != null;

    isUseDetectedNum.value = cfg.isUseDetectedNum != null;

    regionImageType.value = cfg.regionImageType != null;
    jpgCompressType.value = cfg.jpgCompressType != null;
};

//周规则发生改变
const WeekRuleChange = () => {
    if (upWholeImgWeekRule.value) {
        let weeks = "";
        weeks += week1.value ? "1" : "0";
        weeks += week2.value ? "1" : "0";
        weeks += week3.value ? "1" : "0";
        weeks += week4.value ? "1" : "0";
        weeks += week5.value ? "1" : "0";
        weeks += week6.value ? "1" : "0";
        weeks += week7.value ? "1" : "0";
        state.formAddRemoteCfgData.upWholeImgWeekRule = weeks;
    }
}

/**
 * 获取最终要保存的对象(打开开关的)
 */
const getResultModel = () => {
    let isCfg = false;
    let submitData = {} as TaskRemoteCfg;
    submitData.batchFlag='0';
    submitData.createMan = localStorage.getItem("UserName") + "";
    if(!isAdd.value){
        submitData.id=formAddData.value.id;
        submitData.finishedFlag=formAddData.value.finishedFlag;
        submitData.batchFlag=formAddData.value.batchFlag;
        submitData.taskId=formAddData.value.taskId;
    }
    if (ip1Port1.value) { submitData.ip1Port1 = formAddData.value.ip1Port1; isCfg = true; }
    if (ip2Port2.value) { submitData.ip2Port2 = formAddData.value.ip2Port2; isCfg = true; }
    if (ip3Port3.value) { submitData.ip3Port3 = formAddData.value.ip3Port3; isCfg = true; }
    if (ip4Port4.value) { submitData.ip4Port4 = formAddData.value.ip4Port4; isCfg = true; }
    if (stationCode.value) { submitData.stationCode = formAddData.value.stationCode; isCfg = true; };
    if (domainNamePort.value) { submitData.domainNamePort = formAddData.value.domainNamePort; isCfg = true; }
    if (dnType.value) { submitData.dnType = formAddData.value.dnType; isCfg = true; }
    if (digitNum.value) {
        submitData.digitNum = formAddData.value.digitNum;
        submitData.wheelNum = formAddData.value.wheelNum;
        isCfg = true;
    }
    if (uintType.value) { submitData.uintType = formAddData.value.uintType; isCfg = true; }
    if (setupDir.value) { submitData.setupDir = formAddData.value.setupDir; isCfg = true; }
    if (sampleInterval.value) {
        submitData.sampleInterval = formAddData.value.sampleInterval;
        submitData.upInterval = formAddData.value.sampleInterval;//两个值现阶段都是一致的
        isCfg = true;
    }
    if (networkRegTimeout.value) { submitData.networkRegTimeout = formAddData.value.networkRegTimeout; isCfg = true; }
    if (setupYear.value) { submitData.setupYear = formAddData.value.setupYear; isCfg = true; }
    if (aiPullBack.value) { submitData.aiPullBack = formAddData.value.aiPullBack; isCfg = true; }
    if (aiPass.value) { submitData.aiPass = formAddData.value.aiPass; isCfg = true; }
    if (aiSinglePass.value) { submitData.aiSinglePass = formAddData.value.aiSinglePass; isCfg = true; }
    if (pwmHz.value) { submitData.pwmHz = formAddData.value.pwmHz; isCfg = true; }
    if (pwmDuty.value) { submitData.pwmDuty = formAddData.value.pwmDuty; isCfg = true; }
    if (flashBrightMin.value) {
        submitData.flashBrightMin = formAddData.value.flashBrightMin;
        submitData.flashBrightMax = formAddData.value.flashBrightMax;
        isCfg = true;
    }
    // if (upWholeImgWeekRule.value) { submitData.upWholeImgWeekRule = formAddData.value.upWholeImgWeekRule }
    if (ip1ExpandOn.value) { submitData.ip1ExpandOn = formAddData.value.ip1ExpandOn; isCfg = true; }
    if (upInterval.value) { submitData.upInterval = formAddData.value.upInterval; isCfg = true; }
    if (ltSampleInterval.value) { submitData.ltSampleInterval = formAddData.value.ltSampleInterval; isCfg = true; }
    if (workLt.value) {
        submitData.workLt = formAddData.value.workLt;
        submitData.workHt = formAddData.value.workHt;
        isCfg = true;
    }
    if (batAlarmSoc.value) { submitData.batAlarmSoc = formAddData.value.batAlarmSoc; isCfg = true; }
    // if (workHt.value) { submitData.workHt = formAddData.value.workHt }
    if (batAlarmVt.value) { submitData.batAlarmVt = formAddData.value.batAlarmVt; isCfg = true; }
    if (cpuVersion.value) { submitData.cpuVersion = formAddData.value.cpuVersion; isCfg = true; }
    if (tongxunVersion.value) { submitData.tongxunVersion = formAddData.value.tongxunVersion; isCfg = true; }
    if (tianxianType.value) { submitData.tianxianType = formAddData.value.tianxianType; isCfg = true; }
    if (tongxunWay.value) { submitData.tongxunWay = formAddData.value.tongxunWay; isCfg = true; }
    // if (wheelNum.value) { submitData.wheelNum = formAddData.value.wheelNum }
    if (lastVal.value) { submitData.lastVal = formAddData.value.lastVal; isCfg = true; }
    if (meterFontStyle.value) { submitData.meterFontStyle = formAddData.value.meterFontStyle; isCfg = true; }

    //压力表添加
    if (pgRange.value) {
        submitData.pgRangeMin = formAddData.value.pgRangeMin;
        submitData.pgRangeMax = formAddData.value.pgRangeMax;
        isCfg = true;
    }
    if (pgPrecisionType.value) { submitData.pgPrecisionType = formAddData.value.pgPrecisionType; isCfg = true; }
    if (pgManualConfig.value) {
        submitData.originx = formAddData.value.originx;
        submitData.originy = formAddData.value.originy;
        submitData.endx = formAddData.value.endx;
        submitData.endy = formAddData.value.endy;
        submitData.centerx = formAddData.value.centerx;
        submitData.centery = formAddData.value.centery;
        isCfg = true;
    }
    if (pgCorrectvalue.value) { submitData.pgCorrectvalue = formAddData.value.pgCorrectvalue; isCfg = true; }
    if (pgIsDebug.value) { submitData.pgIsDebug = formAddData.value.pgIsDebug; isCfg = true; }
    if (pgInitTargetRegion.value) { submitData.pgInitTargetRegion = formAddData.value.pgInitTargetRegion; isCfg = true; }

    if (isprintcomlog.value) { submitData.isprintcomlog = formAddData.value.isprintcomlog; isCfg = true; }
    if (isresetwdt.value) { submitData.isresetwdt = formAddData.value.isresetwdt; isCfg = true; }
    if (formAddData.value.isresetbat === '1') {
        submitData.isresetbat = formAddData.value.isresetbat; isCfg = true;
    }
    if (formAddData.value.isrestmcu === '1') {
        submitData.isrestmcu = formAddData.value.isrestmcu; isCfg = true;
    }

    if (wiTaskManwakeupFlag.value) {
        submitData.wiTaskManwakeupFlag = formAddData.value.wiTaskManwakeupFlag; isCfg = true;
    }
    if (wiTaskMonthFlag.value) {
        submitData.wiTaskMonthFlag = formAddData.value.wiTaskMonthFlag; isCfg = true;
    }
    if (wiTaskSpecdateFlag.value) {
        submitData.wiTaskSpecdateEnable = formAddData.value.wiTaskSpecdateEnable;
        submitData.wiTaskSpecdateDate = formAddData.value.wiTaskSpecdateDate;
        submitData.wiTaskSpecdateDays = formAddData.value.wiTaskSpecdateDays;
        submitData.wiTaskSpecdateTimes = formAddData.value.wiTaskSpecdateTimes;
        isCfg = true;
    }
    if (logUploadRules.value) {
        submitData.logUploadEnable = formAddData.value.logUploadEnable;
        submitData.logUploadDate = formAddData.value.logUploadDate;
        submitData.logUploadDays = formAddData.value.logUploadDays;
        submitData.logUploadTimes = formAddData.value.logUploadTimes;
        submitData.logUploadMcuLevel = formAddData.value.logUploadMcuLevel;
        submitData.logUploadAiLevel = formAddData.value.logUploadAiLevel;
        isCfg = true;
    }
    if (uploadLastFailLogFlag.value) {
        submitData.uploadLastFailLogFlag = formAddData.value.uploadLastFailLogFlag; isCfg = true;
    }
    if (logTaskManwakeupFlag.value) {
        submitData.logTaskManwakeupFlag = formAddData.value.logTaskManwakeupFlag; isCfg = true;
    }
    if (pgManualConfigLevel.value) {
        submitData.pgManualConfigLevel = formAddData.value.pgManualConfigLevel; isCfg = true;
    }

    if (imageType.value) {
        submitData.imageType = formAddData.value.imageType; isCfg = true;
    }
    if (imageMargin.value) {
        submitData.imageMargin = formAddData.value.imageMargin; isCfg = true;
    }
    if (imageConfig.value) {
        submitData.imageConfigFlag = formAddData.value.imageConfigFlag;
        submitData.imageLeanAngle = formAddData.value.imageLeanAngle;
        submitData.imageNumRegionXMin = formAddData.value.imageNumRegionXMin;
        submitData.imageNumRegionYMin = formAddData.value.imageNumRegionYMin;
        submitData.imageNumRegionXMax = formAddData.value.imageNumRegionXMax;
        submitData.imageNumRegionYMax = formAddData.value.imageNumRegionYMax;
        isCfg = true;
    }
    if (uploadCnnFlag.value) {
        submitData.uploadCnnFlag = formAddData.value.uploadCnnFlag; isCfg = true;
    }
    if (nmsThreshold.value) {
        submitData.nmsThreshold = formAddData.value.nmsThreshold; isCfg = true;
    }
    if (isUseDetectedNum.value) {
        submitData.isUseDetectedNum = formAddData.value.isUseDetectedNum; isCfg = true;
    }

    if (regionImageType.value) {
        submitData.regionImageType = formAddData.value.regionImageType; isCfg = true;
    }
    if (jpgCompressType.value) {
        submitData.jpgCompressType = formAddData.value.jpgCompressType; isCfg = true;
    }

    //处理周规则
    if (upWholeImgWeekRule.value) {
        let weeks = "";
        weeks += week1.value ? "1" : "0";
        weeks += week2.value ? "1" : "0";
        weeks += week3.value ? "1" : "0";
        weeks += week4.value ? "1" : "0";
        weeks += week5.value ? "1" : "0";
        weeks += week6.value ? "1" : "0";
        weeks += week7.value ? "1" : "0";
        submitData.upWholeImgWeekRule = weeks;
        isCfg = true;
    }
    submitData.deviceType = state.deviceType;
    return submitData;
}

const loadConfig = () => {
    TAicbqCfgAction.QueryTAicbqCfg(props.deviceSn as string).then((result) => {
        if (result.status == 200) {
            const { res, flag, error } = result.data;
            if (flag != undefined && flag == 1) {
                const cfgs = res as TAicbqCfg[];
                if (cfgs != null && cfgs.length > 0) {
                    let formAddCfgData = cfgs[0];
                    formAddData.value.deviceSn = formAddCfgData.deviceSn;
                    if (formAddCfgData.serverIp1 != null && formAddCfgData.serverPort1 != null) {
                        formAddData.value.ip1Port1 = formAddCfgData.serverIp1 + ':' + formAddCfgData.serverPort1;
                    }
                    if (formAddCfgData.serverIp2 != null && formAddCfgData.serverPort2 != null) {
                        formAddData.value.ip2Port2 = formAddCfgData.serverIp2 + ':' + formAddCfgData.serverPort2;
                    }
                    if (formAddCfgData.serverIp3 != null && formAddCfgData.serverPort3 != null) {
                        formAddData.value.ip3Port3 = formAddCfgData.serverIp3 + ':' + formAddCfgData.serverPort3;
                    }
                    if (formAddCfgData.serverIp4 != null && formAddCfgData.serverPort4 != null) {
                        formAddData.value.ip4Port4 = formAddCfgData.serverIp4 + ':' + formAddCfgData.serverPort4;
                    }
                    formAddData.value.stationCode = formAddCfgData.stationCode;
                    if (formAddCfgData.domainName != null && formAddCfgData.domainPort != null) {
                        formAddData.value.domainNamePort = formAddCfgData.domainName + ':' + formAddCfgData.domainPort;
                    }
                    formAddData.value.dnType = formAddCfgData.dnType;
                    formAddData.value.digitNum = formAddCfgData.digitNum;
                    formAddData.value.uintType = formAddCfgData.uintType;
                    formAddData.value.setupDir = formAddCfgData.setupDir;
                    formAddData.value.sampleInterval = formAddCfgData.sampleInterval;
                    formAddData.value.networkRegTimeout = formAddCfgData.networkRegTimeout;
                    formAddData.value.setupYear = formAddCfgData.setupYear;
                    formAddData.value.aiPullBack = formAddCfgData.aiPullBack;
                    formAddData.value.aiPass = formAddCfgData.aiPass;
                    formAddData.value.aiSinglePass = formAddCfgData.aiSinglePass;
                    formAddData.value.pwmHz = formAddCfgData.pwmHz;
                    formAddData.value.pwmDuty = formAddCfgData.pwmDuty;
                    formAddData.value.flashBrightMin = formAddCfgData.flashBrightMin;
                    formAddData.value.flashBrightMax = formAddCfgData.flashBrightMax;
                    //formAddData.value.upWholeImgWeekRule=formAddCfgData.upWholeImgWeekRule;
                    formAddData.value.ip1ExpandOn = formAddCfgData.ip1ExpandOn;
                    formAddData.value.upInterval = formAddCfgData.upInterval;
                    formAddData.value.ltSampleInterval = formAddCfgData.ltSampleInterval;
                    formAddData.value.workLt = formAddCfgData.workLt;
                    formAddData.value.batAlarmVt = formAddCfgData.batAlarmVt;
                    formAddData.value.workHt = formAddCfgData.workHt;
                    formAddData.value.batAlarmSoc = formAddCfgData.batAlarmSoc;
                    formAddData.value.cpuVersion = formAddCfgData.cpuVersion;             //CPU版本也没有
                    formAddData.value.tongxunVersion = formAddCfgData.tongxunVersion;     //通讯版本也没有
                    formAddData.value.tianxianType = formAddCfgData.tianxianType;         //天线类型在配置表中没有
                    formAddData.value.tongxunWay = formAddCfgData.tongxunWay;
                    formAddData.value.wheelNum = formAddCfgData.wheelNum;
                    formAddData.value.lastVal = formAddCfgData.lastVal;
                    formAddData.value.meterFontStyle = formAddCfgData.meterFontStyle;

                    //转换周规则
                    week1.value = formAddCfgData.upWholeImgWeek1 == '1';
                    week2.value = formAddCfgData.upWholeImgWeek2 == '1';
                    week3.value = formAddCfgData.upWholeImgWeek3 == '1';
                    week4.value = formAddCfgData.upWholeImgWeek4 == '1';
                    week5.value = formAddCfgData.upWholeImgWeek5 == '1';
                    week6.value = formAddCfgData.upWholeImgWeek6 == '1';
                    week7.value = formAddCfgData.upWholeImgWeek7 == '1';

                    state.deviceType = formAddCfgData.deviceType;

                    //压力表添加 2022-09-13 guozhao
                    formAddData.value.pgRangeMin = formAddCfgData.pgRangeMin;
                    formAddData.value.pgRangeMax = formAddCfgData.pgRangeMax;
                    formAddData.value.pgPrecisionType = formAddCfgData.pgPrecisionType;
                    formAddData.value.pgCorrectvalue = formAddCfgData.pgCorrectvalue;
                    formAddData.value.pgManualConfig = formAddCfgData.pgManualConfig;
                    formAddData.value.pgIsDebug = formAddCfgData.pgIsDebug;
                    formAddData.value.pgInitTargetRegion = formAddCfgData.pgInitTargetRegion;
                    formAddData.value.pgManualConfigCol = formAddCfgData.pgManualConfigCol;
                    formAddData.value.originx = formAddCfgData.originx;
                    formAddData.value.originy = formAddCfgData.originy;
                    formAddData.value.endx = formAddCfgData.endx;
                    formAddData.value.endy = formAddCfgData.endy;
                    formAddData.value.centerx = formAddCfgData.centerx;
                    formAddData.value.centery = formAddCfgData.centery;
                    formAddData.value.isprintcomlog = formAddCfgData.isprintcomlog;
                    formAddData.value.isresetwdt = formAddCfgData.isresetwdt;
                    formAddData.value.pgManualConfigLevel = formAddCfgData.pgManualConfigLevel;

                    //大图和日志规则 2022.10.04 guozhao
                    formAddData.value.wiTaskManwakeupFlag = formAddCfgData.wiTaskManwakeupFlag;
                    formAddData.value.wiTaskMonthFlag = formAddCfgData.wiTaskMonthFlag;
                    formAddData.value.wiTaskSpecdateFlag = formAddCfgData.wiTaskSpecdateFlag;
                    formAddData.value.logUploadRules = formAddCfgData.logUploadRules;
                    formAddData.value.wiTaskSpecdateEnable = formAddCfgData.wiTaskSpecdateEnable;
                    formAddData.value.wiTaskSpecdateDate = formAddCfgData.wiTaskSpecdateDate;
                    formAddData.value.wiTaskSpecdateDays = formAddCfgData.wiTaskSpecdateDays;
                    formAddData.value.wiTaskSpecdateTimes = formAddCfgData.wiTaskSpecdateTimes;
                    formAddData.value.logUploadEnable = formAddCfgData.logUploadEnable;
                    formAddData.value.logUploadDate = formAddCfgData.logUploadDate;
                    formAddData.value.logUploadDays = formAddCfgData.logUploadDays;
                    formAddData.value.logUploadTimes = formAddCfgData.logUploadTimes;
                    formAddData.value.logUploadMcuLevel = formAddCfgData.logUploadMcuLevel;
                    formAddData.value.logUploadAiLevel = formAddCfgData.logUploadAiLevel;
                    formAddData.value.uploadLastFailLogFlag = formAddCfgData.uploadLastFailLogFlag;
                    formAddData.value.logTaskManwakeupFlag = formAddCfgData.logTaskManwakeupFlag;

                    //BMP添加的 2022-11-08
                    formAddData.value.imageType = formAddCfgData.imageType;
                    formAddData.value.imageMargin = formAddCfgData.imageMargin;
                    formAddData.value.imageConfig = formAddCfgData.imageConfig;
                    formAddData.value.uploadCnnFlag = formAddCfgData.uploadCnnFlag;
                    formAddData.value.nmsThreshold = formAddCfgData.nmsThreshold;
                    formAddData.value.imageConfigFlag = formAddCfgData.imageConfigFlag;
                    formAddData.value.imageLeanAngle = formAddCfgData.imageLeanAngle;
                    formAddData.value.imageNumRegionXMin = formAddCfgData.imageNumRegionXMin;
                    formAddData.value.imageNumRegionYMin = formAddCfgData.imageNumRegionYMin;
                    formAddData.value.imageNumRegionXMax = formAddCfgData.imageNumRegionXMax;
                    formAddData.value.imageNumRegionYMax = formAddCfgData.imageNumRegionYMax;

                    //2022-11-15 guozhao
                    formAddData.value.isUseDetectedNum = formAddCfgData.isUseDetectedNum;

                    //2023-01-18 guozhao
                    formAddData.value.regionImageType = formAddCfgData.regionImageType;
                    formAddData.value.jpgCompressType = formAddCfgData.jpgCompressType;
                }
                else {
                    //此处的情况是,数据库中没有该设备的有效配置
                    //   if (isAdd) {
                    //     ElMessageBox.confirm("未查询到设备[" + state.aiCbqCfgQueryParams.deviceSn + "]的配置,是否继续添加? ", "提示", {
                    //       cancelButtonText: "取消",
                    //       confirmButtonText: "确认",
                    //       type: "warning",
                    //       center: true,
                    //     })
                    //       .then(() => {
                    //         queryDeviceAcc(state.aiCbqCfgQueryParams.deviceSn);
                    //         formAddData.value.deviceSn = state.aiCbqCfgQueryParams.deviceSn;
                    //         state.loadDisanbled = true;
                    //       })
                    //       .catch(() => {
                    //         ElMessage({
                    //           type: "info",
                    //           message: "取消添加设备[" + state.aiCbqCfgQueryParams.deviceSn + "]的远程配置任务!",
                    //         });
                    //       });
                    //   }
                }
            }
        }
    })
        .catch((error) => {
            //请求失败时的操作
            ElMessage.error(error);
        });
}
</script>

