<template>
  <div class="flex">
    <criteria-paged :model="model" v-ref:paged>
      <criteria partial='criteria'  @condition-changed='$parent.search' v-ref:criteria>
        <div novalidate class="form-horizontal select-overspread container-fluid auto" partial>
          <div class="row" v-if="!$parent.$parent.$parent.showItem">
            <div :class="$parent.$parent.style">
              <label class="font_normal_body">安检计划</label>
              <input type="text" class="input_search" v-model="$parent.$parent.f_check_plan.f_plan_name"
                     @click="$parent.$parent.showChooser"
                     style="width: 60%" placeholder="安检计划" readonly="readonly">
            </div>
<!--            <div :class="$parent.$parent.style">-->
<!--              <label class="font_normal_body">存在隐患</label>-->
<!--              <v-select style="width:60% "-->
<!--                        class="select select_list"-->
<!--                        :value.sync="model.f_has_defect"-->
<!--                        v-model="model.f_has_defect"-->
<!--                        :options='$parent.$parent.hasDefectOptions'-->
<!--                        :placeholder='model.f_has_defect'-->
<!--                        condition="f_has_defect = '{}'"-->
<!--                        close-on-select>-->
<!--              </v-select>-->
<!--            </div>-->
            <div :class="$parent.$parent.style">
              <label class="font_normal_body">用户编号</label>
              <input type="text" class="input_search" v-model="model.f_userinfo_code"
                     condition="f_userinfo_code = '{}'"
                     style="width: 60%" placeholder="用户编号">
            </div>
            <div :class="$parent.$parent.style">
              <label class="font_normal_body">是否维修</label>
              <v-select
                placeholder='是否维修'
                :value-single="true"
                class="select select_list" style="width: 60%"
                v-model='model.f_repaired'
                :value.sync="model.f_repaired"
                :options='$parent.$parent.repaired'
                condition="f_repaired  = '{}'"
                close-on-select clear-button> </v-select>
            </div>
            <div :class="$parent.$parent.style">
              <label class="font_normal_body">气表状态</label>
              <v-select :value.sync="model.f_table_state" v-model='model.f_table_state'
                        :value-single="true" style="width: 60%"
                        class="select_list select"
                        :options='$parent.$parent.table_state' placeholder='气表状态'
                        close-on-select
                        condition="f_table_state = '{}'"></v-select>
            </div>
            <div class=" col-sm-4 form-group button-range"  >
              <div class="span" style="float: right;margin-top: 8px">
                                <div style="float: right" class="button_spacing"
                     :class="{'button_shrink_left':$parent.$parent.$parent.showItem,'button_shrink_right':!$parent.$parent.$parent.showItem}"
                     @click="$parent.$parent.hiddenr()"></div>
                <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>
                <button style="float: right" class="button_search button_spacing" @click="search">查询</button>

                <div style="float: right">
                <export-excel-safe   :data="{condition: $parent.$parent.model.condition,f_filialeids:$parent.$parent.model.f_filialeids,f_defect_content:$parent.$parent.model.f_defect_content}"
                                :field="$parent.$parent.getfield"
                                progress="safeGetExportProgress"
                                sqlurl="rs/logic/SafeExportExcel" sql-name="GetCheckPaperByDefect" template-name='安检隐患明细' :choose-col="true"></export-excel-safe>
                </div>
              </div>
            </div>
          </div>
          <div class="row" v-if="$parent.$parent.criteriaShow&&!$parent.$parent.$parent.showItem">
            <!--<div :class="$parent.$parent.style">-->
              <!--<label class="font_normal_body">片&emsp;&emsp;区</label>-->
              <!--<v-select class="select_list select"-->
                        <!--placeholder='片区/管理站' style="width: 60%"-->
                        <!--:value.sync="model.f_slice_area" v-model="model.f_slice_area"-->
                        <!--:options='$parent.$parent.sliceArea'-->
                        <!--filer-key="name"-->
                        <!--close-on-select clear-button-->
                        <!--condition="f_slice_area='{}'"-->
                        <!--@change="$parent.$parent.getmeterbook(model.f_slice_area)"-->
                        <!--:value-single="true">-->
              <!--</v-select>-->
            <!--</div>-->
            <div :class="$parent.$parent.style2" style="margin: 0">
              <role-selector-safe
                role-name="维修员"
                role-lable="维&nbsp;修&nbsp;员"
                @re-res="$parent.$parent.getRes"
                :value.sync="model.f_checker_id"
                v-model="model.f_checker_id"
                condition="f_repairman = '{}'">
              </role-selector-safe>
            </div>


            <div :class="$parent.$parent.style">
              <label class="font_normal_body">起始时间</label>
              <datepicker
                placeholder='起始时间' style="width:60%"
                :disabled-days-of-week="[]"
                :format="'yyyy-MM-dd  '"
                :show-rest-button="reset"
                :value.sync="model.f_start_time"
                v-model="model.f_start_time"
                condition="f_repair_date >= '{} 00:00:00'">
              </datepicker>
            </div>
            <div :class="$parent.$parent.style">
              <label class="font_normal_body">结束时间</label>
              <datepicker
                placeholder='结束时间' style="width:60%"
                :disabled-days-of-week="[]"
                :format="'yyyy-MM-dd '"
                :show-rest-button="reset"
                :value.sync="model.f_end_time"
                v-model="model.f_end_time"
                condition="f_repair_date <= '{} 23:59:59'">
              </datepicker>
            </div>
            <div :class="$parent.$parent.style">
              <label class="font_normal_body">用户类型</label>
              <v-select
                placeholder='用户类型'
                :value-single="true"
                class="select select_list" style="width: 60%"
                v-model='model.f_user_type'
                :value.sync="model.f_user_type"
                :options='$parent.$parent.user_types'
                condition="f_user_type  = '{}'"
                close-on-select clear-button></v-select>
            </div>
            <div :class="$parent.$parent.style">
              <label class="font_normal_body">用气性质</label>
              <v-select
                placeholder='用气性质'
                :value-single="true"
                class="select select_list" style="width: 60%"
                v-model='model.f_gasproperties'
                :value.sync="model.f_gasproperties"
                :options='$parent.$parent.gasproperties'
                condition="f_gasproperties  = '{}'"
                close-on-select clear-button></v-select>
            </div>
            <div :class="$parent.$parent.style">
              <label class="font_normal_body">处理公司</label>
              <v-select
                placeholder='处理公司'
                :value-single="true"
                class="select select_list" style="width: 60%"
                v-model='model.f_dealername'
                :value.sync="model.f_dealername"
                :options='$parent.$parent.dealername'
                condition="f_dealer_name  = '{}'"
                close-on-select clear-button> </v-select>
            </div>

          </div>
          <div class="row" v-if="$parent.$parent.$parent.showItem">
            <div :class="$parent.$parent.style">
              <label class="font_normal_body">安检计划</label>
              <input type="text" class="input_search" v-model="$parent.$parent.f_check_plan.f_plan_name"
                     @click="$parent.$parent.showChooser"
                     style="width: 60%" placeholder="安检计划" readonly="readonly">
            </div>
