<template>
  <div>
    <el-button  size="mini" @click="onShow">{{data.isused === 1?'停 用':'启 用'}}</el-button>
    <el-dialog
        title="提示"
        :visible.sync="dialogVisible"
        width="25%"
        append-to-body
    >
      <span>模板已经被使用，确定停用该模板吗?</span>
      <span slot="footer" class="dialog-footer">
    <el-button @click="dialogVisible = false">取 消</el-button>
    <el-button type="primary" @click="onsubmit()">确 定</el-button>
  </span>
    </el-dialog>
  </div>
</template>

<script>
export default {
  name: "isUsed",
  props:["data"],
  data(){
    return{
      dialogVisible:false
    }
  },
  methods:{
    onShow(){
      console.log(this.data)
      this.dialogVisible = true
    },
    async onsubmit(){
      const res = await this.$api.requested({
        "id":"20221104095004",
        "content": {
          "sa_projstagetempid": this.data.sa_projstagetempid,
          "isused":this.data.isused === 1?0:1
        }
      })
      this.dialogVisible = false
      this.$emit("onSuccess")
    }
  }
}
</script>

<style scoped>

</style>