<template>
  <div >
    <el-button  @click="submit" size="mini" slot="reference" type="primary" v-if="data.status=='新建' && tool.checkAuth($route.name,'submit') && !disabled && data.status">提 交</el-button>
    <el-button @click="submit" size="mini" slot="reference" type="primary" v-if="data.status=='已提交' && tool.checkAuth($route.name,'check') && data.status">审 核</el-button>
  </div>
</template>

<script>
export default {
  props:['data','disabled'],
  name: '',
  data() {
    return {
      checkVisible:false,
      refresh:true
    };
  },
  computed:{
  },
  watch:{

  },
  created() {
    console.log('eeee',this.disabled);
  },
  methods: {
    submit () {
      if (this.data.status == '新建') {
        this.$confirm('确定进行提交操作吗？','提示',{
          confirmButtonText:'确定',
          cancelButtonText:'取消'
        }).then(async () => {
          let res = await this.$api.requested({
            "id": 20221121202802,
            "content": {
                "sa_contractids": [this.data.sa_contractid]
            },
          })
          this.tool.showMessage(res,() => {
            this.$emit('onSuccess')
          })
        })
      } else {
        this.$confirm('确定进行审核操作吗？','提示',{
          confirmButtonText:'确定',
          cancelButtonText:'取消'
        }).then(async () => {
          let res = await this.$api.requested({
            "id": 20221121203102,
            "content": {
                "type":1,//0：不通过，1：通过
                "sa_contractid": this.data.sa_contractid
            },
          })
          this.tool.showMessage(res,() => {
            this.$emit('onSuccess')
          })
        })
      }
    },
  },
};
</script>

<style scoped>
.box p {
  line-height: 40px;
  text-align: center;
}
.box p:hover {
  background: #EBF1FE;
  color: #6191F8;
  cursor: pointer;
}
</style>
