<template>
  <form novalidate class="form-horizontal  span auto compatible show-info" v-if="showUser">
    <div class="row col-xs-12 col-sm-6 col-md-6 app-row">
      <div class="col-xs-4 col-sm-4 col-md-4" style="margin-top: 7px">
        <img src="../../assets/用户ID.png" style="width: 20px;" alt="">
        <label class="font text-left">卡&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;号:</label>
      </div>
      <div class="col-xs-8 col-sm-8 col-md-8" style="margin-top: 7px">
        <input class="input-font search_input col-sm-8"
               type="text" v-model="model.f_card_id" :disabled="$parent.$parent.role == 'androidview'">
        <button v-if="item.f_no_checkplan != '点火通气单' && $parent.$parent.role == 'inspect'" type="button"
                class="btn text-rigth  btn-enter btn-enter-font col-sm-4" @click="findUser()"
                style="margin-bottom: 5px;float: right">查找
        </button>
      </div>
    </div>
    <div class="row col-xs-12 col-sm-6 col-md-6 app-row">
      <div class="col-xs-4 col-sm-4 col-md-4" style="margin-top: 7px">
        <img src="../../assets/用户ID.png" style="width: 20px;" alt="">
        <label class="font text-left">用户编号:</label>
      </div>
      <div class="col-xs-8 col-sm-8 col-md-8" style="margin-top: 7px">
        <input class="input-font col-sm-7" style=" border: 0;background-color: #ffffff;border-radius: 3px;"
               type="text" v-model="model.f_userinfo_code" disabled="disabled">
        <button type="button" class="btn text-rigth  btn-enter btn-enter-font col-sm-5" @click="enter()"
                style="margin-bottom: 5px;float: right">记录查询
        </button>
      </div>
    </div>
    <div class="row col-xs-12 col-sm-6 col-md-6 app-row">
      <div class="col-xs-4 col-sm-4 col-md-4">
        <img src="../../assets/户姓名.png" style="width: 20px;margin-bottom: 5px" alt="">
        <label class="font text-left">用户姓名:</label>
      </div>
      <div class="col-xs-8 col-sm-8 col-md-8">
        <input class="search_input input-font col-sm-8" type="text" v-model="model.f_user_name"
               :disabled="$parent.$parent.role == 'androidview' || f_allow_change_name">
        <button type="button" class="btn text-rigth  btn-enter btn-enter-font col-sm-4" @click="bluetooth()"
                style="margin-top: -8px;float: right">读卡器
        </button>
      </div>
    </div>
    <div class="row col-xs-12 col-sm-6 col-md-6 app-row">
      <div class="col-xs-4 col-sm-4 col-md-4">
        <img src="../../assets/用户姓名.png" style="width: 20px;margin-bottom: 5px" alt="">
        <label class="font text-left">证件号码:</label>
      </div>
      <div class="col-xs-8 col-sm-8 col-md-8">
        <input class="search_input input-font col-sm-12" type="text" v-model="model.f_idnumber"
               :disabled="$parent.$parent.role == 'androidview'">
      </div>
    </div>

    <div class="row col-xs-12 col-sm-6 col-md-6 app-row">
      <div class="col-xs-4 col-sm-4 col-md-4">
        <img src="../../assets/户姓名.png" style="width: 20px;margin-bottom: 5px" alt="">
        <label class="font text-left">用户状态:</label>
      </div>
      <div class="col-xs-8 col-sm-8 col-md-8">
        <input class="input-font" style=" border: 0;background-color: #ffffff;width: 50%;border-radius: 3px;"
               type="text" v-model="model.f_user_state" disabled="disabled">
      </div>
    </div>

    <div class="row col-xs-12 col-sm-6 col-md-6 app-row">
      <div class="col-xs-4 col-sm-4 col-md-4">
        <img src="../../assets/户姓名.png" style="width: 20px;margin-bottom: 5px" alt="">
        <label class="font text-left">表具状态:</label>
      </div>
      <div class="col-xs-8 col-sm-8 col-md-8">
        <input class="search_input input-font col-sm-8" type="text" disabled v-model="model.f_table_state">
        <!--<button  type="button" class="btn text-rigth  btn-enter btn-enter-font" @click="outOfUse('启用')"-->
        <!--style="margin-bottom: 5px;float: right">停用-->
        <!--</button>-->
        <button
          v-if="model.f_table_state == '停用' && model.f_reason.indexOf('问题表-死表') == -1 && model.f_reason.indexOf('问题表-常通') == -1 && model.f_reason.indexOf('问题表-气量不符') ==-1 && model.f_reason.indexOf('表具、配件等费用未收') == -1"
          type="button" class="btn text-rigth  btn-danger col-sm-4" @click="outOfUse('启用')"
          style="margin-top: -8px;float: right">启用
        </button>
        <button v-if="model.f_table_state == '正常'" type="button" class="btn text-rigth  btn-danger col-sm-4"
                @click="outOfUse('停用')"
                style="margin-top: -8px;float: right">停用
        </button>
      </div>
    </div>


    <div class="row col-xs-12 col-sm-6 col-md-6 app-row">
      <div class="col-xs-4 col-sm-4 col-md-4">
        <img src="../../assets/户姓名.png" style="width: 20px;margin-bottom: 5px" alt="">
        <label class="font text-left">用气性质:</label>
      </div>
      <div class="col-xs-8 col-sm-8 col-md-8">
        <input class="input-font" style=" border: 0;background-color: #ffffff;width: 50%;border-radius: 3px;"
               type="text" v-model="model.f_gasproperties" disabled="disabled">
      </div>
    </div>


    <div class="row col-xs-12 col-sm-6 col-md-6 app-row">
      <div class="col-xs-4 col-sm-4 col-md-4">
        <img src="../../assets/用户姓名.png" style="width: 20px;margin-bottom: 5px" alt="">
        <label class="font text-left">停用原因:</label>
      </div>
      <div class="col-xs-8 col-sm-8 col-md-8">
        <input v-if="model.f_table_state == '停用'" class="search_input input-font col-sm-12" type="text" disabled
               v-model="model.f_reason">
      </div>
    </div>

    <div v-if="model.f_table_state == '停用'" class="row col-xs-12 col-sm-12 col-md-6 app-row">
      <div class="col-xs-3 col-sm-3 col-md-3">
        <img src="../../assets/用户类型.png" style="width: 20px;margin-bottom: 5px" alt="">
        <label class="font text-left">停用备注:</label>
      </div>
      <div class="col-xs-9 col-sm-9 col-md-9">
        <input class="search_input input-font col-sm-12" style="width: 89%;" type="text" disabled v-model="model.f_stop_remark">
      </div>
    </div>

    <div class="row col-xs-12 col-sm-6 col-md-6 app-row">
      <div class="col-xs-4 col-sm-4 col-md-4">
        <img src="../../assets/用户ID.png" style="width: 20px;" alt="">
        <label class="font text-left">开户状态:</label>
      </div>
      <div class="col-xs-8 col-sm-8 col-md-8">
        <input class="input-font" style=" border: 0;background-color: #ffffff;width: 50%;border-radius: 3px;"
               type="text" v-model="model.archives_state" disabled="disabled">
      </div>

    </div>

    <div class="row col-xs-12 col-sm-6 col-md-6 app-row">
      <div class="col-xs-4 col-sm-4 col-md-4">
        <img src="../../assets/户姓名.png" style="width: 20px;margin-bottom: 5px" alt="">
        <label class="font text-left">立管编号:</label>
      </div>
      <div class="col-xs-8 col-sm-8 col-md-8">
        <input class="search_input input-font col-sm-7" type="text" disabled v-model="model.f_plumb_id">
        <button v-if="$parent.$parent.role == 'inspect'" type="button" class="btn text-rigth btn-danger col-sm-5"
                @click="toPipemap()"
                style="margin-top: -8px;float: right">立管挂接
        </button>
      </div>
    </div>
    <!--<div class="row col-xs-12 col-sm-6 col-md-6 app-row">-->
    <!--<div class="col-xs-4 col-sm-4 col-md-4">-->
    <!--<img src="../../assets/用户ID.png" style="width: 20px;margin-bottom: 5px" alt="">-->
    <!--<label class="font text-left">用户类型:</label>-->
    <!--</div>-->
    <!--<div class="col-xs-8 col-sm-8 col-md-8">-->
    <!--<input class="search_input input-font" type="text" v-model="model.f_user_type" disabled="disabled">-->
    <!--</div>-->
    <!--</div>-->
    <div class="row col-xs-12 col-sm-12 col-md-6 app-row">
      <div class="col-xs-3 col-sm-3 col-md-3">
        <img src="../../assets/用户类型.png" style="width: 20px;margin-bottom: 5px" alt="">
        <label class="font text-left">安全用气协议编号:</label>
      </div>
      <div class="col-xs-9 col-sm-9 col-md-9">
        <input class="search_input input-font col-sm-12" style="width: 89%;" type="text" v-model="model.f_safeagreement_id"
               :disabled="$parent.$parent.role == 'androidview'">
      </div>
    </div>
    <div class="row col-xs-12 col-sm-12 col-md-6 app-row">
      <div class="col-xs-4 col-sm-4 col-md-4">
        <img src="../../assets/用户类型.png" style="width: 20px;margin-bottom: 5px" alt="">
        <label class="font text-left">此次是否签订安全协议：</label>
      </div>
      <div class="col-xs-3 col-sm-3 col-sm-3" v-for="item in openRadiosss">
        <input v-model="model.f_is_safeagreement" :value="item.label" :checked='item.isChecked'
               @click="checkOpens(item.value)" type="radio" :disabled="$parent.$parent.role == 'androidview'">
        <label>{{ item.label }}</label>
      </div>
    </div>
    <div class="row col-xs-12 col-sm-12 col-md-6 app-row">
      <div class="col-xs-3 col-sm-3 col-md-3">
        <img src="../../assets/用户类型.png" style="width: 20px;margin-bottom: 5px" alt="">
        <label class="font text-left">供气合同编号:</label>
      </div>
      <div class="col-xs-9 col-sm-9 col-md-9">
        <input class="search_input input-font col-sm-12" style="width: 89%;" type="text" v-model="model.f_contract_id"
               :disabled="$parent.$parent.role == 'androidview'">
      </div>
    </div>
    <div class="row col-xs-12 col-sm-6 col-md-6 app-row">
      <div class="col-xs-4 col-sm-4 col-md-4">
        <img src="../../assets/用户电话.png" style="width: 20px;margin-bottom: 5px" alt="">
        <label class="font text-left">业主电话:</label>
      </div>
      <div class="col-xs-8 col-sm-8 col-md-8">
        <input class="search_input input-font col-sm-12" type="text" v-model="model.f_user_phone"
               :disabled="$parent.$parent.role == 'androidview' || f_allow_change_name"
        >
      </div>
    </div>
    <div class="row col-xs-12 col-sm-6 col-md-6 app-row">
      <div class="col-xs-4 col-sm-4 col-md-4">
        <img src="../../assets/用户电话.png" style="width: 20px;margin-bottom: 5px" alt="">
        <label class="font text-left">居住人姓名:</label>
      </div>
      <div class="col-xs-8 col-sm-8 col-md-8">
        <input class="search_input input-font col-sm-12" type="text" v-model="model.f_rent_name"
               :disabled="$parent.$parent.role == 'androidview'">
      </div>
    </div>
    <div class="row col-xs-12 col-sm-6 col-md-6 app-row">
      <div class="col-xs-4 col-sm-4 col-md-4">
        <img src="../../assets/用户电话.png" style="width: 20px;margin-bottom: 5px" alt="">
        <label class="font text-left">居住人电话:</label>
      </div>
      <div class="col-xs-8 col-sm-8 col-md-8">
        <input class="search_input input-font col-sm-12" type="text" v-model="model.f_rent_phone" @change="phonetest(model.f_rent_phone)"
               :disabled="$parent.$parent.role == 'androidview'">
      </div>
    </div>
    <div class="row col-xs-12 col-sm-6 col-md-6 app-row">
      <div class="col-xs-4 col-sm-4 col-md-4">
        <img src="../../assets/小区.png" style="width: 20px;margin-bottom: 5px" alt="">
        <label class="font text-left">区 &nbsp;&nbsp;/&nbsp;&nbsp; 县:</label>
      </div>
      <div class="col-xs-8 col-sm-8 col-md-8">
        <input class="search_input input-font col-sm-12" type="text" v-model="model.f_area"
               :disabled="$parent.$parent.role == 'androidview'">
      </div>
    </div>
    <div class="row col-xs-12 col-sm-6 col-md-6 app-row">
      <div class="col-xs-4 col-sm-4 col-md-4">
        <img src="../../assets/小区.png" style="width: 20px;margin-bottom: 5px" alt="">
        <label class="font text-left">街 &nbsp;&nbsp; &nbsp;&nbsp; 道:</label>
      </div>
      <div class="col-xs-8 col-sm-8 col-md-8">
        <input class="search_input input-font col-sm-12" type="text" v-model="model.f_street"
               :disabled="$parent.$parent.role == 'androidview'">
      </div>
    </div>
    <div class="row col-xs-12 col-sm-6 col-md-6 app-row">
      <div class="col-xs-4 col-sm-4 col-md-4">
        <img src="../../assets/小区.png" style="width: 20px;margin-bottom: 5px" alt="">
        <label class="font text-left">小区名称:</label>
      </div>
      <div class="col-xs-8 col-sm-8 col-md-8">
        <input class="search_input input-font col-sm-12" type="text" v-model="model.f_residential_area"
               :disabled="$parent.$parent.role == 'androidview'">
      </div>
    </div>
    <div class="row col-xs-12 col-sm-6 col-md-6 app-row">
      <div class="col-xs-4 col-sm-4 col-md-4">
        <img src="../../assets/小区.png" style="width: 20px;margin-bottom: 5px" alt="">
        <label class="font text-left">楼 &nbsp;&nbsp; &nbsp;&nbsp; 号:</label>
      </div>
      <div class="col-xs-8 col-sm-8 col-md-8">
        <input class="search_input input-font col-sm-12" type="text" v-model="model.f_building"
               :disabled="$parent.$parent.role == 'androidview'">
      </div>
    </div>
    <div class="row col-xs-12 col-sm-6 col-md-6 app-row">
      <div class="col-xs-4 col-sm-4 col-md-4">
        <img src="../../assets/小区.png" style="width: 20px;margin-bottom: 5px" alt="">
        <label class="font text-left">单 &nbsp;&nbsp; &nbsp;&nbsp; 元:</label>
      </div>
      <div class="col-xs-8 col-sm-8 col-md-8">
        <input class="search_input input-font col-sm-12" type="text" v-model="model.f_unit"
               :disabled="$parent.$parent.role == 'androidview'">
      </div>
    </div>
    <div class="row col-xs-12 col-sm-6 col-md-6 app-row">
      <div class="col-xs-4 col-sm-4 col-md-4">
        <img src="../../assets/小区.png" style="width: 20px;margin-bottom: 5px" alt="">
        <label class="font text-left">楼 &nbsp;&nbsp; &nbsp;&nbsp; 层:</label>
      </div>
      <div class="col-xs-8 col-sm-8 col-md-8">
        <input class="search_input input-font col-sm-12" type="text" v-model="model.f_floor"
               :disabled="$parent.$parent.role == 'androidview'">
      </div>
    </div>
    <div class="row col-xs-12 col-sm-6 col-md-6 app-row">
      <div class="col-xs-4 col-sm-4 col-md-4">
        <img src="../../assets/小区.png" style="width: 20px;margin-bottom: 5px" alt="">
        <label class="font text-left">门&nbsp;牌&nbsp;号 :</label>
      </div>
      <div class="col-xs-8 col-sm-8 col-md-8">
        <input class="search_input input-font col-sm-12" type="text" v-model="model.f_room"
               :disabled="$parent.$parent.role == 'androidview'">
      </div>
    </div>
    <div class="row col-xs-12 col-sm-12 col-md-6 app-row">
      <div class="col-xs-3 col-sm-3 col-md-3">
        <img src="../../assets/详细住址.png" style="width: 20px;margin-bottom: 5px" alt="">
        <label class="font text-left">详细住址:</label>
      </div>
      <div class="col-xs-9 col-sm-9 col-md-9">
        <input class="search_input input-font col-sm-12" style="width: 89%;" type="text" v-model="model.f_address"
               :disabled="$parent.$parent.role == 'androidview'">
      </div>
    </div>
    <div class="row col-xs-12 col-sm-6 col-md-6 app-row">
      <div class="col-xs-4 col-sm-4 col-md-4">
        <img src="../../assets/详细住址.png" style="width: 20px;margin-bottom: 5px" alt="">
        <label class="font text-left">常住人口:</label>
      </div>
      <div class="col-xs-8 col-sm-8 col-md-8">
        <input class="search_input input-font col-sm-12" type="text" v-model="model.f_people_num"
               :disabled="$parent.$parent.role == 'androidview'">
      </div>
    </div>
    <div class="row col-xs-12 col-sm-6 col-md-6 app-row">
      <div class="col-xs-4 col-sm-4 col-md-4">
        <img src="../../assets/房屋结构.png" style="width: 20px;margin-bottom: 5px" alt="">
        <label class="font text-left">气价类型:</label>
      </div>
      <div class="col-xs-8 col-sm-8 col-md-8">
        <input class="search_input input-font col-sm-12" type="text" disabled v-model="model.f_price_name">
      </div>
    </div>
    <!-- <div class="col-sm-8">
       <a href="#" class="btn btn-primary" @click="editUserInfo">修改用户信息</a>
     </div>-->
    <div class="row col-xs-12 col-sm-6 col-md-6 app-row">
      <div class="col-xs-4 col-sm-4 col-md-4" style="margin-top: 5px">
        <img src="../../assets/房屋结构.png" style="width: 20px;margin-bottom: 5px" alt="">
        <label for="f_rent" class="font text-left">租住:</label>
      </div>
      <div class="col-xs-8 col-sm-8 col-md-8" style="margin-bottom: 8px">
        <v-select id="f_rent" :value.sync="model.f_rent" class="input-font"
                  :options='rents' placeholder='请选择' :value-single="true"
                  close-on-select clear-button
                  :disabled="$parent.$parent.role == 'androidview'"
        ></v-select>
      </div>
    </div>
    <div class="row col-xs-12 col-sm-6 col-md-6 app-row">
      <div class="col-xs-4 col-sm-4 col-md-4" style="margin-top: 5px">
        <img src="../../assets/房屋结构.png" style="width: 20px;margin-bottom: 5px" alt="">
        <label for="f_residential_properties" class="font text-left">小区性质:</label>
      </div>
      <div class="col-xs-8 col-sm-8 col-md-8" style="margin-bottom: 8px">
        <v-select id="f_residential_properties" :value.sync="model.f_residential_properties" class="input-font"
                  :options='residentialProperties' placeholder='请选择' :value-single="true"
                  close-on-select clear-button
                  :disabled="$parent.$parent.role == 'androidview'"
        ></v-select>
      </div>
    </div>
    <div class="row col-xs-12 col-sm-6 col-md-6 app-row">
      <div class="col-xs-4 col-sm-4 col-md-4" style="margin-top: 5px">
        <img src="../../assets/房屋结构.png" style="width: 20px;margin-bottom: 5px" alt="">
        <label for="f_distinct" class="font text-left">行政区域:</label>
      </div>
      <div class="col-xs-8 col-sm-8 col-md-8" style="margin-bottom: 8px">
        <v-select id="f_distinct" :value.sync="model.f_distinct" class="input-font"
                  :options='distincts' placeholder='请选择' :value-single="true"
                  close-on-select clear-button
                  :disabled="$parent.$parent.role == 'androidview'"
        ></v-select>
      </div>
    </div>
    <div class="row col-xs-12 col-sm-6 col-md-6 app-row">
      <div class="col-xs-4 col-sm-4 col-md-4" style="margin-top: 5px">
        <img src="../../assets/房屋结构.png" style="width: 20px;margin-bottom: 5px" alt="">
        <label for="f_opera_area" class="font text-left">运行区域:</label>
      </div>
      <div class="col-xs-8 col-sm-8 col-md-8" style="margin-bottom: 8px">
        <v-select id="f_opera_area" :value.sync="model.f_opera_area" class="input-font"
                  :options='opera_areas' placeholder='请选择' :value-single="true"
                  close-on-select clear-button
                  :disabled="$parent.$parent.role == 'androidview'"
        ></v-select>
      </div>
    </div>
    <div class="row col-xs-12 col-sm-6 col-md-6 app-row">
      <div class="col-xs-4 col-sm-4 col-md-4" style="margin-top: 5px">
        <img src="../../assets/房屋结构.png" style="width: 20px;margin-bottom: 5px" alt="">
        <label for="f_heating_style" class="font text-left">供暖方式:</label>
      </div>
      <div class="col-xs-8 col-sm-8 col-md-8" style="margin-bottom: 8px">
        <v-select id="f_heating_style" :value.sync="model.f_heating_style" class="input-font"
                  :options='heating_style' placeholder='请选择' :value-single="true"
                  close-on-select clear-button
                  :disabled="$parent.$parent.role == 'androidview'"
        ></v-select>
      </div>
    </div>
    <div class="row col-xs-12 col-sm-6 col-md-6 app-row">
      <div class="col-xs-4 col-sm-4 col-md-4" style="margin-top: 5px">
        <img src="../../assets/房屋结构.png" style="width: 20px;margin-bottom: 5px" alt="">
        <label for="f_user_equipmen" class="font text-left">用气设备:</label>
      </div>
      <div class="col-xs-8 col-sm-8 col-md-8" style="margin-bottom: 8px">
        <v-select id="f_user_equipmen" :value.sync="model.f_user_equipmen" class="input-font"
                  :options='equipmens' placeholder='请选择' :value-single="true"
                  close-on-select clear-button
                  :disabled="$parent.$parent.role == 'androidview'"
        ></v-select>
      </div>
    </div>
    <div class="row col-xs-12 col-sm-6 col-md-6 app-row">
      <div class="col-xs-4 col-sm-4 col-md-4" style="margin-top: 5px">
        <img src="../../assets/房屋结构.png" style="width: 20px;margin-bottom: 5px" alt="">
        <label for="f_emphasis_user" class="font text-left">重点用户:</label>
      </div>
      <div class="col-xs-8 col-sm-8 col-md-8" style="margin-bottom: 8px">
        <v-select id="f_emphasis_user" :value.sync="model.f_emphasis_user" class="input-font"
                  :options='emphasisUsers' placeholder='请选择' :value-single="true"
                  close-on-select clear-button
                  :disabled="$parent.$parent.role == 'androidview'"
        ></v-select>
      </div>
    </div>
    <div class="row col-xs-12 col-sm-6 col-md-6 app-row" v-if="model.f_emphasis_user=='临街商铺'">
      <div class="col-xs-4 col-sm-4 col-md-4" style="margin-top: 5px">
        <img src="../../assets/房屋结构.png" style="width: 20px;margin-bottom: 5px" alt="">
        <label for="f_emphasis_user" class="font text-left">商铺用途:</label>
      </div>
      <div class="col-xs-8 col-sm-8 col-md-8" style="margin-bottom: 8px">
        <v-select id="f_use_type" :value.sync="model.f_use_type" class="input-font"
                  :options='UserTypes' placeholder='请选择' :value-single="true"
                  close-on-select clear-button
                  :disabled="$parent.$parent.role == 'androidview'"
        ></v-select>
      </div>
    </div>
    <div class="row col-xs-12 col-sm-6 col-md-6 app-row" v-if="model.f_emphasis_user=='临街商铺'">
      <div class="col-xs-4 col-sm-4 col-md-4" style="margin-top: 5px">
        <img src="../../assets/房屋结构.png" style="width: 20px;margin-bottom: 5px" alt="">
        <label for="f_emphasis_user" class="font text-left">气源接入:</label>
      </div>
      <div class="col-xs-8 col-sm-8 col-md-8" style="margin-bottom: 8px">
        <v-select id="f_source_type" :value.sync="model.f_source_type" class="input-font"
                  :options='SourceTypes' placeholder='请选择' :value-single="true"
                  close-on-select clear-button
                  :disabled="$parent.$parent.role == 'androidview'"
        ></v-select>
      </div>
    </div>
    <div class="row col-xs-12 col-sm-6 col-md-6 app-row">
      <div class="col-xs-5 col-sm-5 col-md-5">
        <img src="../../assets/户姓名.png" style="width: 20px;margin-bottom: 5px" alt="">
        <label class="font text-left">自锁阀状态:</label>
      </div>
      <div class="col-xs-7 col-sm-7 col-md-7">
        <input class="search_input input-font col-sm-8" type="text" disabled v-model="model.f_latchingvalve_state">
        <!--<button  type="button" class="btn text-rigth  btn-enter btn-enter-font" @click="outOfUse('启用')"-->
        <!--style="margin-bottom: 5px;float: right">停用-->
        <!--</button>-->
        <button v-if="model.f_latchingvalve_state === '开'"
                type="button" class="btn text-rigth  btn-danger col-sm-4" @click="close"
                style="margin-top: -8px;float: right">锁阀
        </button>
        <button v-if="model.f_latchingvalve_state !== '开'"
                type="button" class="btn text-rigth  btn-danger col-sm-4" @click="open"
                style="margin-top: -8px;float: right">开阀
        </button>
      </div>
    </div>

    <!--    <div class="row col-xs-12 col-sm-6 col-md-6 app-row">
          <div class="col-xs-4 col-sm-4 col-md-4" style="margin-top: 5px">
          </div>
          <div class="col-xs-8 col-sm-8 col-md-8" style="margin-bottom: 8px">
          </div>
        </div>-->

    <div class="row col-xs-12 col-sm-12 col-md-6 app-row" style="padding: 20px" v-if="$parent.$parent.role == 'inspect'">
      <div class="col-xs-6 col-sm-6 text-center">
        <button type="button" class="btn btn-primary" @click="create()">生成地址</button>
      </div>
      <!--<div class="col-xs-6 col-sm-6 text-center">-->
      <!--<button type="button" class="btn btn-primary" @click="editUserInfo">上传信息</button>-->
      <!--</div>-->
    </div>

    <div style="height:50px;"></div>
  </form>
  <div v-if="showInfo" class="show-info">
    <div class="page-header app-header auto">
      <div @click='disapprove()'>
        <img src="../../assets/back.png"/>
      </div>
    </div>
    <!--<safecheck-sell-info :user="model" :is-need-condition="false" :is-group="false"></safecheck-sell-info>-->
    <sell-info :user="user" :is-need-condition="false" :is-group="false"></sell-info>
  </div>
  <div v-if="showPipemap" class="show-info">
    <div class="page-header app-header auto">
      <div @click='disPipemap()'>
        <img src="../../assets/back.png"/>
      </div>
    </div>
    <!--<safecheck-sell-info :user="model" :is-need-condition="false" :is-group="false"></safecheck-sell-info>-->
    <pipe-map :user="userPipe"></pipe-map>
  </div>
  <disable-manage :show="showDisable" :type="type"></disable-manage>
  <latching-valve-state-manage v-if="showLatching" :type="latchingType"></latching-valve-state-manage>
