<template>

  <modal :show.sync="show" v-ref:modal :backdrop="isBack" >
    <div slot="modal-header" class="modal-header">
      <span class="modal-title font">
        安检单打印
      </span>
    </div>

    <div slot="modal-body" class="modal-body" style="height: 70vh">
      <div id="print1" style="overflow: scroll">
        <div id="print2">
          <style id="style1">
            #print2 td{
              /*height:32px;*/
              width: 100px;
              text-align: center;
            }
            #print2 table{
              margin: auto;
            }
            #print2 h1{
              text-align: center;
            }
            #print2 p{
              text-align: center;
            }
            .border-btn{
              border-bottom: #000000 solid 2px;
            }
          </style>
          <table cellspacing="0" style="width: 100%">
            <tr>
              <td style="width: 100%"><h4>{{$parent.paperdata.f_address}}入户安检资料</h4></td>
            </tr>
           </table>
          <table border="1" cellspacing="0" style="width: 100%">
            <tr>
              <td colspan="6" style="width: 100%"> <h2>客户安全检查记录表</h2> </td>
            </tr>
            <tr>
              <td colspan="6" style="width: 100%"> <h3>用户安检概况</h3> </td>
            </tr>
            <tr>
              <td><b>用户编号</b></td>
              <td>{{$parent.paperdata.f_userinfo_code}}</td>
              <td ><b>用户姓名</b></td>
              <td >{{$parent.paperdata.f_user_name }}</td>
              <td><b>用户电话</b></td>
              <td>{{$parent.paperdata.f_user_phone}}</td>
            </tr>
            <tr>
              <td><b>特殊用户</b></td>
              <td >{{$parent.paperdata.f_is_specialuser}}</td>
              <td><b>小区名称</b></td>
              <td >{{$parent.paperdata.f_residential_area}}</td>
              <td><b>人口数</b></td>
              <td>{{$parent.f_people_num}}</td>
            </tr>
            <tr>
              <td><b>地址</b></td><td colspan="5">{{$parent.paperdata.f_address}}
            </tr>
<!--            <tr>
              <td colspan="6" style="width: 100%"> <h3>用户安检概况</h3> </td>
            </tr>-->
            <tr>
              <td><b>到达时间</b></td>
              <td>{{$parent.paperdata.f_onsite_time}}</td>
              <td><b>离开时间</b></td>
              <td>{{$parent.paperdata.f_offsite_time}}</td>
              <td><b>入户状态</b></td>
              <td>{{$parent.paperdata.f_entry_status}}</td>
            </tr>
            <tr v-if="paperdata.f_entry_status=='入户'">
              <td><b>燃气使用</b></td>
              <td>{{$parent.paperdata.f_usegas}}</td>
              <td><b>用户满意度</b></td>
              <td>{{$parent.paperdata.f_client_evaluation}}</td>
              <td><b>安检结果</b></td>
              <td>{{$parent.ajresult}}</td>
            </tr>
            <tr v-if="paperdata.f_entry_status=='入户'">
              <td><b>备注</b></td><td colspan="5">{{$parent.paperdata.f_remarks}}
            </tr>
            <tr v-if="paperdata.f_entry_status=='入户'">
              <td><b>隐患详情</b></td><td colspan="5"><span v-for="deviceCollect in $parent.deviceCollects">
                      <span class="li-font">
                        {{ deviceCollect.name }}:{{ deviceCollect.value }}&nbsp;&nbsp;&nbsp;
                      </span>
            </span>
            </tr>
          </table>
          <table style="width: 100%" border="1" cellspacing="0" v-if="paperdata.f_entry_status=='入户'">
            <tr>
              <td colspan="6" style="width: 100%"><h3>安检情况列表</h3></td>
            </tr>
          </table>
          <table v-for="config in data" border="1" cellspacing="0" style="width: 100%" v-if="paperdata.f_entry_status=='入户'">
            <!--            <tr>-->
            <!--              <td>-->
            <!--                {{$parent.$parent.paperdata.f_entry_status}}{{config.checkname}}-->
            <!--              </td>-->
            <!--            </tr>-->
            <tbody v-show="$parent.$parent.paperdata.f_entry_status=='入户'">
            <tr>
              <td colspan="6" style="width: 100%"> <h3>{{config.checkname}}</h3> </td>
            </tr>
            <tr v-for="(index,dev) in config.items" v-show="$parent.$parent.$parent.getDeviceValue(config.checkname, dev.lname)!='无' || config.checkname!='燃气表'">
              <td style="width: 50%" colspan="3" v-if="dev.type!='text'">{{dev.lname}}</td>
              <td style="width: 50%" colspan="3" v-if="dev.type!='text'">{{$parent.$parent.$parent.getDeviceValue(config.checkname, dev.lname)}}</td>
              <td style="width: 100%" colspan="6" v-if="dev.type=='text'">{{dev.lname}}</td>
            </tr>
            <!--              <tr>-->
            <!--                <td style="border-spacing: 0"></td>-->
            <!--                <td style="border-spacing: 0"></td>-->
            <!--                <td style="border-spacing: 0"></td>-->
            <!--                <td style="border-spacing: 0"></td>-->
            <!--                <td style="border-spacing: 0"></td>-->
            <!--                <td style="border-spacing: 0"></td>-->

            <!--              </tr>-->
            </tbody >

          </table>
          <table border="1" cellspacing="0" style="width: 100%" v-for="item in daofangbuyu">
            <tr>
              <td style="width: 100%"><h3>{{item.f_upload_date}}{{item.f_entry_status}}记录</h3></td>
            </tr>
            <tr>
              <td style="margin: auto;text-align: center;width:100%">
                <div class="container" style="width: 100%;background: #FFFFFF">
                  <div class="img" style="width: 100%;">
                    <img   :src="'rs/image/file/'+item.f_noanswer_path" style="float: left;width: 60%;"  v-show="item.f_noanswer_path">
                    <img   :src="'rs/image/file/'+item.f_noanswer1_path" style="float: left;width: 60%;"  v-show="item.f_noanswer1_path">
                    <img   :src="'rs/image/file/'+item.f_noanswer2_path" style="float: left;width: 60%;"  v-show="item.f_noanswer2_path">
                    <img   :src="'rs/image/file/'+item.f_rejectcheck_path" style="float: left;width: 60%;"  v-show="item.f_rejectcheck_path">
                    <img   :src="'rs/image/file/'+item.f_rejectcheck1_path" style="float: left;width: 60%;"  v-show="item.f_rejectcheck1_path">
                    <img   :src="'rs/image/file/'+item.f_rejectcheck2_path" style="float: left;width: 60%;"  v-show="item.f_rejectcheck2_path">
                  </div>
                </div>
              </td>
            </tr>

          </table>
          <table border="1" cellspacing="0" style="width: 100%" v-if="$parent.yinhuanzhaopian.length>0">
            <tr>
              <td style="width: 100%"><h3>隐患照片</h3></td>
            </tr>
            <tr>
              <td style="margin: auto;text-align: center;width:100%">
                <div class="container" style="width: 100%;background: #FFFFFF">
                  <div class="img" style="width: 100%;">
                    <img  v-for="img in yinhuanzhaopian" :src="'rs/image/file/'+img.f_path" style="float: left;width: 60%;" >
                  </div>
                </div>
              </td>
            </tr>

          </table>
          <table border="1" cellspacing="0" style="width: 100%" v-if="paperdata.f_entry_status=='入户'">
            <tr>
              <td style="width: 100%"><h3>总体安检照片</h3></td>
            </tr>
            <tr>
              <td style="margin: auto;text-align: center;width:100%;">
                <div class="container" style="width: 100%;background: #FFFFFF">
                  <div class="img" style="width: 100%;">
                    <img  v-for="img in imgs" :src="img.f_overall_path" style="float: left;width: 60%;" >
                  </div>
                </div>
              </td>
            </tr>

          </table>
          <table border="1" cellspacing="0" style="width: 100%" v-if="paperdata.f_entry_status=='入户'">
            <tr>
              <td style="width: 10%"><b>用户签字</b></td><td style="width: 40%"><img-self :src='$parent.paperdata.f_sign_path' alt="未签名"></img-self></td>
              <td style="width: 10%"><b>安检员</b></td><td style="width: 40%">{{$parent.paperdata.f_checker_name}}</td>
            </tr>
          </table>
        </div>
      </div>
      确定打印安检单？
    </div>
    <div slot="modal-footer" class="modal-footer">
      <button type="button" class="btn btn-cancel" @click="cancel()">取消</button>
      <print-element class="btn btn-success width-80" id="print1"   top='40' left='60' width='100%' height='100%' v-ref:printelement>打印</print-element>
    </div>
  </modal>
