<template>
  <div class="flex-row" v-if="!showdetail">
    <div id='app1' class="basic-main" v-show="(!echarts)&&(!isActiveTotalForm)">
      <criteria-paged :model="model" :pager='true' v-ref:paged>
        <criteria partial='criteria' @condition-changed='$parent.search' 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 style="width:60%" type="text" class="input_search"
                       v-model="model.f_userid"
                       placeholder='客户编号'
                       @keyup.enter="search"
                       condition="f_userid like '%{}%'"
                       v-el:xq v-next-el='f_userid'
                       v-el:username>
              </div>
              <div class="col-sm-2 form-group">
                <label class="font_normal_body">客户名称</label>
                <input style="width:60%" type="text" class="input_search"
                       v-model="model.f_username"
                       @keyup.enter="search"
                       placeholder='客户名称'
                       condition="f_username like '%{}%'"
                       v-el:xq v-next-el='f_username'
                       v-el:username>
              </div>
              <div class="col-sm-2 form-group">
                <label class="font_normal_body">客户地址</label>
                <input style="width:60%" type="text" class="input_search"
                       v-model="model.f_area" placeholder='地址'
                       condition="f_address like '%{}%'"
                       @keyup.enter="search"
                       v-el:xq v-next-el='address' v-el:area
                >
              </div>
              <div class="col-sm-2 form-group">
                <label class="font_normal_body">&nbsp;&nbsp;&nbsp;表号&nbsp;&nbsp;&nbsp;</label>
                <input style="width:60%" type="text" class="input_search"
                       v-model="model.f_meternumber" placeholder='表号'
                       @keyup.enter="search"
                       condition="f_meternumber like '%{}%'"
                       v-next-el='meternumber' v-el:meternumber>
              </div>
            <div style="float:right">
              <!--<button class="button_search button_spacing" @click="$parent.$parent.showmodal">下发</button>-->
                <button class="button_search button_spacing" @click="search()">查询</button>
                <button class="button_clear button_spacing" @click="$parent.$parent.clearmsg">清空</button>
              <export-excel :data="$parent.$parent.getCondition" class="button_export button_spacing"
                            :field="$parent.$parent.getfield"
                            sqlurl="rs/logic/exportfile" sql-name="DrillErrorByUserinfo" template-name='异常分析'
                            :choose-col="true"></export-excel>
                <!--<button class="button_export button_spacing" style="width: max-content" @click="$parent.$parent.showTotalForm()">显示汇总</button>-->
<!--                <button class="button_search button_spacing" @click="$parent.$parent.showEcharts()">显示图表</button>-->
              <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">
            <div class="col-sm-2 form-group">
              <label class="font_normal_body">客户类型</label>
              <v-select style="width:60%" id="f_usertype"
                        v-model="model.f_usertype"
                        placeholder='客户类型'
                        :value.sync="model.f_usertype"
                        :options='$parent.$parent.usertypes'
                        condition="f_usertype = '{}'"
                        close-on-select>
              </v-select>
            </div>
            <div class="col-sm-2 form-group">
              <label class="font_normal_body">用气性质</label>
              <v-select style="width:60%" id="f_gasproperties"
                        v-model="model.f_gasproperties"
                        placeholder='用气性质'
                        @keyup.enter="search"
                        :value.sync="model.f_gasproperties"
                        :options='$parent.$parent.Gasproperties'
                        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.f_gaswatchbrand"
                      v-model="model.f_gaswatchbrand"
                      :options='$parent.$parent.meterbrands' placeholder='请选择'
                      condition="f_gaswatchbrand = '{}'"
                      close-on-select></v-select>
          </div>
            <div class="col-sm-2 form-group">
              <label class="font_normal_body">上报区间</label>
              <datepicker style="width:60%" id="startdate" placeholder="开始时间"
                          v-model="model.startDate"
                          :value.sync="model.startDate"
                          :disabled-days-of-Week="[]"
                          :format="'yyyy-MM-dd HH:mm:ss'"
                          condition="f_insert_date >= '{}'"
                          :show-reset-button="reset">
              </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 style="width:60%" id="enddate" placeholder="结束日期"
                          v-model="model.endDate"
                          :value.sync="model.endDate"
                          :format="'yyyy-MM-dd HH:mm:ss'"
                          :disabled-days-of-Week="[]"
                          condition="f_insert_date <= '{}'"
                          :show-reset-button="reset">
              </datepicker>
            </div>
            <div class="col-sm-2 form-group">
              <label class="font_normal_body">异常级别</label>
              <v-select style="width:60%"
                        v-model="model.f_error_level"
                        placeholder='异常级别'
                        @change="$parent.$parent.getErrorInfo('f_error_type')"
                        :value.sync="model.f_error_level"
                        :options='$parent.$parent.GetErrorLevel'
                        condition="f_error_level = '{}'"
                        close-on-select>
              </v-select>
            </div>
