From af7f2ebba1ca53c05ad1c47361c889afd53a9765 Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@prec-tech.com>
Date: 星期四, 10 八月 2023 17:26:26 +0800
Subject: [PATCH] 耗材备品
---
force-app/main/default/lwc/lexSubmitExtensionApprovalProcess/lexSubmitExtensionApprovalProcess.js | 61 +++++++++++++++++++++---------
1 files changed, 43 insertions(+), 18 deletions(-)
diff --git a/force-app/main/default/lwc/lexSubmitExtensionApprovalProcess/lexSubmitExtensionApprovalProcess.js b/force-app/main/default/lwc/lexSubmitExtensionApprovalProcess/lexSubmitExtensionApprovalProcess.js
index eefc389..409c474 100644
--- a/force-app/main/default/lwc/lexSubmitExtensionApprovalProcess/lexSubmitExtensionApprovalProcess.js
+++ b/force-app/main/default/lwc/lexSubmitExtensionApprovalProcess/lexSubmitExtensionApprovalProcess.js
@@ -1,8 +1,10 @@
import { LightningElement, track, wire, api } from 'lwc';
import { CurrentPageReference,NavigationMixin } from 'lightning/navigation';
import { CloseActionScreenEvent } from 'lightning/actions';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import { updateRecord } from 'lightning/uiRecordApi';
-import init from '@salesforce/apex/SubmitExtensionApprovalProcessController.init';
+import init from '@salesforce/apex/LexSubmitExtensionController.init';
import extension_approval_processCheck from '@salesforce/apex/RentalApplyWebService.extension_approval_processCheck'
export default class lexSubmitExtensionApprovalProcess extends LightningElement {
@api
@@ -23,43 +25,50 @@
connectedCallback(){
init({
recordId:this.recordId
- }).then(result=>{
- console.log(result);
- var today = new Date();
+ }).then(res=>{
+ console.log('res==='+JSON.stringify(res));
+ if(JSON.stringify(res) == '{}'){
+ this.ToastShow('娌℃湁鏌ュ埌闇�瑕佺殑鏁版嵁','warning');
+ return;
+ }
+ let today = new Date();
//杩藉姞澶囧搧鐢宠鐘舵�佺‘璁わ紝宸茬粡鎻愪氦杩囩殑鐢宠锛屼笉鑳介噸澶嶆彁浜tatus__c
- if(result.ExtensionStatus == '濉啓瀹屾瘯' || result.ExtensionStatus == '鐢宠涓�') {
- alert('璇风‘璁ゅ欢鏈熺敵璇风姸鎬侊紝宸茬粡鎻愪氦杩囩殑鐢宠锛屼笉鑳介噸澶嶆彁浜�');
+ if(res.extensionStatus == '濉啓瀹屾瘯' || res.extensionStatus == '鐢宠涓�') {
+ this.showToast('璇风‘璁ゅ欢鏈熺敵璇风姸鎬侊紝宸茬粡鎻愪氦杩囩殑鐢宠锛屼笉鑳介噸澶嶆彁浜�','error');
return;
}
- extension_approval_processCheck({rentalApplyId:this.recordId}).then( result =>{
+ extension_approval_processCheck({rentalApplyId:this.recordId}).then(result =>{
+ console.log('result==='+result);
if(result != '1'){
if(result == '2'){
//杩斿洖鍊间负2锛屽垽鏂叆鍙d负浠庡崟杩樻槸涓诲崟锛屽鏋滄槸浠庡崟锛岄偅涔堝氨闇�瑕佽烦鍘熸潵鐨勫崟涓欢鏈熼〉闈�
- if(result.RootRentalApply == '' || result.RootRentalApply == null){
+ if(result.rootRentalApply == '' || result.rootRentalApply == null){
window.open("/apex/RentalApplyMultiPostpone?parentId=" + this.recordId);
}else {
window.open("/apex/RentalApplyExtensions?parentId=" + this.recordId);
}
}else{
- alert(result);
- this.dispatchEvent(new CloseActionScreenEvent());
+ this.showToast(result,'error');
return
}
}else{
- if(result.demoPurpose2 == '鍗忚鍊熺敤'){
- alert('璇峰湪[闄勪欢]鍐呬笂浼犳柊鐨勫悎鍚岄檮浠讹紝骞朵緷鎹悎鍚屽唴鏈熼檺杩涜鏃ユ湡濉啓锛屼箣鍚庢彁浜ゅ鎵�');
+ if(res.demoPurpose2 == '鍗忚鍊熺敤'){
+ this.showToast('璇峰湪[闄勪欢]鍐呬笂浼犳柊鐨勫悎鍚岄檮浠讹紝骞朵緷鎹悎鍚屽唴鏈熼檺杩涜鏃ユ湡濉啓锛屼箣鍚庢彁浜ゅ鎵�','error');
return;
}
- if(result.AgreementBorrowingExtensionDate =='' || result.AgreementBorrowingExtensionDate == null){
- alert('鍗忚鍊熺敤鐨勫欢鏈熺敵璇风殑銆愬崗璁�熺敤寤舵湡鏃ユ湡銆戜笉鑳戒负绌�');
+ console.log('typeof'+typeof(res.agreementBorrowingExtensionDate));
+ if(res.agreementBorrowingExtensionDate =='' || res.agreementBorrowingExtensionDate == null){
+ this.showToast('鍗忚鍊熺敤鐨勫欢鏈熺敵璇风殑銆愬崗璁�熺敤寤舵湡鏃ユ湡銆戜笉鑳戒负绌�','error');
return;
}
- if(result.AgreementBorrowingExtensionDate <= result.ReturnDadelineFinal){
- alert('鍗忚鍊熺敤鐨勫欢鏈熺敵璇风殑銆愬崗璁�熺敤寤舵湡鏃ユ湡銆戝繀椤诲ぇ浜庢渶鏂伴瀹氬綊杩樻棩');
+ typeof(res.agreementBorrowingExtensionDate) == 'string' ? res.agreementBorrowingExtensionDate = new Date(res.agreementBorrowingExtensionDate) : '';
+ typeof(res.returnDadelineFinal) == 'string' ? res.returnDadelineFinal = new Date(res.returnDadelineFinal) : '';
+ if(res.agreementBorrowingExtensionDate <= res.returnDadelineFinal){
+ this.showToast('鍗忚鍊熺敤鐨勫欢鏈熺敵璇风殑銆愬崗璁�熺敤寤舵湡鏃ユ湡銆戝繀椤诲ぇ浜庢渶鏂伴瀹氬綊杩樻棩','error');
return;
}
- if(result.AgreementBorrowingExtensionDate <= today ){
- alert('鍗忚鍊熺敤鐨勫欢鏈熺敵璇风殑銆愬崗璁�熺敤寤舵湡鏃ユ湡銆戝繀椤诲ぇ浜庝粖澶�');
+ if(res.agreementBorrowingExtensionDate <= today ){
+ this.showToast('鍗忚鍊熺敤鐨勫欢鏈熺敵璇风殑銆愬崗璁�熺敤寤舵湡鏃ユ湡銆戝繀椤诲ぇ浜庝粖澶�','error');
return;
}
}
@@ -73,4 +82,20 @@
console.log('error====>'+err);
})
}
+
+ showToast(msg,type) {
+ const event = new ShowToastEvent({
+ message: msg,
+ variant: type
+ });
+ if(type == 'success'){
+ this.updateRecordView();
+ }
+ this.dispatchEvent(event);
+ this.dispatchEvent(new CloseActionScreenEvent());
+ }
+
+ updateRecordView(recordId) {
+ updateRecord({fields: { Id: recordId }});
+ }
}
\ No newline at end of file
--
Gitblit v1.9.1