<template>
  <div class="app-container">
    <task-info ref="taskInfo" :history="true"></task-info>
    <el-divider v-if="task.status != 0" content-position="left"><h3>审核信息</h3></el-divider>
    <el-form ref="form" label-width="100px" label-position="left">
      <el-row v-if="task.status != 0">
        <el-col :span="12">
          <el-form-item label="审核状态" prop="status">
            <audit-status :status="task.status">  </audit-status>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="审核时间" prop="auditTime">
            <span>{{task.auditTime}}</span>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row v-if="task.status != 0">
        <el-col :span="24">
          <el-form-item label="审核意见" prop="status">
            <span>{{task.auditOpinion}}</span>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <div style="width: 1200px;display: inline-block;text-align: center;margin-top: 10px;">
      <el-button type="primary" v-if="task.status == 2" @click="publishTask" class="btn-yellow">修改并重新发布</el-button>
      <el-button type="warning" @click="back" class="btn-blue">返回
      </el-button>
    </div>
    <crowdsource-task  v-show="task.status == 2" ref="crowdsourceTask"></crowdsource-task>
  </div>
</template>

<script>
  import {getApply} from "@/api/crowdsource/crowdsource";
  import AuditStatus from "../../../components/enum/AuditStatus";
  import TaskInfo from "../../../components/TaskInfo";
  import CrowdsourceTask from "../../../components/CrowdsourceTask";

  export default {
    name: "crowdsourceAuditDetail",
    components: {AuditStatus, TaskInfo, CrowdsourceTask},
    data() {
      return {
        // 遮罩层
        loading: true,
        task:{},
      }
    },
    methods: {
      publishTask(){
        this.$refs.crowdsourceTask.openDialog(this.task);
      },
      back(){
        this.$store.dispatch("tagsView/delView", this.$route);
        this.$router.push({ path: "/crowdsource/myCrowdsource" });
      }
    },
    created() {
      let applyId = this.$route.params && this.$route.params.id;
      getApply(applyId).then(response => {
        this.task = response.data;
        this.$refs.taskInfo.setTask(this.task);
      });
    },
    computed: {}
  }
</script>

<style scoped>
</style>
