From dfff58b7cd897b824a129edba6b5cdae20bb1e5c Mon Sep 17 00:00:00 2001
From: unknown <sunxia@prec-tech.com>
Date: 星期三, 23 八月 2023 17:40:58 +0800
Subject: [PATCH] 发起再注册分析并同步SAP

---
 force-app/main/default/lwc/lexFSESubmit/lexFSESubmit.js          |   83 +++++++++++++++++++++++++++++++++++++++++
 force-app/main/default/lwc/lexFSESubmit/lexFSESubmit.js-meta.xml |   11 +++++
 force-app/main/default/lwc/lexFSESubmit/lexFSESubmit.html        |    3 +
 3 files changed, 97 insertions(+), 0 deletions(-)

diff --git a/force-app/main/default/lwc/lexFSESubmit/lexFSESubmit.html b/force-app/main/default/lwc/lexFSESubmit/lexFSESubmit.html
new file mode 100644
index 0000000..af9fa97
--- /dev/null
+++ b/force-app/main/default/lwc/lexFSESubmit/lexFSESubmit.html
@@ -0,0 +1,3 @@
+<template>
+
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexFSESubmit/lexFSESubmit.js b/force-app/main/default/lwc/lexFSESubmit/lexFSESubmit.js
new file mode 100644
index 0000000..d1e5a38
--- /dev/null
+++ b/force-app/main/default/lwc/lexFSESubmit/lexFSESubmit.js
@@ -0,0 +1,83 @@
+import { LightningElement, track, wire, api } from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import { updateRecord } from 'lightning/uiRecordApi';
+
+import init from '@salesforce/apex/lexRepairAgainAnController.init';
+import updateRepairAgainStatus from '@salesforce/apex/lexRepairAgainAnController.updateRepairAgainStatus';
+//鍙戣捣鍐嶆敞鍐屽垎鏋愬苟鍚屾SAP
+export default class lexFSESubmit extends LightningElement {
+	@api recordId;
+    IsLoading = true;
+
+    @wire(CurrentPageReference)
+    getStateParameters(currentPageReference) {
+
+        if (currentPageReference) {
+           const urlValue = currentPageReference.state.recordId;
+           if (urlValue) {
+             let str = `${urlValue}`;
+             console.log("str");
+             console.log(str);
+             this.recordId = str;
+           }
+         }
+    }
+
+    connectedCallback () {
+    	init({
+    		recordId: this.recordId
+    	}).then(res=>{
+    		if(res){
+    			this.IsLoading = false;
+
+                if(res.repairAgainStatus == '鍙栨秷'){
+                    this.showToast('鍙栨秷鍚庣殑鍐嶄慨鐞嗚繑鍝佸垎鏋愪笉鍏佽鍐嶆彁浜わ紝濡傛灉闇�瑕佹彁浜よ鐐瑰嚮\"澶嶅埗\"鎸夐挳閲嶆柊鐢熸垚涓�涓啀淇悊杩斿搧鍒嗘瀽','warning');
+                    return;
+                }
+                console.log('res==='+JSON.stringify(res));
+    			if(res.repairAgainStatus != '鑽夋涓�' && res.repairAgainStatus != '鍙栨秷'){
+    				this.showToast('宸茬粡鎻愪氦','warning');
+    				return;
+    			}
+
+                console.log(res.rCConfirmer+""===+res.repairLast);
+    			if(res.rCConfirmer == '' || res.repairLast == null){
+    				this.showToast('銆怰C纭鑰呫�戞垨銆愪笂娆′慨鐞嗐�戜负绌烘椂涓嶈兘鎻愪氦鐢宠','warning');
+    				return;
+    			}
+
+    			updateRepairAgainStatus({
+    				recordId: this.recordId,
+    				updateStatus: 'RC濉啓瀹屾瘯'
+    			}).then(result=>{
+    				if(result == 'SUCCESS'){
+    					this.showToast('鎻愪氦鎴愬姛','success');
+	    				return;
+    				}
+    				if(result == 'ERROR'){
+    					this.showToast('鎻愪氦澶辫触','error');
+	    				return;
+    				}
+    			})
+    		}
+    	})
+    }
+
+    showToast(msg,type) {
+        const event = new ShowToastEvent({
+            message: msg,
+            variant: type
+        });
+        if(type == 'success'){
+            this.updateRecordView(this.recordId);
+        }
+        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/lexFSESubmit/lexFSESubmit.js-meta.xml b/force-app/main/default/lwc/lexFSESubmit/lexFSESubmit.js-meta.xml
new file mode 100644
index 0000000..36674f9
--- /dev/null
+++ b/force-app/main/default/lwc/lexFSESubmit/lexFSESubmit.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexFSESubmit">
+     <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