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.js |   65 ++++++++++++++++----------------
 1 files changed, 32 insertions(+), 33 deletions(-)

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

--
Gitblit v1.9.1