Browse Source

(*)员工沟通统计前端导出处理

master
zmh 2 years ago
parent
commit
fbe0bf9056
  1. 22
      web/client/src/sections/humanAffairs/containers/communication/employeeCommunication.jsx

22
web/client/src/sections/humanAffairs/containers/communication/employeeCommunication.jsx

@ -1,14 +1,14 @@
import React, { useEffect, useRef, useState, useMemo } from 'react'; import React, { useEffect, useRef, useState, useMemo } from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import moment from 'moment' import moment from 'moment'
import { Select, Input, Button, Tooltip, Table, Pagination, Skeleton, DatePicker } from '@douyinfe/semi-ui'; import { Select, Input, Button, Tooltip, Table, Pagination, Skeleton, DatePicker, Toast } from '@douyinfe/semi-ui';
import { IconSearch } from '@douyinfe/semi-icons'; import { IconSearch } from '@douyinfe/semi-icons';
import DetailModal from './detailModal'; import DetailModal from './detailModal';
import { SkeletonScreen } from "$components"; import { SkeletonScreen } from "$components";
import '../../style.less' import '../../style.less'
const EmployeeCommunication = (props) => { const EmployeeCommunication = (props) => {
const { dispatch, actions } = props const { dispatch, actions, user } = props
const { humanAffairs } = actions; const { humanAffairs } = actions;
const [keywordTarget, setKeywordTarget] = useState('personalName'); const [keywordTarget, setKeywordTarget] = useState('personalName');
const [keyword, setKeyword] = useState('');// const [keyword, setKeyword] = useState('');//
@ -18,6 +18,7 @@ const EmployeeCommunication = (props) => {
const [modalV, setModalV] = useState(true); const [modalV, setModalV] = useState(true);
const [dataToDetail, setDataToDetail] = useState(null); const [dataToDetail, setDataToDetail] = useState(null);
const [tableData, setTableData] = useState([]); const [tableData, setTableData] = useState([]);
const [exportUrl, setExportUrl] = useState('');
const page = useRef(query.page); const page = useRef(query.page);
function seachValueChange(value) { function seachValueChange(value) {
setKeyword(value) setKeyword(value)
@ -191,14 +192,19 @@ const EmployeeCommunication = (props) => {
setModalV(false) setModalV(false)
} }
function handleChange (date) { function handleChange(date) {
if (date.length > 1) { if (date.length > 1) {
setTimeRange(moment(date[0]).format('YYYY-MM-DD 00:00:00')+','+moment(date[1]).format('YYYY-MM-DD 23:59:59')) setTimeRange(moment(date[0]).format('YYYY-MM-DD 00:00:00') + ',' + moment(date[1]).format('YYYY-MM-DD 23:59:59'))
} }
else { else {
setTimeRange(''); setTimeRange('');
} }
} }
const exportAllData = () => {
let url = `export/employee/communicate?token=${user.token}&timestamp=${moment().valueOf()}`
setExportUrl(url);
}
const scroll = useMemo(() => ({}), []); const scroll = useMemo(() => ({}), []);
return (<div style={{ padding: '0px 12px' }}> return (<div style={{ padding: '0px 12px' }}>
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
@ -247,7 +253,10 @@ const EmployeeCommunication = (props) => {
}}>查询</Button> }}>查询</Button>
</div> </div>
<div style={{ display: 'flex', marginRight: 20 }}> <div style={{ display: 'flex', marginRight: 20 }}>
<div style={{ padding: '6px 20px', background: '#0F7EFB', color: '#FFFFFF', fontSize: 14, marginLeft: 18, cursor: "pointer" }}> <div style={{ padding: '6px 20px', background: '#0F7EFB', color: '#FFFFFF', fontSize: 14, marginLeft: 18, cursor: "pointer" }}
onClick={() => {
exportAllData()
}}>
导出 导出
</div> </div>
</div> </div>
@ -301,6 +310,9 @@ const EmployeeCommunication = (props) => {
close={() => closeAndFetch()} close={() => closeAndFetch()}
onCancel={() => setModalV(false)} /> : '' onCancel={() => setModalV(false)} /> : ''
} }
{
exportUrl ? <iframe src={`/_api/${exportUrl}`} style={{ display: 'none' }} /> : ''
}
</div >) </div >)
} }

Loading…
Cancel
Save