<template>
  <div id="main" class="h-all">
    <el-container class="h-all">
      <el-header height="auto">
        <!-- 通用工具栏 -->
        <div class="header-button-box">
          <el-button size = 'mini' icon="el-icon-circle-plus-outline" type="primary" @click="createElineTemplateInit" v-if="createAndCopyCommand.visible">{{$t('common.createBtn')}}</el-button>
          <el-button size = 'mini' icon="el-icon-document" type="primary" @click="copyElineTemplateInit" v-if="createAndCopyCommand.visible">{{$t('common.copyBtn')}}</el-button>
          <el-button size = 'mini' icon="el-icon-edit" type="primary" @click="updateElineTemplateInit" v-if="updateElineTemplateCommand.visible">{{$t('common.updateBtn')}}</el-button>
          <el-button size = 'mini' icon="el-icon-delete" type="primary" @click="deleteElineTemplateInit" v-if="deleteElineTemplateCommand.visible">{{$t('common.deleteBtn')}}</el-button>
        </div>
        <!-- 条件查询工具栏 -->
        <div class="header-search">
          <div class="search-input-box">
            <label>{{ $t("EveModelConfigurationManagement.ElineTemplateName") }}：</label>
            <el-input size = 'mini' :placeholder="$t('common.placeholder1')"  v-model="queryElineTemplateName" clearable></el-input>
          </div>
          <div class="search-input-box">
            <label>{{ $t("EveModelConfigurationManagement.serviceType") }}：</label>
            <el-select v-model="queryServiceType" size="mini" :placeholder="$t('common.placeholder1')" :clearable="true">
              <el-option
                v-for="item in ServiceTypeList"
                :key="item.serviceTypeID"
                :label="item.serviceTypeName"
                :value="item.serviceTypeID">
              </el-option>
            </el-select>
          </div>
          <div class="search-input-box">
            <label>{{ $t("EveModelConfigurationManagement.protectionMode") }}：</label>
            <el-select v-model="queryProtectionMode" size="mini" :placeholder="$t('common.placeholder1')" :clearable="true">
              <el-option
                v-for="item in protectionModeList"
                :key="item.value"
                :label="item.label"
                :value="item.value">
              </el-option>
            </el-select>
          </div>
          <div class="search-input-box">
            <el-button icon="el-icon-search" type="primary" size = 'mini' @click="queryElineTemplateByCondition" v-loading.fullscreen.lock="fullscreenLoading">{{$t('common.queryBtn')}}</el-button>
          </div>
        </div>
      </el-header>
      <!-- table数据表格 -->
      <el-main class="adapt-height-box">
        <el-table
          :empty-text="$t('common.noData')"
          header-row-class-name="table-header"
          cell-class-name="table-cell"
          class="adapt-height"
          height="auto"
          border
          tooltip-effect="dark"
          stripe
          ref="singleTable"
          :data="ElineTemplateList"
          highlight-current-row
          @current-change="handleCurrentChange"
          @selection-change="handleSelectionChange">
          <el-table-column
            type="selection"
            width="28">
          </el-table-column>
          <el-table-column
            prop="elineTemplateKey"
            label="主键"
            v-if="false">
          </el-table-column>
          <el-table-column
            prop="defaultFlag"
            :label="$t('EveModelConfigurationManagement.defaultFlag')"
            width="100"
            :formatter="formatDefaultFlag"
            :show-overflow-tooltip="true">
          </el-table-column>
          <el-table-column
            text-align="left"
            prop="elineTemplateName"
            :label="$t('EveModelConfigurationManagement.ElineTemplateName')"
            width="100"
            :show-overflow-tooltip="true">
          </el-table-column>
          <el-table-column
            text-align="left"
            prop="serviceTypeID"
            :label="$t('EveModelConfigurationManagement.serviceType')"
            :formatter="formatServerType"
            :show-overflow-tooltip="true">
          </el-table-column>
          <el-table-column
            prop="protectionMode"
            :label="$t('EveModelConfigurationManagement.protectionMode')"
            :formatter="formatProtectionMode"
            width="120"
            :show-overflow-tooltip="true">
          </el-table-column>
          <el-table-column
            prop="reversion"
            :label="$t('EveModelConfigurationManagement.reversion')"
            :formatter="formatReversionFlag"
            :show-overflow-tooltip="true">
          </el-table-column>
          <el-table-column
            prop="wtr"
            :label="$t('EveModelConfigurationManagement.wtr')"
            width="100"
            :formatter="formatWtr"
            :show-overflow-tooltip="true">
          </el-table-column>
          <el-table-column
            prop="oamInfo"
            :label="$t('EveModelConfigurationManagement.oamInfo')"
            :formatter="formatOamInfo"
            :show-overflow-tooltip="true">
          </el-table-column>
          <el-table-column
            prop="ccmInterval"
            :label="$t('EveModelConfigurationManagement.ccmInterval')"
            :formatter="formatCcmInterval"
            width="100"
            :show-overflow-tooltip="true">
          </el-table-column>
          <el-table-column
            prop="encapsulationType"
            :label="$t('EveModelConfigurationManagement.encapsulationType')"
            width="100"
            :formatter="formatEncapsulationType"
            :show-overflow-tooltip="true">
          </el-table-column>
          <el-table-column
            prop="l2AccessType"
            :label="$t('EveModelConfigurationManagement.l2AccessType')"
            width="100"
            :formatter="formatL2AccessType"
            :show-overflow-tooltip="true">
          </el-table-column>
          <el-table-column
            prop="vlanAccess"
            :label="$t('EveModelConfigurationManagement.vlanAccess')"
            width="100"
            :formatter="formatVlanAccess"
            :show-overflow-tooltip="true">
          </el-table-column>
          <el-table-column
            prop="vlanRangeStart"
            :label="$t('EveModelConfigurationManagement.vlanRangeStart')"
            width="120"
            :formatter="formatVlanRangeStart"
            :show-overflow-tooltip="true">
          </el-table-column>
          <el-table-column
            prop="vlanRangeEnd"
            :label="$t('EveModelConfigurationManagement.vlanRangeEnd')"
            width="120"
            :formatter="formatVlanRangeEnd"
            :show-overflow-tooltip="true">
          </el-table-column>
          <el-table-column
            prop="vlanSet"
            :label="$t('EveModelConfigurationManagement.vlanSet')"
            width="120"
            :show-overflow-tooltip="true">
          </el-table-column>
          <el-table-column
            prop="cosId"
            :label="$t('EveModelConfigurationManagement.cosId')"
            :formatter="formatCosId"
            :show-overflow-tooltip="true">
          </el-table-column>
          <el-table-column
            prop="limitedBandwidth"
            :label="$t('EveModelConfigurationManagement.limitedBandwidth')"
            :show-overflow-tooltip="true">
          </el-table-column>
          <el-table-column
            prop="qosProfile"
            :label="$t('EveModelConfigurationManagement.qosProfile')"
            width="100"
            :show-overflow-tooltip="true">
          </el-table-column>
        </el-table>
      </el-main>
    </el-container>

    <CommandExecuteContext v-bind:commands="commandContext"></CommandExecuteContext>

    <!--  使用更新对话框  -->
    <UpdateEveModelConfigurationManagementDialog
      :dialog_elineTemplateUpdate.sync="dialog_elineTemplateUpdate"
      :form.sync="form"
    ></UpdateEveModelConfigurationManagementDialog>
    <!--调用删除子组件-->
    <DeleteEveModelConfigurationManagementDialog
      :deleteList="deleteList"
    ></DeleteEveModelConfigurationManagementDialog>

  </div>
