zmh 2 years ago
parent
commit
4c0d367fd6
  1. 2
      api/app/lib/controllers/customerContactsFollup/index.js
  2. 1
      web/client/src/layout/actions/global.js
  3. 30
      web/client/src/layout/containers/layout/index.jsx
  4. 2
      web/client/src/layout/reducers/global.js
  5. 16
      web/client/src/sections/business/actions/customerContactFollowup.js
  6. 4
      web/client/src/sections/business/actions/index.js
  7. 20
      web/client/src/sections/business/containers/customer/customerContactFollowup.jsx
  8. 2
      web/client/src/utils/webapi.js
  9. 6
      web/config.js
  10. 2
      web/package.json
  11. 5
      web/routes/attachment/index.js

2
api/app/lib/controllers/customerContactsFollup/index.js

@ -19,5 +19,5 @@ async function getCustomerContactsFollowup(ctx, next) {
}
module.exports = {
getCustomerContactsFollowup
getCustomerContactsFollowup,
}

1
web/client/src/layout/actions/global.js

@ -38,6 +38,7 @@ export function initApiRoot () {
type: INIT_API_ROOT,
payload: {
apiRoot: res.root,
webPepUrl:res.webPepUrl
}
})
});

30
web/client/src/layout/containers/layout/index.jsx