<!--            <div :class="$parent.$parent.style">-->
<!--              <label class="font_normal_body">存在隐患</label>-->
<!--              <v-select style="width:60% "-->
<!--                        class="select select_list"-->
<!--                        :value.sync="model.f_has_defect"-->
<!--                        v-model="model.f_has_defect"-->
<!--                        :options='$parent.$parent.hasDefectOptions'-->
<!--                        :placeholder='model.f_has_defect'-->
<!--                        condition="f_has_defect = '{}'"-->
<!--                        close-on-select>-->
<!--              </v-select>-->
<!--            </div>-->

            <div class=" col-sm-4 form-group button-range">
              <div class="span" style="float: right;margin-top: 8px;margin-right: 50px">
                <div style="float: right" class="button_spacing"
                     :class="{'button_shrink_left':$parent.$parent.$parent.showItem,'button_shrink_right':!$parent.$parent.$parent.showItem}"
                     @click="$parent.$parent.hiddenr()"></div>
                <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>
                <button style="float: right" class="button_search button_spacing" @click="search">查询</button>

                <div style="float: right">
                  <export-excel-safe   :data="{condition: $parent.$parent.model.condition,f_filialeids:$parent.$parent.model.f_filialeids,f_defect_content:$parent.$parent.model.f_defect_content}"
                                  :field="$parent.$parent.getfield"
                                  progress="safeGetExportProgress"
                                  sqlurl="rs/logic/SafeExportExcel" sql-name="GetCheckPaperByDefect" template-name='安检计划明细' :choose-col="true"></export-excel-safe>
                </div>
              </div>
            </div>



          </div>
          <div class="row" v-if="$parent.$parent.criteriaShow&&$parent.$parent.$parent.showItem">
            <div :class="$parent.$parent.style">
              <label class="font_normal_body">用户编号</label>
              <input type="text" class="input_search" v-model="model.f_userinfo_code"
                     condition="f_userinfo_code = '{}'"
                     style="width: 60%" placeholder="用户编号">
            </div>
            <div :class="$parent.$parent.style">
              <label class="font_normal_body">是否维修</label>
              <v-select
                placeholder='是否维修'
                :value-single="true"
                class="select select_list" style="width: 60%"
                v-model='model.f_repaired'
                :value.sync="model.f_repaired"
                :options='$parent.$parent.repaired'
                condition="f_repaired  = '{}'"
                close-on-select clear-button> </v-select>
            </div>
            <div :class="$parent.$parent.style">
              <label class="font_normal_body">处理公司</label>
              <v-select
                placeholder='处理公司'
                :value-single="true"
                class="select select_list" style="width: 60%"
                v-model='model.f_dealername'
                :value.sync="model.f_dealername"
                :options='$parent.$parent.dealername'
                condition="f_dealer_name  = '{}'"
                close-on-select clear-button> </v-select>
            </div>
            <div :class="$parent.$parent.style2" style="margin: 0">
              <role-selector-safe
                role-name="维修员"
                role-lable="维&nbsp;修&nbsp;员"
                @re-res="$parent.$parent.getRes"
                :value.sync="model.f_checker_id"
                v-model="model.f_checker_id"
                condition="f_repairman = '{}'">
              </role-selector-safe>
            </div>
          </div>
          <div class="row" v-if="$parent.$parent.criteriaShow && $parent.$parent.$parent.showItem">
            <!--<div :class="$parent.$parent.style">-->
              <!--<label class="font_normal_body">片&emsp;&emsp;区</label>-->
              <!--<v-select class="select_list select"-->
                        <!--placeholder='片区/管理站' style="width: 60%"-->
                        <!--:value.sync="model.f_slice_area" v-model="model.f_slice_area"-->
                        <!--:options='$parent.$parent.sliceArea'-->
                        <!--filer-key="name"-->
                        <!--close-on-select clear-button-->
                        <!--condition="f_slice_area='{}'"-->
                        <!--@change="$parent.$parent.getmeterbook(model.f_slice_area)"-->
                        <!--:value-single="true">-->
              <!--</v-select>-->
            <!--</div>-->
            <!--<div :class="$parent.$parent.style">-->
              <!--<label class="font_normal_body">抄&ensp;表&ensp;册</label>-->
              <!--<v-select class="select_list select"-->
                        <!--placeholder='抄表册' style="width: 60%"-->
                        <!--:value.sync="model.f_meter_book_num" v-model="model.f_meter_book_num"-->
                        <!--:options='$parent.$parent.cbc'-->
                        <!--filer-key="name"-->
                        <!--close-on-select clear-button-->
                        <!--condition="f_meter_book_num={}"-->
                        <!--:value-single="true">-->
              <!--</v-select>-->
            <!--</div>-->
            <div :class="$parent.$parent.style">
              <label class="font_normal_body">起始时间</label>
              <datepicker
                placeholder='起始时间' style="width:60%"
                :disabled-days-of-week="[]"
                :format="'yyyy-MM-dd'"
                :show-rest-button="reset"
                :value.sync="model.f_start_time"
                v-model="model.f_start_time"
                condition="f_offsite_time >= '{} 00:00:00'">
              </datepicker>
            </div>
            <div :class="$parent.$parent.style">
              <label class="font_normal_body">结束时间</label>
              <datepicker
                placeholder='结束时间' style="width:60%"
                :disabled-days-of-week="[]"
                :format="'yyyy-MM-dd'"
                :show-rest-button="reset"
                :value.sync="model.f_end_time"
                v-model="model.f_end_time"
                condition="f_offsite_time <= '{} 23:59:59'">
              </datepicker>
            </div>
          </div>
        </div>
      </criteria>
      <data-grid :model="model" partial='list' v-ref:grid class="list_area table_sy">
        <template partial='head'>
          <tr>
