/*
|
* @Date: 2023-03-28 13:58:54
|
* @Author: @zyh
|
* @LastEditTime: 2023-04-17 16:40:08
|
* @Descripttion:
|
*/
|
import { LightningElement,wire,track,api } from 'lwc';
|
import { CurrentPageReference } from "lightning/navigation";
|
import { CloseActionScreenEvent } from 'lightning/actions';
|
import { NavigationMixin } from 'lightning/navigation';
|
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
|
import init from '@salesforce/apex/OPDLwcController.initOPDCancelSubmit';
|
import changeTrade from '@salesforce/apex/OpdPlanWebService.changeTrade';
|
|
export default class OpdReportSubmit extends LightningElement {
|
@api recordId;
|
Status;
|
Name;
|
Id;
|
Rental_Apply1_Status_New;
|
Rental_Apply2_Status_New;
|
Rental_Apply3_Status_New;
|
Rental_Apply4_Status_New;
|
Rental_Apply5_Status_New;
|
Related_Opportunity1_ID;
|
Related_Opportunity1_Name;
|
Related_Opportunity2_ID;
|
Related_Opportunity2_Name;
|
Activity_Type2;
|
Account_Laboratory;
|
OCM_category_ID;
|
OCM_category_Name;
|
HospitalID;
|
HospitalName;
|
Rental_Apply2;
|
IsLoading = true;
|
|
@wire(CurrentPageReference)
|
getStateParmeters(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(){
|
console.log('zheli'+this.recordId);
|
init({
|
recordId: this.recordId
|
}).then(result => {
|
console.log('zheli11'+result);
|
|
console.log(result);
|
console.log('123123111' + result.Related_Opportunity1_ID);
|
if(result != null) {
|
this.IsLoading = false;
|
this.Id = result.Id;
|
this.Status = result.Status;
|
this.Name = result.Name;
|
this.Rental_Apply1_Status_New = result.Rental_Apply1_Status_New;
|
this.Rental_Apply2_Status_New = result.Rental_Apply2_Status_New;
|
this.Rental_Apply3_Status_New = result.Rental_Apply3_Status_New;
|
this.Rental_Apply4_Status_New = result.Rental_Apply4_Status_New;
|
this.Rental_Apply5_Status_New = result.Rental_Apply5_Status_New;
|
this.Related_Opportunity1_ID = result.Related_Opportunity1_ID;
|
this.Related_Opportunity1_Name = result.Related_Opportunity1_Name;
|
this.Related_Opportunity2_ID = result.Related_Opportunity2_ID;
|
this.Related_Opportunity2_Name = result.Related_Opportunity2_Name;
|
this.Activity_Type2 = result.Activity_Type2;
|
this.Account_Laboratory = result.Account_Laboratory;
|
this.OCM_category_ID = result.OCM_category_ID;
|
this.OCM_category_Name = result.OCM_category_Name;
|
this.HospitalID = result.HospitalID;
|
this.HospitalName = result.HospitalName;
|
this.Rental_Apply2 = result.Rental_Apply2;
|
console.log("123");
|
console.log(this.Id);
|
console.log(this.Status);
|
console.log(this.Name);
|
console.log(this.Rental_Apply2_Status_New);
|
this.opdReportSubmit();
|
this.dispatchEvent(new CloseActionScreenEvent());
|
}
|
}).catch(error => {
|
console.log("error");
|
console.log(error);
|
}).finally(() => {
|
|
});
|
}
|
opdReportSubmit(){
|
if(this.Status == '取消' || this.Status == '完毕' ){
|
const evt = new ShowToastEvent({
|
title : 'Error',
|
message : 'OPD计划的状态为取消或完毕时,不能新建OPD报告',
|
variant : 'error'
|
});
|
this.dispatchEvent(evt);
|
// alert('OPD计划的状态为取消或完毕时,不能新建OPD报告');
|
return;
|
}
|
if( this.Rental_Apply1_Status_New != "已出库" && this.Rental_Apply1_Status_New != "申请者已收货" &&
|
this.Rental_Apply1_Status_New != "医院已装机确认" && this.Rental_Apply1_Status_New != "已回寄" &&
|
this.Rental_Apply1_Status_New != "已回收" && this.Rental_Apply1_Status_New != "完了" && this.Rental_Apply1_Status_New != "欠品中" &&
|
this.Rental_Apply2_Status_New != "已出库" && this.Rental_Apply2_Status_New != "申请者已收货" &&
|
this.Rental_Apply2_Status_New != "医院已装机确认" && this.Rental_Apply2_Status_New != "已回寄" &&
|
this.Rental_Apply2_Status_New != "已回收" && this.Rental_Apply2_Status_New != "完了" && this.Rental_Apply2_Status_New != "欠品中" &&
|
this.Rental_Apply3_Status_New != "已出库" && this.Rental_Apply3_Status_New != "申请者已收货" &&
|
this.Rental_Apply3_Status_New != "医院已装机确认" && this.Rental_Apply3_Status_New != "已回寄" &&
|
this.Rental_Apply3_Status_New != "已回收" && this.Rental_Apply3_Status_New != "完了" && this.Rental_Apply3_Status_New != "欠品中" &&
|
this.Rental_Apply4_Status_New != "已出库" && this.Rental_Apply4_Status_New != "申请者已收货" &&
|
this.Rental_Apply4_Status_New != "医院已装机确认" && this.Rental_Apply4_Status_New != "已回寄" &&
|
this.Rental_Apply4_Status_New != "已回收" && this.Rental_Apply4_Status_New != "完了" && this.Rental_Apply4_Status_New != "欠品中" &&
|
this.Rental_Apply5_Status_New != "已出库" && this.Rental_Apply5_Status_New != "申请者已收货" &&
|
this.Rental_Apply5_Status_New != "医院已装机确认" && this.Rental_Apply5_Status_New != "已回寄" &&
|
this.Rental_Apply5_Status_New != "已回收" && this.Rental_Apply5_Status_New != "完了" && this.Rental_Apply5_Status_New != "欠品中"
|
){
|
const evt = new ShowToastEvent({
|
title : 'Error',
|
message : '没有出库的申请不允许创建OPD报告!',
|
variant : 'error'
|
});
|
this.dispatchEvent(evt);
|
// alert("没有出库的申请不允许创建OPD报告!");
|
// return;
|
}
|
var strs='';
|
if(""!=this.Related_Opportunity1_ID && null!=this.Related_Opportunity1_ID){
|
strs='&CF00N10000002DT68='+this.Related_Opportunity1_Name +
|
'&CF00N10000002DT68_lkid='+ this.Related_Opportunity1_ID +
|
'&CF00N10000002DYCZ=' + this.Related_Opportunity2_Name +
|
'&CF00N10000002DYCZ_lkid=' + this.Related_Opportunity2_ID +
|
'&00N10000002DHk5=跟进询价'
|
// alert('123');
|
}
|
var urlStr = '';
|
|
urlStr += '&CF00N10000002CWW4='+ this.Account_Laboratory +
|
'&CF00N10000002CWW4_lkid='+ this.Account_Laboratory +
|
'&CF00N10000002Dh0f_lkid='+ this.OCM_category_ID +
|
'&CF00N10000002Dh0f='+ this.OCM_category_Name +
|
'&CF00N10000002DPUD_lkid='+ this.HospitalID +
|
'&CF00N10000002DPUD='+ this.HospitalName;
|
|
urlStr += '&CF00N10000004maf3='+ this.Rental_Apply2 +
|
'&CF00N10000008ps6d='+ this.Name +
|
'&CF00N10000008ps6d_lkid=' + this.Id;
|
window.open('/setup/ui/recordtypeselect.jsp?ent=01I10000000SWfe&retURL=%2F'+ this.Id +'&save_new_url=%2Fa0B%2Fe%3FretURL%3D%252Fa0B%252Fo'+urlStr +strs)
|
}
|
}
|