<template>
  <div id="unit" class="flex-row">
    <div class="basic-main" @keyup.enter="search">
      <div class="flex">
        <div style="flex:1;" class="flex" v-if="!show">
          <criteria-paged :model="model" v-ref:paged @sort="sort">
            <criteria partial='criteria' @condition-changed='$parent.selfSearch' v-ref:cri>
              <div novalidate class="form-horizontal select-overspread container-fluid auto" partial>
                <div class="row">
                  <div class="col-sm-2 form-group" >
                    <label class="font_normal_body">客户编号</label>
                    <input  type="text" style="width:60%" class="input_search" v-model="model.f_userinfo_code"
                            condition="f_userinfo_code = '{}' " placeholder="客户编号">
                  </div>
                  <div class="col-sm-2 form-group" >
                    <label class="font_normal_body">客户名称</label>
                    <input  type="text" style="width:60%" class="input_search" v-model="model.f_user_name"
                            condition="f_user_name like '%{}%'" placeholder="客户名称">
                  </div>
                  <div class="col-sm-2 form-group">
                    <label class="font_normal_body">客户电话</label>
                    <input type="text" style="width:60%" class="input_search" v-model="model.f_user_phone"
                           condition="f_user_phone like '%{}%'" placeholder="客户电话">
                  </div>
                  <div class="col-sm-2 form-group">
                    <label class="font_normal_body" title="旧客户编号">档案编号</label>
                    <input type="text" style="width:60%" class="input_search" v-model="model.f_olduserinfo_code"
                           condition="f_olduserinfo_code = '{}' " placeholder="档案编号">
                  </div>
                  <div class="col-sm-2 form-group">
                    <label class="font_normal_body" title="旧客户编号">合同编号</label>
                    <input type="text" style="width:60%" class="input_search" v-model="model.f_contract_id"
                           condition="f_contract_id = '{}' " placeholder="合同编号">
                  </div>



                  <div class="span" style = "float:right;">
                    <button class="button_search button_spacing" v-show="false" @click="$parent.$parent.ReadIDCard()">读取身份证</button>
                    <read-card :is-single.sync="$parent.$parent.isSingleUser"  @read-info="$parent.$parent.cardBtn"  v-ref:readcard></read-card>
                    <button class="button_search button_spacing" @click="search()">查询</button>
                    <button class="button_clear button_spacing" @click="$parent.$parent.clear()">清空</button>
                    <!--<button class="btn btn-default" @click="$parent.$parent.stamp()">打印</button>-->

                    <export-excel :data="$parent.$parent.getCondition"
                                  :field="$parent.$parent.getExportField"         :defaultselect="$parent.$parent.defalutSelect"
                                  v-if="$parent.$parent.authArr.includes('档案查询导出')"
                                  sqlurl="api/af-revenue/logic/openapi/exportfile" sql-name="compreQuery" template-name='综合档案查询导出'  :choose-col="true"></export-excel>
                    <print-data :sum-field="$parent.$parent.getExportField" :model="$parent.model" :field="$parent.$parent.getExportField"
                                 :defaultfield="$parent.$parent.defaultfield"
                                titletable="综合档案查询"
                                :sumsmodel="$parent.$parent.sumsmodel"></print-data>
                    <div style="float: right"  class="button_spacing"
                         :class="{'button_shrink_top':$parent.$parent.criteriaShow,'button_shrink_bottom':!$parent.$parent.criteriaShow}"
                         @click="$parent.$parent.hidden()"></div>
                  </div>
                </div>

                <div class="row" v-show="$parent.$parent.criteriaShow">
                  <res-select-group :initres="$parent.$parent.initres" @re-res="$parent.$parent.getRes"></res-select-group>
                  <div class="col-sm-2 form-group">
                    <label class="font_normal_body">身份证号</label>
                    <input type="text" style="width:60%" class="input_search" v-model="model.f_idnumber"
                           condition="f_idnumber like '%{}%'" placeholder="身份证号">
                  </div>
                  <div class="col-sm-2 form-group" >
                    <label for="startDate" class="font_normal_body" title="建档开始日期">开始日期</label>
                    <datepicker id="startDate" placeholder="建档开始日期" style="width:60%"
                                v-model="model.startDate"
                                :value.sync="model.startDate"
                                :format="'yyyy-MM-dd'"
                                :show-reset-button="true"
                                condition="f_createfile_date >= '{} 00:00:00'">
                    </datepicker>
                  </div>
                  <div class="col-sm-2 form-group" >
                    <label for="endDate" class="font_normal_body" title="建档结束日期">结束日期</label>
                    <datepicker id="endDate" placeholder="建档结束日期" style="width:60%"
                                v-model="model.endDate"
                                :value.sync="model.endDate"
                                :format="'yyyy-MM-dd'"
                                :show-reset-button="true"
                                condition="f_createfile_date <= '{} 23:59:59'">
                    </datepicker>
                  </div>

                  <div class="col-sm-2 form-group" >
                    <label class="font_normal_body">客户状态</label>
                    <v-select :value.sync="model.f_user_state"
                              v-model="model.f_user_state"
                              multiple
                              :options='$parent.$parent.userstates' placeholder='请选择'
                              condition="f_user_state in {}"
                              ></v-select>
                  </div>
                  <div class="col-sm-2 form-group">
                    <label class="font_normal_body">人&emsp;&emsp;数</label>
                    <input type="text" style="width:60%" class="input_search" v-model="model.f_people_num"
                           condition="f_people_num = '{}'" placeholder="人数">
                  </div>
                  <div class="col-sm-2 form-group">
                    <label class="font_normal_body">客户地址</label>
                    <input type="text" style="width:60%" class="input_search" v-model="model.f_address"
                           condition="f_address like '%{}%'" placeholder='客户地址'>
                  </div>
                  <div class="col-sm-2 form-group">
                    <label for="startDate" class="font_normal_body">建档日期</label>
                    <datepicker placeholder="建档日期" style="width:60%"
                                v-model="model.f_createfile_date"
                                :value.sync="model.f_createfile_date"
                                :format="'yyyy-MM-dd'"
                                :show-reset-button="true"
                                condition="f_createfile_date >= '{} 00:00:00'">
                    </datepicker>
                  </div>
                  <div class="col-sm-2 form-group">
                    <label class="font_normal_body">建档部门</label>
                    <input type="text" style="width:60%" class="input_search" v-model="model.f_depname"
                           condition="f_depname like '%{}%'" placeholder='建档部门'>
                  </div>
                  <div class="col-sm-2 form-group">
                    <label class="font_normal_body">报警器编码</label>
                    <input type="text" style="width:60%" class="input_search" v-model="model.f_alarm_code"
                           condition="f_alarm_code like '%{}%'" placeholder='报警器编码'>
                  </div>
                  <div class="col-sm-2 form-group">
                    <label class="font_normal_body">发票编码</label>
                    <input type="text" style="width:60%" class="input_search" v-model="model.f_taxpayer_id"
                           condition="f_taxpayer_id like '%{}%'" placeholder='发票编码'>
                  </div>
                  <div class="col-sm-2 form-group">
                    <label class="font_normal_body">燃气表号</label>
                    <input type="text" style="width:60%" class="input_search" v-model="model.f_meternumber"
                           condition="f_meternumber = '{}'" placeholder='燃气表号'>
                  </div>

                  <div class="col-sm-2 form-group">
                    <label class="font_normal_body">气表分类</label>
                    <v-select :value.sync="model.f_meter_classify"
                              v-model="model.f_meter_classify"  multiple
                              :options='$parent.$parent.metertypes' placeholder='请选择'
                              condition="f_meter_classify in {}"
                              ></v-select>
                  </div>

                  <div class="col-sm-2 form-group">
                    <label class="font_normal_body">气表品牌</label>
                    <v-select :value.sync="model.f_meter_brand"
                              v-model="model.f_meter_brand" multiple
                              @change="$parent.$parent.getMeterStyle"
                              :options='$parent.$parent.meterbrands' placeholder='请选择'
                              condition="f_meter_brand in {}"
                    ></v-select>
                  </div>

                  <div class="col-sm-2 form-group">
                    <label class="font_normal_body">气表型号</label>
                    <v-select :value.sync="model.f_meter_style"
                              v-model="model.f_meter_style" multiple
                              :options='$parent.$parent.meterStyle' placeholder='请选择'
                              condition="f_meter_style in {}"
                    ></v-select>
                  </div>
                  <div class="col-sm-2 form-group">
                    <label class="font_normal_body">表&emsp;&emsp;号</label>
                    <input type="text" style="width:60%" class="input_search" v-model="model.f_meter_number"
                           condition="f_meternumber = '{}'" placeholder='表号'>
                  </div>
                  <div class="col-sm-2 form-group">
                    <label class="font_normal_body">气表封号</label>
                    <input type="text" style="width:60%" class="input_search" v-model="model.f_metertitles"
                           condition="f_metertitles = '{}'" placeholder='气表封号'>
                  </div>
                  <div class="col-sm-2 form-group">
                    <label class="font_normal_body">卡&emsp;&emsp;号</label>
                    <input type="text" style="width:60%" class="input_search" v-model="model.f_card_id"
                           condition="f_card_id = '{}'" placeholder='卡号'>
                  </div>
                  <div class="col-sm-2 form-group">
                    <label class="font_normal_body">客户类型</label>
                    <v-select :value.sync="model.f_user_type"
                              :options='$parent.$parent.usertypes'
                              @change="$parent.$parent.userTypeChange()"
                              placeholder='请选择' v-model="model.f_user_type"
                              condition="f_user_type = '{}'"
                              close-on-select></v-select>
                  </div>
                  <div class="col-sm-2 form-group" >
                      <label for="startDate1" class="font_normal_body" title="抄表开始日期">抄表日期</label>
                      <datepicker id="startDate1" placeholder="开始日期" style="width:60%"
                                  v-model="model.startDate1"
                                  :value.sync="model.startDate1"
                                  :format="'yyyy-MM-dd'"
                                  :show-reset-button="true"
                                  condition="f_hand_date >= '{} 00:00:00'">
                      </datepicker>
                    </div>
                    <div class="col-sm-2 form-group" >
                      <label for="endDate1" class="font_normal_body" title="抄表结束日期">抄表日期</label>
                      <datepicker id="endDate1" placeholder="结束日期" style="width:60%"
                                  v-model="model.endDate1"
                                  :value.sync="model.endDate1"
                                  :format="'yyyy-MM-dd'"
                                  :show-reset-button="true"
                                  condition="f_hand_date <= '{} 23:59:59'">
                      </datepicker>
                    </div>
                  <div class="col-sm-2 form-group">
                    <label class="font_normal_body">街&ensp;&ensp;&ensp;&ensp;道</label>
                    <input type="text" style="width:60%" class="input_search" v-model="model.f_street"
                           condition="f_street like '%{}%'" placeholder='街道'>
                  </div>
                  <div class="col-sm-2 form-group">
                    <label class="font_normal_body">小&emsp;&emsp;区</label>
                    <v-select :value.sync="model.f_residential_area"
                              class="select_list select"
                              enter-push
                              multiple
                              condition="f_residential_area in {}"
                              v-model="model.f_residential_area"
                              style="width: 60%"
                              :options='$parent.$parent.residentialArea' placeholder='选择小区'
                              >

                    </v-select>
                  </div>
                  <div class="col-sm-2 form-group" >
                    <label class="font_normal_body">楼&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;号</label>
                    <input  type="text" style="width:60%" class="input_search" v-model="model.f_building"
                            condition="f_building = '{}'" placeholder='楼号'>
                  </div>
                  <div class="col-sm-2 form-group" >
                    <label class="font_normal_body">单&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;元</label>
                    <input  type="text" style="width:60%" class="input_search" v-model="model.f_unit"
                            condition="f_unit = '{}'" placeholder='单元号'>
                  </div>

                  <div class="col-sm-2 form-group" >
                    <label class="font_normal_body">楼&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;层</label>
                    <input  type="text" style="width:60%" class="input_search" v-model="model.f_floor"
                            condition="f_floor = '{}'" placeholder='楼层号'>
                  </div>
                  <div class="col-sm-2 form-group" >
                    <label class="font_normal_body">门&ensp;牌&ensp;号</label>
                    <input  type="text" style="width:60%" class="input_search" v-model="model.f_room"
                            condition="f_room = '{}'"  placeholder='门牌号'>
                  </div>
                  <div class="col-sm-2 form-group">
                    <label class="font_normal_body">余额区间</label>
                    <input type="text" style="width:60%" class="input_search" v-model="model.f_balance"
                           condition="f_balance >= '{}'" placeholder="最小值">
                  </div>
                  <div class="col-sm-2 form-group">
                    <label class="font_normal_body">&ensp;&ensp;&ensp;至&ensp;&ensp;&ensp;</label>
                    <input type="text" style="width:60%" class="input_search" v-model="model.balance2"
                           condition="f_balance <= '{}'" placeholder="最大值">
                  </div>
                  <div class="col-sm-2 form-group" >
                    <label class="font_normal_body">用&ensp;气&ensp;点</label>
                    <input  type="text" style="width:60%" class="input_search" v-model="model.f_userfiles_address"
                            condition="f_userfiles_address like '%{}%'" placeholder="用气点">
                  </div>