<!--            <th><nobr><input type="checkbox" v-model="$parent.$parent.$parent.checkAll"/> 全选</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>-->
          </tr>
        </template>
        <template partial='body'>
<!--          <td style="text-align: center;white-space:nowrap;"><input  type="checkbox" onClick="event.cancelBubble = true" :checked="$parent.$parent.$parent.isChecked(row.id)"  @change="$parent.$parent.$parent.setCheckes(row)" /></td>-->
          <td style="text-align: center;white-space:nowrap;">{{row.f_entry_status}}</td>
          <td style="text-align: center;white-space:nowrap;">{{row.f_userinfo_code}}</td>
          <td style="text-align: center;white-space:nowrap;">{{row.f_user_name}}</td>
          <td style="text-align: center;white-space:nowrap;">{{row.f_user_phone}}</td>
          <td style="text-align: center;white-space:nowrap;">{{row.f_residential_area}}</td>
          <td style="text-align: center;white-space:nowrap;">{{row.f_address}}</td>
          <td style="text-align: center">{{row.f_user_state}}</td>
          <td style="text-align: center">{{row.f_meter_brand}}</td>
          <td style="text-align: center">{{row.f_meternumber}}</td>
          <td style="text-align: center">{{row.f_position}}</td>
          <td style="text-align: center;white-space:nowrap;">{{row.f_table_state}}</td>
          <td style="text-align: center;white-space:nowrap;">{{row.f_offsite_time}}</td>
          <td style="text-align: center;white-space:nowrap;">{{row.f_checker_name}}</td>
          <td style="text-align: center;white-space:nowrap;">{{row.f_plan_name}}</td>
          <td style="text-align: center;white-space:nowrap;">{{row.f_has_defect}}</td>
          <td style="text-align: center;white-space:nowrap;">{{row.f_defect_content}}</td>
          <td style="text-align: center;white-space:nowrap;" v-if="row.f_has_defect!=='无隐患'">{{row.f_repaired}}</td>
          <td style="text-align: center;white-space:nowrap;" v-if="row.f_has_defect!=='无隐患'">{{row.f_defect_count}}</td>
          <td style="text-align: center;white-space:nowrap;" v-if="row.f_has_defect!=='无隐患'">{{row.f_repair_count}}</td>
          <td style="text-align: center;white-space:nowrap;">{{row.f_user_type}}</td>
          <td style="text-align: center;white-space:nowrap;">{{row.f_gasproperties}}</td>
