From f7484973dc7c94fd41f23ef83d511f082cb0131e Mon Sep 17 00:00:00 2001
From: chenjingwu <chenjingwu@prec-tech.com>
Date: 星期五, 24 五月 2024 16:37:19 +0800
Subject: [PATCH] 1
---
force-app/main/default/lwc/lexRequestDB/lexRequestDB.js | 95 +++++++++++++++++++++++++++++++++--------------
1 files changed, 66 insertions(+), 29 deletions(-)
diff --git a/force-app/main/default/lwc/lexRequestDB/lexRequestDB.js b/force-app/main/default/lwc/lexRequestDB/lexRequestDB.js
index a70cb25..605b790 100644
--- a/force-app/main/default/lwc/lexRequestDB/lexRequestDB.js
+++ b/force-app/main/default/lwc/lexRequestDB/lexRequestDB.js
@@ -4,8 +4,11 @@
import init from '@salesforce/apex/OpportunityLightingButtonController.initForRequestDBButton';
import { updateRecord } from 'lightning/uiRecordApi';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
-
-export default class LexRequestDB extends LightningElement {
+import { NavigationMixin } from 'lightning/navigation';
+import { encodeDefaultFieldValues } from 'lightning/pageReferenceUtils';
+import lwcCSS from '@salesforce/resourceUrl/lwcCSS';
+import {loadStyle} from 'lightning/platformResourceLoader';
+export default class LexRequestDB extends NavigationMixin(LightningElement) {
@api recordId;
stageName;
sapSendOK;
@@ -21,6 +24,7 @@
systemProfileId;
s1ProfileId;
s4ProfileId;
+ recordTypeId;
@wire(CurrentPageReference)
getStateParameters(currentPageReference) {
console.log(111);
@@ -37,6 +41,9 @@
}
}
connectedCallback(){
+ Promise.all([
+ loadStyle(this, lwcCSS)
+ ]);
init({
recordId: this.recordId
}).then(result=>{
@@ -55,6 +62,7 @@
this.systemProfileId = result.systemProfileId == undefined ? '' : result.systemProfileId;
this.s1ProfileId = result.s1ProfileId == undefined ? '' : result.s1ProfileId;
this.s4ProfileId = result.s4ProfileId == undefined ? '' : result.s4ProfileId;
+ this.recordTypeId = result.recordTypeId == undefined ? '' : result.recordTypeId;
this.requestDB();
})
}
@@ -77,36 +85,65 @@
this.showToast("璇环宸茬粡鏈夊彇娑堬紡澶卞崟鎶ュ憡浜嗭紒","error");
}
else {
- location.href = '/a2C/e?retURL=%2F' +
- encodeURI(this.recordId) +
- '&RecordType=01210000000RNXi' +
- '&CF00N10000006QdJz=' +
- encodeURI(this.agency1) +
- '&CF00N10000006QdJz_lkid=' +
- encodeURI(this.agency1Id) +
- '&CF00N10000006QdKn=' +
- encodeURI(this.name) +
- '&CF00N10000006QdKn_lkid=' +
- encodeURI(this.recordId) +
- '&00N10000006QdK4=' +
- encodeURI(this.name) +
- '&00N10000006QdYB=' +
- encodeURI(this.bidPlannedDate) +
- '&CF00N10000006QdZT=' +
- encodeURI(this.salesAssistantName) +
- '&CF00N10000006QdZT_lkid=' +
- encodeURI(this.salesAssistantID) +
- '';
- };
+ // location.href = '/a2C/e?retURL=%2F' +
+ // encodeURI(this.recordId) +
+ // '&RecordType=01210000000RNXi' +
+ // '&CF00N10000006QdJz=' +
+ // encodeURI(this.agency1) +
+ // '&CF00N10000006QdJz_lkid=' +
+ // encodeURI(this.agency1Id) +
+ // '&CF00N10000006QdKn=' +
+ // encodeURI(this.name) +
+ // '&CF00N10000006QdKn_lkid=' +
+ // encodeURI(this.recordId) +
+ // '&00N10000006QdK4=' +
+ // encodeURI(this.name) +
+ // '&00N10000006QdYB=' +
+ // encodeURI(this.bidPlannedDate) +
+ // '&CF00N10000006QdZT=' +
+ // encodeURI(this.salesAssistantName) +
+ // '&CF00N10000006QdZT_lkid=' +
+ // encodeURI(this.salesAssistantID) +
+ // '';
+ const defaultValues = encodeDefaultFieldValues({
+ Bid_distributor__c: this.agency1Id,
+ Prospect_name__c: this.recordId,
+ Product_discription__c: this.name,
+ Tedner_date__c: this.bidPlannedDate,
+ Request_target__c: this.salesAssistantID
+ });
+ this[NavigationMixin.Navigate]({
+ type: 'standard__objectPage',
+ attributes: {
+ objectApiName: 'Request_tedner_doc__c',
+ actionName: 'new'
+ },
+ state: {
+ nooverride: '1',
+ defaultFieldValues: defaultValues,
+ RecordTypeId: this.recordTypeId,
+ }
+ });
+ }
this.dispatchEvent(new CloseActionScreenEvent());
}
showToast(msg,type) {
- const event = new ShowToastEvent({
- title: '',
- message: msg,
- variant: type
- });
- this.dispatchEvent(event);
+ if(type == 'success'){
+ const event = new ShowToastEvent({
+ message: msg,
+ variant: type,
+ });
+ this.dispatchEvent(event);
+ this.dispatchEvent(new CloseActionScreenEvent());
+ }else{
+ const event = new ShowToastEvent({
+ message: msg,
+ variant: type,
+ mode: 'sticky'
+ });
+ this.dispatchEvent(event);
+ this.dispatchEvent(new CloseActionScreenEvent());
+ }
}
updateRecordView(recordId) {
updateRecord({fields: { Id: recordId }});
--
Gitblit v1.9.1