高章伟
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
<apex:page controller="RentalApplyMultiPostponeController"  action="{!init}"  showHeader="false"   sidebar="true" id="allPage"  title="批量延期">
    <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
    <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
    <apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
    <apex:includeScript value="{!URLFOR($Resource.CommonUtilJs)}"/>
    <script type="text/javascript">
        //onload 的方法
        window.onload = function(){
 
        }
        //保存按钮
        function searchBtnJs(){
            var checkId = '';
            //获取勾选的值
            var lawtable = document.getElementById("tableHeader_L");//获取id为tableHeader_L的table
            var rows = lawtable.rows;//获取所有行 
            if(rows != null && rows.length > 1){
                for(var i=1; i < rows.length; i++){
                    var row = rows[i].cells[0].getElementsByTagName("input")[0];
                    if(row.checked){
                        //value的值为 canCheck 证明此条申请单是可以延期的
                        if(row.value == 'canCheck' && row.id != null && row.id != ''){
                            if(checkId == ''){
                                checkId = row.id;
                            }else{
                                checkId += ','+row.id;
                            }
                        }
                    }
                }
            }
            if(checkId == ''){
                alert('至少必须勾选一个申请单。');
                return false;
            }else{
                //跳转到具体延期画面(原延期页面)
                window.open("/apex/RentalApplyExtensions?parentId="+checkId+'&entranceId={!parentId}');
            }
        }
        //返回按钮
        function sendBackJs(){
            senBackPage();
        }
        //全选
        function checkAll(){
            var lawtable = document.getElementById("tableHeader_L");//获取id为tableHeader_L的table
            var rows = lawtable.rows;//获取所有行 
            if(rows != null && rows.length > 1){
                //判断是需要把所有的勾选上还是全部去掉勾选
                var trueOrfalse = rows[0].cells[0].getElementsByTagName("input")[0].checked == false?false:true;
                for(var i=0; i < rows.length; i++){
                    //判断是否可以勾选,备品状态:取消,删除,已延期,不可以勾选
                    if(!rows[i].cells[0].getElementsByTagName("input")[0].disabled){
                        rows[i].cells[0].getElementsByTagName("input")[0].checked = trueOrfalse;
                    }
                }
            }
        }
    </script>
    <apex:form id="allForm">
        <!-- 返回父页面 -->
        <apex:actionFunction name="senBackPage" action="{!senBackPage}" rerender="true" onComplete="unblockUI();"></apex:actionFunction>
        <apex:pageBlock id="searchBlock" tabStyle="Report">
            <table style="border-bottom-width: 0px; font-size:12px;width:100%;margin-left: 40%;">
                <tr>
                    <td style="width: 20%">
                        <apex:commandButton onclick="searchBtnJs();return false;"  rendered="true" value="下一步" style="width:70px;"/>
                        &nbsp;&nbsp;
                        <apex:commandButton onclick="sendBackJs();return false;"  rendered="true" value="返回" style="width:60px;"/>
                    </td>
                </tr>
            </table>
        </apex:pageBlock>
        <apex:pageBlock id="oppBlock1" tabStyle="Report">
            <apex:pageblocksection title="选择延期申请单" id="edmpdDetails" rendered="true" columns="1" >
                <apex:outputPanel rendered="{!IF(tableData.size > 0, true, false)}">
                    <table class="list" style="border-bottom-width: 0px; font-size:11px; border-spacing:0;" border="" id="tableHeader_L" >
                        <thead>
                            <tr class="headerRow" height="30px"  align="center">
                                <!--标题 -->
                                <td style="">
                                    <input  type="checkbox"  class="rowchkcls" onchange="checkAll()" />
                                </td>
                                <td style="">申请单No.</td>
                                <td style="">使用目的2</td>
                                <td style="">最新预定归还日</td>
                                <td style="">科室</td>
                                <td style="">分单理由</td>
                                <td style="">备品借出状态</td>
                            </tr>
                        </thead>
                        <tbody>
                            <apex:variable value="{!0}" var="cnt" />
                            <apex:repeat value="{!tableData}" var="or" id="oppTable">
                                <tr class="dataRow {!IF(MOD(cnt, 2)==0, 'odd', 'even')} {!IF(cnt==1, 'first', '')}" onmouseover="if (window.hiOn){hiOn(this);} " onmouseout="if (window.hiOff){hiOff(this);} "  onblur="if (window.hiOff){hiOff(this);}" onfocus="if (window.hiOn){hiOn(this);}" >
                                    <td align="center" style="vertical-align: inherit;width:25px;border-width: 0px 1px 1px 0px;" >
                                        <apex:outputPanel rendered="{!if( or.canCheck , 'true','false')}" > 
                                            <input type="checkbox" value="canCheck" id="{!or.rentalApplyTable.Id}" class="rowchkcls" />
                                        </apex:outputPanel>
                                        <apex:outputPanel rendered="{!if( or.canCheck , 'false','true')}" > 
                                            <input type="checkbox" value="canNotCheck" id="{!or.rentalApplyTable.Id}" class="rowchkcls" disabled="disabled" />
                                        </apex:outputPanel>
                                    </td>
                                    <td align="center" style="vertical-align: inherit;border-width: 0px 1px 1px 0px;">
                                        <a href="/{!or.rentalApplyTable.id}" target="LINK_a0u1m000000qwTuAAI">
                                            <span id="allPage:allForm:cmpid:cmpinnerid:dataBlock:oppTable_L:0:j_id109:0:j_id114">{!or.rentalApplyTable.name}</span>
                                        </a>
                                    </td>
                                    <td align="center" style="vertical-align: inherit;border-width: 0px 1px 1px 0px;">
                                        <apex:outputText value="{!or.rentalApplyTable.demo_purpose2__c}" />
                                    </td>
                                    <td align="center"  style="vertical-align: inherit;border-width: 0px 1px 1px 0px;">
                                        <apex:outputField value="{!or.rentalApplyTable.Return_dadeline_final__c}" />
                                    </td>
                                    <td align="center"  style="vertical-align: inherit;border-width: 0px 1px 1px 0px;">
                                        <apex:outputText value="{!or.rentalApplyTable.Account__r.Name}" />
                                    </td>
                                    <td align="center"  style="vertical-align: inherit;border-width: 0px 1px 1px 0px;">
                                        <apex:outputText value="{!or.rentalApplyTable.Split_Apply_Reason__c}" />
                                    </td>
                                    <td align="center"  style="vertical-align: inherit;border-width: 0px 1px 1px 0px;">
                                        <apex:outputText value="{!or.rentalApplyTable.RA_Status__c}" />
                                    </td>
                                </tr>
                            <apex:variable value="{!cnt + 1}" var="cnt" />
                            </apex:repeat>
                        </tbody>
                    </table>
                </apex:outputPanel>
                <apex:outputPanel rendered="{!IF(tableData.size > 0, false, true)}">
                    <font style="color:red;font-size: 14px;">无任何申请单满足延期</font>
                </apex:outputPanel>
            </apex:pageblocksection>
        </apex:pageBlock>
    </apex:form>
</apex:page>