import { LightningElement,wire,track } from 'lwc';
|
import { CurrentPageReference } from 'lightning/navigation';
|
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
|
import { NavigationMixin } from 'lightning/navigation';
|
import init from '@salesforce/apex/LexArriveGsDetailsController.init';
|
import proSale from '@salesforce/apex/LexArriveGsDetailsController.proSale';
|
|
export default class LexArriveGsDetails extends NavigationMixin(LightningElement) {
|
|
@track eSetId;
|
@track showSpinner = true;
|
@track showPage = false;
|
@track accountid;
|
@track orderallcount;
|
@track consumableorderdetailsCount;
|
@track arrivetoorder = false;
|
@track coc;
|
@track consumableorderdetailsRecords = [];
|
@track colms = [
|
{label:'消耗品名称' , fieldName:'prodName', hideDefaultActions: true,initialWidth:200},
|
{label:'规格' , fieldName:'packing_list', hideDefaultActions: true},
|
{label:'CFDA状态' , fieldName:'statusCFDA', hideDefaultActions: true},
|
{label:'注册证编码号' , fieldName:'approbation_No', hideDefaultActions: true},
|
{label:'注册证效期' , fieldName:'expiration_DateStr', hideDefaultActions: true},
|
{label:'使用期限' , fieldName:'Sterilization_limitStr', hideDefaultActions: true},
|
{label:'BarCode' , fieldName:'barCode', hideDefaultActions: true,initialWidth:200},
|
{label:'采购单价' , fieldName:'intraTradeList', hideDefaultActions: true}
|
];
|
|
// 获取参数
|
@wire(CurrentPageReference)
|
getStateParameters(currentPageReference) {
|
if (currentPageReference) {
|
this.eSetId = currentPageReference.state?.EsetId;
|
}
|
console.log('CurrentPageReference:'+this.eSetId);
|
}
|
|
//初始化
|
connectedCallback(){
|
init({eSetIdStr : this.eSetId})
|
.then(result=>{
|
this.showPage = true;
|
if(result.result == 'Success'){
|
this.coc = result.coc;
|
if(this.coc.Arrive_Order__c != null && this.coc.Arrive_Order__c != ''){
|
this.coc['arriveOrder'] = this.coc.Arrive_Order__r.Name;
|
}
|
console.log('this.coc:'+JSON.stringify(this.coc));
|
this.accountid = result.accountid;
|
this.orderallcount = result.orderallcount;
|
this.arrivetoorder = result.arrivetoorder;
|
this.consumableorderdetailsCount = result.consumableorderdetailsCount;
|
this.consumableorderdetailsRecords = result.consumableorderdetailsRecords;
|
for(var i in this.consumableorderdetailsRecords){
|
if(this.consumableorderdetailsRecords[i].esd != null){
|
this.consumableorderdetailsRecords[i]['recordId'] = this.consumableorderdetailsRecords[i].esd.Id;
|
if(this.consumableorderdetailsRecords[i].esd.Consumable_Product__c != null && this.consumableorderdetailsRecords[i].esd.Consumable_Product__c != ''){
|
this.consumableorderdetailsRecords[i]['prodName'] = this.consumableorderdetailsRecords[i].esd.Consumable_Product__r.Name__c;
|
}
|
// this.consumableorderdetailsRecords[i]['prodName'] = this.consumableorderdetailsRecords[i].prodName;
|
this.consumableorderdetailsRecords[i]['barCode'] = this.consumableorderdetailsRecords[i].esd.Bar_Code__c;
|
this.consumableorderdetailsRecords[i]['intraTradeList'] = this.consumableorderdetailsRecords[i].esd.Intra_Trade_List_RMB__c;
|
}
|
if(this.consumableorderdetailsRecords[i].Prod != null){
|
this.consumableorderdetailsRecords[i]['statusCFDA'] = this.consumableorderdetailsRecords[i].Prod.SFDA_Status__c;
|
}
|
}
|
this.showSpinner = false;
|
}else {
|
this.showSpinner = false;
|
console.log("error:"+error);
|
this.showMyToast('初始化失败',result.errorMsg,'error');
|
}
|
})
|
.catch(error=>{
|
this.showSpinner = false;
|
this.showPage = true;
|
console.log("error:"+error);
|
this.showMyToast('初始化失败',error,'error');
|
})
|
}
|
|
proSale(){
|
this.showSpinner = true;
|
proSale({
|
cocStr : JSON.stringify(this.coc),
|
orderallcountParm : this.orderallcount,
|
consumableorderdetailsCountParm : this.consumableorderdetailsCount
|
})
|
.then(result=>{
|
if(result.result == 'Success'){
|
var url = result.url;
|
const config = {
|
type: 'standard__webPage',
|
attributes: {
|
url: url
|
}
|
};
|
this[NavigationMixin.Navigate](config);
|
}else {
|
this.showSpinner = false;
|
console.log("error:"+error);
|
this.showMyToast('出库失败',result.errorMsg,'error');
|
}
|
})
|
.catch(error=>{
|
this.showPage = true;
|
this.showSpinner = false;
|
console.log("error:"+error);
|
this.showMyToast('出库失败',error,'error');
|
})
|
}
|
|
showMyToast(title,message,variant){
|
const evt = new ShowToastEvent({
|
title : title,
|
message: message,
|
variant: variant
|
});
|
this.dispatchEvent(evt);
|
}
|
}
|