@bit-sun/business-component 2.0.18 → 2.0.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,31 +1,41 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <svg width="40px" height="42px" viewBox="0 0 40 42" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
- <title>编组 19</title>
2
+ <svg width="40px" height="40px" viewBox="0 0 40 40" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
+ <title>下载中-icon</title>
4
+ <defs>
5
+ <rect id="path-1" x="0" y="0" width="40" height="40"></rect>
6
+ </defs>
4
7
  <g id="导出功能" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
5
- <g id="编组-13" transform="translate(-14.000000, -200.000000)">
6
- <g id="编组-21备份-22" transform="translate(0.000000, 188.000000)">
7
- <g id="编组-19" transform="translate(14.000000, 12.000000)">
8
- <rect id="矩形" stroke="#979797" fill="#D8D8D8" opacity="0" x="0.5" y="0.5" width="39" height="41"></rect>
9
- <g id="编组-16" transform="translate(6.000000, 4.000000)">
10
- <g id="编组-6">
11
- <path d="M4,28 L4,2 C4,0.8954305 4.8954305,-1.91384796e-17 6,0 L20.1028879,0 L20.1028879,0 L28,7.2545499 L28,28 C28,29.1045695 27.1045695,30 26,30 L6,30 C4.8954305,30 4,29.1045695 4,28 Z" id="路径-6" fill="#1B79FF"></path>
12
- <g id="编组-2" transform="translate(0.000000, 9.000000)">
13
- <path d="M11,0.5 C11.4142136,0.5 11.7892136,0.667893219 12.0606602,0.939339828 C12.3321068,1.21078644 12.5,1.58578644 12.5,2 L12.5,2 L12.5,11 C12.5,11.4142136 12.3321068,11.7892136 12.0606602,12.0606602 C11.7892136,12.3321068 11.4142136,12.5 11,12.5 L11,12.5 L2,12.5 C1.58578644,12.5 1.21078644,12.3321068 0.939339828,12.0606602 C0.667893219,11.7892136 0.5,11.4142136 0.5,11 L0.5,11 L0.5,2 C0.5,1.58578644 0.667893219,1.21078644 0.939339828,0.939339828 C1.21078644,0.667893219 1.58578644,0.5 2,0.5 L2,0.5 Z" id="矩形" stroke="#005CFF" fill="#FFFFFF"></path>
14
- <g id="X" transform="translate(3.986000, 4.100000)" fill="#005CFF" fill-rule="nonzero">
15
- <polygon id="路径" points="3.598 4.9 2.583 3.381 1.582 4.9 0 4.9 1.785 2.422 0.077 0 1.638 0 2.618 1.414 3.584 0 5.082 0 3.374 2.366 5.194 4.9"></polygon>
8
+ <g id="列表数据导出功能-导出列表" transform="translate(-1584.000000, -199.000000)">
9
+ <g id="编组-13" transform="translate(1570.000000, 0.000000)">
10
+ <g id="编组-21备份-22" transform="translate(0.000000, 188.000000)">
11
+ <g id="编组-6" transform="translate(14.000000, 11.000000)">
12
+ <mask id="mask-2" fill="white">
13
+ <use xlink:href="#path-1"></use>
14
+ </mask>
15
+ <use id="下载中-icon" fill="#D8D8D8" opacity="0" xlink:href="#path-1"></use>
16
+ <g mask="url(#mask-2)">
17
+ <g transform="translate(4.000000, 3.000000)">
18
+ <path d="M4.57142857,31.7142857 L4.57142857,2.28571429 C4.57142857,1.02334914 5.59477771,-1.10037491e-15 6.85714286,0 L22.974729,0 L22.974729,0 L32,8.22182322 L32,31.7142857 C32,32.9766509 30.9766509,34 29.7142857,34 L6.85714286,34 C5.59477771,34 4.57142857,32.9766509 4.57142857,31.7142857 Z" id="路径-6" fill="#1B79FF"></path>
19
+ <g id="编组-2" stroke-width="1" fill="none" transform="translate(0.000000, 10.200000)">
20
+ <path d="M12.5714286,0.571428571 C13.0448155,0.571428571 13.4733869,0.763306536 13.7836116,1.07353123 C14.0938363,1.38375593 14.2857143,1.81232736 14.2857143,2.28571429 L14.2857143,2.28571429 L14.2857143,12.447619 C14.2857143,12.921006 14.0938363,13.3495774 13.7836116,13.6598021 C13.4733869,13.9700268 13.0448155,14.1619048 12.5714286,14.1619048 L12.5714286,14.1619048 L2.28571429,14.1619048 C1.81232736,14.1619048 1.38375593,13.9700268 1.07353123,13.6598021 C0.763306536,13.3495774 0.571428571,12.921006 0.571428571,12.447619 L0.571428571,12.447619 L0.571428571,2.28571429 C0.571428571,1.81232736 0.763306536,1.38375593 1.07353123,1.07353123 C1.38375593,0.763306536 1.81232736,0.571428571 2.28571429,0.571428571 L2.28571429,0.571428571 Z" id="矩形" stroke="#005CFF" stroke-width="1.14285714" fill="#FFFFFF"></path>
21
+ <g id="X" transform="translate(4.555429, 4.646667)" fill="#005CFF" fill-rule="nonzero">
22
+ <polygon id="路径" points="4.112 5.55333333 2.952 3.8318 1.808 5.55333333 0 5.55333333 2.04 2.74493333 0.088 0 1.872 0 2.992 1.60253333 4.096 0 5.808 0 3.856 2.68146667 5.936 5.55333333"></polygon>
23
+ </g>
16
24
  </g>
