高章伟
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
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
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
<apex:page standardController="Sample_order_list__c" extensions="OrdergoodsController" showheader="false" sidebar="false" action="{!init}" id="Page" title="样本订货">
    <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
    <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
    <apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
    <apex:includeScript value="{!URLFOR($Resource.apex20)}"/>
    <head>
        <script type="text/javascript">
            function checkAll() {
                var productCount = j$(escapeVfId('Page:mainForm:productInfoList:Size')).value();
                if (j$(escapeVfId('checkAll1')).attr('checked') == 'checked') {
                    for (var i = 0; i < productCount; i++) {
                        j$(escapeVfId('Page:mainForm:productInfoList:' + i + ':rowcheck')).attr('checked',true);
                    }
                } else {
                    for (var i = 0; i < productCount; i++) {
                        j$(escapeVfId('Page:mainForm:productInfoList:' + i + ':rowcheck')).attr('checked',false);
                    }
                }
            }
 
            // 保存按钮
            function SaveJs() {
                blockme();
                save();
            }
 
            //提示发送订单 thh 
            function openAddMultipleRow(){
                if (confirm('确认发送样本订货单?')) {
                    blockme();
                    confirmBtn();
                }
            }
            //2021/11/05 fxk 计算总量 Star
            function AllChecktime(lineno){
                var shuliang = j$(escapeVfId('Page:mainForm:productInfoList:'+(lineno-1)+':Number')).value();
                //数量大于1000的要做去掉逗号的全局操作,否则Number会被识别NaN非数字, /,/g标识全局的逗号
                shuliang = shuliang.replace(/,/g, "");
                var guige = j$(escapeVfId('Page:mainForm:productInfoList:'+(lineno-1)+':Packing_list_manual')).value();
                if(shuliang == null || shuliang == ""){
                    j$(escapeVfId('Page:mainForm:productInfoList:'+(lineno-1)+':Total')).html((null));
                    j$(escapeVfId('Page:mainForm:productInfoList:'+(lineno-1)+':Total')).attr('value',null);
                }else{
                    j$(escapeVfId('Page:mainForm:productInfoList:'+(lineno-1)+':Total')).html((shuliang*guige));
                    j$(escapeVfId('Page:mainForm:productInfoList:'+(lineno-1)+':Total')).attr('value',(shuliang*guige));
                }
            }
            //2021/11/05 fxk 计算总量 end
 
            //保存或者发送订货报错之后,计算总量 thh 2021-12-20 start
            function SaveAllChecktime(){
                var productCount = j$(escapeVfId('Page:mainForm:productInfoList:Size')).value();
                for(var lineno = 0; lineno < productCount; lineno++){
                    var shuliang = j$(escapeVfId('Page:mainForm:productInfoList:'+lineno+':Number')).value();
                    //数量大于1000的要做去掉逗号的全局操作,否则Number会被识别NaN非数字, /,/g标识全局的逗号
                    shuliang = shuliang.replace(/,/g, "");
                    var guige = j$(escapeVfId('Page:mainForm:productInfoList:'+lineno+':Packing_list_manual')).value();
                    if(shuliang == null || shuliang == ""){
                        j$(escapeVfId('Page:mainForm:productInfoList:'+lineno+':Total')).html((null));
                        j$(escapeVfId('Page:mainForm:productInfoList:'+lineno+':Total')).attr('value',null);
                    }else{
                        j$(escapeVfId('Page:mainForm:productInfoList:'+lineno+':Total')).html((shuliang*guige));
                        j$(escapeVfId('Page:mainForm:productInfoList:'+lineno+':Total')).attr('value',(shuliang*guige));
                    }
                }
            }
            //保存或者发送订货报错之后,计算总量 thh 2021-12-20 end
            
            //add 当收货方为办事处时,收货方地址为办事处地址 2021/11/17 fxk
            function resetDealer() {
                // 收货方
                var ReceivePart = j$(escapeVfId('Page:mainForm:sampleReceivePart')).val();
                var AccAdress = '{!AccName.Address__c}';
                var AccPhone = '{!AccName.Phone}';
                if (ReceivePart == '办事处') {
                    j$(escapeVfId('Page:mainForm:Address')).val(AccAdress);
                    j$(escapeVfId('Page:mainForm:Phone')).val(AccPhone);
                }else {
                    j$(escapeVfId('Page:mainForm:Address')).val('');
                    j$(escapeVfId('Page:mainForm:Phone')).val('');
                    j$(escapeVfId('Page:mainForm:Contact')).val('');
                }
            }
 
            //文本框输入值,复选框自动打勾 thh 2021-12-15
            function ComputePrice(j) {
                var productCount = j$(escapeVfId('Page:mainForm:productInfoList:Size')).value();
                for(var i = 0; i < productCount; i++){
                    var samNumber = document.getElementById("Page:mainForm:productInfoList:"+ i +":Number").value;
                    var checklist = j$("input[name='Page:mainForm:productInfoList:"+ i +":rowcheck']");
                    if(samNumber != null && samNumber != 0 && samNumber != ''){
                        checklist[0].checked = true;
                    }else{
                        checklist[0].checked = false;
                    }
                }
            }
        </script>
        <!-- 样式 -->
        <style type="text/css">
            /*滚动框*/
            div#iframelike {
                color: #fff;
                height: 300px;
                width: 70px;
                overflow-x:auto;
                overflow-y:auto;
            }
            .pure-table {
                border-collapse: collapse; 
                border-spacing: 0; 
                empty-cells: show;
                border: 1px solid #cbcbcb;
                width: 100%;
            }
     
            .pure-table caption {
                color: #000;
                font: italic 85%/1 arial,sans-serif;
            /* padding: 1em 0;*/
                text-align: center;
            }
            
            .pure-table td,.pure-table th {
                border-left: 1px solid #cbcbcb;
                border-width: 0 0 0 1px;
                font-size: inherit;
                margin: 0;
                /*overflow: auto;*/
                padding: .5em 1em;
            }
            
            .pure-table thead {
                background-color: #c3bfbf;
                color: #000;
                text-align: center;
                vertical-align: bottom;
            }
            
            .pure-table td {
                background-color: transparent; 
            }
    
            .pure-table-horizontal th,.pure-table-horizontal td {
                border-width: 0 0 1px 0;
                border-bottom: 1px solid #cbcbcb;
            }
    
            .pure-table-horizontal tbody>tr:last-child>td {
                border-bottom-width: 0;
            }
            
            /* 这里不考虑浏览器的兼容性 */
            input[type="range"] {
                width: 100%;
                -webkit-appearance: none;
                height: 8px;
                border-radius: 4px;
                background: -webkit-linear-gradient(#ffa200, #ffa200) no-repeat white;
                background-size: 50% 100%; /* 因为周期默认value=0.50正好占50% */
            }
            /* -webkit-slider-thumb仅对谷歌浏览器有效 */
            input[type="range"]::-webkit-slider-thumb {
                -webkit-appearance: none;
                background-color: #aaa;
                width: 8px;
                height: 20px;
                border-radius: 4px;
                cursor: pointer;
            }
            input[type="range"]::-webkit-slider-thumb:hover {
                background: #666;
            }
            /* 左侧渐变色的写法,默认滑块在最左侧所以下面white为0% */
            #speed {
                background: linear-gradient(to right, #ffa200, white 0%, white);
                background-size: 100% 100%;
            }
 
            /*弹窗中的input样式*/
            .diaInput{
                font-size:10.5px;
                 /* 设置输入框中字体的大小 */
 
                height:20px; 
                /* 设置输入框的高度 */
 
                border-radius:4px; 
                /* 设置输入框的圆角的大小 */
 
                border:1px solid #c8cccf;
                /* 设置输入框边框的粗细和颜色 */
 
                color:#986655; 
                /* 设置输入框中文字的颜色 */
 
                outline:0; 
                /* 将输入框点击的时候出现的边框去掉 */
 
                text-align:left; 
                /* 设置输入框中文字的位置 */
 
                padding-left: 10px;
 
                display:block; 
                /* 将输入框设置为块级元素 */
 
                cursor: pointer;
 
                 box-shadow: 2px 2px 5px 1px #ccc;
            }
            .diaInput::-webkit-input-placeholder{
                 color: #986655;
                 font-size: 12px;
             }
             /*弹窗中的p标签样式*/
            .diap{
                font-family: "宋体",sans-serif;
                color: red;
                opacity: 1;
                font-weight:bold;
            }
        </style>
    </head>
    <apex:form id="mainForm">
        <h1 style ="font-size: 30px; margin-left: 45%;">样本订货</h1>
        <apex:actionFunction name="save" action="{!save}" rerender="message,mainForm,listsTable" onComplete="SaveAllChecktime();unblockUI();">
        </apex:actionFunction>
        <!-- 确认按钮 -->
        <apex:actionFunction name="confirmBtn" action="{!confirmBtn}" rerender="message,mainForm,listsTable" onComplete="SaveAllChecktime();unblockUI();">
        </apex:actionFunction>
        <apex:outputPanel id="listsTable">
            <!-- <apex:pageBlock id="block1"> -->
                <div style="width: 100%;text-align:center;margin:0 auto;">
                    <table id="datatable_header" class="pure-table pure-table-horizontal" border="1" style="border-collapse:collapse; table-layout:fixed;">
                        <!-- 统一设置列宽度 -->
                        <colgroup>
                            <col width="15%"/>
                        </colgroup>
                        <tr style="background-color:#f2f3f1;width:900px;">
                            <th style="text-align: left;">客户:</th>
                            <td style="text-align:left;">
                                <apex:outputLabel id="AccName" value="{!AccName.Name}" />
                            </td>
                            <th>
                                <td></td>
                            </th>
                        </tr>
                        <tr style="background-color:#f2f3f1;width:900px;">
                            <th style="text-align: left;">收货方:</th>
                            <td style="text-align:left;">
 
                                <apex:outputPanel rendered="{!IF(sampleOrder.Status__c='订单已发送',true,false)}" >
                                    <apex:outputField value="{!sampleOrder.ReceivePart__c}"/>
                                </apex:outputPanel>
                                <apex:outputPanel rendered="{!!IF(sampleOrder.Status__c='订单已发送',true,false)}" >
                                    <apex:inputField id="sampleReceivePart" value="{!sampleOrder.ReceivePart__c}" onchange="resetDealer();return false;" />
                                </apex:outputPanel>
                            </td>
                            <th style="text-align:right;">送达方地址:</th>
                            <td style="text-align:left;">
                                <apex:outputPanel rendered="{!IF(sampleOrder.Status__c='订单已发送',true,false)}" >
                                    <apex:outputField value="{!sampleOrder.DeliveryAddress__c}"/>
                                </apex:outputPanel>
                                <apex:outputPanel rendered="{!!IF(sampleOrder.Status__c='订单已发送',true,false)}" >
                                    <apex:inputField id="Address" value="{!sampleOrder.DeliveryAddress__c}" />
                                </apex:outputPanel>
                                <!-- <apex:inputHidden id="tempSize" value="{!tempSize}" /> -->
                            </td>
                        </tr>
                        <!-- 20211115 lt end -->
                        <tr style="background-color:#f2f3f3;width:900px;">
                            <th style="text-align: left;">送达方联系人:</th>
                            <td style="text-align:left;">
                                <apex:outputPanel rendered="{!IF(sampleOrder.Status__c='订单已发送',true,false)}" >
                                    <apex:outputField value="{!sampleOrder.DeliveryContact__c}"/>
                                </apex:outputPanel>
                                <apex:outputPanel rendered="{!!IF(sampleOrder.Status__c='订单已发送',true,false)}" >
                                    <apex:inputField id="Contact" value="{!sampleOrder.DeliveryContact__c}" />
                                </apex:outputPanel>
                            </td>
                            <th style="text-align:right;">送达方电话:</th>
                            <td style="text-align:left;">
                                <apex:outputPanel rendered="{!IF(sampleOrder.Status__c='订单已发送',true,false)}" >
                                    <apex:outputField value="{!sampleOrder.DeliveryPhone__c}"/>
                                </apex:outputPanel>
                                <apex:outputPanel rendered="{!!IF(sampleOrder.Status__c='订单已发送',true,false)}" >
                                    <apex:inputField id="Phone" value="{!sampleOrder.DeliveryPhone__c}" />
                                </apex:outputPanel>
                            </td>
                        </tr>
                    </table>
                </div>
                <!-- 后台报错信息显示的关键 -->
                <apex:outputPanel id="message">
                    <apex:pageMessages ></apex:pageMessages>
                </apex:outputPanel>
                <input type="hidden" id="Page:mainForm:productInfoList:Size" value="{!tempSize}" />
                <apex:outputPanel rendered="{!IF(sampleOrder.Status__c='订单已发送',false,true)}" >
                    <table id="theTable_Body" class="pure-table pure-table-horizontal" border="1" style="border-collapse: collapse; table-layout:fixed;">
                        <tr style="background-color:#f2f3f3; width:900px; color: black;">
                            <th style="text-align:left; width:50px">查询:</th>
                            <td style="text-align:left; width:180px">
                                <apex:inputText style="text-align:left;" id="selectlike" value="{!QueryTemp}" />
                            </td>
                            <td style="text-align:left;">
                                <apex:commandButton id="Query" value="查询" style="width:100px;height:30px;" action="{!FuzzyQuery}" />
                            </td>
                        </tr>
                    </table>
                </apex:outputPanel>
                <div id="iframelike" style="width: 100%; height: 400px; text-align:center;margin:0 auto;" >
                <table id="theTable_Body" class="pure-table pure-table-horizontal" border="1" style="border-collapse: collapse; table-layout:fixed;">
                    <colgroup>
                        <col width="2%"/>
                        <col width="3%"/>
                        <col width="20%"/>
                        <col width="30%"/>
                        <col width="20%"/>
                        <col width="10%"/>
                        <col width="5%"/>
                        <col width="10%"/>
                    </colgroup>
                    <tr style="background-color:#f2f3f3;">
                        <th style="text-align:center"><input type="checkbox" id="checkAll1" onclick="checkAll();" style="width:10px;"/></th>
                        <th style="text-align:center;color: black;">NO</th>
                        <th style="text-align:center;color: black;">资料编码</th>
                        <th style="text-align:center;color: black;">资料名称</th>
                        <th style="text-align:center;color: black;">资料分类</th>
                        <th style="text-align:center;color: black;">数量</th>
                        <th style="text-align:center;color: black;">规格</th>
                        <th style="text-align:center;color: black;">总量</th>    
                    </tr>
                    <apex:repeat value="{!productInfoList}" var="pros" id="productInfoList">
                        <tr>
                            <!-- ⚀ -->
                            <td class="dataCell" style="text-align:center;">
                                <apex:inputCheckbox value="{!pros.check}" id="rowcheck"/>
                                <apex:inputHidden id="ProIdHidden" value="{!pros.proId}"/>
                            </td>
 
                            <!-- NO -->
                            <td class="dataCell" style="text-align:center;">
                                <apex:outputPanel rendered="{!IF(sampleOrder.Status__c='订单已发送',true,false)}" >
                                    <apex:outputLabel style="width:20px" id="indexNo" value="{!IF(pros.SOLDel.Pro_model__c == null,'',pros.lineNo)}"/>
                                </apex:outputPanel>
                                <apex:outputPanel rendered="{!!IF(sampleOrder.Status__c='订单已发送',true,false)}" >
                                    <apex:outputLabel style="width:20px" value="{!IF(pros.pro.Asset_Model_No__c == null,'',pros.lineNo)}"/>
                                </apex:outputPanel>
                            </td>
 
                            <!-- 资料编码 -->
                            <td class="dataCell" style="text-align:center;">
                                <apex:outputPanel rendered="{!IF(sampleOrder.Status__c='订单已发送',true,false)}" >
                                    <apex:outputField value="{!pros.SOLDel.Pro_model__c}"/>
                                </apex:outputPanel>
                                <apex:outputPanel rendered="{!!IF(sampleOrder.Status__c='订单已发送',true,false)}" >
                                    <apex:outputField style="width:90px" id="proModel" value="{!pros.pro.Asset_Model_No__c}"/>
                                </apex:outputPanel>
                            </td>
 
                            <!-- 资料名称 -->
                            <td class="dataCell" style="text-align:center;">
                                <apex:outputPanel rendered="{!IF(sampleOrder.Status__c='订单已发送',true,false)}" >
                                    <apex:outputText style="width:400px" id="SOLDelName" value="{!pros.SOLDel.Pro_Name__c}"/>
                                </apex:outputPanel>
                                <apex:outputPanel rendered="{!!IF(sampleOrder.Status__c='订单已发送',true,false)}" >
                                    <apex:outputText style="width:400px" id="Name" value="{!pros.pro.Name}"/>
                                </apex:outputPanel>
                            </td>
                            
                            <!-- 资料分类 -->
                            <td class="dataCell" style="text-align:center;">
                                <apex:outputPanel rendered="{!IF(sampleOrder.Status__c='订单已发送',true,false)}" >
                                    <apex:outputText style="width:400px" id="SOLDelClassification" value="{!pros.SOLDel.Sample_Classification__c}"/>
                                </apex:outputPanel>
                                <apex:outputPanel rendered="{!!IF(sampleOrder.Status__c='订单已发送',true,false)}" >
                                    <apex:outputText style="width:400px" id="Classification" value="{!pros.pro.Sample_Classification__c}"/>
                                </apex:outputPanel>
                            </td>
 
                            <!-- 数量 -->
                            <td class="dataCell" style="text-align:center;">
                                <apex:outputPanel rendered="{!IF(sampleOrder.Status__c='订单已发送',true,false)}" >
                                    <apex:outputField value="{!pros.SOLDel.ItemQuantity__c}"/>
                                </apex:outputPanel>
                                <apex:outputPanel rendered="{!!IF(sampleOrder.Status__c='订单已发送',true,false)}" >
                                    <apex:inputField id="Number" style="width:80px" value="{!pros.SOLDel.ItemQuantity__c}" onblur="AllChecktime({!pros.lineNo});ComputePrice(this);return false;" />
                                </apex:outputPanel>
                            </td>
 
                            <!-- 规格 -->
                            <td class="dataCell" style="text-align:center;">
                                <apex:outputPanel rendered="{!IF(sampleOrder.Status__c='订单已发送',true,false)}" >
                                    <apex:outputText value="{!pros.SOLDel.Standards__c}"/>
                                </apex:outputPanel>
                                <apex:outputPanel rendered="{!!IF(sampleOrder.Status__c='订单已发送',true,false)}" >
                                    <apex:outputText style="width:30px" id="Packing_list_manual" value="{!if(pros.pro.Asset_Model_No__c == null , '',pros.pro.Packing_list_manual__c)}" />
                                    <!-- <apex:inputHidden id="PackingHidden" value="{!pros.SOLDel.Standards__c}"/> -->
                                </apex:outputPanel>
                            </td>
 
                            <!-- 总量 -->
                            <td class="dataCell" style="text-align:center;">
                                <apex:outputField style="margin-left:3px;margin-right:3px;width:25px" id="Total" value="{!pros.SOLDel.Total__c}">
                                </apex:outputField>
                            </td>
                        </tr>
                    </apex:repeat>
                </table>
            </div>
            <div id="iframelike" style="width: 100%; height: 40px; text-align:center;margin:0 auto;" >
                <table id="buttontable" border="0">
                    <tr>
                        <!-- <td style="width:100px;" align="left"><apex:commandButton value="增加行" style="width:100px;height:30px;" onclick="openAddMultipleRow(); return false;" rerender="{!displayFlg}"/></td> -->
                        <apex:outputPanel rendered="{!IF(sampleOrder.Status__c='订单已发送',false,true)}">
                            <td style="width:100%;" align="right"><apex:commandButton id="preserve" value="保存" style="width:100px;height:30px;" onclick="SaveJs();return false;" /></td>
                            <td align="right"><apex:commandButton id="sendOrder" value="发送订货" style="width:100px;height:30px;" onclick="openAddMultipleRow(); return false;"/></td>
                        </apex:outputPanel>
                        <apex:outputPanel rendered="{!IF(sampleOrder.Status__c='订单已发送',true,false)}">
                            <td style="width:98%; position: absolute;" align="right"><apex:commandButton id="Return" value="返回" style="width:100px;height:30px;" action="{!ReturnBtn}" /></td>
                        </apex:outputPanel>
                    </tr>
                </table>
            </div>
        </apex:outputPanel>
    </apex:form>
</apex:page>