Browse Source

(*)储备项目报备表 导出 ;ps:导出速度很慢,转圈圈后续开展

master
周沫沫历险记 2 years ago
parent
commit
a9385b21e9
  1. 4
      README.md
  2. 19
      web/client/src/sections/business/actions/reserve-item.js
  3. 27
      web/client/src/sections/business/containers/reserveItemsReporting.jsx
  4. 4
      web/client/src/utils/webapi.js
  5. 13
      web/config.js
  6. 2
      web/package.json
  7. 17
      web/routes/services/index.js

4
README.md

@ -36,3 +36,7 @@ CLICKHOUST_USER
CLICKHOUST_PASSWORD
CLICKHOUST_PEP_EMIS //clickhouse 的 emis 库名
```
### 后端服务
```
ANXINCLOUD_PM_SERVICES //郑兴写的后端服务地址
```

19
web/client/src/sections/business/actions/reserve-item.js

@ -12,13 +12,14 @@ export function getReserveItemReport(type) {
});
}
export function getFilingReport(type) {
return dispatch => basicAction({
type: 'get',
dispatch: dispatch,
actionType: 'GET_FILING_REPORT',
url: `${ApiTable.getFilingReport}`,
msg: { error: '获取储备项目报备表失败' },
reducer: { name: 'filingReport' }
});
export function getFilingReport() {
return dispatch => {
return RouteRequest.get(RouteTable.getServiceUrl)
.then(res => {
return dispatch({
type: "SERVER_PMREPORT_URL",
payload: res
})
});
}
}

27
web/client/src/sections/business/containers/reserveItemsReporting.jsx

@ -1,11 +1,14 @@
import React, { useEffect, useState } from 'react';
import { connect } from 'react-redux';
import { Select, Input, Button, RadioGroup, Radio, Tooltip, Table } from '@douyinfe/semi-ui';
import { Select, Input, Button, Banner, Radio, Tooltip, Table } from '@douyinfe/semi-ui';
import { IconSearch } from '@douyinfe/semi-icons';
import '../style.less'
import moment from 'moment'
const ReserveItemsReporting = (props) => {
const [downloadUrl, setDownloadUrl] = useState(null);
const [warningBanner, setWarningBanner] = useState(null);
const columns = [
{
title: '序号',
@ -67,11 +70,18 @@ const ReserveItemsReporting = (props) => {
},
];
const data = [];
const exportAll = () => {
const { dispatch, actions } = props;
dispatch(actions.businessManagement.getFilingReport());
dispatch(actions.businessManagement.getFilingReport()).then(res => {
const { payload } = res;
if (payload && payload.url) {
setDownloadUrl(`${payload.url}/week_report/reserve`);
} else {
setWarningBanner("导出地址有误,导出失败");
}
});
}
return (
<>
<div style={{ padding: '0px 12px' }}>
@ -90,6 +100,13 @@ const ReserveItemsReporting = (props) => {
<div style={{ marginLeft: 6, fontSize: 12, color: '#969799', fontFamily: "DINExp", }}>REPORT FORM OF RESERVE ITEMS</div>
</div>
</div>
{
warningBanner &&
(<Banner
type="danger"
description={warningBanner}
onClose={() => setWarningBanner(null)}
/>)}
<div style={{ display: 'flex', marginTop: 16, marginBottom: 17 }}>
{/* <div style={{ marginLeft: 12, marginRight: 18 }}>
<Input suffix={<IconSearch />}
@ -108,6 +125,7 @@ const ReserveItemsReporting = (props) => {
// }
// })
}}>查询</Button> */}
<Button theme='solid' type='secondary' style={{ width: 80, borderRadius: 2, marginLeft: 15 }}
onClick={exportAll}>导出全部</Button>
</div>
@ -115,6 +133,9 @@ const ReserveItemsReporting = (props) => {
<Table columns={columns} dataSource={data} pagination={false} />
</div>
{
downloadUrl ? <iframe key={downloadUrl} src={downloadUrl} style={{ display: 'none' }} /> : ''
}
</div>
</>
)

4
web/client/src/utils/webapi.js

@ -18,13 +18,11 @@ export const ApiTable = {
//项目报表
getReserveItemReport: "reserveItem/report/{type}",
getFilingReport:'/week_report/reserve',
};
export const RouteTable = {
apiRoot: "/api/root",
fileUpload: "/_upload/new",
cleanUpUploadTrash: "/_upload/cleanup",
getWeeklyService: '/_service/weekly',
qnDownload:'/file/qiniu/download',
getServiceUrl: '/_service/url'
};

13
web/config.js

@ -18,6 +18,7 @@ args.option('qnak', 'qiniuAccessKey');
args.option('qnsk', 'qiniuSecretKey');
args.option('qnbkt', 'qiniuBucket');
args.option('qndmn', 'qiniuDomain');
args.option('pmrs', 'pmReportService');
//基本动作-周报后端服务
args.option('wkys', 'weeklyServices');
@ -33,7 +34,7 @@ const ANXINCLOUD_QINIU_SK = process.env.ANXINCLOUD_QINIU_SECRETKEY || flags.qnsk
const ANXINCLOUD_QINIU_BUCKET_RESOURCE = process.env.ANXINCLOUD_QINIU_BUCKET_RESOURCE || flags.qnbkt;
const ANXINCLOUD_QINIU_DOMAIN_QNDMN_RESOURCE = process.env.ANXINCLOUD_QINIU_DOMAIN_QNDMN_RESOURCE || flags.qndmn;
//后端服务
const ANXINCLOUD_WEEKLY_SERVICES = process.env.ANXINCLOUD_WEEKLY_SERVICES || flags.wkys; //周报统计服务
const ANXINCLOUD_PM_SERVICES = process.env.ANXINCLOUD_PM_SERVICES || flags.pmrs;
if (
@ -77,7 +78,7 @@ const product = {
domain: ANXINCLOUD_QINIU_DOMAIN_QNDMN_RESOURCE
},
service: {
weekly: ANXINCLOUD_WEEKLY_SERVICES
url: ANXINCLOUD_PM_SERVICES
}
}
}, {
@ -111,10 +112,10 @@ if (dev) {
staticDirs: product.staticDirs,
mws: product.mws
.concat([
{
entry: require('./middlewares/webpack-dev').entry,
opts: {}
}
{
entry: require('./middlewares/webpack-dev').entry,
opts: {}
}
])
,
logger: product.logger

2
web/package.json

@ -7,7 +7,7 @@
"test": "mocha",
"start-vite": "cross-env NODE_ENV=developmentVite npm run start-params",
"start": "cross-env NODE_ENV=development npm run start-params",
"start-params": "node server -p 5700 -u http://localhost:4700 --apiHrUrl http://localhost:4700 --qnak 5XrM4wEB9YU6RQwT64sPzzE6cYFKZgssdP5Kj3uu --qnsk w6j2ixR_i-aelc6I7S3HotKIX-ukMzcKmDfH6-M5 --qnbkt pep-process-report --qndmn https://pepsource.anxinyun.cn --wkys http://10.8.30.109:14000",
"start-params": "node server -p 5700 -u http://localhost:4700 --apiHrUrl http://localhost:4700 --qnak 5XrM4wEB9YU6RQwT64sPzzE6cYFKZgssdP5Kj3uu --qnsk w6j2ixR_i-aelc6I7S3HotKIX-ukMzcKmDfH6-M5 --qnbkt pep-process-report --qndmn https://pepsource.anxinyun.cn --pmrs http://10.8.30.109:14000",
"deploy": "export NODE_ENV=production&& npm run build && node server",
"build-dev": "cross-env NODE_ENV=development&&webpack --config webpack.config.js",
"build": "cross-env NODE_ENV=production&&webpack --config webpack.config.prod.js"

17
web/routes/services/index.js

@ -0,0 +1,17 @@
'use strict';
module.exports = {
entry: function (app, router, opts) {
const getServiceUrl = async function (ctx) {
const { service } = opts;
ctx.status = 200;
ctx.body = {
url: service.url,
};
};
router.get('/_service/url', getServiceUrl);
}
};
Loading…
Cancel
Save