25
+ <path d="M17.1428571,11.3333333 L20.5714286,11.3333333 C21.2026111,11.3333333 21.7142857,11.8450079 21.7142857,12.4761905 L21.7142857,13.5904762 C21.7142857,14.2216588 21.2026111,14.7333333 20.5714286,14.7333333 L17.1428571,14.7333333 C16.5116746,14.7333333 16,14.2216588 16,13.5904762 L16,12.4761905 C16,11.8450079 16.5116746,11.3333333 17.1428571,11.3333333 Z" id="矩形备份-7" fill="#005CFF"></path>
26
+ <path d="M24,11.3333333 L27.4285714,11.3333333 C28.059754,11.3333333 28.5714286,11.8450079 28.5714286,12.4761905 L28.5714286,13.5904762 C28.5714286,14.2216588 28.059754,14.7333333 27.4285714,14.7333333 L24,14.7333333 C23.3688174,14.7333333 22.8571429,14.2216588 22.8571429,13.5904762 L22.8571429,12.4761905 C22.8571429,11.8450079 23.3688174,11.3333333 24,11.3333333 Z" id="矩形备份-18" fill="#005CFF"></path>
27
+ <path d="M17.1428571,15.8666667 L20.5714286,15.8666667 C21.2026111,15.8666667 21.7142857,16.3783412 21.7142857,17.0095238 L21.7142857,18.1238095 C21.7142857,18.7549921 21.2026111,19.2666667 20.5714286,19.2666667 L17.1428571,19.2666667 C16.5116746,19.2666667 16,18.7549921 16,18.1238095 L16,17.0095238 C16,16.3783412 16.5116746,15.8666667 17.1428571,15.8666667 Z" id="矩形备份-20" fill="#005CFF"></path>
28
+ <path d="M24,15.8666667 L27.4285714,15.8666667 C28.059754,15.8666667 28.5714286,16.3783412 28.5714286,17.0095238 L28.5714286,18.1238095 C28.5714286,18.7549921 28.059754,19.2666667 27.4285714,19.2666667 L24,19.2666667 C23.3688174,19.2666667 22.8571429,18.7549921 22.8571429,18.1238095 L22.8571429,17.0095238 C22.8571429,16.3783412 23.3688174,15.8666667 24,15.8666667 Z" id="矩形备份-19" fill="#005CFF"></path>
29
+ <path d="M17.1428571,20.4 L20.5714286,20.4 C21.2026111,20.4 21.7142857,20.9116746 21.7142857,21.5428571 L21.7142857,22.6571429 C21.7142857,23.2883254 21.2026111,23.8 20.5714286,23.8 L17.1428571,23.8 C16.5116746,23.8 16,23.2883254 16,22.6571429 L16,21.5428571 C16,20.9116746 16.5116746,20.4 17.1428571,20.4 Z" id="矩形备份-22" fill="#005CFF"></path>
30
+ <path d="M24,20.4 L27.4285714,20.4 C28.059754,20.4 28.5714286,20.9116746 28.5714286,21.5428571 L28.5714286,22.6571429 C28.5714286,23.2883254 28.059754,23.8 27.4285714,23.8 L24,23.8 C23.3688174,23.8 22.8571429,23.2883254 22.8571429,22.6571429 L22.8571429,21.5428571 C22.8571429,20.9116746 23.3688174,20.4 24,20.4 Z" id="矩形备份-21" fill="#005CFF"></path>
31
+ <polygon id="路径-19" fill="#005CFF" points="22.9906832 0 22.9906832 8.22182322 32 8.22182322"></polygon>
17
32
  </g>
