From 2f4492ee18f90274582fcc2bb06f5e9bf64136e8 Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期五, 13 五月 2022 17:32:14 +0800
Subject: [PATCH] ProdBackup0513

---
 force-app/main/default/pages/SendEmail.page |  550 +++++++++---------------------------------------------
 1 files changed, 93 insertions(+), 457 deletions(-)

diff --git a/force-app/main/default/pages/SendEmail.page b/force-app/main/default/pages/SendEmail.page
index 8487046..c6a373f 100644
--- a/force-app/main/default/pages/SendEmail.page
+++ b/force-app/main/default/pages/SendEmail.page
@@ -6,7 +6,6 @@
 <apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
 <apex:includeScript value="{!URLFOR($Resource.connection20)}"/>
 <apex:includeScript value="{!URLFOR($Resource.apex20)}"/>
-<apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }" />
 
     <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable=no"/>
     <style type="text/css"> 
@@ -28,20 +27,6 @@
         }
     </style>
     <script>
-        let isBlocking = false;
-        function b(){
-            if (!isBlocking) {
-                isBlocking = true;
-                blockme();
-            }
-        }
-
-        function ub(){
-            if (isBlocking) {
-                isBlocking = false;
-                unblockUI();
-            }
-        }
 
         function formSubmit(){
             testFile();
@@ -61,9 +46,7 @@
             var memberEmailId = "memberEmail"+lineNum;
             j$(escapeVfId(memberNameId)).attr("value",memberName);
             j$(escapeVfId(memberEmailId)).attr("value",memberEmail);*/
-            // addMemberData(lineNum,memberId,memberName,memberEmail);
-            j$("#memberBody tr[line-id='"+lineNum+"'] input.emailAddress").val(memberEmail);
-            j$("#memberBody tr[line-id='"+lineNum+"'] input.name").val(memberName);
+            addMemberData(lineNum,memberId,memberName,memberEmail);
         }
         function statusChabge(linenumNum,type){
             var toId = "Page:messageForm:lineDataList:"+linenumNum+":"+"to";
@@ -109,7 +92,6 @@
         function openFile(){
             // alert('111111111');
             // uploadFileS();
-            document.getElementById("file_input").value = '';
             popupBox.setTitle("璇烽�夋嫨瑕佷笂浼犵殑鍥剧墖锛�");
             popupBox.importContentNode(document.getElementById("Page:messageForm:popupBox"));
             popupBox.show(document.getElementById("Page:messageForm:popupBox"));
@@ -120,399 +102,72 @@
         //dialog 寮圭獥 end 
         
         //涓婁紶鍥剧墖
-        function saveAttachment(){
-                var maxFileSize = 4350000;      //Base64 缂栫爜浠ュ悗鏈�澶х殑鏂囦欢瀛楄妭鏁�
-                var attachmentBody;                //闄勪欢鍐呭
-                var attachmentName;                //闄勪欢鍚嶇О
-                var attachmentType;                //闄勪欢鍚嶇О
-                var attachmentSize;                //闄勪欢澶у皬
-                var parentId = j$(escapeVfId("parentId")).value();
-                // 鑾峰彇涓婁紶鍥剧墖鐨勬暟閲�
-                var size = document.getElementById("file_input").files.length;
-                if (size > 0) {
-                var nameList = [];
-                var typeList = [];
-                var bodyList = [];
-                for(var i = 0;i < size;i++){
-                    var fbody = document.getElementById("file_input").files[i];
-                    attachmentName = fbody.name;
-                    if(fbody.size <= maxFileSize) {
-                        attachmentType = fbody.type;
-                        nameList.push(attachmentName);
-                        typeList.push(attachmentType);
-                        var fileReader = new FileReader();
-                        fileReader.readAsBinaryString(fbody);
-                        fileReader.onload = function(e) {
-                            bodyList.push(window.btoa(this.result));
-                        }
-                        fileReader.onerror = function(e) {
-                            alert("涓婁紶澶辫触锛岃閲嶆柊灏濊瘯");
-                        }
-                        fileReader.onabort = function(e) {
-                            alert("涓婁紶澶辫触锛岃閲嶆柊灏濊瘯");
-                        }
-                    } else {
-                        alert("Base64 缂栫爜鏈�澶у厑璁�4.3M鏂囦欢,"+attachmentName + '杩囧ぇ鏃犳硶涓婁紶');
-                    }
-
-
-                }
-                if (nameList.length > 0) {
-                        //浣跨敤RemoteAction涓婁紶闄勪欢
-                        Visualforce.remoting.Manager.invokeAction(
-                        '{!$RemoteAction.SendEmailController.AddAttachment}',
-                        nameList,
-                        typeList,
-                        bodyList,
-                        parentId,
-                        function(result,event) {
-                            
-                            if(result == '鏂囦欢涓婁紶鎴愬姛'){
-                            alert(result); 
-                            RefreshPage();
-                            } else if (result == null){
-                            result = '鏂囦欢涓婁紶澶辫触,璇烽噸鏂颁笂浼�';
-                            alert(result); 
-                            RefreshPage();
-                            } else {
-                            alert(result); 
+            function saveAttachment(){
+                 var maxFileSize = 4350000;      //Base64 缂栫爜浠ュ悗鏈�澶х殑鏂囦欢瀛楄妭鏁�
+                 var attachmentBody;                //闄勪欢鍐呭
+                 var attachmentName;                //闄勪欢鍚嶇О
+                 var attachmentType;                //闄勪欢鍚嶇О
+                 var attachmentSize;                //闄勪欢澶у皬
+                 var parentId = j$(escapeVfId("parentId")).value();
+                 // 鑾峰彇涓婁紶鍥剧墖鐨勬暟閲�
+                 var size = document.getElementById("file_input").files.length;
+                 if (size > 0) {
+                    var nameList = [];
+                    var typeList = [];
+                    var bodyList = [];
+                    for(var i = 0;i < size;i++){
+                        var fbody = document.getElementById("file_input").files[i];
+                        attachmentName = fbody.name;
+                        if(fbody.size <= maxFileSize) {
+                            attachmentType = fbody.type;
+                            nameList.push(attachmentName);
+                            typeList.push(attachmentType);
+                            var fileReader = new FileReader();
+                            fileReader.readAsBinaryString(fbody);
+                            fileReader.onload = function(e) {
+                                bodyList.push(window.btoa(this.result));
                             }
-                            
-                        });
-
-                }
-                
-                }
-                
-                
-        }
-
-        // PI鏀归�� By Bright 20220329
-        AWSService.sfSessionId = '{!GETSESSIONID()}';
-        var staticResourceMail = JSON.parse('{!staticResourceMail}');
-        var staticResourceMailMerge = JSON.parse('{!staticResourceMailMerge}');
-        var staticResourceDocument = JSON.parse('{!staticResourceDocument}');
-        var isQuotesPdf = false;
-
-        function alertErrorMessage(errorMsg) {
-            console.log(errorMsg);
-        }
-
-        function uploadFileToAWS(data, size, fileName, callback) {
-            
-            console.log("body=" + JSON.stringify({ 'file': data, "size": size, 'fileName': fileName }));
-            AWSService.post(staticResourceDocument.newUrl, JSON.stringify({ 
-                'file': data, 
-                "size": size, 
-                'fileName': fileName })
-                , function(result){
-                    console.log("result" + JSON.stringify(result));
-                    
-                    if (result.success) {
-                        let key = result.object;
-                        confirmTrans(result.txId,1,function(){
-                            if (callback) {
-                                callback(key);
+                            fileReader.onerror = function(e) {
+                                alert("涓婁紶澶辫触锛岃閲嶆柊灏濊瘯");
                             }
-                        })
-                        //SendEmail();
-                        console.log('key' + key);
-                    } else {
-                        alertErrorMessage('涓婁紶澶辫触璇风◢鍚庡啀璇曪紒');
-                    }
-            }, staticResourceDocument.token);
-        
-        }
-
-        function SendEmailCallBack(){
-            console.log('SendEmailCallBack');
-        }
-
-        function confirmTrans(transId, isSuccess,callback) {
-              
-            AWSService.post(staticResourceDocument.updateUrl, JSON.stringify({
-                "txId":transId,
-                "sfRecordId":"",
-                "isSuccess":isSuccess
-            }), function(data){
-                console.log("confirmTrans-" + JSON.stringify(data));
-                if (callback) {
-                    callback()
-                }
-            }, staticResourceDocument.token);
-        
-        }
-
-        function uploadFile() {
-            var maxFileSize = 4350000;
-            let files = document.getElementById("file_input").files
-            // 鑾峰彇涓婁紶鍥剧墖鐨勬暟閲�
-            
-            if (files.length == 0) {
-                alert('鑷冲皯閫夋嫨涓�涓檮浠�');
-                return;
-            }
-            
-            let attachList=[];
-            let complete_flags = new Array(files.length + 1).join(0).split('').map(function () { return false });
-            let AllComplete = function(){
-                for (let index = 0; index < complete_flags.length; index++){
-                    if(!complete_flags[index]){
-                        return;
-                    }
-                }
-                
-                ub();
-            }
-            for(var i = 0;i < files.length;i++){
-                var fbody = files[i];
-                let j = i;
-                if(fbody.size <= maxFileSize) {
-                    
-                } else {
-                    alert("Base64 缂栫爜鏈�澶у厑璁�4.3M鏂囦欢,"+fbody.name + '杩囧ぇ鏃犳硶涓婁紶');
-                    return;
-                }
-            }
-
-            popupBox.hide();
-            b();
-            for(var i = 0;i < files.length;i++){
-                var fbody = files[i];
-                let j = i;
-                var fileReader = new FileReader();
-                fileReader.fbody = fbody;
-                fileReader.readAsDataURL(fbody);
-                fileReader.onload = function(e) {
-                    let reader = this;
-                    attachList.push({
-                        name:reader.fbody.name,
-                        type:reader.fbody.type,
-                        body:reader.result,
-                        size:reader.fbody.size
-                    })
-                    // 
-                    console.log('onload '+ j);
-                    // ReadComplete();
-                    uploadFileToAWS(reader.result, reader.fbody.size, reader.fbody.name,function(key){
-                        complete_flags[j] = true;
-                        AppendAttachmentHtml(reader.fbody.name,key,reader.fbody.size);
-                        AllComplete();
-                    });
-
-                    
-                }
-                fileReader.onerror = function(e) {
-                    ub();
-                    alert("涓婁紶澶辫触锛岃閲嶆柊灏濊瘯");
-                }
-                fileReader.onabort = function(e) {
-                    ub();
-                    alert("涓婁紶澶辫触锛岃閲嶆柊灏濊瘯");
-                }
-            }
-            
-            console.log('end');
-            
-        }
-
-        let AfterCallBack = null;
-        function AddQuotesPdf(callback){
-            if (isQuotesPdf) {
-                alert('宸叉坊鍔犳姤浠峰崟锛屾棤闇�閲嶅娣诲姞');
-                return;
-            }
-            b();
-            AfterCallBack = callback;
-            j$("#pdf").attr("src",'/apex/QuotesPDF?id={!typeid}&addFile=AddQuotesPdfCallBack');
-        }
-
-        function AddQuotesPdfCallBack(uri){
-            let bodys = uri.split(',');
-            let body = bodys[bodys.length-1]
-            let size = window.atob(body).length;
-            let name = '鎶ヤ环鍗�.pdf';
-            uploadFileToAWS(uri, size, name,function(key){
-                ub();
-                AppendAttachmentHtml(name,key,size);
-                isQuotesPdf = true;
-                if (AfterCallBack) {
-                    AfterCallBack();
-                }
-            });
-        }
-
-        function SendEmailJs(){
-
-            let tos = jQuery("#memberBody :checked[target='to']");
-            if(tos.length<1){
-                alert("鑷冲皯濉啓涓�涓敹浠朵汉");
-                return;
-            }
-
-            let error_email_e = null;
-            j$("#memberBody .emailAddress").each(function(i,e){
-                if (!/^[\w-]{1,99}@[\da-zA-Z]{1,99}\.[a-zA-Z]+$/.test(e.value)) {
-                    error_email_e = e;
-                    return false;
-                }
-                return true;
-            })
-
-            if (error_email_e) {
-                if(error_email_e.value){
-                    alert('閭鍦板潃鏍煎紡涓嶅:'+error_email_e.value);
-                }else{
-                    alert('閭鍦板潃蹇呭~');
-                }
-                
-                j$(error_email_e).focus();
-                j$(error_email_e).select();
-                return;
-            }
-
-            let subject = j$(".SUBJECT__c").val();
-            if (!subject) {
-                alert("SUBJECT蹇呭~");
-                return;
-            }
-
-            
-            let message = j$(".MESSAGE__c").val();
-            if (!message) {
-                alert("MESSAGE蹇呭~");
-                return;
-            }
-
-            let Foo = function(target){
-                let targets = jQuery("#memberBody :checked[target='"+target+"']");
-                let emails = [];
-                let names = [];
-                targets.each(function(i,e){
-                    let v = j$(e).closest("tr").find(".name").val();
-                    names.push(v?v:'-');
-                    emails.push(j$(e).closest("tr").find(".emailAddress").val());
-                });
-                return {
-                    emails:emails,
-                    names:names
-                }
-            }
-            
-
-            let to = Foo('to');
-            let cc = Foo('cc');
-            let bcc = Foo('bcc');
-
-            
-            let payload = {
-                "bcc": bcc.emails.join(';'),
-                "bccName": bcc.names.join(';'),
-                "cc": cc.emails.join(';'),
-                "ccName": cc.names.join(';'),
-                "from": j$(".FROM__c").html(),
-                "fromName": "",
-                "message": message,
-                "recipient": to.emails.join(';'),
-                "recordId": "{!typeid}",
-                "recordType": "{!type}",
-                "subjectCopy": subject+'~{!name}',
-                "toName": to.names.join(';')
-            };
-            b();
-
-            
-
-            let Send = function(){
-                let fileMap = {}
-                j$("a.attach_link").each(function(i,e){
-                    fileMap[j$(e).attr("data-key")] = j$(e).attr("data-name");
-                });
-                payload.fileMap = fileMap;
-                AWSService.post(staticResourceMail.newUrl,JSON.stringify(payload),function(data){
-                    console.log(data);
-                    ub();
-                    if (data && data.success) {
-                        alert('鍙戦�佹垚鍔�')
-                        if ('{!typeid}') {
-                            window.location.href = '/{!typeid}?type=mail';
-                        }else{
-                            window.location.href = '/'+data.object;
+                            fileReader.onabort = function(e) {
+                                alert("涓婁紶澶辫触锛岃閲嶆柊灏濊瘯");
+                            }
+                        } else {
+                            alert("Base64 缂栫爜鏈�澶у厑璁�4.3M鏂囦欢,"+attachmentName + '杩囧ぇ鏃犳硶涓婁紶');
                         }
-                    }else{
-                        alert('鍙戦�佸け璐ワ紝鍘熷洜:'+(data && data.message ? data.message :'鏈煡閿欒'));
+
+
                     }
-                },staticResourceMail.token);
-            }
-
-            // 濡傛灉娌℃坊鍔犳姤浠峰崟锛岃嚜鍔ㄦ坊鍔�
-            if ('{!type}' == 'Quotes' && !isQuotesPdf) {
-                AddQuotesPdf(Send);
-            }else{
-                Send();
-            }
-            
-        }
-
-        function AppendAttachmentHtml(name,key,size){
-           let html =  '<tr style="text-align:center; vertical-align: middle;">'
-                         + '<td><a class="attach_link" target="_blank" data-key="'+key+'" data-name="'+name+'" href="'+staticResourceDocument.queryUrl+key+'">'+name+'</a></td>'
-                            +'<td>'+new Date().toLocaleString()+'</td>'
-                            +'<td>'+size+'</td>'
-                            +'<td><input type="button" class="btn delete_attachment" value="delete" /></td>'
-                        +'</tr>';
-            j$("table.attach_preview").append(html);
-        }
-
-        function AddMemberJs(){
-            let line_id = new Date().getTime()+''+Math.floor(Math.random()*1000);
-            let html =  '<tr line-id="'+line_id+'" style="text-align:center;">'
-                            +'<td><input id="memberName2" type="hidden" value=""><input class="emailAddress" type="text" value=""/></td>'
-                                +'<td><input class="name" type="text" value=""/></td>'
-                                +'<td><input line-id="'+line_id+'" target="to" type="checkbox" checked="checked"/></td>'
-                                +'<td><input line-id="'+line_id+'" target="cc" type="checkbox"/></td>'
-                                +' <td><input line-id="'+line_id+'" target="bcc" type="checkbox"/></td>'
-                                +' <td><input line-id="'+line_id+'" class="btn delete" value="delete" type="button"/></td>'
-                                +' <td><input type="button" value="Search" onclick="openSearchMemberPage('+line_id +');" class="btn search"/></td>'
-                        +' </tr>';
-            j$("#memberBody").append(html);
-        }
-        
-        j$(function(){
-            j$("table.attach_preview").on("click",".delete_attachment",function(){
-                j$(this).closest("tr").remove();
-            })
-
-            j$("#memberBody").on("click",":checkbox",function(){
-                let b = j$(this).prop("checked");
-                console.log(b);
-                j$(":checkbox[line-id='"+j$(this).attr("line-id")+"']").prop("checked",false);
-                j$(this).prop("checked",b);
-            })
-
-            j$("#memberBody").on("click","input.delete",function(){
-                j$("tr[line-id='"+j$(this).attr("line-id")+"']").remove();
-            })
-            
-            if ('{!AWSDataId}') {
-                b();
-                AWSService.query(staticResourceMailMerge.queryUrl,'{!AWSDataId}',function(data){
-                    ub();
-                    if (data && data.object) {
-                        let allMembers = data.object.allMember.split(';');
-                        let allMemberNames = data.object.allMemberName.split(';');
-                        j$("#memberBody .emailAddress").each(function(i,e){
-                            j$(e).val(allMembers[i]);
-                        })
-
-                        j$("#memberBody .name").each(function(i,e){
-                            j$(e).val(allMemberNames[i]=='-'?'':allMemberNames[i]);
-                        })
+                    if (nameList.length > 0) {
+                         //浣跨敤RemoteAction涓婁紶闄勪欢
+                         Visualforce.remoting.Manager.invokeAction(
+                           '{!$RemoteAction.SendEmailController.AddAttachment}',
+                           nameList,
+                           typeList,
+                           bodyList,
+                           parentId,
+                           function(result,event) {
+                               
+                             if(result == '鏂囦欢涓婁紶鎴愬姛'){
+                                alert(result); 
+                                RefreshPage();
+                             } else if (result == null){
+                                result = '鏂囦欢涓婁紶澶辫触,璇烽噸鏂颁笂浼�';
+                                alert(result); 
+                                RefreshPage();
+                             } else {
+                                alert(result); 
+                             }
+                             
+                           });
+ 
                     }
-
-                },staticResourceMailMerge.token);
+                    
+                 }
+                 
+                 
             }
-        })
     </script>
     <div style="width : 100%;">
     <div style="width : 70%; margin: auto;">
@@ -534,10 +189,6 @@
                 <!-- <apex:param name="lineNum" assignTo="{!lineNum}" value="" /> -->
             </apex:actionFunction>
 
-            <apex:actionFunction name="SendEmail" action="{!SendEmail}"  oncomplete="SendEmailCallBack();" reRender="messageForm" >
-                <apex:param name="handleType" assignTo="{!handleType}" value="send" />
-            </apex:actionFunction>
-
             <div style="width: 100%">
                 <div class="errorMessage" style="margin-left: 39%">
                     <span id="errorMessage">{!errorMessage}</span>
@@ -551,7 +202,7 @@
                     </tr>
                     <tr>
                         <th style="width: 20%;text-align:center;">FROM:</th>
-                        <td><apex:outputText styleClass="FROM__c" value="{!mail.FROM__c}" style="width: 40%"/></td>
+                        <td><apex:outputText value="{!mail.FROM__c}" style="width: 40%"/></td>
                     </tr>
                 </table>
             </div>
@@ -570,18 +221,17 @@
                     </thead>
                     <tbody id="memberBody">
                         <apex:repeat id="lineDataList" value="{!memberLineDatas}" var="lineData">
-                            <tr line-id="{!lineData.lineNum}" style="text-align:center;">
+                            <tr style="text-align:center;">
                                 <td>
                                 <input type="hidden" id="memberName{!lineData.lineNum}" value="{!lineData.name}" />
-                                <apex:inputText styleClass="emailAddress" value="{!lineData.emailAddress}" /></td>
-                                <td><apex:inputText styleClass="name" value="{!lineData.name}" /></td>
-                                <td><apex:inputCheckbox html-line-id="{!lineData.lineNum}" html-target="to"  id="to" value="{!lineData.to}"/></td>
-                                <td><apex:inputCheckbox html-line-id="{!lineData.lineNum}" html-target="cc"  id="cc" value="{!lineData.cc}"/></td>
-                                <td><apex:inputCheckbox html-line-id="{!lineData.lineNum}" html-target="bcc"  id="bcc" value="{!lineData.bcc}"/></td>
-                                <td><input line-id="{!lineData.lineNum}" class="btn delete" value="delete" type="button"/></td>
-                                <!-- <td><apex:commandButton onclick="b();" action="{!deLine}" reRender="messageForm" value="delete"  oncomplete="ub();" disabled="{!isOnClick}">
+                                <apex:inputText value="{!lineData.emailAddress}" /></td>
+                                <td><apex:inputText value="{!lineData.name}" /></td>
+                                <td><apex:inputCheckbox onclick="statusChabge({!lineData.lineNum},'to')" id="to" value="{!lineData.to}"/></td>
+                                <td><apex:inputCheckbox onclick="statusChabge({!lineData.lineNum},'cc')" id="cc" value="{!lineData.cc}"/></td>
+                                <td><apex:inputCheckbox onclick="statusChabge({!lineData.lineNum},'bcc')" id="bcc" value="{!lineData.bcc}"/></td>
+                                <td><apex:commandButton onclick="blockme();" action="{!deLine}" reRender="messageForm" value="delete"  oncomplete="unblockUI();" disabled="{!isOnClick}">
                                     <apex:param name="lineNum" assignTo="{!lineNum}" value="{!lineData.lineNum}" />
-                                </apex:commandButton></td> -->
+                                </apex:commandButton></td>
                                 <td>
                                     <apex:commandButton onclick="openSearchMemberPage({!lineData.lineNum});" value="Search" disabled="{!isOnClick}">
                                         
@@ -592,8 +242,7 @@
                     </tbody>
                     <thead>
                         <tr style="text-align:center;">
-                            <!-- <td><apex:commandButton id="addLine" onclick="b();" action="{!addLine}" reRender="messageForm" value="ADD Member" oncomplete="ub();" disabled="{!isOnClick}"></apex:commandButton></td> -->
-                            <td><apex:commandButton id="addLine" onclick="AddMemberJs();" value="ADD Member" oncomplete=""></apex:commandButton></td>
+                            <td><apex:commandButton id="addLine" onclick="blockme();" action="{!addLine}" reRender="messageForm" value="ADD Member" oncomplete="unblockUI();" disabled="{!isOnClick}"></apex:commandButton></td>
                         </tr>
                     </thead>
                 </table>
@@ -617,11 +266,11 @@
                     </tr> -->
                     <tr>
                         <th style="text-align:center;width: 20%;">SUBJECT:</th>
-                        <td><apex:inputField styleClass="SUBJECT__c" value="{!mail.SUBJECT__c}" style="width: 40%"/></td>
+                        <td><apex:inputField value="{!mail.SUBJECT__c}" style="width: 40%"/></td>
                     </tr>
                     <tr>
                         <th style="text-align:center;width: 20%;">MESSAGE:</th>
-                        <td><apex:inputField styleClass="MESSAGE__c" style="height: 200px;width: 60%" value="{!mail.MESSAGE__c}"/></td>
+                        <td><apex:inputField style="height: 200px;width: 60%" value="{!mail.MESSAGE__c}"/></td>
                     </tr>
                 </table>
             </div>
@@ -635,70 +284,57 @@
 
                     <tr>
                         <td>
-                            <!-- <apex:commandButton value="Upload Attachment" action="{!uploadFile}" disabled="{!isOnClick}">
-                            </apex:commandButton> -->
+                            <apex:commandButton value="Upload Attachment" action="{!uploadFile}" disabled="{!isOnClick}">
+                            </apex:commandButton>
                              <apex:panelGroup >
-                                 <apex:commandButton onclick="openFile();return false;" value="鍥剧墖鎵归噺涓婁紶" disabled="{!isOnClick}"/>
+                                 <apex:commandButton onclick="uploadFileS();return false;" value="鍥剧墖鎵归噺涓婁紶" disabled="{!isOnClick}"/>
                             </apex:panelGroup>
                         </td>
                     </tr>
                 </table>
             </div>
-            <apex:outputPanel rendered="{!IF(openType == 'View', true, false)}" style="margin-left: 5px;"> 
+            <div style="margin-left: 5px;"> 
                 <!-- border:1px solid #000000; -->
                 <table class="tableCss" style="width: 80%"> 
                     <tr style="text-align:center;">
                         <th style="text-align:center;width: 33%;">File Name</th>
                         <th style="text-align:center;width: 33%;">Upload Time</th>
-                        <!-- <th style="text-align:center;width: 33%;">File Size</th> -->
+                        <th style="text-align:center;width: 33%;">File Size</th>
                     </tr>
-                    <apex:repeat id="attachmentList" value="{!newAttachmentList}" var="item">
+                    <apex:repeat id="attachmentList" value="{!attachmentList}" var="attachment">
                         <tr style="text-align:center; vertical-align: middle;">
-                            <!-- <td><input value="{!item.Name}" readonly="readonly" style="border:none;"/></td> -->
-                            <td><apex:outputLink value="/{!item.Id}">{!item.FileName__c}</apex:outputLink></td>
-                            <td><apex:inputField value="{!item.CreatedDate}"/></td>
-                            <!-- <td><apex:inputField value="{item.BodyLength}"/></td> -->
-                            <td id="{!item.Id}">
-                                <a target="_blank" href="{!item.ViewLink__c}">鏌ョ湅</a>
+                            <!-- <td><input value="{!attachment.Name}" readonly="readonly" style="border:none;"/></td> -->
+                            <td><apex:outputLink value="/{!attachment.Id}">{!attachment.Name}</apex:outputLink></td>
+                            <td><apex:inputField value="{!attachment.CreatedDate}"/></td>
+                            <td><apex:inputField value="{!attachment.BodyLength}"/></td>
+                            <td id="{!attachment.Id}">
+                                <apex:commandButton id="deleteFile" value="delete" action="{!deleteFile}" reRender="messageForm" onclick="blockme();" oncomplete="unblockUI();" disabled="{!isOnClick}">
+                                    <apex:param name="fileId" assignTo="{!fileId}" value="{!attachment.Id}" />
+                                </apex:commandButton>
                             </td>
                         </tr>
                     </apex:repeat>
                 </table>
-            </apex:outputPanel>
-            <!-- 20220222 PI鏀归�� by Bright start -->
-            <apex:outputPanel rendered="{!IF(openType == 'View', false, true)}" style="margin-left: 5px;"> 
-                <!-- border:1px solid #000000; -->
-                <table class="tableCss attach_preview" style="width: 80%"> 
-                    <tr style="text-align:center;">
-                        <th style="text-align:center;width: 33%;">File Name</th>
-                        <th style="text-align:center;width: 33%;">Upload Time</th>
-                        <th style="text-align:center;width: 33%;">File Size</th>
-                    </tr>
-                    
-                </table>
-            </apex:outputPanel>
-            <!-- 20220222 PI鏀归�� by Bright end -->
+            </div>
 
             <div style="width: 30%;height: 5%;margin-left: 30%;margin-top: middle;">
                  <apex:outputPanel rendered="{!IF(type == 'Quotes', true, false)}">
-                    <apex:commandButton id="open" value="鏌ョ湅鎶ヤ环鍗�" onclick="openPDF();return false;" style="width: 49%;height: 5%" />
-                    <apex:commandButton id="addPDf" value="娣诲姞鎶ヤ环鍗�" onclick="AddQuotesPdf();return false;"  oncomplete="" reRender="messageForm" style="width: 49%;height: 5%" disabled="{!isOnClick}"/>
+                    <apex:commandButton id="open" value="鏌ョ湅鎶ヤ环鍗�" onclick="openPDF()" style="width: 49%;height: 5%" />
+                    <apex:commandButton id="addPDf" value="娣诲姞鎶ヤ环鍗�" action="{!addPDF}" onclick="blockme();"  oncomplete="unblockUI();" reRender="messageForm" style="width: 49%;height: 5%" disabled="{!isOnClick}"/>
                 </apex:outputPanel>
-                <apex:commandButton id="test" value="Send   Mail" onclick="SendEmailJs();return false;" style="width: 99%;height: 5%" disabled="{!isOnClick}"/>
-                <!-- <apex:commandButton id="test" action="{!SendEmail}" value="Send   Mail" onclick="b();"  oncomplete="ub();" reRender="messageForm" style="width: 99%;height: 5%" disabled="{!isOnClick}">
+                <apex:commandButton id="test" action="{!SendEmail}" value="Send   Mail" onclick="blockme();"  oncomplete="unblockUI();" reRender="messageForm" style="width: 99%;height: 5%" disabled="{!isOnClick}">
                     <apex:param name="handleType" assignTo="{!handleType}" value="send" />
-                </apex:commandButton> -->
+                </apex:commandButton>
             </div>
             <apex:outputPanel id="popupBox" layout="block" style="display:none">
 
                 <input type="file" id="file_input" name="attFile" multiple="true"/><br/>
                 <center>
-                    <apex:commandButton value="纭" onclick="uploadFile(); return false;" style="width: 20%; margin: 20px 10px 0px 10px" />
+                    <apex:commandButton value="纭" onclick="saveAttachment(); return false;" style="width: 20%; margin: 20px 10px 0px 10px" />
                     <apex:commandButton value="鍙栨秷" onclick="popupBox.hide();" style="width: 20%; margin: 20px 10px 0px 10px" />
                 </center>
             </apex:outputPanel> 
         </apex:form>
-        <iframe src="" id="pdf" style="position: absolute;left: 100%;" />
     </div>
     </div>
 </apex:page>
\ No newline at end of file

--
Gitblit v1.9.1