<template>
  <Input
    :value="value"
    :disabled="disabledFlag"
    :buCode="buCode"
    icon="log-in"
    readonly
    @input="handleInput"
    @click.native="showVendorBankTable"
  ></Input>
</template>
<script>
/**
 * 根据供应商名称查询供应商银行账号信息
 */
import PayInfoForm from './PayInfoForm';
export default {
  name: 'PayInfo',
  components: { },
  directives: {},
  props: {
    size: {
      type: String,
      default() {
        return '';
      }
    },
    title: {
      type: String,
      default() {
        return '付款信息';
      }
    },
    value: {
      type: String,
      default() {
        return '';
      }
    },
    buCode: {
      type: String,
      default() {
        return '';
      }
    },
    payRequestLineId: {
      type: [String, Number],
      default() {
        return '';
      }
    },
    payLineId: {
      type: [String, Number],
      default() {
        return '';
      }
    },
    showAmount: {
      type: Boolean,
      default() {
        return false;
      }
    },
    applyAmount: {
      type: [String, Number],
      default() {
        return 0;
      }
    },
    checkFlag: {
      type: Boolean,
      default() {
        return false;
      }
    },
    disabledFlag: {
      type: Boolean,
      default() {
        return false;
      }
    },
    compName: {
      type: String,
      default() {
        return '';
      }
    },
    companyCode: {
      type: String,
      default() {
        return '';
      }
    },
    initFun: {
      type: Function,
      default() {
        return function() {};
      }
    }
  },
  data() {
    return {};
  },
  computed: {},
  watch: {},
  created: function() {},
  beforeMount: function() {},
  mounted: function() {},
  beforeDestroy: function() {},
  destroyed: function() {},
  methods: {
    handleInput(value) {
      this.$emit('input', value);
    },
    showVendorBankTable(refreshFun, checkFlag, categoryCode) {
      let flag = false;// 判断付款信息是否可以编辑
      if (!refreshFun) {
        refreshFun = function() {};
      }
      if (checkFlag) {
        flag = checkFlag;
      } else {
        flag = this.checkFlag;
      }
      if (this.disabledFlag) {

      } else {
        new this.$pageModal(
          PayInfoForm,
          {
            props: {
              title: this.title,
              payRequestLineId: this.payRequestLineId,
              showAmount: this.showAmount,
              applyAmount: this.applyAmount,
              payLineId: this.payLineId,
              compName: this.compName,
              companyCode: this.companyCode,
              initFun: this.initFun,
              refreshFun: refreshFun,
              checkFlag: flag,
              categoryCode: categoryCode
            },
            on: {
              save: () => {
                this.$emit('save');
              },
              delete: () => {
                this.$emit('delete');
              }
            }
          },
          data => {
            if (data) {
              this.$emit('handleSelect', data);
            }
          }
        );
      }
    }
  }
};
</script>
<style lang="less" scoped>
</style>
