<template>
  <div class="panel panel-default auto repair-info-content">
    <div class="panel-body">
      <div>
        <div class="panel panel-default well" v-for="row in model">
          <div class="bg-info">
            <div class="row form-group">
              <div class="col-xs-12 col-sm-12 col-md-12">
                <div class="row">
                  <div class="col-xs-12 col-sm-12 col-md-12">
                    安检时间: {{ row.f_offsite_time }}
                  </div>
                  <div class="col-xs-12 col-sm-12 col-md-12">
                    安检员: {{ row.f_checker_name }}
                  </div>
                  <div class="col-xs-12 col-sm-12 col-md-12">
                    是否有隐患: {{ row.f_defect_content.includes('正常') ? '正常' : '有隐患' }}
                  </div>
                  <div class="col-xs-12 col-sm-12 col-md-12" v-if="row.f_defect_content.includes('有隐患')">
                    隐患内容: {{ row.f_defect_text }}
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <p v-show="model.length == 0">{{ message }}</p>
    </div>
  </div>
</template>

<script>
import HttpResetClass from "vue-client/src/plugins/HttpResetClass";
import Vue from "vue";

export default {
  title: "查询用户",
  data() {
    return {
      model: [],
      show: false,
      row: Object,
      message: "请稍候。。。。。。",
    }
  },
  props: {
    user: {
      type: Object
    },
    f_userinfo_id: "",
    title: "",
  },
  methods: {
    searchHistory(userinfoid) {
      this.$resetpost(
        `${this.$androidUtil.getProxyUrl()}/rs/sql/tel_singleTable_OrderBy`,
        {
          data: {
            items: '*',
            tablename: 't_check_paper',
            orderitem: 'f_offsite_time desc',
            condition: `f_userinfoid = '${userinfoid}'`
          }
        }).then((resp) => {
        this.model = resp.data;
        if (this.model.length == 0) {
          this.message = "该用户暂无" + this.title;
        }
      }).catch((error) => {
        this.message = "该用户暂无" + this.title;
      })
    }
  },
  ready() {
    if (this.user && this.user.f_userinfo_id) {
      this.searchHistory(this.user.f_userinfo_id);
    } else if (this.f_userinfo_id) {
      this.searchHistory(this.f_userinfo_id);
    }
  }
}
</script>
<style>
.app-botton {
  position: fixed;
  background: #87b2dd;
  color: #fff;
  padding: 8px;
  text-align: center;
  font-size: 1.2em;
  z-index: 10;
  opacity: 0.5;
  bottom: 50px;
  margin-top: -10px;
  height: 40px;
}
</style>
