From 07a70391092d0b1e3f8e2a14e972070404b81d86 Mon Sep 17 00:00:00 2001
From: liwentao <1376563863@qq.com>
Date: 星期一, 17 七月 2023 15:09:25 +0800
Subject: [PATCH] 营业 任务按钮: 授权委托更新完毕 报价委托更新完毕 无效委托
---
force-app/main/default/lwc/lexRequestClose/lexRequestClose.js | 95 ++++++
force-app/main/default/lwc/lexInvalidDelegation/lexInvalidDelegation.js-meta.xml | 11
force-app/main/default/classes/LexTaskCloseController.cls-meta.xml | 5
force-app/main/default/lwc/lexInvalidDelegation/lexInvalidDelegation.js | 177 ++++++++++++
force-app/main/default/lwc/lexTaskClose/lexTaskClose.css | 11
force-app/main/default/classes/LexRequestCloseController.cls | 65 ++++
force-app/main/default/lwc/lexRequestClose/lexRequestClose.js-meta.xml | 11
force-app/main/default/classes/LexInvalidDelegationController.cls | 143 ++++++++++
force-app/main/default/lwc/lexTaskClose/lexTaskClose.html | 5
force-app/main/default/lwc/lexRequestClose/lexRequestClose.css | 11
force-app/main/default/classes/LexRequestCloseController.cls-meta.xml | 5
force-app/main/default/lwc/lexInvalidDelegation/lexInvalidDelegation.html | 5
force-app/main/default/classes/LexInvalidDelegationController.cls-meta.xml | 5
force-app/main/default/classes/LexTaskCloseController.cls | 125 ++++++++
force-app/main/default/lwc/lexRequestClose/lexRequestClose.html | 5
force-app/main/default/lwc/lexTaskClose/lexTaskClose.js | 132 +++++++++
force-app/main/default/lwc/lexTaskClose/lexTaskClose.js-meta.xml | 11
17 files changed, 822 insertions(+), 0 deletions(-)
diff --git a/force-app/main/default/classes/LexInvalidDelegationController.cls b/force-app/main/default/classes/LexInvalidDelegationController.cls
new file mode 100644
index 0000000..d1c8147
--- /dev/null
+++ b/force-app/main/default/classes/LexInvalidDelegationController.cls
@@ -0,0 +1,143 @@
+public with sharing class LexInvalidDelegationController {
+ public LexInvalidDelegationController() {
+
+ }
+ @AuraEnabled
+ public static InitData init(String recordId){
+ InitData res=new InitData();
+ try{
+
+ Task task=[SELECT Status,Id,QuoteIraiId__c,Answer__c FROM Task where id = :recordId];
+ res.Id=task.Id;
+ res.Status=task.Status;
+ res.QuoteIraiIdC=task.QuoteIraiId__c;
+ res.AnswerC=task.Answer__c;
+ return res;
+ }catch(Exception e){
+ System.debug(LoggingLevel.INFO,'LexInvalidDelegationController init Error : ' + e);
+ }
+ return res;
+ }
+
+
+ @AuraEnabled
+ public static QuoteIrai__c getQuoteIraiC(String recordId){
+ try{
+
+ QuoteIrai__c res=[select id,Lead__r.LatestQuotationEntrustment__c,Lead__r.QuotationDelegationStatus__c, Lead__c from QuoteIrai__c where id = :recordId];
+ return res;
+ }catch(Exception e){
+ System.debug(LoggingLevel.INFO,'LexInvalidDelegationController init Error : ' + e);
+ }
+ return null;
+ }
+
+
+
+ @AuraEnabled
+ public static UpdateResult updateTask(
+ String recordId,
+ String Status
+ ) {
+ UpdateResult result = new UpdateResult();
+ result.recordId = recordId;
+ try{
+ // 鏇存柊璁板綍骞惰幏鍙栫粨鏋�
+ if(recordId==null) return null;
+ Task rac = new Task( id=recordId);
+
+ if(String.isNotBlank(Status)){
+ rac.Status=Status;
+ }
+
+ rac.Request_completed_time__c=System.now();
+ if(rac.id==null)return null;
+ update rac;
+ result.success = true;
+ result.errors = new List<String>();
+ return result;
+ }catch(Exception e){
+ result.success = false;
+ result.errors = new List<String>();
+ result.errors.add(e.getMessage());
+ System.debug(LoggingLevel.INFO,'updateTask update Error : ' + e);
+ }
+ return result;
+ }
+ @AuraEnabled
+ public static UpdateResult updateLead(
+ String recordId,
+ String LatestQuotationEntrustmentC
+ ) {
+ UpdateResult result = new UpdateResult();
+ result.recordId = recordId;
+ try{
+ // 鏇存柊璁板綍骞惰幏鍙栫粨鏋�
+ if(recordId==null) return null;
+ Lead rac = new Lead( id=recordId);
+
+ if(String.isNotBlank(LatestQuotationEntrustmentC)){
+ rac.LatestQuotationEntrustment__c=LatestQuotationEntrustmentC;
+ }
+ if(rac.id==null)return null;
+ update rac;
+ result.success = true;
+ result.errors = new List<String>();
+ return result;
+ }catch(Exception e){
+ result.success = false;
+ result.errors = new List<String>();
+ result.errors.add(e.getMessage());
+ System.debug(LoggingLevel.INFO,'updateLead update Error : ' + e);
+ }
+ return result;
+ }
+ @AuraEnabled
+ public static UpdateResult updateQuoteIraiC(
+ String recordId,
+ String QuoteIraiStatusC
+ ) {
+ UpdateResult result = new UpdateResult();
+ result.recordId = recordId;
+ try{
+ // 鏇存柊璁板綍骞惰幏鍙栫粨鏋�
+ if(recordId==null) return null;
+ QuoteIrai__c rac = new QuoteIrai__c( id=recordId);
+
+ if(String.isNotBlank(QuoteIraiStatusC)){
+ rac.QuoteIrai_Status__c=QuoteIraiStatusC;
+ }
+ if(rac.id==null)return null;
+ update rac;
+ result.success = true;
+ result.errors = new List<String>();
+ return result;
+ }catch(Exception e){
+ result.success = false;
+ result.errors = new List<String>();
+ result.errors.add(e.getMessage());
+ System.debug(LoggingLevel.INFO,'updateQuoteIraiC update Error : ' + e);
+ }
+ return result;
+ }
+
+ @AuraEnabled
+ public static String getProfileId(){
+ return UserInfo.getProfileId();
+ }
+ public class UpdateResult {
+ @AuraEnabled public String recordId {get;set;}
+ @AuraEnabled public Boolean success {get;set;}
+ @AuraEnabled public List<String> errors {get;set;}
+ }
+ public class InitData{
+ @AuraEnabled
+ public String Status{get;set;}
+ @AuraEnabled
+ public String Id{get;set;}
+ @AuraEnabled
+ public String QuoteIraiIdC{get;set;}
+ @AuraEnabled
+ public String AnswerC{get;set;}
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexInvalidDelegationController.cls-meta.xml b/force-app/main/default/classes/LexInvalidDelegationController.cls-meta.xml
new file mode 100644
index 0000000..d75b058
--- /dev/null
+++ b/force-app/main/default/classes/LexInvalidDelegationController.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>51.0</apiVersion>
+ <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/classes/LexRequestCloseController.cls b/force-app/main/default/classes/LexRequestCloseController.cls
new file mode 100644
index 0000000..fd701f9
--- /dev/null
+++ b/force-app/main/default/classes/LexRequestCloseController.cls
@@ -0,0 +1,65 @@
+public with sharing class LexRequestCloseController {
+ public LexRequestCloseController() {
+
+ }
+ @AuraEnabled
+ public static Rental_Apply__c init(String recordId){
+
+ try{
+ }catch(Exception e){
+ System.debug(LoggingLevel.INFO,'Rental_Apply__c Cancel Error : ' + e);
+ }
+ return null;
+ }
+ @AuraEnabled
+ public static UpdateResult updateTask(
+ String recordId,
+ String Status
+ ) {
+ UpdateResult result = new UpdateResult();
+ result.recordId = recordId;
+ try{
+ // 鏇存柊璁板綍骞惰幏鍙栫粨鏋�
+ if(recordId==null) return null;
+ Task rac = new Task( id=recordId);
+
+ if(String.isNotBlank(Status)){
+ rac.Status=Status;
+ }
+
+ rac.Request_completed_time__c=System.now();
+ if(rac.id==null)return null;
+ update rac;
+ result.success = true;
+ result.errors = new List<String>();
+ return result;
+ }catch(Exception e){
+ result.success = false;
+ result.errors = new List<String>();
+ result.errors.add(e.getMessage());
+ System.debug(LoggingLevel.INFO,'Rental_Apply__c update Error : ' + e);
+ }
+ return result;
+ }
+ @AuraEnabled
+ public static String getProfileId(){
+ return UserInfo.getProfileId().substring(0,15);
+ }
+ @AuraEnabled
+ public static List<String> getProfileIds(){
+ List<Profile> res=[SELECT id FROM Profile where name='OBA2_璇环绠$悊' OR name='OBA7_璇环+鎷涙爣绠$悊'];
+ List<String> ids=new List<String>();
+ for (Profile p:res ) {
+ String idd=p.Id;
+
+ ids.add(idd.substring(0,15));
+ }
+
+ return ids;
+ }
+ public class UpdateResult {
+ @AuraEnabled public String recordId {get;set;}
+ @AuraEnabled public Boolean success {get;set;}
+ @AuraEnabled public List<String> errors {get;set;}
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexRequestCloseController.cls-meta.xml b/force-app/main/default/classes/LexRequestCloseController.cls-meta.xml
new file mode 100644
index 0000000..d75b058
--- /dev/null
+++ b/force-app/main/default/classes/LexRequestCloseController.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>51.0</apiVersion>
+ <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/classes/LexTaskCloseController.cls b/force-app/main/default/classes/LexTaskCloseController.cls
new file mode 100644
index 0000000..83dc4e1
--- /dev/null
+++ b/force-app/main/default/classes/LexTaskCloseController.cls
@@ -0,0 +1,125 @@
+public with sharing class LexTaskCloseController {
+ public LexTaskCloseController() {
+
+ }
+ @AuraEnabled
+ public static Task init(String recordId){
+
+ try{
+ Task res=[SELECT QuoteIraiId__c from Task where id= :recordId];
+ return res;
+ }catch(Exception e){
+ System.debug(LoggingLevel.INFO,'Rental_Apply__c Cancel Error : ' + e);
+ }
+ return null;
+ }
+
+ @AuraEnabled
+ public static QuoteIrai__c getQuoteIraic(String recordId) {
+ try{
+ QuoteIrai__c res=[select id,Lead__c from QuoteIrai__c where id = :recordId];
+ return res;
+ }catch(Exception e){
+ System.debug(LoggingLevel.INFO,'Rental_Apply__c Cancel Error : ' + e);
+ }
+ return null;
+ }
+ @AuraEnabled
+ public static UpdateResult updateLead(
+ String recordId,
+ String LatestQuotationEntrustmentc
+ ) {
+ UpdateResult result = new UpdateResult();
+ result.recordId = recordId;
+ try{
+ // 鏇存柊璁板綍骞惰幏鍙栫粨鏋�
+ if(recordId==null) return null;
+ Lead rac = new Lead( id=recordId);
+
+ if(String.isNotBlank(LatestQuotationEntrustmentc)){
+ rac.LatestQuotationEntrustment__c=LatestQuotationEntrustmentc;
+ }
+ if(rac.id==null)return null;
+ update rac;
+ result.success = true;
+ result.errors = new List<String>();
+ return result;
+ }catch(Exception e){
+ result.success = false;
+ result.errors = new List<String>();
+ result.errors.add(e.getMessage());
+ System.debug(LoggingLevel.INFO,'Rental_Apply__c update Error : ' + e);
+ }
+ return result;
+ }
+ @AuraEnabled
+ public static UpdateResult updateQuoteIraic(
+ String recordId,
+ String QuoteIraiStatusc
+ ) {
+ UpdateResult result = new UpdateResult();
+ result.recordId = recordId;
+ try{
+ // 鏇存柊璁板綍骞惰幏鍙栫粨鏋�
+ if(recordId==null) return null;
+ QuoteIrai__c rac = new QuoteIrai__c( id=recordId);
+
+ if(String.isNotBlank(QuoteIraiStatusc)){
+ rac.QuoteIrai_Status__c=QuoteIraiStatusc;
+ }
+ if(rac.id==null)return null;
+ update rac;
+ result.success = true;
+ result.errors = new List<String>();
+ return result;
+ }catch(Exception e){
+ result.success = false;
+ result.errors = new List<String>();
+ result.errors.add(e.getMessage());
+ System.debug(LoggingLevel.INFO,'updateQuoteIraic update Error : ' + e);
+ }
+ return result;
+ }
+ @AuraEnabled
+ public static UpdateResult updateTask(
+ String recordId,
+ String Status
+ ) {
+ UpdateResult result = new UpdateResult();
+ result.recordId = recordId;
+ try{
+ // 鏇存柊璁板綍骞惰幏鍙栫粨鏋�
+ if(recordId==null) return null;
+ Task rac = new Task( id=recordId);
+
+ if(String.isNotBlank(Status)){
+ rac.Status=Status;
+ }
+
+ rac.Request_completed_time__c=System.now();
+ if(rac.id==null)return null;
+ update rac;
+ result.success = true;
+ result.errors = new List<String>();
+ return result;
+ }catch(Exception e){
+ result.success = false;
+ result.errors = new List<String>();
+ result.errors.add(e.getMessage());
+ System.debug(LoggingLevel.INFO,'Rental_Apply__c update Error : ' + e);
+ }
+ return result;
+ }
+ @AuraEnabled
+ public static String getProfileId(){
+ return UserInfo.getProfileId();
+ }
+ public class UpdateResult {
+ @AuraEnabled public String recordId {get;set;}
+ @AuraEnabled public Boolean success {get;set;}
+ @AuraEnabled public List<String> errors {get;set;}
+ }
+ public class InitData{
+ @AuraEnabled public String QuoteIraiId {get;set;}
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexTaskCloseController.cls-meta.xml b/force-app/main/default/classes/LexTaskCloseController.cls-meta.xml
new file mode 100644
index 0000000..d75b058
--- /dev/null
+++ b/force-app/main/default/classes/LexTaskCloseController.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>51.0</apiVersion>
+ <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/lwc/lexInvalidDelegation/lexInvalidDelegation.html b/force-app/main/default/lwc/lexInvalidDelegation/lexInvalidDelegation.html
new file mode 100644
index 0000000..d044dbb
--- /dev/null
+++ b/force-app/main/default/lwc/lexInvalidDelegation/lexInvalidDelegation.html
@@ -0,0 +1,5 @@
+<template>
+ <div class="exampleHolder" if:true={IsLoading}>
+ <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+ </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexInvalidDelegation/lexInvalidDelegation.js b/force-app/main/default/lwc/lexInvalidDelegation/lexInvalidDelegation.js
new file mode 100644
index 0000000..522a43f
--- /dev/null
+++ b/force-app/main/default/lwc/lexInvalidDelegation/lexInvalidDelegation.js
@@ -0,0 +1,177 @@
+import { LightningElement,api, track, wire } from 'lwc';
+import {CurrentPageReference} from 'lightning/navigation';
+import { CloseActionScreenEvent } from 'lightning/actions';
+
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import LightningConfirm from 'lightning/confirm';
+import init from '@salesforce/apex/LexInvalidDelegationController.init';
+import getQuoteIraiC from '@salesforce/apex/LexInvalidDelegationController.getQuoteIraiC';
+import updateTask from '@salesforce/apex/LexInvalidDelegationController.updateTask';
+import updateLead from '@salesforce/apex/LexInvalidDelegationController.updateLead';
+
+export default class lexInvalidDelegation extends LightningElement {
+ @api recordId;
+ @api isDoneRendering;
+ IsLoading=true;
+ isShow=true;
+ Id;
+ Status;
+ QuoteIraiIdC;
+ AnswerC;
+ @wire(CurrentPageReference)
+ getStateParameters(currentPageReference){
+
+ if(currentPageReference){
+ const urvalue=currentPageReference.state.recordId;
+ if(urvalue){
+ let str=`${urvalue}`;
+ this.recordId=str;
+ }
+ }
+ }
+
+
+
+ connectedCallback(){
+ this.dispatchEvent(new CloseActionScreenEvent());
+ this.isDoneRendering=false;
+ init({recordId:this.recordId}).then(result=>{
+ this.Id=this.recordId;
+ this.Status=result.Status;
+ this.QuoteIraiIdC=result.QuoteIraiIdC;
+ this.AnswerC=result.AnswerC;
+ this.cancelSubmit().then(res=>{
+ this.isShow=false;
+ this.IsLoading=false;
+ this.dispatchEvent(new CloseActionScreenEvent());
+ this.isDoneRendering=false;
+ const passOneEvent = new CustomEvent('closem', {
+ 銆�銆�銆�銆�detail: '111'
+ 銆�銆�});
+ 銆�銆�this.dispatchEvent(passOneEvent);
+ });
+ }).catch(err=>{
+ // console.log("error:");
+ // console.log(err.message);
+ }).finally(()=>{
+ this.dispatchEvent(new CloseActionScreenEvent());
+ });
+ }
+
+
+
+ async cancelSubmit(){
+ var flag=false;
+ if(this.Status == '鏈潃鎵�'||this.Status == '閫茶涓�'){
+ this.isDoneRendering=true;
+ if(this.AnswerC ==null || this.AnswerC==''){
+ // alert('璇峰~鍐欏洖绛斿唴瀹�');
+ const event = new ShowToastEvent({
+ title: '鎻愮ず淇℃伅',
+ message:"鎿嶄綔澶辫触:"+'璇峰~鍐欏洖绛斿唴瀹�',
+ });
+ this.dispatchEvent(event);
+ this.isDoneRendering=true;
+ return;
+ }else{
+ var Id = this.recordId;
+ var Status = "鏃犳晥濮旀墭";
+ await updateTask({
+ recordId:Id,
+ Status:Status
+ }).then(res=>{
+ console.log(res);
+
+ if(res!=null&&res.success==false){
+ var messages=res.errors[0];
+ if (messages!=null&&messages!="") {
+ const event = new ShowToastEvent({
+ title: '鎻愮ず淇℃伅',
+ message:"鎿嶄綔澶辫触:"+messages,
+ });
+ this.dispatchEvent(event);
+ flag=true;
+ return;
+ }
+ }
+ }).catch(err=>{
+ // console.log("updateTask error:");
+ // console.log(err.message);
+ });
+ if (flag) {return;}
+ var messages2 = '';
+ if(this.QuoteIraiIdC != null&&this.QuoteIraiIdC !='') {
+ // 鑾峰緱鎶ヤ环濮旀墭
+ var sqlResult2 = await getQuoteIraiC({recordId:this.QuoteIraiIdC});
+ if(sqlResult2!=null&&sqlResult2.Lead__c!=null){
+ //alert(sqlResult2.Lead__r.LatestQuotationEntrustment__c + '|' + sqlResult2.Lead__r.QuotationDelegationStatus__c);
+ if(!sqlResult2.Lead__r.LatestQuotationEntrustment__c || (sqlResult2.Lead__r.LatestQuotationEntrustment__c && sqlResult2.Lead__r.QuotationDelegationStatus__c != '宸叉湁璇环' && sqlResult2.Lead__r.QuotationDelegationStatus__c != '鏇存柊瀹屾瘯')){
+ // Lead鏇存柊
+ await updateLead({
+ recordId:Id,
+ LatestQuotationEntrustmentC:sqlResult2.Lead__r.LatestQuotationEntrustment__c
+ }).then(res=>{
+ if(res!=null&&res.success==false){
+ var messages=res.errors[0];
+ if (messages!=null&&messages!="") {
+ const event = new ShowToastEvent({
+ title: '鎻愮ず淇℃伅',
+ message:"鎿嶄綔澶辫触:"+messages,
+ });
+ this.dispatchEvent(event);
+ flag=true;
+ return;
+ }
+ }
+ }).catch(err=>{
+ // console.log("updateLead error:");
+ // console.log(err.message);
+ });
+ }
+ }
+ if(flag)return;
+ var id = this.QuoteIraiIdC;
+ var QuoteIrai_Status__c = '鏃犳晥濮旀墭';
+ await updateLead({
+ recordId:id,
+ QuoteIraiStatusC:QuoteIrai_Status__c
+ }).then(res=>{
+ if(res!=null&&res.success==false){
+ var messages=res.errors[0];
+ if (messages!=null&&messages!="") {
+ const event = new ShowToastEvent({
+ title: '鎻愮ず淇℃伅',
+ message:"鎿嶄綔澶辫触:"+messages,
+ });
+ this.dispatchEvent(event);
+ flag=true;
+ return;
+ }else{
+ const event = new ShowToastEvent({
+ title: '鎻愮ず淇℃伅',
+ message:'鏇存柊宸插畬鎴�',
+ });
+ this.dispatchEvent(event);
+ return;
+ //鍙戦�佹垚鍔熷悗锛屽笇鏈涜嚜鍔ㄥ埛鏂扮敾闈€��
+ window.location.reload();
+ }
+ }
+ }).catch(err=>{
+ // console.log("updateLead error:");
+ // console.log(err.message);
+ });
+ if (flag) {return;}
+ }
+ }
+ }else{
+ // alert('浠诲姟宸茬粨鏉燂紝濡傞渶淇敼璇疯仈绯荤鐞嗗憳');
+ const event = new ShowToastEvent({
+ title: '鎻愮ず淇℃伅',
+ message:"鎿嶄綔澶辫触:"+'浠诲姟宸茬粨鏉燂紝濡傞渶淇敼璇疯仈绯荤鐞嗗憳',
+ });
+ this.dispatchEvent(event);
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexInvalidDelegation/lexInvalidDelegation.js-meta.xml b/force-app/main/default/lwc/lexInvalidDelegation/lexInvalidDelegation.js-meta.xml
new file mode 100644
index 0000000..45e1fa3
--- /dev/null
+++ b/force-app/main/default/lwc/lexInvalidDelegation/lexInvalidDelegation.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexInvalidDelegation">
+ <apiVersion>51.0</apiVersion>
+ <isExposed>true</isExposed>
+ <targets>
+ <target>lightning__AppPage</target>
+ <target>lightning__RecordPage</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/lexRequestClose/lexRequestClose.css b/force-app/main/default/lwc/lexRequestClose/lexRequestClose.css
new file mode 100644
index 0000000..af18c76
--- /dev/null
+++ b/force-app/main/default/lwc/lexRequestClose/lexRequestClose.css
@@ -0,0 +1,11 @@
+.Holder{
+ position: relative;
+ display: inline-block;
+ width: 80px;
+ height: 80px;
+ text-align: center;
+}
+
+.container .uiContainerManager{
+ display : none !important;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexRequestClose/lexRequestClose.html b/force-app/main/default/lwc/lexRequestClose/lexRequestClose.html
new file mode 100644
index 0000000..35dab7a
--- /dev/null
+++ b/force-app/main/default/lwc/lexRequestClose/lexRequestClose.html
@@ -0,0 +1,5 @@
+<template>
+ <div class="Holder" if:true={IsLoading} >
+ <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+ </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexRequestClose/lexRequestClose.js b/force-app/main/default/lwc/lexRequestClose/lexRequestClose.js
new file mode 100644
index 0000000..6612af3
--- /dev/null
+++ b/force-app/main/default/lwc/lexRequestClose/lexRequestClose.js
@@ -0,0 +1,95 @@
+import { LightningElement,api, track, wire } from 'lwc';
+import { CurrentPageReference } from 'lightning/navigation';
+import { CloseActionScreenEvent } from 'lightning/actions';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import LightningConfirm from 'lightning/confirm';
+import init from '@salesforce/apex/LexRequestCloseController.init';
+import getProfileId from '@salesforce/apex/LexRequestCloseController.getProfileId';
+import updateTask from '@salesforce/apex/LexRequestCloseController.updateTask';
+import getProfileIds from '@salesforce/apex/LexRequestCloseController.getProfileIds';
+
+
+export default class lexRequestClose extends LightningElement {
+ @api recordId;
+ @api isDoneRendering;
+ IsLoading=true;
+ isShow=true;
+ @wire(CurrentPageReference)
+ getStateParameters(currentPageReference){
+ console.log("杩涘叆椤甸潰");
+ console.log(currentPageReference);
+ if(currentPageReference){
+ const urvalue=currentPageReference.state.recordId;
+ if(urvalue){
+ let str=`${urvalue}`;
+ this.recordId=str;
+ }
+ }
+ }
+
+
+
+ connectedCallback(){
+ this.dispatchEvent(new CloseActionScreenEvent());
+ console.log(this.recordId);
+ init({recordId:this.recordId}).then(result=>{
+ // this.dispatchEvent(new CloseActionScreenEvent());
+ this.cancelSubmit().then(res=>{
+ this.isShow=false;
+ this.IsLoading=false;
+ this.dispatchEvent(new CloseActionScreenEvent());
+ const passOneEvent = new CustomEvent('closem', {
+ 銆�銆�銆�銆�detail: '111'
+ 銆�銆�});
+ 銆�銆�this.dispatchEvent(passOneEvent);
+ });
+ }).catch(err=>{
+ // console.log("error:");
+ // console.log(err.message);
+ }).finally(()=>{
+ this.dispatchEvent(new CloseActionScreenEvent());
+ });
+ }
+
+
+
+ async cancelSubmit(){
+ var pro = await getProfileId();
+ var fag = true;
+ var ids = await getProfileIds();
+ // pro='00e10000000s3Jp';
+ if( ids.indexOf(pro) == -1 ){
+ fag=false;
+ const event = new ShowToastEvent({
+ title: '鎻愮ず淇℃伅',
+ message:'涓嶉渶瑕佸仛鎺堟潈纭',
+ });
+ this.dispatchEvent(event);
+ }
+ if(fag){
+ var Id = this.recordId;
+ var Status = "瀹屼簡"; await updateTask({
+ recordId:Id,
+ Status:Status
+ }).then(res=>{
+ if(res!=null&&res.success==false){
+ var messages=res.errors[0];
+ if (messages!=null&&messages!="") {
+ const event = new ShowToastEvent({
+ title: '鎻愮ず淇℃伅',
+ message:"鎿嶄綔澶辫触,鎻愮ず淇℃伅:"+messages,
+ });
+ this.dispatchEvent(event);
+ return;
+ }
+ }
+ else this.dispatchEvent(new CloseActionScreenEvent());
+ }).catch(err=>{
+ // console.log("updateRentalApplyC error:");
+ // console.log(err.message);
+ });
+ window.location.reload();
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexRequestClose/lexRequestClose.js-meta.xml b/force-app/main/default/lwc/lexRequestClose/lexRequestClose.js-meta.xml
new file mode 100644
index 0000000..b2f518d
--- /dev/null
+++ b/force-app/main/default/lwc/lexRequestClose/lexRequestClose.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexRequestClose">
+ <apiVersion>51.0</apiVersion>
+ <isExposed>true</isExposed>
+ <targets>
+ <target>lightning__AppPage</target>
+ <target>lightning__RecordPage</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/lexTaskClose/lexTaskClose.css b/force-app/main/default/lwc/lexTaskClose/lexTaskClose.css
new file mode 100644
index 0000000..af18c76
--- /dev/null
+++ b/force-app/main/default/lwc/lexTaskClose/lexTaskClose.css
@@ -0,0 +1,11 @@
+.Holder{
+ position: relative;
+ display: inline-block;
+ width: 80px;
+ height: 80px;
+ text-align: center;
+}
+
+.container .uiContainerManager{
+ display : none !important;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexTaskClose/lexTaskClose.html b/force-app/main/default/lwc/lexTaskClose/lexTaskClose.html
new file mode 100644
index 0000000..35dab7a
--- /dev/null
+++ b/force-app/main/default/lwc/lexTaskClose/lexTaskClose.html
@@ -0,0 +1,5 @@
+<template>
+ <div class="Holder" if:true={IsLoading} >
+ <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+ </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexTaskClose/lexTaskClose.js b/force-app/main/default/lwc/lexTaskClose/lexTaskClose.js
new file mode 100644
index 0000000..6445834
--- /dev/null
+++ b/force-app/main/default/lwc/lexTaskClose/lexTaskClose.js
@@ -0,0 +1,132 @@
+import { LightningElement,api, track, wire } from 'lwc';
+import {CurrentPageReference} from 'lightning/navigation';
+import { CloseActionScreenEvent } from 'lightning/actions';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import LightningConfirm from 'lightning/confirm';
+import init from '@salesforce/apex/LexTaskCloseController.init';
+import getProfileId from '@salesforce/apex/LexTaskCloseController.getProfileId';
+import updateQuoteIraic from '@salesforce/apex/LexTaskCloseController.updateQuoteIraic';
+import updateTask from '@salesforce/apex/LexTaskCloseController.updateTask';
+import getQuoteIraic from '@salesforce/apex/LexTaskCloseController.getQuoteIraic';
+export default class lexTaskClose extends LightningElement {
+ @api recordId;
+ @api isDoneRendering;
+ IsLoading=true;
+ QuoteIraiId;
+
+ @wire(CurrentPageReference)
+ getStateParameters(currentPageReference){
+ console.log("杩涘叆椤甸潰");
+ console.log(currentPageReference);
+ if(currentPageReference){
+ const urvalue=currentPageReference.state.recordId;
+ if(urvalue){
+ let str=`${urvalue}`;
+ this.recordId=str;
+ }
+ }
+ }
+
+
+
+ connectedCallback(){
+ this.dispatchEvent(new CloseActionScreenEvent());
+ init({recordId:this.recordId}).then(result=>{
+ this.QuoteIraiId=result.Id;
+ this.cancelSubmit().then(res=>{
+ this.IsLoading=false;
+ const passOneEvent = new CustomEvent('closem', {
+ 銆�銆�銆�銆�detail: '111'
+ 銆�銆�});
+ 銆�銆�this.dispatchEvent(passOneEvent);
+ });
+ }).catch(err=>{
+ // console.log("error:");
+ // console.log(err.message);
+ }).finally(()=>{
+ this.dispatchEvent(new CloseActionScreenEvent());
+ });
+ }
+
+
+
+ async cancelSubmit(){
+ var re = await getQuoteIraic({recordId:this.QuoteIraiId});
+ if(re!=null&&re.Lead__c){
+ // Lead浣滄垚
+ var Id = re.Lead__c;
+ if(this.QuoteIraiId != '') {
+ var LatestQuotationEntrustment__c=this.QuoteIraiId;
+ // Lead鏇存柊
+ await updateLead({
+ recordId:Id,
+ LatestQuotationEntrustmentc:LatestQuotationEntrustment__c
+ }).then(res=>{
+ console.log(res);
+ if(res!=null&&res.success==false){
+ var messages=res.errors[0];
+ if (messages!=null&&messages!="") {
+ const event = new ShowToastEvent({
+ title: '鎻愮ず淇℃伅',
+ message:"鎿嶄綔澶辫触,鎻愮ず淇℃伅:"+messages,
+ });
+ this.dispatchEvent(event);
+ return;
+ }
+ }
+ }).catch(err=>{
+ // console.log("updateLead error:");
+ // console.log(err.message);
+ });
+ }
+ }
+ if(this.QuoteIraiId != '') {
+ var id =this.QuoteIraiId;
+ var QuoteIrai_Status__c = '鏇存柊瀹屾瘯';
+ await updateQuoteIraic({
+ recordId:Id,
+ QuoteIraiStatusc:QuoteIrai_Status__c
+ }).then(res=>{
+ console.log(res);
+ if(res!=null&&res.success==false){
+ var messages=res.errors[0];
+ if (messages!=null&&messages!="") {
+ const event = new ShowToastEvent({
+ title: '鎻愮ず淇℃伅',
+ message:"鎿嶄綔澶辫触,鎻愮ず淇℃伅:"+messages,
+ });
+ this.dispatchEvent(event);
+ return;
+ }
+ }
+ }).catch(err=>{
+ // console.log("updateLead error:");
+ // console.log(err.message);
+ });
+ }
+ var Id = this.recordId;
+ var Status = "瀹屼簡";
+ await updateTask({
+ recordId:Id,
+ Status:Status
+ }).then(res=>{
+ console.log(res);
+ if(res!=null&&res.success==false){
+ var message=res.errors[0];
+ if (messages!=null&&messages!="") {
+ const event = new ShowToastEvent({
+ title: '鎻愮ず淇℃伅',
+ message:"鎿嶄綔澶辫触,鎻愮ず淇℃伅:"+messages,
+ });
+ this.dispatchEvent(event);
+ return;
+ }
+ }
+ }).catch(err=>{
+ // console.log("updateLead error:");
+ // console.log(err.message);
+ });
+ window.location.reload();
+ }
+
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexTaskClose/lexTaskClose.js-meta.xml b/force-app/main/default/lwc/lexTaskClose/lexTaskClose.js-meta.xml
new file mode 100644
index 0000000..82c49cb
--- /dev/null
+++ b/force-app/main/default/lwc/lexTaskClose/lexTaskClose.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexTaskClose">
+ <apiVersion>51.0</apiVersion>
+ <isExposed>true</isExposed>
+ <targets>
+ <target>lightning__AppPage</target>
+ <target>lightning__RecordPage</target>
+ <target>lightning__HomePage</target>
+ <target>lightning__RecordAction</target>
+ </targets>
+</LightningComponentBundle>
\ No newline at end of file
--
Gitblit v1.9.1