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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
<apex:page controller="ChangeDealerApprovalController" showHeader="false" sidebar="false" id="allPage" action="{!init}" title="变更报价提交对象申请" lightningStylesheets="true">
    <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
    <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
    <apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
    <apex:includeScript value="{!URLFOR($Resource.connection20)}"/>
    <apex:includeScript value="{!URLFOR($Resource.apex20)}"/>
    <apex:includeScript value="{!URLFOR($Resource.SelectFieldJs)}"/>
    <style type="text/css">
    body .pbHeader .pbTitle{
      width: 30%;
      display: none;
 
    }
  body .pbHeader .pbButton, body .pbHeader .pbButtonb, .slds-vf-scope .pbHeader .pbButton, .slds-vf-scope .pbHeader .pbButtonb {
    text-align: center;
  }
    </style>
    <script type="text/javascript">
 
 
        window.onload = function initCheckValue() {
            resetDealer();
        }
         function unblockUI(){ 
 
            j$("#sbArea").fadeOut(500, function(){ 
 
                j$("#sbArea").remove(); 
 
            }); 
 
            resetOpenPage(SelectFieldParamList); 
 
        } 
        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;
                }
                console.log('etTarget='+etTarget);
                console.log('etTarget='+target);
                console.log('obj='+obj);
                console.log('dealer='+dealer);
                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.close();
                window.opener.closeWin(1);
            } else {
                var errMsg = '{!submitErrorMsg}';
                if (errMsg == 'false') {
                    if (!confirm("已经提交待审批,是否关闭?")) {
                        
                        return false;
                    }else{
                         window.close();
                    }
                    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__r.name}"/>
        <apex:inputHidden id="Changed_Dealer__c" value="{!estimate.Changed_Dealer__c}"/>
        <apex:actionFunction name="submitApproval" action="{!submitApproval}" rerender="allForm" oncomplete="closedWin(2);"/>
        <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 style="height: 40px;">
                    <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; width:220px;"/>
                    </td>
                </tr>
            </table>
        </apex:pageBlock>
    </apex:form>
    <script type="text/javascript">
        //查询参数列表
        let SelectFieldParamList=[
            //第一个输入框参数,eg:绑定的参数为{!estimate.Changed_Dealer__c}
            {
                //原apex:inputField的id值,需要在页面上获取
                inputFieldId : 'allPage:allForm:changedInput:changedDealer',
                //当前对象类型
                ObjectType : 'Maintenance_Contract_Estimate__c',
                //查询的当前对象的字段
                QueryFieldApiName : 'Changed_Dealer__c',
                //关联对象类型
                SelectObj : 'Account',
                //查询时匹对的字段
                SelectFld : 'Name',
                //当前输入框的值
                value : '{!estimate.Changed_Dealer__c}',
            },
 
        ]
        resetOpenPage(SelectFieldParamList);
    </script>
</apex:page>