selectMerchant.vue 2.81 KB
<template>
  <div>
    <el-dialog title="提示" :visible.sync="dialogVisible" width="50%" :before-close="!dialogVisible">
      <span>
        <glsx-combi-form ref="showSearch" :formObj="searchForm" :formData="searchFormData">
          <span slot="footer" class="footer-btns">
            <el-button :size="size" type="primary" @click="handleSearch">搜索</el-button>
          </span>
        </glsx-combi-form>
        <GLTable ref="merchantTable" :noDataImg="url" :searchForm="searchForm" :tableParams="tableParams" :pageConf="pageConf" :tableData="tableData" highlight-current-row @current-change="handleCurrentChange"></GLTable>
      </span>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="handleConfirm">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import url from '@/assets/empty.png'
export default {
  name: 'SelectMerchant',
  data() {
    return {
      url,
      dialogVisible: false,
      selectData: '',
      searchForm: {
        merchantName: ''
      },
      searchFormData: [
        {
          label: '关键字:',
          name: 'merchantName',
          type: 'input',
          maxlength: 20,
          placeholder: '请输入滴加商户名称或商户号进行搜索',
          isClear: true
        }
      ],
      tableParams: {
        listName: 'list',
        tableOption: false,
        tableColumns: [
          {
            label: '滴加商户名',
            prop: 'merchantName',
            line: 2
          },
          {
            label: '滴加商户号',
            prop: 'merchantID',
            line: 2
          }
        ]
      },
      pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
      tableData: [
        {
          merchantName: '滴滴虎',
          merchantID: 111
        },
        {
          merchantName: '滴滴虎',
          merchantID: 222
        },
        {
          merchantName: '滴滴虎',
          merchantID: 333
        },
        {
          merchantName: '滴滴虎',
          merchantID: 444
        }
      ]
    }
  },
  methods: {
    init() {
      this.dialogVisible = true
    },
    handleSearch() {
      this.$refs.merchantTable.refreshTable()
    },
    handleClose(done) {
      this.$confirm('确认关闭?')
        .then(_ => {
          done()
        })
        .catch(_ => {})
    },
    // 触发单选
    handleCurrentChange(val) {
      // console.log(val, 'currentRow')
      this.selectData = val
    },
    // 点击确定,传递单选数据
    handleConfirm() {
      alert('111')
      console.log(this.selectData, '124')
      this.$emit('selectMerchant', this.selectData)
      this.dialogVisible = false
    }
  }
}
</script>

<style lang="scss" scoped>
</style>