liuyn
2024-03-11 a87f1c3df03078814ee97ad0c8ac200a232419e9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<apex:page standardController="Opportunity" extensions="SI_Opportunity_ResponseController" showHeader="false" sidebar="false" action="{!init}" id="allPage" lightningStylesheets="true" >
<apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
<apex:stylesheet value="{!URLFOR($Resource.StyleUtilCss)}"/>
<apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
<apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
<apex:includeScript value="{!URLFOR($Resource.SelectFieldJs)}"/>
    <style type="text/css">
        .hideDropdown select{
            display:none
        }
    </style>
<script type="text/javascript">
    function SendToSIJs() {
        // body...
        window.open('/apex/SI_Opportunity_Response?showFlg=false&mailType=SI&id={!Opportunity.id}','SI部门送信','height=400,width=700,top=0,left=0,toolbar=no,menubar=no,scrollbars=no, resizable=no,location=no, status=no');
    }
    function SendToApplyJs() {
        // body...
        window.open('/apex/SI_Opportunity_Response?showFlg=false&mailType=apply&id={!Opportunity.id}','申请者送信','height=400,width=700,top=0,left=0,toolbar=no,menubar=no,scrollbars=no, resizable=no,location=no, status=no');
    }
    function ConfirmJs() {
        // body...
        //blockme();
        sendMail();
    }
    function CancelJs() {
        // body...
        window.close();
    }
    function AddCcjs() {
            // body...
            var oldStr = j$(escapeVfId('allPage:allForm:ResponseBlock:Cc')).val();
            var AddElem = (oldStr==''?'':',') + j$(escapeVfId('allPage:allForm:ResponseBlock:Mail_Tar_Selector__c')).val();
 
            var oldStrID = j$(escapeVfId('allPage:allForm:ResponseBlock:Ccid')).val();
            var AddElemID = (oldStrID==''?'':',') + (j$(escapeVfId('allPage:allForm:ResponseBlock:Mail_Tar_Selector__c_lkid')).val()=={!$Label.Agency_ID_c}?'':j$(escapeVfId('allPage:allForm:ResponseBlock:Mail_Tar_Selector__c_lkid')).val());
            oldStr = oldStr + (AddElem==','?'':AddElem);
            oldStrID = oldStrID + (AddElemID==','?'':AddElemID);
            j$(escapeVfId('allPage:allForm:ResponseBlock:Cc')).val(oldStr);
            j$(escapeVfId('allPage:allForm:ResponseBlock:Ccid')).val(oldStrID);
            j$(escapeVfId('allPage:allForm:ResponseBlock:Mail_Tar_Selector__c')).val(null);
            // 以输入的信息置空
 
        }
    function reloadJs(){
        initJs();
    }
    function refreshPage(){
 
        var resStatus = j$(escapeVfId('allPage:allForm:ResponseBlock:mailStatus')).val();
        if(resStatus =='Fin'){
            setTimeout( alert('发送完成'),5000 );
            top.window.opener.reloadJs();
            top.window.close();
        }
    }
</script>
    <apex:form id="allForm">
    <apex:actionFunction action="{!sendMail}" name="sendMail"/>
    <apex:actionFunction action="{!init}" name="initJs"  />
        <apex:pageBlock id="allBlock" rendered="{!IF(isShowFlg=='true',true,false)}">
        
            <apex:pageBlockButtons location="top" style="display:flex">
                <apex:commandButton title="SI部门" value="TO:SP-SI" onclick="SendToSIJs()" />
                <apex:commandButton title="申请者" value="TO:营业本部" onclick="SendToApplyJs()" />
            </apex:pageBlockButtons>
            <apex:inputField id="response"  value="{!oppEle.response__c}"  style="width:100%; height:330px; resize:none;"/>
            <script>
                    j$(escapeVfId('allPage:allForm:allBlock:response')).attr('readonly', true);
            </script>
        </apex:pageBlock>
        <apex:pageBlock rendered="{!IF(isShowFlg=='true',false,true)}" id="ResponseBlock">
        <apex:outputPanel id="message">
            <apex:pageMessages />
        </apex:outputPanel>
        <apex:inputHidden id="mailStatus" value="{!mailStatus}"/>
            <apex:pageBlockButtons location="top"  style="padding-left: 17px; display: flex;">
                <div style="padding-right: 8px;">
                    <apex:commandButton onclick="ConfirmJs(); " value="发送" rerender="allForm,ResponseBlock,message,mailStatus" oncomplete="refreshPage();" />
                </div>
                <apex:commandButton onclick="CancelJs(); " value="取消" rerender="dummy" oncomplete="CancelJs();"/>
            </apex:pageBlockButtons>
            <apex:inputField value="{!oppEle.Mail_Tar_Selector__c}" id="Mail_Tar_Selector__c" style="padding-left: 17px;padding-bottom: 5px;" styleClass="hideDropdown"/>
            <div style="width: 200px;padding-left:17px;">
                <apex:commandButton onclick="AddCcjs(); return false;" value="追加Cc" style="width: 80px;" rerender="dummy"/>
            </div>
            <div style="width: 80%;padding-top: 5px;">
                  Cc:<apex:inputText value="{!Cc}" id="Cc" style="width: 80%;"/>
            </div>
            <apex:inputHidden value="{!Ccid}" id="Ccid" />
            <apex:inputHidden value="{!MailTarget}" id="MailTarget" />
            <div style="width:100%; height:120px; resize:none;padding-left: 17px;padding-top: 5px;">
                <apex:inputTextarea id="response" value="{!MailDetail}" style="width:100%; height:120px; resize:none;padding-left: 8px;padding-top: 5px;"/>
            </div>
        </apex:pageBlock>
    </apex:form>
    
        <script>
        //标准控件弹出页面修改 start
 
        //查询参数列表
        let SelectFieldParamList=[
            // 
            {
                //原apex:inputField的id值,需要在页面上获取
                inputFieldId : 'allPage:allForm:ResponseBlock:Mail_Tar_Selector__c',
                //查找字段所在对象
                ObjectType : 'Opportunity',
                //查找字段的api名称
                QueryFieldApiName : 'Mail_Tar_Selector__c',
                //查找字段的查找对象
                SelectObj : 'User',
                //搜索时使用的字段
                SelectFld : 'Name',
            },
        ]
        //初始化
        resetOpenPage(SelectFieldParamList);
        //标准控件弹出页面修改 end
 
    </script>
</apex:page>