driverInfo.vue 4.44 KB
<template>
    <div>
  <div v-loading="loading" style="border: 1px solid black;">
        <el-row  >
          <el-col :span="12" class="bd">姓名</el-col>
          <el-col :span="12" class="bd">{{infoData.name}}</el-col>
        </el-row>
        <el-row  >
          <el-col :span="12" class="bd">身份证</el-col>
          <el-col :span="12" class="bd">{{infoData.identityNo}}</el-col>
        </el-row>
        <el-row >
          <el-col :span="12" class="bd">所属企业</el-col>
          <el-col :span="12" class="bd">{{infoData.companyName}}</el-col>
        </el-row>

        <el-row  >
          <el-col :span="12" class="bd">从业资格证有效期</el-col>
          <el-col :span="12" class="bd">{{infoData.qualificationCertValidStartAt}} - {{infoData.qualificationCertValidEndAt}}</el-col>
        </el-row>
        <el-row >
          <el-col :span="12" class="bd">驾驶证有效期</el-col>
          <el-col :span="12" class="bd">{{infoData.startAt}} - {{infoData.endAt}}</el-col>
        </el-row>

        <el-row >
          <el-col :span="12" class="bd">安全教育培训日期</el-col>
          <el-col :span="12" class="bd">{{infoData.safetyEducationDate}}</el-col>
        </el-row>
        <el-row >
          <el-col :span="12" class="bd">安全教育培训内容</el-col>
          <el-col :span="12" class="bd">{{infoData.safetyEducationContent}}</el-col>
        </el-row>
        <el-row >
          <el-col :span="12" class="bd">备注</el-col>
          <el-col :span="12" class="bd">{{infoData.remark}}</el-col>
        </el-row>

        <div v-for="dict in dicts">
          <p >{{dict.name}}</p>

          <el-image v-for="item in infoData.attachment"
                    style="width: 40px; height: 40px; margin: 5px;"
                    :src="'/remotedown/' + item.attachmentPath"
                    :z-index="2000"
                    :preview-src-list="[slides1('/remotedown/' + item.attachmentPath)]"
                    v-if="Number(item.typeCode) == (dict.code) && (item.attachmentPath.toLowerCase().indexOf('.jpg') > -1 || item.attachmentPath.toLowerCase().indexOf('.png') > -1)">
          </el-image>
          <a v-for="item in infoData.attachment"
            @click="downloadFile(item.attachmentPath);"
            style="color:blue;"
            v-if="Number(item.typeCode) == (dict.code)
            && item.attachmentPath.toLowerCase().indexOf('.jpg') == -1
            && item.attachmentPath.toLowerCase().indexOf('.png') == -1"><p>{{item.name}}</p></a>
        </div>
       </div>
  </div>
</template>

<script>


import store from "@/store";
  import {
    getToken
  } from "@/utils/auth";


  import {
    getDriverInfo,
    getArea,

    getDict
  } from "@/api/dict";


  export default {
    name: "ThreestepInfo",
    props: {
      businessKey: {
        type: String
      },
    },
    data() {
      return {
        sign: store.getters.avatar, //裁剪图片的地址
        areas: [],
        loading: null,
        infoData: {},
        dicts:null,
        showPic:false,
        picImage:null,
      }
    },
    created() {
      getDict({type:"CSDriverAttachmentType"}).then(res=>{
          this.dicts = res.result;
      });
      this.loading = true;
      this.getInfo();

    },
    methods: {
      slides1(img){
        return img;
      },
      getInfo() {
        let id;
        if (this.businessKey.split(":").length == 2) {
          id = this.businessKey.split(":")[1];
        } else {
          id = this.businessKey;
        }

        getDriverInfo(id).then(response => {

           this.infoData = response;
          // getArea().then(res => {
          //   this.areas = res.result;
          //   this.loading = false;
          //   for (let i = 0; i < this.areas.length; i++) {
          //     if (Number(this.infoData.place) == this.areas[i].code) {
          //       this.infoData.place = this.areas[i].name;
          //     }
          //   }
          // });

          // for(let i in obj){
          //   if(this.objectDict[i]){
          //       this.infoData.push({label:this.objectDict[i] ,value:obj[i]})
          //   }
          // }
          this.loading = false;
        });
      },

      downloadFile(path){
        let file =  "/remotedown/" + path;

        if(path.indexOf(".jpg") != -1){
            this.showPic = true;

            this.picImage = file;
            return;
        }


          window.open(file,"new window");
      }
    }

  }
</script>
<style>
  .bd{
    padding:5px;
  }



</style>