<template>
  <div class="flex" style="flex:1;" @keyup.enter="search1">
  <criteria-paged :model="model" v-ref:paged>
    <criteria @condition-changed='$parent.search' partial='criteria' v-ref:criteria>
      <div class="form-horizontal select-overspread container-fluid auto" novalidate partial
           v-show="$parent.$parent.isdeal">
        <div class="row" width="100%">
          <div class="col-sm-2 form-group">
            <label class="font_normal_body">表&emsp;&emsp;号</label>
            <input style="width:60%" class="input_search" condition="mr.f_meternumber = '{}'"
                   placeholder='表号'
                   type="text"
                   v-model="model.f_meternumber"
            >
          </div>
          <div class="col-sm-2 form-group">
            <label class="font_normal_body">客户编号</label>
            <input style="width:60%" class="input_search" condition="u.f_userinfo_code = '{}'"
                   placeholder='客户编号'
                   type="text"
                   v-model="model.f_userinfo_code">
          </div>
          <div class="col-sm-2 form-group">
            <label class="font_normal_body">客户名称</label>
            <input style="width:60%" class="input_search" condition="u.f_user_name = '{}'" placeholder='客户名称'
                   type="text"
                   v-model="model.f_user_name">
          </div>
          <div class="col-sm-3 form-group button-range">
            <button @click="search()" class="button_search button_spacing" v-el:cba>查询</button>
            <button @click="$parent.$parent.clearmsg" class="button_clear button_spacing">清空</button>
            <!--<label class="font_normal_body"></label>
            <button class="btn btn-success width-100" @click="$parent.$parent.SaveAsFile('webmeterhandplan')">导出</button>-->
            <!--              </div>-->
            <!--              <div class="col-sm-2 form-group form-group">-->
            <export-excel
              :choose-col="true"
              :data="{condition: $parent.$parent.condition}"
              :field="$parent.$parent.getfield" sql-name="manage_getNewAllWebHandPlan" sqlurl="rs/logic/exportfile"
              template-name='数据采集'></export-excel>
            <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>
            <!--              <span style="padding-left: 30px; ">-->
            <!--        <report-excel class="btn btn-success" id="grid"></report-excel>-->
            <!--              </span>-->
          </div>
        </div>
        <div class="row" v-show="$parent.$parent.criteriaShow">
          <div class="col-sm-2 form-group">
            <label class="font_normal_body">用气地址</label>
            <input style="width:60%" class="input_search" condition="u.f_address like '%{}%'" placeholder='用气地址'
                   type="text"
                   v-model="model.f_address"
            >
          </div>
          <div class="col-sm-2 form-group">
            <label class="font_normal_body">用户类型</label>
            <v-select :options="$parent.$parent.Gasusertype" :value.sync="model.f_user_type"
                      close-on-select
                      style="width:60%"
                      condition="ui.f_user_type = '{}'"
                      placeholder='用户类型'
                      v-model="model.f_user_type"
                      value-single="true"
            >
            </v-select>
          </div>
          <div class="col-sm-2 form-group">
            <label class="font_normal_body">用气性质</label>
            <v-select :options="$parent.$parent.Gasproperties" :value.sync="model.f_gasproperties"
                      close-on-select
                      style="width:60%"
                      condition="ui.f_gasproperties = '{}'"
                      placeholder='用气性质'
                      v-model="model.f_gasproperties"
                      value-single="true">
            </v-select>
          </div>
          <!--<div class="col-sm-2 form-group">
            <label class="font_normal_body">阀门状态</label>
            <v-select placeholder='阀门状态'  close-on-select
                      v-model="model.f_valvestate"
                      :value.sync="model.f_valvestate"
                      condition="mr.f_valvestate like '%{}%'"
                      :options="$parent.$parent.Valvestates">
            </v-select>
          </div>-->
          <!--<div class="col-sm-2 form-group">
            <label class="font_normal_body">上报类型</label>
            <v-select placeholder='上报类型' close-on-select
                      v-model="model.f_upload_type"
                      :value.sync="model.f_upload_type"
                      :options="$parent.$parent.Getuploadtype"
                      condition="mr.f_upload_type = '{}'"
            >
            </v-select>
          </div>-->
          <div class="col-sm-2 form-group">
            <label class="font_normal_body" style="word-break:keep-all;">上报时间</label>
            <datepicker :format="'yyyy-MM-dd HH:mm:ss'"
                        :value.sync="model.startDate"
                        style="width:60%"
                        condition="mr.f_insert_date >= '{}'"
                        placeholder="起始时间"
                        v-model="model.startDate"
            ></datepicker>
          </div>
          <div class="col-sm-2 form-group">
            <label class="font_normal_body" style="word-break:keep-all;">&emsp;&ensp;至&emsp;</label>
            <datepicker :format="'yyyy-MM-dd HH:mm:ss'"
                        :value.sync="model.endDate"
                        style="width:60%"
                        condition="mr.f_insert_date <= '{}'"
                        placeholder="结束时间"
                        v-model="model.endDate"
            ></datepicker>
          </div>
          <div class="col-sm-2 form-group">
            <label class="font_normal_body" style="word-break:keep-all;">安装时间</label>
            <datepicker :format="'yyyy-MM-dd HH:mm:ss'"
                        :value.sync="model.startDate1"
                        style="width:60%"
                        condition="ui.f_gas_date >= '{}'"
                        placeholder="起始时间"
                        v-model="model.startDate1"
            ></datepicker>
          </div>
          <div class="col-sm-2 form-group">
            <label class="font_normal_body" style="word-break:keep-all;">&emsp;&ensp;至&emsp;</label>
            <datepicker :format="'yyyy-MM-dd HH:mm:ss'"
                        :value.sync="model.endDate1"
                        style="width:60%"
                        condition="ui.f_gas_date <= '{}'"
                        placeholder="结束时间"
                        v-model="model.endDate1"
            ></datepicker>
          </div>
          <!--<div class="col-sm-2 form-group">-->
          <!--<label class="font_normal_body">故障状态</label>-->
          <!--<v-select placeholder='故障状态'-->
          <!--v-model="model.faultstate"-->
          <!--multiple-->
          <!--:value.sync="model.faultstate"-->
          <!--:options="$parent.$parent.FaultStates">-->
          <!--</v-select>-->
          <!--</div>-->
          <div class="col-sm-2 form-group">
            <label class="font_normal_body">用&ensp;气&ensp;量</label>
            <input style="width:60%" class="input_search" condition="h.f_oughtamount >= '{}'" placeholder='最小气量' type="text"
                   v-el:start_gas v-model="model.start_gas" v-next-el='start_gas'>
          </div>
          <div class="col-sm-2 form-group">
            <label class="font_normal_body" style="word-break:keep-all;">&emsp;&ensp;至&emsp;</label>
            <input style="width:60%" class="input_search" condition="h.f_oughtamount <= '{}'" placeholder='最大气量' type="text"
                   v-el:end_gas v-el:xq v-model="model.end_gas" v-next-el='end_gas'
            >
          </div>
          <div class="col-sm-2 form-group">
            <label class="font_normal_body">剩余金额</label>
            <input style="width:60%" class="input_search" condition="h.f_curbalance >= '{}'"
                   placeholder='最小金额'
                   type="text"
                   v-model="model.start_f_balance">
          </div>
          <div class="col-sm-2 form-group">
            <label class="font_normal_body">&emsp;&ensp;至&emsp;</label>
            <input style="width:60%" class="input_search" condition="h.f_curbalance <= '{}'"
                   placeholder='最大金额'
                   type="text"
                   v-model="model.end_f_balance"
            >
          </div>
          <!--<div class="col-sm-2 form-group" >
            <label class="font_normal_body">标记名称</label>
            <v-select placeholder='标记名称' close-on-select
                      v-model="model.f_parameter_name"
                      :value.sync="model.f_parameter_name"
                      :options="$parent.$parent.parameterName"
                      condition="p.f_parameter_name = '{}'">
            </v-select>
          </div>-->
          <!--<div class="col-sm-2 form-group" >
            <label class="font_normal_body" style="word-break:keep-all;">操作时间</label>
            <datepicker placeholder="起始时间"
                      :value.sync="model.startDate2"
                      v-model="model.startDate2"
                      :format="'yyyy-MM-dd HH:mm:ss'"
                      condition="p.f_parameter_date >= '{}'"
            ></datepicker>
          </div>
          <div class="col-sm-2 form-group" >
            <label class="font_normal_body" style="word-break:keep-all;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;至&nbsp;&nbsp;&nbsp;</label>
            <datepicker placeholder="结束时间"
                      :value.sync="model.endDate2"
                      v-model="model.endDate2"
                      :format="'yyyy-MM-dd HH:mm:ss'"
                      condition="p.f_parameter_date <= '{}'"
            ></datepicker>
          </div>-->
          <!--<div class="col-sm-2 form-group" >
            <label class="font_normal_body">标记状态</label>
            <v-select placeholder='标记状态' close-on-select
                      v-model="model.f_parameter_state"
                      :value.sync="model.f_parameter_state"
                      :options="$parent.$parent.getSignStatus"
                      condition="p.f_parameter_state {}">
            </v-select>
          </div>-->
          <div class="col-sm-2 form-group form-fix-width">
            <label class="font_normal_body" >使用公司</label>
            <res-select :initresid="$parent.$parent.orgid"
                        style="width:60%"
                        @res-select="$parent.$parent.getRes"
                        restype='organization'>
            </res-select>
          </div>
        </div>
      </div>
    </criteria>
    <data-grid :model="model" class="list_area table_sy" id="webmeterhandplan" partial='list' v-ref:grid>
      <template partial='head'>
        <tr>
          <th style="text-align:center" v-show="!$parent.$parent.$parent.isdeal">
            <nobr>操作</nobr>
          </th>
          <th style="text-align:center">
            <nobr>组织机构</nobr>
          </th>
          <th style="text-align:center">
            <nobr>客户编号</nobr>
          </th>
          <th style="text-align:center">
            <nobr>用户类型</nobr>
          </th>
          <th style="text-align:center">
            <nobr>用气性质</nobr>
          </th>
          <!--<th style="text-align:center"><nobr>用气属性</nobr></th>-->
          <th style="text-align:center">
            <nobr>客户名称</nobr>
          </th>
          <th style="text-align:center">
            <nobr>用气地址</nobr>
          </th>
          <th style="text-align:center">
            <nobr>安装时间</nobr>
          </th>
          <th style="text-align:center">
            <nobr>表号</nobr>
          </th>
          <th style="text-align:center">
            <nobr>气表品牌</nobr>
          </th>
          <th style="text-align:center">
            <nobr>气表型号</nobr>
          </th>
          <!--<th style="text-align:center"><nobr>期初余额</nobr></th>-->
          <th style="text-align:center">
            <nobr>上次抄表底数</nobr>
          </th>
          <th style="text-align:center">
            <nobr>本次抄表底数</nobr>
          </th>
          <th style="text-align:center">
            <nobr>本次用气量(m³)</nobr>
          </th>
          <!--<th style="text-align:center"><nobr>气价(元/m³)</nobr></th>-->
          <!--<th style="text-align:center"><nobr>24小时用气量</nobr></th>-->
          <th style="text-align:center">
            <nobr>本次用气金额(元)</nobr>
          </th>
          <th style="text-align:center">
            <nobr>剩余金额</nobr>
          </th>
          <!--<th style="text-align:center"><nobr>上报类型</nobr></th>-->
          <th style="text-align:center">
            <nobr>上报时间</nobr>
          </th>
          <th style="text-align:center"><nobr>信号强度</nobr></th>
          <th style="text-align:center"><nobr>电压</nobr></th>
          <!--<th style="text-align:center"><nobr>信噪比</nobr></th>-->
          <th style="text-align:center"><nobr>阀门状态</nobr></th>
          <!--<th style="text-align:center"><nobr>磁干扰</nobr></th>
          <th style="text-align:center"><nobr>周期关阀</nobr></th>
          <th style="text-align:center"><nobr>过流保护关阀</nobr></th>
          <th style="text-align:center"><nobr>关阀走气</nobr></th>
          <th style="text-align:center"><nobr>拆表报警</nobr></th>
          <th style="text-align:center"><nobr>外部晶振标志</nobr></th>
          <th style="text-align:center"><nobr>软件版本号</nobr></th>-->
          <!--<th style="text-align:center"><nobr>本次上报日期</nobr></th>
          <th style="text-align:center"><nobr>上次上报日期</nobr></th>-->
          <!--<th style="text-align:center"><nobr>上次表状态</nobr></th>
          <th style="text-align:center"><nobr>本次表状态</nobr></th>
          <th style="text-align:center"><nobr>标记状态</nobr></th>
          <th style="text-align:center"><nobr>标记时间</nobr></th>-->
        </tr>
      </template>
      <template partial='body' partial='list' v-ref:grid>
        <tr>
          <td style="text-align:center" v-show="!$parent.$parent.$parent.isdeal">
            <button-link @click="$parent.$parent.$parent.handchange(row)" class="btn btn-link" type="button">处理
            </button-link>
          </td>
          <td style="text-align:center">
            <nobr>{{row.f_orgname}}</nobr>
          </td>
          <td style="text-align:center">
            <nobr>{{row.f_userinfo_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_user_name}}</nobr>
          </td>
          <td>
            <nobr>{{row.f_address}}</nobr>
          </td>
          <td style="text-align:center">
            <nobr>{{row.f_gas_date}}</nobr>
          </td>
          <td style="text-align:center">
            <nobr>{{row.f_meternumber}}</nobr>
          </td>
          <td style="text-align:center">
            <nobr>{{row.f_meter_brand}}</nobr>
          </td>
          <td style="text-align:center">
            <nobr>{{row.f_meter_style}}</nobr>
          </td>
          <!--<td style="text-align:center"><nobr>{{row.f_curbalance}}</nobr></td>-->
          <td style="text-align:center">{{row.f_last_tablebase}}</td>
          <td style="text-align:center">{{row.f_tablebase}}</td>
          <td style="text-align:center">{{row.f_oughtamount}}</td>
          <!--<td style="text-align:center"><nobr>{{row.f_price}}</nobr></td>-->
          <td style="text-align:center">{{row.f_oughtfee}}</td>
          <td style="text-align:center">
            <nobr>{{row.f_curbalance}}</nobr>
          </td>
          <!--<td style="text-align:center;width: 170px;"><nobr>{{row.f_upload_type}}</nobr></td>-->

            <td style="text-align:center">
              <nobr>{{row.f_insert_date}}</nobr>
            </td>
            <td style="text-align:center" >
              <img :title='row.f_signal' v-if="row.f_signal>-80"
                   src="../../../../static/WebMetericon/1.png"
                   height="12" width="24"/>
              <img :title='row.f_signal' v-if="row.f_signal>-100&&row.f_signal<=-80"
                   src="../../../../static/WebMetericon/2.png"
                   height="12" width="24"/>
              <img :title='row.f_signal' v-if="row.f_signal>-120&&row.f_signal<=-100"
                   src="../../../../static/WebMetericon/3.png"
                   height="12" width="24"/>
              <img :title='row.f_signal' v-if="row.f_signal<=-120"
                   src="../../../../static/WebMetericon/4.png"
                   height="12" width="24"/>
            </td>
            <td style="text-align:center" >
              <img :title='row.f_batterylevel' v-if="row.f_batterylevel>=6.00"
                   src="../../../../static/WebMetericon/01.png"
                   height="12" width="24"/>
              <img :title='row.f_batterylevel' v-if="row.f_batterylevel>=5.00&&row.f_batterylevel<6.00"
                   src="../../../../static/WebMetericon/02.png"
                   height="12" width="24"/>
              <img :title='row.f_batterylevel' v-if="row.f_batterylevel>=4.00&&row.f_batterylevel<5.00"
                   src="../../../../static/WebMetericon/03.png"
                   height="12" width="24"/>
              <img :title='row.f_batterylevel' v-if="row.f_batterylevel<4.00"
                   src="../../../../static/WebMetericon/04.png"
                   height="12" width="24"/>
            </td>
            <td style="text-align:center;width: 51px">{{row.f_valvestate==1?'关阀':'开阀'}}</td>
          <!--<td style="text-align:center;width: 51px">
            <img :title='故障' v-if="row.f_magneticinterference==1"
                 src="../../../../static/WebMetericon/guzhang.png"
                 height="12" width="12"/>
            <img :title='正常' v-if="row.f_magneticinterference==0"
                 src="../../../../static/WebMetericon/zhengchang.png"
                 height="12" width="17"/>
          </td>
          <td style="text-align:center;width: 51px">
            <img :title='关阀' v-if="row.f_cycleshutvalue==1"
                 src="../../../../static/WebMetericon/guzhang.png"
                 height="12" width="12"/>
            <img :title='正常' v-if="row.f_cycleshutvalue==0"
                 src="../../../../static/WebMetericon/zhengchang.png"
                 height="12" width="17"/>
          </td>
          <td style="text-align:center;width: 51px">
            <img :title='关阀' v-if="row.f_overcurrentprotection==1"
                 src="../../../../static/WebMetericon/guzhang.png"
                 height="12" width="12"/>
            <img :title='正常' v-if="row.f_overcurrentprotection==0"
                 src="../../../../static/WebMetericon/zhengchang.png"
                 height="12" width="17"/>
          </td>
          <td style="text-align:center;width: 51px">
            <img :title='走气' v-if="row.f_leakageflag==1"
                 src="../../../../static/WebMetericon/guzhang.png"
                 height="12" width="12"/>
            <img :title='正常' v-if="row.f_leakageflag==0"
                 src="../../../../static/WebMetericon/zhengchang.png"
                 height="12" width="17"/>
          </td>
          <td style="text-align:center;width: 51px">
            <img :title='拆表' v-if="row.f_splitalarm==='1'"
                 src="../../../../static/WebMetericon/guzhang.png"
                 height="12" width="12"/>
            <img :title='正常' v-if="row.f_splitalarm==='0'"
                 src="../../../../static/WebMetericon/zhengchang.png"
                 height="12" width="17"/>
          </td>
          <td style="text-align:center;width: 51px">
            <img :title='停止' v-if="row.f_xtipllstopflag==='1'"
                 src="../../../../static/WebMetericon/guzhang.png"
                 height="12" width="12"/>
            <img :title='正常' v-if="row.f_xtipllstopflag==='0'"
                 src="../../../../static/WebMetericon/zhengchang.png"
                 height="12" width="17"/>
          </td>
          <td style="text-align:center"><nobr>{{row.f_software_version}}</nobr></td>-->
            <!--<td style="text-align:center;width: 170px;"><nobr>{{row.f_hand_date}}</nobr></td>
            <td style="text-align:center"><nobr>{{row.f_last_hand_date}}</nobr></td>-->
            <!--<td style="text-align:center"><nobr>{{row.f_last_meter_state_msg}}</nobr></td>
            <td style="text-align:center"><nobr>{{row.f_table_msg}}</nobr></td>
            <td style="text-align:center"><nobr>{{row.f_parameter_state}}</nobr></td>
            <td style="text-align:center"><nobr>{{row.f_parameter_date}}</nobr></td>-->
          </tr>
        </template>
        <template partial='foot'></template>
      </data-grid>
    </criteria-paged>
  </div>
  <!--异常抄表录入-->
  <modal :show.sync="handshow" backdrop="false" v-ref:modal>
    <header class="modal-header" slot="modal-header">
      <button @click="handchange()" class="close" type="button"><span>&times;</span></button>
      <h4 class="modal-title">表号{{handExce.exceobj.f_meternumber}}</h4>
    </header>
    <article class="modal-body" slot="modal-body">
      <div class="col-sm-12">
        <label class="font_normal_body">上报异常类型</label>
        <textarea class="ver-textarea" style="width:60%" class="input_search" name="name"
                  placeholder='上报异常类型' rows="2"
                  style="width: 100%"
                  v-model='handExce.f_error_type'></textarea>
      </div>
      <div class="col-sm-12 form-group form-fix-width">
        <label class="font_normal_body">异常描述</label>
        <textarea class="ver-textarea" style="width:60%" class="input_search" name="name"
                  placeholder='上报异常类型'
                  rows="2" style="width: 100%"
                  v-model='handExce.f_error_msg'></textarea>
      </div>
    </article>
    <footer class="modal-footer" slot="modal-footer">
      <button @click='handchange()' class="btn btn-default" type="button" v-show="handshow">取消</button>
      <button @click='saveException' class="btn btn-success" type="button" v-show="handshow">确认</button>
    </footer>
  </modal>