@ -33,8 +33,8 @@ let requestlogout = false;
// const location111 = useLocation();
const LayoutContainer = props => {
const {
dispatch,actions, msg, user, copyright, children, sections, clientWidth, clientHeight,
location, match, routes, history, socket, apiRoot
dispatch, actions, msg, user, copyright, children, sections, clientWidth, clientHeight,
location, match, routes, history, socket, apiRoot, webPepUrl
} = props
const [collapsed, setCollapsed] = useState(false)
@ -206,12 +206,9 @@ const LayoutContainer = props => {
const getUserInfoByToken = () => {
if (requestUser) {
requestUser = false;
console.log(RouteTable.apiRoot);
RouteRequest.get(RouteTable.apiRoot).then(res => {
let token = Cookie.get('pepToken', { domain: res.domain });
console.log(token);
dispatch(login({ token })).then(res => {
console.log(res);
if (res.type == 'LOGIN_SUCCESS') {
const data = res.payload?.user || {}
history.push('/businessManagement/pmReport/reserveItemsReporting')
@ -220,34 +217,18 @@ const LayoutContainer = props => {
localStorage.setItem('word', JSON.stringify('')) //
dispatch(actions.layout.initWebSocket({ ioUrl: apiRoot, token: data.token, hrUserId: data.hrUserInfo && hrUserInfo.id }))
} else {
redirectToLogin(true);
window.location.href = `${webPepUrl}/signin`
}
}, error => {
redirectToLogin(true);
window.location.href = `${webPepUrl}/signin`
})
}, error => {
message.error('鉴权失败', 5);
redirectToLogin(true);
window.location.href = `${webPepUrl}/signin`
})
}
}
const redirectToLogin = (toLogin = false) => {
//
if (!requestlogout) {
requestlogout = true;//退redirectToLoginwindow.location.hrefmessage.warning
RouteRequest.get(RouteTable.getPepWebUrl).then(res => {
if (res.url) {
if (toLogin) {
window.location.href = `${res.url}/signin`;
}
else {
window.location.href = `${res.url}/signin?isLogout=true`;
}
}
});
}
}
// websocket 使
@ -374,6 +355,7 @@ function mapStateToProps (state) {
user: auth.user,
socket: webSocket.socket,
apiRoot: global.apiRoot,
webPepUrl: global.webPepUrl,
};
}

2
web/client/src/layout/reducers/global.js

@ -11,6 +11,7 @@ function global (state = {
clientHeight: 768,
clientWidth: 1024,
apiRoot: '',
webPepUrl: ''
}, action) {
const payload = action.payload;
switch (action.type) {
@ -30,6 +31,7 @@ function global (state = {
case INIT_API_ROOT:
return Immutable.fromJS(state).merge({
apiRoot: payload.apiRoot,
webPepUrl: payload.webPepUrl
}).toJS();
default:
return state;

16
web/client/src/sections/business/actions/customerContactFollowup.js

@ -0,0 +1,16 @@
'use strict';
import { ApiTable, basicAction } from '$utils'
export function getCustomerContactsFollowup() {//查询
return (dispatch) => basicAction({
type: "get",
dispatch: dispatch,
actionType: "GET_CUSTOMER_CONTACT_FOLLOWUP",
url: `${ApiTable.getCustomerContactsFollowup}`,
msg: { option: "查询客户联系人对接跟进表" },
reducer: { name: "customerContactsFollowupList", params: { noClear: true } },
});
}

4
web/client/src/sections/business/actions/index.js

@ -2,8 +2,10 @@
import * as reserveItem from './reserve-item';
import * as salersReport from './salers-report';
import * as achievementReport from './achievement-report';
import * as getCustomerContactsFollowup from './customerContactFollowup'
export default {
...reserveItem,
...salersReport,
...achievementReport
...achievementReport,
...getCustomerContactsFollowup
}

20
web/client/src/sections/business/containers/customer/customerContactFollowup.jsx

@ -6,8 +6,10 @@ import '../../style.less'
import moment from 'moment'
const CustomerContactFollowup = (props) => {
const [downloadUrl, setDownloadUrl] = useState(null);
const [warningBanner, setWarningBanner] = useState(null);
const { dispatch,actions } = props
useEffect(() => {
dispatch(actions.businessManagement.getCustomerContactsFollowup());
}, []);
const columns = [
{
@ -54,7 +56,7 @@ const CustomerContactFollowup = (props) => {
];
const data = [];
const exportAll = () => {
}
return (
@ -75,13 +77,7 @@ const CustomerContactFollowup = (props) => {
<div style={{ marginLeft: 6, fontSize: 12, color: '#969799', fontFamily: "DINExp", }}>CUSTOMER CONTACT FOLLOW UP</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,9 +104,7 @@ const CustomerContactFollowup = (props) => {
<Table columns={columns} dataSource={data} pagination={false} />
</div>
{
downloadUrl ? <iframe key={downloadUrl} src={downloadUrl} style={{ display: 'none' }} /> : ''
}
</div>
</>
)

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

@ -30,6 +30,8 @@ export const ApiTable = {
getContractDetail: 'contract/detail',
getInvoicingDetail: 'invoicing/detail',
//客户联系人对接跟进
getCustomerContactsFollowup:'customerContactsFollup'
};
export const RouteTable = {
apiRoot: "/api/root",

6
web/config.js

@ -13,6 +13,8 @@ args.option(['p', 'port'], '启动端口');
args.option(['u', 'api-url'], 'webapi的URL');
args.option('apiHrUrl', 'webapi的URL 外网可访问');
args.option(['d', 'domain'], 'web domain');
args.option('webPepUrl', '企业管理 web');
// 七牛
@ -27,6 +29,7 @@ const flags = args.parse(process.argv);
const API_URL = process.env.API_URL || flags.apiUrl;
const API_DC_URL = process.env.API_DC_URL || flags.apiHrUrl;
const FS_REPORT_DOMAIN = process.FS_REPORT_DOMAIN || flags.domain;
const WEB_PEP_URL = process.env.WEB_PEP_URL || flags.webPepUrl;
// 七牛
const ANXINCLOUD_QINIU_AK = process.env.ANXINCLOUD_QINIU_ACCESSKEY || flags.qnak;
@ -80,7 +83,8 @@ const product = {
service: {
url: ANXINCLOUD_PM_SERVICES
},
domain: FS_REPORT_DOMAIN
domain: FS_REPORT_DOMAIN,
webPepUrl: WEB_PEP_URL
}
}, {
entry: require('./client').entry,// 静态信息

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 -d localhost --qnak 5XrM4wEB9YU6RQwT64sPzzE6cYFKZgssdP5Kj3uu --qnsk w6j2ixR_i-aelc6I7S3HotKIX-ukMzcKmDfH6-M5 --qnbkt pep-process-report --qndmn https://pepsource.anxinyun.cn --pmrs http://10.8.30.109:14000",
"start-params": "node server -p 5700 -u http://localhost:4700 --apiHrUrl http://localhost:4700 -d localhost --webPepUrl http://localhost:5300 --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"

5
web/routes/attachment/index.js

@ -20,12 +20,13 @@ module.exports = {
entry: function (app, router, opts) {
const getApiRoot = async function (ctx) {
const { apiUrl,domain } = opts;
const { apiUrl, domain, webPepUrl } = opts;
ctx.status = 200;
ctx.body = {
root: apiUrl,
domain:domain
domain: domain,
webPepUrl
};
};

Loading…
Cancel
Save