<style scoped>
.img {
  width: auto;
  height: auto;
  float: left;
  text-align: center;
  margin: 6px;
}

img {
  margin: 6px;
}


.container {
  margin: 10px auto;
  width: 80%;
  height: auto;
}

div::-webkit-scrollbar {
  width: 0 !important;
  height: 0 !important;
}

div {
  -ms-overflow-style: none;
  overflow: -moz-scrollbars-none;
}

.divmask {
  pointer-events: none;
}

.app-header {
  border-radius: 50%;
  background: rgba(73, 158, 223, 0.4);
  color: #FFF;
  padding: 20px;
  text-align: center;
  font-size: 1.2em;
  z-index: 10;
  opacity: 0.5;
  bottom: 50px;
  margin-top: -20px;
  position: absolute;
  top: 10%;
  right: 2%;
  height: 8%;
}
</style>

<template>
  <div class="basic-main" style="height: 100%">
    <div class="page-header app-header auto" style="padding: 15px;margin-right: 10px;right: 0%;height: 7%">
      <div @click="back()">
        <img src="../../assets/back.png" style="margin: 0px" />
      </div>
    </div>
    <work-busy :is-busy="loading"></work-busy>
    <div class="container-fluid" style="overflow: scroll">
      <div class="row">
        <div class="col-md-6" style="margin-right: 2%;height: 100%;overflow: scroll">
          <div style="width: 95%;margin-left: 5%">
            <table class="table table-striped table-bordered" v-for="config in deviceconfig2">
              <thead v-show="!(config.checkname != '燃气表' && data.f_entry_status != '入户')">
              <tr>
                <th style="text-align: center">{{ config.checkname }}</th>
              </tr>
              </thead>
              <tbody v-show="!(config.checkname != '燃气表' && data.f_entry_status != '入户')">
              <tr v-for="dev in config.items">
                <td v-if="dev.type != 'text'">
                  <div class="row">
                    <div class="col-md-8" style="text-align: center;">
                      <label><button-link :style="{ color: defectNames.includes(dev.lname) ? 'red' : 'black' }"
                                          type="button" class="btn btn-link" @click="showpicture(config.checkname, dev.lname)">{{
                          dev.lname }}
                      </button-link></label>
                    </div>
                    <div class="col-md-4" style="text-align: center">
                      <label style="font-weight: normal" v-if="dev.type != 'picture'">{{
                          getDeviceValue(config.checkname, dev.lname) }}</label>
                      <label style="font-weight: normal" v-if="dev.type == 'picture'">
                        <div v-show="getDevicePath(config.checkname, dev.lname)"><button-link style="color: black"
                                                                                              type="button" class="btn btn-link"
                                                                                              @click="showpath(getDevicePath(config.checkname, dev.lname), dev.lname)">查看照片
                        </button-link></div>
                      </label>
                    </div>
                  </div>
                </td>
                <td v-if="dev.type === 'text'">
                  <label style="width: 100%;text-align: center">{{ dev.lname }}</label>
                </td>
              </tr>
              </tbody>
            </table>
          </div>
        </div>
        <div class style="width: 1%;height: 100%;background-color: #F1F8FF;float: left;"></div>
        <div class="col-md-5" style="margin-left: 2%;height: 100%;overflow: scroll">
          <div style="width: 100%;margin: auto">
            <table class="table table-striped table-bordered" style="margin-bottom: 6px">
              <thead>
              <tr>
                <th colspan="6" style="text-align: center">用户基本信息
                  <span v-if="spot" style="color: red; font-weight: bold; font-size: larger;">（已）</span>
                  <button type="button" class="btn btn-success" v-if="isSpot" style="float: right" @click="spotCheck('工单合格')">工单合格</button>
                  <button type="button" class="btn btn-success" v-if="isSpot" style="float: right;margin-right: 10px;" @click="spotCheck('工单不合格')">工单不合格</button>
                </th>
              </tr>
              </thead>
              <tbody>
              <tr>
                <td style="text-align: center;border: #E9E9E9 solid 1px;width: 17%">用户编号:</td>
                <td style="text-align: center;border: #E9E9E9 solid 1px;width: 33%">{{ data.f_userinfo_code }}</td>
                <td style="text-align: center;border: #E9E9E9 solid 1px;width: 17%">用户名称:</td>
                <td style="text-align: center;border: #E9E9E9 solid 1px;width: 33%">{{ data.f_user_name }}</td>
              </tr>
              <tr>
                <td style="text-align: center;border: #E9E9E9 solid 1px">证件号码:</td>
                <td style="text-align: center;border: #E9E9E9 solid 1px">{{ data.f_idnumber }}</td>
                <td style="text-align: center;border: #E9E9E9 solid 1px">用户类型:</td>
                <td style="text-align: center;border: #E9E9E9 solid 1px">{{ data.f_check_type }}</td>
              </tr>
              <tr>
                <td style="text-align: center;border: #E9E9E9 solid 1px">用户电话:</td>
                <td style="text-align: center;border: #E9E9E9 solid 1px">{{ data.f_user_phone }}</td>
                <td style="text-align: center;border: #E9E9E9 solid 1px">区 / 县:</td>
                <td style="text-align: center;border: #E9E9E9 solid 1px">{{ data.f_area }}</td>
              </tr>
              <tr>
                <td style="text-align: center;border: #E9E9E9 solid 1px">街 道:</td>
                <td style="text-align: center;border: #E9E9E9 solid 1px">{{ data.f_street }}</td>
                <td style="text-align: center;border: #E9E9E9 solid 1px">楼 号:</td>
                <td style="text-align: center;border: #E9E9E9 solid 1px">{{ data.f_building }}</td>
              </tr>
              <tr>
                <td style="text-align: center;border: #E9E9E9 solid 1px">单 元:</td>
                <td style="text-align: center;border: #E9E9E9 solid 1px">{{ data.f_unit }}</td>
                <td style="text-align: center;border: #E9E9E9 solid 1px">楼 层:</td>
                <td style="text-align: center;border: #E9E9E9 solid 1px">{{ data.f_floor }}</td>
              </tr>
              <tr>
                <td style="text-align: center;border: #E9E9E9 solid 1px">门 牌 号 :</td>
                <td style="text-align: center;border: #E9E9E9 solid 1px">{{ data.f_room }}</td>
                <td style="text-align: center;border: #E9E9E9 solid 1px">用户性质:</td>
                <td style="text-align: center;border: #E9E9E9 solid 1px">{{ data.f_userproperties }}</td>
              </tr>
              <tr>
                <td style="text-align: center;border: #E9E9E9 solid 1px">进气口铅封号:</td>
                <td style="text-align: center;border: #E9E9E9 solid 1px">{{ item.f_airintake_seal_no }}</td>
                <td style="text-align: center;border: #E9E9E9 solid 1px">出气口铅封号:</td>
                <td style="text-align: center;border: #E9E9E9 solid 1px">{{ item.f_airouttake_seal_no }}</td>
              </tr>
              <tr>
                <td style="text-align: center;border: #E9E9E9 solid 1px">备注信息:</td>
                <td style="text-align: center;border: #E9E9E9 solid 1px">{{ data.f_comments }}</td>
                <td style="text-align: center;border: #E9E9E9 solid 1px">小区名称:</td>
                <td style="text-align: center;border: #E9E9E9 solid 1px">{{ data.f_residential_area }}</td>
              </tr>
              <tr>
                <td colspan="1" style="text-align: center;border: #E9E9E9 solid 1px">详细住址:</td>
                <td colspan="3" style="text-align: center;border: #E9E9E9 solid 1px">{{ data.f_address }}</td>
              </tr>
              </tbody>
            </table>
            <table class="table table-striped table-bordered" v-show="data.f_entry_status == '入户'">
              <thead>
              <tr>
                <th colspan="4" style="text-align: center">用户安检概况</th>
              </tr>
              </thead>
              <tbody>
              <tr>
                <td style="text-align: center;border: #E9E9E9 solid 1px;width: 17%">到达时间:</td>
                <td style="text-align: center;border: #E9E9E9 solid 1px;width: 33%">{{ data.f_onsite_time }}</td>
                <td style="text-align: center;border: #E9E9E9 solid 1px;width: 17%">离开时间:</td>
                <td style="text-align: center;border: #E9E9E9 solid 1px;width: 33%">{{ data.f_offsite_time }}</td>
              </tr>
              <tr>
                <td style="text-align: center;border: #E9E9E9 solid 1px;width: 17%">入户状态:</td>
                <td style="text-align: center;border: #E9E9E9 solid 1px;width: 33%">{{ data.f_entry_status }}</td>
                <td style="text-align: center;border: #E9E9E9 solid 1px;width: 17%">燃气使用:</td>
                <td style="text-align: center;border: #E9E9E9 solid 1px;width: 33%">{{ data.f_usegas }}</td>
              </tr>
              <tr>
                <td colspan="1" style="text-align: center;border: #E9E9E9 solid 1px;">用户满意度:</td>
                <td colspan="1" style="text-align: center;border: #E9E9E9 solid 1px;">{{ data.f_client_evaluation }}
                </td>
                <td colspan="1" style="text-align: center;border: #E9E9E9 solid 1px;">安检结果:</td>
                <td colspan="1" style="text-align: center;border: #E9E9E9 solid 1px;">{{ ajresult }}</td>
              </tr>
              <tr>
                <td colspan="1" style="text-align: center;border: #E9E9E9 solid 1px;">备注:</td>
                <td colspan="3"
                    style="text-align: center;border: #E9E9E9 solid 1px;word-wrap:break-word;word-break:break-all;width:87%">
                  {{ data.f_repair_approved_note }}
                </td>
              </tr>
              <tr>
                <td colspan="1" style="text-align: center;border: #E9E9E9 solid 1px;">隐患详情:</td>
                <td colspan="3"
                    style="text-align: center;border: #E9E9E9 solid 1px;word-wrap:break-word;word-break:break-all;width:87%">
                    <span v-for="deviceCollect in deviceCollects">
                      <span class="li-font">
                        {{ deviceCollect.name }}:{{ deviceCollect.value }}&nbsp;&nbsp;&nbsp;
                      </span>
                      <br>
                      <span v-if="deviceCollect.value == '有隐患'">
                        <lable>
                          隐患:
                        </lable>
                        <span class="li-font" v-for="val in deviceCollect.devices">
                          {{ val }}&nbsp;&nbsp;&nbsp;
                        </span><br>
                      </span>

                    </span>
                </td>
              </tr>

              </tbody>
            </table>
            <table class="table table-striped table-bordered" v-show="data.f_entry_status != '入户'">
              <thead>
              <tr>
                <th colspan="4" style="text-align: center">用户安检概况</th>
              </tr>
              </thead>
              <tbody>
              <tr>
                <td style="text-align: center;border: #E9E9E9 solid 1px;width: 17%">到达时间:</td>
                <td style="text-align: center;border: #E9E9E9 solid 1px;width: 33%">{{ data.f_onsite_time }}</td>
                <td style="text-align: center;border: #E9E9E9 solid 1px;width: 17%">离开时间:</td>
                <td style="text-align: center;border: #E9E9E9 solid 1px;width: 33%">{{ data.f_offsite_time }}</td>
              </tr>
              <tr>
                <td style="text-align: center;border: #E9E9E9 solid 1px;width: 17%">入户状态:</td>
                <td colspan="2" style="text-align: center;border: #E9E9E9 solid 1px;width: 33%">{{ data.f_entry_status
                  }}</td>
                <td style="text-align: center;border: #E9E9E9 solid 1px;width: 17%">
                  <!--<button-link  style="color: black" type="button" class="btn btn-link"  @click="showpicture2()">{{dev.lname}}
              查看{{data.f_entry_status}}照片
              </button-link>-->
                  <img-self-safe v-if="this.data.f_entry_status == '到访不遇'"
                                 :src="data.f_noanswer_path" :alt="`查看${data.f_entry_status}}照片`" width="80"
                                 height="30"></img-self-safe>
                  <img-self-safe v-if="this.data.f_entry_status == '到访不遇' && data.f_noanswer1_path"
                                 :src="data.f_noanswer1_path" :alt="`查看${data.f_entry_status}}照片`" width="80"
                                 height="30"></img-self-safe>
                  <img-self-safe v-if="this.data.f_entry_status == '拒检'"
                                 :src="data.f_rejectcheck_path" :alt="`查看${data.f_entry_status}}照片`" width="80"
                                 height="30"></img-self-safe>
                </td>
              </tr>
              <tr v-if="data.f_entry_status == '到访不遇'">
                <td colspan="1" style="text-align: center;border: #E9E9E9 solid 1px;">到访不遇备注:</td>
                <td colspan="3"
                    style="text-align: center;border: #E9E9E9 solid 1px;word-wrap:break-word;word-break:break-all;width:87%">
                  {{ data.f_novisit_reason }}
                </td>
              </tr>

              </tbody>
            </table>
            <table class="table table-striped table-bordered" v-show="data.f_entry_status == '入户'">
              <thead>
              <tr>
                <th style="text-align: center">总体安检照片</th>
              </tr>
              </thead>
              <tbody>
              <tr>
                <td style="margin: auto;text-align: center">
                  <div class="container" style="max-width: 610px;background: #FFFFFF">
