<template>
    <div class="auto">
        <validator name='v'>

            <div class="alert alert-warning" role="alert" style="color:darkred">
                <dl>
                    <dd style="line-height:30px;font-size: 30px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;清零后将清空用户当前的表上余额!</dd>
                </dl>
            </div>
            <div style="text-align:right;height:auto;margin-top:30px;margin-right:50px;">
                <button class="button_search btn-gn" @click="confirm()"  :disabled='!$v.valid'>确认</button>
                <button class="button_clear btn-gn" @click="clean()" >取消</button>
            </div>
        </validator>
    </div>
</template>
<script>
  /**
   *综合业务
   *发折组件
   */

  export default {
    title: '补卡管理',
    data () {
      return {
        model: {
          f_book_no: ''
        },
        print: false,
        bookData: {}
      }
    },
    props: ['row', 'cardData'],
    methods: {
      async confirm () {
        let param = {}
        if (this.row.f_meter_brand == '莱德物联网表') {
          param = {
            inputtor: this.$login.f.name,
            alias: this.row.f_alias,
            vsersion: this.row.version,
            userId: this.row.f_userfiles_id,
            moduleName: 'webmeter'
          }
        } else {
          let content = {
            meterno: this.row.f_meternumber
          }
          param = {
            content: content,
            title: '清零',
            alias: this.row.f_alias,
            vsersion: this.row.version,
            userId: this.row.f_userfiles_id,
            moduleName: 'SiZhuSystem',
            inputtor: this.$login.f.name
          }
        }
        console.log('row', this.row)
        let url = 'http://172.168.1.13:8445/webmeter/rs/logic/syncSaveInitializationTemplate'
        let data = {
          url: url,
          param: param
        }
        let res = await this.$resetpost('rs/logic/meterReset', data, {resolveMsg: '指令发送成功', rejectMsg: '指令发送失败'})
        this.$dispatch('success')
      },
      clean () {
        this.$dispatch('refresh')
      },
      close () {
        this.print = false
        this.clean()
      },
      printok () {
        this.$dispatch('success')
      }
    }
  }
</script>
