<template>
  <div class="auto" id="meterInfoTest">
    <validator name='m' @valid="mValid(true)" @invalid="mValid(false)">
      <form class="form-horizontal select-overspread ">
        <div style="margin-top: 2%;">
          <a style="font-size: 16px;font-weight: 500;">表具信息</a>&nbsp;<a style="color: #999999;text-decoration: none"></a>
        </div>
        <div class="row" >
          <div class="col-sm-4 form-group" :class="[$m.brand.required ? 'has-error' : '']">
            <label for="gasbrand" class="font_normal_body">气表品牌</label>
            <input type="text" class="input_search" style="width:60%" v-show="false" v-model="$refs.brand.selectedItems"
                   v-validate:brand='{required: true }'>
            <v-select :value.sync="row.gasbrand" :options='meterbrands' placeholder='气表品牌' close-on-select
                      search @change='brandChange' v-model='row.gasbrand' v-ref:brand></v-select>
          </div>
          <div class="col-sm-4 form-group" :class="[$m.model.required ? 'has-error' : '']">
            <label for="gasmodel" class="font_normal_body">气表型号</label>
            <input type="text" v-show="false" v-model="$refs.model.selectedItems"
                   v-validate:model='{required: true }'>
            <v-select :value.sync="row.gasmodel" :options='row.gasbrand[0].gasmodel' placeholder='气表型号'
                      close-on-select
                      v-model='row.gasmodel' :disabled="row.gasbrand.length === 0" v-ref:model></v-select>
          </div>

          <div class="col-sm-4 form-group" v-if="isiot" :class="[$m.f_meternumber.required ? 'has-error' : '']">
            <label for="f_meternumber" class="font_normal_body">&ensp;表&emsp;&emsp;号</label>
            <input type="text" class="input_search" style="width:60%" v-model="row.f_meternumber"
                   @blur="meternumberValidate()" placeholder='表号' v-validate:f_meternumber='{required: true }'
                   v-next-el="{id: 'metertitles'}" :disabled="meterNumberDisabled && meterChangeDisabled">
          </div>
          <div class="col-sm-4 form-group" v-else>
            <label for="f_meternumber" class="font_normal_body">&ensp;表&emsp;&emsp;号</label>
            <input type="text" class="input_search" style="width:60%" v-model="row.f_meternumber"
                   @blur="meternumberValidate()" placeholder='表号'
                   v-next-el="{id: 'metertitles'}">
          </div>
          <div class="col-sm-4 form-group" :class="[$m.f_defendcard.required ? 'has-error' : '']"
               v-show="(formconfig && formconfig.f_defendcard && formconfig.f_defendcard.required) || !onlyshowmust"
               v-if="getConfigShowItem('f_defendcard',false)">
            <label class="font_normal_body">防盗卡号1</label>
            <input type="text" class="input_search" style="width:60%" v-model="row.f_defendcard"
                   v-validate:f_defendcard=getConfigValidate("f_defendcard",false)
                   :value.sync="row.f_defendcard"
                   placeholder='防盗卡号1' >
          </div>
          <div class="col-sm-4 form-group" :class="[$m.f_defendcard_two.required ? 'has-error' : '']"
               v-show="(formconfig && formconfig.f_defendcard_two && formconfig.f_defendcard_two.required) || !onlyshowmust"
               v-if="getConfigShowItem('f_defendcard_two',false)">
            <label class="font_normal_body">防盗卡号2</label>
            <input type="text" class="input_search" style="width:60%" v-model="row.f_defendcard_two"
                   v-validate:f_defendcard_two=getConfigValidate("f_defendcard_two",false)
                   :value.sync="row.f_defendcard_two"
                   placeholder='防盗卡号2' >
          </div>
          <div class="col-sm-4 form-group" :class="[$m.f_metertitles.required ? 'has-error' : '']"
               v-show="(formconfig && formconfig.f_metertitles && formconfig.f_metertitles.required) || !onlyshowmust"
               v-if="getConfigShowItem('f_metertitles')">
            <label for="f_metertitles" class="font_normal_body">&ensp;表&ensp;封&ensp;号</label>
            <input type="text" class="input_search" style="width:60%" v-model="row.f_metertitles" placeholder='表封号'
                   v-next-el="{id: 'meterbase'}">
          </div>
          <div class="col-sm-4 form-group" v-if="getConfigShowItem('f_table_state')"
               v-show="(formconfig && formconfig.f_table_state && formconfig.f_table_state.required) || !onlyshowmust">
            <label for="f_metertitles" class="font_normal_body">表具状态</label>
            <input type="text" class="input_search" style="width:60%" v-model="row.f_table_state" placeholder='表具状态' disabled>
          </div>
          <div class="col-sm-4 form-group" v-if="getConfigShowItem('f_meter_base')"
               v-show="(formconfig && formconfig.f_meter_base && formconfig.f_meter_base.required) || !onlyshowmust">
            <label for="f_meter_base" class="font_normal_body">&ensp;表&ensp;读&ensp;数</label>
            <input type="text" class="input_search" style="width:60%" v-model="row.f_meter_base" placeholder='表底数'
                   :disabled="!jurisdiction.includes('档案信息查询修改')" :readonly="!row.f_userfiles_id"
                   v-on:keyup="validateInput($event, 'f_meter_base')" >
          </div>
          <div class="col-sm-4 form-group" title="涉及权限:【档案信息查询修改】" v-if="getConfigShowItem('f_initial_base')"
               v-show="(formconfig && formconfig.f_initial_base && formconfig.f_initial_base.required) || !onlyshowmust">
            <label for="f_meter_base" class="font_normal_body">&ensp;初始底数</label>
            <input type="text" class="input_search" style="width:60%" v-model="row.f_initial_base" placeholder='表底数'
                   :disabled="!jurisdiction.includes('档案信息查询修改')" v-on:keyup="validateInput($event, 'f_initial_base')">
          </div>

          <div class="col-sm-4 form-group" title="涉及权限:【档案信息查询修改】" v-if="getConfigShowItem('f_total_gas')"
               v-show="(formconfig && formconfig.f_total_gas && formconfig.f_total_gas.required) || !onlyshowmust">
            <label for="f_meter_base" class="font_normal_body">&ensp;累购气量</label>
            <input type="text" class="input_search" style="width:60%" v-model="row.f_total_gas" placeholder='累购气量'
                   :disabled="!jurisdiction.includes('档案信息查询修改')" v-on:keyup="validateInput($event, 'f_total_gas')">
          </div>
          <div class="col-sm-4 form-group" title="涉及权限:【档案信息查询修改】" v-if="getConfigShowItem('f_write_totalgas')"
               v-show="(formconfig && formconfig.f_write_totalgas && formconfig.f_write_totalgas.required) || !onlyshowmust">
            <label for="f_meter_base" class="font_normal_body">表写卡累购气量</label>
            <input type="text" class="input_search" style="width:60%" v-model="row.f_write_totalgas" placeholder='表写卡累购气量'
                   :disabled="!jurisdiction.includes('档案信息查询修改')" v-on:keyup="validateInput($event, 'f_write_totalgas')" >
          </div>
          <div class="col-sm-4 form-group" title="涉及权限:【档案信息查询修改】" v-if="getConfigShowItem('f_total_fee')"
               v-show="(formconfig && formconfig.f_total_fee && formconfig.f_total_fee.required) || !onlyshowmust">
            <label for="f_meter_base" class="font_normal_body">&ensp;累购金额</label>
            <input type="text" class="input_search" style="width:60%" v-model="row.f_total_fee" placeholder='累购金额'
                   :disabled="!jurisdiction.includes('档案信息查询修改')" v-on:keyup="validateInput($event, 'f_total_fee')">
          </div>
          <div class="col-sm-4 form-group" title="涉及权限:【档案信息查询修改】" v-if="getConfigShowItem('f_write_totalfee')"
               v-show="(formconfig && formconfig.f_write_totalfee && formconfig.f_write_totalfee.required) || !onlyshowmust">
            <label for="f_meter_base" class="font_normal_body">表写卡累购金额</label>
            <input type="text" class="input_search" style="width:60%" v-model="row.f_write_totalfee" placeholder='表写卡累购金额'
                   :disabled="!jurisdiction.includes('档案信息查询修改')" v-on:keyup="validateInput($event, 'f_write_totalfee')">
          </div>
          <div class="col-sm-4 form-group" v-show="row.f_meter_classify != '机表' && ((formconfig && formconfig.f_times && formconfig.f_times.required) || !onlyshowmust)" title="涉及权限:【档案信息查询修改】"
               v-if="getConfigShowItem('f_times')">
            <label for="f_times" class="font_normal_body">&ensp;写卡次数</label>
            <input type="text" class="input_search" style="width:60%" v-model="row.f_times" placeholder='写卡次数'
                   :disabled="!jurisdiction.includes('档案信息查询修改')" v-on:keyup="validateInput($event, 'f_times')">
          </div>
          <div class="col-sm-4 form-group" v-show="row.f_meter_classify == '物联网表' && ((formconfig && formconfig.f_iot_times && formconfig.f_iot_times.required) || !onlyshowmust)" title="涉及权限:【档案信息查询修改】"
              v-if="getConfigShowItem('f_iot_times')">
            <label for="f_times" class="font_normal_body">物联网次数</label>
            <input type="text" class="input_search" style="width:60%" v-model="row.f_iot_times" placeholder='物联网次数'
                   :disabled="!jurisdiction.includes('档案信息查询修改')" v-on:keyup="validateInput($event, 'f_iot_times')">
          </div>
          <div class="col-sm-4 form-group"  v-show="false">
            <label for="f_remanent_gas" class="font_normal_body">剩余气量</label>
            <input type="text" class="input_search" style="width:60%"  v-model="row.f_remanent_gas"
                   placeholder='剩余气量'
                   :disabled="f_userinfo_id" v-on:keyup="validateInput($event, 'f_remanent_gas')"></input>
            <!--<button type="button" name="button" class="btn btn-link" @click="modefiy('f_remanent_gas')" v-if="f_userinfo_id">修改</button>-->
          </div>
          <div class="col-sm-4 form-group" v-if="getConfigShowItem('f_capacity')"
               v-show="(formconfig && formconfig.f_capacity && formconfig.f_capacity.required) || !onlyshowmust">
            <label for="f_times" class="font_normal_body">&ensp;最大量程</label>
            <input type="text" class="input_search" style="width:60%" v-model="row.f_capacity" placeholder='最大量程'
                   v-on:keyup="validateInput($event, 'f_capacity')">
          </div>
          <div class="col-sm-4 form-group" v-show="row.f_meter_classify == '物联网表' && (formconfig && formconfig.f_valve_state.required || !onlyshowmust)" v-if="getConfigShowItem('f_valve_state')">
            <label for="gasmodel" class="font_normal_body">&ensp;阀门状态</label>
            <v-select :value.sync="row.f_valve_state" :options='valvestate' placeholder='阀门状态' close-on-select
                      v-model='row.f_valve_state'></v-select>
          </div>
          <div class="col-sm-4 form-group"
               v-show="row.gasbrand.length > 0 && row.gasbrand[0].f_meter_type == '物联网表' && row.gasbrand[0].f_hascard == '是' && (
                 (formconfig && formconfig.f_open_way && formconfig.f_open_way.required) || !onlyshowmust
               )">
            <label class="font_normal_body" title="开户方式">开户方式</label>
            <v-select :value.sync="row.f_open_way" :options='openWay' value-single placeholder='开户方式' close-on-select v-if="row.f_userfiles_id"
                      search v-model='row.f_open_way' :disabled="curuser.f_user_state != '预备'"></v-select>
            <v-select :value.sync="row.f_open_way" :options='openWay' value-single placeholder='开户方式' close-on-select v-else
                      search v-model='row.f_open_way' :disabled="false"></v-select>
          </div>
          <div class="col-sm-4 form-group" v-show="row.gasbrand.length > 0 && row.gasbrand[0].f_meter_brand.indexOf('集中器') !== -1