18
- <path d="M15,10 L18,10 C18.5522847,10 19,10.4477153 19,11 L19,12 C19,12.5522847 18.5522847,13 18,13 L15,13 C14.4477153,13 14,12.5522847 14,12 L14,11 C14,10.4477153 14.4477153,10 15,10 Z" id="矩形备份-7" fill="#005CFF"></path>
19
- <path d="M21,10 L24,10 C24.5522847,10 25,10.4477153 25,11 L25,12 C25,12.5522847 24.5522847,13 24,13 L21,13 C20.4477153,13 20,12.5522847 20,12 L20,11 C20,10.4477153 20.4477153,10 21,10 Z" id="矩形备份-18" fill="#005CFF"></path>
20
- <path d="M15,14 L18,14 C18.5522847,14 19,14.4477153 19,15 L19,16 C19,16.5522847 18.5522847,17 18,17 L15,17 C14.4477153,17 14,16.5522847 14,16 L14,15 C14,14.4477153 14.4477153,14 15,14 Z" id="矩形备份-20" fill="#005CFF"></path>
21
- <path d="M21,14 L24,14 C24.5522847,14 25,14.4477153 25,15 L25,16 C25,16.5522847 24.5522847,17 24,17 L21,17 C20.4477153,17 20,16.5522847 20,16 L20,15 C20,14.4477153 20.4477153,14 21,14 Z" id="矩形备份-19" fill="#005CFF"></path>
22
- <path d="M15,18 L18,18 C18.5522847,18 19,18.4477153 19,19 L19,20 C19,20.5522847 18.5522847,21 18,21 L15,21 C14.4477153,21 14,20.5522847 14,20 L14,19 C14,18.4477153 14.4477153,18 15,18 Z" id="矩形备份-22" fill="#005CFF"></path>
23
- <path d="M21,18 L24,18 C24.5522847,18 25,18.4477153 25,19 L25,20 C25,20.5522847 24.5522847,21 24,21 L21,21 C20.4477153,21 20,20.5522847 20,20 L20,19 C20,18.4477153 20.4477153,18 21,18 Z" id="矩形备份-21" fill="#005CFF"></path>
24
- <polygon id="路径-19" fill="#005CFF" points="20.1168478 0 20.1168478 7.2545499 28 7.2545499"></polygon>
25
33
  </g>
26
- <g id="编组-8" transform="translate(17.000000, 19.000000)" stroke="#FFFFFF">
27
- <circle id="椭圆形" fill="#14C255" cx="8" cy="8" r="7.5"></circle>
28
- <polyline id="路径-20" stroke-width="1.13795117" stroke-linecap="round" points="4 7.78993765 7.25875897 11 12 5"></polyline>
34
+ <g id="编组-8" mask="url(#mask-2)" stroke="#FFFFFF">
35
+ <g transform="translate(24.000000, 24.000000)">
36
+ <circle id="椭圆形" stroke-width="1" fill="#14C255" fill-rule="evenodd" cx="8" cy="8" r="7.5"></circle>
37
+ <polyline id="路径-20" stroke-width="1.13795117" fill="none" stroke-linecap="round" points="4 7.78993765 7.25875897 11 12 5"></polyline>
38
+ </g>
29
39
  </g>
30
40
  </g>
31
41
  </g>
@@ -1,20 +1,20 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
- <title>xinglan-icon-message备份 5</title>
3
+ <title>下载记录-icon</title>
4
4
  <defs>
5
5
  <rect id="path-1" x="0" y="0" width="24" height="24"></rect>
6
6
  </defs>
