import { LightningElement,api, track, wire } from 'lwc';
|
// {!RequireScript("/resource/CommonUtilJs")}
|
import {CurrentPageReference} from 'lightning/navigation';
|
import { CloseActionScreenEvent } from 'lightning/actions';
|
import LightningConfirm from 'lightning/confirm';
|
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
|
export default class lexStockCancel extends LightningElement {
|
|
@api recordId;
|
IsLoading=true
|
@wire(CurrentPageReference)
|
getStateParameters(currentPageReference){
|
console.log("进入页面");
|
console.log(currentPageReference);
|
if(currentPageReference){
|
const urvalue=currentPageReference.state.recordId;
|
if(urvalue){
|
let str=`${urvalue}`;
|
console.log('str');
|
console.log(str);
|
this.recordId=str;
|
}
|
}
|
}
|
|
|
async connectedCallback(){
|
console.log(this.recordId);
|
await init({recordId:this.recordId}).then(result=>{
|
console.log(result);
|
if(result!=null){
|
|
this.sumit().then(res=>{
|
console.log("关闭窗口");
|
this.IsLoading=false;
|
this.dispatchEvent(new CloseActionScreenEvent());
|
}).catch(err=>{
|
console.log("error:");
|
console.log(err.message);
|
const event = new ShowToastEvent({
|
title: '提示信息',
|
message:"操作失败,提示信息:"+err.message,
|
});
|
this.dispatchEvent(event);
|
//alert("操作失败,提示信息:"+err.message);
|
});
|
console.log("end");
|
}
|
}).catch(err=>{
|
console.log("error:");
|
console.log(err.message);
|
console.log("报错结束");
|
}).finally(()=>{
|
console.log("finally");
|
|
});
|
|
}
|
|
|
async sumit(){
|
|
// var reason = '{!Opportunity.Stock_cancel_reason__c}';
|
// if (reason == null || reason == '') {
|
// alert('必须填写撤销备货理由。');
|
// return
|
// }
|
|
// // CHAN-BCS8T5 LHJ 20190604 Start
|
// var stage = '{!Opportunity.Whether_Upload_Question_Document__c}';
|
// if (stage == '0') {
|
// alert('请上传质疑函。');
|
// return;
|
// }
|
// // CHAN-BCS8T5 LHJ 20190604 End
|
|
// if (!confirm("一旦提交此记录以待批准,根据您的设置您可能不再能够编辑此记录或将他从批准过程中调回。是否继续?")) {
|
// return;
|
// }
|
|
// var rac = new sforce.SObject("Opportunity");
|
// rac.Id = "{!Opportunity.Id}";
|
// rac.Stock_apply_status__c = "撤销填写完毕";
|
// var result = sforce.connection.update([rac]);
|
// var messages = getConnectDMLErrorMessages(result);
|
// if (messages.length > 0) {
|
// alert(messages.join("\n"));
|
// return;
|
// }
|
|
// var request = new sforce.ProcessSubmitRequest();
|
// request.objectId = "{!Opportunity.Id}";
|
// var processResults = sforce.connection.process([request]);
|
// if (processResults[0].errors != null) {
|
// var back = new sforce.SObject("Opportunity");
|
// back.Id = "{!Opportunity.Id}";
|
// back.Stock_apply_status__c = "批准";
|
// var backResult = sforce.connection.update([back]);
|
// backMessages = getConnectDMLErrorMessages(backResult);
|
// if (backMessages.length > 0) {
|
// alert(backMessages.join("\n"));
|
// return;
|
// }
|
|
// var errmsg = processResults[0].errors.message.toString();
|
// alert(errmsg);
|
// return;
|
// }
|
// window.location.reload();
|
// };
|
}
|
}
|