<template>
  <a-drawer
    :title="title"
    :width="width"
    placement="right"
    :closable="false"
    @close="close"
    :visible="visible">
    <adweb-enquiry-site-rule-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></adweb-enquiry-site-rule-form>
    <div class="drawer-footer">
      <a-button v-if="!disableSubmit"  @click="handleOk" type="primary" style="margin-bottom: 0;">提交</a-button>
    </div>
     <div class="side_close_btn">
          <a-button type="primary" icon="close" size="large" @click="handleCancel" />
        </div>
  </a-drawer>
</template>

<script>

  import AdwebEnquirySiteRuleForm from './AdwebEnquirySiteRuleForm'

  export default {
    name: 'AdwebEnquirySiteRuleModal',
    components: {
      AdwebEnquirySiteRuleForm
    },
    data () {
      return {
        title:"操作",
        width:800,
        visible: false,
        disableSubmit: false
      }
    },
    methods: {
      add () {
        this.visible=true
        this.$nextTick(()=>{
          this.$refs.realForm.add();
        })
      },
      edit (record) {
        this.visible=true
        this.$nextTick(()=>{
          this.$refs.realForm.edit(record);
        });
      },
      close () {
        this.$emit('close');
        this.visible = false;
      },
      submitCallback(){
        this.$emit('ok');
        this.visible = false;
      },
      handleOk () {
        this.$refs.realForm.submitForm();
      },
      handleCancel () {
        this.close()
      }
    }
  }
</script>

<style lang="less" scoped>
/** Button按钮间距 */
  .ant-btn {
    margin-left: 30px;
    margin-bottom: 30px;
    float: right;
  }
  .drawer-footer{
    position: absolute;
    bottom: 0;
    width: 100%;
    border-top: 1px solid #e8e8e8;
    padding: 10px 16px;
    text-align: right;
    left: 0;
    background: #fff;
    border-radius: 0 0 2px 2px;
  }
    .ant-drawer-open{
      /deep/ .ant-drawer-content{
        overflow: inherit;
        .side_close_btn{
          position: absolute;
          left: -60px;
          top: calc(50% - 60px);
          .ant-btn{
            margin: 0;
            width: 60px;
            height: 60px;
            border-radius: 0;
          }
        }
      }

    }
</style>