<!--                    <button @click="open_f">查看安检总体照片</button>-->
                    <div class="img" v-for="(index, img) in overallImagePaths">
                      <img-self-safe
                        :src="img"
                        :images="overallImagePaths"
                        :current-index="index"
                        width="150"
                        height="200"
                        style="margin-right: 10px;margin-bottom: 10px;"
                      ></img-self-safe>
                    </div>
<!--                    <div class="img" v-for="img in data.f_overall_imgs" @click="open_f">
                      <img-self-safe  :src="img.f_overall_path" style="float: left" width="150" height="200"></img-self-safe>
&lt;!&ndash;                      <img :src="'/rs/image/file/' + img.f_overall_path"
                           style=" height: 200px;margin-right: 10px;margin-bottom: 10px;">&ndash;&gt;
                    </div>-->
                  </div>
                </td>
              </tr>
              </tbody>
            </table>
            <table class="table table-striped table-bordered" v-show="data.f_entry_status == '入户'">
              <thead>
              <tr>
                <th style="text-align: center">用户签名照片</th>
              </tr>
              </thead>
              <tbody>
              <tr>
                <td style="margin: auto;text-align: center">
                  <div class="container" style="max-width: 500px;background: #FFFFFF">
                    <div class="img" style="float: none">
                      <img-self-safe :src="data.f_sign_path" width="486"
                                     height="300"></img-self-safe>
                    </div>
                  </div>
                </td>
              </tr>
              </tbody>
            </table>
            <table class="table table-striped table-bordered" v-show="data.f_notified_path">
              <thead>
              <tr>
                <th style="text-align: center">隐患整改通知书照片</th>
              </tr>
              </thead>
              <tbody>
              <tr>
                <td style="margin: auto;text-align: center">
                  <div class="container" style="max-width: 500px;background: #FFFFFF">
                    <div class="img" style="float: none">
                      <img-self-safe v-if="data.f_notified_path" :src="data.f_notified_path" width="486"
                                     height="300"></img-self-safe>
                    </div>
                  </div>
                </td>
              </tr>
              </tbody>
            </table>
            <table class="table table-striped table-bordered" v-show="data.f_table_anomaly_path">
              <thead>
              <tr>
                <th colspan="2" style="text-align: center">表具异常记录</th>
              </tr>
              </thead>
              <tbody>
              <tr>
                <td style="margin: auto;text-align: center">
                  备注:
                </td>
                <td style="margin: auto;text-align: center">
                  {{ data.f_table_anomaly_remark }}
                </td>
              </tr>
              <tr>
                <td colspan="2" style="margin: auto;text-align: center">
                  <div class="container" style="max-width: 500px;background: #FFFFFF">
                    <div class="img" style="float: none">
                      <img-self-safe v-if="data.f_table_anomaly_path" :src="data.f_table_anomaly_path" width="486" height="300"></img-self-safe>
                    </div>
                  </div>
                </td>
              </tr>
              </tbody>
            </table>
          </div>
        </div>
      </div>
    </div>
  </div>
  <image-viewer :src="paperImgs" :show="showpaperImg" :linenumber="linenumber" @clone_f="clone_p"
                alt="安检总体图片"></image-viewer>
  <modal :show.sync="imgshow" v-ref:modal backdrop="true">
    <header slot="modal-header" class="modal-header">
      {{ picturename }}
    </header>
    <article slot="modal-body" class="modal-body">
      <div class="from-group">
        <div class="row">
          <div class="col-md-6">
            <img-self-safe v-if="imgshow" :src="showimg1" width="300" height="400"></img-self-safe>
          </div>
          <div class="col-md-6">
            <img-self-safe v-if="imgshow" :src="showimg2" width="300" height="400"></img-self-safe>
          </div>
        </div>
      </div>
    </article>
    <footer slot="modal-footer" class="modal-footer" v-show="false">
      <button type="button" class="btn btn-success" @click='imgclose'>关闭</button>
    </footer>
  </modal>
  <modal :show.sync="imgshow2" v-ref:modal backdrop="true">
    <header slot="modal-header" class="modal-header">
      {{ data.f_entry_status }}照片
    </header>
    <article slot="modal-body" class="modal-body">
      <div class="from-group">
        <div class="row">
          <!--<div class="col-md-6">
            <img-self-safe v-if="this.data.f_entry_status=='到访不遇'" :src="showimg3"   width="300" height="400"></img-self-safe>
          </div>
          <div class="col-md-6">
            <img-self-safe v-if="this.data.f_entry_status=='拒检'" :src="showimg4"   width="300" height="400"></img-self-safe>
          </div>-->
          <img v-if="this.data.f_entry_status == '到访不遇'" :src="'/rs/image/file/' + showimg3" width="300" height="400">
          <img v-if="this.data.f_entry_status == '拒检'" :src="'/rs/image/file/' + showimg4" width="300" height="400">
        </div>
      </div>
    </article>
    <footer slot="modal-footer" class="modal-footer" v-show="false">
      <button type="button" class="btn btn-success" @click='imgclose'>关闭</button>
    </footer>
  </modal>
  <modal :show.sync="modalShow" v-ref:modal backdrop="true">
    <header slot="modal-header" class="modal-header">
      抽查工单不合格备注
    </header>
    <article slot="modal-body" class="modal-body">
      <div class="from-group">
        <div class="row">
          <div class="col-sm-12" >
            <label class="font_normal_body">抽查工单不合格备注</label>
            <input type="text" class="input_search" v-model="spotCheckData.f_spot_check_remark"
                   style="width: 60%">
          </div>
        </div>
      </div>
    </article>
    <footer slot="modal-footer" class="modal-footer">
      <button type="button" class="btn btn-success" @click='spotCheckUpload()'>提交</button>
    </footer>
  </modal>
