buli
2022-04-26 5835379ec30b1667c4e522db9d294c9b7bb8633a
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
<apex:page controller="LoanerPortionReturnController" showHeader="true" 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)}"/>
<!-- Update PIPL 20220425 By Chen Yanan Start -->
<apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }" />
<apex:includeScript value="{!URLFOR($Resource.connection20)}"/>
<!-- Update PIPL 20220425 By Chen Yanan End -->
<style type="text/css"> td>div{display: inline-block;}</style>
<script>
    // Update PIPL 20220425 By Chen Yanan start
    AWSService.sfSessionId = '{!GETSESSIONID()}';
    var staticResource = JSON.parse('{!staticResource}');
    var aws_data = {};
 
    function Decrypt(r,dataIds,callback){
        if (!(dataIds && dataIds.length)) {
            if(callback)callback();
            return;
        }
 
        let Foo = function(){
            for (const id of dataIds) {
                if (aws_data.hasOwnProperty(id)) {
                    let d = aws_data[id];
                    let $e =j$("[aws-id='"+d.dataId+ "']");
                    $e.each((i,e)=>{
                        if (d[j$(e).attr("aws-api")] != '') {
                            j$(e).attr('value',d[j$(e).attr("aws-api")]);
                        }
                    })
                }
            }
            if(callback)callback();
        }
        let ids = [];
        for (const id of dataIds) {
            if (!aws_data.hasOwnProperty(id)) {
                ids.push(id);
            }
        }
        if (ids.length > 0) {
            
            AWSService.query(r.queryUrl,ids[0],function(data){    
                console.log('data: ' + JSON.stringify(data));
                if(data.object){
                    aws_data[data.object.dataId] = data.object;
                    Foo();
                }else{
                    if(callback)callback();
                }
            },r.token);
        }else{
            Foo();
        }
    }
 
    function DecryptAll(callback){
        let dataIds1 = [];
        j$('[aws-id][aws-obj="loaner_application__c"]').each((i,e)=>{
            let v = j$(e).attr('aws-id');
            if (v) {
                dataIds1.push(v);
            }
        });
        Decrypt(staticResource,dataIds1,callback);
    }
 
    j$(function(){
        DecryptAll();
        
    })
    // Update PIPL 20220425 By Chen Yanan end
