diff --git a/src/components/Promenu/index.tsx b/src/components/Promenu/index.tsx index ea722d0..199d7c1 100644 --- a/src/components/Promenu/index.tsx +++ b/src/components/Promenu/index.tsx @@ -213,6 +213,8 @@ const Promenu: React.FC<{}> = () => { tempForm.appendChild(hideInput) } tempForm.submit(); + }else{ + message.warn('请先选择跟进的项目') } } } diff --git a/src/pages/Finance/Cost/index.tsx b/src/pages/Finance/Cost/index.tsx index 13d549f..ca47d02 100644 --- a/src/pages/Finance/Cost/index.tsx +++ b/src/pages/Finance/Cost/index.tsx @@ -8,7 +8,8 @@ import { ExclamationCircleOutlined } from '@ant-design/icons'; import ExtendUpload from '@/utils/ExtendUpload'; import { commonMessage } from '@/utils/MessageUtils'; import moment from 'moment'; - +import kefu from '@/assets/img/kefu.png' //智慧客服 +import {windowOpenChatUI} from '@/utils/CustomerService' //智慧客服 const dateFormat = 'YYYY-MM-DD'; const finance: React.FC<{}> = () => { @@ -73,6 +74,14 @@ const finance: React.FC<{}> = () => { "-1": { text: '已失效', }, }, }, + { + title: '我要咨询', + dataIndex: 'consult', + width: '5%', + render: (text: any, record: any) => ( + {initChatUI(record)}}> + ), + }, { title: '操作', dataIndex: 'option', width: '5%', valueType: 'option', @@ -575,6 +584,84 @@ const finance: React.FC<{}> = () => { }) } + const initChatUI = (record:any)=>{//智慧客服-创建临时表单 + let roleAuthority: any | null = sessionStorage.getItem('roleAuthority'); + const inputList = [ + { + label:null, + paraName:'origin', + isEncode:false, + paraVal:'eBid', + }, + { + label:null, + paraName:'tenderAgencyId', + isEncode:false, + paraVal:record.agencyId, + }, + { + label:null, + paraName:'tenderAgencyName', + isEncode:true, + paraVal:record.agencyName, + }, + { + 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', + }, + { + label:'项目名称', + paraName:'projectName', + isEncode:true, + paraVal:record.projectName, + }, + { + label:'订单号', + paraName:'orderNumber', + isEncode:true, + paraVal:record.orderNumber, + }, + { + label:'费用类型', + paraName:'commodityName', + isEncode:true, + paraVal:record.commodityName, + }, + { + label:'下单时间 ', + paraName:'createDate', + isEncode:true, + paraVal:record.createDate, + }, + { + label:'金额', + paraName:'amount', + isEncode:true, + paraVal:`¥${record.amount}`, + }, + { + label:'状态', + paraName:'fystate', + isEncode:true, + paraVal:record.state=='0'?'未支付':record.state=='1'?'支付中':record.state=='2'?'支付成功':record.state=='3'?'待审核':record.state=='-2'?'审核驳回':record.state=='-1'?'已失效':'-', + }, + ] + windowOpenChatUI(inputList, window.location.pathname) + } return ( <> diff --git a/src/pages/Invoice/Supplier/index.tsx b/src/pages/Invoice/Supplier/index.tsx index 28b4d11..7d0ca1c 100644 --- a/src/pages/Invoice/Supplier/index.tsx +++ b/src/pages/Invoice/Supplier/index.tsx @@ -1,5 +1,5 @@ import React, { useState, useRef, useEffect } from 'react'; -import { Button, Card } from 'antd'; +import { Button, Card, message } from 'antd'; import ProTable, { ProColumns, ActionType } from '@ant-design/pro-table'; import { addInvoice, getList } from './service'; import EditInvoiceSupplier from './components/EditInvoiceSupplier'; @@ -7,6 +7,9 @@ import { handleUpdate } from './utils'; import ViewInvoiceSupplier from './components/ViewInvoiceSupplier'; import '@/assets/zjl_style.less'; import { btnAuthority } from '@/utils/authority'; +import kefu from '@/assets/img/kefu.png' //智慧客服 +import {windowOpenChatUI} from '@/utils/CustomerService' //智慧客服 +import { getSessionUserData } from "@/utils/session"; const InvoiceSupplier: React.FC<{}> = () => { const actionRef = useRef(); @@ -45,6 +48,14 @@ const InvoiceSupplier: React.FC<{}> = () => { dataIndex: 'projectName', key: 'projectName', }, + { + title: '我要咨询', + dataIndex: 'consult', + width: '5%', + render: (text: any, record: any) => ( + {initChatUI(record)}}> + ), + }, { title: '公司名称', dataIndex: 'companyName', @@ -96,6 +107,78 @@ const InvoiceSupplier: React.FC<{}> = () => { ), }, ]; + const initChatUI = (record:any)=>{//智慧客服-创建临时表单 + let roleAuthority: any | null = sessionStorage.getItem('roleAuthority'); + const inputList = [ + { + label:null, + paraName:'origin', + isEncode:false, + paraVal:'eBid', + }, + { + label:null, + paraName:'tenderAgencyId', + isEncode:false, + paraVal:'EMPTY', + }, + { + label:null, + paraName:'tenderAgencyName', + isEncode:true, + paraVal:'招投标客服', + }, + { + 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:'2', + }, + { + label:'项目名称', + paraName:'projectName', + isEncode:true, + paraVal:record.projectName, + }, + { + label:'公司名称', + paraName:'companyName', + isEncode:true, + paraVal:record.companyName, + }, + { + label:'发票类型', + paraName:'fptype', + isEncode:true, + paraVal:record.type=='0'?'增值税普通发票':record.type=='1'?'增值税专用发票':'-', + }, + { + label:'发票状态', + paraName:'fpstate', + isEncode:true, + paraVal:record.state=='0'?'未开':record.state=='1'?'已开':'-', + }, + { + label:'是否需要邮寄', + paraName:'isMail', + isEncode:true, + paraVal:record.isMail==-1?'无需邮寄':'需要邮寄', + }, + ] + windowOpenChatUI(inputList, window.location.pathname) + } return ( { * 项目跟进 * @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'); diff --git a/src/pages/Project/ProjectManage/ProjectManager/ProjectInformationManagement/index.tsx b/src/pages/Project/ProjectManage/ProjectManager/ProjectInformationManagement/index.tsx index 3eae946..871abf1 100644 --- a/src/pages/Project/ProjectManage/ProjectManager/ProjectInformationManagement/index.tsx +++ b/src/pages/Project/ProjectManage/ProjectManager/ProjectInformationManagement/index.tsx @@ -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 ( 项目建档 + , } style={{ borderRadius: 6 }} headStyle={{ padding: "0px 24px" }} bodyStyle={{ padding: "1px 0px" }} > diff --git a/src/pages/Project/ProjectManage/ProjectManager/PurchasingManagerEnquiries/components/PurchasingManagerEnquiries.tsx b/src/pages/Project/ProjectManage/ProjectManager/PurchasingManagerEnquiries/components/PurchasingManagerEnquiries.tsx index 91d5ae8..e77e65a 100644 --- a/src/pages/Project/ProjectManage/ProjectManager/PurchasingManagerEnquiries/components/PurchasingManagerEnquiries.tsx +++ b/src/pages/Project/ProjectManage/ProjectManager/PurchasingManagerEnquiries/components/PurchasingManagerEnquiries.tsx @@ -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) => ( + {saveTmpForm(record); initChatUI()}}> + ), + }, { 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(); diff --git a/src/pages/Tender/ProjectsInvolved/index.tsx b/src/pages/Tender/ProjectsInvolved/index.tsx index 73c8710..82d0c71 100644 --- a/src/pages/Tender/ProjectsInvolved/index.tsx +++ b/src/pages/Tender/ProjectsInvolved/index.tsx @@ -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) => ( - {createHiddenForm(record);initChatUI()}}> + {saveTmpForm(record); initChatUI()}}> ), }, { @@ -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 ( <> diff --git a/src/pages/Tender/supplier/InvitationLetter/components/InvitationLetter.tsx b/src/pages/Tender/supplier/InvitationLetter/components/InvitationLetter.tsx index 6ec29eb..ec2659b 100644 --- a/src/pages/Tender/supplier/InvitationLetter/components/InvitationLetter.tsx +++ b/src/pages/Tender/supplier/InvitationLetter/components/InvitationLetter.tsx @@ -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) => ( + {initChatUI(record)}}> + ), + }, { title: '采购人', dataIndex: 'tendereeOrgName', diff --git a/src/pages/Tender/supplier/LookingForBusinessOpportunities/components/LookingForBusinessOpportunitiesList.tsx b/src/pages/Tender/supplier/LookingForBusinessOpportunities/components/LookingForBusinessOpportunitiesList.tsx index 38d6c3b..d921dc0 100644 --- a/src/pages/Tender/supplier/LookingForBusinessOpportunities/components/LookingForBusinessOpportunitiesList.tsx +++ b/src/pages/Tender/supplier/LookingForBusinessOpportunities/components/LookingForBusinessOpportunitiesList.tsx @@ -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) => ( - {createHiddenForm(record);initChatUI()}}> + {initChatUI(record)}}> ), }, { diff --git a/src/utils/CustomerService.ts b/src/utils/CustomerService.ts new file mode 100644 index 0000000..5f24891 --- /dev/null +++ b/src/utils/CustomerService.ts @@ -0,0 +1,68 @@ + /*客服系统专用*/ + //跨系统post传参 + + export const bizServiceCustomService = REACT_APP_CUSTOMERSERVICE_USERCENTER + '&client_id=' + REACT_APP_CUSTOMERSERVICE_CLIENT_ID + '&redirect_uri=' + REACT_APP_CUSTOMERSERVICE_REDIRECT + '/redirect?page=home&mall3_token=';//智慧客服 + //export const bizServiceCustomService = REACT_APP_CUSTOMERSERVICE_USERCENTER + '&client_id=S00hFPxc&redirect_uri=http://localhost:3000/redirect?page=home&mall3_token=';//智慧客服 + export function windowOpenChatUI(inputList:any,pathname:string) { + if(inputList && inputList.length>0){ + 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 = bizServiceCustomService + sessionStorage.getItem('Authorization') + tempForm.target='_blank' + inputList.map((input: any)=>{ + let labelName= input.label!=null?`_CustomerServiceLabel_${input.label}`:'' + var hideInput = document.createElement("input") + hideInput.type="hidden" + hideInput.name= input.paraName + hideInput.value = input.isEncode?`${encodeURI(input.paraVal)}${labelName}`:`${input.paraVal}${labelName}` + tempForm.appendChild(hideInput) + }) + var input = document.createElement("input") + input.id = 'tempInput_CustomerService' + input.name= 'sceneUrl' + input.value= pathname + tempForm.appendChild(input) + document.body.appendChild(tempForm); + if(tempForm){ + tempForm.submit(); + document.body.removeChild(tempForm); + } + } + } + //创建临时表单 + export function createHiddenForm(inputList:any,pathname:string) { + if(inputList && inputList.length>0){ + 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 = bizServiceCustomService + sessionStorage.getItem('Authorization') + tempForm.target='_blank' + inputList.map((input: any)=>{ + let labelName= input.label!=null?`_CustomerServiceLabel_${input.label}`:'' + var hideInput = document.createElement("input") + hideInput.type="hidden" + hideInput.name= input.paraName + hideInput.value = input.isEncode?`${encodeURI(input.paraVal)}${labelName}`:`${input.paraVal}${labelName}` + tempForm.appendChild(hideInput) + }) + var input = document.createElement("input") + input.id = 'tempInput_CustomerService' + input.name= 'sceneUrl' + input.value= pathname + tempForm.appendChild(input) + document.body.appendChild(tempForm); + } + } + //提交临时表单 + export function submitHiddenForm() { + var tempForm = document.getElementById('tempForm_CustomerService') as HTMLFormElement + if(tempForm){ + tempForm.submit(); + document.body.removeChild(tempForm); + } + } \ No newline at end of file