7
- <g id="导出功能" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
8
- <g id="导出功能-导出数据转入后台提示" transform="translate(-1659.000000, -18.000000)">
9
- <g id="导入、导出记录icon" transform="translate(1659.000000, 18.000000)">
7
+ <g id="首页" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
8
+ <g id="首页-消息入口" transform="translate(-1653.000000, -13.000000)">
9
+ <g id="编组-11备份-2" transform="translate(1653.000000, 13.000000)">
10
10
  <mask id="mask-2" fill="white">
11
11
  <use xlink:href="#path-1"></use>
12
12
  </mask>
13
13
  <use id="xinglan-icon-message" fill="#D8D8D8" opacity="0" xlink:href="#path-1"></use>
14
- <g id="responsetime" mask="url(#mask-2)" fill="#000000" fill-rule="nonzero">
15
- <g transform="translate(3.000000, 2.000000)">
16
- <path d="M5.21516417,6.74357406 L4.07552238,7.8711358 L0,3.83881343 L3.87940299,0 L5.02011939,1.12756173 L3.05785074,3.06796734 L9.4438209,3.06903059 C14.112,3.06903059 17.9075821,6.76802848 17.9978507,11.3659924 L18,11.5345153 C18,16.2095638 14.1689552,20 9.4438209,20 C4.71814925,20 0.887104494,16.2095638 0.887104469,11.5345153 L2.49904477,11.5345153 C2.49904477,15.3292044 5.6084776,18.4051461 9.4438209,18.4051461 C13.2786269,18.4051461 16.3880597,15.3292044 16.3880597,11.5345153 C16.3880597,7.73982616 13.2786269,4.66388453 9.4438209,4.66388453 L3.11265671,4.66335292 L5.21516417,6.74357406 Z" id="形状"></path>
17
- <path d="M10.4,7.2 L10.399,12.381 L12.4660494,10.315207 L13.6934831,11.5426407 L9.55833777,15.677786 L5.2,11.5508424 L6.44018239,10.31066 L8.599,12.309 L8.6,7.2 L10.4,7.2 Z" id="形状结合" transform="translate(9.446742, 11.438893) scale(1, -1) translate(-9.446742, -11.438893) "></path>
14
+ <g id="编组-43" mask="url(#mask-2)" fill="#A9B7E0">
15
+ <g transform="translate(3.000000, 5.000000)">
16
+ <path d="M6.13636364,0 C8.63317229,0 10.7816931,1.49524673 11.7399047,3.64143255 C12.2798603,3.40935387 12.8750529,3.28161372 13.5,3.28161372 C15.9852814,3.28161372 18,5.30180291 18,7.79383258 C18,10.0230473 16.3878264,11.8746964 14.2687972,12.2404603 C14.2465364,11.7876875 14.070622,11.3415459 13.7391397,10.9841303 C13.1286438,10.3258726 12.1783769,10.1711683 11.4091093,10.5396215 L11.4091093,10.5396215 L11.4090909,8.93969663 L11.4036052,8.79043429 C11.327256,7.75557442 10.4634527,6.93969663 9.40909091,6.93969663 C8.30452141,6.93969663 7.40909091,7.83512713 7.40909091,8.93969663 L7.40909091,8.93969663 L7.41007537,10.5401022 C6.64063099,10.1710339 5.68980332,10.3255866 5.07904209,10.9841303 C4.78169022,11.3047453 4.60952003,11.696756 4.56026628,12.099988 C1.93590154,11.404792 0,9.00559976 0,6.15302572 C0,2.75480345 2.74734358,0 6.13636364,0 Z" id="形状结合" fill-rule="evenodd"></path>
17
+ <path d="M9.40909091,8.13969663 C9.81693196,8.13969663 10.1534925,8.44488478 10.2028578,8.83934633 L10.2090909,8.93969663 L10.209,13.166 L11.7287222,11.757578 C12.0526731,11.4571323 12.5588465,11.476187 12.8592923,11.8001379 C13.1324247,12.0946387 13.1415072,12.5397367 12.8975122,12.843959 L12.8167323,12.930708 L9.40909091,16.0910982 L6.00144947,12.930708 C5.67749858,12.6302623 5.65844386,12.1240888 5.95888956,11.8001379 C6.23202202,11.5056371 6.67517742,11.4631166 6.99688293,11.6835488 L7.08945962,11.757578 L8.609,13.166 L8.60909091,8.93969663 C8.60909091,8.49786883 8.96726311,8.13969663 9.40909091,8.13969663 Z" id="形状结合备份-2" fill-rule="nonzero"></path>
18
18
  </g>