<!--                  <div class="col-sm-2 form-group">-->
<!--                    <label class="font_normal_body">用气性质</label>-->
<!--                    <v-select :value.sync="model.f_gasproperties" v-model="model.f_gasproperties"-->
<!--                              :options='$parent.$parent.gasproperties' placeholder='请选择'-->
<!--                              condition="f_gasproperties in {}"-->
<!--                              ></v-select>-->
<!--                  </div>-->
                  <div class="col-sm-2 form-group">
                    <label class="font_normal_body">用气性质</label>
                    <v-select :value.sync="model.f_gasproperties" v-model="model.f_gasproperties"
                              :options='$parent.$parent.gasproperties' placeholder='请选择'
                              condition="f_gasproperties = '{}'"
                              close-on-select></v-select>
                  </div>
                  <div class="col-sm-2 form-group">
                    <label class="font_normal_body">气价类型</label>
                    <v-select :value.sync="model.pricetype" v-model="model.pricetype"
                              placeholder='气价类型' :options="$parent.$parent.pricetypes"
                              condition="f_price_type = '{}'"  @change="$parent.$parent.pricetypechanged"
                              close-on-select v-ref:type>
                    </v-select>
                  </div>
                  <div class="col-sm-2 form-group">
                    <label class="font_normal_body">气价名称</label>
                    <v-select :value.sync="model.f_price_name" v-model="model.f_price_name"
                              multiple
                              :options="$parent.$parent.pricenames" placeholder='气价名称'
                              condition="f_price_name in {}"
                               ></v-select>
                  </div>
                  <div class="col-sm-2 form-group" >
                    <label class="font_normal_body">微信绑定</label>
                    <v-select :value.sync="model.f_isband"
                              v-model="model.f_isband"
                              :options='$parent.$parent.bandstates' placeholder='请选择'
                              condition="f_isband = '{}'"
                              close-on-select></v-select>
                  </div>
                  <div class="col-sm-2 form-group">
                    <label class="font_normal_body">壁&ensp;挂&ensp;炉</label>
                    <v-select :value.sync="model.isbgl" v-model="model.isbgl"
                              :options='$parent.$parent.bgl' placeholder='请选择'
                              condition="isbgl = '{}'"
                              close-on-select></v-select>
                  </div>
                  <div class="col-sm-2 form-group">
                    <label class="font_normal_body">发卡状态</label>
                    <v-select :value.sync="model.whetherhairpin" v-model="model.whetherhairpin"
                              :options='$parent.$parent.whetherCard' placeholder='请选择'
                              condition="f_whether_hairpin = '{}'"
                              close-on-select></v-select>
                  </div>
                  <div class="col-sm-2 form-group">
                    <label class="font_normal_body">安装位置</label>
                    <v-select :value.sync="model.f_position" v-model="model.f_position"
                              :options='$parent.$parent.positions' placeholder='请选择'
                              condition="f_position = '{}'"
                              close-on-select></v-select>
                  </div>

                  <!--表册片区-->
                  <div class="col-sm-2 form-group">
                    <label class="font_normal_body">表册片区</label>
                    <v-select :value.sync="model.f_book_slice_area" v-model="model.f_book_slice_area"
                              @change="$parent.$parent.inputtorchange"
                              :options='$parent.$parent.bookSlice' placeholder='片区/表册'
                              style="width:60%"
                              close-on-select
                              condition="f_book_slice_area = '{}'"></v-select>
                  </div>
                  <div class="col-sm-2 form-group">
                    <label class="font_normal_body">抄&ensp;表&ensp;册</label>
                    <v-select :value.sync="model.f_meter_book" v-model="model.f_meter_book"
                              :options='$parent.$parent.meterbooks' placeholder='请选择'
                              style="width:60%"
                              close-on-select
                              condition="f_meter_book_num = '{}'"></v-select>
                  </div>
                  <div class="col-sm-2 form-group">
                    <label class="font_normal_body">房屋类型</label>
                    <v-select :value.sync="model.f_house_type" v-model="model.f_house_type"
                              :options='$parent.$parent.houseTypes' placeholder='请选择'
                              style="width:60%"
                              close-on-select
                              condition="f_house_type = '{}'"></v-select>
                  </div>
                  <div class="col-sm-2 form-group">
                    <label class="font_normal_body" >缴费类型</label>
                    <v-select :value.sync="model.f_payment" multiple
                              v-model="model.f_payment"
                              :options='$parent.$parent.dypayment' placeholder='请选择'
                              condition="f_cost_type in {}"
                              ></v-select>
                  </div>
                  <div class="col-sm-2 form-group" >
                    <label for="startDate2" class="font_normal_body" title="开户时间">开户时间</label>
                    <datepicker id="startDate2" placeholder="开始日期" style="width:60%"
                                v-model="model.startDate2"
                                :value.sync="model.startDate2"
                                :format="'yyyy-MM-dd'"
                                :show-reset-button="true"
                                condition="f_open_date >= '{} 00:00:00'">
                    </datepicker>
                  </div>
                  <div class="col-sm-2 form-group" >
                    <label for="endDate2" class="font_normal_body" title="开户时间">开户时间</label>
                    <datepicker id="endDate2" placeholder="结束日期" style="width:60%"
                                v-model="model.endDate2"
                                :value.sync="model.endDate2"
                                :format="'yyyy-MM-dd'"
                                :show-reset-button="true"
                                condition="f_open_date <= '{} 23:59:59'">
                    </datepicker>
                  </div>
                  <div class="col-sm-2 form-group" >
                    <label for="startDate3" class="font_normal_body" title="安装日期">安装日期</label>
                    <datepicker id="startDate3" placeholder="开始日期" style="width:60%"
                                v-model="model.startDate3"
                                :value.sync="model.startDate3"
                                :format="'yyyy-MM-dd'"
                                :show-reset-button="true"
                                condition="f_install_date >= '{} 00:00:00'">
                    </datepicker>
                  </div>
                  <div class="col-sm-2 form-group" >
                    <label for="endDate3" class="font_normal_body" title="安装日期">安装日期</label>
                    <datepicker id="endDate3" placeholder="结束日期" style="width:60%"
                                v-model="model.endDate3"
                                :value.sync="model.endDate3"
                                :format="'yyyy-MM-dd'"
                                :show-reset-button="true"
                                condition="f_install_date <= '{} 23:59:59'">
                    </datepicker>
                  </div>
                  <div class="col-sm-2 form-group" >
                    <label for="endDate4" class="font_normal_body" title="点火时间">点火时间</label>
                    <datepicker id="endDate4" placeholder="开始日期" style="width:60%"
                                v-model="model.startDate4"
                                :value.sync="model.startDate4"
                                :format="'yyyy-MM-dd'"
                                :show-reset-button="true"
                                condition="f_gas_date >= '{} 00:00:00'">
                    </datepicker>
                  </div>
                  <div class="col-sm-2 form-group" >
                    <label for="endDate4" class="font_normal_body" title="点火时间">点火时间</label>
                    <datepicker id="endDate4" placeholder="结束日期" style="width:60%"
                                v-model="model.endDate4"
                                :value.sync="model.endDate4"
                                :format="'yyyy-MM-dd'"
                                :show-reset-button="true"
                                condition="f_gas_date <= '{} 23:59:59'">
                    </datepicker>
                  </div>
                  <div class="col-sm-2 form-group" >
                    <label for="startDate5" class="font_normal_body" title="预约通气时间">预约时间</label>
                    <datepicker id="startDate5" placeholder="开始日期" style="width:60%"
                                v-model="model.startDate5"
                                :value.sync="model.startDate5"
                                :format="'yyyy-MM-dd'"
                                :show-reset-button="true"
                                condition="f_subscribe_date >= '{} 00:00:00'">
                    </datepicker>
                  </div>
                  <div class="col-sm-2 form-group" >
                    <label for="endDate5" class="font_normal_body" title="预约通气时间">预约时间</label>
                    <datepicker id="endDate5" placeholder="结束日期" style="width:60%"
                                v-model="model.endDate5"
                                :value.sync="model.endDate5"
                                :format="'yyyy-MM-dd'"
                                :show-reset-button="true"
                                condition="f_subscribe_date <= '{} 23:59:59'">
                    </datepicker>
                  </div>
                  <div class="col-sm-2 form-group" >
                    <label class="font_normal_body">气表表号</label>
                    <input  type="text" style="width:60%" class="input_search" v-model="model.f_meternumber"
                            condition="f_meternumber like '%{}%'" placeholder='气表表号'>
                  </div>
                  <div class="col-sm-2 form-group">
                    <label class="font_normal_body">使用类型</label>
                    <v-select :value.sync="model.f_usetype" v-model="model.f_usetype"
                              :options='$parent.$parent.useTypes' placeholder='请选择'
                              style="width:60%"
                              close-on-select
                              condition="f_usetype = '{}'"></v-select>
                  </div>
                  <div class="col-sm-2 form-group">
                    <label class="font_normal_body">表具状态</label>
                    <v-select :value.sync="model.f_table_state" v-model="model.f_table_state"
                              multiple
                              :options='$parent.$parent.TableStates' placeholder='请选择'
                              style="width:60%"
                              condition="f_table_state in {}"></v-select>
                  </div>
                  <div class="col-sm-2 form-group">
                    <label class="font_normal_body">表册抄表员</label>
                    <v-select :value.sync="model.f_book_inputtor" v-model='model.f_book_inputtor'
                              style="width:60%"
                              multiple
                              :options='$parent.$parent.inputtores' placeholder='表册抄表员'
                              v-el:cc></v-select>
                  </div>
                  <div class="col-sm-2 form-group">
                    <label class="font_normal_body">档案抄表员</label>
                    <v-select :value.sync="model.f_inputtor" v-model='model.f_inputtor'
                              style="width:60%"
                              multiple
                              :options='$parent.$parent.inputtores' placeholder='档案抄表员'
                              v-el:cc></v-select>
                  </div>
                  <div class="col-sm-2 form-group">
                    <label class="font_normal_body">安&ensp;装&ensp;人</label>
                    <v-select :value.sync="model.f_install_person" v-model='model.f_install_person'
                              style="width:60%"
                              multiple
                              :options='$parent.$parent.person' placeholder='安装人'
                              condition="f_install_person in {}"
                              v-el:cc></v-select>
                  </div>
                  <div class="col-sm-2 form-group">
                    <label class="font_normal_body">自动阀控</label>
                    <v-select
                      placeholder='自动阀控'

                      :value.sync="model.f_network_valve"
                      style="width:60%"
                      v-model="model.f_network_valve"
                      :options='$parent.$parent.networkvalves'
                      close-on-select
                      condition="f_network_valve='{}'">
                    </v-select>
                  </div>
                  <div class="col-sm-2 form-group">
                    <label class="font_normal_body">阀门状态</label>
                    <v-select
                      placeholder='阀门状态'
                      :value.sync="model.f_valve_state"
                      style="width:60%"
                      v-model="model.f_valve_state"
                      :options='$parent.$parent.valvestate'
                      close-on-select
                      condition="f_valve_state='{}'">
                    </v-select>
                  </div>
                </div>
              </div>
            </criteria>

            <data-grid  :model="model" partial='list' class="list_area table_sy"  v-ref:grid>
              <template partial='head'>
                <tr>
                  <th rowspan="2">
                    <nobr>序号</nobr>
                  </th>
                  <th colspan="6">
                    <nobr>用户信息</nobr>
                  </th>
                  <th colspan="5">
                    <nobr>建档信息</nobr>
                  </th>
                  <th colspan="6">
                    <nobr>燃气表</nobr>
                  </th>
                  <th colspan="68">
                    <nobr>其他</nobr>
                  </th>
                </tr>
                <tr>
                  <th>
                    <!--<nobr>客户编号</nobr>-->
                    <data-order field="f_userinfo_code" name="客户编号" :order.sync="$parent.$parent.$parent.orderFields.f_userinfo_code"></data-order>
                  </th>
                  <th>
                    <nobr>小区名称</nobr>
                  </th>
                  <th>
                    <nobr>户主姓名</nobr>
                  </th>
                  <th>
                    <nobr>身份证号</nobr>
                  </th>
                  <th>
                    <nobr>详细地址</nobr>
                  </th>
                  <th>
                    <nobr>联系电话</nobr>
                  </th>
                  <th>
                    <nobr>建档日期</nobr>
                  </th>
                  <th>
                    <nobr>供气合同编号</nobr>
                  </th>
                  <th>
                    <nobr>通气日期</nobr>
                  </th>
                  <th>
                    <nobr>通气人员</nobr>
                  </th>
                  <th>
                    <nobr>防盗卡号</nobr>
                  </th>
                  <th>
                    <nobr>品牌</nobr>
                  </th>
                  <th>
                    <nobr>表号</nobr>
                  </th>
                  <th>
                    <nobr>类型</nobr>
                  </th>
                  <th>
                    <nobr>型号</nobr>
                  </th>
                  <th>
                    <nobr>表向</nobr>
                  </th>
                  <th>
                    <nobr>生产年月</nobr>
                  </th>
                  <th><nobr>客户状态</nobr></th>

                  <th><nobr>档案编号</nobr></th>
                  <th><nobr>是否发卡</nobr></th>
                  <th><nobr>卡号</nobr></th>
                  <!--                  <th><nobr>客户名称</nobr></th>-->
                  <!--                  <th><nobr>小区名称</nobr></th>-->
                  <th><nobr>楼栋</nobr></th>
                  <th><nobr>单元</nobr></th>
                  <th><nobr>楼层</nobr></th>
                  <th><nobr>门牌号</nobr></th>
                  <!--                  <th>-->
                  <!--                    <data-order field="f_userinfo_code" name="客户地址"-->
                  <!--                                :order.sync="$parent.$parent.$parent.orderFields.f_address"></data-order>-->
                  <!--                  </th>-->
                  <!--                  <th><nobr>客户电话</nobr></th>-->
                  <th><nobr>表册片区</nobr></th>
                  <!--                  <th>-->
                  <!--                    &lt;!&ndash;<nobr>通气日期</nobr>&ndash;&gt;-->
                  <!--                    <data-order field="f_gas_date" name="通气日期" :order.sync="$parent.$parent.$parent.orderFields.f_gas_date"></data-order>-->
                  <!--                  </th>-->
                  <!-- 气价类型,单价暂时未处理 -->
                  <th><nobr>气价类型</nobr></th>
                  <th><nobr>气价名称</nobr></th>
                  <th><nobr>单价</nobr></th>

                  <th><nobr>安装位置</nobr></th>
                  <th><nobr>缴费类型</nobr></th>
                  <!--                  <th><nobr>气表类型</nobr></th>-->
                  <!--                  <th><nobr>气表品牌</nobr></th>-->
                  <!--                  <th><nobr>表号</nobr></th>-->
                  <th><nobr>表封号</nobr></th>
                  <!--                  <th><nobr>左右表</nobr></th>-->
                  <th>
                    <!--<nobr>气表安装日期</nobr>-->
                    <data-order field="f_install_date" name="气表安装日期" :order.sync="$parent.$parent.$parent.orderFields.f_install_date"></data-order>
                  </th>
                  <th><nobr>气表底数</nobr></th>
                  <th><nobr>账户余额</nobr></th>
                  <th>
                    <!--<nobr>最后抄表日期</nobr>-->
                    <data-order field="f_hand_date" name="最后抄表日期" :order.sync="$parent.$parent.$parent.orderFields.f_hand_date"></data-order>
                  </th>
                  <th><nobr>最后购气量</nobr></th>
                  <th><nobr>最后购气金额</nobr></th>
                  <th><nobr>最后购气日期</nobr></th>

                  <th><nobr>自动阀控</nobr></th>
                  <th><nobr>阀门状态</nobr></th>

                  <!--                  <th><nobr>旧客户编号</nobr></th> -->
                  <th><nobr>客户类型</nobr></th>
                  <th><nobr>用气性质</nobr></th>
                  <th>
                    <!--<nobr>开户时间</nobr>-->
                    <data-order field="f_open_date" name="开户时间" :order.sync="$parent.$parent.$parent.orderFields.f_open_date"></data-order>

                  </th>
                  <th><nobr>证件类型</nobr></th>
                  <!--                  <th><nobr>证件号码</nobr></th>-->
                  <th><nobr>人口数</nobr></th>
                  <th>
                    <!--<nobr>保险结束日期</nobr>-->
                    <data-order field="f_ins_stop_date" name="保险结束日期" :order.sync="$parent.$parent.$parent.orderFields.f_ins_stop_date"></data-order>
                  </th>
                  <!--                  <th>-->
                  <!--                    &lt;!&ndash;<nobr>建档日期</nobr>&ndash;&gt;-->
                  <!--                    <data-order field="f_createfile_date" name="建档日期" :order.sync="$parent.$parent.$parent.orderFields.f_createfile_date"></data-order>-->
                  <!--                  </th>-->
                  <th><nobr>建档人</nobr></th>
                  <th><nobr>所属营业厅</nobr></th>