<!--          <td style="text-align: center;white-space:nowrap;">{{row.f_repairman}}</td>-->
<!--          <td style="text-align: center;white-space:nowrap;">{{row.f_repair_date}}</td>-->
<!--          <td style="text-align: center;white-space:nowrap;">{{row.f_ratification_des}}</td>-->
<!--          <td style="text-align: center;white-space:nowrap;">{{row.f_dealer_name}}</td>-->
        </template>
      </data-grid>
    </criteria-paged>

    <modal :show.sync="showModal" v-ref:modal :backdrop="false">
      <div slot="modal-header" class="modal-header">
        <h4 class="modal-title">
          选择计划
        </h4>
      </div>
      <div slot="modal-body" class="modal-body">
        <plan-chooser :f.sync="$login.f" v-ref:chooser></plan-chooser>
      </div>
      <div slot="modal-footer" class="modal-footer" style="text-align: center">
        <button class="button_search" @click="ok">确认</button>
        <button class="button_search" @click="cancel">取消</button>
      </div>
    </modal>
    <modal :show.sync="showModal2" :backdrop="false">
      <div slot="modal-header" class="modal-header">
        <h4 class="modal-title">
          维修处理
        </h4>
      </div>
      <div slot="modal-body" class="modal-body">
          <div class="row" style="margin-top: 10px">
            <label class="control-label font text-left" style="float:left;margin-left:20%;margin-top:5px">维修人员</label>
            <div class="col-xs-8 col-md-8">
              <v-select :value.sync="personnel" :value-single="true" v-model="personnel"
                        :options='checkersid' placeholder='维修人员'
                        close-on-select>
              </v-select>
            </div>
          </div>
          <div class="row" style="margin-top: 10px">
            <label class="control-label font text-left" style="float:left;margin-left:20%;margin-top:5px">处理时间</label>
            <div class="col-xs-8 col-md-8">
              <datepicker
                placeholder='处理时间' style="width:60%"
                :disabled-days-of-week="[]"
                :format="'yyyy-MM-dd'"
                :show-rest-button="reset"
                :value.sync="processingtime"
                v-model="processingtime">
              </datepicker>
            </div>
          </div>
        <div class="row" style="margin-top: 10px">
          <label class="control-label font text-left" style="float:left;margin-left:20%;margin-top:5px">是否完成</label>
          <div class="col-xs-8 col-md-8">
            <v-select :value.sync="f_repaired" :value-single="true" v-model="f_repaired"
                      :options='resultrepaired' placeholder='完成情况'
                      close-on-select>
            </v-select>
          </div>
        </div>
          <div class="row" style="margin-top: 10px">
            <label class="control-label font text-left" style="float:left;margin-left:20%;margin-top:5px">处理内容</label>
            <div class="col-xs-8 col-md-8">
              <textarea class="form-control" type="text" v-model="repair_content"></textarea>
            </div>
          </div>
      </div>
      <div slot="modal-footer" class="modal-footer" style="text-align: center">
        <button class="button_search" @click="rectification">确认</button>
        <button class="button_search" @click="cancel1">取消</button>
      </div>
    </modal>
  </div>
