高章伟
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
<apex:page controller="ReceivingNoteDetailSelectController" showHeader="false" sidebar="false" id="allPage" action="{!init}">
<head>
<apex:outputPanel rendered="{!isAcceptance}">
    <meta name="viewport" content="width=device-width,initial-scale=1"/>
</apex:outputPanel>
<title>收货清单配套明细选择</title>
<apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
<apex:stylesheet value="{!URLFOR($Resource.RentalFixtureSetDetilSelectCss)}"/>
<apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
<apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
<apex:includeScript value="{!URLFOR($Resource.RelationListPagingCmpJS)}"/>
<apex:stylesheet value="{!URLFOR($Resource.jquery_confirm, 'jquery-confirm.min.css')}"/>
<apex:includeScript value="{!URLFOR($Resource.jquery_confirm, 'jquery-confirm.min.js')}"/>
 
<script type="text/javascript">
var heightAjustment = 120;
var widthAjustment = 30;
    function setEmailBody() {
        j$.confirm({
            title: '无配套明细提醒邮件',
            boxWidth: '50%',
            useBootstrap: false,
            content: '' +
              '<form action="" class="formName">' +
              '<div style="overflow: hidden;">' +
              '<label>请输入邮件内容<br/>' +
              '<textarea placeholder="邮件内容" style="width:95%" class="name form-control" rows="3" required />' +
              '</div>' +
              '</form>',
            buttons: {
                formSubmit: {
                    text: '发送',
                    btnClass: 'btn-blue',
                    action: function () {
                        var body = this.$content.find('.name').val();
                        if(!body){
                            j$.alert({
                                title:'',
                                content: '未输入邮件内容!',
                                boxWidth: '50%',
                                useBootstrap: false,
                            });
                            return false;
                        }
                        j$.confirm({
                            title: '确认',
                            content: '输入的邮件内容为[' + body + ']' + '是否发送?',
                            boxWidth: '50%',
                            useBootstrap: false,
                            buttons: {
                                OK: function () {
                                    blockme();
                                    sendEmail(body);
                                },
                                cancel: {
                                    text: '取消' // With spaces and symbols
                                }
                            }
                        });
                    }
                },
                cancel: {
                    text: '取消'
                }
            }
        });
        // var body = prompt('请输入无配套提醒邮件');
        // if (body != null) {
        //     if (confirm('输入的邮件内容为[' + body + ']' + '是否发送?')) {
        //         blockme();
        //         sendEmail(body);
        //     }
        // }
        return false;
    }
