From 81c408033b6acb4c1dad5a38bf5d5aff0d370b23 Mon Sep 17 00:00:00 2001
From: 黄千龙 <huangqianlong@prec-tech.com>
Date: 星期四, 20 七月 2023 15:13:00 +0800
Subject: [PATCH] 20230720提交页面
---
force-app/main/default/pages/QLMAttachmentPreview.page | 6 +++---
force-app/main/default/classes/QLMAttachmentPreviewController.cls | 34 +++++++++++++++++++++++++---------
2 files changed, 28 insertions(+), 12 deletions(-)
diff --git a/force-app/main/default/classes/QLMAttachmentPreviewController.cls b/force-app/main/default/classes/QLMAttachmentPreviewController.cls
index 205f091..37962ac 100644
--- a/force-app/main/default/classes/QLMAttachmentPreviewController.cls
+++ b/force-app/main/default/classes/QLMAttachmentPreviewController.cls
@@ -4,7 +4,7 @@
// //闄勪欢鐨処d
public String attachId { get; private set; }
//鎵�鏈夐檮浠�
- public list<Attachment> attachMentList { get; private set; }
+ public list<ContentVersion> attachMentList { get; private set; }
//鎵�鏈夎秴杩�12Murl
public list<Over12MInfo> Over12MInfoList { get; set; }
@@ -20,8 +20,12 @@
try {
// return [SELECT Id, Body, ParentId FROM Attachment
// where Id = :parentId ].body.tostring();
- String Att = [SELECT Id, Body, ParentId FROM Attachment
- where Id = :attachId ].body.tostring();
+ // String Att = [SELECT Id, Body, ParentId FROM Attachment
+ // where Id = :attachId ].body.tostring();
+ // lwc鏀归��
+ String Att = [SELECT Id,Title,VersionData, ContentDocumentId
+ FROM ContentVersion
+ WHERE id = :attachId].VersionData.toString();
System.debug('------123456----' + Att);
return Att;
} catch (exception e) {
@@ -37,9 +41,21 @@
try {
//鍒ゆ柇url鏄惁鏈塱d
if (String.isNotBlank(this.parentId)) {
- this.attachMentList = [SELECT id, parentId, Name, Body, ContentType
- from Attachment where parentId = :parentId];
+ // this.attachMentList = [SELECT id, parentId, Name, Body, ContentType
+ // from Attachment where parentId = :parentId];
+ // lwc 淇敼
+ // 鏌ヨ ContentDocumentLink 瀵硅薄
+ List<ContentDocumentLink> cdlList = [SELECT ContentDocumentId
+ FROM ContentDocumentLink
+ WHERE LinkedEntityId = :parentId];
+ // 閬嶅巻 ContentDocumentLink 瀵硅薄鍒楄〃
+ for (ContentDocumentLink cdl : cdlList) {
+ // 鏌ヨ ContentVersion 瀵硅薄
+ this.attachMentList = [SELECT Id,Title,VersionData, ContentDocumentId
+ FROM ContentVersion
+ WHERE ContentDocumentId = :cdl.ContentDocumentId];
+ }
attachmentInfo = new AttachmentInfo(attachMentList);
List<Tender_information__c> QLMattachMentList = [SELECT id, ProjectId__c, InfoType__c,
Overstep_12M_infofile__c,
@@ -66,12 +82,12 @@
}
public class AttachmentInfo {
- public list<Attachment> attachMentList { get; set; }
+ public list<ContentVersion> attachMentList { get; set; }
- public AttachmentInfo(list<Attachment> attachMentList) {
+ public AttachmentInfo(list<ContentVersion> attachMentList) {
this.attachMentList = attachMentList;
- for (Attachment tempatt : attachMentList) {
- tempatt.Name = String.escapeSingleQuotes(tempatt.Name);
+ for (ContentVersion tempatt : attachMentList) {
+ tempatt.Title = String.escapeSingleQuotes(tempatt.Title);
}
}
}
diff --git a/force-app/main/default/pages/QLMAttachmentPreview.page b/force-app/main/default/pages/QLMAttachmentPreview.page
index 752ceb7..91b4c3c 100644
--- a/force-app/main/default/pages/QLMAttachmentPreview.page
+++ b/force-app/main/default/pages/QLMAttachmentPreview.page
@@ -1,4 +1,4 @@
-<apex:page action="{!init}" id="Page" controller="QLMAttachmentPreviewController" showheader="false" sidebar="false">
+<apex:page action="{!init}" id="Page" controller="QLMAttachmentPreviewController" showheader="false" sidebar="false" lightningStylesheets="true">
<!-- 鏂囦欢鍒楄〃 鐐瑰嚮琛岄」鐩� 棰勮鍥剧墖 闈炲浘鐗囨牸寮忕偣鍑讳笅杞� -->
<apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}">
@@ -170,8 +170,8 @@
<apex:column style="width: 60%; height: 25px;text-align: center;font-size: 13px;
border-left: 1px solid #cbcbcb;">
<!-- //javascript:void(0) 涓轰簡瀹炵幇a鏍囩璺宠浆 -->
- <a href="javascript:void(0);" onclick="openUrl('{!attach.Id}','{!attach.Name}')">
- <apex:outputfield id="attachMentName" value="{!attach.Name}">
+ <a href="javascript:void(0);" onclick="openUrl('{!attach.Id}','{!attach.Title}')">
+ <apex:outputfield id="attachMentName" value="{!attach.Title}">
</apex:outputfield>
</a>
<!-- onclick="ClearJson('{!attach.Name}')" -->
--
Gitblit v1.9.1