<!--                  <th><nobr>备注信息</nobr></th>-->

                  <!--                  <th><nobr>气价详情</nobr></th>-->
                  <th><nobr>曾用名</nobr></th>
                  <th><nobr>备用电话</nobr></th>
                  <th><nobr>租户姓名</nobr></th>
                  <th><nobr>租户电话</nobr></th>
                  <!--<th><nobr>曾用名</nobr></th>-->
<!--                  <th><nobr>发票编码</nobr></th>-->
                  <th><nobr>是否煤改气</nobr></th>
                  <th><nobr>是否发放天然气使用证</nobr></th>

                  <th><nobr>使用类型</nobr></th>

                  <!--                  <th><nobr>使用状态</nobr></th>-->
                  <!--<th><nobr>通气时间</nobr></th>-->

<!--                  <th><nobr>气表型号</nobr></th>-->
                  <th><nobr>预约通气时间</nobr></th>
                  <th><nobr>表具状态</nobr></th>
                  <th><nobr>初始气表底数</nobr></th>
                  <th><nobr>累计用气金额</nobr></th>
                  <th><nobr>表累购气量</nobr></th>
                  <th><nobr>表累购金额</nobr></th>

                  <th><nobr>用户总购气量</nobr></th>
                  <th><nobr>用户总购金额</nobr></th>

                  <th><nobr>抄表员(表册)</nobr></th>
                  <th><nobr>抄表员(档案)</nobr></th>
                  <th><nobr>用气点</nobr></th>
                  <th><nobr>安装人</nobr></th>
