前端--导出

这边记录我们公司后端做的导出接口和前端是如何对接的
    这边的技术栈是:
               1: react 

               2: fetch

第一步:简单封装--导出界面

import { DrawerForm } from '@ant-design/pro-components';
import { CloseOutlined } from '@ant-design/icons';
import { Col, Input, Row, Select, DatePicker, message, InputNumber, Card, Button } from 'antd'
import React, { useEffect, useState } from 'react';
import { connect } from 'react-redux';
import { DEPT_NAMESPACE } from "@/actions/dept";
import { getCurrentUser } from "@/utils/authority";
import { getDictBiz } from "@/utils/utils";
import { DICT_BIZ_NAMESPACE } from "@/actions/dictbiz";
import { clubSetMealSave, clubSetMealUpdate } from "@/services/club";
import { list } from '@/services/menu';

import style from './common.less';

const { TextArea } = Input;

function NewExp(props) {
     //show  是根据需要是否展示下方的弹窗
    //hang 是根据返回结果关闭弹窗
   //changeHange 是根据需要把参数返回出去
  //title  是弹窗的标题
 //Component  是触发弹窗的关键
    const {  title, Component, changeHange, hang, show } = props

    //  时间
    const [startDate, setStartDate] = useState(null)
    const [startDate1, setStartDate1] = useState(null)
    const [flag, setflag] = useState(false)


    const submit = async () => {

        // 判断时间
        if (!show) {
            if (startDate != null || startDate1 != null) {
                // 时间比较大小
                if (startDate1 < startDate) {
                    return message.error('结束时间不能小于开始时间')
                }
                let data = {
                    d1: startDate,
                    d2: startDate1,
                }
                changeHange(data)
                if (hang() == 1) {
                    setflag(false)
                    setStartDate(null)
                    

相关推荐

  1. 前端--导出

    2024-06-05 19:50:08       11 阅读
  2. 前端模块导入导出方式

    2024-06-05 19:50:08       8 阅读
  3. 前端导出Excel

    2024-06-05 19:50:08       21 阅读
  4. 前端实现导出xlsx功能

    2024-06-05 19:50:08       20 阅读
  5. 前端VUE导出excel多sheet,适用单多导出

    2024-06-05 19:50:08       39 阅读
  6. 前端页面直接导出Excel方案

    2024-06-05 19:50:08       39 阅读
  7. vue:功能【xlsx】纯前端导出Excel

    2024-06-05 19:50:08       24 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-06-05 19:50:08       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-06-05 19:50:08       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-06-05 19:50:08       18 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-06-05 19:50:08       20 阅读

热门阅读

  1. AI 领域未来的 5 个预测

    2024-06-05 19:50:08       7 阅读
  2. git 下载失败

    2024-06-05 19:50:08       9 阅读
  3. Qt6 QSslSocket 客户端设计踩坑

    2024-06-05 19:50:08       9 阅读
  4. 里氏替换原则经典反例:正方形不是长方形

    2024-06-05 19:50:08       10 阅读
  5. Spring Cloud Gateway通过配置文件方式提供路由服务

    2024-06-05 19:50:08       11 阅读
  6. 竹纤维家装元宇宙:虚拟空间与绿色生活的融合

    2024-06-05 19:50:08       10 阅读
  7. 生活中的人工智能

    2024-06-05 19:50:08       9 阅读
  8. SVN在Linux服务器下部署过程

    2024-06-05 19:50:08       8 阅读