tableMixin.js 1.3 KB
import { mapGetters } from 'vuex'
import business from '@/api/business'
let mixin = {
  data () {
    return {
      formData: {
        pageSize: 10
      }
    }
  },
  computed: {
    ...mapGetters(['dicData'])
  },
  created () {
    this.featchData()
    this.keyupSubmit()
  },
  methods: {
    async handleXmlres (index, row) {
      try {
        let { result: res } = await business.queryXML(row.BSM_SJSB)
        if (res != null) {
          this.xml = res
          this.$refs.dialog.$refs.xmlDialog.isShow();
        } else {
          this.$message('报文为空')
        }
      } catch (error) {
        this.$alert(error, '提示', {
          confirmButtonText: '确定',
          type: 'error'
        })
      }
    },
    keyupSubmit () {
      document.onkeydown = e => {
        let _key = window.event.keyCode;
        if (_key === 13) {
          this.featchData()
        }
      }
    },
    // 表格索引得问题
    indexMethod (index) {
      return index + 1 + (this.form.currentPage - 1) * this.formData.pageSize;
    },
    handleSizeChange (val) {
      this.formData.pageSize = val
      this.featchData()
    },
    handleCurrentChange (val) {
      this.form.currentPage = val
      this.featchData()
    },
    handleSubmit () {
      this.featchData()
    }
  }
}
export default mixin