<template>
  <work-busy :is-busy="excessive"></work-busy>
  <div style="height: 100%">
    <div class="panel auto">
      <div class="panel-heading" @click="selectVal('基本信息')" style="background-color: #ffffff">
          <span class="spanboder">
            <img src="../../../assets/person.png" style="width: 22px;margin-right: 8px;">基本信息
            <img class="butt3" :src="imgback('基本信息')">
          </span>
      </div>
      <div class="panel-body " id="upuserinfo_sel" v-show="headername=='基本信息'">
        <div class="row auto" style="margin: 5px 0">
          <label class="righttxt">用户编号:</label>
          <input type="text" class="form-control rightipt" v-model="userinfo.baseinfo.base.f_userinfo_code" readonly/>
        </div>
        <div class="row auto" style="margin: 5px 0">
          <label class="righttxt">用户名称:</label><input type="text" class="form-control rightipt"
                                                          v-model="userinfo.baseinfo.base.f_user_name" readonly/>
        </div>
        <div class="row auto" style="margin: 5px 0">
          <label class="righttxt">用户状态:</label><input type="text" class="form-control rightipt" readonly
                                                          v-model="userinfo.baseinfo.base.f_user_state"/>
        </div>
        <div class="row auto" style="margin: 5px 0">
          <label class="righttxt">用户电话:</label><input type="text" class="form-control rightipt"
                                                          v-model="userinfo.baseinfo.base.f_user_phone"/>
        </div>
        <div class="row auto" style="margin: 5px 0">
          <label class="righttxt">备用电话:</label><input type="text" class="form-control rightipt"
                                                          v-model="f_phone1"/>
        </div>
        <div class="row auto" style="margin: 5px 0">
          <label class="righttxt">备用电话:</label><input type="text" class="form-control rightipt"
                                                          v-model="f_phone2"/>
        </div>
        <div class="row auto" style="margin: 5px 0">
          <label class="righttxt">租户姓名:</label><input type="text" class="form-control rightipt"
                                                          v-model="userinfo.baseinfo.base.f_rent_name"/>
        </div>
        <div class="row auto" style="margin: 5px 0">
          <label class="righttxt">租户电话:</label><input type="text" class="form-control rightipt"
                                                          v-model="userinfo.baseinfo.base.f_zuhu_phone"/>
        </div>
        <div class="row auto" style="margin: 5px 0">
          <label class="righttxt">建档日期:</label><input type="text" class="form-control rightipt"
                                                          v-model="userinfo.baseinfo.base.f_createfile_date" readonly/>
        </div>
        <!--        <div class="row auto" style="margin: 5px 0">
                  <label class="righttxt">开户日期:</label><input type="text" class="form-control rightipt" v-model="userinfo.baseinfo.base.f_open_date" readonly  />
                </div>-->
        <div class="row auto" style="margin: 5px 0">
          <label class="righttxt">地址类型:</label>
          <div class="rightipt" style="display: flex;justify-content: space-around;margin-top: 5px">
            <div><input type="radio" v-model="addressType" name="addressType" @change="changeAddressType"
                        id="phone_addressType1" value="普通地址"/><label style="font-weight: normal;padding-left: 2px"
                                                                         for="phone_addressType1">普通地址</label></div>
            <div><input type="radio" v-model="addressType" name="addressType" @change="changeAddressType"
                        id="phone_addressType2" value="特殊地址"/><label style="font-weight: normal;padding-left: 2px"
                                                                         for="phone_addressType2">特殊地址</label></div>
          </div>
          <!--<input type="text" style="width: 75%;float:right" class="form-control"  v-model="row.f_devices_type"  />-->
          <!--<input type="text" class="form-control rightipt" readonly v-model="userinfo.addressinfo.f_pcd"  />-->
          <!--<v-select :value.sync="userinfo.addressinfo.f_iscity" class="input-font" style="margin-left: 5%;"
                    :width="'60%'"
                    v-model="userinfo.addressinfo.f_iscity"
                    :options='cityTypes' placeholder='地区类型'  close-on-select clear-button value-single @change="area_change()"></v-select>-->
        </div>
        <div class="row auto" style="margin: 5px 0">
          <label class="righttxt">地区类型:</label>
          <!--<input type="text" style="width: 75%;float:right" class="form-control"  v-model="row.f_devices_type"  />-->
          <input type="text" class="form-control rightipt" readonly v-model="userinfo.addressinfo.f_iscity"/>
          <!--<v-select :value.sync="userinfo.addressinfo.f_iscity" class="input-font" style="margin-left: 5%;"
                    :width="'60%'"
                    :disabled="true"
                    v-model="userinfo.addressinfo.f_iscity"
                    :options='cityTypes' placeholder='地区类型'  close-on-select clear-button value-single ></v-select>-->
        </div>
        <div class="row auto" style="margin: 5px 0">
          <label class="righttxt">省&ensp;市&ensp;区:</label>
          <!--<input type="text" style="width: 75%;float:right" class="form-control"  v-model="row.f_devices_type"  />-->
          <!--<input type="text" class="form-control rightipt" readonly v-model="userinfo.addressinfo.f_pcd"  />-->
          <v-select :value.sync="selectPcd" class="input-font" style="margin-left: 5%;"
                    :width="'60%'"
                    v-model="selectPcd"
                    :options='pcds' placeholder='请选择省市区' close-on-select clear-button value-single
                    @change="pcd_change()"></v-select>
        </div>
        <div class="row auto" style="margin: 5px 0">
          <label class="righttxt">街道名称:</label>
          <!--<input type="text" readonly class="form-control rightipt" v-model="userinfo.addressinfo.f_street"  />-->
          <v-select :value.sync="selectStreet" class="input-font" style="margin-left: 5%;"
                    :width="'60%'"
                    v-model="selectStreet"
                    :options='streets' placeholder='请选择街道' close-on-select clear-button value-single
          ></v-select>
        </div>
        <div class="row auto" style="margin: 5px 0">
          <label class="righttxt">小区:</label>
          <!--<input type="text" readonly class="form-control rightipt" v-model="userinfo.addressinfo.f_residential_area"  />-->
          <v-select :value.sync="selectArea" class="input-font" style="margin-left: 5%;"
                    :width="'60%'"
                    v-model="selectArea"
                    :timeout="500"
                    :options='area' placeholder='请选择小区' close-on-select clear-button value-single
                    @change="area_change()"></v-select>
        </div>
        <!--<div class="row auto" style="margin: 5px 0"  v-show="addressType=='特殊地址'">
          <label class="righttxt">集收单位:</label>
          &lt;!&ndash;<input type="text" readonly class="form-control rightipt" v-model="userinfo.addressinfo.f_residential_area"  />&ndash;&gt;
          <v-select :value.sync="selectArea" class="input-font" style="margin-left: 5%;"
                    :width="'60%'"
                    v-model="selectArea"
                    @select-search="select_search"
                    :options='area' placeholder='请选择集收单位'  close-on-select clear-button value-single @change="area_changeTC()"></v-select>
        </div>-->
        <div class="row auto" style="margin: 5px 0" v-show="addressType=='普通地址'">
          <label class="righttxt">楼&ensp;&ensp;&ensp;&ensp;号:</label><input type="text" @change="changeNewAddress"
                                                                              class="form-control rightipt"
                                                                              v-model="userinfo.addressinfo.f_building"/>
        </div>
        <div class="row auto" style="margin: 5px 0" v-show="addressType=='普通地址'">
          <label class="righttxt">单&ensp;&ensp;&ensp;&ensp;元:</label><input type="text" @change="changeNewAddress"
                                                                              class="form-control rightipt"
                                                                              v-model="userinfo.addressinfo.f_unit"/>
        </div>
        <div class="row auto" style="margin: 5px 0" v-show="addressType=='普通地址'">
          <label class="righttxt">楼&ensp;&ensp;&ensp;&ensp;层:</label><input type="text" @change="changeNewAddress"
                                                                              class="form-control rightipt"
                                                                              v-model="userinfo.addressinfo.f_floor"/>
        </div>
        <div class="row auto" style="margin: 5px 0" v-show="addressType=='普通地址'">
          <label class="righttxt">门&ensp;牌&ensp;号:</label><input type="text" @change="changeNewAddress"
                                                                    class="form-control rightipt"
                                                                    v-model="userinfo.addressinfo.f_room"/>
        </div>
        <div class="row auto" style="margin: 5px 0">
          <label class="righttxt">详细地址:</label><input type="text" class="form-control rightipt" readonly
                                                          v-model="userinfo_old.addressinfo.f_address"/>
        </div>
        <div class="row auto" style="margin: 5px 0">
          <label class="righttxt">新&ensp;地&ensp;址:</label>
          <!--<input type="text" class="form-control rightipt" readonly v-model="getaddress()"  />-->
          <textarea :readonly="addressType=='普通地址'" class="form-control rightipt" : style="height: 80px"
                    v-model="userinfo.addressinfo.f_address"></textarea>
        </div>

        <!--<div class="row auto" style="margin: 5px 0" v-show="addressType=='特殊地址'">
          <label class="righttxt">新&ensp;地&ensp;址:</label>&lt;!&ndash;<input type="text" class="form-control rightipt" v-model="userinfo.addressinfo.f_address"  />&ndash;&gt;
          <textarea class="form-control rightipt" style="height: 80px" v-model="getAddressTS"></textarea>
        </div>-->

        <div class="row auto" style="margin: 5px 0">
          <label class="righttxt">备&ensp;&ensp;&ensp;&ensp;注:</label><textarea class="form-control rightipt"
                                                                                 style="height: 150px"
                                                                                 v-model="userinfo.baseinfo.base.f_remark"></textarea>
          <!--<input type="text" class="form-control rightipt" v-model="userinfo.baseinfo.base.f_remark"  />-->
        </div>
      </div>
    </div>
    <div class="panel auto">
      <div class="panel-heading" @click="selectVal('表具信息')" style="background-color: #ffffff">
          <span class="spanboder">
            <img src="../../../assets/person.png" style="width: 22px;margin-right: 8px;">表具信息
            <img class="butt3" :src="imgback('表具信息')">
          </span>
      </div>
      <div class="panel-body " v-show="headername=='表具信息'">
        <div class="row auto" style="margin: 5px 0">
          <label class="righttxt">表&ensp;&ensp;&ensp;&ensp;号:</label>
          <input type="text" readonly class="form-control rightipt"
                 style="width: 45%" v-model="userinfo.meterinfo[0].f_meternumber"  readonly />
          <!--          <button type="button"-->
          <!--                  :disabled="!(userinfo.meterinfo[0].f_meter_classify=='机表' || userinfo.meterinfo[0].f_meter_classify=='金额卡表' || userinfo.meterinfo[0].f_meter_classify=='气量卡表')"-->
          <!--                  name="button" class="btn btn-primary" style="width: 15%" @click="scan">扫码-->
          <!--          </button>-->
        </div>

        <!--<div class="row auto" style="margin: 5px 0" v-if="userinfo.meterinfo[0].f_meter_classify=='机表'">
          <div class="auto">
            <div class="panel" style="padding: 0px 15px 5px 10px;">
              <div class="panel-body panel-self" style="background-color: #F8F8F8;width: 100%;height: 260px;position: relative">
                <div class="row" style="height: 240px;">
                  <div class="col-sm-4">
                    <img-self :src="f_meterno_path" alt="表号照片" width="150" height="200"></img-self>
                  </div>
                </div>
                <div class="row text-right div-photo" :class="style__">
                  <button type="button" name="button" class="btn btn-primary btn-photo" @click="takePic('f_meterno_path', '表号照片')">拍照</button>
                  <img src="../../../assets/remove.png" :class="style__" @click="delfile('f_meterno_path', this.f_meterno_path)" style="width: 25%;"></img>
                </div>
              </div>
            </div>
          </div>
        </div>-->
        <div class="row auto" style="margin: 5px 0">
          <labe class="righttxt">生产日期:</labe>
          <datepicker
                      v-show="!userinfo.meterinfo[0].f_manufacture_date"
                      class="rightipt"
                      :value.sync="userinfo.meterinfo[0].f_manufacture_date"
                      v-model="userinfo.meterinfo[0].f_manufacture_date"
                      :disabled-days-of-Week="[]"
                      :format="'yyyy-MM-dd'"
                      :show-reset-button="reset">
          </datepicker>
          <input v-show="userinfo.meterinfo[0].f_manufacture_date" type="text" class="form-control rightipt" @click ="showmassage" v-model="userinfo.meterinfo[0].f_manufacture_date"  readonly/>
        </div>
        <div class="row auto" style="margin: 5px 0">
          <label class="righttxt">气表品牌:</label>
          <v-select class="rightipt" :value.sync="userinfo.meterinfo[0].f_gasbrand_id "
                    v-model="userinfo.meterinfo[0].f_gasbrand_id "
                    placeholder='请选择'
                    :width='wid'
                    @change="brand_change"
                    readonly
                    disabled
                    :options="brandlist"
                    close-on-select value-single></v-select>
        </div>
        <div class="row auto" style="margin: 5px 0">
          <label class="righttxt">气表型号:</label>
          <v-select class="rightipt" :value.sync="userinfo.meterinfo[0].f_gasmodel_id"
                    v-model="userinfo.meterinfo[0].f_gasmodel_id"
                    placeholder='请选择'
                    :width='wid'
                    :options="modellist"
                    close-on-select value-single></v-select>
        </div>
        <div class="row auto" style="margin: 5px 0">
          <label class="righttxt">通&ensp;气&ensp;人:</label>
          <input type="text" class="form-control rightipt" v-model="userinfo.meterinfo[0].f_gas_person"/>
        </div>
        <div class="row auto" style="margin: 5px 0">
          <label class="righttxt">通气时间:</label>
          <datepicker class="rightipt"
                      :value.sync="userinfo.meterinfo[0].f_gas_date"
                      v-model="userinfo.meterinfo[0].f_gas_date"
                      :disabled-days-of-Week="[]"
                      :format="'yyyy-MM-dd'"
                      :show-reset-button="reset">
          </datepicker>
        </div>
        <div class="row auto" style="margin: 5px 0" v-show="showBox">
          <label class="righttxt">调&ensp;压&ensp;箱:</label>
          <v-select class="rightipt"
                    :value.sync="userinfo.meterinfo[0].f_adjustable_id"
                    v-model="userinfo.meterinfo[0].f_adjustable_id"
                    placeholder='请选择'
                    :width='wid'
                    :options="boxOptions"
                    close-on-select value-single></v-select>
        </div>
        <div class="row auto" style="margin: 5px 0">
          <label class="righttxt">是否直通:</label>
          <v-select
            :value.sync="userinfo.meterinfo[0].f_if_direct"
            class="input-font"
            style="margin-left: 5%;"
            :width="'60%'"
            v-model="userinfo.meterinfo[0].f_if_direct"
            :options='directOptions'
            placeholder='是否直通'
            close-on-select
            clear-button
            value-single>
          </v-select>
        </div>
        <div class="row auto" style="margin: 5px 0">
          <label class="righttxt">表&ensp;封&ensp;号:</label>
          <input type="text" class="form-control rightipt" v-model="userinfo.meterinfo[0].f_metertitles"/>
        </div>
        <div class="row auto" style="margin: 5px 0">
          <label class="righttxt">表&ensp;位&ensp;置:</label>
          <!--<input type="text" class="form-control rightipt" v-model="userinfo.meterinfo[0].f_position"  readonly/>-->
          <v-select class="rightipt" :value.sync="userinfo.meterinfo[0].f_position"
                    v-model="userinfo.meterinfo[0].f_position"
                    placeholder='请选择'
                    :width='wid'
                    :options="wz_types"
                    close-on-select value-single></v-select>
        </div>
        <div class="row auto" style="margin: 5px 0">
          <label class="righttxt">表&ensp;&ensp;&ensp;&ensp;向:</label>
          <v-select class="rightipt" :value.sync="userinfo.meterinfo[0].f_aroundmeter"
                    v-model="userinfo.meterinfo[0].f_aroundmeter"
                    placeholder='请选择'
                    :width='wid'
                    :options="aroundmeters"
                    close-on-select value-single></v-select>
        </div>
        <div class="row auto" style="margin: 5px 0">
          <label class="righttxt">气表类型:</label>
          <input type="text" class="form-control rightipt" v-model="userinfo.meterinfo[0].f_meter_classify" readonly/>
        </div>
        <div class="row auto" style="margin: 5px 0">
          <label class="righttxt">表前阀状态:</label>
          <v-select class="rightipt" :value.sync="userinfo.meterinfo[0].f_bqf_state"
                    v-model="userinfo.meterinfo[0].f_bqf_state"
                    placeholder='请选择'
                    :width='wid'
                    :options="bqf_states"
                    close-on-select value-single></v-select>
        </div>
      </div>
    </div>
    <div class="panel auto">
      <div class="panel-heading" @click="selectVal('设备信息')" style="background-color: #ffffff">

          <span class="spanboder"><img src="../../../assets/list.png" style="width: 22px;margin-right: 8px;">设备信息<img
            class="butt3" :src="imgback('设备信息')"></span>
      </div>
      <div class="panel-body" v-show="headername=='设备信息'">
        <div class="row" v-for="row in model"
             style="border:2px solid #A2C2EB; border-top:10px solid #A2C2EB; box-shadow: #00b3ee;margin-bottom: 10px">
          <div class="row auto" style="margin: 5px 0">
            <label class="righttxt">设备类型:</label>
            <!--<input type="text" class="form-control rightipt" readonly v-model="row.f_devices_type"  />-->
            <v-select class="rightipt" :value.sync="row.f_devices_type"
                      v-model="row.f_devices_type"
                      placeholder='请选择'
                      :width='wid'
                      readonly
                      :options="devices_types"
                      close-on-select value-single></v-select>
          </div>
          <div class="row auto" style="margin: 5px 0">
            <labe class="righttxt">设备品牌:</labe><input type="text" class="form-control rightipt"  v-model="row.f_brand"  />
          </div>
          <div class="row auto" style="margin: 5px 0">
            <label class="righttxt">设备型号:</label><input type="text" class="form-control rightipt"
                                                            v-model="row.f_devices_model"/>
          </div>
          <div class="row auto" style="margin: 5px 0">
            <label class="righttxt">生产日期:</label>
            <datepicker class="rightipt"
                        :value.sync="row.f_make_date"
                        v-model="row.f_make_date"
                        :disabled-days-of-Week="[]"
                        :format="'yyyy-MM-dd'"
                        :show-reset-button="reset" :readonly="row.f_make_date">
            </datepicker>
          </div>
          <div class="row auto" style="margin: 5px 0">
            <label class="righttxt">使用年限:</label><input type="number" class="form-control rightipt"
                                                            v-model="row.f_service_life"/>
          </div>
          <!--          <div class="row auto" style="margin: 5px 0">
                      <label class="righttxt">到期日期:</label>
                      &lt;!&ndash;<input type="text" class="form-control rightipt"   v-model="row.f_expire_date"  />&ndash;&gt;
                      <datepicker class="rightipt"
                                  :value.sync="row.f_expire_date"
                                  v-model="row.f_expire_date"
                                  :disabled-days-of-Week="[]"
                                  :format="'yyyy-MM-dd'"
                                  :show-reset-button="reset" readonly="readonly">
                      </datepicker>
                    </div>-->
          <div class="row auto" style="margin: 5px 0">
            <label class="righttxt">安&ensp;装&ensp;人:</label><input type="text" class="form-control rightipt"
                                                                      v-model="row.f_input_person"/>
          </div>
          <div class="row auto" style="margin: 5px 0">
            <label class="righttxt">安装日期:</label>
            <!--<input type="text" class="form-control rightipt"   v-model="row.f_input_date"  />-->
            <datepicker class="rightipt"
                        :value.sync="row.f_input_date"
                        v-model="row.f_input_date"
                        :disabled-days-of-Week="[]"
                        :format="'yyyy-MM-dd'"
                        :show-reset-button="reset" readonly="readonly">
            </datepicker>
          </div>
          <div class="row auto" style="margin:  5px 0">
            <label class="righttxt">设备数量:</label><input type="number" class="form-control rightipt"
                                                            v-model="row.f_devices_num"/>
          </div>
          <!--<div class="row auto" style="margin: 5px 0">
            <label class="righttxt">管道类型:</label><input type="text" class="form-control rightipt" readonly  v-model="row.f_pipe_type"  />
          </div>-->
          <!--<div class="row auto" style="margin: 5px 0">
            <label class="righttxt">设备状态:</label><input type="text" class="form-control rightipt" readonly  v-model="row.f_userinfodevices_state"  />
          </div>-->
          <!--<div class="row auto" style="margin: 5px 0">
            <label class="righttxt">购买方式:</label><input type="text" class="form-control rightipt" readonly  v-model="row.watchpurchase"  />
          </div>-->
          <div style="display: flex;justify-content: center;margin-bottom: 3px"
               v-if="$index>this.userinfo_old.devicesinfo.length-1 || this.userinfo_old.devicesinfo.length==0">
            <button class="btn btn-warning" @click="delDevices($index)">删除设备</button>
          </div>
        </div>
        <div style="display: flex;justify-content: space-around;">
          <button class="col-sm-3 btn btn-primary" @click="addDevices($index)">新增设备</button>
        </div>
      </div>
    </div>
    <div class="panel auto">
      <div class="panel-body">
        <div style="display: flex;justify-content: center;">
          <button class="col-sm-3 btn btn-primary" :disabled="enable" @click="isNeedAudit ? editUserInfo() : editUserInfoNoAudit()">{{isNeedAudit ? '上传审核' : '上传'}}</button>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import {HttpResetClass} from 'vue-client'
