<template>
  <div>
    <el-dialog
      title="代码生成"
      width="95vw"
      :visible.sync="dialogVisible"
      top="1vh"
    >
      <div class="header">
        <div class="steps">
          <el-steps :active="active" finish-status="success" align-center>
            <el-step title="单据信息"></el-step>
            <el-step title="数据源"></el-step>
            <el-step title="页面设计"></el-step>
            <el-step title="代码生成"></el-step>
          </el-steps>
        </div>
        <div class="button">
          <el-button size="small" @click="stepUp" v-if="active != 0">上一步</el-button>
          <el-button size="small" @click="nextStep" v-if="active != 3">下一步</el-button>
          <el-button size="small" type="primary">保存</el-button>
          <el-button size="small" @click="handleClose">取消</el-button>
        </div>
      </div>
      <div class="bottom">
          <information-editing v-if="active == 0"></information-editing>
          <data-source v-if="active == 1"></data-source>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import informationEditing from './codeGenerationPage/informationEditing'
import dataSource from './codeGenerationPage/dataSource'
export default {
  data() {
    return {
      active: 1,
    };
  },

  props: {
    dialogVisible: {
      type: Boolean,
      default: false,
    },
  },

  components: {
    informationEditing,
    dataSource
  },

  computed: {},

  mounted() {},

  methods: {
    handleClose() {
      this.$emit("close");
      this.active = 0;
    },
    stepUp() {
      this.active--
    },
    nextStep() {
      this.active++
    }
  },
};
</script>
<style scoped lang="scss">
::v-deep .el-dialog__body {
  padding: 20px 0;
}
::v-deep .el-dialog__headerbtn {
  display: none;
}
.steps {
  width: 550px;
  margin: 0 auto;
}
.header {
  position: relative;
  padding-bottom: 20px;
}
.button {
  padding: 10px 20px 0 0;
  position: absolute;
  top: 0;
  right: 0;
}
.bottom {
  height: 650px;
  background-color: #f2f2f2;
  position: relative;
}
</style>
