diff --git a/.vscode/launch.json b/.vscode/launch.json index 21c6934..f060cb0 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -4,6 +4,26 @@ // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ + { + "type": "node", + "request": "launch", + "name": "启动 web", + "program": "${workspaceRoot}/web/server.js", + "env": { + "NODE_ENV": "development" + }, + "args": [ + "-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" + ] + }, { "type": "node", "request": "launch", diff --git a/api/app/lib/controllers/auth/index.js b/api/app/lib/controllers/auth/index.js index 7c23a36..cfcc1f1 100644 --- a/api/app/lib/controllers/auth/index.js +++ b/api/app/lib/controllers/auth/index.js @@ -19,7 +19,7 @@ async function login (ctx, next) { emisLoginRes.authorized = true emisLoginRes.expired = moment().add(1, 'day') - emisLoginRes.hrUserInfo = undefined + emisLoginRes.dcUserInfo = undefined await ctx.redis.hmset(emisLoginRes.token, { expired: moment().add(1, 'day'), diff --git a/web/client/src/layout/actions/webSocket.js b/web/client/src/layout/actions/webSocket.js index 605748e..cd6cfce 100644 --- a/web/client/src/layout/actions/webSocket.js +++ b/web/client/src/layout/actions/webSocket.js @@ -2,19 +2,19 @@ import io from 'socket.io-client'; export const INIT_WEB_SOCKET = 'INIT_WEB_SOCKET' -export function initWebSocket ({ ioUrl, token, hrUserId }) { +export function initWebSocket ({ ioUrl, token, dcUserId }) { if (!ioUrl) { ioUrl = localStorage.getItem('apiRoot') ioUrl = JSON.parse(ioUrl).root } if (!token) { - let user = sessionStorage.getItem('hrUser') + let user = sessionStorage.getItem('dcUser') if (user) { user = JSON.parse(user) token = user.token } } - if (!ioUrl || !token || !hrUserId) { + if (!ioUrl || !token || !dcUserId) { return { type: '', } diff --git a/web/client/src/sections/auth/actions/auth.js b/web/client/src/sections/auth/actions/auth.js index d95db2b..afcb759 100644 --- a/web/client/src/sections/auth/actions/auth.js +++ b/web/client/src/sections/auth/actions/auth.js @@ -5,10 +5,10 @@ import { Request } from '@peace/utils'; export const INIT_AUTH = 'INIT_AUTH'; export function initAuth(userData) { - const sessionUser = JSON.parse(sessionStorage.getItem('hrUser')) + const sessionUser = JSON.parse(sessionStorage.getItem('dcUser')) const user = userData || sessionUser || {}; if (user.authorized && !sessionUser) { - sessionStorage.setItem('hrUser', JSON.stringify(user)) + sessionStorage.setItem('dcUser', JSON.stringify(user)) } return { type: INIT_AUTH, @@ -45,7 +45,7 @@ export function login(username, password) { return Request.post(ApiTable.login, { username, password, code: 'HR' }) .then(user => { - sessionStorage.setItem('hrUser', JSON.stringify(user)); + sessionStorage.setItem('dcUser', JSON.stringify(user)); return dispatch({ type: LOGIN_SUCCESS, payload: { user: user }, @@ -64,13 +64,13 @@ export function login(username, password) { export const LOGOUT = 'LOGOUT'; export function logout() { - const user = JSON.parse(sessionStorage.getItem('hrUser')) + const user = JSON.parse(sessionStorage.getItem('dcUser')) user && user.token ? Request.put(ApiTable.logout, { token: user.token, code: 'POMS' }) : null; - sessionStorage.removeItem('hrUser'); + sessionStorage.removeItem('dcUser'); localStorage.removeItem('poms_selected_sider'); localStorage.removeItem('poms_open_sider'); diff --git a/web/client/src/sections/auth/containers/login.jsx b/web/client/src/sections/auth/containers/login.jsx index b1f5f9d..4dfe39d 100644 --- a/web/client/src/sections/auth/containers/login.jsx +++ b/web/client/src/sections/auth/containers/login.jsx @@ -67,7 +67,7 @@ const Login = props => { dispatch(login(values.username, values.password)).then(res => { const data = res.payload.user localStorage.setItem('word', JSON.stringify(values.password)) - dispatch(actions.layout.initWebSocket({ ioUrl: apiRoot, token: data.token, hrUserId: data.hrUserInfo && hrUserInfo.id })) + dispatch(actions.layout.initWebSocket({ ioUrl: apiRoot, token: data.token, dcUserId: data.dcUserInfo && dcUserInfo.id })) }) }} getFormApi={formApi => form.current = formApi} diff --git a/web/client/src/sections/business/containers/reserveItemsPeriodicStatistics.jsx b/web/client/src/sections/business/containers/reserveItemsPeriodicStatistics.jsx index aa015f8..9f56834 100644 --- a/web/client/src/sections/business/containers/reserveItemsPeriodicStatistics.jsx +++ b/web/client/src/sections/business/containers/reserveItemsPeriodicStatistics.jsx @@ -8,17 +8,15 @@ import '../style.less' const ReserveItemsPeriodicStatistics = (props) => { const { dispatch, actions, isRequesting, reserveItemReport } = props; + const [downloadUrl, setDownloadUrl] = useState(null); + const [downloadKey, setDownloadKey] = useState(null); useEffect(() => { dispatch(actions.businessManagement.getReserveItemReport(RESERVEITEM_TYPE.periodicStatistics)); }, []); - const exportReport = () => { - RouteRequest.get(RouteTable.qnDownload).then(res => { - debugger; - console.log(res); - // setDownloadUrl(`members/export?token=${user.token}&state=${typeChoose}&keywordTarget=${keywordTarget}&keyword=${keyword}&keys=overtimeStatistic,vacateStatistic`) - }) - + const exportReport = (url) => { + setDownloadUrl(`/_file-server${url}`); + setDownloadKey(Math.random()); } const columns = [ @@ -38,7 +36,7 @@ const ReserveItemsPeriodicStatistics = (props) => { { title: '操作', dataIndex: 'action', - render: (text, record, indexe) => () + render: (text, record, indexe) => () }, ]; @@ -61,9 +59,9 @@ const ReserveItemsPeriodicStatistics = (props) => {
- {/* { - downloadUrl ?