From 03dbeca473dd82350778bcacfe6b6b36cf658861 Mon Sep 17 00:00:00 2001
From: 黄千龙 <huangqianlong@prec-tech.com>
Date: 星期五, 07 四月 2023 15:08:25 +0800
Subject: [PATCH] 黄千龙提交按钮20230407

---
 force-app/main/default/lwc/lexRCCDScomplete/lexRCCDScomplete.js          |   98 +++++++++++++++++++
 force-app/main/default/lwc/lexRCCDScomplete/lexRCCDScomplete.js-meta.xml |   11 ++
 force-app/main/default/classes/QISReportController.cls                   |  151 ------------------------------
 force-app/main/default/lwc/lexRCCDScomplete/lexRCCDScomplete.css         |   22 ++++
 force-app/main/default/lwc/lexRCCDScomplete/lexRCCDScomplete.html        |    5 +
 5 files changed, 136 insertions(+), 151 deletions(-)

diff --git a/force-app/main/default/classes/QISReportController.cls b/force-app/main/default/classes/QISReportController.cls
index ea5f6a9..c778eac 100644
--- a/force-app/main/default/classes/QISReportController.cls
+++ b/force-app/main/default/classes/QISReportController.cls
@@ -350,158 +350,7 @@
         }
          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;
-    }
-
-    //鍙戦�丵IS鍒癝PO
-    @AuraEnabled
-    public static InitData initForlexSendQISButton (String recordId){
-        InitData res = new initData();
-        ID myUserID = UserInfo.getUserId();
-        User userinfo = [SELECT id,Profile.name FROM User WHERE Id = :myUserID LIMIT 1];
-        try{
-            QIS_Report__c report = [SELECT  id ,RecordTypeId,IsSendQIS__c FROM QIS_Report__c WHERE Id = :recordId LIMIT 1];
-            RecordType rec = [SELECT id,name FROM RecordType where  Id = :report.RecordTypeId];
-            res.Id = report.Id;
-            res.qisRecordTypeId = report.RecordTypeId;
-            res.qisRecordName = rec.name;
-            res.profileName = userinfo.Profile.name;
-            res.IsSendQIS = report.IsSendQIS__c;
-            System.debug(LoggingLevel.INFO, '*** res: ' + res);
-        }catch(Exception e){
-            System.debug(LoggingLevel.INFO, '*** e: ' + e);
-        }
-        return res;
-    }
-
-    @AuraEnabled
-    public static String updateQisForSendQIS (String recordId){
-        String re = '鎴愬姛'; 
-        QIS_Report__c report = [SELECT Id,Name,IsSendQIS__c FROM QIS_Report__c WHERE Id = :recordId LIMIT 1];
-        if(report == null ){
-            return '娌℃湁QIS锛�' + recordId + '鐨勬暟鎹��';
-        }
-        Savepoint sp = Database.setSavepoint(); 
-        try{    
-                
-                QIS_Report__c rac  = new QIS_Report__c();   
-                rac.id = recordId;
-                rac.IsSendQIS__c = true;
-                update rac;
-        }catch(Exception e){
-            Database.rollback(sp);
-            System.debug(LoggingLevel.INFO, '*** e: ' + e);
-            re = e.getMessage();
-        }
-         return re;
-    }
-    // OCSM鏈嶅姟鏈儴鏀跺埌瀹炵墿
-    @AuraEnabled
-    public static InitData initForlexRCRecievedButton (String recordId){
-        InitData res = new initData();
-        ID myUserID = UserInfo.getUserId();
-        User userinfo = [SELECT id,Profile.name FROM User WHERE Id = :myUserID LIMIT 1];
-        try{
-            QIS_Report__c report = [SELECT  id ,isAE_Profile__c,QIS_Status__c,isPAE_Profile__c,is_CNBuy__c FROM QIS_Report__c WHERE Id = :recordId LIMIT 1];
-            res.Id = report.Id;
-            res.isAEProfile = report.isAE_Profile__c;
-            res.isPAEProfile = report.isPAE_Profile__c;
-            res.QIStatus = report.QIS_Status__c;
-            res.isCNBuy = report.is_CNBuy__c;
-            System.debug(LoggingLevel.INFO, '*** res: ' + res);
-        }catch(Exception e){
-            System.debug(LoggingLevel.INFO, '*** e: ' + e);
-        }
-        return res;
-    }
-
-    @AuraEnabled
-    public static String updateQisForRCRecieved (String recordId){
-        String re = '鎴愬姛'; 
-        ID myUserID = UserInfo.getUserId();
-        User userinfo = [SELECT id,Alias,BuchangApprovalManagerSales__c,JingliApprovalManager__c, BuchangApprovalManager__c, ZongjianApprovalManager__c FROM User WHERE Id = :myUserID LIMIT 1];
-
-        try{    
-                QIS_Report__c rac  = new QIS_Report__c();   
-                rac.id = recordId;
-
-                rac.QIS_Status__c = 'RC妫�娴嬩腑';
-                rac.OCM_RC_RecievedDate__c = Date.today();
-                rac.RC__c = myUserID;
-                rac.RC_Receive_staff__c = userinfo.Alias;
-
-                if (userinfo != null  && userinfo.BuchangApprovalManagerSales__c!= null) {
-                    rac.RC_Manager__c = userinfo.BuchangApprovalManagerSales__c;
-                } else {
-                    rac.RC_Manager__c = myUserID;
-                }
-                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/lexRCCDScomplete/lexRCCDScomplete.css b/force-app/main/default/lwc/lexRCCDScomplete/lexRCCDScomplete.css
new file mode 100644
index 0000000..79456f2
--- /dev/null
+++ b/force-app/main/default/lwc/lexRCCDScomplete/lexRCCDScomplete.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/lexRCCDScomplete/lexRCCDScomplete.html b/force-app/main/default/lwc/lexRCCDScomplete/lexRCCDScomplete.html
new file mode 100644
index 0000000..c8bdbfc
--- /dev/null
+++ b/force-app/main/default/lwc/lexRCCDScomplete/lexRCCDScomplete.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/lexRCCDScomplete/lexRCCDScomplete.js b/force-app/main/default/lwc/lexRCCDScomplete/lexRCCDScomplete.js
new file mode 100644
index 0000000..4f7e882
--- /dev/null
+++ b/force-app/main/default/lwc/lexRCCDScomplete/lexRCCDScomplete.js
@@ -0,0 +1,98 @@
+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.initForRCCDScompleteButton';
+import updateQis  from '@salesforce/apex/QISReportController.updateQisForRCCDScomplete';
+import UserInfo_Owner from '@salesforce/apex/TaskFeedbackController.UserInfo_Owner';
+import { updateRecord } from 'lightning/uiRecordApi';
+
+export default class lexRCCDScomplete extends LightningElement {
+	@api recordId;
+	IsLoading = true;
+	qisReportId;
+	cdsdate;
+	QIStatus;
+    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.qisReportId = result.Id;
+            this.cdsdate = result.cdsdate;
+            this.QIStatus = result.qIStatus;
+            if (this.QIStatus == 'RC妫�娴嬬敵璇�') {
+            	const evt = new ShowToastEvent({
+                            title : '闇�瑕佸厛鐐瑰嚮锛籓CM鏈嶅姟鏈儴鏀跺埌瀹炵墿锛�',
+                            message: '',
+                            variant: 'error'
+                        });
+                        this.dispatchEvent(evt);
+                        this.dispatchEvent(new CloseActionScreenEvent());
+                        return;
+            }
+            if (this.cdsdate != null) {
+            	const evt = new ShowToastEvent({
+                            title : 'OCM鏈嶅姟鏈儴CDS宸茬粡瀹屾瘯',
+                            message: '',
+                            variant: 'error'
+                        });
+                        this.dispatchEvent(evt);
+                        this.dispatchEvent(new CloseActionScreenEvent());
+                        return;
+            }
+            this.updateQisSubmit();
+        }).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/lexRCCDScomplete/lexRCCDScomplete.js-meta.xml b/force-app/main/default/lwc/lexRCCDScomplete/lexRCCDScomplete.js-meta.xml
new file mode 100644
index 0000000..b85f028
--- /dev/null
+++ b/force-app/main/default/lwc/lexRCCDScomplete/lexRCCDScomplete.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexRCCDScomplete">
+    <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