</template>

<script>
  import CreateEveModelConfigurationManagementDialog from '../DialogComponents/ElineDialog/CreateEveModelConfigurationManagementDialog.vue'
  import UpdateEveModelConfigurationManagementDialog from '../DialogComponents/ElineDialog/UpdateEveModelConfigurationManagementDialog.vue'
  import DeleteEveModelConfigurationManagementDialog from '../DialogComponents/ElineDialog/DeleteEveModelConfigurationManagementDialog.vue'
  import CDPService from '@/domain/services/Business/CDPService.js'
  import ServiceTypeService from '@/domain/services/Business/ServiceTypeService.js'
  import ElineTemplateService from '@/domain/services/Business/ElineTemplateService.js'
  import HelperUtil from "../../utils/HelperUtil";
  import CommandExecuteContext from '@/commands/CommandExecuteContext'
  import EveModelCommands from '@/commands/EveModelCommands'
  export default {
    components:{
      CommandExecuteContext
    },
    name: 'EveModelConfigurationManagementFather',
    data: function () {   //存放数据
      return {
        commandContext: {},
        //标记
        createAndCopyTitle: '',

        fullscreenLoading: false,

        //创建修改复制窗口是否打开
        dialog_elineTemplateCreate: false,
        dialog_elineTemplateUpdate: false,
        dialog_elineTemplateCopy: false,

        //-----------------表格数据过滤---------------------------------------
        //业务类型过滤
        ServiceTypeList: [],
        //保护模式过滤
        protectionModeList:[
          {
            value: 0,
            label: this.$t('EthernetELineServiceConfigurationManagement.unprotected')
          },
          {
            value: 1,
            label: this.$t('EthernetELineServiceConfigurationManagement.one2one')
          },
          {
            value: 2,
            label: this.$t('EthernetELineServiceConfigurationManagement.lspone2one')
          }
        ],
        //是否回滚过滤
         reversionFlag:[
          {
            value:0,
            label:this.$t('EveModelConfigurationManagement.is')
          },
          {
            value:1,
            label:this.$t('EveModelConfigurationManagement.no')
          }
        ],
        //oam选项过滤
        oamInfoFlag:[
          {
            value:0,
            label:this.$t('EveModelConfigurationManagement.is')
          },
          {
            value:1,
            label:this.$t('EveModelConfigurationManagement.no')
          }
        ],
        //ccm间隔时间过滤
        ccmIntervalList: [
          {
            ccmIntervalTime: '3.3min',
            value:1
          },
          {
            ccmIntervalTime: '10min',
            value:2
          },
          {
            ccmIntervalTime: '60min',
            value:3
          },
          {
            ccmIntervalTime: '100min',
            value:4
          },
          {
            ccmIntervalTime: '600min',
            value:5
          },
          {
            ccmIntervalTime: '6000min',
            value:6
          }
        ],
        //vlan类别过滤
        encapsulationTypeList:[
          {
            value: 0,
            label: this.$t('EthernetELineServiceConfigurationManagement.ethernetType')
          },
          {
            value: 1,
            label: this.$t('EthernetELineServiceConfigurationManagement.vlanType')
          }
        ],
        //l2AccessType类别过滤
        l2AccessTypeList:[
          {
            value: 0,
            label: "untag"
          },
          {
            value: 1,
            label: "dot1q"
          },
          {
            value: 2,
            label: "qinq"
          },
        ],
        //vlan设置方式过滤
        vlanAccessList:[
          {
            value:0,
            label: this.$t('EthernetELineServiceConfigurationManagement.vlanRange1')
          },
          {
            value:1,
            label: this.$t('EthernetELineServiceConfigurationManagement.vlanSet')
          }
        ],
        //cos-id过滤
        cosIdList: [
          {
            value: 0,
            label: '0'
          },
          {
            value: 1,
            label: '1'
          },
          {
            value: 2,
            label: '2'
          },
          {
            value: 3,
            label: '3'
          },
          {
            value: 4,
            label: '4'
          },
          {
            value: 5,
            label: '5'
          },
          {
            value: 6,
            label: '6'
          },
          {
            value: 7,
            label: '7'
          },
        ],
        defaultFlagList:[
          {
            value: 0,
            label: this.$t('EveModelConfigurationManagement.nonDefault')
          },
          {
            value: 1,
            label: this.$t('EveModelConfigurationManagement.default')
          },
        ],

        //-------------------剩余变量--------------------------------------------------
        //条件查询
        queryElineTemplateName:'',//模板名称
        queryServiceType:'',   //业务类型
        queryProtectionMode:'',//保护模式

        //------------------------------------------------------------------------------------------
        //弹框中的窗口是否可输入约束
        wtr_input_disable:'true',
        oaminfo_select_disable:'true',
        vlanRangeStart_input_disable:'true',
        vlanRangeEnd_input_disable:'true',
        vlanRangeSet_input_disable:'true',
        ccmInterval_select_disable:'true',

        //双向绑定弹出窗口input域
        form:{
          elineTemplateKey: "",
          elineTemplateName: "",
          serviceTypeID: "",
          protectionMode: "",
          reversion: "",
          wtr: "",
          oamInfo: "",
          ccmInterval: "",
          encapsulationType: "",
          l2AccessType:"",
          vlanAccess: "",
          vlanRangeStart: "",
          vlanRangeEnd: "",
          vlanSet: "",
          cosId: "",
          limitedBandwidth: "",
          qosProfile: "",
          defaultFlag: "",
        },
        //eline模板
        ElineTemplateList: [],
        //保存当前行数据
        currentRow: null,
        //保存多选行数据
        multipleSelection: [],

        //删除列表
        deleteList:[],
      }
    },
    //vue加载初始化函数，加载数据
    created:function(){
      console.log('业务模板管理界面初始化：')
      this.getAllElineTemplateInit()
      //获取下拉框业务类型信息
      this.getAllServiceType()
      //获取下拉框qos信息
      this.getAllCDPProfileCreation()
    },
    computed: {
      openTab () {
        return this.$store.state.openTab;
      },
      activeIndex:{
        get () {
          return this.$store.state.activeIndex;
        },
        set (val) {
          this.$store.commit('set_active_index', val);
        }
      },
      createAndCopyCommand (){
        return EveModelCommands.createAndCopyEveModelCommand(this.createAndCopyTitle, this.form, this.commandContext)
      },
      updateElineTemplateCommand(){
        return EveModelCommands.updateEveModelCommand(this.form, this.commandContext)
      },
      deleteElineTemplateCommand(){
        return EveModelCommands.deleteEveModelCommand(this.deleteList, this.commandContext)
      },
      queryNodeTypeChange(){
        this.reversionFlag[0].label=this.$t('EveModelConfigurationManagement.is');
        this.reversionFlag[1].label=this.$t('EveModelConfigurationManagement.no');
        this.oamInfoFlag[0].label=this.$t('EveModelConfigurationManagement.is');
        this.oamInfoFlag[1].label=this.$t('EveModelConfigurationManagement.no');
        this.protectionModeList[0].label=this.$t('EthernetELineServiceConfigurationManagement.unprotected');
        this.protectionModeList[1].label=this.$t('EthernetELineServiceConfigurationManagement.one2one');
        this.protectionModeList[2].label=this.$t('EthernetELineServiceConfigurationManagement.lspone2one');
        this.encapsulationTypeList[0].label=this.$t('EthernetELineServiceConfigurationManagement.ethernetType');
        this.encapsulationTypeList[1].label=this.$t('EthernetELineServiceConfigurationManagement.vlanType');
        this.vlanAccessList[0].label=this.$t('EthernetELineServiceConfigurationManagement.vlanRange1');
        this.vlanAccessList[1].label=this.$t('EthernetELineServiceConfigurationManagement.vlanSet');
      },
    },
    methods: {
      /**
       * @Description  ：单选一行，将所选行进行保存
       */
      handleCurrentChange(val) {
        this.currentRow = val;
      },

      /**
       * @Description  ：表格多选框改变时，将所选行进行保存
       */
      handleSelectionChange (val) {
        this.multipleSelection = val
      },

      /***
       * --------------表格数据过滤---------------------------------------------------------
       */

      /**
       * @Description  :业务类型过滤
       */
      formatServerType: function (row, column) {
        for (var j = 0; j < this.ServiceTypeList.length; j++) {
          if (row.serviceTypeID == (this.ServiceTypeList[j]['serviceTypeID'])) {
            return this.ServiceTypeList[j]['serviceTypeName']
          }
        }
      },

      /**
       * @Description  ：保护模式过滤
       */
      formatProtectionMode: function (row, column){
        for(var i= 0;i<this.protectionModeList.length;i++){
          if(this.protectionModeList[i]['value']==row.protectionMode){
            return this.protectionModeList[i]['label']
            break;
          }
        }
      },

      /**
       * @Description  ：是否回滚过滤
       */
      formatReversionFlag: function (row, column){
        for(var i= 0;i<this.reversionFlag.length;i++){
          if(this.reversionFlag[i]['value']==row.reversion){
            return this.reversionFlag[i]['label']
            break;
          }
        }
      },

      /**
       * @Description  ：回滚等待时间过滤
       */
      formatWtr:function (row, column) {
        if(row.wtr === -999){
          return ""
        }
        return row.wtr;
      },

      /**
       * @Description  ：oamInfo选项过滤
       */
      formatOamInfo: function (row, column){
        if(row.oamInfo === -999){
          return ""
        }
        for(var i= 0;i<this.oamInfoFlag.length;i++){
          if(this.oamInfoFlag[i]['value']==row.oamInfo){
            return this.oamInfoFlag[i]['label']
            break;
          }
        }
      },

      /**
       * @Description  ：ccm间隔时间过滤
       */
      formatCcmInterval:function (row, column) {
        if(row.ccmInterval === -999){
          return ""
        }
        for (var i = 0; i < this.ccmIntervalList.length; i++) {
          if (this.ccmIntervalList[i]['value'] === row.ccmInterval) {
            return this.ccmIntervalList[i]['ccmIntervalTime'];
            break;
          }
        }
      },

      /**
       * @Description  ：vlan类别过滤
       */
      formatEncapsulationType: function (row, column){
        for(var i= 0;i<this.encapsulationTypeList.length;i++){
          if(this.encapsulationTypeList[i]['value']==row.encapsulationType){
            return this.encapsulationTypeList[i]['label']
            break;
          }
        }
      },

      /**
       * @Description  ：vlan协议过滤
       */
      formatL2AccessType:function (row, column) {
        if(row.l2AccessType === -999){
          return ""
        }
        for (let i = 0; i < this.l2AccessTypeList.length; i++) {
          if (this.l2AccessTypeList[i]['value'] === row.l2AccessType) {
            return this.l2AccessTypeList[i]['label'];
            break;
          }
        }
      },

      /**
       * @Description  ：vlan设置方式过滤
       */
      formatVlanAccess: function (row, column){
        if(row.vlanAccess === -999){
          return ""
        }
        for(var i= 0;i<this.vlanAccessList.length;i++){
          if(this.vlanAccessList[i]['value'] === row.vlanAccess){
            return this.vlanAccessList[i]['label'];
            break;
          }
        }
      },

      /**
       * @Description  ：vlan-range起点过滤
       */
      formatVlanRangeStart:function (row, column) {
        if(row.vlanRangeStart === -999){
          return ""
        }
        return row.vlanRangeStart;
      },

      /**
       * @Description  ：vlan-range终点过滤
       */
      formatVlanRangeEnd:function (row, column) {
        if(row.vlanRangeEnd === -999){
          return ""
        }
        return row.vlanRangeEnd;
      },

      /**
       * @Description  ：cosId设置方式过滤
       */
      formatCosId: function (row, column) {
        for (let i = 0; i < this.cosIdList.length; i++) {
          if (this.cosIdList[i]['value'] === row.cosId) {
            return this.cosIdList[i]['label'];
            break;
          }
        }
      },

      /**
       * @Description  ：defaultFlag是否为默认模板过滤
       */
      formatDefaultFlag:function (row, column) {
        if(row.defaultFlag === 1){
          return this.$t('EveModelConfigurationManagement.default');
        }
      },

      /***
       * ---------------获取数据-------------------------------------------------------------------
       */

      /**
       * @Description  ：获取下拉框所有业务类型消息
       * @date         : 2019/03/19 15:20
       */
      getAllServiceType: function (){
        console.log('获取全部业务类型信息：')
        //从domin处获取
        let _this = this
        ServiceTypeService.getAllServiceTypeCollection().then(result => {
          //成功
          _this.ServiceTypeList = Object.values(result)
        }).catch(err => {
          //失败
          _this.InfoTip.errorTip(_this, err);
        })
      },

      /**
       * @Description  ：获取业务模板信息
       * @date         : 2019/03/19 15:22
       */
      getAllElineTemplateInit: function () {
        console.log('获取全部业务模板信息：')
        //从domin处获取
        let _this = this
        ElineTemplateService.getAllElineTemplateCollection().then(result => {
          //成功
          _this.ElineTemplateList = Object.values(result)
          _this.elineTemplateShow();
        }).catch(err => {
          //失败
          _this.InfoTip.errorTip(_this, err);
        })
      },

      /**
       * @Description  ：增删改后调用，重新加载table
       * @date         : 2019/03/19 15:24
       */
      getAllElineTemplate: function (vue) {
        console.log('获取全部服务器信息：')
        //从domin处获取
        let _this = this;
        ElineTemplateService.getAllElineTemplateCollection().then(result => {
          //成功
          vue.ElineTemplateList = Object.values(result)
          vue.elineTemplateShow();
        }).catch(err => {
          _this.InfoTip.errorTip(_this, err);
          //失败
        })
      },

      /***
       *  -------------操作初始化--------------------------------------------------------------------
       */

      /**
       * @Description  ：创建业务模板初始化
       * @date         : 2019/03/19 15:54
       */
      createElineTemplateInit:function () {
        this.createAndCopyTitle = '业务模板的创建';

        this.form.elineTemplateKey = '';
        this.form.elineTemplateName = '';
        this.form.serviceTypeID = '';
        this.form.protectionMode = '';
        this.form.reversion = '';
        this.form.wtr = '';
        this.form.oamInfo = '';
        this.form.ccmInterval = '';
        this.form.encapsulationType = '';
        this.form.l2AccessType = '';
        this.form.vlanAccess = '';
        this.form.vlanRangeStart = '';
        this.form.vlanRangeEnd = '';
        this.form.vlanSet = '';
        this.form.cosId = '';
        this.form.limitedBandwidth = '';
        this.form.qosProfile = '';
        this.form.defaultFlag = '';
        this.createAndCopyCommand.execute();
      },

      /**
       * @Description  ：复制业务模板信息初始化
       * @date         : 2019/03/19 16:31
       */
      copyElineTemplateInit: function () {
        if(this.multipleSelection.length === 0){
          this.InfoTip.warningTip(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.COPY_SELECT_CODE))
          return;
        }else if(this.multipleSelection.length > 1){
          this.InfoTip.warningTip(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.COPY_ONLY_ONE_CODE))
          return;
        }else{
          this.createAndCopyTitle = '业务模板的复制';

          this.currentRow = this.multipleSelection[0];

          this.form.elineTemplateKey = this.currentRow.elineTemplateKey;
          this.form.elineTemplateName = this.currentRow.elineTemplateName;
          this.form.serviceTypeID = this.currentRow.serviceTypeID;
          this.form.protectionMode = this.currentRow.protectionMode;
          this.form.reversion = this.currentRow.reversion;
          this.form.wtr = this.currentRow.wtr;
          this.form.oamInfo = this.currentRow.oamInfo;
          this.form.ccmInterval = this.currentRow.ccmInterval;
          this.form.encapsulationType = this.currentRow.encapsulationType;
          this.form.l2AccessType = this.currentRow.l2AccessType;
          this.form.vlanAccess = this.currentRow.vlanAccess;
          this.form.vlanRangeStart = this.currentRow.vlanRangeStart;
          this.form.vlanRangeEnd = this.currentRow.vlanRangeEnd;
          this.form.vlanSet = this.currentRow.vlanSet;
          this.form.cosId = this.currentRow.cosId;
          this.form.limitedBandwidth = this.currentRow.limitedBandwidth;
          this.form.qosProfile = this.currentRow.qosProfile;
          this.form.defaultFlag = this.currentRow.defaultFlag;
          this.createAndCopyCommand.execute();
        }
      },

      /**
       * @Description  ：修改业务模板信息初始化
       * @date         : 2019/03/19 16:03
       */
      updateElineTemplateInit: function () {
        if(this.multipleSelection.length === 0){
          this.InfoTip.warningTip(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.UPDATE_SELECT_CODE))
          return;
        }else if(this.multipleSelection.length > 1){
          this.InfoTip.warningTip(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.UPDATE_SELECT_CODE))
          return;
        }else{
          this.currentRow = this.multipleSelection[0];

          this.form.elineTemplateKey = this.currentRow.elineTemplateKey;
          this.form.elineTemplateName = this.currentRow.elineTemplateName;
          this.form.serviceTypeID = this.currentRow.serviceTypeID;
          this.form.protectionMode = this.currentRow.protectionMode;
          this.form.reversion = this.currentRow.reversion;
          this.form.wtr = this.currentRow.wtr;
          this.form.oamInfo = this.currentRow.oamInfo;
          this.form.ccmInterval = this.currentRow.ccmInterval;
          this.form.encapsulationType = this.currentRow.encapsulationType;
          this.form.l2AccessType = this.currentRow.l2AccessType;
          this.form.vlanAccess = this.currentRow.vlanAccess;
          this.form.vlanRangeStart = this.currentRow.vlanRangeStart;
          this.form.vlanRangeEnd = this.currentRow.vlanRangeEnd;
          this.form.vlanSet = this.currentRow.vlanSet;
          this.form.cosId = this.currentRow.cosId;
          this.form.limitedBandwidth = this.currentRow.limitedBandwidth;
          this.form.qosProfile = this.currentRow.qosProfile;
          this.form.defaultFlag = this.currentRow.defaultFlag;
          this.defaultFlag_select_disable = true
          this.updateElineTemplateCommand.execute();
        }
      },

      /**
       * @Description  ：删除业务模板信息初始化（支持批量）
       * @date         : 2019/03/19 16:36
       */
      deleteElineTemplateInit:function () {
        if(this.multipleSelection.length === 0){
          this.InfoTip.warningTip(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.DELETE_SELECT_CODE))
          return;
        }else{
          this.deleteList = new Array()
          for(var i= 0; i < this.multipleSelection.length; i++){
            this.deleteList[i]=this.multipleSelection[i]['elineTemplateKey'];
          }
          this.deleteElineTemplateCommand.execute();
        }
      },

      /**
       * @Description  ：条件查询
       * @date         : 2019/03/19 17:06
       */
      queryElineTemplateByCondition: function () {
        if(this.queryElineTemplateName === ''&& this.queryServiceType === '' && (parseInt(this.queryProtectionMode).toString()==="NaN") ){
          //所有查询条件为空点击查询--》重新刷新表格
          this.$options.methods.getAllElineTemplate(this);
          this.InfoTip.successTip(this,HelperUtil.getStatusCodeObjectByCode(this.successCode.QUERY_CODE));
          return;
        }
        let selectList = new Array();
        if(this.queryElineTemplateName !== ''){
          selectList.push({ quaryAttribute:'elineTemplateName',
            compareSymbol:"like",
            compareValue:this.queryElineTemplateName,})
        }
        if(this.queryServiceType !== '' && this.queryServiceType !== null){
          selectList.push({ quaryAttribute:'serviceTypeID',
            compareSymbol:"==",
            compareValue:this.queryServiceType,})
        }
        if(parseInt(this.queryProtectionMode).toString() !== "NaN"){
          selectList.push({ quaryAttribute:'protectionMode',
            compareSymbol:"==",
            compareValue:this.queryProtectionMode,})
        }
        let _this = this
        //按条件查询
        let loadingInstance = _this.Loading.openLoading();
        ElineTemplateService.conditionQueryElineTemplate(selectList).then(result => {
          //成功
          _this.ElineTemplateList = Object.values(result)
          _this.elineTemplateShow();
          _this.Loading.closeLoading(loadingInstance);
          _this.InfoTip.successTip(_this,HelperUtil.getStatusCodeObjectByCode(_this.successCode.QUERY_CODE));
        }).catch(err => {
          //失败
          _this.Loading.closeLoading(loadingInstance);
          _this.InfoTip.errorTip(_this, err);
        })
      },

      /**
       * @Description  ：业务模板显示调整
       * @date         : 2019/03/19 15:59
       */
      elineTemplateShow:function () {
        //选择默认模板，将其移到顶部
        let template_default = "";
        for (let i = 0; i < this.ElineTemplateList.length; i++) {
          if (this.ElineTemplateList[i].defaultFlag === 1) {
            template_default = this.ElineTemplateList[i];
            this.ElineTemplateList.splice(i, 1);
            break;
          }
        }
        if(template_default !== ""){
          this.ElineTemplateList.unshift(template_default);
        }
      },
    },
    watch: {
      commandContext(newVal, oldVal){
        if(JSON.stringify(newVal) === '{}'){
          this.getAllElineTemplateInit()
        }
        deep: true
      },
      '$i18n.locale' () {
        this.queryNodeTypeChange()
      },
    },
  }
</script>

<style scoped>
</style>
