From ddb0231ef7c5cf2bad9d3f1afc2f733674ad38a5 Mon Sep 17 00:00:00 2001
From: unknown <sunxia@prec-tech.com>
Date: 星期四, 24 八月 2023 14:50:51 +0800
Subject: [PATCH] 再修理按钮
---
force-app/main/default/lwc/lexNewSparePartsLoanApplication/lexNewSparePartsLoanApplication.js | 150 ++++++++++++++++++++++++++++----------------------
1 files changed, 84 insertions(+), 66 deletions(-)
diff --git a/force-app/main/default/lwc/lexNewSparePartsLoanApplication/lexNewSparePartsLoanApplication.js b/force-app/main/default/lwc/lexNewSparePartsLoanApplication/lexNewSparePartsLoanApplication.js
index c28718a..036c28b 100644
--- a/force-app/main/default/lwc/lexNewSparePartsLoanApplication/lexNewSparePartsLoanApplication.js
+++ b/force-app/main/default/lwc/lexNewSparePartsLoanApplication/lexNewSparePartsLoanApplication.js
@@ -18,7 +18,7 @@
console.log(currentPageReference);
if (currentPageReference) {
- const urlValue = currentPageReference.state.recordId;
+ let urlValue = currentPageReference.state.recordId;
if (urlValue) {
let str = `${urlValue}`;
console.log("str");
@@ -36,81 +36,98 @@
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;
- }
- if (result.opdIFApproved == true && result.opdApprovedNo != '' && result.opdStatusProcessState.indexOf(result.opdApprovedStatus)!= -1 && result.opdApprovedStatus != '鑽夌' ){
- this.showToast('宸茬敵璇峰喅瑁佷絾鍐宠鐘舵�佷笉绗﹀悎鏉′欢','error');
- return;
- }
- var HaveValue = "{!OPDPlan__c.Rental_Apply2__c}";
- if (result.opdRentalApply2 != '' && result.opdType != '瀛︿細') {
- this.showToast('涓�涓狾PD璁″垝鍙彲鍏宠仈鍒涘缓涓�涓鍝佺敵璇峰崟','error');
+ this.showToast('闇�瑕佸喅瑁佹椂锛屽喅瑁佺紪鐮佷笉鑳戒负绌�','warning');
return;
}
+ // 鍐宠鐘舵�� Approved_Status__c
+ if (result.opdIFApproved == true && result.opdApprovedNo != '' && result.opdStatusProcessState.indexOf(result.opdApprovedStatus)!== -1 && result.opdApprovedStatus != '鑽夌' ){
+ 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璁″垝鍙彲鍏宠仈鍒涘缓涓�涓鍝佺敵璇峰崟','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 == '') {
+ console.log("---------瀛︿細-5555--------",result.opdCampaignId);
if (result.opdType == '瀛︿細' && result.opdCampaignId != '') {
+ console.log("---------瀛︿細---------",result.opdCampaignId);
// var purposeStr = '&00N10000003Msk0=浜у搧璇曠敤' +
// '&00N10000003Msk5=瀛︿細灞曚細' +
// '&CF00N10000003Mp2q_lkid={!URLENCODE(OPDPlan__c.CampaignId__c)}' +
// '&CF00N10000003Mp2q={!URLENCODE(OPDPlan__c.CampaignName__c)}';
- const defaultValues = encodeDefaultFieldValues({
+ let defaultValues = encodeDefaultFieldValues({
// OPDPlan__c:this.recordId,
Demo_purpose1__c:'浜у搧璇曠敤',
demo_purpose2__c:'瀛︿細灞曚細',
- Campaign__c:result.opdCampaign,
+ Campaign__c:result.opdCampaignId,
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,
@@ -118,31 +135,33 @@
Approved_State_Create__c:result.ApprovedStatus,
ApprovedNo_Create__c:result.opdApprovedNo
});
+ console.log("---------瀛︿細---defaultValues------",defaultValues);
this.navigateEvents(defaultValues);
} else if (result.opdOpportunityId != '') {
+ // 璺熻繘璇环ID1
// var purposeStr = '&00N10000003Msk0=浜у搧璇曠敤' +
// '&00N10000003Msk5=璇曠敤锛堟湁璇环锛�' +
// '&CF00N10000003O3VB_lkid={!OPDPlan__c.Related_Opportunity1_IDId__c}' +
// '&CF00N10000003O3VB={!HTMLENCODE(OPDPlan__c.Related_Opportunity1_Name__c)}';
console.log("--------defaultValues------")
- const defaultValues = encodeDefaultFieldValues({
+ let defaultValues = encodeDefaultFieldValues({
// 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);
@@ -152,18 +171,18 @@
// var purposeStr = '&00N10000003Msk0=浜у搧璇曠敤' +
// '&00N10000003Msk5=璇曠敤锛堟棤璇环锛�' +
// '&00N100000098amW={!OPDPlan__c.NoOpp_Reason__c}';
- const defaultValues = encodeDefaultFieldValues({
+ let defaultValues = encodeDefaultFieldValues({
// OPDPlan__c:this.recordId,
Demo_purpose1__c:'浜у搧璇曠敤',
demo_purpose2__c:'璇曠敤锛堟湁璇环锛�',
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,
@@ -190,7 +209,7 @@
// window.open('/a0t/e?retURL=%2F{!OPDPlan__c.Id}' + purposeStr + urlStr );
} else {
- const defaultValues = encodeDefaultFieldValues({
+ let defaultValues = encodeDefaultFieldValues({
// OPDPlan__c:this.recordId,
Cancel_Reason__c:'',
Loaner_cancel_reason__c:'',
@@ -214,7 +233,7 @@
}
}else {
console.log("-------UserInfo_Owner---00000--else-------");
- const defaultValues = encodeDefaultFieldValues({
+ let defaultValues = encodeDefaultFieldValues({
// OPDPlan__c:this.recordId,
Cancel_Reason__c:'',
Loaner_cancel_reason__c:'',
@@ -249,8 +268,8 @@
}
showToast(message, type) {
- const evt = new ShowToastEvent({
- title: 'Error',
+ let evt = new ShowToastEvent({
+ // title: 'Error',
message: message,
variant: type
});
@@ -268,8 +287,7 @@
},
state:{
defaultFieldValues: defaultValues
-
}
- })
+ });
}
}
\ No newline at end of file
--
Gitblit v1.9.1