From 51f6dc7bc93a89c97ebc17e8c908f7f6be6566dc Mon Sep 17 00:00:00 2001
From: 黄千龙 <huangqianlong@prec-tech.com>
Date: 星期三, 12 四月 2023 09:38:42 +0800
Subject: [PATCH] 黄千龙提交按钮20230412

---
 force-app/main/default/lwc/lexOCSMNoToReportLighting/lexOCSMNoToReportLighting.css         |   22 +++
 force-app/main/default/lwc/lexOCSMToReportLighting/lexOCSMToReportLighting.html            |    5 
 force-app/main/default/lwc/lexOCSMToReportLighting/lexOCSMToReportLighting.js              |   89 ++++++++++++++
 force-app/main/default/classes/QISReportController.cls                                     |   62 ++++++++++
 force-app/main/default/lwc/lexOCSMToReportLighting/lexOCSMToReportLighting.css             |   10 +
 force-app/main/default/lwc/lexOCSMNoToReportLighting/lexOCSMNoToReportLighting.html        |    5 
 force-app/main/default/lwc/lexOCSMNoToReportLighting/lexOCSMNoToReportLighting.js          |  105 +++++++++++++++++
 force-app/main/default/lwc/lexOCSMToReportLighting/lexOCSMToReportLighting.js-meta.xml     |   11 +
 force-app/main/default/lwc/lexOCSMNoToReportLighting/lexOCSMNoToReportLighting.js-meta.xml |   11 +
 9 files changed, 320 insertions(+), 0 deletions(-)

diff --git a/force-app/main/default/classes/QISReportController.cls b/force-app/main/default/classes/QISReportController.cls
index c778eac..3b375e1 100644
--- a/force-app/main/default/classes/QISReportController.cls
+++ b/force-app/main/default/classes/QISReportController.cls
@@ -351,6 +351,68 @@
          return re;
     }
 
