From a01d383c53ebd172400d7927ba6d52b111522db3 Mon Sep 17 00:00:00 2001
From: unknown <sunxia@prec-tech.com>
Date: 星期五, 26 五月 2023 15:19:46 +0800
Subject: [PATCH] Merge branch 'LEX_dev' of http://47.92.229.245:8089/r/lightningupdate into LEX_dev

---
 force-app/main/default/lwc/lexTaskOLYwinBid/lexTaskOLYwinBid.js-meta.xml |   11 ++
 force-app/main/default/lwc/lexTaskLoseBid/lexTaskLoseBid.js-meta.xml     |   11 ++
 force-app/main/default/lwc/lexTaskOLYwinBid/lexTaskOLYwinBid.js          |   75 ++++++++++++++++++
 force-app/main/default/lwc/lexTaskLoseBid/lexTaskLoseBid.html            |    5 +
 force-app/main/default/lwc/lexTaskLoseBid/lexTaskLoseBid.js              |   75 ++++++++++++++++++
 force-app/main/default/classes/LightingButtonConstant.cls                |    4 +
 force-app/main/default/lwc/lexTaskOLYwinBid/lexTaskOLYwinBid.html        |    5 +
 force-app/main/default/classes/OppLoseController.cls                     |   48 ++++++++++-
 8 files changed, 229 insertions(+), 5 deletions(-)

