高章伟
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
<apex:page Controller="InventoryLostReportController" showHeader="false" sidebar="false" id="allPage" action="{!init}" title="盘亏一览">
<apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
<apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
<apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
<script type="text/javascript">
function savejs() {
    if (confirm('是否保存遗失报告?')) {
        blockme();
        saveBtn();
    }
}
function returnjs() {
    var lhId = j$(escapeVfId('allPage:allForm:allBlock:lhId')).text();
    var url = "/" + lhId;
    window.location.href = url;
}
function return1js() {
    var lhId = j$(escapeVfId('allPage:allForm:allBlock:lrId')).text();
    var url = "/" + lhId;
    window.open(url);
    window.location.href = "/apex/InventoryLostReport?lhid={!lhId}&alertInfo="+encodeURI(j$(escapeVfId('allPage:allForm:allBlock:alertInfo')).text());
}
function refresh() {
    var hasError = j$(escapeVfId('allPage:allForm:allBlock:hasError')).text();
    if (hasError == 'false') {
        return1js();
    }
}
function checkAll() {
    var recCount = document.getElementById('allPage:allForm:EquipmentSetCnt').value;
    if (j$(escapeVfId('checker')).attr('checked') == 'checked') {
        for (var i = 0; i < recCount; i++) {
            var disabled = j$(escapeVfId('allPage:allForm:allBlock:records:' + i + ':rowCheck')).prop('disabled');
            if (disabled == false) {
                j$(escapeVfId('allPage:allForm:allBlock:records:' + i + ':rowCheck')).attr('checked',true);
            }
        }
    } else {
        for (var i = 0; i < recCount; i++) {
            var disabled = j$(escapeVfId('allPage:allForm:allBlock:records:' + i + ':rowCheck')).prop('disabled');
            if (disabled == false) {
                j$(escapeVfId('allPage:allForm:allBlock:records:' + i + ':rowCheck')).attr('checked',false);
            }
        }
    }
}
function sortTableJs(key) {
  // blockme();
  sortTablefunc(key);
}
</script>
    <apex:form id="allForm">
