<template>
    <div class="auto" style="overflow:auto;">
        <validator name='v'>
            <form novalidate class="form-horizontal">
                <div class="row auto" >

                </div>

                <div style="text-align:right;height:auto;">
                    <button class="button_search" type="button" @click="saveobj()"
                    >确认
                    </button>
                    <button class="button_clear" type="button" @click="clean()" >取消
                    </button>
                </div>
                <!--<div style="height: auto;width: 100%">-->
                <!--<div style="height: 10%">-->
                <!--<img style="margin-top: -5px" src="../../../../../../static/images/lefticon/矩形1183.png">-->
                <!--<a style="font-size: 16px;font-weight: 500;color: #333;text-decoration: none;">附件信息</a>&nbsp;<a style="color: #999999"></a>-->
                <!--</div>-->
                <!--<upload :blodid="row.f_userinfo_id" isremark="true" fusetype="换表"></upload>-->
                <!--</div>-->
            </form>
        </validator>
    </div>
</template>
<script>
/**
 *换表管理
 *组合界面，加载机表，物联网表，气量卡表，金额卡表旧表信息，以及控制显示换新表信息
 */
import { HttpResetClass } from 'vue-client'
export default {
  title: '换表登记',
  data () {
    return {
      resid: [],  // 存放新增的f_files表中id
      model: {
        metermessage: {
          f_meter_type: '',
          gasbrand: '',
          gasmodel: '',
          f_meternumber: '',
          f_meter_base: 0,
          f_metertitles: '',
          f_oldmeter_use_reference: 0 // 旧表使用量参考值
        },
                // 旧表底数
        f_using_base_old: '',
                // 换表补气量
        f_remanent_gas: 0,
                // 换表补气单价
        f_remanent_price: 0,
        f_remanent_money: 0,
        f_type: '换新表',
        f_comments: '',
        f_othereason: '',
        f_payment: '现金缴费',
        f_print: '普通收据',
        f_state: '有效',
        f_changemeter_date: this.$login.toStandardTimeString(),
        f_changemeter_fee: this.$appdata.getSingleValue('换表金额') ? this.$appdata.getSingleValue('换表金额') : 0
      },
      meterinfo: false,

            // 控制气量和金额的转换显示
      changeType: '',
      config: {
        showupload: true, //
        dispatch: false // 是否派工
      },
            // 控制气量金额的编辑
      isGas: false,
      replacewatchtype: this.$appdata.getParam('换表类型'),
      reason: this.$appdata.getParam('换表原因') ? this.$appdata.getParam('换表原因') : [],
      paytype: this.$appdata.getParam('付款方式'),
      printstyle: this.$appdata.getParam('打印格式'),
      gasproperties: [],
      newinfo: {
        f_user_type: '',
        f_gasproperties: '',
        pricetype: '',
        pricename: '',
        f_perform_date: this.$login.toStandardDateString() + ' 00:00:00' // 操作时间
      },
      usertypes: this.$appdata.getParam('用户类型') ? [{label: '全部', value: ''}, ...this.$appdata.getParam('用户类型')] : [],
      pricetypes: this.$appdata.getParam('气价类型') ? [{label: '全部', value: ''}, ...this.$appdata.getParam('气价类型')] : []
    }
  },
  props: ['row'],
  ready () {

  },
  events: {

  },
  methods: {
        // 返回
    clean () {
      this.$dispatch('success', '换表', this.row)
    },
    async saveobj () {
      let data = {
        f_userfiles_id: {
          f_userfiles_id: this.row.f_userfiles_id,
          f_table_state: '正常',
          version: this.row.version
        },
        f_meter_type: this.row.f_meter_type,
        f_userfile_id: this.row.f_userfiles_id,
        f_user_id: this.row.f_user_id,
        f_userinfo_id: this.row.f_userinfo_id,
        f_user_name: this.row.f_user_name,
        f_operat_type: '表具复位',
        f_describe: `${this.$login.f.name}对客户${this.row.f_user_name}进行表具复位操作`,
        f_state: '有效',
        f_operator: this.$login.f.name,
        f_operatorid: this.$login.f.id,
        f_orgid: this.$login.f.orgid,
        f_orgname: this.$login.f.orgs,
        f_depid: this.$login.f.depids,
        f_depname: this.$login.f.deps,
        f_zoneid: this.$login.f.zoneid,
        f_zones: this.$login.f.zones
      }
      await this.$resetpost('rs/logic/removeTableCancel', data, {resolveMsg: '复拆表成功', rejectMsg: '复拆表失败'})
      this.$dispatch('success')
    }

  },

  watch: {

  }
}
</script>
