<template>
<div style="height:96%" class="auto">
    <criteria-paged :model="model" v-ref:paged >
      <criteria partial='criteria' @condition-changed='$parent.selfSearch' v-ref:cri>
        <div class="form-horizontal select-overspread container-fluid auto" novalidate partial>
          <p class="bg-info text-center" style="padding: 8px;font-size: 20px">短信信息
          </p>
          <div class="row">
            <!--<div  :class="{'col-sm-2 form-group':!$parent.$parent.$parent.isdetail,'col-sm-3 form-group':$parent.$parent.isdetail}">-->
            <div  class="col-sm-3 form-group">
              <label class="font_normal_body">组织机构</label>
              <res-select :initresid='$parent.$parent.curorgid'
                          @res-select="$parent.$parent.getorg"
                          class="select select_list"
                          restype='organization'
                          style="width: 60%">
              </res-select>
            </div>




           <div class="span" style="float:right;">
             <button class="button_search button_spacing width-60" @click="$parent.$parent.search()" v-el:cba>查询</button>
             <button class="button_clear button_spacing width-60" @click="$parent.$parent.confirms()" v-el:cba>推送</button>
<!--             <button class="button_clear button_spacing width-60" @click="$parent.$parent.showMsgDetail=!$parent.$parent.showMsgDetail" v-el:cba>查看发送详情</button>-->
             <button class="button_delete button_spacing width-60" @click="$parent.$parent.delete()"  v-el:cba>删除</button>
             <button class="button_delete button_spacing width-60" @click="$parent.$parent.deleteAll()"  v-el:cba>删除全部</button>
             <button v-show="$parent.$parent.alllist" class="button_clear button_spacing width-60" @click="$parent.$parent.retrun()"  v-el:cba>返回</button>
             <button class="button_export button_spacing" title="权限:短信导入"  v-show="$parent.$parent.smsMessaage.includes('短信导入')" @click="$parent.$parent.importSMS()">导入</button>
             <export-excel :data="$parent.$parent.getCondition"  sql-name="salegetSendAll"
                           template-name="短信信息导出" sqlurl="rs/logic/exportfile"
                           :field="$parent.$parent.getfield" :choose-col="true"></export-excel>