function test1(){
      getIsOk();
}
function saveJs() {
  
 
    var okDate = j$(escapeVfId('isOk')).value();
    var loanerType = '{!loanerType}';
   
     if(loanerType == 'BS' && okDate == 'true'){
        alert('未装机确认,不能回寄样机。');
        return;
    }
   
    if(loanerType != 'BS' && okDate == 'true'){ 
        if(confirm('未装机确认,是否回寄?') == false){
            return;
         }
    }
    
    if(confirm('是否保存修改?')==true){
        blockme();
        saveBtn();
    }
}
function checkAll() {
    var productCount = j$(escapeVfId('linesize')).value();
    if (j$(escapeVfId('checkall')).attr('checked') == 'checked') {
        for (var i = 0; i < productCount; i++) {
            j$(escapeVfId('allPage:allForm:allBlock:lines:' + i + ':check')).attr('checked',true);
        }
    } else {
        for (var i = 0; i < productCount; i++) {
            j$(escapeVfId('allPage:allForm:allBlock:lines:' + i + ':check')).attr('checked',false);
        }
    }
}
</script>
 
    <apex:form id="allForm">
        <apex:actionFunction name="saveBtn" action="{!saveBtn}" rerender="allForm,message,allPanel" onComplete="unblockUI();"> </apex:actionFunction>
       <apex:actionFunction name="getIsOk" action="{!getIsOk}"  rerender="allForm,message,allPanel" onComplete="unblockUI();saveJs();"></apex:actionFunction>
 
        <apex:outputPanel id="message">
            <apex:messages />
        </apex:outputPanel>
 
        <input type="hidden" id='linesize' value="{!datalineSize}"/>
 
        <apex:outputPanel id="allPanel">
             <input type="hidden" id='isOk' value="{!isOk}"/>
            <apex:pageBlock id="allBlock">
               
                <table border="0" style="width: 800px;">
                    <tr>
                        <td colspan="3">
                            <label for="company">{!$ObjectType.loaner_application_detail__c.fields.Return_Track_Company__c.label}: </label><apex:inputField value="{!lac.Return_Track_Company__c}" id="company"></apex:inputField>
                        </td>
                    </tr>
                    <tr>
                        <td>    
                             <label for="number">{!$ObjectType.loaner_application_detail__c.fields.Return_Track_Number__c.label}: </label><apex:inputField value="{!lac.Return_Track_Number__c}" id="number"></apex:inputField>
                        </td>
                    </tr>
                    <tr>
                        <td>
                             <label for="user">{!$ObjectType.loaner_application_detail__c.fields.Return_Trake_Staff__c.label}: </label>
                             <!-- Update PIPL 20220425 By Chen Yanan Start -->
                            <!-- <apex:inputField value="{!lac.Return_Trake_Staff__c}" id="user"></apex:inputField> -->
                            <!-- PIPL 改造后 -->
                            <apex:inputField html-aws-obj="loaner_application__c" html-aws-api="returnTrakeStaff" html-aws-id="{!lac.AWS_Data_Id__c}" id="Return_Trake_Staff__c" value="{!lac.Return_Trake_Staff__c}"></apex:inputField>
                            <!-- Update PIPL 20220425 By Chen Yanan  -->
 
                        </td>
                        <td>
                             <apex:commandButton onclick="test1();" value="回寄" rerender="dummy" style="width: 70px;float: right;"/>  
                             <apex:commandButton action="{!cancelBtn}" value="返回" rerender="dummy" style="width: 70px;float: right;"/>
                            
                        </td>
                    </tr>
                    <apex:outputPanel layout="none" rendered="{!IF(la.Equipment_Type__c == 'NDT' || la.Equipment_Type__c == 'ANI', true , false)}">
                    <tr>
                        <td>    
                             <label for="return_Number__c">{!$ObjectType.loaner_application_detail__c.fields.return_Number__c.label}: </label><apex:inputField value="{!lac.return_Number__c}" id="return_Number__c"></apex:inputField>
                        </td>
                    </tr>
                    <tr>
                        <td>    
                             <label for="place">{!$ObjectType.loaner_application_detail__c.fields.loaner_manage_place__c.label}: </label><apex:inputField value="{!lac.loaner_manage_place__c}" id="place"></apex:inputField>
                        </td>
                    </tr>
                     </apex:outputPanel>
                </table>
                <br/>
                <br/>
                <table border="0" style="border-collapse: collapse;width:900px;table-layout:fixed;">
                    <colgroup>
                        <col width="25"/>
                        <col width="25"/>
                        <col width="150"/>
                        <col width="150"/>
                        <col width="150"/>
                        <col width="170"/>
                        <col width="170"/>
                        <col width="150"/>
                        <apex:outputPanel layout="none" rendered="{!IF(loanerType == 'BS', true , false)}">
                            <col width="150" />
                        </apex:outputPanel>
                        <col width="150"/>
                    </colgroup>
                    <tr>
                        <th style="text-align: center; border-bottom-style: ridge;"><input type="checkbox" id="checkall" onclick="checkAll();" /></th>
                        <th style="text-align: center; border-bottom-style: ridge;">No.</th>
                        <th style="text-align: center; border-bottom-style: ridge;">样机名称</th>
                        <th style="text-align: center; border-bottom-style: ridge;">{!$ObjectType.loaner_application_detail__c.fields.SerialNumber__c.label}</th>
                        <th style="text-align: center; border-bottom-style: ridge;">{!$ObjectType.loaner_application_detail__c.fields.Internal_Asset_number__c.label}</th>
                        <th style="text-align: center; border-bottom-style: ridge;">{!$ObjectType.loaner_application_detail__c.fields.OTCODE__c.label}</th>
                        <th style="text-align: center; border-bottom-style: ridge;">{!$ObjectType.loaner_application_detail__c.fields.ECCode__c.label}</th>
                        <th style="text-align: center; border-bottom-style: ridge;">
                        {!$ObjectType.loaner_application_detail__c.fields.RAESD_Status__c.label}</th>
                        <apex:outputPanel layout="none" rendered="{!IF(loanerType == 'BS', true , false)}">
                            <th style="text-align: center; border-bottom-style: ridge;">样机描述</th>
                        </apex:outputPanel>
                        <th style="text-align: center; border-bottom-style: ridge;">样机备注</th>
                    </tr>
                    <apex:variable value="{!1}" var="cnt" />
                    <apex:repeat value="{!dataLines}" var="line" id="lines">
                    <tr class="dataRow {!IF(MOD(cnt, 2)==0, 'odd', 'even')} {!IF(cnt==1, 'first', '')}" onmouseover="if (window.hiOn){hiOn(this);} " onmouseout="if (window.hiOff){hiOff(this);} " onblur="if (window.hiOff){hiOff(this);}" onfocus="if (window.hiOn){hiOn(this);}">
                        <td class="dataCell" style="text-align: center;">
                            <apex:inputCheckbox id="check" value="{!line.checkFlag}"/>
                        </td>
                        <td class="dataCell" style="text-align: center;">
                            <apex:outputText value="{!line.lineNo}"/>
                        </td>
                        <td class="dataCell" style="text-align: center;">
                            <apex:outputText value="{!line.lad.LOANER__r.Name}"/>
                        </td>
                        <td class="dataCell" style="text-align: center;">
                            <apex:outputText value="{!line.lad.SerialNumber__c}"/>
                        </td>
                        <td class="dataCell" style="text-align: center;">
                            <apex:outputText value="{!line.lad.Internal_Asset_number__c}"/>
                        </td>
                        <td class="dataCell" style="text-align: center;">
                            <apex:outputText value="{!line.lad.OTCODE__c}"/>
                        </td>
                        <td class="dataCell" style="text-align: center;">
                            <apex:outputText value="{!line.lad.ECCode__c}"/>
                        </td>
                        <td class="dataCell" style="text-align: center;">
                            <apex:outputField value="{!line.lad.RAESD_Status__c}"/>
                        </td>
                         <apex:outputPanel layout="none" rendered="{!IF(loanerType == 'BS', true , false)}">
                            <td class="dataCell" style="text-align: center;">
                                <apex:outputField value="{!line.lad.LOANER__r.Description}"/>
                            </td>
                        </apex:outputPanel>
                        <td class="dataCell" style="text-align: center;">
                            <apex:outputText value="{!line.lad.LOANER__r.Remarks2__c}"/>
                        </td>
                        <apex:variable value="{!cnt + 1}" var="cnt" />
                    </tr>
                    </apex:repeat>
                </table>
            </apex:pageBlock>
        </apex:outputPanel>
    </apex:form>
</apex:page>