19
19
  </g>
20
20
  </g>
@@ -5,7 +5,7 @@ import { Input, Button, Modal, Select, InputNumber, message, Spin, Form, Table,
5
5
  import { SearchOutlined, CopyOutlined, CloseCircleOutlined } from '@ant-design/icons';
6
6
  import axios from 'axios';
7
7
  import { stringify } from 'querystring';
8
- import _ from "loadsh"
8
+ import _ from "lodash"
9
9
  import './index.less';
10
10
  import { BusinessSearchSelect, QueryMutipleInput } from '@/index';
11
11
  import { Resizable } from 'react-resizable';
@@ -27,7 +27,7 @@ import {
27
27
  } from '@ant-design/icons';
28
28
  import axios from 'axios';
29
29
  import './index.less';
30
- import _ from "loadsh"
30
+ import _ from "lodash"
31
31
 
32
32
  // const luckysheet = window.luckysheet;
33
33
 
@@ -27,7 +27,7 @@ import {
27
27
  } from '@ant-design/icons';
28
28
  import axios from 'axios';
29
29
  import './index.less';
30
- import _ from "loadsh"
30
+ import _ from "lodash"
31
31
 
32
32
  // const luckysheet = window.luckysheet;
33
33
 
@@ -0,0 +1,37 @@
1
+ ---
2
+ title: 导出按钮
3
+ order: 5
4
+ nav:
5
+ title: 组件
6
+ order: 1
7
+ group:
8
+ path: /components/functional
9
+ order: 0
10
+ title: 功能组件
11
+ ---
12
+
13
+ ## ExportIcon
14
+
15
+ 导出按钮demo
16
+
17
+ ```tsx
18
+ import React, { useState, useRef } from 'react';
19
+ import {ExportIcon} from '../../../../index';
20
+
21
+
22
+
23
+ export default () => {
24
+
25
+ const tableRef = useRef()
26
+
27
+ return (
28
+ <div>
29
+ <ExportIcon request={{url:'abc'}} tableRef={tableRef}/>
30
+ </div>
31
+ );
32
+ };
33
+ ```
34
+
35
+ <API></API>
36
+
37
+ More skills for writing demo: https://d.umijs.org/guide/demo-principle
@@ -2,41 +2,55 @@ import React, {Ref} from 'react'
2
2
  import {message, Popconfirm, Tooltip} from "antd";
3
3
  import axios from 'axios'
4
4
  import exportlogo from '../../../../assets/exportlogo.png'
5
-
5
+ import {omit} from 'lodash'
6
6
  interface exportIconType{
7
- url: string,
8
- params: any,
9
- otherParams?: any
7
+ /** others选填,使用axios发请求,*/
8
+ request:{
9
+ url: string,
10
+ params: Function | Object,
11
+ others?: Object
12
+ },
13
+ /** BsSulaQueryTable的tableRef*/
14
+ tableRef: any,
10
15
  }
11
16
 
12
- const ExportIcon = ({params, url, otherParams}: exportIconType) => {
13
-
17
+ const ExportIcon = ({request, tableRef}: exportIconType) => {
18
+ const {url, params, others} = request
14
19
 
15
20
  return (
16
21
  <div style={{ cursor: 'pointer' }}>
17
- <Popconfirm
18
- title={'确定要导出当前数据吗?'}
19
- onConfirm={() => {
20
- axios({
21
- url,
22
- method:'POST',
23
- data:params?.current || params(),
24
- ...otherParams,
25
- })
26
- .then((result: any) => {
27
- result = result.data;
28
- if (result.code !== '000000') {
29
- message.error(result?.msg);
30
- return;
31
- }
32
- message.success('任务已排入导出队列')
33
- })
34
- }}
35
- >
36
22
  <Tooltip title="导出数据">
37
- <img width={32} src={exportlogo} />
23
+ <img width={32} src={exportlogo} onClick={() =>{
24
+ const convertedParams = tableRef?.current?.getExportParams()
25
+ let requestData: any
26
+
27
+ if(typeof params === 'function'){
28
+ requestData = {...omit(params(convertedParams),'selectedRows')}
29
+ }else if(typeof params === 'object'){
30
+ requestData = {...params}
31
+ }
32
+ if(!params){
33
+ requestData = omit(convertedParams, 'selectedRows')
34
+ }
35
+
36
+ requestData['qp-id-in'] = convertedParams?.selectedRows?.map((d: any) => d.id)?.join(',')
37
+
38
+ axios({
39
+ url,
40
+ method:'POST',
41
+ data:requestData,
42
+ ...others,
43
+ })
44
+ .then((result: any) => {
45
+ result = result.data;
46
+ if (result.code !== '000000') {
47
+ message.error(result?.msg);
48
+ return;
49
+ }
50
+ message.success('任务已排入导出队列')
51
+ })
52
+ }} />
38
53
  </Tooltip>
39
- </Popconfirm>
40
54
  </div>
41
55
  )
42
56
  }
@@ -5,7 +5,7 @@ import { Input, Button, Modal, Select, Divider, message, Spin, Form, Table, Chec
5
5
  import { SearchOutlined, CopyOutlined, CaretLeftOutlined } from '@ant-design/icons';
6
6
  import axios from 'axios';
7
7
  import { stringify } from 'querystring';
8
- import _ from "loadsh"
8
+ import _ from "lodash"
9
9
  import './index.less';
10
10
  import { BusinessSearchSelect, QueryMutipleInput } from '@/index';
11
11
 
package/src/index.ts CHANGED
@@ -23,4 +23,3 @@ export { default as BusinessTreeSearchSelect } from './components/Business/TreeS
23
23
  export { default as StateFlow } from './components/Business/StateFlow';
24
24
  export { default as GuideWrapper } from './components/Business/CommonGuideWrapper';
25
25
  export { default as ExportIcon } from './components/Functional/ExportFunctions/ExportIcon'
26
- export { default as ExportHistoryIcon } from './components/Functional/ExportFunctions/ExportHistoryDrawer'
@@ -1,2 +0,0 @@
1
- declare const ExportHistoryIcon: () => JSX.Element;
2
- export default ExportHistoryIcon;
@@ -1,2 +0,0 @@
1
- export declare function downloadExcel(data: any, fileName?: any, isResUrl?: boolean): void;
2
- export declare function handleCommonTimeRender(text: any, format?: any): any;
@@ -1,24 +0,0 @@
1
- .pictureWrap{
2
- position: relative;
3
- width: 44px;
4
- }
5
- .pictureWrap::before{
6
- content:'';
7
- width: 1px;
8
- height: 27px;
9
- position: absolute;
10
- right: 0;
11
- top: 10px;
12
- background-color: #CACACA;
13
- }
14
-
15
- .tableWrapper {
16
- :global {
17
- .ant-table-thead {
18
- display: none
19
- }
20
- .bs_table_styl {
21
- padding: 0!important;
22
- }
23
- }
24
- }
@@ -1,150 +0,0 @@
1
- import React, { useEffect, useState } from 'react';
2
- import {Drawer, Tooltip, Table, Space, Button, message, Popconfirm} from 'antd';
3
- import upExport from '../../../../assets/upExport.svg';
4
- import exportProcessing from '../../../../assets/exportProcessing.svg';
5
- import exportSuccess from '../../../../assets/exportSuccess.svg';
6
- import exportFail from '../../../../assets/exportFail.svg';
7
- import styles from './index.less';
8
- import { downloadExcel, handleCommonTimeRender } from '@/utils/utils';
9
- import axios from 'axios';
10
-
11
- const ExportHistoryIcon = () => {
12
- const [exportHistoryParams, setExportHistoryParams] = useState({
13
- visible: false,
14
- title: '导出列表',
15
- width: '420',
16
- placement: 'right',
17
- onClose: () =>
18
- setExportHistoryParams({
19
- ...exportHistoryParams,
20
- visible: false,
21
- }),
22
- });
23
-
24
- return (
25
- <div style={{ cursor: 'pointer' }}>
26
- <Tooltip title="导出记录">
27
- <img
28
- width={24}
29
- src={upExport}
30
- onClick={() =>
31
- setExportHistoryParams({
32
- ...exportHistoryParams,
33
- visible: true,
34
- })
35
- }
36
- />
37
- </Tooltip>
38
- {exportHistoryParams.visible && (
39
- <ExportHistoryDrawer {...exportHistoryParams} />
40
- )}
41
- </div>
42
- );
43
- };
44
-
45
- const ExportHistoryDrawer = (props: any) => {
46
- const [dataSource, setDataSource] = useState([]);
47
- const [pagination, setPagination] = useState({
48
- current: 1,
49
- pageSize: 20,
50
- total: undefined
51
- })
52
- const remoteData = (pag?: any) => {
53
- axios({
54
- url: '/oms-ops/businessImport',
55
- method: 'get',
56
- params: {
57
- 'qp-type-eq': 100,
58
- currentPage: pag?.current || pagination.current,
59
- pageSize: pag?.pageSize || pagination.pageSize,
60
- },
61
- }).then((result) => {
62
- setDataSource(result?.data?.data?.items);
63
- setPagination({
64
- current: result?.data?.data?.page,
65
- pageSize:result?.data?.data?.size,
66
- total: result?.data?.data?.total
67
- })
68
- });
69
- }
70
-
71
- useEffect(() => {
72
- remoteData()
73
- }, []);
74
- const columns = [
75
- {
76
- title: false,
77
- key: 'name',
78
- dataIndex: 'name',
79
- render: (text: any, record: any) => {
80
- const { importStatus, createTime } = record;
81
- let resultIcon;
82
- switch (importStatus) {
83
- case '10':
84
- resultIcon = <img src={exportProcessing} />;
85
- break;
86
- case '20':
87
- resultIcon = <img src={exportSuccess} />;
88
- break;
89
- case '30':
90
- resultIcon = <img src={exportFail} />;
91
- }
92
- return (
93
- <div style={{ display: 'flex' }}>
94
- <div className={styles.pictureWrap}>{resultIcon}</div>
95
- <div style={{ marginLeft: '4px' }}>
96
- <div style={{ fontSize: '14px', marginBottom: '-3px' }}>
97
- {text}
98
- </div>
99
- <div
100
- style={{
101
- color: '#BFBFBF',
102
- fontSize: '12px',
103
- lineHeight: '16px',
104
- }}
105
- >
106
- {record?.importStatus === '10'
107
- ? '导出进行中...'
108
- : handleCommonTimeRender(createTime)}
109
- </div>
110
- </div>
111
- </div>
112
- );
113
- },
114
- },
115
- {
116
- title: false,
117
- dataIndex: '2',
118
- render: (text: any, record: any) => {
119
- return (
120
- <Space>
121
- {record.importStatus == 20 && <Button style={{padding: 0}} type={'link'} onClick={() => {
122
- downloadExcel(record.importUrl, record.name, true);
123
- }}>下载</Button>}
124
- {record.importStatus !== 10 && <Popconfirm title={'确定要删除吗?'} onConfirm={() => {
125
- axios({
126
- url:`/oms-ops/businessImport/${record.id}`,
127
- method:'DELETE',
128
- })
129
- .then((result) => {
130
- message.success('删除成功')
131
- remoteData()
132
- })
133
- }}>
134
- <Button style={{padding: 0}} type={'link'} danger={true} >删除</Button>
135
- </Popconfirm>}
136
- </Space>
137
- );
138
- },
139
- },
140
- ];
141
-
142
- return (
143
- <Drawer {...props} bodyStyle={{ padding: 0 }}>
144
- <div className={styles.tableWrapper}>
145
- <Table columns={columns} dataSource={dataSource} pagination={pagination} onChange={remoteData} />
146
- </div>
147
- </Drawer>
148
- );
149
- };
150
- export default ExportHistoryIcon;
@@ -1,22 +0,0 @@
1
- import dayjs from 'dayjs'
2
-
3
- export function downloadExcel(data: any, fileName?: any, isResUrl?: boolean) {
4
- const resUrl = isResUrl
5
- ? data
6
- : window.URL.createObjectURL(
7
- new Blob([data], {
8
- type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
9
- }),
10
- );
11
- const save_link = document.createElement('a');
12
- save_link.href = resUrl;
13
- if (fileName) {
14
- save_link.download = fileName; /// 设置下载文件名
15
- }
16
- save_link.click();
17
- }
18
-
19
- export function handleCommonTimeRender(text: any, format?: any) {
20
- const formatType = format || 'YYYY-MM-DD HH:mm:ss';
21
- return text && dayjs(text).format(formatType);
22
- }