<template>
  <div v-if="resuletshow">
      <div class="ls-btn-row" style="color: #357FB9;padding: 20px 0px 15px; font-size: 16px;font-weight: bold;">
        <span>处理信息表</span>
      </div>
    <table class="ls-table-comm">
      <tbody>
        <tr>
          <td style="width: 16%;">完成状态</td>
          <td colspan="5">{{reviewerParam.resultName}}</td>
        </tr>
        <tr>
          <td>处理人员</td>
          <td colspan="5">{{reviewerParam.creater}}</td>
        </tr>
        <tr>
          <td>处理时间</td>
          <td colspan="5">{{reviewerParam.createTime}}</td>
        </tr>
        <tr>
          <td>备注信息</td>
          <td colspan="5">{{reviewerParam.content}}</td>
        </tr>
      </tbody>
    </table>
  </div>
</template>

<script>
  import commonSelectList from '../common/commonSelectList.js'
  export default {
    name: 'review-form',
    props:{
      detailStatus: {
        type: Object,
        default: () => {
          return {
          }
        }
      },
    },
    data() {
      return {
        resuletshow:false,//如果没有数据就隐藏处理信息表
        reviewerParam: {
          result:"",
          creater:"",
          createTime:"",
          content:""
        },
        param:{
          busId:"",
          busStatus:"",
          content :"",
          createTime:"",
          creater:"",
          result:"",
          reviewerType:"",
          status:"Y",
        },
        latestTime:"",
        resultName:[],
      }
    },
    created() {
// this.reviewerData()
      // this.reviewerData()

    },
    methods: {
      //获取当前时间
      timeObtain(){
        let dateTime
        let yy = new Date().getFullYear()
        let mm = new Date().getMonth() + 1
        let dd = new Date().getDate()
        let hh = new Date().getHours()
        let mf = new Date().getMinutes() < 10 ? '0' + new Date().getMinutes() :
          new Date().getMinutes()
        let ss = new Date().getSeconds() < 10 ? '0' + new Date().getSeconds() :
          new Date().getSeconds()
        dateTime = yy + '-' + mm + '-' + dd + ' ' + hh + ':' + mf + ':' + ss
        console.log(dateTime)
        this.latestTime = dateTime
      },
      //获取最新批阅信息
     async bresultData(){
        this.resultName = await commonSelectList.initDictDataGet(this, 'Crm_Task_Operate');
        console.log(this.resultName)
      },
      reviewerData() {
        this.bresultData()
        this.timeObtain()
        let that=this

        this.param = {
          busId: that.detailStatus.busId,
          commentType: "1",
          content: that.param.content,
          reviewStatus: "dealing",
          status: "1",
          latestTime: this.latestTime
        }
        this.$ajax.post({
          domain: 'crmUrl',
          url: "reviewer.getNewestReviewer",
          data: JSON.stringify(this.param),
          success: function(res) {
            console.log(res)
            if (res.errorCode === 200) {
              if (res.data!=""&&res.data!=undefined&&res.data!=null) {
                this.resuletshow=true
                this.reviewerParam=res.data
                for (var i = 0; i < this.resultName.length; i++) {
                  if (this.resultName[i].ext2== this.reviewerParam.result) {
                    this.reviewerParam.result=this.resultName[i].key
                  }
                }
              }


            } else {
              this.$message.error(res.msg)
            }
          }.bind(this),
          error: function(res) {
            this.$message.error(res.msg)
          }
        })
      }
    },
    watch: {
      detailStatus: {
        handler: function(val) {
          console.log(val)
          this.reviewerData()
        },
        deep: true
      },
    }
  }
</script>

<style>

</style>
