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
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
<apex:page lightningStylesheets="true" standardController="Consum_Apply_Equipment_Set__c" extensions="ConsumSelectController" showHeader="false" sidebar="false" id="allPage" action="{!init}">
<head>
<title>耗材分配</title>
<apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
<apex:stylesheet value="{!URLFOR($Resource.RentalFixtureSetSelectCss)}"/>
<apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
<apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
<apex:includeScript value="{!URLFOR($Resource.RelationListPagingCmpJS)}"/>
<apex:stylesheet value="{!URLFOR($Resource.StyleUtilCss)}"/><!-- 20230619 ljh lightning  -->
 
<style>
    table.list .col_No_Jia__c{width:100px;}
    table.list .col_Fixture_Model_No__c{width:100px;}
    table.list .col_ProductName__c{width:100px;}
    table.list .col_Request_Num_Jia__c{width:100px;}
    table.list .col_Salesdepartment__c{width:100px;}
    table.list .col_SerialNumber_F__c{width:100px;}
    table.list .col_Consumable_Guaranteen_end_F__c{width:100px;}
    table.list .col_You_Xiao_Ku_Cun_Jia__c{width:100px;}
    table.list .col_Jie_Chu_Fen_Pei_Jia__c{width:100px;}
    table.list .col_Fen_Pei_Shu_Liang_Jia__c{width:100px;}
    table.list .col_Fen_Pei_Shu_Liang_Jia__c input[type="text"] {width:100px;}
    tr.headerRow {
        height: 40px;
    }
</style>
 
<script type="text/javascript">
var heightAjustment = 120;
var widthAjustment = 30;
    function checkCount() {
        var requestCount = document.getElementById("allPage:allForm:RetalFSetDetail_Cnt").value;
        var checkList = document.getElementsByClassName("col_Fen_Pei_Shu_Liang_Jia__c");
        var Rs = j$(escapeVfId('allPage:allForm:hgerqi')).value(); // WYL 贸易合规2期
        var IFTradeComplianceAlertName = j$(escapeVfId('allPage:allForm:IFTradeComplianceAlertName')).value(); // WYL 贸易合规2期
        console.info('rs='+Rs);
        var selectCount = 0;
        Array.prototype.filter.call(checkList, function(testElement){
            if (testElement.childNodes.length > 0 && testElement.childNodes[0].textContent != '分配数量') {
                selectCount += parseInt(testElement.childNodes[0].value);
            }
        });
       //WYL 贸易合规2期 start
        if (Rs=='true' || Rs == true) {
            if (confirm('您此次申请的业务可能存在贸易合规风险,是否继续保存,如果有问题请联系法务本部贸易合规窗口'+IFTradeComplianceAlertName+'进一步评估(一般需5-10个工作日)。')) {
                if (parseInt(selectCount) < parseInt(requestCount)) {
                    if (confirm('"分配件数"小于待分配件数,是否继续?')) {
                        blockme();
                        saveCustom('NO');
                    }
                }
                else if (parseInt(selectCount) > parseInt(requestCount)) {
                alert('"分配件数"不能大于待分配件数');
                }
                else {
                    blockme();
                    saveCustom('NO');
                }
            }
        }else{
            if (parseInt(selectCount) < parseInt(requestCount)) {
                    if (confirm('"分配件数"小于待分配件数,是否继续?')) {
                        blockme();
                        saveCustom('NO');
                    }
                }
                else if (parseInt(selectCount) > parseInt(requestCount)) {
                alert('"分配件数"不能大于待分配件数');
                }
                else {
                    blockme();
                    saveCustom('NO');
                }
        }
        // WYL 贸易合规2期 end
    }
 
