From d533f39b6fa798e238810d17e928dee75d5b1af7 Mon Sep 17 00:00:00 2001
From: yumenghui <953181891@qq.com>
Date: 星期五, 11 八月 2023 16:02:17 +0800
Subject: [PATCH] 备注添加改造
---
force-app/main/default/lwc/lexSelectSubstitute/lexSelectSubstitute.js | 110 ++++++++++++++++++++++--------------------------------
1 files changed, 45 insertions(+), 65 deletions(-)
diff --git a/force-app/main/default/lwc/lexSelectSubstitute/lexSelectSubstitute.js b/force-app/main/default/lwc/lexSelectSubstitute/lexSelectSubstitute.js
index 753abc5..c8361ac 100644
--- a/force-app/main/default/lwc/lexSelectSubstitute/lexSelectSubstitute.js
+++ b/force-app/main/default/lwc/lexSelectSubstitute/lexSelectSubstitute.js
@@ -8,87 +8,67 @@
@api recordId;
id;
- RentalApplyId;
- Status;
IsLoading=true;
+ @api rentalApplyEquipmentSetIds;
+
@wire(CurrentPageReference)
getStateParameters(currentPageReference){
- console.log("杩涘叆椤甸潰");
- console.log(currentPageReference);
- if(currentPageReference){
- const urvalue=currentPageReference.state.recordId;
- if(urvalue){
- let str=`${urvalue}`;
- console.log('str');
- console.log(str);
- this.recordId=str;
+ if(currentPageReference) {
+ const urlValue = currentPageReference.state.recordId;
+ if(urlValue) {
+ let str = `${urlValue}`;
+ this.recordId = str;
}
}
}
-
-
connectedCallback(){
console.log(this.recordId);
- init({recordId:this.recordId}).then(result=>{
- console.log(result);
- if(result!=null){
- this.id=result.id;
- this.RentalApplyId=result.RentalApplyId;
- this.Status=result.Status;
- this.cancelSubmit().then(res=>{
- this.IsLoading=false;
- this.dispatchEvent(new CloseActionScreenEvent());
- });
+ init({
+ recordId:this.recordId
+ }).then(result=>{
+ if(rentalApplyEquipmentSetIds.length<1){
+ this.showToast("璇烽�夋嫨涓�鏉″�熷嚭澶囧搧涓�瑙堣褰�",'warning');
+ }else if(rentalApplyEquipmentSetIds.length>1){
+ this.showToast("鍙兘閫夋嫨涓�鏉¤褰�",'warning');
+ }else{
+
}
}).catch(err=>{
console.log("error:");
console.log(err);
}).finally(()=>{
-
+ selectRentalApplyEquipmentSetByID({
+ recordId: rentalApplyEquipmentSetIds[0]
+ }).then(res=>{
+ if(res.Status__c !='宸叉壒鍑�' && res.Status__c!= '宸插嚭搴撴寚绀�'){
+ this.showToast('鐢宠涔︾姸鎬佷笉绗﹀悎鍒嗛厤浠f浛鍝佹潯浠讹紝璇风‘璁ょ敵璇风殑鐘舵��','warning');
+ }else{
+ if(res.Status__c == '鑽夋涓�' || res.Status__c == '鐢宠涓�' || res.Shippment_loaner_time2__c != null){
+ this.showToast("涓�瑙堢殑鐘舵�佷笉绗﹀悎鍒嗛厤鏇夸唬鍝佹潯浠�",'warning');
+ }else if(res.Irreplaceable_flag__c == true){
+ this.showToast("鐢宠浜哄嬀閫変簡浠f浛鍝佷笉鍙�",'warning');
+ }else{
+ window.open("/apex/RentalFixtureSetSelect?pt_recid="+ this.recordId +"&raesid="+rentalApplyEquipmentSetIds[0]);
+ }
+ }
+ })
});
}
+ showToast(msg,type) {
+ const event = new ShowToastEvent({
+ message: msg,
+ variant: type
+ });
+ if(type == 'success'){
+ this.updateRecordView();
+ }
+ this.dispatchEvent(event);
+ this.dispatchEvent(new CloseActionScreenEvent());
+ }
-
- async cancelSubmit(){
- // 鍙垎閰嶄唬鏇垮搧鍓嶆彁1 -- 澶囧搧鍊熷嚭鐢宠鐨勭姸鎬侊細鈥滃凡鎵瑰噯鈥濆埌鈥滃凡鍑哄簱鎸囩ず鈥�
- if(this.Status != '宸叉壒鍑�' && this.Status != '宸插嚭搴撴寚绀�') {
- // alert('鐢宠涔︾姸鎬佷笉绗﹀悎鍒嗛厤浠f浛鍝佹潯浠讹紝璇风‘璁ょ敵璇风殑鐘舵��');
- const event = new ShowToastEvent({
- title: '鎻愮ず淇℃伅',
- message:'鐢宠涔︾姸鎬佷笉绗﹀悎鍒嗛厤浠f浛鍝佹潯浠讹紝璇风‘璁ょ敵璇风殑鐘舵��'
- });
- this.dispatchEvent(event);
- } else {
- // 鍙垎閰嶄唬鏇垮搧鍓嶆彁2 -- 鎵�閫夊�熷嚭澶囧搧閰嶅涓�瑙堢殑鐘舵�侊細鈥樺凡鎵瑰噯鈥欏埌鈥樺嚭搴撳墠宸叉娴嬧��
- var soqlRecord ;
- await selectRentalApplyEquipmentSetByID({recordId:this.recordId})
- .then(res=>{
- soqlRecord=res;
- var status = soqlRecord.RAES_Status__c;
- var irreplaceable = soqlRecord.Irreplaceable_flag__c;
- var shipTime = soqlRecord.Shippment_loaner_time2__c;
-
- if(status == "鑽夋涓�" || status == "鐢宠涓�" || shipTime != null) {
- // alert("涓�瑙堢殑鐘舵�佷笉绗﹀悎鍒嗛厤鏇夸唬鍝佹潯浠�");
- const event = new ShowToastEvent({
- title: '鎻愮ず淇℃伅',
- message:"涓�瑙堢殑鐘舵�佷笉绗﹀悎鍒嗛厤鏇夸唬鍝佹潯浠�"
- });
- this.dispatchEvent(event);
- } else if(irreplaceable=="true") {
- // alert("鐢宠浜哄嬀閫変簡浠f浛鍝佷笉鍙�");
- const event = new ShowToastEvent({
- title: '鎻愮ず淇℃伅',
- message:"鐢宠浜哄嬀閫変簡浠f浛鍝佷笉鍙�"
- });
- this.dispatchEvent(event);
- } else {
- window.open("/apex/RentalFixtureSetSelect?pt_recid="+this.RentalApplyId+"&raesid="+this.recordId);
- }
- });
-
- }
- }
+ updateRecordView(recordId) {
+ updateRecord({fields: { Id: recordId }});
+ }
}
\ No newline at end of file
--
Gitblit v1.9.1