</template>

<script>
// import PaperUserm from './PaperUserm'
// import PaperStatem from './PaperStatem'
// import Devicesm from './Devicesm'
// import PaperFeedbackm from './PaperFeedbackm'
import ObjConfig from '../../utils/GerJsonObjectConfig'
import RadioGroup from 'vue-client/src/vue-strap/src/radioGroup'
import Radio from 'vue-client/src/vue-strap/src/radioBtn'
import Vue from 'vue'
import * as Util from '../Util'
import { jsonSort } from '../../utils/LdapHelper'
import { HttpResetClass } from 'vue-client'
let asyncReady = async function (self) {
  // 获取配置信息
  try {
    let res = await new HttpResetClass().load('get', '/api/af-safecheck/vue', null, { resolveMsg: null, rejectMsg: null })
    self.delConfigKey(res.data)
    Vue.config.safecheck = res.data
    console.log('获取配置结果===', res.data)
  } catch (error) {
    // 忽略704,文件找不到异常R
    if (error.status !== 704) {
      throw error
    }
  }
}
export default {
  title: '安检单',
  props: ['f_plan_id', 'item', 'role'],
  data() {
    return {
      spot:false,
      modalShow:false,
      spotCheckData:{},
      data: {
        f_devices: [],
        f_defect_content: '',
        f_overall_imgs: []
      },
      // 图片URL
      paperImgs: [],
      // 缩略图显示的行数
      linenumber: 1,
      iswlw: false,
      // 是否显示
      showpaperImg: false,
      picturename: '隐患照片',
      defectDevice: {},
      hasDevice: false,
      deviceCollect: {},
      deviceCollects: [],
      isshow: false,
      ajresult: '',
      loading: true,
      imgshow: false,
      imgshow2: false,
      isUpload: false,
      livedispose: '',
      defectNames: [],
      showimg1: '',
      showimg2: '',
      showimg3: '',
      showimg4: '',
      isSpot:this.$login.r ? this.$login.r.includes("工单抽查"):false,
      startClick: false, //开始安检按钮是否可点击
      isStrat: false, //是否开始安检
      checkResult: {},//查询结果
      newcheckResult: {},
      timer: null,
      showModal: false,
      pic_to_be_viewed: '',
      showBack: true,
      devices: [],
      devicesAll: [],
      configAJ: [],
      configRQ: [],
      deviceconfig: {},
      deviceconfig2: [],
      f_devices: [],
      config: {
        "燃气表": {
          "checkmust": true,
          "index": 1,
          "items": {
            //"燃气表照片":{"index":1,"type":"picture","remark":"(拍摄清晰的表具编号、字轮数、剩余气量等)"},
            "基表编号": { "index": 1, "type": "string", "readonly": true },
            "气表型号": { "index": 2, "type": "string", "readonly": true },
            "气表品牌": { "index": 3, "type": "string", "readonly": true },
            "进气方向": { "index": 4, "type": "string", "readonly": true },
            // "初始表底":{"index":5,"type":"number","isshow":false,"readonly":true},
            "上期表读数": { "index": 5, "type": "number", "readonly": true, isshow: false },
            "户累购气量": { "index": 6, "type": "number", "readonly": true },
            "累购气量": { "index": 7, "type": "number", "readonly": true },
            "已用气量": { "index": 8, "type": "number", "checkmust": true },//基表数
            "剩余气量": { "index": 9, "type": "number", "checkmust": true },//累购-已用
            //显示屏数  --实际剩余气量
            "气量异常差值": { "index": 10, "type": "number", "readonly": true },
            "差值备注": { "index": 12, "type": "string", "readonly": false }
          }
          // 注意，配置项的index必须与上面的固定配置保持'顺序'
        }
      },
      //金额
      config2: {
        "燃气表": {
          "checkmust": true,
          "index": 1,
          "items": {
            //"燃气表照片":{"index":1,"type":"picture","remark":"(拍摄清晰的表具编号、字轮数、剩余气量等)"},
            "基表编号": { "index": 1, "type": "string", "readonly": true },
            "气表型号": { "index": 2, "type": "string", "readonly": true },
            "气表品牌": { "index": 3, "type": "string", "readonly": true },
            "进气方向": { "index": 4, "type": "string", "readonly": true },
            // "初始表底":{"index":5,"type":"number","isshow":false,"readonly":true},
            "上期表读数": { "index": 5, "type": "number", "readonly": true, isshow: false },
            "户累购金额": { "index": 6, "type": "number", "readonly": true },
            "累购金额": { "index": 7, "type": "number", "readonly": true },
            "已用金额": { "index": 8, "type": "number", "checkmust": true },
            //显示屏数  --实际剩余气量
            "剩余金额": { "index": 9, "type": "number", "checkmust": true },
            "金额异常差值": { "index": 10, "type": "number", "readonly": true },
            "差值备注": { "index": 12, "type": "string", "readonly": false }
          }
        }
      },
      config3: {
        "燃气表": {
          "checkmust": true,
          "index": 1,
          "items": {
            //"燃气表照片":{"index":1,"type":"picture","remark":"(拍摄清晰的表具编号、字轮数、剩余气量等)"},
            "基表编号": { "index": 1, "type": "string", "readonly": true },
            "气表型号": { "index": 2, "type": "string", "readonly": true },
            "气表品牌": { "index": 3, "type": "string", "readonly": true },
            "进气方向": { "index": 4, "type": "string", "readonly": true },
            // "初始表底":{"index":5,"type":"number","isshow":false,"readonly":true},
            "上期表读数": { "index": 5, "type": "number", "readonly": true, isshow: false },
            "表读数": { "index": 6, "type": "number", "readonly": true },
            "表剩余金额": { "index": 7, "type": "number", "readonly": true },
            "字轮数": { "index": 8, "type": "number", "checkmust": true },//基表数
            "表余额": { "index": 9, "type": "number", "checkmust": true },
            //显示屏数  --实际剩余气量
            "表数异常差值": { "index": 10, "type": "number", "readonly": true },
            "表金额异常差值": { "index": 11, "type": "number", "readonly": true },
            "差值备注": { "index": 12, "type": "string", "readonly": false }
          }
        }
      },
    }
  },
  components: {
    RadioGroup,
    Radio,
  },
  computed: {
    selector: {
      get() {
        return 'paper-state'
      },
      set(val) {
        if (this.isStrat) {
          debugger;
          this.$goto(val, { userinfo: this.data }, 'paper-router')
        } else {
          this.$showMessage('未开始安检！')
        }
      }
    },
    actionEnabled: {
      get() {
        return this.role == 'inspect'
      }
    },
    // 添加新的计算属性
    overallImagePaths() {
      return this.data.f_overall_imgs ? this.data.f_overall_imgs.map(img => img.f_overall_path) : []
    }
  },
  methods: {
    spotCheck(state){
      this.spotCheckData = {
        f_spot_check_person:this.$login.f.name,
        f_spot_check_date:Util.toStandardTimeString(),
        f_check_upload_org_id:this.data.f_filialeid,
        f_check_id:this.data.id,
        f_check_type:'安检单',
        f_check_upload_date:this.data.f_upload_date,
        f_check_upload_person:this.item.f_checker_name,
        f_spot_check_org_id:this.$login.f.orgid,
        f_spot_check_state:state,
        f_spot_check_remark:''
      }
      if (state == '工单不合格'){
        this.modalShow = true
        return
      }
      this.spotCheckUpload()
    },
    spotCheckUpload(){
      new HttpResetClass().load('post','api/af-safecheck/logic/saveSpotCheck',{data:this.spotCheckData}).then(response=>{
        this.modalShow = false
        this.spot = true
        this.spotCheckData = {}
      }).catch(error=>{
        this.modalShow = false
      })
    },
    delConfigKey(obj) {
      // 从琉璃中获取的配置中会包含 $开头的一些额外描述新的key。为了兼容v3的代码逻辑在此函数中去掉
      Object.keys(obj).forEach(key => {
        Object.keys(obj[key]).forEach(col => {
          // 检查键是否以$开头
          if (col.startsWith('$')) {
            // 使用delete操作符删除键
            delete obj[key][col];
          }
        })
      })
    },
    open_f() {
      // 打开组件
      this.showpaperImg = true
      console.log('打开图片查看器')
    },
    clone_p() {
      // 关闭组件
      this.showpaperImg = false
      console.log('关闭图片查看器')
    },
    devicesCollect() {
      this.deviceCollects = []
      let checkResult = '正常'
      this.result = '正常'

      // 遍历所有设备数据
      for (const deviceKey in this.data) {
        if (deviceKey.startsWith('device')) {
          this.data[deviceKey].forEach(device => {
            let deviceInfos = []
            let hasDefect = false

            device.f_items.forEach(item => {
              // 检查是否有隐患标记
              if (item.f_is_defect && item.f_is_defect === 'true') {
                hasDefect = true
                const defectValue = Array.isArray(item.f_item_value) ?
                  item.f_item_value.join(',') :
                  item.f_item_value
                deviceInfos.push(`${item.f_item_name}:${defectValue}`)
              }

              // 检查选择型隐患
              if ((item.type === 'selector' || item.type === 'radio' || item.type === 'checkbox')
                && Array.isArray(item.f_item_value)) {
                item.f_item_value.forEach(value => {
                  if (value){
                    if (value.includes('隐患') || value.includes('不合格')) {
                      hasDefect = true
                      deviceInfos.push(`${item.f_item_name}:${value}`)
                    }
                  }else {
                    console.log(value)
                  }
                })
              }

              // 检查特殊隐患项
              if (item.f_item_name === '金额异常差值' || item.f_item_name === '表金额异常差值') {
                const deviation = this.$appdata.getSingleValue('金额异常差值允许误差')
                const value = parseFloat(item.f_item_value[0])
                if (!isNaN(value) && !isNaN(parseFloat(deviation))) {
                  if (value > parseFloat(deviation) || value < parseFloat(deviation) * -1 || value < 0) {
                    hasDefect = true
                    deviceInfos.push(`${item.f_item_name}:${value}`)
                  }
                }
              }

              if (item.f_item_name === '气量异常差值' || item.f_item_name === '表气量异常差值') {
                const deviation = this.$appdata.getSingleValue('气量异常差值允许误差')
                const value = parseFloat(item.f_item_value[0])
                if (!isNaN(value) && !isNaN(parseFloat(deviation))) {
                  if (value > parseFloat(deviation) || value < parseFloat(deviation) * -1) {
                    hasDefect = true
                    deviceInfos.push(`${item.f_item_name}:${value}`)
                  }
                }
              }
            })

            // 如果有隐患，添加到 deviceCollects
            if (hasDefect) {
              checkResult = '有隐患'
              this.result = '有隐患'
              this.deviceCollects.push({
                name: device.f_device_type,
                value: '有隐患',
                devices: deviceInfos
              })
            }
          })
        }
      }

      this.ajresult = JSON.parse(this.data.f_defect_content).result
      this.showimg3 = this.data.f_noanswer_path
      this.showimg4 = this.data.f_rejectcheck_path
      this.loading = false
    },
    imgclose() {
      this.imgshow2 = false
    },
    putDevices() {
      //console.log('Vue.config.safecheck', Vue.config.safecheck.safetype)
      this.$set('data.approve', "true")
      this.$set('data.writeback', "false")
      if (Vue.config.safecheck && Vue.config.safecheck.ApproveConfig != undefined) {
        if (Vue.config.safecheck.ApproveConfig.approve != undefined) {
          this.$set('data.approve', Vue.config.safecheck.ApproveConfig.approve)
        }
        if (Vue.config.safecheck.ApproveConfig.writeback != undefined) {
          this.$set('data.writeback', Vue.config.safecheck.ApproveConfig.writeback)
        }
        if (Vue.config.safecheck.ApproveConfig.livedispose != undefined) {
          this.livedispose = Vue.config.safecheck.ApproveConfig.livedispose
        }
      }
      console.log('当前安检类型----' + this.item.f_safecheck_type)

      console.log(JSON.stringify(this.data))
      if (!this.item.f_safecheck_type) {
        this.config = this.extend(this.config, Vue.config.safecheck[Vue.config.safecheck.SafecheckType['年度普检'][this.item.f_check_type]])
      } else {
        if (this.item.f_offsite_time < '2021-07-20 20:54:02') {
          if (this.item.f_safecheck_type = '民用') {
            this.config = this.extend(this.config, Vue.config.safecheck.SafeDevicesVersion.v1.DevicesConfig)
          } else {
            this.config = this.extend(this.config, Vue.config.safecheck.DevicesSetConfig)
          }
        } else if (this.item.f_offsite_time < '2025-02-26 22:00:00') {
          if (this.item.f_safecheck_type = '民用') {
            this.config = this.extend(this.config, Vue.config.safecheck.SafeDevicesVersion.v2.DevicesConfig)
          } else {
            this.config = this.extend(this.config, Vue.config.safecheck.DevicesSetConfig)
          }
        } else {
          if (Vue.config.safecheck.DevicesConfig != undefined)
            this.config = this.extend(this.config, Vue.config.safecheck[Vue.config.safecheck.SafecheckType[this.item.f_safecheck_type][this.item.f_check_type]])

        }
      }
      //遍历安检项配置
      for (let i in this.config) {
        //取得安检项索引值
        let n = this.config[i].index
        this.devices[n - 1] = { device: i, n: n, checkmust: this.config[i].checkmust }
        this.$set('data.' + 'device' + n, [])
        let items = []
        for (let it in this.config[i].items) {
          //赋值下拉选项
          if (this.config[i].items[it].type == 'selector') {
            for (let op in this.config[i].items[it].options)
              if (this.config[i].items[it].options[op].isdefault == true) {
                items.push({
                  f_defect_level: this.config[i].items[it].options[op].level,
                  f_is_defect: this.config[i].items[it].options[op].isdefect,
                  f_item_name: it,
                  f_item_value: this.config[i].items[it].options[op].data,
                  f_path: "",
                  type: "selector"
                })
              }
          }
        }
        n = n + 1
      }

    },
    showpath(val1, val2) {
      console.log("555555555555555555")
      console.log(val1)
      if (val1) {
        this.showimg1 = val1
        this.picturename = val2
        this.imgshow = true
      }
    },
    showpicture(val1, val2) {
      if (val2 == '气量异常差值' || val2 == '金额异常差值') {
        return
      }
      for (let i = 0; i < this.devicesAll.length; i++) {
        for (let j = 0; j < this.devicesAll[i].length; j++) {
          if (this.devicesAll[i][j].f_device_type == val1) {
            for (let k = 0; k < this.devicesAll[i][j].f_items.length; k++) {
              if (this.devicesAll[i][j].f_items[k].f_item_name == val2) {
                if (!this.devicesAll[i][j].f_items[k].f_is_defect) {
                  return
                } else {
                  this.showimg1 = this.devicesAll[i][j].f_items[k].f_path
                  this.showimg2 = this.devicesAll[i][j].f_items[k].f_second_path
                  this.picturename = '隐患照片'
                  this.imgshow = true
                }
              }
            }

          }
        }
      }
    },
    showpicture2() {
      this.imgshow2 = true
    },
    getDeviceValue(deviceType, itemName) {
      console.log('deviceType==', deviceType)
      console.log('itemName==', itemName)
      console.log('this==', this)
      // 先从当前配置中查找
      for (const deviceKey in this.data) {
        if (deviceKey.startsWith('device')) {
          for (const device of this.data[deviceKey]) {
            if (device.f_device_type === deviceType) {
              const item = device.f_items.find(item => item.f_item_name === itemName)
              if (item) {
                // 如果是数组，用逗号连接
                return Array.isArray(item.f_item_value) ?
                  item.f_item_value.join(',') :
                  item.f_item_value
              }
            }
          }
        }
      }
      return ''
    },
    getDevicePath(val1, val2) {
      for (let i = 0; i < this.devicesAll.length; i++) {
        for (let j = 0; j < this.devicesAll[i].length; j++) {
          if (this.devicesAll[i][j].f_device_type == val1) {
            for (let k = 0; k < this.devicesAll[i][j].f_items.length; k++) {
              if (this.devicesAll[i][j].f_items[k].f_item_name == val2) {
                return this.devicesAll[i][j].f_items[k].f_path
              }
            }

          }
        }
      }

    },
    getDeviceAll() {
      let keyall = Object.keys(this.data)
      for (let i = 0; i < keyall.length; i++) {
        console.log(JSON.stringify(keyall))
        if (keyall[i].startsWith('device') && keyall[i] != 'deviceundefined') {
          this.devicesAll.push(this.data[keyall[i]])
          console.log(keyall[i])
        }
      }
      console.log("666666666666666666")
      console.log(JSON.stringify(this.devicesAll))
      this.devicesCollect()

    },

    back() {
      if (this.role == 'inspect') {
        if (!this.isStrat) {
          this.$back()
          return
        } else {
          this.savePaper(true).then(() => {
            this.$back()
            this.isStrat = false
          })
        }
      } else {
        this.$back()
      }
    },
    checkIsStart() {
      alert('asdad')
      return
    },

    viewPic(fileName) {
      console.log('view pic: ' + fileName)
      if (this.role == 'view') {
        if (!fileName.endsWith('nopic.png')) {
          this.pic_to_be_viewed = fileName
          this.showModal = true
        }
      } else {
        HostApp.viewPic(fileName)
      }
    },
    tick() {
      this.timer = null
      this.data.f_offsite_time = Util.toStandardTimeString()
      this.timer = window.setTimeout(this.tick, 1000)
    },
    getRepairState() {
      let repaired = true
      this.data.f_defects.forEach((defect) => {
        repaired = repaired & (defect.f_ratification == '已处理')
      })
      return repaired
    },
    verifyRepairDefects() {
      this.data.f_repair_date = Util.toStandardTimeString()
      this.data.f_repaired = this.getRepairState() ? '已修' : '在修'
    },
    genuineSave(saveOnly) {
      HostApp.__this__.save(saveOnly)
      if (!saveOnly)
        HostApp.__this__.disableTimer()
      HostApp.__callback__ = null
      HostApp.__this__ = null
    },
    setUrgency() {
      this.data.f_defect_urgency = 'Z'
      let that = this
      this.data.f_defects.forEach(function (defect) {
        if (that.data.f_defect_urgency > defect.f_defect_level.charAt(0))
          that.data.f_defect_urgency = defect.f_defect_level.charAt(0)
      })
      if (this.data.f_defect_urgency == 'Z')
        this.data.f_defect_urgency = null
    },
    disableTimer() {
      if (this.timer) {
        window.clearTimeout(this.timer)
        this.timer = null
      }
    },
    loaded(paper) {
      if (!paper.hasOwnProperty('id')) {
        this.$showMessage("该安检单在手机上已经不存在，可能是卸载过程序。可以进入重新安检，或返回安检计划。")
        this.init()
      } else {
        Util.booleanFilter(paper)
        HostApp.__this__.$set('data', paper)
        HostApp.__this__.$goto('paper-state', {}, 'paper-router')
        // 如果打回重检则重新计时
        console.log('HostApp.__this__.role' + HostApp.__this__.role + ' HostApp.__this__.f_approved:' + HostApp.__this__.data.f_approved)
        if (HostApp.__this__.role == 'inspect'
          && HostApp.__this__.data.f_approved
          && HostApp.__this__.data.f_approved == '打回') {
          console.log('打回')
          HostApp.__this__.data.f_onsite_time = Util.toStandardTimeString()
          HostApp.__this__.tick()
        }
      }
      HostApp.__callback__ = null
      HostApp.__this__ = null
    },
    S4() {
      return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
    },
    init() {
      this.data.f_noplan_item_id = this.S4() + "" + this.S4() + "" + this.S4() + "" + this.S4() + "" + this.S4() + "" + this.S4() + "" + this.S4()
      this.data.ename = Vue.user.ename
      this.data.f_outlets = Vue.user.f_parentname
      this.data.f_meetunit = Vue.user.orgpathnames
      this.data.orgpathstr = Vue.user.orgpathstr
      this.data.f_check_item_id = this.item.id
      this.data.f_check_plan_id = this.f_plan_id
      this.data.f_checker_id = Vue.user.id
      this.data.f_checker_name = Vue.user.name
      this.data.f_check_type = this.item.f_user_type
      this.data.f_subcompany = this.item.f_subcompany
      this.data.f_approved = this.item.f_approved
      this.data.f_repair_approved = this.item.f_repair_approved
      this.data.f_no_checkplan = this.item.f_no_checkplan
      this.data.f_approved = this.item.f_approved
      this.data.f_filialeid = this.item.f_filialeid
      this.data.f_orgstr = this.item.f_orgstr
      this.data.version = this.item.version
      this.$set('data.f_meters', this.item.f_plan_meters)
      this.$set('data.f_userinfo_code', this.item.f_userinfo_code)
      // 安检状态
      this.$set('data.f_entry_status', '入户')
      this.$set('data.f_usegas', '已使用')
      this.$set('data.f_state', this.item.f_state)
      // 用户信息
      this.$set('data.f_user_name', this.item.f_user_name)
      this.$set('data.f_user_phone', this.item.f_user_phone)
      this.$set('data.f_userinfoid', this.item.f_userinfoid)
      this.$set('data.f_address', this.item.f_address)
      this.$set('data.f_card_id', this.item.f_card_id)
      this.$set('data.f_area', this.item.f_area)
      this.$set('data.f_street', this.item.f_street)
      this.$set('data.f_room', this.item.f_room)
      this.$set('data.f_building', this.item.f_building)
      this.$set('data.f_unit', this.item.f_unit)
      this.$set('data.f_floor', this.item.f_floor)
      this.$set('data.f_residential_area', this.item.f_residential_area)
      this.$set('data.f_idnumber', this.item.f_idnumber)
      this.$set('data.f_comments', this.item.f_comments)
      this.$set('data.f_userproperties', this.item.f_userproperties)
      // 处置方式
      this.$set('data.f_no_gas_device', false)
      this.$set('data.f_close_valve', false)
      this.$set('data.f_unload_battery', false)
      if (this.data.f_check_item_id == '' && this.item.f_no_checkplan == '无计划安检') {
        this.data.f_check_item_id = this.data.f_noplan_item_id
      }

      //房屋结构
      // this.$set('data.f_room_style', '多层')
      //供暖方式
      //  this.$set('data.f_heating_style', '热力公司集中供暖')
      if (this.item.f_plan_meters) {
        for (let de in this.devices) {
          this.$set('data.device' + this.devices[de].n, [])
          for (let i = 0; i < this.item.f_plan_meters.length; i++) {
            if (this.item.f_plan_meters[i].f_meter_type) {
              if (this.devices[de].device == "燃气表" && this.item.f_plan_meters[i].f_meter_type.indexOf('机表') > 0) {
                delete this.config['燃气表']['items']['累计购气量']
                this.data['device' + this.devices[de].n].push({
                  f_device_type: "燃气表",
                  f_items: [{
                    f_defect_level: null,
                    f_device_id: "",
                    f_is_defect: "",
                    f_item_name: "表品牌",
                    f_item_value: this.item.f_plan_meters[i].f_aliasname,
                    f_path: "",
                    type: "string"
                  },
                    {
                      f_defect_level: null,
                      f_device_id: "",
                      f_is_defect: "",
                      f_item_name: "位置",
                      f_item_value: this.item.f_plan_meters[i].f_weizhi,
                      f_path: "",
                      type: "selector"
                    },
                    {
                      f_defect_level: null,
                      f_device_id: "",
                      f_is_defect: "",
                      f_item_name: "表号",
                      f_item_value: this.item.f_plan_meters[i].f_meter_no,
                      f_path: "",
                      type: "number"
                    },
                    {
                      f_defect_level: null,
                      f_device_id: "",
                      f_is_defect: "",
                      f_item_name: "表封号",
                      f_item_value: this.item.f_plan_meters[i].f_metertitles,
                      f_path: "",
                      type: "number"
                    },
                    {
                      f_defect_level: null,
                      f_device_id: "",
                      f_is_defect: "",
                      f_item_name: "表型号",
                      f_item_value: this.item.f_plan_meters[i].f_diaphgram_size,
                      f_path: "",
                      type: "selector"
                    },
                    {
                      f_defect_level: null,
                      f_device_id: "",
                      f_is_defect: "",
                      f_item_name: "表底数",
                      f_item_value: this.item.f_plan_meters[i].f_prior_reading,
                      f_path: "",
                      type: "number"
                    }
                  ]
                })
              } else if (this.devices[de].device == "燃气表") {
                delete this.config['燃气表']['items']['表底数']
                this.data['device' + this.devices[de].n].push({
                  f_device_type: "燃气表",
                  f_items: [{
                    f_defect_level: null,
                    f_device_id: "",
                    f_is_defect: "",
                    f_item_name: "表品牌",
                    f_item_value: this.item.f_plan_meters[i].f_aliasname,
                    f_path: "",
                    type: "string"
                  },
                    {
                      f_defect_level: null,
                      f_device_id: "",
                      f_is_defect: "",
                      f_item_name: "位置",
                      f_item_value: this.item.f_plan_meters[i].f_weizhi,
                      f_path: "",
                      type: "selector"
                    },
                    {
                      f_defect_level: null,
                      f_device_id: "",
                      f_is_defect: "",
                      f_item_name: "表号",
                      f_item_value: this.item.f_plan_meters[i].f_meter_no,
                      f_path: "",
                      type: "number"
                    },
                    {
                      f_defect_level: null,
                      f_device_id: "",
                      f_is_defect: "",
                      f_item_name: "表封号",
                      f_item_value: this.item.f_plan_meters[i].f_metertitles,
                      f_path: "",
                      type: "number"
                    },
                    {
                      f_defect_level: null,
                      f_device_id: "",
                      f_is_defect: "",
                      f_item_name: "表型号",
                      f_item_value: this.item.f_plan_meters[i].f_diaphgram_size,
                      f_path: "",
                      type: "selector"
                    },
                    {
                      f_defect_level: null,
                      f_device_id: "",
                      f_is_defect: "",
                      f_item_name: "累计购气量",
                      f_item_value: this.item.f_plan_meters[i].f_prior_reading,
                      f_path: "",
                      type: "number"
                    }
                  ]
                })
              }
            }
          }
        }
      }

      this.$goto('paper-state', {}, 'paper-router')
    },
    extend(initalObj, finalObj) {
      var obj = finalObj || {};
      for (var i in initalObj) {
        var prop = initalObj[i];

        // 避免相互引用对象导致死循环，如initalObj.a = initalObj的情况
        if (prop === obj) {
          continue;
        }

        if (typeof prop === 'object') {
          if (obj[i]) {
            this.extend(obj[i], prop)
          } else {
            obj[i] = prop;
          }
        }
      }
      return obj;
    },
    //获取当前时间
    getNowFormatDate() {
      var date = new Date();
      var seperator1 = "-";
      var seperator2 = ":";
      var month = date.getMonth() + 1;
      var strDate = date.getDate();
      if (month >= 1 && month <= 9) {
        month = "0" + month;
      }
      if (strDate >= 0 && strDate <= 9) {
        strDate = "0" + strDate;
      }
      var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate
        + " " + date.getHours() + seperator2 + date.getMinutes()
        + seperator2 + date.getSeconds();
      return currentdate;
    }
  },
  ready() {
    if (this.item.f_spot_state && this.item.f_spot_state == 'ok'){
      this.spot = true
    }
    asyncReady(this).then(() => {
      this.putDevices()
      console.log('CONFIG==', JSON.stringify(this.config))
      if (this.item.f_state != '未检' || this.item.f_no_checkplan == '无计划安检') {
        if (this.role != 'inspect') {
          let that = this
          let id = this.role == 'view' ? this.item.id : this.item.f_paper_id

          new HttpResetClass().load('post',`${this.$androidUtil.getProxyUrl()}/api/af-safecheck/logic/path_getCheckPaper`, { id: id }).then((respanse) => {
            if (respanse.data.length != 0) {
              if (respanse.data[0].f_spot_state && respanse.data[0].f_spot_state == 'ok'){
                this.spot = true
              }
              // 先合并历史配置到当前配置
              if (respanse.data[0].f_devices) {
                respanse.data[0].f_devices.forEach((savedDevice) => {
                  const deviceType = savedDevice.f_device_type

                  // 如果设备类型不存在于当前配置，则添加
                  if (!this.config[deviceType]) {
                    this.config[deviceType] = {
                      checkmust: true,
                      index: Object.keys(this.config).length + 1,
                      items: {}
                    }
                  }

                  // 合并检查项
                  savedDevice.f_items.forEach((savedItem) => {
                    const itemName = savedItem.f_item_name
                    if (!this.config[deviceType].items[itemName]) {
                      this.config[deviceType].items[itemName] = {
                        index: Object.keys(this.config[deviceType].items).length + 1,
                        type: savedItem.type || 'string',
                        readonly: true
                      }
                    }
                  })
                })
              }

              // 处理数据
              that.data = Object.assign(that.data, respanse.data[0])
              console.log('respanse.data[0].f_devices', respanse.data[0].f_devices)
              if (respanse.data[0].f_devices) {
                for (let da in that.devices) {
                  that.$set('data.device' + that.devices[da].n, [])
                }
                console.log('that.devices==', that.devices)
                respanse.data[0].f_devices.forEach((item) => {
                  for (let de in that.devices) {
                    if (that.devices[de].device == item.f_device_type) {
                      item.f_items.forEach((f_item) => {
                        console.log("9527")
                        console.log('f_item====>', JSON.stringify(f_item))
                        if (f_item.f_is_defect == 'true') {
                          this.defectNames.push(f_item.f_item_name)
                        }
                        if (f_item.f_item_name == '字轮数') {
                          console.log("9529")
                          this.iswlw = true
                        }
                        /*console.log('f_item.f_path====>', f_item.f_path)*/
                        let itemValues = []
                        f_item.f_item_lists.forEach((tempItem) => {
                          // console.log('emm => ', f_item.f_item_name, '   ', tempItem.f_item_value)
                          if (tempItem.f_item_value !== 'null') {
                            itemValues.push(tempItem.f_item_value)
                          }
                        })
                        f_item.f_item_value = itemValues
                      })
                      that.data['device' + that.devices[de].n].push({
                        f_device_type: item.f_device_type,
                        f_items: item.f_items
                      })
                    }
                  }
                })
              }

              // 根据时间和类型选择配置
              this.deviceconfig = JSON.parse(JSON.stringify(this.config))
              // 处理特殊配置
              if (this.iswlw) {
                this.deviceconfig["燃气表"] = this.config3["燃气表"]
              } else if (this.data.f_collection_type == '按金额') {
                /*if (this.data.f_collection_type == '按气量') {
                  this.deviceconfig["燃气表"] = this.config["燃气表"]
                } else */
                this.deviceconfig["燃气表"] = this.config2["燃气表"]
              }

              // 更新排序后的配置
              this.deviceconfig2 = ObjConfig.getObjConfig(JSON.parse(JSON.stringify(this.deviceconfig)))
              this.deviceconfig2.forEach(config => {
                config.items = jsonSort(config.items, "index")
              })
              this.deviceconfig2 = jsonSort(this.deviceconfig2, "index")

              this.getDeviceAll()
            }
          }).catch((respanse) => {
            console.log('respanse', respanse)
            alert('查找安检单失败!')
          })
        }
      }
    })
  },
  watch: {
    'data.f_overall_imgs'(val) {
      console.log('安检总体照片55555555发生变化===>', val)
      this.paperImgs = []
      if (val) {
        for (var i in val) {
          console.log(i)
          console.log(val[i])
          console.log(val[i].f_overall_path)
          if (val[i].f_overall_path)
            this.paperImgs.push({ url: '/rs/image/file/' + val[i].f_overall_path })
        }
      }
      console.log('照片URL+++++》》》', this.paperImgs)
      if (this.paperImgs.length > 0) {
        this.linenumber = Math.ceil(this.paperImgs.length / 3)
        console.log('行数--linenumber', this.linenumber)
      }
    }
    /*,
    'data.f_noanswer_path'(val){
      console.log('不遇照片55555555发生变化===>',val)
      this.paperImgs = []
      if(val) {
            this.paperImgs.push({url: val})
      }
      console.log('照片URL+++++》》》',this.paperImgs)
      if(this.paperImgs.length>0) {
        this.linenumber = Math.ceil(this.paperImgs.length / 3)
        console.log('行数--linenumber',this.linenumber)
      }
    },
    'data.f_rejectcheck_path'(val){
      console.log('拒检照片55555555发生变化===>',val)
      this.paperImgs = []
      if(val) {
        this.paperImgs.push({url: val})
      }
      console.log('照片URL+++++》》》',this.paperImgs)
      if(this.paperImgs.length>0) {
        this.linenumber = Math.ceil(this.paperImgs.length / 3)
        console.log('行数--linenumber',this.linenumber)
      }
    }*/
  },
  destroyed() {
    console.log('退出当前页Set')
    this.disableTimer()
  }
}

</script>
