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/lexLoseReport/lexLoseReport.js | 100 ++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 77 insertions(+), 23 deletions(-)
diff --git a/force-app/main/default/lwc/lexLoseReport/lexLoseReport.js b/force-app/main/default/lwc/lexLoseReport/lexLoseReport.js
index 7b167ea..576018d 100644
--- a/force-app/main/default/lwc/lexLoseReport/lexLoseReport.js
+++ b/force-app/main/default/lwc/lexLoseReport/lexLoseReport.js
@@ -2,6 +2,14 @@
* @Description:
* @version:
* @Author: chen jing wu
+ * @Date: 2023-04-20 14:08:55
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-10-16 14:45:16
+ */
+/*
+ * @Description:
+ * @version:
+ * @Author: chen jing wu
* @Date: 2023-04-14 10:16:19
* @LastEditors: chen jing wu
* @LastEditTime: 2023-04-14 10:41:46
@@ -12,6 +20,9 @@
import { updateRecord } from 'lightning/uiRecordApi';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import init from '@salesforce/apex/OpportunityLightingButtonController.initForLostReportButton';
+import queryLostReport from '@salesforce/apex/OpportunityLightingButtonController.queryLostReport';
+import lwcCSS from '@salesforce/resourceUrl/lwcCSS';
+import {loadStyle} from 'lightning/platformResourceLoader';
export default class LexLoseReport extends LightningElement {
@api recordId;
stageName;
@@ -24,6 +35,8 @@
salesManagerDepartmentID;
salesOwnerBuchang;
salesOwnerBuchangID;
+ cntLostCancelDraft;
+ haveLostReport;
IsLoading = true;
@wire(CurrentPageReference)
getStateParameters(currentPageReference) {
@@ -41,6 +54,10 @@
}
}
connectedCallback(){
+ Promise.all([
+ loadStyle(this, lwcCSS)
+ ]);
+
init({
recordId: this.recordId
}).then(result=>{
@@ -54,7 +71,19 @@
this.salesManagerDepartmentID = result.salesManagerDepartmentID;
this.salesOwnerBuchang = result.salesOwnerBuchang;
this.salesOwnerBuchangID = result.salesOwnerBuchangID;
- this.loseReport();
+ this.cntLostCancelDraft = result.cntLostCancelDraft;
+ if(!result.isHavePower){
+ this.showToast('鎮ㄤ笉鑳藉垱寤哄け鍗�/閮ㄥ垎澶卞崟鎶ュ憡锛�','error');
+ this.dispatchEvent(new CloseActionScreenEvent());
+ return;
+ }
+ queryLostReport({
+ recordId: this.recordId
+ }).then(result=>{
+ this.haveLostReport = result;
+ this.loseReport();
+ });
+
})
}
loseReport(){
@@ -67,34 +96,59 @@
else if (this.sapSendOK == '1') {
this.showToast("宸茬粡涓婁紶SAP銆佷笉鑳藉仛 澶卞崟 浜嗭紒","error");
}
- else if (this.cntLostCancelReport > 0) {
- this.showToast("璇环宸茬粡鏈� 鍙栨秷锛忓け鍗曟姤鍛� 浜嗭紒","error");
+ else if (this.haveLostReport) {
+ this.showToast('璇环宸茬粡鏈� 鍙栨秷锛忓け鍗曟姤鍛� 浜嗭紒','error');
}
- //else if({!Not(ISBLANK(Opportunity.Bidding_Project_Name_Bid__c))} && //'{!Opportunity.InfoTypeBid__c}' != '3锛氱粨鏋�' ){
- //alert("鍏宠仈鎷涙姇鏍囬」鐩殑璇环锛屽彧鑳藉湪鏈夌粨鏋滃悗鍋氬け鍗曟姤鍛婏紒");
- //}
else {
- location.href = '/a1U/e?retURL=%2F' + this.recordId +
- '&RecordType=01210000000R4hM' +
- '&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 +
- '';
+ var url = '/lightning/n/PCLLostReportPageLwc#pageStatus=Create&oppId=' + this.recordId + '&lostType=澶卞崟';
+ location.href = url;
}
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());
+ }
+ }
+ //鏄剧ず淇℃伅
+ showMyToast(title, message, variant) {
+ console.log('show custom message');
+ let iconName = '';
+ let content = '';
+ if (variant == 'success') {
+ iconName = 'utility:check';
+ } else {
+ iconName = 'utility:error';
+ }
+ if (message != '') {
+ content =
+ '<h2><strong>' +
+ title +
+ '<strong/></h2><h5>' +
+ message +
+ '</h5>';
+ } else {
+ content = '<h2><strong>' + title + '<strong/></h2>';
+ }
+ this.template
+ .querySelector('c-common-toast')
+ .showToast(variant, content, iconName, 10000).then(result=>{
+ this.dispatchEvent(new CloseActionScreenEvent());
+ });
+ this.isLoading = false;
}
updateRecordView(recordId) {
updateRecord({fields: { Id: recordId }});
--
Gitblit v1.9.1