From c83dc56870037a7b5a10d07ef1154a33b6bf43ee Mon Sep 17 00:00:00 2001
From: 19626 <1962676589@qq.com>
Date: 星期日, 23 四月 2023 17:44:40 +0800
Subject: [PATCH] 修改按钮以及页面所需controller
---
force-app/main/default/lwc/lexOpporSplite/lexOpporSplite.html | 6
force-app/main/default/lwc/lexNewOpportunityAgency/lexNewOpportunityAgency.js | 27 ++
force-app/main/default/lwc/lexOpporSplite/lexOpporSplite.js-meta.xml | 11 +
force-app/main/default/staticresources/PleaseWaitDialog.js | 212 +++++++++++++++++++++
force-app/main/default/lwc/lexOpporSplite/__tests__/lexOpporSplite.test.js | 25 ++
force-app/main/default/lwc/lexStockApply/lexStockApply.js | 39 ++-
force-app/main/default/staticresources/PleaseWaitDialog.resource-meta.xml | 5
force-app/main/default/lwc/lexOpporSplite/lexOpporSplite.js | 88 ++++++++
force-app/main/default/classes/lexPCLLostReportLwcController.cls | 184 +++++++-----------
9 files changed, 466 insertions(+), 131 deletions(-)
diff --git a/force-app/main/default/classes/lexPCLLostReportLwcController.cls b/force-app/main/default/classes/lexPCLLostReportLwcController.cls
index 6b5484f..9082354 100644
--- a/force-app/main/default/classes/lexPCLLostReportLwcController.cls
+++ b/force-app/main/default/classes/lexPCLLostReportLwcController.cls
@@ -1,51 +1,31 @@
public with sharing class lexPCLLostReportLwcController {
- public static Product2 pro2;
- public static string oppId;
- public static string lostReportId;
+ public Product2 pro2 { get; set; }
+ public string oppId { get; set; }
+ public string lostReportId { get; set; }
// 褰撳墠椤甸潰鐘舵�� Create,View and Edit, MarketEdit
- public static string pageStatus;
+ public string pageStatus { get; set; }
// 澶卞崟锛岄儴鍒嗗け鍗�
- public static string lostType;
- public static Set<ID> deleteBrandIDSet = new Set<ID>();
- public static string submitFlag;
- public static LostReport LostReport;
- public static integer brandNo;
- public static integer RemoveBrandNo;
- public static integer setBrandNo;
- public static integer brandCount;
+ public string lostType {get; set;}
+ public Set<ID> deleteBrandIDSet = new Set<ID>();
+ public string submitFlag {get; set;}
+ public LostReport LostReport {get; set;}
+ public integer brandNo {get; set;}
+ public integer RemoveBrandNo {get; set;}
+ public integer setBrandNo {get; set;}
+ public integer brandCount {get; set;}
// add tcm 20211122 start
- public static integer topNum;
- public static integer secondNum;
+ public integer topNum {get; set;}
+ public integer secondNum {get; set;}
// add tcm 20211122 end
-
-
-
- // 绔炰簤瀵规墜瀵圭収鍏崇郴琛紝key鏄搧鐗屽悕瀛楋紝value鏄疘D
- public static map<string,id> CompetitionMap;
-
- // public PCLLostReportController(ApexPages.StandardController controller) {
- // this();
- // }
- // public PCLLostReportController(){
- // oppId =
- // ApexPages.currentPage().getParameters().get('oppId') == null ? ''
- // : ApexPages.currentPage().getParameters().get('oppId');
- // lostReportId =
- // ApexPages.currentPage().getParameters().get('Id') == null ? ''
- // : ApexPages.currentPage().getParameters().get('Id');
- // pageStatus =
- // ApexPages.currentPage().getParameters().get('pageStatus') == null ? ''
- // : ApexPages.currentPage().getParameters().get('pageStatus');
- // lostType =
- // ApexPages.currentPage().getParameters().get('lostType') == null ? ''
- // : ApexPages.currentPage().getParameters().get('lostType');
- // submitFlag = ApexPages.currentPage().getParameters().get('submitFlag') == null ? ''
- // : ApexPages.currentPage().getParameters().get('submitFlag');
-
- // }
// 鍒濆鍖�
- @AuraEnabled
- public static String init(){
+ public void initForApex(string oppId1,string lostReportId1,string pageStatus1,string lostType1,string submitFlag1){
+ oppId = oppId1;
+ lostReportId = lostReportId;
+ pageStatus = pageStatus1;
+ lostType = lostType1;
+ submitFlag = submitFlag1;
+ }
+ public String init(){
if(string.isblank(pageStatus)) {
// 杩欓噷闇�瑕佹姤閿欐病鏈変紶鍙傛暟
return '椤甸潰鍑洪敊锛岃鍒锋柊鍚庨噸璇曪紒';
@@ -176,13 +156,13 @@
// 璇诲彇绔炰簤瀵规墜鍝佺墝
// BrandmapSet();
if(string.isNotEmpty(submitFlag)) {
- return '鎻愪氦鎴愬姛锛�';
+ return '鎻愪氦鎴愬姛锛�';
+
}
- return null;
+ return null;
}
// 缂栬緫 鍙湁绯荤粺绠$悊鍛樻垨鑰呰崏妗堜腑鍙互缂栬緫
- @AuraEnabled
- public static String edit2(){
+ public String edit2(){
if( userinfo.getProfileId() == (ID) '00e10000000Y3o5AAC' ||
'鑽夋'.equals(LostReport.LostReport.Report_Status__c)
) {
@@ -190,13 +170,12 @@
init();
}
else{
- return '鍙湁鍦ㄨ崏妗堜腑鎵嶈兘杩涜缂栬緫锛�';
+ return '鍙湁鍦ㄨ崏妗堜腑鎵嶈兘杩涜缂栬緫锛�';
}
return null;
}
// 璁剧疆鍝佺墝
- @AuraEnabled
- public static void setBrand(){
+ public void setBrand(){
list<LostBrand> LostBrandlist = LostReport.LostBrands;
LostBrand tempBrand = LostBrandlist.get(setBrandNo);
string brandName = tempBrand.lostBrand.Lost_By_Company__c;
@@ -220,8 +199,7 @@
}
}
// 璁剧疆鍝佺墝
- @AuraEnabled
- public static void setbrandmannual(){
+ public void setbrandmannual(){
list<LostBrand> LostBrandlist = LostReport.LostBrands;
LostBrand tempBrand = LostBrandlist.get(setBrandNo);
string brandName = tempBrand.lostBrand.Lost_By_Company__c;
@@ -243,8 +221,7 @@
}
}
// 淇濆瓨
- @AuraEnabled
- public static String save(){
+ public String save(){
if(!DataCheck()) {
return null;
@@ -268,8 +245,7 @@
// }
// 鏁版嵁妫�鏌�
- @AuraEnabled
- public static boolean DataCheck(){
+ public boolean DataCheck(){
boolean dataCheck = true;
if(string.isBlank(LostReport.LostReport.LostType__c))
{
@@ -347,8 +323,7 @@
return dataCheck;
}
- @AuraEnabled
- public static list<LostBrand> brandcopy(){
+ public list<LostBrand> brandcopy(){
list<LostBrand> tempbrands = new list<LostBrand>();
for(LostBrand tempbrand: LostReport.LostBrands) {
LostBrand LostBrand =
@@ -360,8 +335,7 @@
return tempbrands;
}
// 鏁版嵁褰曞叆
- @AuraEnabled
- public static boolean dataEntry(){
+ public boolean dataEntry(){
system.debug('save---start:');
Savepoint sp = Database.setSavepoint();
Lost_cancel_report__c templostReport = LostReport.lostReport.clone();
@@ -488,52 +462,47 @@
LostReport.lostReport = templostReport;
LostReport.LostBrands = tempBrands;
// 杩欓噷闇�瑕佸啓涓�浜涙姤閿欎俊鎭�
+ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error,ex.getMessage()));
return false;
}
return true;
}
- // 鍙栨秷
- // public PageReference cancel(){
- // PageReference page = new PageReference('/'+oppId);
- // page.setRedirect(true);
- // return page;
- // }
+
// 鎻愪氦
- // public PageReference submit(){
- // if(!'鑽夋'.equals(LostReport.LostReport.Report_Status__c) ) {
- // return '鍙湁鍦ㄨ崏妗堜腑鎵嶈兘鎻愪氦鐢宠锛�';
- // }
-
- // Savepoint sp = Database.setSavepoint();
- // try{
- // LostReport.lostReport.Report_Status__c = '鎻愪氦';
- // update LostReport.lostReport;
- // Approval.ProcessSubmitRequest psr = new Approval.ProcessSubmitRequest();
- // psr.setObjectId(lostReportId);
- // Approval.ProcessResult submitResult = Approval.process(psr);
- // PageReference page = new PageReference('/apex/PCLLostReportPage');
- // page.getParameters().put('Id', lostReportId);
- // page.getParameters().put('pageStatus', 'View');
- // page.getParameters().put('submitFlag', '1');
-
- // page.setRedirect(true);
- // return page;
- // }catch(exception ex) {
- // Database.rollback(sp);
- // return ex.getMessage();
- // }
- // }
+ public Map<string,Object> submit(){
+ Map<string,string> messages = new Map<string,string>();
+ if(!'鑽夋'.equals(LostReport.LostReport.Report_Status__c) ) {
+ messages.put('error', '鍙湁鍦ㄨ崏妗堜腑鎵嶈兘鎻愪氦鐢宠锛�');
+ return messages;
+ }
+ Map<string,Object> objs = new Map<string,Object>();
+ Savepoint sp = Database.setSavepoint();
+ try{
+ LostReport.lostReport.Report_Status__c = '鎻愪氦';
+ update LostReport.lostReport;
+ Approval.ProcessSubmitRequest psr = new Approval.ProcessSubmitRequest();
+ psr.setObjectId(lostReportId);
+ Approval.ProcessResult submitResult = Approval.process(psr);
+ objs.put('uri', '/apex/PCLLostReportPage');
+ objs.put('Id', lostReportId);
+ objs.put('pageStatus', 'View');
+ objs.put('submitFlag', '1');
+ return objs;
+ }catch(exception ex) {
+ Database.rollback(sp);
+ messages.put('error', ex.getMessage());
+ return messages;
+ }
+ }
// 娣诲姞鍝佺墝
- @AuraEnabled
- public static String addBrand(){
+ public String addBrand(){
LostReport.LostBrands.add(new LostBrand(LostReport.LostBrands.size()));
brandCount = LostReport.LostBrands.size();
return null;
}
// 鍒犻櫎鍝佺墝 杩欎釜鏈夊弬鏁癰randNo锛屾墠鐭ラ亾鏄垹闄ら偅涓搧鐗�
- @AuraEnabled
- public static String Remove(){
+ public String Remove(){
system.debug('RemoveBrandNo:'+RemoveBrandNo);
list<LostBrand> tempLostBrands = new List<lostBrand>();
Integer i = 0;
@@ -555,8 +524,7 @@
}
// 娣诲姞鍨嬪彿锛� 杩欎釜鏈夊弬鏁癰randNo锛屾墠鐭ラ亾鏄坊鍔犲埌閭d釜鍝佺墝
// update tcm 20211125 娣诲姞鍨嬪彿鏃惰嚜鍔ㄥ甫鍑哄搧鐗� start
- @AuraEnabled
- public static String addProduct(){
+ public String addProduct(){
system.debug('brandNo:'+brandNo);
LostBrand tempLostBrand = LostReport.LostBrands.get(brandNo);
// PCLLostProduct__c plp = new PCLLostProduct__c(Competitor__c=CompetitionMap.get(LostReport.LostBrands[brandNo].lostBrand.Lost_By_Company__c));
@@ -570,9 +538,7 @@
// update tcm 20211125 娣诲姞鍨嬪彿鏃惰嚜鍔ㄥ甫鍑哄搧鐗� end
// 椤甸潰鐨勬暟鎹粨鏋�
public class LostReport {
- @AuraEnabled
public Lost_cancel_report__c lostReport { get; set; }
- @AuraEnabled
public list<LostBrand> LostBrands { get; set; }
public LostReport(){
lostReport = new Lost_cancel_report__c();
@@ -589,14 +555,10 @@
}
public class LostBrand {
- @AuraEnabled
- public PCLLostBrand__c lostBrand;
- @AuraEnabled
- public Integer lineNo;
- @AuraEnabled
- public list<PCLLostProducts> LostProducts;
- @AuraEnabled
- public Integer ProductSize;
+ public PCLLostBrand__c lostBrand { get; set; }
+ public Integer lineNo { get; set; }
+ public list<PCLLostProducts> LostProducts { get; set; }
+ public Integer ProductSize {get; set;}
public LostBrand( integer lineNo ){
lostBrand = new PCLLostBrand__c();
this.lineNo = lineNo;
@@ -619,12 +581,9 @@
}
// add tcm 20211119 start
public class PCLLostProducts {
- @AuraEnabled
- public Integer lineNo2;
- @AuraEnabled
- public PCLLostProduct__c LostProductss;
- @AuraEnabled
- public Boolean bool;
+ public Integer lineNo2 { get; set; }
+ public PCLLostProduct__c LostProductss { get; set; }
+ public Boolean bool { get; set; }
public PCLLostProducts() {
this.lineNo2 = 0;
@@ -647,8 +606,7 @@
// add tcm 20211119 end
// add tcm 20211118 start
- @AuraEnabled
- public static void search() {
+ public void search() {
if (LostReport.LostBrands[topNum].LostProducts[secondNum].LostProductss.LostProduct__c==null) {
LostReport.LostBrands[topNum].LostProducts[secondNum].LostProductss.ProductClass__c=null;
LostReport.LostBrands[topNum].LostProducts[secondNum].LostProductss.ProductCategory__c=null;
diff --git a/force-app/main/default/lwc/lexNewOpportunityAgency/lexNewOpportunityAgency.js b/force-app/main/default/lwc/lexNewOpportunityAgency/lexNewOpportunityAgency.js
index 9b6cfc7..6116562 100644
--- a/force-app/main/default/lwc/lexNewOpportunityAgency/lexNewOpportunityAgency.js
+++ b/force-app/main/default/lwc/lexNewOpportunityAgency/lexNewOpportunityAgency.js
@@ -57,6 +57,22 @@
this.opportunityCategory = result.opportunityCategory;
this.agency1Name = result.agency1Name;
console.log("1");
+ if(this.closeForecastedDate == undefined){
+ this.closeForecastedDate = '';
+ }else{
+ this.closeForecastedDate = new String(this.closeForecastedDate).replace("-","/");
+ }
+ console.log(this.closeForecastedDate);
+ if(this.bidPlannedDate == undefined){
+ this.bidPlannedDate = '';
+ }else{
+ this.bidPlannedDate = new String(this.bidPlannedDate).replace("-","/");
+ }
+ if(this.dealerFinalPrice == undefined){
+ this.dealerFinalPrice = '';
+ }
+ console.log(this.bidPlannedDate);
+ console.log(this.dealerFinalPrice);
this.newOpportunityAgency();
}).catch(error=>{
console.log("error");
@@ -69,15 +85,15 @@
var newflag = true;
if (this.agency1Id == undefined) {
newflag = false;
- alert("缁忛攢鍟嗕笉瀛樺湪锛屼笉鑳借浆鎴愩�愮粡閿�鍟嗙洰鏍囪浠枫�戙��");
+ this.showToast("缁忛攢鍟嗕笉瀛樺湪锛屼笉鑳借浆鎴愩�愮粡閿�鍟嗙洰鏍囪浠枫�戙��","error");
}
else if (this.agencyOpportunity != undefined) {
newflag = false;
- alert("宸茬粡杞垚杩囥�愮粡閿�鍟嗙洰鏍囪浠枫�戙��");
+ this.showToast("宸茬粡杞垚杩囥�愮粡閿�鍟嗙洰鏍囪浠枫�戙��","error");
}
else if (this.trade != '鍐呰部') {
newflag = false;
- alert("涓嶆槸鍐呰锤锛屼笉鑳借浆鎴愩�愮粡閿�鍟嗙洰鏍囪浠枫�戙��");
+ this.showToast("涓嶆槸鍐呰锤锛屼笉鑳借浆鎴愩�愮粡閿�鍟嗙洰鏍囪浠枫�戙��","error");
}
else {
var records = null;
@@ -89,7 +105,7 @@
records = result;
if (records == null || records.length == 0) {
newflag = false;
- alert("娌℃湁鏈夋晥鐨勩�愮粡閿�鍟嗗尰闄€�戙��");
+ this.showToast("娌℃湁鏈夋晥鐨勩�愮粡閿�鍟嗗尰闄€�戙��","error");
}
if (newflag) {
console.log("5");
@@ -101,7 +117,7 @@
console.log("6");
var recTypeList = result;
if (recTypeList.length == 0) {
- alert("娌℃湁鎵惧埌锛岀粡閿�鍟嗚浠风殑瀹氫箟銆�");
+ this.showToast("娌℃湁鎵惧埌锛岀粡閿�鍟嗚浠风殑瀹氫箟銆�","error");
} else {
console.log("7");
queryForRecords2({
@@ -154,6 +170,7 @@
console.log("10");
console.log(records[0]);
var ahl = records[0];
+
try {
var url = "/a2Y/e?retURL=%2F"
+ this.recordId
diff --git a/force-app/main/default/lwc/lexOpporSplite/__tests__/lexOpporSplite.test.js b/force-app/main/default/lwc/lexOpporSplite/__tests__/lexOpporSplite.test.js
new file mode 100644
index 0000000..e36b65e
--- /dev/null
+++ b/force-app/main/default/lwc/lexOpporSplite/__tests__/lexOpporSplite.test.js
@@ -0,0 +1,25 @@
+import { createElement } from 'lwc';
+import LexOpporSplite from 'c/lexOpporSplite';
+
+describe('c-lex-oppor-splite', () => {
+ afterEach(() => {
+ // The jsdom instance is shared across test cases in a single file so reset the DOM
+ while (document.body.firstChild) {
+ document.body.removeChild(document.body.firstChild);
+ }
+ });
+
+ it('TODO: test case generated by CLI command, please fill in test logic', () => {
+ // Arrange
+ const element = createElement('c-lex-oppor-splite', {
+ is: LexOpporSplite
+ });
+
+ // Act
+ document.body.appendChild(element);
+
+ // Assert
+ // const div = element.shadowRoot.querySelector('div');
+ expect(1).toBe(1);
+ });
+});
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexOpporSplite/lexOpporSplite.html b/force-app/main/default/lwc/lexOpporSplite/lexOpporSplite.html
new file mode 100644
index 0000000..7c1379b
--- /dev/null
+++ b/force-app/main/default/lwc/lexOpporSplite/lexOpporSplite.html
@@ -0,0 +1,6 @@
+<template>
+ <div class="lexOpporSpliteHolder" if:true={IsLoading}>
+ <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+ <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button>
+ </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexOpporSplite/lexOpporSplite.js b/force-app/main/default/lwc/lexOpporSplite/lexOpporSplite.js
new file mode 100644
index 0000000..564dea5
--- /dev/null
+++ b/force-app/main/default/lwc/lexOpporSplite/lexOpporSplite.js
@@ -0,0 +1,88 @@
+/*
+ * @Description:
+ * @version:
+ * @Author: chen jing wu
+ * @Date: 2023-04-23 10:09:31
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-04-23 11:29:15
+ */
+import { api, wire,LightningElement } from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import { updateRecord } from 'lightning/uiRecordApi';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import init from '@salesforce/apex/OpportunityLightingButtonController.initForOpporSpliteButton';
+
+export default class LexOpporSplite extends LightningElement {
+ @api recordId;
+ authorizedDBNo;
+ estimationDecision;
+ siDecideID;
+ name;
+ opportunityNo;
+ isAuthorized;
+ @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(){
+ init({
+ recordId: this.recordId
+ }).then(result=>{
+ console.log(result);
+ this.authorizedDBNo = result.authorizedDBNo;
+ this.estimationDecision = result.estimationDecision;
+ this.siDecideID = result.siDecideID;
+ this.name = result.name;
+ this.opportunityNo = result.opportunityNo;
+ this.isAuthorized = result.isAuthorized;
+ this.opporSplite();
+ })
+ }
+ opporSplite(){
+ if(this.recordId == '宸茬粓姝�'){
+ this.showToast("闇�姹傝〃宸茬粓姝紝涓嶈兘鎷嗗崟","error");
+ }else if(this.authorizedDBNo == ''){
+ this.showToast("娌℃湁鍚堝悓鎺堟潈缂栫爜锛屼笉鑳芥媶鍗�","error");
+ }else if(this.estimationDecision == true){
+ this.showToast("鎶ヤ环宸茬粡Decided锛屼笉鑳芥媶鍗�","error");
+ }else if(this.siDecideID == ''){
+ this.showToast("闇�姹傝〃鏈壒鍑嗭紝涓嶈兘鎷嗗崟","error");
+ }else if(this.recordId != '鑽夋涓�' && this.recordId != '宸叉彁浜�' && this.recordId != '宸茬粓姝�'){
+ window.open(
+ this.recordId
+ + "/e?clone=1&retURL=%2F"
+ + this.recordId + "&00N10000002Cbwh=*&CF00N10000006qHai="
+ + this.name + "&00Np0000001DOwi=***&00Np0000001CxmR="
+ + this.opportunityNo + "&CF00N10000006qHai_lkid="
+ + this.recordId + "&00N10000006qHav="
+ + this.opportunityNo + "&00N10000009Glvn="
+ + this.isAuthorized + "&00N10000008pnmd=1&00N10000002DXkZ=&00N10000002DXke=&00N10000002CmTf=&00N10000002Cb9P=&00N10000002DItz=&00N10000003O9oO=&00N10000003O9o4=&00N10000002CYHy=&00Np00000030gzb=&00Np0000002ajGe=&00Np00000034Qlb"
+ );
+ }
+ this.dispatchEvent(new CloseActionScreenEvent());
+ }
+ showToast(msg,type) {
+ const event = new ShowToastEvent({
+ title: '',
+ message: msg,
+ variant: type
+ });
+ this.dispatchEvent(event);
+ this.dispatchEvent(new CloseActionScreenEvent());
+ }
+ updateRecordView(recordId) {
+ updateRecord({fields: { Id: recordId }});
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexOpporSplite/lexOpporSplite.js-meta.xml b/force-app/main/default/lwc/lexOpporSplite/lexOpporSplite.js-meta.xml
new file mode 100644
index 0000000..3392981
--- /dev/null
+++ b/force-app/main/default/lwc/lexOpporSplite/lexOpporSplite.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>54.0</apiVersion>
+ <isExposed>true</isExposed>
+ <targets>
+ <target>lightning__RecordPage</target>
+ <target>lightning__AppPage</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/lexStockApply/lexStockApply.js b/force-app/main/default/lwc/lexStockApply/lexStockApply.js
index e82a54a..d2f94b3 100644
--- a/force-app/main/default/lwc/lexStockApply/lexStockApply.js
+++ b/force-app/main/default/lwc/lexStockApply/lexStockApply.js
@@ -4,7 +4,7 @@
* @Author: chen jing wu
* @Date: 2023-04-14 13:04:53
* @LastEditors: chen jing wu
- * @LastEditTime: 2023-04-14 17:54:56
+ * @LastEditTime: 2023-04-23 14:49:52
*/
import { api, wire,LightningElement } from 'lwc';
import { CurrentPageReference } from "lightning/navigation";
@@ -15,6 +15,7 @@
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import { loadScript } from "lightning/platformResourceLoader";
import connection from '@salesforce/resourceUrl/connection20';
+import submitProcess from '@salesforce/apex/OpportunityLightingButtonController.submitProcess';
export default class LexStockApply extends LightningElement {
@api recordId;
stockApplyStatus;
@@ -49,11 +50,13 @@
var status = this.stockApplyStatus;
if (status != '鑽夋涓�' && status != '濉啓瀹屾瘯' && status != '涓嶆壒鍑�' && status != '' && status != undefined) {
this.showToast("澶囪揣鐢宠鐘舵�佷笉姝g‘锛屼笉鑳芥彁浜ゅ璐х敵璇枫��","error");
+ this.dispatchEvent(new CloseActionScreenEvent);
return;
}
var oppfile = this.lastOpportunityFileId;
if (oppfile == undefined || oppfile == '') {
this.showToast("璇蜂笂浼犺浠锋枃浠躲��","error");
+ this.dispatchEvent(new CloseActionScreenEvent);
return;
}
@@ -68,33 +71,43 @@
}).then(result=>{
if(result){
this.showToast(result,"error");
+ this.dispatchEvent(new CloseActionScreenEvent);
return;
}
- Promise.all([
- loadScript(this,connection)
- ]).then(() =>{
- var request = new window.sforce.ProcessSubmitRequest();
- request.objectId = this.recordId;
- console.log("s");
- console.log(request);
- console.log("e");
- var processResults = window.sforce.Connection.prototype.process([request]);
- console.log(processResults);
- if (processResults[0].errors != null) {
+ // var request = new window.sforce.ProcessSubmitRequest();
+ // request.objectId = this.recordId;
+ // console.log("s");
+ // console.log(request);
+ // console.log("e");
+ // var processResults = window.sforce.Connection.prototype.process([request]);
+ // console.log(processResults);
+ submitProcess({
+ opportunityId: this.recordId
+ }).then(result=>{
+ if(result){
+ this.showToast(result,"error");
updateForStockApplyButton({
recordId: this.recordId,
flag: false
}).then(result=>{
if(result){
this.showToast(result,"error");
+ this.dispatchEvent(new CloseActionScreenEvent);
return;
}
this.IsLoading = false;
this.updateRecordView(this.recordId);
this.dispatchEvent(new CloseActionScreenEvent);
})
+
+ }else{
+ this.showToast("鎴愬姛","success");
+ this.updateRecordView(this.recordId);
+ this.dispatchEvent(new CloseActionScreenEvent);
}
- });
+
+ })
+
}).catch(error=>{
console.log(error);
})
diff --git a/force-app/main/default/staticresources/PleaseWaitDialog.js b/force-app/main/default/staticresources/PleaseWaitDialog.js
new file mode 100644
index 0000000..df368fa
--- /dev/null
+++ b/force-app/main/default/staticresources/PleaseWaitDialog.js
@@ -0,0 +1,212 @@
+function escapeVfId(vfId) {
+ return '#' + vfId.replace(/(:|\.)/g,'\\$1');
+}
+
+function scrollbarWidth() {
+ var $inner = jQuery('<div style="width: 100%; height:200px;">test</div>'),
+ $outer = jQuery('<div style="width:200px;height:150px; position: absolute; top: 0; left: 0; visibility: hidden; overflow:hidden;"></div>').append($inner),
+ inner = $inner[0],
+ outer = $outer[0];
+
+ jQuery('body').append(outer);
+ var width1 = inner.offsetWidth;
+ $outer.css('overflow', 'scroll');
+ var width2 = outer.clientWidth;
+ $outer.remove();
+
+ return (width1 - width2);
+}
+
+function setButtonDisable(object, status){
+ if(!(object.id == 'idGetActive' || object.id == 'Page:mainForm:idDayEdit:idReportDate')) {
+ object.disabled = status;
+ }
+ if(object.id != 'idGetActive' && object.tagName.toLowerCase() == "input" && (object.type.toLowerCase() == "button" || object.type.toLowerCase() == "submit")) {
+ if(status == true) {
+ object.style.cursor = "default";
+ object.style.backgroundPosition = "0 -90px";
+ object.style.borderColor = "#C4C4C4";
+ object.style.color = "#909090";
+
+ } else {
+ object.style.backgroundPosition = "";
+ object.style.color = "";
+ object.style.cursor = "pointer";
+ object.style.borderColor = "#B5B5B5 #B5B5B5 #7F7F7F";
+ }
+ }
+}
+
+function setButtonsDisable(jObj, status){
+ jObj.each(function(index) {
+ setButtonDisable(this, status);
+ });
+}
+
+function number_format_common (number, decimals, dec_point, thousands_sep) {
+ number = (number + '').replace(/[^0-9+\-Ee.]/g, '');
+ var n = !isFinite(+number) ? 0 : +number,
+ prec = !isFinite(+decimals) ? 0 : Math.abs(decimals),
+ sep = (typeof thousands_sep === 'undefined') ? ',' : thousands_sep,
+ dec = (typeof dec_point === 'undefined') ? '.' : dec_point,
+ s = '',
+ toFixedFix = function (n, prec) {
+ var k = Math.pow(10, prec);
+ return '' + Math.round(n * k) / k;
+ };
+ // Fix for IE parseFloat(0.55).toFixed(0) = 0;
+ s = (prec ? toFixedFix(n, prec) : '' + Math.round(n)).split('.');
+ if (s[0].length > 3) {
+ s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, sep);
+ }
+ if ((s[1] || '').length < prec) {
+ s[1] = s[1] || '';
+ s[1] += new Array(prec - s[1].length + 1).join('0');
+ }
+ return ( s.join(dec));
+}
+function toNum( input) {
+ return number_format_common( input, 2, ".", "");
+}
+function toNumComma( input) {
+ return number_format_common( input, 2, ".", ",");
+}
+
+function localParseFloat( input) {
+ input += "";
+ input = input.split(" ");
+ if (input.length > 1) {
+ input = input[1];
+ } else {
+ input = input[0];
+ }
+ input = input.replace(/,/g, "");
+ input = input.replace(/ /g, "");
+ // IE銇牬鍚堛�乗s銇屽姽銇嬨仾銇勩�佷竴鏃arse銇緦鍐嶅害isNaN銈掋儊銈с儍銈�
+ //input = input.replace(/^\s+/, '').replace(/\s+$/, '');
+ if ( input == '' || isNaN( input)) {
+ input = 0.00;
+ }
+ input = parseFloat(input);
+ if (isNaN( input)) input = 0.00;
+ return input;
+}
+function localParseInt( input) {
+ input += "";
+ input = input.split(" ");
+ if (input.length > 1) {
+ input = input[1];
+ } else {
+ input = input[0];
+ }
+ input = input.replace(/,/g, "");
+ input = input.replace(/ /g, "");
+ // IE銇牬鍚堛�乗s銇屽姽銇嬨仾銇勩�佷竴鏃arse銇緦鍐嶅害isNaN銈掋儊銈с儍銈�
+ //input = input.replace(/^\s+/, '').replace(/\s+$/, '');
+ if ( input == '' || isNaN( input)) {
+ input = 0;
+ }
+ input = parseInt(input);
+ if (isNaN( input)) input = 0.00;
+ return input;
+}
+
+/*************************************************
+ * prototype銈掓嫛寮�
+ *************************************************/
+(function($) {
+ /**
+ * TODO 鍊ゃ偦銉冦儓銇仺銇撱倣銈傚蹇�
+ * from銇畍alue銈掑彇寰椼�乺adio銇牬鍚堟浉銇嶆柟銇岄仌銇嗐仧銈併�佸惛鍙庛仐銇俱仚
+ * value銇屽彇銈屻仾銇勫牬鍚堛�佺┖鏂囧瓧銈掕繑銇�
+ */
+ $.fn.value = function() {
+ var jQueryObj = this;
+ var rtn = [];
+ jQueryObj.each(function(i) {
+ if (this.tagName.toLowerCase() == "input"
+ || this.tagName.toLowerCase() == "textarea"
+ || this.tagName.toLowerCase() == "select") {
+ if (this.type.toLowerCase() == "radio" || this.type.toLowerCase() == "checkbox") {
+ if (this.checked) {
+ rtn.push(this.value);
+ }
+ } else {
+ rtn.push($(this).val());
+ }
+ }
+ else if (this.tagName.toLowerCase() == "span" || this.tagName.toLowerCase() == "label") {
+ rtn.push($(this).text());
+ }
+ });
+ if (rtn.length == 0) {
+ rtn = '';
+ }
+ else if (rtn.length == 1) {
+ rtn = rtn[0];
+ }
+ return rtn;
+ };
+})(jQuery);
+
+j$ = jQuery.noConflict();
+
+function blockme(){
+ j$("body").prepend("<div id='sbArea'><div id='sbArea_contentsArea'><div id='sbArea_contentsArea_msg'>Please wait...</div></div><div id='sbArea_backArea'></div></div>");
+ j$("#sbArea_contentsArea").css({"opacity":"0"}).fadeTo(500, 0.8);
+ j$("#sbArea_backArea").css({"opacity":"0"}).fadeTo(500, 0.4);
+ resizeShadowBox();
+}
+
+function blockme_dark(){
+ j$("body").prepend("<div id='sbArea'><div id='sbArea_contentsArea'><div id='sbArea_contentsArea_msg'>Please wait...</div></div><div id='sbArea_backArea'></div></div>");
+ j$("#sbArea_contentsArea").css({"opacity":"0"}).fadeTo(500, 0.9);
+ j$("#sbArea_backArea").css({"opacity":"0"}).fadeTo(500, 0.8);
+ resizeShadowBox();
+}
+
+//銈︺偅銉炽儔銇偟銈ゃ偤銇亗銈忋仜銇︿綅缃倰瑾挎暣
+function resizeShadowBox(){
+ var h = j$(document);
+ var winH = j$(window).height();
+ var winW = j$(window).width();
+ var screanWidth = window.screen.width;
+ if (screanWidth < winW) {
+ winH = winH * winW / screanWidth;
+ winW = winW * winW / screanWidth;
+ }
+ var contents = j$("#sbArea_contentsArea")
+ contents.css({"width":"auto","height":"auto"});
+ var iSaBoxH = contents.outerHeight();
+ var iSaBoxW = contents.outerWidth();
+
+ if(winH >= iSaBoxH+10*2){
+ var innerT = (winH-iSaBoxH)/2;
+ }else{
+ var innerT = 10;
+ iSaBoxH = winH-10*2;
+ iSaBoxW += 20;
+ }
+ if(winW >= iSaBoxW+10*2){
+ var innerL = (winW-iSaBoxW)/2;
+ }else{
+ var innerL =10;
+ iSaBoxW = winW-10*2;
+ }
+ var sbTop = h.scrollTop()
+
+ var IE6browser = (navigator.userAgent.indexOf("MSIE 6")>=0) ? true : false;
+ if(!IE6browser){
+ j$("#sbArea").css({"width":winW+"px","height":winH+"px","position":"fixed"});
+ }else{
+ j$("#sbArea").css({"width":winW+"px","height":winH+"px","top":h.scrollTop()+"px","left":h.scrollLeft()+"px"});
+ }
+ j$("#sbArea_contentsArea").css({"left":innerL+"px","top":innerT+"px","height":iSaBoxH+"px","width":iSaBoxW+"px"});
+ j$("#sbArea_backArea").css({"width":winW+"px","height":winH+"px"});
+}
+
+function unblockUI(){
+ j$("#sbArea").fadeOut(500, function(){
+ j$("#sbArea").remove();
+ });
+}
\ No newline at end of file
diff --git a/force-app/main/default/staticresources/PleaseWaitDialog.resource-meta.xml b/force-app/main/default/staticresources/PleaseWaitDialog.resource-meta.xml
new file mode 100644
index 0000000..aa06dd8
--- /dev/null
+++ b/force-app/main/default/staticresources/PleaseWaitDialog.resource-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<StaticResource xmlns="http://soap.sforce.com/2006/04/metadata">
+ <cacheControl>Public</cacheControl>
+ <contentType>application/x-javascript</contentType>
+</StaticResource>
--
Gitblit v1.9.1