Commit 5779df4d367ecd83f744a62b35f02f37008dc8b8
1 parent
da356727
下载模板优化
Showing
2 changed files
with
25 additions
and
19 deletions
src/pages/performance/EvaDataImport/api.ts
... | ... | @@ -52,3 +52,17 @@ export function evaDataIndApi(): http.PromiseResp<any> { |
52 | 52 | export function saveEvaImportData(params: { key: string }) { |
53 | 53 | return request.get(`${MORAX_HOST}/erp/eval-indicator/save-import`, { params }); |
54 | 54 | } |
55 | + | |
56 | +/** 下载人员模板 | |
57 | + * http://testgate.feewee.cn/morax/erp/eval-indicator/import-detail | |
58 | + */ | |
59 | +export function upLoadStaffApi(): http.PromiseResp<any> { | |
60 | + return request.get(`${MORAX_HOST}/erp/eval-indicator/staff/template-file`, {}); | |
61 | +} | |
62 | + | |
63 | +/** 下载门店模板 | |
64 | + * http://testgate.feewee.cn/morax/erp/eval-indicator/import-detail | |
65 | + */ | |
66 | +export function upLoadShopApi(): http.PromiseResp<any> { | |
67 | + return request.get(`${MORAX_HOST}/erp/eval-indicator/shop/template-file`, {}); | |
68 | +} | ... | ... |
src/pages/performance/EvaDataImport/index.tsx
... | ... | @@ -2,7 +2,8 @@ import React, { useState } from "react"; |
2 | 2 | import { PageHeaderWrapper } from "@ant-design/pro-layout"; |
3 | 3 | import { Button, Card, Table, Row, message, Space, Typography, Divider, Switch, Upload } from "antd"; |
4 | 4 | import usePagination from "@/hooks/usePagination"; |
5 | -import { evaDataListApi } from "./api"; | |
5 | +import useInitial from "@/hooks/useInitail"; | |
6 | +import { evaDataListApi, upLoadStaffApi, upLoadShopApi } from "./api"; | |
6 | 7 | import { UploadOutlined } from "@ant-design/icons"; |
7 | 8 | import type { UploadProps } from "antd"; |
8 | 9 | import { history } from "umi"; |
... | ... | @@ -16,8 +17,12 @@ export default () => { |
16 | 17 | const { loading, list, paginationConfig, setParams, innerParams } = usePagination(evaDataListApi, { |
17 | 18 | pageSize: 10, |
18 | 19 | }); |
20 | + const { data: upLoadStaff, loading: upLoadStaffLoading } = useInitial(upLoadStaffApi, [], {}); | |
21 | + const { data: upLoadShop, loading: upLoadShopLoading } = useInitial(upLoadShopApi, [], {}); | |
19 | 22 | const [fileData, setFileData] = useState({}); |
20 | 23 | const [visible, setVisible] = useState<boolean>(false); |
24 | + console.log("upLoadStaff", upLoadStaff); | |
25 | + console.log("upLoadShop", upLoadShop); | |
21 | 26 | const uploadPerson: UploadProps = { |
22 | 27 | name: "file", |
23 | 28 | action: "/api/morax/erp/eval-indicator/analysis-staff", |
... | ... | @@ -59,21 +64,13 @@ export default () => { |
59 | 64 | <Row style={{ marginBottom: 10 }} justify="space-between"> |
60 | 65 | <Filter setParams={setParams} /> |
61 | 66 | <div> |
62 | - <Button type="default" style={{ marginRight: 10 }}> | |
63 | - <a | |
64 | - href="https://gate.feewee.cn/file/download?fid=74d1d724f9be48baa5921f3782037c3b" | |
65 | - target="_blank" | |
66 | - rel="noreferrer" | |
67 | - > | |
67 | + <Button type="default" style={{ marginRight: 10 }} loading={upLoadStaffLoading}> | |
68 | + <a href={upLoadStaff} target="_blank" rel="noreferrer"> | |
68 | 69 | 下载人员模板 |
69 | 70 | </a> |
70 | 71 | </Button> |
71 | - <Button type="default" style={{ marginRight: 10 }}> | |
72 | - <a | |
73 | - href="https://gate.feewee.cn/file/download?fid=e4eb136962164264a78753bd1d6061f3" | |
74 | - target="_blank" | |
75 | - rel="noreferrer" | |
76 | - > | |
72 | + <Button type="default" style={{ marginRight: 10 }} loading={upLoadShopLoading}> | |
73 | + <a href={upLoadShop} target="_blank" rel="noreferrer"> | |
77 | 74 | 下载门店模板 |
78 | 75 | </a> |
79 | 76 | </Button> |
... | ... | @@ -87,12 +84,7 @@ export default () => { |
87 | 84 | </Upload> |
88 | 85 | </div> |
89 | 86 | </Row> |
90 | - <Table | |
91 | - loading={loading} | |
92 | - rowKey={(row) => `id${row.id}`} | |
93 | - dataSource={list} | |
94 | - pagination={paginationConfig} | |
95 | - > | |
87 | + <Table loading={loading} rowKey={(row) => `id${row.id}`} dataSource={list} pagination={paginationConfig}> | |
96 | 88 | <Column |
97 | 89 | title="导入时间" |
98 | 90 | dataIndex="createTime" | ... | ... |