<!--                  <th><nobr>通气人</nobr></th>-->
                  <!--                  <th><nobr>点火状态</nobr></th>-->
                  <th><nobr>表册名称</nobr></th>
                  <th><nobr>抄表册编号</nobr></th>

                  <th><nobr>抄表册顺序</nobr></th>
                  <th><nobr>表剩余金额</nobr></th>
                  <!--                  <th><nobr>首次购气日期</nobr></th>-->
                  <th><nobr>写卡次数</nobr></th>
                  <th><nobr>补卡次数</nobr></th>
                  <!--                  <th><nobr>购气次数</nobr></th>-->

                  <th><nobr>表同步状态</nobr></th>
                  <th><nobr>微信绑定</nobr></th>

                  <th>
                    <nobr>银行户名</nobr>
                  </th>
                  <th>
                    <nobr>银行名称</nobr>
                  </th>
                  <th>
                    <nobr>银行账号</nobr>
                  </th>
                  <th>
                    <nobr>银行身份证号</nobr>
                  </th>
                  <th>
                    <nobr>缴费编号</nobr>
                  </th>
                  <th>
                    <nobr>报警器编号</nobr>
                  </th>
                  <th>
                    <!--<nobr>换表时间</nobr>-->
                    <data-order field="f_maxdate" name="换表时间" :order.sync="$parent.$parent.$parent.orderFields.f_maxdate"></data-order>
                  </th>
                  <th>
                    <nobr>灶具信息</nobr>
                  </th>
                  <th>
                    <nobr>备注</nobr>
                  </th>
                </tr>
              </template>
              <template partial='body'>
                <td style="text-align: center;"><nobr>{{$index + 1}}</nobr></td>
                <td style="text-align: center;"><nobr>{{row.f_userinfo_code}}</nobr></td>
                <td style="text-align: center;"><nobr>{{row.f_residential_area}}</nobr></td>
                <td style="text-align: center;"><nobr>{{row.f_user_name}}</nobr></td>
                <td style="text-align: center;"><nobr>{{row.f_idnumber}}</nobr></td>
                <td style="text-align: center;"><nobr>{{row.f_address}}</nobr></td>
                <td style="text-align: center;"><nobr>{{row.f_user_phone}}</nobr></td>
                <td style="text-align: center;"><nobr>{{row.f_createfile_date}}</nobr></td>
                <td style="text-align: center;"><nobr>{{row.f_contract_id}}</nobr></td>
                <td style="text-align: center;"><nobr>{{row.f_gas_date}}</nobr></td>
                <td style="text-align: center;"><nobr>{{row.f_gas_person}}</nobr></td>
                <td style="text-align: center;"><nobr>{{row.f_defendcard}}</nobr></td>
                <td style="text-align: center;"><nobr>{{row.f_meter_brand}}</nobr></td>
                <td style="text-align: center;"><nobr>{{row.f_meternumber}}</nobr></td>
                <td style="text-align: center;"><nobr>{{row.f_meter_type}}</nobr></td>
                <td style="text-align: center;"><nobr>{{row.f_meter_style}}</nobr></td>
                <td style="text-align: center;"><nobr>{{row.f_aroundmeter}}</nobr></td>
                <td style="text-align: center;"><nobr>{{row.f_factory_date}}</nobr></td>
