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.css | 13 +++
force-app/main/default/lwc/lexSelectSubstitute/lexSelectSubstitute.js-meta.xml | 39 ++++++++-
force-app/main/default/lwc/lexSelectSubstitute/lexSelectSubstitute.html | 14 ++
force-app/main/default/lwc/lexSelectSubstitute/lexSelectSubstitute.js | 125 ++++++++++++------------------
4 files changed, 106 insertions(+), 85 deletions(-)
diff --git a/force-app/main/default/lwc/lexSelectSubstitute/lexSelectSubstitute.css b/force-app/main/default/lwc/lexSelectSubstitute/lexSelectSubstitute.css
index af18c76..95c1c55 100644
--- a/force-app/main/default/lwc/lexSelectSubstitute/lexSelectSubstitute.css
+++ b/force-app/main/default/lwc/lexSelectSubstitute/lexSelectSubstitute.css
@@ -1,4 +1,4 @@
-.Holder{
+.holder{
position: relative;
display: inline-block;
width: 80px;
@@ -8,4 +8,15 @@
.container .uiContainerManager{
display : none !important;
+}
+.toast{
+ border: 1px solid #c9c9c9;
+ border-radius: 10px;
+ width: 50%;
+ margin: 0 auto;
+ font-size: 18px;
+ font-weight: bold;
+ padding: 10px 20px;
+ background: #feb75d;
+ display: flex;
}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSelectSubstitute/lexSelectSubstitute.html b/force-app/main/default/lwc/lexSelectSubstitute/lexSelectSubstitute.html
index 960b41d..7063605 100644
--- a/force-app/main/default/lwc/lexSelectSubstitute/lexSelectSubstitute.html
+++ b/force-app/main/default/lwc/lexSelectSubstitute/lexSelectSubstitute.html
@@ -1,5 +1,13 @@
<template>
- <div class="Holder" if:true={IsLoading}>
- <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
- </div>
+ <div class="holder" if:true={IsLoading}>
+ <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+ </div>
+ <div if:false={IsLoading} class="toast">
+ <span style="padding: 10px;">{msg}</span>
+ <button class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse" onclick={closeAction} title="Close" style="background-color: #e5e4e2;margin-top: 15px;">
+ <lightning-icon class="greyIcon" icon-name="utility:close" alternative-text="Connected" variant="inverse" size="small"
+ title="Close" style="color: black;"></lightning-icon>
+ <span class="slds-assistive-text">Close</span>
+ </button>
+ </div>
</template>
\ No newline at end of file
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
diff --git a/force-app/main/default/lwc/lexSelectSubstitute/lexSelectSubstitute.js-meta.xml b/force-app/main/default/lwc/lexSelectSubstitute/lexSelectSubstitute.js-meta.xml
index c94e4e2..b87fe03 100644
--- a/force-app/main/default/lwc/lexSelectSubstitute/lexSelectSubstitute.js-meta.xml
+++ b/force-app/main/default/lwc/lexSelectSubstitute/lexSelectSubstitute.js-meta.xml
@@ -1,11 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
-<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="selectSubstituteLWC">
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexRentalFixtureSetAssign">
<apiVersion>51.0</apiVersion>
<isExposed>true</isExposed>
- <targets>
- <target>lightning__AppPage</target>
- <target>lightning__RecordPage</target>
- <target>lightning__HomePage</target>
- <target>lightning__RecordAction</target>
- </targets>
+ <targets>
+
+ <target>lightning__AppPage</target>
+
+ <target>lightning__RecordPage</target>
+
+ <target>lightning__HomePage</target>
+
+ <target>lightning__RecordAction</target>
+
+ <!-- 灞忓箷娴侀厤缃� -->
+
+ <target>lightning__FlowScreen</target>
+
+ </targets>
+
+ <!-- 瀹氫箟鍙橀噺 -->
+
+ <targetConfigs>
+
+ <targetConfig targets="lightning__FlowScreen">
+
+ <!-- name js涓娇鐢ㄧ殑鍙橀噺锛屼粠灞忓箷娴佷腑鑾峰彇鍙傛暟 label 鍦ㄥ睆骞曟祦鐨勮LWC鐨勮缃腑鏄剧ず -->
+
+ <property name="recordId" type="String" label="recordId"/>
+
+ <property name="rentalApplyEquipmentSetIds" type="String[]" label="rentalApplyEquipmentSetIds"/>
+
+ </targetConfig>
+
+ </targetConfigs>
</LightningComponentBundle>
\ No newline at end of file
--
Gitblit v1.9.1