高章伟
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
<apex:page controller="LookupController" id="pg" showheader="false" sidebar="false"  title="{!title}" >
    <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
    <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
    <apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
    <apex:includeScript value="{!URLFOR($Resource.connection20)}"/>
    <apex:includeScript value="{!URLFOR($Resource.clipboardminjs)}"/>
    <apex:includeScript value="{!URLFOR($Resource.apex20)}"/>
    <script type="text/javascript">
 
        //搜索跳转
        function clearSearch(){
            //清空值
            j$(escapeVfId('pg:formId:txtSearch'))[0].value = '';
        }
 
        //js取参
        function GetQueryValue(queryName) {
              var query = decodeURI(window.location.search.substring(1));
              var vars = query.split("&");
             for (var i = 0; i < vars.length; i++) {
                 var pair = vars[i].split("=");
                 if (pair[0] == queryName) { return pair[1]; }
             }
             return null;
         }
         //强制 不同部分之间刷新的先后顺序
        function loadPage(){
            //初始化去掉默认样式
            removeButtonStyle();
            loadPage();
        }
    </script>
    <style type="text/css">
        /* 标准查找字段 搜索框 input样式*/
        .inputTextStyle{
            height: 28px;
            width: 150px;
            box-sizing: border-box;
            border-radius: 4px;
            border: 1px solid #cccccc;
            box-shadow: inset 0 1px 1px rgba(0,0,0,0.075);
        }
        .wrapper {
            cursor: pointer;
            border-radius: 5em;
            color: #fff;
            background: linear-gradient(to right, #34becd, #7740fb5c);
            border: 0;
            padding-left: 20px;
            padding-right: 20px;
            padding-bottom: 5px;
            padding-top: 3px;
            font-family: 'Ubuntu', sans-serif;
            /* margin-left: 5%; */
            font-size: 13px;
            box-shadow: 0 0 20px 1px rgba(0, 0, 0, 0.04);
          }
          /*分页按钮用*/
          .wrapperPage {
            cursor: pointer;
            border-radius: 5em;
            color: #fff;
            /*background: linear-gradient(to right, #34becd, #7740fb5c);*/
            border: 0;
            padding-left: 20px;
            padding-right: 20px;
            padding-bottom: 5px;
            padding-top: 3px;
            font-family: 'Ubuntu', sans-serif;
            /* margin-left: 5%; */
            font-size: 13px;
            box-shadow: 0 0 20px 1px rgba(0, 0, 0, 0.04);
          }
          .buttonDisabled{
            background-position: 0 -90px;
            border-color: #c4c4c4;
            color: #909090;
          }
          
    </style>
    <!-- form 表单 -->
    <apex:form id="formId">
        <!-- 定义后台方法 js 调用   精琢技术 wql 2021/04/01  start-->
        <apex:actionFunction action="{!loadPage}" name="loadPage" reRender="pnlSearchResults" oncomplete="removeButtonStyle()">
        </apex:actionFunction>
        <apex:actionFunction action="{!search}" name="search" reRender="pnlSearchResults" oncomplete="removeButtonStyle()">
        </apex:actionFunction>
        <!-- 定义后台方法 js 调用   精琢技术 wql 2021/04/01  end-->
        <apex:outputpanel id="page" layout="block" style="margin:5px;padding:10px;padding-top:2px;">
            <apex:tabpanel id="tabbedPanel" selectedtab="name1" switchtype="client">
                <!-- SEARCH TAB -->
                <apex:tab id="tabOne" label="{!title}" name="tab1">
                    <apex:actionregion id="actionOne">
 
                        <!-- 搜索列 模糊检索  精琢技术 wql 2021/04/01-->
                        <apex:outputpanel id="top" layout="block" style="margin:5px;padding:10px;padding-top:2px;">
                            <apex:outputlabel for="txtSearch" style="font-weight:Bold;padding-right:10px;" value="{!searchLabel}" id="searchLabel">
                            </apex:outputlabel>
                            <apex:inputtext id="txtSearch" value="{!searchString}" styleClass="inputTextStyle">
                            </apex:inputtext>
                            <span style="padding-left:5px" id="ClearSearch">
                                <apex:commandbutton id="btnGoClear" action="{!Search}" rerender="searchResults" value="清空" oncomplete="loadPage(); "  styleClass="wrapper" onClick="clearSearch();" >
                                </apex:commandbutton>
                            </span>
                            <span style="padding-left:5px" id="searchButton">
                                <apex:commandbutton action="{!Search}" id="btnGo" rerender="searchResults" value="搜索" oncomplete="loadPage();" styleClass="wrapper" >
                                </apex:commandbutton>
                            </span>
                        </apex:outputpanel>
 
                        <!-- 表格列+分页按钮列  一同刷新 精琢技术 wql 2021/04/01  -->
                        <apex:outputpanel id="pnlSearchResults" layout="block" style="margin:10px;height:350px;overflow-Y:auto;">
                            <!-- table 表格列  精琢技术 wql 2021/04/01 start-->
 
                            <apex:pageblock id="searchResults">
                                
                                <!-- PleaseJudge 下次调用时,需判断 -->
                                <apex:outputpanel rendered="{!IF(SObjectName == 'ModelLendingProduct__c', true, false)}">
                                    <apex:pageblocktable id="tblResults" value="{!ModelCode}" var="a">
                                        <apex:column >
                                            <apex:facet name="header">
                                                <apex:outputpanel >
                                                    备品配套明细型号
                                                </apex:outputpanel>
                                            </apex:facet>
                                            <apex:outputlink value="{!a.Lid}" onclick="setParentList('{!a.Lid}','{!a.LName}','{!a.id}');return false;">
                                                {!a.Name}
                                            </apex:outputlink>
                                        </apex:column>
                                    </apex:pageblocktable>
                                </apex:outputpanel>
                                <!-- PleaseJudge 下次调用时,需判断 -->
                                <apex:outputpanel rendered="{!IF(SObjectName == 'ModelLendingProduct__c', false, true)}">
                                     <apex:pageblocktable id="tblResults2" value="{!ModelCode}" var="a">
                                        <apex:column >
                                            <apex:facet name="header">
                                                <apex:outputpanel >
                                                    ID
                                                </apex:outputpanel>
                                            </apex:facet>
                                            <apex:outputlink value="{!a.id}" onclick="">
                                                {!a.id}
                                            </apex:outputlink>
                                        </apex:column>
                                        <apex:column >
                                            <apex:facet name="header">
                                                <apex:outputpanel >
                                                    Name
                                                </apex:outputpanel>
                                            </apex:facet>
                                            <apex:outputlink value="{!a.name}" onclick="">
                                                {!a.name}
                                            </apex:outputlink>
                                        </apex:column>
                                    </apex:pageblocktable>
                                </apex:outputpanel>
                            </apex:pageblock>
                            <!-- table 表格列  精琢技术 wql 2021/04/01 end-->
 
                            <!-- table 分页按钮列  精琢技术 wql 2021/04/01 start-->
                            <!-- 首页 -->
                            <apex:commandbutton action="{!FirstPage}" disabled="{!prev}" rerender="pnlSearchResults" value="首页" id="FirstPage" styleClass="wrapper" oncomplete="removeButtonStyle()">
                            </apex:commandbutton>
                            <!-- 上一页 -->
                            <apex:commandbutton action="{!previous}" disabled="{!prev}" rerender="pnlSearchResults" value="上一页" id="previous" styleClass="wrapper" oncomplete="removeButtonStyle()">
                            </apex:commandbutton>
                            当前页/总页数 {!pageNumber} of {!totalPages}
                            <!-- 下一页 -->
                            <apex:commandbutton action="{!next}" disabled="{!nxt}" rerender="pnlSearchResults" status="Status" value="下一页" id="next" styleClass="wrapper" oncomplete="removeButtonStyle()">
                            </apex:commandbutton>
                            <!-- 尾页 -->
                            <apex:commandbutton action="{!LastPage}" disabled="{!nxt}" rerender="pnlSearchResults" value="尾页" id="LastPage" styleClass="wrapper" oncomplete="removeButtonStyle()">
                            </apex:commandbutton>
                            <!-- table 分页按钮列  精琢技术 wql 2021/04/01 end-->
 
                        </apex:outputpanel>
                    </apex:actionregion>
                </apex:tab>
            </apex:tabpanel>
        </apex:outputpanel>
    </apex:form>
    <script type="text/javascript">
        //初始化去掉默认按钮样式
        function removeButtonStyle(){
            //去掉上方 模型出借型号 样式
            if(j$(escapeVfId('pg:formId:tabOne_lbl'))[0]){
                j$(escapeVfId('pg:formId:tabOne_lbl'))[0].classList.remove("rich-tab-header");
                j$(escapeVfId('pg:formId:tabOne_lbl'))[0].classList.remove("rich-tab-active");
                j$(escapeVfId('pg:formId:tabOne_lbl'))[0].style.backgroundColor = "#f1f1f1";
            }
            //去掉上方 清空 样式
 
            if(j$(escapeVfId('pg:formId:btnGoClear'))[0]){
                j$(escapeVfId('pg:formId:btnGoClear'))[0].classList.remove("btn");
            }
            //去掉 搜索按钮
            if(j$(escapeVfId('pg:formId:btnGo'))[0]){
                j$(escapeVfId('pg:formId:btnGo'))[0].classList.remove("btn");
            }
            //首页
            //先判断是否有该元素
            if(j$(escapeVfId('pg:formId:FirstPage'))[0]){
                //如果按钮是disabled 则去掉默认样式 添加新的disabled样式
                if(j$(escapeVfId('pg:formId:FirstPage'))[0].className.indexOf('btnDisabled')==0){
                    j$(escapeVfId('pg:formId:FirstPage'))[0].classList.remove("btnDisabled");
                    j$(escapeVfId('pg:formId:FirstPage'))[0].classList.add("buttonDisabled");
                    j$(escapeVfId('pg:formId:FirstPage'))[0].classList.remove("wrapper");
                    j$(escapeVfId('pg:formId:FirstPage'))[0].classList.add("wrapperPage");
 
                }
                //如果按钮不是disabled 则去掉默认样式 添加新的disabled样式
                if(j$(escapeVfId('pg:formId:FirstPage'))[0].className.indexOf('btn')==0){
                    j$(escapeVfId('pg:formId:FirstPage'))[0].classList.remove("btn");
                }  
 
            }
            //上一页
            if(j$(escapeVfId('pg:formId:previous'))[0]){
                //如果按钮是disabled 则去掉默认样式 添加新的disabled样式
                if(j$(escapeVfId('pg:formId:previous'))[0].className.indexOf('btnDisabled')==0){
                    j$(escapeVfId('pg:formId:previous'))[0].classList.remove("btnDisabled");
                    j$(escapeVfId('pg:formId:previous'))[0].classList.add("buttonDisabled");
                    j$(escapeVfId('pg:formId:previous'))[0].classList.remove("wrapper");
                    j$(escapeVfId('pg:formId:previous'))[0].classList.add("wrapperPage");
                }
                //如果按钮不是disabled 则去掉默认样式 添加新的disabled样式
                if(j$(escapeVfId('pg:formId:previous'))[0].className.indexOf('btn')==0){
                    j$(escapeVfId('pg:formId:previous'))[0].classList.remove("btn");
                }  
            }
            //下一页
            if(j$(escapeVfId('pg:formId:next'))[0]){
                //如果按钮是disabled 则去掉默认样式 添加新的disabled样式
                if(j$(escapeVfId('pg:formId:next'))[0].className.indexOf('btnDisabled')==0){
                    j$(escapeVfId('pg:formId:next'))[0].classList.remove("btnDisabled");
                    j$(escapeVfId('pg:formId:next'))[0].classList.add("buttonDisabled");
                    j$(escapeVfId('pg:formId:next'))[0].classList.remove("wrapper");
                    j$(escapeVfId('pg:formId:next'))[0].classList.add("wrapperPage");
                }
                //如果按钮不是disabled 则去掉默认样式 添加新的disabled样式
                if(j$(escapeVfId('pg:formId:next'))[0].className.indexOf('btn')==0){
                    j$(escapeVfId('pg:formId:next'))[0].classList.remove("btn");
                }  
            }
            //尾页
            if(j$(escapeVfId('pg:formId:LastPage'))[0]){
                //如果按钮是disabled 则去掉默认样式 添加新的disabled样式
                if(j$(escapeVfId('pg:formId:LastPage'))[0].className.indexOf('btnDisabled')==0){
                    j$(escapeVfId('pg:formId:LastPage'))[0].classList.remove("btnDisabled");
                    j$(escapeVfId('pg:formId:LastPage'))[0].classList.add("buttonDisabled");
                    j$(escapeVfId('pg:formId:LastPage'))[0].classList.remove("wrapper");
                    j$(escapeVfId('pg:formId:LastPage'))[0].classList.add("wrapperPage");
                }
                //如果按钮不是disabled 则去掉默认样式 添加新的disabled样式
                if(j$(escapeVfId('pg:formId:LastPage'))[0].className.indexOf('btn')==0){
                    j$(escapeVfId('pg:formId:LastPage'))[0].classList.remove("btn");
                }  
            }
        }
 
        //点击行项目 带值到父页面
        function setParentList(id,name,modelId){
            //赋值到无报告页面
            if(window.opener.j$(escapeVfId("allPage:allForm:allBlock:tableListQ:SectionItem1:ModelLendingProductCode"))){
                 window.opener.j$(escapeVfId("allPage:allForm:allBlock:tableListQ:SectionItem1:ModelLendingProductCode")).val(name);
            }
            //赋值到无报告页面
            if(window.opener.j$(escapeVfId("allPage:allForm:allBlock:tableListQ:SectionItem1:ModelLendingProductCodeId"))){
                window.opener.j$(escapeVfId("allPage:allForm:allBlock:tableListQ:SectionItem1:ModelLendingProductCodeId")).val(id);
            }
            
            //赋值到无报告页面
            if(window.opener.j$(escapeVfId("allPage:allForm:allBlock:tableListQ:SectionItem1:ModelLendingCodeId"))){
                window.opener.j$(escapeVfId("allPage:allForm:allBlock:tableListQ:SectionItem1:ModelLendingCodeId")).val(modelId);
            }
 
            window.close();
        }
        //初始化去掉默认样式
        removeButtonStyle();
    </script>
</apex:page>