<template>
  <div id="main" class="h-all">
    <!--<el-scrollbar style="height: 100%">-->
    <el-dialog
      @close="close"
      v-dialogDrag
      :title=title
      style="font-size: 10px;" width='950px'
      :visible.sync="createElementDiscoveryVisible">
      <el-row>
        <el-form :model="form" inline="true" ref="form" style="width: 1600px">
            <el-row>
              <el-form-item style="margin-bottom: 0px; float:left;">
                <el-form-item :label="$t('ReportTemplateManagement.reportTemplateName')+':'"
                              prop="string" :label-width="formLabelWidth">
                  <el-input size='mini' :placeholder="$t('common.placeholder')" v-model="form.reportTemplateName"
                            autocomplete="off"
                            v-on:blur="reportTemplateNameCheck">
                  </el-input>
                </el-form-item>
                <el-form-item :label="$t('ReportTemplateManagement.subnetKey')+':'"
                              style="margin-left:-40px"
                              prop="string" :label-width="formLabelWidth">
                  <el-select size='mini' clearable v-model="form.subnet" v-on:change="subnetCheck" :placeholder="$t('ResourceManagement.selectSubnet')">
                    <el-option v-for="item in subnetList"
                               :key="item.subnetKey"
                               :label="item.subnetName"
                               :value="item.subnetKey">
                    </el-option>
                  </el-select>
                </el-form-item>
              </el-form-item>
            </el-row>
          <el-row>
            <el-form-item style="float:left;margin-bottom: 0px">
              <el-form-item :label="$t('ReportTemplateManagement.desc')+':'" :label-width="formLabelWidth">
                <el-input type="textarea" :rows="3" size="mini" :placeholder="$t('common.placeholder')" v-model="form.desc"
                          autocomplete="off" style="width: 600px"></el-input>
              </el-form-item>
            </el-form-item>
          </el-row>
          <el-row>
            <el-form-item style="float:left;margin-bottom: 0px">
              <el-form-item :label="$t('ReportTemplateManagement.templateType')+':'"
                            prop="string" :label-width="formLabelWidth">
                <el-radio-group v-model="form.reportType" @change="reportTypeChange(form.reportType)">
                  <el-radio :label=0 >{{$t("ReportTemplateManagement.alarmDistribution")}}</el-radio>
                  <el-radio :label=1 style="margin-left:-25px">{{$t("ReportTemplateManagement.alarmTrend")}}</el-radio>
                  <el-radio :label=2 style="margin-left:-25px">{{$t("ReportTemplateManagement.alarmTopBottom")}}</el-radio>
                  <el-radio :label=3 style="margin-left:-25px">{{$t("ReportTemplateManagement.performanceDistribution")}}</el-radio>
                  <el-radio :label=4 style="margin-left:-25px">{{$t("ReportTemplateManagement.performanceTrend")}}</el-radio>
                  <el-radio :label=5 style="margin-left:-25px">{{$t("ReportTemplateManagement.performanceTopBottom")}}</el-radio>
                </el-radio-group>
              </el-form-item>
            </el-form-item>
          </el-row>
          <el-row v-show="alarmDistributionFlag">
            <el-form-item style="float:left;margin-bottom: 0px">
              <el-form-item :label="$t('ReportTemplateManagement.X')+':'"
                            prop="string" :label-width="formLabelWidth">
                <el-select size='mini'
                           @change="alarmDistributionXChange"
                           v-model="form.alarmDistributionX"
                           :placeholder="$t('common.selectOption')">
                  <el-option v-for="item in chooseList"
                             :key="item.key"
                             :label="item.label"
                             :value="item.key">
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item :label="$t('ReportTemplateManagement.Y')+':'"
                            style="margin-left:-40px"
                            prop="string" :label-width="formLabelWidth">
                <el-select size='mini'
                           @change="alarmDistributionYChange"
                           v-model="form.alarmDistributionY"
                           :placeholder="$t('common.selectOption')">
                  <el-option v-for="item in chooseList"
                             :key="item.key"
                             :label="item.label"
                             :value="item.key">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-form-item>
          </el-row>
          <el-row v-show="alarmTrendFlag">
            <el-form-item style="float:left;margin-bottom: 0px">
              <el-form-item :label="$t('ReportTemplateManagement.statDimension')+':'"
                            prop="string" :label-width="formLabelWidth">
                <el-select size='mini'
                           v-model="form.alarmTrend"
                           @change="alarmTrendChange"
                           :placeholder="$t('common.selectOption')">
                  <el-option v-for="item in chooseList"
                             :key="item.key"
                             :label="item.label"
                             :value="item.key">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-form-item>
          </el-row>
          <el-row v-show="alarmTopFlag">
            <el-form-item style="float:left;margin-bottom: 0px">
              <el-form-item :label="$t('ReportTemplateManagement.statDimension')+':'"
                            prop="string" :label-width="formLabelWidth">
                <el-select size='mini'
                           v-model="form.alarmTopN"
                           @change="alarmTopNChange"
                           :placeholder="$t('common.selectOption')">
                  <el-option v-for="item in chooseAlarmItem"
                             :key="item.key"
                             :label="item.label"
                             :value="item.key">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-form-item>
          </el-row>
          <el-row v-show="performDistributionFlag">
            <el-form-item style="float:left;margin-bottom: 0px">
              <el-form-item :label="$t('ReportTemplateManagement.X')+':'"
                            prop="string" :label-width="formLabelWidth">
                <el-select size='mini'
                           @change="performDistributionXChange"
                           v-model="form.performDistributionX"
                           :placeholder="$t('common.selectOption')">
                  <el-option v-for="item in performDistributionList"
                             :key="item.key"
                             :label="item.label"
                             :value="item.key">
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item :label="$t('ReportTemplateManagement.Y')+':'"
                            style="margin-left:-40px"
                            prop="string" :label-width="formLabelWidth">
                <el-select size='mini'
                           @change="performDistributionYChange"
                           v-model="form.performDistributionY"
                           :placeholder="$t('common.selectOption')">
                  <el-option v-for="item in performDistributionList"
                             :key="item.key"
                             :label="item.label"
                             :value="item.key">
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item :label="$t('ReportTemplateManagement.staticType')+':'"
                            style="margin-left:-40px"
                            prop="string" :label-width="formLabelWidth">
                <el-select size='mini' v-model="form.staticType"
                           @change="performStaticType"
                           :placeholder="$t('common.selectOption')">
                  <el-option v-for="item in staticTypeList"
                             :key="item.key"
                             :label="item.label"
                             :value="item.key">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-form-item>
          </el-row>

          <el-row v-show="performTrendFlag">
            <el-form-item style="float:left;margin-bottom: 0px">
              <el-form-item :label="$t('ReportTemplateManagement.statDimension')+':'"
                            prop="string" :label-width="formLabelWidth">
                <el-select size='mini' v-model="form.performTrend"
                           @change="performTrendYCheck"
                           :placeholder="$t('common.selectOption')">
                  <el-option v-for="item in performDistributionList"
                             :key="item.key"
                             :label="item.label"
                             :value="item.key">
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item :label="$t('ReportTemplateManagement.staticType')+':'"
                            style="margin-left:-40px"
                            prop="string" :label-width="formLabelWidth">
                <el-select size='mini' v-model="form.staticType"
                           @change="performStaticType"
                           :placeholder="$t('common.selectOption')">
                  <el-option v-for="item in staticTypeList"
                             :key="item.key"
                             :label="item.label"
                             :value="item.key">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-form-item>
          </el-row>

          <el-row v-show="performTopFlag">
            <el-form-item style="float:left;margin-bottom: 0px">
              <el-form-item :label="$t('ReportTemplateManagement.X')+':'"
                            prop="string" :label-width="formLabelWidth">
                <el-select size='mini'
                           v-model="form.performTopX"
                           @change="performTopXChange"
                           :placeholder="$t('common.selectOption')">
                  <el-option v-for="item in performTopDistributionList"
                             :key="item.key"
                             :label="item.label"
                             :value="item.key">
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item :label="$t('ReportTemplateManagement.Y')+':'"
                            style="margin-left:-40px"
                            prop="string" :label-width="formLabelWidth">
                <el-select size='mini'
                           v-model="form.performTopY"
                           @change="performTopYChange"
                           :placeholder="$t('common.selectOption')">
                  <el-option
                    v-for="item in performTypeList"
                    :key="item.deviceParam"
                    :label="item.peformTypeName"
                    :value="item.deviceParam">
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item :label="$t('ReportTemplateManagement.staticType')+':'"
                            style="margin-left:-40px"
                            prop="string" :label-width="formLabelWidth">
                <el-select size='mini' v-model="form.staticType"
                           @change="performStaticType"
                           :placeholder="$t('common.selectOption')">
                  <el-option v-for="item in staticTypeList"
                             :key="item.key"
                             :label="item.label"
                             :value="item.key">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-form-item>
          </el-row>

          <el-row>
            <el-form-item style="float:left;margin-bottom: 0px">
              <el-button @click="moreConditionShow" size="mini" style="margin-left: 40px">
                {{$t('ReportTemplateManagement.moreCondition')}}
              </el-button>
            </el-form-item>
          </el-row>
          <el-row v-show="alarmFlag">
            <el-form-item style="float:left;margin-bottom: 0px">
              <el-form-item :label="$t('ReportTemplateManagement.alarmLevel')+':'"
                            prop="string" :label-width="formLabelWidth">
                <el-select size='mini' clearable v-model="form.alarmLevel" multiple collapse-tags :placeholder="$t('common.selectOption')">
                  <el-option v-for="item in alarmLeverList"
                             :key="item.key"
                             :label="item.label"
                             :value="item.key">
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item :label="$t('ReportTemplateManagement.alarmStatus')+':'"
                            style="margin-left:-40px"
                            prop="string" :label-width="formLabelWidth">
                <el-select size='mini' clearable v-model="form.alarmStatus" multiple collapse-tags :placeholder="$t('common.selectOption')">
                  <el-option v-for="item in optionsAlarmStauts"
                             :key="item.value"
                             :label="item.label"
                             :value="item.value">
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item :label="$t('ReportTemplateManagement.alarmCause')+':'"
                            style="margin-left:-40px"
                            prop="string" :label-width="formLabelWidth">
                <el-select size='mini' clearable v-model="form.alarmCode" multiple collapse-tags :placeholder="$t('common.selectOption')">
                  <el-option v-for="item in optionsAlarmCause"
                             :key="item.alarmCode"
                             :label="item.alarmName"
                             :value="item.alarmCode">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-form-item>
          </el-row>
          <el-row v-show="alarmFlag">
            <el-form-item style="float:left;margin-bottom: 0px">
              <el-form-item :label="$t('ReportTemplateManagement.deviceType')+':'"
                            prop="string" :label-width="formLabelWidth">
                <el-select size='mini' clearable v-model="form.deviceTypeKey"
                           @change="deviceTypeChange"
                           multiple collapse-tags
                           :placeholder="$t('common.selectOption')">
                  <el-option v-for="item in deviceTypeList"
                             :key="item.deviceTypeKey"
                             :label="item.deviceTypeName"
                             :value="item.deviceTypeKey">
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item :label="$t('ReportTemplateManagement.deviceModel')+':'"
                            style="margin-left:-40px"
                            prop="string" :label-width="formLabelWidth">
                <el-select size='mini' clearable
                           v-model="form.deviceModel"
                           @change="deviceModelChange"
                           multiple collapse-tags
                           :placeholder="$t('common.selectOption')">
                  <el-option v-for="item in deviceModelList"
                             :key="item.deviceModelKey"
                             :label="item.deviceModel"
                             :value="item.deviceModel">
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item :label="$t('ReportTemplateManagement.device')+':'"
                            style="margin-left:-40px"
                            prop="string" :label-width="formLabelWidth">
                <el-select size='mini' clearable v-model="form.displayName"  multiple collapse-tags :placeholder="$t('common.selectOption')">
                  <el-option
                    v-for="item in deviceList"
                    :key="item.deviceKey"
                    :label="item.displayName"
                    :value="item.displayName">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-form-item>
          </el-row>
          <el-row v-show="alarmFlag">
            <el-form-item style="float:left;margin-bottom: 0px">
