<template>
  <el-container class="tablecon">
    <el-header class="header">
      <p class="title">基本信息</p>
    </el-header>
    <el-main>
      <el-form :ref="type" :rules="rule" :model="form" label-width="120px">
        <slot :form="form" name="content"></slot>
      </el-form>
    </el-main>
    <el-footer class="footer">
      <template v-if="justshow">
        <el-button type="primary" @click="$emit('cancel')">返回</el-button>
      </template>
      <template v-else>
        <el-button @click="$emit('cancel')">取消</el-button>
        <el-button type="primary" @click="emitsave">保存</el-button>
      </template>
    
    </el-footer>
  </el-container>
</template>

<script>
export default {
  props:['form','rule',"type",'justshow','status'],
  data(){
    return {
      isAudit:this.$route.query.isAudit,
      lock:false
    }
  },
  computed:{
    staStr(){
      let sta = Number(this.status)
      let flag = ''
      if (sta===3) {
        flag = '已审核'
      }

      if (this.isAudit&&sta===1) {
        flag = '待审核非查看'
      }

      if (sta===2) {
        flag = '审核不通过'
      }

      return flag ?flag: this.statusStr[sta]
    }

  },
  methods: {
    emitsave(){
      if (!this.lock) {
        this.lock = true
        setTimeout(() => {
          this.lock = false
        }, 3000);
        console.log(111111);
        this.$emit('save')
        
      }
    }
  },
}
</script>

<style lang="less" scoped>
.tablecon{
  height: calc(100% - 80px);
 @h:50px;
  .header{
    background: #fafafa;
    height: @h!important;
    .title{
      color: #532F1C;
      font-size: 16px;
      line-height: @h;
      height: @h;
      margin-bottom: 0;
    }

  }

  .footer{
    text-align: center;
    display: flex;
    align-items: center;
    position: relative;
    justify-content: center;
    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
    button{
      margin: 0 10px;
    }
  }
}
</style>