From 75550e1bd16611d11ffac577f14ba743c6711338 Mon Sep 17 00:00:00 2001
From: yumenghui <953181891@qq.com>
Date: 星期一, 07 八月 2023 20:33:22 +0800
Subject: [PATCH] 按钮及附件修改

---
 force-app/main/default/lwc/lexConsumApplyEquipmentSetReassign/lexConsumApplyEquipmentSetReassign.html |   14 ++
 force-app/main/default/lwc/lexAssetMaintainHeaderAbandon/lexAssetMaintainHeaderAbandon.js             |    6 +
 force-app/main/default/lwc/lexAssetMaintainHeaderDeleteApply/lexAssetMaintainHeaderDeleteApply.js     |    3 
 force-app/main/default/lwc/lexConsumApplySubmitApprovalProcess/lexConsumApplySubmitApprovalProcess.js |    1 
 force-app/main/default/lwc/lexConsumApplyEquipmentSetReassign/lexConsumApplyEquipmentSetReassign.css  |   40 ++++----
 force-app/main/default/classes/RentalApplyTriggerHandler.cls                                          |  112 +++++++++++++++++----
 force-app/main/default/classes/QISToETQWebService.cls                                                 |   53 +++++++--
 force-app/main/default/lwc/lexConsumApplyEquipmentSetReassign/lexConsumApplyEquipmentSetReassign.js   |   65 ++++++------
 8 files changed, 200 insertions(+), 94 deletions(-)

diff --git a/force-app/main/default/classes/QISToETQWebService.cls b/force-app/main/default/classes/QISToETQWebService.cls
index bcba6d8..1d86c90 100644
--- a/force-app/main/default/classes/QISToETQWebService.cls
+++ b/force-app/main/default/classes/QISToETQWebService.cls
@@ -20,7 +20,8 @@
                 apiNames.add('Photo_OSH_3__c');
                 apiNames.add('Photo_OSH_4__c');
                 List<QIS_Report__c> updateQis = new List<QIS_Report__c>();