</template>

<script>

import co from 'co'
import { PagedList } from 'vue-client'
import * as Util from '../../Util'

export default {
  title: '安检信息',
  data () {
    return {
      imgs:[],
      paperdata:{},
      normalDevices:{},//设备信息
      device:[],//表具信息
      devices:[],//所有表具信息
      userinfo:[],
      yinhuanzhaopian:[],
      defectList:[],
      defectLists:[],
      deviceInfo:{
        bfh:'',
        bxh:'',
        bbh:'',
        jbds:'',
        yl:'',
        bpp:'',
        jqfx:''

      },//具体表具信息
      deviceInfos:{},//每个表具的所有信息
      drowspan:0,
      erowspan:0,//设备信息个数
      hrowspan:0,//隐患数
      f_defect_content:'', //安检结果
      equipmentmsgs:[],//所有设备信息
      Hinvestigations:[], //所有隐患信息
      Hinvestigation:{},
      defect:{},//隐患信息
      normal:{},
      normalDevice:[],
      Hiddenchecks:[],
      hiddenvalues:[],
      HazardDevice:[],
      HazardDevices:{},
      printtime:'',
      print_id:'',
      showAdd:true,
      company:'',
      daofangbuyu:[],
      isBack:false
    }
  },
  props: ['data','show'],
  ready () {
    // console.log(this.$parent.paperdata.f_entry_status)
    this.paperdata = this.$parent.paperdata
    this.daofangbuyu = this.$parent.daofangbuyu
    this.yinhuanzhaopian = this.$parent.yinhuanzhaopian
    console.log(this.$parent.yinhuanzhaopian,this.yinhuanzhaopian)
    this.imgs =this.$parent.paperdata.f_overall_imgs
  },
  methods: {

    cancel(){
      this.$parent.showcheckmsg = false
    }
  }
}
</script>
<style media="screen" scoped>
.divtext {
  min-width: 50px;
  max-width: 200px;
  border: 1px solid green;
  display: inline-block;
}
.bg-info{
  border-left: 5px solid #5989be;
}
.bg-cus-body {
  margin-left: 5px;
}

</style>