<!--         <apex:actionFunction name="saveBtn1" action="{!saveBtn1}" rerender="allBlock" onComplete="unblockUI();refresh();">
            <apex:param name="raesdId" value=""/>
        </apex:actionFunction> -->
        <apex:actionFunction name="sortTablefunc" action="{!sortTable}" rerender="allBlock" status="statusPreload" onComplete="unblockUI();">
            <apex:param name="psortKey" value="" />
        </apex:actionFunction>
        <apex:inputHidden id="EquipmentSetCnt" value="{!EquipmentSetCnt}"/>
        <apex:outputPanel id="allPanel">
            <apex:pageBlock title="盘亏一览" id="allBlock">
                <apex:pageBlockButtons >
                    <!-- <apex:commandButton onclick="savejs(); return false;" value="保存" disabled="{!saveBtn}" rerender="dummy"/> -->
                    <apex:actionFunction name="saveBtn" action="{!saveBtn}" rerender="allBlock" onComplete="unblockUI();refresh();"/>
                    <apex:commandButton onclick="returnjs(); return false;" value="返回" rerender="dummy"/>
                    <apex:commandButton onclick="savejs(); return false;" disabled="{!canSave == false}" rerender="allBlock" value="保存遗失报告" oncomplete="unblockUI();refresh();"/>
                </apex:pageBlockButtons>
                <apex:outputPanel id="message">
                    <apex:pageMessages />
                </apex:outputPanel>
                <apex:outputText id="hasError" value="{!hasError}" style="display:none"/>
                <apex:outputText id="lhId" value="{!lhId}" style="display:none"/>
                <apex:outputText id="lrId" value="{!lrId}" style="display:none"/>
                <apex:outputText id="alertInfo" value="{!alertInfo}" style="display:none"/>
                <apex:pageBlockSection >
                    <apex:pageBlockSectionItem >
                        <apex:outputLabel style="font-size: 15px;" value="{!$ObjectType.Inventory_Header__c.fields.Name.label}" for="Name"/>
                        <apex:outputField style="font-size: 15px;" value="{!lh.Name}" id="Name"/>
                    </apex:pageBlockSectionItem>
                </apex:pageBlockSection>
                <table class="linetable" border="1" style="border-collapse: collapse;">
                    <colgroup>
                        <col width="25"/>
                        <col width="25"/>
                        <col width="110"/>
                        <col width="50"/>
                        <col width="50"/>
                        <col width="110"/>
                        <col width="110"/>
                        <col width="110"/>
                        <col width="110"/>
                        <col width="110"/>
                        <col width="110"/>
                        <!-- <col width="175"/> -->
                    </colgroup>
                    <tr style="background-color:#DCDCDC;">
                        <!-- <th style="text-align:center">&nbsp;</th> -->
                        <th style="text-align:center"> <input type='checkbox' onClick='checkAll()' id='checker'/></th>
                        <apex:variable value="{!0}" var="index"/>
                        <apex:repeat value="{!titleList}" var="title">
                            <th style="text-align:center">
                                <a href="#" name="out_Div_a" onclick="sortTableJs('{!index}');return false;" style="text-decoration: underline;">
                                    {!sortOrder[index]}{!title}
                                </a>
                            </th>
                            <apex:variable var="index" value="{!index + 1}"/>
                        </apex:repeat>
                        <!-- <th style="text-align:center">
                            <a href="#" name="out_Div_a" onclick="sortTableJs('0');return false;" style="text-decoration: underline;">
                                {!sortOrder[0] + $ObjectType.Inventory_Detail__c.fields.Name.label}
                            </a>
                        </th>
                        <th style="text-align:center">
                            <a href="#" name="out_Div_a" onclick="sortTableJs('1');return false;" style="text-decoration: underline;">
                                {!sortOrder[1] + $ObjectType.Inventory_Detail__c.fields.LostReport_Detail__c.label}
                            </a>
                        </th> 
                        <th style="text-align:center">
                            <a href="#" name="out_Div_a" onclick="sortTableJs('2');return false;" style="text-decoration: underline;">
                                {!sortOrder[2] + $ObjectType.Inventory_Detail__c.fields.Fixture_Model_No__c.label}
                            </a>
                        </th>
                        <th style="text-align:center">
                            <a href="#" name="out_Div_a" onclick="sortTableJs('3');return false;" style="text-decoration: underline;">
                                {!sortOrder[3] + $ObjectType.Inventory_Detail__c.fields.Amount__c.label}
                            </a>
                        </th>
                        <th style="text-align:center">
                            <a href="#" name="out_Div_a" onclick="sortTableJs('4');return false;" style="text-decoration: underline;">
                                {!sortOrder[4] + $ObjectType.Inventory_Detail__c.fields.Inventory_Count__c.label}
                            </a>
                        </th>
                        <th style="text-align:center">
                            <a href="#" name="out_Div_a" onclick="sortTableJs('5');return false;" style="text-decoration: underline;">
                                {!sortOrder[5] + $ObjectType.Inventory_Detail__c.fields.Inventory_Deviation__c.label}
                            </a>
                        </th> -->
                        <!-- <th style="text-align:center">{!$ObjectType.LostReport__c.label}{!$ObjectType.LostReport__c.fields.Report_Type__c.label}</th> --> <!-- 遗失报告审批状态 -->
                        <!-- <th style="text-align:center">确认丢失</th> -->
                    </tr>
                    <apex:repeat value="{!lineInfoList}" var="info" id="records">
                        <tr>
                            <td align="center"><apex:inputCheckbox disabled="{!info.checkboxDis}" value="{!info.isSelect}" id="rowCheck"/></td>
                                <apex:repeat value="{!columnsApi}" var="c">
                                    <td align="left">
                                        <apex:outputPanel rendered="{!(c.size==2 && info.ldObject[c[0]] != null)}" layout="none">
                                            <apex:outputField value="{!info.ldObject[c[0]][c[1]]}"/>
                                        </apex:outputPanel>
                                        <apex:outputPanel rendered="{!(c.size==1 && info.ldObject[c[0]] != null && (c[0] != 'DeleteLostReport_Detail_Reason__c' || info.checkboxDis == true))}" layout="none">
                                            <apex:outputField value="{!info.ldObject[c[0]]}"/>
                                        </apex:outputPanel>
                                         <apex:outputPanel rendered="{!(c.size==1 && c[0] == 'DeleteLostReport_Detail_Reason__c' && info.checkboxDis == false)}" layout="none">
                                            <apex:inputField value="{!info.ldObject[c[0]]}"/>
                                        </apex:outputPanel>
                                    </td>
                            </apex:repeat>
                           <!--  <td align="left"><apex:outputText value="{!info.ldObject.Name}"></apex:outputText></td>
                            <td align="center"><apex:outputField value="{!info.ldObject.LostReport_Detail__c}"></apex:outputField></td>
                            <td align="center"><apex:outputField value="{!info.ldObject.Fixture_Model_No__c}"></apex:outputField></td>
                            <td align="center"><apex:outputField value="{!info.ldObject.Amount__c}"></apex:outputField></td>
                            <td align="center"><apex:outputField value="{!info.ldObject.Inventory_Count__c}"></apex:outputField></td>
                            <td align="center"><apex:outputField value="{!info.ldObject.Inventory_Deviation__c}"></apex:outputField></td> -->
                            <!-- <td align="center"><apex:outputField value="{!info.raesd.LostReport_Detail__r.LostReport__r.Report_Type__c}"></apex:outputField></td> -->
                            <!-- <td align="center"><apex:commandButton onclick="savejs('{!info.raesd.Id}');" value="确认丢失" disabled="{!info.haveConfirm_Lost_Date}" rerender="dummy"/></td> -->
                        </tr>
                    </apex:repeat>
                </table>
            </apex:pageBlock>
        </apex:outputPanel>
    </apex:form>
</apex:page>