import * as Util from "../../Util";
import Vue from 'vue'

export default {
  title: '设备查看',
  data() {
    return {
      model: [],
      show: false,
      row: Object,
      userinfo: Object,
      userinfo_old: Object,
      wid: "60%",
      f_phone1:'',
      f_phone2:'',
      aroundmeters: [],
      devices_types: [],
      pipe_types: [{label: '橡胶管', value: '橡胶管'}, {label: '波纹管', value: '波纹管'}, {label: '钢管', value: '钢管'}],
      wz_types: [],
      cityTypes: [{label: '市区', value: '市区'}, {label: '城镇', value: '城镇'}],
      bqf_states: [{label: '开阀', value: '开阀'}, {label: '关阀', value: '关阀'}],
      pcds: [],
      streets: [],
      update: false,
      headername: '基本信息',
      excessive: false,
      area: [],
      enable: false,
      f_meterno_path: Vue.nopic,
      selectArea: {id: ''},
      selectPcd: {id: ''},
      selectStreet: {id: ''},
      changemeterno: false,//是否修改了机表表号
      approveChange: false,//是否需要进行信息变更审核
      newAddress: '',
      addressType: '',
      //需要审核的字段
      checkField: {
        checkUserinfoField: [
          'f_user_name'
        ],
        checkUserFilesField: [
          'f_meternumber',
          'f_gasbrand_id',
          'f_gasmodel_id'
        ],
        checkAddressField: [
          'f_pcd_id',
          'f_street_id',
          'f_residential_area_id',
          'f_building',
          'f_unit',
          'f_floor',
          'f_room',
          'f_slice_area',
          'f_special',
          'f_address'
        ],
      },
      boxOptions: [],
      brandlist: [],
      modellist: [],
      showBox: false,
      directOptions: [{label: '是', value: '是'}, {label: '否', value: '否'}],
      deviceBrandOption: {},
      isNeedAudit: this.$appdata.getSingleValue('信息变更是否需要审核') == 'true' ? true : false
    }
  },
  props: {
    user: {
      type: Object
    },
    f_userinfo_id: '',
    f_source: ''
  },
  methods: {
    showmassage(){
      this.$showMessage('表具出厂日期已由表厂提供，如需修改请联系管理员！')
    },
    async getmeterinfo(){
      let res = await  new HttpResetClass().load("POST", `${this.$androidUtil.getProxyUrl()}/rs/sql/safe_singleTable_OrderBy`, {data:{
          items:"*",
          tablename:"t_meterinfo",
          orderitem:"id",
          condition:`f_meternumber = '${this.userinfo.meterinfo[0].f_meternumber}'`
        }}, {resolveMsg: null, rejectMsg: null})
      if (res.data.length>0){
        this.userinfo.meterinfo[0].f_manufacture_date = res.data[0].f_manufacture_date
        this.$set('this.userinfo.meterinfo[0].f_manufacture_date',  res.data[0].f_manufacture_date)
      }
    },
    async getBrand() {
      let res = await new HttpResetClass().load("POST", `${this.$androidUtil.getProxyUrl()}/rs/sql/safe_singleTable_OrderBy`, {
        data: {
          items: "*",
          tablename: "t_gasbrand",
          orderitem: "id",
          condition: `1=1`
        }
      }, {resolveMsg: null, rejectMsg: null})
      ////tag)
      res.data.forEach((result) => {
        this.brandlist.push({label: result.f_meter_brand , value: result.id})
      })
    },
    scan() {
      HostApp.__this__ = this,
        HostApp.scanCode({callback: "javascript:HostApp.__this__.getCode();"})
    },
    getCode() {
      var datapa = HostApp.getCode().data;
      //tag
      this.userinfo.meterinfo[0].f_meternumber = datapa
    },
    //数据检查
    checkVal() {
      //检查一些必要信息是否未填
      this.approveChange = false
      this.changemeterno = false
      let checked = {ischeck: true, msg: ''}
      //tag
      //tag
      //tag
      if (!this.userinfo.baseinfo.base.f_user_name) {
        checked = {ischeck: false, msg: '请输入用户名称！'}
      }
      if (!this.selectPcd.id) {
        checked = {ischeck: false, msg: '请选择省市区！'}
      }
      if (!this.selectStreet.id) {
        checked = {ischeck: false, msg: '请选择街道！'}
      }
      if (!this.userinfo.addressinfo.f_address) {
        checked = {ischeck: false, msg: '新地址不能为空！'}
      }
      if (this.addressType == '普通地址') {
        if (!this.selectArea.id) {
          checked = {ischeck: false, msg: '请选择小区单位！'}
        }
        if (!this.userinfo.addressinfo.f_room) {
          checked = {ischeck: false, msg: '新输入门牌号！'}
        }
      }
      if (this.userinfo.meterinfo[0].f_meter_classify == '机表' && this.userinfo_old.meterinfo[0].f_meternumber) {

        //tag
        //tag
        if (this.userinfo.meterinfo[0].f_meternumber) {
          if (this.userinfo.meterinfo[0].f_meternumber != this.userinfo_old.meterinfo[0].f_meternumber) {
            if (!this.f_meterno_path || this.f_meterno_path == Vue.nopic) {
              checked = {ischeck: false, msg: '请拍摄表号照片！'}
            } else {
              //用来标识当前有修改机表表号，后台需要进行照片上传
              this.changemeterno = true
            }
          }
        } else {
          checked = {ischeck: false, msg: '请输入表号！'}
        }
      }
      //检查本次修改信息中是否包含需要审核的内容
      for (let check in this.checkField) {
        //tag
        if (typeof check != 'function') {
          for (let i = 0; i < this.checkField[check].length; i++) {
            //tag
            if (check == 'checkUserinfoField') {
              //tag
              //tag
              if (this.userinfo.baseinfo.base[this.checkField[check][i]] != this.userinfo_old.baseinfo.base[this.checkField[check][i]]) {
                //tag
                this.approveChange = true
              }
            } else if (check == 'checkUserFilesField') {
              //tag
              //tag
              if (this.userinfo.meterinfo[0][this.checkField[check][i]] != this.userinfo_old.meterinfo[0][this.checkField[check][i]]) {
                //tag
                this.approveChange = true
              }
            } else if (check == 'checkAddressField') {
              //tag
              //tag
              if (this.userinfo.addressinfo[this.checkField[check][i]] != this.userinfo_old.addressinfo[this.checkField[check][i]]) {
                //tag
                this.approveChange = true
              }
            }
          }
        }
      }
      //tag
      return checked
    },
    select_search(text) {
      //tag
      if (this.selectStreet.id) {
        let pcdText = text ? `and f_street_id=${this.selectStreet.id} and f_residential_area like '%${text}%'` : `and f_street_id=${this.selectStreet.id}`
        new HttpResetClass().load("POST", `${this.$androidUtil.getProxyUrl()}/rs/sql/safe_singleTable_OrderBy`, {
          data: {
            items: "*",
            tablename: "t_area",
            orderitem: "id",
            condition: `f_orgid = '${Vue.user.orgid}' ${pcdText} `
          }
        }, {resolveMsg: null, rejectMsg: null}).then((res) => {
          //tag)
          if (res.data.length > 0) {
            this.area = []
            res.data.forEach((result) => {
              this.area.push({label: result.f_residential_area, value: result})
            })
          }
        })
      } else {
        this.area = []
      }
    },
    cameraCallBack(prop, fileName) {
      HostApp.__this__.$set(prop, fileName + '?' + Math.random())
      //tag
      HostApp.__callback__ = null
      HostApp.__this__ = null
    },
    takePic(prop, title) {
      HostApp.__callback__ = this.cameraCallBack
      HostApp.__this__ = this
      //tag
      let fileName
      if (!this[prop] || this[prop].includes("nopic.png")) {
        fileName = Util.guid() + '-' + prop + '.jpg'
      } else {
        fileName = Util.getFileName(this[prop])
      }
      HostApp._open_a_page({
        type: 'boomerang',
        page: 'com.aofeng.hybrid.android.peripheral.CameraActivity',
        param: {
          file: fileName,
          requestCode: 111,
          callback: 'javascript:HostApp.__callback__("' + prop + '", "%s");',
          watermark: title + '\t时间：' + Util.toStandardTimeString() + '\t' + Vue.user.name
        }
      })
    },
    delfile(prop, fileName) {
      if (fileName == Vue.nopic)
        return
      else {
        HostApp.delfile(fileName)
        this[prop] = Vue.nopic
      }
    },
    editUserInfoNoAudit() {
      let checked = this.checkVal()
      if (!checked.ischeck) {
        this.$showMessage(checked.msg)
        return
      }
      for (let i = 0; i < this.model.length; i++) {
        this.model[i].f_user_id = this.userinfo.meterinfo[0].f_user_id
      }
      this.$showMessage('确定是否修改上传用户信息？', ['confirm', 'cancel']).then((res) => {
        if (res === 'confirm') {
          this.excessive = true
          let userinfoms = Object.assign({}, this.userinfo_old.baseinfo.base)
          // userinfoms.f_user_name=row.f_user_name
          userinfoms.f_user_phone = this.userinfo.baseinfo.base.f_user_phone
          userinfoms.f_rent_name = this.userinfo.baseinfo.base.f_rent_name
          userinfoms.f_zuhu_phone = this.userinfo.baseinfo.base.f_zuhu_phone
          userinfoms.f_operator_record = Vue.user.name
          userinfoms.f_operatorid_record = Vue.user.id
          userinfoms.f_remark = this.userinfo.baseinfo.base.f_remark
          userinfoms.f_orgid_record = Vue.user.orgid
          userinfoms.f_orgname_record = Vue.user.orgs
          userinfoms.f_depid_record = Vue.user.depids
          userinfoms.f_depname_record = Vue.user.deps
          this.userinfo_old.meterinfo[0].f_gas_person = this.userinfo.meterinfo[0].f_gas_person
          this.userinfo_old.meterinfo[0].f_gas_date = this.userinfo.meterinfo[0].f_gas_date
          this.userinfo_old.meterinfo[0].f_adjustable_id = this.userinfo.meterinfo[0].f_adjustable_id
          this.userinfo_old.meterinfo[0].f_metertitles = this.userinfo.meterinfo[0].f_metertitles
          this.userinfo_old.meterinfo[0].f_position = this.userinfo.meterinfo[0].f_position
          this.userinfo_old.meterinfo[0].f_manufacture_date = this.userinfo.meterinfo[0].f_manufacture_date
          this.userinfo_old.meterinfo[0].f_aroundmeter = this.userinfo.meterinfo[0].f_aroundmeter
          this.userinfo_old.meterinfo[0].f_bqf_state = this.userinfo.meterinfo[0].f_bqf_state
          this.userinfo_old.meterinfo[0].f_if_direct = this.userinfo.meterinfo[0].f_if_direct
          this.userinfo_old.meterinfo[0].f_gasmodel_id=this.userinfo.meterinfo[0].f_gasmodel_id
          userinfoms.userfiles = []
          this.userinfo_old.meterinfo[0].devicesinfo = this.model
          userinfoms.userfiles.push(this.userinfo_old.meterinfo[0])
          new HttpResetClass().load('POST', `${this.$androidUtil.getProxyUrl()}/rs/logic/filemanage_fileSave`, {
            data: {
              userinfo: userinfoms,
              modifyReason: this.f_source ? `${this.f_source}维护档案信息` : '',
              address: {
                id: this.userinfo_old.addressinfo.id,
                oldid: this.userinfo_old.addressinfo.id,
                f_address: this.userinfo.addressinfo.f_address ? this.userinfo.addressinfo.f_address : this.userinfo_old.addressinfo.f_address
              }
            }
          }, {resolveMsg: null, rejectMsg: null}).then((res1) => {
            if (res1.data.status == 200) {
              let data = this.userinfo.addressinfo
              data.modifyReason=this.f_source ? `${this.f_source}维护档案信息` : ''
              data.f_address = this.userinfo.addressinfo.f_address? this.userinfo.addressinfo.f_address : this.userinfo_old.addressinfo.f_address
              data.f_operator = Vue.user.name
              new HttpResetClass().load('POST', `${this.$androidUtil.getProxyUrl()}/rs/logic/address_updateuseraddress`, {data: data}).then((res2) => {
                this.$showMessage("修改用户地址信息成功！")
              }).catch(error => {
                this.$showMessage("修改用户地址信息！")
              })
              this.$showMessage("修改用户信息成功！")
              this.enable = true
              this.excessive = false
            }
          }).catch((msg) => {
            this.$showMessage("修改用户信息失败,请检查手机网络状况！")
            this.excessive = false
          })
        }
      })
    },
    editUserInfo() {
      let checked = this.checkVal()
      if (!checked.ischeck) {
        this.$showMessage(checked.msg)
        return
      }
      let phones = []
      if (this.f_phone1){
        phones.push({
          id:this.userinfo.baseinfo.userphonelist[0]?this.userinfo.baseinfo.userphonelist[0].id:'',
          f_userinfo_id:this.userinfo.baseinfo.base.f_userinfo_id,
          f_rent_phone:this.f_phone1,
          f_state:'正常'
        })
      }
      if (this.f_phone2){
        phones.push({
          id:this.userinfo.baseinfo.userphonelist[1]?this.userinfo.baseinfo.userphonelist[1].id:'',
          f_userinfo_id:this.userinfo.baseinfo.base.f_userinfo_id,
          f_rent_phone:this.f_phone2,
          f_state:'正常'
        })
      }
      this.$showMessage('确定是否修改上传审核用户信息？', ['confirm', 'cancel']).then((res) => {
        if (res === 'confirm') {
          this.excessive = true
          let userinfoms = Object.assign({}, this.userinfo_old.baseinfo.base)
          //userinfoms.f_user_name=row.f_user_name
          userinfoms.f_user_phone = this.userinfo.baseinfo.base.f_user_phone
          userinfoms.f_rent_name = this.userinfo.baseinfo.base.f_rent_name
          userinfoms.f_zuhu_phone = this.userinfo.baseinfo.base.f_zuhu_phone
          userinfoms.f_operator_record = Vue.user.name
          userinfoms.f_operatorid_record = Vue.user.id
          userinfoms.f_remark = this.userinfo.baseinfo.base.f_remark
          userinfoms.f_orgid_record = Vue.user.orgid
          userinfoms.f_orgname_record = Vue.user.orgs
          userinfoms.f_depid_record = Vue.user.depids
          userinfoms.f_depname_record = Vue.user.deps
          userinfoms.userphonelist = phones
          this.userinfo_old.meterinfo[0].f_gas_person = this.userinfo.meterinfo[0].f_gas_person
          this.userinfo_old.meterinfo[0].f_gas_date = this.userinfo.meterinfo[0].f_gas_date
          this.userinfo_old.meterinfo[0].f_adjustable_id = this.userinfo.meterinfo[0].f_adjustable_id
          this.userinfo_old.meterinfo[0].f_metertitles = this.userinfo.meterinfo[0].f_metertitles
          this.userinfo_old.meterinfo[0].f_position = this.userinfo.meterinfo[0].f_position
          this.userinfo_old.meterinfo[0].f_manufacture_date = this.userinfo.meterinfo[0].f_manufacture_date
          this.userinfo_old.meterinfo[0].f_aroundmeter = this.userinfo.meterinfo[0].f_aroundmeter
          this.userinfo_old.meterinfo[0].f_bqf_state = this.userinfo.meterinfo[0].f_bqf_state
          this.userinfo_old.meterinfo[0].f_if_direct = this.userinfo.meterinfo[0].f_if_direct
          this.userinfo_old.meterinfo[0].f_meter_classify=this.userinfo.meterinfo[0].f_meter_classify
          this.userinfo_old.meterinfo[0].f_gasmodel_id=this.userinfo.meterinfo[0].f_gasmodel_id
          userinfoms.userfiles = []
          this.userinfo_old.meterinfo[0].devicesinfo = this.model
          userinfoms.userfiles.push(this.userinfo_old.meterinfo[0])
          //tag)
          new HttpResetClass().load('POST', `${this.$androidUtil.getProxyUrl()}/rs/logic/filemanage_fileSave`, {
            data: {
              userinfo: userinfoms,
              modifyReason: this.f_source ? `${this.f_source}维护档案信息` : '',
              address: {id: this.userinfo_old.addressinfo.id, oldid: this.userinfo_old.addressinfo.id}
            }
          }, {resolveMsg: null, rejectMsg: null}).then((res1) => {
            //tag+res1.data.status)
            if (res1.data.status == 200) {
              //本次修改信息包含需要审核信息
              if (this.approveChange) {
                //tag
                let res2 = this.$androidUtil.bzLogic('safe_upUserinfoApprove', {
                  row: {
                    f_time: Util.toStandardTimeString(),
                    f_modifier: Vue.user.name,//Vue.user.name
                    f_modifier_id: Vue.user.id,//Vue.user.id
                    f_modify_type: '用户档案',
                    f_userinfoid: this.userinfo.baseinfo.base.f_userinfo_id,
                    f_userinfo_code: this.userinfo.baseinfo.base.f_userinfo_code,
                    f_approved: '未审核',
                    filialestr: Vue.user.orgid,//Vue.user.orgid
                    version: 1,
                    f_user_name: this.userinfo.baseinfo.base.f_user_name,
                    f_user_phone: this.userinfo.baseinfo.base.f_user_phone,
                    f_street: this.userinfo.addressinfo.f_street,
                    f_building: this.userinfo.addressinfo.f_building,
                    f_unit: this.userinfo.addressinfo.f_unit,
                    f_floor: this.userinfo.addressinfo.f_floor,
                    f_room: this.userinfo.addressinfo.f_room,
                    f_building_suffix: this.userinfo.addressinfo.f_special == 1 ? null : this.userinfo.addressinfo.f_building_suffix,
                    f_unit_suffix: this.userinfo.addressinfo.f_special == 1 ? null : this.userinfo.addressinfo.f_unit_suffix,
                    f_floor_suffix: this.userinfo.addressinfo.f_special == 1 ? null : this.userinfo.addressinfo.f_floor_suffix,
                    f_room_suffix: this.userinfo.addressinfo.f_special == 1 ? null : this.userinfo.addressinfo.f_room_suffix,
                    f_residential_area: this.userinfo.addressinfo.f_residential_area,
                    f_address: this.userinfo.addressinfo.f_address,
                    f_pcd: this.userinfo.addressinfo.f_pcd,
                    f_pcd_id: this.userinfo.addressinfo.f_pcd_id,
                    f_street_id: this.userinfo.addressinfo.f_street_id,
                    f_residential_area_id: this.userinfo.addressinfo.f_residential_area_id,
                    f_used_name: this.userinfo.baseinfo.base.f_used_name,
                    f_rent_phone: this.userinfo.baseinfo.base.f_rent_phone,
                    f_slice_area: this.userinfo.addressinfo.f_slice_area,
                    f_remark: this.userinfo.baseinfo.base.f_remark,
                    f_source: this.f_source,
                    f_meterno_path: this.f_meterno_path,
                    f_iscity: this.userinfo.addressinfo.f_iscity,
                    f_special: this.userinfo.addressinfo.f_special,
                    f_meternumber: this.userinfo.meterinfo[0].f_meternumber,
                    f_gasbrand_id: this.userinfo.meterinfo[0].f_gasbrand_id,
                    f_gasmodel_id: this.userinfo.meterinfo[0].f_gasmodel_id,
                    changemeterno: this.changemeterno
                  },
                  tablename: 't_modify_userinfo'
                })
                //tag)
                if (res2.code == 200) {
                  this.$showMessage("变更用户信息成功,需要审核的信息已提交审核，等待管理员处理！")
                  this.enable = true
                  this.excessive = false
                } else {
                  this.$showMessage("上传审核信息失败，请检查图片和网络状况是否正常！")
                  this.excessive = false
                }
              } else {
                this.$showMessage("修改用户信息成功！")
                this.enable = true
                this.excessive = false
              }

            }
          }).catch((msg) => {
            this.$showMessage("修改用户信息失败,请检查手机网络状况！")
            this.excessive = false
          })

        }
      })
    },
    imgback(header) {
      if (this.headername == header) {
        return require('../../../assets/xiangxia1.png')
      } else {
        return require('../../../assets/xiangyou1.png')
      }
      this.headername = header
    },
    selectVal(header) {
      if (this.headername == header) {
        this.headername = ''
      } else {
        this.headername = header
      }

    },
    changeNewAddress() {
      this.userinfo.addressinfo.f_address = this.addressType == '普通地址' ? this.getAddress : this.getAddressTS
    },
    area_change() {
      //tag
      this.selectPcd = {id: this.selectArea.f_pcd_id,f_pcd:this.selectArea.f_pcd}
      this.userinfo.addressinfo.f_pcd = this.selectArea.f_pcd
      this.userinfo.addressinfo.f_pcd_id = this.selectArea.f_pcd_id

      this.selectStreet = {id: this.selectArea.f_street_id,f_street:this.selectArea.f_street}
      this.userinfo.addressinfo.f_street = this.selectArea.f_street
      this.userinfo.addressinfo.f_street_id = this.selectArea.f_street_id

      this.userinfo.addressinfo.f_residential_area = this.selectArea.f_residential_area
      this.userinfo.addressinfo.f_residential_area_id = this.selectArea.id
      this.userinfo.addressinfo.f_slice_area = this.selectArea.f_slice_area
      this.changeNewAddress()
      //this.userinfo.addressinfo.f_residential_area=this.f_residential_area.f_residential_area
    },
    async street_change() {
      //tag
      if (this.selectStreet.id) {
        //如果街道改变--给街道赋值！
        this.userinfo.addressinfo.f_street = this.selectStreet.f_street
        this.userinfo.addressinfo.f_street_id = this.selectStreet.id
        this.userinfo.addressinfo.f_iscity = this.selectStreet.f_iscity
        //清空当前选中小区的值
        this.userinfo.addressinfo.f_residential_area = ''
        this.userinfo.addressinfo.f_residential_area_id = ''
        this.userinfo.addressinfo.f_slice_area = ''
        this.selectArea = {id: ''}
        this.area = []
        let pcdText = ` and f_street_id=${this.selectStreet.id}`
        let res = await new HttpResetClass().load("POST", `${this.$androidUtil.getProxyUrl()}/rs/sql/safe_singleTable_OrderBy`, {
          data: {
            items: "*",
            tablename: "t_area",
            orderitem: "id",
            condition: `f_orgid = '${Vue.user.orgid}' ${pcdText} `
          }
        }, {resolveMsg: null, rejectMsg: null})
        ////tag)
        res.data.forEach((result) => {
          this.area.push({label: result.f_residential_area, value: result})
        })
      } else {
        this.area = []
      }

      this.changeNewAddress()
    },
    async brand_change() {
      /*根据气表品牌，查询气表类型*/
      if (this.userinfo.meterinfo[0].f_gasbrand_id!== "") {
        let res = await new HttpResetClass().load("POST", `${this.$androidUtil.getProxyUrl()}/rs/sql/safe_singleTable_OrderBy`, {
          data: {
            items: "*",
            tablename: "t_gasmodel",
            orderitem: "id",
            condition: `f_gasbrand_id= '${this.userinfo.meterinfo[0].f_gasbrand_id}'`
          }
        }, {resolveMsg: null, rejectMsg: null})
        ////tag)
        res.data.forEach((result) => {
          this.modellist.push({label: result.f_meter_style, value: result.id})
        })
      }
    },
    async pcd_change() {
      //tag
      if (this.selectPcd.id) {
        //tag
        //如果省市区改变-重新赋值
        this.userinfo.addressinfo.f_pcd = this.selectPcd.f_pcd
        this.userinfo.addressinfo.f_pcd_id = this.selectPcd.id
        //清空 选中的街道和集收单位
        /* this.selectStreet = {id: ''}
         this.userinfo.addressinfo.f_street = ''
         this.userinfo.addressinfo.f_street_id = ''
         this.userinfo.addressinfo.f_iscity = ''
         this.selectArea = {id: ''}
         this.userinfo.addressinfo.f_residential_area = ''
         this.userinfo.addressinfo.f_residential_area_id = ''
         this.userinfo.addressinfo.f_slice_area = ''*/
        this.streets = []
        let pcdText = `and f_pcd_id=${this.selectPcd.id}`
        let streetlist = await new HttpResetClass().load("POST", `${this.$androidUtil.getProxyUrl()}/rs/sql/safe_singleTable_OrderBy`, {
          data: {
            items: "*",
            tablename: "t_street",
            orderitem: "id",
            condition: `f_orgid = '${Vue.user.orgid}' ${pcdText}`
          }
        }, {resolveMsg: null, rejectMsg: null})
        streetlist.data.forEach((result) => {
          this.streets.push({label: result.f_street, value: result})
        })
      } else {
        this.streets = []
      }
      this.changeNewAddress()
    },
    upUserState() {
      //tag)
      if (this.userinfo.meterinfo[0].f_table_state == '正常') {
        let data = {
          f_userfiles_id: {
            f_userfiles_id: this.userinfo.meterinfo[0].f_userfiles_id,
            f_table_state: '停用',
            version: this.userinfo.meterinfo[0].version
          },
          f_userfile_id: this.userinfo.meterinfo[0].f_userfiles_id,
          f_user_id: this.userinfo.meterinfo[0].f_user_id,
          f_userinfo_id: this.userinfo.meterinfo[0].f_userinfo_id,
          f_user_name: this.userinfo.baseinfo.base.f_user_name,
          f_comments: '安检时发现问题关闭阀门',
          f_othereason: '',
          f_operat_type: '停用',
          f_describe: `${Vue.user.name}对客户${this.userinfo.baseinfo.base.f_user_name}进行表具停用操作`,
          f_state: '有效',
          f_operator: Vue.user.name,//${Vue.$login.f.name}
          f_operatorid: Vue.user.id,
          f_orgid: Vue.user.orgid,
          f_orgname: Vue.user.orgs,
          f_depid: Vue.user.depids,
          f_depname: Vue.user.deps,
          f_zoneid: Vue.user.zoneid,
          f_zones: Vue.user.zones
        }
        new HttpResetClass().load('post', `${this.$androidUtil.getProxyUrl()}/rs/entity/t_disable`,
          data, {resolveMsg: null, rejectMsg: null}).then((row) => {
          this.$showMessage('已成功关阀停气！')
          this.userinfo.meterinfo[0].f_table_state = '停用'
        })
      } else {
        this.$showMessage('该用户已被关阀停用，请勿重复操作！')
      }

    },
    addDevices() {
      //Vue.user.name
      let obj = {
        "f_operator": Vue.user.name,
        "f_picture": null,
        "f_pipe_type": null,
        "f_pipeinstall_date": null,
        "f_pipe_connection": null,
        "f_expire_date": null,
        "f_pipeexpire_date": null,
        "f_comments": null,
        "f_operate_date": Util.toStandardTimeString(),
        "f_operatorid": Vue.user.id,
        "f_devices_num": null,
        "f_process_id": null,
        "f_devices_type": null,
        "f_make_date": null,
        "f_input_date": null,
        "f_state": "有效",
        "f_brand": null,
        "f_devices_model": null,
        "f_devices_no": null,
        "img": {"content": null, "filename": null}
      }
      this.model.push(obj)
    },
    delDevices(idx) {
      //tag
      this.$showMessage('删除后不可恢复，确认删除吗？', ['confirm', 'cancel']).then((res) => {
        if (res === 'confirm') {
          this.model.splice(idx, 1)
        }
      })
    },
    async getAreaList(text) {
      if (this.selectStreet.id) {
        this.area = []
        let pcdText = text ? `and f_street_id=${this.selectStreet.id} and f_residential_area like '%${text}%'` : `and f_street_id=${this.selectStreet.id}`
        let res = await new HttpResetClass().load("POST", `${this.$androidUtil.getProxyUrl()}/rs/sql/safe_singleTable_OrderBy`, {
          data: {
            items: "*",
            tablename: "t_area",
            orderitem: "id",
            condition: `f_orgid = '${Vue.user.orgid}' ${pcdText}`
          }
        }, {resolveMsg: null, rejectMsg: null})
        ////tag)
        res.data.forEach((result) => {
          this.area.push({label: result.f_residential_area, value: result})
        })
        //tag
        this.area.push({
          label: this.userinfo.addressinfo.f_residential_area,
          value: {
            id: this.userinfo.addressinfo.f_residential_area_id,
            f_residential_area: this.userinfo.addressinfo.f_residential_area
          }
        })
      } else {
        this.area = []
      }

    },
    async getStreetList() {
      if (this.selectPcd.id) {
        //tag
        this.streets = []
        let pcdText = `and f_pcd_id=${this.selectPcd.id}`
        let streetlist = await new HttpResetClass().load("POST", `${this.$androidUtil.getProxyUrl()}/rs/sql/safe_singleTable_OrderBy`, {
          data: {
            items: "*",
            tablename: "t_street",
            orderitem: "id",
            condition: `f_orgid = '${Vue.user.orgid}' ${pcdText}`
          }
        }, {resolveMsg: null, rejectMsg: null})
        streetlist.data.forEach((result) => {
          //如果第一次进来有地址id 就拿下地址区域
          if (this.selectStreet.id && this.selectStreet.id == result.id) {
            //tag)
            this.userinfo.addressinfo.f_iscity = result.f_iscity
          }
          this.streets.push({label: result.f_street, value: result})
        })
      } else {
        this.streets = []
      }
    },
    changeAddressType(val) {
      //tag
      if (this.addressType == '普通地址') {
        this.userinfo.addressinfo.f_special = null
      } else if (this.addressType == '特殊地址') {
        this.userinfo.addressinfo.f_special = 1
        this.userinfo.addressinfo.f_building = null
        this.userinfo.addressinfo.f_unit = null
        this.userinfo.addressinfo.f_floor = null
        this.userinfo.addressinfo.f_room = null
      }
      this.changeNewAddress()
    }

  },
  computed: {
    getAddress() {
      return (this.userinfo.addressinfo.f_pcd ? this.userinfo.addressinfo.f_pcd : '') +
        (this.userinfo.addressinfo.f_street ? this.userinfo.addressinfo.f_street : '') +
        (this.userinfo.addressinfo.f_residential_area ? this.userinfo.addressinfo.f_residential_area : '') +
        (this.userinfo.addressinfo.f_building ? this.userinfo.addressinfo.f_building + (this.userinfo.addressinfo.f_building_suffix ? this.userinfo.addressinfo.f_building_suffix : '-') : '') +
        (this.userinfo.addressinfo.f_unit ? this.userinfo.addressinfo.f_unit + (this.userinfo.addressinfo.f_unit_suffix ? this.userinfo.addressinfo.f_unit_suffix : '') : '-') +
        (this.userinfo.addressinfo.f_floor ? this.userinfo.addressinfo.f_floor + (this.userinfo.addressinfo.f_floor_suffix ? this.userinfo.addressinfo.f_floor_suffix : '-') : '') +
        (this.userinfo.addressinfo.f_room ? this.userinfo.addressinfo.f_room + this.userinfo.addressinfo.f_room_suffix : '' )
    },
    getAddressTS() {
      return (this.userinfo.addressinfo.f_pcd ? this.userinfo.addressinfo.f_pcd : '') +
        (this.userinfo.addressinfo.f_street ? this.userinfo.addressinfo.f_street : '') +
        (this.userinfo.addressinfo.f_residential_area ? this.userinfo.addressinfo.f_residential_area : '')
    }
  },
  watch: {

    /*'selectPcd.id' (val) {
      //tag
      if(this.selectPcd.id){
        this.getStreetList()
      }
    },
    'selectStreet.id' (val) {
      //tag
      if(this.selectStreet.id){
        this.getAreaList()
      }
    }*/
  },
  async ready() {
    /*//tag)

    //tag)
    //tag)*/
    //this.f_userinfo_id=1102260
    //this.f_userinfo_id=1997541
    if (!this.f_userinfo_id) {
      this.$showMessage("未检测到用户！")
      this.enable = true
      return
    }
    try {
      this.getBrand()
      this.devices_types = Vue.$appdata.getParam('设备类型')
      console.log('this.devices_types=', JSON.stringify(this.devices_types))
      for (const devices_type of this.devices_types) {
        console.log('Vue.$appdata.getParam(`档案设备信息-${devices_type.label}品牌`)=', JSON.stringify(Vue.$appdata.getParam(`档案设备信息-${devices_type.label}品牌`)))
        this.deviceBrandOption[devices_type.label] = Vue.$appdata.getParam(`档案设备信息-${devices_type.label}品牌`) || []
      }
      console.log('this.deviceBrandOption=', JSON.stringify(this.deviceBrandOption))
      this.wz_types = Vue.$appdata.getParam('安装位置')
      this.aroundmeters = Vue.$appdata.getParam('左右表')

      ////tag)
      this.excessive = true
      //Vue.user.orgid ${this.f_userinfo_id} 10101    ${Vue.user.orgid}

      let pcdlist = await new HttpResetClass().load("POST", `${this.$androidUtil.getProxyUrl()}/rs/sql/safe_singleTable_OrderBy`, {
        data: {
          items: "*",
          tablename: "t_pcd",
          orderitem: "id",
          condition: `f_orgid = '${Vue.user.orgid}'`
        }
      }, {resolveMsg: null, rejectMsg: null})
      //tag)
      pcdlist.data.forEach((result) => {
        this.pcds.push({label: result.f_pcd, value: result})
      })
      let areas = await new HttpResetClass().load("POST", `${this.$androidUtil.getProxyUrl()}/rs/sql/getallarea?pageNo=1&pageSize=9999`, {
        data: {
          /*items: "*",
          tablename: "t_area",
          orderitem: "id",
          condition: `f_orgid = '${Vue.user.orgid}'`*/
          orgid:Vue.user.orgid
        }
      }, {resolveMsg: null, rejectMsg: null})
      //tag)
      areas.data.forEach((result) => {
        this.area.push({label: result.f_residential_area, value: result})
      })
      ////tag)
      let res = await new HttpResetClass().load('post', `${this.$androidUtil.getProxyUrl()}/rs/logic/filemanage_getFilesDetail`, {
        //f_userinfo_code:'12381344',
        f_userinfo_id: this.f_userinfo_id
      }, {resolveMsg: null, rejectMsg: null})
      //tag
      //tag
      this.userinfo = res.data
      this.f_phone1 = res.data.baseinfo.userphonelist[0]?res.data.baseinfo.userphonelist[0].f_rent_phone:''
      this.f_phone2 = res.data.baseinfo.userphonelist[1]?res.data.baseinfo.userphonelist[1].f_rent_phone:''
      this.userinfo_old = JSON.parse(JSON.stringify(res.data))
      this.model = this.userinfo.meterinfo[0].devicesinfo
      this.selectArea.id = this.userinfo.addressinfo.f_residential_area_id
      this.selectArea.f_residential_area = this.userinfo.addressinfo.f_residential_area
      this.selectPcd.id = this.userinfo.addressinfo.f_pcd_id
      this.selectPcd.f_pcd = this.userinfo.addressinfo.f_pcd
      this.selectStreet.id = this.userinfo.addressinfo.f_street_id
      this.selectStreet.f_street = this.userinfo.addressinfo.f_street
      await this.getStreetList()
      this.getmeterinfo()
      // await this.getAreaList()
      this.excessive = false
      this.addressType = this.userinfo.addressinfo.f_special == 1 ? '特殊地址' : '普通地址'
      //this.userinfo.addressinfo.f_special=1
      //tag
    } catch (e) {
      this.excessive = false
      this.enable = true
      this.$showMessage('获取用户信息出错,请检查网络状况！')
    }
    new HttpResetClass().load('get', `${this.$androidUtil.getProxyUrl()}/rs/vue/UserAddress.json`, {data: {}}, {
      resolveMsg: null,
      rejectMsg: null
    }).then((addressUnit) => {
      //tag
      //tag
      //tag
      //tag
      this.userinfo.addressinfo.f_building_suffix = addressUnit.data.f_building_suffix
      this.userinfo.addressinfo.f_unit_suffix = addressUnit.data.f_unit_suffix
      this.userinfo.addressinfo.f_floor_suffix = addressUnit.data.f_floor_suffix
      this.userinfo.addressinfo.f_room_suffix = addressUnit.data.f_room_suffix
    }).catch((msg) => {
      //tag)
    })
    this.showBox = this.$appdata.getSingleValue('档案审核是否显示调压箱') == '是'? true : false
    console.log(this.showBox)
    if (this.showBox) {
      // 获取调压箱
      new HttpResetClass().load('post', `${this.$androidUtil.getProxyUrl()}/rs/sql/adjustableboxQuery`, {data: {condition: '1 = 1'}}, {
        resolveMsg: null,
        rejectMsg: null
      }).then((res) => {
        const boxOptions = []
        for (const data of res.data) {
          const one = {
            label: data.f_adjustable_id + data.f_adjustable_name,
            value: Number(data.f_adjustable_id)
          }
          boxOptions.push(one)
        }
        this.boxOptions = JSON.parse(JSON.stringify(boxOptions))
        console.log(this.boxOptions)
      }).catch((msg) => {
        //tag)
      })
    }
  }
}
</script>
<style lang="less" scoped>
.butt3 {
  float: right;
  width: 12px;
  margin: 1% 2% 0 0;
}

.rightipt {
  width: 60%;
  float: left;
  margin-left: 5%;
}

.righttxt {
  border: none;
  margin-left: 5px;
  /*border-left: 5px solid #A2C2EB;*/
  float: left;
  width: 25%;
  margin-bottom: 3px;
  text-align: left;
  word-wrap: break-word;
  white-space: normal;
}

.tit1 {
  background-image: url('../../../assets/用户姓名.png');
  background-repeat: no-repeat;
  background-position: center;
}

.spanboder {
  border-bottom: 2px solid #499edf;
  padding-bottom: 8px
}

#upuserinfo_sel /deep/ ul {
  width: 100% !important;
  left: 0 !important;
}

.btn-photo {
  border: 0;
  border-radius: 7px;
  background-color: #7dc1f4;
  font: 15px PingFang-SC-Bold;
  height: 20%;
}

.panel-self {
  border-radius: 10px;
  border: 1px solid #499EDF;
  background-color: #F8F8F8;
}

.div-photo {
  width: auto;
  height: auto;
  /* margin-top: 10px; */
  position: absolute;
  bottom: 10px;
  right: 10px;
}
</style>
<style lang="less">
#upuserinfo_sel ul {
  width: 100% !important;
  left: 0 !important;
}
</style>

