<template xmlns="http://www.w3.org/1999/html">
  <div class="panel panel-default auto repair-info-content">
    <div class="panel-body">
      <table class="table table-striped table-bordered" style="margin-bottom: 6px;width: 100%;">
        <thead>
        <tr style="border: #E9E9E9 solid 2px">
          <th colSpan="6" style="text-align: center">最后十次异常记录</th>
        </tr>
        </thead>
        <tbody>
        <tr v-for="row in model.warninfo" style="margin-top: 5px;border-collapse: collapse;border: #E9E9E9 solid 2px">
          <td colSpan="6" style="text-align: left">
            <div class="col-xs-12 col-sm-6 col-md-6">
              上报时间: {{ row.f_insert_date }}
            </div>
            <div class="col-xs-12 col-sm-6 col-md-6">
              异常类型: {{ row.f_error_type }}
            </div>
            <div class="col-xs-12 col-sm-6 col-md-6">
              异常信息: {{ row.f_error_msg }}
            </div>
          </td>
        </tr>
        </tbody>
      </table>
      <div v-if="model.warninfo.length > 0 && false" style="padding: 4px; border:1px solid #D4D4D4;border-bottom: 0">
        <div style="float: left;width:60%" class="form-group" >
          <button style="float: left;" type="button" name="button" class="btn btn-primary" @click="takePic()">表具异常拍照</button>
          <div class="auto" style="float: left;">
            <div class="panel">
              <div class="panel-body panel-self" style="background-color: #F8F8F8;width: 160px;height: 160px;position: relative">
                <div class="row" style="height: 160px;width:160px;overflow: scroll;top: 1px">
                  <div class="col-sm-4" >
                    <img-self v-if="f_table_anomaly_path" :src="f_table_anomaly_path"  width="140" height="140"></img-self>
                  </div>
                  <img src="../../assets/remove.png" :class="style__"  @click="delfile()" style="width: 40px;height: 40px;position: absolute;left:110px;top:110px"></img>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <div v-if="model.warninfo.length > 0 && false" style="padding: 4px; border:1px solid #D4D4D4;border-bottom: 0">
        <div class="form-group col-md-12 col-sm-12 col-xs-12">
          <label class="control-label font text-left col-md-4 col-xs-4">备注</label>
          <div class="col-md-12 col-sm-12 col-xs-12">
            <textarea  v-model="$parent.$parent.data.f_table_anomaly_remark" class="form-control"></textarea>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import * as Util from '../Util'
export default {
  title: '查询用户',
  data() {
    return {
      model: {},
      f_table_anomaly_path:''
    }
  },
  methods: {
    // getModel() {
    //   let http = new HttpResetClass()
    //   http.load('POST', `${this.$androidUtil.getProxyUrl()}/rs/logic/getIotInfo`, {
    //     data: {
    //       f_userinfo_code: `${this.$parent.$parent.data.f_userinfo_code}`
    //     }
    //   }).then((res) => {
    //     this.model = res.data
    //   })
    // },
    back() {

    },
    takePic(prop,order) {
      HostApp.__callback__ = this.cameraCallBack
      HostApp.__this__ = this
      let fileName
      fileName = Util.guid() + '.jpg'
      HostApp._open_a_page({type: 'boomerang',
        page: 'com.aofeng.hybrid.android.peripheral.CameraActivity',
        param: {file: fileName, requestCode: 111, callback:'javascript:HostApp.__callback__("'+ prop +'", "%s",'+order+');', watermark:  '\t时间：'+ Util.toStandardTimeString()}
      })
    },
    cameraCallBack(prop, fileName,order) {
      this.$parent.$parent.data.f_table_anomaly_path = fileName
      this.f_table_anomaly_path = fileName
    },
    delfile() {
      this.$parent.$parent.data.f_table_anomaly_path = ''
      this.f_table_anomaly_path = ''
    },
  },
  watch: {},
  ready() {
    // 证明已进来
    this.$parent.$parent.data.f_table_anomaly_remark = '异常'
    this.f_table_anomaly_path = this.$parent.$parent.data.f_table_anomaly_path
    // this.getModel()
    this.model = this.$parent.$parent.tableAnomalyRecords
  }
}
</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>