</template>

<script>
import Vue from 'vue'
import * as Util from '../Util'

export default {
  title: '用户基本信息',
  data() {
    return {
      type: '',
      rowx:'',
      parentData: this.$parent.$parent.data,
      // f_user_defects: this.$parent.$parent.f_user_defects,
      // model: this.model,
      openRadiosss: [
        {
          label: '是',
          value: 0,
          isChecked: false
        },
        {
          label: '否',
          value: 1,
          isChecked: false
        }
      ],
      config: this.$parent.$parent.config,
      templateInfo: this.$parent.$parent.templateInfo,
      item: this.$parent.$parent.item,
      f_allow_change_name: true,
      model: {
        f_source_type: '',
        f_use_type: '',
        f_card_id: '',
        f_user_name: '',
        f_userinfo_code: '',
        f_area: '',
        f_address: '',
        f_user_phone: '',
        f_rent_name: '',
        f_rent_phone: '',
        f_user_type: '民用',
        f_idnumber: '',
        f_street: '',
        f_building: '',
        f_unit: '',
        f_floor: '',
        f_room: '',
        f_residential_area: '',
        // f_userproperties: '',
        f_rent: '',
        f_emphasis_user: '',
        f_user_equipmen: '',
        f_residential_properties: '',
        f_people_num: '',
        f_safeagreement_id: Util.isReturnJM(''),
        f_is_safeagreement: '是',
        f_contract_id: Util.isReturnJM(''),
        f_reason: '',
        f_price_name: '',
        f_table_state: '',
        f_user_state: '',
        f_gasproperties: '',
        archives_state: '',
        f_plumb_id: '',
        f_user_id: '',
        version: '',
        f_stop_remark: '',
        f_latchingvalve_state: ''
      },
      // user_properties:this.$appdata.getParam('安检用户性质'),
      // user_properties:[
      //   {label: '平房', value: '平房'},
      //   {label: '多层', value: '多层'}
      // ],
      showUser: true,
      showInfo: false,
      showPipemap: false,
      showDisable: false,
      user: {card_id: this.$parent.$parent.item.f_card_id, sid: this.$parent.$parent.item.f_card_id,f_user_id:this.rowx},
      userPipe: {
        f_card_id: this.$parent.$parent.item.f_card_id,
        f_residential_area: '',
        f_building: '',
        f_unit: '',
        f_room: ''
      },
      // room_style : this.$appdata.getParam('民用房屋结构'),
      // heating_style : this.$appdata.getParam('供暖方式')

      rents: [
        {label: '否', value: '否'},
        {label: '普通居住', value: '普通居住'},
        {label: '托管培训', value: '托管培训'},
        {label: '办公', value: '办公'},
        {label: '餐饮', value: '餐饮'},
        {label: '集体宿舍', value: '集体宿舍'}
      ],
      residentialProperties: [
        {label: '物业小区', value: '物业小区'},
        {label: '企事业单位', value: '企事业单位'},
        {label: '安置小区', value: '安置小区'},
        {label: '自建房', value: '自建房'},
        {label: '公租房', value: '公租房'},
        {label: '廉租房', value: '廉租房'}
      ],
      distincts: [
        {label: '航天', value: '航天'},
        {label: '曲江', value: '曲江'},
        {label: '高新', value: '高新'},
        {label: '长安', value: '长安'},
        {label: '沣东', value: '沣东'},
        {label: '雁塔', value: '雁塔'},
        {label: '沣西', value: '沣西'},
        {label: '浐灞生态区', value: '浐灞生态区'}
      ],
      opera_areas: [
        {label: '航天', value: '航天'},
        {label: '韦曲', value: '韦曲'},
        {label: '高新', value: '高新'},
        {label: '沣东', value: '沣东'},
        {label: '中心站', value: '中心站'}
      ],
      UserTypes: [
        {label: '民用', value: '民用'},
        {label: '商用', value: '商用'},
        {label: '未用', value: '未用'},
        {label: '其他', value: '其他'}
      ],
      latchingvalveStates: [
        {label: '开', value: '开'},
        {label: '锁', value: '锁'}
      ],
      SourceTypes: [
        {label: '小区', value: '小区'},
        {label: '独立气源', value: '独立气源'}
      ],
      emphasisUsers: [
        {label: '否', value: '否'},
        {label: '孤寡老人', value: '孤寡老人'},
        {label: '重大隐患', value: '重大隐患'},
        {label: '气量出入', value: '气量出入'},
        {label: '临街商铺', value: '临街商铺'},
        {label: '小区大锅灶', value: '小区大锅灶'},
        {label: '民改商', value: '民改商'},
        {label: '村内餐饮', value: '村内餐饮'},
        {label: '职工用户', value: '职工用户'},
        {label: '行业内用户', value: '行业内用户'},
        {label: '星级用户', value: '星级用户'},
        {label: '公寓', value: '公寓'},
        {label: '户内立管阀', value: '户内立管阀'}
      ],
      heating_style: [
        {label: '壁挂炉供暖', value: '壁挂炉供暖'},
        {label: '集中供暖', value: '集中供暖'},
        {label: '其他', value: '其他'},
        {label: '燃气取暖器供暖', value: '燃气取暖器供暖'}
      ],
      equipmens: [
        {label: '请选择', value: ''},
        {label: '单灶', value: '单灶'},
        {label: '灶具+热水器', value: '灶具+热水器'},
        {label: '灶具+壁挂锅炉', value: '灶具+壁挂锅炉'},
        {label: '灶具+燃气取暖器', value: '灶具+燃气取暖器'},
        {label: '未用', value: '未用'},
        {label: '灶具+热水器+壁挂锅炉', value: '灶具+热水器+壁挂锅炉'},
        {label: '单热水器', value: '单热水器'},
        {label: '单壁挂锅炉', value: '单壁挂锅炉'}
      ],
      defaultCheckMust: ['表后管', '灶具连接管', '报警器', '立管', '阀门', '其他', '抽油机', '燃气表'],
      equipmensChart: {
        '单灶': '灶具',
        '灶具': '灶具',
        '单热水器': '热水器',
        '热水器': '热水器',
        '单壁挂炉': '壁挂锅炉',
        '壁挂炉': '壁挂锅炉',
        '壁挂锅炉': '壁挂锅炉',
        '表后管': '表后管',
        '灶具连接管': '灶具连接管',
        '报警器': '报警器',
        '立管': '立管',
        '阀门': '阀门',
        '其他': '其他',
        '抽油机': '抽油机',
        '燃气表': '燃气表',
        '燃气取暖器': '',
        '未用': ''
      },
      userproperties: '',
      showLatching: false,
      latchingType: '',
      loginInfo: Vue.user.f_parentname,
      searchUserInfo: {}
    }
  },
  props: ['userinfo'],
  ready() {
    // 当计划类型是预约开户单或从预约开户计划进入时，允许修改用户名
    if (this.item.f_no_checkplan === '预约开户单' || (this.parentData && this.parentData.f_plan_type === '预约开户计划')) {
      this.parentData.f_allow_change_name = '是'
      this.f_allow_change_name = false
    }

    if (this.item.f_no_checkplan === '点火通气单') {
      this.model.f_is_safeagreement = '否'
    } else {
      this.model.f_is_safeagreement = '是'
    }
    this.model.f_card_id = this.item.f_card_id
    if (Vue.config.safecheck != undefined) {
      if (Vue.config.safecheck.ApproveConfig != undefined) {
        if (Vue.config.safecheck.ApproveConfig.userproperties != undefined) {
          this.userproperties = Vue.config.safecheck.ApproveConfig.userproperties
        } else {
          this.userproperties = false
        }
      }
    }
    // console.log('this.parentData.f_entry_status==>'+this.parentData.f_entry_status)
    // console.log('this.parentData.f_card_id==>'+this.parentData.f_card_id)
    console.log('this.$parent.$parent.item.f_state==>' + this.$parent.$parent.item.f_state)
    // console.log('this.$parent.$parent.isSearchUser==>'+this.$parent.$parent.isSearchUser)
    // console.log('this.$parent.$parent.isSearchUser==>'+this.$parent.$parent.isSearchUser)
    if (this.$parent.$parent.item.f_state == '已检' || this.$parent.$parent.isSearchUser == true || this.parentData.f_entry_status != '入户' || !this.parentData.f_card_id || this.item.f_no_checkplan === '点火通气单') {
      // console.log('用户信息页面合并地址信息==>区：'+JSON.stringify(this.parentData.f_area))
      // console.log('用户信息页面合并地址信息==>街道：'+JSON.stringify(this.parentData.f_street))
      // console.log('用户信息页面合并地址信息==>小区名称：'+JSON.stringify(this.parentData.f_residential_area))
      // console.log('用户信息页面合并地址信息==>楼号：'+JSON.stringify(this.parentData.f_building))
      // console.log('用户信息页面合并地址信息==>单元：'+JSON.stringify(this.parentData.f_unit))
      // console.log('用户信息页面合并地址信息==>楼层：'+JSON.stringify(this.parentData.f_floor))
      // console.log('用户信息页面合并地址信息==>门牌号：'+JSON.stringify(this.parentData.f_room))
      // console.log('用户信息页面合并地址信息==>详细住址：'+JSON.stringify(this.parentData.f_address))
      // console.log('用户信息页面==>姓名：'+JSON.stringify(this.parentData.f_user_name))
      // console.log('用户信息页面==>卡号：'+JSON.stringify(this.parentData.f_card_id))
      // console.log('用户信息页面==>租住：'+JSON.stringify(this.parentData.f_rent))
      // 引用当前页面的model和paperSet页面的data数据合并之后放在model
      Object.assign(this.model, this.model, this.parentData)
      this.userPipe.f_residential_area = this.model.f_residential_area
      this.userPipe.f_building = this.model.f_building
      this.userPipe.f_unit = this.model.f_unit
      this.userPipe.f_room = this.model.f_room
      // console.log('合并完成后==>区：'+JSON.stringify(this.model.f_area))
      // console.log('合并完成后==>街道：'+JSON.stringify(this.model.f_street))
      // console.log('合并完成后==>小区名称：'+JSON.stringify(this.model.f_residential_area))
      // console.log('合并完成后==>楼号：'+JSON.stringify(this.model.f_building))
      // console.log('合并完成后==>单元：'+JSON.stringify(this.model.f_unit))
      // console.log('合并完成后==>楼层：'+JSON.stringify(this.model.f_floor))
      // console.log('合并完成后==>门牌号：'+JSON.stringify(this.model.f_room))
      // console.log('合并完成后==>详细住址：'+JSON.stringify(this.model.f_address))
      // console.log('合并完成后==>姓名：'+JSON.stringify(this.model.f_user_name))
      // console.log('合并完成后==>卡号：'+JSON.stringify(this.model.f_card_id))
      // console.log('合并完成后==>租住：'+JSON.stringify(this.model.f_rent))
    }

    if (this.item.f_no_checkplan === '点火通气单' && this.$parent.$parent.item.f_state != '已检') {
      console.log('templateInfo => ' + JSON.stringify(this.templateInfo))
      this.model.f_area = this.getTemplateValue('用户基本信息', '区/县')
      this.model.f_street = this.getTemplateValue('用户基本信息', '街道')
      this.model.f_residential_properties = this.getTemplateValue('用户基本信息', '小区性质')
      //TODO 点火通气单PC定制计划模板修改
      this.model.f_distinct = this.getTemplateValue('用户基本信息', '所属区域')
      this.model.f_opera_area = this.getTemplateValue('用户基本信息', '运行区域')
      this.model.f_heating_style = this.getTemplateValue('用户基本信息', '供暖方式')
      this.model.f_rent = this.getTemplateValue('用户基本信息', '租住')
      this.model.f_user_equipmen = this.getTemplateValue('用户基本信息', '用气设备')
      this.model.f_emphasis_user = '否'
      this.model.f_people_num = '0'
      this.model.f_latchingvalve_state = this.item.f_latchingvalve_state
    }
    console.log('用户信息。。。' + JSON.stringify(this.model))
    // Object.assign(this.model, this.model, this.userinfo)

    this.$resetpost(`${this.$androidUtil.getProxyUrl()}/rs/sql/safecheckSingleTable`, {
      data: {
        tablename: 'T_USERFILES',
        condition: "f_userinfo_id = '" + this.item.f_userinfoid + "'"
      }
    }).then((res) => {
      this.user.f_user_id=res.data[0].f_user_id

    })

  },
  methods: {
    phonetest (row) {
      if (!(/^\d{11}$/.test(row))) {
        this.$showMessage('电话必须为11位的数字!')
      }
    },
    checkOpens(index) {
      console.log('index', index)
      // 先取消所有选中项
      for (let item of this.openRadiosss) {
        item.isChecked = false
      }
      //再设置当前点击项选中
      this.model.f_is_safeagreement = this.openRadiosss[index].label
      // 设置值，以供传递
      this.openRadiosss[index].isChecked = true
      console.log('model.f_is_safeagreement==', this.model.f_is_safeagreement)
    },
    bluetooth() {
      HostApp._open_a_page({
        type: 'boomerang',
        page: 'com.aofeng.hotline.activity.BluetoothActivity',
        param: {
          operator: '',
          requestCode: 111,
          readonly: 'true',
          callback: 'javascript:console.log("boomerang");'
        }
      })
    },
    enter() {
      this.$parent.$parent.showBack = false
      this.showUser = false
      this.showInfo = true
    },
    toPipemap() {

      this.$parent.$parent.showBack = false
      this.showUser = false
      this.showPipemap = true
    },
    // 用户状态变更
    userInfoStateUpdate(val) {
      this.$parent.$parent.showBack = false
      if (val == '正常') {
        this.$showMessage(`确定将用户${this.model.f_user_name}的用户状态进行隐患消除吗？`, ['confirm', 'cancel']).then((res) => {
          if (res == 'confirm') {
            let data = {}
            data.f_userinfo_id = this.model.f_userinfoid
            data.f_user_name = this.model.f_user_name
            data.f_state = '有效'
            data.f_remark = `安检员${Vue.user.name}，从安检单中对用户${this.model.f_user_name}进行户档案隐患消除操作`
            data.f_reason = null
            data.f_othereason = null
            data.f_operat_type = '户档案隐患消除（启用）'
            data.f_describe = `${Vue.user.name}对${this.model.f_user_name}进行户档案隐患消除操作`
            data.f_operator = Vue.user.name
            data.f_userinfo_id = {}
            data.f_userinfo_id.f_userinfo_id = this.model.f_userinfoid
            data.f_userinfo_id.f_user_state = '正常'
            data.f_userinfo_id.version = this.model.f_userinfo_version
            this.$resetpost(`${this.$androidUtil.getProxyUrl()}/NewSaleRest/rs/entity/t_record`, data, {
              resolveMsg: '恭喜！提交成功！',
              rejectMsg: '提交错误！'
            }).then((res) => {
              this.$showMessage('户档案隐患消除成功')
            })
          } else {

          }
          this.$parent.$parent.showBack = true
        })
      }
    },
    outOfUse(val) {
      this.type = val
      this.$parent.$parent.showBack = false
      this.showDisable = true
    },
    disapprove() {
      this.$parent.$parent.showBack = true
      this.showUser = true
      this.showInfo = false
    },
    disPipemap() {
      this.$parent.$parent.showBack = true
      this.showUser = true
      this.showPipemap = false
    },
    editUserInfo() {
      let rowMeter
      // var r = confirm("确定是否修改用户信息？")
      this.$showMessage('确定是否修改用户信息和表信息？', ['confirm', 'cancel']).then((res) => {
          console.log('res=====>' + res)
          if (res === 'confirm') {
            if (Util.required(this.model.f_rent)) {
              this.$showMessage('请选择租住情况')
              return
            }
            if (Util.required(this.model.f_residential_properties)) {
              this.$showMessage('请选择小区性质')
              return
            }
            if (Util.required(this.model.f_distinct)) {
              this.$showMessage('请选择行政区域')
              return
            }
            if (Util.required(this.model.f_opera_area)) {
              this.$showMessage('请选择运行区域')
              return
            }
            if (Util.required(this.model.f_emphasis_user)) {
              this.$showMessage('请选择重点用户')
              return
            }
            if (Util.required(this.model.f_heating_style)) {
              this.$showMessage('请选择供暖方式')
              return
            }
            if (Util.required(this.model.f_user_equipmen)) {
              this.$showMessage('请选择用气设备')
              return
            }
            for (let dataItem in this.parentData) {
              if (dataItem.startsWith('device')) {
                let deviceN = this.parentData[dataItem]
                for (let deviceItem in deviceN) {
                  if (deviceN[deviceItem].f_device_type === '燃气表') {
                    rowMeter = {
                      f_card_id: '',
                      f_meternumber: '',
                      f_flow_direction: '',
                      f_making_date: '',
                      f_metertitles: '',
                      f_meter_style: ''
                    }
                    let f_items = deviceN[deviceItem].f_items
                    console.log('f_items = > ' + JSON.stringify(f_items))
                    for (let item in f_items) {
                      let itemData = f_items[item]
                      let name = itemData.f_item_name
                      console.log('itemData.f_item_value===========>>>>>>' + JSON.stringify(itemData.f_item_value))
                      console.log('typeof itemData.f_item_value===========>>>>>>' + JSON.stringify(typeof itemData.f_item_value))
                      if (name == '左右表' || name == '表型' || name == 'IC卡表类型') {
                        if (typeof itemData.f_item_value == 'object') {
                          if (!itemData.f_item_value || itemData.f_item_value.length < 1) {
                            this.$showMessage('请选择' + name)
                            return
                          }
                        } else {
                          if (itemData.f_item_value == '' || !itemData.f_item_value) {
                            this.$showMessage('请选择' + name)
                            return
                          }
                        }

                      }
                      switch (name) {
                        case '表编号':
                          rowMeter.f_meternumber = itemData.f_item_value
                          break
                        case '左右表':
                          rowMeter.f_flow_direction = typeof itemData.f_item_value == 'object' ? itemData.f_item_value[0] : itemData.f_item_value
                          break
                        case '生产时间':
                          rowMeter.f_making_date = itemData.f_item_value
                          break
                        case '表封号':
                          rowMeter.f_metertitles = itemData.f_item_value
                          break
                        case '表型':
                          rowMeter.f_meter_style = typeof itemData.f_item_value == 'object' ? itemData.f_item_value[0] : itemData.f_item_value
                          break
                        case 'IC卡表类型':
                          rowMeter.f_size_card = typeof itemData.f_item_value == 'object' ? itemData.f_item_value[0] : itemData.f_item_value
                          break
                      }
                    }
                  }
                }
              }
            }
            console.log('rowMeter===>' + JSON.stringify(rowMeter))

            this.$resetpost(`${this.$androidUtil.getProxyUrl()}/rs/logic/SaveEntity`,
              {
                data: {
                  row: {
                    f_time: Util.toStandardTimeString(),
                    f_create_time: Util.toStandardTimeString(),
                    f_plan_item_id: this.model.f_check_item_id,
                    f_modifier: Vue.user.name,
                    f_modifier_id: Vue.user.id,
                    f_modify_type: '用户档案',
                    f_userinfoid: this.model.f_userinfoid,
                    f_userinfo_code: this.model.f_userinfo_code,
                    f_user_name: this.model.f_user_name,
                    f_approved: '未审核',
                    filialestr: this.parentData.f_filialeids,
                    version: this.model.version,
                    f_content: {
                      'f_user_name': this.model.f_user_name,
                      'f_user_phone': this.model.f_user_phone,
                      'f_rent_phone': this.model.f_rent_phone,
                      'f_area': this.model.f_area,
                      'f_street': this.model.f_street,
                      'f_building': this.model.f_building,
                      'f_unit': this.model.f_unit,
                      'f_floor': this.model.f_floor,
                      'f_room': this.model.f_room,
                      'f_residential_area': this.model.f_residential_area,
                      'f_address': this.model.f_address,
                      // TODO 新增字段，后台逻辑可能需要调整，PaperUserm所有信息都从userinfo（this.$parent.data）获取
                      'f_rent': this.model.f_rent,
                      'f_emphasis_user': this.model.f_emphasis_user,
                      'f_user_equipmen': this.model.f_user_equipmen,
                      'f_residential_properties': this.model.f_residential_properties,
                      'f_idnumber': this.model.f_idnumber,
                      'f_people_num': this.model.f_people_num,
                      // "f_safeagreement_id": this.model.f_safeagreement_id,
                      // "f_contract_id": this.model.f_contract_id,
                      'f_distinct': this.model.f_distinct,
                      'f_opera_area': this.model.f_opera_area,
                      'f_heating_style': this.model.f_heating_style,
                      'f_meternumber': rowMeter.f_meternumber,
                      'f_flow_direction': rowMeter.f_flow_direction,
                      'f_making_date': rowMeter.f_making_date,
                      'f_meter_style': rowMeter.f_meter_style,
                      'f_size_card': rowMeter.f_size_card
                      // "f_userproperties":this.model.f_userproperties
                    }
                  },
                  tablename: 't_modify_userinfo'

                }
              }).then((res) => {
              this.$showMessage('待审核信息上传成功！')
            }).catch(() => {
              this.$showMessage('上传失败！')
            })
          }
        }
      )
    },
    //取暖方式框赋值
    assigHeating(val) {
      console.log(`val=${val}`)
      this.model.f_heating_style = val
      this.parentData.f_heating_style = this.model.f_heating_style
    },
    //房屋结构框赋值
    assigRoom(val) {
      console.log(`val[0]=${val}`)
      if (val.length == 0) {
        val = ['']
      }
      this.model.f_room_style = val[0]
      this.parentData.f_room_style = this.model.f_room_style
    },
    //更新父组件用户信息
    setParentValue(key) {
      // if (key == 'f_user_phone') {
      //     if (this.model.f_user_phone != '') {
      //         if (!(/^((0\d{2,3}-\d{7,8})|(1[3584]\d{9}))$/.test(this.model[key]))) {
      //             this.$showMessage("电话号有误，请重填")
      //             this.model[key] = this.parentData[key]
      //             return
      //         }
      //     }
      // }
      console.log('asd==' + this.model[key])
      this.parentData[key] = this.model[key]
      console.log('asd==' + this.parentData[key])
    },

    create() {
      let addresstype = 'A'
      if (Vue.config.safecheck != undefined) {
        if (Vue.config.safecheck.ApproveConfig != undefined) {
          if (Vue.config.safecheck.ApproveConfig.addresstype != undefined) {
            addresstype = Vue.config.safecheck.ApproveConfig.addresstype
          }
        }
      }
      if (addresstype == 'A') {
        this.createA()
      } else if (addresstype == 'B') {
        this.createB()
      } else if (addresstype == 'C') {
        this.createC()
      }
    },
    createA() {
      if (!this.model.f_street) {
        this.$set('model.f_street', ' ')
        this.$set('parentData.f_street', ' ')
      }
      if (!this.model.f_residential_area) {
        this.$set('model.f_residential_area', ' ')
        this.$set('parentData.f_residential_area', ' ')
      }
      let address = this.model.f_street + this.model.f_residential_area
      if (this.model.f_building) {
        address += this.model.f_building + '栋'
        // address += isNaN(this.model.f_building) ? this.model.f_building : this.model.f_building + '栋'
      }
      if (this.model.f_unit) {
        address += this.model.f_unit + '单元'
        // address += isNaN(this.model.f_unit) ? this.model.f_unit : this.model.f_unit + "单元"
      }
      if (this.model.f_floor) {
        address += isNaN(this.model.f_floor) ? this.model.f_floor : this.model.f_floor + '层'
      }
      if (this.model.f_room) {
        address += isNaN(this.model.f_room) ? this.model.f_room : this.model.f_room + '室'
      }
      this.$set('model.f_address', address)

      this.$set('parentData.f_address', address)
    },
    createB() {
      if (!this.model.f_residential_area) {
        this.$set('model.f_residential_area', ' ')
        this.$set('parentData.f_residential_area', ' ')
      }
      let address = this.model.f_residential_area
      if (this.model.f_building) {
        address += '' + this.model.f_building
      }
      if (this.model.f_unit) {
        address += '-' + this.model.f_unit
      }
      if (this.model.f_floor) {
        address += '-' + this.model.f_floor
      }
      if (this.model.f_room) {
        address += '-' + this.model.f_room
      }
      this.$set('model.f_address', address)

      this.$set('parentData.f_address', address)
    },
    createC() {
      if (!this.model.f_street) {
        this.$set('model.f_street', ' ')
        this.$set('parentData.f_street', ' ')
      }
      if (!this.model.f_residential_area) {
        this.$set('model.f_residential_area', ' ')
        this.$set('parentData.f_residential_area', ' ')
      }
      let address = this.model.f_street + this.model.f_residential_area
      if (this.model.f_building) {
        address += isNaN(this.model.f_building) ? this.model.f_building : this.model.f_building + '号楼'
      }
      if (this.model.f_unit) {
        address += isNaN(this.model.f_unit) ? this.model.f_unit : this.model.f_unit + '单元'
      }
      if (this.model.f_floor) {
        address += isNaN(this.model.f_floor) ? this.model.f_floor : this.model.f_floor + '层'
      }
      if (this.model.f_room) {
        address += isNaN(this.model.f_room) ? this.model.f_room : this.model.f_room + '室'
      }
      this.$set('model.f_address', address)

      this.$set('parentData.f_address', address)
    },
    findUser() {
      if (this.model.f_card_id) {
        this.$resetpost(`${this.$androidUtil.getProxyUrl()}/rs/logic/getUserInfoAndPlan`, {data: {f_card_id: this.model.f_card_id}}).then((res) => {
          console.log('通过卡号查询信息结果' + JSON.stringify(res))
          console.log('换表后累购==>>>>' + JSON.stringify(res.data.changeGas))
          console.log('新表底数' + JSON.stringify(res.data.newmeterbase))
          this.searchUserInfo = res.data
          if (res.data.imgs && res.data.imgs.length > 0) {
            console.log('赋值前f_user_defects' + JSON.stringify(this.$parent.$parent.f_user_defects))
            this.$parent.$parent.ic_imgs = res.data.imgs
          }
          if (res.data.userDefects.length > 0) {
            console.log('赋值前f_user_defects' + JSON.stringify(this.$parent.$parent.f_user_defects))
            this.$parent.$parent.f_user_defects = res.data.userDefects
            console.log('赋值后f_user_defects' + JSON.stringify(this.$parent.$parent.f_user_defects))
            for (let i = 0; i < this.$parent.$parent.f_user_defects.length; i++) {
              this.$parent.$parent.f_user_defects[i].f_is_eliminate = ''
            }
          } else {
            this.$parent.$parent.f_user_defects = []
          }
          if (res.data.userinfo.length > 0) {
            let userinfo = this.$androidUtil.bzLogic('getRepairUserInfo', {f_card_id: this.model.f_card_id})
            let repairUserInfo
            console.log('repairuserinfo====>' + JSON.stringify(userinfo))
            if (userinfo.code == '200') {
              if (userinfo.data.rows > 0) {
                repairUserInfo = userinfo.data.rows[0]
              }
            }
            if (repairUserInfo) {
              console.log('开始合并')
              Object.assign(res.data.userinfo[0], res.data.userinfo[0], repairUserInfo)
              Object.assign(res.data.planMeter[0], res.data.planMeter[0], repairUserInfo)
            }
            this.$parent.$parent.isSearchUser = true
            let f_user_equipmen = ''
            if (res.data.devices.length > 0) {
              for (let i = 0; i < res.data.devices.length; i++) {
                if (this.equipmensChart[res.data.devices[i].f_devices_type]) {
                  f_user_equipmen += `${this.equipmensChart[res.data.devices[i].f_devices_type]}+`
                }
              }
              console.log('f_user_equipmen-》-》-》-》-》-》' + f_user_equipmen)
              if (f_user_equipmen) {
                let equipment = f_user_equipmen.slice(0, f_user_equipmen.length - 1)
                if (equipment) {
                  this.model.f_user_equipmen = equipment
                }
              }
              console.log('用气设备===' + this.model.f_user_equipmen)
              if (this.model.f_user_equipmen == '灶具') {
                this.model.f_user_equipmen = '单灶'
              }
              if (this.model.f_user_equipmen == '壁挂锅炉') {
                this.model.f_user_equipmen = '单壁挂锅炉'
              }
              if (this.model.f_user_equipmen == '热水器') {
                this.model.f_user_equipmen = '单热水器'
              }
            }
            res.data.userinfo[0].f_safeagreement_id = Util.isReturnJM(res.data.userinfo[0].f_safeagreement_id)
            res.data.userinfo[0].f_contract_id = Util.isReturnJM(res.data.userinfo[0].f_contract_id)
            Object.assign(this.model, this.model, res.data.userinfo[0])
            this.userPipe.f_residential_area = this.model.f_residential_area
            this.userPipe.f_building = this.model.f_building
            this.userPipe.f_unit = this.model.f_unit
            this.userPipe.f_room = this.model.f_room
            this.user.card_id = res.data.userinfo[0].f_card_id
            this.user.sid = res.data.userinfo[0].f_card_id
            let totalgas = 0
            if (res.data.totalGas.length > 0) {
              totalgas = res.data.totalGas[0].f_pregas
            }
            this.$parent.$parent.setGasMeterData(res.data.planMeter[0], totalgas, res.data.newmeterbase, res.data.changeGas, res.data.changeFee, res.data.hasChange, res.data.devices)
            //该用户姓名为自动生成的（楼号单元号楼东拼起来的），可以修改
            if (/\d/.test(this.model.f_user_name)) {
              this.parentData.f_allow_change_name = '是'
              console.log('this.parentData.f_allow_change_name=>' + this.parentData.f_allow_change_name)
              this.f_allow_change_name = false
            }
            // this.$set('$parent.$parent.data.changegas',changegas)
            // // this.$parent.$parent.data.changegas = changegas
            // this.$set('$parent.$parent.data.hasChange',hasChange)
            // console.log('this.$parent.$parent.changegas'+this.$parent.$parent.changegas)
            // console.log('this.$parent.$parent.hasChange'+this.$parent.$parent.hasChange)
          } else {
            this.$showMessage('没有查询到对应该卡号的用户！')
          }

        })
      } else {
        this.$showMessage('请输入卡号')
      }
    },
    close() {
      this.showLatching = true
      this.latchingType = '锁阀'
    },
    open() {
      this.showLatching = true
      this.latchingType = '开阀'
    },
    getTemplateValue(type, name) {
      let item = this.templateInfo.find((item) => {
        return item.f_type === type && item.f_name === name
      })
      return item ? item.f_value : ''
    }
  },
  destroyed() {
    console.log('paperUser页面销毁')
    console.log('this.model' + JSON.stringify(this.model))
    Object.assign(this.parentData, this.parentData, this.model)
    console.log('合并后')
    //TODO 用气设备的字段名
    console.log('this.model.f_user_equipmen => ' + JSON.stringify(this.model.f_user_equipmen))
    console.log('this.config => ' + JSON.stringify(this.config))
    console.log('typeof this.model.f_user_equipmen => ' + typeof this.model.f_user_equipmen)
    // 通过对照表转换值
    let checkMustArray = []
    if (this.model.f_user_equipmen !== null && typeof this.model.f_user_equipmen == 'string') {
      console.log('this.model.f_user_equipmen.indexOf(\'+\') == -1' + this.model.f_user_equipmen.indexOf('+') == -1)
      if (this.model.f_user_equipmen.indexOf('+') == -1) {
        console.log('单个设备')
        checkMustArray.push(this.equipmensChart[this.model.f_user_equipmen])
        console.log('单个checkMustArray => ' + JSON.stringify(checkMustArray))
      } else {
        console.log('多个设备')
        checkMustArray = this.model.f_user_equipmen.split('+').map(value => this.equipmensChart[value]).filter(value => value !== '')
        console.log('多个checkMustArray => ' + JSON.stringify(checkMustArray))
      }
    }
    for (let dev in this.config) {
      if (checkMustArray.indexOf(dev) >= 0) {
        console.log(dev + ' selected be check')
        this.config[dev].checkmust = true
      } else if (this.defaultCheckMust.indexOf(dev) === -1) {
        console.log(dev + ' selected be not check')
        this.config[dev].checkmust = false
      }
    }
    // this.$dispatch('updateUserInfo')
  },
  events: {
    'setPlumbId'(val) {
      console.log('更新立管编号===》' + val)
      this.model.f_plumb_id = val
    },
    'success'(type, val) {
      console.log('完成停用', type)
      console.log('完成停用', val)
      console.log('当前用户信息' + JSON.stringify(this.searchUserInfo))
      let data = {}
      data.f_userinfo_id = this.model.f_userinfoid
      data.f_user_name = this.model.f_user_name
      data.f_state = '有效'
      data.f_reason = val.f_reason
      data.f_othereason = val.f_othereason
      data.f_remark = val.f_remake
      data.f_operator = Vue.user.name
      data.f_user_id = {}
      data.f_user_id.f_user_id = this.model.f_user_id
      data.f_user_id.version = this.searchUserInfo.userinfo[0].version
      if (type == '启用') {
        data.f_operat_type = '启用'
        data.f_describe = `${Vue.user.name}对${this.model.f_card_id}进行启用操作`
        data.f_user_id.f_table_state = '正常'
        console.log('保存启用记录data==>' + JSON.stringify(data))
        this.$resetpost(`${this.$androidUtil.getProxyUrl()}/NewSaleRest/rs/entity/t_enable`, data, {
          resolveMsg: '恭喜！提交成功！',
          rejectMsg: '提交错误！'
        }).then((res) => {
          this.showEnable = false
          this.$showMessage('提交成功')
          this.showDisable = false
          this.$parent.$parent.showBack = true
          this.findUser()
        })
      } else {
        data.f_operat_type = '停用'
        data.f_describe = `${Vue.user.name}对${this.model.f_card_id}进行停用操作`
        data.f_user_id.f_table_state = '停用'
        console.log('保存停用记录data==>' + JSON.stringify(data))
        this.$resetpost(`${this.$androidUtil.getProxyUrl()}/NewSaleRest/rs/entity/t_disable`, data, {
          resolveMsg: '恭喜！提交成功！',
          rejectMsg: '提交错误！'
        }).then((res) => {
          this.$showMessage('提交成功')
          this.showDisable = false
          this.$parent.$parent.showBack = true
          this.findUser()
        })
      }
    },
    'finish'(type, val) {
      console.log('选择完成  type==》' + type)
      console.log('选择完成  val==》' + JSON.stringify(val))
      let data = {}
      data.f_userinfo_id = this.model.f_userinfoid
      data.f_user_name = this.model.f_user_name
      data.f_state = '有效'
      data.f_reason = val.f_reason
      data.f_card_id = this.model.f_card_id
      data.f_meternumber = this.model.f_meternumber
      data.f_operator = Vue.user.name
      data.f_remark = val.f_remark
      data.f_user_id = {}
      data.f_user_id.f_user_id = this.model.f_user_id
      data.f_user_id.version = this.model.f_userfiles_version
      if (type === '开阀') {
        data.f_operat_type = '开阀'
        data.f_describe = `${Vue.user.name}对${this.model.f_card_id}进行总阀开阀操作`
        data.f_user_id.f_latchingvalve_state = '开'
        console.log('开阀data====>' + JSON.stringify(data))
        this.$resetpost(`${this.$androidUtil.getProxyUrl()}/NewSaleRest/rs/entity/t_valve`, data, {
          resolveMsg: '恭喜！提交成功！',
          rejectMsg: '提交错误！'
        }).then((res) => {
          this.$showMessage('开阀成功')
          this.findUser()
          this.showLatching = false
        })
      } else if (type === '锁阀') {
        data.f_operat_type = '锁阀'
        data.f_describe = `${Vue.user.name}对${this.model.f_card_id}进行总阀锁阀操作`
        data.f_user_id.f_latchingvalve_state = '锁'
        console.log('闭阀data====>' + JSON.stringify(data))
        this.$resetpost(`${this.$androidUtil.getProxyUrl()}/NewSaleRest/rs/entity/t_valve`, data, {
          resolveMsg: '恭喜！提交成功！',
          rejectMsg: '提交错误！'
        }).then((res) => {
          this.$showMessage('关阀成功')
          this.findUser()
          this.showLatching = false
        })
      }
    },
    'closeLatching'() {
      this.showLatching = false
    },
    'closeDisable'() {
      this.showDisable = false
      this.$parent.$parent.showBack = true
      // this.showUser = true
    }
  },
  watch: {
    'model.f_safeagreement_id': function (val) {
      this.model.f_safeagreement_id = Util.isReturnJM(val)
      this.model.f_contract_id = Util.isReturnJM(val)  // 绑定
    },
    'model.f_contract_id': function (val) {
      this.model.f_contract_id = Util.isReturnJM(val)
      this.model.f_safeagreement_id = Util.isReturnJM(val) // 绑定
    }
  }
}
</script>
<style scoped>
.app-header {
  border-radius: 50%;
  position: fixed;
  background: rgba(73, 158, 223, 0.12);
  color: #FFF;
  padding: 8px;
  text-align: center;
  font-size: 1.2em;
  z-index: 10;
  opacity: 0.5;
  bottom: 50px;
  margin-top: -20px;
}

.search_input {
  border: 1px solid #c0c0c0;
  border-radius: 3px;
  background-color: #f8fcff;
}

.userid-input {
  border: 0;
  background-color: #ffffff;
  width: 40%;
  border-radius: 3px;
}

.input-font {
  font: 15px PingFang-SC-Medium;
  color: #333333;
}

.font {
  font: 15px PingFang-SC-Medium;
  color: #666666;
}

.btn-enter {
  background-color: #f5fbff;
  border-radius: 3px;
  border: 1px solid #499EDF;
}

.btn-enter-font {
  font: 15px PingFang-SC-Medium;
  color: #499edf;
}

.show-info {
  width: 95%;
  margin: auto;
  position: relative;
  top: 40px
}
</style>
