/*
|
* @Description:
|
* @version:
|
* @Author: chen jing wu
|
* @Date: 2023-06-21 11:23:56
|
* @LastEditors: chen jing wu
|
* @LastEditTime: 2023-06-21 17:51:15
|
*/
|
import { api, wire,LightningElement } from 'lwc';
|
import { CurrentPageReference } from "lightning/navigation";
|
import { CloseActionScreenEvent } from 'lightning/actions';
|
import init from '@salesforce/apex/lexSolutionProjectRequirementsController.initForClosingCaseFlowButton';
|
import updateForClosingCaseFlowButton from '@salesforce/apex/lexSolutionProjectRequirementsController.updateForClosingCaseFlowButton';
|
import queryForSolutionProgramme from '@salesforce/apex/lexSolutionProjectRequirementsController.queryForSolutionProgramme';
|
import queryForAttachments1 from '@salesforce/apex/lexSolutionProjectRequirementsController.queryForAttachments1';
|
import { updateRecord } from 'lightning/uiRecordApi';
|
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
|
|
export default class LexClosingCaseFlow extends LightningElement {
|
@api recordId;
|
status;
|
profileId;
|
m2ProfileId;
|
IsLoading = true;
|
msg;
|
connectedCallback(){
|
init({
|
recordId: this.recordId
|
}).then(result=>{
|
this.status = result.status;
|
this.profileId = result.profileId;
|
this.m2ProfileId = result.m2ProfileId;
|
this.closingCase();
|
});
|
}
|
closingCase(){
|
if(this.profileId != this.m2ProfileId){
|
this.msg = '只有GIR窗口可以结案';
|
this.Isloading = false;
|
return;
|
}else if(this.status == '07结案'){
|
this.msg = '该项目已经结案';
|
this.Isloading = false;
|
return;
|
}else{
|
queryForSolutionProgramme({
|
recordId: this.recordId
|
}).then(result=>{
|
var Solprogramme = result;
|
if(Solprogramme.length > 0){
|
if(Solprogramme[0].ApprovalClosingProgramme__c != 'true'){
|
this.msg = '结案方案还未通过审批,不能结案';
|
this.Isloading = false;
|
return;
|
}else{
|
queryForAttachments1({
|
recordId: this.recordId
|
}).then(result=>{
|
var records= result;
|
if(records.length > 0){
|
updateForClosingCaseFlowButton({
|
recordId: this.recordId
|
}).then(result=>{
|
if(result){
|
this.msg = result;
|
this.Isloading = false;
|
return;
|
}
|
this.closeAction();
|
});
|
}else{
|
this.msg = '结案前请先新建并上传结案附件';
|
this.Isloading = false;
|
return;
|
}
|
});
|
}
|
}else{
|
this.msg = '没有结案方案不能结案';
|
this.Isloading = false;
|
return;
|
}
|
});
|
|
}
|
}
|
closeAction(){
|
window.open("/"+this.recordId,'_self');
|
}
|
}
|