whiteList.vue 1.89 KB
<template>
  <GLDialog
      mode="big"
      class="muti link"
      bigTitle="白名单"
      :hasFooter="true"
      :before-close="handleClose"
      :visible.sync="whiteListObj.show"
      @onOk="handleConfirm"
      @onCancel="handleClose"
  >
    <div class="tabs">
      <GLTabs
          v-model="currentComponent"
          :tabPaneList="tabPaneList"
          @tab-click="handleClick"
      ></GLTabs>
    </div>
    <div class="component">
      <component
          :is="currentComponent"
          :DetailObj="whiteListObj"
          v-if="currentComponent"
          ref="componentRef"
      ></component>
    </div>
  </GLDialog>
</template>

<script type='text/ecmascript-6'>

import WhiteListImport from "./whiteListImport";
import WhiteListSearch from "./whiteListSearch";
export default {
  name: '',
  components: {
    WhiteListSearch,
    WhiteListImport  },
  props: {
    whiteListObj: {
      type: Object,
      default: () => { }
    }
  },
  data () {
    return {
      currentComponent: 'WhiteListSearch',
      tabPaneList: [
        {
          label: '白名单列表',
          name: 'WhiteListSearch'
        },
        {
          label: '导入白名单',
          name: 'WhiteListImport'
        },
      ],
    }
  },
  mounted () {
    // this.currentComponent = this.tabPaneList[0].name;
  },
  methods: {
    handleConfirm(){
      if (this.currentComponent == 'WhiteListSearch'){
        this.$message.success('确定成功')
        this.handleClose()
      }
      if (this.currentComponent == 'WhiteListImport'){
        this.$refs.componentRef.handleConfirm()
      }

    },
    handleClose () {
      this.$emit('update:whiteListObj', {
        id:this.whiteListObj.id,
        show:false
      })
      this.currentComponent = this.tabPaneList[0].name;
    },

  }
}
</script>

<style scoped lang='scss'>
.link {
  /deep/.el-form-item--small {
    width: fit-content;
  }
}
</style>