<template>
  <el-dialog
    title="审批申请"
    :visible.sync="visible"
    width="60%"
    :before-close="onClose"
    append-to-body
    class="el-dialogDeep"
    :close-on-click-modal="false"
    v-dialog-drag
  >
    <slot name='content'></slot>
    <avue-form :option="option" v-model="query"></avue-form>
    <span slot="footer" class="dialog-footer">
      <el-button @click="onClose()">取 消</el-button>
      <el-button @click="onClose()" type="primary">提交审核</el-button>
    </span>
  </el-dialog>
</template>

<script>
export default {
  data() {
    return {
      visible: false,
      query: {},
      option: {
        menuBtn:false,
        column: [
          {
            label: "理由",
            prop: "reason",
            type:'textarea',
            span:24,
            rules: [
              {
                required: true,
                message: "请输入理由",
                trigger: "blur"
              }
            ]
          }
        ]
      }
    };
  },
  props: {
    switchDialog: {
      type: Boolean,
      default: false
    }
  },
  methods: {
    onClose() {
      this.visible = false;
      Object.assign(this.$data, this.$options.data());
      this.$emit("onClose", false);
    }
  },
  watch: {
    switchDialog: function(i) {
      this.visible = i;
    }
  }
};
</script>

<style lang="scss" scoped></style>
