<template>
  <div style="height: 100%;width: 100%;padding:10px 0px 10px 0px;">
    <div  class="auto" >
      <partial-view v-ref:pv>
        <div class="row text-left" style="padding-bottom: 10px">
          <label class = "col-sm-3 control-label">用户姓名:</label>
          <span class = "col-sm-9">{{rowdata.f_user_name}}</span>
        </div>
        <div class="row text-left" style="padding-bottom: 10px">
          <label class = "col-sm-3 control-label">用户地址:</label>
          <span class = "col-sm-9">{{rowdata.f_address}}</span>
        </div>
        <div class="row text-left" style="padding-bottom: 10px">
          <label class = "col-sm-3 control-label">入户时间:</label>
          <span class = "col-sm-9">{{rowdata.f_onsite_time}}</span>
        </div>
        <div class="row text-left" style="padding-bottom: 10px">
          <label class = "col-sm-3 control-label">离开时间:</label>
          <span class = "col-sm-9">{{rowdata.f_offsite_time}}</span>
        </div>
        <div class="row text-left" style="padding-bottom: 10px">
          <label class = "col-sm-3 control-label">安检人:</label>
          <span class = "col-sm-3">{{rowdata.f_checker_name}}</span>
          <label class = "col-sm-3 control-label">安检状态:</label>
          <span class = "col-sm-3">{{rowdata.f_entry_status}}</span>
        </div>
        <div class="row text-left" style="padding-bottom: 10px">
          <label class = "col-sm-3 control-label">用户评价:</label>
          <span class = "col-sm-3">{{rowdata.f_client_evaluation}}</span>
          <label class = "col-sm-3 control-label">是否维修:</label>
          <span class = "col-sm-3">
            {{rowdata.f_repaired}}
            <a v-if="rowdata.f_repaired === '已修'" style="text-decoration: none" href="#" @click="repairlist()">查看</a>
          </span>
        </div>
      </partial-view>
    </div>
    <check-paper-items :row="rowdata"></check-paper-items>
    <!--<work-history :row-one="workhistoryid" v-if="repaierShow"></work-history>-->
  </div>
</template>

<script>
  import Vue from 'vue'
  import co from 'co'
  // import RepairOrder from 'telephone-clients/src/components/workorder/RepairOrder'
  // import WorkHistory from 'telephone-clients/src/components/pc/WorkHistory'

  let readRepair = async function (self) {
    let condition = "f_service_id = '" + self.rowdata.f_safetorepair_id+"'"
    let res = await self.$resetpost('rs/sql/singleTable',{data:{tablename:'t_serviceworkorder',condition:condition}}, { resolveMsg: null, rejectMsg: null })
    self.workhistoryid.id = res.data[0].id
    self.workhistoryid.f_workorder_type = '报修单'
    self.repaierShow =true
  }

  export default {
    title: '安检项信息',
    name: 'CheckPaperItem',
    props: ['row'],
    data () {
      return {
        workhistoryid: {},
        rowdata: this.row,
        repaierShow: false,
        service: null,
        repair: {}
      }
    },
    ready () {
      this.rowdata = this.row
    },
    watch: {
      'row' (val) {
        this.rowdata = val
        this.repaierShow = false
      }
    },
    methods: {
      repairlist () {
        readRepair(this)
      },
      close () {
        this.repaierShow = false
      }
    },
    components: {
      // 'work-history' : WorkHistory
      // 'repair-order': RepairOrder
    }
  }
</script>