</script>
</head>
    <apex:form id="allForm">
 
        <apex:outputPanel id="message">
            <apex:pageMessages />
        </apex:outputPanel>
        <apex:actionFunction name="saveAndSort" action="{!save}" rerender="allForm, checEventFrame" oncomplete="unblockUI();">
            <apex:param name="firstParam" assignTo="{!saveType}" value="" />
            <apex:param name="secondParam" assignTo="{!sortKey}" value="" />
        </apex:actionFunction>
        <apex:actionFunction name="sendEmail" action="{!sendEmail}"  rerender="allForm, checEventFrame" oncomplete="unblockUI();">
            <apex:param name="emailBody" value="" />
        </apex:actionFunction>
        <apex:outputPanel id="pageallPanel">
            <apex:pageBlock id="searchBlock" tabStyle="Report">
                <apex:pageBlockButtons location="bottom">
                        <apex:commandButton style="float:left;" action="{!save}" value="确定" onclick="blockme();" rerender="allForm, checEventFrame" oncomplete="unblockUI();" />
                        <apex:commandButton style="float:left;" value="无配套明细提醒邮件" onclick="setEmailBody();" rerender="allForm, checEventFrame"/>
                        <apex:commandButton style="float:right;" value="{!IF(isAcceptance, '返回', '返回上一级')}" action="{!goBack}"/>
                        <apex:commandButton rendered="{!isAcceptance == false}" style="float:right;" value="返回数据确认画面" action="{!cancel}"/>
                </apex:pageBlockButtons>
                <div style="clear:both;"></div>
 
                    <table border="1" cellspacing="0" cellpadding="0" >
                        <tr>
                            <td colspan="2" width="200px">{!$ObjectType.Rental_Apply_Equipment_Set__c.fields.Name.label}</td>
                            <td colspan="3" width="200px"><apex:outputText value="{!parentObj.Name}" style="width:100px"/></td>
                        </tr>
                        <!-- <tr>
                            <td colspan="2">{!$ObjectType.Rental_Apply_Equipment_Set__c.fields.Fixture_Set_Idx__c.label}</td>
                            <td colspan="3"><apex:outputText value="{!parentObj.Fixture_Set_Idx__c}" style="width:100px"/></td>
                        </tr> -->
                        <tr>
                            <td colspan="2" width="200px">{!$ObjectType.Fixture_Set__c.fields.Loaner_name__c.label}</td>
                            <td colspan="3" width="200px"><apex:outputText value="{!parentObj.Fixture_Set__r.Loaner_name__c}" style="width:100px"/></td>
                        </tr>
 <!--                        <tr>
                            <td colspan="2">{!$ObjectType.Rental_Apply_Equipment_Set__c.fields.Loaner_code__c.label}</td>
                            <td colspan="3"><apex:outputText value="{!parentObj.Loaner_code__c}" style="width:100px"/></td>
                        </tr> -->
                        <!-- <tr>
                            <td colspan="2">{!$ObjectType.Rental_Apply_Equipment_Set__c.fields.Rental_Num__c.label}</td>
                            <td colspan="3"><apex:outputText value="{!parentObj.Rental_Num__c}" style="width:100px"/></td>
                        </tr> -->
 <!--TODO  同一附属品:レ -->
 
                    </table>
            </apex:pageBlock>
            <c:RelationListPagingCmp id="cmpid" pgController="{!this}" hasCheckbox="false" noSort="true"/>
        </apex:outputPanel>
    </apex:form>
    <!-- add by rentx 20210729 start 新品收货_集中备品_建立新品入库标准配套 -->
    <style>
      table.list .col_Fixture_Set_New_Quantity__c input {width:55%;}
      /*没找着这个输入框在哪设置的 就直接设置隐藏了 */
      table.list .col_Rental_Num__c input { display: none;}
    </style>
    <!-- add by rentx 20210729 end 新品收货_集中备品_建立新品入库标准配套 -->
    <apex:outputPanel id="checEventFrame">
      <script type="text/javascript">
        //update by rentx 20210729 start 新品收货_集中备品_建立新品入库标准配套
            var i = 0;
            // 数量添加加减符号 
            /*j$(".dataCellBorder1.col_Rental_Num__c").each(function () {
                // if (i > 0) {
                    j$(this).append('<input type="button" style="width: auto;" class="inc btn" value="+" /><input type="button" style="width: auto;" class="dec btn" value="-" />');
                // }
                i ++;
            });
            j$(".dataCellBorder1.col_Rental_Num__c input[type=button]").on("click", function() {
                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);
            });
 
          // 
            j$(document).ready(function(){
                var count = j$(":text").length;
                var inputbox = j$(":text")[count/2];
                j$(inputbox).prop('disabled', true);
                var a = j$("input.inc.btn")[0]
                var b = j$("input.dec.btn")[0]
                j$(a).prop('disabled', true);
                j$(b).prop('disabled', true);
            });*/
            //设置数量只读
            j$(".dataCellBorder1.col_Rental_Num__c input").each(function () {
                var $button = j$(this);
                var oldValue = $button.parent().find("input[type=text]").val();
                $button.parent().append('<span>'+oldValue+'</span>');
            });
            //设置加减符号并设置一个隐藏的初始值 
            j$(".dataCellBorder1.col_Fixture_Set_New_Quantity__c").each(function () {
                //oldValue 是初始值 设置他到一个hidden里 方便后面加减的时候做判断
                    var oldValue = j$(this).find("input[type=text]").val();
                    // var aaaa = j$(this).find("input[type=text]");
                    //  var bbbb = j$(this).find("input[type=text]")[0];
                    // // var ccc = j$(this).find("input[type=text]").0;
                    // // bbbb.readonly='true';
                    // debugger;
                    //新品配套=false 时新品配套数量不可修改 直接隐藏就可以了 因为新品配套为false是 新品配套数是空
                    if (oldValue == 'NaN' || oldValue == '') {
                        j$(this).find("input[type=text]")[0].style.display = "None";
                    }else{
                        j$(this).find("input[type=text]")[0].readonly = true;
                        j$(this).append('<input type="button" style="width: auto;" class="inc btn" value="+" /><input type="button" style="width: auto;" class="dec btn" value="-" /> <input type="hidden" style="width: auto;" class="dec btn" value="'+oldValue+'" />');
                    }   
                i ++;
            });
            //点击加减符号时执行
            j$(".dataCellBorder1.col_Fixture_Set_New_Quantity__c input[type=button]").on("click", function() {
                var $button = j$(this);
                //获取旧值 和 初始值
                var oldValue = $button.parent().find("input[type=text]").val();
                var firValue = $button.parent().find("input[type=hidden]").val();
                // 初始值有值 并且不是nan的时候 新品配套有值
                if (firValue != 'NaN' && firValue != '') {
                    //判断 如果用户点击的加号 判断 旧值是否大于初始值 若大于初始值 设置值为初始值
                    if ($button.val() == "+") {
                        var newVal = parseFloat(oldValue) + 1;
                        if (newVal > parseFloat(firValue)) {
                            var newVal = parseFloat(firValue);
                        }
 
                    } 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);
                }else{
                    var a = j$("input.inc.btn")[0]
                    var b = j$("input.dec.btn")[0]
                    j$(a).prop('disabled', true);
                    j$(b).prop('disabled', true);
                }
                
            });
            //输入框设置上线为初始值
            j$(".dataCellBorder1.col_Fixture_Set_New_Quantity__c input[type=text]").on("change", function() {
                console.log('12121');
                var $text = j$(this);
                //获取旧值 和 初始值
                // var oldValue = $button.parent().find("input[type=text]").val();
                var firValue = $text.parent().find("input[type=hidden]").val();
 
                //取得当前值
                var nowValue = $text.parent().find("input[type=text]").val();
 
                //判断如果输入的值大于初始值 则设置当前值为初始值
                if (parseFloat(nowValue) > parseFloat(firValue)) {
 
                    $text.parent().find("input[type=text]").val(firValue);
                }
                
            });
        //update by rentx 20210729 end 新品收货_集中备品_建立新品入库标准配套
 
 
      </script>
    </apex:outputPanel>
</apex:page>