<template>
  <form novalidate class="form-horizontal" style="width: 95%;margin: auto;border:15px;position: relative;top: 40px">
    <!--<div class="form-group" style="margin-top: 8px">-->
    <!--<span class="col-md-4 col-sm-4 col-xs-4" style="margin-top: 8px;"> <img src="../../assets/clock.png" style="width: 20px;text-align: left" alt="">开始安检:</span>-->
    <!--<div class="col-md-8 col-sm-8 col-xs-8 text-center">-->
    <!--<button :disabled="$parent.$parent.startClick" class="btn btn-start" type="button"  @click="start">开始&nbsp;&nbsp;&nbsp;<img src="../../assets/startTime.png" style="width: 20px;margin-bottom: 5px" v-show="action" alt="">-->
    <!--<img src="../../assets/pausetime.png" v-show="!action" style="width: 20px;margin-bottom: 5px" alt=""></button>-->
    <!--</div>-->
    <!--</div>-->
    <div class="form-group"  v-if="$parent.$parent.f_no_checkplan != '一级隐患跟进单' || ($parent.$parent.f_no_checkplan == '一级隐患跟进单' && f_followup_way == '上门跟进')">
      <span class="col-md-4 col-sm-4 col-xs-4"> <img src="../../assets/showtime.png" style="width: 20px;margin-bottom: 5px;text-align: left" alt="">到达时间:</span>
      <div class="col-md-8 col-sm-8 col-xs-8">
        <input readonly="readonly" style="width: 100%" type="text" v-model="$parent.$parent.data.f_onsite_time" class=" form-control text-center time-input"/>
      </div>
    </div>
    <div class="form-group" v-if="$parent.$parent.f_no_checkplan != '一级隐患跟进单' || ($parent.$parent.f_no_checkplan == '一级隐患跟进单' && f_followup_way == '上门跟进')">
      <span class="col-md-4 col-sm-4 col-xs-4"> <img src="../../assets/showtime.png" style="width: 20px;margin-bottom: 5px;text-align: left" alt="">离开时间:</span>
      <div class="col-md-8 col-sm-8 col-xs-8">
        <input readonly="readonly" style="width: 100%" type="text" v-model="$parent.$parent.data.f_offsite_time" class="form-control text-center time-input"/>
      </div>
    </div>
    <div class="form-group" v-if="$parent.$parent.f_no_checkplan == '一级隐患跟进单'">
      <span class="col-md-4 col-sm-4 col-xs-4  text-left"><img src="../../assets/housestyle.png" style="width: 20px;margin-bottom: 5px;text-align: left" alt="">跟进方式:</span>
      <div :class="style__" class="col-md-8 col-sm-8 col-xs-8 text-center">
        <input type="radio" name="followway" v-model="f_followup_way" id="followphone" value="电话跟进" :disabled="$parent.$parent.role == 'androidview'">电话跟进
        <input type="radio" name="followway" v-model="f_followup_way" id="recordfollow" value="记录跟进"  :disabled="$parent.$parent.role == 'androidview'">记录跟进
        <input type="radio" name="followway" v-model="f_followup_way" id="enter" value="上门跟进"  :disabled="$parent.$parent.role == 'androidview'">上门跟进
        <!--  <radio-group :value.sync="f_entry_status" :type="f_entry_class" buttons="false">
            <radio value="到访不遇">到访不遇</radio>
            <radio value="拒检">拒检</radio>
            <radio value="入户">入户</radio>
          </radio-group>-->
      </div>
      <div class="form-group col-sm-12 col-xs-12" v-show="f_followup_way=='电话跟进'">
        <label class="text-left font">电话跟进记录照片：</label>
        <div class="auto">
          <div class="panel" style="padding: 10px 10px 5px 10px;">
            <div class="panel-body panel-self" style="background-color: #F8F8F8;width: 100%;height: 260px;position: relative">
              <div class="row col-xs-12 col-sm-6 col-md-6" style="height: 240px;overflow: scroll;top: 1px">
                <div class="col-sm-4">
                  <img-self :src="f_followphone_path" alt="电话跟进记录照片" width="150" height="200"> </img-self>
                </div>
              </div>
              <div class="row col-xs-12 col-sm-6 col-md-6 text-right div-photo">
                <button type="button" name="button" class="btn btn-primary btn-photo"  @click="takePic('f_followphone_path', '电话跟进记录照片')">拍照</button>
                &nbsp;&nbsp;&nbsp;&nbsp;<img src="../../assets/remove.png" :class="style__"  @click="delfile('f_followphone_path', this.f_followphone_path)" style="width: 25%;"></img>
              </div>
            </div>
          </div>
        </div>
      </div>
      <div class="form-group col-sm-12 col-xs-12" v-show="f_followup_way=='记录跟进'">
        <label class="text-left font">记录跟进照片：</label>
        <div class="auto">
          <div class="panel" style="padding: 10px 10px 5px 10px;">
            <div class="panel-body panel-self" style="background-color: #F8F8F8;width: 100%;height: 260px;position: relative">
              <div class="row col-xs-12 col-sm-6 col-md-6" style="height: 240px;overflow: scroll;top: 1px">
                <div class="col-sm-4">
                  <img-self :src="f_recordfollow_path" alt="记录跟进照片" width="150" height="200"> </img-self>
                </div>
              </div>
              <div class="row col-xs-12 col-sm-6 col-md-6 text-right div-photo">
                <button type="button" name="button" class="btn btn-primary btn-photo"  @click="takePic('f_recordfollow_path', '记录跟进照片')">拍照</button>
                &nbsp;&nbsp;&nbsp;&nbsp;<img src="../../assets/remove.png" :class="style__"  @click="delfile('f_recordfollow_path', this.f_recordfollow_path)" style="width: 25%;"></img>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="form-group" v-if="$parent.$parent.f_no_checkplan != '一级隐患跟进单' || ($parent.$parent.f_no_checkplan == '一级隐患跟进单' && f_followup_way == '上门跟进')">
