采购经理、供应商、代理商嵌入客服

This commit is contained in:
unknown
2022-08-24 15:47:53 +08:00
parent 5821868d56
commit 8a7b0e1dae
10 changed files with 592 additions and 279 deletions

View File

@ -8,6 +8,7 @@ import { Button, Card, Col, Popover, Progress, Row, Tag, message } from 'antd';
import ProList from '@ant-design/pro-list';
import ProjectSectionInfo from './ProjectSectionInfo';
import { getBusinessModuleName, getTagColor } from '../utils';
import {submitHiddenForm, createHiddenForm} from '@/utils/CustomerService' //智慧客服
//标的类型
const procurementTypeEntrust = 'procurement_type=entrust';
//采购方式
@ -276,135 +277,93 @@ const ProjectDocumentation: React.FC = () => {
* 项目跟进
* @param data
*/
const createHiddenForm = (record:any)=>{//智慧客服-创建临时表单
const customerservice = REACT_APP_CUSTOMERSERVICE_USERCENTER + '&client_id=' + REACT_APP_CUSTOMERSERVICE_CLIENT_ID + '&redirect_uri=' + REACT_APP_CUSTOMERSERVICE_REDIRECT + '/redirect?page=home&mall3_token=';//智慧客服
//const customerservice = REACT_APP_CUSTOMERSERVICE_USERCENTER + '&client_id=S00hFPxc&redirect_uri=http://localhost:3000/redirect?page=home&mall3_token=';//智慧客服
var tempForm = document.getElementById('tempForm_CustomerService') as HTMLFormElement
if(tempForm) document.body.removeChild(tempForm);
tempForm = document.createElement("form")
tempForm.id="tempForm_CustomerService"
tempForm.method="post"
tempForm.action=customerservice + sessionStorage.getItem('Authorization')
tempForm.target='_blank'
const saveTmpForm = (record:any)=>{//智慧客服-创建临时表单
let roleAuthority: any | null = sessionStorage.getItem('roleAuthority');
const inputList = [
{
label:null,
paraName:'origin',
isEncode:false,
defaultVal:'eBid',
paraVal:'eBid',
},
{
paraName:'projectName',
isEncode:true,
defaultVal:null,
label:'项目名称',
paraName:'projectName',
isEncode:true,
paraVal:record.projectName,
},
{
label:'项目编号 ',
paraName:'ebpProjectNumber',
isEncode:true,
paraVal:record.ebpProjectNumber,
},
{
label:'项目流水号',
paraName:'projectBizNum',
isEncode:false,
defaultVal:null,
paraVal:record.projectBizNum,
},
{
label:null,
paraName:'tenderAgencyId',
isEncode:false,
defaultVal:'EMPTY',
paraVal:'EMPTY',
},
{
label:null,
paraName:'tenderAgencyName',
isEncode:true,
defaultVal:null,
},
{
paraName:'tendereeName',
isEncode:true,
defaultVal:null,
paraVal:'招投标客服',
},
{
label:'项目状态',
paraName:'status',
isEncode:false,
defaultVal:null,
paraVal:record.status==1?'编辑中':record.status==2?'进行中':record.status==3?'已结束':record.status==9?'废止':'无效状态',
},
{
label:'采购单位',
paraName:'tendereeName',
isEncode:true,
paraVal:record.tendereeName,
},
{
label:'实施单位',
paraName:'providerName',
isEncode:true,
paraVal:record.tenderAgencyName,
},
{
label:'实施人员',
paraName:'ownerContactName',
isEncode:true,
defaultVal:null,
},
{
paraName:'ownerContactId',
isEncode:false,
defaultVal:null,
},
{
paraName:'ownerContactTel',
isEncode:false,
defaultVal:null,
},
{
paraName:'appManagerName',
isEncode:true,
defaultVal:null,
},
{
paraName:'appManagerId',
isEncode:false,
defaultVal:null,
},
{
paraName:'appManagerTel',
isEncode:false,
defaultVal:null,
paraVal:record.appManagerName+'-'+record.appManagerId+'-'+record.appManagerTel
},
{
label:null,
paraName:'roleAuthority',
isEncode:false,
defaultVal:null,
paraVal:JSON.parse(roleAuthority)[0],
},
{
label:null,
paraName:'module',
isEncode:false,
defaultVal:'2',
paraVal:'2',
},
{
label:null,
paraName:'custType',
isEncode:false,
defaultVal:'1',
paraVal:'1',
},
]
if(inputList && inputList.length>0){
inputList.map(input=>{
var hideInput = document.createElement("input")
hideInput.type="hidden"
hideInput.name= input.paraName
if(input.paraName=='roleAuthority'){
let roleAuthority: any | null = sessionStorage.getItem('roleAuthority');
hideInput.value = JSON.parse(roleAuthority)[0]
}else{
if(input.isEncode){
hideInput.value = encodeURI(record[input.paraName])
}else{
if(input.defaultVal!=null){
hideInput.value = input.defaultVal
}else{
hideInput.value = record[input.paraName]
}
}
}
tempForm.appendChild(hideInput)
})
var input = document.createElement("input")
input.id = 'tempInput_CustomerService'
input.name= 'sceneUrl'
input.value= window.location.pathname
tempForm.appendChild(input)
document.body.appendChild(tempForm);
}else{
message.warn('参数为空')
}
createHiddenForm(inputList, window.location.pathname)
}
const followUpProject = async (data: projectDataItem) => {
//创建临时表单-智慧客服
createHiddenForm(data)
saveTmpForm(data)
data.returnURL = getReturnURL();
await followUpAProjectManager(data);
history.push('/ProjectLayout/Manager/HomePageSectionList');
@ -423,6 +382,8 @@ const ProjectDocumentation: React.FC = () => {
* @param data
*/
const projectDocumentation = async (data: projectDataItem) => {
//创建临时表单-智慧客服
saveTmpForm(data)
data.returnURL = getReturnURL();
await followUpAProjectManager(data);
history.push('/Project/ProjectManage/ProjectManager/ProjectInformationManagement');

View File

@ -14,6 +14,7 @@ import PackageDivided from '@/pages/Project/ProjectManage/PackageDivided';
import { getId, getProjectIsUpdate, submitProject } from './service';
import { history } from 'umi';
import { getProMethod, followUpAProjectManager, getSessionProjectData } from '@/utils/session';
import { CustomerServiceTwoTone } from '@ant-design/icons';
const { TabPane } = Tabs;
let tab1 = '项目信息',
@ -156,13 +157,35 @@ const Index: React.FC = () => {
setSubmitLoading(false);
});
}
const initChatUI = () => { //智慧客服
var tempForm = document.getElementById('tempForm_CustomerService') as HTMLFormElement
if(tempForm){
var hideInput = document.getElementById('tempInput_CustomerService') as HTMLInputElement
if(hideInput){
hideInput.value= window.location.pathname
}else{
hideInput = document.createElement("input")
hideInput.id = 'tempInput_CustomerService'
hideInput.type="hidden"
hideInput.name= 'sceneUrl'
hideInput.value= window.location.pathname
tempForm.appendChild(hideInput)
}
tempForm.submit();
}else{
message.warn('请先选择建档项目')
}
}
return (
<Spin spinning={submitLoading}>
<Card title={
<span>
<span style={{ verticalAlign: 'middle' }}></span>
<Button onClick={() => window.history.go(-1)} style={{ float: 'right' }}></Button>
<Button key="customerservice" style={{ float: 'right' }} onClick={() =>{
initChatUI() //智慧客服
}} icon={<CustomerServiceTwoTone />}>
</Button>,
</span>
} style={{ borderRadius: 6 }} headStyle={{ padding: "0px 24px" }} bodyStyle={{ padding: "1px 0px" }}
>

View File

@ -14,6 +14,8 @@ import ProTable, { ProColumns } from '@ant-design/pro-table';
import { Button, Card, PageHeader } from 'antd';
import React, { useState } from 'react';
import { useHistory } from 'umi';
import kefu from '@/assets/img/kefu.png' //智慧客服
import {submitHiddenForm, createHiddenForm} from '@/utils/CustomerService' //智慧客服
const PurchasingManagerEnquiries: React.FC = () => {
//获取字典
const getDict: any = getDicData();
@ -46,6 +48,13 @@ const PurchasingManagerEnquiries: React.FC = () => {
dataIndex: 'projectName',
initialValue: projectName
},
{
title: '我要咨询',
dataIndex: 'consult',
render: (text: any, record: any) => (
<span onClick={()=>{saveTmpForm(record); initChatUI()}}><img style={{width:20,height:20, cursor:'pointer'}} src={kefu} alt="" /></span>
),
},
{
title: '项目编号',
dataIndex: 'ebpProjectNumber',
@ -97,7 +106,93 @@ const PurchasingManagerEnquiries: React.FC = () => {
)
},
];
const saveTmpForm = (record:any)=>{//智慧客服-创建临时表单
let roleAuthority: any | null = sessionStorage.getItem('roleAuthority');
const inputList = [
{
label:null,
paraName:'origin',
isEncode:false,
paraVal:'eBid',
},
{
label:'项目名称',
paraName:'projectName',
isEncode:true,
paraVal:record.projectName,
},
{
label:'项目编号',
paraName:'ebpProjectNumber',
isEncode:false,
paraVal:record.ebpProjectNumber,
},
{
label:'项目流水号',
paraName:'projectBizNum',
isEncode:false,
paraVal:record.projectBizNum,
},
{
label:null,
paraName:'tenderAgencyId',
isEncode:false,
paraVal:'EMPTY',
},
{
label:null,
paraName:'tenderAgencyName',
isEncode:true,
paraVal:'招投标客服',
},
{
label:'项目状态',
paraName:'status',
isEncode:false,
paraVal:record.status==1?'编辑中':record.status==2?'进行中':record.status==3?'已结束':record.status==9?'废止':'无效状态',
},
{
label:'采购单位',
paraName:'tendereeName',
isEncode:true,
paraVal:record.tendereeName,
},
{
label:'实施单位',
paraName:'providerName',
isEncode:true,
paraVal:record.tenderAgencyName,
},
{
label:'实施人员',
paraName:'ownerContactName',
isEncode:true,
paraVal:record.appManagerName+'-'+record.appManagerId+'-'+record.appManagerTel
},
{
label:null,
paraName:'roleAuthority',
isEncode:false,
paraVal:JSON.parse(roleAuthority)[0],
},
{
label:null,
paraName:'module',
isEncode:false,
paraVal:'2',
},
{
label:null,
paraName:'custType',
isEncode:false,
paraVal:'1',
},
]
createHiddenForm(inputList, window.location.pathname)
}
const initChatUI = ()=>{ //打开客服界面
submitHiddenForm()
}
/**
* 获取返回路径
* @returns
@ -112,6 +207,7 @@ const PurchasingManagerEnquiries: React.FC = () => {
* @param data
*/
const followUpProject = async (data: any) => {
saveTmpForm(data)
data.returnURL = getReturnURL()
await followUpAProjectManager(data);
setPurchaseCanOperate();