彭锟
2022-03-22 2ecb63062fe10bbfb6853e37a38a74dcc10291db
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
<apex:page controller="ReceivingNoteSummarySelectController" 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)}"/>
 
<script type="text/javascript">
var heightAjustment = 120;
var widthAjustment = 30;
    function setEmailBody() {
        var body = prompt('请输入无配套提醒邮件');
        if (body != null) {
            if (confirm('输入的邮件内容为[' + body + ']' + '是否发送?')) {
                blockme();
                sendEmail(body);
            }
        }
        return false;
    }
</script>
</head>
    <apex:form id="allForm">
 
        <!-- <apex:actionFunction name="saveAndSearch" action="{!save}" rerender="allForm,checEventFrame" oncomplete="unblockUI();"> -->
            <!-- <apex:param name="firstParam" assignTo="{!saveType}" 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>
 
        <apex:actionFunction name="sendEmail" action="{!sendEmail}"  rerender="allForm" oncomplete="unblockUI();">
            <apex:param name="emailBody" value="" />
        </apex:actionFunction>
 
        <apex:outputPanel id="pageallPanel">
            <apex:pageBlock id="searchBlock" tabStyle="Report">
                <table style="width:700px;">
                    <tr>
                        <td width="50px">关键字</td>
                        <td width="200px"><apex:inputText value="{!keyword}" style="width:98%;"/></td>
                        <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="margin-left:50px;float:left;" value="保存" onclick="blockme();saveCustom('NO');" oncomplete="unblockUI();" /> -->
                            <apex:commandButton style="float:left;" value="确定" onclick="blockme();saveCustom('YES');" oncomplete="unblockUI();" />
                            <apex:commandButton style="float:left;" value="返回" action="{!cancel}"/>
                            <apex:commandButton style="float:left;" value="清空配套" action="{!cleanFixtureSet}"/>
                            <apex:commandButton style="float:right;" value="无配套提醒邮件" onclick="return setEmailBody();"/>
                        </td>
                    </tr>
                </table>
                <div style="clear:both;"></div>
                <!-- OLY_OCM-404 只在分配代替品页面显示,防止以后需求变化,选中一览支持传list -->
                <apex:outputPanel layout="none" rendered="{!IF(inRaesId == '', false, true)}">
                    <apex:dataTable value="{!selectedRnsList}" var="raes" id="selRaes" border="1" cellpadding="5">
                        <apex:column >
                            <apex:facet name="header">
                                <apex:outputText value="{!$ObjectType.ReceivingNoteSummary__c.fields.Name.label}" />
                            </apex:facet>
                            <apex:outputText value="{!raes.Name}" />
                        </apex:column>
                        <apex:column >
                            <apex:facet name="header">
                                <apex:outputText value="{!$ObjectType.Fixture_Set__c.fields.Name.label}" />
                            </apex:facet>
                            <apex:outputText value="{!raes.Fixture_Set__r.Name}" />
                        </apex:column>
                        <apex:column >
                            <apex:facet name="header">
                                <apex:outputText value="{!$ObjectType.Fixture_Set__c.fields.Loaner_name__c.label}" />
                            </apex:facet>
                            <apex:outputText value="{!raes.Fixture_Set__r.Loaner_name__c}" />
                        </apex:column>
                        <!-- <apex:column >
                            <apex:facet name="header">
                                <apex:outputText value="{!$ObjectType.Rental_Apply_Equipment_Set__c.fields.Old_Loaner_code_F__c.label}" />
                            </apex:facet>
                            <apex:outputText value="{!raes.Loaner_code_F__c}" />
                        </apex:column> -->
                        <!-- <apex:column >
                            <apex:facet name="header">
                                <apex:outputText value="{!$ObjectType.Rental_Apply_Equipment_Set__c.fields.Old_Loaner_name_F__c.label}" />
                            </apex:facet>
                            <apex:outputText value="{!raes.Loaner_name_F__c}" />
                        </apex:column>
                        <apex:column >
                            <apex:facet name="header">
                                <apex:outputText value="{!$ObjectType.Rental_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_Rental_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_Rental_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_Rental_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);
          });
          // 代替品不可默认为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$(document).ready(function(){
                if ('{!direct}' == 'true') {
                    var $td;
                    var onlyOne = false;
                    j$(".rowchkcls").each(function (index) {
                        if (index == 0) {
                            $td = j$(this);
                            onlyOne = true;
                        }
                        if (index > 0) {
                            onlyOne = false;
                            // break;
                        }
                    });
                    if (onlyOne) {
                        blockme();
                        $td.attr('checked', true);
                        saveCustom();
                    }
                }
            });
      </script>
    </apex:outputPanel>
</apex:page>