From 13a007c5803ab3b52e7827c717640b1721cc96e5 Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@prec-tech.com>
Date: 星期四, 13 七月 2023 18:31:07 +0800
Subject: [PATCH] 耗材申请 取消 选择明细 发货 耗材申请中间小画面 一览 选择操作画面借出耗材备品一览

---
 force-app/main/default/lwc/lexNewSparePartsLoanApplication/lexNewSparePartsLoanApplication.js |  119 +++++++++++++++++++++++++++++++++--------------------------
 1 files changed, 67 insertions(+), 52 deletions(-)

diff --git a/force-app/main/default/lwc/lexNewSparePartsLoanApplication/lexNewSparePartsLoanApplication.js b/force-app/main/default/lwc/lexNewSparePartsLoanApplication/lexNewSparePartsLoanApplication.js
index c28718a..17f0cf5 100644
--- a/force-app/main/default/lwc/lexNewSparePartsLoanApplication/lexNewSparePartsLoanApplication.js
+++ b/force-app/main/default/lwc/lexNewSparePartsLoanApplication/lexNewSparePartsLoanApplication.js
@@ -36,63 +36,78 @@
             this.IsLoading = false;
             if (result != null) {
                 console.log("-------result--------------",JSON.stringify(result))
+                // 	StayOrNot__c 鎵�鏈変汉鍦ㄧ鑱岀姸鎬�
                 if (result.opdStayOrNot == '宸茬鑱�') {
-                    this.showToast('鎵�鏈変汉宸茬粡绂昏亴锛岃鑱旂郴绯荤粺绠$悊鍛樹慨鏀规墍鏈変汉銆�','error');
+                    this.showToast('鎵�鏈変汉宸茬粡绂昏亴锛岃鑱旂郴绯荤粺绠$悊鍛樹慨鏀规墍鏈変汉銆�','warning');
                     return;
                 }
+                // IF_Approved__c 鏄惁闇�瑕佺敵璇峰喅瑁� ; Approved_No__c 鍐宠缂栫爜
                 if (result.opdIFApproved == true && result.opdApprovedNo == ''){
-                this.showToast('闇�瑕佸喅瑁佹椂锛屽喅瑁佺紪鐮佷笉鑳戒负绌�','error');
-                return;
+                    this.showToast('闇�瑕佸喅瑁佹椂锛屽喅瑁佺紪鐮佷笉鑳戒负绌�','warning');
+                    return;
                 }
+                // 鍐宠鐘舵��  Approved_Status__c  
                 if (result.opdIFApproved == true && result.opdApprovedNo != '' && result.opdStatusProcessState.indexOf(result.opdApprovedStatus)!= -1 && result.opdApprovedStatus != '鑽夌' ){
-                this.showToast('宸茬敵璇峰喅瑁佷絾鍐宠鐘舵�佷笉绗﹀悎鏉′欢','error');
-                return;
+                    this.showToast('宸茬敵璇峰喅瑁佷絾鍐宠鐘舵�佷笉绗﹀悎鏉′欢','warning');
+                    return;
                 }
                 var HaveValue = "{!OPDPlan__c.Rental_Apply2__c}";
+                // 	澶囧搧鍊熷嚭鐢宠1   Rental_Apply2__c ;  OPD璁″垝鏉ユ簮  OPDType__c
                 if (result.opdRentalApply2 != '' && result.opdType != '瀛︿細') {
-                    this.showToast('涓�涓狾PD璁″垝鍙彲鍏宠仈鍒涘缓涓�涓鍝佺敵璇峰崟','error');
+                    this.showToast('涓�涓狾PD璁″垝鍙彲鍏宠仈鍒涘缓涓�涓鍝佺敵璇峰崟','warning');
                     return;
                 }
+                // 	鐘舵��  Status__c
                 if (result.opdStatus != '璁″垝涓�') {
-                this.showToast('OPD璁″垝鐨勭姸鎬佷笉鏄鍒掍腑锛屼笉鑳芥柊寤哄鍝佸�熷嚭鐢宠','error');
-                return;
+                    this.showToast('OPD璁″垝鐨勭姸鎬佷笉鏄鍒掍腑锛屼笉鑳芥柊寤哄鍝佸�熷嚭鐢宠','warning');
+                    return;
                 }
                 
                 UserInfo_Owner({}).then(res=>{
-                    console.log("-------UserInfo_Owner------------",res);
-                    if(res.isFormalStuff == 'true'){
-                        this.showToast('璇曠敤鏈熷唴锛屼笉鑳界敵璇�','error');
+                    console.log("-------UserInfo_Owner---1111---------",res);
+                    // 鏄惁鍦ㄨ瘯鐢ㄦ湡  isFormal_Stuff__c
+                    if(res.isFormalStuff){
+                        this.showToast('璇曠敤鏈熷唴锛屼笉鑳界敵璇�','warning');
                         return;
                     }
-                    console.log("-------UserInfo_Owner---1111---------",result);
+                    
+                    // 瀛︿細  Campaign__c
                     if (result.opdType == '瀛︿細' && result.opdCampaignId != '') {
                         console.log("-------UserInfo_Owner---2222---------");
+                        // 	鎻愪氦鐢宠FLG  Rental_Apply_Flag__c
                         if (result.opdRentalApplyFlag < 7) {
-                        this.showToast("鐢宠鎻愪氦蹇呴』鍦�7澶╋紙鍚級浠ヤ笂鎵嶅彲浠�",'error');
-                        return;
+                            this.showToast("鐢宠鎻愪氦蹇呴』鍦�7澶╋紙鍚級浠ヤ笂鎵嶅彲浠�",'warning');
+                            return;
                         }
+                        // userProvince 鐪� Province__c
                         var ups = res.userProvince.slice(0, 2);
-                        if (result.opdCampaignTypeId != '01210000000R26P' && res.userJobCategory == '閿�鍞湇鍔�' ) {
-                        this.showToast('FSE涓嶈兘鐢宠璇ュ浼氱被鍨嬪鍝�','error');
-                        return;
-                        } else if ((res.userJobCategory == '閿�鍞湇鍔�' || res.userJobCategory == '鏀彺') && result.opdCampaignTypeId == '01210000000R26P' && result.opdInternalinchargeprovince.indexOf(ups) == -1) {
-                        this.showToast("涓嶧SE鎵�鍦ㄧ渷涓�鑷达紝鎵嶅彲浣跨敤澶囧搧",'error');
-                        return;
+                        let campaignRecodeType = result.opdCampaignRecodeTypeId.slice(0,15)
+                        let getCampaignRecodeType = result.opdCampaignTypeId.slice(0,15)
+                        console.log("-------opdCampaignRecodeTypeId---2222---------",getCampaignRecodeType,campaignRecodeType);
+                        // 鑱岀 Job_Category__c
+                        if (campaignRecodeType !== getCampaignRecodeType && res.userJobCategory == '閿�鍞湇鍔�' ) {
+                            this.showToast('FSE涓嶈兘鐢宠璇ュ浼氱被鍨嬪鍝�','warning');
+                            return;
+                        } else if ((res.userJobCategory == '閿�鍞湇鍔�' || res.userJobCategory == '鏀彺') && campaignRecodeType !== getCampaignRecodeType && result.opdInternalinchargeprovince.indexOf(ups) == -1) {
+                            this.showToast("涓嶧SE鎵�鍦ㄧ渷涓�鑷达紝鎵嶅彲浣跨敤澶囧搧",'warning');
+                            return;
                         } else if (result.opdCampaignStatus == '宸茬粨鏉�') {
-                        this.showToast("宸茬粨鏉燂紝涓嶈兘鐢宠",'error');
-                        return;
+                            // 瀛︿細鐘舵��   CampaignStatus__c
+                            this.showToast("宸茬粨鏉燂紝涓嶈兘鐢宠",'warning');
+                            return;
                         } else if (result.opdCampaignStatus == '宸叉彁浜ゆ姤鍛�') {
-                        this.showToast("宸叉彁浜ゆ姤鍛婏紝涓嶈兘鐢宠",'error');
-                        return;
+                            this.showToast("宸叉彁浜ゆ姤鍛婏紝涓嶈兘鐢宠",'warning');
+                            return;
                         } else if (result.opdCampaignStatus == '鍙栨秷鐢宠涓�') {
-                        this.showToast("鍙栨秷鐢宠涓紝涓嶈兘鐢宠",'error');
-                        return;
+                            this.showToast("鍙栨秷鐢宠涓紝涓嶈兘鐢宠",'warning');
+                            return;
                         } else if (result.opdCampaignStatus == '鍙栨秷') {
-                        this.showToast("宸茬粡鍙栨秷锛屼笉鑳界敵璇�",'error');
-                        return;
+                            this.showToast("宸茬粡鍙栨秷锛屼笉鑳界敵璇�",'warning');
+                            return;
                         }  
                     }
 
+                    // 鍘烵PD璁″垝(鍐嶇敵璇�)   OriginalOpdPlan__c  鍘烵PD璁″垝(琛ュ厖鐢宠) OriginalOpdPlanApplication__c
                     if (result.opdOriginalOpdPlan == '') {
                         if (result.opdOriginalOpdPlanApplication == '') {
                             if (result.opdType == '瀛︿細' && result.opdCampaignId != '') {
@@ -106,11 +121,11 @@
                                     demo_purpose2__c:'瀛︿細灞曚細',
                                     Campaign__c:result.opdCampaign,
                                     Account__c:result.opdAccountLaboratory,
-                                    Strategic_dept__c:result.opdOCMcategoryName,
-                                    Hospital__c:result.opdHospitalName,
-                                    OPDPlan__c:opdName,
-                                    Person_In_Charge__c:res.lastName + res.firstName,
-                                    applyUser__c:res.lastName + res.firstName,
+                                    Strategic_dept__c:result.opdOCMcategoryId,
+                                    Hospital__c:result.opdHospitalId,
+                                    OPDPlan__c:result.opdPlanId,
+                                    Person_In_Charge__c:res.id,
+                                    applyUser__c:res.id,
                                     Loaner_received_staff__c:res.lastName + res.firstName,
                                     IsJump__c:result.opdIsJump,
                                     JumpCause__c:result.opdJumpCause,
@@ -120,6 +135,7 @@
                                 });
                                 this.navigateEvents(defaultValues);
                             } else if (result.opdOpportunityId != '') {
+                                // 璺熻繘璇环ID1
                                 // var purposeStr = '&00N10000003Msk0=浜у搧璇曠敤' +
                                 // '&00N10000003Msk5=璇曠敤锛堟湁璇环锛�' +
                                 // '&CF00N10000003O3VB_lkid={!OPDPlan__c.Related_Opportunity1_IDId__c}' +
@@ -129,20 +145,20 @@
                                     // OPDPlan__c:this.recordId,
                                     Demo_purpose1__c:'浜у搧璇曠敤',
                                     demo_purpose2__c:'璇曠敤锛堟湁璇环锛�',
-                                    Follow_UP_Opp__c:result.opdRelatedOpportunity1Name,
+                                    Follow_UP_Opp__c:result.opdRelatedOpportunity1ID,
 
                                     Account__c:result.opdAccountLaboratory,
-                                    // Strategic_dept__c:result.opdOCMcategoryName,
-                                    // Hospital__c:result.opdHospitalName,
-                                    // OPDPlan__c:opdName,
-                                    // Person_In_Charge__c:res.lastName + res.firstName,
-                                    // applyUser__c:res.lastName + res.firstName,
-                                    // Loaner_received_staff__c:res.lastName + res.firstName,
-                                    // IsJump__c:result.opdIsJump,
-                                    // JumpCause__c:result.opdJumpCause,
-                                    // Name:'*',
-                                    // Approved_State_Create__c:result.ApprovedStatus,
-                                    // ApprovedNo_Create__c:result.opdApprovedNo
+                                    Strategic_dept__c:result.opdOCMcategoryId,
+                                    Hospital__c:result.opdHospitalId,
+                                    OPDPlan__c:result.opdPlanId,
+                                    Person_In_Charge__c:res.id,
+                                    applyUser__c:res.id,
+                                    Loaner_received_staff__c:res.lastName + res.firstName,
+                                    IsJump__c:result.opdIsJump,
+                                    JumpCause__c:result.opdJumpCause,
+                                    Name:'*',
+                                    Approved_State_Create__c:result.ApprovedStatus,
+                                    ApprovedNo_Create__c:result.opdApprovedNo
                                 });
                                 console.log("--------defaultValues---1111---",defaultValues);
                                 
@@ -159,11 +175,11 @@
                                     NoOpp_Reason__c:result.opdNoOppReason,
 
                                     Account__c:result.opdAccountLaboratory,
-                                    Strategic_dept__c:result.opdOCMcategoryName,
-                                    Hospital__c:result.opdHospitalName,
-                                    OPDPlan__c:opdName,
-                                    Person_In_Charge__c:res.lastName + res.firstName,
-                                    applyUser__c:res.lastName + res.firstName,
+                                    Strategic_dept__c:result.opdOCMcategoryId,
+                                    Hospital__c:result.opdHospitalId,
+                                    OPDPlan__c:result.opdPlanId,
+                                    Person_In_Charge__c:res.id,
+                                    applyUser__c:res.id,
                                     Loaner_received_staff__c:res.lastName + res.firstName,
                                     IsJump__c:result.opdIsJump,
                                     JumpCause__c:result.opdJumpCause,
@@ -250,7 +266,7 @@
 
     showToast(message, type) {
         const evt = new ShowToastEvent({
-            title: 'Error',
+            // title: 'Error',
             message: message,
             variant: type
         });
@@ -268,7 +284,6 @@
             },
             state:{
                 defaultFieldValues: defaultValues
-
             }
         })
     }

--
Gitblit v1.9.1