-                List<Attachment> attachments = new List<Attachment>();
+                // List<Attachment> attachments = new List<Attachment>();
+                List<ContentDocumentLink> attachments = new List<ContentDocumentLink>();
                 PageReference pdfPage ;
                 for(QIS_Report__c qis : temp){
                     for (String apiName : apiNames) {
@@ -39,16 +40,27 @@
                         } else {
                             pdfBody = pdfPage.getContentAsPDF();
                         }
-                        Attachment attach = new Attachment();
-                        attach.Body = pdfBody;
+                        // Attachment attach = new Attachment();
+                        // attach.Body = pdfBody;
+                        ContentVersion cv = new ContentVersion();
+                        cv.VersionData = pdfBody;
                         if ('problem_detail_photo__c'.equals(apiName)) {
-                            attach.Name =  substringApiName(qis.name) + '_Problem_Discription.pdf';
+                            // attach.Name =  substringApiName(qis.name) + '_Problem_Discription.pdf';
+                            cv.Title = substringApiName(qis.name) + '_Problem_Discription.pdf';
                         }else {
-                            attach.Name = substringApiName(qis.name) + '_' + 'Problem_' + apiName.substring(0,apiName.length()-3) + '.pdf';
+                            // attach.Name = substringApiName(qis.name) + '_' + 'Problem_' + apiName.substring(0,apiName.length()-3) + '.pdf';
+                            cv.Title = substringApiName(qis.name) + '_' + 'Problem_' + apiName.substring(0,apiName.length()-3) + '.pdf';
                         }
-                        attach.ParentId = qis.id;
-        
-                        attachments.add(attach);
+                        // attach.ParentId = qis.id;
+                        insert cv;
+                        Id docId = [SELECT ContentDocumentId FROM ContentVersion WHERE Id = :cv.Id].ContentDocumentId;
+                        ContentDocumentLink cdl = new ContentDocumentLink();
+                        cdl.ContentDocumentId = docId;
+                        cdl.LinkedEntityId = qis.id;
+                        cdl.ShareType = 'I';
+                        cdl.visibility = 'AllUser';
+                        // attachments.add(attach);
+                        attachments.add(cdl);
                         if (generatedFields == null) {
                             qis.GeneratedPDFField__c = apiName;
                         }else {
@@ -90,7 +102,8 @@
                 PageReference pdfPage ;
             
                 List<Repair__c> updateRpr = new List<Repair__c>();
-                List<Attachment> attachments = new List<Attachment>();
+                // List<Attachment> attachments = new List<Attachment>();
+                List<ContentDocumentLink> attachments = new List<ContentDocumentLink>();
                 for(Repair__c re : tempRe){
                     String generatedFields = re.GeneratedPDFField__c;
                     if (checkFieldisGeneratedPDF('ProblemDescription__c',re)) {
@@ -108,11 +121,23 @@
                     } else {
                         pdfBody = pdfPage.getContentAsPDF();
                     }
-                    Attachment attach = new Attachment();
-                    attach.Body = pdfBody;
-                    attach.Name = re.name + '_' + 'Problem_Discription.pdf';
-                    attach.ParentId = re.id;
-                    attachments.add(attach);
+                    // Attachment attach = new Attachment();
+                    // attach.Body = pdfBody;
+                    // attach.Name = re.name + '_' + 'Problem_Discription.pdf';
+                    // attach.ParentId = re.id;
+                    ContentVersion cv = new ContentVersion();
+                    cv.VersionData = pdfBody;
+                    cv.Title = re.name + '_' + 'Problem_Discription.pdf';
+                    insert cv;
+                    Id docId = [SELECT ContentDocumentId FROM ContentVersion WHERE Id = :cv.Id].ContentDocumentId;  
+                    ContentDocumentLink cdl = new ContentDocumentLink();
+                    cdl.ContentDocumentId = docId;
+                    cdl.LinkedEntityId = re.id;
+                    cdl.ShareType = 'I';
+                    cdl.visibility = 'AllUser';
+
+                    // attachments.add(attach);
+                    attachments.add(cdl);
                     re.GeneratedPDFField__c = 'ProblemDescription__c';
                     updateRpr.add(re);
                 }
diff --git a/force-app/main/default/classes/RentalApplyTriggerHandler.cls b/force-app/main/default/classes/RentalApplyTriggerHandler.cls
index fb2a9b3..0d69918 100644
--- a/force-app/main/default/classes/RentalApplyTriggerHandler.cls
+++ b/force-app/main/default/classes/RentalApplyTriggerHandler.cls
@@ -181,45 +181,52 @@
             }
             if(!childRaList.isEmpty()) {
                 update childRaList;
-                
                 // 涓诲崟閲岄檮浠�
-                List<Attachment> attList = [SELECT Id, Body, Name, ParentId
-                                            FROM Attachment
-                                            WHERE ParentId IN: raIdSet
-                                            ];
+                List<ContentDocumentLink> attList = [SELECT Id, LinkedEntityId, ContentDocumentId, IsDeleted, 
+                                                    ContentDocument.Title
+                                                    FROM ContentDocumentLink 
+                                                    WHERE  LinkedEntityId IN: raIdSet];
                 // 浠庡崟閲岄檮浠讹紝鏀惧埌涓�璧锋煡浼氭姤limit閿�
-                attList.addAll([SELECT Id, Name, ParentId FROM Attachment WHERE ParentId IN:childRaList]);
+                List<Id> racIdList = new List<Id>();
+                for (Rental_Apply__c rac : childRaList) {
+                    racIdList.add(rac.Id);
+                }
+                List<ContentDocumentLink> attList1 =[SELECT Id, LinkedEntityId, ContentDocumentId, IsDeleted, 
+                                                    ContentDocument.Title
+                                                    FROM ContentDocumentLink 
+                                                    WHERE LinkedEntityId IN: racIdList];
+                attList.addAll(attList1);
                 if(attList.isEmpty()) {
                     return;
                 }
-                Map<Id, List<Attachment>> parentFiles = new Map<Id, List<Attachment>>();
+                Map<Id, List<ContentDocumentLink>> parentFiles = new Map<Id, List<ContentDocumentLink>>();
                 // 寰呭垹闄ら檮浠�
-                List<Attachment> deleteFiles = new List<Attachment>();
-                for(Attachment att: attList) {
-                    if(att.Name.startsWith('QRCode-')) {
+                List<ContentDocumentLink> deleteFiles = new List<ContentDocumentLink>();
+                for(ContentDocumentLink att: attList) {
+                    if(att.ContentDocument.Title.startsWith('QRCode-') || att.ContentDocument.Title.startsWith('BRCode-')) {
                         continue;
                     }
-                    if(raIdSet.contains(att.ParentId)) {
-                        List<Attachment> tempList = null;
-                        if(parentFiles.containsKey(att.ParentId)) {
-                            tempList = parentFiles.get(att.ParentId);
+                    if(raIdSet.contains(att.LinkedEntityId)) {
+                        List<ContentDocumentLink> tempList = null;
+                        if(parentFiles.containsKey(att.LinkedEntityId)) {
+                            tempList = parentFiles.get(att.LinkedEntityId);
                         }
                         else {
-                            tempList = new List<Attachment>();
+                            tempList = new List<ContentDocumentLink>();
                         }
                         tempList.add(att);
-                        parentFiles.put(att.ParentId, tempList);
+                        parentFiles.put(att.LinkedEntityId, tempList);
                     }
                     else {
                         deleteFiles.add(att);
                     }
                 }
                 // 寰呮彃鍏ョ殑闄勪欢
-                List<Attachment> newFiles = new List<Attachment>();
+                List<ContentDocumentLink> newFiles = new List<ContentDocumentLink>();
                 for(Rental_Apply__c childRa: childRaList) {
                     if(parentFiles.containsKey(childRa.Old_Rental_Apply__c)) {
-                        for(Attachment att : parentFiles.get(childRa.Old_Rental_Apply__c)){
-                            newFiles.add(new Attachment(Body = att.Body,Name = att.Name, ParentId = childRa.Id));
+                        for(ContentDocumentLink att : parentFiles.get(childRa.Old_Rental_Apply__c)){
+                            newFiles.add(new ContentDocumentLink(ContentDocumentId = att.ContentDocumentId,LinkedEntityId = childRa.Id,ShareType = 'I',Visibility = 'AllUsers'));
                         }
                     }
                 }
@@ -229,6 +236,54 @@
                 if(!newFiles.isEmpty()) {
                     insert newFiles;
                 }
+                
+                // // 涓诲崟閲岄檮浠�
+                // List<Attachment> attList = [SELECT Id, Body, Name, ParentId
+                //                             FROM Attachment
+                //                             WHERE ParentId IN: raIdSet
+                //                             ];
+                // // 浠庡崟閲岄檮浠讹紝鏀惧埌涓�璧锋煡浼氭姤limit閿�
+                // attList.addAll([SELECT Id, Name, ParentId FROM Attachment WHERE ParentId IN:childRaList]);
+                // if(attList.isEmpty()) {
+                //     return;
+                // }
+                // Map<Id, List<Attachment>> parentFiles = new Map<Id, List<Attachment>>();
+                // // 寰呭垹闄ら檮浠�
+                // List<Attachment> deleteFiles = new List<Attachment>();
+                // for(Attachment att: attList) {
+                //     if(att.Name.startsWith('QRCode-')) {
+                //         continue;
+                //     }
+                //     if(raIdSet.contains(att.ParentId)) {
+                //         List<Attachment> tempList = null;
+                //         if(parentFiles.containsKey(att.ParentId)) {
+                //             tempList = parentFiles.get(att.ParentId);
+                //         }
+                //         else {
+                //             tempList = new List<Attachment>();
+                //         }
+                //         tempList.add(att);
+                //         parentFiles.put(att.ParentId, tempList);
+                //     }
+                //     else {
+                //         deleteFiles.add(att);
+                //     }
+                // }
+                // // 寰呮彃鍏ョ殑闄勪欢
+                // List<Attachment> newFiles = new List<Attachment>();
+                // for(Rental_Apply__c childRa: childRaList) {
+                //     if(parentFiles.containsKey(childRa.Old_Rental_Apply__c)) {
+                //         for(Attachment att : parentFiles.get(childRa.Old_Rental_Apply__c)){
+                //             newFiles.add(new Attachment(Body = att.Body,Name = att.Name, ParentId = childRa.Id));
+                //         }
+                //     }
+                // }
+                // if(!deleteFiles.isEmpty()) {
+                //     delete deleteFiles;
+                // }
+                // if(!newFiles.isEmpty()) {
+                //     insert newFiles;
+                // }
             }
         }
     }
@@ -241,6 +296,7 @@
         List<Rental_Apply__Share> rasList = new List<Rental_Apply__Share>();
         List<Id> deleteOfficeAssistantShare_nObjId_List = new List<Id>();       // 鍏变韩鍒犻櫎鐢�
         List<Id> deleteApplyUserShare_nObjId_List = new List<Id>();// 20210727 ljh SFDC-C54C33 鍏变韩鍒犻櫎鐢�
+        Set<Id> shareSet = new Set<Id>(); // 20230301 ljh DB202302444522 add
         for (Rental_Apply__c nObj : newList) {
             Rental_Apply__c oObj = (null == this.oldMap) ? null : this.oldMap.get(nObj.Id);
             // 鏈嶅姟閮ㄥ鎵逛汉
@@ -296,6 +352,7 @@
                 ) {
                 deleteApplyUserShare_nObjId_List.add(nObj.Id);
                 if(nObj.SalesManager__c != null){
+                    shareSet.add(nObj.SalesManager__c);// 20230301 ljh DB202302444522 add
                     Rental_Apply__Share rasSalesManager = new Rental_Apply__Share(
                             RowCause = 'ApplyUserShare__c',
                             ParentId = nObj.Id,
@@ -305,6 +362,7 @@
                     rasList.add(rasSalesManager);
                 }
                 if(nObj.BuchangApprovalManagerSales__c != null){
+                    shareSet.add(nObj.BuchangApprovalManagerSales__c);// 20230301 ljh DB202302444522 add
                     Rental_Apply__Share rasBz = new Rental_Apply__Share(
                             RowCause = 'ApplyUserShare__c',
                             ParentId = nObj.Id,
@@ -314,6 +372,7 @@
                     rasList.add(rasBz);
                 }
                 if(nObj.ZongjianApprovalManager__c != null){
+                    shareSet.add(nObj.ZongjianApprovalManager__c);// 20230301 ljh DB202302444522 add
                     Rental_Apply__Share rasZj = new Rental_Apply__Share(
                             RowCause = 'ApplyUserShare__c',
                             ParentId = nObj.Id,
@@ -336,10 +395,18 @@
         if(deleteOfficeAssistantShare_nObjId_List.size() > 0){
             soql += ' AND (RowCause = \'Office_Assistant__c\' AND ParentId =: deleteOfficeAssistantShare_nObjId_List) ';
             if(deleteApplyUserShare_nObjId_List.size() > 0){
-                soql += ' OR (RowCause = \'ApplyUserShare__c\'AND ParentId =: deleteApplyUserShare_nObjId_List)';
+                // 20230301 ljh DB202302444522 update start
+                // soql += ' OR (RowCause = \'ApplyUserShare__c\'AND ParentId =: deleteApplyUserShare_nObjId_List)';
+                soql += ' OR (RowCause = \'ApplyUserShare__c\'AND ParentId =: deleteApplyUserShare_nObjId_List';
+                soql += ' and UserOrGroupId IN :shareSet)';
+                // 20230301 ljh DB202302444522 update end
             }
         }else if(deleteApplyUserShare_nObjId_List.size() > 0){
-            soql += ' AND (RowCause = \'ApplyUserShare__c\'AND ParentId =: deleteApplyUserShare_nObjId_List)';
+            // 20230301 ljh DB202302444522 update start
+            // soql += ' AND (RowCause = \'ApplyUserShare__c\'AND ParentId =: deleteApplyUserShare_nObjId_List)';
+            soql += ' AND (RowCause = \'ApplyUserShare__c\'AND ParentId =: deleteApplyUserShare_nObjId_List';
+            soql += ' and UserOrGroupId IN :shareSet)';
+            // 20230301 ljh DB202302444522 update end
         }
         List<Rental_Apply__Share> deleteShareList = new List<Rental_Apply__Share>();
         if(deleteOfficeAssistantShare_nObjId_List.size() > 0 || deleteApplyUserShare_nObjId_List.size() > 0){
@@ -1899,7 +1966,6 @@
 
     @testVisible
     private void testI() {
-        Integer i = 0;
-        
+       
     }
 }
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexAssetMaintainHeaderAbandon/lexAssetMaintainHeaderAbandon.js b/force-app/main/default/lwc/lexAssetMaintainHeaderAbandon/lexAssetMaintainHeaderAbandon.js
index 5127851..5dd68df 100644
--- a/force-app/main/default/lwc/lexAssetMaintainHeaderAbandon/lexAssetMaintainHeaderAbandon.js
+++ b/force-app/main/default/lwc/lexAssetMaintainHeaderAbandon/lexAssetMaintainHeaderAbandon.js
@@ -2,6 +2,7 @@
 import { CurrentPageReference,NavigationMixin } from 'lightning/navigation';
 import { CloseActionScreenEvent } from 'lightning/actions';
 import { updateRecord } from 'lightning/uiRecordApi';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
 
 import abandon from '@salesforce/apex/AssetMaintainHeaderWebService.abandon';
 import applyPermission from '@salesforce/apex/AssetMaintainHeaderWebService.applyPermission';
@@ -23,12 +24,15 @@
 
     connectedCallback(){
     	applyPermission().then(res=>{
+            this.IsLoading = false;
+            console.log("res11111:"+res);
     		if(res=='false'){
-    			this.showToast('娌℃湁鎿嶄綔搴熷純鐨勬潈闄�','error');
+    			this.showToast('娌℃湁鎻愪氦鐢宠鐨勬潈闄�','error');
     		}else{
     			abandon({
     				amhId: this.recordId
 		    	}).then(result=>{
+                    console.log("result11111:"+result);
 		    		if(result=='1'){
 		    			this.showToast('宸插惎鍔˙atch锛屽畬鎴愭椂浼氭湁閭欢鎻愰啋','success');
 		    		}else{
diff --git a/force-app/main/default/lwc/lexAssetMaintainHeaderDeleteApply/lexAssetMaintainHeaderDeleteApply.js b/force-app/main/default/lwc/lexAssetMaintainHeaderDeleteApply/lexAssetMaintainHeaderDeleteApply.js
index db8c855..bdfa1dd 100644
--- a/force-app/main/default/lwc/lexAssetMaintainHeaderDeleteApply/lexAssetMaintainHeaderDeleteApply.js
+++ b/force-app/main/default/lwc/lexAssetMaintainHeaderDeleteApply/lexAssetMaintainHeaderDeleteApply.js
@@ -2,6 +2,7 @@
 import { CurrentPageReference,NavigationMixin } from 'lightning/navigation';
 import { CloseActionScreenEvent } from 'lightning/actions';
 import { updateRecord } from 'lightning/uiRecordApi';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
 
 import deleteApply from '@salesforce/apex/AssetMaintainHeaderWebService.deleteApply';
 import applyPermission from '@salesforce/apex/AssetMaintainHeaderWebService.applyPermission';
@@ -24,11 +25,13 @@
      connectedCallback(){
      	applyPermission().then(res=>{
     		if(res=='false'){
+                this.IsLoading = false;
     			this.showToast('娌℃湁鍒犻櫎鐢宠鐨勬潈闄�','error');
     		}else if(confirm("鏄惁纭畾鍒犻櫎锛�")){
     			deleteApply({
     				amhId:this.recordId
     			}).then(result=>{
+                    console.log("result2222:"+result);
     				if(result=='1'){
     					this.showToast('宸插惎鍔˙atch锛屽畬鎴愭椂浼氭湁閭欢鎻愰啋','success');
     				}else{
diff --git a/force-app/main/default/lwc/lexConsumApplyEquipmentSetReassign/lexConsumApplyEquipmentSetReassign.css b/force-app/main/default/lwc/lexConsumApplyEquipmentSetReassign/lexConsumApplyEquipmentSetReassign.css
index 635bc6c..4da4f48 100644
--- a/force-app/main/default/lwc/lexConsumApplyEquipmentSetReassign/lexConsumApplyEquipmentSetReassign.css
+++ b/force-app/main/default/lwc/lexConsumApplyEquipmentSetReassign/lexConsumApplyEquipmentSetReassign.css
@@ -1,22 +1,22 @@
-.outerBorderCss{
-    border: 1px solid #D4D4D4;
-    border-radius : 5px;
-    border-top : 3px solid #565959;
-}
-.borderCss{
-    border: 1px solid #D4D4D4;
-    border-radius : 5px;
-    margin-bottom : 7px;
-    border-top : 3px solid #565959;
-}
-.headerDorderCss{
-    border-top: 1px solid #565959;
-    border-bottom: 1px solid #D4D4D4;
-    padding:3px;
-}
-.centerCss{
+.holder{
+    position: relative;
+    display: inline-block;
+    width: 80px;
+    height: 80px;
     text-align: center;
 }
-.centerCss .left{
-    margin-left: 100px;
-}/* sample css file */
\ No newline at end of file
+
+.container .uiContainerManager{
+    display : none !important;
+}
+.toast{
+    border: 1px solid #c9c9c9;
+    border-radius: 10px; 
+    width: 50%;
+    margin: 0 auto;
+    font-size: 18px;
+    font-weight: bold;
+    padding: 10px 20px;
+    background: #feb75d;
+    display: flex;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexConsumApplyEquipmentSetReassign/lexConsumApplyEquipmentSetReassign.html b/force-app/main/default/lwc/lexConsumApplyEquipmentSetReassign/lexConsumApplyEquipmentSetReassign.html
index 49a10f7..bc79a95 100644
--- a/force-app/main/default/lwc/lexConsumApplyEquipmentSetReassign/lexConsumApplyEquipmentSetReassign.html
+++ b/force-app/main/default/lwc/lexConsumApplyEquipmentSetReassign/lexConsumApplyEquipmentSetReassign.html
@@ -1,5 +1,13 @@
 <template>
-    <div class="sisToOPDHolder" if:true={IsLoading}>
-        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
-    </div>
+  <div class="holder" if:true={IsLoading}>
+      <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+  </div>
+  <div if:true={IsDisplay} class="toast">
+    <span style="padding: 10px;">{msg}</span>
+    <button class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse" onclick={closeAction} title="Close" style="background-color: #e5e4e2;margin-top: 15px;">
+                <lightning-icon class="greyIcon" icon-name="utility:close" alternative-text="Connected" variant="inverse" size="small"
+                    title="Close"  style="color: black;"></lightning-icon>
+              <span class="slds-assistive-text">Close</span>
+        </button>
+  </div>
 </template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexConsumApplyEquipmentSetReassign/lexConsumApplyEquipmentSetReassign.js b/force-app/main/default/lwc/lexConsumApplyEquipmentSetReassign/lexConsumApplyEquipmentSetReassign.js
index 4debcb6..a6b7178 100644
--- a/force-app/main/default/lwc/lexConsumApplyEquipmentSetReassign/lexConsumApplyEquipmentSetReassign.js
+++ b/force-app/main/default/lwc/lexConsumApplyEquipmentSetReassign/lexConsumApplyEquipmentSetReassign.js
@@ -3,54 +3,53 @@
 import { CloseActionScreenEvent } from 'lightning/actions';
 import { updateRecord } from 'lightning/uiRecordApi';
 import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import LightningConfirm from 'lightning/confirm';
 
-import reassign from '@salesforce/apex/ConsumApplyEquipmentSetReaController.reassign';
+import reassign from '@salesforce/apex/LexConsumApplyEquipmentSetReaController.reassign';
 
 export default class LexConsumApplyEquipmentSetReassign extends LightningElement {
     @api recordId;
     @api consumEquipmentId;
     IsLoading = true;
-
-    @wire(CurrentPageReference)
-     getStateParameters(currentPageReference) {
-         if (currentPageReference) {
-           const urlValue = currentPageReference.state.recordId;
-           if (urlValue) {
-             let str = `${urlValue}`;
-             console.log("str:"+str);
-             this.recordId = str;
-            }
-         }
-     }
+    IsDisplay=false;
+    //鎻愮ず淇℃伅
+    msg;
 
      connectedCallback(){
       this.IsLoading = false;
       reassign({recordId:this.recordId}).then(result=>{
-            console.log('result--->'+result);
-            if (result.status != '宸插嚭搴撴寚绀�' ) {
-              this.showToast('鑰楁潗璇峰崟娌℃湁鍑哄簱鎸囩ず涓嶈兘閲嶆柊鍒嗛厤','error')
-              return;
+            console.log('result--->'+ JSON.stringify(result));
+            console.log('this.recordId--->'+this.recordId);
+            if(this.consumEquipmentId){
+              if (result.status != '宸插嚭搴撴寚绀�' ) {
+                this.IsDisplay = true;
+                this.msg = '鑰楁潗璇峰崟娌℃湁鍑哄簱鎸囩ず涓嶈兘閲嶆柊鍒嗛厤';
+                return;
+              }
+
+              LightningConfirm.open({
+                message: "浣犵‘瀹氳閲嶆柊鍒嗛厤鍚�?",
+                variant: 'headerless',
+                label: '鎻愮ず淇℃伅',
+                // setting theme would have no effect
+              }).then(submit=>{
+                  this.dispatchEvent(new CloseActionScreenEvent());
+                  window.open("/apex/ConsumReassign?caid="+this.recordId);
+                  this.closeAction();
+                  return;
+              })
+            }else{
+              this.IsDisplay = true;
+              this.msg = '鏈�夋嫨鑰楁潗澶囧搧閰嶅涓�瑙�';
             }
-            if(confirm('浣犵‘瀹氳閲嶆柊鍒嗛厤鍚�')){
-                window.open("/apex/ConsumReassign?caid="+this.recordId);
-            }
-            
-            // window.location.href = "/apex/ConsumReassign?caid={!Consum_Apply__c.Id}";
         })
     }
 
-    showToast(msg,type) {
-      const event = new ShowToastEvent({
-          title: '',
-          message: msg,
-          variant: type
-      });
-      this.dispatchEvent(event);
-      this.dispatchEvent(new CloseActionScreenEvent());
+    updateRecordView(recordId) {
+        updateRecord({fields: { Id: recordId }});
     }
 
-
-     updateRecordView(recordId) {
-        updateRecord({fields: { Id: recordId }});
+    closeAction() {
+      window.open("/"+this.recordId,'_self');
     }
 }
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexConsumApplySubmitApprovalProcess/lexConsumApplySubmitApprovalProcess.js b/force-app/main/default/lwc/lexConsumApplySubmitApprovalProcess/lexConsumApplySubmitApprovalProcess.js
index 5ddbbec..dc9c901 100644
--- a/force-app/main/default/lwc/lexConsumApplySubmitApprovalProcess/lexConsumApplySubmitApprovalProcess.js
+++ b/force-app/main/default/lwc/lexConsumApplySubmitApprovalProcess/lexConsumApplySubmitApprovalProcess.js
@@ -152,6 +152,7 @@
           // }
 
             //娌℃湁this.status == '寮曞綋瀹屼簡'鐘舵��
+            console.log("鐘舵��---------",this.status);
           if(this.status == '濉啓瀹屾瘯' || this.status == '鐢宠涓�' || this.status == '宸叉壒鍑�'
             || this.status == '宸插嚭搴撴寚绀�' || this.status == '鍒犻櫎' || this.status == '鍙栨秷'){
             this.showToast('璇峰鍝佺敵璇风姸鎬佺‘璁わ紝宸茬粡鎻愪氦杩囩殑鐢宠锛屼笉鑳介噸澶嶆彁浜�','error');

--
Gitblit v1.9.1