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';
|
import lwcCSS from '@salesforce/resourceUrl/lwcCSS';
|
import {loadStyle} from 'lightning/platformResourceLoader';
|
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(){
|
|
Promise.all([
|
loadStyle(this, lwcCSS)
|
]);
|
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({
|
message:'上级分配的任务不能取消',
|
variant: 'warning',
|
mode: 'sticky'
|
});
|
this.dispatchEvent(event);
|
}else{
|
var date=new Date();
|
if((date > this.StartDateTime) || IsHasEventC && (date = this.StartDateTime)){
|
const event = new ShowToastEvent({
|
message:'不允许修改今天及以前的事件',
|
variant: 'warning',
|
mode: 'sticky'
|
});
|
this.dispatchEvent(event);
|
}else if(this.EventStatus__c!=null && this.EventStatus__c!='' && this.EventStatus__c != '02 接受' ){
|
const event = new ShowToastEvent({
|
message:'不允许修改本事件',
|
variant: 'warning',
|
mode: 'sticky'
|
});
|
this.dispatchEvent(event);
|
}else{
|
window.location.href= "/apex/SimpleEventRegister?Id="+this.recordId;
|
// window.open(url,'lexEventAdvance', 'width=1000,height=500');
|
}
|
//2021-10-08 mzy 任务管理改善 已完成的任务,事件页面和日报页面不允许修改 end
|
}
|
}
|
|
}
|