<!--             items: 'f_userinfo_id,f_user_name,f_user_phone,f_user_id, f_gas,f_amount,f_balance,f_arreamount,f_arrears_date,f_create_date,f_send_content,f_send,f_send_date, f_filiale,f_outlets',-->
<!--             orderitem: 'id',tablename: 't_sms',-->
             <div
               :class="{'button_shrink_top':$parent.$parent.criteriaShow,'button_shrink_bottom':!$parent.$parent.criteriaShow}"
               @click="$parent.$parent.hidden()" class="button_spacing" style="float: right">
             </div>
           </div>
          </div>
          <div class="row" v-show="$parent.$parent.criteriaShow">
            <div class="form-group col-sm-3">
              <label class="font_normal_body">短信类型</label>
              <v-select id="f_send_type"
                        v-model="model.f_send_type"
                        placeholder='短信类型'
                        style="width: 60%"
                        :value.sync="model.f_send_type"
                        :options='$parent.$parent.getsendType'
                        condition= "f_send_type = '{}'"
                        close-on-select>
              </v-select>
            </div>
            <div class="form-group col-sm-3">
              <label class="font_normal_body">发送状态</label>
              <v-select id="f_send"
                        v-model="model.f_send"
                        placeholder='发送状态'
                        style="width: 60%"
                        :value.sync="model.f_send"
                        :options='$parent.$parent.sendType'
                        condition= "f_send = '{}'"
                        close-on-select>
              </v-select>
            </div>
            <div class="form-group col-sm-3">
              <label class="font_normal_body">用户编号</label>
              <input  type="text" class="form-control" v-model="model.code" placeholder='用户编号' v-filter v-figure_filter
                      condition="code = '{}'" v-next-el='yhxm' style="width: 60%"
                      :size="model.code ? model.code.length  : 4">
            </div>
            <div class="form-group col-sm-3">
              <label class="font_normal_body">用户姓名</label>
              <input  type="text" class="form-control" v-model="model.f_user_name" placeholder='用户姓名'
                      condition="f_user_name = '{}'" v-next-el='yhxm' style="width: 60%"
                      :size="model.f_user_name ? model.f_user_name.length  : 4">
            </div>
            <div class="form-group col-sm-3">
              <label class="font_normal_body">用户电话</label>
              <input  type="text" class="form-control" v-model="model.f_user_phone" placeholder='用户电话'
                      condition="f_user_phone like '%{}%'" v-next-el='yhxm' style="width: 60%"
                      :size="model.f_user_phone ? model.f_user_phone.length  : 4">
            </div>

            <div class="form-group col-sm-3">
              <label class="font_normal_body">选择小区</label>
              <v-select :value.sync="model.f_residential_area" :value-single="true"
                        class="select_list select"
                        style="width: 60%"
                        :options='$parent.$parent.residentialArea' placeholder='选择小区'
                        close-on-select search="true">
              </v-select>
            </div>
            <div class="form-group  col-sm-3" title="短信生成开始时间">
              <label class="font_normal_body">生成日期</label>
              <datepicker id="f_create_start_date" placeholder="开始日期"
                          v-model="model.f_create_start_date"
                          :value.sync="model.f_create_start_date"
                          :disabled-days-of-Week="[]"
                          style="width: 60%"
                          condition="convert(varchar(10),f_createdate,120) >= '{}'"
                          :format="'yyyy-MM-dd'"
                          :show-reset-button="reset">
              </datepicker>
            </div>
            <div class="form-group col-sm-3" title="短信生成结束时间">
              <label class="font_normal_body">&emsp;&emsp;至&emsp;</label>
              <datepicker id="f_create_end_date" placeholder="结束日期"
                          v-model="model.f_create_end_date"
                          :value.sync="model.f_create_end_date"
                          :disabled-days-of-Week="[]"
                          style="width: 60%"
                          condition="convert(varchar(10),f_createdate,120) <= '{}'"
                          :format="'yyyy-MM-dd'"
                          :show-reset-button="reset">
              </datepicker>
            </div>
            <div class="form-group  col-sm-3" title="短信发送开始时间">
              <label class="font_normal_body">发送日期</label>
              <datepicker id="f_send_start_date" placeholder="开始日期"
                          v-model="model.f_send_start_date"
                          :value.sync="model.f_send_start_date"
                          :disabled-days-of-Week="[]"
                          style="width: 60%"
                          condition="convert(varchar(10),f_sendtime,120) >= '{}'"
                          :format="'yyyy-MM-dd'"
                          :show-reset-button="reset">
              </datepicker>
            </div>
            <div class="form-group col-sm-3" title="短信发送结束时间">
              <label class="font_normal_body">&emsp;&emsp;至&emsp;</label>
              <datepicker id="f_send_end_date" placeholder="结束日期"
                          v-model="model.f_send_end_date"
                          :value.sync="model.f_send_end_date"
                          :disabled-days-of-Week="[]"
                          style="width: 60%"
                          condition="convert(varchar(10),f_sendtime,120) <= '{}'"
                          :format="'yyyy-MM-dd'"
                          :show-reset-button="reset">
              </datepicker>
            </div>
            <div class="form-group col-sm-3">
              <label class="font_normal_body">评价级别</label>
              <v-select id="f_reply_type"
                        v-model="model.f_reply_type"
                        placeholder='评价级别'
                        style="width: 60%"
                        :value.sync="model.f_reply_type"
                        :options='$parent.$parent.replyType'
                        condition= "f_reply_type = '{}'"
                        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>
              <input type="checkbox"  @click="$parent.$parent.$parent.isAll(model.pageIndex)">
            </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">
            <input type="checkbox" v-model="$parent.$parent.$parent.ids"
            :value="row.id">
          </td>
          <td style="text-align:center"><nobr>{{$index+1}}</nobr></td>
          <td style="text-align:center"><nobr>{{row.code}}|{{row.f_user_name}}|{{row.f_user_phone}}</nobr></td>
