<template>
  <div >
    <el-button slot="reference" :type="!disabled ?'':'primary'" size="mini" :disabled="!disabled " @click="dialogTableVisible=true" >作 废</el-button>
    <el-dialog title="作废项目" append-to-body :visible.sync="dialogTableVisible" width="25%">
      <el-row :gutter="20">
        <el-form label-position="right" ref="form" :rules="rules" inline label-width="100px" :model="form" size="small">
          <el-col :span="24">
            <el-form-item label="作废原因" prop="deletereason">
              <el-input v-model="form.deletereason" placeholder="请输入作废原因名称"></el-input>
            </el-form-item>
          </el-col>
        </el-form>
      </el-row>
      <span slot="footer" class="dialog-footer">
        <div>
          <el-button @click="dialogTableVisible = false" size="small">取 消</el-button>
          <el-button type="primary" @click="submit" size="small">确 定</el-button>
        </div>
      </span>
    </el-dialog>
  </div>
</template>

<script>
/* 
id:数据id
nameId:接口id
nameKey:接口字段
 */
export default {
  data () {
    return {
      dialogTableVisible:false,
      form: {
        "sa_projectids":[],
        "deletereason": ""
      },
      rules:{
        deletereason: [
          { required: true, message: '请填写作废原因', trigger: 'blur' },
        ],
      }
    }
  },
  props: ['id',"disabled","rowData"],
  methods: {
    async submit() {
      this.form.sa_projectids = [this.id]
      let res = await this.$api.requested({
        "id": 20221020144302,
        "content": this.form
      })
      this.tool.showMessage(res,() => {
        this.$emit('deleteSuccess')
        this.dialogTableVisible = false
      })
    },
  },
  created () {
  }
}

</script>
<style scoped>
/deep/.el-form-item {
  width: 100% !important;
}
/deep/.el-form-item__content {
  width: calc(100% - 100px);
}
</style>