高章伟
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
<apex:page Controller="ConsumReassignController" 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)}"/>
<apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }" />
<script src="../../soap/ajax/53.0/connection.js" type="text/javascript"></script>
<style>
    .decrypt {
        position: absolute;
        top: 0;
        left: 100%;
        display: none;
        text-align: left;
        padding-left: 5px;
    }
 
    a:hover .decrypt {
        display: block;
        width: 100px
    }
</style>
<script type="text/javascript">
    function savejs() {
        if (confirm('是否操作重新分配?')) {
            blockme();
            saveBtn();
        }
    }
    function checkAll(checker) {
        var checkList = document.getElementsByClassName("checker");
        Array.prototype.filter.call(checkList, function(testElement){
            testElement.checked = checker.checked;
        });
        //     j$(escapeVfId('Page:Form:headBlock:postRepeat:' + i + ':post'))[0].checked = checker.checked;
    }
    function returnjs() {
        var rentalApplyId = j$(escapeVfId('allPage:allForm:allBlock:rentalApplyId')).text();
        var url = "/" + rentalApplyId;
        window.location.href = url;
    }
    function refresh() {
        var hasError = j$(escapeVfId('allPage:allForm:allBlock:hasError')).text();
        if (hasError == 'false') {
            alert('保存成功');
            returnjs();
        }
    }
 
    AWSService.sfSessionId = '{!GETSESSIONID()}';
    var staticResource = JSON.parse('{!staticResource}');
 
    document.body.onload = function () {
        blockme();
        DecryptContactName(() => unblockUI());
    }
    var awsdata_map = {};
 
    function DecryptContactName(callback) {
 
        let no_in_ids = [];
        j$("[aws-data-id]").each(function (i, e) {
            let id = e.getAttribute("aws-data-id");
            if (!(id && awsdata_map.hasOwnProperty(id))) {
                no_in_ids.push(id);
            }
        });
        if (no_in_ids.length > 0) {
            AWSService.search(staticResource.searchUrl, JSON.stringify({
                "dataIds": no_in_ids
            }), function (data) {
                if (data.object && data.object.length > 0) {
                    for (let d of data.object) {
                        if (d.dataId) {
                            awsdata_map[d.dataId] = d;
                        }
                    }
                }
                BindToTile();
                if (callback) callback();
            }, staticResource.token);
        }
        else {
            BindToTile();
            if (callback) callback();
        }
    }
 
    function BindToTile() {
        j$("[aws-data-id]").each(function (i, e) {
            let id = e.getAttribute("aws-data-id");
            if (id && awsdata_map.hasOwnProperty(id) && awsdata_map[id].trialUser) {
                j$(e).find(".decrypt").html(awsdata_map[id].trialUser);
            }
        });
    }
</script>
 
    <apex:form id="allForm">
        <apex:actionFunction name="saveBtn" action="{!saveBtn}" rerender="allBlock,message" onComplete="unblockUI();refresh();">
        </apex:actionFunction>
        <apex:outputPanel id="allPanel">
            <apex:pageBlock title="重新分配" id="allBlock">
                <apex:pageBlockButtons >
                    <apex:commandButton onclick="savejs(); return false;" value="保存" disabled="{!saveBtn}" rerender="dummy" />
                    <apex:commandButton onclick="returnjs(); return false;" value="返回" rerender="dummy"/>
                </apex:pageBlockButtons>
 
                <apex:outputPanel id="message">
                    <apex:pageMessages />
                </apex:outputPanel>
 
                <apex:outputText id="hasError" value="{!hasError}" style="display:none"/>
                <apex:outputText id="rentalApplyId" value="{!rentalApplyId}" style="display:none"/>
 
                <table class="linetable" border="1" style="border-collapse: collapse;width: 750px;">
                    <colgroup>
                        <col width="25"/>
                        <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">全选
                            <apex:inputCheckbox id="checkAll" value="{!checkAll}" onclick="checkAll(this);" />
                        </th>
                        <th style="text-align:center">{!$ObjectType.Consum_Apply_Equipment_Set_Detail__c.fields.Consum_Apply_Equipment_Set__c.label}</th>
                        <th style="text-align:center">{!$ObjectType.Consum_Apply_Equipment_Set_Detail__c.fields.Fixture_Model_No_F__c.label}</th>
                        <th style="text-align:center">数量</th>
                        <th style="text-align:center">{!$ObjectType.Consum_Apply_Equipment_Set_Detail__c.fields.Asset__c.label}</th>
                        <th style="text-align:center">{!$ObjectType.Consum_Apply_Equipment_Set_Detail__c.fields.SerialNumber_F__c.label}</th>
                        <th style="text-align:center">{!$ObjectType.Consum_Apply_Equipment_Set_Detail__c.fields.RAESD_Status__c.label}</th>
                        <th style="text-align:center">{!$ObjectType.Consum_Apply_Equipment_Set_Detail__c.fields.Trial_User__c.label}</th>
                        <th style="text-align:center">{!$ObjectType.Consum_Apply_Equipment_Set_Detail__c.fields.Degree_Of_Importance__c.label}</th>
                    </tr>
                    <apex:repeat value="{!lineInfoList}" var="info" id="records">
                        <tr>
                            <!--<td align="center"><apex:inputCheckbox value="{!info.isSelect}" id="rowCheck" disabled="{!IF(info.status=='cantCancel', true, false)}"/></td>-->
                            <td align="center">
                                <apex:inputCheckbox styleClass="checker" value="{!info.isSelect}" id="rowCheck" />
                            </td>
                            <td align="left">
                                <apex:outputField value="{!info.caesd.Consum_Apply_Equipment_Set__c}"></apex:outputField>
                            </td>
                            <td align="left">
                                <apex:outputField value="{!info.caesd.Fixture_Model_No_F__c}"></apex:outputField>
                            </td>
                            <td align="left">
                                <apex:outputField value="{!info.caesd.Trial_Num__c}"></apex:outputField>
                            </td>
                            <td align="left">
                                <apex:outputField value="{!info.caesd.Asset__c}"></apex:outputField>
                            </td>
                            <td align="left">
                                <apex:outputField value="{!info.caesd.SerialNumber_F__c}"></apex:outputField>
                            </td>
                            <td align="center">
                                <apex:outputField value="{!info.caesd.RAESD_Status__c}"></apex:outputField>
                            </td>
                            <td align="center">
                                <a style="position: relative" href="/{!info.caesd.Id}" aws-data-id="{!info.caesd.AWS_Data_Id__c}" title="">
                                    <span>{!info.caesd.Trial_User__c}</span>
                                    <span class="decrypt"></span>
                                </a>
                                <!-- <apex:outputField value="{!info.caesd.Trial_User__c}"></apex:outputField> -->
                            </td>
                            <td align="center">
                                <apex:outputField value="{!info.caesd.Degree_Of_Importance__c}"></apex:outputField>
                            </td>
                        </tr>
                    </apex:repeat>
                </table>
            </apex:pageBlock>
        </apex:outputPanel>
    </apex:form>
</apex:page>