<!--          <td style="text-align:center"><nobr>{{row.code}}</nobr></td>-->
          <td style="text-align:center"><nobr>{{row.f_phone}}</nobr></td>
          <td style="text-align:center"><nobr>{{row.f_send_type}}</nobr></td>
          <td style="text-align:center;width: 20px" :title="row.f_content"><nobr>{{row.f_content.substr(0,20)}}</nobr></td>
          <td style="text-align:center"><nobr>{{row.f_send}}</nobr></td>
          <td style="text-align:center"><nobr>{{row.f_sendtime}}</nobr></td>
          <td style="text-align:center"><nobr>{{row.f_statedetail}}</nobr></td>
          <td style="text-align:center"><nobr>{{row.f_reply_type}}</nobr></td>
          <td style="text-align:center"><nobr>{{row.f_result_msg}}</nobr></td>
          <td style="text-align:center"><nobr>{{row.f_reply_content}}</nobr></td>
          <td style="text-align:center"><nobr>{{row.f_operator}}</nobr>
          </td>
          <td :class="'back-blue'" style="text-align: center;" >
            <div v-if="row.f_state == '未发'">
              <button class="button_clear button_spacing width-50" @click="$parent.$parent.$parent.amendment(row)">修正</button>
              <button class="button_delete button_spacing width-50" @click="$parent.$parent.$parent.delete2(row)">删除</button>
            </div>
          </td>
        </template>
      </data-grid>
    </criteria-paged>
</div>
  <table class="table-hover">
    <tr class="table-bordered" style="position: relative">
      <td style="display: inline-block;width: auto;border-right: 1px solid #F2F6FA;padding: 0px 10px 0px 10px">
        短信条数:&emsp;{{model.sums.sumsend}}
      </td>
      <td style="display: inline-block;width: auto;border-right: 1px solid #F2F6FA;padding: 0px 10px 0px 10px">
        未发送:&emsp;{{model.sums.unsend}}
      </td>
      <td style="display: inline-block;width: auto;border-right: 1px solid #F2F6FA;padding: 0px 10px 0px 10px">
        待发送:&emsp;{{model.sums.tosend}}
      </td>
      <td style="display: inline-block;width: auto;border-right: 1px solid #F2F6FA;padding: 0px 10px 0px 10px">
        发送成功:&emsp;{{model.sums.hassend}}
      </td>
<!--      <td style="display: inline-block;width: auto;border-right: 1px solid #F2F6FA;padding: 0px 10px 0px 10px">-->
<!--        发送失败:&emsp;{{model.sums.failsend}}-->
<!--      </td>-->
      <td style="display: inline-block;width: auto;border-right: 1px solid #F2F6FA;padding: 0px 10px 0px 10px">
        已发合计:&emsp;{{model.sums.hassend+model.sums.failsend}}
      </td>
      <td v-if=" this.$appdata.getSingleValue('每年最多短信发送条数')" style="display: inline-block;width: auto;border-right: 1px solid #F2F6FA;padding: 0px 10px 0px 10px">
        本年剩余短信条数:&emsp;{{leftmsg}}
      </td>
      <td v-for="item in msgInfo.data" style="display: inline-block;width: auto;border-right: 1px solid #F2F6FA;padding: 0px 10px 0px 10px">
        {{item.f_send_type}}:&emsp;{{item.num}}
      </td>
    </tr>
  </table>