<!--                <td style="text-align: center;"><nobr>-->
<!--                <span @click="$parent.$parent.$parent.showmsg(row)"><a>{{row.f_userinfo_code}}</a></span>-->
<!--                </nobr> </td>-->
                <td style="text-align: center;"><nobr>{{row.f_user_state}}</nobr></td>
                <td style="text-align: center;"><nobr>{{row.f_olduserinfo_code}}</nobr></td>
                <td style="text-align: center;"><nobr>{{row.f_whether_hairpin}}</nobr></td>
                <td style="text-align: center;"><nobr>{{row.f_card_id}}</nobr></td>
<!--                <td style="text-align: center;"><nobr>{{row.f_user_name}}</nobr></td>-->
<!--                <td style="text-align: center;"><nobr>{{row.f_residential_area}}</nobr></td>-->
                <td style="text-align: center;"><nobr>{{row.f_building}}</nobr></td>
                <td style="text-align: center;"><nobr>{{row.f_unit}}</nobr></td>
                <td style="text-align: center;"><nobr>{{row.f_floor}}</nobr></td>
<!--                <td style="text-align: center;"><nobr>{{row.f_address}}</nobr></td>-->
                <td style="text-align: center;"><nobr>{{row.f_room}}</nobr></td>
<!--                <td style="text-align: center;"><nobr>{{row.f_user_phone}}</nobr></td>-->
                <td style="text-align: center;"><nobr>{{row.f_book_slice_area}}</nobr></td>
<!--                <td style="text-align: center;"><nobr>{{row.f_gas_date}}</nobr></td>-->
                <!-- 气价类型,单价暂时未处理 -->
                <td style="text-align: center;"><nobr>&nbsp;&nbsp;</nobr></td>
                <td style="text-align: center;"><nobr>{{row.f_price_name}}</nobr></td>
                <td style="text-align: center;"><nobr>{{row.value}}</nobr></td>

                <td style="text-align: center;"><nobr>{{row.f_position}}</nobr></td>
                <td style="text-align: center;"><nobr>{{row.f_cost_type}}</nobr></td>
<!--                <td style="text-align: center;"><nobr>{{row.f_meter_type}}</nobr></td>-->
<!--                <td style="text-align: center;"><nobr>{{row.f_meter_brand}}</nobr></td>-->
<!--                <td style="text-align: center;"><nobr>{{row.f_meternumber}}</nobr></td>-->
                <td style="text-align: center;"><nobr>{{row.f_metertitles}}</nobr></td>
<!--                <td style="text-align: center;"><nobr>{{row.f_aroundmeter}}</nobr></td>-->
                <td style="text-align: center;"><nobr>{{row.f_install_date}}</nobr></td>
                <td style="text-align: center;"><nobr>{{row.f_meter_base}}</nobr></td>
                <td style="text-align: center;"><nobr>{{row.f_balance}}</nobr></td>
                <td style="text-align: center;"><nobr>{{row.f_hand_date}}</nobr></td>
                <td style="text-align: center;"><nobr>{{row.latest_f_pregas}}</nobr></td>
                <td style="text-align: center;"><nobr>{{row.latest_f_collection}}</nobr></td>
                <td style="text-align: center;"><nobr>{{row.f_max_operate_date}}</nobr></td>
                <td style="text-align: center;"><nobr>{{row.f_network_valve}}</nobr></td>
                <td style="text-align: center;"><nobr>{{row.f_valve_state}}</nobr></td>

                <!-- <td style="text-align: center;"><nobr>{{row.f_olduserinfo_code}}</nobr></td>-->
                <td style="text-align: center;"><nobr>{{row.f_user_type}}</nobr></td>
                <td style="text-align: center;"><nobr>{{row.f_gasproperties}}</nobr></td>

                <td style="text-align: center;"><nobr>{{row.f_open_date}}</nobr></td>
                <td style="text-align: center;"><nobr>{{row.f_credentials}}</nobr></td>
<!--                <td style="text-align: center;"><nobr>{{row.f_idnumber}}</nobr></td>-->
                <td style="text-align: center;"><nobr>{{row.f_people_num}}</nobr></td>
                <td style="text-align: center;"><nobr>{{row.f_ins_stop_date}}</nobr></td>
<!--                <td style="text-align: center;"><nobr>{{row.f_createfile_date}}</nobr></td>-->
                <td style="text-align: center;"><nobr>{{row.f_createfile_person}}</nobr></td>
                <td style="text-align: center;"><nobr>{{row.f_depname}}</nobr></td>
<!--                <td style="text-align: center;"><nobr>{{row.f_comments}}</nobr></td>-->

                <!-- <td style="text-align: center;"><nobr>{{row.value}}</nobr></td>-->
                <td style="text-align: center;"><nobr>{{row.f_used_name}}</nobr></td>
                <td style="text-align: center;"><nobr>{{row.f_rent_phone}}</nobr></td>
                <td style="text-align: center;"><nobr>{{row.f_rent_name}}</nobr></td>
                <td style="text-align: center;"><nobr>{{row.f_zuhu_phone}}</nobr></td>
<!--                <td style="text-align: center;"><nobr>{{row.f_contract_id}}</nobr></td>-->
                <td style="text-align: center;"><nobr>{{row.f_is_mgq}}</nobr></td>
                <td style="text-align: center;"><nobr>{{row.f_send_usegas_card}}</nobr></td>

                <td style="text-align: center;"><nobr>{{row.f_usetype}}</nobr></td>
                <!--                <td style="text-align: center;"><nobr>{{row.f_usestate}}</nobr></td>-->
                <!--<td style="text-align: center;"><nobr>{{row.f_people_num}}</nobr></td>-->

