/*
 * @description:  付款信息弹框
 */
<template>
  <EMSTable
    ref="emsTable"
    :action="action"
    :columns="columns"
    :params="searchForm"
    :rowClickHandle="rowClick"
  >
    <Form
      ref="searchForm"
      slot="search-bar"
      :model="searchForm"
    >
      <FormItem
        prop="compName"
        label="公司名称"
      >
        <Input
          v-model="searchForm.compName"
          placeholder="请输入"
          type="text"
          clearable
        />
      </FormItem>
      <FormItem
        prop="bankName"
        label="银行名称"
      >
        <Input
          v-model="searchForm.bankName"
          placeholder="请输入"
          type="text"
          clearable
        />
      </FormItem>
    </Form>
    <div slot="handle-bar">
      <Button
        type="warning"
        icon="md-search"
        @click.native="search"
      >
        查询
      </Button>
      <Button
        type="info"
        icon="md-sync"
        @click.native="reset"
      >
        重置
      </Button>
    </div>
  </EMSTable>
</template>
<script>
export default {
  name: 'SelectPayInfo',
  props: {
    title: {
      type: String,
      default: '选择实际付款公司'
    },
    ouCode: {
      type: String,
      default: ''
    },
    ouName: {
      type: String,
      default: ''
    },
    bankName: {
      type: String,
      default: ''
    },
    paymentType: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      action: '/ems/ems-base-application/mdBank/findMdBankListByCondition',
      searchForm: {
        compCode: this.ouCode,
        compName: '',
        bankName: '',
        payMode: this.paymentType || '1',
        extend3: '对私付款银行'
      },
      columns: [
        {
          title: '公司名称',
          align: 'center',
          key: 'compName'
        },
        {
          title: '银行名称',
          align: 'center',
          key: 'bankName'
        },
        {
          title: '银行账户名',
          align: 'center',
          key: 'bankAccountName'
        },
        {
          title: '银行账号',
          align: 'center',
          key: 'bankAccountNum'
        }
      ]
    };
  },
  computed: {},
  created() {
    this.$emit('SetTitle', this.title);
  },
  mounted() {},
  methods: {
    onSelectRow(data) {
      debugger;
      if (data.length == 0) return;
      this.$emit('Close', data[0]);
    },
    search() {
      this.$refs.emsTable.load(this.searchForm);
    },
    reset() {
      this.$refs.searchForm.resetFields();
      this.$refs.emsTable.load(this.searchForm);
    },
    rowClick(selection) {
      debugger;
      if (selection) {
        this.$emit('Close', selection);
      }
    }
  }
};
</script>