<!--  <table class="table-hover">-->
<!--    <tr class="table-bordered" style="position: relative">-->
<!--      <td v-for="item in msgInfo" style="display: inline-block;width: auto;border-right: 1px solid #F2F6FA;padding: 0px 10px 0px 10px">-->
<!--        {{item.f_send_type}}:&emsp;{{item.num}}-->
<!--      </td>-->
<!--    </tr>-->
<!--  </table>-->
  <modal :show.sync="arrshow" v-ref:modal backdrop="false">
    <header slot="modal-header" class="modal-header">
      <h4 class="modal-title">修正</h4>
    </header>
    <article slot="modal-body" class="modal-body">
      <div class="form-group">
        <input type="text" class="input_search" v-model="amendcontent" :value.sync="amendcontent"
               placeholder='短信内容'>
      </div>
    </article>
    <footer slot="modal-footer" class="modal-footer">
      <button v-show="arrshow" type="button" class="btn btn-default" @click='close'>取消</button>
      <button v-show="arrshow" type="button" class="btn btn-success" @click='create(row)'>确认</button>
    </footer>
  </modal>
  <modal :show.sync="showFile" v-ref:modal backdrop="true">
    <header slot="modal-header" class="modal-header">
      <button type="button" class="close" @click="closeFile"><span>&times;</span></button>
      <h4 class="modal-title">选择文件</h4>
    </header>
    <article slot="modal-body" class="modal-body">
      <div class="form-group">
        <file-upload class="my-file-uploader" name="importSms"  action="rs/file/uploadFile" tagname="确定" multiple v-ref:file></file-upload>
      </div>
    </article>
    <footer slot="modal-footer" class="modal-footer"></footer>
  </modal>
</template>