+    //OCSM涓嶈鎶ュ憡
+    @AuraEnabled
+    public static InitData initForlexOCSMNoToReportLightingButton (String recordId){
+        InitData res = new initData();
+        try{
+            QIS_Report__c report = [SELECT  id ,OCSMAdministrativeReportNumber__c,OCSMAdministrativeReportDate__c,Aware_date__c FROM QIS_Report__c WHERE Id = :recordId LIMIT 1];  
+            res.Id = report.Id;
+            res.oCSMAdministrativeReportNumber = report.OCSMAdministrativeReportNumber__c;
+            res.oCSMAdministrativeReportDate = report.OCSMAdministrativeReportDate__c;
+            res.Awaredate = report.Aware_date__c;
+            System.debug(LoggingLevel.INFO, '*** res: ' + res);
+        }catch(Exception e){
+            System.debug(LoggingLevel.INFO, '*** e: ' + e);
+        }
+        return res;
+    }
+    @AuraEnabled
+    public static String updateQisForlexOCSMNoToReportLighting (String recordId){
+        String re = '鎴愬姛'; 
+        QIS_Report__c report = [SELECT  id FROM QIS_Report__c WHERE Id = :recordId LIMIT 1];
+        try{
+                QIS_Report__c rac  = new QIS_Report__c();   
+                rac.id = recordId;
+                rac.OCSMAdministrativeReportStatus__c = '鏃犻渶鎶ュ憡';
+                update rac;        
+        }catch(Exception e){
+            System.debug(LoggingLevel.INFO, '*** e: ' + e);
+            re = e.getMessage();
+        }
+         return re;
+    }
+    //OCSM瑕佹姤鍛�
+    @AuraEnabled
+    public static InitData initForlexOCSMToReportLightingButton (String recordId){
+        InitData res = new initData();
+        try{
+            QIS_Report__c report = [SELECT  id ,OCSMAdministrativeReportStatus__c,Aware_date__c FROM QIS_Report__c WHERE Id = :recordId LIMIT 1];  
+            res.Id = report.Id;
+            res.oCSMAdministrativeReportStatus = report.OCSMAdministrativeReportStatus__c;
+            res.Awaredate = report.Aware_date__c;
+            System.debug(LoggingLevel.INFO, '*** res: ' + res);
+        }catch(Exception e){
+            System.debug(LoggingLevel.INFO, '*** e: ' + e);
+        }
+        return res;
+    }
+
+    @AuraEnabled
+    public static String updateQisForlexOCSMToReportLighting (String recordId){
+        String re = '鎴愬姛'; 
+        QIS_Report__c report = [SELECT  id FROM QIS_Report__c WHERE Id = :recordId LIMIT 1];
+        try{
+                QIS_Report__c rac  = new QIS_Report__c();   
+                rac.id = recordId;
+                rac.OCSMAdministrativeReportStatus__c  = '寰呮姤鍛�';
+                update rac;        
+        }catch(Exception e){
+            System.debug(LoggingLevel.INFO, '*** e: ' + e);
+            re = e.getMessage();
+        }
+         return re;
+    }
     public class InitData{
         @AuraEnabled
         public String Id;
diff --git a/force-app/main/default/lwc/lexOCSMNoToReportLighting/lexOCSMNoToReportLighting.css b/force-app/main/default/lwc/lexOCSMNoToReportLighting/lexOCSMNoToReportLighting.css
new file mode 100644
index 0000000..79456f2
--- /dev/null
+++ b/force-app/main/default/lwc/lexOCSMNoToReportLighting/lexOCSMNoToReportLighting.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;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexOCSMNoToReportLighting/lexOCSMNoToReportLighting.html b/force-app/main/default/lwc/lexOCSMNoToReportLighting/lexOCSMNoToReportLighting.html
new file mode 100644
index 0000000..c8bdbfc
--- /dev/null
+++ b/force-app/main/default/lwc/lexOCSMNoToReportLighting/lexOCSMNoToReportLighting.html
@@ -0,0 +1,5 @@
+<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/lexOCSMNoToReportLighting/lexOCSMNoToReportLighting.js b/force-app/main/default/lwc/lexOCSMNoToReportLighting/lexOCSMNoToReportLighting.js
new file mode 100644
index 0000000..2c3c93c
--- /dev/null
+++ b/force-app/main/default/lwc/lexOCSMNoToReportLighting/lexOCSMNoToReportLighting.js
@@ -0,0 +1,105 @@
+import { LightningElement,wire,track,api} from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import { NavigationMixin } from 'lightning/navigation';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import init  from '@salesforce/apex/QISReportController.initForlexOCSMNoToReportLightingButton';
+import updateQis  from '@salesforce/apex/QISReportController.updateQisForlexOCSMNoToReportLighting';
+import UserInfo_Owner from '@salesforce/apex/TaskFeedbackController.UserInfo_Owner';
+import { updateRecord } from 'lightning/uiRecordApi';
+
+export default class lexOCSMNoToReportLighting extends LightningElement {
+	@api recordId;
+	IsLoading = true;
+	qisReportId;
+	OCSMAdministrativeReportNumber;
+    OCSMAdministrativeReportDate;
+    Awaredate;
+    err;
+    
+    @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.IsLoading = false;
+            this.OCSMAdministrativeReportNumber = result.oCSMAdministrativeReportNumber;
+            this.OCSMAdministrativeReportDate = result.oCSMAdministrativeReportDate;
+            this.qisReportId = result.Id;
+            this.Awaredate = result.awaredate;
+            if (!confirm("涓嶈鎶ュ憡鍚庢棤娉曟挙鍥烇紝鏄惁缁х画锛�")) {
+            		this.dispatchEvent(new CloseActionScreenEvent());
+                    return;
+        	}
+            if (this.OCSMAdministrativeReportDate != null || this.OCSMAdministrativeReportNumber != null) {
+            		const evt = new ShowToastEvent({
+                            title : '宸茬粡鎶ュ憡鐨凲IS锛屼笉鍙互鐐瑰嚮OCSM涓嶈鎶ュ憡',
+                            message: '',
+                            variant: 'error'
+                        });
+                        this.dispatchEvent(evt);
+                        this.dispatchEvent(new CloseActionScreenEvent());
+                        return;
+            }
+         	if (this.Awaredate!=null) {
+         		this.updateQisSubmit();
+         	}else{
+         		const evt = new ShowToastEvent({
+                        title : '娌℃湁AwareDate鎴栧凡缁廜CSM琛屾斂鎶ュ憡锛岃纭',
+                        message: '',
+                        variant: 'error'
+                    });
+                    this.dispatchEvent(evt);
+                    this.dispatchEvent(new CloseActionScreenEvent());
+                    return;
+         	}
+        }).catch(error => {
+            console.log('error='+error);
+        }).finally(() => {
+            
+        }); 
+    }
+
+    updateRecordView(recordId) {
+        updateRecord({fields: { Id: recordId }});
+    }
+
+    updateQisSubmit(){
+        	updateQis({
+        		 recordId: this.recordId
+        		}).then(result =>{
+        			console.log('result'+result);
+                     this.err = result;
+        			if (result!='鎴愬姛') {
+                        const evt = new ShowToastEvent({
+                            title : '鏇存柊澶辫触',
+                            message: this.err,
+                            variant: 'error'
+                        });
+                        this.dispatchEvent(evt);
+                    }
+                this.dispatchEvent(new CloseActionScreenEvent());
+                this.updateRecordView(this.recordId);
+        		}).catch(error => {
+            console.log('error='+error);
+        }).finally(() => {
+            
+        });
+    }
+
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexOCSMNoToReportLighting/lexOCSMNoToReportLighting.js-meta.xml b/force-app/main/default/lwc/lexOCSMNoToReportLighting/lexOCSMNoToReportLighting.js-meta.xml
new file mode 100644
index 0000000..791ff80
--- /dev/null
+++ b/force-app/main/default/lwc/lexOCSMNoToReportLighting/lexOCSMNoToReportLighting.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexOCSMNoToReportLighting">
+   <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/lexOCSMToReportLighting/lexOCSMToReportLighting.css b/force-app/main/default/lwc/lexOCSMToReportLighting/lexOCSMToReportLighting.css
new file mode 100644
index 0000000..0ca9d8e
--- /dev/null
+++ b/force-app/main/default/lwc/lexOCSMToReportLighting/lexOCSMToReportLighting.css
@@ -0,0 +1,10 @@
+.toReportHolder{
+    position: relative;
+    display: inline-block;
+    width: 80px;
+    height: 80px;
+    text-align: center;
+}
+.container .uiContainerManager{
+	display: none !important;
+}/* sample css file *//* sample css file */
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexOCSMToReportLighting/lexOCSMToReportLighting.html b/force-app/main/default/lwc/lexOCSMToReportLighting/lexOCSMToReportLighting.html
new file mode 100644
index 0000000..c8bdbfc
--- /dev/null
+++ b/force-app/main/default/lwc/lexOCSMToReportLighting/lexOCSMToReportLighting.html
@@ -0,0 +1,5 @@
+<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/lexOCSMToReportLighting/lexOCSMToReportLighting.js b/force-app/main/default/lwc/lexOCSMToReportLighting/lexOCSMToReportLighting.js
new file mode 100644
index 0000000..fe89267
--- /dev/null
+++ b/force-app/main/default/lwc/lexOCSMToReportLighting/lexOCSMToReportLighting.js
@@ -0,0 +1,89 @@
+import { LightningElement,wire,track,api} from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import { NavigationMixin } from 'lightning/navigation';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import init  from '@salesforce/apex/QISReportController.initForlexOCSMToReportLightingButton';
+import updateQis  from '@salesforce/apex/QISReportController.updateQisForlexOCSMToReportLighting';
+import UserInfo_Owner from '@salesforce/apex/TaskFeedbackController.UserInfo_Owner';
+import { updateRecord } from 'lightning/uiRecordApi';
+
+export default class lexOCSMToReportLighting extends LightningElement {
+	@api recordId;
+    str;
+    err;
+    IsLoading = true;
+    qisReportId;
+    OCSMAdministrativeReportStatus;
+    Awaredate;
+
+    @wire(CurrentPageReference)
+    getStateParameters(currentPageReference) {
+        if (currentPageReference) {
+            const urlValue = currentPageReference.state.recordId;
+            if (urlValue) {
+                let str = `${urlValue}`;
+                this.recordId = str;
+            }
+        }
+    }
+
+    connectedCallback() {
+        console.log(this.recordId);
+        init({
+            recordId: this.recordId
+        }).then(result => {
+            console.log(result);
+                this.IsLoading = false;
+                this.OCSMAdministrativeReportStatus = result.oCSMAdministrativeReportStatus;
+                this.qisReportId = result.Id;
+                this.Awaredate = result.awaredate;
+                if (!confirm("涓嶈鎶ュ憡鍚庢棤娉曟挙鍥烇紝鏄惁缁х画锛�")) {
+            		this.dispatchEvent(new CloseActionScreenEvent());
+                    return;
+        		}
+        		if (this.OCSMAdministrativeReportStatus == null && this.Awaredate!=null) {
+	         		this.updateQisSubmit();
+	         	}else{
+	         		const evt = new ShowToastEvent({
+                            title : '娌℃湁AwareDate鎴栧凡缁廜CSM琛屾斂鎶ュ憡锛岃纭',
+                            message: '',
+                            variant: 'error'
+                        });
+                        this.dispatchEvent(evt);
+                        this.dispatchEvent(new CloseActionScreenEvent());
+                        return;
+	         	}
+        }).catch(error => {
+            console.log(error);
+        }).finally(() => {
+
+        });
+    }
+    updateRecordView(recordId) {
+        updateRecord({fields: { Id: recordId }});
+    }
+
+    updateQisSubmit(){
+        	updateQis({
+        		 recordId: this.recordId
+        		}).then(result =>{
+        			console.log('result'+result);
+                     this.err = result;
+        			if (result!='鎴愬姛') {
+                        const evt = new ShowToastEvent({
+                            title : '鏇存柊澶辫触',
+                            message: this.err,
+                            variant: 'error'
+                        });
+                        this.dispatchEvent(evt);
+                    }
+                this.dispatchEvent(new CloseActionScreenEvent());
+                this.updateRecordView(this.recordId);
+        		}).catch(error => {
+            console.log('error='+error);
+        }).finally(() => {
+            
+        });
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexOCSMToReportLighting/lexOCSMToReportLighting.js-meta.xml b/force-app/main/default/lwc/lexOCSMToReportLighting/lexOCSMToReportLighting.js-meta.xml
new file mode 100644
index 0000000..b0e1001
--- /dev/null
+++ b/force-app/main/default/lwc/lexOCSMToReportLighting/lexOCSMToReportLighting.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexOCSMToReportLighting">
+   <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