李金换
2023-04-21 cc7487a59bd4b0fa5bed1dd59f6d0565ace81b8b
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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
<!-- <apex:page action="{!init}" controller="SubmitForApprovalController" id="allPage" showheader="false" sidebar="true" title="提交申请"> standardcontroller="Maintenance_Contract__c"  -->
    <apex:page standardcontroller="Lost_Report__c"  extensions="SubmitForApprovalController" id="allPage" action="{!init}" showHeader="false" sidebar="false" title="提交申请">
    <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}">
    </apex:stylesheet>
    <apex:includescript value="{!URLFOR($Resource.jquery183minjs)}">
    </apex:includescript>
    <apex:includescript value="{!URLFOR($Resource.PleaseWaitDialog)}">
    </apex:includescript>
    <script type="text/javascript">
    window.onload = function() {
        toWhere();
 
        specificReasons();
 
        grey();
 
    }
 
    function initkin() {
        toWhere();
        specificReasons();
        grey();
    }
    
    function disToWhere(){
        j$(escapeVfId('allPage:sada:To_Where')).attr("disabled", true);
    }
 
    function specificReasons() {
 
        var specificReasonsVal = j$(escapeVfId("allPage:sada:Specific_Reasons")).val();
 
        if (specificReasonsVal == '其他(手写)') {
 
            document.getElementById("font2").style.display = "block";;
 
            document.getElementById("allPage:sada:Other_Reasons").style.display = "block";
 
        } else {
 
            document.getElementById("font2").style.display = "none";
 
            document.getElementById("allPage:sada:Other_Reasons").style.display = "none";
        }
        if (specificReasonsVal == '转第三方或维修托管') {
            
            tochange();
            document.getElementById("font5").style.display = "block";
 
            document.getElementById("allPage:sada:Third_Party_Company").style.display = "block";
 
            document.getElementById("font6").style.display = "block";
 
            document.getElementById("allPage:sada:Third_Party_Contract_Price").style.display = "block";
 
        } else {
            j$(escapeVfId('allPage:sada:To_Where')).attr("disabled", false);
             document.getElementById("font5").style.display = "none";
 
            document.getElementById("allPage:sada:Third_Party_Company").style.display = "none";
 
            document.getElementById("font6").style.display = "none";
 
            document.getElementById("allPage:sada:Third_Party_Contract_Price").style.display = "none";
        }
        if (specificReasonsVal == '重复报价') {
            document.getElementById("font7").style.display = "block";
            document.getElementById("MC_Code__c").style.display = "block";
            document.getElementById("font3").style.display = "none";
            document.getElementById("To_Where__c").style.display = "none";
        } else {
            
            document.getElementById("font7").style.display = "none";
            document.getElementById("MC_Code__c").style.display = "none";
            document.getElementById("font3").style.display = "block";
            document.getElementById("To_Where__c").style.display = "block";
        }
    }
 
    function toWhere() {
 
        var toWhereVal = j$(escapeVfId("allPage:sada:To_Where")).val();
 
        if (toWhereVal == '其他(手写)') {
 
            document.getElementById("font4").style.display = "block";
 
            document.getElementById("allPage:sada:Other").style.display = "block";
 
        } else {
 
            document.getElementById("font4").style.display = "none";
 
            document.getElementById("allPage:sada:Other").style.display = "none";
        }
 
 
        if (toWhereVal == '医院选择第三方') {
 
            document.getElementById("font5").style.display = "block";
 
            document.getElementById("allPage:sada:Third_Party_Company").style.display = "block";
 
            document.getElementById("font6").style.display = "block";
 
            document.getElementById("allPage:sada:Third_Party_Contract_Price").style.display = "block";
 
        } else {
 
            document.getElementById("font5").style.display = "none";
 
            document.getElementById("allPage:sada:Third_Party_Company").style.display = "none";
 
            document.getElementById("font6").style.display = "none";
 
            document.getElementById("allPage:sada:Third_Party_Contract_Price").style.display = "none";
 
        }
    }
 
    function grey() {
 
        var status = j$(escapeVfId("allPage:sada:Status")).val();
 
        if (status == '批准' || status == '审批中') {
 
            j$(escapeVfId('allPage:sada:Specific_Reasons')).attr("disabled", true);
 
            j$(escapeVfId('allPage:sada:Other_Reasons')).attr("disabled", true);
 
            j$(escapeVfId('allPage:sada:To_Where')).attr("disabled", true);
 
            j$(escapeVfId('allPage:sada:Other')).attr("disabled", true);
 
            j$(escapeVfId('allPage:sada:Third_Party_Company')).attr("disabled", true);
 
            j$(escapeVfId('allPage:sada:Third_Party_Contract_Price')).attr("disabled", true);
 
        } else {
 
            j$(escapeVfId('allPage:sada:Specific_Reasons')).attr("disabled", false);
 
            j$(escapeVfId('allPage:sada:Other_Reasons')).attr("disabled", false);
 
            j$(escapeVfId('allPage:sada:To_Where')).attr("disabled", false);
 
            j$(escapeVfId('allPage:sada:Other')).attr("disabled", false);
 
            j$(escapeVfId('allPage:sada:Third_Party_Company')).attr("disabled", false);
 
            j$(escapeVfId('allPage:sada:Third_Party_Contract_Price')).attr("disabled", false);
 
        }
    }
 
    function reload() {
        var disableInput = j$(escapeVfId('flag')).value();
        console.log(disableInput);
        if (disableInput == "true") {
            window.opener.location.href = "/" + "{!mcId}";
            // DealerInquiryModifyState
            window.close();
 
        }
 
    }
 
    function saveBatch() {
        blockme();
        save();
    }
 
    
    function submitBatch() {
        blockme();
        submit();
    }
 
    function setChangeFlgRight() {
        var tpcp = j$(escapeVfId('allPage:sada:Third_Party_Contract_Price')).value();
        if (isNaN(tpcp) == true) {
            alert('请输入数字!');
            return false;
        }
    }
    </script>
    <style type="text/css">
    #bluebuttoncss input {
        width: 100px;
        height: 30px;
        font-family: "tahoma", "宋体";
    }
    </style>
    <apex:form id="sada">
        <apex:actionfunction action="{!init}" name="init" oncomplete="unblockUI();" rerender="oppBlock1,message">
        </apex:actionfunction>
        <apex:actionfunction action="{!tochange}" name="tochange" oncomplete="unblockUI();disToWhere();" rerender="To_Where">
        </apex:actionfunction>
        <apex:actionfunction action="{!save}" name="save" oncomplete="unblockUI();reload();initkin();" rerender="oppBlock1,sada,message">
        </apex:actionfunction>
        <apex:actionfunction action="{!submit}" name="submit" oncomplete="unblockUI();reload();initkin();" rerender="oppBlock1,message,sada,ApprovalHistory">
        </apex:actionfunction>
       <!--  <apex:outputpanel id="message">
            <apex:PageMessages />
        </apex:outputpanel> -->
        <input type="hidden" id="flag" value="{!flag}" />
        <input type="hidden" id="sa" value="{!mcId}"/>
        <table id="oppBlock1" style="width:100%;height:200%;">
            <tr>
                <td style="padding-left:50px;padding-top:10px; ">
                    <font id="font1" style="font-size:small">
                        具体原因:
                    </font>
                </td>
            </tr>
            <tr>
                <td style="padding-left:50px">
                    <apex:inputfield id="Specific_Reasons" onchange="specificReasons();return false;" style="width:90%;outline-color:#1A94E6;" value="{!lostData.Specific_Reasons__c}" required="true">
                    </apex:inputfield>
                </td>
            </tr>
            <tr>
                <td style="padding-left:50px">
                    <font id="font2" style="font-size:small;display:none;">
                        其他原因(手写):
                    </font>
                </td>
            </tr>
            <tr>
                <td style="padding-left:50px">
                    <apex:inputfield id="Other_Reasons" style="width:88.5%;display:none;" value="{!lostData.Other_Reasons__c}">
                    </apex:inputfield>
                </td>
            </tr>
            <tr>
                <td style="padding-left:50px">
                    <font id="font7" style="font-size:small;display:none;">
                        手动关联报价编码:
                    </font>
                </td>    
            </tr>
            <tr>
                <td style="padding-left:50px ;">
                    <div id = "MC_Code__c"  style="width:90%;display:none"><apex:inputField value="{!lostData.MC_Code__c}" style="width:90%;"/></div>
                </td>
            </tr>
            <tr>
                <td style="padding-left:50px">
                    <font id="font3" style="font-size:small">
                        去向:
                    </font>
                </td>
            </tr>
             <!--  <tr>
                <td style="padding-left:50px">
                    <div id = "To_Three"  style="width:90%;display:none">
                        <input id = "To_Three1" style="width:90%;outline:none" value="医院选择第三方" readonly="readonly" />
                    </div>
                </td>
            </tr> -->
            <tr>
                <td style="padding-left:50px">
                    <div id = "To_Where__c"  style="width:90%;display:block;"><apex:inputfield id="To_Where" onchange="toWhere();" required="true" style="width:90%;outline-color:#1A94E6;display:block;" value="{!lostData.To_Where__c}">
                    </apex:inputfield></div>
                </td>
            </tr>
            <tr>
                <td style="padding-left:50px">
                    <font id="font4" style="font-size:small;display:none;">
                        其他(手写):
                    </font>
                </td>
            </tr>
            <tr>
                <td style="padding-left:50px">
                    <apex:inputfield id="Other" style="width:88.5%;display:none;outline-color:#1A94E6;" value="{!lostData.Other__c}">
                    </apex:inputfield>
                </td>
            </tr>
            <tr>
                <td style="padding-left:50px">
                    <font id="font5" style="font-size:small;display:none;">
                        第三方公司:
                    </font>
                </td>
            </tr>
            <tr>
                <td style="padding-left:50px">
                    <apex:inputfield id="Third_Party_Company" style="width:88.5%;display:none;outline-color:#1A94E6;" value="{!lostData.Third_Party_Company__c}">
                    </apex:inputfield>
                </td>
            </tr>
            <tr>
                <td style="padding-left:50px">
                    <!--;padding-top:50px-->
                    <font id="font6" style="font-size:small;display:none;">
                        第三成约价格:
                    </font>
                </td>
            </tr>
            <tr>
                <td style="padding-left:50px">
                    <apex:inputfield id="Third_Party_Contract_Price" style="width:88.5%;outline-color:#1A94E6;display:none;" value="{!lostData.Third_Party_Contract_Price__c}">
                    </apex:inputfield>
                </td>
            </tr>
            <tr>
                <td style="padding-left:50px">
                    <apex:inputfield id="Status" style="width:90%;border-radius: 3px 3px 3px 3px; height:110%;display:none;" value="{!lostData.Status__c}">
                    </apex:inputfield>
                </td>
            </tr>
            <td style="padding-left:50px" id="bluebuttoncss">
                <center>
                   <!--  <apex:commandButton onclick="saveBatch();return false;" disabled="{!IF(lostData.Status__c='审批中'||lostData.Status__c='批准',true,false)}" rendered="true" rerender="oppBlock1,message" value="保存">
                    </apex:commandButton> -->
                  
                    &nbsp;&nbsp;&nbsp;&nbsp;
                    <apex:commandbutton onclick="submitBatch();return false;" disabled="{!IF(lostData.Status__c='审批中'||lostData.Status__c='批准',true,false)}" rerender="oppBlock1,message" rendered="true" value="提交审核">
                    </apex:commandbutton>
                </center>
            </td>
        </table>
    </apex:form>
    <!-- 显示审批过程用 -->
     <apex:outputPanel id="ApprovalHistory" rendered="{!canseePage}">
        <apex:relatedList list="ProcessSteps"/>
    </apex:outputPanel>
</apex:page>