</script>
</head>
    <apex:form id="allForm">
        <!-- WYL 2023-11-28 贸易合规2期 start -->
        <apex:inputHidden value="{!hgerqi}" id="hgerqi"/> 
        <apex:inputHidden value="{!IFTradeComplianceAlertName}" id="IFTradeComplianceAlertName"/> 
        <!-- WYL 2023-11-28 贸易合规2期 end -->
        <apex:inputHidden id="RetalFSetDetail_Cnt" value="{!parentObj.RetalFSetDetail_Cnt__c}"/>
 
        <apex:actionFunction name="saveAndSearch" action="{!save}" rerender="allForm,checEventFrame" oncomplete="unblockUI();">
            <apex:param name="firstParam" assignTo="{!saveType}" value="" />
        </apex:actionFunction>
       <!--  <apex:actionFunction name="reSetYouXiaoKuCun" action="{!reSetYouXiaoKuCun}" rerender="allForm,checEventFrame" oncomplete="unblockUI();">
            <apex:param name="index" value="" />
            <apex:param name="date" value="" />
        </apex:actionFunction> -->
 
        <apex:actionFunction name="searchOpp" action="{!searchOpp}" rerender="allForm,checEventFrame" oncomplete="windowResize();unblockUI();">
        </apex:actionFunction>
 
        <apex:actionFunction name="saveCustom" action="{!save}" rerender="allForm,checEventFrame" oncomplete="windowResize();unblockUI();">
        </apex:actionFunction>
        <!-- 20240205 sx 贸易合规发邮件修改,增加未分配时提醒 -->
        <apex:actionFunction name="tradeCheckTwo" action="{!tradeCheckTwo}" rerender="allForm" oncomplete="checkCount()"></apex:actionFunction>
        <!-- 20240205 sx 贸易合规发邮件修改,增加未分配时提醒 -->
        <!-- <apex:inputHidden id="demo_purpose2Hidden" value="{!parentObj.demo_purpose2__c}"/> -->
        <apex:outputPanel id="pageallPanel">
            <apex:pageBlock id="searchBlock" tabStyle="Report">
 
                <apex:pageBlockSection title="耗材分配画面" id="defSelect">
                    <apex:outputField value="{!parentObj.Name}"/>
                    <apex:outputField value="{!parentObj.Consum_Apply__r.Person_In_Charge__c}"/>
                    <apex:outputField value="{!parentObj.Consum_Apply__r.Salesdept__c}"/>
                    <apex:outputField value="{!parentObj.Consum_Apply__r.WorkPlace__c}"/>
                    <apex:outputField value="{!parentObj.Consum_Apply__r.Internal_asset_location_F__c}"/>
                    <apex:outputField value="{!parentObj.Consum_Apply__r.Request_shipping_day__c}"/>
                    <apex:outputField value="{!parentObj.Consum_Apply__r.demo_purpose2__c}"/>
                    <apex:outputField value="{!parentObj.Model_No__c}"/>
                    <apex:outputField value="{!parentObj.Consum_Apply__r.Asset_loaner_start_date__c}"/>
                    <apex:outputField id="Wei_Assigned_Cnt" value="{!parentObj.Wei_Assigned_Cnt__c}"/>
                    <apex:outputField value="{!parentObj.RetalFSetDetail_Cnt__c}"/>
                    
                   
                </apex:pageBlockSection>
 
                <table style="width:700px;">
                    <tr>
                        <td>
                            <!-- <apex:commandButton style="float:left;" value="检索" onclick=" searchOppJs(); return false;"/> -->
                            <!-- 原分配页面,选中一条记录, 再查询, ,点‘确定’就会走save())方法,代替品的话 单纯 Search(即 searchOppJs) -->
                            <!-- <apex:commandButton style="float:left;" value="检索" onclick="{!IF(inRaesId == '', 'searchOppJs();', 'searchOpp();')}  return false;"/> -->
                            <apex:commandButton style="float:right;" value="返回" action="{!cancel}" reRender="allForm"/>
                            <!-- 20240205 sx 贸易合规发邮件修改,增加未分配时提醒 -->
                            <apex:commandButton style="margin-right:50px; float:right;" disabled="{!parentObj.Wei_Assigned_Cnt__c == 0}" value="保存" onclick="tradeCheckTwo(); return false;"/>
                            <!-- <apex:commandButton style="margin-right:50px; float:right;" disabled="{!parentObj.Wei_Assigned_Cnt__c == 0}" value="保存" onclick="checkCount(); return false;"/> -->
                            <!-- <apex:commandButton style="float:left;" value="确定" onclick="blockme();saveCustom('YES');" oncomplete="unblockUI();" /> -->
                        </td>
                    </tr>
                </table>
                <div style="clear:both;"></div>
                <!-- OLY_OCM-404 只在分配代替品页面显示,防止以后需求变化,选中一览支持传list -->
                <apex:outputPanel layout="none" rendered="{!IF(inRaesId == '', false, true)}">
                    <apex:dataTable value="{!selectedRaesList}" var="raes" id="selRaes" border="1" cellpadding="5">
                        <apex:column >
                            <apex:facet name="header">
                                <apex:outputText value="{!$ObjectType.Consum_Apply_Equipment_Set__c.fields.Name.label}" />
                            </apex:facet>
                            <apex:outputText value="{!raes.Name}" />
                        </apex:column>
                        <apex:column >
                            <apex:facet name="header">
                                <apex:outputText value="{!$ObjectType.Consum_Apply_Equipment_Set__c.fields.Old_RetalFSetDetail_Cnt__c.label}" />
                            </apex:facet>
                            <apex:outputText value="{!raes.RetalFSetDetail_Cnt__c}" />
                        </apex:column>
                    </apex:dataTable>
                </apex:outputPanel>
                <apex:outputPanel id="message">
                    <apex:pageMessages />
                </apex:outputPanel>
            </apex:pageBlock>
            <c:RelationListPagingCmp id="cmpid" pgController="{!this}" hasCheckbox="true" noSort="true" isRadio="{!isRadio}"/>
        </apex:outputPanel>
    </apex:form>
    <apex:outputPanel id="checEventFrame">
        <script type="text/javascript">
          var $Col_Scroll = j$(".dataRow.col_Scroll");
          // 数量添加加减符号
          // j$(".dataCellBorder1.col_Consum_Num__c").each(function (index) {
          //     // var $subSetFlg = $Col_Scroll.find("input[name=Substitute_Select_Again__c]");
          //     // if ($subSetFlg[index].value == 'true' || '{!$CurrentPage.parameters.raesid}' != '') {
          //     //     // 分配代替品画面 -- 数量不可更改
          //     //     j$(".dataCellBorder1.col_Consum_Num__c").each(function() {
          //     //         var $td = j$(this);
          //     //         $td.find("input[type=text]").attr('disabled',true);
          //     //     });
          //     // } else {
          //         j$(this).append('<input type="button" style="width: auto;" class="inc btn" value="+" /><input type="button" style="width: auto;" class="dec btn" value="-" />');
          //     // }
          // });
          // j$(".dataCellBorder1.col_Consum_Num__c input[type=button]").on("click", function(index) {
          //     var $button = j$(this);
          //     var oldValue = $button.parent().find("input[type=text]").val();
          //     if ($button.val() == "+") {
          //         var newVal = parseFloat(oldValue) + 1;
          //     } else {
          //         // Don't allow decrementing below zero
          //         if (oldValue > 0) {
          //           var newVal = parseFloat(oldValue) - 1;
          //         } else {
          //           newVal = 0;
          //         }
          //     }
          //     $button.parent().find("input[type=text]").val(newVal);
          // });
          var aa = false;
          // function resetFun() {
          //       var p = document.getElementById("allPage:allForm:demo_purpose2Hidden").value;
          //       if (p != '动物实验') {
          //           j$(".dataCellBorder1.col_Consum_Start_Date__c input[type=text]").on("change", function(index) {
          //               if (aa == true) {
          //                   aa = false;
          //                   return false;
          //               }
          //               var date = j$(this);
          //               var datastr = date.val();
          //               if (datastr != '' && datastr != null) {
          //                   blockme();
          //                   reSetYouXiaoKuCun(date.index(), datastr);
          //               }
          //               aa = true;
          //           });
          //       }
          // }
          // resetFun();
          // // 代替品不可默认为false且不可更改
          // j$(".dataCellBorder1.col_Irreplaceable_flag__c").each(function(index) {
          //     var $subSetFlg = $Col_Scroll.find("input[name=Substitute_Select_Again__c]");
          //     if ($subSetFlg[index].value == 'true' || '{!$CurrentPage.parameters.raesid}' != '') {
          //         var $td = j$(this);
          //         $td.find("input[type=checkbox]").attr('disabled',true);
          //     }
          // });
          // // 同一附属品默认为false且不可更改
          // j$(".dataCellBorder1.col_Same_Accessory_flag__c").each(function(index) {
          //     var $subSetFlg = $Col_Scroll.find("input[name=Substitute_Select_Again__c]");
          //     if ($subSetFlg[index].value == 'true' || '{!$CurrentPage.parameters.raesid}' != '') {
          //         var $td = j$(this);
          //         $td.find("input[type=checkbox]").attr('disabled',true);
          //     }
          // });
            j$("td.dataCellBorder1.col_Fen_Pei_Shu_Liang_Jia__c input").change(function(){
                var names = this.name.split(':');
                var i = names[names.length - 4];
                j$("input.rowchkcls")[i].checked = true;
            })
 
        </script>
    </apex:outputPanel>
</apex:page>