&& ((formconfig && formconfig.f_concentrator_id && formconfig.f_concentrator_id.required) || !onlyshowmust)">
            <label class="font_normal_body" title="集中器">集&ensp;中&ensp;器</label>
            <v-select :value.sync="row.f_concentrator_id" :options='concentrators' value-single placeholder='集中器' close-on-select v-if="row.f_userfiles_id"
                      search v-model='row.f_concentrator_id' :disabled="true"></v-select>
            <v-select :value.sync="row.f_concentrator_id" :options='concentrators' value-single placeholder='集中器' close-on-select v-else
                      search v-model='row.f_concentrator_id' :disabled="false"></v-select>
          </div>
          <div class="col-sm-4 form-group" v-if="(row.gasbrand.length > 0 && ((row.gasbrand[0].f_meter_type == '物联网表' && row.gasbrand[0].f_hascard == '是') || (row.f_meter_classify.includes('卡表'))) && row.f_user_id )">
            <label class="font_normal_body">&ensp;卡&emsp;&emsp;号</label>
            <input type="number" class="input_search" style="width:60%" v-model="row.f_card_id" placeholder='卡号' @blur="checkCardId" :disabled="!jurisdiction.includes('卡号修改')">
          </div>
          <div class="col-sm-4 form-group" :class="[$m.f_force_measure.required ? 'has-error' : '']"
               v-show="(formconfig && formconfig.f_force_measure && formconfig.f_force_measure.required) || !onlyshowmust"
               v-if="getConfigShowItem('f_force_measure',false)">
            <label class="font_normal_body">{{getConfigLabelName('f_force_measure','三项强制措施')}}</label>
            <input type="text" v-model="$refs.measure.selectedItems" v-show="false"
                   v-validate:f_force_measure=getConfigValidate("f_force_measure",false)>
            <v-select :value.sync="row.f_force_measure" v-model="row.f_force_measure"
                      :options='forceMeasure' placeholder='三项强制措施' :multiple="true"
                      v-ref:measure>
            </v-select>
          </div>
          <div class="col-sm-4 form-group" :class="[$m.f_usetype.required ? 'has-error' : '']"
               v-show="(formconfig && formconfig.f_usetype && formconfig.f_usetype.required) || !onlyshowmust"
               v-if="getConfigShowItem('f_usetype')">
            <label for="f_usetype" class="font_normal_body" title="参数:使用类型">&ensp;{{getConfigLabelName('f_usetype','使用类型')}}</label>
            <input type="text" v-model="row.f_usetype" v-show="false"
                   v-validate:f_usetype=getConfigValidate("f_usetype",false)>
            <v-select :value.sync="row.f_usetype" v-model="row.f_usetype"
                      :options='usetype' placeholder='使用类型'
                      close-on-select></v-select>
          </div>
        </div>
        <div>
          <a style="font-size: 16px;font-weight: 500;">气价信息</a>&nbsp;<a style="color: #999999;text-decoration: none"></a>
        </div>
        <div class="row">
          <div class="col-sm-4 form-group" :class="[$m.name.required ? 'has-error' : '']">
            <label for="pricename" class="font_normal_body">气价名称</label>
            <v-select :value.sync="row.pricename" v-model="row.pricename" search
                      placeholder='气价名称' :options="getPricenames" @change="priceChange"
                      close-on-select :disabled="permissionPrice" v-ref:name></v-select>
            <input type="text" v-show="false" v-model="$refs.name.selectedItems" v-validate:name='{required: true }'>
          </div>
          <div class="col-sm-4 form-group">
            <label for="f_username" class="font_normal_body">&ensp;客户类型</label>
            <v-select :value.sync="row.f_user_type"
                      :options='usertypes' placeholder='客户类型'
                      @change="userTypeChange()"
                      :disabled="true"
                      close-on-select></v-select>
          </div>
          <div class="col-sm-4 form-group"
               :class="[$m.gas.required ? 'select-error' : '']">
            <label for="f_username" class="font_normal_body">&ensp;用气性质</label>
            <input type="text" v-show="false" v-model="$refs.gas.selectedItems" v-validate:gas='{required: true }'>
            <v-select :value.sync="row.f_gasproperties" v-model="row.f_gasproperties"
                      :options='gasproperties' placeholder='用气性质'
                      :disabled="true"
                      close-on-select v-ref:gas></v-select>
          </div>
          <div class="col-sm-4 form-group">
            <label for="f_detailprice" class="font_normal_body">&ensp;价&emsp;&emsp;格</label>
            <input type="text" class="input_search" style="width:60%" v-model="row.f_detailprice" placeholder='价格'
                   disabled>
          </div>
          <div class="col-sm-4 form-group" :class="[$m.type.required ? 'select-error' : '']">
            <label for="pricetype" class="font_normal_body">&ensp;气价类型</label>
            <v-select :value.sync="row.pricetype" v-model="row.pricetype"
                      placeholder='气价类型' :options="pricetypes"
                      :value-single="true"
                      :disabled="true"
                      close-on-select v-ref:type>
            </v-select>
            <input type="text" v-show="false" v-model="$refs.type.selectedItems" v-validate:type='{required: true }'>
          </div>
          <div class="col-sm-4 form-group">
            <label class="font_normal_body">&ensp;气价备注</label>
            <input type="text" class="input_search" style="width:60%" v-model="row.f_price_comments" placeholder='气价备注' disabled>
          </div>
        </div>
        <div>
          <a style="font-size: 16px;font-weight: 500;">表具其他信息</a>&nbsp;<a style="color: #999999;text-decoration: none"></a>
        </div>
        <div class="row">
          <div class="col-sm-4 form-group" v-show="(row.f_gasproperties=='工业'||row.f_gasproperties=='工业用气') && (formconfig && formconfig.f_gongye_type.required || !onlyshowmust)"
               :class="[$m.f_gongye_type.required ? 'has-error' : '']"
               v-if="getConfigShowItem('f_gongye_type')">
            <label for="f_gongye_type" class="font_normal_body" title="参数:工业备注">&ensp;{{getConfigLabelName('f_gongye_type','工业备注')}}</label>
            <input type="text" v-show="false" v-model="row.f_gongye_type"
                   v-validate:f_gongye_type=getConfigValidate("f_gongye_type",false)>
            <v-select :value.sync="row.f_gongye_type" v-model='row.f_gongye_type'
                      :options='gongyetype'
                      :placeholder="getConfigPlaceholder('f_gongye_type','工业备注')"
                      close-on-select
                      v-el:cc></v-select>
          </div>
          <div class="col-sm-4 form-group"
               :class="[$m.f_aroundmeter.required ? 'has-error' : '']"
               v-show="(formconfig && formconfig.f_aroundmeter && formconfig.f_aroundmeter.required) || !onlyshowmust"
               v-if="getConfigShowItem('f_aroundmeter')">
            <input type="text" v-show="false" v-model="row.f_aroundmeter"
                   v-validate:f_aroundmeter=getConfigValidate("f_aroundmeter",false)>
            <label for="gasmodel" class="font_normal_body w2" style="width: auto;letter-spacing: 2em;margin-right: -2em;margin-left: -2em;">&ensp;{{getConfigLabelName('f_aroundmeter','表向')}}</label>
            <v-select :value.sync="row.f_aroundmeter" :options='aroundmeters'
                      :placeholder="getConfigPlaceholder('f_aroundmeter','表向')"
                      close-on-select
                      v-model='row.f_aroundmeter'></v-select>
          </div>
          <div class="col-sm-4 form-group"  :class="[$m.f_bqf_type.required ? 'has-error' : '']"
               v-show="(formconfig && formconfig.f_bqf_type && formconfig.f_bqf_type.required) || !onlyshowmust"
               v-if="getConfigShowItem('f_bqf_type')">
            <label for="f_bqf_type" class="font_normal_body">{{getConfigLabelName('f_bqf_type','表前阀型号')}}</label>
            <input type="text" class="input_search" style="width:60%" v-model="row.f_bqf_type"
                   v-validate:f_bqf_type=getConfigValidate("f_bqf_type",false)
                   :placeholder="getConfigPlaceholder('f_bqf_type','表前阀型号')">
          </div>
          <div class="col-sm-4 form-group" :class="[$m.f_use_limit.required ? 'has-error' : '']"
               v-show="(formconfig && formconfig.f_use_limit && formconfig.f_use_limit.required) || !onlyshowmust"
               v-if="getConfigShowItem('f_use_limit')">
            <label class="font_normal_body">表具使用年限</label>
            <input type="number" class="input_search" style="width:60%" v-model="row.f_use_limit"
                   v-validate:f_use_limit=getConfigValidate("f_use_limit",false)
                   :value.sync="row.f_use_limit"
                   placeholder='表具使用年限' >
          </div>
          <div class="col-sm-4 form-group" :class="[$m.f_gas_person.required ? 'has-error' : '']"
               v-show="(formconfig && formconfig.f_gas_person && formconfig.f_gas_person.required) || !onlyshowmust"
               v-if="getConfigShowItem('f_gas_person')">
            <label for="f_gas_person" style="width: auto;letter-spacing: 0.5em;margin-right: -0.5em;margin-left: -0.5em"
                   class="font_normal_body">&ensp;{{getConfigLabelName('f_gas_person','通气人')}}</label>
            <input type="text" class="input_search" style="width:60%" v-model="row.f_gas_person"
                   v-validate:f_gas_person=getConfigValidate("f_gas_person",false)
                   placeholder='通气人'></input>
          </div>
          <div class="col-sm-4 form-group" :class="[$m.f_gas_date.required ? 'has-error' : '']"
               v-show="(formconfig && formconfig.f_gas_date && formconfig.f_gas_date.required) || !onlyshowmust"
               v-if="getConfigShowItem('f_gas_date')">
            <input type="text" v-model="$refs.f_gas_date.value" v-show="false"
                   v-validate:f_gas_date=getConfigValidate("f_gas_date",false)>
            <label for="f_gas_date" class="font_normal_body">&ensp;{{getConfigLabelName('f_gas_date','通气日期')}}</label>
            <datepicker style="width:60%" placeholder="通气日期"
                        v-model="row.f_gas_date"
                        v-ref:f_gas_date
                        @change="gasDateChange"
                        :value.sync="row.f_gas_date"
                        :format="'yyyy-MM-dd HH:mm:ss'"
            ></datepicker>
          </div>

          <div class="col-sm-4 form-group" :class="[$m.f_position.required ? 'has-error' : '']"
               v-show="(formconfig && formconfig.f_position && formconfig.f_position.required) || !onlyshowmust"
               v-if="getConfigShowItem('f_gas_date')">
            <label for="f_position" class="font_normal_body"  title="参数:安装位置">&ensp;{{getConfigLabelName('f_position','安装位置')}}</label>
            <input type="text" v-model="row.f_position" v-show="false"
                   v-validate:f_position=getConfigValidate("f_position",false)>
            <v-select :value.sync="row.f_position" v-model="row.f_position"
                      :options='positions' placeholder='安装位置'
                      close-on-select></v-select>
          </div>
          <div class="col-sm-4 form-group" :class="[$m.f_install_person.required ? 'has-error' : '']"
               v-show="(formconfig && formconfig.f_install_person && formconfig.f_install_person.required) || !onlyshowmust"
               v-if="getConfigShowItem('f_install_person')">
            <label for="f_install_person" class="font_normal_body" style="width: auto;letter-spacing: 0.5em;margin-right: -0.5em;margin-left: -0.5em">&ensp;{{getConfigLabelName('f_install_person','安装人')}}</label>
            <input type="text" v-model="row.f_install_person" v-show="false"
                   v-validate:f_install_person=getConfigValidate("f_install_person",false)>
            <v-select :value.sync="row.f_install_person" v-model="row.f_install_person"
                      :options='installperson' placeholder='安装人'
                      close-on-select></v-select>
          </div>
          <div class="col-sm-4 form-group" :class="[$m.f_subscribe_date.required ? 'has-error' : '']"
               v-show="(formconfig && formconfig.f_subscribe_date && formconfig.f_subscribe_date.required) || !onlyshowmust"
               v-if="getConfigShowItem('f_subscribe_date')">
            <label for="f_subscribe_date" class="font_normal_body">&ensp;{{getConfigLabelName('f_subscribe_date','预约时间')}}</label>
            <input type="text" v-model="row.f_subscribe_date" v-show="false"
                   v-validate:f_subscribe_date=getConfigValidate("f_subscribe_date",false)>
            <datepicker style="width:60%" placeholder="预约通气时间"
                        v-model="row.f_subscribe_date"
                        :value.sync="row.f_subscribe_date"
                        :format="'yyyy-MM-dd HH:mm:ss'"
            ></datepicker>
          </div>
          <div class="col-sm-4 form-group" v-show="opteratormetrbook && ((formconfig && formconfig.f_meter_book_num && formconfig.f_meter_book_num.required) || !onlyshowmust)" :class="[$m.f_meter_book_num.required ? 'has-error' : '']"
               v-if="getConfigShowItem('f_meter_book_num')">
            <label for="f_position" class="font_normal_body" style="width: auto;letter-spacing: 0.5em;margin-right: -0.5em;margin-left: -0.5em">&ensp;{{getConfigLabelName('f_meter_book_num','抄表册')}}</label>
            <input type="text" v-model="row.f_meter_book_num" v-show="false"
                   v-validate:f_meter_book_num=getConfigValidate("f_meter_book_num",false)>
            <v-select :value.sync="row.f_meter_book_num" v-model="row.f_meter_book_num"
                      :options='meterbookoptions' placeholder='抄表册'
                      close-on-select></v-select>
          </div>
          <div class="col-sm-4 form-group" :class="[$m.f_install_date.required ? 'has-error' : '']"
               v-show="(formconfig && formconfig.f_install_date && formconfig.f_install_date.required) || !onlyshowmust"
               v-if="getConfigShowItem('f_install_date')">
            <input type="text" v-model="row.f_install_date" v-show="false"
                   v-validate:f_install_date=getConfigValidate("f_install_date",false)>
            <label for="f_install_date" class="font_normal_body">&ensp;{{getConfigLabelName('f_install_date','安装日期')}}</label>
            <datepicker style="width:60%" id="startDate" placeholder="安装日期" width='100%'
                        v-model="row.f_install_date"
                        :value.sync="row.f_install_date"
                        class="datepicker"
                        v-ref:f_install_date
                        :format="'yyyy-MM-dd HH:mm:ss'"
                        :show-reset-button="true">
            </datepicker>
          </div>
          <div class="col-sm-4 form-group" :class="[$m.f_adjustable.required ? 'has-error' : '']"
               v-show="(formconfig && formconfig.f_adjustable && formconfig.f_adjustable.required) || !onlyshowmust"
               v-if="getConfigShowItem('f_adjustable')">
            <label for="f_adjustable" class="font_normal_body" style="width: auto;letter-spacing: 0.5em;margin-right: -0.5em;margin-left: -0.5em">&ensp;{{getConfigLabelName('f_adjustable','调压箱')}}</label>
            <input type="text" v-model="row.f_adjustable" v-show="false"
                   v-validate:f_adjustable=getConfigValidate("f_adjustable",false)>
            <v-select :value.sync="row.f_adjustable" :options='adjustables' placeholder='调压箱' close-on-select
                      v-model='row.f_adjustable' :search='true'></v-select>
          </div>
          <div class="col-sm-4 form-group" :class="[$m.f_hand_date.required ? 'has-error' : '']"
               v-show="(formconfig && formconfig.f_hand_date && formconfig.f_hand_date.required) || !onlyshowmust"
               v-if="getConfigShowItem('f_hand_date')">
            <label for="f_hand_date" class="font_normal_body">&ensp;{{getConfigLabelName('f_hand_date','上次抄表')}}</label>
            <input type="text" v-model="row.f_hand_date" v-show="false"
                   v-validate:f_hand_date=getConfigValidate("f_hand_date",false)>
            <datepicker style="width:60%" id="f_hand_date" placeholder="上次抄表日期"
                        v-model="row.f_hand_date"
                        :value.sync="row.f_hand_date"
                        class="datepicker"
                        :format="'yyyy-MM-dd HH:mm:ss'"
                        :show-reset-button="true">
            </datepicker>
          </div>
          <div class="col-sm-4 form-group" :class="[$m.f_price_ratio.required ? 'has-error' : '']"
               v-show="(formconfig && formconfig.f_price_ratio && formconfig.f_price_ratio.required) || !onlyshowmust"
               v-if="getConfigShowItem('f_price_ratio')">
            <label for="f_ratio" class="font_normal_body" style="width: auto;letter-spacing: 2em;margin-right: -2em;margin-left: -2em">&ensp;{{getConfigLabelName('f_price_ratio','比率')}}</label>
            <input type="number" class="input_search" style="width:60%"  v-model="row.f_price_ratio"
                   :value.sync="row.f_price_ratio"
                   v-validate:f_price_ratio=getConfigValidate("f_price_ratio",false)
                   placeholder='比率'>
          </div>
          <div class="col-sm-4 form-group" :class="[$m.f_factory_date.required ? 'has-error' : '']"
               v-show="(formconfig && formconfig.f_factory_date && formconfig.f_factory_date.required) || !onlyshowmust"
               v-if="getConfigShowItem('f_factory_date')">
            <label for="f_factory_date" class="font_normal_body">&ensp;{{getConfigLabelName('f_factory_date','出厂日期')}}</label>
            <input type="text" v-model="row.f_factory_date" v-show="false"
                   v-validate:f_factory_date=getConfigValidate("f_factory_date",false)>
            <datepicker style="width:60%" id="f_factory_date" placeholder="出厂日期" width='100%'
                        v-model="row.f_factory_date"
                        :value.sync="row.f_factory_date"
                        class="datepicker"
                        :format="'yyyy-MM-dd'"
                        :show-reset-button="true">
            </datepicker>
          </div>
          <div class="col-sm-4 form-group" :class="[$m.f_check_time.required ? 'has-error' : '']"
               v-show="(formconfig && formconfig.f_check_time && formconfig.f_check_time.required) || !onlyshowmust"
               v-if="getConfigShowItem('f_check_time')">
            <label for="f_check_time" class="font_normal_body">&ensp;{{getConfigLabelName('f_check_time','校验日期')}}</label>
            <input type="text" v-model="row.f_check_time" v-show="false"
                   v-validate:f_check_time=getConfigValidate("f_check_time",false)>
            <datepicker style="width:60%" id="f_check_time" placeholder="校验日期" width='100%'
                        v-model="row.f_check_time"
                        :value.sync="row.f_check_time"
                        class="datepicker"
                        :format="'yyyy-MM-dd'"
                        :show-reset-button="true">
            </datepicker>
          </div>
          <div class="col-sm-4 form-group" :class="[$m.f_scrap_date.required ? 'has-error' : '']"
               v-show="(formconfig && formconfig.f_scrap_date && formconfig.f_scrap_date.required) || !onlyshowmust"
               v-if="getConfigShowItem('f_scrap_date')">
            <label for="f_scrap_date" class="font_normal_body">&ensp;{{getConfigLabelName('f_scrap_date','报废日期')}}</label>
            <input type="text" v-model="row.f_scrap_date" v-show="false"
                   v-validate:f_scrap_date=getConfigValidate("f_scrap_date",false)>
            <datepicker style="width:60%" id="ScrapDate" placeholder="报废日期" width='100%'
                        v-model="row.f_scrap_date"
                        :value.sync="row.f_scrap_date"
                        class="datepicker"
                        :format="'yyyy-MM-dd'"
                        :show-reset-button="true">
            </datepicker>
          </div>
          <div class="col-sm-4 form-group" :class="[$m.f_garbage_fee.required ? 'has-error' : '']"
               v-show="(formconfig && formconfig.f_garbage_fee && formconfig.f_garbage_fee.required) || !onlyshowmust"
               v-if="getConfigShowItem('f_garbage_fee')">
            <label for="gasmodel" class="font_normal_body" style="width: auto;letter-spacing: 0.5em;margin-right: -0.5em;margin-left: -0.5em">&ensp;{{getConfigLabelName('f_garbage_fee','垃圾费')}}</label>
            <input type="text" v-model="row.f_garbage_fee" v-show="false"
                   v-validate:f_garbage_fee=getConfigValidate("f_garbage_fee",false)>
            <v-select :value.sync="row.f_garbage_fee" :options='garbagefee' placeholder='垃圾费' close-on-select
                      :value-single="true"
                      v-model='row.f_garbage_fee'></v-select>
          </div>
          <div class="col-sm-4 form-group" :class="[$m.f_inputtor.required ? 'has-error' : '']"
               v-show="(formconfig && formconfig.f_inputtor && formconfig.f_inputtor.required) || !onlyshowmust"
               v-if="getConfigShowItem('f_inputtor')">
            <label class="font_normal_body" style="width: auto;letter-spacing: 0.5em;margin-right: -0.5em;margin-left: -0.5em">&ensp;{{getConfigLabelName('f_inputtor','抄表员')}}</label>
            <input type="text" v-model="row.f_inputtor" v-show="false"
                   v-validate:f_inputtor=getConfigValidate("f_inputtor",false)>
            <v-select :value.sync="row.f_inputtor" v-model='row.f_inputtor'
                      style="width:60%"
                      :options='inputtores' placeholder='抄表员'
                      close-on-select
                      condition="f_inputtor like '%{}%'" v-el:cc></v-select>
          </div>
          <div class="col-sm-4 form-group" :class="[$m.f_usestate.required ? 'has-error' : '']"
               v-show="(formconfig && formconfig.f_usestate && formconfig.f_usestate.required) || !onlyshowmust"
               v-if="getConfigShowItem('f_usestate')">
            <label for="f_position" class="font_normal_body" title="参数:使用状态">&ensp;{{getConfigLabelName('f_usestate','使用状态')}}</label>
            <input type="text" v-model="row.f_usestate" v-show="false"
                   v-validate:f_usestate=getConfigValidate("f_usestate",false)>
            <v-select :value.sync="row.f_usestate" v-model="row.f_usestate"
                      :options='usestate' placeholder='使用状态'
                      close-on-select></v-select>
          </div>
          <div class="col-sm-4 form-group" :class="[$m.f_limit_sms.required ? 'has-error' : '']"
               v-show="(formconfig && formconfig.f_limit_sms && formconfig.f_limit_sms.required) || !onlyshowmust"
               v-if="getConfigShowItem('f_limit_sms')">
            <label for="f_limit_sms" class="font_normal_body">&ensp;{{getConfigLabelName('f_limit_sms','短信限定')}}</label>
            <input type="text" class="input_search" style="width:60%" v-model="row.f_limit_sms"
                   v-validate:f_limit_sms=getConfigValidate("f_limit_sms",false)
                   placeholder='短信限定'></input>
          </div>
          <div style="" class="col-sm-4 form-group" :class="[$m.f_alarm_code.required ? 'has-error' : '']"
               v-show="(formconfig && formconfig.f_alarm_code && formconfig.f_alarm_code.required) || !onlyshowmust"
               v-if="getConfigShowItem('f_alarm_code')">
            <label for="f_alarm_code" class="font_normal_body ">&ensp;{{getConfigLabelName('f_alarm_code','报警器号')}}</label>
            <input type="text" class="input_search" style="width:60%" v-model="row.f_alarm_code" placeholder='报警器号'
                   v-validate:f_alarm_code=getConfigValidate("f_alarm_code",false) >
          </div>
          <div style="" class="col-sm-4 form-group" :class="[$m.f_hand_month.required ? 'has-error' : '']"
               v-show="(formconfig && formconfig.f_hand_month && formconfig.f_hand_month.required) || !onlyshowmust"
               v-if="getConfigShowItem('f_hand_month')">
            <label for="f_hand_month" class="font_normal_body ">&ensp;{{getConfigLabelName('f_hand_month','抄表月份')}}</label>
            <input type="text" v-model="row.f_hand_month" v-show="false"
                   v-validate:f_hand_month=getConfigValidate("f_hand_month",false)>
            <v-select :value.sync="row.f_hand_month" v-model="row.f_hand_month"
                      :options='handmonth' placeholder='抄表月份'
                      close-on-select></v-select>
          </div>
          <div style="" class="col-sm-4 form-group" :class="[$m.f_userfiles_address.required ? 'has-error' : '']"
               v-show="(formconfig && formconfig.f_userfiles_address && formconfig.f_userfiles_address.required) || !onlyshowmust"
               v-if="getConfigShowItem('f_userfiles_address')">
            <label for="f_userfiles_address" class="font_normal_body ">&ensp;{{getConfigLabelName('f_userfiles_address','用气点名')}}</label>
            <input class="input_search" style="width:60%" v-model="row.f_userfiles_address"
                   v-validate:f_userfiles_address=getConfigValidate("f_userfiles_address",false) >
          </div>
          <div style="" class="col-sm-4 form-group" :class="[$m.f_userfiles_lng.required ? 'has-error' : '']"
               v-show="(formconfig && formconfig.f_userfiles_lng && formconfig.f_userfiles_lng.required) || !onlyshowmust"
               v-if="getConfigShowItem('f_userfiles_lng')">
            <label class="font_normal_body" style="width: auto;letter-spacing: 2em;margin-right: -2em;margin-left: -2em">&ensp;{{getConfigLabelName('f_userfiles_lng','经度')}}</label>
            <input type="text" style="width:60%" v-model="row.f_userfiles_lng" class="input_search" placeholder="经度"
                   v-validate:f_userfiles_lng=getConfigValidate("f_userfiles_lng",false)>
          </div>
          <div style="" class="col-sm-4 form-group" :class="[$m.f_userfiles_lat.required ? 'has-error' : '']"
               v-show="(formconfig && formconfig.f_userfiles_lat && formconfig.f_userfiles_lat.required) || !onlyshowmust"
               v-if="getConfigShowItem('f_userfiles_lat')">
            <label class="font_normal_body" style="width: auto;letter-spacing: 2em;margin-right: -2em;margin-left: -2em">&ensp;{{getConfigLabelName('f_userfiles_lat','纬度')}}</label>
            <input type="text" style="width:48%" v-model="row.f_userfiles_lat" class="input_search" placeholder="纬度"
                   v-validate:f_userfiles_lat=getConfigValidate("f_userfiles_lat",false)>
            &ensp;<span class="glyphicon glyphicon-map-marker" @click="openModal" ></span>
          </div>
          <div class="col-sm-4 form-group" :class="[$m.f_comments.required ? 'has-error' : '']"
               v-show="(formconfig && formconfig.f_comments && formconfig.f_comments.required) || !onlyshowmust"
               v-if="getConfigShowItem('f_comments')">
            <label class="font_normal_body" style="width: auto;letter-spacing: 2em;margin-right: -2em;margin-left: -2em">&ensp;{{getConfigLabelName('f_comments','备注')}}</label>
            <input type="text" style="width:60%" v-model="row.f_comments" class="input_search" placeholder="备注"
                   v-validate:f_comments=getConfigValidate("f_comments",false)>
          </div>
          <div class="col-sm-4 form-group" :class="[$m.f_overdue_set.required ? 'has-error' : '']"
               v-show="(formconfig && formconfig.f_overdue_set && formconfig.f_overdue_set.required) || !onlyshowmust"
               v-if="getConfigShowItem('f_overdue_set')">
            <label class="font_normal_body">{{getConfigLabelName('f_overdue_set','违约金规则')}}</label>
            <input type="text" v-model="row.f_overdue_set" v-show="false"
                   v-validate:f_overdue_set=getConfigValidate("f_overdue_set",false)>
            <v-select :value.sync="row.f_overdue_set" v-model="row.f_overdue_set"
                      :options='overdueset' placeholder='违约金规则'
                      close-on-select></v-select>
          </div>
          <div class="col-sm-4 form-group" :class="[$m.f_seal_number.required ? 'has-error' : '']"
               v-show="(formconfig && formconfig.f_seal_number && formconfig.f_seal_number.required) || !onlyshowmust"
               v-if="getConfigShowItem('f_seal_number')">
            <label for="f_seal_number" class="font_normal_body">&ensp;铅封编号</label>
            <input type="text" class="input_search" style="width:60%" v-model="row.f_seal_number" placeholder='铅封编号'
                   v-validate:f_comments=getConfigValidate("f_seal_number",false)>
          </div>
          <div class="col-sm-4 form-group">
            <label class="font_normal_body">报警器是否安装</label>
            <v-select :value.sync="row.f_isalarm" v-model="row.f_isalarm"
                      :value-single="true"
                      :options='yesnoOptions' placeholder='报警器是否安装'
                      close-on-select></v-select>
          </div>
          <div class="col-sm-4 form-group">
            <label class="font_normal_body">报警器是否正常</label>
            <v-select :value.sync="row.f_annunciator_normal" v-model="row.f_annunciator_normal"
                      :value-single="true"
                      :options='yesnoOptions' placeholder='报警器是否正常'
                      close-on-select></v-select>
          </div>
          <div class="col-sm-4 form-group">
            <label class="font_normal_body">报警器是否年检</label>
            <v-select :value.sync="row.f_annunciator_inspected" v-model="row.f_annunciator_inspected"
                      :value-single="true"
                      :options='yesnoOptions' placeholder='报警器是否年检'
                      close-on-select></v-select>
          </div>
          <div class="col-sm-4 form-group">
            <label class="font_normal_body">报警器是否在用</label>
            <v-select :value.sync="row.f_annunciator_inuse" v-model="row.f_annunciator_inuse"
                      :value-single="true"
                      :options='yesnoOptions' placeholder='报警器是否在用'
                      close-on-select></v-select>
          </div>
          <div class="col-sm-4 form-group">
            <label class="font_normal_body">报警器探测器是否超过三年</label>
            <v-select :value.sync="row.f_annunciator_expired" v-model="row.f_annunciator_expired"
                      :value-single="true"
                      :options='yesnoOptions' placeholder='报警器探测器是否超过三年'
                      close-on-select></v-select>
          </div>
          <div class="col-sm-4 form-group">
            <label class="font_normal_body">报警器厂家品牌和型号</label>
            <input type="text" class="input_search" style="width:60%" v-model="row.f_annunciator_factory"
                   placeholder='报警器厂家品牌和型号'>
          </div>
          <div class="col-sm-4 form-group">
            <label class="font_normal_body">报警器数量</label>
            <input type="text" class="input_search" style="width:60%" v-model="row.f_annunciator_num"
                   placeholder='报警器数量'>
          </div>
          <div class="col-sm-4 form-group">
            <label class="font_normal_body">调压箱是否安装</label>
            <v-select :value.sync="row.f_adjustable_install" v-model="row.f_adjustable_install"
                      :value-single="true"
                      :options='yesnoOptions' placeholder='调压箱是否安装'
                      close-on-select></v-select>
          </div>
          <div class="col-sm-4 form-group">
            <label class="font_normal_body">调压箱是否正常</label>
            <v-select :value.sync="row.f_adjustable_normal" v-model="row.f_adjustable_normal"
                      :value-single="true"
                      :options='yesnoOptions' placeholder='调压箱是否正常'
                      close-on-select></v-select>
          </div>
          <div class="col-sm-4 form-group">
            <label class="font_normal_body">调压箱厂家</label>
            <input type="text" class="input_search" style="width:60%" v-model="row.f_adjustable_factory"
                   placeholder='调压箱厂家'>
          </div>
          <div class="col-sm-4 form-group">
            <label class="font_normal_body">调压箱型号</label>
            <input type="text" class="input_search" style="width:60%" v-model="row.f_adjustable_model"
                   placeholder='调压箱型号'>
          </div>
          <div class="col-sm-4 form-group">
            <label class="font_normal_body">调压箱数量</label>
            <input type="text" class="input_search" style="width:60%" v-model="row.f_adjustable_num"
                   placeholder='调压箱数量'>
          </div>
          <div class="col-sm-4 form-group">
            <label class="font_normal_body">调压箱出厂日期</label>
            <datepicker style="width:60%" placeholder="调压箱出厂日期"
                        v-model="row.f_adjustable_date"
                        :value.sync="row.f_adjustable_date"
                        :format="'yyyy-MM-dd'"
                        :show-reset-button="true">
            </datepicker>
          </div>
          <template v-if="config.stuckFlowmeterShow">
            <div class="col-sm-4 form-group">
              <label class="font_normal_body" title="控制器通经">控制器通经</label>
              <input type="text" class="input_search" style="width:60%" v-model="row.f_control_pass"
                     placeholder='控制器通经'></input>
            </div>
            <div class="col-sm-4 form-group">
              <label class="font_normal_body" title="控制器压力等级">控制器压力等级</label>
              <input type="text" class="input_search" style="width:60%" v-model="row.f_control_mpa_level"
                     placeholder='控制器压力等级'></input>
            </div>
            <div class="col-sm-4 form-group">
              <label class="font_normal_body" title="流量计表号">流量计表号</label>
              <input type="text" class="input_search" style="width:60%" v-model="row.f_flowmeter_number"
                     placeholder='流量计表号'></input>
            </div>
            <div class="col-sm-4 form-group">
              <label class="font_normal_body" title="流量计表封号">流量计表封号</label>
              <input type="text" class="input_search" style="width:60%" v-model="row.f_llj_metertitles"
                     placeholder='流量计表封号'></input>
            </div>
            <div class="col-sm-4 form-group">
              <label class="font_normal_body" title="流量计品牌">流量计品牌</label>
              <v-select :value.sync="row.f_flowmeter_brand" :options='flowmeterbrands' value-single placeholder='流量计品牌' close-on-select
                        search v-model='row.f_flowmeter_brand'></v-select>
            </div>
            <div class="col-sm-4 form-group">
              <label class="font_normal_body" title="流量计型号">流量计型号</label>
              <v-select :value.sync="row.f_flowmeter_model" :options='flowmetermodels(row.f_flowmeter_brand)' value-single placeholder='流量计型号' close-on-select
                        v-model='row.f_flowmeter_model' :disabled='row.f_flowmeter_brand.length === 0'></v-select>
            </div>
            <div class="col-sm-4 form-group">
              <label class="font_normal_body" title="流量计通经">流量计通经</label>
              <input type="text" class="input_search" style="width:60%" v-model="row.f_flowmeter_pass"
                     placeholder='流量计通经'></input>
            </div>
            <div class="col-sm-4 form-group">
              <label class="font_normal_body" title="流量计压力等级">流量计压力等级</label>
              <input type="text" class="input_search" style="width:60%" v-model="row.f_flowmeter_mpa_level"
                     placeholder='流量计压力等级'></input>
            </div>
            <div class="col-sm-4 form-group">
              <label class="font_normal_body" title="流量计出厂日期">流量计出厂日期</label>
              <datepicker style="width:60%" placeholder="流量计出厂日期"
                          v-model="row.f_flowmeter_factory_date"
                          :value.sync="row.f_flowmeter_factory_date"
                          :format="'yyyy-MM-dd HH:mm:ss'"
              ></datepicker>
            </div>
            <div class="col-sm-4 form-group">
              <label class="font_normal_body" title="流量计精准度">流量计精准度</label>
              <input type="text" class="input_search" style="width:60%" v-model="row.f_flowmeter_accuracy"
                     placeholder='流量计精准度'></input>
            </div>
            <div class="col-sm-4 form-group">
              <label class="font_normal_body" title="流量计电仪出厂编号">流量计电仪出厂编号</label>
              <input type="text" class="input_search" style="width:60%" v-model="row.f_flowmeter_factory_num"
                     placeholder='流量计电仪出厂编号'></input>
            </div>
            <div class="col-sm-4 form-group">
              <label class="font_normal_body" title="流量计电仪出厂编号">流量计类型</label>
              <input type="text" class="input_search" style="width:60%" v-model="row.f_llj_type"
                     placeholder='流量计类型'></input>
            </div>
            <div class="col-sm-4 form-group">
              <label class="font_normal_body" title="流量计安装日期">流量计安装日期</label>
              <datepicker style="width:60%" placeholder="流量计安装日期"
                          v-model="row.f_flowmeter_install_date"
                          :value.sync="row.f_flowmeter_install_date"
                          :format="'yyyy-MM-dd HH:mm:ss'"
              ></datepicker>
            </div>
          </template>
        </div>
      </form>
    </validator>
    <!--<idverify :show.sync="show" @change-con="changeVal"></idverify>-->
    <modal v-if="showParame" :show.sync="showParame" v-ref:modal backdrop="false">
      <header slot="modal-header" class="modal-header">
        <button type="button" class="close" @click="cancel"><span>&times;</span></button>
        <h3 class="modal-title" style="text-align: center;">添加参数</h3>
      </header>
      <article slot="modal-body" class="modal-body">
        <add-json-parameter v-ref:addparamlist :gasmodel_id="userfileid" :gastype="gastype"
                            :gasid="gasid"></add-json-parameter>
      </article>
      <footer slot="modal-footer" class="modal-footer">
        <button type="button" class="btn btn-primary" @click='confirmUserfiles()'>确认</button>
      </footer>
    </modal>

    <modal :show.sync="mapShow" v-if="mapShow"  large backdrop="false" :width="900">
      <header slot="modal-header" class="modal-header">
      </header>
      <article slot="modal-body" class="modal-body">
        <amap-location :islocationclearmark="false"  dom="addboxmap" v-ref:positionInfo @getmylocation="getmylocation"></amap-location>
      </article>
      <footer slot="modal-footer" class="modal-footer">
        <button v-show="mapShow" type="button" class="button_clear btn-gn" @click='closeModal'>取消</button>
        <button v-show="mapShow" type="button" class="button_clear btn-gn" @click='confirmLocation'>确认</button>
      </footer>
    </modal>
  </div>
