
<template>
  <el-drawer
    v-loading="loading"
    title="作品审核"
    size="600px"
    :append-to-body="false"
    :destroy-on-close="true"
    :visible="true"
    :modal-append-to-body="false"
    :before-close="handleClose"
    :wrapperClosable="false"
    ref="drawer_close">
    <el-form label-width="100px" v-loading="loading" style="padding-right: 20px;margin-top: 20px" class="qs-form-add">
      <el-form-item label="拒绝理由">
        <el-input type="textarea" v-model="ruleForm.name"></el-input>
      </el-form-item>
      <el-form-item>
        <el-tag @click="set_name('非源码')">非源码</el-tag>
        <el-tag @click="set_name('价格明显不合理')">价格明显不合理</el-tag>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="refuse()">确认拒绝</el-button>
      </el-form-item>
    </el-form>
  </el-drawer>
</template>

<script>
  export default {
    props: {
      pro_id: {
        default: 0
      },
      back:{
        type:Object
      },
    },
    data() {
      return {
        ruleForm: {
          name:"",
        },
      };
    },
    methods: {
      set_name:function (name) {
        this.ruleForm.name=name;
      },
      handleClose:function()
      {
        this.back.drawer_obj.user_workfile_check=false;
      },
      async refuse(){
        if(!(this.pro_id>0))
        {
          this.$message({
            type: 'error',
            message: '项目编号不存在!'
          });
          return ;
        }

        if(!this.ruleForm.name)
        {
          this.$message({
            type: 'error',
            message: '拒绝的原因必填!'
          });
          return ;
        }
        this.loading = true;
        let res = await this.$post("/api/admin/UserWorks/changeWorkFile", {id: this.pro_id, type: 2,content:this.ruleForm.name});
        if (res && res.status === 1) {
          this.$message({
            type: 'success',
            message: '操作成功!'
          });
          this.back.drawer_obj.user_workfile_check=false;
          this.back.getAuditList();
          this.back.getTableData();
          this.loading = false;
        }
      }
    }
  };
</script>

<style scoped>
  .el-tag {
    cursor: pointer;
  }
</style>