<!--      <span class="col-md-4 col-sm-4 col-xs-4  text-left"><img src="../../assets/housestyle.png" style="width: 20px;margin-bottom: 5px;text-align: left" alt="">验收结果:</span>-->
<!--      <div :class="style__" class="col-md-8 col-sm-8 col-xs-8 text-center" v-if="$parent.$parent.f_no_checkplan == '点火通气单'">-->
<!--        <input type="radio" name="verifyresult" v-model="f_verify_result" id="1" value="通过"  :disabled="$parent.$parent.role == 'androidview'">通过-->
<!--        <input type="radio" name="verifyresult" v-model="f_verify_result" id="2" value="未通过"  :disabled="$parent.$parent.role == 'androidview'">未通过-->
<!--      </div>-->
      <span class="col-md-4 col-sm-4 col-xs-4  text-left"><img src="../../assets/housestyle.png" style="width: 20px;margin-bottom: 5px;text-align: left" alt="">入户状态:</span>
      <div :class="style__" class="col-md-8 col-sm-8 col-xs-8 text-center">
        <input type="radio" name="enterstatus" v-model="f_entry_status" id="nopeople" value="到访不遇"  :disabled="$parent.$parent.role == 'androidview'">到访不遇
        <input type="radio" name="enterstatus" v-model="f_entry_status" id="rejectchecck" value="拒检"  :disabled="$parent.$parent.role == 'androidview'">拒检
        <input type="radio" name="enterstatus" v-model="f_entry_status" id="enterhouse" value="入户"  :disabled="$parent.$parent.role == 'androidview'">入户
        <!--  <radio-group :value.sync="f_entry_status" :type="f_entry_class" buttons="false">
            <radio value="到访不遇">到访不遇</radio>
            <radio value="拒检">拒检</radio>
            <radio value="入户">入户</radio>
          </radio-group>-->
      </div>
      <div class="form-group col-sm-12 col-xs-12" v-show="f_entry_status=='到访不遇'" style="margin-top: 6px">
        <span class="text-left col-md-4 col-sm-4 col-xs-4"> <img src="../../assets/enterstatus.png" style="width: 20px;margin-bottom: 5px;text-align: left" alt="">到访不遇情况:</span>
        <div :class="style__" class="col-md-8 col-sm-8 col-xs-8 text-center">
          <input type="radio" name="isuseed" v-model="f_visit_state" id="useedgas" value="未在"  :disabled="$parent.$parent.role == 'androidview'">未在
          <input type="radio" name="isuseed" v-model="f_visit_state" id="nousegas" value="长期无人"  :disabled="$parent.$parent.role == 'androidview'">长期无人
          <input type="radio" name="isuseed" v-model="f_visit_state" id="nousegas" value="毛坯房"  :disabled="$parent.$parent.role == 'androidview'">毛坯房
          <!--<radio-group :value.sync="f_usegas" :type="f_useclass" buttons="false">
            <radio value="已使用">已使用</radio>
            <radio value="未使用">未使用</radio>
          </radio-group>-->
        </div>
      </div>
      <div class="form-group col-sm-12 col-xs-12" v-show="f_entry_status=='到访不遇'">
        <label class="text-left font">到访不遇照片：</label>
        <div class="auto">
          <div class="panel" style="padding: 10px 10px 5px 10px;">
            <div class="panel-body panel-self" style="background-color: #F8F8F8;width: 100%;height: 260px;position: relative">
              <div class="row col-xs-12 col-sm-6 col-md-6" style="height: 240px;overflow: scroll;top: 1px">
                <div class="col-sm-4"v-for="(index,img) in f_noanswer_paths">

                  <img-self :src="img.f_noanswer_path" alt="到访不遇照片" width="150" height="200"> </img-self>
                  <img src="../../assets/remove.png" :class="style__"  @click="delfile('f_noanswer_paths', img.f_noanswer_path,index)" style="width: 25%;">
                </div>
              </div>
              <div class="row col-xs-12 col-sm-6 col-md-6 text-right div-photo">
                <button type="button" name="button" class="btn btn-primary btn-photo"  @click="takePic('f_noanswer_paths', '到访不遇照片')"  :disabled="$parent.$parent.role == 'androidview'">拍照</button>
              </div>
            </div>
          </div>
        </div>
      </div>
      <div class="form-group col-sm-12 col-xs-12" v-show="f_entry_status=='拒检'">
        <label class="text-left font">拒检照片：</label>
        <div class="auto">
          <div class="panel" style="padding: 10px 10px 5px 10px;">
            <div class="panel-body panel-self" style="background-color: #F8F8F8;width: 100%;height: 260px;position: relative">
              <div class="row col-xs-12 col-sm-6 col-md-6" style="height: 240px;overflow: scroll;top: 1px">
                <div class="col-sm-4"v-for="(index,img) in f_rejectcheck_paths">
                  <img-self :src="img.f_rejectcheck_path" alt="拒检照片" width="150" height="200"> </img-self>
                  <img src="../../assets/remove.png" :class="style__"  @click="delfile('f_rejectcheck_paths', img.f_rejectcheck_path,index)" style="width: 25%;"></img>
                </div>
              </div>
              <div class="row col-xs-12 col-sm-6 col-md-6 text-right div-photo">
                <button type="button" name="button" class="btn btn-primary btn-photo" @click="takePic('f_rejectcheck_paths', '拒检照片')"  >拍照</button>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div :class="style__" class="form-group" v-show="f_usegas == '未使用'">
      <sapn class="text-left col-md-12 col-sm-12 col-xs-12">处置方式：</sapn>
      <div class="col-xs-12 col-sm-12 col-md-12">
        <input type="checkbox" v-model="f_no_gas_device">无燃气具
        <input type="checkbox" v-model="f_close_valve">关闭表前阀
        <input type="checkbox" v-model="f_unload_battery">取下表内电池
      </div>
    </div>
    <div class="auto app-text" style="margin-top: 5px;" v-if="this.$parent.$parent.role != 'view'">
      <div class="panel" style="padding: 10px 10px 5px 10px;">
        <div class="panel-body panel-self">
          <div class="row col-xs-12 col-sm-6 col-md-6" v-if="last_check_date ">
            <p class="panel-title col-xs-4 text-left font">上次安检时间</p>
            <p class="panel-title col-xs-8 text-left input-font">{{ last_check_date }}</p>
          </div>
          <div class="row col-xs-12 col-sm-6 col-md-6" v-if="last_check_state">
            <p class="panel-title col-xs-4 text-left font">上次安检状态</p>
            <p class="panel-title col-xs-8 text-left input-font">{{last_check_state}}</p>
          </div>
          <div class="row col-xs-12 col-sm-6 col-md-6" v-if="last_check_date">
            <p class="panel-title col-xs-4 text-left font">上次安检结果</p>
            <p class="panel-title col-xs-8 text-left input-font" :class="last_check_result == '正常'?'':'color-red'">{{last_check_result}}</p>
            <div v-if="$parent.$parent.f_no_checkplan != '一级隐患跟进单'">
              <div v-for="data in last_check_data.data" class="panel-title col-xs-offset-4 col-xs-8 text-left input-font">
                <p v-for="(key,item) in data">
                  {{key}}:{{item}}
                </p>
              </div>
            </div>

            <div v-if="$parent.$parent.f_no_checkplan == '一级隐患跟进单'">
              <p class="panel-title col-sm-4 text-left input-font color-red" v-if="last_check_result != '正常'">一级隐患</p>
              <div v-if="last_check_result != '正常'">
                <div v-for="defect in $parent.$parent.defects" class="panel-title col-xs-offset-4 col-xs-8 col-sm-8 text-left input-font">
                  <div v-for="item in defect.f_items">
                    <span class="color-red">{{item.f_item_name}}(</span>
                    <span class="color-red" v-for="list in item.f_item_lists">{{list.f_item_value}}&nbsp;&nbsp;&nbsp;</span>
                    <span class="color-red">)</span>
                  </div>
                </div>
              </div>
            </div>

            <div v-if="$parent.$parent.f_no_checkplan == '预约安检单' || $parent.$parent.f_no_checkplan == '预约开户单'" >
              <div v-for="defect in worhercontent_state" class="panel-title col-xs-offset-4 col-xs-8 col-sm-8 text-left input-font">
                <span class="color-red">{{defect}}</span>
              </div>
            </div>

          </div>
        </div>
      </div>

    </div>
    <div style="height:50px;"></div>
  </form>