<!--            <div class="col-sm-2 form-group">-->
<!--              <label class="font_normal_body">异常类型</label>-->
<!--              <v-select style="width:60%"-->
<!--                        v-model="model.f_error_type"-->
<!--                        placeholder='异常类型'-->
<!--                        :value.sync="model.f_error_type"-->
<!--                        :options='$parent.$parent.GetErrorType'-->
<!--                        condition="f_error_type = '{}'"-->
<!--                        close-on-select>-->
<!--              </v-select>-->
<!--            </div>-->
        </div>
        </div>
      </criteria>
      <data-grid id="lostuserlist" :model="model" class="list_area table_sy" partial='list' v-ref:grid>
        <template partial='head'>
          <tr>
            <!--<th>-->
              <!--<input type="checkbox"  @click="$parent.$parent.$parent.isAll(model.pageIndex)">-->
            <!--</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'>
          <!--<td style="text-align:center">-->
            <!--<input type="checkbox"` v-model="row.flag"-->
                    <!--@change="$parent.$parent.$parent.addRow($event,row,$index)">-->
          <!--</td>-->
          <!--<td style="text-align:center">-->
            <!--<input type="checkbox" v-model="$parent.$parent.$parent.ids"-->
                   <!--:value="row.flag" @click='$parent.$parent.$parent.addRow(row)'>-->
          <!--</td>-->
          <td style="text-align:center">
            <nobr>{{$index+1}}</nobr>
          </td>
          <td style="text-align: center;"><nobr>
            <!--<span @click="$parent.$parent.$parent.showmsg(row)"><a>{{row.f_userid}}</a></span>-->
            <span @click="$parent.$parent.$parent.dealmsg(row)"><a>{{row.f_userid}}</a></span>
          </nobr> </td>
          <td style="text-align:center"><nobr>{{row.f_username}}</nobr></td>
          <td>
            <nobr>{{row.f_phone}}</nobr>
          </td>
          <td>
            <nobr>{{row.f_address}}</nobr>
          </td>
          <td style="text-align:center">{{row.f_usertype}}</td>
          <td style="text-align:center">{{row.f_gasproperties}}</td>
          <td style="text-align:center"><nobr>{{row.f_meternumber}}</nobr></td>
          <td style="text-align:center">
            <nobr>{{row.f_gaswatchbrand}}</nobr>
          </td>
          <td style="text-align:center">
            <nobr>{{row.f_insert_date}}</nobr>
          </td>
          <td style="text-align:center">
            <nobr>{{row.f_error_level}}</nobr>
          </td>
          <td style="text-align:center">
            <nobr>{{row.f_error_msg}}</nobr>
          </td>
        </template>
      </data-grid>
    </criteria-paged>
      <!--<template-message :show="templateShow" :condition="model.condition" :ids="ids" v-ref:printbill v-on:toggle="close"></template-message>-->
  </div>
  <!--<div style="height: 40px;width: 100%;" v-show="echarts">
    <div style="display: inline-block;width: 20%;">
      <button class="button_search button_spacing" v-show="echarts" @click="notShowEcharts()">隐藏图表</button>
      <button class="button_search button_spacing" v-show="isActiveTotalForm" @click="notShowTotalForm()">隐藏汇总</button>
    </div>
    &lt;!&ndash;图显示模板&ndash;&gt;
    <div class="mystyle" style="display: inline-block;" >
      <label class="font_normal_body">图表统计项</label>
      <v-select style="width:60%"  id="groupname" v-model="groupname"
                placeholder='分组项'
                value-single="true"
                :value.sync="groupname"
                :options='getgroupname'
                close-on-select></v-select>
    </div>
  </div>
  <div v-show="echarts" style="width: 100%;height: 90%;">
    <new-exception-echarts :condition="condition" :startdate="startDate" :groupname="groupname[0]"
                           :enddate="endDate" :echarts="echarts"></new-exception-echarts>
  </div>
  <div v-show="isActiveTotalForm" style="width: 100%;height: 90%;">
    <new-exception-eform-total :condition="condition" :startdate="startDate"
                         :enddate="endDate"></new-exception-eform-total>
  </div>-->
  </div>
  <modal :show.sync="isShowUserException" >
    <header slot="modal-header" class="modal-header">
      <button type="button" class="close" @click="close()"><span>&times;</span></button>
      <h4 class="modal-title" align="center">下发申请</h4>
    </header>
    <article slot="modal-body" class="modal-body">
      <div style="padding-left: 8px" v-if="val1=='设置参数'">
        <label class="font_normal_body">参数类型</label>
        <v-select style="width:60%"
                  placeholder='参数类型'
                  :value.sync="parameterType"
                  v-model="parameterType"
                  :options='parameterTypeList'
                  close-on-select>
        </v-select>
      </div>
      <div class="form-group">
        <label>接单部门</label>
        <v-select :value.sync="model.f_meetunit"
                  :options='Receivingdepartment' placeholder='请选择'
                  close-on-select></v-select>
      </div>
      <div class="form-group">
        <label>接单人</label>
        <v-select :value.sync="model.f_order_man"
                  :options='Ordertakert' placeholder='请选择'
                  close-on-select></v-select>
      </div>
      <div class="col-sm-6 form-group form-fix-width">
        <label for="f_repair" class="control-label">报修类型</label>
        <v-select :value.sync="model.f_repairtype" :value-single="true"
                  :options='repairstypes' placeholder='报修类型'
                  close-on-select>
        </v-select>
      </div>
      <div class="col-sm-6 form-group form-fix-width">
        <label class="control-label">工单类型</label>
        <v-select :value.sync="model.f_workordertype" :value-single="true"
                  :options='Workordertype' placeholder='工单类型'
                  close-on-select>
        </v-select>
      </div>
      <div class="col-sm-6 form-group form-fix-width">
        <label class="control-label">报修级别</label>
        <v-select :value.sync="model.f_warrantylevel" :value-single="true"
                  :options='Warrantylevel' placeholder='报修级别'
                  close-on-select>
        </v-select>
      </div>
      <!--<div class="form-group " style="padding-left: 8px">-->
        <!--<label class="font_normal_body">申请原因：</label>-->
        <!--<textarea class="search_area" v-model="f_beizhu" rows="3" placeholder=""></textarea>-->
      <!--</div>-->
    </article>
    <footer slot="modal-footer" class="modal-footer">
      <button  type="button" class="btn btn-success btn-ln fr" @click='addApprovalValve()'>提交</button>
      <button  type="button" class="btn btn-info btn-ln fr" @click='sssclose()'>取消</button>
    </footer>
  </modal>
  <div  class="basic-main" v-if="showdetail">
    <user-info-detail-manage :f_userid="rowdata.f_userid" @cancel-main="cancel"></user-info-detail-manage>
  </div>
</template>

<script>
  import {HttpResetClass, PagedList} from 'vue-client'
  import * as Util from '../../../../Util'
  import getLodop from '../../../../plugins/LodopFuncs'
  import plugin from 'system-clients/src/plugins/GetLoginInfoService'

  let readySomething = async function (self) {
    await self.$MagLoadParams.loadParam()
    self.initParams()
  }
  export default {
    title: '异常查看',
    props: ['data'],
    data() {
      return {
        flag:'',
        f_workordertype:'',
        f_warrantylevel:'',
        f_repairtype:'',
        f_username:'',
        f_add_gas:'',
        ides:'',
        s:'',
        f_userid:'',

        model:{
          f_meetunit:'',
          f_order_man:'',
          f_repairtype:'',
          f_workordertype:'',
          f_warrantylevel:''
        },
        model: new PagedList('rs/sql/DrillErrorByUserinfo', 20),
        reportStr: null,
        show: false,
        startDate: '',
        endDate: '',
        isShowUserException:false,
        ids: [],
        pages: [],
        b:[],
        obj:'',
        repairstypes : this.$appdata.getParam('报修类型'),
        serviceList: null,
        f_service_id: '' ,
        // meterbrands: [],
        f_error_type:'',
        groupname: ['year'],
        states: [
          {label: '全部', value: ''},
          {label: '处理中', value: '处理中'},
          {label: '已完成', value: '已完成'}
        ],
        getgroupname: [
          {label: '年份', value: 'year'},
          {label: '月份', value: 'month'},
          {label: '周', value: 'week'},
          {label: '日', value: 'day'}
        ],
        getfield:{
          "f_userid":"客户编号", "f_username":"客户名称", "f_address":"客户地址","f_usertype":"客户类型","f_gasproperties":"用气性质",
          "f_meternumber":"表号","f_gaswatchbrand":"气表品牌","f_insert_date":"上报时间","f_error_level":"异常级别",
          "f_error_msg":"异常描述"
        },
        outlets: [],
        operator: [],
        showdetail:false,
        rowdata:{},
        filename: '',
        criteriaShow: false,
        echarts: false,
        searchshow: false,
        isActiveTotalForm: false,
        // GetErrorLevel:[],
        GetErrorType:[],
        condition: '1=1',
        org:[this.$login.f.orgid]
      }
    },
    ready() {
      readySomething(this)
      this.$refs.paged.$refs.cri.model.startDate = Util.toStandardDateString() + ' 00:00:00'
      this.$refs.paged.$refs.cri.model.endDate = Util.toStandardDateString() + ' 23:59:59'
      // console.log("type:"+this.$refs.paged.$refs.cri.model.f_error_type)
      this.getErrorInfo('f_error_level')
      // console.log("type:"+this.$refs.paged.$refs.cri.model.f_error_type)
      this.$refs.paged.$refs.cri.search()
    },
    methods: {
      async addApprovalValve () {
        console.log(this.b)
        let http = new HttpResetClass()
        var man=this.model.f_order_man.toString()
        var main=this.model.f_meetunit.toString()
        // var man = JSON.stringify(this.model.f_order_man)
        // var main = JSON.stringify(this.model.f_meetunit)
        for(var i = 0;i<this.b.length;i++)  {
          let createsms = {
            model: {
              serviceacitivity: [{f_service_acitivity_type: "派单"}],
              f_service_id: "",
              f_contact_phone: "",
              f_meetunit:main,
              f_phone: "",
              f_user_name:this.b[i].f_username ,
              f_address:this.b[i].f_address,
              f_remarks:this.b[i].f_error_msg,
              f_user_type:"",
              f_area: "",
              f_street: "",
              f_residential_area: "",
              f_building: "",
              f_unit: "",
              f_floor:"",
              f_room: "",
              f_jibie:this.model.f_warrantylevel,
              f_handlingtype:"转交维修",
              f_repairtype: this.model.f_repairtype,//报修类型
              f_userinfo_id:this.b[i].f_userid,
              f_baworktype:this.model.f_workordertype,
              f_order_man: man ,
              failure:[{f_failure_type:""}],
              aState:"",
              f_casetype:""
            },
            loginUser: {name: this.$login.f.name ,ename:"",f_fengongsi:""},
            user: {f_userid:"",f_filiale:""},
            callObj: null,
            levelsend:"一级"
          }
           await http.load('POST','rs/logic/callerSend', { data:createsms}).then((res) => {
            console.log("===================================")
            console.log(res)
            console.log(res.data.id)
            let obj = eval('(' + res.data.id + ')');
            let ides=obj.id
            console.log("------------------------------------------------")
            console.log(ides)
          })
           // let ides=obj.ides
          // console.log("222222222222222222222222222222222")
          // console.log(obj.id)
          // console.log(ides)
          let security={
            safetyinspection:ides,
            f_userid:this.b[i].f_userid,
            f_username:this.b[i].f_username
          }
          console.log("123132331231321321313131313231")
          console.log(security)
          this.$resetpost('rs/logic/callforrepairs',{data:security}).then((res) =>{

          })
          // this.$resetpost('rs/logic/callerSend', { data:createsms}).then((res) => {
          //   // this.id = res.data.id
          //  })

          // this.$resetpost('rs/logic/callerSend', { data:this.id}).then((res) => {
          //   entiy.prisave($t_meterread$,row)
          //   this.id = res.data.id
          // })
        }

      },
      // sendMessage () {
      //   let tempcondition = this.model.condition
      //   if (this.ids.length !== 0) {
      //     this.model.condition = this.model.condition + 'and id in (' + this.ids + ')'
      //   }
      //   this.$resetpost('rs/logic/sendSms', {condition: this.model.condition}).then((res) => {
      //     this.$dispatch('success')
      //   }).catch((error) => {
      //     this.$dispatch('error')
      //   })
      //   this.ids = []
      //   this.model.condition = tempcondition
      // },
      // create (args) {
      //   // let tempcondition = this.model.condition
      //   // if (this.ids.length !== 0) {
      //   //   this.model.condition = this.model.condition + 'and f_userinfo_id in (' + this.ids + ')'
      //   // }
      //   /* this.$dispatch('create', this.model.condition, this.userdefinedMessage)*/
      //   let createsms = {
      //     issend: args,
      //     usermsg: this.userdefinedMessage,
      //     userinfoid: this.ids,
      //     condition: this.model.condition,
      //     operatorname: this.$login.f.name,
      //     f_filiale: this.$login.f.f_fengongsi,
      //     f_outlets: this.$login.f.f_parentname,
      //     f_orgstr: this.$login.f.orgpathstr,
      //     f_filialeids: this.$login.f.f_orgids
      //   }
      //   this.$resetpost('rs/logic/CreateUserSMS', { data: createsms }, ).then((res) => {
      //   })
      //   this.ids = []
      //   this.model.condition = tempcondition
      // },
      showmodal(){
        this.isShowUserException=true
      },
      sssclose(){
        this.isShowUserException=false
      },
      addRow(event,row,num){
        console.log(event.target.checked)

        console.log("查看event",event)
        debugger
        if(event.target.checked == true){
          this.b.push(row)
          // console.log(this.b)
        }else{
          this.b =[]
          // console.log(this.b)
        }
        console.log(this.b)
      },
      isAll (page) {
        if (this.pages.includes(page)) { // 已添加,取消动作
          // 从ids中删除本页所有数据的ids
          this.addOrRemove(false)
          this.pages = this.pages.filter((item) => {
            return item !== page
          })
        } else { // 未添加
          this.pages.push(page) // 添加id，添加动作
          this.addOrRemove(true)
        }
      },
      addOrRemove (is) {
        let that = this
        if (is) { // 添加本页所有数据到ids中
          this.model.rows.forEach((row) => {
            if (!that.ids.includes(row)) {
              that.ids.push(row)
            }
          })
        } else { // 从ids中取消所有的数据
          this.model.rows.forEach((row) => {
            that.ids = that.ids.filter((item) => {
              return item !== row
            })
          })
        }
        console.log(this.ids)
      },
      showmsg(obj){
        this.rowdata=obj
        this.showdetail=true
      },
      cancel() {
        this.showdetail = false
      },
      initParams () {
        let arr = []
        this.$MagGetSaleParam.getGasbrand().forEach((item) => {
          let temp = {}
          if(item.value.f_meter_type==='物联网表'){
            temp.label = item.label
            temp.value = item.label
            arr.push(temp )
          }
        })
        // this.meterbrands = [{label: '全部', value: ''}, ...arr]
      },
      dealmsg(val) {
        val.model = this.model.model
        this.$emit('deal-msg', val)
      },
      hidden(){
        this.criteriaShow = !this.criteriaShow
      },

      clickshow() {
        this.searchshow = !this.searchshow
      },
      getErrorInfo(items){
          let self = this
        let f_error_level=''
        if (items!='f_error_level') {
          if(this.$refs.paged.$refs.cri.model.f_error_level){
            f_error_level=this.$refs.paged.$refs.cri.model.f_error_level[0]
          }
        }
          let load = new HttpResetClass()
          load.load('POST', 'rs/sql/singleTableParam', {
            data: {
              items:items+' f_type',
              tablename:'t_exception',
              condition:items=='f_error_level'?'1=1 group by '+items:`f_error_level='${f_error_level}' group by `+items
            }
          },{warnMsg:null,resolveMsg:null}).then((res) => {
            let i = 0
            let rows=res.data
            let array1=[]
            array1.push({label: '全部', value: ''})
            console.log("rows========",rows)
            for (i = 0; i < rows.length; i++) {
              let dr = {label: '全部', value: ''}
              dr.label=rows[i].f_type
              dr.value=rows[i].f_type
              array1.push(dr)
              console.log("rows[i]========",rows[i],dr)
            }
            console.log("array1========",array1)
            // if (items=='f_error_level'){
            //   self.GetErrorLevel=array1
            // }else {
            //   self.GetErrorType=array1
            // }
          })

      },
      search(args) {
        this.startDate = this.$refs.paged.$refs.cri.model.startDate
        this.endDate = this.$refs.paged.$refs.cri.model.endDate
        this.f_error_type=this.$refs.paged.$refs.cri.model.f_error_type
        console.log('1231321312312321')
       /* if (this.endDate == '' || this.startDate == '') {
          return this.$showMessage("时间区间的开始和结束时间不能为空！")
        }*/
          this.condition = this.$refs.paged.$refs.cri.condition

        args.condition = this.condition
        this.model.search(args.condition, args.model)
      },
      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')
          }
        })
      },
      getEmp () {
        let val = {source: 'this.getParentByType($department$).getChildByName($维修员$).getUsers()', userid: `${this.$login.f.id}`}
        let http = new HttpResetClass()
        http.load('POST', '/rs/search', {data: val}, {resolveMsg: null, rejectMsg: null}).then((res) => {
          res.data.forEach((item) => {
            let http1 = new HttpResetClass()
            http1.load('POST','rs/sql/tel_singleTable_OrderBy', {data: {
                items: 'f_user_telephone',
                tablename: 't_user',
                condition: `id  =  ${item.id}`,
                orderitem: 'id'
              }}, {resolveMsg: null, rejectMsg: null}).then((ress) => {
              this.repairers.push({label: `${item.name}：${ress.data[0].f_user_telephone}`, value: item.name})
            })
          })
        })
      },
      clearmsg() {
        this.$refs.paged.$refs.cri.model = {}
      },
      close() {
        this.show = false
      },
      // 显示柱状图
      showEcharts() {
        this.echarts = true
        this.isActiveTotalForm = false
      },
      notShowTotalForm() {
        this.echarts = false
        this.isActiveTotalForm = false
      },
      // 不显示柱状图
      notShowEcharts() {
        this.echarts = false
        this.isActiveTotalForm = false
      },
      // 显示汇总数据表格
      showTotalForm() {
        this.echarts = false
        this.isActiveTotalForm = true
      }
    },
    watch: {
      'data'(val) {
        if (val.f_files_path) {
          this.getFileContent(val.f_files_path)
        } else {
          this.reportStr = null
        }
      }
    },
    computed: {
      // usertypes () {
      //   return this.$appdate.getParams("客户类型")
      // },
      getCondition() {
        let condition=this.$refs.paged.$refs.cri.condition
        return {
          condition: condition  ,
          startDate:`${this.$refs.paged.$refs.cri.model.startDate}`,
          endDate:`${this.$refs.paged.$refs.cri.model.endDate}`
        }
      },
      usertypes() {
        return [{label: '全部', value: ''}, ...this.$appdata.getParam('用户类型')]
      },
      meterbrands() {
        return [{label: '全部', value: ''}, ...this.$appdata.getParam('气表品牌')]
      },
      GetErrorLevel() {
        return [{label: '全部', value: ''}, ...this.$appdata.getParam('异常级别')]
      },
      Receivingdepartment() {
        return [{label: '全部', value: ''}, ...this.$appdata.getParam('接单部门')]
      },
      Workordertype(){
        return [{label: '全部', value: ''}, ...this.$appdata.getParam('工单类型')]
      },
      Warrantylevel(){
        return [{label: '全部', value: ''}, ...this.$appdata.getParam('报修级别')]
      },
      // Ordertakert() {
      //   return [{label: '全部', value: ''}, ...this.$appdata.getParam('接单人')]
      // },
      // Gasproperties() {
      //   return [{label: '全部', value: ''}, ...this.$appdata.getParam('用气性质')]
      // }
      Ordertakert(){
        let rss=[]
        if (this.model.f_meetunit.length===1){
          rss=this.$appdata.getParam(this.model.f_meetunit[0])
        }
        return[{lable:'全部',value:''}, ...rss]
      },
      Gasproperties () {
        let rs=[]
        if (this.$refs.paged.$refs.cri.model.f_usertype.length===1){
                 rs=this.$appdata.getParam(this.$refs.paged.$refs.cri.model.f_usertype[0])
        }
        return[{lable:'全部',value:''}, ...rs]
      }

    }
  }
</script>
<style>
  .form-input-group label {
    text-align: right;
    width: auto;
  }

  .mystyle {
    float: right;
    padding-right: 10%;
  }

  .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>