<!--                <td style="text-align: center;"><nobr>{{row.f_meter_style}}</nobr></td>-->
                <td style="text-align: center;"><nobr>{{row.f_subscribe_date}}</nobr></td>
                <td style="text-align: center;"><nobr>{{row.f_table_state}}</nobr></td>
                <td style="text-align: center;"><nobr>{{row.f_initial_base}}</nobr></td>
                <td style="text-align: center;"><nobr>{{row.f_total_usegas_amount}}</nobr></td>
                <td style="text-align: center;"><nobr>{{row.f_total_gas}}</nobr></td>
                <td style="text-align: center;"><nobr>{{row.f_total_fee}}</nobr></td>
                <td style="text-align: center;"><nobr>{{row.f_user_total_gas}}</nobr></td>
                <td style="text-align: center;"><nobr>{{row.f_user_total_fee}}</nobr></td>
                <td style="text-align: center;"><nobr>{{row.f_book_inputtor}}</nobr></td>
                <td style="text-align: center;"><nobr>{{row.f_inputtor}}</nobr></td>

                <td style="text-align: center;"><nobr>{{row.f_userfiles_address}}</nobr></td>
                <td style="text-align: center;"><nobr>{{row.f_install_person}}</nobr></td>
<!--                <td style="text-align: center;"><nobr>{{row.f_gas_person}}</nobr></td>-->
                <!--                <td style="text-align: center;"><nobr>{{row.f_fire_state}}</nobr></td>-->
                <td style="text-align: center;"><nobr>{{row.f_book_name}}</nobr></td>
                <td style="text-align: center;"><nobr>{{row.f_meter_book_num}}</nobr></td>

                <td style="text-align: center;"><nobr>{{row.f_meter_book_sort}}</nobr></td>
                <td style="text-align: center;"><nobr>{{row.f_balance_amount}}</nobr></td>
                <!--                <td style="text-align: center;"><nobr>{{row.f_min_operate_date}}</nobr></td>-->
                <td style="text-align: center;"><nobr>{{row.f_times}}</nobr></td>
                <td style="text-align: center;"><nobr>{{row.f_fillcard_times}}</nobr></td>
                <!--                <td style="text-align: center;"><nobr>{{row.f_sell_number}}</nobr></td>-->
                <td style="text-align: center;"><nobr>{{row.f_sendsuccess}}</nobr></td>
                <td style="text-align: center;"><nobr>{{row.f_isband}}</nobr></td>

                <td  style="text-align: center;">
                  <nobr><span v-if="row.f_cost_type =='银行代扣'">{{row.f_bank_accopen}}</span></nobr>
                </td>
                <td  style="text-align: center;">
                  <nobr><span v-if="row.f_cost_type =='银行代扣'">{{row.f_bank_name}}</span></nobr>
                </td>
                <td style="text-align: center;">
                  <nobr><span v-if="row.f_cost_type =='银行代扣'">{{row.f_bank_account}}</span></nobr>
                </td>
                <td :class="row.f_user_state !== '正常'? 'back-red' : 'back-blue'" style="text-align: center;">
                  <nobr><span v-if="row.f_cost_type =='银行代扣'">{{row.f_bank_idnumber}}</span></nobr>
                </td>
                <td style="text-align: center;">
                  <nobr><span v-if="row.f_cost_type =='银行代扣'">{{row.f_bank_pay_number}}</span></nobr>
                </td>
                <td style="text-align: center;"><nobr>{{row.f_alarm_code}}</nobr></td>
                <td style="text-align: center;"><nobr>{{row.f_maxdate}}</nobr></td>
                <td style="text-align: center;"><nobr>{{row.f_devices_type}}</nobr></td>
                <td style="text-align: center;"><nobr>{{row.f_comments}}</nobr></td>
              </template>
              <template partial='foot'>

              </template>
            </data-grid>
          </criteria-paged>

          <table class="table-hover">
            <tr style="position: relative" class="table-bordered">
              <td style="display: inline-block;width: auto;border-right: 1px solid #F2F6FA;padding: 0px 10px 0px 10px;color: #5CB95C;font-weight: bold">汇总信息</td>
              <td style="display: inline-block;width: auto;border-right: 1px solid #F2F6FA;padding: 0px 10px 0px 10px;color: #5CB95C;font-weight: bold">已挂表:{{sumsmodel.f_yiguabiao}}</td>
              <td style="display: inline-block;width: auto;border-right: 1px solid #F2F6FA;padding: 0px 10px 0px 10px;color: #5CB95C;font-weight: bold">未挂表:{{sumsmodel.f_weiguabiao}}</td>
            </tr>
          </table>

          <modal :show.sync="printshow" v-ref:modal backdrop="false">
            <header slot="modal-header" class="modal-header text-center">
              <h4 class="modal-title">打印列选择</h4>
              <input type="checkbox" class="" id="f_generations" v-model="all">
              <label for="f_generations" class="font-size">全选</label>
            </header>
            <article slot="modal-body">
              <div class="auto col-sm-11 col-md-offset-1"  style="margin-top: 10px;">
                <div class="col-sm-3" v-for="f in fields">
                  <input type="checkbox" class="" :id="'water-owe-details-'+$index" v-model="modelval" :value="$key">
                  <label :for="'water-owe-details-'+$index" class="font-size">{{f}}</label>
                </div>
              </div>
            </article>
            <footer slot="modal-footer" class="modal-footer">
              <center>

                <button v-show="printshow" type="button" class="btn btn-default" @click='close()'>取消</button>
                <button v-show="printshow" type="button" class="btn btn-success" @click='print()'>打印</button>
                <print-table :model='model' v-show="false" v-ref:print
                             :top='40' :left='60' :right='40' :bottom='60'
                             :thead="thead" :tfoot='tfoot' :attach="yangsen"
                             :fields="modelval" :printpage="true">
                </print-table>
              </center>
            </footer>
          </modal>
        </div>
        <div class="flex" v-if="show">
          <user-info-detail-manage-new :f_userinfo_id="rowdata.f_userinfo_id" @cancel-main="cancel"></user-info-detail-manage-new>
        </div>
      </div></div></div>
  <high-meter-idcard :show.sync="false"  v-ref:highcard  ></high-meter-idcard>
</template>