</template>

<script>
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'

export default {
  title: '安检概况',
  data() {
    // return {
    //   f_no_checkplan:this.$parent.$parent.f_no_checkplan,
    //   defects:this.$parent.$parent.defects, //上次安检中需要检查的所有隐患项
    //   defect:[],   //上次安检中需要检查的某一隐患项
    // }
    return this.$parent.$parent.data

  },
  methods: {

    cameraCallBack(prop, fileName) {
      HostApp.__this__ = this
      if (prop){ if (prop == 'f_rejectcheck_paths') {
        let f_rejectcheck_path = fileName + '?' + Math.random()
        if (HostApp.__this__.f_rejectcheck_paths.length < 3) {
          HostApp.__this__.f_rejectcheck_paths.push({
            f_rejectcheck_path: f_rejectcheck_path
          })
        } else {
          this.$showMessage('最多输入3张照片')
        }
      }
        if (prop == 'f_noanswer_paths') {

          let f_noanswer_path = fileName + '?' + Math.random()
          if (HostApp.__this__.f_noanswer_paths.length < 3) {

            HostApp.__this__.f_noanswer_paths.push({
              f_noanswer_path: f_noanswer_path
            })
          } else {
            this.$showMessage('最多输入3张照片')
          }


        }} else
      {
        HostApp.__this__.$set(prop, fileName + '?' + Math.random())
      }
      console.log('photo file name:' + HostApp.__this__.f_nongasuser_path)
      HostApp.__callback__ = null
      HostApp.__this__ = null
    },
    takePic(prop,title) {

      HostApp.__callback__ = this.cameraCallBack
      HostApp.__this__ = this
      console.log('this[prop]:' + this[prop])
      let fileName
      if (prop == 'f_noanswer_paths') {
        //tag
        if (this.f_noanswer_paths.length == 3) {
          return
        }
        fileName = Util.guid() + '-' + prop + '.jpg'
      }else if (prop == 'f_rejectcheck_paths') {
        //tag
        if (this.f_rejectcheck_paths.length == 3) {
          return
        }
        fileName = Util.guid() + '-' + prop + '.jpg'
      }else {
        if (!this[prop] || this[prop].includes("nopic.png")) {
          fileName = Util.guid() + '-' + prop + '.jpg'
        } else {
          fileName = Util.getFileName(this[prop])
        }
      }

      HostApp._open_a_page({
        type: 'boomerang',
        page:'com.aofeng.hybrid.android.peripheral.CameraActivity',
        param: {
          file: fileName,
          requestCode: 111,
          callback: 'javascript:HostApp.__callback__("' + prop + '", "%s");',
          watermark: title + '\t时间：' + Util.toStandardTimeString() + '\t' + Vue.user.name
        }
      })
    },
    delfile (prop, fileName, index) {
      if (fileName == Vue.nopic) {
        return
      } else {
        if (prop == 'f_noanswer_paths') {
          this.f_noanswer_paths.splice(index, 1)
          HostApp.delfile(fileName)
        }else if (prop == 'f_rejectcheck_paths') {
          this.f_rejectcheck_paths.splice(index, 1)
          HostApp.delfile(fileName)
        } else {
          HostApp.delfile(fileName)
          this[prop] = Vue.nopic
        }
      }
    },
    setEntryClass(val) {
      if (val == '到访不遇') {
        this.$set('f_entry_class', 'warning')
      }else if (val == '拒检') {
        this.f_visit_state = ''
        this.$set('f_entry_class', 'danger')
      } else if (val == '入户') {
        this.f_visit_state =''
        this.$set('f_entry_class', 'success')
      }
    },
    // setUsegas(val){
    //   if (val == '未使用')
    //     this.$set('f_useclass', 'default')
    //   if (val == '已使用')
    //     this.$set('f_useclass', 'success')
    // },

    start(){
      // console.log('this.f_onsite_time--',this.data.f_onsite_time)
      this.$parent.$parent.isStrat = true
      this.$set('action',!this.action)
      this.$set('f_onsite_time', Util.toStandardTimeString())
      //this.$set('f_offsite_time', Util.toStandardTimeString())
      //this.$parent.$parent.tick()
    }
  },
  components: {
    RadioGroup,
    Radio
  },
  destroyed(){
    this.worhercontent_state = []
  },
  ready() {
    this.$set('laststates',JSON.parse(JSON.stringify(this.$parent.$parent.data)).f_entry_status)
    console.log('laststates赋值')
    console.log('this.$parent.$parent.f_no_checkplan====》'+this.$parent.$parent.f_no_checkplan)
    if(this.$parent.$parent.f_no_checkplan == '预约安检单' || this.$parent.$parent.f_no_checkplan == '预约开户单'){
      console.log('赋值worhercontent_state===》'+this.$parent.$parent.data.worhercontent)
      if(this.$parent.$parent.data.worhercontent && this.$parent.$parent.data.worhercontent.includes('[')){
        this.$set('worhercontent_state',JSON.parse(JSON.parse(JSON.stringify(this.$parent.$parent.data)).worhercontent))
      }else{
        this.$set('worhercontent_state',[])
      }
    }
    if(!this.$parent.$parent.showBack){
      this.$parent.$parent.showBack= true
    }
    // this.$set('f_onsite_time', Util.toStandardTimeString())
    // this.$set('f_offsite_time', Util.toStandardTimeString())
    console.log('this.f_onsite_time'+this.f_onsite_time)
    if(!this.f_onsite_time){
      this.$parent.$parent.tick()
    }
    // else{
    //   if(this.f_entry_status != '入户' || this.f_state == '已检'){
    //     this.$parent.$parent.tick()
    //   }
    // }
    this.$parent.$parent.devicesCollect()
    console.log('this.$parent.$parent.f_no_checkplan'+this.$parent.$parent.f_no_checkplan)
    console.log('this.$parent.$parent.defects=======>>>>>'+JSON.stringify(this.$parent.$parent.defects))
    this.$set('last_check_date',this.$parent.$parent.item.f_last_check_date)
    this.$set('last_check_state',this.$parent.$parent.item.f_last_check_state)
    console.log('this.$parent.$parent.item.f_last_check_result===》'+this.$parent.$parent.item.f_last_check_result)
    if(this.$parent.$parent.item.f_last_check_result){
      let checkResult = JSON.parse(this.$parent.$parent.item.f_last_check_result)
      this.$set('last_check_result',checkResult.result)
      this.$set('last_check_data.data',checkResult.data)
    }else{
      this.$set('last_check_result','')
      this.$set('last_check_data.data',[])
    }
    if(this.$parent.$parent.data.f_onsite_time){
      console.log('已经开始安检')
      this.$parent.$parent.startClick = true
    }
    // if(this.$parent.$parent.role == 'androidview'){
    //   this.action = false
    //   this.f_onsite_time = this.$parent.$parent.f_onsite_time
    //   this.f_offsite_time = this.$parent.$parent.f_offsite_time
    // }
    this.action = true
    console.log('this.f_onsite_time'+this.f_onsite_time)
    if(this.f_onsite_time){
      // this.$parent.$parent.isStrat = true
      // this.$parent.$parent.data.f_onsite_time = Util.toStandardTimeString()
    }
    if (this.$parent.$parent.role == 'repair') {
      this.$set('style__', 'divmask')
      this.$set('style_view_', '')
    }
    else if (this.$parent.$parent.role == 'view') {
      this.$set('style__', 'divmask')
      this.$set('style_view_', 'divmask')
      console.log('set style for ....')
    } else {
      this.$set('style__', '')
      this.$set('style_view_', '')
    }
    if (!this.f_nongasuser_path)
      this.$set('f_nongasuser_path', Vue.nopic)
    this.$set('f_noanswer_paths', [])
    if (this.f_noanswer_path) {
      this.f_noanswer_paths.push({f_noanswer_path: this.f_noanswer_path})
    } else {
      this.$set('f_noanswer_path', '')
    }
    if (this.f_noanswer1_path) {
      this.f_noanswer_paths.push({f_noanswer_path: this.f_noanswer1_path})
    } else {
      this.$set('f_noanswer1_path', '')
    }
    if (this.f_noanswer2_path) {
      this.f_noanswer_paths.push({f_noanswer_path: this.f_noanswer2_path})
    } else {
      this.$set('f_noanswer2_path', '')
    }


    if (!this.f_followphone_path)
      this.$set('f_followphone_path', Vue.nopic)
    if (!this.f_recordfollow_path)
      this.$set('f_recordfollow_path', Vue.nopic)
    //拒检多张照片
    this.$set('f_rejectcheck_paths', [])
    if (this.f_rejectcheck_path) {
      this.f_rejectcheck_paths.push({f_rejectcheck_path: this.f_rejectcheck_path})
    } else {
      this.$set('f_rejectcheck_path', '')
    }
    if (this.f_rejectcheck1_path) {
      this.f_rejectcheck_paths.push({f_rejectcheck_path: this.f_rejectcheck1_path})
    } else {
      this.$set('f_rejectcheck1_path', '')
    }
    if (this.f_rejectcheck2_path) {
      this.f_rejectcheck_paths.push({f_rejectcheck_path: this.f_rejectcheck2_path})
    } else {
      this.$set('f_rejectcheck2_path', '')
    }


    //  this.$watch('f_visit_state', (val) => {
    //    this.setUsegas(val)
    // })

    this.setEntryClass(this.f_entry_status)
    this.$watch('f_rejectcheck_paths.length', () => {
      //tag)
      for (let i = 0; i < 3; i++) {

        if (this.f_rejectcheck_paths[i] && this.f_rejectcheck_paths[i].f_rejectcheck_path) {
          //tag)
          if (i == 0) {
            this.f_rejectcheck_path = this.f_rejectcheck_paths[i].f_rejectcheck_path
          } else {
            this['f_rejectcheck' + i + '_path'] = this.f_rejectcheck_paths[i].f_rejectcheck_path
          }
        } else {
          //tag)
          if (i == 0) {
            this.f_rejectcheck_path = null
          } else {
            this['f_rejectcheck' + i + '_path'] = null
          }
        }
      }
      //tag
    })
    this.$watch('f_noanswer_paths.length', () => {
      //tag)
      for (let i = 0; i < 3; i++) {

        if (this.f_noanswer_paths[i] && this.f_noanswer_paths[i].f_noanswer_path) {
          //tag)
          if (i == 0) {
            this.f_noanswer_path = this.f_noanswer_paths[i].f_noanswer_path
          } else {
            this['f_noanswer' + i + '_path'] = this.f_noanswer_paths[i].f_noanswer_path
          }
        } else {
          //tag)
          if (i == 0) {
            this.f_noanswer_path = null
          } else {
            this['f_noanswer' + i + '_path'] = null
          }
        }
      }
      //tag

    })
    this.$watch('f_followup_way', (val) => {
      console.log('当前选择的跟进方式'+val)
      if (val == '电话跟进') {
        this.f_recordfollow_path = Vue.nopic
      }
      if (val == '记录跟进') {
        this.f_followphone_path = Vue.nopic
      }
    })
    this.$watch('f_entry_status', (val) => {
      console.log('当前选择的入户状态'+val)
      if(this.laststates != '入户'){
        if(val != this.laststates){
          this.$set('f_onsite_time', Util.toStandardTimeString())
          this.$set('f_offsite_time', Util.toStandardTimeString())
          this.$parent.$parent.tick()
        }
      }
      console.log('当前选择的入户状态'+val)
      this.setEntryClass(val)
      console.log('当前选择的入户状态'+val)
      //TODO 上传过的单子切换入户状态时间重计
      // if(val != this.$parent.$parent.data.f_entry_status){

      // }
      if (val == '到访不遇') {
        this.f_rejectcheck_path = Vue.nopic
      }
      if (val == '拒检') {
        this.f_noanswer_path = Vue.nopic
      }

      if (val != '入户') {
        //清理安检概括
        this.f_no_gas_device = false
        this.f_unload_battery = false
        this.f_close_valve = false
        //清理全局隐患
        this.f_defect_cramped = false
        this.f_defect_bedroom = false
        this.f_defect_longpipe = false
        this.f_defect_firesource = false
        this.f_defect_explosive = false
        this.f_defect_viacabinet = false
        this.f_defect_intermittent = false
        this.f_defect_nearfire = false
        this.f_defect_openkitchen = false
        this.f_defect_hang = false
        this.f_cramped_path = Vue.nopic
        //用户评价
        this.f_client_evaluation = null
        //清设备
        this.$set('f_meters', [])
        this.$set('f_plumbs', [])
        this.$set('f_valves', [])
        this.$set('f_inner_plumbs', [])
        this.$set('f_alarms', [])
        this.$set('f_cookers', [])
        this.$set('f_heaters', [])
        this.$set('f_furnaces', [])
        //TODO 删除已有的照片
      }
    })
  },

}
</script>
<style>
.btn-start{
  background-color: #f5fbff;
  border-radius: 7px;
  border: 1px solid #dcdcdc;
  font: 15px PingFang-SC-Medium;
  color: #499edf;
}
.time-input{
  border: 1px solid #c0c0c0;
  border-radius: 3px;
}
.div-photo{
  width: auto;
  height: auto;
  /* margin-top: 10px; */
  position: absolute;
  bottom: 10px;
  right: 10px;
}
.btn-photo{
  border: 0;
  border-radius: 7px;
  background-color: #7dc1f4;
  font: 15px PingFang-SC-Bold;
  height: 20%;
}
.color-red{
  color: red;
}
</style>
