From 44ed00f66817d069afafb09c19e7ff87162b65c2 Mon Sep 17 00:00:00 2001
From: unknown <sunxia@prec-tech.com>
Date: 星期四, 20 七月 2023 15:54:01 +0800
Subject: [PATCH] button-lexFeedbackReport

---
 force-app/main/default/lwc/lexFeedbackReport/lexFeedbackReport.html       |    3 -
 force-app/main/default/lwc/lexFeedbackReport/lexFeedbackReport.js         |   36 +++++++++--------
 force-app/main/default/classes/LexRentalApplyFaultController.cls-meta.xml |    5 ++
 force-app/main/default/classes/LexRentalApplyFaultController.cls          |   41 ++++++++++++++++++++
 4 files changed, 65 insertions(+), 20 deletions(-)

diff --git a/force-app/main/default/classes/LexRentalApplyFaultController.cls b/force-app/main/default/classes/LexRentalApplyFaultController.cls
new file mode 100644
index 0000000..3298d0f
--- /dev/null
+++ b/force-app/main/default/classes/LexRentalApplyFaultController.cls
@@ -0,0 +1,41 @@
+/**
+ * *
+    ODescription:
+    GAuthor: sun xia
+    @Date: 2023-07-11 15:31:56
+    GIastEditors: sun xia
+    @IastEditTime: 2023-07-17 15:31:56
+ * */
+public with sharing class LexRentalApplyFaultController {
+    @AuraEnabled
+    public static Rental_Apply_Fault__c init(String recordId){
+        try {
+            List<Rental_Apply_Fault__c> rafList = [Select Id, status__c from Rental_Apply_Fault__c where Id = :recordId];
+            if(rafList.size()>0){
+                return rafList[0];
+            }
+        }
+        catch (Exception e) {
+            System.debug(LoggingLevel.INFO, '*** e.getMessage()+e.getLineNumber(): ' + e.getMessage()+e.getLineNumber());
+            
+        }
+        return null;
+    }
+
+    @AuraEnabled
+    public static String updateRentalApplyFaultStatus(String recordId, String updateStatus){
+        Savepoint sp = Database.setSavepoint();
+        try {
+            Rental_Apply_Fault__c updateRaf = new Rental_Apply_Fault__c();
+            updateRaf.Id = recordId;
+            updateRaf.status__c = updateStatus;
+            Update updateRaf;
+            return 'SUCCESS';
+        }
+        catch (Exception e) {
+            Database.rollback(sp);
+            System.debug(LoggingLevel.INFO, '*** e.getMessage()+e.getLineNumber(): ' + e.getMessage()+e.getLineNumber());
+            return e.getMessage();
+        }
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexRentalApplyFaultController.cls-meta.xml b/force-app/main/default/classes/LexRentalApplyFaultController.cls-meta.xml
new file mode 100644
index 0000000..9662499
--- /dev/null
+++ b/force-app/main/default/classes/LexRentalApplyFaultController.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>50.0</apiVersion>
+    <status>Active</status>
+</ApexClass>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexFeedbackReport/lexFeedbackReport.html b/force-app/main/default/lwc/lexFeedbackReport/lexFeedbackReport.html
index 49a10f7..ba53413 100644
--- a/force-app/main/default/lwc/lexFeedbackReport/lexFeedbackReport.html
+++ b/force-app/main/default/lwc/lexFeedbackReport/lexFeedbackReport.html
@@ -1,5 +1,2 @@
 <template>
-    <div class="sisToOPDHolder" if:true={IsLoading}>
-        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
-    </div>
 </template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexFeedbackReport/lexFeedbackReport.js b/force-app/main/default/lwc/lexFeedbackReport/lexFeedbackReport.js
index 327730f..ddb8d31 100644
--- a/force-app/main/default/lwc/lexFeedbackReport/lexFeedbackReport.js
+++ b/force-app/main/default/lwc/lexFeedbackReport/lexFeedbackReport.js
@@ -3,12 +3,10 @@
 import { ShowToastEvent } from 'lightning/platformShowToastEvent';
 import { CurrentPageReference } from 'lightning/navigation';
 
-import init from '@salesforce/apex/RentalApplyFaultController.init';
-import updateRentalApplyFaultStatus from '@salesforce/apex/RentalApplyFaultController.updateRentalApplyFaultStatus';
+import init from '@salesforce/apex/LexRentalApplyFaultController.init';
+import updateRentalApplyFaultStatus from '@salesforce/apex/LexRentalApplyFaultController.updateRentalApplyFaultStatus';
 export default class lexFeedbackReport extends LightningElement {
 	@api recordId;
-	IsLoading = true;
-
 	@wire(CurrentPageReference)
 	getStateParameters(currentPageReference){
 		if(currentPageReference) {
@@ -24,21 +22,25 @@
 		init({
 			recordId: this.recordId
 		}).then(res=>{
-			if(res.status__c!='宸插彂閫�'){
+			if(res){
+				if(res.status__c!='宸插彂閫�'){
 				this.showToast('鍙湁宸插彂閫佺殑妫�娴嬪垎鏋愭姤鍛婃墠鑳藉彂閫�','warning');
-				return;
-			}
-
-			updateRentalApplyFaultStatus({
-				recordId: this.recordId,
-				updateStatus: '宸插弽棣�'
-			}).then(result=>{
-				if(result=='SUCCESS'){
-					this.showToast('鎶ュ憡宸插弽棣�','success');
-				}else{
-					this.showToast(res,'error');
+					return;
 				}
-			})
+
+				updateRentalApplyFaultStatus({
+					recordId: this.recordId,
+					updateStatus: '宸插弽棣�'
+				}).then(result=>{
+					if(result=='SUCCESS'){
+						this.showToast('鎶ュ憡宸插弽棣�','success');
+					}else{
+						this.showToast(res,'error');
+					}
+				})
+			}else{
+				this.showToast('鏈煡璇㈠埌鏁版嵁','warning');
+			}
 		})
 	}
 

--
Gitblit v1.9.1