From 44224f92bc02b73db5069cf649daeb103561eb78 Mon Sep 17 00:00:00 2001
From: 19626 <1962676589@qq.com>
Date: 星期二, 04 四月 2023 09:44:46 +0800
Subject: [PATCH] update button 4.4

---
 force-app/main/default/lwc/lexDispatchOCSMQARA/lexDispatchOCSMQARA.js-meta.xml               |   11 +
 force-app/main/default/lwc/lexCancel/lexCancel.js                                            |   95 ++++++++
 force-app/main/default/lwc/lexDispatchOCSMQARA/lexDispatchOCSMQARA.html                      |    6 
 force-app/main/default/lwc/lexVOCAnswer/lexVOCAnswer.js                                      |   84 +++++++
 force-app/main/default/lwc/lexOCSMToReport/lexOCSMToReport.js                                |   88 ++++++++
 force-app/main/default/lwc/lexSIStoOPD/lexSIStoOPD.js-meta.xml                               |   11 +
 force-app/main/default/lwc/lexVOCAnswer/lexVOCAnswer.js-meta.xml                             |   11 +
 force-app/main/default/lwc/lexSIStoOPD/lexSIStoOPD.css                                       |   10 
 force-app/main/default/lwc/lexCancel/lexCancel.css                                           |   10 
 force-app/main/default/lwc/lexCancel/lexCancel.html                                          |    6 
 force-app/main/default/lwc/lexSIStoOPD/lexSIStoOPD.js                                        |   96 ++++++++
 force-app/main/default/lwc/lexVOCAnswer/lexVOCAnswer.css                                     |   10 
 force-app/main/default/lwc/lexOCSMToReport/lexOCSMToReport.js-meta.xml                       |   11 +
 force-app/main/default/lwc/lexOCSMNoToReportForReport/lexOCSMNoToReportForReport.js          |   82 +++++++
 force-app/main/default/lwc/lexDispatchOCSMQARA/lexDispatchOCSMQARA.js                        |   59 +++++
 force-app/main/default/lwc/lexOCSMNoToReportForReport/lexOCSMNoToReportForReport.js-meta.xml |   11 +
 force-app/main/default/lwc/lexDispatchOCSMQARA/lexDispatchOCSMQARA.css                       |   10 
 force-app/main/default/lwc/lexCancel/lexCancel.js-meta.xml                                   |   11 +
 force-app/main/default/lwc/lexVOCAnswer/lexVOCAnswer.html                                    |    7 
 force-app/main/default/lwc/lexOCSMNoToReportForReport/lexOCSMNoToReportForReport.html        |    6 
 force-app/main/default/lwc/lexOCSMToReport/lexOCSMToReport.css                               |   10 
 force-app/main/default/lwc/lexSIStoOPD/lexSIStoOPD.html                                      |    6 
 force-app/main/default/lwc/lexOCSMToReport/lexOCSMToReport.html                              |    6 
 23 files changed, 657 insertions(+), 0 deletions(-)

