高章伟
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
<apex:page controller="ServiceMaintenanceTaskController"  showHeader="false" sidebar="true" lightningStylesheets="true" id="allPage"  >
    <apex:slds />
    <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
    <apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
    <apex:includeScript value="{!URLFOR($Resource.CommonUtilJs)}"/>
    <apex:includeScript value="/soap/ajax/29.0/connection.js"/>
    <apex:includeScript value="/soap/ajax/29.0/apex.js"/>
    <apex:includeScript value="{!URLFOR($Resource.jquerysuggestjs)}"/>
 
    <apex:outputPanel id="checEventFrame">
        <script>
            function selectAll() {
                var count = {!pagesize};
                if (j$(escapeVfId('allPage:allForm:mcListview:allCheckbox')).attr('checked') == 'checked') {
                    for (var i = 0; i < count; i++) {
                        j$(escapeVfId('allPage:allForm:mcListview:' + i + ':rowCheckbox')).prop('checked',true);
                    }
                } else {
                    for (var i = 0; i < count; i++) {
                        j$(escapeVfId('allPage:allForm:mcListview:' + i + ':rowCheckbox')).prop('checked',false);
                    }
                }
            }
            function assignTask(){
                var count = {!pagesize};
                var mcIds = '';
                for (var i = 0; i < count; i++) {
                    if(j$(escapeVfId('allPage:allForm:mcListview:' + i + ':rowCheckbox')).attr('checked') == 'checked'){
                        mcIds+=j$(escapeVfId('allPage:allForm:mcListview:' + i + ':mcId')).value() +',';
                    }
                }
                assignTasks(mcIds);
                
            }
            function exportALL(){
                exportAll();
            }
            function exportSelected(){
                var count = {!pagesize};
                var mcIds = '';
                for (var i = 0; i < count; i++) {
                    if(j$(escapeVfId('allPage:allForm:mcListview:' + i + ':rowCheckbox')).attr('checked') == 'checked'){
                        mcIds+=j$(escapeVfId('allPage:allForm:mcListview:' + i + ':mcId')).value() +',';
                    }
                }
                exportSelect(mcIds);
            }
            function refreshPageSizeJs() {
                refreshPageSize();
            }
        </script>
    </apex:outputPanel>
    <apex:outputPanel rendered="{!!isShowDetail}" > 无访问权限 </apex:outputPanel>
    <apex:form id="allForm" rendered="{!isShowDetail}">
        <apex:pagemessages ></apex:pagemessages>
        <apex:actionFunction name="assignTasks" action="{!assignTasks}" rerender="allForm">
            <apex:param name="firstParam" assignTo="{!mcIdList}" value=""></apex:param>
        </apex:actionFunction>
        <apex:actionFunction name="exportAll" action="{!exportAll}" ></apex:actionFunction>
        <apex:actionFunction name="exportSelect" action="{!exportSelected}" rerender="allPage" oncomplete="toPage()">
            <apex:param name="exportIds" assignTo="{!exportIdList}" value=""></apex:param>
        </apex:actionFunction>
        <apex:actionFunction name="toPage" action="{!ToPage}" ></apex:actionFunction>
        <apex:actionFunction name="refreshPageSize" action="{!refreshPageSize}" status="fetchStatus" reRender="allForm"/>
 
        <div style="background-color:#ffffff; padding:0.5rem;">
            <button class="slds-button slds-button_neutral" onclick="exportALL();return false;" id="export">
                <svg class="slds-button__icon slds-button__icon_left" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
                    <use xlink:href="/apexpages/slds/latest/assets/icons/utility-sprite/svg/symbols.svg#download"></use>
                </svg>导出全部
            </button>
            <button class="slds-button slds-button_neutral" onclick="exportSelected();return false;" id="exportbutt">
                <svg class="slds-button__icon slds-button__icon_left" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
                    <use xlink:href="/apexpages/slds/latest/assets/icons/utility-sprite/svg/symbols.svg#download"></use>
                </svg>导出选中
            </button>
        </div>
 
        <div style="width:100%; overflow :scroll; height: 560px;">
            <apex:dataTable value="{!pageRecords}" var="mcTask" styleClass="slds-table slds-table_cell-buffer slds-table_bordered slds-table_col-bordered" id="mcListview" style="max-height: 580px;">
                <apex:column >
                    <apex:facet name="header"><apex:inputCheckbox onClick="selectAll()" id="allCheckbox" /></apex:facet>
                    <apex:inputCheckbox id="rowCheckbox" />
                    <apex:inputHidden id="mcId" value="{!mcTask.MC.Id}" />
                </apex:column>
 
                <apex:column value="{!mcTask.MC.Management_Code__c}"  >
                    <apex:facet name="header">合同询价编码</apex:facet>
                </apex:column>
                <apex:column value="{!mcTask.MC.Hospital__c}"  >
                    <apex:facet name="header">医院</apex:facet>
                </apex:column>
                <apex:column value="{!mcTask.MC.Department__c}"  >
                    <apex:facet name="header">科室</apex:facet>
                </apex:column>
                <apex:column value="{!mcTask.MC.Service_Contract_Staff__c}"  >
                    <apex:facet name="header">主担当</apex:facet>
                </apex:column>
                <!-- <apex:column value="{!mcTask.MC.Estimate_Target__c}"  >
                    <apex:facet name="header">报价提交对象</apex:facet>
                </apex:column> -->
                <!-- <apex:column value="{!mcTask.MC.Dealer__c}"  >
                    <apex:facet name="header">经销商名</apex:facet>
                </apex:column> -->
                <apex:column value="{!mcTask.ContractStartDate}"  >
                    <apex:facet name="header">合同开始日</apex:facet>
                </apex:column>
                <apex:column value="{!mcTask.ContractEndDate}"  >
                    <apex:facet name="header">合同结束日</apex:facet>
                </apex:column>
                <apex:column value="{!mcTask.MC.Contract_Amount__c}"  >
                    <apex:facet name="header">最终用户合同金额</apex:facet>
                </apex:column>
                <apex:column value="{!mcTask.EstimatePricerangeF}"  >
                    <apex:facet name="header">价格范围</apex:facet>
                </apex:column>
                <apex:column value="{!mcTask.ServiceDiscountRateF}"  >
                    <apex:facet name="header">相对标准价格范围的折扣率</apex:facet>
                </apex:column>
                <apex:column value="{!mcTask.ContractConsumptionrate}"  >
                    <apex:facet name="header">消费率</apex:facet>
                </apex:column>
                <apex:column value="{!mcTask.EstimateAssetCnt}"  >
                    <apex:facet name="header">报价资产件数</apex:facet>
                </apex:column>
                <apex:column value="{!mcTask.OwnershipMachineNo1}"  >
                    <apex:facet name="header">故障型号1</apex:facet>
                </apex:column>
                <apex:column value="{!mcTask.OwnershipMachineNo2}"  >
                    <apex:facet name="header">故障型号2</apex:facet>
                </apex:column>
                <apex:column value="{!mcTask.OwnershipMachineNo3}"  >
                    <apex:facet name="header">故障型号3</apex:facet>
                </apex:column>
                <apex:column value="{!mcTask.OwnershipMachineNo4}"  >
                    <apex:facet name="header">故障型号4</apex:facet>
                </apex:column>
                <apex:column value="{!mcTask.OwnershipMachineNo5}"  >
                    <apex:facet name="header">故障型号5</apex:facet>
                </apex:column> 
                <apex:column value="{!mcTask.LocationName1}"  >
                    <apex:facet name="header">故障部位1</apex:facet>
                </apex:column>
                <apex:column value="{!mcTask.LocationName2}"  >
                    <apex:facet name="header">故障部位2</apex:facet>
                </apex:column>
                <apex:column value="{!mcTask.LocationName3}"  >
                    <apex:facet name="header">故障部位3</apex:facet>
                </apex:column>
                <apex:column value="{!mcTask.LocationName4}"  >
                    <apex:facet name="header">故障部位4</apex:facet>
                </apex:column>
                <apex:column value="{!mcTask.LocationName5}"  >
                    <apex:facet name="header">故障部位5</apex:facet>
                </apex:column>
                <apex:column value="{!mcTask.LastMContract1}"  >
                    <apex:facet name="header">上期合同1</apex:facet>
                </apex:column>
                <apex:column value="{!mcTask.LastMContract2}"  >
                    <apex:facet name="header">上期合同2</apex:facet>
                </apex:column>
                <apex:column value="{!mcTask.LastMContract3}"  >
                    <apex:facet name="header">上期合同3</apex:facet>
                </apex:column>
                <!-- <apex:column value="{!mcTask.LastMContract4}"  >
                    <apex:facet name="header">上期合同4</apex:facet>
                </apex:column>
                <apex:column value="{!mcTask.LastMContract5}"  >
                    <apex:facet name="header">上期合同5</apex:facet>
                </apex:column> -->
                <apex:column value="{!mcTask.LastMContract1gapTime}"  >
                    <apex:facet name="header">上期合同1空白期</apex:facet>
                </apex:column>
                <apex:column value="{!mcTask.LastMContract2gapTime}"  >
                    <apex:facet name="header">上期合同2空白期</apex:facet>
                </apex:column>
                <apex:column value="{!mcTask.LastMContract3gapTime}"  >
                    <apex:facet name="header">上期合同3空白期</apex:facet>
                </apex:column>
                <!-- <apex:column value="{!mcTask.LastMContract4gapTime}"  >
                    <apex:facet name="header">上期合同4空白期</apex:facet>
                </apex:column> -->
                <apex:column value="{!mcTask.MCTask.Name}"  >
                    <apex:facet name="header">维修合同任务名称</apex:facet>
                </apex:column>
                <apex:column value="{!mcTask.MCTask.Maintenance_Consumption_rate__c}"  >
                    <apex:facet name="header">任务发送时点消费率</apex:facet>
                </apex:column>
                <apex:column value="{!mcTask.MCTask.Task__c}"  >
                    <apex:facet name="header">任务</apex:facet>
                </apex:column>
                <apex:column value="{!mcTask.Task.taskStatus__c}"  >
                    <apex:facet name="header">任务状态</apex:facet>
                </apex:column>
                <apex:column value="{!mcTask.taskHandleDate}"  >
                    <apex:facet name="header">任务确认日</apex:facet>
                </apex:column>
                <apex:column value="{!mcTask.SubmitDate}"  >
                    <apex:facet name="header">日报提交日</apex:facet>
                </apex:column>
                <apex:column value="{!mcTask.Task.cancelReason__c}"  >
                    <apex:facet name="header">取消原因</apex:facet>
                </apex:column>
            </apex:dataTable>
        </div>
        <div style="width:100%;">
            <table style="width: 100%">
                <tr>
                    <td><apex:outputText value="{!(currentpage * pagesize)+1-pagesize}-{!IF((currentpage * pagesize)>mcTaskCount, mcTaskCount,(currentpage * pagesize))} 共 {!mcTaskCount} 个" />  </td>
                    <td align="center">  
                        <div class="paginator line1">
                            <span class="prevNextLinks">
                                <span class="prevNext">
                                    <apex:commandLink status="fetchStatus" reRender="allForm" action="{!moveToFirst}" oncomplete="refreshPageSizeJs();" title="首页" >
                                        <img src="/s.gif" title="首页" alt="首页" class="{!if((hasPrevious),'first','firstoff')}"/>
                                    </apex:commandLink>
                                </span>
                                <span class="prevNext">
                                    <apex:commandLink status="fetchStatus" reRender="allForm"  action="{!moveToPrevious}" oncomplete="refreshPageSizeJs();"  title="上一页">
                                        <img src="/s.gif" title="上一页" alt="上一页" class="{!if((hasPrevious),'prev','prevoff')}"/>上一页
                                    </apex:commandLink>
                                </span>
                                <span class="prevNext">
                                    <apex:commandLink status="fetchStatus" reRender="allForm" action="{!moveToNext}" oncomplete="refreshPageSizeJs();" title="下一页">下一页
                                        <img src="/s.gif" title="下一页" alt="下一页" class="{!if((hasNext),'next','nextoff')}"/>
                                    </apex:commandLink>
                                </span>
                                <span class="prevNext">
                                    <apex:commandLink status="fetchStatus" reRender="allForm" action="{!moveToLast}"  oncomplete="refreshPageSizeJs();" title="尾页">
                                        <img src="/s.gif" title="尾页" alt="尾页" class="{!if((hasNext),'last','lastoff')}"/>
                                    </apex:commandLink>
                                </span>
                            </span>
                        </div>
                    </td> 
                    <td align="right" width="20%">  </td>  
                </tr>
            </table>
        </div>
        <div style="background-color:#ffffff; padding:0.5rem;">
            <button class="slds-button slds-button_outline-brand" onclick="assignTask();return false;" id="assignbut">分配任务</button>
        </div>
    </apex:form>
</apex:page>