<!--              <el-form-item :label="$t('ReportTemplateManagement.deviceBrand')+':'"-->
<!--                            prop="string" :label-width="formLabelWidth">-->
<!--                <el-select size='mini' clearable v-model="form.brand" multiple collapse-tags :placeholder="$t('common.selectOption')">-->
<!--                  <el-option v-for="item in deviceModelList"-->
<!--                             :key="item.deviceModelKey"-->
<!--                             :label="item.deviceModel"-->
<!--                             :value="item.deviceModel">-->
<!--                  </el-option>-->
<!--                </el-select>-->
<!--              </el-form-item>-->
<!--              <el-form-item :label="$t('ReportTemplateManagement.deviceBrand')+':'"-->
<!--                            prop="string" :label-width="formLabelWidth">-->
<!--                <el-input size='mini' :placeholder="$t('common.placeholder')" v-model="form.brand"-->
<!--                          autocomplete="off" style="width: 178px">-->
<!--                </el-input>-->
<!--              </el-form-item>-->
            </el-form-item>
          </el-row>

          <el-row v-show="performFlag">
            <el-form-item style="float:left;margin-bottom: 0px">
              <el-form-item :label="$t('ReportTemplateManagement.deviceType')+':'"
                            prop="string" :label-width="formLabelWidth">
                <el-select size='mini' clearable v-model="form.deviceTypeKey1"
                           multiple collapse-tags
                           @change="performDeviceTypeChange"
                           :placeholder="$t('common.selectOption')">
                  <el-option v-for="item in deviceTypeList"
                             :key="item.deviceTypeKey"
                             :label="item.deviceTypeName"
                             :value="item.deviceTypeKey">
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item :label="$t('ReportTemplateManagement.deviceModel')+':'"
                            style="margin-left:-40px"
                            prop="string" :label-width="formLabelWidth">
                <el-select size='mini' clearable v-model="form.deviceModel1"
                           multiple collapse-tags
                           @change="performDeviceModelChange"
                           :placeholder="$t('common.selectOption')">
                  <el-option v-for="item in deviceModelList"
                             :key="item.deviceModelKey"
                             :label="item.deviceModel"
                             :value="item.deviceModel">
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item :label="$t('ReportTemplateManagement.device')+':'"
                            style="margin-left:-40px"
                            prop="string" :label-width="formLabelWidth">
                <el-select size='mini' clearable v-model="form.displayName1" multiple collapse-tags :placeholder="$t('common.selectOption')">
                  <el-option
                    v-for="item in deviceList"
                    :key="item.deviceKey"
                    :label="item.displayName"
                    :value="item.displayName">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-form-item>
          </el-row>
          <el-row v-show="performFlag">
            <el-form-item style="float:left;margin-bottom: 0px">
