From 35910c355f74e736e2068a0ffb7f39ae9615d8e1 Mon Sep 17 00:00:00 2001
From: chenjingwu <chenjingwu@prec-tech.com>
Date: 星期五, 24 五月 2024 16:29:00 +0800
Subject: [PATCH] 1
---
force-app/main/default/lwc/lexCancelReport/lexCancelReport.js | 81 +++++++++++++++++++++++++++++-----------
1 files changed, 59 insertions(+), 22 deletions(-)
diff --git a/force-app/main/default/lwc/lexCancelReport/lexCancelReport.js b/force-app/main/default/lwc/lexCancelReport/lexCancelReport.js
index d75559e..7adca35 100644
--- a/force-app/main/default/lwc/lexCancelReport/lexCancelReport.js
+++ b/force-app/main/default/lwc/lexCancelReport/lexCancelReport.js
@@ -5,8 +5,12 @@
import queryForCancelReportButton from '@salesforce/apex/OpportunityLightingButtonController.queryForCancelReportButton';
import { updateRecord } from 'lightning/uiRecordApi';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
-import ConSent from '@salesforce/apex/BidAnnouncementController.ConSent';
-export default class LexCancelReport extends LightningElement {
+import { NavigationMixin } from 'lightning/navigation';
+import { encodeDefaultFieldValues } from 'lightning/pageReferenceUtils';
+import lwcCSS from '@salesforce/resourceUrl/lwcCSS';
+import {loadStyle} from 'lightning/platformResourceLoader';
+import queryCancelReport from '@salesforce/apex/OpportunityLightingButtonController.queryCancelReport';
+export default class LexCancelReport extends NavigationMixin(LightningElement) {
@api recordId;
stageName;
sapSendOK;
@@ -21,6 +25,8 @@
salesManagerDepartmentID;
salesOwnerBuchang;
salesOwnerBuchangID;
+ recordTypeId;
+ haveLostReport;
IsLoading = true;
@wire(CurrentPageReference)
getStateParameters(currentPageReference) {
@@ -38,6 +44,10 @@
}
}
connectedCallback(){
+ Promise.all([
+ loadStyle(this, lwcCSS)
+ ]);
+
init({
recordId: this.recordId
}).then(result=>{
@@ -55,16 +65,36 @@
this.salesManagerDepartmentID = result.salesManagerDepartmentID == undefined ? '' : result.salesManagerDepartmentID;
this.salesOwnerBuchang = result.salesOwnerBuchang == undefined ? '' : result.salesOwnerBuchang;
this.salesOwnerBuchangID = result.salesOwnerBuchangID == undefined ? '' : result.salesOwnerBuchangID;
- this.cancelReport();
- })
+ this.recordTypeId = result.recordTypeId;
+ queryCancelReport({
+ recordId: this.recordId
+ }).then(result=>{
+ this.haveLostReport = result;
+ this.cancelReport();
+ });
+
+ }).catch(error=>{
+ console.log("error");
+ console.log(error);
+ });
}
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 }});
@@ -87,7 +117,7 @@
else if (this.sapSendOK == '1') {
this.showToast("宸茬粡涓婁紶SAP銆佷笉鑳藉仛 鍙栨秷 浜嗭紒","error");
}
- else if (this.cntLostCancelReport - this.cntLostCancelDraft > 0) {
+ else if (this.haveLostReport) {
this.showToast("璇环宸茬粡鏈� 鍙栨秷锛忓け鍗曟姤鍛� 浜嗭紒","error");
}
else if (this.jobCategory == '鏀彺') {
@@ -100,17 +130,24 @@
}
//XLIU-CG98L5 銆愬鎵樸�戙�愯瘎浼般�戞柊闇�姹�-鎷涙爣椤圭洰/璇环瀵瑰簲娴佹爣銆佸簾鏍囨敼鍠� end
else {
- location.href = '/a1U/e?retURL=%2F'+ this.recordId +
- '&RecordType=01210000000R4hH' +
- '&CF00N10000004lbGT=' + this.name +
- '&CF00N10000004lbGT_lkid=' + this.recordId +
- '&CF00N10000006QShg=' + this.salesAssistantName +
- '&CF00N10000006QShg_lkid=' + this.salesAssistantID +
- '&CF00N10000006QShq='+ this.managerName +
- '&CF00N10000006QShq_lkid=' + this.salesManagerDepartmentID +
- '&CF00N10000006QShb=' + this.salesOwnerBuchang +
- '&CF00N10000006QShb_lkid=' + this.salesOwnerBuchangID +
- '';
+ const defaultValues = encodeDefaultFieldValues({
+ Opportunity__c: this.recordId, // 鍏宠仈涓昏褰� ID
+ Sales_assistant__c: this.salesAssistantID,
+ Manager_sales__c: this.salesManagerDepartmentID,
+ Buchang_sales__c: this.salesOwnerBuchangID
+ });
+ this[NavigationMixin.Navigate]({
+ type: 'standard__objectPage',
+ attributes: {
+ objectApiName: 'Lost_cancel_report__c',
+ actionName: 'new'
+ },
+ state: {
+ nooverride: '1',
+ defaultFieldValues: defaultValues,
+ recordTypeId: this.recordTypeId,
+ }
+ });
}
this.dispatchEvent(new CloseActionScreenEvent());
});
--
Gitblit v1.9.1