NNowhZzU
2023-12-25 fcd7ece15a86fc0cb526ee801ff8262b0db22dee
north-glass-erp/northglass-erp/src/views/sd/customer/SelectCustomer.vue
@@ -1,67 +1,153 @@
<script setup>
let orderList = $ref([
  {
    '0':'1',
    '1':'太仓卓高玻璃制品有限公司',
    '2':'A',
    '3':'100000',
    '4':'江苏太仓xxxx街道',
    '5':'张三',
    '6':'139xxxxxxxx',
  },
  {
    '0':'1',
    '1':'山西某某公司',
    '2':'A',
    '3':'100000',
    '4':'江苏太仓xxxx街道',
    '5':'张三',
    '6':'139xxxxxxxx',
import {reactive} from "vue";
import {useRouter} from  'vue-router'
let router=useRouter()
const getTableRow = (row,type) =>{
  switch (type) {
    case 'edit' :{
      //alert('我接收到子组件传送的编辑信息')
      router.push({path: '/main/customer/CreateCustomer', query: { id: row.id }})
      break
    }
    case 'delete':{
      alert('我接收到子组件传送的删除信息')
      break
    }
  }
])
}
let titleList = $ref([
  '客户编码',
  '名称',
  '客户等级',
  '信用额度',
  '地址',
  '联系人',
  '联系电话'
])
//子组件接收参数
const gridOptions = reactive({
  border:  "full",//表格加边框
  keepSource: true,//保持源数据
  align: 'center',//文字居中
  stripe:true,//斑马纹
  rowConfig: {isCurrent: true, isHover: true,height: 50},//鼠标移动或选择高亮
  id: 'CustomerList',
  showFooter: true,//显示脚
  printConfig: {},
  importConfig: {},
  exportConfig: {},
  scrollY:{ enabled: true },//开启虚拟滚动
  showOverflow:true,
  columnConfig: {
    resizable: true,
    useKey: true
  },
  filterConfig: {   //筛选配置项
    remote: true
  },
  customConfig: {
    storage: true
  },
  editConfig: {
    trigger: 'click',
    mode: 'row',
    showStatus: true
  },//表头参数
  columns:[
          {type:'expand',fixed:"left",slots: { content:'content' },width: 50},
          {type: 'seq',fixed:"left", title: '自序', width: 80 },
          {title: '操作', width: 110, slots: { default: 'button_slot' },fixed:"left"},
          {field: '0', title: '客户编码',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
          {field: '1', title: '名称',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
          {field: '2', title: '客户等级',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
          {field: '3', title: '信用额度',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
          {field: '4', title: '地址',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
          {field: '5', title: '联系人',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
          {field: '6', title: '联系电话',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true}
      ],//表头按钮
  toolbarConfig: {
    buttons: [],
    import: false,
    export: true,
    print: true,
    zoom: true,
    custom: true
  },
  data:  [
    {
      '0':'1',
      '1':'太仓卓高玻璃制品有限公司',
      '2':'A',
      '3':'100000',
      '4':'江苏太仓xxxx街道',
      '5':'张三',
      '6':'139xxxxxxxx',
    },
    {
      '0':'1',
      '1':'山西某某公司',
      '2':'A',
      '3':'100000',
      '4':'江苏太仓xxxx街道',
      '5':'张三',
      '6':'139xxxxxxxx',
    }
  ],//table body实际数据
  footerMethod ({ columns, data }) {//页脚函数
    return[
      columns.map((column, columnIndex) => {
        if (columnIndex === 0) {
          return '合计:'
        }
        // if (props.tableProp.footList.includes(column.field)) {
        //   return sumNum(data, column.field)
        // }
        return ''
      })
    ]
  }
})
</script>
<template>
  <div class="main-div-customer">
    <el-table
        :data="orderList"
        :header-cell-style="{ 'text-align': 'center' }"
        :cell-style="{ 'text-align': 'center' }"
        lazy
        border
    >
      <el-table-column type="expand" fixed>
        <template #default="props" >
          <div m="4">
    <vxe-grid
        max-height="100%"
        @filter-change="filterChanged"
        class="mytable-scrollbar"
        ref="xGrid"
        v-bind="gridOptions"
            <p m="t-0 b-2">客户相关信息</p>
    >
      <!--      @toolbar-button-click="toolbarButtonClickEvent"-->
      <!--      下拉显示所有信息插槽-->
      <template #content="{ row}">
        <ul class="expand-wrapper">
          <li  v-for="(item,key,index) in row">
            <span style="font-weight: bold">{{key+':  '}}</span>
            <span>{{ item }}</span>
          </li>
        </ul>
      </template>
      <!--左边固定显示的插槽-->
      <template #button_slot="{ row }">
        <el-button @click="getTableRow(row,'edit')" link type="primary" size="small">编辑</el-button>
        <el-button @click="getTableRow(row,'delete')" link type="primary" size="small">删除</el-button>
      </template>
      <template #num1_filter="{ column, $panel }">
        <div>
          <div v-for="(option, index) in column.filters" :key="index">
            <input type="type" v-model="option.data" @input="changeFilterEvent($event, option, $panel)"/>
          </div>
        </template>
      </el-table-column>
      <el-table-column label="操作" fixed width="110"  >
        <el-button link type="primary" size="small">编辑</el-button>
        <el-button link type="primary" size="small">删除</el-button>
      </el-table-column>
      <el-table-column
          :prop="index.toString()"
          :show-overflow-tooltip='true'
           v-for="(item,index) in titleList"
          :label="item" >
      </el-table-column>
    </el-table>
        </div>
      </template>
    </vxe-grid>
  </div>
</template>