</template>

<script>
  import co from 'co'
  import {HttpResetClass} from 'vue-client'
  import Vue from 'vue'
  let meterBookGen = function * (self) {
    if (self.$login.r.find(value => value == '抄表册建档')) {
      self.opteratormetrbook = true
    }
    let temp = {
      tablename: 't_meter_book',
      condition: `f_book_state='有效' and f_filiale_id='${self.$login.f.orgid}'`
    }
    let http = new HttpResetClass()
    let meterbooks = yield http.load('POST', 'rs/sql/saleSingleTable', {data: temp},
      {resolveMsg: null, rejectMsg: '获取抄表册信息失败！！'})
    if (meterbooks.data.length > 0) {
      let options = []
      for (let i = 0; i < meterbooks.data.length; i++) {
        let tmp = {label: meterbooks.data[i].f_book_name, value: `${meterbooks.data[i].id}`}
        options.push(tmp)
      }
      self.meterbookoptions = options
    }
    try {
      let result = yield http.load('GET', `rs/vue/MeterinfoTest.json`, {}, {resolveMsg: null, rejectMsg: null})
      Object.assign(self.config, result.data)
      if (!self.row.f_open_way) {
        self.row.f_open_way = self.config.open_way
      }
      if (!self.row.f_usetype || self.row.f_usetype.length === 0) {
        self.row.f_usetype = self.config.f_usetype
      }
    } catch (error) {
      // 忽略704,文件找不到异常
      if (error.status !== 704) {
        throw error
      }
    }
  }
  let brandChangeGen = function* (self, val) {
    let beforeRecord = null

    if (self.meter.f_meter_classify === '机表') {
      beforeRecord = yield self.$resetpost('rs/sql/saleSingleTable', {
        data: {
          tablename: 't_handplan',
          condition: `f_user_id = '${self.row.f_user_id}' and f_meter_state in ('已抄表','未抄表')`
        }
      }, {resolveMsg: null, rejectMsg: '在档案中更改气表品牌时，获取之前机表抄表信息出错！！'})
    } else if (self.meter.f_meter_classify === '物联网表') {
      beforeRecord = yield self.$resetpost('rs/sql/saleSingleTable', {
        data: {
          tablename: 't_instruct',
          condition: `f_user_id = '${self.row.f_user_id}'`
        }
      }, {resolveMsg: null, rejectMsg: '在档案中更改气表品牌时，获取之前机表抄表信息出错！！'})
    } else {
      beforeRecord = yield self.$resetpost('rs/sql/saleSingleTable', {
        data: {
          tablename: 't_sellinggas',
          condition: `f_user_id = '${self.row.f_user_id}' and f_state = '有效'`
        }
      }, {resolveMsg: null, rejectMsg: '在档案中更改气表品牌时，获取之前卡表收费信息出错！！'})
    }
    if (beforeRecord.data.length > 0 && self.row.gasbrand[0].f_meter_brand != self.oldrow.gasbrand[0].f_meter_brand) {
      self.$showAlert('该气表已投入使用，如需更改请执行换表操作', 'warning', 3000)
      self.$dispatch('success')
    } else {
      self.row.f_whether_hairpin = self.row.gasbrand[0].f_meter_type === '机表' ? '无卡' : '未发'
    }
  }
  export default {
    title: '表具信息',
    data () {
      return {
        config: {
          // 卡控流量计相关字段显示
          stuckFlowmeterShow: false,
          overduesetShow: true,
          f_install_date: true,
          f_usetype: '',
          open_way: '指令开户'
        },
        mapShow: false,
        viewsee: false,
        row: this.meter,
        show: false,
        field: '',
        ratioshow: false,
        // 原本的卡号
        orginCardId: '',
        userfileid: '',
        gasid: '',
        gastype: 'userfiles',
        showParame: false,
        selectUserFiles: '', // 选中的 userfiles
        jurisdiction: this.$login.r,
        positions: this.$appdata.getParam('安装位置'),
        usetype: this.$appdata.getParam('使用类型'),
        usestate: this.$appdata.getParam('使用状态'),
        aroundmeters: this.$appdata.getParam('左右表'),
        forceMeasure: this.$appdata.getParam('三项强制措施'),
        garbagefee: this.$appdata.getParam('垃圾费'),
        valvestate: this.$appdata.getParam('阀门状态'),
        usertypes: this.$appdata.getParam('用户类型'),
        handmonth: [{label: '单月', value: '单月'}, {label: '双月', value: '双月'}],
        yesnoOptions: [{label: '是', value: '是'}, {label: '否', value: '否'}],
        gasproperties: this.meter.f_user_type && this.meter.f_user_type.length === 1 ? this.$appdata.getParam(this.meter.f_user_type[0]) : [],
        pricetypes: this.$appdata.getParam('气价类型'),
        industrycomments: this.$appdata.getParam('工业备注'),
        openWay: [{label: '指令开户', value: '指令开户'}, {label: '发卡开户', value: '发卡开户'}],
        concentrators: [],
        meterbookoptions: [],  // 抄表册选项
        opteratormetrbook: false, // 抄表册操作
        oldrow: [],
        overdueset: [],
        isiot: true,
        meterNumberDisabled: false,
        meterChangeDisabled: this.$appdata.getSingleValue('建档后禁止更改表号') ? this.$appdata.getSingleValue('建档后禁止更改表号') : false,
        templng: '',  //  临时经度
        templat: '' //  临时纬度
      }
    },
    props: ['f_filialeid', 'meter', 'isdecimal', 'valid', 'f_userinfo_id', 'overdueset', 'curuser', 'formconfig', 'onlyshowmust'],
    async ready () {
      console.log('看看meter里面的数据', this.meter, this.row)
      this.row = Object.assign(this.row, this.meter, {f_use_limit: this.$appdata.getSingleValue('报废年限')})
      this.orginCardId = this.row.f_card_id
      if (this.row.f_meter_classify) {
        if (this.row.f_meter_classify === '物联网表') {
          this.isiot = true
        } else {
          this.isiot = false
        }
      }
      this.oldrow = this.row
      this.isdecimal = this.row.gasbrand.length > 0 ? this.row.gasbrand.f_isdecimal : '否'
      this.row.valid = false
      if (this.row.pricetype === '混合气价') {
        this.ratioshow = true
      }
      if (this.row) {
        if (this.row.f_force_measure !== undefined && Object.prototype.toString.call(this.row.f_force_measure) === '[object Array]') {
          if (this.row.f_force_measure[0]) {
            this.row.f_force_measure = this.row.f_force_measure[0].split(',')
          }
        }
      }
      if (this.row.f_meternumber) {
        this.meterNumberDisabled = true
      }
      await this.getConcentrators()
      co(meterBookGen(this))
    },
    methods: {
      validateInput (event, key) {
        const value = event.target.value
        const sanitizedValue = value.replace(/[^0-9.]/g, '')
        this.row[key] = sanitizedValue
      },
      getConfigValidate (name, defaultVal) {
        this.$resetValidation()
        if (this.formconfig && this.formconfig[name]) {
          let Validate = {}
          if (this.formconfig[name].required) {
            Object.assign(Validate, {required: true})
          }
          if (this.formconfig[name].minlength || this.formconfig[name].minlength === 0) {
            Object.assign(Validate, {minlength: this.formconfig[name].minlength})
          }
          if (this.formconfig[name].maxlength) {
            Object.assign(Validate, {maxlength: this.formconfig[name].maxlength})
          }
          return Validate
        } else if (name === 'f_user_phone') {
          return { minlength: 11, maxlength: 11 }
        } else if (defaultVal) {
          return {required: defaultVal}
        }
        return {}
      },
      getConfigShowItem (name,defaultVal = true) {
        if (this.formconfig && this.formconfig[name] && this.formconfig[name].hasOwnProperty('showItem')) {
          return this.formconfig[name].showItem
        } else {
          return defaultVal
        }
      },
      getConfigLabelName (name, defaultVal) {
        if (this.formconfig && this.formconfig[name] && this.formconfig[name].labelName) {
          return this.formconfig[name].labelName
        } else {
          return defaultVal
        }
      },
      getConfigPlaceholder (name, defaultVal) {
        if (this.formconfig && this.formconfig[name] && this.formconfig[name].placeholder) {
          return this.formconfig[name].placeholder
        } else {
          return defaultVal
        }
      },
      checkCardId () {
        this.$resetpost('rs/logic/checkCardId', {
          data: {
            f_userfiles_id: this.row.f_userfiles_id,
            gasbrandId: this.row.f_gasbrand_id,
            cardId: this.row.f_card_id,
            f_orgid: this.row.f_orgid
          }
        }, {resolveMsg: null, rejectMsg: '获取表号出错'}).then(res => {
          if (res.data.code !== '200') {
            this.row.f_card_id = this.orginCardId
            this.$showAlert(res.data.msg, 'warning', 1500)
          }
        })
      },
      gasDateChange () {
        if (!this.row.f_scrap_date && this.row.f_gas_date) {
          if (this.row.f_use_limit) {
            let date = new Date(this.row.f_gas_date)
            let year = date.getFullYear() + (this.row.f_use_limit / 1)
            this.$set('row.f_scrap_date', year + this.row.f_gas_date.slice(4))
          }
        }
      },
      // 获取集中器下拉框
      async getConcentrators () {
        let condition = {
          items: 'id,f_mpc_alias',
          tablename: 't_concentrator',
          condition: `f_mpc_state !='删除'`,
          orderitem: 'id'
        }
        let data = await this.$resetpost('rs/sql/saleSingleTable', {data: condition}, {resolveMsg: null, rejectMsg: '获取集中器失败!'})
        this.concentrators = []
        for (let row of data.data) {
          this.concentrators.push({label: row.f_mpc_alias, value: row.id})
        }
      },
      async confirmUserfiles () {
        if (this.$refs.addparamlist.confirm()) {
          var paramlist = this.$refs.addparamlist.addGasParameter
          await this.$resetpost('rs/logic/updateGasParam', {
            data: {
              id: this.selectUserFiles.f_user_id,
              paramlist: paramlist,
              gastype: 'userfiles'
            }
          }, {resolveMsg: '更新成功', rejectMsg: '更新失败'})
          this.showParame = false
        }
      },

      priceChange (val) {
        if (val.length > 0) {
          this.row.f_user_type = [val[0].f_user_type]
          this.row.f_gasproperties = [val[0].f_gasproperties]
          this.row.pricetype = val[0].f_price_type
          // 展示气价备注
          this.$set('row.f_price_comments', val[0].f_comments ? val[0].f_comments : '无')
          // 展示价格明细
          if (val[0].detailprice) {
            // this.row.f_detailprice = this.$CommonService.getShowPriceDetail(val[0].detailprice)
            this.$set('row.f_detailprice', this.$CommonService.getShowPriceDetail(val[0].detailprice))
          }
        }
      },
      cancel () {
        this.gasid = ''
        this.userfileid = ''
        this.showParame = false
      },
      tablebaseChange () {
        if (this.isdecimal === '是') {
          this.$set('row.f_meter_base', (this.row.f_meter_base - 0).toFixed(4))
        } else {
          this.$set('row.f_meter_base', (this.row.f_meter_base - 0).toFixed(0))
        }
      },
      brandChange (val) {
        this.isdecimal = val.length > 0 ? val[0].f_isdecimal : '否'
        console.log('sadasfasf', val)
        if (val.length > 0 && val[0].f_meter_type === '物联网表') {
          this.isiot = true
        } else {
          this.isiot = false
        }
        // this.tablebaseChange()
        if (this.row.f_user_id) {
          co(brandChangeGen(this))
        }
        this.meternumberValidate()
      },
      userTypeChange () {
        this.gasproperties = []
        if (this.row.f_user_type.length === 1) {
          this.gasproperties = this.$appdata.getParam(this.row.f_user_type[0])
        }
      },
      // getPricenames(pricetype) {
      //     console.log('气价。，。。', pricetype, this.row.f_user_type, this.row.f_gasproperties)
      //     let rs = []
      //     if (this.row.f_user_type.length === 1 && this.row.f_gasproperties.length === 1 && pricetype.length === 1) {
      //         let params = {
      //             f_user_type: this.row.f_user_type[0],
      //             f_gasproperties: this.row.f_gasproperties[0],
      //             f_price_type: pricetype[0],
      //             filter: this.f_filialeid
      //         }
      //         rs = this.$GetSaleParam.getPrice(params)
      //     }
      //     if (rs.length === 0) {
      //         this.row.f_price_name = ''
      //     }
      //     return rs
      // },
      mValid (bool) {
        this.row.valid = bool
        this.$dispatch('self-valid')
      },
      // 带权限修改单值返回修改后得值和修改原因
      modefiy (field) {
        this.show = true
        this.field = field
      },
      async meternumberValidate () {
        let http1 = new HttpResetClass()
        let res1 = await http1.load('POST', '/rs/sql/getBrandAndType', {data: {condition: ` mi.f_meternumber = '${this.row.f_meternumber}'`}}, {resolveMsg: null, rejectMsg: '获取默认气表品牌型号失败！！'})
        if (res1.data.length > 0) {
          // 替换表号自带的气表品牌和型号
          let meterbrands = this.meterbrands
          for (let row of meterbrands) {
            if (row.label == res1.data[0].f_meter_brand) {
              // 已经选择了气表品牌则不再替换
              if (this.row.gasbrand.length <= 0) this.row.gasbrand = [row.value]
              // 替换气表型号
              if (res1.data[0].f_meter_style) {
                for (let model of row.value.gasmodel) {
                  if (model.label == res1.data[0].f_meter_style) {
                    // 已经选择了气表型号则不再替换
                    if (this.row.gasmodel.length <= 0) this.row.gasmodel = [model.value]
                    continue
                  }
                }
              }
              continue
            }
          }
        }
        // 验证表号
        if (this.row.f_meternumber && this.row.gasbrand.length > 0) {
          // 表号位数验证
          let meternumberLen = this.row.gasbrand[0].f_meternumber_len
          if (meternumberLen) {
            if (this.row.f_meternumber.length != meternumberLen) {
              this.row.f_meternumber = ''
              this.$showAlert(`表号位数不正确, 当前气表品牌表号位数是: ${meternumberLen}`, 'warning', 3000)
              return
            }
          }
          // 表计信息验证
          if (this.row.gasbrand[0].f_meterverification == '是') {
            if (res1.data.length <= 0) {
              this.$showAlert(`当前表号: ${this.row.f_meternumber}在表计信息中无记录, 请核实!!!`, 'warning', 3000)
              this.row.f_meternumber = ''
              return
            }
          }
          let param = {
            f_meternumber: this.row.f_meternumber,
            f_gasbrand_id: this.row.gasbrand[0].id
          }
          if (this.row.f_userfiles_id) {
            param.f_userfiles_id = this.row.f_userfiles_id
          }
          let res = await this.$resetpost('rs/logic/meternumberValidate', param, {
            resolveMsg: null,
            rejectMsg: '表号验证失败！！'
          })
          if (this.row.gasbrand[0].f_meter_type === '物联网表') {
            if (res.data) {
              this.row.f_meternumber = ''
              this.$showAlert('表号已存在！！', 'warning', 3000)
            }
          } else {
            if (res.data) {
              this.$showAlert('请注意，相同的表号已存在', 'warning', 3000)
            }
          }
        }
      },
      openModal () {
        this.mapShow = true
      },
      closeModal () {
        this.mapShow = false
      },
      getmylocation (res) {
        this.templng = res.position.lng
        this.templat = res.position.lat
      },
      confirmLocation () {
        this.row.f_userfiles_lat = this.templat
        this.row.f_userfiles_lng = this.templng
        this.mapShow = false
      },
      flowmetermodels (label) {
        let gasbrand = this.$GetSaleParam.getGasbrand()
        let flowmetermodels = []
        for (let row of gasbrand) {
          if (row.label == label) {
            for (let gasmodel of row.value.gasmodel) {
              flowmetermodels.push({label: gasmodel.label, value: gasmodel.label})
            }
            break
          }
        }
        return flowmetermodels
      }
    },
    watch: {
      'meter' () {
        this.row = Object.assign(this.row, this.meter, {})
        this.isdecimal = this.row.gasbrand.f_isdecimal
        this.row.valid = false
        this.showtype = this.row.gasbrand.f_meter_type
      },
      'row.pricetype' (val) {
        if (val == '混合气价') {
          this.ratioshow = true
        } else {
          this.ratioshow = false
        }
      }
    },
    computed: {

      // 控制用户类型修改
      permissionUserType () {
        let res = false
        if (this.row.f_user_id) {
          res = !(this.jurisdiction.includes('民用气价修改') && this.jurisdiction.includes('非民用气价修改'))
        }
        return res
      },

      // 控制用气性质，气价类型，气价名称修改
      permissionPrice () {
        let res = false
        if (this.row.f_user_id) {
          console.log('获取权限、', this.row, this.jurisdiction)
          // 变更操作
          if (this.row.pricename.length > 0) {
            if (this.row.f_user_type[0] === '民用') {
              // 判断是否有民用气价权限
              res = !this.jurisdiction.includes('民用气价修改')
            } else if (this.row.f_user_type[0] === '非民用') {
              // 判断是否有非民用气价权限
              res = !this.jurisdiction.includes('非民用气价修改')
            }
          }
        }
        console.log('有无气价权限', res)
        return res
      },

      getPricenames () {
        let f_filialeid = this.f_filialeid
        let result = []
        this.$GetSaleParam.prices.forEach((item) => {
          if (item.f_state === '有效' && f_filialeid == item.f_filialeid) {
            let value = {
              label: item.f_price_name,
              value: item
            }
            result.push(value)
          }
        })
        return Array.from(new Set(result))
      },

      adjustables () {
        let arr = []
        let filter = this.f_filialeid
        this.$GetSaleParam.getAdjustable(filter).forEach((item) => {
          let temp = {}
          temp.label = `[${item.value.f_adjustable_id}]-${item.label}`
          temp.value = item.value
          arr.push(temp)
        })
        return [{label: '全部', value: ''}, ...arr]
      },
      inputtores () {
        // return this.$login.f.f_gasman
        let rs = new Array()
        for (let i = 0; i < this.$login.f.f_gasman.length; i++) {
          let temp = {
            label: this.$login.f.f_gasman[i].name,
            value: this.$login.f.f_gasman[i].name
          }
          rs.push(temp)
        }
        return rs
      },
      installperson () {
        // return this.$login.f.f_installman
        let rs = new Array()
        for (let i = 0; i < this.$login.f.f_installman.length; i++) {
          let temp = {
            label: this.$login.f.f_installman[i].name,
            value: this.$login.f.f_installman[i].name
          }
          rs.push(temp)
        }
        return rs
      },
      meterbrands () {
        return this.$GetSaleParam.getGasbrand()
      },
      aroundmeters () {
        return this.$appdata.getParam('左右表')
      },
      positions () {
        return this.$appdata.getParam('安装位置')
      },
      usetype () {
        return this.$appdata.getParam('使用类型')
      },
      usestate () {
        return this.$appdata.getParam('使用状态')
      },
      gongyetype () {
        return this.$appdata.getParam('工业备注')
      },
      flowmeterbrands () {
        let gasbrand = this.$GetSaleParam.getGasbrand()
        let flowmeterbrands = []
        for (let row of gasbrand) {
          flowmeterbrands.push({label: row.label, value: row.label})
        }
        return flowmeterbrands
      }
    }
  }
</script>
<style lang="less">
  #meterInfoTest{
    // 去掉number类型输入框的上下箭头
    input[type="number"] {
      &::-webkit-inner-spin-button,
      &::-webkit-outer-spin-button {
        -webkit-appearance: none;
        margin: 0;
      }

      & {
        -moz-appearance: textfield;
      }
    }
    #addboxmap {
      height: 300px;
    }
    .glyphicon-map-marker:hover {
      color: red;
    }
    .glyphicon-map-marker {
      color: blue;
      cursor: pointer;
    }
    .col-sm-4 {
      .font_normal_body {
        width: 73px;
        overflow: auto;
        white-space: nowrap;
        // 指滚动条两边的按钮
        &::-webkit-scrollbar-button {
          display: none;
        }
        // 滚动条的宽度
        &::-webkit-scrollbar {
          width: 5px !important;
          height: 5px !important;
        }
        // 滚动条的设置
        &::-webkit-scrollbar-thumb {
          background-color: #ddd;
          background-clip: padding-box;
        }
        &::-webkit-scrollbar-thumb:hover {
          background-color: #bbb;
        }
        &::-webkit-scrollbar-track {
          /*滚动条里面轨道*/
          box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
          background: #ededed;
        }
      }
    }
  }
</style>
