<template>
    <div>
        <el-dialog title="审核详情" v-if="visible" :visible.sync="visible" >
            <el-row style="text-align: right; margin-bottom: 10px" v-if="showButton">
                <el-button type="primary" @click="showProcessDiagram({procinstid: procinstid, taskid: taskid, programmecode: '审核详情'})" size="mini">流程轨迹</el-button>
            </el-row>
            <el-table
                :data="tableData3"  :header-cell-style="{background:'#e0f3ff',color:'#5f95b7'}"
                border
                stripe
                highlight-current-row="true"
                style="width: 100%"
            >
                <el-table-column align="center"  prop="procinstid" label="实例ID" ></el-table-column>
                <el-table-column align="center"  prop="taskName" label="处理节点" ></el-table-column>
                <el-table-column align="center"  prop="userName" label="处理人" ></el-table-column>
                <el-table-column align="center"  prop="approveDetail" label="处理结果" >
                    <template slot-scope="scope">
                        <el-tag type="success" v-if="scope.row.approve=='yes'">{{scope.row.approveDetail}}</el-tag>
                        <el-tag type="danger" v-if="scope.row.approve=='no'">{{scope.row.approveDetail}}</el-tag>
                    </template>
                </el-table-column>
                <el-table-column align="center"  prop="content" label="处理意见" ></el-table-column>
                <el-table-column align="center"  prop="time" label="处理时间" ></el-table-column>



            </el-table>

        </el-dialog>
        <process-diagram-dialog ref="processDiagramDialog"></process-diagram-dialog>
    </div>

</template>

<script>

// import moment from 'moment';
// //import util from '@/util'
import ProcessDiagramDialog from '../../../components/ProcessDiagramDialog'
export default {
  data() {
    return {
      items:[],
      visible:false,
      tableData3: [],
      selectedRows: [],
      procinstid: '',
      taskid: '',
      showButton: false,
    };
  },
  components: {
      ProcessDiagramDialog
  },
  created() {},
  methods: {
     init(idList, status, procinstid, taskid){
         this.procinstid = procinstid;
         this.taskid = taskid;
         this.visible = true;
         this.showButton = false;
         this.doSearch(idList, status);
     },
    doSearch(idList,status) {
        let self = this;
        if(!idList||status==0){
          this.tableData3 = [];
          return false;
        }
        var obj ={
          url:this.$url.activeti.getCommentsByProcinstid,
          data:{
            data: idList
          }
        };
        this.common.httpPost(obj,success);
        function success(data){
            self.tableData3 = data;
            if (self.tableData3.length > 0) {
                if (self.tableData3[0].approve !== 'yes' && self.tableData3[0].approve !== 'no'){
                    self.showButton = true;
                }
            }
        }
    },
      showProcessDiagram(row) {
          this.$refs.processDiagramDialog.showProcessDiagram(row)
      }
  }
};
</script>
