<template>
  <div>
    <el-button type="text" size="mini" @click="onShow" :disabled="!tool.checkAuth($route.name,'assessManage') || !disabled">评估记录</el-button>
    <el-drawer
        title="评估记录"
        :visible.sync="drawer"
        size="600px"
        direction="rtl"
        :show-close="false"
        append-to-body
        @close="drawer = false"
        >
      <div class="drawer__panel">
        <div  class="container">
          <div v-if="recordList.length === 0">
            <el-empty description="暂无记录" :image-size="40"></el-empty>
          </div>
          <div>
            <el-timeline>
              <el-timeline-item
                  v-for="i in recordList" :key="i.index"
              >
                <div slot="dot" class="dot"></div>
                <div class="step__panel normal-margin">
                  <div class="flex-align-center flex-between" style="margin-bottom:10px">
                    <div  class="flex-align-center">
                      <img class="inline-16" height="45" width="45" :src="i.user.headpic" alt="">
                      <div>
                        <p >{{i.user.name}}</p>
                        <p style="font-size: 12px;color:#999">{{i.user.depname}}<span style="margin-left: 10px">{{i.user.position}}</span></p>
                      </div>

                    </div>
                    <small style="color:#999;">{{i.data[0].createdate}}</small>
                  </div>
                  <div style="margin-bottom: 10px">
                    <p>评估说明：<span style="font-size: 12px">{{i.actionnotes}}</span></p>
                  </div>
                  <div style="margin-bottom: 10px" v-for="(item,index) in i.data" :key="index">
                    <div v-if="item.type !== ''" style="margin-bottom: 10px">
                      <el-tag type="warning" size="mini" >{{item.type}}</el-tag>
                      <span style="margin-left: 10px" >{{item.enterprisename}}</span>
                    </div>
                    <div>
                      <span >结果:</span>
                      <span style="margin-left: 2px">{{item.optionname}}</span>
                      <span style="font-size: 12px;margin-left: 5px;color: #999999">{{item.remarks}}</span>
                    </div>
                  </div>
                </div>
              </el-timeline-item>
            </el-timeline>
          </div>
        </div>
      </div>
      <div class="fixed__btn__panel">
        <el-button size="small" @click="drawer = false" class="normal-btn-width">取 消</el-button>
      </div>
    </el-drawer>
  </div>
</template>

<script>
import upload from '@/components/upload/hw_obs_upload.vue'
import previewImage from '@/components/previewImage/index.vue'
export default {
  name: "evaluationRecord",
  props:["data","rowData","disabled"],
  components:{upload,previewImage},
  data(){
    return {
      drawer:false,
      recordList:[],
      nowUserid:''
    }
  },
  methods:{
    onShow(){
      this.drawer = true
      this.queryRecords()
      this.nowUserid = JSON.parse(sessionStorage.getItem('active_account')).userid
    },
    async queryRecords(){
      const res = await this.$api.requested({
        "id": 20221128144904,
        "content": {
          "sa_projectid": this.data.sa_projectid,
          "sa_projtaskmagid": this.rowData.sa_projtaskmagid,
          "sa_projstagemagid":this.rowData.sa_projstagemagid,
          "pageNumber": 1,
          "pageSize": 90
        }
      })
      this.recordList = res.data
      console.log(res,'评估记录')
    }
  },

  mounted() {

  }
}
</script>

<style scoped>
.step__panel{
  background-color: #eff4ff;
  padding: 10px;
  border-radius: 5px;
  color:#666
}
.dot{
  background:#fff;height:10px;width:10px;border-radius:100%;border:2px solid #3874F6;
  margin-left: -2px;
}
</style>