<!--              <el-form-item :label="$t('ReportTemplateManagement.deviceBrand')+':'"-->
<!--                            prop="string" :label-width="formLabelWidth">-->
<!--                <el-select size='mini' clearable v-model="form.brand1" multiple collapse-tags :placeholder="$t('common.selectOption')">-->
<!--                  <el-option v-for="item in deviceTypeList"-->
<!--                             :key="item.deviceTypeKey"-->
<!--                             :label="item.deviceTypeName"-->
<!--                             :value="item.deviceTypeKey">-->
<!--                  </el-option>-->
<!--                </el-select>-->
<!--              </el-form-item>-->
              <el-form-item :label="$t('ReportTemplateManagement.performEvent')+':'"
                            prop="string" :label-width="formLabelWidth">
                <el-select size='mini' clearable
                           v-model="form.deviceParam"
                           multiple
                           collapse-tags
                           :placeholder="$t('common.selectOption')">
                  <el-option
                    v-for="item in performTypeList"
                    :key="item.deviceParam"
                    :label="item.peformTypeName"
                    :value="item.deviceParam">
                  </el-option>
                </el-select>
              </el-form-item>
<!--              <el-form-item :label="$t('ReportTemplateManagement.deviceBrand')+':'"-->
<!--                            prop="string" style="margin-left:-40px" :label-width="formLabelWidth">-->
<!--                <el-input size='mini' :placeholder="$t('common.placeholder')" v-model="form.brand"-->
<!--                          autocomplete="off" style="width: 178px">-->
<!--                </el-input>-->
<!--              </el-form-item>-->
            </el-form-item>
          </el-row>
        </el-form>
      </el-row>
      <el-row slot="footer" class="dialog-footer">
        <el-button icon="el-icon-circle-check" type="primary" size="mini" @click="onSubmit">{{$t("common.ok")}}</el-button>
        <el-button icon='el-icon-circle-close' size="mini" @click="close">{{$t("common.cancel")}}</el-button>
      </el-row>
    </el-dialog>
  </div>
</template>

<script>
import ReportTemplateService from '@/domain/services/ReportTemplateService'
import SubnetService from '../../../domain/services/SubnetService'
import HelperUtil from '../../../utils/HelperUtil'
import legitimacyCheck from '../../../utils/legitimacyCheck'
import DeviceService from '../../../domain/services/DeviceService'
import PerformanceStatisticService from '../../../domain/services/PerformanceStatisticService'
import AlarmManagerService from '@/domain/services/AlarmManagerService.js'