diff --git a/force-app/main/default/classes/LightingButtonConstant.cls b/force-app/main/default/classes/LightingButtonConstant.cls
index df3b465..0fe95d4 100644
--- a/force-app/main/default/classes/LightingButtonConstant.cls
+++ b/force-app/main/default/classes/LightingButtonConstant.cls
@@ -1,4 +1,8 @@
 global without sharing class LightingButtonConstant {
+    //浠诲姟鐨勭姸鎬佲�極LY涓爣鈥�
+    public static final String STATUS_OLYwinBid = 'OLY涓爣';
+    //浠诲姟鐨勭姸鎬佲�樼珵浜夊鎵嬩腑鏍団��
+    public static final String STATUS_Bid_LoseBid = '绔炰簤瀵规墜涓爣';
   //涓爣閫氱煡涔︾殑鐘舵�佲�樺鐞嗗畬姣曗��
     public static final String STATUS_Bid_Announcement_Consent = '澶勭悊瀹屾瘯';
     //涓爣閫氱煡涔︾殑鐘舵�佲�樿崏妗堜腑鈥�
diff --git a/force-app/main/default/classes/OppLoseController.cls b/force-app/main/default/classes/OppLoseController.cls
index fb78bab..e2917ed 100644
--- a/force-app/main/default/classes/OppLoseController.cls
+++ b/force-app/main/default/classes/OppLoseController.cls
@@ -4,12 +4,13 @@
     public static InitData init(String taskId){
         InitData res = new initData();
         try{
-            task__c task = [SELECT id, OpportunityId__c 
+            task__c task = [SELECT id, OpportunityId__c , taskStatus__c
                             FROM task__c
                             WHERE Id =: taskId 
                             LIMIT 1];
 
             res.task = task;
+            res.taskStatus = task.taskStatus__c;
             res.OpportunityId = task.OpportunityId__c;
 
             Opportunity opp =  [SELECT Sales_owner_buchangID__c,Manager_name__c,Sales_owner_buchang__c,
@@ -38,18 +39,53 @@
             System.debug(LoggingLevel.INFO, '*** e: ' + e);
         }
         return res;
-    }    
-
+    }  
+  
     public class ReturnData{
 
     }
-
+    //OLY涓爣
+    @AuraEnabled
+    public static String taskOLYwinBid(String recordId) {
+        String messageText = '';
+       try {
+        Opportunity opp = [SELECT Id,ConfirmationofAward__c FROM Opportunity WHERE Id = :recordId LIMIT 1];
+        opp.Id = recordId;
+        opp.ConfirmationofAward__c = LightingButtonConstant.STATUS_OLYwinBid;
+        messageText = '1';
+        update opp;
+        System.debug(LoggingLevel.INFO, '*** winBid: ' + opp);
+        return messageText;
+       } catch (Exception ex) {
+        System.debug(LoggingLevel.INFO, '*** winBidXu: ' + ex);
+        messageText = ex.getMessage();
+        return messageText;
+       }
+    }
+    //绔炰簤瀵规墜涓爣
+    @AuraEnabled
+    public static String taskLoseBid(String recordId) {
+        String messageText = '';
+        try {
+        Opportunity opp = [SELECT Id,ConfirmationofAward__c FROM Opportunity WHERE Id = :recordId LIMIT 1];
+        opp.Id = recordId;
+        opp.ConfirmationofAward__c = LightingButtonConstant.STATUS_Bid_LoseBid;
+        messageText = '1';
+        update opp;
+        System.debug(LoggingLevel.INFO, '*** winBid: ' + opp);
+        return messageText;
+        } catch (Exception ex) {
+        System.debug(LoggingLevel.INFO, '*** winBidXu: ' + ex);
+        messageText = ex.getMessage();
+        return messageText;
+        }
+    }
     public class InitData{
         //璇环鏁版嵁
         @AuraEnabled
         public Opportunity opp;
         @AuraEnabled
-        public String stageName;
+        public String StageName;
         @AuraEnabled
         public Boolean SAP_Send_OK;
         @AuraEnabled
@@ -73,6 +109,8 @@
         @AuraEnabled
         public String OpportunityId;
         @AuraEnabled
+        public String taskStatus;
+        @AuraEnabled
         public task__c task;
     }
 
diff --git a/force-app/main/default/lwc/lexTaskLoseBid/lexTaskLoseBid.html b/force-app/main/default/lwc/lexTaskLoseBid/lexTaskLoseBid.html
new file mode 100644
index 0000000..ade3dab
--- /dev/null
+++ b/force-app/main/default/lwc/lexTaskLoseBid/lexTaskLoseBid.html
@@ -0,0 +1,5 @@
+<template>
+    <div class="ApplicationSubmit" 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/lexTaskLoseBid/lexTaskLoseBid.js b/force-app/main/default/lwc/lexTaskLoseBid/lexTaskLoseBid.js
new file mode 100644
index 0000000..ae14d5d
--- /dev/null
+++ b/force-app/main/default/lwc/lexTaskLoseBid/lexTaskLoseBid.js
@@ -0,0 +1,75 @@
+import { LightningElement,wire,track,api} from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import  init  from '@salesforce/apex/OppLoseController.init';
+import  taskLoseBid  from '@salesforce/apex/OppLoseController.taskLoseBid';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import { updateRecord } from 'lightning/uiRecordApi';
+import LightningConfirm from 'lightning/confirm';
+export default class lexTaskOLYwinBid extends LightningElement {
+    @api recordId;
+    taskStatus;//浠诲姟 鐘舵��
+    OpportunityId;//浠诲姟 ID
+    IsLoading = true;
+    @wire(CurrentPageReference)
+    getStateParameters(currentPageReference){
+        if(currentPageReference){
+            const urlValue=currentPageReference.state.recordId;
+            if(urlValue){
+                let str=`${urlValue}`;
+                this.recordId=str;
+            }
+        }
+    }
+    connectedCallback(){
+        init({
+            taskId: this.recordId
+        }).then(result => {
+            this.IsLoading = false;
+            console.log(result.OpportunityId,result.taskStatus);
+            this.OpportunityId = result.OpportunityId;
+            this.taskStatus = result.taskStatus;
+            this.taskLoseBid();
+        })      
+    }
+
+    taskLoseBid(){
+        if(this.taskStatus == '04 鍙栨秷'){
+            this.showToast('浠诲姟鍙栨秷锛屼笉鍙搷浣�',"error");
+        }else{
+            LightningConfirm.open({
+                message: '鏄惁纭绔炰簤瀵规墜涓爣锛�',
+                variant: 'headerless',
+                label: 'this is the aria-label value',
+                }).then(res=>{
+                    if(res) {
+                        taskLoseBid({recordId:this.OpportunityId}).then(requst=>{
+                            if(requst == '1'){
+                                this.showToast("鎿嶄綔鎴愬姛锛�","success");
+                                this.updateRecordView();
+                                this.dispatchEvent(new CloseActionScreenEvent());
+                            }
+                            if(requst != "1"){
+                                this.showToast(requst,"error");
+                            }
+                        })
+                    }else{
+                        this.dispatchEvent(new CloseActionScreenEvent());
+                        this.updateRecordView(this.recordId);
+                        return;
+                    }                 
+                });
+        }
+    }
+    showToast(msg,type) {
+        const event = new ShowToastEvent({
+            message: msg,
+            variant: type
+        });
+        this.dispatchEvent(event);
+        this.dispatchEvent(new CloseActionScreenEvent());
+    }
+    updateRecordView() {
+        updateRecord({fields: { Id: this.OpportunityId }});
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexTaskLoseBid/lexTaskLoseBid.js-meta.xml b/force-app/main/default/lwc/lexTaskLoseBid/lexTaskLoseBid.js-meta.xml
new file mode 100644
index 0000000..2b7649d
--- /dev/null
+++ b/force-app/main/default/lwc/lexTaskLoseBid/lexTaskLoseBid.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<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/lexTaskOLYwinBid/lexTaskOLYwinBid.html b/force-app/main/default/lwc/lexTaskOLYwinBid/lexTaskOLYwinBid.html
new file mode 100644
index 0000000..ade3dab
--- /dev/null
+++ b/force-app/main/default/lwc/lexTaskOLYwinBid/lexTaskOLYwinBid.html
@@ -0,0 +1,5 @@
+<template>
+    <div class="ApplicationSubmit" 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/lexTaskOLYwinBid/lexTaskOLYwinBid.js b/force-app/main/default/lwc/lexTaskOLYwinBid/lexTaskOLYwinBid.js
new file mode 100644
index 0000000..46ca57d
--- /dev/null
+++ b/force-app/main/default/lwc/lexTaskOLYwinBid/lexTaskOLYwinBid.js
@@ -0,0 +1,75 @@
+import { LightningElement,wire,track,api} from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import  init  from '@salesforce/apex/OppLoseController.init';
+import  taskOLYwinBid  from '@salesforce/apex/OppLoseController.taskOLYwinBid';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import { updateRecord } from 'lightning/uiRecordApi';
+import LightningConfirm from 'lightning/confirm';
+export default class lexTaskOLYwinBid extends LightningElement {
+    @api recordId;
+    taskStatus;//浠诲姟 鐘舵��
+    OpportunityId;//浠诲姟 ID
+    IsLoading = true;
+    @wire(CurrentPageReference)
+    getStateParameters(currentPageReference){
+        if(currentPageReference){
+            const urlValue=currentPageReference.state.recordId;
+            if(urlValue){
+                let str=`${urlValue}`;
+                this.recordId=str;
+            }
+        }
+    }
+    connectedCallback(){
+        init({
+            taskId: this.recordId
+        }).then(result => {
+            this.IsLoading = false;
+            console.log(result.OpportunityId,result.taskStatus);
+            this.OpportunityId = result.OpportunityId;
+            this.taskStatus = result.taskStatus;
+            this.taskOLYwinBid();
+        })      
+    }
+    //浠诲姟 OLY涓爣
+    taskOLYwinBid(){
+        if(this.taskStatus == '04 鍙栨秷'){
+            this.showToast('浠诲姟鍙栨秷锛屼笉鍙搷浣�',"error");
+        }else{
+            LightningConfirm.open({
+                message: '鏄惁纭绔炰簤瀵规墜涓爣锛�',
+                variant: 'headerless',
+                label: 'this is the aria-label value',
+                }).then(res=>{
+                    if(res) {
+                        taskOLYwinBid({recordId:this.OpportunityId}).then(requst=>{
+                            if(requst == '1'){
+                                this.showToast("鎿嶄綔鎴愬姛锛�","success");
+                                this.updateRecordView();
+                                this.dispatchEvent(new CloseActionScreenEvent());
+                            }
+                            if(requst != "1"){
+                                this.showToast(requst,"error");
+                            }
+                        })
+                    }else{
+                        this.dispatchEvent(new CloseActionScreenEvent());
+                        this.updateRecordView(this.recordId);
+                        return;
+                    }                 
+                });
+        }
+    }
+    showToast(msg,type) {
+        const event = new ShowToastEvent({
+            message: msg,
+            variant: type
+        });
+        this.dispatchEvent(event);
+        this.dispatchEvent(new CloseActionScreenEvent());
+    }
+    updateRecordView() {
+        updateRecord({fields: { Id: this.OpportunityId }});
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexTaskOLYwinBid/lexTaskOLYwinBid.js-meta.xml b/force-app/main/default/lwc/lexTaskOLYwinBid/lexTaskOLYwinBid.js-meta.xml
new file mode 100644
index 0000000..2b7649d
--- /dev/null
+++ b/force-app/main/default/lwc/lexTaskOLYwinBid/lexTaskOLYwinBid.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<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