From e14d6d0619330cad423f06493e3aa2371faa2a8f Mon Sep 17 00:00:00 2001
From: 19626 <1962676589@qq.com>
Date: 星期六, 09 九月 2023 14:02:23 +0800
Subject: [PATCH] Sit期间修改

---
 force-app/main/default/lwc/lexAgencyAuthorize/lexAgencyAuthorize.js |  159 ++++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 140 insertions(+), 19 deletions(-)

diff --git a/force-app/main/default/lwc/lexAgencyAuthorize/lexAgencyAuthorize.js b/force-app/main/default/lwc/lexAgencyAuthorize/lexAgencyAuthorize.js
index 30da2db..0ab2880 100644
--- a/force-app/main/default/lwc/lexAgencyAuthorize/lexAgencyAuthorize.js
+++ b/force-app/main/default/lwc/lexAgencyAuthorize/lexAgencyAuthorize.js
@@ -4,7 +4,7 @@
  * @Author: chen jing wu
  * @Date: 2023-04-12 14:51:44
  * @LastEditors: chen jing wu
- * @LastEditTime: 2023-04-19 09:11:02
+ * @LastEditTime: 2023-09-05 15:47:38
  */
 import { api, wire,LightningElement } from 'lwc';
 import { CurrentPageReference } from "lightning/navigation";
@@ -14,9 +14,12 @@
 import { updateRecord } from 'lightning/uiRecordApi';
 import { ShowToastEvent } from 'lightning/platformShowToastEvent';
 import checkDangerItem from '@salesforce/apex/OpportunityWebService.checkDangerItem';
+import accSendEmail from '@salesforce/apex/OpportunityWebService.accSendEmail';
 import oppCheck from '@salesforce/apex/OpportunityWebService.oppCheck';
 import updReg from '@salesforce/apex/OpportunityWebService.updReg';