export default {
  name: 'CreateAndCopyReportTemplateDialog',
  props: ['command'],
  data: function () {
    return {
      createElementDiscoveryVisible: false,
      title: this.command.title,
      initList: this.command.target,
      check: null,
      deviceTypeList: [],
      deviceList: [],
      deviceList0: [],
      deviceModelList: [],
      deviceModelList0: [],
      performTypeList: [],
      optionsAlarmCause: [],
      subnetList: [],
      form: {
        reportTemplateName: '',
        subnet: '',
        desc: '',
        reportType: 0,
        templateType: 0,
        alarmDistributionX: '',
        alarmDistributionY: '',
        alarmTrend: '',
        alarmTopN: '',
        performDistributionX: '',
        performDistributionY: '',
        staticType: '',
        performTrend: '',
        performTopX: '',
        performTopY: '',
        alarmLevel: '',
        alarmStatus: '',
        alarmCode: '',
        deviceTypeKey: '',
        brand: '',
        deviceModel: '',
        displayName: '',
        deviceTypeKey1: '',
        brand1: '',
        deviceModel1: '',
        displayName1: '',
        deviceParam: ''
      },
      filterValueInit: '',
      alarmFlag: true,
      performFlag: false,
      alarmDistributionFlag: true,
      alarmTrendFlag: false,
      alarmTopFlag: false,
      performDistributionFlag: false,
      performTrendFlag: false,
      performTopFlag: false,
      commandContext: {},
      tableHeight: window.innerHeight * 0.7,
      formLabelWidth: '120px',
      alarmLeverList: [
        {
          key: 0,
          label: this.$t('ReportTemplateManagement.warn')
        },
        {
          key: 1,
          label: this.$t('ReportTemplateManagement.serve')
        },
        {
          key: 2,
          label: this.$t('ReportTemplateManagement.urgency')
        }
      ],
      optionsAlarmStauts: [{
        value: 0,
        label: this.$t('AlarmQuery.Notconfirmed')
      }, {
        value: 1,
        label: this.$t('AlarmQuery.Confirmed')
      }, {
        value: 2,
        label: this.$t('AlarmQuery.Cleared')
      }, {
        value: 3,
        label: this.$t('AlarmQuery.Restored')
      }, {
        value: 4,
        label: this.$t('AlarmQuery.Delete')
      }],
      chooseList: [
        {
          key: 'alarmLevel',
          label: this.$t('ReportTemplateManagement.alarmLevel')
        },
        {
          key: 'alarmStatus',
          label: this.$t('ReportTemplateManagement.alarmStatus')
        },
        {
          key: 'alarmCode',
          label: this.$t('ReportTemplateManagement.alarmCause')
        },
        {
          key: 'displayName',
          label: this.$t('ReportTemplateManagement.device')
        },
        {
          key: 'deviceTypeKey',
          label: this.$t('ReportTemplateManagement.deviceType')
        },
        {
          key: 'deviceModel',
          label: this.$t('ReportTemplateManagement.deviceModel')
        },
        // {
        //   key: 'brand',
        //   label: this.$t('ReportTemplateManagement.deviceBrand')
        // }
      ],
      chooseAlarmItem: [
        {
          key: 'alarmCode',
          label: this.$t('ReportTemplateManagement.alarmCause')
        },
        {
          key: 'displayName',
          label: this.$t('ReportTemplateManagement.device')
        },
        {
          key: 'deviceTypeKey',
          label: this.$t('ReportTemplateManagement.deviceType')
        },
        {
          key: 'deviceModel',
          label: this.$t('ReportTemplateManagement.deviceModel')
        },
        // {
        //   key: 'brand',
        //   label: this.$t('ReportTemplateManagement.deviceBrand')
        // }
      ],
      performDistributionList: [
        {
          key: 'displayName',
          label: this.$t('ReportTemplateManagement.device')
        },
        {
          key: 'deviceTypeKey',
          label: this.$t('ReportTemplateManagement.deviceType')
        },
        {
          key: 'deviceModel',
          label: this.$t('ReportTemplateManagement.deviceModel')
        },
        // {
        //   key: 'brand',
        //   label: this.$t('ReportTemplateManagement.deviceBrand')
        // },
        {
          key: 'deviceParam',
          label: this.$t('ReportTemplateManagement.performEvent')
        }
      ],
      performTopDistributionList: [
        {
          key: 'displayName',
          label: this.$t('ReportTemplateManagement.device')
        },
        {
          key: 'deviceTypeKey',
          label: this.$t('ReportTemplateManagement.deviceType')
        },
        {
          key: 'deviceModel',
          label: this.$t('ReportTemplateManagement.deviceModel')
        },
        // {
        //   key: 'brand',
        //   label: this.$t('ReportTemplateManagement.deviceBrand')
        // }
      ],
      staticTypeList: [
        {
          key: 0,
          label: this.$t('ReportTemplateManagement.max')
        },
        {
          key: 1,
          label: this.$t('ReportTemplateManagement.min')
        },
        {
          key: 2,
          label: this.$t('ReportTemplateManagement.mean')
        },
        {
          key: 3,
          label: this.$t('ReportTemplateManagement.total')
        }
      ]
    }
  },
  methods: {
    /**
     * @Description  : 告警分布x系列变化
     * @author       : ls
     * @date         : 2020/5/6 13:44
     * @param        :
     * @return       :
     */
    alarmDistributionXChange: function () {
      if (!this.check.textNullCheck(this.form.alarmDistributionX)) {
        this.InfoTip.warningTip_alarm(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.TEXT_NULL_CODE), this.$t('ReportTemplateManagement.X'))
        return false
      }
      if (this.form.alarmDistributionX === this.form.alarmDistributionY) {
        this.InfoTip.warningTip_alarm(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.NOT_EQUAL))
        // this.form.alarmDistributionX = ''
        return false
      }
      return true
    },
    /**
     * @Description  : 告警分布Y轴系列变化
     * @author       : ls
     * @date         : 2020/5/6 13:55
     * @param        :
     * @return       :
     */
    alarmDistributionYChange: function () {
      if (!this.check.textNullCheck(this.form.alarmDistributionY)) {
        this.InfoTip.warningTip_alarm(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.TEXT_NULL_CODE), this.$t('ReportTemplateManagement.Y'))
        return false
      }
      if (this.form.alarmDistributionY === this.form.alarmDistributionX) {
        this.InfoTip.warningTip_alarm(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.NOT_EQUAL))
        return false
      }
      return true
    },
    /**
     * @Description  : 告警趋势系类变化
     * @author       : ls
     * @date         : 2020/5/27 16:25
     * @param        :
     * @return       :
     */
    alarmTrendChange: function () {
      if (!this.check.textNullCheck(this.form.alarmTrend)) {
        this.InfoTip.warningTip_alarm(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.TEXT_NULL_CODE), this.$t('ReportTemplateManagement.Y'))
        return false
      }
      return true
    },
    /**
     * @Description  : 告警TopN校验
     * @author       : ls
     * @date         : 2020/5/27 16:28
     * @param        :
     * @return       :
     */
    alarmTopNChange: function () {
      if (!this.check.textNullCheck(this.form.alarmTopN)) {
        this.InfoTip.warningTip_alarm(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.TEXT_NULL_CODE), this.$t('ReportTemplateManagement.statDimension'))
        return false
      }
      return true
    },
    /**
     * @Description  : 性能分布X轴系列变化
     * @author       : ls
     * @date         : 2020/5/6 14:08
     * @param        :
     * @return       :
     */
    performDistributionXChange: function () {
      if (!this.check.textNullCheck(this.form.performDistributionX)) {
        this.InfoTip.warningTip_alarm(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.TEXT_NULL_CODE), this.$t('ReportTemplateManagement.X'))
        return false
      }
      if (this.form.performDistributionX === this.form.performDistributionY) {
        this.InfoTip.warningTip_alarm(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.NOT_EQUAL))
        return false
      }
      return true
    },
    /**
     * @Description  : 性能分布Y轴系列变化
     * @author       : ls
     * @date         : 2020/5/6 14:11
     * @param        :
     * @return       :
     */
    performDistributionYChange: function () {
      if (!this.check.textNullCheck(this.form.performDistributionY)) {
        this.InfoTip.warningTip_alarm(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.TEXT_NULL_CODE), this.$t('ReportTemplateManagement.Y'))
        return false
      }
      if (this.form.performDistributionY === this.form.performDistributionX) {
        this.InfoTip.warningTip_alarm(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.NOT_EQUAL))
        return false
      }
      return true
    },
    /**
     * @Description  : 性能TopY校验
     * @author       : ls
     * @date         : 2020/5/27 16:55
     * @param        :
     * @return       :
     */
    performTopYChange: function () {
      if (!this.check.textNullCheck(this.form.performTopY)) {
        this.InfoTip.warningTip_alarm(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.TEXT_NULL_CODE), this.$t('ReportTemplateManagement.Y'))
        return false
      }
      return true
    },
    /**
     * @Description  : 性能TopX校验
     * @author       : ls
     * @date         : 2020/5/27 17:02
     * @param        :
     * @return       :
     */
    performTopXChange: function () {
      if (!this.check.textNullCheck(this.form.performTopX)) {
        this.InfoTip.warningTip_alarm(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.TEXT_NULL_CODE), this.$t('ReportTemplateManagement.X'))
        return false
      }
      return true
    },
    /**
     * @Description  : 统计类型
     * @author       : ls
     * @date         : 2020/5/27 16:31
     * @param        :
     * @return       :
     */
    performStaticType: function () {
      if (!this.check.textNullCheck(this.form.staticType)) {
        this.InfoTip.warningTip_alarm(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.TEXT_NULL_CODE), this.$t('ReportTemplateManagement.staticType'))
        return false
      }
      return true
    },
    /**
     * @Description  : 性能指标唯一性校验
     * @author       : ls
     * @date         : 2020/5/6 14:41
     * @param        :
     * @return       :
     */
    performDistribution: function () {
      if (this.form.performDistributionX !== 'deviceParam' && this.form.performDistributionY !== 'deviceParam') {
        if (!this.performDistributionChange()) {
          return false
        }
      }
      return true
    },
    /**
     * @Description  : 性能事件校验
     * @author       : ls
     * @date         : 2020/5/6 14:35
     * @param        :
     * @return       :
     */
    performDistributionChange: function () {
      if (!this.check.textNullCheck(this.form.deviceParam)) {
        this.InfoTip.warningTip_alarm(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.TEXT_NULL_CODE), this.$t('ReportTemplateManagement.performEvent'))
        return false
      }
      if (this.form.deviceParam.length > 1) {
        this.InfoTip.warningTip_alarm(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.SELECT_ONLY_ONE))
        return false
      }
      return true
    },
    /**
     * @Description  : 告警趋势Y轴校验
     * @author       : ls
     * @date         : 2020/5/6 15:03
     * @param        :
     * @return       :
     */
    performTrendYCheck: function () {
      var result = this.check.textNullCheck(this.form.performTrend)
      if (!result) {
        this.InfoTip.warningTip(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.TEXT_NULL_CODE), this.$t('ReportTemplateManagement.Y'))
        return false
      }
      return true
    },
    /**
     * @Description  : 告警趋势校验
     * @author       : ls
     * @date         : 2020/5/6 14:54
     * @param        :
     * @return       :
     */
    performTrendCheck: function () {
      if (this.form.performDistributionY !== 'deviceParam') {
        if (!this.performDistributionChange()) {
          return false
        }
      }
      return true
    },
    moreConditionShow: function () {
      if (this.form.reportType === 0 || this.form.reportType === 1 || this.form.reportType === 2) {
        this.alarmFlag = !this.alarmFlag
      } else {
        this.performFlag = !this.performFlag
      }
    },
    /**
     * @Description  : 网元类型
     * @author       : ls
     * @date         : 2020/5/6 12:21
     * @param        :
     * @return       :
     */
    getAllDeviceType: function () {
      let _this = this
      DeviceService.getAllDeviceTypeCollection().then(result => {
        _this.deviceTypeList = Object.values(result)
      }).catch(err => {
        _this.InfoTip.errorTip(_this, err)
      })
    },
    getAllDevice: function () {
      let _this = this
      DeviceService.getAllDeviceCollection().then(result => {
        _this.deviceList = Object.values(result)
        _this.deviceList0 = Object.values(result)
        // _this.getAllDeviceModelListSelf()
      }).catch(err => {
        _this.InfoTip.errorTip(_this, err)
      })
    },
    /**
     * @Description  : performDeviceModelChange
     * @author       : ls
     * @date         : 2020/11/23 12:24
     * @param        :
     * @return       :
     */
    performDeviceTypeChange: function () {
      // this.form.deviceModel1 = ''
      // this.form.displayName1 = ''
      // this.deviceModelList = []
      // this.deviceList = []
      // var arr = HelperUtil.deviceTypeCha(this.deviceModelList0, this.form.deviceTypeKey1, this.deviceList0)
      // this.deviceModelList = arr[0]
      // this.deviceList = arr[1]


      this.form.deviceModel1 = ''
      this.form.displayName1 = ''
      this.deviceModelList = []
      this.deviceList = []
      var a = HelperUtil.deviceTypeChangeCURD(this.deviceModelList0, this.form.deviceTypeKey1, this.form.deviceModel1, this.deviceList0)
      this.deviceModelList = a[0]
      this.form.deviceModel = ''
      this.form.displayName = ''
      this.deviceList = a[1]
    },
    /**
     * @Description  : performDeviceTypeChange
     * @author       : ls
     * @date         : 2020/11/23 12:27
     * @param        :
     * @return       :
     */
    performDeviceModelChange: function () {
      // this.form.displayName1 = ''
      // this.deviceList = []
      // this.deviceList = HelperUtil.deviceModelCha(this.deviceList0, this.form.deviceTypeKey1, this.form.deviceModel1)

      this.form.displayName1 = ''
      this.deviceList = []
      this.deviceList = HelperUtil.deviceModelChangeCURD(this.form.deviceTypeKey1, this.form.deviceModel1, this.deviceList0)
    },
    /**
     * @Description  : deviceTypeChange
     * @author       : ls
     * @date         : 2020/11/23 10:38
     * @param        :
     * @return       :
     */
    deviceTypeChange: function () {
      // this.form.deviceModel = ''
      // this.form.displayName = ''
      // this.deviceModelList = []
      // this.deviceList = []
      // var arr = HelperUtil.deviceTypeCha(this.deviceModelList0, this.form.deviceTypeKey, this.deviceList0)
      // this.deviceModelList = arr[0]
      // this.deviceList = arr[1]


      this.form.deviceModel = ''
      this.form.displayName = ''
      this.deviceModelList = []
      this.deviceList = []
      var a = HelperUtil.deviceTypeChangeCURD(this.deviceModelList0, this.form.deviceTypeKey, this.form.deviceModel, this.deviceList0)
      this.deviceModelList = a[0]
      this.form.deviceModel = ''
      this.form.displayName = ''
      this.deviceList = a[1]

    },
    /**
     * @Description  : deviceModelChange
     * @author       : ls
     * @date         : 2020/11/23 10:39
     * @param        :
     * @return       :
     */
    deviceModelChange: function () {
      // this.form.displayName = ''
      // this.deviceList = []
      // this.deviceList = HelperUtil.deviceModelCha(this.deviceList0, this.form.deviceTypeKey, this.form.deviceModel)

      this.form.displayName = ''
      this.deviceList = []
      this.deviceList = HelperUtil.deviceModelChangeCURD(this.form.deviceTypeKey, this.form.deviceModel, this.deviceList0)
    },
    /**
     * @Description  : getAllDeviceModelListSelf
     * @author       : ls
     * @date         : 2020/11/23 10:13
     * @param        :
     * @return       :
     */
    getAllDeviceModelListSelf: function () {
      for (let key in this.deviceList) {
        let containIs = false
        for (let i in this.deviceModelList) {
          if (this.deviceList[key].deviceModel === this.deviceModelList[i].value) {
            containIs = true
            break
          }
        }
        if (containIs === false && this.deviceList[key].deviceModel !== '') {
          let device = {}
          device.key = this.deviceList[key].deviceTypeKey
          device.label = this.deviceList[key].deviceModel
          device.value = this.deviceList[key].deviceModel
          this.deviceModelList.push(device)
          this.deviceModelList0.push(device)
        }
      }
    },
    /**
     * @Description  : 网元型号
     * @author       : ls
     * @date         : 2020/5/6 12:21
     * @param        :
     * @return       :
     */
    getAllDeviceModel: function () {
      let _this = this
      DeviceService.getAllDeviceModelCollection().then(result => {
        _this.deviceModelList = Object.values(result)
        _this.deviceModelList0 = Object.values(result)
      }).catch(err => {
        _this.InfoTip.errorTip(_this, err)
      })
    },
    /**
     * @Description  : 控制显示
     * @author       : ls
     * @date         : 2020/5/2 16:41
     * @param        :
     * @return       :
     */
    reportTypeChange: function (val) {
      this.deviceList = this.deviceList0
      this.deviceModelList = this.deviceModelList0
      switch (val) {
        case 0:
          this.alarmDistributionFlag = true
          this.alarmTrendFlag = false
          this.alarmTopFlag = false
          this.performDistributionFlag = false
          this.performTrendFlag = false
          this.performTopFlag = false

          this.alarmFlag = true
          this.performFlag = false
          break
        case 1:
          this.alarmDistributionFlag = false
          this.alarmTrendFlag = true
          this.alarmTopFlag = false
          this.performDistributionFlag = false
          this.performTrendFlag = false
          this.performTopFlag = false

          this.alarmFlag = true
          this.performFlag = false
          break
        case 2:
          this.alarmDistributionFlag = false
          this.alarmTrendFlag = false
          this.alarmTopFlag = true
          this.performDistributionFlag = false
          this.performTrendFlag = false
          this.performTopFlag = false

          this.alarmFlag = true
          this.performFlag = false
          break
        case 3:
          this.alarmDistributionFlag = false
          this.alarmTrendFlag = false
          this.alarmTopFlag = false
          this.performDistributionFlag = true
          this.performTrendFlag = false
          this.performTopFlag = false

          this.alarmFlag = false
          this.performFlag = true
          break
        case 4:
          this.alarmDistributionFlag = false
          this.alarmTrendFlag = false
          this.alarmTopFlag = false
          this.performDistributionFlag = false
          this.performTrendFlag = true
          this.performTopFlag = false

          this.alarmFlag = false
          this.performFlag = true
          break
        case 5:
          this.alarmDistributionFlag = false
          this.alarmTrendFlag = false
          this.alarmTopFlag = false
          this.performDistributionFlag = false
          this.performTrendFlag = false
          this.performTopFlag = true

          this.alarmFlag = false
          this.performFlag = true
          break
      }
    },
    /**
     * @Description  : 提交
     * @author       : ls
     * @date         : 2020/5/6 14:46
     * @param        :
     * @return       :
     */
    onSubmit: function () {
      if (!this.totalCheck()) {
        return
      }
      var reportTemplate = {
        reportTemplateName: this.form.reportTemplateName,
        subnetKey: this.form.subnet,
        description: this.form.desc,
        reportType: this.form.reportType
      }
      switch (this.form.reportType) {
        case 0:
          reportTemplate.statDimensionX = this.form.alarmDistributionX
          reportTemplate.statDimensionY = this.form.alarmDistributionY
          reportTemplate.statType = -999
          break
        case 1:
          reportTemplate.statDimensionX = ''
          reportTemplate.statDimensionY = this.form.alarmTrend
          reportTemplate.statType = -999
          break
        case 2:
          reportTemplate.statDimensionX = this.form.alarmTopN
          reportTemplate.statDimensionY = ''
          reportTemplate.statType = -999
          break
        case 3:
          reportTemplate.statDimensionX = this.form.performDistributionX
          reportTemplate.statDimensionY = this.form.performDistributionY
          reportTemplate.statType = this.form.staticType
          break
        case 4:
          reportTemplate.statDimensionX = ''
          reportTemplate.statDimensionY = this.form.performTrend
          reportTemplate.statType = this.form.staticType
          break
        case 5:
          reportTemplate.statDimensionX = this.form.performTopX
          reportTemplate.statDimensionY = this.form.performTopY
          reportTemplate.statType = this.form.staticType
          break
      }
      if (this.form.reportType === 0 || this.form.reportType === 1 || this.form.reportType === 2) {
        this.filterValueInit = ''
        if (this.form.alarmLevel.length !== 0) {
          for (var t = 0; t < this.form.alarmLevel.length; t++) {
            if (t === 0) {
              this.filterValueInit = this.filterValueInit.concat('alarmLevel' + '@#in@#' + this.form.alarmLevel[t])
            } else {
              this.filterValueInit = this.filterValueInit.concat(',' + this.form.alarmLevel[t])
            }
          }
        }
        if (this.form.alarmStatus.length !== 0) {
          this.filterValueInit = this.filterValueInit === '' ? this.filterValueInit : this.filterValueInit.concat(';')
          for (var t1 = 0; t1 < this.form.alarmStatus.length; t1++) {
            if (t1 === 0) {
              this.filterValueInit = this.filterValueInit.concat('alarmStatus' + '@#in@#' + this.form.alarmStatus[t1])
            } else {
              this.filterValueInit = this.filterValueInit.concat(',' + this.form.alarmStatus[t1])
            }
          }
        }
        if (this.form.alarmCode.length !== 0) {
          this.filterValueInit = this.filterValueInit === '' ? this.filterValueInit : this.filterValueInit.concat(';')
          for (var t2 = 0; t2 < this.form.alarmCode.length; t2++) {
            if (t2 === 0) {
              this.filterValueInit = this.filterValueInit.concat('alarmCode' + '@#in@#' + this.form.alarmCode[t2])
            } else {
              this.filterValueInit = this.filterValueInit.concat(',' + this.form.alarmCode[t2])
            }
          }
        }
        if (this.form.deviceTypeKey.length !== 0) {
          this.filterValueInit = this.filterValueInit === '' ? this.filterValueInit : this.filterValueInit.concat(';')
          for (var t3 = 0; t3 < this.form.deviceTypeKey.length; t3++) {
            if (t3 === 0) {
              this.filterValueInit = this.filterValueInit.concat('deviceTypeKey' + '@#in@#' + this.form.deviceTypeKey[t3])
            } else {
              this.filterValueInit = this.filterValueInit.concat(',' + this.form.deviceTypeKey[t3])
            }
          }
        }
        if (this.form.deviceModel.length !== 0) {
          this.filterValueInit = this.filterValueInit === '' ? this.filterValueInit : this.filterValueInit.concat(';')
          for (var t4 = 0; t4 < this.form.deviceModel.length; t4++) {
            if (t4 === 0) {
              this.filterValueInit = this.filterValueInit.concat('deviceModel' + '@#in@#' + this.form.deviceModel[t4])
            } else {
              this.filterValueInit = this.filterValueInit.concat(',' + this.form.deviceModel[t4])
            }
          }
        }
        if (this.form.displayName.length !== 0) {
          this.filterValueInit = this.filterValueInit === '' ? this.filterValueInit : this.filterValueInit.concat(';')
          for (var t5 = 0; t5 < this.form.displayName.length; t5++) {
            if (t5 === 0) {
              this.filterValueInit = this.filterValueInit.concat('displayName' + '@#in@#' + this.form.displayName[t5])
            } else {
              this.filterValueInit = this.filterValueInit.concat(',' + this.form.displayName[t5])
            }
          }
        }
        // if (this.form.brand.length !== 0) {
        //   this.filterValueInit = this.filterValueInit === '' ? this.filterValueInit : this.filterValueInit.concat(';')
        //   for (var t6 = 0; t6 < this.form.brand.length; t6++) {
        //     if (t6 === 0) {
        //       this.filterValueInit = this.filterValueInit.concat('brand' + '@#in@#' + this.form.brand[t6])
        //     } else {
        //       this.filterValueInit = this.filterValueInit.concat(',' + this.form.brand[t6])
        //     }
        //   }
        // }
        if (this.form.brand !== '') {
          this.filterValueInit = this.filterValueInit === '' ? this.filterValueInit : this.filterValueInit.concat(';')
          this.filterValueInit = this.filterValueInit.concat('brand' + '@#in@#' + this.form.brand)
        }
      } else {
        this.filterValueInit = ''
        if (this.form.deviceTypeKey1.length !== 0) {
          this.filterValueInit = this.filterValueInit === '' ? this.filterValueInit : this.filterValueInit.concat(';')
          for (var t7 = 0; t7 < this.form.deviceTypeKey1.length; t7++) {
            if (t7 === 0) {
              this.filterValueInit = this.filterValueInit.concat('deviceTypeKey' + '@#in@#' + this.form.deviceTypeKey1[t7])
            } else {
              this.filterValueInit = this.filterValueInit.concat(',' + this.form.deviceTypeKey1[t7])
            }
          }
        }
        if (this.form.deviceModel1.length !== 0) {
          this.filterValueInit = this.filterValueInit === '' ? this.filterValueInit : this.filterValueInit.concat(';')
          for (var t8 = 0; t8 < this.form.deviceModel1.length; t8++) {
            if (t8 === 0) {
              this.filterValueInit = this.filterValueInit.concat('deviceModel' + '@#in@#' + this.form.deviceModel1[t8])
            } else {
              this.filterValueInit = this.filterValueInit.concat(',' + this.form.deviceModel1[t8])
            }
          }
        }
        if (this.form.displayName1.length !== 0) {
          this.filterValueInit = this.filterValueInit === '' ? this.filterValueInit : this.filterValueInit.concat(';')
          for (var t9 = 0; t9 < this.form.displayName1.length; t9++) {
            if (t9 === 0) {
              this.filterValueInit = this.filterValueInit.concat('displayName' + '@#in@#' + this.form.displayName1[t9])
            } else {
              this.filterValueInit = this.filterValueInit.concat(',' + this.form.displayName1[t9])
            }
          }
        }
        // if (this.form.brand1.length !== 0) {
        //   this.filterValueInit = this.filterValueInit === '' ? this.filterValueInit : this.filterValueInit.concat(';')
        //   for (var t10 = 0; t10 < this.form.brand1.length; t10++) {
        //     if (t10 === 0) {
        //       this.filterValueInit = this.filterValueInit.concat('brand' + '@#in@#' + this.form.brand1[t10])
        //     } else {
        //       this.filterValueInit = this.filterValueInit.concat(',' + this.form.brand1[t10])
        //     }
        //   }
        // }
        if (this.form.brand1 !== '') {
          this.filterValueInit = this.filterValueInit === '' ? this.filterValueInit : this.filterValueInit.concat(';')
          this.filterValueInit = this.filterValueInit.concat('brand' + '@#in@#' + this.form.brand1)
        }
        if (this.form.deviceParam.length !== 0) {
          this.filterValueInit = this.filterValueInit === '' ? this.filterValueInit : this.filterValueInit.concat(';')
          for (var t0 = 0; t0 < this.form.deviceParam.length; t0++) {
            if (t0 === 0) {
              this.filterValueInit = this.filterValueInit.concat('deviceParam' + '@#in@#' + this.form.deviceParam[t0])
            } else {
              this.filterValueInit = this.filterValueInit.concat(',' + this.form.deviceParam[t0])
            }
          }
        }
      }
      reportTemplate.filterValue = this.filterValueInit
      let _this = this
      let loadingInstance = _this.Loading.openLoading()
      ReportTemplateService.createReportTemplate(reportTemplate).then(result => {
        _this.Loading.closeLoading(loadingInstance)
        _this.InfoTip.successTip(_this, HelperUtil.getStatusCodeObjectByCode(_this.successCode.ADD_CODE))
        _this.close()
      }).catch(err => {
        _this.Loading.closeLoading(loadingInstance)
        this.InfoTip.errorTip(this, err)
      })
    },
    /**
     * @Description  : 提交校验
     * @author       : ls
     * @date         : 2020/4/23 16:37
     * @param        :
     * @return       :
     */
    totalCheck: function () {
      if (!this.reportTemplateNameCheck()) {
        return false
      }
      if (!this.subnetCheck()) {
        return false
      }
      switch (this.form.reportType) {
        case 0:
          if (!this.alarmDistributionXChange()) {
            return false
          }
          if (!this.alarmDistributionYChange()) {
            return false
          }
          break
        case 1:
          if (!this.alarmTrendChange()) {
            return false
          }
          break
        case 2:
          if (!this.alarmTopNChange()) {
            return false
          }
          break
        case 3:
          if (!this.performDistributionXChange()) {
            return false
          }
          if (!this.performDistributionYChange()) {
            return false
          }
          if (!this.performStaticType()) {
            return false
          }
          if (!this.performDistribution()) {
            return false
          }
          break
        case 4:
          if (!this.performTrendYCheck()) {
            return false
          }
          if (!this.performStaticType()) {
            return false
          }
          if (!this.performTrendCheck()) {
            return false
          }
          break
        case 5:
          if (!this.performTopXChange()) {
            return false
          }
          if (!this.performTopYChange()) {
            return false
          }
          if (!this.performStaticType()) {
            return false
          }
          if (!this.performTrendCheck()) {
            return false
          }
          break
      }

      return true
    },
    /**
     * @Description  : 名称校验
     * @author       : ls
     * @date         : 2020/5/6 13:32
     * @param        :
     * @return       :
     */
    reportTemplateNameCheck: function () {
      if (!this.check.textNullCheck(this.form.reportTemplateName)) {
        this.InfoTip.warningTip_alarm(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.TEXT_NULL_CODE), this.$t('ResourceManagement.templateName'))
        return false
      }
      if (!this.check.textLengthCheck(this.form.reportTemplateName)) return false
      return true
    },
    /**
     * @Description  : 子网校验
     * @author       : ls
     * @date         : 2020/4/23 13:11
     * @param        :
     * @return       :
     */
    subnetCheck: function () {
      var result = this.check.textNullCheck(this.form.subnet)
      if (!result) {
        this.InfoTip.warningTip(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.TEXT_NULL_CODE), this.$t('ResourceManagement.subnet'))
        return false
      }
      return true
    },
    /**
     * @Description  : SNMP协议校验
     * @author       : ls
     * @date         : 2020/4/23 16:46
     * @param        :
     * @return       :
     */
    SNMPVersionCheck: function () {
      var result = this.check.textNullCheck(this.form.snmpProtocolVersion)
      if (!result) {
        this.InfoTip.warningTip(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.TEXT_NULL_CODE), this.$t('ResourceManagement.SNMPProtocolVersion'))
        return false
      }
      return true
    },
    /**
     * @Description  : 关闭
     * @author       : ls
     * @date         : 2020/4/23 12:34
     * @param        :
     * @return       :
     */
    close: function () {
      this.command.done()
    },
    /**
     * @Description  : getAllSubnet
     * @author       : ls
     * @date         : 2020/4/25 17:13
     * @param        :
     * @return       :
     */
    getAllSubnet: function () {
      let _this = this
      SubnetService.getAllSubnetCollection().then(result => {
        // 成功
        _this.subnetList = Object.values(result)
      }).catch(err => {
        // 失败
        _this.InfoTip.errorTip(_this, err)
      })
    },
    /**
     * @Description  : 获取性能指标
     * @author       : ls
     * @date         : 2020/5/13 18:53
     * @param        :
     * @return       :
     */
    getPerformType: function () {
      let _this = this
      PerformanceStatisticService.getPerformTypeService().then(result => {
        _this.performTypeList = Object.values(result)
      }).catch(err => {
        _this.InfoTip.errorTip(_this, err)
      })
    },
    getAlarmTypeList: function () {
      let _this = this
      AlarmManagerService.getAlarmTypeList().then(result => {
        _this.optionsAlarmCause = Object.values(result)
      }).catch(err => {
        _this.InfoTip.errorTip(_this, err)
      })
    }
  },
  created: function () {
    this.check = legitimacyCheck()
    this.getAllSubnet()
    this.getAllDevice()
    this.getAllDeviceType()
    this.getAllDeviceModel()
    this.getPerformType()
    this.getAlarmTypeList()
  },
  // 初始化函数，加载数据
  mounted () {
    this.createElementDiscoveryVisible = true
  }
}
</script>

<style scoped lang="scss">
  /*!* 外层布局容器样式 *!*/
  .el-header {
    background-color: #f9fafc;
    color: #333;
    line-height: 40px;
  }

  #box{
    width:100%;
    height:100%;
    overflow:hidden;
  }
  .el-card__header {
    background-color: greenyellow;
  }

  /* .el-input {
     width: 330px;
   }*/

  /deep/ .el-textarea__inner{
    font-size: 12px;
  }
</style>