</template>
<script>
  import {PagedList} from 'vue-client'
  import HttpResetClass from "vue-client/src/plugins/HttpResetClass";
  import co from 'co'

  let select = function* (self) {
    let http = new HttpResetClass()
    let getGasman = yield http.load('POST', '/rs/search', {
      source: 'this.getParentByType($department$).getAllChildrens().where(row.getAttributes().get($rolestr$).indexOf($维修员$) != -1))',
      userid: self.$login.f.id
    }, {resolveMsg: null, rejectMsg: null})
    //tag
    getGasman.data.forEach((checker) => {
      self.checkersid.push({label: checker.name, value: checker.name})
    })
  }
  export default {
    title: '隐患查询',
    data() {
      let model = new PagedList('rs/sql/GetCheckPaperByDefect', 20, {
        f_filialeids: 'this.f_filialeids',f_defect_content: 'this.f_defect_content'
      })
      model.f_filialeids = '(' + this.$login.f.orgid + ')'
      model.f_defect_content="CASE WHEN CHARINDEX( '\"result\":\"正常\"', f_defect_content ) > 0 THEN '无隐患' ELSE replace(replace(replace( replace( RIGHT ( f_defect_content, len( f_defect_content ) - 26 ), substring('{}',2,1), '' ), substring('{}',1,1), '' ),']',''),'\"','') END"
      return {
        hasDefectOptions: [{label: '全部', value: ''}, {label: '有隐患', value: '有隐患'}, {label: '无隐患', value: '无隐患'}],
        repaired:[{label: '全部', value: ''},{label: '未修', value: '未修'}, {label: '已修', value: '已修'}],
        dealername:[{label: '全部', value: ''},{label: '洁能', value: '洁能'}, {label: '宏语', value: '宏语'}],
        resultrepaired:[{label: '已完成', value: '已完成'}, {label: '未完成', value: '未完成'}],
        f: this.$login.f,
        model: model,
        criteriaShow: false,
        showModal: false,
        showModal2:false,
        repair_content:'',
        table_state: [{label: '全部', value: ''}, ...this.$appdata.getParam('气表状态')],
        processingtime:'',
        personnel:'',
        f_repaired:'未完成',
        f_check_plan: {f_plan_name: '', id: ''},
        sumsmodel: {},
        all: false,
        fields: {},
        modelval: [],
        checkersid: [],
        sliceArea: [],
        gasproperties: [{label: '全部', value: ''}, ...this.$appdata.getParam('用气性质')],
        user_types: [{label: '全部', value: ''}, ...this.$appdata.getParam('用户类型')],
        checkAll:false,
        checkes:[],
        cbc:[],
        cbcs:[],
        thead: '',
        headData: ['入户状态','用户编号','用户名','用户电话','用户小区','用户地址','安检时间','安检员','计划名','是否有隐患','维修状态','隐患数','整改数','隐患情况','维修人','维修时间','维修内容','处理公司','用户状态','表品牌','表号','表位置','表状态','用户类型','用气性质'],
        bodyData: ['f_entry_status','f_userinfo_code','f_user_name','f_user_phone','f_residential_area','f_address','f_offsite_time','f_checker_name','f_plan_name','f_has_defect','f_repaired','f_defect_count','f_repair_count','f_defect_content','f_repairman','f_repair_date','f_ratification_des','f_dealer_name','f_user_state','f_meter_brand','f_meternumber','f_position','f_table_state','f_user_type','f_gasproperties']
      }
    },
    props:{

      style: {
        type: String,
        default: 'col-sm-2 form-group'
      },
      style2: {
        type: String,
        default: 'col-sm-4 form-group'
      }

    },

    methods: {

      isChecked(v) {
        // 如果全选，不在的按选中算，否则，在的按选中算
        if (this.checkAll) {
          return this.checkes.indexOf(v) == -1
        } else {
          return this.checkes.indexOf(v) != -1
        }
      },

      setCheckAll() {
        this.checkAll=this.checkAll?false:true;
        // 全选改变后，清空选中数据
        this.checkes = []
      },
      setCheckes(row) {
        let index=this.checkes.indexOf(row.id)
        if(index<0){
          this.checkes.push(row.id)
        }else{
          this.checkes.splice(index,1)
        }
      },
      getmeterbook(val){
        this.cbc=[]
        this.cbc.push({
          label:'全部',
          value:''
        })
        if (val==''){

          this.cbcs.forEach(res=>{
            this.cbc.push({
              label:res.f_book_name,
              value:res.id
            })
          })
        }else{
          this.cbcs.forEach(res=>{
            if (res.f_book_slice_area==val){
              this.cbc.push({
                label:res.f_book_name,
                value:res.id
              })
            }
          })
        }
      },

      Mreadibook(val){
        //tag
        //tag
        this.sliceArea=[]
        if (val){
          new HttpResetClass().load('POST',`/rs/sql/tel_singleTable_OrderBy`, {data: {
              items: 'name',
              tablename: 't_zone',
              condition: `parentid  in ${val}`,
              orderitem: 'id'
            }}, {resolveMsg: null, rejectMsg: null}).then((res) => {
            this.sliceArea.push({
              label:'全部',
              value:''
            })
            res.data.forEach(ress=>{
              this.sliceArea.push({
                label:ress.name,
                value:ress.name
              })
            })

          })
        }
      },
      getAllMeterBook(val){
        //tag
        //tag
        this.cbcs=[]
        if (val){
          new HttpResetClass().load('POST',`/rs/sql/tel_singleTable_OrderBy`, {data: {
              items: 'f_book_name,f_book_slice_area,id',
              tablename: 't_meter_book',
              condition: `f_filiale_id  in ${val}`,
              orderitem: 'id'
            }}, {resolveMsg: null, rejectMsg: null}).then((res) => {
            res.data.forEach(ress=>{
              this.cbcs.push({
                id:ress.id,
                f_book_name:ress.f_book_name,
                f_book_slice_area:ress.f_book_slice_area
              })
            })
            this.cbc=[]
            this.cbc.push({
              label:'全部',
              value:''
            })
            this.cbcs.forEach(res=>{
              this.cbc.push({
                label:res.f_book_name,
                value:res.id
              })
            })
          })
        }
      },
      hiddenr() {
        this.$parent.showItem = !this.$parent.showItem
      },
      hidden() {
        this.criteriaShow = !this.criteriaShow
      },
      search(args) {
        if (this.f_check_plan.f_plan_name) {
          args.condition += ` and f_check_plan_id = '${this.f_check_plan.id}'`
        }
        args.condition += ` and f_has_defect = '有隐患'`
        this.model.search(args.condition, args.model)
      },
      getRes(obj) {
        this.model.f_filialeids = this.$login.convertToIn(obj.resids);
        this.Mreadibook(this.model.f_filialeids)
        this.getAllMeterBook(this.model.f_filialeids)
      },
      showChooser() {
        this.showModal = true
      },
      ok() {
        this.showModal = false
        if (this.$refs.modal.$children[0].selectedRow.id) {
          this.f_check_plan = this.$refs.modal.$children[0].selectedRow
        }
      },
      cancel() {
        this.showModal = false
        this.f_check_plan = {f_plan_name: '', id: ''}
      }
    },
    ready() {
      this.$refs.paged.$refs.criteria.model.f_has_defect = '有隐患'
      let gen = select(this)
      // this.Mreadibook(`('${this.$login.f.orgid}')`)
      co(gen)
    },
    computed: {
      selected() {
        return this.$refs.paged.$refs.grid.selected
      },
      getfield(){
        //tag
        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
      }
    }
  }
</script>
