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

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

@ -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 (
<>

View File

@ -13,6 +13,9 @@ import { queryingPagingData } from '@/utils/PageUtils';
import ExtendUpload from '@/utils/ExtendUpload';
import { btnAuthority } from '@/utils/authority';
import BraftText from '@/components/richText/wang';
import kefu from '@/assets/img/kefu.png' //智慧客服
import {windowOpenChatUI} from '@/utils/CustomerService' //智慧客服
const { TabPane } = Tabs;
const modalHeight = innerHeight * 96 / 100;
//标的类型
@ -85,7 +88,84 @@ const LookingForBusinessOpportunitiesList: React.FC = () => {
//获取当前页是哪种采购方式
const proTypeCode = getProjectTypeCode();
const initChatUI = (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:'bidMethodDict',
isEncode:true,
paraVal:record.bidMethodDict=='procurement_mode_1'?'公开招标':record.bidMethodDict=='procurement_mode_2'?'邀请招标':record.bidMethodDict=='procurement_mode_3'?'公开比选':record.bidMethodDict=='procurement_mode_4'?'公开招募':record.bidMethodDict=='procurement_mode_5'?'竞争性谈判':record.bidMethodDict=='procurement_mode_6'?'单一来源':record.bidMethodDict=='procurement_mode_7'?'公开询价':record.bidMethodDict=='procurement_mode_8'?'竞拍':record.bidMethodDict=='procurement_mode_9'?'单一来源简化流程':'-',
},
{
label:'采购人',
paraName:'tendereeOrgName',
isEncode:true,
paraVal:record.tendereeOrgName,
},
{
label:'代理机构',
paraName:'tenderAgencyName',
isEncode:true,
paraVal:record.tenderAgencyName,
},
{
label:null,
paraName:'tenderAgencyId',
isEncode:false,
paraVal:record.tenderAgencyId,
},
{
label:null,
paraName:'tenderAgencyName',
isEncode:true,
paraVal:record.tenderAgencyName,
},
{
label:'项目分类',
paraName:'procurementType',
isEncode:false,
paraVal:record.procurementType=='procurement_type_1'?'货物':record.procurementType=='procurement_type_2'?'工程':record.procurementType=='procurement_type_3'?'服务':record.procurementType=='procurement_type_4'?'其他':'-',
},
{
label:'所属区域',
paraName:'regionDictName',
isEncode:true,
paraVal:record.regionDictName,
},
{
label:null,
paraName:'roleAuthority',
isEncode:false,
paraVal:JSON.parse(roleAuthority)[0],
},
{
label:null,
paraName:'module',
isEncode:false,
paraVal:'10',
},
{
label:null,
paraName:'custType',
isEncode:false,
paraVal:'2',
},
]
windowOpenChatUI(inputList, window.location.pathname)
}
useEffect(() => {
setTableLoading(true);
lookingForBussinessResp({ procurementMode: proTypeCode }).then((res: any) => {
@ -113,6 +193,13 @@ const LookingForBusinessOpportunitiesList: React.FC = () => {
title: '项目名称',
dataIndex: 'projectName',
},
{
title: '我要咨询',
dataIndex: 'consult',
render: (text: any, record: any) => (
<span onClick={()=>{initChatUI(record)}}><img style={{width:20,height:20, cursor:'pointer'}} src={kefu} alt="" /></span>
),
},
{
title: '采购人',
dataIndex: 'tendereeOrgName',

View File

@ -18,6 +18,7 @@ import { queryingPagingData } from '@/utils/PageUtils';
import ExtendUpload from '@/utils/ExtendUpload';
import { btnAuthority } from '@/utils/authority';
import kefu from '@/assets/img/kefu.png' //智慧客服
import {windowOpenChatUI} from '@/utils/CustomerService' //智慧客服
const { TabPane } = Tabs;
//标的类型
@ -107,140 +108,91 @@ const LookingForBusinessOpportunitiesList: React.FC<{}> = () => {
}
return '标段';
}
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 initChatUI = (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
windowOpenChatUI(inputList, window.location.pathname)
}
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('参数为空')
}
}
const initChatUI = () => { //智慧客服
var tempForm = document.getElementById('tempForm_CustomerService') as HTMLFormElement
if(tempForm){
tempForm.submit();
document.body.removeChild(tempForm);
}
}
useEffect(() => {
setTableLoading(true);
if (bidMethodDict.indexOf("procurement_mode_4") > -1) {
@ -293,7 +245,7 @@ const LookingForBusinessOpportunitiesList: 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={()=>{initChatUI(record)}}><img style={{width:20,height:20, cursor:'pointer'}} src={kefu} alt="" /></span>
),
},
{