</template>

<script>
  import {PagedList} from 'vue-client'
  import getLodop from '../../../plugins/LodopFuncs'
  import plugins from '../../../plugins/GetLoginInfoService'

  let readyGen = async function (self) {
    await self.$getConfig(self, 'HandManager')
    console.log('指令查看config', self.config)
    self.getfield = self.config.excelHeaders
    // self.reflash()
  }

  export default {
    title: '数据采集',
    data() {
      return {
        model: new PagedList('rs/sql/manage_getNewAllWebHandPlan', 50),
        row: null,
        // 搜索显示开关
        searchshow: true,
        // 抄表录入开关
        handshow: false,
        condition: '',
        criteriaShow: false,
        orgCondtionStr: '(' + this.$login.f.orgid + ')',
        orgid: [this.$login.f.orgid],
        getfield: {},
        config: {
          excelHeaders: {
            'f_orgname': '公司',
            'f_userinfo_code': '客户编号',
            'f_address': '客户地址',
            'f_user_name': '客户名称',
            'f_user_type': '用户类型',
            'f_gasproperties': '用气性质',
            'f_gas_date': '安装时间',
            'f_meternumber': '表号',
            'f_meter_brand': '气表品牌',
            // 'f_position': '安装位置',
            'f_meter_style': '气表型号',
            /*'f_curbalance': '期初余额',*/
            'f_last_tablebase': '上次抄表底数',
            'f_tablebase': '本次抄表底数',
            'f_oughtamount': '本次用气量(m³)',
            'f_oughtfee': '本次用气金额(元)',
            'f_curbalance': '剩余金额',
            'f_insert_date': '上报时间',
            'f_signal': '信号强度',
            'f_batterylevel': '电压',
            'f_valvestate': '阀门状态'

          }
        },
        Gasproperties: [],
        isdeal: true,
        getSignStatus: [
          {label: '全部', value: ''},
          {label: '已标记', value: 'is not null'},
          {label: '未标记', value: 'is null'}
        ],

        handExce: {
          //异常对象
          exceobj: {},
          //异常类型
          f_error_type: "",
          //异常描述
          f_error_msg: '',
        },
        show: false,
      }
    },
    props: ['searchobj', 'isdeal'],
    ready() {
      /*this.$refs.paged.$refs.criteria.model.startDate = Util.toStandardDateString() + ' 00:00:00'
      this.$refs.paged.$refs.criteria.model.endDate = Util.toStandardDateString() + ' 23:59:59'*/
      // this.$refs.paged.$refs.criteria.model.startDate1 = Util.toStandardDateString() + ' 00:00:00'
      // this.$refs.paged.$refs.criteria.model.endDate1 = Util.toStandardDateString() + ' 23:59:59'
      //初始化用户类型，用气性质，用气属性下拉框
      this.search({'condition': '1=1'})
      readyGen(this)
    },
    methods: {
      search1(){
        this.$refs.paged.$refs.criteria.search()
      },
      // 跳转处理页面
      dealmsg(val) {
        val.model = this.model.model
        this.$emit('deal-msg', val)
      },
      // 查询开关
      hidden() {
        this.criteriaShow = !this.criteriaShow
      },
      // 异常开关
      handchange(val) {
        if (val) {
          console.log("开启弹窗")
          this.handExce.exceobj = val
        } else {
          console.log("返回置空")
          this.handExce = {}
        }
        this.handshow = !this.handshow
      },
      // 保存输入
      saveException() {
        // 准备数据
        var Exejson = {}
        // 抄表记录id
        Exejson.data_id = this.handExce.exceobj.id
        // 异常表档案ID
        Exejson.f_userfiles_id = this.handExce.exceobj.f_userfiles_id
        // 异常户档案ID
        Exejson.f_userinfo_id = this.handExce.exceobj.f_userinfo_id
        // 异常表号
        Exejson.f_meternumber = this.handExce.exceobj.f_meternumber
        // 分公司
        Exejson.f_orgname = this.handExce.exceobj.f_orgname
        // 分公司编号
        Exejson.f_orgid = this.handExce.exceobj.f_orgid
        // 营业网点
        Exejson.f_outlets = this.handExce.exceobj.f_outlets
        // 组织机构
        Exejson.f_orgstr = this.handExce.exceobj.f_orgstr
        // 异常类型
        Exejson.f_error_type = this.handExce.f_error_type
        // 异常说明
        Exejson.f_error_msg = this.handExce.f_error_msg
        console.log("提交异常数据")
        console.log(Exejson)
        let param = {
          tablename: 't_exception',
          basedata: Exejson
        }
        try {
          this.$resetpost('rs/logic/saveTable', param, {resolveMsg: null, rejectMsg: null}).then((req) => {
            console.log(val)
            this.handExce = {}
            console.log("提交成功")
          }).then(() => {
            this.$showMessage("异常保存成功！")
          })
        } catch (e) {
          this.handExce = {}
          console.log("提交失败")
          this.$showMessage("异常保存失败！")
        }
        this.handshow = false
      },
      /*DealSignal(val){
        console.log(val.model.f_signal)
        if(val.model&&val.model.f_signal) {
          if (val.model.f_signal == '信号正常') {
            val.condition = val.condition + " and " + "f_signal>-100 "
          }
          if (val.model.f_signal == '信号异常') {
            val.condition = val.condition + " and " + "f_signal<-100 "
          }
        }
        return val
      },*/
      /*DealFaults(val){
        if (val.model&&val.model.faultstate){
          console.log(val.model.faultstate)
          val.model.faultstate.forEach((item) =>{
            if (item=='磁干扰'){
              val.condition=val.condition+" and "+"f_magneticInterference=1 "
            }
            if (item=='周期关阀'){
              val.condition=val.condition+" and "+"f_cycleShutValue=1 "
            }
            if (item=='过流保护关阀'){
              val.condition=val.condition+" and "+"f_overCurrentProtection=1 "
            }
            if (item=='关阀走气'){
              val.condition=val.condition+" and "+"f_leakageFlag=1 "
            }
            if(item=='拆表报警'){
              val.condition=val.condition+" and "+"f_SplitAlarm=1 "
            }
          })
        }
        return val
      },*/
      SaveAsFile(str) {
        this.$showMessage('您是否需要导出本页数据？', ['confirm', 'cancel']).then((res) => {
          if (res === 'confirm') {
            let style = '<style>' +
              'td {border-width: 1px;padding: 2px;border-style: solid; border-color:black; border-collapse:collapse;} .tdright{text-align: right;}  .tdcenter{text-align: center;}</style>';
            let strHtml = style + document.getElementById(str).innerHTML;
            console.log(strHtml);
            let LODOP = getLodop();
            LODOP.PRINT_INIT('');
            LODOP.ADD_PRINT_TABLE(5, 5, '99%', '100%', strHtml);
            LODOP.SAVE_TO_FILE('抄表查看.xls')
          }
        })
      },
      clearmsg() {
        this.$refs.paged.$refs.criteria.model = {}
      },
      search(args) {
        if (this.orgCondtionStr)
          args.condition = args.condition + `and ui.f_orgid in ${this.orgCondtionStr}`
        this.model.search(args.condition, args.model)
      },
      getRes(obj) {
        this.orgCondtionStr = plugins.convertToIn(obj)

        console.log('++++++++++++++++++', this.orgCondtionStr)
      },
    },

    watch: {
      // 监听查询对象
      'searchobj'(val) {
        if (this.searchobj != null) {
          this.$refs.paged.$refs.criteria.model.f_meternumber = this.searchobj.f_meternumber
          /*          this.$refs.paged.$refs.criteria.model.startDate = this.searchobj.model.startDate
                    this.$refs.paged.$refs.criteria.model.endDate = this.searchobj.model.endDate*/
          this.$refs.paged.$refs.criteria.search()
        }
      }
    },
    computed: {
      // 上报异常类型
      Excestates() {
        return [{label: '全部', value: ''}, ...this.$appdata.getParam('上报异常类型')]
      },
      Gasproperties() {
        return [{label: '全部', value: ''}, ...this.$appdata.getParam('用气性质')]
      },
      Gasusertype() {
        return [{label: '全部', value: ''}, ...this.$appdata.getParam('用户类型')]
      },
      Getuploadtype() {
        return [{label: '全部', value: ''}, ...this.$appdata.getParam('上报类型')]
      },
      //标记状态
      parameterState() {
        return [{label: '全部', value: ''}, ...this.$appdata.getParam('标记状态')]
      },
      //标记名称
      parameterName() {
        return [{label: '全部', value: ''}, ...this.$appdata.getParam('标记名称')]
      },
      // 故障状态
      FaultStates() {
        return [{label: '全部', value: ''}, ...this.$appdata.getParam('故障状态')]
        // return [
        //   {label: '磁干扰', value: '磁干扰'},
        //   {label: '周期关阀', value: '周期关阀'},
        //   {label: '过流保护关阀', value: '过流保护关阀'},
        //   {label: '关阀走气', value: '关阀走气'},
        //   {label: '拆表报警', value: '拆表报警'},
        // ]
      },
      SignalStates() {
        return [
          {label: '全部', value: '全部'},
          {label: '信号正常', value: '信号正常'},
          {label: '信号异常', value: '信号异常'},
        ]
      }
    }
  }
</script>
<style>
  .datapanel {
    color: #333;
    background-color: white;
    box-shadow: darkgrey 0.5px 0.5px 0.5px 0.5px;
    padding: 10px 30px 10px 30px;
    border-radius: 15px;
  }
</style>
