From c176575f639ac3bf3e5eb5acec11bcdd9905572c Mon Sep 17 00:00:00 2001
From: unknown <sunxia@prec-tech.com>
Date: 星期四, 06 七月 2023 11:45:33 +0800
Subject: [PATCH] 发送报告

---
 force-app/main/default/lwc/lexSendReport/lexSendReport.js-meta.xml |   11 +++++
 force-app/main/default/lwc/lexSendReport/lexSendReport.css         |   22 +++++++++++
 force-app/main/default/lwc/lexSendReport/lexSendReport.html        |    2 +
 force-app/main/default/lwc/lexSendReport/lexSendReport.js          |   66 +++++++++++++++++++++++++++++++++
 4 files changed, 101 insertions(+), 0 deletions(-)

diff --git a/force-app/main/default/lwc/lexSendReport/lexSendReport.css b/force-app/main/default/lwc/lexSendReport/lexSendReport.css
new file mode 100644
index 0000000..635bc6c
--- /dev/null
+++ b/force-app/main/default/lwc/lexSendReport/lexSendReport.css
@@ -0,0 +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{
+    text-align: center;
+}
+.centerCss .left{
+    margin-left: 100px;
+}/* sample css file */
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSendReport/lexSendReport.html b/force-app/main/default/lwc/lexSendReport/lexSendReport.html
new file mode 100644
index 0000000..ba53413
--- /dev/null
+++ b/force-app/main/default/lwc/lexSendReport/lexSendReport.html
@@ -0,0 +1,2 @@
+<template>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSendReport/lexSendReport.js b/force-app/main/default/lwc/lexSendReport/lexSendReport.js
new file mode 100644
index 0000000..bb442ab
--- /dev/null
+++ b/force-app/main/default/lwc/lexSendReport/lexSendReport.js
@@ -0,0 +1,66 @@
+import { LightningElement, track, wire, api } from 'lwc';
+import { CloseActionScreenEvent } from 'lightning/actions';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import { CurrentPageReference } from 'lightning/navigation';
+
+import init from '@salesforce/apex/RentalApplyFaultController.init';
+import updateRentalApplyFaultStatus from '@salesforce/apex/RentalApplyFaultController.updateRentalApplyFaultStatus';
+export default class lexSendReport extends LightningElement {
+
+	@api recordId;
+	IsLoading = true;
+
+	@wire(CurrentPageReference)
+	getStateParameters(currentPageReference){
+		if(currentPageReference) {
+			const urlValue = currentPageReference.state.recordId;
+			if(urlValue) {
+				let str = `${urlValue}`;
+		        this.recordId = str;
+			}
+		}
+	}
+
+	connectedCallback(){
+		init({
+			recordId: this.recordId
+		}).then(res=>{
+			console.log('res==='+JSON.stringify(res));
+			if(res.status__c!='鑽夋涓�' && res.status__c!=''){
+				this.showToast('鍙湁鑽夋涓殑妫�娴嬪垎鏋愭姤鍛婃墠鑳藉彂閫佹姤鍛�','warning');
+				return;
+			}
+
+			updateRentalApplyFaultStatus({
+				recordId: this.recordId,
+				updateStatus: '宸插彂閫�'
+			}).then(result=>{
+				console.log('result==='+result);
+				if(result=='SUCCESS'){
+					this.showToast('鎶ュ憡宸插彂閫�','success');
+				}else{
+					this.showToast(res.getMessage(),'error');
+				}
+			})
+		}).catch(err=>{
+			console.log('init=='+err);
+		})
+	}
+
+
+	showToast(msg,type) {
+        const event = new ShowToastEvent({
+            message: msg,
+            variant: type
+        });
+        if(type == 'success'){
+            this.updateRecordView();
+        }
+        this.dispatchEvent(event);
+        this.dispatchEvent(new CloseActionScreenEvent());
+    }
+
+    updateRecordView(recordId) {
+        updateRecord({fields: { Id: recordId }});
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSendReport/lexSendReport.js-meta.xml b/force-app/main/default/lwc/lexSendReport/lexSendReport.js-meta.xml
new file mode 100644
index 0000000..e1f65e1
--- /dev/null
+++ b/force-app/main/default/lwc/lexSendReport/lexSendReport.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexSendReport">
+    <apiVersion>54.0</apiVersion>
+    <isExposed>true</isExposed>
+    <targets>
+        <target>lightning__RecordPage</target>
+        <target>lightning__AppPage</target>
+        <target>lightning__HomePage</target>
+        <target>lightning__RecordAction</target>
+    </targets>
+</LightningComponentBundle>
\ No newline at end of file

--
Gitblit v1.9.1