<template>
  <div id="unit" class="flex-row">
    <div class="basic-main" @keyup.enter="search">
      <div class="flex" v-if="!show">
        <criteria-paged :model="model" v-ref:paged>
          <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 for="startDate" class="font_normal_body">开始日期</label>
                  <datepicker id="startDate" placeholder="开始日期" style="width:60%"
                              v-model="model.startDate"
                              :value.sync="model.startDate"
                              :format="'yyyy-MM-dd HH:mm:ss'"
                              :show-reset-button="true"
                              condition="f_operate_date >= '{}'">
                  </datepicker>
                </div>
                <div class="col-sm-2 form-group">
                  <label for="endDate" class="font_normal_body">结束日期</label>
                  <datepicker id="endDate" placeholder="结束日期" style="width:60%"
                              v-model="model.endDate"
                              :value.sync="model.endDate"
                              :format="'yyyy-MM-dd HH:mm:ss'"
                              :show-reset-button="true"
                              condition="f_operate_date <= '{}'">
                  </datepicker>
                </div>
                <div class="col-sm-2 form-group">
                  <label class="font_normal_body" title="参数:付款方式查询">付款方式</label>
                  <v-select :value.sync="model.f_payment" multiple
                            v-model="model.f_payment"
                            :options='$parent.$parent.payment' placeholder='请选择'
                            condition="f_payment in {}"
                            close-on-select></v-select>
                </div>
                <div class="span" style="float:right;">
                  <!--<read-idcard></read-idcard>-->
                  <button class="button_search button_spacing" @click="search()">查询</button>
                  <button class="button_clear  button_spacing" @click="$parent.$parent.clear()">清空</button>

                  <export-excel :data="$parent.$parent.getCondition"
                                :field="$parent.$parent.getfield"
                                :footer="$parent.$parent.footer"
                                :header="$parent.$parent.other"
                                sqlurl="api/af-revenue/logic/openapi/exportfile"
                                sql-name="sellPeopleQuery"
                                template-name='收费员汇总导出'
                                :choose-col="true"></export-excel>

                  <print-data :sum-field="$parent.$parent.getfield" :model="$parent.model" :field="$parent.$parent.getfield"
                               :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" v-ref:sel></res-select-group>

                <!--<div class="col-sm-2 form-group">-->
                  <!--<label class="font_normal_body">&nbsp;&nbsp;&nbsp;小区&nbsp;&nbsp;&nbsp;</label>-->
                  <!--<v-select :value.sync="model.f_residential_area"-->
                            <!--class="select_list select"-->
                            <!--enter-push-->
                            <!--multiple = "true"-->
                            <!--v-model="model.f_residential_area"-->
                            <!--style="width: 60%"-->
                            <!--:options='$parent.$parent.residentialArea' placeholder='选择小区'-->
                            <!--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_type" multiple
                            :options='$parent.$parent.chargetype' placeholder='请选择'
                            close-on-select clear-button
                            condition="f_type in {}"
                            v-model="model.f_type"></v-select>
                </div>
                <div class="col-sm-2 form-group">
                  <label class="font_normal_body">客户类型</label>
                  <v-select :value.sync="model.f_user_type"
                            @change="$parent.$parent.userTypeChange()"
                            :options='$parent.$parent.usertypes' 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 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"-->
                            <!--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"-->
                            <!--:options="$parent.$parent.getPricenames"-->
                            <!--condition="f_price_name = '{}'"-->
                            <!--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_meter_type" multiple
                            :options='$parent.$parent.metertypes' placeholder='请选择' v-model="model.f_meter_type"
                            condition="f_meter_type in {}"
                            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_meter_brand" multiple
                            v-model="model.f_meter_brand"
                            :options='$parent.$parent.meterbrands' placeholder='请选择'
                            condition="f_meter_brand in {}"
                            close-on-select></v-select>
                </div>
                <div class="col-sm-2 form-group">
                  <label class="font_normal_body" >抄&nbsp;&nbsp;表&nbsp;员</label>
                  <v-select :value.sync="model.f_inputtor"
                            v-model="model.f_inputtor"
                            :options='$parent.$parent.inputtores' placeholder='请选择'
                            condition="f_inputtor = '{}'"
                            close-on-select :search="false">
                  </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.inputtchange"
                            multiple
                            :options='$parent.$parent.bookSlice' placeholder='片区/表册'
                            style="width:60%"
                            close-on-select
                            condition="f_book_slice_area in {}"></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%"
                            multiple
                            close-on-select
                            condition="f_meter_book_num in {}"></v-select>
                </div>

                <div class="col-sm-2 form-group">
                  <label class="font_normal_body">收费状态</label>
                  <v-select :value.sync="model.f_state" multiple
                            v-model="model.f_state"
                            :options='$parent.$parent.charge_state' placeholder='请选择'
                            condition="f_state in {}"
                            close-on-select></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>
                  <nobr>收费员</nobr>
                </th>
                <th>
                  <nobr>燃气费</nobr>
                </th>
                <th>
                  <nobr>预存款</nobr>
                </th>
                <th>
                  <nobr>其他费</nobr>
                </th>
                <th>
                  <nobr>销售笔数</nobr>
                </th>
                <th>
                  <nobr>冲正金额</nobr>
                </th>
                <th title="实收金额 = 燃气费 + 预存款 - 冲正金额">
                  <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 title="合计金额 = 实收金额 + 其他费">
                  <nobr>合计金额</nobr>
                </th>
              </tr>
            </template>
            <template partial='body'>
              <td style="text-align: center;">
                <nobr>{{row.f_operator}}</nobr>
              </td>
              <td style="text-align: center;"><nobr>
                <nobr>{{row.f_oughtfee}}</nobr>
              </nobr> </td>
              <td style="text-align: center;">
                <nobr>{{row.f_yucun}}</nobr>
              </td>
              <td style="text-align: center;">
                <nobr>{{row.f_other_fee}}</nobr>
              </td>
              <td style="text-align: center;">
                <nobr>{{row.f_number}}</nobr>
              </td>
              <td style="text-align: center;">
                <nobr>{{row.f_cal_collection}}</nobr>
              </td>
              <td style="text-align: center;">
                <nobr>{{row.f_collection}}</nobr>
              </td>
              <td style="text-align: center;">
                <nobr>{{row.qifei_num}}</nobr>
              </td>
              <td style="text-align: center;">
                <nobr>{{row.qifei_fee}}</nobr>
              </td>
              <td style="text-align: center;">
                <nobr>{{row.yucun_num}}</nobr>
              </td>
              <td style="text-align: center;">
                <nobr>{{row.yucun_fee}}</nobr>
              </td>
              <td style="text-align: center;">
                <nobr>{{row.tuifei_num}}</nobr>
              </td>
              <td style="text-align: center;">
                <nobr>{{row.tuifei_fee}}</nobr>
              </td>
              <td style="text-align: center;">
                <nobr>{{row.f_delaypay}}</nobr>
              </td>
              <td style="text-align: center;">
                <nobr>{{row.f_heji}}</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;font-weight: bold">
              燃气费合计:&emsp;{{sumsmodel.f_oughtfee}}
            </td>
            <td style="display: inline-block;width: auto;border-right: 1px solid #F2F6FA;padding: 0px 10px 0px 10px;font-weight: bold">
              预存款合计:&emsp;{{sumsmodel.f_yucun}}
            </td>
            <td style="display: inline-block;width: auto;border-right: 1px solid #F2F6FA;padding: 0px 10px 0px 10px;font-weight: bold">
              其他费合计:&emsp;{{sumsmodel.f_other_fee}}
            </td>
            <td style="display: inline-block;width: auto;border-right: 1px solid #F2F6FA;padding: 0px 10px 0px 10px;font-weight: bold">
              销售笔数合计:&emsp;{{sumsmodel.f_number}}
            </td>
            <td style="display: inline-block;width: auto;border-right: 1px solid #F2F6FA;padding: 0px 10px 0px 10px;font-weight: bold">
              冲正金额合计:&emsp;{{sumsmodel.f_cal_collection}}
            </td>
            <td style="display: inline-block;width: auto;border-right: 1px solid #F2F6FA;padding: 0px 10px 0px 10px;font-weight: bold">
              实收金额合计:&emsp;{{sumsmodel.f_collection}}
            </td>
            <td style="display: inline-block;width: auto;border-right: 1px solid #F2F6FA;padding: 0px 10px 0px 10px;font-weight: bold">
              气费笔数合计:&emsp;{{sumsmodel.qifei_num}}
            </td>
            <td style="display: inline-block;width: auto;border-right: 1px solid #F2F6FA;padding: 0px 10px 0px 10px;font-weight: bold">
              气费金额合计:&emsp;{{sumsmodel.qifei_fee}}
            </td>
            <td style="display: inline-block;width: auto;border-right: 1px solid #F2F6FA;padding: 0px 10px 0px 10px;font-weight: bold">
              预存笔数合计:&emsp;{{sumsmodel.yucun_num}}
            </td>
            <td style="display: inline-block;width: auto;border-right: 1px solid #F2F6FA;padding: 0px 10px 0px 10px;font-weight: bold">
              预存金额合计:&emsp;{{sumsmodel.yucun_fee}}
            </td>
            <td style="display: inline-block;width: auto;border-right: 1px solid #F2F6FA;padding: 0px 10px 0px 10px;font-weight: bold">
              退费笔数合计:&emsp;{{sumsmodel.tuifei_num}}
            </td>
            <td style="display: inline-block;width: auto;border-right: 1px solid #F2F6FA;padding: 0px 10px 0px 10px;font-weight: bold">
              退费金额合计:&emsp;{{sumsmodel.tuifei_fee}}
            </td>
            <td style="display: inline-block;width: auto;border-right: 1px solid #F2F6FA;padding: 0px 10px 0px 10px;font-weight: bold">
              已交违约金合计:&emsp;{{sumsmodel.f_delaypay}}
            </td>
            <td style="display: inline-block;width: auto;border-right: 1px solid #F2F6FA;padding: 0px 10px 0px 10px;font-weight: bold">
              总合计:&emsp;{{sumsmodel.f_heji}}
            </td>
          </tr>
        </table>
      </div>
    </div>
  </div>
