<apex:page controller="CampaignMemberController" showHeader="false" sidebar="false" id="allPage" action="{!init}" title="参会人员">
|
<apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
|
<apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
|
<apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
|
<apex:stylesheet value="{!URLFOR($Resource.jquerysuggestcss)}"/>
|
<apex:includeScript value="{!URLFOR($Resource.jquerysuggestjs)}"/>
|
<apex:includeScript value="{!URLFOR($Resource.connection20)}"/>
|
<apex:includeScript value="{!URLFOR($Resource.apex20)}"/>
|
<!-- 2022/02/15 张华建 dependency start -->
|
<apex:includeScript value="{!URLFOR($Resource.AWSService, 'AWSService.js') }" />
|
<!-- 2022/02/15 张华建 dependency end -->
|
<style type="text/css">
|
.visitorplace_results {
|
border: 1px solid gray;
|
background-color: white;
|
padding: 0;
|
margin: 0;
|
list-style: none;
|
position: absolute;
|
z-index: 10000;
|
display: none;
|
overflow:auto;
|
white-space:nowrap;
|
width:400px;
|
height:250px;
|
}
|
.visitorplace_results li {
|
padding: 2px 5px 2px 0px;
|
margin-left : 2px;
|
color: #101010;
|
text-align: left;
|
}
|
</style>
|
<script>
|
//訪問場所インスタント検索
|
//allPage:allForm:allBlock:records:0:department
|
sforce.connection.sessionId = '{!$Api.Session_ID}';
|
|
var Error_Message15 = '医院科室不存在,请重新设定。';
|
var Error_Message16 = '请设定医院科室。';
|
|
function setVisitorPlace(index){
|
try{
|
var str = 'allPage:allForm:allBlock:records:'+ index + ':department';
|
var strPage = null;
|
var options = {};
|
|
var ros = j$(escapeVfId('userState')).value();
|
|
strPage = '/apex/CM_SearchDepartment?r=' + encodeURI(ros);
|
options = {minchars:3, minwords:2, resultsClass:'visitorplace_results'};
|
|
jQuery(escapeVfId(str)).unbind();
|
if (strPage != null) {
|
jQuery(escapeVfId(str)).suggest(strPage,options);
|
}
|
}catch(e){
|
alert(e);
|
}
|
|
//setVisitorPlaceDisabled();
|
}
|
|
function vpClear2_delay(index){
|
var vp = 'allPage:allForm:allBlock:records:'+ index + ':department';
|
var vpHidden = 'allPage:allForm:allBlock:records:'+ index + ':departmentHidden';
|
setTimeout(
|
function() {
|
//alert('jquerysuggest_skip_flag=' + j$(escapeVfId(vp)).attr("jquerysuggest_skip_flag"));
|
if(j$(escapeVfId(vp)).attr("jquerysuggest_skip_flag") == "false") {
|
if (j$(escapeVfId(vp)).value() != j$(escapeVfId(vpHidden)).value()) {
|
vpClear2(index);
|
}
|
}
|
},
|
200
|
);
|
}
|
|
function vpClear2(index){
|
var vp = 'allPage:allForm:allBlock:records:'+ index + ':department';
|
var vpHidden = 'allPage:allForm:allBlock:records:'+ index + ':departmentHidden';
|
var vpId = 'allPage:allForm:allBlock:records:'+ index + ':departmentId';
|
var vpHiddenId = 'allPage:allForm:allBlock:records:'+ index + ':departmentHiddenId';
|
if (j$(escapeVfId(vp)).value() != j$(escapeVfId(vpHidden)).value() || j$(escapeVfId(vpId)).value() != j$(escapeVfId(vpHiddenId)).value()) {
|
changeFlg = 'false';
|
v1 = 'allPage:allForm:allBlock:records:' + index + ':contact';
|
|
if(j$(escapeVfId(v1)).value() != null && j$(escapeVfId(v1)).value() != ''){changeFlg = 'true';}
|
|
unblockUI();
|
//alert('changeFlg+' +changeFlg);
|
if(changeFlg == 'true'){
|
alert('设定参会人员后,不能变更医院科室。');
|
vpBefore = j$(escapeVfId('allPage:allForm:allBlock:records:' + index + ':departmentHidden')).value();
|
vpIdBefore = j$(escapeVfId('allPage:allForm:allBlock:records:' + index + ':departmentHiddenId')).value();
|
j$(escapeVfId('allPage:allForm:allBlock:records:' + index + ':department')).val(vpBefore);
|
j$(escapeVfId('allPage:allForm:allBlock:records:' + index + ':departmentId')).val(vpIdBefore);
|
document.getElementById('allPage:allForm:allBlock:records:' + index + ':department').blur();
|
return;
|
}
|
}
|
resetValue('allPage:allForm:allBlock:records:'+ index + ':department');
|
}
|
|
//関連する引合インスタント検索
|
function setRelOppId(index, id, hiddenId){
|
try{
|
var str = 'allPage:allForm:allBlock:records:'+ index + ':' + id;
|
var strPD = 'allPage:allForm:allBlock:records:'+ index + ':department';
|
var aNamePD = j$(escapeVfId(strPD)).value();
|
if(aNamePD == ''){
|
// 訪問場所を設定してください。
|
document.getElementById(str).blur();
|
alert(Error_Message16);
|
return;
|
}
|
|
var strVP = 'allPage:allForm:allBlock:records:'+ index + ':departmentId';
|
var vl = j$(escapeVfId(strVP)).value();
|
if(vl.length == 0){
|
// 訪問場所が存在しません。
|
document.getElementById(str).blur();
|
alert(Error_Message15);
|
return;
|
}
|
|
var match = sforce.apex.execute("Add_Report","checkAccountMatch",{name:aNamePD,id:vl});
|
if(match == "NG"){
|
// 訪問場所IDマッチしていない
|
document.getElementById(str).blur();
|
alert("无法确定访问场所,请再设定一次访问场所。");
|
return;
|
}
|
|
var strPage = '/apex/CM_SearchOpportunity?r=' + encodeURI(vl);
|
jQuery(escapeVfId(str)).unbind();
|
jQuery(escapeVfId(str)).suggest(strPage,{});
|
}catch(e){
|
alert(e);
|
}
|
}
|
|
// 20220216 PI改造 by 徐亮 start
|
var staticResource = JSON.parse('{!staticResource}');
|
|
var awsids = [];
|
var aws_result={};
|
|
jQuery(function(){
|
|
jQuery("input.contact").each(function(){
|
let awsid = this.getAttribute('awsid');
|
if(awsid) awsids.push(awsid);
|
})
|
|
if(awsids.length > 0){
|
AWSService.search(staticResource.searchUrl,JSON.stringify({dataIds:awsids}),function(result){
|
if(result.status == '0' && result.object && result.object.length > 0){
|
for(let obji in result.object){let obj=result.object[obji];
|
jQuery("[awsid='"+obj.dataId + "']").val(obj.lastName);
|
}
|
}
|
},staticResource.token);
|
}
|
})
|
|
|
|
|
|
//jQuery(".contact").attr("awsid");
|
|
function encrypt(){
|
jQuery(".contact").each(function(i,e){
|
if(e.value){
|
e.value = '***';
|
}
|
});
|
}
|
|
// 20220216 PI改造 by 徐亮 end
|
|
function saveJs() {
|
blockme();
|
encrypt() // 20220216 PI改造 by 徐亮
|
saveLine();
|
}
|
function addJs() {
|
blockme();
|
addLine();
|
}
|
function closeJs() {
|
window.close();
|
}
|
function deleteJs(line) {
|
blockme();
|
deleteLine(line);
|
}
|
|
function openSearchContact(line) {
|
var vpHiddenId = j$(escapeVfId('allPage:allForm:allBlock:records:'+ (line-1) + ':departmentHiddenId')).value();
|
if (vpHiddenId == null || vpHiddenId == '') {
|
alert("请先选择医院科室。");
|
return false;
|
}
|
var urlStr = 'apex/CM_SearchContactService?line='+ line + '&acc=' + vpHiddenId;
|
var w = window.open(urlStr,'CM_SearchContactService','menubar=no,height=580,width=620');
|
w.focus();
|
}
|
|
function openCreateLead(line) {
|
var username = j$(escapeVfId('allPage:allForm:allBlock:records:'+ (line-1) + ':contact')).value();
|
var userid = j$(escapeVfId('allPage:allForm:allBlock:records:'+ (line-1) + ':contactId')).value();
|
var contactSDCName = j$(escapeVfId('allPage:allForm:allBlock:records:'+ (line-1) + ':contactSDCName')).value();
|
var acc = j$(escapeVfId('allPage:allForm:allBlock:records:'+ (line-1) + ':department')).value();
|
var accid = j$(escapeVfId('allPage:allForm:allBlock:records:'+ (line-1) + ':departmentId')).value();
|
var campaign = j$(escapeVfId('campaignName')).value();
|
var campaignId = j$(escapeVfId('campaignId')).value();
|
|
console.log('userid:'+userid+'---'+'contactSDCName:'+contactSDCName);
|
|
var sql = "select id,name,Department_Class__c,Department_Class__r.Name from Account where Id='"+accid+"'";
|
var sqlResult = sforce.connection.query(sql);
|
var records = sqlResult.getArray("records");
|
|
console.log('aaaaa:'+records[0].Department_Class__c+',bbbbb:'+records[0].Department_Class__r.Name);
|
|
var surname = username.replace(/\s/g,"");
|
if(surname.length == 3 || surname.length == 2){
|
var family_name = surname.substring(0,1);
|
var last_name = surname.substring(1);
|
}else if(surname.length == 4){
|
var family_name = surname.substring(0,2);
|
var last_name = surname.substring(1);
|
}else{
|
var family_name ='';
|
var last_name ='';
|
}
|
console.log('姓:'+family_name +'名:'+last_name);
|
if (username == null || username == '') {
|
alert("请先选择参会人员。");
|
} else{
|
//JZ-20191009 通过学会·培训记录区分新建意向还是新建询问单 START
|
var recordType = "{!cam.recordType.developerName}";
|
console.log(recordType);
|
if(recordType !='Society' && recordType !='BusinessTraining'){
|
// 新建意向URL
|
var urlStr = '/00Q/e?RecordType=01210000000QiRa&ent=Lead&name_lastlea2=' + encodeURI(username) +
|
'&CF00N10000006ps6f=' + encodeURI(username) +
|
'&CF00N10000006ps6f_lkid=' + userid +
|
'&lea3=' + encodeURI(acc) +
|
'&CF00N10000002CvC5=' + encodeURI(acc) +
|
'&CF00N10000002CvC5_lkid=' + accid +
|
'&lea20=' + encodeURI(campaign) +
|
'&lea20_lkid=' + campaignId +
|
'&CF00N10000004oN28=' + encodeURI(campaign) +
|
'&CF00N10000004oN28_lkid=' + campaignId +
|
// '&lea5=' + encodeURI('学会/沙龙') +
|
'&lea5=' + encodeURI('学会会议') +
|
'&CF00N10000006qNtt=' + encodeURI(contactSDCName);
|
}else{
|
//新建询问单 URL 客户姓名 科室 询问单来源 主要学会 公司 意向学会
|
var urlStr = '/a41/e?ent=Inquiry_form&name_lastlea2=' + encodeURI(username) +
|
'&CF00N1000000962n8=' + encodeURI(username) +
|
'&CF00N1000000962n8_lkid=' + userid +
|
'&00N1000000962n5=' + encodeURI(acc) +
|
'&CF00N1000000962nJ=' + encodeURI(acc) +
|
'&CF00N1000000962nJ_lkid=' + accid +
|
'&CF00N1000000962n3=' + encodeURI(campaign) +
|
'&CF00N1000000962n3_lkid=' + campaignId +
|
// '&00N1000000962nO=' + encodeURI('学会/沙龙') +
|
'&00N1000000962nO=' + encodeURI('学会会议') +
|
'&CF00N1000000962nC=' + encodeURI(records[0].Department_Class__r.Name)+
|
'&CF00N1000000962nC_lkid=' + encodeURI(records[0].Department_Class__c)+
|
'&Name='+encodeURI(username)+
|
'&00N1000000962nH='+encodeURI(family_name)+
|
'&00N1000000962nN='+encodeURI(last_name)+
|
'&00N1000000962nT='+ encodeURI('信息');
|
}
|
//JZ-20191009 通过学会·培训记录区分新建意向还是新建询问单 END
|
|
window.open(urlStr);
|
}
|
}
|
|
</script>
|
|
<apex:form id="allForm">
|
<apex:actionFunction name="saveLine" action="{!saveLine}" rerender="allForm,allPanel,allBlock" oncomplete="checkLine('1');">
|
</apex:actionFunction>
|
<apex:actionFunction name="addLine" action="{!addLine}" rerender="allForm,allPanel,allBlock,records" oncomplete="checkLine();">
|
</apex:actionFunction>
|
<apex:actionFunction name="deleteLine" action="{!deleteLine}" rerender="allForm,allPanel,allBlock,records" oncomplete="checkLine();">
|
<apex:param name="firstParam" assignTo="{!lineNo}" value="" />
|
</apex:actionFunction>
|
<apex:actionFunction name="checkLine" action="{!checkLine}" rerender="allForm,allPanel,allBlock,records" oncomplete="unblockUI();">
|
<apex:param name="firstParam" assignTo="{!saveflg}" value="" />
|
</apex:actionFunction>
|
<apex:outputPanel id="allPanel">
|
<apex:pageBlock id="allBlock">
|
<apex:pageBlockButtons location="top">
|
<apex:commandButton immediate="true" onclick="saveJs();" value="保存" rerender="dummy"/>
|
<apex:commandButton immediate="true" onclick="addJs();" value="添加行" rerender="dummy"/>
|
<apex:commandButton immediate="true" onclick="closeJs();" value="关闭" rerender="dummy"/>
|
</apex:pageBlockButtons>
|
|
<apex:outputPanel id="message">
|
<apex:pageMessages />
|
</apex:outputPanel>
|
|
<input type="hidden" id="campaignName" value="{!campaignName}"/>
|
<input type="hidden" id="campaignId" value="{!campaignId}"/>
|
<input type="hidden" id="hasError" value="{!hasError}"/>
|
<input type="hidden" id="userState" value="{!localuser.State_Hospital__c}"/>
|
|
<table class="linetable" border="1" style="border-collapse: collapse;width:850px;table-layout:fixed;">
|
<colgroup>
|
<col width="40px"/>
|
<col width="300px"/>
|
<col width="150px"/>
|
<!-- SWAG-B9J9YR 2-19-02-19 start -->
|
|
<apex:variable value="Training_event" var="Training_event" rendered="{!IF(cam.recordType.developerName == 'Training_event', false, true)}">
|
<!--JZ-20191120 学会会议和营业部会议 隐藏询价字段 START -->
|
<apex:variable value="Society" var="Society" rendered="{!IF(cam.recordType.developerName == 'Society' || cam.recordType.developerName == 'BusinessTraining',false,true)}">
|
<col width="150px" />
|
</apex:variable>
|
<!--JZ-20191120 学会会议和营业部会议 隐藏询价字段 END -->
|
<col width="60px"/>
|
</apex:variable>
|
<!-- SWAG-B9J9YR 2-19-02-19 end -->
|
<col width="100px"/>
|
<col width="50px"/>
|
</colgroup>
|
<tr style="background-color:#DCDCDC;">
|
<th style="text-align:center">No.</th>
|
<!-- <th style="text-align:center">{!$ObjectType.CampaignMember__c.fields.Department__c.label}</th> -->
|
<!-- SWAG-BLPDK7 update by vivek 2020-02-12 start -->
|
<th style="text-align:center">
|
<!-- {!$ObjectType.CampaignMember__c.fields.Department__c.label} -->
|
医院科室/经销商
|
</th>
|
<!-- SWAG-BLPDK7 update by vivek 2020-02-12 end -->
|
<th style="text-align:center">{!$ObjectType.CampaignMember__c.fields.Contact__c.label}</th>
|
<!-- SWAG-B9J9YR 2-19-02-19 start -->
|
<apex:variable value="Training_event" var="Training_event" rendered="{!IF(cam.recordType.developerName == 'Training_event', false, true)}">
|
<!--JZ-20191120 学会会议和营业部会议 隐藏询价字段 START -->
|
<apex:variable value="Society" var="Society" rendered="{!IF(cam.recordType.developerName == 'Society' || cam.recordType.developerName == 'BusinessTraining',false,true)}">
|
<th style="text-align:center">{!$ObjectType.CampaignMember__c.fields.Opportunity__c.label}</th>
|
</apex:variable>
|
<apex:variable value="Society" var="Society" rendered="{!IF(cam.recordType.developerName == 'Society' || cam.recordType.developerName == 'BusinessTraining',true,false)}">
|
<th style="text-align:center">询问单</th>
|
</apex:variable>
|
<apex:variable value="Society" var="Society" rendered="{!IF(cam.recordType.developerName == 'Society' || cam.recordType.developerName == 'BusinessTraining',false,true)}">
|
<th style="text-align:center">新建意向</th>
|
</apex:variable>
|
<!--JZ-20191120 学会会议和营业部会议 隐藏询价字段 END -->
|
</apex:variable>
|
<!-- SWAG-B9J9YR 2-19-02-19 end -->
|
<th style="text-align:center">{!$ObjectType.CampaignMember__c.fields.Type__c.label}</th>
|
<th style="text-align:center">操作</th>
|
</tr>
|
</table>
|
<div style="width:875px;height:260px;overflow:auto;">
|
<table id="linetable" class="linetable" border="1" style="border-collapse: collapse;width:850px;table-layout:fixed;">
|
<colgroup>
|
<col width="40px"/>
|
<col width="300px"/>
|
<col width="150px"/>
|
<!-- SWAG-B9J9YR 2-19-02-19 start -->
|
<apex:variable value="Training_event" var="Training_event" rendered="{!IF(cam.recordType.developerName == 'Training_event', false, true)}">
|
<!--JZ-20191120 学会会议和营业部会议 隐藏询价字段 START -->
|
<apex:variable value="Society" var="Society" rendered="{!IF(cam.recordType.developerName == 'Society' || cam.recordType.developerName == 'BusinessTraining',false,true)}">
|
<col width="150px" />
|
</apex:variable>
|
<!--JZ-20191120 学会会议和营业部会议 隐藏询价字段 END -->
|
<col width="60px"/>
|
</apex:variable>
|
<!-- SWAG-B9J9YR 2-19-02-19 end -->
|
<col width="100px"/>
|
<col width="50px"/>
|
</colgroup>
|
<apex:repeat value="{!lineInfoList}" var="lineInfo" id="records">
|
<tr>
|
<td align="center">
|
<apex:outputText id="line" value="{!lineInfo.line}"></apex:outputText>
|
</td>
|
<td align="center">
|
<apex:inputField id="department" value="{!lineInfo.cm.Department__c}" onblur="vpClear2_delay({!lineInfo.line - 1});" onfocus="setVisitorPlace({!lineInfo.line - 1});" style="width:95%;"></apex:inputField>
|
<apex:inputHidden id="departmentId" value="{!lineInfo.cm.Department_ID__c}" />
|
<apex:inputHidden id="departmentHidden" value="{!lineInfo.cm.Department__c}" />
|
<apex:inputHidden id="departmentHiddenId" value="{!lineInfo.cm.Department_ID__c}" />
|
</td>
|
<td align="center">
|
<apex:inputField styleClass="contact" html-awsid="{!lineInfo.cm.Contact_ID__r.AWS_Data_Id__c}" id="contact" value="{!lineInfo.cm.Contact__c}" onclick="openSearchContact({!lineInfo.line})" style="width: 95%"></apex:inputField>
|
<apex:inputHidden id="contactId" value="{!lineInfo.cm.Contact_ID__c}"></apex:inputHidden>
|
<apex:inputHidden id="contactSDCName" value="{!lineInfo.cm.Contact_ID__r.Strategic_dept_Class__r.Name}"></apex:inputHidden>
|
</td>
|
<!-- SWAG-B9J9YR 2-19-02-19 start -->
|
<apex:variable value="Training_event" var="Training_event" rendered="{!IF(cam.recordType.developerName == 'Training_event', false, true)}">
|
<!--JZ-20191120 学会会议和营业部会议 隐藏询价字段 START -->
|
<apex:variable value="Society" var="Society" rendered="{!IF(cam.recordType.developerName == 'Society' || cam.recordType.developerName == 'BusinessTraining',false,true)}">
|
<td align="center">
|
<apex:inputField id="opportunity" value="{!lineInfo.cm.Opportunity__c}" onfocus="setRelOppId({!lineInfo.line - 1},'opportunity','opportunityId');" onchange="resetValue('allPage:allForm:allBlock:records:{!lineInfo.line - 1}:opportunity');" style="width:95%;"></apex:inputField>
|
<apex:inputHidden id="opportunityId" value="{!lineInfo.cm.Opportunity_ID__c}" />
|
<apex:inputHidden id="opportunityHidden" value="{!lineInfo.cm.Opportunity__c}" />
|
<apex:inputHidden id="opportunityHiddenId" value="{!lineInfo.cm.Opportunity_ID__c}" />
|
</td>
|
</apex:variable>
|
<td align="center">
|
<input style="width:90%;" type="button" value="新建" onclick="openCreateLead({!lineInfo.line});"/>
|
</td>
|
</apex:variable>
|
<!-- SWAG-B9J9YR 2-19-02-19 end -->
|
<td align="center">
|
<apex:inputField id="type" value="{!lineInfo.cm.Type__c}"></apex:inputField>
|
</td>
|
<td align="center">
|
<input style="width:90%;" type="button" value="删除" onclick="deleteJs({!lineInfo.line})"/>
|
</td>
|
</tr>
|
</apex:repeat>
|
</table>
|
</div>
|
</apex:pageBlock>
|
</apex:outputPanel>
|
</apex:form>
|
</apex:page>
|