From a47869c747f3e4777700fc2d430957b6772e5910 Mon Sep 17 00:00:00 2001
From: unknown <sunxia@prec-tech.com>
Date: 星期一, 29 五月 2023 15:31:58 +0800
Subject: [PATCH] 分配代替品
---
force-app/main/default/lwc/lexSelectSubstitute/lexSelectSubstitute.js | 125 +++++++++++++++++------------------------
1 files changed, 51 insertions(+), 74 deletions(-)
diff --git a/force-app/main/default/lwc/lexSelectSubstitute/lexSelectSubstitute.js b/force-app/main/default/lwc/lexSelectSubstitute/lexSelectSubstitute.js
index 753abc5..ca3687a 100644
--- a/force-app/main/default/lwc/lexSelectSubstitute/lexSelectSubstitute.js
+++ b/force-app/main/default/lwc/lexSelectSubstitute/lexSelectSubstitute.js
@@ -3,92 +3,69 @@
import { CloseActionScreenEvent } from 'lightning/actions';
import init from '@salesforce/apex/SelectSubstituteControllerLWT.initFromSelectSubstituteButton';
import selectRentalApplyEquipmentSetByID from '@salesforce/apex/SelectSubstituteControllerLWT.selectRentalApplyEquipmentSetByID';
-import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+
export default class selectSubstituteLWC extends LightningElement {
@api recordId;
id;
- RentalApplyId;
- Status;
IsLoading=true;
- @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;
- }
- }
- }
+ @api rentalApplyEquipmentSetIds;
+ msg;
-
+ // @wire(CurrentPageReference)
+ // getStateParameters(currentPageReference){
+ // 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=>{
+ this.IsLoading = false;
+ if(this.rentalApplyEquipmentSetIds.length<1){
+ this.msg = "璇烽�夋嫨涓�鏉″�熷嚭澶囧搧涓�瑙堣褰�";
+ return;
+ }else if(this.rentalApplyEquipmentSetIds.length>1){
+ this.msg = "鍙兘閫夋嫨涓�鏉¤褰�";
+ return;
+ }else{
+ selectRentalApplyEquipmentSetByID({
+ recordId: this.rentalApplyEquipmentSetIds[0]
+ }).then(res=>{
+ console.log(res);
+ if(res.RAES_Status__c !='宸叉壒鍑�' && res.RAES_Status__c!= '宸插嚭搴撴寚绀�'){
+ this.msg = '鐢宠涔︾姸鎬佷笉绗﹀悎鍒嗛厤浠f浛鍝佹潯浠讹紝璇风‘璁ょ敵璇风殑鐘舵��';
+ return;
+ }else{
+ if(res.RAES_Status__c == '鑽夋涓�' || res.RAES_Status__c == '鐢宠涓�' || res.Shippment_loaner_time2__c != null){
+ this.msg = "涓�瑙堢殑鐘舵�佷笉绗﹀悎鍒嗛厤鏇夸唬鍝佹潯浠�";
+ return;
+ }else if(res.Irreplaceable_flag__c == true){
+ this.msg = "鐢宠浜哄嬀閫変簡浠f浛鍝佷笉鍙�";
+ return;
+ }else{
+ window.open("/apex/RentalFixtureSetSelect?pt_recid="+ this.recordId +"&raesid="+this.rentalApplyEquipmentSetIds[0]);
+ this.closeAction();
+ }
+ }
+ })
}
}).catch(err=>{
- console.log("error:");
- console.log(err);
- }).finally(()=>{
-
- });
+ console.log("error:"+err);
+ })
}
+ closeAction() {
+ //杩斿洖褰撳墠鐨勫鍝佺敵璇�
+ console.log(window.url);
+ window.open("/"+this.recordId,'_self');
+ }
-
- 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);
- }
- });
-
- }
- }
}
\ No newline at end of file
--
Gitblit v1.9.1