NNowhZzU
2023-12-27 97c3f97a11524d8bacc6d36cf2ec4e3b93b5c277
north-glass-erp/northglass-erp/src/views/mm/mainTrader/SelectTrader.vue
@@ -1,184 +1,219 @@
<!-- 供应商管理 -->
<script lang="ts" setup>
import { ref } from "vue";
const name = ref('')
const productName = ref('')
const salId = ref('')
let tableData = ref([
  {
    "供应商编码":'221',
    "供应商名称":'成都正华电子仪器有限公司',
    "代理产品":'辅料',
    "结算方式":'货到付款',
    "联系人":'',
    "联系电话":'',
    "税率":'13.00',
    "公司地址":'北京市辖区东城区',
    "收货地址":'北京市辖区东城区',
    "所属集团":'',
    "等级":'',
    "单据状态":'未审核',
    "审核员":'0.0000',
    "审核日期":'2023-11-19',
    "换算单位":'0',
    "备注":'0',
<script setup>
import {reactive, ref} from "vue";
import {useRouter} from  'vue-router'
import {VXETable} from "vxe-table";
let router=useRouter()
const getTableRow = (row,type) =>{
  switch (type) {
    case 'edit' :{
      //alert('我接收到子组件传送的编辑信息')
      router.push({path: '/main/trader/CreateTrader', query: { id: row.id }})
      break
    }
    case 'delete':{
      alert('我接收到子组件传送的删除信息')
      break
    }
  }
}
//子组件接收参数
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
  },
  {
    "供应商编码":'220',
    "供应商名称":'广州合申机电科技有限公司',
    "代理产品":'辅料',
    "结算方式":'货到付款',
    "联系人":'',
    "联系电话":'',
    "税率":'13.00',
    "公司地址":'北京市辖区东城区',
    "收货地址":'北京市辖区东城区',
    "所属集团":'',
    "等级":'',
    "单据状态":'未审核',
    "审核员":'0.0000',
    "审核日期":'2023-11-19',
    "换算单位":'0',
    "备注":'0',
  filterConfig: {   //筛选配置项
    remote: true
  },
  {
    "供应商编码":'219',
    "供应商名称":'江门市中锐金刚石工具有限公司',
    "代理产品":'辅料',
    "结算方式":'货到付款',
    "联系人":'',
    "联系电话":'',
    "税率":'13.00',
    "公司地址":'北京市辖区东城区',
    "收货地址":'北京市辖区东城区',
    "所属集团":'',
    "等级":'',
    "单据状态":'未审核',
    "审核员":'0.0000',
    "审核日期":'2023-11-19',
    "换算单位":'0',
    "备注":'0',
  customConfig: {
    storage: true
  },
  {
    "供应商编码":'218',
    "供应商名称":'深圳悦创精密自动化技术有限公司',
    "代理产品":'辅料',
    "结算方式":'货到付款',
    "联系人":'',
    "联系电话":'',
    "税率":'13.00',
    "公司地址":'北京市辖区东城区',
    "收货地址":'北京市辖区东城区',
    "所属集团":'',
    "等级":'',
    "单据状态":'未审核',
    "审核员":'0.0000',
    "审核日期":'2023-11-19',
    "换算单位":'0',
    "备注":'0',
  editConfig: {
    trigger: 'click',
    mode: 'row',
    showStatus: true
  },//表头参数
  columns:[
    {type:'expand',fixed:"left",slots: { content:'content' },width: '50'},
    // { type: 'checkbox',fixed:"left", title: '选择', width: '80' },
    { type: 'seq',fixed:"left", title: '自序', width: '80' },
    {title: '操作', width: '110', slots: { default: 'button_slot' },fixed:"left"},
    {field: 'supplierCode', width:'150', title: '供应商编号', sortable: true,editRender: { name: 'input', attrs: { placeholder: '' } } },
    {field: 'supplierName', width: '150',title: '供应商名称', sortable: true,showOverflow:"ellipsis" ,filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
    {field: 'agentProduct', width: '120',title: '代理产品', sortable: true,filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
    {field: 'settlementMethod', width: '100',title: '结算方式', sortable: true},
    {field: 'contactPerson',width: '100', title: '联系人', sortable: true,showOverflow:"ellipsis"},
    {field: 'taxRate', width: '80',title: '税率', sortable: true},
    {field: 'companyAddress',width: '100', title: '公司地址', sortable: true},
    {field: 'receivingAddress', width: '100',title: '收货地址', sortable: true},
    {field: 'belongingGroup',width: '100', title: '所属集团', sortable: true},
    {field: 'grade', width: '80',title: '等级', sortable: true},
    {field: 'documentStatus',width: '100', title: '单据状态', sortable: true},
    {field: 'auditor', width: '100',title: '审核员', sortable: true},
    {field: 'auditDate',width: '110', title: '审核日期', sortable: true},
    {field: 'conversionUnit',width: '100', title: '换算单位', sortable: true},
    {field: 'remark',width: '80', title: '备注', sortable: true},
  ],//表头按钮
  toolbarConfig: {
    buttons: [{
      'name': '新增',
       'code':'add'
    },],
    import: false,
    export: true,
    print: true,
    zoom: true,
    custom: true
  },
  {
    "供应商编码":'217',
    "供应商名称":'深圳市伯欣科技有限公司',
    "代理产品":'辅料',
    "结算方式":'货到付款',
    "联系人":'',
    "联系电话":'',
    "税率":'13.00',
    "公司地址":'北京市辖区东城区',
    "收货地址":'北京市辖区东城区',
    "所属集团":'',
    "等级":'',
    "单据状态":'未审核',
    "审核员":'0.0000',
    "审核日期":'2023-11-19',
    "换算单位":'0',
    "备注":'0',
  data:  [
    {
      "supplierCode": 216,
      "supplierName": "宿迁宣之文电子商务有限公司",
      "agentProduct": "辅料",
      "settlementMethod": "货到付款",
      "contactPerson": "平钢",
      "taxRate": 13.00,
      "companyAddress": "北京市辖区东城区",
      "receivingAddress": "北京市辖区东城区",
      "belongingGroup": "上海北玻",
      "grade": "5",
      "documentStatus": "未审核",
      "auditor": "小岳",
      "auditDate": "2023-11-19",
      "conversionUnit": "0",
      "remark": "测试",
    },
    {
      "supplierCode": 215,
      "supplierName": "宿迁宣之文电子商务有限公司",
      "agentProduct": "辅料",
      "settlementMethod": "货到付款",
      "contactPerson": "小岳",
      "taxRate": 13.00,
      "companyAddress": "北京市辖区东城区",
      "receivingAddress": "北京市辖区东城区",
      "belongingGroup": "上海北玻",
      "grade": "5",
      "documentStatus": "未审核",
      "auditor": "小岳",
      "auditDate": "2023-11-19",
      "conversionUnit": "0",
      "remark": "测试",
    },
  ],//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 ''
      })
    ]
  }
})
const  xGrid = ref();
const gridEvents = {
  toolbarButtonClick ({ code }) {
    const $grid = xGrid.value
    if ($grid) {
      switch (code) {
        case 'add': {
          router.push({path: '/main/trader/CreateTrader'})
          /*if($grid.getCheckboxRecords().length==0){
            VXETable.modal.message( '请选择一条数据!')
            return
          }*/
          return;
        }
      }
    }
  },
  {
    "供应商编码":'216',
    "供应商名称":'宿迁宣之文电子商务有限公司',
    "代理产品":'辅料',
    "结算方式":'货到付款',
    "联系人":'',
    "联系电话":'',
    "税率":'13.00',
    "公司地址":'北京市辖区东城区',
    "收货地址":'北京市辖区东城区',
    "所属集团":'',
    "等级":'',
    "单据状态":'未审核',
    "审核员":'0.0000',
    "审核日期":'2023-11-19',
    "换算单位":'0',
    "备注":'0',
  toolbarToolClick ({ code }) {
    const $grid = xGrid.value
    if ($grid) {
      switch (code) {
        case 'myPrint': {
          $grid.print()
          break
        }
      }
    }
  },
])
}
</script>
<template>
  <div>
    <!-- 表单开始 -->
    <div>
      <el-form  size="medium" >
  <div class="main-div-customer">
    <vxe-grid
        max-height="100%"
        @filter-change="filterChanged"
        class="mytable-scrollbar"
        ref="xGrid"
        v-bind="gridOptions"
        v-on="gridEvents"
<!--        <el-row gutter="5">-->
<!--          <el-col :span="4">-->
<!--            <el-input v-model="name" placeholder="请输入供应商编码" style="width: 200px; height: 30px;" />-->
<!--          </el-col>-->
<!--          <el-col :span="4">-->
<!--            <el-input v-model="productName" placeholder="请输入供应商名称" style="width: 200px; height: 30px;" />-->
<!--          </el-col>-->
<!--          <el-col :span="4">-->
<!--            <el-input v-model="salId" placeholder="请输入代理产品" style="width: 200px; height: 30px;" />-->
<!--          </el-col>-->
<!--          <el-col :span="4">-->
<!--            <el-input v-model="salId" placeholder="请输入联系人" style="width: 200px; height: 30px;" />-->
<!--          </el-col>-->
<!--          <el-col :span="4">-->
<!--            <el-button id="searchButton" type="primary" :icon="Search">查询</el-button>-->
<!--          </el-col>-->
<!--        </el-row>-->
    >
      <!--      @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>
        <!-- <el-form-item size="large">
          <el-button type="primary" @click="submitForm">查询</el-button>
          <el-button @click="resetForm">重置</el-button>
        </el-form-item>-->
      <!--左边固定显示的插槽-->
      <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>
      </el-form>
    </div>
    <!-- 表单结束 -->
    <!-- 表格开始 -->
    <div>
      <el-table :data="tableData" border style="width: 100%">
        <el-table-column prop="供应商编码" label="供应商编码" width="180" />
        <el-table-column prop="供应商名称" label="供应商名称" width="180" />
        <el-table-column prop="代理产品" label="代理产品" width="180"/>
        <el-table-column prop="结算方式" label="结算方式" width="180"/>
        <el-table-column prop="联系人" label="联系人" width="180"/>
        <el-table-column prop="联系电话" label="联系电话" width="180"/>
        <el-table-column prop="税率" label="税率" width="180"/>
        <el-table-column prop="公司地址" label="公司地址" width="180"/>
        <el-table-column prop="收货地址" label="收货地址" width="180"/>
        <el-table-column prop="所属集团" label="所属集团" width="180"/>
        <el-table-column prop="等级" label="等级" width="180"/>
        <el-table-column prop="单据状态" label="单据状态" width="180"/>
        <el-table-column prop="审核员" label="审核员" width="180"/>
        <el-table-column prop="审核日期" label="审核日期" width="180"/>
        <el-table-column prop="换算单位" label="换算单位" width="180"/>
        <el-table-column prop="备注" label="备注" width="180"/>
        <el-table-column fixed="left" label="操作" width="120">
          <template #default>
            <el-button link type="primary" size="small" @click="handleClick"
            >修改</el-button
            >
            <el-button link type="primary" size="small">删除</el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
      <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>
        </div>
      </template>
    </vxe-grid>
  </div>
</template>
<style>
<style scoped>
.main-div-customer{
  width: 99%;
  height: 100%;
}
</style>