高章伟
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
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="RentalApplySplitController" action="{!init}" showHeader="false" id="allPage">
    <head>
      <title>备品借出申请分单</title>
      <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
      <apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
      <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
    </head>
    <style type="text/css">
        .hideDropdown select{
            display: none
        }
        .modal {
           display:none;
           position: fixed; /* Stay in place */
           z-index: 10; /* Sit on top */
           left: 0;
           top: 0;
           width: 100%; /* Full width */
           height: 100%; /* Full height */
           overflow: auto; /* Enable scroll if needed */
           background-color: rgb(0,0,0); /* Fallback color */
           background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
        }
        span.dateFormat {
            display: none;
        }
 
        /* Modal Content/Box */
        .modal-content {
           background-color: #fefefe;
           margin-left: 6px;
           margin-top: 100px;
           padding: 20px;
           border: 1px solid #888;
           right: 5%;
           position: absolute;
           width: 200px;
        }
        .modal-content-cancel {
           background-color: #fefefe;
           margin-left: -150px;
           margin-top: 100px;
           padding: 20px;
           border: 1px solid #888;
           left: 50%;
           position: absolute;
           width: 300px;
        }
        /*table.list td{
            width:100px;
            border-width: 1px;
        }
        table.list td.col_chk {
            width:30px;
        }
        body .pbBody table.list tr.headerRow td, body .pbBody table.list tr.headerRow th {
            border-width: 1px;
        }*/
    </style>
    <apex:form id="allForm">
        <script type="text/javascript">
            function back() {
                window.opener.parent.location.href = "/{!ra.Id}";
                top.window.close();
            }
 
            function checkSaveStatus() {
                var saveStatus = document.getElementById('{!$Component.allForm.saveStatus}').value;
                if (saveStatus == 'ok') {
                    //20210609 ljh update 1732  start
                    var temp = '{!cloneRas.Id}';
                    console.log(temp);
                    if( temp == null || temp == '' ){
                        window.open("/{!ra.Id}");
                    }else{
                        window.open("/{!cloneRas.Id}");    
                    }
                    //20210609 ljh update 1732 end
                    top.window.close();
                }
            }
            //现地管理分单 202100609 ljh update 1732
            function changeSplitApplyReason(){
                var reason = j$(escapeVfId('allPage:allForm:searchBlock:split:split0:Split_Apply_Reason')).value();
                console.log(reason);
                var RecordTypeIsAgency = j$(escapeVfId('allPage:allForm:RecordTypeIsAgency')).value();
                if(reason != null && (reason == '现地管理分单' 
                    || (eval(RecordTypeIsAgency) && reason == '到货NG分单'))
                    ){
                    //办事处必须填写
                    j$(escapeVfId('allPage:allForm:searchBlock:split:ToAgency0:ToAgency')).attr('disabled',false);
                    j$(escapeVfId('allPage:allForm:searchBlock:split:ToAgency0:ToAgency')).attr('required',true);
                }else{
                    if(!(eval(RecordTypeIsAgency) && reason != null && reason == '到货NG分单')){
                        //办事处清空 只读
                        j$(escapeVfId('allPage:allForm:searchBlock:split:ToAgency0:ToAgency')).val(null);
                        j$(escapeVfId('allPage:allForm:searchBlock:split:ToAgency0:ToAgency')).attr('disabled',true);
                    } 
                }
            }
            function allSplitShow(){
                var allSplitShow = j$(escapeVfId('allPage:allForm:allSplitShow')).value();
                if(eval(allSplitShow)){
                    j$('#AllSplitModal').show();
                }
            }
        </script>
        <apex:pageMessages />
        <apex:inputHidden value="{!saveStatus}" id="saveStatus"/>
        <!-- 20210609 ljh add 1732  start-->
        <apex:inputHidden value="{!allSplitShow}" id="allSplitShow"/>
        <apex:inputHidden value="{!RecordTypeIsAgency}" id="RecordTypeIsAgency"/> 
        <div id="AllSplitModal" class="modal">
            <div class="modal-content-cancel">
                <table>
                    <tr>
                        <td colspan="2"> 
                        是否要整单分{!IF(SplitNum == 1,'回备品中心?',IF(SplitNum == 2,'给其他办事处?',IF(SplitNum == 3,'给办事处?','')))}                     
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" align="center">
                            <apex:commandButton style="margin: 0 20px;" value="确定"  action="{!saveSplitAll}" oncomplete="checkSaveStatus();unblockUI();" onclick="j$('#AllSplitModal').hide();blockme();" rerender="allForm"
                            />
                            <apex:commandButton style="margin: 0 20px;" value="取消" onclick="j$('#AllSplitModal').hide();return false;"/>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
        <!-- 20210609 ljh add 1732  end-->
        <apex:pageBlock id="searchBlock" tabStyle="Report">
            <apex:pageBlockSection title="备品借出申请分单" collapsible="false" id="split">
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="{!$ObjectType.Rental_Apply__c.fields.Name.label}" for="Name"/>
                    <apex:outputField value="{!ra.Name}" id="Name"/>
                </apex:pageBlockSectionItem>
                <!-- 20201119 ljh update start -->
                <apex:pageBlockSectionItem id="split0">
                    <apex:outputLabel value="{!$ObjectType.Rental_Apply__c.fields.Split_Apply_Reason__c.label}" for="Split_Apply_Reason"/>
                    <apex:inputField value="{!cloneRas.Split_Apply_Reason__c}" id="Split_Apply_Reason" required="true"  onchange="changeSplitApplyReason();"/>
                </apex:pageBlockSectionItem>
                <!-- 20201117 ljh add start --> 
                <apex:pageBlockSectionItem id="ToAgency0">
                    <apex:outputLabel value="{!$ObjectType.Rental_Apply__c.fields.ToAgency__c.label}" for="Name"/>
                    <apex:inputField value="{!cloneRas.ToAgency__c}" id="ToAgency"  />
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem html-style="display: none;">
                <apex:inputField value="{!cloneRas.SalesdeptSelect__c}" id="SalesdeptSelect" style="display: none;" />
              </apex:pageBlockSectionItem>
                <!-- 20201117 ljh add end -->
            </apex:pageBlockSection>
            
            <apex:dataTable value="{!raesList}" var="raes" id="raesLists" border="1" cellpadding="5">
              <apex:column >
                <apex:facet name="header">借出备品配套一览No.</apex:facet>
                <apex:outputText value="{!raes.Name}" />
              </apex:column>
              <apex:column >
                <apex:facet name="header">借出配套型号</apex:facet>
                <apex:outputText value="{!raes.Loaner_code_F__c}" />
              </apex:column>
              <apex:column >
                <apex:facet name="header">借出备品配套一览状态</apex:facet>
                <apex:outputText value="{!raes.RAES_Status__c}" />
              </apex:column>
            </apex:dataTable>
            <div style="height: 15px"></div>
            <apex:commandButton value="确认分单" action="{!saveSplit}" oncomplete="allSplitShow();checkSaveStatus();unblockUI();" onclick="blockme();" rerender="allForm" />
            <apex:commandButton value="返回" onclick="back(); return false;" rerender="allForm" oncomplete="unblockUI();" />
          </apex:pageBlock>
        </apex:form>
</apex:page>