<template>
<!--  待办工作详情-->
<div class="app-container">
  <el-form ref="form" :model="form" label-width="100px">
    <el-form-item label="来文标题 : ">
      <el-input v-model="form.fwtitle"></el-input>
    </el-form-item>
    <el-form-item label="来文单位 : ">
      <el-input v-model="form.fwdept"></el-input>
    </el-form-item>
    <el-form-item label="来文日期 : ">
      <el-input v-model="form.createTime"></el-input>
    </el-form-item>
    <el-form-item label="流水号 : ">
      <el-input ></el-input>
    </el-form-item>
    <el-form-item label="文件字号 : ">
      <el-input ></el-input>
    </el-form-item>
    <el-form-item label="紧急程度 : ">
      <el-input></el-input>
    </el-form-item>
    <el-form-item label="添加附件 : ">
      <el-upload
        class="upload-demo"
        action="https://jsonplaceholder.typicode.com/posts/"
        multiple
        :limit="3"
        :file-list="fileList">
        <el-button size="small" type="primary">点击上传</el-button>
      </el-upload>
    </el-form-item>

    <el-form-item label="收文原件 : ">
      <el-input ></el-input>
    </el-form-item>
    <el-form-item label="发文对象 : ">
      <el-input ></el-input>
    </el-form-item>
    <el-form-item>
      <el-button  type="primary" @click="submitToDo">同 意</el-button>
      <el-button type="danger" @click="deleteToDo">拒 绝</el-button>
    </el-form-item>
  </el-form>
</div>
</template>

<script>
  import { deleteToDoItem,submitToDoItem } from "@/api/activiti/form/fw";
    export default {
        name: "tododetails",
        data(){
            return{
                form:this.$route.query.bd,
                actkey:this.$route.query.id,
              // 遮罩层
              loading: true,
              fileList:[]
            }

        },
        created(){
          this.info();
        },
        methods:{

            info(row){
                console.log(this.$route.query.bd);
                // this.form = this.$route.query.id;
            },
          submitToDo(){
            this.loading = true;
            submitToDoItem(this.form.taskid).then(response => {
              this.msgSuccess("提交成功");
              this.$router.go(-1)// 返回 //关闭子页面
              this.$store.state.tagsView.visitedViews.splice(this.$store.state.tagsView.visitedViews.findIndex(item => item.path === this.$route.path), 1)
              this.$router.push(this.$store.state.tagsView.visitedViews[this.$store.state.tagsView.visitedViews.length - 1].path)
            })
          },
          //拒绝按钮
          deleteToDo(){
            this.$confirm('是否确认拒绝这这个申请吗?', '警告', {
              confirmButtonText: '确定',
              cancelButtonText: '取消',
              type: 'warning'
            }).then(() => {
               deleteToDoItem(this.form.taskid).then(response => {
                 this.msgSuccess("拒绝成功")
                 this.form={}
                 this.$router.go(-1)// 返回 //关闭子页面
                 this.$store.state.tagsView.visitedViews.splice(this.$store.state.tagsView.visitedViews.findIndex(item => item.path === this.$route.path), 1)
                 this.$router.push(this.$store.state.tagsView.visitedViews[this.$store.state.tagsView.visitedViews.length - 1].path)
               })

            }).catch(() => {
            });

          }

        },

      watch:{
        '$route':function(newUrl,oldUrl){
          if(newUrl!=oldUrl){
            this.form=this.$route.query.bd;
          }
        }
      },
    }
</script>

<style scoped>

</style>