</template>

<script>
  import {HttpResetClass, PagedList} from 'vue-client'
  import exportConfig from '../config/exportConfig'

  let readySomething = async function (self) {
    self.defaultfield = [...self.defaultfield, ...self.config.defaultPrint]
    //加载抄表册
    self.$MagGetSaleParam.initinputtor();
    self.getinputtores();
    self.initmeterbook();

    self.$refs.paged.$refs.cri.model.startDate = self.$login.toStandardDateString() + ' 00:00:00'
    self.$refs.paged.$refs.cri.model.endDate = self.$login.toStandardDateString() + ' 23:59:59'
    // self.$refs.paged.$refs.cri.search()

    await self.$MagLoadParams.loadParam()
    self.initParams()
    self.sumsmodel = self.$refs.paged.$refs.grid.model.sums
  }
  export default {
    title: '收费员汇总表',
     data() {
      return {

        config: {
          defaultPrint: ['qifei_fee','f_collection','f_delaypay']
        },
        other: [],
        footer: [],
        //f_price_name:[],
        gasproperties:[],
        showinfo: false,
        data: {},
        show:false,
        rowdata:{},
        initres: {
          org:[this.$login.f.orgid],
          dep:[],
          user:[]
        },
        model: new PagedList('api/af-revenue/sql/sellPeopleQuery', 20, {}, {
          f_oughtfee: 0,
          f_yucun: 0,
          f_other_fee: 0,
          f_number :0,
          f_cal_collection: 0,
          f_collection: 0,
          qifei_num:0,
          qifei_fee:0,
          yucun_num:0,
          yucun_fee:0,
          tuifei_num:0,
          tuifei_fee:0,
          f_heji:0,
          f_delaypay:0
        }),
        criteriaShow: false,
        orgCondtionStr: '',
        // 下拉框
        meterbrands: [],
        pricenames: [],
        prices: [],
        area: [],
        //合计数据
        defaultfield: [],
        //小区
        residentialArea: [],
        sumsmodel: {},
        f_filialeid: this.$login.f.f_orgid,
        meterbooks:[{label: '全部',value: ''}],  //抄表册
        bookSlice:[{label: '全部',value: ''}],   //表册片区
        tempfalg :false,
        lastorgstr:'',
        allorgid:[],
        inputtores:[{label: '全部',value: ''}],  //抄表员
      }
    },
    ready() {


      readySomething(this).then(() => {
        this.$emit('ready')
      }).catch((error) => {
        this.$emit('error', error)
      })
    },
    methods: {
      //初始化片区
      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 = []
          arr.forEach((res) => {
            this.bookSlice.push({label: res.name, value: res.name})
          })
        }
      },
      //表册片区和抄表册关联
      async inputtchange(){
        /*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='有效' `
          let aaa = '('
          val2.forEach((item) => {
            aaa = aaa + `'${item}',`
          })
          aaa = aaa + `'')`
          condition = condition + ` and f_book_slice_area in ${aaa} `
          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.$set('$refs.paged.$refs.cri.model.f_meter_book',[]);
              this.meterbooks = [{label: '全部',value: ''}];
            }
          }else{
            this.$set('$refs.paged.$refs.cri.model.f_meter_book',[]);
          }
        }else{
          this.$set('$refs.paged.$refs.cri.model.f_meter_book',[]);
          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()]
      },
      async getinputtores () {
        // 获取抄表员
        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)
          }
        }
        this.inputtores = [{label: '全部', value: ''}, ...rs]
      },
      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));
          })
        }
        this.initParams()
      },
      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()}`);
        let footerData = [], exportfield = this.getfield;
        footerData.push("合计");
        let self = this;
        for (var field in self.sumsmodel) {
          footerData.push(`${exportfield[field]}合计:${self.sumsmodel[field]}`);
        }
        this.footer.push(footerData);
        this.other.push(otherInData);
        let date = []
        date.push(`起始时间:${this.$refs.paged.$refs.cri.model.startDate}`)
        date.push(`终止时间:${this.$refs.paged.$refs.cri.model.endDate}`)
        this.other.push(date)
      },
      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
      },




      //把数据库查询数据转换为下拉数据
      calculate(rows){
        let data = []
        rows.forEach((row, n) => {
          data[n] = {label: row.f_residential_area, value: row.id}
        })
        return data
      },

      search(){
        this.$refs.paged.$refs.cri.search()
      },
      cancel() {
        this.show = false
      },
      showmsg(obj){
        this.rowdata=obj
        this.show=true
      },
      userTypeChange () {
        this.gasproperties=[]
        if(this.$refs.paged.$refs.cri.model !==null) {
          this.$refs.paged.$refs.cri.model.f_gasproperties=''

            console.log(this.$refs.paged.$refs.cri.model.f_user_type[0])
          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: ''}]
        }
      },
      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();
      },
      clearSum(sum){
        for (let itme in sum) {
          sum[itme] = 0
        }
      },
      selfSearch(args) {
        this.clearSum(this.$refs.paged.$refs.grid.model.sums)
        let f_orgstr = this.orgCondtionStr
        args.condition = `${args.condition} ` + f_orgstr
        this.model.search(args.condition, args.model)
        this.sumsmodel = this.$refs.paged.$refs.grid.model.sums
      },
      clear() {
        //清空部门和人员
        this.$refs.paged.$refs.cri.$refs.sel.$children[1].selectres = []
        //部门和人员变为全选
        this.$refs.paged.$refs.cri.$refs.sel.$children[1].$children[0].isSelectAll = false
        this.$refs.paged.$refs.cri.$refs.sel.$children[2].$children[0].isSelectAll = false
        Object.keys(this.$refs.paged.$refs.cri.model).forEach((key) => {
          this.$refs.paged.$refs.cri.model[key] = []
        })

      },
      dealmsg(val) {
        val.model = this.model.model
        this.$dispatch('deal-msg', val)
      },
      show() {
        this.criteriaShow = true
      },
      hidden() {
        this.criteriaShow = !this.criteriaShow
      },
      async getRes(condition,obj) {
        this.orgCondtionStr = condition
        this.orgname = obj.orgnames[0]
        this.depname = obj.depnames[0]

      },


    },
    events:{
      'getidcard'(IdCard){
        console.log("IdCard-===")
        console.log(IdCard)
        // console.log(param)
        this.$refs.paged.$refs.cri.model.f_info_idnumber=IdCard.strID
      }
    },
    watch: {
      'model'(val) {
      },
      sumsmodel: {
        handler: function (val) {
          this.getotherfooter();
        },
        deep: true
      },
      async 'orgCondtionStr'(val) {
        this.$refs.paged.$refs.cri.model.f_book_slice_area=[]
        this.$refs.paged.$refs.cri.model.f_inputtor = []
        this.$refs.paged.$refs.cri.model.f_meter_book = []
        this.meterbooks = [{label: '全部',value: ''}];
        if(this.lastorgstr != val){
          this.tempfalg = true;
          this.lastorgstr = val;
        }
        debugger
        if(this.tempfalg && val != null && val!=''  && val.indexOf("(")>-1){
          this.tempfalg = false;
          let a = val.substring(val.indexOf("(")+2)
          await this.initmeterbook(a.substring(0,a.indexOf(")")-1));
        }
        debugger
        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: {

      getPricenames() {
        let f_user_type = this.$refs.paged.model.model.f_user_type;
        let f_gasproperties = this.$refs.paged.model.model.f_gasproperties;
        let pricetype = this.$refs.paged.model.model.pricetype;
        console.log("打印一下:",f_user_type,f_gasproperties,pricetype,this.f_filialeid,this.prices)
        if(this.$refs.paged.model.model !==null) {
          let rs = []
          let priceArr = []
          if (f_user_type.length > 0 && f_gasproperties.length > 0 && pricetype.length >0) {
            let params = {
              f_user_type: f_user_type[0],
              f_gasproperties: f_gasproperties[0],
              f_price_type: pricetype[0],
              filter: this.f_filialeid,
              prices: this.prices
            }
            this.$MagGetSaleParam.getPrice(params).forEach((item) => {
              let temp = {}
              temp.label = item.label
              temp.value = item.value.f_price_name
              priceArr.push(temp)
            })
            rs = [{label: '全部', value: ''}, ...priceArr]
          }
          if (rs.length === 0) {
            console.log('rs读出来是空')
            this.$refs.paged.model.model.f_price_name = ''
          }
          return rs
        }
      },
      getCondition() {
        return {condition: `${this.$refs.paged.$refs.cri.condition}` + this.orgCondtionStr}
      },
      getfield() {
        return exportConfig.sellPeopleConfig
      },
      pricetypes() {
        return [{label: '全部', value: ''}, ...this.$appdata.getParam('气价类型')]
      },

      usertypes() {
        return [{label: ' 全部 ', value: ''}, ...this.$appdata.getParam('用户类型')]
      },
      metertypes() {
        return [{label: ' 全部 ', value: ''}, ...this.$appdata.getParam('气表类型')]
      },

      tablestate() {
        return [{label: ' 全部 ', value: ''}, ...this.$appdata.getParam('气表状态')]
      },
      chargetype() {
        return [{label: ' 全部 ', value: ''}, ...this.$appdata.getParam('收费类型')]
      },
      payment() {
        return [{label: ' 全部 ', value: ''}, ...this.$appdata.getParam('付款方式查询')]
      },
      charge_state() {
        return [{label: '全部', value: ''}, ...this.$appdata.getParam('收费状态')]
      }
    }
  }
</script>
