force-app/main/default/classes/LexEventCancelController.cls
New file @@ -0,0 +1,45 @@ public with sharing class LexEventCancelController { public LexEventCancelController() { } @AuraEnabled public static Event init(String recordId){ try{ Event res=[SELECT Id,EventC_ID__c,Task_ID__c,StartDateTime,EventStatus__c from Event where id= :recordId]; if(res.Task_ID__c==null)res.Task_ID__c=''; if(res.EventStatus__c==null)res.EventStatus__c=''; if(res.EventC_ID__c==null)res.EventC_ID__c=''; return res; }catch(Exception e){ System.debug(LoggingLevel.INFO,'LexEventCancelController Error : ' + e); } return null; } @AuraEnabled public static Task__c getTaskC(String recordId) { if(String.isBlank(recordId))return null; try{ Task__c res=[SELECT id,taskStatus__c,taskDifferent__c FROM Task__c where id = :recordId]; return res; }catch(Exception e){ System.debug(LoggingLevel.INFO,'Rental_Apply__c Cancel Error : ' + e); } return null; } @AuraEnabled public static List<Task__c> getTaskC1(String recordId) { try{ List<Task__c> res=[select id from task__c where id = :recordId and taskStatus__c = '03 完成' ]; return res; }catch(Exception e){ System.debug(LoggingLevel.INFO,'Rental_Apply__c Cancel Error : ' + e); } return null; } public class InitData{ @AuraEnabled public String EventCIDC {get;set;} @AuraEnabled public String TaskIDC {get;set;} } } force-app/main/default/classes/LexEventCancelController.cls-meta.xml
New file @@ -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> force-app/main/default/lwc/lexEventAdvance/lexEventAdvance.html
New file @@ -0,0 +1,5 @@ <template> <div class="Attachment" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> </template> force-app/main/default/lwc/lexEventAdvance/lexEventAdvance.js
New file @@ -0,0 +1,94 @@ 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/LexEventCancelController.init'; import getTaskC1 from '@salesforce/apex/LexEventCancelController.getTaskC1'; export default class lexEventAdvance extends LightningElement { @api recordId; @api isDoneRendering; IsLoading=true; QuoteIraiId; EventC_ID__c; Task_ID__c; StartDateTime; EventStatus__c; @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.EventC_ID__c=result.EventC_ID__c; this.Task_ID__c=result.Task_ID__c; this.StartDateTime=result.StartDateTime; this.EventStatus__c=result.EventStatus__c; 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(){ //2021-07-28 mzy update //判断是否有生成报告一览 var IsHasEventC = this.EventC_ID__c==''?false:true; //2021-07-28 mzy update //2021-10-08 mzy 任务管理改善 已完成的任务,事件页面和日报页面不允许修改 start var TaskCount = await getTaskC1({recordId:this.Task_ID__c}); if(TaskCount!=null&&TaskCount.size>0){ // alert('上级分配的任务不能取消'); const event = new ShowToastEvent({ title: '提示信息', message:"操作失败:"+' ', }); this.dispatchEvent(event); }else{ var date=new Date(); if((date > this.StartDateTime) || IsHasEventC && (date = this.StartDateTime)){ const event = new ShowToastEvent({ title: '提示信息', message:"操作失败:"+'不允许修改今天及以前的事件', }); this.dispatchEvent(event); }else if(this.EventStatus__c!=null && this.EventStatus__c!='' && this.EventStatus__c != '02 接受' ){ const event = new ShowToastEvent({ title: '提示信息', message:"操作失败:"+'不允许修改本事件', }); this.dispatchEvent(event); }else{ var url= "/apex/SimpleEventRegister?Id="+this.recordId; window.open(url,'lexEventAdvance', 'width=1000,height=500'); } //2021-10-08 mzy 任务管理改善 已完成的任务,事件页面和日报页面不允许修改 end } } } force-app/main/default/lwc/lexEventAdvance/lexEventAdvance.js-meta.xml
New file @@ -0,0 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexEventAdvance"> <apiVersion>51.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexEventCancel/lexEventCancel.html
New file @@ -0,0 +1,5 @@ <template> <div class="Attachment" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> </template> force-app/main/default/lwc/lexEventCancel/lexEventCancel.js
New file @@ -0,0 +1,100 @@ 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/LexEventCancelController.init'; import getTaskC from '@salesforce/apex/LexEventCancelController.getTaskC'; export default class lexEventCancel extends LightningElement { @api recordId; @api isDoneRendering; IsLoading=true; QuoteIraiId; EventC_ID__c; Task_ID__c; StartDateTime; EventStatus__c; @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.EventC_ID__c=result.EventC_ID__c; this.Task_ID__c=result.Task_ID__c; this.StartDateTime=result.StartDateTime; this.EventStatus__c=result.EventStatus__c; 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(){ //2021-07-28 mzy update //判断是否有生成报告一览 var IsHasEventC = this.EventC_ID__c==''?false:true; //2021-07-28 mzy update //2021-10-08 mzy 任务管理改善 已完成的任务,事件页面和日报页面不允许修改 start var TaskCount = await getTaskC({recordId:this.Task_ID__c}); if(TaskCount!=null&&TaskCount.taskDifferent__c == '上级分配任务'){ const event = new ShowToastEvent({ title: '提示信息', message:"操作失败:"+'上级分配的任务不能取消', }); this.dispatchEvent(event); }else if(TaskCount!=null&&TaskCount.taskStatus__c == '03 完成'){ const event = new ShowToastEvent({ title: '提示信息', message:"操作失败:"+'已完成的任务不能修改', }); this.dispatchEvent(event); }else{ var date=new Date(); if( ( date > this.StartDateTime ) || IsHasEventC && ( date = this.StartDateTime ) ){ // alert('不允许修改今天及以前的事件'); const event = new ShowToastEvent({ title: '提示信息', message:"操作失败:"+'不允许修改今天及以前的事件', }); this.dispatchEvent(event); }else if(this.EventStatus__c!=null && this.EventStatus__c!='' && this.EventStatus__c != '02 接受' ){ // alert('不允许修改本事件'); const event = new ShowToastEvent({ title: '提示信息', message:"操作失败:"+'不允许修改本事件', }); this.dispatchEvent(event); }else{ window.open("/apex/EventHandle?Id="+this.recordId+"&isEventCancel=true",'lexEventCancel'); } //2021-10-08 mzy 任务管理改善 已完成的任务,事件页面和日报页面不允许修改 end } } } force-app/main/default/lwc/lexEventCancel/lexEventCancel.js-meta.xml
New file @@ -0,0 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexEventCancel"> <apiVersion>51.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexEventDelay/lexEventDelay.html
New file @@ -0,0 +1,5 @@ <template> <div class="Attachment" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> </template> force-app/main/default/lwc/lexEventDelay/lexEventDelay.js
New file @@ -0,0 +1,104 @@ 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/LexEventCancelController.init'; import getTaskC from '@salesforce/apex/LexEventCancelController.getTaskC'; export default class lexEventDelay extends LightningElement { @api recordId; @api isDoneRendering; IsLoading=true; QuoteIraiId; EventC_ID__c; Task_ID__c; StartDateTime; EventStatus__c; @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.EventC_ID__c=result.EventC_ID__c; if(result.Task_ID__c==null)this.Task_ID__c=''; else this.Task_ID__c=result.Task_ID__c; this.StartDateTime=result.StartDateTime; this.EventStatus__c=result.EventStatus__c; this.QuoteIraiId=result.Id; this.cancelSubmit().then(res=>{ console.log(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(){ //2021-07-28 mzy update //判断是否有生成报告一览 var IsHasEventC = this.EventC_ID__c==''?false:true; //2021-07-28 mzy update //2021-10-08 mzy 任务管理改善 已完成的任务,事件页面和日报页面不允许修改 start var TaskCount = await getTaskC({recordId:this.Task_ID__c}); if(TaskCount!=null&&TaskCount.taskDifferent__c == '上级分配任务'){ // if(TaskCount!=null&&TaskCount.taskDifferent__c == '主动任务'){ const event = new ShowToastEvent({ variant: 'error', message:"操作失败:"+'上级分配的任务不能延期', }); this.dispatchEvent(event); }else if(TaskCount!=null&&TaskCount.taskStatus__c == '03 完成'){ const event = new ShowToastEvent({ variant: 'error', message:"操作失败:"+'已完成的任务不能修改', }); this.dispatchEvent(event); }else{ var date=new Date(); if((date > this.StartDateTime) || IsHasEventC && (date = this.StartDateTime)){ const event = new ShowToastEvent({ variant: 'error', message:"操作失败:"+'不允许修改今天及以前的事件', }); this.dispatchEvent(event); }else if(this.EventStatus__c!=null && this.EventStatus__c!='' && this.EventStatus__c != '02 接受' ){ const event = new ShowToastEvent({ variant: 'error', message:"操作失败:"+'不允许修改本事件', }); this.dispatchEvent(event); }else{ var url= "/apex/EventHandle?Id="+this.recordId+"&isEventDelay=true"; window.open(url,'lexEventDelay'); // window.open("/apex/EventHandle?Id="+this.recordId+"&isEventDelay=true",'lexEventCancel', 'width=1000,height=500'); } //2021-07-28 mzy update } } } force-app/main/default/lwc/lexEventDelay/lexEventDelay.js-meta.xml
New file @@ -0,0 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexEventDelay"> <apiVersion>51.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle>