<template>
  <div class="select-overspread repair-bg auto" style="padding-bottom:5px;">
    <!--<div class="bq-parent" v-if="shutype == 'heng'">-->
    <!--<blockquote class="blockquote">-->
    <!--<p><span>{{repairitem.header}}</span><a   @click="mute()" style="float:right"  href="#" class="repair-mute-class"><img src="../../../assets/novoice.png" width="25px;" alt=""><span style="margin-left:10px;color: #304A66">关闭声音</span></a></p>-->
    <!--</blockquote>-->
    <!--</div>-->
    <div class="panel panel-default auto repair-info-content">
      <div class="panel-body" style="padding: 0">
        <!-- 安检项内容 -->
        <div  class="auto repair-info-content compatible" style="padding: 0">
          <div class="row auto" style="padding: 0">
            <div v-show="false" class="{{shuclass}}" v-if=" device.device != '燃气表'">
              <button type="button" name="button" class="btn btn-primary" @click='adddetails()' :disabled="issee">增加</button>
            </div>
            <!--<div class="{{shuclass}}" v-if="device.device != '燃气表' && candelete">-->
            <!--<button type="button" name="button" class="btn btn-primary" @click='deletedetails()' :disabled="issee">删除</button>-->
            <!--</div>-->
            <div class="shuclass1"  v-show="row.isshow" v-for="(idxs,row) in f_items"  style="padding: 4px; border:1px solid #D4D4D4;border-bottom: 0" >
              <label v-if="row.type != 'radio' && row.type != 'text' && row.type != 'picture' && row.type != 'checkbox'" v-show="row.isshow" class="fivelabel">{{row.f_item_name}}<span v-if="row.unit">({{row.unit}})</span><br/>{{row.remark}}</label>
              <label v-if="row.type == 'radio'" v-show="row.isshow" class="radiolabel">{{row.f_item_name}}<span v-if="row.unit">({{row.unit}})</span><br/>{{row.remark}}</label>
              <label v-if="row.type == 'text'" v-show="row.isshow" class="textlabel1">{{row.f_item_name}}<span v-if="row.unit">({{row.unit}})</span><br/>{{row.remark}}</label>
              <label v-if="row.type == 'picture' || row.type == 'checkbox'" v-show="row.isshow" class="textlabel">{{row.f_item_name}} <br/>{{row.remark}} <span v-show="row.verification_state" :style="{color:row.verification_state==='pass'?'green':'red'}">{{row.verification_text}}</span></label>
              <!--<span v-if="show" style="font-weight:bold">{{row.f_content}}</span>-->
              <!--<datepicker placeholder="请选择时间"-->
              <!--:value.sync="row.f_content"-->
              <!--v-model="row.f_content"-->
              <!--:format="'yyyy-MM-dd'"-->
              <!--v-if="!show && row.type == 'date'"-->
              <!--:readonly="true"-->
              <!--&gt;</datepicker>-->
              <div style="clear: both" v-if="row.type == 'picture'" class="form-group col-sm-12" >
                <div class="auto" >
                  <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" v-show="row.f_path">
                          <img-self  :src="row.f_path" :alt="row.f_item_name"  width="140" height="140"></img-self>
                        </div>
                        <div class="col-sm-4" v-show="!row.f_path" @click="takePic(idxs, row.f_item_name)">
                          <img src="../../../assets/tackpic.png" :alt="点击拍摄照片"  width="140" height="140"></img>
                        </div>
                        <img v-show="row.f_path" src="../../../assets/remove.png" :class="style__"   @click="delfile(idxs, row.f_path)" v-if="role!='androidview'" style="width: 30px;height: 30px;position: absolute;left:110px;top:110px"></img>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
              <div style="float: left;width:60%" class="form-group" v-if="row.type == 'string'" v-show="row.isshow">
                <input type="text" class="form-control" maxlength="100" v-model="row.f_item_value" :readonly="role == 'androidview' || row.readonly">
              </div>
              <div style="float: left;width:60%" class="form-group col-sm-12" v-if="row.type == 'date'" v-show="row.isshow">
                <datepicker id="f_making_date" :placeholder= row.f_item_name
                            :value.sync="row.f_item_value"
                            v-if="row.type == 'date'"
                            v-show="row.isshow"
                            :disabled-days-of-Week="[]"
                            :format="'yyyy-MM-dd HH:mm:ss'"
                            :show-reset-button="reset" readonly="readonly">
                </datepicker>
              </div>

              <div style="float: left;width:60%" class="form-group" v-if="!show && row.type == 'number'" v-show="row.isshow">
                <input type="text" class="form-control" maxlength="100" v-model="row.f_item_value"  onkeyup="value=value.replace(/[^\d\.-]/g,'')" :readonly="row.readonly">
              </div>
              <!--<input type="text" class="form-control" v-model="row.f_content" v-if="!show && row.type == 'string' && row.f_project != '表号'" :disabled="(!(ischecked == '有')) || issee" :readonly="issee">-->
              <!--<input type="text" class="form-control" v-model="meternum" v-if="!show && row.type == 'string' && row.f_project == '表号' " :disabled="(!(ischecked == '有')) || issee" :readonly="issee" >-->
              <!--<button type="button" name="button" class="btn btn-primary" @click="scan" v-if="!show && row.f_project == '表号' ">扫码</button>-->
              <input-select    v-if="row.type == 'inputSelector'"
                               v-show="row.isshow"
                               :value.sync="row.selected"
                               v-model="row.selected"
                               :readonly="false"
                               :options="row.options"
                               @change="changse"
                               @click="transelation(idxs)"></input-select>
              <v-select  style="float: left"  :value.sync="row.selected"
                         v-model="row.selected"
                         v-if="row.type == 'selector'"
                         :search="false"
                         v-show="row.isshow"
                         placeholder='请选择'
                         :options="row.options"
                         :disabled="role == 'androidview' || row.readonly"
                         @change="changse"
                         @click="transelation(idxs)"
                         :multiple="row.multiple"
                         :close-on-select="!row.multiple" clear-button></v-select>
              <div style="float: left;width: 30%" class="form-group" v-if="!show && row.type == 'radio'">
                <div  class="col-xs-6 col-sm-6 col-md-6" v-for="item in row.options">
                  <!--                  <input type="radio" :name="row.f_item_name" @click="disSelect($parent.idxs,item.value)" :value="item.value" :disabled="(!(ischecked == '有')) || issee" v-model="row.f_item_value" >-->
                  <input type="radio" :name="row.f_item_name"  :value="item.value" :disabled="(!(ischecked == '有')) || issee" v-model="row.f_item_value" >
                  <span>{{item.label}}</span>
                </div>
              </div>
              <div v-if="!show && row.type == 'checkbox'" class="col-xs-12 col-sm-12 col-md-12" style="white-space: nowrap" >
                <div style="float: left" v-for="item in row.options">
                  <input type="checkbox" :name="row.f_item_name" :value="item.value" :disabled="(!(ischecked == '有')) || issee" v-model="row.f_item_value">
                  <span>{{item.label}}</span>
                </div>
              </div>
              <div style="clear: both">
                <label v-if="row.f_item_value.indexOf('其他') >-1" class="fivelabel">其他</label>
                <div style="float: left;width:60%" class="form-group" v-if="row.f_item_value.indexOf('其他') >-1">
                  <input type="text" class="form-control" maxlength="100" v-model="row.f_else" :readonly="role == 'androidview' || row.readonly">
                </div>
              </div>
              <div style="clear: both">
                <!--                <div class="form-group" style="display: flex;flex-wrap: wrap" v-if="(row.type == 'selector' || row.type == 'radio' || row.type =='checkbox') && (row.f_path != '' || row.f_is_defect != '') && (livedispose == 'true' || livedispose == true) " >-->
                <!--                  <label class="fivelabel">现场已处理</label>-->
                <!--                  <v-select   :value="row.f_live_dispose"-->
                <!--                              :value-single="true"-->
                <!--                              :options="lives"-->
                <!--                              :disabled="role == 'androidview'"-->
                <!--                              @change="changlive"-->
                <!--                              @click="transelation(idxs)"-->
                <!--                              close-on-select clear-button></v-select>-->
                <!--                </div>-->
                <div class="form-group" style="display: flex;flex-wrap: wrap" v-if="(row.type == 'selector' || row.type == 'radio' || row.type =='checkbox') && (row.f_path != '' || row.f_is_defect != '') && (dealdispose == 'true' || dealdispose == true) " >
                  <label class="fivelabel">处理方式</label>
                  <v-select
                    :value="row.f_deal_dispose"
                    :value-single="true"
                    :options="deals"
                    :disabled="role == 'androidview'"
                    @change="changdeal"
                    @click="transelation(idxs)"
                    close-on-select clear-button>
                  </v-select>
                </div>
                <div style="display: flex;flex-wrap: wrap" v-if="row.f_deal_dispose == '自行处理' && this.showZXTime">
                  <label class="fivelabel">处理时效:</label>
                  <datepicker
                    :value.sync="row.f_handle_date"
                    v-model="row.f_handle_date"
                    :format="'yyyy-MM-dd 00:00:00'"
                    placeholder="请选择"
                    style="width: 60%">
                  </datepicker>
                </div>
                <div style="margin-left: 10px" class="form-group col-sm-10" v-if="(row.type == 'selector' || row.type == 'radio' || row.type =='checkbox') && row.tooltip != undefined  && row.tooltip != '' ">
                  ☆{{row.tooltip}}
                </div>
                <div class="form-group col-sm-12"  v-if="(row.type == 'selector' || row.type == 'radio' || row.type =='checkbox') && (row.f_path != '' || row.f_is_defect != '')">
                  <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" style="height: 240px;overflow: scroll;top: 1px" >
                          <div class="col-xs-4 col-sm-3 col-md-2" style="margin-bottom: 35px" v-for="(index,paper) in row.paths">
                            <img-self  :src="paper.f_path" :alt="row.f_item_name" :width="140" :height="170"></img-self>
                            <img   src="../../../assets/删除.png" @click="delfile(idxs, index,'paths')" style="width: 15px;margin-top: -80px" alt="">
                          </div>
                        </div>
                        <div class="row text-right div-photo">
                          <button  type="button" name="button" class="btn btn-photo" @click="takePic(idxs,row.f_item_name,'paths')">拍照</button>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>

              <!--<v-select :value.sync="row.f_content" :options='getOptions(row.f_project)' placeholder='请选择' :disabled="(!(ischecked == '有')) || issee"  close-on-select  :value-single="true" v-if="!show && row.type == 'selector' && row.f_project != '气表品牌'"-->
              <!--&gt;</v-select>-->
              <!--<v-select :value.sync="row.f_content" :options='getOptions(row.f_project)' @change="getgasmodel" placeholder='请选择' :disabled="(!(ischecked == '有')) || issee"  close-on-select  :value-single="true" v-if="!show && row.type == 'selector' && row.f_project == '气表品牌'"-->
              <!--&gt;</v-select>-->
              <!--              <div class="auto" v-if="!show && row.type == 'checkbox' ">-->
              <!--                <input class="magic-checkbox" type="checkbox"  id="shebeicheckbox"-->
              <!--                       :checked="row.f_content == '有'"-->
              <!--                       @click="switchDetails(row.f_project, $event)" :disabled="issee"/>-->
              <!--                <label for="shebeicheckbox" style="width:150px;padding-bottom: 10px">{{row.f_project}}</label>-->
              <!--              </div>-->
              <!--<img-area  :model="Detail.imgs"  :sutitle="row.f_project" v-if="row.type == 'picture'" :disabled="issee"></img-area>-->
            </div>
          </div>
        </div>
        <div style="border-top: 1px solid #D4D4D4"></div>
      </div>
    </div>
  </div>
</template>
<script>
import Vue from 'vue'
import * as Util from '../../Util'

export default {
  title: '维修列表信息',
  data() {
    return {
      // telphoneValid: '/^((0\\d{2,3}-\\d{7,8})|(1[3584]\\d{9}))$/',
      // meterstyle:[],
      shuclass:'col-xs-12 col-sm-12 col-md-12 form-input-group mg8',
      shuclass1:'col-xs-12 col-sm-12 col-md-12 mg8',
      // labels:[],
      meternum:'',
      ischecked:'有',
      gasmodel:'',
      textstyle:'color: red',
      paper: this.$parent.$parent.data,
      f_items:[],
      page:{},
      selectindex:null,
      lives:[{label: '是', value: '是'},{label: '否', value: '否'}],
      deals:[{label: '未处理', value: '未处理'}],
      f_live_dispose:'否',
      f_deal_dispose:'未处理',
      // 初始表底
      f_initial_base: {},
      // 气量异常差值  计算公式 =>  气量异常差值 = 累计购气量 - （已用气量 - 初始表底） - 剩余气量
      f_gas_aberrant_number: {},
      // 金额异常差值  计算公式 =>  金额异常差值 = 累计购金额 - 已用金额 - 剩余金额
      f_fee_aberrant_number: {},
      // 累购气量
      f_total_gas: {},
      // 累购金额
      f_total_fee: {},
      // 已用气量
      f_table_base: {},
      // 已用金额
      f_fee_base: {},
      // 剩余气量
      f_gas_balance: {},
      // 剩余金额
      f_fee_balance: {},
      // 表端剩余金额
      f_table_balance: {},
      // 气量异常差值允许误差

      //物联网表数据存储
      f_balance_amount:{},//物联网表剩余金额
      f_meter_base:{},//物联网表读数
      f_balance_amount1:{},//物联网表现场录入的表上剩余金额
      f_meter_base1:{},//物联网表现场录入的表字轮数
      f_meter_aberrant_number1: {},//物联网表 表数异常差值
      f_fee_aberrant_number1: {},//物联网 表金额异常差值
      gasDeviation: (
        function (_this) {
          let deviation = _this.$appdata.getSingleValue('气量异常差值允许误差')
          if (deviation && !isNaN(deviation)) {
            return deviation
          } else {
            return 0
          }
        }
      )(this),
      // 金额异常差值允许误差
      feeDeviation: (
        function (_this) {
          let deviation = _this.$appdata.getSingleValue('金额异常差值允许误差')
          if (deviation && !isNaN(deviation)) {
            return deviation
          } else {
            return 0
          }
        }
      )(this),
      // 字轮异常差值允许误差
      meterbase: (
        function (_this) {
          let deviation = _this.$appdata.getSingleValue('字轮异常差值允许误差')
          if (deviation && !isNaN(deviation)) {
            return deviation
          } else {
            return 0
          }
        }
      )(this),
      showElse:false, //控制其他选项是否显示
      showXCImg: false, //  是否显示现场整改拍照选项
      showZXTime: false //  是否显示自行整改处理时效
    }
  },
  props: ['config','device','idx','operation','role'],
  // props: {
  //   // 维修对应的用户数据收集
  //   model: {
  //     type: Object
  //   },
  //   service:{
  //     type: Object
  //   },
  //   show: {
  //     type: Boolean,
  //     default: false
  //   },
  //   repairitem:{
  //     type: Object
  //   },
  //   shutype:'heng',
  //   tabs:{
  //     type: Object
  //   },
  //   repairdetails:{
  //     type: Object
  //   },
  //   faultshow:{
  //     type: Object
  //   },
  //   issee:''
  // },
  methods: {
    changse(val){
      if(val == undefined){
        return
      }
      if(this.selectindex != null) {
        if(this.f_items[this.selectindex].type == 'selector'){
          this.f_items[this.selectindex].f_item_value = val
        }else if(this.f_items[this.selectindex].type == 'inputSelector'){
          this.f_items[this.selectindex].f_item_value = val.target.value
        }
      }
    },
    changlive(val){
      if(val == undefined){
        return
      }
      if(this.selectindex != null) {
        this.f_items[this.selectindex].f_live_dispose = val
      }
    },
    changdeal(val){
      if(val == undefined){
        return
      }
      if(this.selectindex != null) {
        this.f_items[this.selectindex].f_deal_dispose = val
      }
    },
    switchDetails(detailsType, event){
      if (event.srcElement.checked) {
        for(var i = 0;i<this.Detail.details.length;i++){
          if(this.Detail.details[i].f_project == detailsType){
            this.Detail.details[i].f_content =  '有'
            this.ischecked = '有'
            return
          }
        }
      } else {
        this.Detail.imgs = []
        for(var i = 0;i<this.Detail.details.length;i++){
          if(this.Detail.details[i].f_project == detailsType){
            this.Detail.details[i].f_content =  '无'
            this.ischecked = '无'
          }else{
            this.Detail.details[i].f_content = ''
          }
        }
      }
    },
    getgasmodel(val){
      this.gasmodel = val
    },
    getradios(val,flag){
      let Reoptions = []
      for (let i = 0;i<this.repairdetails.length;i++) {
        var t = false
        if(this.repairdetails[i].f_type == this.repairitem.header ){
          for(var j =0;j<this.repairdetails[i].details.length;j++){
            if(this.repairdetails[i].details[j].f_project == val ){
              Reoptions = this.repairdetails[i].details[j].options
              t = true
              break
            }
          }
        }
        if(t){
          break
        }
      }
      for(let j = 0;j<Reoptions.length;j++){
        if(Reoptions[j].data == flag){
          for(var e = 0;e<this.Detail.details.length;e++){
            if(this.Detail.details[e].f_project == val){
              this.Detail.details[e].f_status = Reoptions[j].f_status
              return
            }
          }
          break
        }
      }
    },
    deletedetails(){
      this.$showMessage('该操作会删除所填信息，是否继续！', ['confirm', 'cancel']).then((res) => {
        if (res === 'confirm') {
          for(var i = 0;i<this.tabs.length;i++){
            if(this.tabs[i].number == this.repairitem.number){
              this.tabs.splice(i, 1)
              this.model.servicerepair.splice(this.repairitem.number, 1)
              for(let t = i;t < this.tabs.length;t++ ) {
                this.tabs[t].number -= 1
              }
              return
            }
          }
        }
      })
    },
    takePic(prop, title, pathname='null') {
      if (this.role == 'androidview') {
        return
      }
      HostApp.__callback__ = this.cameraCallBack
      HostApp.__this__ = this
      //tag
      let fileName
      if (pathname == 'null') {
        if (!this.f_items[prop].f_path || this.f_items[prop].f_path.includes("nopic.png")) {
          fileName = Util.guid() + '-' + 'device'+this.device.n + '-' + this.idx + '-'+'f_items'+prop+ '.jpg'
        } else {
          fileName = Util.getFileName(this.f_items[prop].f_path)
        }
      } else if (pathname == 'paths'){
        fileName = Util.guid() + '-' + 'device'+this.device.n + '-' + this.idx + '-'+'f_items'+prop+ '.jpg'
      }else {
        if (!this.f_items[prop][pathname] || this.f_items[prop][pathname].includes("nopic.png")) {
          fileName = Util.guid() + '-' + 'device'+this.device.n + '-' + this.idx + '-'+'f_items'+prop+ '.jpg'
        } else {
          fileName = Util.getFileName(this.f_items[prop][pathname])
        }
      }
      let jingweidu = ''
      if (this.$parent.$parent.is_has_jingweidu == 'true'){
        const obj = HostApp.getGpsDetailAddress()
        jingweidu =  '\t经度：' + obj.longitude+ '\t纬度：' + obj.latitude
        this.f_items[prop].f_longitude = obj.longitude
        this.f_items[prop].f_latitude = obj.latitude
      }
      //tag
      //tag
      HostApp._open_a_page({type: 'boomerang',
        page: 'com.aofeng.hybrid.android.peripheral.CameraActivity',
        param: {file: fileName, requestCode: 111, callback:'javascript:HostApp.__callback__("'+ prop +'","'+ title +'", "%s","'+pathname+'");', watermark: title + '\t时间：'+ Util.toStandardTimeString() + '\t' + Vue.user.name + jingweidu}
      })
    },
    cameraCallBack(prop,title, fileName,pathname) {
      //tag
      if (pathname == 'null') {
        //tag
        HostApp.__this__.$set( 'f_items['+prop+'].f_path', fileName + '?' + Math.random())
        //tag
        HostApp.__callback__ = null
        HostApp.__this__ = null
      } else if (pathname =='paths'){
        let f_path = fileName + '?' + Math.random()
        let f_filename_path = fileName.substring(fileName.lastIndexOf('/')+1) + '?' + Math.random()
        this.f_items[prop].paths.push({f_path:f_path})
        if (Util.isEmpty(this.f_items[prop].f_paths)){
          this.f_items[prop].f_paths = f_path
        }else {
          this.f_items[prop].f_paths += ',' + f_path
        }
        if (Util.isEmpty(this.f_items[prop].f_filename_paths)){
          this.f_items[prop].f_filename_paths = f_filename_path
        }else {
          this.f_items[prop].f_filename_paths += ',' + f_filename_path
        }
        console.log('this.f_items[prop].f_paths',this.f_items[prop].f_paths)
        HostApp.__this__.$set( 'f_items['+prop+'].f_filename_paths', this.f_items[prop].f_filename_paths)
        HostApp.__this__.$set( 'f_items['+prop+'].f_paths', this.f_items[prop].f_paths)
        HostApp.__this__.$set( 'f_items['+prop+'].paths', this.f_items[prop].paths)
        HostApp.__callback__ = null
        HostApp.__this__ = null
      } else {
        //tag
        //tag)
        HostApp.__this__.$set( 'f_items['+prop+'].'+pathname+'', fileName + '?' + Math.random())
        HostApp.__callback__ = null
        HostApp.__this__ = null
      }
      if(this.f_items[prop].is_verification){
        let path=fileName.replace('http://newimg','')
        path=path.replace('file://','')
        console.log('fileName',fileName)
        console.log(path)
        let res=HostApp.pictureVerificationAI(path,title)
        if(res.code==200){
          if(res.type_result){
            // this.$showMessage("检测通过，当前照片为"+title)
            this.f_items[prop].verification_text=`检测通过，当前照片为 ${title}`
            this.f_items[prop].verification_state='pass'
          }else{
            // this.$showMessage("检测失败，未识别到当前照片为 "+title+"，请重新拍摄！")
            this.f_items[prop].verification_text=`检测失败，未识别到当前照片为'${title}'，请重新拍摄！`
            this.f_items[prop].verification_state='npass'
          }
        }else{
          // this.$showMessage("检测失败，请重试！")
          this.f_items[prop].verification_text=`检测失败，请重试！`
          this.f_items[prop].verification_state='npass'
        }
      }
    },
    delfile(prop, fileName, pathname='null') {
      if (pathname == 'null') {
        //tag
        //tag)
        if(fileName == Vue.nopic){
          return
        } else {
          HostApp.delfile(fileName)
          this.f_items[prop].f_path = Vue.nopic
        }
      }else if (pathname == 'paths'){
        this.f_items[prop].f_paths = this.f_items[prop].f_paths.replace(this.f_items[prop].paths[fileName].f_path,'')
        this.f_items[prop].f_filename_paths = this.f_items[prop].f_filename_paths.replace(this.f_items[prop].paths[fileName].f_path.substring(this.f_items[prop].paths[fileName].f_path.lastIndexOf('/')+1),'')
        this.$set( 'f_items['+prop+'].f_filename_paths', this.f_items[prop].f_filename_paths)
        this.$set( 'f_items['+prop+'].f_paths', this.f_items[prop].f_paths)
        HostApp.delfile(this.f_items[prop].paths[fileName].f_path)
        this.f_items[prop].paths.splice(fileName, 1)
      }else {
        //tag
        //tag)
        if(fileName == Vue.nopic){
          return
        } else {
          HostApp.delfile(fileName)
          this.f_items[prop][pathname] = Vue.nopic
        }
      }
    },
    adddetails(){
      // 下标作为序号，取值用。 增加  序号得依次增加
      if(this.tabs.length > 0){
        for(let i = this.tabs.length-1;i > 0 ;i-- ){
          if(this.tabs[i].header == this.repairitem.header){
            if(this.model.servicerepair.length > 0){
              for(let j = this.model.servicerepair.length -1;j > -1;j-- ){
                if(this.model.servicerepair[j].f_type == this.repairitem.header){
                  this.model.servicerepair.splice(j+1, 0, Object.assign({}, JSON.parse(JSON.stringify(this.tabs[i].details))))
                  this.tabs.splice(i+1, 0, {header: `${this.repairitem.header}`,details:this.tabs[i].details,complete:'repair-details',class:'repair-details-class',number:j+1,items:this.tabs[i].items})
                  for(let t = i+2;t < this.tabs.length;t++ ) {
                    this.tabs[t].number += 1
                  }
                  this.faultshow.number += this.faultshow.number + 1
                  return
                }
              }
            }
          }
        }
      }
    },
    transelation(val){
      this.selectindex = val
    },
    towatch(){
      for(let n in this.f_items){
        if(typeof this.f_items[n]=='function'){
          continue
        }
        if(this.f_items[n].type  == 'selector' || this.f_items[n].type  == 'inputSelector'){
          // 监听下拉框，如果有隐患，需要拍照
          this.$watch('f_items['+n+'].selected',function(val,old) {
              if(val==old){
                return
              }
              // 下拉框值
              //tag)
              // 下拉框所属设备
              //tag
              // 下拉框所属项
              //tag
              if (val == undefined || val.length == 0 || val[0] == ''){
                this.f_items[n].f_path = ''
                this.f_items[n].f_is_defect = ''
                this.f_items[n].f_defect_level = ''
                this.f_items[n].f_live_dispose = ''
                this.f_items[n].f_deal_dispose = ''
                this.f_items[n].tooltip = ''
                this.f_items[n].f_else = ''
                return
              }
              let shImage = false
              if(val.indexOf('其他') == -1){
                this.f_items[n].f_else = ''
              }
              // if(this.config[this.device.device].items[item].type == 'selector'){
              //   this.f_items[n].f_item_value = val
              // }else if(this.config[this.device.device].items[item].type == 'inputSelector'){
              //   this.f_items[n].f_item_value = val[0]
              // }
              // 在配置中查找该项
              for (let item in this.config[this.device.device].items) {
                if(typeof this.config[this.device.device].items[item]=='function'){
                  continue
                }
                let type = this.config[this.device.device].items[item].type
                let multiple = this.config[this.device.device].items[item].multiple?this.config[this.device.device].items[item].multiple:false
                let options = this.config[this.device.device].items[item].options
                if ((this.config[this.device.device].items[item].type == 'selector' || this.config[this.device.device].items[item].type == 'inputSelector') && item == this.f_items[n].f_item_name) {
                  for (let i in options) {
                    if(typeof options[i]=='function'){
                      continue
                    }
                    let value
                    if(this.config[this.device.device].items[item].type == 'selector' && this.config[this.device.device].items[item].multiple == false){
                      value = val[0]
                    }else if (this.config[this.device.device].items[item].type == 'inputSelector'){
                      value = val
                    }
                    //tag)
                    // 如果未选择，清空图片、隐患信息等
                    if((type == 'selector' && val.length == 0) || (type == 'inputSelector' && val == '')){
                      this.f_items[n].f_path = ''
                      this.f_items[n].f_is_defect = ''
                      this.f_items[n].f_defect_level = ''
                      this.f_items[n].f_live_dispose = ''
                      this.f_items[n].f_deal_dispose = ''
                      this.f_items[n].tooltip = ''
                    }
                    if((type == 'selector' && multiple == false && options[i].data == val[0]) || (type == 'inputSelector' && options[i].data == val) || (type == 'selector' && multiple == true && val.indexOf(options[i].data) > -1)){
                      // 找到选中的项了
                      //tag
                      if(options[i].isdefect == true ){
                        shImage = true
                      }
                      if(options[i].isdefect == false || this.f_items[n].f_item_value == ''){
                        shImage = false
                      }
                      //tag
                      if(shImage){
                        this.f_items[n].f_is_defect =true
                        this.f_items[n].f_defect_level = options[i].level
                        this.f_items[n].f_path = Vue.nopic
                        this.f_items[n].f_live_dispose = '否'
                        this.f_items[n].f_deal_dispose = '未处理'
                        //tag
                        this.f_items[n].tooltip= options[i].tooltip
                      }else{
                        this.f_items[n].f_path = ''
                        this.f_items[n].f_is_defect = ''
                        this.f_items[n].f_defect_level = ''
                        this.f_items[n].f_live_dispose = ''
                        this.f_items[n].f_deal_dispose = ''
                        this.f_items[n].tooltip = ''
                      }
                    }
                  }
                }
              }
            }
          )
          // this.$watch('other',function(val){
          //   //tag
          //   if(this.selectindex != null) {
          //     let index = this.f_items[this.selectindex].f_item_value.indexOf('其他')
          //     if(index > -1){
          //       this.f_items[this.selectindex].f_item_value.splice(index,1,this.other)
          //     }
          //   }
          //
          // })
        }else if(this.f_items[n].type  == 'radio') {
          // 监听单选框，如果有隐患，需要拍照
          this.$watch('f_items[' + n + '].f_item_value', function (val) {
            //tag)
            let options = this.f_items[n].options
            //tag)
            for (let i = 0; i < options.length; i++) {
              //tag)
              // 找到选中的项了
              if (options[i].value == val) {
                // 如果有隐患，拍图片
                if (options[i].isdefect) {
                  this.f_items[n].f_is_defect = true
                  this.f_items[n].f_defect_level = options[i].level
                  this.f_items[n].f_path = Vue.nopic
                  this.f_items[n].f_live_dispose = '否'
                  this.f_items[n].f_deal_dispose = '未处理'
                  this.f_items[n].tooltip = options[i].tooltip
                  //tag)
                  return
                }
              }
            }
            this.f_items[n].f_path = ''
            this.f_items[n].f_is_defect = ''
            this.f_items[n].f_defect_level = ''
            this.f_items[n].f_live_dispose = ''
            this.f_items[n].f_deal_dispose = ''
            this.f_items[n].tooltip = ''
          })
        }else if(this.f_items[n].type  == 'checkbox') {
          // 监听单选框，如果有隐患，需要拍照
          this.$watch('f_items[' + n + '].f_item_value', function (val) {
            //tag)
            // 如果是手动赋值，不执行下面逻辑
            if (this.f_items[n].isReSet) {
              this.f_items[n].isReSet = false
              return
            }
            let options = this.f_items[n].options
            //tag)
            // 取出选中项中有隐患的详细信息
            let selected = options.filter(item => { return val.indexOf(item.value) != -1 && item.isdefect })

            if(selected.length > 0){
              // 防止赋值无限调用
              this.f_items[n].isReSet = true
              let selectList = selected.map(item => {return item.value})
              // 如果选中的是非隐患项,取消选中isdefect为true的
              if (selectList.indexOf(val[val.length - 1]) == -1) {
                this.f_items[n].f_item_value = val.filter(item => {return selectList.indexOf(item) == -1})
                this.f_items[n].f_path = ''
                this.f_items[n].f_is_defect = ''
                this.f_items[n].f_defect_level = ''
                this.f_items[n].f_live_dispose = ''
                this.f_items[n].f_deal_dispose = ''
                this.f_items[n].tooltip = ''
                return
              }
              // 如果选中的是隐患项,取消选中isdefect为false的
              this.f_items[n].f_item_value = selectList
              // 如果第一次选择隐患项，初始化
              if (!this.f_items[n].f_is_defect) {
                this.f_items[n].f_is_defect = true
                this.f_items[n].f_defect_level = selected[0].level
                this.f_items[n].f_path = Vue.nopic
                this.f_items[n].f_live_dispose = '否'
                this.f_items[n].f_deal_dispose = '未处理'
                //tag
                this.f_items[n].tooltip = selected[0].tooltip
              }
              //tag)
              return
            }
            this.f_items[n].f_path = ''
            this.f_items[n].f_is_defect = ''
            this.f_items[n].f_defect_level = ''
            this.f_items[n].f_live_dispose = ''
            this.f_items[n].f_deal_dispose = ''
            this.f_items[n].tooltip = ''
          })
        }
      }
      //tag)
    },
    getGasAberrantNumber(val) {
      //tag
      if(!this.f_table_base.index || !this.f_gas_balance.index){
        //tag
        return
      }
      // 先清空
      this.f_items[this.f_gas_aberrant_number.index].f_item_value = null
      this.f_items[this.f_gas_aberrant_number.index].f_is_defect = false
      if(val=='已用气量'){
        //剩余气量 = 累购-已用
        this.f_items[this.f_gas_balance.index].f_item_value= (this.f_items[this.f_total_gas.index].f_item_value-this.f_items[this.f_table_base.index].f_item_value).toFixed(2)
        if (isNaN(this.f_items[this.f_gas_balance.index].f_item_value)) {
          this.f_items[this.f_gas_balance.index].f_item_value = null
        }
      }

      // 只有两个值都填了才会计算
      if (!this.f_items[this.f_table_base.index].f_item_value || !this.f_items[this.f_gas_balance.index].f_item_value) {
        return
      }
      //tag)
      //tag
      //tag

      // 计算公式 =>  气量异常差值 = 累计购气量 - （已用气量 - 初始表底） - 剩余气量
      this.f_items[this.f_gas_aberrant_number.index].f_item_value = this.f_items[this.f_total_gas.index].f_item_value - this.f_items[this.f_gas_balance.index].f_item_value - (this.f_items[this.f_table_base.index].f_item_value - (this.f_initial_base.index?this.f_items[this.f_initial_base.index].f_item_value:0))
      this.f_items[this.f_gas_aberrant_number.index].f_item_value = this.f_items[this.f_gas_aberrant_number.index].f_item_value.toFixed(3)
      // 如果数值有误，清空结果s
      if (isNaN(this.f_items[this.f_gas_aberrant_number.index].f_item_value)) {
        this.f_items[this.f_gas_aberrant_number.index].f_item_value = null
      }
      //tag ===> ' + Math.abs(this.f_items[this.f_gas_aberrant_number.index].f_item_value))
      //tag ===> ' + JSON.stringify(Number(this.gasDeviation)))
      // 计算差值是否在范围内
      if (Math.abs(this.f_items[this.f_gas_aberrant_number.index].f_item_value) > Number(this.gasDeviation)|| Math.abs(this.f_items[this.f_gas_aberrant_number.index].f_item_value) < Number(this.gasDeviation) * -1) {
        // this.f_items[this.f_gas_aberrant_number.index].f_is_defect = true
        // this.f_items[this.f_gas_aberrant_number.index].f_deal_dispose = '未处理'
      }else{
        this.f_items[this.f_gas_aberrant_number.index].f_is_defect = null
        this.f_items[this.f_gas_aberrant_number.index].f_deal_dispose = null
      }

      //tag)
    },
    getFeeAberrantNumber(val) {
      //tag
      // 只有两个值都填了才会计算
      if(!this.f_fee_base.index || !this.f_fee_balance.index){
        //tag
        return
      }
      // 先清空
      this.f_items[this.f_fee_aberrant_number.index].f_item_value = null
      this.f_items[this.f_fee_aberrant_number.index].f_is_defect = false

      if(val=='已用金额'){
        this.f_items[this.f_fee_balance.index].f_item_value=(this.f_items[this.f_total_fee.index].f_item_value-this.f_items[this.f_fee_base.index].f_item_value).toFixed(3)
        if (isNaN(this.f_items[this.f_fee_balance.index].f_item_value)) {
          this.f_items[this.f_fee_balance.index].f_item_value = null
        }
      }

      if (!this.f_items[this.f_fee_base.index].f_item_value || !this.f_items[this.f_fee_balance.index].f_item_value) {
        return
      }

      // 计算公式 =>  金额异常差值 = 累计购金额 - 已用金额 - 剩余金额
      this.f_items[this.f_fee_aberrant_number.index].f_item_value = this.f_items[this.f_total_fee.index].f_item_value - this.f_items[this.f_fee_balance.index].f_item_value - this.f_items[this.f_fee_base.index].f_item_value
      this.f_items[this.f_fee_aberrant_number.index].f_item_value = this.f_items[this.f_fee_aberrant_number.index].f_item_value.toFixed(3)
      if (isNaN(this.f_items[this.f_fee_aberrant_number.index].f_item_value)) {
        this.f_items[this.f_fee_aberrant_number.index].f_item_value = null
      }
      //tag ===> ' + Math.abs(this.f_items[this.f_fee_aberrant_number.index].f_item_value))
      //tag ===> ' + JSON.stringify(Number(this.feeDeviation)))
      // 计算差值是否在范围内
      if (Math.abs(this.f_items[this.f_fee_aberrant_number.index].f_item_value) > Number(this.feeDeviation)) {
        // this.f_items[this.f_fee_aberrant_number.index].f_is_defect = true
        // this.f_items[this.f_fee_aberrant_number.index].f_deal_dispose = '未处理'
      }else{
        this.f_items[this.f_fee_aberrant_number.index].f_is_defect = null
        this.f_items[this.f_fee_aberrant_number.index].f_deal_dispose = null
      }

      //tag)
    },
    //  计算剩余金额和剩余金额差值
    getFeeAberrantNumber2(val) {
      //tag
      // 只有两个值都填了才会计算
      if(!this.f_table_balance.index || !this.f_fee_balance.index){
        //tag
        return
      }
      // 先清空
      this.f_items[this.f_fee_aberrant_number.index].f_item_value = null
      this.f_items[this.f_fee_aberrant_number.index].f_is_defect = false

      // 计算公式 =>  金额异常差值 = 系统剩余金额 - 表端剩余金额
      this.f_items[this.f_fee_aberrant_number.index].f_item_value = this.f_items[this.f_fee_balance.index].f_item_value - this.f_items[this.f_table_balance.index].f_item_value
      this.f_items[this.f_fee_aberrant_number.index].f_item_value = this.f_items[this.f_fee_aberrant_number.index].f_item_value.toFixed(3)
      if (isNaN(this.f_items[this.f_fee_aberrant_number.index].f_item_value)) {
        this.f_items[this.f_fee_aberrant_number.index].f_item_value = null
      }
      //tag ===> ' + Math.abs(this.f_items[this.f_fee_aberrant_number.index].f_item_value))
      //tag ===> ' + JSON.stringify(Number(this.feeDeviation)))
      // 计算差值是否在范围内
      if (Math.abs(this.f_items[this.f_fee_aberrant_number.index].f_item_value) > Number(this.feeDeviation)) {
        // this.f_items[this.f_fee_aberrant_number.index].f_is_defect = true
        // this.f_items[this.f_fee_aberrant_number.index].f_deal_dispose = '未处理'
      }else{
        this.f_items[this.f_fee_aberrant_number.index].f_is_defect = null
        this.f_items[this.f_fee_aberrant_number.index].f_deal_dispose = null
      }
      console.log('--------------------------------')
      console.log(this.f_items[this.f_fee_aberrant_number.index].f_item_value)

      //tag)
    },
    //物联网表字轮数改变触发
    getmeteraberrantnumber() {
      //tag

      // 先清空
      this.f_items[this.f_meter_aberrant_number1.index].f_item_value = null
      this.f_items[this.f_meter_aberrant_number1.index].f_is_defect = false
      //tag
      // 只有两个值都填了才会计算
      if (!this.f_items[this.f_meter_base.index].f_item_value || !this.f_items[this.f_meter_base1.index].f_item_value) {
        return
      }
      //tag
      // 计算公式 =>   表数异常差值= - 字轮数 - 后台表读数
      this.f_items[this.f_meter_aberrant_number1.index].f_item_value = this.f_items[this.f_meter_base1.index].f_item_value - this.f_items[this.f_meter_base.index].f_item_value
      this.f_items[this.f_meter_aberrant_number1.index].f_item_value = this.f_items[this.f_meter_aberrant_number1.index].f_item_value.toFixed(3)
      if (isNaN(this.f_items[this.f_meter_aberrant_number1.index].f_item_value)) {
        this.f_items[this.f_meter_aberrant_number1.index].f_item_value = null
      }
      //tag ===> ' + Math.abs(this.f_items[this.f_meter_aberrant_number1.index].f_item_value))
      // 计算差值是否在范围内
      //tag)
      // if (Math.abs(this.f_items[this.f_meter_aberrant_number1.index].f_item_value) > Number(this.meterbase)){
      //   this.f_items[this.f_meter_aberrant_number1.index].f_is_defect = true
      // }

      //tag)
    },

    disSelect(index, itemValue) {
      //tag)
      //tag)
      if (this.f_items[index].f_item_value == itemValue) {
        this.$set(`f_items[${index}].f_item_value`, '')
      }
    }
  },
  ready() {
    //tag
    //tag
    if(Vue.config.safecheck != undefined){
      if(Vue.config.safecheck.ApproveConfig != undefined){
        if(Vue.config.safecheck.ApproveConfig.livedispose != undefined) {
          this.livedispose = Vue.config.safecheck.ApproveConfig.livedispose
        }
        if(Vue.config.safecheck.ApproveConfig.dealdispose != undefined) {
          this.dealdispose = Vue.config.safecheck.ApproveConfig.dealdispose
        }
        // if(Vue.config.safecheck.ApproveConfig.showtorepair) {
        //   this.deals=[{label: '现场整改', value: '现场整改'},
        //     {label: '自行处理', value: '自行处理'},
        //     {label: '转维修', value: '报修'}
        //   ]
        // }
        // if(Vue.config.safecheck.ApproveConfig.Processing) {
        //   if(Vue.config.safecheck.ApproveConfig.Processing.length > 0){
        //     this.deals = Vue.config.safecheck.ApproveConfig.Processing
        //   }
        // }
        if(Vue.config.safecheck.ApproveConfig.showXCImg) {
          this.showXCImg = true
        }
        if(Vue.config.safecheck.ApproveConfig.showZXTime) {
          this.showZXTime = true
        }
        if(Vue.config.safecheck.ApproveConfig.showtorepair) {
        }
        // if(Vue.config.safecheck.ApproveConfig.hiddendanger != undefined) {
        //   if (parseInt(Vue.config.safecheck.ApproveConfig.hiddendanger) >= 5) {
        //     this.hiddenDangerImgNumber = 5
        //   }else {
        //     this.hiddenDangerImgNumber = parseInt(Vue.config.safecheck.ApproveConfig.hiddendanger)
        //   }
        // }
      }
    }
    //tag
    //tag)
    //tag)
    //tag)
    //创建页面所需数据
    this.$set('piece', this.paper['device'+this.device.n][this.idx])
    //tag)
    //tag)
    let n = 0
    for (let item in this.config[this.device.device].items) {
      if(typeof this.config[this.device.device].items[item]=='function'){
        continue
      }
      let index = this.config[this.device.device].items[item].index-1
      this.$set('page.options' + index, [])
      //tag)
      //tag)
      //tag)
      // 先根据配置组接页面
      let f_item_value
      if(this.config[this.device.device].items[item].type == 'selector' || this.config[this.device.device].items[item].type == 'checkbox'){
        f_item_value = []
        // 判断选项的默认值
        for (let defitem in this.config[this.device.device].items[item].options) {
          if(typeof this.config[this.device.device].items[item].options[defitem]=='function'){
            continue
          }
          let defopt = this.config[this.device.device].items[item].options[defitem]
          if (defopt.isdefault) {
            //tag
            f_item_value[0] = defopt.data
          }
        }
        // if(this.config[this.device.device].items[item].data){
        //   f_item_value.push(this.config[this.device.device].items[item].data)
        // }
      }else if(this.config[this.device.device].items[item].type == 'radio'){
        //为radio添加默认值
        f_item_value=''
        //tag)
        for (let defitem in this.config[this.device.device].items[item].options) {
          if(typeof this.config[this.device.device].items[item].options[defitem]=='function'){
            continue
          }
          //tag)
          let defopt = this.config[this.device.device].items[item].options[defitem]
          if (defopt.isdefault) {
            //tag)
            f_item_value = defopt.data
          }
        }
      }else{
        f_item_value = this.config[this.device.device].items[item].data ? this.config[this.device.device].items[item].data : ''
      }
      //tag)
      let it = {
        type: this.config[this.device.device].items[item].type,
        f_item_name: item,
        checkmust: this.config[this.device.device].items[item].checkmust,
        f_item_value: f_item_value,
        is_verification:this.config[this.device.device].items[item].is_verification,
        verification_text:'',
        verification_state:'',// ai验证是否通过 npass(未通过)/pass(通过)
        f_is_defect: '',
        multiple:this.config[this.device.device].items[item].multiple == true?this.config[this.device.device].items[item].multiple:false,
        isshow:this.config[this.device.device].items[item].isshow == false?this.config[this.device.device].items[item].isshow:true,
        readonly: this.config[this.device.device].items[item].readonly == true?true:false,
        remark: this.config[this.device.device].items[item].remark ? this.config[this.device.device].items[item].remark : '',
        f_path: '',
        f_paths: '',
        f_filename_paths: '',
        paths: [],
        unit: this.config[this.device.device].items[item].unit ? this.config[this.device.device].items[item].unit : '',
        tooltip:'',
        f_live_dispose:'',
        f_deal_dispose:'',
        f_else: '',
        f_p1_path: '',
        f_p2_path: '',
        f_p3_path: '',
        f_longitude:'',
        f_latitude:''
      }
      //tag)
      //tag)
      this.$set('f_items['+index+']',it)
      if (this.config[this.device.device].items[item].type == 'selector' ||this.config[this.device.device].items[item].type == 'inputSelector') {
        if(this.config[this.device.device].items[item].type == 'selector'){
          this.page['options' + index].push({
            label: "请选择",
            value: ''
          })
        }
        for (let i in this.config[this.device.device].items[item].options) {
          if(typeof this.config[this.device.device].items[item].options[i]=='function'){
            continue
          }
          this.page['options' + index].push({
            label: this.config[this.device.device].items[item].options[i].data,
            value: this.config[this.device.device].items[item].options[i].data,
            tooltip: this.config[this.device.device].items[item].options[i].tooltip
          })
        }
        if(this.config[this.device.device].items[item].type == 'selector'){
          this.$set('f_items['+index+'].selected', f_item_value)
        }else if(this.config[this.device.device].items[item].type == 'inputSelector'){
          this.$set('f_items['+index+'].selected', f_item_value)
        }

        this.$set('f_items['+index+'].options',this.page['options' + index])

        //tag)
      } else if (this.config[this.device.device].items[item].type == 'radio' || this.config[this.device.device].items[item].type == 'checkbox') {
        //tag)
        //tag
        //tag)
        for (let i in this.config[this.device.device].items[item].options) {
          if(typeof this.config[this.device.device].items[item].options[i]=='function'){
            continue
          }
          //tag
          this.page['options' + index].push({
            label: this.config[this.device.device].items[item].options[i].data,
            value: this.config[this.device.device].items[item].options[i].data,
            isdefect: this.config[this.device.device].items[item].options[i].isdefect,
            level: this.config[this.device.device].items[item].options[i].level,
            tooltip: this.config[this.device.device].items[item].options[i].tooltip
          })
          //tag)
        }
        //tag)
        this.$set('f_items[' + index + '].options', this.page['options' + index])
        this.$set('f_items[' + index + '].f_item_value', f_item_value)
        //tag)
      }
      n = n + 1
    }
    if(!this.piece || JSON.stringify(this.piece) == '{}') {
      // 如果没有，则新建
      this.$set('piece.f_items',this.f_items)
      this.$set('piece.f_device_type',this.device.device)
    } else {
      // 已经存在，把之前的数据重新填入
      for (let f in this.f_items){
        if(typeof this.f_items[f]=='function'){
          continue
        }
        for(let p in this.piece.f_items) {
          if(typeof this.piece.f_items[p]=='function'){
            continue
          }
          if (this.f_items[f].f_item_name == this.piece.f_items[p].f_item_name) {
            //tag)
            //tag)
            if(Util.isEmpty(this.piece.f_items[p].paths) && !Util.isEmpty(this.piece.f_items[p].f_paths)){
              this.piece.f_items[p].paths = []
              let imgs = this.piece.f_items[p].f_paths.split(',').filter(Boolean)
              for (let i in imgs){
                this.piece.f_items[p].paths.push({f_path:imgs[i]})
              }
            }
            this.f_items[f] = Object.assign(this.f_items[f], this.piece.f_items[p])
            //tag)
            if (this.f_items[f].type == 'selector' || this.f_items[f].type == 'inputSelector') {
              //tag)
              //tag)
              this.f_items[f].selected = this.piece.f_items[p].f_item_value
              //tag)
            }
            // 取出特殊值
            if (this.f_items[f].f_item_name == '初始表底') {
              //tag)
              this.f_initial_base.index = f
            } else if (this.f_items[f].f_item_name == '累购气量') {
              //tag)
              this.f_total_gas.index = f
            } else if (this.f_items[f].f_item_name == '已用气量') {
              //tag)
              this.f_table_base.index = f
              this.$watch('f_items[' + f + '].f_item_value', function () {
                this.getGasAberrantNumber('已用气量')
              })
            } else if (this.f_items[f].f_item_name == '剩余气量') {
              //tag)
              this.f_gas_balance.index = f
              this.$watch('f_items[' + f + '].f_item_value', function () {
                this.getGasAberrantNumber('')
              })
            } else if (this.f_items[f].f_item_name == '气量异常差值') {
              //tag)
              this.f_gas_aberrant_number.index = f
            } else if (this.f_items[f].f_item_name == '累购金额') {
              //tag)
              this.f_total_fee.index = f
            } else if (this.f_items[f].f_item_name == '已用金额') {
              //tag)
              this.f_fee_base.index = f
              this.$watch('f_items[' + f + '].f_item_value', function () {
                this.getFeeAberrantNumber('已用金额')
              })
            } else if (this.f_items[f].f_item_name == '剩余金额') {
              //tag)
              this.f_fee_balance.index = f
              this.$watch('f_items[' + f + '].f_item_value', function () {
                this.getFeeAberrantNumber('')
                this.getFeeAberrantNumber2('')
              })
            } else if (this.f_items[f].f_item_name == '表端剩余金额') {
              this.f_table_balance.index = f
              this.$watch('f_items[' + f + '].f_item_value', function () {
                this.getFeeAberrantNumber2('')
              })
            } else if (this.f_items[f].f_item_name == '金额异常差值') {
              //tag)
              this.f_fee_aberrant_number.index = f
            }else if (this.f_items[f].f_item_name == '表读数') {
              //tag)
              this.f_meter_base.index = f
            }else if (this.f_items[f].f_item_name == '表剩余金额') {
              //tag)
              this.f_balance_amount.index = f
            }else if (this.f_items[f].f_item_name == '字轮数') {
              //tag)
              this.f_meter_base1.index = f
              this.$watch('f_items[' + f + '].f_item_value', function () {
                this.getmeteraberrantnumber()
              })
            }else if (this.f_items[f].f_item_name == '表余额') {
              //tag)
              this.f_balance_amount1.index = f
              this.$watch('f_items[' + f + '].f_item_value', function () {
                this.getfeeaberrantnumber1()
              })
            }else if (this.f_items[f].f_item_name == '表数异常差值') {
              //tag)
              this.f_meter_aberrant_number1.index = f
            }else if (this.f_items[f].f_item_name == '表金额异常差值') {
              //tag)
              this.f_fee_aberrant_number1.index = f
            }
          }
        }
        for (let em in this.config[this.device.device].items) {
          if(typeof this.config[this.device.device].items[em]=='function'){
            continue
          }
          if (this.config[this.device.device].items[em].type == 'selector' && em == this.f_items[f].f_item_name) {
            this.f_items[f].options =[]
            for (let k in this.config[this.device.device].items[em].options) {
              if(typeof this.config[this.device.device].items[em].options[k]=='function'){
                continue
              }
              this.f_items[f].options.push({
                label: this.config[this.device.device].items[em].options[k].data,
                value: this.config[this.device.device].items[em].options[k].data
              })
            }
          }
        }
      }
      //tag)
      this.$set('piece.f_items',this.f_items)
    }
    this.towatch()
  },
  destroyed(){
    let nullCount = 0
    let metertitles
    //判断当前是否有选中项
    for (let row in this.f_items){
      if(typeof this.f_items[row]=='function'){
        continue
      }
      if(this.f_items[row].selected  && this.f_items[row].selected != '' && this.f_items[row].selected instanceof Array){
        //tag
        this.f_items[row].f_item_value = this.f_items[row].selected
      }else if(this.f_items[row].selected  && this.f_items[row].selected != ''){
        //tag
        this.f_items[row].f_item_value = this.f_items[row].selected
      }
      // if(this.f_items[row].f_item_value instanceof Array && this.f_items[row].f_item_value.length != 0 ){
      //   nullCount = nullCount+1
      // }else if(this.f_items[row].f_item_value != ''){
      //   nullCount = nullCount+1
      // }
    }
    let picture = []
    // for (let row in this.f_items){
    //   let a={}
    //   a.f_path = this.f_items[row].f_path
    //   a.name = this.f_items[row].f_item_name
    // }
    //   picture.push(a)
    this.$set(`paper['device${this.device.n}'][${this.idx}]`, this.piece)
    //tag
  },
  computed:{

  }
}
</script>
<style lang="less" scoped>
.class-erro {
  color: #a94442;
}
.fivelabel{
  border: none;
  border-left: 5px solid #A2C2EB;
  float: left;
  width: 35%;
  margin-bottom: 3px;
  text-align: left;
  word-wrap: break-word;
  white-space: normal;
}
.radiolabel{
  border: none;
  border-left: 5px solid #A2C2EB;
  float: left;
  width: 65%;
  margin-bottom: 3px;
  text-align: left;
  word-wrap: break-word;
  white-space: normal;
}

.textlabel {
  border: none;
  border-left: 5px solid #A2C2EB;
  width: 100%;
  margin-bottom: 3px;
  text-align: left;
  word-wrap: break-word;
  white-space: normal;
}
.textlabel1 {
  border: none;
  border-left: 5px solid #f7cb32;
  width: 100%;
  margin-bottom: 3px;
  text-align: left;
  word-wrap: break-word;
  white-space: normal;
}
.spanrodio{
  margin-right: 10px;
}
.div-photo{
  width: auto;
  height: auto;
  /* margin-top: 10px; */
  position: absolute;
  bottom: 10px;
  right: 10px;
}
.panel-self{
  border-radius: 5px;
  border:1px solid #c5e1f7;
  //background-color: #F2F6FA;
}
.btn-photo{
  border: 0;
  border-radius: 7px;
  background-color: #7dc1f4;
  font: 15px PingFang-SC-Bold;
  height: 20%;
}
</style>

