采购经理、供应商、代理商嵌入客服
This commit is contained in:
@ -10,6 +10,7 @@ import { followUpAProjectSupplier, getDicData } from '@/utils/session';
|
||||
import { getDictName, getProjectTypeCode, getURLInformation, getUrlParam, getUrlRelativePath, isEmpty, isNotEmpty, proTableValueEnum, proTableValueEnumOther } from '@/utils/CommonUtils';
|
||||
import { btnAuthority } from '@/utils/authority';
|
||||
import kefu from '@/assets/img/kefu.png' //智慧客服
|
||||
import {submitHiddenForm, createHiddenForm} from '@/utils/CustomerService' //智慧客服
|
||||
|
||||
const { TabPane } = Tabs;
|
||||
const { TextArea } = Input;
|
||||
@ -126,7 +127,7 @@ const Index: React.FC<{}> = () => {
|
||||
title: '我要咨询',
|
||||
dataIndex: 'consult',
|
||||
render: (text: any, record: any) => (
|
||||
<span onClick={()=>{createHiddenForm(record);initChatUI()}}><img style={{width:20,height:20, cursor:'pointer'}} src={kefu} alt="" /></span>
|
||||
<span onClick={()=>{saveTmpForm(record); initChatUI()}}><img style={{width:20,height:20, cursor:'pointer'}} src={kefu} alt="" /></span>
|
||||
),
|
||||
},
|
||||
{
|
||||
@ -291,7 +292,7 @@ const Index: React.FC<{}> = () => {
|
||||
|
||||
const saveProject = async (val: any) => { // 点击项目跟进存储项目信息
|
||||
//创建临时表单-智慧客服
|
||||
createHiddenForm(val)
|
||||
saveTmpForm(val)
|
||||
val.returnURL = getReturnURL()
|
||||
await followUpAProjectSupplier(val);
|
||||
history.push('/ProjectLayout/Supplier/HomePageSectionList')
|
||||
@ -404,139 +405,92 @@ const Index: React.FC<{}> = () => {
|
||||
}
|
||||
})
|
||||
}
|
||||
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:false,
|
||||
paraVal:record.ebpProjectNumber,
|
||||
},
|
||||
{
|
||||
label:'项目流水号',
|
||||
paraName:'projectBizNum',
|
||||
isEncode:false,
|
||||
defaultVal:null,
|
||||
paraVal:record.projectBizNum,
|
||||
},
|
||||
{
|
||||
label:null,
|
||||
paraName:'tenderAgencyId',
|
||||
isEncode:false,
|
||||
defaultVal:null,
|
||||
paraVal:record.tenderAgencyId,
|
||||
},
|
||||
{
|
||||
label:null,
|
||||
paraName:'tenderAgencyName',
|
||||
isEncode:true,
|
||||
defaultVal:null,
|
||||
},
|
||||
{
|
||||
paraName:'tendereeName',
|
||||
isEncode:true,
|
||||
defaultVal:null,
|
||||
paraVal:record.tenderAgencyName,
|
||||
},
|
||||
{
|
||||
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:'10',
|
||||
paraVal:'10',
|
||||
},
|
||||
{
|
||||
label:null,
|
||||
paraName:'custType',
|
||||
isEncode:false,
|
||||
defaultVal:'2',
|
||||
paraVal:'2',
|
||||
},
|
||||
]
|
||||
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 initChatUI = () => { //智慧客服
|
||||
var tempForm = document.getElementById('tempForm_CustomerService') as HTMLFormElement
|
||||
if(tempForm){
|
||||
tempForm.submit();
|
||||
document.body.removeChild(tempForm);
|
||||
}
|
||||
const initChatUI = ()=>{ //打开客服界面
|
||||
submitHiddenForm()
|
||||
}
|
||||
return (
|
||||
<>
|
||||
|
Reference in New Issue
Block a user