<script>
/**
*阶梯气价查询列表
*/
import { PagedList, HttpResetClass } from 'vue-client'
import Vue from 'vue'
export default {
  data () {
    return {
      criteriaShow: false,
      // 公司下拉
      curorgid: [this.$login.f.orgid],
      model: new PagedList('rs/sql/getSendAll', 20,{},{
        sumsend:0,
        unsend: 0,
        tosend: 0,
        hassend :0,
        failsend: 0
      }),
      msgInfo:[],
      showMsgDetail:false,
      f_send: '待发送',
      downDate: this.$login.toStandardDateString(),
      ids: [],
      show: false,
      pages: [],
      arrshow: false,
      alllist: false,
      // 修正的短信内容
      amendcontent: '',
      isFirst: true,
      amendid: '',
      // 小区
      residentialArea: [],
      sendType: [{label: '全部', value: ''}, ...this.$appdata.getParam('发送状态') ? this.$appdata.getParam('发送状态') : {}],
      getsendType: this.$appdata.getParam('短信类型'),
      replyType: this.$appdata.getParam('评价级别'),
      bodydata: ['f_user_name', 'code', 'f_phone', 'f_send_type', 'f_content', 'f_send', 'f_sendtime', 'f_statedetail', 'f_reply_type', 'f_reply_content', 'f_reply_content'],
      header: ['用户姓名', '用户编号', '电话号码', '短信类型', '短信内容', '发送状态', '发送时间', '状态报告', '评价级别', '回执状态', '评价内容'],
      showFile: false,
      leftmsg:0
    }
  },
  props: {
    condition: {
      type: String
    }
  },
  computed: {
    getCondition () {
      return {condition: this.$refs.paged.$refs.cri.condition}
    },
    getfield () {
      let data = {}
      this.bodydata.forEach((value, index) => {
        data[this.bodydata[index]] = this.header[index]
      })
      return data
      console.log('field' + data)
    }
  },
 async ready () {
   let dt = new Date()
   this.$refs.paged.$refs.cri.model.f_create_start_date= dt.getFullYear()+'-01-01 00:00:00'
   this.$refs.paged.$refs.cri.model.f_create_end_date= dt.getFullYear()+'-12-31 23:59:59'
   var maxsms=this.$appdata.getSingleValue('每年最多短信发送条数')
    if(maxsms){
      //默认查当年
      this.$refs.paged.$refs.cri.model.f_send_start_date= dt.getFullYear()+'-01-01 00:00:00'
      this.$refs.paged.$refs.cri.model.f_send_end_date= dt.getFullYear()+'-12-31 23:59:59'
      //获取本年剩余短信条数
      let http = new HttpResetClass()
      var sendmsg =await http.load('POST', 'rs/sql/singleTable_Count1',
        {data:
                {
                  tablename: 't_sms',
                  condition: `f_send='提交成功'
                     and  f_sendtime>=dateadd(year, datediff(year, 0, getdate()), 0)
                     and f_sendtime<= dateadd(year, datediff(year, 0, dateadd(year, 1, getdate())), -1)`
                }
             }, {resolveMsg: null, rejectMsg: null})
      this.leftmsg=maxsms-sendmsg.data[0].count
    }
    await this.getMsgTypes(this.$refs.paged.$refs.cri.model.f_create_start_date,this.$refs.paged.$refs.cri.model.f_create_end_date)
    this.getaddress()
    this.search()
    console.log('============>')
  },
  methods: {
    getorg (val) {
      this.f_orgid = this.$login.convertToIn(val)
      this.f_filialeid = val[0]
    },
    async getMsgTypes(startDate,endDate){
      let http2 = new HttpResetClass()
      var condition='1=1'
      if(startDate){
        condition+=` and f_sendtime>='${startDate}' `
      }
      if(endDate){
        condition+=` and f_sendtime<='${endDate}' `
      }
      this.msgInfo = await http2.load('POST', 'rs/sql/singleTable_OrderBy',
        {data:
            {
              items: 'f_send_type,count(*) num',
              tablename: 't_sms',
              condition: `${condition} group by f_send_type`,
              orderitem: ' f_send_type '
            }
        }, {resolveMsg: null, rejectMsg: null})
    },
    // showMsgDetail(){
    //
    // },
    importSMS () {
      this.showFile = true
    },
    // 关闭文件上传对话框
    closeFile () {
      this.showFile = false
      // 将选的文件清空
      this.$refs.file.$el.querySelector('input').value = ''
    },
    hidden () {
      this.criteriaShow = !this.criteriaShow
    },
    async  getaddress () {
      console.log('开始获取小区')
      let HttpReset = new HttpResetClass()
      var data = await HttpReset.load('POST', 'rs/sql/address_getarealist', {
        data: {
          condition: '1=1'
        }
      }, {resolveMsg: null, rejectMsg: '获取小区失败!'})
      console.log('小区', data)
      let house = []
      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.f_residential_area}
    //   })
    //   return data
    // },
    amendment (row) {
      this.arrshow = true
      this.amendid = row.id
    },
    delete () {
      if (this.ids.length !== 0) {
        this.$refs.paged.$refs.cri.condition = this.$refs.paged.$refs.cri.condition + 'and id in (' + this.ids + ')'
      }
      this.$showMessage('删除后不可恢复，确认删除？', ['confirm', 'cancel']).then((res) => {
        if (res === 'confirm') {
          this.$LogicService.deletMessage(this.$refs.paged.$refs.cri.condition).then((res) => {
            this.$dispatch('success')
          }).catch((error) => {
            this.$dispatch('error', error)
          })
        }
        this.$refs.paged.$refs.cri.search()
      })
    },
    deleteAll () {
      // 删除所有查询结果
      let self = this;
      if (this.model.model.count <= 0) {
        this.$showAlert('无短信需要被删除!','warning',2000);
        return;
      }
      this.$showMessage(`本次操作将删除当前查询页面中未发送或发送失败的所有短信,确认删除?`, ['confirm', 'cancel']).then(res => {
        if (res === 'confirm') {
          self.$LogicService.deletAllMessage(this.$refs.paged.$refs.cri.condition).then((res) => {
            self.$dispatch('success')
          }).catch(error => {
            self.$dispatch('error', error)
          })
        }
        self.$refs.paged.$refs.cri.search()
      })
    },
    delete2 (row) {
      let condition = '1=1' + ' and  id = ' + row.id
      this.$showMessage('删除后不可恢复，确认删除？', ['confirm', 'cancel']).then((res) => {
        console.log('删除2方法')
        if (res === 'confirm') {
          this.$LogicService.deletMessage(condition).then((res) => {
            this.$dispatch('success')
          }).catch((error) => {
            this.$dispatch('error', error)
          })
        }
        this.$refs.paged.$refs.cri.search()
      })
    },
    retrun () {
      this.alllist = false
      this.$dispatch('allchange2')
    },
    close () {
      this.arrshow = false
    },
    create () {
      if (this.amendcontent === '' || this.amendcontent === null) {
        this.$showAlert('短信内容不能为空', 'warning', 2000)
        return
      }
      this.arrshow = false
      // 组织数据
      let content = {
        // 批量减免金额
        f_content: this.amendcontent,
        f_operator: Vue.$login.f.name,
        f_operatorid: Vue.$login.f.id,
        f_orgid: Vue.$login.f.orgid,
        f_orgname: Vue.$login.f.orgs,
        f_depid: Vue.$login.f.depids,
        f_depname: Vue.$login.f.deps,
        id: this.amendid

      }
      console.log('数据id', content.id)
      this.$resetpost('rs/logic/amendcontent', content, {
        resolveMsg: null,
        rejectMsg: '修正短信内容出错!!!'
      }).then((res) => {
        this.search()
      })
    },
    confirms () {
      let data = {
        condition: this.$refs.paged.$refs.cri.condition

      }
      console.log('this.ids:', this.ids)
      console.log('-----------------------------' + data.condition)
      if (this.ids.length !== 0) {
        data.condition = data.condition + 'and id in (' + this.ids + ')'

        this.$showMessage(`您本次发送短信的条数为${this.ids.length}，是否确认下发？`, ['confirm', 'cancel']).then((res) => {
          if (res === 'confirm') {
            this.ids = []
            console.log('data1:', data)
            this.$LogicService.sendMessage(data).then((res) => {
              this.$dispatch('success')
              this.$refs.paged.$refs.cri.search()
            }).catch((error) => {
              this.$dispatch('error', error)
              this.$refs.paged.$refs.cri.search()
            })
          }
        })
      } else {
        this.$showMessage('是否确认全部发送？', ['confirm', 'cancel']).then((res) => {
          if (res === 'confirm') {
            this.ids = []
            console.log('data2:', data)
            this.$LogicService.sendMessage(data).then((res) => {
              this.$dispatch('success')
              this.$refs.paged.$refs.cri.search()
            }).catch((error) => {
              this.$dispatch('error', error)
              this.$refs.paged.$refs.cri.search()
            })
          }
        })
      }
    },
    search () {
      this.$refs.paged.$refs.cri.search()
      if (this.isFirst) {
        this.isFirst = false
      } else {
        this.$dispatch('allchange')
        this.alllist = true
      }
    },
    async selfSearch (args) {
      // this.condition = ' and convert(varchar(10),f_create_date,120) = ' + "'" + Util.toStandardDateString() + "'"
     // if (!Util.f.parent.parent.name.includes('统一资源管理')) {
       // args.condition = `${args.condition} and f_orgid = '${Vue.$login.f.orgid}'`
     // }
      // args.condition += this.condition
      if (!this.f_orgid) {
        this.getorg([this.$login.f.orgid])
      }
      await this.getMsgTypes(this.$refs.paged.$refs.cri.model.f_create_start_date,this.$refs.paged.$refs.cri.model.f_create_end_date)
      args.condition = `f_orgid  in ${this.f_orgid} and ${args.condition}`
      this.model.search(args.condition, this.model)
      this.ids = []
    },
    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.ids = []
        this.model.rows.forEach((row) => {
          if (!that.ids.includes(row.id)) {
            that.ids.push(row.id)
          }
        })
      } else { // 从ids中取消所有的数据
        this.ids = []
        this.model.rows.forEach((row) => {
          that.ids = that.ids.filter((item) => {
            return item !== row.id
          })
        })
      }
    }
  },
  events: {
    'onFileUpload': async function (file, res) {
      console.log('上传完毕' + JSON.stringify(res))
      let data = {
        filepath: res.f_downloadpath,
        f_operatorid: this.$login.f.f_operatorid,
        f_operator: this.$login.f.f_operator
      }
      console.log('filepath=' + JSON.stringify(data))
      await this.$resetpost(`rs/logic/importSms`, data, {resolveMsg: null, rejectMsg: '导入失败', silent: true}, 0).then((res) => {
        if (res.data.type == 'success') {
          this.$showAlert(`导入成功信息:${res.data.allSms}条,导入失败：${res.data.errorSms}`, res.data.type, 2000)
        } else {
          this.$showMessage(res.data.msg)
        }

        // 关闭上传框
        this.closeFile()
        // 重新查询
        this.selfSearch()
      })
    },
    'onFileError' (error) {
      this.$showAlert(error, 'warning', 2000)
    }
  }
}
</script>
<style>
  #tooltip {
    height: auto;
  }
</style>
