selectMutiProDialog.vue 1.9 KB
<!-- 选择商品弹窗 -->
<template>
  <glsx-dialog class="muti-pro" title="选择商品" :isVisible.sync="isMutiSelectVisible" width="70%" @confirmDialog="handleMutiSelectConfirm" @closeDialog="handleMutiSelectClose">
    <GLTable ref="mutiProRef" :searchForm="searchForm" :tableParams="tableParams" :tableData="tableData" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn"></GLTable>
  </glsx-dialog>
</template>

<script>
import glsxDialog from '@/components/glsx-dialog'
export default {
  name: 'selectMutiProDialog',
  data() {
    return {
      // 表格组件
      getListApi: '',
      tableData: [
        {
          id: 1,
          name: '商品名称1'
        },
        {
          id: 2,
          name: '商品名称2'
        }
      ],
      pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
      // 表格参数
      tableParams: {
        listName: 'list',
        // 行数据的key
        mutiSelectUniqueKey: 'id',
        // 多选ref的名称
        mutiSelectName: 'list',
        tableOption: true,
        tableColumns: [
          {
            label: '商品名称',
            prop: 'name'
          },
          {
            label: '缩略图',
            prop: 'title'
          },
          {
            label: '价格(元)',
            prop: 'status'
          },
          {
            label: '来源门店',
            prop: ''
          }
        ]
      }
    }
  },

  props: {
    isMutiSelectVisible: {
      type: Boolean,
      default: false
    }
  },

  components: {
    glsxDialog
  },

  mounted() {},

  methods: {
    handleMutiSelectConfirm() {
      var selectedData = this.$refs.mutiProRef.mutiSelectArr[this.tableParams.mutiSelectName]
      console.log(selectedData)
      this.$emit('handleMutiSelectConfirm', selectedData)
    },
    handleMutiSelectClose() {
      this.$emit('handleMutiSelectClose')
    }
  }
}
</script>
<style></style>