-
+import TradeComplianceStatusFlag from '@salesforce/label/c.TradeComplianceStatusFlag';
+import IFTradeComplianceAlert from '@salesforce/label/c.IFTradeComplianceAlert';
+import LightningConfirm from 'lightning/confirm';
 export default class LexAgencyAuthorize extends LightningElement {
     @api recordId;
     agency1Id;
@@ -37,6 +40,17 @@
     isCorrosion;
     profileId;
     ifAuthorizingLock;
+    systemProfileId;
+    j3ProfileId;
+    s61ProfileId;
+    s62ProfileId;
+    m4ProfileId;
+    AccDealerBlacklist;
+    angency1;
+    angency2;
+    accname;
+    ownerids;
+    ddid;
     IsLoading = true;
     @wire(CurrentPageReference)
     getStateParameters(currentPageReference) {
@@ -76,8 +90,23 @@
             this.isCorrosion = result.isCorrosion;
             this.profileId = result.profileId;
             this.ifAuthorizingLock = result.ifAuthorizingLock;
+            this.systemProfileId = result.systemProfileId;
+            this.j3ProfileId = result.j3ProfileId;
+            this.s61ProfileId = result.s61ProfileId;
+            this.s62ProfileId = result.s62ProfileId;
+            this.m4ProfileId = result.m4ProfileId;
+            this.AccDealerBlacklist = result.AccDealerBlacklist;
+            this.angency1 = result.angency1;
+            this.angency2 = result.angency2;
+            this.accname = result.accname;
+            this.ownerids = result.ownerids;
+            this.ddid = result.ddid;
+            console.log("w");
             this.AgencyAuthorize();
-        })
+        }).catch(error=>{
+            console.log("error");
+            console.log(error);
+        });
     }
     AgencyAuthorize(){
         var btns = document.getElementsByName("agency_authorize");
@@ -89,12 +118,96 @@
         var oppid = this.recordId;
         var angency = this.agency1Id;
         var profileId = this.profileId;
-        
-        if (profileId != '00e10000000Y3o5' && profileId != '00e10000000Nab7' && profileId != '00e10000000xnpR' && profileId != '00e10000000xyK6' && profileId != '00e10000000NbCE'
-        && profileId != '00e10000000xyK6' && profileId != '00e10000000Nb7i') {
+         //娴嬭瘯宸查攣瀹氭巿鏉冨悎鍚岀敵璇蜂负鈥�1鈥�
+        this.estimationId = 'test';
+        this.detailNum = 1;
+        if (profileId != this.systemProfileId && profileId != this.j3ProfileId && profileId != this.s61ProfileId && profileId != this.s62ProfileId && profileId != this.m4ProfileId) {
             this.showToast("鎮ㄦ病鏈夋巿鏉冪敵璇风殑鏉冮檺銆傝鑱旂郴绯荤粺绠$悊鍛樸��","error");
             return;
         }
+        //璐告槗鍚堣 you
+        var AccDealerBlacklist = this.AccDealerBlacklist;//鍒ゆ柇瀹㈡埛/缁忛攢鍟嗘槸鍚︿负榛戝悕鍗�
+        var angency1 = this.angency1;
+        var angency2 = this.angency2;
+        var accname = this.accname;
+        var ownerids = this.ownerids;
+        var ddid = this.ddid;
+        if(TradeComplianceStatusFlag=='true'){
+            //鎷︽埅+閭欢鎻愰啋
+            var oppflag=false;
+            if (AccDealerBlacklist=='123') {
+                // alert('瀹㈡埛,缁忛攢鍟�1锛岀粡閿�鍟�2閮戒负榛戝悕鍗曪紝涓嶈兘鍋氭巿鏉冪敵璇凤紝'+IFTradeComplianceAlert);
+                this.showToast('瀹㈡埛,缁忛攢鍟�1锛岀粡閿�鍟�2閮戒负榛戝悕鍗曪紝涓嶈兘鍋氭巿鏉冪敵璇凤紝'+IFTradeComplianceAlert,'error');
+                oppflag=true;
+
+            }else if(AccDealerBlacklist=='12'){
+                // alert('瀹㈡埛,缁忛攢鍟�1閮戒负榛戝悕鍗曪紝涓嶈兘鍋氭巿鏉冪敵璇凤紝'+IFTradeComplianceAlert);
+                this.showToast('瀹㈡埛,缁忛攢鍟�1閮戒负榛戝悕鍗曪紝涓嶈兘鍋氭巿鏉冪敵璇凤紝'+IFTradeComplianceAlert,'error');
+                oppflag=true;
+            }else if(AccDealerBlacklist=='23'){
+                // alert('缁忛攢鍟�1锛岀粡閿�鍟�2閮戒负榛戝悕鍗曪紝涓嶈兘鍋氭巿鏉冪敵璇凤紝'+IFTradeComplianceAlert);
+                this.showToast('缁忛攢鍟�1锛岀粡閿�鍟�2閮戒负榛戝悕鍗曪紝涓嶈兘鍋氭巿鏉冪敵璇凤紝'+IFTradeComplianceAlert,'error');
+                oppflag=true;
+            }else if(AccDealerBlacklist=='13'){
+                // alert('瀹㈡埛,缁忛攢鍟�2閮戒负榛戝悕鍗曪紝涓嶈兘鍋氭巿鏉冪敵璇凤紝'+IFTradeComplianceAlert);
+                this.showToast('瀹㈡埛,缁忛攢鍟�2閮戒负榛戝悕鍗曪紝涓嶈兘鍋氭巿鏉冪敵璇凤紝'+IFTradeComplianceAlert,'error');
+                oppflag=true;
+            }else if(AccDealerBlacklist=='1'){
+                // alert('瀹㈡埛涓洪粦鍚嶅崟锛屼笉鑳藉仛鎺堟潈鐢宠锛�'+IFTradeComplianceAlert);
+                this.showToast('瀹㈡埛涓洪粦鍚嶅崟锛屼笉鑳藉仛鎺堟潈鐢宠锛�'+IFTradeComplianceAlert,'error');
+                oppflag=true;
+            }else if(AccDealerBlacklist=='2'){
+                // alert('缁忛攢鍟�1涓洪粦鍚嶅崟锛屼笉鑳藉仛鎺堟潈鐢宠锛�'+IFTradeComplianceAlert);
+                this.showToast('缁忛攢鍟�1涓洪粦鍚嶅崟锛屼笉鑳藉仛鎺堟潈鐢宠锛�'+IFTradeComplianceAlert,'error');
+                oppflag=true;
+            }else if(AccDealerBlacklist=='3'){
+                // alert('缁忛攢鍟�2涓洪粦鍚嶅崟锛屼笉鑳藉仛鎺堟潈鐢宠锛�'+IFTradeComplianceAlert);
+                this.showToast('缁忛攢鍟�2涓洪粦鍚嶅崟锛屼笉鑳藉仛鎺堟潈鐢宠锛�'+IFTradeComplianceAlert,'error');
+                oppflag=true;
+            }
+            console.log('y');
+            console.log(oppflag);
+            if(oppflag){
+                accSendEmail({
+                    "AccDealerBlacklist":AccDealerBlacklist,
+                    "accname":accname,
+                    "angency1":angency1,
+                    "angency2":angency2,
+                    "ownerids":ownerids,
+                    "ddid":ddid,
+                    "oppid":oppid 
+                }).then(result=>{
+                    console.log('q');
+                    var opprtn = result;
+                    if (opprtn = true) {
+                        return;
+                    }
+                    //璀︾ず鎻愰啋
+                    if (AccDealerBlacklist=='567') {
+                        this.handleConfirmClick('鎮ㄦ墍閫夋嫨鐨勫鎴�,缁忛攢鍟�1锛岀粡閿�鍟�2瀛樺湪璐告槗鍚堣璀︾ず椋庨櫓锛屼笉寤鸿鍋氭巿鏉冪敵璇凤紝璇锋偍纭鏄惁缁х画鐢宠锛�'+IFTradeComplianceAlert);
+                    }else if(AccDealerBlacklist=='56'){
+                        this.handleConfirmClick('鎮ㄦ墍閫夋嫨鐨勫鎴�,缁忛攢鍟�1瀛樺湪璐告槗鍚堣璀︾ず椋庨櫓锛屼笉寤鸿鍋氭巿鏉冪敵璇凤紝璇锋偍纭鏄惁缁х画鐢宠锛�'+IFTradeComplianceAlert);
+                    }else if(AccDealerBlacklist=='67'){
+                        this.handleConfirmClick('鎮ㄦ墍閫夋嫨鐨勭粡閿�鍟�1锛岀粡閿�鍟�2瀛樺湪璐告槗鍚堣璀︾ず椋庨櫓锛屼笉寤鸿鍋氭巿鏉冪敵璇凤紝璇锋偍纭鏄惁缁х画鐢宠锛�'+IFTradeComplianceAlert);
+                    }else if(AccDealerBlacklist=='57'){
+                        this.handleConfirmClick('鎮ㄦ墍閫夋嫨鐨勫鎴�,缁忛攢鍟�2瀛樺湪璐告槗鍚堣璀︾ず椋庨櫓锛屼笉寤鸿鍋氭巿鏉冪敵璇凤紝璇锋偍纭鏄惁缁х画鐢宠锛�'+IFTradeComplianceAlert);
+                    }else if(AccDealerBlacklist=='5'){
+                        this.handleConfirmClick('鎮ㄦ墍閫夋嫨鐨勫鎴峰瓨鍦ㄨ锤鏄撳悎瑙勮绀洪闄╋紝涓嶅缓璁仛鎺堟潈鐢宠锛岃鎮ㄧ‘璁ゆ槸鍚︾户缁敵璇凤紝'+IFTradeComplianceAlert);
+                    }else if(AccDealerBlacklist=='6'){
+                        this.handleConfirmClick('鎮ㄦ墍閫夋嫨鐨勭粡閿�鍟�1瀛樺湪璐告槗鍚堣璀︾ず椋庨櫓锛屼笉寤鸿鍋氭巿鏉冪敵璇凤紝璇锋偍纭鏄惁缁х画鐢宠锛�'+IFTradeComplianceAlert);
+                    }else if(AccDealerBlacklist=='7'){
+                        this.handleConfirmClick('鎮ㄦ墍閫夋嫨鐨勭粡閿�鍟�2瀛樺湪璐告槗鍚堣璀︾ず椋庨櫓锛屼笉寤鸿鍋氭巿鏉冪敵璇凤紝璇锋偍纭鏄惁缁х画鐢宠锛�'+IFTradeComplianceAlert);
+                    }
+                });
+            }else{
+                this.ss();
+            }
+        }else{
+            this.ss();
+        }
+        //璐告槗鍚堣 you
+    }
+    ss(){
         if (this.stageName != '寮曞悎' && this.stageName != '璇环' ) {
             this.showToast("鐘舵��1:" + this.stageName + "銆佷笉鑳藉仛鎺堟潈鐢宠锛�","error");
             return;
@@ -108,9 +221,10 @@
             this.showToast("鑰楁潗涓嶅彲涓庡ゥ杈変骇鍝佸悓鏃跺瓨鍦紒","error");
             return;
         } else if (this.cntLostCancelDraft > 0) {
-        if(!confirm('璇环鏈夎崏妗堜腑鐨勫彇娑�/澶卞崟鎶ュ憡锛屾槸鍚︾户缁紵')){
-            return ;
-        }
+            if(!confirm('璇环鏈夎崏妗堜腑鐨勫彇娑�/澶卞崟鎶ュ憡锛屾槸鍚︾户缁紵')){
+                this.dispatchEvent(new CloseActionScreenEvent());
+                return ;
+            }     
         } else if (this.cntLostCancelReport - this.cntLostCancelDraft > 0) {
             this.showToast('璇环鏈夊凡鎻愪氦鐨勫彇娑�/澶卞崟鎶ュ憡銆�',"error");
             return;
@@ -123,23 +237,18 @@
         } else if (this.salesRoot != '璨╁2搴�') {
             this.showToast('鍖婚櫌鐩撮攢涓嶉渶瑕佹巿鏉冪敵璇枫��',"error");
             return;
-        }
-        // else if ('{!Opportunity.AcecideCntCheck__c}' != '1') {
-        // alert('闃胯タ璧涘璇环鍙兘鍖呭惈鍗卞寲鍝侊紝鎴栬�咃紝鏅�氳浠蜂笉鑳藉寘鍚嵄鍖栧搧銆�');
-        // return;
-        // }
-        else if (this.ifSubmit == '1') {
+        }else if (this.ifSubmit == '1') {
             this.showToast('涓婁紶澶辫触锛岃鑱旂郴绯荤粺绠$悊鍛�!',"error");
             return;
         }
-        if (this.ifAuthorizingLock == 'true') {
+        if (this.ifAuthorizingLock == true) {
             this.showToast('璇环姝e湪鎺堟潈涓紝璇蜂笉瑕侀噸澶嶆彁浜ゃ��',"error");
             return;
         }
         if (this.trade == '鍐呰部') {
             if(this.isCorrosion == '1'){
                 checkDangerItem({
-                    agency1: angency
+                    agency1: this.agency1Id
                 }).then(result=>{
                     var rtn1 = result;
                     if (rtn1 != 'OK') {
@@ -150,7 +259,7 @@
             });
             }else{
                 oppCheck({
-                    oppid: oppid,
+                    oppid: this.recordId,
                     saveFlg: '1'
                 }).then(result=>{
                     var rtn = result;
@@ -163,12 +272,24 @@
             }
         } else {
             updReg({
-                oppid: oppid
+                oppid: this.recordId
             }).then(()=>{
                 this.update();
             });
         }  
     }
+    async handleConfirmClick(msg) {
+        const result = await LightningConfirm.open({
+            message: msg,
+            variant: 'headerless',
+            label: 'this is the aria-label value'
+        });
+        if (result) {
+            this.ss();
+        } else {
+            this.dispatchEvent(new CloseActionScreenEvent());
+        }
+    }
     showToast(msg,type) {
         const event = new ShowToastEvent({
             title: '',

--
Gitblit v1.9.1