高章伟
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
<apex:page id="Page" showHeader="false" sidebar="false" Controller="PersonalEvaluationClipEditController" applyBodyTag="false" applyHtmlTag="false" action="{!init}">
<apex:stylesheet value="{!URLFOR($Resource.PersonalEvaluationCss)}"/>
<apex:includeScript value="{!URLFOR($Resource.SurveyForce, 'jquery.js')}"/>
<script type="text/javascript" src="{!URLFOR($Resource.SurveyForce, 'survey_jui.js')}" ></script>
<script type="text/javascript">
 
(function($) {
    var a = $.ui.mouse.prototype._mouseMove;
    $.ui.mouse.prototype._mouseMove = function(b) {
        if($.browser.msie && document.documentMode >= 9) {
            b.button = 1;
        };
        a.apply(this,[b]);
    }
}(jQuery));
 
$(document).ready(function() {
    $("#justClipList").sortable({ 
        axis: 'y', opacity: .6, tolerance: 'pointer', revert: true,
        update: function(event, ui) { 
            var elemParent = $('#justClipList');
            var childrenList = elemParent.children();
            var childIds = new Array();
            var cIds = "";
            for(var i = 0; i < childrenList.length; i++){
               cIds = cIds + childrenList[i].id + ",";
            }
            
            cIds = cIds.substr(0, cIds.length - 1);
            jQuery("input[id*='newOrderList']").val(cIds);
            jQuery("input[id*='saveOrder1']").effect("pulsate", { times: 2 }, 1000);
            jQuery("input[id*='saveOrder2']").effect("pulsate", { times: 2 }, 1000);
        }
    });
    
    PersonalEvaluationClipEditController.getAttachmentBody('{!sid}', function(res, event) {
    if(event.status) {
        result = res;
        
        if (result['AttCnt'] > 0) {
            for (var i = 1; i <= result['AttCnt']; i++) {
                var body = result[i]['Body'];
                var id = result[i]['Id'];
                for (var j = 0; j < result['AttCnt']; j++) {
                    if (document.getElementById("Page:Form:Repeat:" + j + ":attId") != null && id == document.getElementById("Page:Form:Repeat:" + j + ":attId").value) {
                        var imgDiv = document.getElementById("img_div_" + j);
                        imgDiv.innerHTML = '<img src="data:image/png;base64,' + body + '"></img>';
                    }
                    
                }
            }
        }
    } else {
        alert(event.message);
    }}, {buffer: false, escape: true, timeout: 20000});
});
 
function confirmDelete(delno){
    if(confirm("删除该剪贴图,确定吗?")){
        deleteClip(delno);
    }
</script>
<apex:form id="Form">
    <apex:pageMessages />
    
    <apex:actionFunction name="deleteClip" action="{!deleteClip}" rerender="Form">
        <apex:param name="param1" value="" assignTo="{!delLineNo}"/>
    </apex:actionFunction>
 
    <div class="clip_btnDiv"><apex:commandButton id="saveOrder1" value="{!$Label.LABS_SF_SaveOrder}" rerender="Form" action="{!saveOrder}" style="width:100px"/>&nbsp;&nbsp;<apex:commandButton value="{!$Label.LABS_SF_FIXED}" rerender="dummy" action="{!complete}" style="width:100px"/></div>
    <apex:inputHidden id="newOrderList" value="{!newOrder}"/>
    <div id="justClipList">
        <apex:variable value="{!0}" var="cnt" />
        <apex:repeat value="{!clipList}" var="c" id="Repeat">
            <div id="{!c.lineNo}" class="clip_dragDiv" title="拖动以排序">
            <apex:inputHidden id="attId" value="{!c.attId}" />
            <apex:outputPanel id="Panel">
                <div class="clip_menu">
                    <apex:commandButton value="{!$Label.LABS_SF_Delete}" rerender="Form" onclick="confirmDelete('{!c.lineNo}');" style="width:100px" />
                    <div class="clip_lineNo">{!c.lineNo}</div>
                </div>
                <div>{!c.reportName}</div>
                <div id="img_div_{!cnt}" style="width:322px; height:262px"></div>
                <div class="clip_textarea"><apex:inputTextarea value="{!c.comment}" cols="50" rows="10"/></div>
                <br/>
            </apex:outputPanel>
            </div>
            <apex:variable value="{!cnt + 1}" var="cnt" />
        </apex:repeat>
    </div>
    <br/>
    <div class="clip_btnDiv"><apex:commandButton id="saveOrder2" value="{!$Label.LABS_SF_SaveOrder}" rerender="Form" action="{!saveOrder}" style="width:100px"/>&nbsp;&nbsp;<apex:commandButton value="{!$Label.LABS_SF_FIXED}" rerender="dummy" action="{!complete}" style="width:100px"/></div>
</apex:form>
</apex:page>