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
<apex:page controller="FixtureSetManageController" showHeader="false" sidebar="false" id="allPage" action="{!init}" lightningStylesheets="true">
<head>
<title>备品配套明细管理</title>
<apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
<!-- FixtureSetManageページ用css -->
<apex:stylesheet value="{!URLFOR($Resource.FixtureSetManageCss)}"/>
<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  -->   
 
<!-- 20230426 zq add style -->
<style>
.mytable td {
    padding: 5px 5px;
    width: auto;
}
body input[type="submit"], body input.btn{
    padding: 0 10px;
}
</style>
 
<script type="text/javascript">
var heightAjustment = 120;
var widthAjustment = 30;
 
</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="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="searchOpp" action="{!searchOpp}" rerender="allForm,checEventFrame" oncomplete="unblockUI();">
        </apex:actionFunction>
 
        <apex:outputPanel id="pageallPanel">
            <apex:pageBlock id="searchBlock" tabStyle="Report">
            <apex:variable value="{!$ObjectType.Fixture_Set_Detail__c.updateable && $ObjectType.Fixture_Set_Detail__c.createable}" var="savedisabled" />
                <apex:pageBlockButtons location="bottom">
                        <!--20230426 zq <apex:commandButton style="float:left;" disabled="{!Not(savedisabled)}" action="{!save}" value="保存" onclick="blockme();" rerender="allForm,checEventFrame,message" oncomplete="unblockUI();" /> 
                            <apex:commandButton style="float:right;" action="{!cancel}" value="取消" rerender="message"/>
                        -->
                        <apex:commandButton disabled="{!Not(savedisabled)}" action="{!save}" value="保存" onclick="blockme();" rerender="allForm,checEventFrame,message" oncomplete="unblockUI();" />
                        <apex:commandButton style="float:right;margin-right: 10px;" action="{!cancel}" value="取消" rerender="message"/>
                </apex:pageBlockButtons>
                <div style="clear:both;"></div>
                
                    <apex:inputHidden value="{!multiStatus}" id="multiStatus"/>
                    <!-- 20230817 ljh add mytable-->
                    <table class="mytable">
                        <tr>
                            <td colspan="2">{!$ObjectType.Fixture_Set__c.fields.Name.label}</td>
 
                            <td colspan="2">
                                <apex:outputPanel layout="none">
                                   <apex:outputfield value="{!parentObj.Name}" />
                               </apex:outputPanel>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">{!$ObjectType.Product2.fields.Asset_Model_No__c.label}</td>
                            <td colspan="3"><apex:inputText value="{!assetModelNo}" style="width:100px"/></td>
                        </tr>
                        <tr>
                            <td width="50px">{!$ObjectType.Product2.fields.Family.label}</td>
                            <td>
                                <apex:selectList id="Family" style="width:100px" value="{!family}" size="1"><apex:selectOptions value="{!familyOpts}"/></apex:selectList>
                            </td>
                            <td width="20px"/>
                            <td width="50px">{!$ObjectType.Product2.fields.Category2__c.label}</td>
                            <td><apex:inputText value="{!category2}" style="width:100px"/></td>
                            <td width="20px"/>
                            <td width="50px">{!$ObjectType.Product2.fields.Category3__c.label}</td>
                            <td><apex:inputText value="{!category3}" style="width:100px"/></td>
                            <td width="20px"/>
                            <td width="50px">{!$ObjectType.Product2.fields.Category4__c.label}</td>
                            <td><apex:inputText value="{!category4}" style="width:100px"/></td>
                            <td width="20px"/>
                            <td width="50px">{!$ObjectType.Product2.fields.Category5__c.label}</td>
                            <td><apex:inputText value="{!category5}" style="width:100px"/></td>
                        </tr>
                        <tr>
                            <td><apex:commandButton value="搜索" onclick=" searchOppJs(); return false;"/></td>
                        </tr>
                    </table>
                <apex:outputPanel id="message">
                    <apex:pageMessages />
                </apex:outputPanel>
            </apex:pageBlock>
            <c:RelationListPagingCmp id="cmpid" pgController="{!this}" hasCheckbox="true" noSort="true"/>
        </apex:outputPanel>
    </apex:form>
 
<apex:outputPanel id="checEventFrame">
  <script type="text/javascript">
      // 数量添加加减符号
      j$(".dataCellBorder1.col_Quantity__c").each(function () {
        // 20230817 ljh lightning start
        //   j$(this).append('<input type="button" style="width: auto;" class="inc btn" value="+" /><input type="button" style="width: auto;" class="dec btn" value="-" />');
        j$(this).append('<input type="button" style="width:1.5rem;line-height:1.5rem;" class="inc btn" value="+" /><input type="button" style="width:1.5rem;line-height: 1.5rem;" class="dec btn" value="-" />');
        // 20230817 ljh lightning end
        });
      j$(".dataCellBorder1.col_Quantity__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$(".dataCellBorder1.col_SortInt_F__c").each(function () {
        // 20230817 ljh style="width: auto;" style="width:1.5rem;line-height:1.5rem;"
          j$(this).append('<input type="button" style="width:1.5rem;line-height:1.5rem;" class="inc btn" value="↑" onclick="lineMoveUpDown(this)" /><input type="button" style="width:1.5rem;line-height:1.5rem;" class="dec btn" value="↓" onclick="lineMoveUpDown(this)" />');
      });
 
      function lineMoveUpDown(pObj) {
          var eleList = j$(".dataCellBorder1.col_SortInt_F__c input[type=button]");
          var $button = j$(pObj);
          var line = parseInt(eleList.index(j$(pObj)) / 2) + 1;  // ↑ と ↓ 2つbtnあります
          if ($button.val() == "↑") {
              return resetOrderNoMoveUpDown(true, line);
          } else {
              return resetOrderNoMoveUpDown(false, line);
          }
      }
 
      function setPageElementAfterLoadedCmp(){
          // 备品配套设定页面用
          j$('.col_Is_Body__c').children('input[type=checkbox]').each(function() {
              if (j$(this).prop('checked')){
                j$(this).parent().parent().children('.col_Is_OneToOne__c').children('input[type=checkbox]').prop('disabled', true).prop('checked', false);
              } else {
                j$(this).parent().parent().children('.col_Is_OneToOne__c').children('input[type=checkbox]').prop('disabled', false);
              }
          });
 
          // 主体の場合は、一対一 自動でFalseにする。
          j$('.col_Is_Body__c').children('input[type=checkbox]').click(function(){
              if (j$(this).prop('checked')){
                  console.log();
                  if(j$('.col_Is_Body__c').children('input[type=checkbox]:checked').length >=2){
                      window.confirm('一个配套内、主体备品最多只能勾选一个。');
                      j$(this).prop('checked',false);
                      return;
                  }
                  j$(this).parent().parent().children('.col_Is_OneToOne__c').children('input[type=checkbox]').prop('disabled', true).prop('checked', false);
              } else {
                  j$(this).parent().parent().children('.col_Is_OneToOne__c').children('input[type=checkbox]').prop('disabled', false);
              }
          });
      }
 
      j$(function() {
        setPageElementAfterLoadedCmp();
      });
  </script>
</apex:outputPanel>
</apex:page>