廖井涛
2024-09-05 8b2c74fb6842e8af60f70e7df6eef8837d74be07
north-glass-erp/northglass-erp/src/components/BasicTable.vue
@@ -8,8 +8,13 @@
import deepClone from "@/utils/deepClone";
import {ElMessage} from "element-plus";
import * as XLSX from "xlsx";
import {useI18n} from "vue-i18n";
import useOrderInfoStore from "@/stores/sd/order/orderInfo";
const { t } = useI18n()
const xGrid = ref()
let filterData = ref({})
const orderInfo = useOrderInfoStore()
const gridOptions = reactive({
  loading:true,
  border:  "full",//表格加边框
@@ -22,7 +27,8 @@
  printConfig: {},
  importConfig: {},
  exportConfig: {},
  scrollY:{ enabled: true },//开启虚拟滚动
  scrollY:{ enabled: true,gt:0 },//开启虚拟滚动
  scrollX:{ enabled: true,gt:5 },//开启虚拟滚动
  showOverflow:true,
  columnConfig: {
    resizable: true,
@@ -44,7 +50,7 @@
      options: [
        [
          { code: 'exportExcelChecked', name: '导出选中', prefixIcon: 'vxe-icon-download', visible: true }
          { code: 'exportExcelChecked', name: t('components.exportSelected'), prefixIcon: 'vxe-icon-download', visible: true }
        ]
      ]
    }
@@ -69,7 +75,7 @@
    return[
      columns.map((column, columnIndex) => {
        if (columnIndex === 0) {
          return '合计:'
          return t('basicData.total')
        }
        if (props.childrenData.footList.includes(column.field)) {
          return sumNum(data, column.field)
@@ -92,7 +98,7 @@
            const worksheet = XLSX.utils.aoa_to_sheet(result);
            const workbook = XLSX.utils.book_new();
            XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
            XLSX.writeFile(workbook, 'data.xlsx');
            XLSX.writeFile(workbook, `${props.childrenData.exportName}.xlsx`);
          }
          break
        }
@@ -168,12 +174,12 @@
}
const  getReportData = () => {
  request.post(`${props.childrenData.url}/${basicProp.value.pageNum}/${basicProp.value.pageSize}/${basicProp.value.selectDate}`,filterData.value).then(res => {
  request.post(`${props.childrenData.url}/${basicProp.value.pageNum}/${basicProp.value.pageSize}/${orderInfo.reportFormDate}`,filterData.value).then(res => {
    if(res.code === '200'){
      props.childrenData.data = res.data.data
      basicProp.value.pageTotal = res.data.total.pageTotal
      basicProp.value.dataTotal = res.data.total.total
      basicProp.value.selectDate = res.data.selectDate
      orderInfo.reportFormDate = res.data.selectDate
    }
  })
}
@@ -186,10 +192,10 @@
<template>
  <div class="main-div">
    <el-date-picker
        v-model="basicProp.selectDate"
        v-model="orderInfo.reportFormDate"
        type="daterange"
        start-placeholder="开始时间"
        end-placeholder="结束时间"
        :start-placeholder="$t('basicData.startDate')"
        :end-placeholder="$t('basicData.endDate')"
        format="YYYY-MM-DD"
        value-format="YYYY-MM-DD"
    />
@@ -198,7 +204,7 @@
        id="searchButton"
        type="primary"
        style="margin-top: -5px"
        :icon="Search">查询</el-button>
        :icon="Search">{{$t('basicData.search')}}</el-button>
    <div class="order-detail">
      <vxe-grid
          @filter-change="filterChanged"
@@ -230,8 +236,8 @@
          <vxe-button style="margin-right: 0.5rem"
                      @click="exportExcel(props.childrenData.exportUrl,
                                          props.childrenData.exportName,
                                          basicProp.selectDate)">
            导出</vxe-button>
                                          orderInfo.reportFormDate)">
            {{$t('basicData.export')}}</vxe-button>
        </template>
        <template #pager>