From 1ce13a35baf4d4a8cd047aacfb27afaae3278073 Mon Sep 17 00:00:00 2001
From: zhangzhengmei <zhangzhengmei@prec-tech.com>
Date: 星期四, 18 五月 2023 14:06:28 +0800
Subject: [PATCH] Merge branch 'LEX_dev' into LEX_zhangzhengmei_dev

---
 force-app/main/default/lwc/lexESignAcceptanceFranchiser/lexESignAcceptanceFranchiser.js |   96 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 96 insertions(+), 0 deletions(-)

diff --git a/force-app/main/default/lwc/lexESignAcceptanceFranchiser/lexESignAcceptanceFranchiser.js b/force-app/main/default/lwc/lexESignAcceptanceFranchiser/lexESignAcceptanceFranchiser.js
new file mode 100644
index 0000000..a41b8ba
--- /dev/null
+++ b/force-app/main/default/lwc/lexESignAcceptanceFranchiser/lexESignAcceptanceFranchiser.js
@@ -0,0 +1,96 @@
+import { LightningElement,wire,track,api} from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import  init  from '@salesforce/apex/ESignController.ESignController';
+import  OcsmResult  from '@salesforce/apex/ESignController.OcsmResult';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+export default class lexESignAcceptanceFranchiser extends LightningElement {
+    @api recordId;//OwnerId
+    IsLoading = true;
+    profileId = '';//褰撳墠鐧诲綍浜虹殑鏉冮檺
+    GrouppurchasePCL = null; //鏄惁闆嗛噰璇环
+    OCMManProvinceCus = null; //OCSM绠$悊鐪�
+    agencyAutoSignUpStatus = null; //缁忛攢鍟嗙姸鎬�
+    agencySignUpDate = null;// 缁忛攢鍟嗙鏀舵棩
+    userId; // 褰撳墠鐧诲綍浜�
+    systemProfileId;//绯荤粺绠$悊鍛�
+    OBA4_sinFor;//OBA4_绛炬敹绠$悊
+
+    @wire(CurrentPageReference)
+     getStateParameters(currentPageReference) {
+         if (currentPageReference) {
+           const urlValue = currentPageReference.state.recordId;
+           if (urlValue) {
+             let str = `${urlValue}`;
+             this.recordId = str;
+           }
+         }
+     }
+    
+    connectedCallback(){
+        init({
+            recordId: this.recordId
+        }).then(result => {
+            console.log(result.agencyAutoSignUpStatus);
+            this.GrouppurchasePCL = result.GrouppurchasePCL;
+            this.OCMManProvinceCus = result.OCMManProvinceCus;
+            this.agencyAutoSignUpStatus = result.agencyAutoSignUpStatus;
+            this.agencySignUpDate = result.agencySignUpDate;
+            this.profileId = result.profileId;
+            this.userId = result.userId;
+            this.systemProfileId = result.systemProfileId;
+            this.OBA4_sinFor = result.OBA4_sinFor;
+            this.IsLoading = false;
+            this.AcceptanceFranchiser();
+        })       
+    }
+    //绛炬敹鍗� 楠屾敹纭(缁忛攢鍟�)
+    AcceptanceFranchiser(){
+    var Group_purchase_PCL ;
+    if(this.GrouppurchasePCL == 1){
+        Group_purchase_PCL = '闆嗛噰璇�';
+    }else{
+        Group_purchase_PCL = this.OCMManProvinceCus;
+    }
+    //妫�绱CSM绠$悊鐪� 涓婄殑钀ヤ笟绠$悊閮ㄦ媴褰�
+    OcsmResult({GrouppurchasePCL:Group_purchase_PCL}).then(res=>{
+        //钀ヤ笟绠$悊閮ㄦ媴褰搃d
+        var salesManage;
+        console.log(res[0].SalesManage__c);
+        salesManage = res[0].SalesManage__c;
+        //鐢靛瓙绛炬敹鍗昳d
+        var id = this.recordId
+        //new 涓�涓璞�
+        var eSignForm;
+        //缁忛攢鍟嗙姸鎬�
+        var status = this.agencyAutoSignUpStatus;
+        if (salesManage || this.profileId == this.systemProfileId) {
+            if (salesManage != this.userId && this.profileId != this.systemProfileId && this.profileId != this.OBA4_sinFor) {
+                // alert('鎮ㄥ彧鑳藉鎵硅惀涓氱鐞嗛儴鎷呭綋鏄嚜宸辩殑绛炬敹鍗曪紒');
+                this.showToast("鎮ㄥ彧鑳藉鎵硅惀涓氱鐞嗛儴鎷呭綋鏄嚜宸辩殑绛炬敹鍗曪紒","error");
+                return;
+            } else if (status != '鐢宠涓�') {
+                // alert('鎮ㄥ彧鑳藉鎵圭敵璇蜂腑鐨勭鏀跺崟锛�')
+                this.showToast("鎮ㄥ彧鑳藉鎵圭敵璇蜂腑鐨勭鏀跺崟锛�","error");
+                return;
+            } else if (this.agencySignUpDate == undefined || this.agencySignUpDate == null || this.agencySignUpDate == "") {
+                // alert('缁忛攢鍟嗙鏀舵棩涓虹┖鏃讹紝涓嶅彲浠ョ‘璁わ紒');
+                this.showToast("缁忛攢鍟嗙鏀舵棩涓虹┖鏃讹紝涓嶅彲浠ョ‘璁わ紒","error");
+                return;
+            }else{
+                window.open ('/apex/AgencyConfirmPage?id='+this.recordId, '缁忛攢鍟嗙‘璁�',
+                'height=440, width=750, top=150, left=300, toolbar=no, menubar=no, scrollbars=no, location=no, status=no');
+                this.dispatchEvent(new CloseActionScreenEvent());
+            }
+        }
+    })
+    }
+    showToast(msg,type) {
+        const event = new ShowToastEvent({
+            message: msg,
+            variant: type
+        });
+        this.dispatchEvent(event);
+        this.dispatchEvent(new CloseActionScreenEvent());
+    }
+}

--
Gitblit v1.9.1