From ca743be68ec263a6d9d6c70410f894ed2bb1d293 Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@prec-tech.com>
Date: 星期一, 31 七月 2023 15:29:03 +0800
Subject: [PATCH] 耗材申请按钮
---
force-app/main/default/lwc/lexConsumApply_FromCampaign/lexConsumApply_FromCampaign.js-meta.xml | 11 +
force-app/main/default/lwc/lexConsumApply_FromQIS/lexConsumApply_FromQIS.js | 45 +++---
force-app/main/default/lwc/lexEquipmentSetRental_Order/lexEquipmentSetRental_Order.js | 72 ++++++---
force-app/main/default/lwc/lexConsumApply_FromOPDPlan/lexConsumApply_FromOPDPlan.js | 24 +-
force-app/main/default/lwc/lexConsumApply_FromCampaign/lexConsumApply_FromCampaign.html | 5
force-app/main/default/lwc/lexConsumApply_FromAccount/lexConsumApply_FromAccount.js | 13 +
force-app/main/default/lwc/lexConsumApply_FromRA/lexConsumApply_FromRA.js-meta.xml | 11 +
force-app/main/default/lwc/lexConsumApply_FromRA/lexConsumApply_FromRA.js | 113 ++++++++++++++++
force-app/main/default/lwc/lexConsumApply_FromCampaign/lexConsumApply_FromCampaign.js | 109 +++++++++++++++
force-app/main/default/lwc/lexConsumApply_FromRA/lexConsumApply_FromRA.html | 5
10 files changed, 343 insertions(+), 65 deletions(-)
diff --git a/force-app/main/default/lwc/lexConsumApply_FromAccount/lexConsumApply_FromAccount.js b/force-app/main/default/lwc/lexConsumApply_FromAccount/lexConsumApply_FromAccount.js
index 161d51d..7ad8c63 100644
--- a/force-app/main/default/lwc/lexConsumApply_FromAccount/lexConsumApply_FromAccount.js
+++ b/force-app/main/default/lwc/lexConsumApply_FromAccount/lexConsumApply_FromAccount.js
@@ -7,7 +7,7 @@
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import { encodeDefaultFieldValues } from 'lightning/pageReferenceUtils';
-export default class LexConsumApply_FromAccount extends LightningElement {
+export default class LexConsumApply_FromAccount extends NavigationMixin(LightningElement) {
@api recordId;
IsLoading = true;
@@ -34,8 +34,8 @@
recordId: this.recordId
}).then(result=>{
UserInfo_Owner({}).then(res=>{
- if(res.isFormalStuff == 'true'){
- this.showToast('璇曠敤鏈熷唴锛屼笉鑳界敵璇�','warning');
+ if(res.isFormalStuff){
+ this.showToast('璇曠敤鏈熷唴锛屼笉鑳界敵璇�','error');
return;
}else{
@@ -55,8 +55,8 @@
Account__c:result.name,
Name:'*',
demo_purpose2__c:'OPD璇曠敤',
- Person_In_Charge__c:res.lastName + res.firstName,
- applyUser__c:res.lastName + res.firstName
+ Person_In_Charge__c:res.id,
+ applyUser__c:res.id
});
this[NavigationMixin.Navigate]({
@@ -66,7 +66,7 @@
actionName: 'new'
},
state:{
- defaultFieldValues: this.defaultValues
+ defaultFieldValues: defaultValues
}
})
}
@@ -92,6 +92,7 @@
variant: type
});
this.dispatchEvent(evt);
+ this.dispatchEvent(new CloseActionScreenEvent());
}
}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexConsumApply_FromCampaign/lexConsumApply_FromCampaign.html b/force-app/main/default/lwc/lexConsumApply_FromCampaign/lexConsumApply_FromCampaign.html
new file mode 100644
index 0000000..b53dd72
--- /dev/null
+++ b/force-app/main/default/lwc/lexConsumApply_FromCampaign/lexConsumApply_FromCampaign.html
@@ -0,0 +1,5 @@
+<template>
+ <div class="dispatchOCSMQARAHolder" if:true={IsLoading}>
+ <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+ </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexConsumApply_FromCampaign/lexConsumApply_FromCampaign.js b/force-app/main/default/lwc/lexConsumApply_FromCampaign/lexConsumApply_FromCampaign.js
new file mode 100644
index 0000000..be53705
--- /dev/null
+++ b/force-app/main/default/lwc/lexConsumApply_FromCampaign/lexConsumApply_FromCampaign.js
@@ -0,0 +1,109 @@
+import { LightningElement,wire,track,api} from 'lwc';
+import { CurrentPageReference, NavigationMixin} from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import init from '@salesforce/apex/LexConsumApply_FromCampaignCtl.init';
+import rentalApp from '@salesforce/apex/LexConsumApply_FromCampaignCtl.rentalApp';
+import UserInfo_Owner from '@salesforce/apex/LexConsumApply_FromCampaignCtl.UserInfo_Owner';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import { encodeDefaultFieldValues } from 'lightning/pageReferenceUtils';
+
+export default class LexConsumApply_FromCampaign extends NavigationMixin(LightningElement) {
+ @api recordId;
+ IsLoading = true;
+
+ @wire(CurrentPageReference)
+ getStateParameters(currentPageReference) {
+ console.log(111);
+ console.log(currentPageReference);
+
+ if (currentPageReference) {
+ const urlValue = currentPageReference.state.recordId;
+ if (urlValue) {
+ let str = `${urlValue}`;
+ console.log("str");
+ console.log(str);
+ this.recordId = str;
+ }
+ }
+ }
+
+ connectedCallback(){
+ console.log(this.recordId);
+ UserInfo_Owner({}).then(res=>{
+ if(res){
+ init({
+ recordId: this.recordId
+ }).then(result => {
+ this.IsLoading = false;
+ var ups = res.userprovince.slice(0,2);
+ if(res.isFormalStuff){
+ this.showToast('璇曠敤鏈熷唴锛屼笉鑳界敵璇�','error');
+ }else if(result.recordTypeId != result.servicetrainig && res.jobCategory == '閿�鍞湇鍔�'){
+
+ this.showToast('FSE涓嶈兘鐢宠璇ュ浼氱被鍨嬪鍝�','error');
+ }else if((res.jobCategory == '閿�鍞湇鍔�' || res.jobCategory == '鏀彺') && result.recordTypeId != result.servicetrainig && res.chargeProvince.indexOf((ups) == -1)){
+ this.showToast('涓嶧SE鎵�鍦ㄧ渷涓�鑷达紝鎵嶅彲浣跨敤澶囧搧','error');
+ }else if(result.status == '宸茬粨鏉�'){
+ this.showToast('宸茬粨鏉燂紝涓嶈兘鐢宠','error');
+ }else if(result.status == '宸叉彁浜ゆ姤鍛�'){
+ this.showToast('宸叉彁浜ゆ姤鍛婏紝涓嶈兘鐢宠','error');
+ }else if(result.status == '鍙栨秷鐢宠涓�'){
+ this.showToast('鍙栨秷鐢宠涓紝涓嶈兘鐢宠','error');
+ }else if(result.status == '鍙栨秷'){
+ this.showToast('璇曠敤鏈熷唴锛屼笉鑳界敵璇�','error');
+ }else{
+ rentalApp({})
+ .then(results=>{
+ var fieldmap = new Map();
+ for (var i=0; i< results.length; i++) {
+ var record = results[i];
+ fieldmap.set(record.QualifiedApiName,record.DurableId.toString().split('.')[1]);
+ }
+ // var url = "{!$Site.Prefix}/" + prefix + "/e?retURL=%2F{!URLENCODE(Campaign.Id)}"
+ // + "&CF" + fieldmap.get('Campaign__c') + "={!URLENCODE(Campaign.Name)}"
+ // + "&CF" + fieldmap.get('Campaign__c') + "_lkid={!URLENCODE(Campaign.Id)}"
+ // + "&Name={!URLENCODE('*')}"
+ // + "&" + fieldmap.get('demo_purpose2__c') + "={!URLENCODE('瀛︿細灞曚細')}"
+ // + "&Name={!URLENCODE('*')}"
+ // + "&CF" + fieldmap.get('Person_In_Charge__c') + "={!URLENCODE($User.LastName&' '&$User.FirstName)}"
+ // + "&CF" + fieldmap.get('Person_In_Charge__c') + "_lkid={!URLENCODE($User.Id)}"
+ // + "&CF" + fieldmap.get('applyUser__c') + "={!URLENCODE($User.LastName&' '&$User.FirstName)}"
+ // + "&CF" + fieldmap.get('applyUser__c') + "_lkid={!URLENCODE($User.Id)}"
+ // + "";
+ const defaultValues = encodeDefaultFieldValues({
+ Campaign__c: result.campaignId,
+ Name:'*',
+ demo_purpose2__c:'瀛︿細灞曚細',
+ Person_In_Charge__c:res.id,
+ applyUser__c:res.id
+ });
+
+ this[NavigationMixin.Navigate]({
+ type: 'standard__objectPage',
+ attributes: {
+ objectApiName: 'Consum_Apply__c',
+ actionName: 'new'
+ },
+ state:{
+ defaultFieldValues: defaultValues
+ }
+ })
+ })
+
+ }
+
+ })
+ }
+ })
+ }
+
+ showToast(message, type) {
+ const evt = new ShowToastEvent({
+ title: 'Error',
+ message: message,
+ variant: type
+ });
+ this.dispatchEvent(evt);
+ this.dispatchEvent(new CloseActionScreenEvent());
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexConsumApply_FromCampaign/lexConsumApply_FromCampaign.js-meta.xml b/force-app/main/default/lwc/lexConsumApply_FromCampaign/lexConsumApply_FromCampaign.js-meta.xml
new file mode 100644
index 0000000..a52f089
--- /dev/null
+++ b/force-app/main/default/lwc/lexConsumApply_FromCampaign/lexConsumApply_FromCampaign.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexConsumApply_FromCampaign">
+ <apiVersion>56.0</apiVersion>
+ <isExposed>true</isExposed>
+ <targets>
+ <target>lightning__AppPage</target>
+ <target>lightning__RecordPage</target>
+ <target>lightning__HomePage</target>
+ <target>lightning__RecordAction</target>
+ </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexConsumApply_FromOPDPlan/lexConsumApply_FromOPDPlan.js b/force-app/main/default/lwc/lexConsumApply_FromOPDPlan/lexConsumApply_FromOPDPlan.js
index 7e07b03..8966bf5 100644
--- a/force-app/main/default/lwc/lexConsumApply_FromOPDPlan/lexConsumApply_FromOPDPlan.js
+++ b/force-app/main/default/lwc/lexConsumApply_FromOPDPlan/lexConsumApply_FromOPDPlan.js
@@ -7,7 +7,8 @@
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import { encodeDefaultFieldValues } from 'lightning/pageReferenceUtils';
-export default class LexConsumApply_FromOPDPlan extends LightningElement {
+// 鏂板缓鑰楁潗鐢宠(OPD璁″垝)
+export default class LexConsumApply_FromOPDPlan extends NavigationMixin(LightningElement) {
@api recordId;
IsLoading = true;
@@ -33,8 +34,9 @@
recordId: this.recordId
}).then(result=>{
UserInfo_Owner({}).then(res=>{
- if(res.isFormalStuff == 'true'){
- this.showToast('璇曠敤鏈熷唴锛屼笉鑳界敵璇�','warning');
+ console.log("-----UserInfo_Owner--",res)
+ if(res.isFormalStuff){
+ this.showToast('璇曠敤鏈熷唴锛屼笉鑳界敵璇�','error');
return;
}else{
@@ -57,10 +59,10 @@
Account__c:result.accountLab,
Name:'*',
demo_purpose2__c:'OPD璇曠敤',
- Person_In_Charge__c:res.lastName + res.firstName,
- applyUser__c:res.lastName + res.firstName
+ Person_In_Charge__c:res.id,
+ applyUser__c:res.id
});
-
+ console.log("defaultValues====> ",defaultValues);
this[NavigationMixin.Navigate]({
type: 'standard__objectPage',
attributes: {
@@ -68,19 +70,18 @@
actionName: 'new'
},
state:{
- defaultFieldValues: this.defaultValues
+ defaultFieldValues: defaultValues
}
- })
+ });
}
})
.catch(error => {
- console.log("error");
- console.log(error);
+ console.log("error ---> ",error);
})
})
.catch(error => {
- console.log("error");
+ console.log("error----");
console.log(error);
}).finally(() => {
this.dispatchEvent(new CloseActionScreenEvent());
@@ -94,6 +95,7 @@
variant: type
});
this.dispatchEvent(evt);
+ this.dispatchEvent(new CloseActionScreenEvent());
}
}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexConsumApply_FromQIS/lexConsumApply_FromQIS.js b/force-app/main/default/lwc/lexConsumApply_FromQIS/lexConsumApply_FromQIS.js
index 237f4b1..f68583e 100644
--- a/force-app/main/default/lwc/lexConsumApply_FromQIS/lexConsumApply_FromQIS.js
+++ b/force-app/main/default/lwc/lexConsumApply_FromQIS/lexConsumApply_FromQIS.js
@@ -8,7 +8,8 @@
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import { encodeDefaultFieldValues } from 'lightning/pageReferenceUtils';
-export default class LexConsumApply_FromQIS extends LightningElement {
+// 鏂板缓鑰楁潗澶囧搧鐢宠(QIS)
+export default class LexConsumApply_FromQIS extends NavigationMixin(LightningElement) {
@api recordId;
IsLoading = true;
@@ -34,7 +35,7 @@
rentalApp({
recordId: this.recordId
}).then(result => {
- console.log('rentalApp============' + result);
+ console.log('rentalApp============',result);
if(result.lenth > 0){
const evt = new ShowToastEvent({
title : 'Error',
@@ -47,22 +48,23 @@
init({
recordId: this.recordId
}).then(result => {
+ console.log('init============',result);
this.IsLoading = false;
if (result != null) {
if(result.nextAction=='閫佸洖'){
- this.showToast('QIS瀵瑰簲鏂规硶涓衡�滈�佸洖鈥濓紝涓嶈兘鐢宠','warning');
+ this.showToast('QIS瀵瑰簲鏂规硶涓衡�滈�佸洖鈥濓紝涓嶈兘鐢宠','error');
return;
}
if(result.qISStatus=='鑽夋涓�'){
- this.showToast('QIS鐘舵�佷负鑽夋涓紝涓嶈兘鐢宠','warning');
+ this.showToast('QIS鐘舵�佷负鑽夋涓紝涓嶈兘鐢宠','error');
return;
}
if(result.qISStatus=='FSE濉啓瀹屾瘯'){
- this.showToast('QIS鐘舵�佷负FSE濉啓瀹屾瘯锛屼笉鑳界敵璇�','warning');
+ this.showToast('QIS鐘舵�佷负FSE濉啓瀹屾瘯锛屼笉鑳界敵璇�','error');
return;
}
if(result.qISStatus=='鍙栨秷'){
- this.showToast('QIS鐘舵�佷负鍙栨秷锛屼笉鑳界敵璇�','warning');
+ this.showToast('QIS鐘舵�佷负鍙栨秷锛屼笉鑳界敵璇�','error');
return;
}
// if('{!$User.isFormal_Stuff__c}'=='true'){
@@ -72,8 +74,8 @@
// window.top.location.href=url;
// }
UserInfo_Owner({}).then(res=>{
- if(res.isFormalStuff == 'true'){
- this.showToast('璇曠敤鏈熷唴锛屼笉鑳界敵璇�','warning');
+ if(res.isFormalStuff){
+ this.showToast('璇曠敤鏈熷唴锛屼笉鑳界敵璇�','error');
return;
}else{
// var query = "Select QualifiedApiName, EntityDefinition.KeyPrefix, DurableId From FieldDefinition WHERE EntityDefinition.QualifiedApiName = 'Consum_Apply__c'";
@@ -97,17 +99,17 @@
.catch(e=>{console.log(e)})
const defaultValues = encodeDefaultFieldValues({
- QIS_Report__c: this.recordId,
- Hospital: result.hospital,
- Strategic_dept: result.departmentClass,
- Account:result.hospitalDepartment,
- demo_purpose2:'绱㈣禂QIS',
+ Hospital__c: result.hospital,
+ Strategic_dept__c: result.departmentClass,
+ Account__c:result.hospitalDepartment,
+ demo_purpose2__c:'绱㈣禂QIS',
Name:'*',
- Person_In_Charge:res.lastName + res.firstName,
- applyUser:res.lastName + res.firstName,
- QIS_number:result.name
+ Person_In_Charge__c:res.id,
+ applyUser__c:res.id,
+ QIS_number__c:result.qisReportId
});
-
+ console.log('init============',result);
+ console.log('init============',defaultValues);
this[NavigationMixin.Navigate]({
type: 'standard__objectPage',
attributes: {
@@ -115,9 +117,9 @@
actionName: 'new'
},
state:{
- defaultFieldValues: this.defaultValues
+ defaultFieldValues: defaultValues
}
- })
+ });
}
})
this.dispatchEvent(new CloseActionScreenEvent());
@@ -126,14 +128,10 @@
}).catch(error => {
console.log("error");
console.log(error);
- }).finally(() => {
-
});
}).catch(error => {
console.log("error");
console.log(error);
- }).finally(() => {
-
});
}
@@ -144,6 +142,7 @@
variant: type
});
this.dispatchEvent(evt);
+ this.dispatchEvent(new CloseActionScreenEvent());
}
}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexConsumApply_FromRA/lexConsumApply_FromRA.html b/force-app/main/default/lwc/lexConsumApply_FromRA/lexConsumApply_FromRA.html
new file mode 100644
index 0000000..ae58c6c
--- /dev/null
+++ b/force-app/main/default/lwc/lexConsumApply_FromRA/lexConsumApply_FromRA.html
@@ -0,0 +1,5 @@
+<template>
+ <div class="dispatchOCSMQARAHolder" if:true={IsLoading}>
+ <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+ </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexConsumApply_FromRA/lexConsumApply_FromRA.js b/force-app/main/default/lwc/lexConsumApply_FromRA/lexConsumApply_FromRA.js
new file mode 100644
index 0000000..0d757fb
--- /dev/null
+++ b/force-app/main/default/lwc/lexConsumApply_FromRA/lexConsumApply_FromRA.js
@@ -0,0 +1,113 @@
+import { LightningElement,wire,track,api} from 'lwc';
+import { CurrentPageReference, NavigationMixin} from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import init from '@salesforce/apex/lexConsumApply_FromRACtl.init';
+import fieldDefineApp from '@salesforce/apex/lexConsumApply_FromRACtl.fieldDefineApp';
+import UserInfo_Owner from '@salesforce/apex/lexConsumApply_FromRACtl.UserInfo_Owner';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import { encodeDefaultFieldValues } from 'lightning/pageReferenceUtils';
+
+// 鏂板缓鑰楁潗鐢宠
+export default class LexConsumApply_FromRA extends NavigationMixin(LightningElement) {
+
+@api recordId;
+ IsLoading = true;
+
+ @wire(CurrentPageReference)
+ getStateParameters(currentPageReference) {
+ console.log(111);
+ console.log(currentPageReference);
+
+ if (currentPageReference) {
+ const urlValue = currentPageReference.state.recordId;
+ if (urlValue) {
+ let str = `${urlValue}`;
+ console.log("str");
+ console.log(str);
+ this.recordId = str;
+ }
+ }
+ }
+
+ connectedCallback(){
+ console.log(this.recordId);
+ UserInfo_Owner({}).then(res=>{
+ this.IsLoading = false;
+ if(res.isFormalStuff){
+ this.showToast('璇曠敤鏈熷唴锛屼笉鑳界敵璇�','error');
+ return;
+ }else{
+ fieldDefineApp({}).then(resp=>{
+ var fieldmap = new Map();
+ for (var i=0; i< resp.length; i++) {
+ var record = resp[i];
+ fieldmap.set(record.QualifiedApiName,record.DurableId.toString().split('.')[1]);
+ }
+
+ })
+ .catch(e=>{console.log(e)})
+
+ init({
+ recordId: this.recordId
+ }).then(result=>{
+ console.log('result.rentalHospital'+result.rentalHospital);
+ if(result){
+ const defaultValues = encodeDefaultFieldValues({
+ Rental_Apply__c: result.rentalApplyId,
+ demo_purpose2__c:result.demoPurpose2,
+ Campaign__c: result.rentalCampaign,
+ QIS_number__c:result.rentalQISNumber,
+ QISRepair__c:result.rentalQISRepair,
+ OPD__c:result.rentalOPD,
+ OPDPlan__c:result.rentalOPDPlan,
+ Hospital__c:result.rentalHospital,
+ Strategic_dept__c:result.rentalStrategicDept,
+ Account__c:result.rentalAccount,
+ ApplyPerson_Phone__c:result.rentalApplyPersonPhone,
+ Phone_number__c:result.rentalPhoneNumber,
+ Request_shipping_day__c:result.rentalRequestShippingDay,
+ Loaner_medical_Staff__c:result.rentalLoanerMedicalStaff,
+ Shipment_address__c:result.rentalShipmentAddress,
+ Dealer__c:result.rentalDealer,
+ direct_send__c:result.rentalDirectSend,
+ pickup_time__c:result.rentalPickupTime,
+ Loaner_received_staff__c:result.rentalLoanerReceivedStaff,
+ Loaner_received_staff_phone__c:result.rentalLoanerReceivedStaffPhone,
+ Post_Code__c:result.rentalPostCode,
+ direct_shippment_address__c:result.rentalDirectShippmentAddress,
+ Name:'*',
+ Person_In_Charge__c:res.id,
+ applyUser__c:res.id
+ });
+ console.log('init============',result);
+ console.log('init============',defaultValues);
+ this[NavigationMixin.Navigate]({
+ type: 'standard__objectPage',
+ attributes: {
+ objectApiName: 'Consum_Apply__c',
+ actionName: 'new'
+ },
+ state:{
+ defaultFieldValues: defaultValues
+ }
+ });
+ }
+
+ }).catch(e=>{console.log(e)})
+ }
+ this.dispatchEvent(new CloseActionScreenEvent());
+ })
+ .catch(err=>{console.log(err)})
+ }
+
+ showToast(message, type) {
+ const evt = new ShowToastEvent({
+ title: '',
+ message: message,
+ variant: type
+ });
+ this.dispatchEvent(evt);
+ this.dispatchEvent(new CloseActionScreenEvent());
+ }
+
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexConsumApply_FromRA/lexConsumApply_FromRA.js-meta.xml b/force-app/main/default/lwc/lexConsumApply_FromRA/lexConsumApply_FromRA.js-meta.xml
new file mode 100644
index 0000000..b36ef00
--- /dev/null
+++ b/force-app/main/default/lwc/lexConsumApply_FromRA/lexConsumApply_FromRA.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <isExposed>true</isExposed>
+ <targets>
+ <target>lightning__AppPage</target>
+ <target>lightning__RecordPage</target>
+ <target>lightning__HomePage</target>
+ <target>lightning__RecordAction</target>
+ </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexEquipmentSetRental_Order/lexEquipmentSetRental_Order.js b/force-app/main/default/lwc/lexEquipmentSetRental_Order/lexEquipmentSetRental_Order.js
index ff768cb..ec9d65b 100644
--- a/force-app/main/default/lwc/lexEquipmentSetRental_Order/lexEquipmentSetRental_Order.js
+++ b/force-app/main/default/lwc/lexEquipmentSetRental_Order/lexEquipmentSetRental_Order.js
@@ -3,6 +3,19 @@
import AssignBtn from '@salesforce/apex/RentalApplyWebService.AssignBtn';
import {CurrentPageReference} from 'lightning/navigation';
import { CloseActionScreenEvent } from 'lightning/actions';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+
+const event1 = new ShowToastEvent({
+ title: '璇锋鏌ョ敵璇风姸鎬�',
+ message:
+ '涓嶈兘寮曞綋锛岃纭鐢宠鐨勭姸鎬�',
+ });
+const event2 = new ShowToastEvent({
+ title: 'Get Help',
+ message:
+ '鏂规硶閿欒锛岃鑱旂郴绠$悊鍛�',
+ });
+
export default class lexEquipmentSetRental_Order extends LightningElement {
@api recordId;
@@ -10,35 +23,35 @@
Rental_Apply__c;
- @wire(CurrentPageReference)
- getStateParameters(currentPageReference){
- if(currentPageReference){
- console.log(currentPageReference);
- console.log("杩涘叆鑾峰彇page鍙傛暟")
- const IdValue=currentPageReference.state.recordId;
- if(IdValue){
- let str=`${IdValue}`;
- this.recordId=str;
- console.log("recordId="+str);
- }
- }
- }
+ // @wire(CurrentPageReference)
+ // getStateParameters(currentPageReference){
+ // if(currentPageReference){
+ // console.log(currentPageReference);
+ // console.log("杩涘叆鑾峰彇page鍙傛暟")
+ // const IdValue=currentPageReference.state.recordId;
+ // if(IdValue){
+ // let str=`${IdValue}`;
+ // this.recordId=str;
+ // console.log("recordId="+str);
+ // }
+ // }
+ // }
connectedCallback(){
init({recordId:this.recordId}).then(res=>{
if(res!=null){
- this.IsLoading=false;
- console.log("res");
- console.log(res);
- console.log("杩涘叆鍒濆鍖栧璞″叾浠栧睘鎬�");
- this.Rental_Apply__c=res;
- console.log(this.Rental_Apply__c);
- this.distribution();
+ this.IsLoading=false;
+ console.log("res");
+ console.log(res);
+ console.log("杩涘叆鍒濆鍖栧璞″叾浠栧睘鎬�");
+ this.Rental_Apply__c=res;
+ console.log(this.Rental_Apply__c);
+ this.distribution();
}
else{
- var a="娌¤繘distribution";
- console.log(a);
+ var a="娌¤繘distribution";
+ console.log(a);
}
}).catch(error =>{
console.log("error");
@@ -60,7 +73,8 @@
this.Rental_Apply__c.demo_purpose2__c == '鍩硅涓績'
)
&& this.Rental_Apply__c.Status__c == '鑽夋涓�') {
- alert("涓嶈兘寮曞綋锛岃纭鐢宠鐨勭姸鎬�");
+ this.dispatchEvent(event1);
+ this.dispatchEvent(new CloseActionScreenEvent());
} else if(
(this.Rental_Apply__c.demo_purpose2__c == '璇曠敤锛堟棤璇环锛�' ||
this.Rental_Apply__c.demo_purpose2__c == '璇曠敤锛堟湁璇环锛�' ||
@@ -72,12 +86,20 @@
&& this.Rental_Apply__c.Status__c != '鎵瑰噯瀹屼簡'
&& this.Rental_Apply__c.Status__c != '寮曞綋瀹屼簡'
&& this.Rental_Apply__c.Status__c != '鍑哄簱鎸囩ず瀹屼簡') {
- alert("涓嶈兘寮曞綋锛岃纭鐢宠鐨勭姸鎬�");
+ this.dispatchEvent(event1);
+ this.dispatchEvent(new CloseActionScreenEvent());
} else if(rtn == 'Fin') {
window.open("/apex/EquipmentRentalApply?raid="+URLENCODE(this.Rental_Apply__c.Id));
+ this.closeAction();
} else{
- alert(rtn);
+ this.dispatchEvent(event2);
+ this.dispatchEvent(new CloseActionScreenEvent());
}
}
+
+ closeAction() {
+ //杩斿洖褰撳墠鐨勫鍝佺敵璇�
+ window.open("/"+this.recordId,'_self');
+ }
}
\ No newline at end of file
--
Gitblit v1.9.1