From 3b96b51ff6a671445bbeeb0ec155d9b5d85f2998 Mon Sep 17 00:00:00 2001
From: chenjingwu <chenjingwu@prec-tech.com>
Date: 星期三, 10 四月 2024 16:00:43 +0800
Subject: [PATCH] 1
---
force-app/main/default/lwc/lexAgencyAuthorize/lexAgencyAuthorize.js | 215 +++++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 191 insertions(+), 24 deletions(-)
diff --git a/force-app/main/default/lwc/lexAgencyAuthorize/lexAgencyAuthorize.js b/force-app/main/default/lwc/lexAgencyAuthorize/lexAgencyAuthorize.js
index 30da2db..7a9f8f2 100644
--- a/force-app/main/default/lwc/lexAgencyAuthorize/lexAgencyAuthorize.js
+++ b/force-app/main/default/lwc/lexAgencyAuthorize/lexAgencyAuthorize.js
@@ -4,7 +4,7 @@
* @Author: chen jing wu
* @Date: 2023-04-12 14:51:44
* @LastEditors: chen jing wu
- * @LastEditTime: 2023-04-19 09:11:02
+ * @LastEditTime: 2023-10-10 17:25:57
*/
import { api, wire,LightningElement } from 'lwc';
import { CurrentPageReference } from "lightning/navigation";
@@ -14,8 +14,15 @@
import { updateRecord } from 'lightning/uiRecordApi';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import checkDangerItem from '@salesforce/apex/OpportunityWebService.checkDangerItem';
+import accSendEmail from '@salesforce/apex/OpportunityWebService.accSendEmail';
import oppCheck from '@salesforce/apex/OpportunityWebService.oppCheck';
import updReg from '@salesforce/apex/OpportunityWebService.updReg';
+import TradeComplianceStatusFlag from '@salesforce/label/c.TradeComplianceStatusFlag';
+import IFTradeComplianceAlert from '@salesforce/label/c.IFTradeComplianceAlert';
+import LightningConfirm from 'lightning/confirm';
+import lwcCSS from '@salesforce/resourceUrl/lwcCSS';
+import {loadStyle} from 'lightning/platformResourceLoader';
+import queryQuote from '@salesforce/apex/OpportunityLightingButtonController.queryQuote';
export default class LexAgencyAuthorize extends LightningElement {
@api recordId;
@@ -37,6 +44,17 @@
isCorrosion;
profileId;
ifAuthorizingLock;
+ systemProfileId;
+ j3ProfileId;
+ s61ProfileId;
+ s62ProfileId;
+ m4ProfileId;
+ AccDealerBlacklist;
+ angency1;
+ angency2;
+ accname;
+ ownerids;
+ ddid;
IsLoading = true;
@wire(CurrentPageReference)
getStateParameters(currentPageReference) {
@@ -54,6 +72,9 @@
}
}
connectedCallback(){
+ Promise.all([
+ loadStyle(this, lwcCSS)
+ ]);
init({
recordId: this.recordId
}).then(result=>{
@@ -76,8 +97,23 @@
this.isCorrosion = result.isCorrosion;
this.profileId = result.profileId;
this.ifAuthorizingLock = result.ifAuthorizingLock;
+ this.systemProfileId = result.systemProfileId;
+ this.j3ProfileId = result.j3ProfileId;
+ this.s61ProfileId = result.s61ProfileId;
+ this.s62ProfileId = result.s62ProfileId;
+ this.m4ProfileId = result.m4ProfileId;
+ this.AccDealerBlacklist = result.AccDealerBlacklist;
+ this.angency1 = result.angency1;
+ this.angency2 = result.angency2;
+ this.accname = result.accname;
+ this.ownerids = result.ownerids;
+ this.ddid = result.ddid;
+ console.log("w");
this.AgencyAuthorize();
- })
+ }).catch(error=>{
+ console.log("error");
+ console.log(error);
+ });
}
AgencyAuthorize(){
var btns = document.getElementsByName("agency_authorize");
@@ -89,12 +125,106 @@
var oppid = this.recordId;
var angency = this.agency1Id;
var profileId = this.profileId;
-
- if (profileId != '00e10000000Y3o5' && profileId != '00e10000000Nab7' && profileId != '00e10000000xnpR' && profileId != '00e10000000xyK6' && profileId != '00e10000000NbCE'
- && profileId != '00e10000000xyK6' && profileId != '00e10000000Nb7i') {
+ this.detailNum = 1;
+ if (profileId != this.systemProfileId && profileId != this.j3ProfileId && profileId != this.s61ProfileId && profileId != this.s62ProfileId && profileId != this.m4ProfileId) {
this.showToast("鎮ㄦ病鏈夋巿鏉冪敵璇风殑鏉冮檺銆傝鑱旂郴绯荤粺绠$悊鍛樸��","error");
return;
}
+ queryQuote({
+ estimationId: this.estimationId
+ }).then(result=>{
+ console.log(result);
+ if(result == true){
+ this.showToast("鍖呭惈铏氭嫙浜у搧锛屼笉鑳芥巿鏉冿紝璇锋洿鏂版姤浠峰崟鍚庣敵璇�","error");
+ return;
+ }
+ //璐告槗鍚堣 you
+ var AccDealerBlacklist = this.AccDealerBlacklist;//鍒ゆ柇瀹㈡埛/缁忛攢鍟嗘槸鍚︿负榛戝悕鍗�
+ var angency1 = this.angency1;
+ var angency2 = this.angency2;
+ var accname = this.accname;
+ var ownerids = this.ownerids;
+ var ddid = this.ddid;
+ if(TradeComplianceStatusFlag=='true'){
+ //鎷︽埅+閭欢鎻愰啋
+ var oppflag=false;
+ if (AccDealerBlacklist=='123') {
+ // alert('瀹㈡埛,缁忛攢鍟�1锛岀粡閿�鍟�2閮戒负榛戝悕鍗曪紝涓嶈兘鍋氭巿鏉冪敵璇凤紝'+IFTradeComplianceAlert);
+ this.showToast('瀹㈡埛,缁忛攢鍟�1锛岀粡閿�鍟�2閮戒负榛戝悕鍗曪紝涓嶈兘鍋氭巿鏉冪敵璇凤紝'+IFTradeComplianceAlert,'error');
+ oppflag=true;
+
+ }else if(AccDealerBlacklist=='12'){
+ // alert('瀹㈡埛,缁忛攢鍟�1閮戒负榛戝悕鍗曪紝涓嶈兘鍋氭巿鏉冪敵璇凤紝'+IFTradeComplianceAlert);
+ this.showToast('瀹㈡埛,缁忛攢鍟�1閮戒负榛戝悕鍗曪紝涓嶈兘鍋氭巿鏉冪敵璇凤紝'+IFTradeComplianceAlert,'error');
+ oppflag=true;
+ }else if(AccDealerBlacklist=='23'){
+ // alert('缁忛攢鍟�1锛岀粡閿�鍟�2閮戒负榛戝悕鍗曪紝涓嶈兘鍋氭巿鏉冪敵璇凤紝'+IFTradeComplianceAlert);
+ this.showToast('缁忛攢鍟�1锛岀粡閿�鍟�2閮戒负榛戝悕鍗曪紝涓嶈兘鍋氭巿鏉冪敵璇凤紝'+IFTradeComplianceAlert,'error');
+ oppflag=true;
+ }else if(AccDealerBlacklist=='13'){
+ // alert('瀹㈡埛,缁忛攢鍟�2閮戒负榛戝悕鍗曪紝涓嶈兘鍋氭巿鏉冪敵璇凤紝'+IFTradeComplianceAlert);
+ this.showToast('瀹㈡埛,缁忛攢鍟�2閮戒负榛戝悕鍗曪紝涓嶈兘鍋氭巿鏉冪敵璇凤紝'+IFTradeComplianceAlert,'error');
+ oppflag=true;
+ }else if(AccDealerBlacklist=='1'){
+ // alert('瀹㈡埛涓洪粦鍚嶅崟锛屼笉鑳藉仛鎺堟潈鐢宠锛�'+IFTradeComplianceAlert);
+ this.showToast('瀹㈡埛涓洪粦鍚嶅崟锛屼笉鑳藉仛鎺堟潈鐢宠锛�'+IFTradeComplianceAlert,'error');
+ oppflag=true;
+ }else if(AccDealerBlacklist=='2'){
+ // alert('缁忛攢鍟�1涓洪粦鍚嶅崟锛屼笉鑳藉仛鎺堟潈鐢宠锛�'+IFTradeComplianceAlert);
+ this.showToast('缁忛攢鍟�1涓洪粦鍚嶅崟锛屼笉鑳藉仛鎺堟潈鐢宠锛�'+IFTradeComplianceAlert,'error');
+ oppflag=true;
+ }else if(AccDealerBlacklist=='3'){
+ // alert('缁忛攢鍟�2涓洪粦鍚嶅崟锛屼笉鑳藉仛鎺堟潈鐢宠锛�'+IFTradeComplianceAlert);
+ this.showToast('缁忛攢鍟�2涓洪粦鍚嶅崟锛屼笉鑳藉仛鎺堟潈鐢宠锛�'+IFTradeComplianceAlert,'error');
+ oppflag=true;
+ }
+ console.log('y');
+ console.log(oppflag);
+ if(oppflag){
+ accSendEmail({
+ "AccDealerBlacklist":AccDealerBlacklist,
+ "accname":accname,
+ "angency1":angency1,
+ "angency2":angency2,
+ "ownerids":ownerids,
+ "ddid":ddid,
+ "oppid":oppid
+ }).then(result=>{
+ console.log('q');
+ var opprtn = result;
+ if (opprtn = true) {
+ return;
+ }
+ //璀︾ず鎻愰啋
+ if (AccDealerBlacklist=='567') {
+ this.handleConfirmClick('鎮ㄦ墍閫夋嫨鐨勫鎴�,缁忛攢鍟�1锛岀粡閿�鍟�2瀛樺湪璐告槗鍚堣璀︾ず椋庨櫓锛屼笉寤鸿鍋氭巿鏉冪敵璇凤紝璇锋偍纭鏄惁缁х画鐢宠锛�'+IFTradeComplianceAlert);
+ }else if(AccDealerBlacklist=='56'){
+ this.handleConfirmClick('鎮ㄦ墍閫夋嫨鐨勫鎴�,缁忛攢鍟�1瀛樺湪璐告槗鍚堣璀︾ず椋庨櫓锛屼笉寤鸿鍋氭巿鏉冪敵璇凤紝璇锋偍纭鏄惁缁х画鐢宠锛�'+IFTradeComplianceAlert);
+ }else if(AccDealerBlacklist=='67'){
+ this.handleConfirmClick('鎮ㄦ墍閫夋嫨鐨勭粡閿�鍟�1锛岀粡閿�鍟�2瀛樺湪璐告槗鍚堣璀︾ず椋庨櫓锛屼笉寤鸿鍋氭巿鏉冪敵璇凤紝璇锋偍纭鏄惁缁х画鐢宠锛�'+IFTradeComplianceAlert);
+ }else if(AccDealerBlacklist=='57'){
+ this.handleConfirmClick('鎮ㄦ墍閫夋嫨鐨勫鎴�,缁忛攢鍟�2瀛樺湪璐告槗鍚堣璀︾ず椋庨櫓锛屼笉寤鸿鍋氭巿鏉冪敵璇凤紝璇锋偍纭鏄惁缁х画鐢宠锛�'+IFTradeComplianceAlert);
+ }else if(AccDealerBlacklist=='5'){
+ this.handleConfirmClick('鎮ㄦ墍閫夋嫨鐨勫鎴峰瓨鍦ㄨ锤鏄撳悎瑙勮绀洪闄╋紝涓嶅缓璁仛鎺堟潈鐢宠锛岃鎮ㄧ‘璁ゆ槸鍚︾户缁敵璇凤紝'+IFTradeComplianceAlert);
+ }else if(AccDealerBlacklist=='6'){
+ this.handleConfirmClick('鎮ㄦ墍閫夋嫨鐨勭粡閿�鍟�1瀛樺湪璐告槗鍚堣璀︾ず椋庨櫓锛屼笉寤鸿鍋氭巿鏉冪敵璇凤紝璇锋偍纭鏄惁缁х画鐢宠锛�'+IFTradeComplianceAlert);
+ }else if(AccDealerBlacklist=='7'){
+ this.handleConfirmClick('鎮ㄦ墍閫夋嫨鐨勭粡閿�鍟�2瀛樺湪璐告槗鍚堣璀︾ず椋庨櫓锛屼笉寤鸿鍋氭巿鏉冪敵璇凤紝璇锋偍纭鏄惁缁х画鐢宠锛�'+IFTradeComplianceAlert);
+ }
+ });
+ }else{
+ this.ss();
+ }
+ }else{
+ this.ss();
+ }
+ //璐告槗鍚堣 you
+ });
+
+
+
+ }
+ ss(){
if (this.stageName != '寮曞悎' && this.stageName != '璇环' ) {
this.showToast("鐘舵��1:" + this.stageName + "銆佷笉鑳藉仛鎺堟潈鐢宠锛�","error");
return;
@@ -108,9 +238,11 @@
this.showToast("鑰楁潗涓嶅彲涓庡ゥ杈変骇鍝佸悓鏃跺瓨鍦紒","error");
return;
} else if (this.cntLostCancelDraft > 0) {
- if(!confirm('璇环鏈夎崏妗堜腑鐨勫彇娑�/澶卞崟鎶ュ憡锛屾槸鍚︾户缁紵')){
- return ;
- }
+ // if(!confirm('璇环鏈夎崏妗堜腑鐨勫彇娑�/澶卞崟鎶ュ憡锛屾槸鍚︾户缁紵')){
+ // this.dispatchEvent(new CloseActionScreenEvent());
+ // return ;
+ // }
+ this.handleConfirmClick1("璇环鏈夎崏妗堜腑鐨勫彇娑�/澶卞崟鎶ュ憡锛屾槸鍚︾户缁紵");
} else if (this.cntLostCancelReport - this.cntLostCancelDraft > 0) {
this.showToast('璇环鏈夊凡鎻愪氦鐨勫彇娑�/澶卞崟鎶ュ憡銆�',"error");
return;
@@ -123,23 +255,24 @@
} else if (this.salesRoot != '璨╁2搴�') {
this.showToast('鍖婚櫌鐩撮攢涓嶉渶瑕佹巿鏉冪敵璇枫��',"error");
return;
- }
- // else if ('{!Opportunity.AcecideCntCheck__c}' != '1') {
- // alert('闃胯タ璧涘璇环鍙兘鍖呭惈鍗卞寲鍝侊紝鎴栬�咃紝鏅�氳浠蜂笉鑳藉寘鍚嵄鍖栧搧銆�');
- // return;
- // }
- else if (this.ifSubmit == '1') {
+ }else if (this.ifSubmit == '1') {
this.showToast('涓婁紶澶辫触锛岃鑱旂郴绯荤粺绠$悊鍛�!',"error");
return;
+ }else{
+ this.dd();
}
- if (this.ifAuthorizingLock == 'true') {
+
+ }
+
+ dd(){
+ if (this.ifAuthorizingLock == true) {
this.showToast('璇环姝e湪鎺堟潈涓紝璇蜂笉瑕侀噸澶嶆彁浜ゃ��',"error");
return;
}
if (this.trade == '鍐呰部') {
if(this.isCorrosion == '1'){
checkDangerItem({
- agency1: angency
+ agency1: this.agency1Id
}).then(result=>{
var rtn1 = result;
if (rtn1 != 'OK') {
@@ -150,7 +283,7 @@
});
}else{
oppCheck({
- oppid: oppid,
+ oppid: this.recordId,
saveFlg: '1'
}).then(result=>{
var rtn = result;
@@ -163,20 +296,54 @@
}
} else {
updReg({
- oppid: oppid
+ oppid: this.recordId
}).then(()=>{
this.update();
});
}
}
- showToast(msg,type) {
- const event = new ShowToastEvent({
- title: '',
+ async handleConfirmClick(msg) {
+ const result = await LightningConfirm.open({
message: msg,
- variant: type
+ variant: 'headerless',
+ label: 'this is the aria-label value'
});
- this.dispatchEvent(event);
- this.dispatchEvent(new CloseActionScreenEvent());
+ if (result) {
+ this.ss();
+ } else {
+ this.dispatchEvent(new CloseActionScreenEvent());
+ }
+ }
+
+ async handleConfirmClick1(msg) {
+ const result = await LightningConfirm.open({
+ message: msg,
+ variant: 'headerless',
+ label: 'this is the aria-label value'
+ });
+ if (result) {
+ this.dd();
+ } else {
+ this.dispatchEvent(new CloseActionScreenEvent());
+ }
+ }
+ showToast(msg,type) {
+ 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