diff --git a/force-app/main/default/lwc/lexCancel/lexCancel.css b/force-app/main/default/lwc/lexCancel/lexCancel.css
new file mode 100644
index 0000000..6e1b0a2
--- /dev/null
+++ b/force-app/main/default/lwc/lexCancel/lexCancel.css
@@ -0,0 +1,10 @@
+.cancelHolder{
+    position: relative;
+    display: inline-block;
+    width: 80px;
+    height: 80px;
+    text-align: center;
+}
+.container .uiContainerManager{
+	display: none !important;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCancel/lexCancel.html b/force-app/main/default/lwc/lexCancel/lexCancel.html
new file mode 100644
index 0000000..61b5906
--- /dev/null
+++ b/force-app/main/default/lwc/lexCancel/lexCancel.html
@@ -0,0 +1,6 @@
+<template>
+    <div class="cancelHolder" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+        <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button>
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCancel/lexCancel.js b/force-app/main/default/lwc/lexCancel/lexCancel.js
new file mode 100644
index 0000000..18c6654
--- /dev/null
+++ b/force-app/main/default/lwc/lexCancel/lexCancel.js
@@ -0,0 +1,95 @@
+import { api, wire,LightningElement } from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import init  from '@salesforce/apex/ReportController.initForCancelButton';
+import updateForCancelButton  from '@salesforce/apex/ReportController.updateForCancelButton';
+import { updateRecord } from 'lightning/uiRecordApi';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+export default class LexCancel extends LightningElement {
+    @api recordId;
+    status;
+    IsLoading = true;
+    @wire(CurrentPageReference)
+    getStateParameters(currentPageReference) {
+            console.log(111);
+            console.log(currentPageReference);
+
+        if (currentPageReference) {
+          const urlValue = currentPageReference.state.recordId;
+          if (urlValue) {
+            let str = `${urlValue}`;
+            console.log("str");
+            console.log(str);
+            this.recordId = str;
+          }
+        }
+    }
+
+
+
+    connectedCallback(){
+        console.log(this.recordId);
+        init({
+            recordId: this.recordId
+        }).then(result => {
+            console.log(result);
+            if (result != null) {
+                this.IsLoading = false;
+                this.status = result.status;
+                console.log(this.status);
+                this.cancel();
+
+            }
+        }).catch(error => {
+            console.log("error");
+            console.log(error);
+        }).finally(() => {
+            
+        });
+
+    }
+
+    showToast(msg,type) {
+        const event = new ShowToastEvent({
+            title: '',
+            message: msg,
+            variant: type
+        });
+        this.dispatchEvent(event);
+    }
+
+
+    updateRecordView(recordId) {
+        updateRecord({fields: { Id: recordId }});
+    }
+
+    cancel () {
+        if (this.status == "鍙栨秷") {
+            ShowToastEvent("宸茬粡鍙栨秷锛�","error");
+            this.dispatchEvent(new CloseActionScreenEvent());
+            return;
+            }
+        if (this.status == "鎵瑰噯") {
+            ShowToastEvent("宸茬粡鎵瑰噯锛屼笉鑳藉垹闄わ紒","error");
+            this.dispatchEvent(new CloseActionScreenEvent());
+            return;
+        }
+        if (this.status == "瀹屾瘯") {
+            ShowToastEvent("宸茬粡瀹屾瘯锛屼笉鑳藉垹闄わ紒","error");
+            this.dispatchEvent(new CloseActionScreenEvent());
+            return;
+        }
+        if (this.status == "鎻愪氦") {
+            ShowToastEvent("宸茬粡鎻愪氦锛屼笉鑳藉垹闄わ紒","error");
+            this.dispatchEvent(new CloseActionScreenEvent());
+            return;
+        }
+        updateForCancelButton({
+            recordId: this.recordId
+        }).then(result =>{
+            this.showToast("鍙栨秷鎴愬姛锛�","success");
+            this.updateRecordView(this.recordId);
+            this.dispatchEvent(new CloseActionScreenEvent());
+        });
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCancel/lexCancel.js-meta.xml b/force-app/main/default/lwc/lexCancel/lexCancel.js-meta.xml
new file mode 100644
index 0000000..329e839
--- /dev/null
+++ b/force-app/main/default/lwc/lexCancel/lexCancel.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+    <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
diff --git a/force-app/main/default/lwc/lexDispatchOCSMQARA/lexDispatchOCSMQARA.css b/force-app/main/default/lwc/lexDispatchOCSMQARA/lexDispatchOCSMQARA.css
new file mode 100644
index 0000000..3d14772
--- /dev/null
+++ b/force-app/main/default/lwc/lexDispatchOCSMQARA/lexDispatchOCSMQARA.css
@@ -0,0 +1,10 @@
+.dispatchOCSMQARAHolder{
+    position: relative;
+    display: inline-block;
+    width: 80px;
+    height: 80px;
+    text-align: center;
+}
+.container .uiContainerManager{
+	display: none !important;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexDispatchOCSMQARA/lexDispatchOCSMQARA.html b/force-app/main/default/lwc/lexDispatchOCSMQARA/lexDispatchOCSMQARA.html
new file mode 100644
index 0000000..894569c
--- /dev/null
+++ b/force-app/main/default/lwc/lexDispatchOCSMQARA/lexDispatchOCSMQARA.html
@@ -0,0 +1,6 @@
+<template>
+    <div class="dispatchOCSMQARAHolder" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+        <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button>
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexDispatchOCSMQARA/lexDispatchOCSMQARA.js b/force-app/main/default/lwc/lexDispatchOCSMQARA/lexDispatchOCSMQARA.js
new file mode 100644
index 0000000..6436e0b
--- /dev/null
+++ b/force-app/main/default/lwc/lexDispatchOCSMQARA/lexDispatchOCSMQARA.js
@@ -0,0 +1,59 @@
+import { api, wire,LightningElement } from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import updateForDispatchOCSMQARAButton  from '@salesforce/apex/ReportController.updateForDispatchOCSMQARAButton';
+import { updateRecord } from 'lightning/uiRecordApi';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+export default class LexDispatchOCSMQARA extends LightningElement {
+    @api recordId;
+    IsLoading = true;
+    
+
+    @wire(CurrentPageReference)
+    getStateParameters(currentPageReference) {
+            console.log(111);
+            console.log(currentPageReference);
+
+        if (currentPageReference) {
+          const urlValue = currentPageReference.state.recordId;
+          if (urlValue) {
+            let str = `${urlValue}`;
+            console.log("str");
+            console.log(str);
+            this.recordId = str;
+          }
+        }
+    }
+
+
+    connectedCallback(){
+        console.log(this.recordId);
+        this.IsLoading = false;
+        this.DispatchOCSMQARA();
+
+    }
+
+    showToast(msg,type) {
+        const event = new ShowToastEvent({
+            title: '',
+            message: msg,
+            variant: type
+        });
+        this.dispatchEvent(event);
+    }
+
+
+    updateRecordView(recordId) {
+        updateRecord({fields: { Id: recordId }});
+    }
+
+    DispatchOCSMQARA () {
+            updateForDispatchOCSMQARAButton({
+                recordId: this.recordId
+            }).then(result =>{
+                this.showToast("鎴愬姛","success");
+                this.updateRecordView(this.recordId);
+                this.dispatchEvent(new CloseActionScreenEvent());
+                });
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexDispatchOCSMQARA/lexDispatchOCSMQARA.js-meta.xml b/force-app/main/default/lwc/lexDispatchOCSMQARA/lexDispatchOCSMQARA.js-meta.xml
new file mode 100644
index 0000000..3392981
--- /dev/null
+++ b/force-app/main/default/lwc/lexDispatchOCSMQARA/lexDispatchOCSMQARA.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+    <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
diff --git a/force-app/main/default/lwc/lexOCSMNoToReportForReport/lexOCSMNoToReportForReport.html b/force-app/main/default/lwc/lexOCSMNoToReportForReport/lexOCSMNoToReportForReport.html
new file mode 100644
index 0000000..38c9114
--- /dev/null
+++ b/force-app/main/default/lwc/lexOCSMNoToReportForReport/lexOCSMNoToReportForReport.html
@@ -0,0 +1,6 @@
+<template>
+    <div class="reportHolder" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+        <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button>
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexOCSMNoToReportForReport/lexOCSMNoToReportForReport.js b/force-app/main/default/lwc/lexOCSMNoToReportForReport/lexOCSMNoToReportForReport.js
new file mode 100644
index 0000000..c52ad47
--- /dev/null
+++ b/force-app/main/default/lwc/lexOCSMNoToReportForReport/lexOCSMNoToReportForReport.js
@@ -0,0 +1,82 @@
+import { api, wire,LightningElement } from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import init  from '@salesforce/apex/ReportController.initForOCSMNoToReportButton';
+import updateForOCSMNoToReportButton  from '@salesforce/apex/ReportController.updateForOCSMNoToReportButton';
+import { updateRecord } from 'lightning/uiRecordApi';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+export default class LexOCSMNoToReportForReport extends LightningElement {
+    @api recordId;
+    IsLoading = true;
+    OCSMAdministrativeReportNumber;
+    OCSMAdministrativeReportDate;
+    AwareDate;
+
+
+    @wire(CurrentPageReference)
+    getStateParameters(currentPageReference) {
+            console.log(111);
+            console.log(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(result=>{
+            this.OCSMAdministrativeReportDate = result.OCSMAdministrativeReportDate;
+            this.OCSMAdministrativeReportNumber = result.OCSMAdministrativeReportNumber;
+            this.AwareDate = result.awareDate;
+            this.noToReport();
+        });
+    }
+
+
+    updateRecordView(recordId) {
+        updateRecord({fields: { Id: recordId }});
+    }
+
+    showToast(msg,type) {
+        const event = new ShowToastEvent({
+            title: '',
+            message: msg,
+            variant: type
+        });
+        this.dispatchEvent(event);
+    }
+
+    noToReport(){
+        if (!confirm("涓嶈鎶ュ憡鍚庢棤娉曟挙鍥烇紝鏄惁缁х画锛�")) {
+            this.dispatchEvent(new CloseActionScreenEvent());
+            return;
+        }
+        if(this.OCSMAdministrativeReportNumber != undefined || this.OCSMAdministrativeReportDate != undefined ){
+            this.showToast("宸茬粡鎶ュ憡鐨凲IS锛屼笉鍙互鐐瑰嚮OCSM涓嶈鎶ュ憡銆�","error");
+            this.dispatchEvent(new CloseActionScreenEvent());
+            return;
+        }
+        if(this.AwareDate != undefined ){
+           updateForOCSMNoToReportButton({
+                recordId: this.recordId
+           }).then(result=>{
+                this.showToast("OCSM涓嶈鎶ュ憡鎴愬姛","success");
+                this.updateRecordView(this.recordId);
+                this.dispatchEvent(new CloseActionScreenEvent());
+           });
+        }else{
+            this.showToast("娌℃湁AwareDate鎴栧凡缁廜CSM琛屾斂鎶ュ憡锛岃纭銆�","error");
+            this.dispatchEvent(new CloseActionScreenEvent());
+            return;
+        }
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexOCSMNoToReportForReport/lexOCSMNoToReportForReport.js-meta.xml b/force-app/main/default/lwc/lexOCSMNoToReportForReport/lexOCSMNoToReportForReport.js-meta.xml
new file mode 100644
index 0000000..3392981
--- /dev/null
+++ b/force-app/main/default/lwc/lexOCSMNoToReportForReport/lexOCSMNoToReportForReport.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+    <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
diff --git a/force-app/main/default/lwc/lexOCSMToReport/lexOCSMToReport.css b/force-app/main/default/lwc/lexOCSMToReport/lexOCSMToReport.css
new file mode 100644
index 0000000..ecc934d
--- /dev/null
+++ b/force-app/main/default/lwc/lexOCSMToReport/lexOCSMToReport.css
@@ -0,0 +1,10 @@
+.toReportHolder{
+    position: relative;
+    display: inline-block;
+    width: 80px;
+    height: 80px;
+    text-align: center;
+}
+.container .uiContainerManager{
+	display: none !important;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexOCSMToReport/lexOCSMToReport.html b/force-app/main/default/lwc/lexOCSMToReport/lexOCSMToReport.html
new file mode 100644
index 0000000..aaa4cbd
--- /dev/null
+++ b/force-app/main/default/lwc/lexOCSMToReport/lexOCSMToReport.html
@@ -0,0 +1,6 @@
+<template>
+    <div class="toReportHolder" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+        <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button>
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexOCSMToReport/lexOCSMToReport.js b/force-app/main/default/lwc/lexOCSMToReport/lexOCSMToReport.js
new file mode 100644
index 0000000..91b2722
--- /dev/null
+++ b/force-app/main/default/lwc/lexOCSMToReport/lexOCSMToReport.js
@@ -0,0 +1,88 @@
+import { api, wire,LightningElement } from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import init  from '@salesforce/apex/ReportController.initForOCSMToReportButton';
+import updateForOCSMToReportButton  from '@salesforce/apex/ReportController.updateForOCSMToReportButton';
+import { updateRecord } from 'lightning/uiRecordApi';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+export default class LexOCSMToReport extends LightningElement {
+    @api recordId;
+    IsLoading = true;
+    OCSMAdministrativeReportStatus;
+    awareDate;
+
+    @wire(CurrentPageReference)
+    getStateParameters(currentPageReference) {
+            console.log(111);
+            console.log(currentPageReference);
+
+        if (currentPageReference) {
+          const urlValue = currentPageReference.state.recordId;
+          if (urlValue) {
+            let str = `${urlValue}`;
+            console.log("str");
+            console.log(str);
+            this.recordId = str;
+          }
+        }
+    }
+
+
+
+    connectedCallback(){
+        console.log(this.recordId);
+        init({
+            recordId: this.recordId
+        }).then(result => {
+            console.log(result);
+            if (result != null) {
+                this.IsLoading = false;
+                this.OCSMAdministrativeReportStatus = result.OCSMAdministrativeReportStatus;
+                this.awareDate = result.awareDate;
+                this.toReport();
+            }
+        }).catch(error => {
+            console.log("error");
+            console.log(error);
+        }).finally(() => {
+            
+        });
+
+    }
+
+
+    showToast(msg,type) {
+        const event = new ShowToastEvent({
+            title: '',
+            message: msg,
+            variant: type
+        });
+        this.dispatchEvent(event);
+    }
+
+
+    updateRecordView(recordId) {
+        updateRecord({fields: { Id: recordId }});
+    }
+
+    toReport () {
+        if (!confirm("鎶ュ憡鍚庢棤娉曟挙鍥烇紝鏄惁缁х画锛�")) {
+            this.dispatchEvent(new CloseActionScreenEvent());
+            return;
+            }
+
+        if(this.OCSMAdministrativeReportStatus == undefined && this.awareDate != undefined ){
+            updateForOCSMToReportButton({
+                recordId: this.recordId
+            }).then(result =>{
+                this.showToast("鎴愬姛","success");
+                this.updateRecordView(this.recordId);
+                this.dispatchEvent(new CloseActionScreenEvent());
+                });
+        }else{
+            this.showToast("娌℃湁AwareDate鎴栧凡缁廜CSM琛屾斂鎶ュ憡锛岃纭銆�","error");
+            this.dispatchEvent(new CloseActionScreenEvent());
+            return;
+        }
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexOCSMToReport/lexOCSMToReport.js-meta.xml b/force-app/main/default/lwc/lexOCSMToReport/lexOCSMToReport.js-meta.xml
new file mode 100644
index 0000000..3392981
--- /dev/null
+++ b/force-app/main/default/lwc/lexOCSMToReport/lexOCSMToReport.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+    <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
diff --git a/force-app/main/default/lwc/lexSIStoOPD/lexSIStoOPD.css b/force-app/main/default/lwc/lexSIStoOPD/lexSIStoOPD.css
new file mode 100644
index 0000000..eb667c5
--- /dev/null
+++ b/force-app/main/default/lwc/lexSIStoOPD/lexSIStoOPD.css
@@ -0,0 +1,10 @@
+.sisToOPDHolder{
+    position: relative;
+    display: inline-block;
+    width: 80px;
+    height: 80px;
+    text-align: center;
+}
+.container .uiContainerManager{
+	display: none !important;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSIStoOPD/lexSIStoOPD.html b/force-app/main/default/lwc/lexSIStoOPD/lexSIStoOPD.html
new file mode 100644
index 0000000..48f29e0
--- /dev/null
+++ b/force-app/main/default/lwc/lexSIStoOPD/lexSIStoOPD.html
@@ -0,0 +1,6 @@
+<template>
+    <div class="sisToOPDHolder" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+        <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button>
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSIStoOPD/lexSIStoOPD.js b/force-app/main/default/lwc/lexSIStoOPD/lexSIStoOPD.js
new file mode 100644
index 0000000..b612e13
--- /dev/null
+++ b/force-app/main/default/lwc/lexSIStoOPD/lexSIStoOPD.js
@@ -0,0 +1,96 @@
+import { api, wire,LightningElement } from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import updateForSIStoOPDButton  from '@salesforce/apex/ReportController.updateForSIStoOPDButton';
+import init  from '@salesforce/apex/ReportController.initForSIStoOPDButton';
+import { updateRecord } from 'lightning/uiRecordApi';
+import UserInfo_Owner from '@salesforce/apex/TaskFeedbackController.UserInfo_Owner';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+export default class LexSIStoOPD extends LightningElement {
+    @api recordId;
+    IsLoading = true;
+    ownerId;
+    status;
+    userId;
+    recordTypeId = '01210000000Qekj';
+    errorMsg;
+    @wire(CurrentPageReference)
+    getStateParameters(currentPageReference) {
+            console.log(111);
+            console.log(currentPageReference);
+
+        if (currentPageReference) {
+          const urlValue = currentPageReference.state.recordId;
+          if (urlValue) {
+            let str = `${urlValue}`;
+            console.log("str");
+            console.log(str);
+            this.recordId = str;
+          }
+        }
+    }
+
+
+    connectedCallback(){
+        console.log(this.recordId);
+        init({
+            recordId: this.recordId
+        }).then(result => {
+            console.log(result);
+            if (result != null) {
+                this.IsLoading = false;
+                this.ownerId = result.ownerId;
+                this.status = result.status;
+                this.userId = result.userId;
+                this.SIStoOPD();
+            }
+        }).catch(error => {
+            console.log("error");
+            console.log(error);
+        }).finally(() => {
+            console.log(this.errorMsg);
+            if(this.errorMsg){
+                this.showToast(this.errorMsg,"error");
+            }  
+        });
+
+    }
+
+    showToast(msg,type) {
+        const event = new ShowToastEvent({
+            title: '',
+            message: msg,
+            variant: type
+        });
+        this.dispatchEvent(event);
+    }
+
+
+    updateRecordView(recordId) {
+        updateRecord({fields: { Id: recordId }});
+    }
+
+    SIStoOPD () {
+        if(this.ownerId == this.userId && this.status == "鑽夋涓�") {
+            updateForSIStoOPDButton({
+                recordId: this.recordId,
+                recordTypeId: this.recordTypeId
+            }).then(result=>{
+                if(result){
+                    this.showToast(result,"error");
+                }else{
+                    this.updateRecordView(this.recordId);
+                } 
+                this.dispatchEvent(new CloseActionScreenEvent());
+            });              
+    }
+    
+}
+        // ifError(result){
+        //     console.log(result);
+        //     if(result){
+        //         this.showToast(result,"error");
+        //     }
+            
+        // }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSIStoOPD/lexSIStoOPD.js-meta.xml b/force-app/main/default/lwc/lexSIStoOPD/lexSIStoOPD.js-meta.xml
new file mode 100644
index 0000000..c307012
--- /dev/null
+++ b/force-app/main/default/lwc/lexSIStoOPD/lexSIStoOPD.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+     <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
diff --git a/force-app/main/default/lwc/lexVOCAnswer/lexVOCAnswer.css b/force-app/main/default/lwc/lexVOCAnswer/lexVOCAnswer.css
new file mode 100644
index 0000000..f2237d1
--- /dev/null
+++ b/force-app/main/default/lwc/lexVOCAnswer/lexVOCAnswer.css
@@ -0,0 +1,10 @@
+.answerHolder{
+    position: relative;
+    display: inline-block;
+    width: 80px;
+    height: 80px;
+    text-align: center;
+}
+.container .uiContainerManager{
+	display: none !important;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexVOCAnswer/lexVOCAnswer.html b/force-app/main/default/lwc/lexVOCAnswer/lexVOCAnswer.html
new file mode 100644
index 0000000..c79d866
--- /dev/null
+++ b/force-app/main/default/lwc/lexVOCAnswer/lexVOCAnswer.html
@@ -0,0 +1,7 @@
+<template>
+    <div class="answerHolder" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+        <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button>
+
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexVOCAnswer/lexVOCAnswer.js b/force-app/main/default/lwc/lexVOCAnswer/lexVOCAnswer.js
new file mode 100644
index 0000000..8ae7088
--- /dev/null
+++ b/force-app/main/default/lwc/lexVOCAnswer/lexVOCAnswer.js
@@ -0,0 +1,84 @@
+import { LightningElement, wire, track, api } from "lwc";
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from "lightning/actions";
+import { NavigationMixin } from "lightning/navigation";
+import init from "@salesforce/apex/ReportController.initForVOCAnswerButton";
+import updateForVOCAnswerButton from "@salesforce/apex/ReportController.updateForVOCAnswerButton";
+import { updateRecord } from "lightning/uiRecordApi";
+import { ShowToastEvent } from "lightning/platformShowToastEvent";
+export default class LexVOCAnswer extends LightningElement {
+  @api recordId;
+  status;
+  Isloading = true;
+
+  @wire(CurrentPageReference)
+  getStateParameters(currentPageReference) {
+    console.log(111);
+    console.log(currentPageReference);
+
+    if (currentPageReference) {
+      const urlValue = currentPageReference.state.recordId;
+      if (urlValue) {
+        let str = `${urlValue}`;
+        console.log("str");
+        console.log(str);
+        this.recordId = str;
+      }
+    }
+  }
+
+  connectedCallback() {
+    console.log(this.recordId);
+    init({
+      recordId: this.recordId,
+    })
+      .then((result) => {
+        console.log(result);
+        if (result != null) {
+          this.Isloading = false;
+          this.status = result.status;
+          this.update();
+        }
+      })
+      .catch((error) => {
+        console.log("error");
+        console.log(error);
+      })
+      .finally(() => {});
+    //window.location.replace("https://ocsm--partial.sandbox.lightning.force.com/lightning/r/Report__c/" + this.recordId + "/view");
+  }
+
+  showToast(msg, type) {
+    const event = new ShowToastEvent({
+      title: "",
+      message: msg,
+      variant: type
+    });
+    this.dispatchEvent(event);
+  }
+
+  updateRecordView(recordId) {
+    updateRecord({ fields: { Id: recordId } });
+  }
+
+  update() {
+    if (this.status != "宸插垎閰�") {
+      this.showToast("涓嶆槸宸插垎閰嶄笉鑳界偣鍑�", "error");
+      return;
+    }
+    updateForVOCAnswerButton({
+      recordId: this.recordId
+    }).then(result => {
+      if (result == null) {
+        this.showToast("鎴愬姛", "success");
+      } else {
+        console.log(result);
+        this.showToast(result,"error");
+      }
+      this.updateRecordView(this.recordId);
+      this.dispatchEvent(new CloseActionScreenEvent());
+    }).catch(error=>{
+      console.log(error);
+    });
+  }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexVOCAnswer/lexVOCAnswer.js-meta.xml b/force-app/main/default/lwc/lexVOCAnswer/lexVOCAnswer.js-meta.xml
new file mode 100644
index 0000000..3392981
--- /dev/null
+++ b/force-app/main/default/lwc/lexVOCAnswer/lexVOCAnswer.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+    <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