高章伟
2022-03-18 4bfe21c4b5ddc089ae5a95f4b10f6cff148b690d
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
<apex:page controller="ChangeDealerApprovalController" 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:includeScript value="/soap/ajax/29.0/connection.js"/>
    <apex:includeScript value="/soap/ajax/29.0/apex.js"/>
 
    <script type="text/javascript">
        window.onload = function initCheckValue() {
            resetDealer();
        }
 
        function resetDealer() {
            var target = j$(escapeVfId('allPage:allForm:changedInput:estimateTarget')).val();
            var obj = document.getElementById('allPage:allForm:changedInput:changedDealer');
            var obj_lkwgt = document.getElementById('allPage:allForm:changedInput:changedDealer_lkwgt');
            var lbObj = document.getElementById('changedLabel');
            if (target == '医院') {
                obj.style.display = "none";
                obj_lkwgt.style.display = "none";
                lbObj.style.display = "none";
            } else {
                obj.style.display = "block";
                obj_lkwgt.style.display = "block";
                lbObj.style.display = "block";
            }
        }
 
        function requiredCheck() {
            var target = j$(escapeVfId('allPage:allForm:changedInput:estimateTarget')).val();
            var etTarget = j$(escapeVfId('allPage:allForm:etTarget')).val();
            var dealer = j$(escapeVfId('allPage:allForm:dealer')).val();
            if (target != '医院') {
                var obj = j$(escapeVfId('allPage:allForm:changedInput:changedDealer')).val();
                if (obj == null || obj == '') {
                    alert('请输入变更后经销商名');
                    return false;
                }
                if (etTarget == target && obj == dealer) {
                    alert('报价提交对象没有变更!');
                    return false;
                }
            } else {
                if (etTarget == '医院') {
                    alert('报价提交对象没有变更!');
                    return false;
                }
            }
            if (confirm('一旦提交此记录,您将不能再编辑或调回,请确认是否继续?')) {
                submitApproval();
            } else {
                return false;
            }
        }
 
        function closedWin(isClosed) {
            
            if (isClosed == 1) {
                if (!confirm("请确认是否取消修改?")) {
                    return false;
                }
                window.opener.closeWin(1);
            } else {
                var errMsg = '{!submitErrorMsg}';
                if (errMsg == 'false') {
                    if (!confirm("已经提交待审批,是否关闭?")) {
                        return false;
                    }
                    window.opener.closeWin(2);
                } else {
                    return false;
                }
            }
        }
    </script>
 
    <apex:form id="allForm">
        <apex:inputHidden id="etTarget" value="{!estimate.Estimate_Target__c}"/>
        <apex:inputHidden id="dealer" value="{!estimate.Dealer__c}"/>
        <apex:actionFunction name="submitApproval" action="{!submitApproval}" rerender="allForm" oncomplete="closedWin();"/>
        <apex:pageBlock id="changedInput" title="" mode="edit" >
            <apex:pageMessages id="submitErrorMsg"/>
            <apex:pageBlockButtons >
                <!-- 取引の開始 -->
                <apex:commandButton value="提交待审批" onclick="requiredCheck(); return false;" disabled="{!ApprovalButDisabled}"/>
                <!-- キャンセル -->
                <apex:commandButton value="取消" onclick="closedWin(1); return false;" />
            </apex:pageBlockButtons>
            <div class="pbSubheader first tertiaryPalette">
                <h3>报价提交对象变更</h3>
            </div>
            <table style="padding-top:10px" width="100%">
                <tr>
                    <td width="5%"></td>
                    <td width="15%" style="text-align: right;">
                        <label>报价提交对象</label>
                    </td>
                    <td width="80%" style="text-align: left;">
                        <apex:selectList value="{!estimate.Changed_Estimate_Target__c}" multiselect="false" size="1" id="estimateTarget" onchange="resetDealer()" style="margin-left:15px;">
                            <apex:selectOptions value="{!etSelectOptions}" ></apex:selectOptions>
                            <!-- <apex:actionSupport event="onchange" onsubmit="" onbeforedomupdate="" action="{!depChange}" rerender="idCon">
                                <apex:param name="sltD" value="{!sltDep}"/>
                            </apex:actionSupport> -->
                        </apex:selectList>
                    </td>
                </tr>
                <tr>
                    <td width="5%"></td>
                    <td width="15%" style="text-align: right;">
                        <div id="changedLabel">经销商名</div>
                    </td>
                    <td width="80%" style="text-align: left;">
                        <apex:inputField value="{!estimate.Changed_Dealer__c}" id="changedDealer" style="margin-left:15px;"/>
                    </td>
                </tr>
            </table>
        </apex:pageBlock>
    </apex:form>    
</apex:page>