<script>
  import {HttpResetClass, PagedList} from 'vue-client'
  import defaultPrint from '../config/DefaultPrint'
  import exportConfig from '../config/exportConfig'
  import defalutSelect from '../config/DefaultSelect'
  let readySomething = async function (self) {
    await self.$MagLoadParams.loadParam()
    // await self.$LoadParams.loadParam(self.f_filialeid)
    self.initParams()
    self.getPricenames();
    self.defaultfield = [...self.defaultfield, ...self.config.defaultPrint]
    self.defalutSelect = defalutSelect.compreConfig
    // self.$refs.paged.$refs.cri.model.startDate = self.$login.toStandardDateString()
    // self.$refs.paged.$refs.cri.model.endDate = self.$login.toStandardDateString()
    // await self.$refs.paged.$refs.cri.search()
  }
  export default {
    title: '综合档案信息查询',
    data() {
      return {
        IdCardInfo:'',
        defalutSelect:[],
        card:'',
        isSingleUser: null,
        other:[],
        footer:[],
        model: new PagedList('api/af-revenue/sql/compreQuery', 20,{orderitem: this.orderitem?'"' + this.orderitem + ' "':`'f_residential_area desc,f_building desc,f_unit desc,f_floor desc,f_room desc,f_userfiles_id desc'`},{f_yiguabiao:0,f_weiguabiao:0}),
        criteriaShow: false,
        orgCondtionStr:'',
        residentialArea: [],
        gasproperties:[],
        meterbrands: [],
        modelval: [],
        prices: [],
        meterbooks: [],
        printshow: false,
        all: false,
        fields: {},
        thead: '',
        tfoot: '',
        defaultfield: [],
        //排序
        orderitem: 'f_residential_area desc,f_building desc,f_unit desc,f_floor desc,f_room desc,f_userfiles_id desc',
        orderFields: {
          f_operate_date: 'no'
        },
        config: {
          defaultPrint: ['f_userinfo_code', 'f_user_name', 'f_user_phone', 'f_user_state']
        },
        area: [],
        inputtouPerson: [],
        bookinputtorperson:[],
        conditon2:'',
        show:false,
        rowdata:{},
        f_filialeid: this.$login.f.orgid,
        // 下拉框参数
        initres: {
          org:[this.$login.f.orgid],
          dep:[],
          user:[],
        },
        // 合计数据
        sumsmodel: {},
        //表册片区
        bookSlice:[{label: '全部',value: ''}],
        meterStyle:[{label: '全部',value: ''}],
        pricenames:[],
        dypayment:[{label:"全部",value:""},{label:"银行代扣",value:"银行代扣",},{label:"现金缴费",value:"现金缴费",}],
        networkvalves: this.$appdata.getParam('自动阀控') ? [{label: '全部', value: ''}, ...this.$appdata.getParam('自动阀控')] : [],
      }
    },
    ready(){
      this.getaddress()
      this.$refs.paged.$refs.cri.model.f_user_state=['正常']
      readySomething(this).then(() => {
        this.$emit('ready')
      }).catch((error) => {
        this.$emit('error', error)
      })
    },
    methods: {
      recombine (param) {
        // 条件拼接数据，多用于in （）。将数组转成字符串时加上单引号处理
        let str = ''
        if (param && param.length > 0) {
          param.forEach((p) => {
            str += `'${p}',`
          })
        }
        return `(${str.substring(0, str.length - 1)})`
      },
      async getMeterStyle(val){
        if (val.length > 0){
          // 获取气表型号下拉框
          let HttpReset = new HttpResetClass()
          let param = {
            items: 'distinct f_meter_style',
            tablename: 't_gasmodel gm left join t_gasbrand tg on gm.f_gasbrand_id = tg.id',
            condition: `tg.f_meter_brand in ${this.recombine(val)}`,
            orderitem: 'f_meter_style'
          }
          let data = await HttpReset.load('POST', 'api/af-revenue/sql/manage_singleTable', {data: param}, {resolveMsg: null, rejectMsg: '获取设备列表失败!'})
          for (let row of data.data) {
            this.meterStyle.push({label: row.f_meter_style, value: row.f_meter_style})
          }
        } else {
          this.meterStyle = [{label: '全部',value: ''}]
        }
      },
      ReadIDCard(){
        this.$refs.highcard.sendMsg(this.$refs.highcard.CLT_MSG.READ_IDCARD, (msg) => {
          console.log('======',msg)
          if(msg.err !== 0){ return}
          this.IdCardInfo=msg.strID
        })
        if(this.IdCardInfo) {
          this.search()
        }else{
          alert("读取失败，找不到用户信息")
        }
      },
      cardBtn (val) {
        // this.clear()
        cardBtnGen(this, val)
      },
      getPricenames() {
        this.pricenames = []
        let priceArr = []
        this.$MagGetSaleParam.prices.forEach((item) => {
          let temp = {}
          temp.label = item.f_price_name
          temp.value = item.f_price_name
          priceArr.push(temp)
        })
        this.pricenames  = [{label: '全部', value: ''}, ...priceArr]
      },
      selectPrice(){
        this.pricesAll=[{label: '全部', value: ''}]
        this.$refs.paged.$refs.cri.model.f_price=''
        this.pricesSum.forEach((item)=>{
          if(this.$refs.paged.$refs.cri.model.f_price_name==item.f_price_name){
            item.detailprice.forEach((item)=>{
              let temp={}
              temp.label=item.f_price
              temp.value=item.f_price
              this.pricesAll.push(temp)
            })
          }
        })
      },
      pricetypechanged(){
        this.$refs.paged.$refs.cri.model.f_price_name = []
      },
      getotherfooter () {
        // this.$refs.paged.$refs.cri.$refs.exports.otherData = [];
        // this.$refs.paged.$refs.cri.$refs.exports.footerData = [];
        this.other = [];
        this.footer = [];
        let exportdata = this.getCondition;
        let otherInData = [];
        otherInData.push(`导出时间: ${this.$login.toStandardTimeString()}`);
        this.other.push(otherInData);
      },
      initParams() {
        // 初始化气表品牌
        let brandArr = []
        this.$MagGetSaleParam.getGasbrand().forEach((item) => {
          let temp = {}
          temp.label = item.label
          temp.value = item.value.f_meter_brand
          brandArr.push(temp)
        })
        this.meterbrands = [{label: '全部', value: ''}, ...brandArr]
        //初始化气表价格
        this.prices = this.$MagGetSaleParam.getPrices();
      },
      async  getaddress(){
        console.log('开始获取小区')
        let HttpReset = new HttpResetClass()
        var data = await HttpReset.load('POST', 'api/af-revenue/sql/manage_getarealist', {
          data: {
            condition: `1=1 and s.f_filialeid = '${this.$login.f.orgid}'`
          }
        }, {resolveMsg: null, rejectMsg: '获取小区失败!'})
        console.log('小区',data)
        let house = [{label: '全部', value: ''}]
        for (let row of data.data){
          console.log('开始保存小区')
          house.push({label: row.f_residential_area, value: row.f_residential_area})
        }
        this.residentialArea = house
      },
      search(){
        this.$refs.paged.$refs.cri.search()
      },
      cancel() {
        this.show = false
      },
      showmsg(obj){
        this.rowdata=obj
        this.show=true
      },
      selfSearch (args) {

        //抄表员查询条件
        this.inputtouPerson = this.$refs.paged.$refs.cri.model.f_inputtor
        if(this.inputtouPerson.length !== 0){
          let str = JSON.stringify(this.inputtouPerson)
          str = str.replace(/"/g,`'`)
          str = str.replace(/\[/g,``)
          str = str.replace(/\]/g,``)
          console.log("=====抄表员model22222222222绑定====",str)
          //查询多个抄表员时条件
          args.condition += ` and f_inputtor in  ( ${str} )`
        }
        //debugger
        this.bookinputtorperson = this.$refs.paged.$refs.cri.model.f_book_inputtor;
        if(this.bookinputtorperson.length !== 0){
          let str = JSON.stringify(this.bookinputtorperson)
          str = str.replace(/"/g,`'`)
          str = str.replace(/\[/g,``)
          str = str.replace(/\]/g,``)
          console.log("=====抄表员model22222222222绑定====",str)
          //查询多个抄表员时条件
          args.condition += ` and f_book_inputtor  in  ( ${str} )`
        }
        if (!this.orgCondtionStr) {
          args.condition = `${args.condition}` + " and uf.f_orgid = " + this.$login.f.orgid
        } else {
          args.condition = `${args.condition}` + this.orgCondtionStr
        }
        console.log("查看条件",this.conditon2)
        if(this.card!=''){
          args.condition +=` and f_card_id='${this.card}'`
        }
        if(this.IdCardInfo!=''){
          args.condition+=` and f_idnumber='${this.IdCardInfo}'`
        }
        this.conditon2 = args.condition
        this.model.search(args.condition, args.model)
        this.sumsmodel = this.$refs.paged.$refs.grid.model.sums;
        this.card=''
        this.IdCardInfo=''
        console.log('合计字段',this.sumsmodel)
      },
      clear(){
        Object.keys(this.$refs.paged.$refs.cri.model).forEach((key) => {
          this.$refs.paged.$refs.cri.model[key] = []
        })
      },
      hidden(){
        this.criteriaShow = !this.criteriaShow
      },
      getRes(obj) {
        this.orgCondtionStr = obj
      },
      stamp () {
        this.all = false
        //默认选择要打印的列
        this.modelval = defaultPrint.config
        this.fields = this.getfield
        console.log('所有打印字段',this.fields)
        this.printshow = true
        this.put()
      },
      put () {
        // 对Modelval进行排序
        this.sortModelval()
        this.thead = `<tr><th colspan=${this.modelval.length}>设备查询统计报表</th></tr><tr>`
        for (let key of this.modelval) {
          this.thead += '<th>' + this.fields[key] + '</th>'
        }
        this.thead += '</tr>'
      },
      print () {
        this.$refs.print.PrintAsFile()
        this.printshow = false
      },
      close () {
        this.printshow = false
        this.all = false
      },
      userTypeChange () {
        this.gasproperties=[]
        if(this.$refs.paged.$refs.cri.model !==null) {
          this.$refs.paged.$refs.cri.model.f_gasproperties=''
          this.gasproperties = this.$appdata.getParam(this.$refs.paged.$refs.cri.model.f_user_type[0])
          // this.gasproperties.push({label: '全部', value: ''})
        }
        else{
          this.gasproperties =[{label: '全部', value: ''}]
        }
      },
      // 对选择的列进行排序
      sortModelval () {
        let sortModel = []
        Object.keys(this.fields).forEach((key) => {
          if (this.modelval.includes(key)) {
            sortModel.push(key)
          }
        })
        this.modelval = sortModel
        console.log('选择的打印的字段', this.modelval)
      },
      async updateParams() {
        await this.$MagLoadParams.loadParam(this.f_filialeid)
        this.inputtores = [];
        this.inputtores.push({label: "全部", value: ""})
        this.initSlice(this.f_filialeid)
        if(this.allorgid!=null){
          this.allorgid.forEach((res)=>{
            this.inputtores = this.inputtores.concat(this.$MagGetSaleParam.getresinputtor(res));
          })
        }
      },
      async initSlice (val) {
        if (val) {
          let getAllArea = await this.$resetpost('/rs/search', {
            source: 'this.getParentByType($organization$).getAllChildrens().where(row.getType() == $zone$)',
            userid: this.$login.f.id
          }, {resolveMsg: null, rejectMsg: '获取片区出错！！！'})
          let arr = getAllArea.data.filter((res) => {
            return res.parentid == val
          })
          this.bookSlice = []
          console.log('过滤之后的片区-------------------', arr)
          arr.forEach((res) => {
            this.bookSlice.push({label: res.name, value: res.name})
          })
        }
      },
      //表册片区和抄表册关联
      async inputtorchange(){
        this.$set('$refs.paged.$refs.cri.model.f_meter_book',[]);
        /*let val1=this.$refs.paged.$refs.cri.model.f_meter_book*/
        let val2=this.$refs.paged.$refs.cri.model.f_book_slice_area
        if((val2.length>0)){
          let condition = ` 1=1 and f_orgid ='${this.f_filialeid}' and f_book_state='有效' `
          /*if (val1[0]){
            condition = condition+ ` and f_meter_book = '${val1[0]}' `
          }*/
          if(val2[0]) {
            condition = condition + ` and f_book_slice_area = '${val2}' `
          }
          let param={
            items:'*',
            tablename:'t_meter_book',
            condition:condition,
            orderitem:'id'
          }
          let getMeterBooks = await this.$resetpost('api/af-revenue/sql/singleTable_OrderBy', {data: param}, {resolveMsg: null, rejectMsg: '获取营收参数出错！！！'})
          if (getMeterBooks.data) {
            if(getMeterBooks.data.length >0){
              let rs = [];
              getMeterBooks.data.forEach((item)=>{
                let temp = {
                  label:item.f_book_name,
                  value:item.id
                };
                rs.push(temp);

              })
              this.meterbooks = [{label: '全部',value: ''}, ...rs];
            }else{
              this.meterbooks = [{label: '全部',value: ''}];
            }
          }
        }else{
          this.meterbooks = [{label: '全部',value: ''}];
          this.initmeterbook();
        }
      },
      async initmeterbook(orgstr){
        if(orgstr == null ){
          orgstr = this.f_filialeid;
        }
        //获取新的抄表册,先去清理所有的抄表册
        this.$GetSaleParam.meterbooks = [];
        //开始加载新的抄表册
        await this.$LoadParams.loadMeterBook(orgstr)
        this.meterbooks = [{label: '全部', value: ''}, ...this.$GetSaleParam.getMeterBooks()]
      },
      sort (field, rule) {
        // 将所有排序方式设为不排序，实现相互排斥
        for (let key in this.orderFields) {
          if (key === field) {
            this.orderFields[key] = rule
          } else {
            this.orderFields[key] = 'no'
          }
        }
        // 如果新规则不排序，还原为默认排序
        if (rule === 'no') {
          this.model.paramSource.orderitem = `'${this.orderitem}'`
        } else {
          this.model.paramSource.orderitem = `'${field} ${rule},f_userfiles_id desc'`
        }

        this.search()
      }
    },
    watch:{
      'model.rows.length' () {
        this.isSingleUser = this.model.rows
      },
      'all' (val) {
        if (val) {
          this.modelval = this.bodyData
        } else {
          this.modelval = defaultPrint.config
          this.put()
        }
      },
      'modelval.length' () {
        this.put()
      },
      sumsmodel:{
        handler: function(val) {
          this.getotherfooter();
        },
        deep: true
      },
      'orgCondtionStr'(val) {
        let res = val.match(/'(.*?)'/)
        console.log('正则提取:',res && res[1])
        if (res) {
          this.f_filialeid = res[1]
          if(res.input !=null){
            let resorgid = res.input.substring(res.input.indexOf("'"));
            if(resorgid!= null && resorgid!=''){
              resorgid = resorgid.substring(0,resorgid.lastIndexOf("'")+1);
              // resorgid = resorgid.replaceAll("'","");
              resorgid = resorgid.replace(/'/g,"");
              this.allorgid = resorgid.split(",")
            }
          }
          this.updateParams()
        }
      },
    },
    computed:{
      valvestate() {
        return [{label: '全部', value: ''}, ...this.$appdata.getParam('阀门状态')]
      },
      bandstates () {
        return [{label: '全部', value: ''}, ...this.$appdata.getParam('微信绑定')]
      },
      TableStates () {
        return [{label: '全部', value: ''}, ...this.$appdata.getParam('气表状态')]
      },
      bgl(){
        return [{label: '全部', value: ''}, ...this.$appdata.getParam('壁挂炉')]
      },
      houseTypes(){
        return [{label: '全部', value: ''}, ...this.$appdata.getParam('房屋类型')]
      },
      gasproperties(){
        return [{label: '全部', value: ''}, ...this.$appdata.getParam('用气性质')]
      },
      whetherCard(){
        return [{label: '全部', value: ''}, ...this.$appdata.getParam('发卡状态')]
      },
      usertypes() {
        return [{label: '全部', value: ''}, ...this.$appdata.getParam('用户类型')]
      },
      useTypes() {
        return [{label: '全部', value: ''}, ...this.$appdata.getParam('使用类型')]
      },
      positions() {
        return [{label: '全部', value: ''}, ...this.$appdata.getParam('安装位置')]
      },
      meterbooks(){
        return [{label: '全部', value: ''}, ...this.$GetSaleParam.getMeterBooks()]
      },
      userstates() {
        return [{label: '全部', value: ''}, ...this.$appdata.getParam('客户状态')]
      },

      metertypes() {
        return [{label: '全部', value: ''}, ...this.$appdata.getParam('气表类型')]
      },
      pricetypes() {
        return [{label: '全部', value: ''}, ...this.$appdata.getParam('气价类型')]
      },
      person() {
        return [{label: '全部', value: ''}, ...this.$appdata.getParam('安装人')]
      },
      tablestate() {
        return [{label: '全部', value: ''}, ...this.$appdata.getParam('表具状态')]
      },
      inputtores () {
        // 获取抄表员
        console.log('获取抄表员', this.$login.f)
        let rs = []
        if (this.$login.f.f_gasman.length > 0) {
          for (let i = 0; i < this.$login.f.f_gasman.length; i++) {
            let temp = {
              label: this.$login.f.f_gasman[i].name,
              value: this.$login.f.f_gasman[i].name
            }
            rs.push(temp)
          }
        }

        return [{label: '全部', value: ''}, ...rs]
      },
      authArr () {
        return this.$login.r ? this.$login.r : []
      },
      getCondition(){

        return {condition:this.conditon2,orderitem:this.orderitem}
      },
      getfield(){
        let data = {}
        this.bodyData.forEach((value, index)=>{
          data[this.bodyData[index]] = this.headData[index]
        })
        //合计字段打印
        this.tfoot = `<tr><th colspan=${this.modelval.length}>全表汇总信息: `
        if(this.sumsmodel){
          Object.keys(this.sumsmodel).forEach((key) => {
            this.tfoot += this.fields[key] + '合计: ' + `<font color="blue">${this.sumsmodel[key]} </font>`
          })
        }else{
          this.tfoot += '暂无'
        }
        this.tfoot += '</th></tr>'
        return data
      },
      getExportField() {
        return exportConfig.compreConfig
      }
    }
  }
</script>
