import { LightningElement,wire,api,track } from 'lwc';
|
import { CurrentPageReference } from 'lightning/navigation';
|
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
|
import { NavigationMixin } from 'lightning/navigation';
|
import initPage from '@salesforce/apex/LexConsumableController.init';
|
import categoryAllload from '@salesforce/apex/LexConsumableController.categoryAllload';
|
import categoryload from '@salesforce/apex/LexConsumableController.categoryload';
|
import searchConsumableorderdetails from '@salesforce/apex/LexConsumableController.searchConsumableorderdetails';
|
import searchorderdetails from '@salesforce/apex/LexConsumableController.searchorderdetails';
|
import save from '@salesforce/apex/LexConsumableController.save';
|
import ordrCopy from '@salesforce/apex/LexConsumableController.ordrCopy';
|
import setEditAble from '@salesforce/apex/LexConsumableController.setEditAble';
|
import backOrder from '@salesforce/apex/LexConsumableController.backOrder';
|
import delConsumable from '@salesforce/apex/LexConsumableController.delConsumable';
|
import sorder from '@salesforce/apex/LexConsumableController.sorder';
|
import filesUpload from '@salesforce/apex/LexConsumableController.filesUpload';
|
import initHospital from '@salesforce/apex/LexSearchHospitalController.init';
|
import searchHospital from '@salesforce/apex/LexSearchHospitalController.searchHospital';
|
import initContract from '@salesforce/apex/LexSearchContractController.init';
|
import searchContract from '@salesforce/apex/LexSearchContractController.searchContract';
|
|
export default class LexConsumable extends NavigationMixin(LightningElement) {
|
|
//页面基础数据
|
@track editAble;
|
@track pageType;
|
@track esetId;
|
@track keyWords;
|
@track coc;
|
@track cocId;
|
@track userWorkLocation;
|
@track accountName;
|
@track accountid;
|
@track specialCampaign = false;
|
@track dealerProductId = [];
|
@track category1;
|
@track category3 = '';
|
@track category4 = '';
|
@track category5 = '';
|
@track category_Goods;
|
@track category3Option = [];
|
@track category4Option = [];
|
@track category5Option = [];
|
@track consumableorderdetailsRecordsview = [];
|
@track consumableorderdetailsRecordForDT = [];
|
@track attachmentRecoeds = [];
|
@track contactDealer = [];
|
@track proLimitAndDate = [];
|
@track agencyProType;
|
@track bargainPrice;
|
@track showOrderDate = false;
|
@track showAttUploadDate = false;
|
@track edoffersPrice = false;
|
@track editDelCommitBtnDisabled = false;
|
@track showEditBtn = false;
|
@track disabledEditBtn = false;
|
@track showPrintSheetBtn = false;
|
@track showUploadSheetBtn = false;
|
@track disabledUploadSheetBtn = false;
|
@track showSubOrderbtn = false;
|
@track disabledSubOrderbtn = false;
|
@track showSaveOrderbtn1 = false;
|
@track showSaveOrderbtn2 = false;
|
@track showDeleteBtn = false;
|
@track disabledDeleteBtn = false;
|
@track showOfferPriceInputBtn = false;
|
@track disabledOfferPriceInputBtn = false;
|
@track showReapplyBtn = false;
|
@track showHospital = false;
|
@track showSpinner = true;
|
@track showPage = false;
|
@track cansee = false;
|
//报错提醒
|
// @track hasError = false;
|
@track errorMsgs = [];
|
// @track hasWarning = false;
|
@track warningMsgs = [];
|
//附件上传
|
@track showAttPop = false;
|
@track filesUploaded = [];
|
@track fileName;
|
file;
|
fileContents;
|
fileReader;
|
content;
|
//医院搜索
|
@track showAttHosPop = false;
|
@track hospitalList = [];
|
@track searchNameHos;
|
@track chooseHospital;
|
@track chooseHospitalId;
|
@track hospitalId;
|
@track hospitalName;
|
@track tempidHp;
|
@track hosCols = [
|
// {label:'医院名称',fieldName:'Name',type:'button',typeAttributes:{label:{fieldName:'Name'},variant:'base'}},
|
{label:'',type:'button',typeAttributes:{label:'选择'},initialWidth:80,hideDefaultActions: true},
|
{label:'医院名称',fieldName:'Name',initialWidth:380,wrapText:true,hideDefaultActions: true},
|
{label:'省份',fieldName:'StateMaster',initialWidth:80,hideDefaultActions: true},
|
{label:'地址',fieldName:'Address__c',hideDefaultActions: true}
|
];
|
//合同搜索
|
@track contractLabel;
|
@track showConPop = false;
|
@track contractList = [];
|
@track searchNameCon;
|
@track chooseContract;
|
@track chooseContractId;
|
@track contractId;
|
@track contractName;
|
@track tempidPp;
|
@track conCols = [
|
{label:'',type:'button',typeAttributes:{label:'选择'},initialWidth:80,hideDefaultActions: true},
|
{label:'合同名称',fieldName:'Name',wrapText:true,hideDefaultActions: true},
|
{label:'省份',fieldName:'StateMaster',initialWidth:80,hideDefaultActions: true},
|
{label:'申请销售课',fieldName:'Sales_Section__c',initialWidth:200,hideDefaultActions: true},
|
{label:'允许报价期间(开始日)',fieldName:'Contract_Decide_Start_Date__c',initialWidth:200,hideDefaultActions: true},
|
{label:'允许报价期间(结束日)',fieldName:'Contract_Decide_End_Date__c',initialWidth:200,hideDefaultActions: true}
|
];
|
|
//消耗品数据col
|
get cols(){
|
var cols = [];
|
cols.push({label:'消耗品名称',fieldName:'prodName',wrapText:true,hideDefaultActions: true});
|
cols.push({label:'规格',fieldName:'packing_list',hideDefaultActions: true});
|
cols.push({label:'CFDA状态',fieldName:'prodSFDAStatus',hideDefaultActions: true});
|
cols.push({label:'注册证编码号',fieldName:'approbation_No',hideDefaultActions: true});
|
cols.push({label:'注册证效期',fieldName:'expiration_Date',hideDefaultActions: true});
|
cols.push({label:'第3分类',fieldName:'prodCategory3',hideDefaultActions: true});
|
cols.push({label:'第4分类',fieldName:'prodCategory4',hideDefaultActions: true});
|
cols.push({label:'第5分类',fieldName:'prodCategory5',hideDefaultActions: true});
|
if(this.cansee){
|
cols.push({label:'标准单价',fieldName:'prodIntraTradeList',hideDefaultActions: true});
|
}
|
if(this.editAble){
|
cols.push(
|
{label:'采购数量',
|
type: "customTableInput",typeAttributes: {
|
recordId: { fieldName: "recordId" },
|
inputValue: { fieldName: "consumableCount" },
|
},
|
hideDefaultActions: true});
|
}else{
|
cols.push({label:'采购数量',fieldName:'consumableCount',hideDefaultActions: true});
|
}
|
cols.push({label:'在库数下限',fieldName:'lowerlimit',hideDefaultActions: true});
|
cols.push({label:'在库数上限',fieldName:'upperlimit',hideDefaultActions: true});
|
cols.push({label:'有效期库存(盒)',fieldName:'allnumber',hideDefaultActions: true});
|
cols.push({label:'有效期库存(个)',fieldName:'allnumber_piece',hideDefaultActions: true});
|
return cols;l
|
}
|
|
@wire(CurrentPageReference)
|
getStateParameters(currentPageReference) {
|
console.log('CurrentPageReference');
|
if (currentPageReference) {
|
this.pageType = currentPageReference.state?.type;
|
this.esetId = currentPageReference.state?.ESetid;
|
this.keyWords = currentPageReference.state?.KeyWords;
|
console.log('type:'+this.pageType);
|
console.log('esetId:'+this.esetId);
|
console.log('keyWords:'+this.keyWords);
|
}
|
}
|
|
connectedCallback(){
|
this.showSpinner = true;
|
initPage({type:this.pageType, esetId:this.esetId, keywordStr:this.keyWords})
|
.then(result=>{
|
if(result.result == 'Success'){
|
this.editAble = result.editAble;
|
this.edoffersPrice = result.edoffersPrice;
|
this.cansee = result.cansee;
|
this.editDelCommitBtnDisabled = result.editDelCommitBtnDisabled;
|
this.category3Option = result.category3Option;
|
this.category4Option = result.category4Option;
|
this.category5Option = result.category5Option;
|
this.agencyProType = result.agencyProType;
|
this.hospitalName = result.hospitalName;
|
this.contractName = result.contractName;
|
this.contractLabel = '经销商有效合同';
|
this.consumableorderdetailsRecordsview = result.consumableorderdetailsRecordsview;
|
// this.consumableorderdetailsRecordForDT = result.consumableorderdetailsRecordsview;
|
this.getTableData();
|
this.attachmentRecoeds = result.attachmentRecoeds;
|
this.errorMsgs = result.errorMsgList;
|
this.warningMsgs = result.warningMsgList;
|
this.userWorkLocation = result.userWorkLocation;
|
this.accountName = result.accountName;
|
this.accountid = result.accountid;
|
this.hospitalId = result.hospitalId;
|
this.contractId = result.contractId;
|
this.category_Goods = result.category_Goods;
|
this.specialCampaign = result.specialCampaign;
|
this.dealerProductId = result.dealerProductId;
|
this.contactDealer = result.contactDealer;
|
this.pageType = result.methodType;
|
this.proLimitAndDate = result.proLimitAndDate;
|
this.coc = result.coc;
|
this.cocId = this.coc.Id;
|
if(this.pageType == 'hospitalorder' && this.agencyProType != 'ET'){
|
this.showHospital = true;
|
}
|
if(this.coc.Order_status__c == "已提交" || this.coc.Order_status__c == "批准"){
|
this.showOrderDate = true;
|
}
|
if(this.coc.Consumable_pdf_insert_day__c != null){
|
this.showAttUploadDate = true;
|
}
|
if(!(this.editAble || this.edoffersPrice)){
|
this.showEditBtn = true;
|
this.showOfferPriceInputBtn = true;
|
}
|
if(this.coc.Order_status__c == "已提交" || this.coc.Order_status__c == "批准" || this.coc.Order_status__c == "驳回"){
|
this.disabledEditBtn = true;
|
this.disabledUploadSheetBtn = true;
|
this.disabledSubOrderbtn = true;
|
this.disabledDeleteBtn = true;
|
this.disabledOfferPriceInputBtn = true;
|
}
|
if(!(this.editDelCommitBtnDisabled || this.editAble || this.edoffersPrice)){
|
this.showPrintSheetBtn = true;
|
this.showUploadSheetBtn = true;
|
this.showSubOrderbtn = true;
|
this.showDeleteBtn = true;
|
}
|
if((this.editDelCommitBtnDisabled || this.editAble || this.edoffersPrice) && this.coc.Order_status__c != "驳回"){
|
this.showSaveOrderbtn1 = true;
|
}
|
if(this.coc.Order_status__c == "驳回" && this.editAble){
|
this.showSaveOrderbtn2 = true;
|
}
|
if(this.coc.Order_status__c == "驳回" && !this.editAble){
|
this.showReapplyBtn = true;
|
}
|
this.showSpinner = false;
|
this.showPage = true;
|
}else{
|
this.showSpinner = false;
|
console.log("Error:"+result.errorMsg);
|
this.showMyToast('初始化页面失败',result.errorMsg,'error');
|
}
|
})
|
}
|
|
getTableData(){
|
for(var i in this.consumableorderdetailsRecordForDT){
|
if(!this.consumableorderdetailsRecordForDT[i].oldCheck){
|
this.consumableorderdetailsRecordForDT[i]["prodName"] = this.consumableorderdetailsRecordForDT[i].Prod.Name__c;
|
}else{
|
this.consumableorderdetailsRecordForDT[i]["prodName"] = this.consumableorderdetailsRecordForDT[i].esd.Consumable_Product__r.Name__c;
|
}
|
this.consumableorderdetailsRecordForDT[i]["prodSFDAStatus"] = this.consumableorderdetailsRecordForDT[i].Prod.SFDA_Status__c;
|
this.consumableorderdetailsRecordForDT[i]["prodCategory3"] = this.consumableorderdetailsRecordForDT[i].Prod.Category3__c;
|
this.consumableorderdetailsRecordForDT[i]["prodCategory4"] = this.consumableorderdetailsRecordForDT[i].Prod.Category4__c;
|
this.consumableorderdetailsRecordForDT[i]["prodCategory5"] = this.consumableorderdetailsRecordForDT[i].Prod.Category5__c;
|
this.consumableorderdetailsRecordForDT[i]["prodIntraTradeList"] = this.consumableorderdetailsRecordForDT[i].Prod.Intra_Trade_List_RMB__c;
|
this.consumableorderdetailsRecordForDT[i]["consumableCount"] = this.consumableorderdetailsRecordForDT[i].esd.Consumable_count__c;
|
}
|
console.log("ProdName1:"+this.consumableorderdetailsRecordForDT[0].prodName);
|
console.log("ProdName2:"+this.consumableorderdetailsRecordsview[0].prodName);
|
}
|
|
get hasWarning(){
|
if(this.warningMsgs.length > 0){
|
return true;
|
}else{
|
return false;
|
}
|
}
|
|
get hasError(){
|
if(this.errorMsgs.length > 0){
|
return true;
|
}else{
|
return false;
|
}
|
}
|
|
offerPriceChange(event){
|
this.coc.Offers_Price__c = event.detail.value;
|
}
|
|
category1Change(event){
|
this.category1 = event.detail.value;
|
}
|
|
category3Change(event){
|
this.showSpinner = true;
|
this.category3 = event.detail.value;
|
this.category4 = '';
|
this.category5 = '';
|
categoryAllload({agencyProTypeStr:this.agencyProType, category3Str:this.category3})
|
.then(result=>{
|
if(result.result == 'Success'){
|
this.category4Option = result.category4Option;
|
this.category5Option = result.category5Option;
|
this.showSpinner = false;
|
}else{
|
this.showSpinner = false;
|
console.log("Error:"+result.errorMsg);
|
this.showMyToast('加载分类失败',result.errorMsg,'error');
|
}
|
})
|
}
|
|
category4Change(event){
|
this.showSpinner = true;
|
this.category4 = event.detail.value;
|
this.category5 = '';
|
categoryload({agencyProTypeStr:this.agencyProType, category3Str:this.category3, category4Str:this.category4})
|
.then(result=>{
|
if(result.result == 'Success'){
|
this.category4Option = result.category4Option;
|
this.category5Option = result.category5Option;
|
this.showSpinner = false;
|
}else{
|
this.showSpinner = false;
|
console.log("Error:"+result.errorMsg);
|
this.showMyToast('加载分类失败',result.errorMsg,'error');
|
}
|
})
|
}
|
|
category5Change(event){
|
this.category5 = event.detail.value;
|
}
|
|
searchProduct(event){
|
this.showSpinner = true;
|
searchConsumableorderdetails({userWorkLocationStr:this.userWorkLocation,
|
agencyProTypeStr:this.agencyProType,
|
accountNameStr:this.accountName,
|
accountIdStr:this.accountid,
|
contractIdStr:this.contractId,
|
hospitalIdStr:this.hospitalId,
|
category1Str:this.category1,
|
category3Str:this.category3,
|
category4Str:this.category4,
|
category5Str:this.category5,
|
category_GoodStr:this.category_Goods,
|
specialCampaignStr:this.specialCampaign,
|
dealerProductIdStr:JSON.stringify(this.dealerProductId),
|
methodTypeStr:this.pageType,
|
editAbleStr:this.editAble,
|
consumableorderdetailsRecordsviewStr:JSON.stringify(this.consumableorderdetailsRecordsview)})
|
.then(result=>{
|
if(result.result == 'Success'){
|
this.consumableorderdetailsRecordsview = result.consumableorderdetailsRecordsview;
|
this.getTableData();
|
this.showSpinner = false;
|
this.errorMsgs = result.errorMsgList;
|
this.warningMsgs = result.warningMsgList;
|
// this.hasError = result.hasError;
|
// this.hasWarning = result.hasWarning;
|
this.showMyToast('搜索成功',result.errorMsg,'success');
|
}else{
|
this.showSpinner = false;
|
console.log("Error:"+result.errorMsg);
|
if(result.errorMsg == '没有搜索到相关数据'){
|
this.showMyToast(result.errorMsg,'','error');
|
}else{
|
this.showMyToast('搜索失败',result.errorMsg,'error');
|
}
|
}
|
})
|
.catch(error=>{
|
console.log("Error:"+error);
|
})
|
}
|
|
clear(event){
|
this.category1 = '';
|
this.category3 = '';
|
this.category4 = '';
|
this.category5 = '';
|
this.showSpinner = true;
|
searchConsumableorderdetails({
|
userWorkLocationStr:this.userWorkLocation,
|
agencyProTypeStr:this.agencyProType,
|
accountNameStr:this.accountName,
|
accountIdStr:this.accountid,
|
contractIdStr:this.contractId,
|
hospitalIdStr:this.hospitalId,
|
category1Str:this.category1,
|
category3Str:this.category3,
|
category4Str:this.category4,
|
category5Str:this.category5,
|
category_GoodStr:this.category_Goods,
|
specialCampaignStr:this.specialCampaign,
|
dealerProductIdStr:JSON.stringify(this.dealerProductId),
|
methodTypeStr:this.pageType,
|
editAbleStr:this.editAble,
|
consumableorderdetailsRecordsviewStr:JSON.stringify(this.consumableorderdetailsRecordsview)
|
}).then(result=>{
|
if(result.result == 'Success'){
|
this.consumableorderdetailsRecordsview = result.consumableorderdetailsRecordsview;
|
this.getTableData();
|
this.showSpinner = false;
|
this.showMyToast('搜索成功',result.errorMsg,'success');
|
}else{
|
this.showSpinner = false;
|
console.log("Error:"+result.errorMsg);
|
if(result.errorMsg == '没有搜索到相关数据'){
|
this.showMyToast(result.errorMsg,'','error');
|
}else{
|
this.showMyToast('搜索失败',result.errorMsg,'error');
|
}
|
}
|
})
|
}
|
|
attClick1(event){
|
var id = event.currentTarget.dataset.name;
|
console.log('id:'+id);
|
const config = {
|
type: 'standard__webPage',
|
attributes: {
|
url: '/detail/'+id,
|
}
|
};
|
this[NavigationMixin.Navigate](config);
|
}
|
|
attClick2(event){
|
var id = event.currentTarget.dataset.name;
|
var site = window.location.origin;
|
console.log('id:'+id);
|
const config = {
|
type: 'standard__webPage',
|
attributes: {
|
url: site+'/consumable/servlet/servlet.FileDownload?file='+id,
|
}
|
};
|
this[NavigationMixin.Navigate](config);
|
}
|
|
checkAll(event){
|
for(let i=0, len=this.consumableorderdetailsRecordsview.length; i < len ;i++){
|
this.consumableorderdetailsRecordsview[i].check = event.target.checked;
|
}
|
}
|
|
check(event){
|
let index = event.target.getAttribute("data-index");
|
this.consumableorderdetailsRecordsview[index].check = event.target.checked;
|
}
|
|
consumableCountChange(event){
|
let index = event.target.getAttribute("data-index");
|
var value = event.target.value;
|
this.consumableorderdetailsRecordsview[index].esd.Consumable_count__c = value;
|
if(isNaN(value)){
|
value=0.00;
|
}
|
if(value != null && value !=0 && value!=''){
|
this.consumableorderdetailsRecordsview[index].check = true;
|
}else{
|
this.consumableorderdetailsRecordsview[index].check = false;
|
}
|
}
|
|
//保存订单
|
saveOrder(event){
|
this.showSpinner = true;
|
console.log('start save');
|
save({
|
contractNameStr:this.contractName,
|
cocStr:JSON.stringify(this.coc),
|
agencyProTypeStr:this.agencyProType,
|
accountidStr:this.accountid,
|
consumableorderdetailsRecordsviewStr:JSON.stringify(this.consumableorderdetailsRecordsview),
|
contactDealerStr:JSON.stringify(this.contactDealer),
|
methodTypeStr:this.pageType,
|
eSetIdStr:this.esetId,
|
hospitalIdStr : this.hospitalId
|
}).then(result=>{
|
this.showSpinner = false;
|
if(result.result == 'Success'){
|
this.esetId = result.eSetId;
|
const config = {
|
type: 'standard__webPage',
|
attributes: {
|
url: '/lexconsumable?ESetid=' + this.esetId + '&type=' + this.pageType
|
}
|
};
|
this[NavigationMixin.Navigate](config);
|
}else{
|
this.showSpinner = false;
|
console.log("Error:"+result.errorMsg);
|
this.showMyToast('保存失败',result.errorMsg,'error');
|
}
|
})
|
}
|
|
//保存订单(驳回)
|
orderCopy(event){
|
this.showSpinner = true;
|
ordrCopy({
|
contractNameStr:this.contractName,
|
cocStr:JSON.stringify(this.coc),
|
agencyProTypeStr:this.agencyProType,
|
accountidStr:this.accountid,
|
consumableorderdetailsRecordsviewStr:JSON.stringify(this.consumableorderdetailsRecordsview),
|
contactDealerStr:JSON.stringify(this.contactDealer),
|
methodTypeStr:this.pageType
|
}).then(result=>{
|
this.showSpinner = false;
|
if(result.result == 'Success'){
|
this.esetId = result.esetId;
|
const config = {
|
type: 'standard__webPage',
|
attributes: {
|
url: '/lexconsumable?ESetid=' + this.esetId + '&type=' + this.pageType
|
}
|
};
|
this[NavigationMixin.Navigate](config);
|
}else{
|
this.showSpinner = false;
|
console.log("Error:"+result.errorMsg);
|
this.showMyToast('保存失败',result.errorMsg,'error');
|
}
|
})
|
}
|
|
//编辑
|
editOrder(event){
|
setEditAble({eSetidStr:this.esetId})
|
.then(result=>{
|
if(result.result == 'Success'){
|
const config = {
|
type: 'standard__webPage',
|
attributes: {
|
url: result.url
|
}
|
};
|
this[NavigationMixin.Navigate](config);
|
}else{
|
this.showSpinner = false;
|
console.log("Error:"+result.errorMsg);
|
this.showMyToast('编辑失败',result.errorMsg,'error');
|
}
|
})
|
}
|
|
//打印配置单
|
printOrder(event){
|
var site = window.location.origin;
|
const config = {
|
type: 'standard__webPage',
|
attributes: {
|
url: site+'/consumable/PrintConsumblePDF?ESetid='+this.esetId
|
}
|
};
|
this[NavigationMixin.Navigate](config);
|
}
|
|
//上传配置单
|
uploadOrder(event){
|
this.showAttPop = true;
|
}
|
|
//提交订单
|
submitOrder(event){
|
sorder({eSetidStr:this.esetId,accountidStr:this.accountid})
|
.then(result=>{
|
if(result.result == 'Success'){
|
const config = {
|
type: 'standard__webPage',
|
attributes: {
|
url: result.url
|
}
|
};
|
this[NavigationMixin.Navigate](config);
|
}else{
|
this.showSpinner = false;
|
this.errorMsgs = result.errorMsgList;
|
this.warningMsgs = result.warningMsgList;
|
console.log("Error:"+result.errorMsg);
|
if(result.errorMsg.indexOf("请上传订货配置单附件") != -1){
|
result.errorMsg = '请上传订货配置单附件';
|
}
|
this.showMyToast('提交失败',result.errorMsg,'error');
|
}
|
})
|
.catch(error=>{
|
console.log("Error:"+error);
|
})
|
}
|
|
//删除订单
|
deleteOrder(event){
|
if(!window.confirm('删除是不可恢复的,你确认要删除吗?')){
|
return;
|
}
|
delConsumable({eSetidStr:this.esetId})
|
.then(result=>{
|
if(result.result == 'Success'){
|
const config = {
|
type: 'standard__webPage',
|
attributes: {
|
url: result.url
|
}
|
};
|
this[NavigationMixin.Navigate](config);
|
}else{
|
this.showSpinner = false;
|
console.log("Error:"+result.errorMsg);
|
this.showMyToast('删除失败',result.errorMsg,'error');
|
}
|
})
|
}
|
|
//特价金额录入
|
inputOfferPrice(event){
|
this.edoffersPrice = true;
|
if(!(this.editAble || this.edoffersPrice)){
|
this.showEditBtn = true;
|
this.showOfferPriceInputBtn = true;
|
}else{
|
this.showEditBtn = false;
|
this.showOfferPriceInputBtn = false;
|
}
|
if(!(this.editDelCommitBtnDisabled || this.editAble || this.edoffersPrice)){
|
this.showPrintSheetBtn = true;
|
this.showUploadSheetBtn = true;
|
this.showSubOrderbtn = true;
|
this.showDeleteBtn = true;
|
}else{
|
this.showPrintSheetBtn = false;
|
this.showUploadSheetBtn = false;
|
this.showSubOrderbtn = false;
|
this.showDeleteBtn = false;
|
}
|
if((this.editDelCommitBtnDisabled || this.editAble || this.edoffersPrice) && this.coc.Order_status__c != "驳回"){
|
this.showSaveOrderbtn1 = true;
|
}else{
|
this.showSaveOrderbtn1 = false;
|
}
|
}
|
|
//再申请
|
reapplyOrder(event){
|
backOrder({eSetidStr:this.esetId})
|
.then(result=>{
|
if(result.result == 'Success'){
|
const config = {
|
type: 'standard__webPage',
|
attributes: {
|
url: result.url
|
}
|
};
|
this[NavigationMixin.Navigate](config);
|
}else{
|
this.showSpinner = false;
|
console.log("Error:"+result.errorMsg);
|
this.showMyToast('再申请失败',result.errorMsg,'error');
|
}
|
})
|
}
|
|
attChange(event){
|
if(event.target.files.length > 0) {
|
this.filesUploaded = event.target.files;
|
this.fileName = event.target.files[0].name;
|
console.log('this.fileName:'+this.fileName);
|
}
|
}
|
|
get attDelBtn(){
|
if(this.fileName != '' && this.fileName != null && this.fileName != '请选择一个文件上传'){
|
return true;
|
}else{
|
return false;
|
}
|
}
|
|
closePop(){
|
this.showAttPop = false;
|
this.filesUploaded = [];
|
this.fileName = null;
|
}
|
|
removeAtt(){
|
this.filesUploaded = [];
|
this.fileName = '';
|
}
|
|
uploadAtt(event){
|
if(this.filesUploaded.length > 0) {
|
this.file = this.filesUploaded[0];
|
if (this.file.size > this.MAX_FILE_SIZE) {
|
window.console.log('文件过大');
|
return ;
|
}
|
this.fileReader= new FileReader();
|
|
this.fileReader.onloadend = (() => {
|
this.fileContents = this.fileReader.result;
|
let base64 = 'base64,';
|
this.content = this.fileContents.indexOf(base64) + base64.length;
|
this.fileContents = this.fileContents.substring(this.content);
|
this.saveToFile();
|
});
|
this.fileReader.readAsDataURL(this.file);
|
}
|
else {
|
this.fileName = '请选择一个文件上传';
|
}
|
}
|
|
saveToFile() {
|
// this.showSpinner = true;
|
filesUpload({pId:this.esetId, fileName: this.file.name, base64Data: encodeURIComponent(this.fileContents)})
|
.then(result => {
|
// this.showSpinner = false;
|
if(result.result == 'Success'){
|
// this.showMyToast('上传成功','','success');
|
this.closePop();
|
window.location.reload();
|
}else{
|
console.log("Error:"+result.errorMsg);
|
this.showMyToast('上传失败',result.errorMsg,'error');
|
}
|
})
|
.catch(error => {
|
this.showSpinner = false;
|
this.showMyToast('上传失败',error,'error');
|
});
|
}
|
|
//打开搜索弹窗,并初始化弹窗
|
showSearchHos(event){
|
initHospital()
|
.then(result=>{
|
if(result.result == 'Success'){
|
this.showAttHosPop = true;
|
this.hospitalList = result.attList;
|
for(var i in this.hospitalList){
|
if(this.hospitalList[i].State_Master__c){
|
this.hospitalList[i]['StateMaster'] = this.hospitalList[i].State_Master__r.Name;
|
}
|
}
|
}else{
|
console.log("Error:"+result.errorMsg);
|
this.showMyToast('初始化检索医院页面失败',result.errorMsg,'error');
|
}
|
})
|
.catch(error=>{
|
console.log("Error:"+error);
|
this.showMyToast('初始化检索医院页面失败',error,'error');
|
})
|
}
|
|
//检索医院
|
searchHos(event){
|
searchHospital({searchName:this.searchNameHos, accountId:this.accountid})
|
.then(result=>{
|
if(result.result == 'Success'){
|
this.hospitalList = result.attList;
|
for(var i in this.hospitalList){
|
if(this.hospitalList[i].State_Master__c){
|
this.hospitalList[i]['StateMaster'] = this.hospitalList[i].State_Master__r.Name;
|
}
|
}
|
}else{
|
console.log("Error:"+result.errorMsg);
|
this.showMyToast('搜索失败',result.errorMsg,'error');
|
}
|
})
|
.catch(error=>{
|
console.log("Error:"+error);
|
this.showMyToast('搜索失败',error,'error');
|
})
|
}
|
|
searchNameHosChange(event){
|
this.searchNameHos = event.detail.value;
|
}
|
|
//关闭弹窗
|
closeHospitalPop(){
|
this.showAttHosPop = false;
|
this.chooseHospital = '';
|
this.chooseHospitalId = '';
|
}
|
|
// //选择医院
|
// chooseHos(event){
|
// var hosName = event.target.getAttribute("data-name");
|
// var hosid = event.target.getAttribute("data-hosid");
|
// console.log('hos:'+hosName+'---'+hosid);
|
// this.chooseHospital = hosName;
|
// this.chooseHospitalId = hosid;
|
// }
|
|
chooseHos(event){
|
const row = event.detail.row;
|
this.chooseHospitalId = row.Id;
|
this.chooseHospital = row.Name;
|
console.log('row.Id:'+row.Id);
|
console.log('row.Name:'+row.Name);
|
this.confirmHospital();
|
}
|
|
//确认选择医院
|
confirmHospital(){
|
if(this.chooseHospital != '' && this.chooseHospital != null){
|
this.hospitalId = this.chooseHospitalId;
|
this.tempidHp = this.chooseHospitalId;
|
this.hospitalName = this.chooseHospital;
|
this.closeHospitalPop();
|
//消除警告
|
var arr = [];
|
for(var i in this.warningMsgs){
|
if(this.warningMsgs[i] != '请选择医院'){
|
arr.push(this.warningMsgs[i]);
|
}
|
}
|
this.warningMsgs = arr;
|
if(this.tempidHp != 'tempId' && this.tempidHp != ''){
|
searchorderdetails({
|
methodTypeStr : this.pageType,
|
accountIdStr : this.accountid,
|
hospitalIdStr : this.hospitalId,
|
contractIdStr : this.contractId,
|
userWorkLocationStr : this.userWorkLocation,
|
accountNameStr : this.accountName,
|
proLimitAndDateList : this.proLimitAndDate,
|
editAbleStr : this.editAble
|
}).then(result=>{
|
if(result.result == 'Success'){
|
this.consumableorderdetailsRecordsview = result.consumableorderdetailsRecordsview;
|
this.getTableData();
|
this.showMyToast('搜索成功',result.errorMsg,'success');
|
}else{
|
console.log("Error:"+result.errorMsg);
|
if(result.errorMsg == '没有搜索到相关数据'){
|
this.showMyToast(result.errorMsg,'','error');
|
}else{
|
this.showMyToast('搜索产品失败',result.errorMsg,'error');
|
}
|
}
|
})
|
.catch(error=>{
|
console.log("Error:"+error);
|
this.showMyToast('搜索产品失败',error,'error');
|
})
|
this.tempidHp = 'tempId';
|
}
|
}else{
|
this.showMyToast('请选择医院','','error');
|
}
|
}
|
|
//打开合同检索弹窗并初始化
|
showSearchCon(){
|
initContract({ctype:this.agencyProType})
|
.then(result=>{
|
if(result.result == 'Success'){
|
this.showConPop = true;
|
this.contractList = result.attList;
|
for(var i in this.contractList){
|
if(this.contractList[i].State_Master__c){
|
this.contractList[i]['StateMaster'] = this.contractList[i].State_Master__r.Name;
|
}
|
}
|
}else{
|
console.log("Error:"+result.errorMsg);
|
this.showMyToast('初始化检索合同页面失败',result.errorMsg,'error');
|
}
|
})
|
.catch(error=>{
|
console.log("Error:"+error);
|
this.showMyToast('初始化检索合同页面失败',error,'error');
|
})
|
}
|
|
//检索合同
|
searchCon(){
|
searchContract({searchName:this.searchNameCon, accountId:this.accountid, ctype:this.agencyProType})
|
.then(result=>{
|
if(result.result == 'Success'){
|
this.contractList = result.attList;
|
for(var i in this.contractList){
|
if(this.contractList[i].State_Master__c){
|
this.contractList[i]['StateMaster'] = this.contractList[i].State_Master__r.Name;
|
}
|
}
|
}else{
|
console.log("Error:"+result.errorMsg);
|
this.showMyToast('搜索失败',result.errorMsg,'error');
|
}
|
})
|
.catch(error=>{
|
console.log("Error:"+error);
|
this.showMyToast('搜索失败',error,'error');
|
})
|
}
|
|
searchNameConChange(event){
|
this.searchNameCon = event.detail.value;
|
}
|
|
//关闭弹窗
|
closeContractPop(){
|
this.showConPop = false;
|
this.chooseContract = '';
|
this.chooseContractId = '';
|
}
|
|
//选择合同
|
// chooseCon(event){
|
// var conName = event.target.getAttribute("data-name");
|
// var conid = event.target.getAttribute("data-hosid");
|
// console.log('hos:'+conName+'---'+conid);
|
// this.chooseContract = conName;
|
// this.chooseContractId = conid;
|
// }
|
|
chooseCon(event){
|
const row = event.detail.row;
|
this.chooseContractId = row.Id;
|
this.chooseContract = row.Name;
|
console.log('row.Id:'+row.Id);
|
console.log('row.Name:'+row.Name);
|
this.confirmContract();
|
}
|
|
//确认选择合同
|
confirmContract(){
|
if(this.chooseContract != '' && this.chooseContract != null){
|
this.contractId = this.chooseContractId;
|
this.tempidPp = this.chooseContractId;
|
this.contractName = this.chooseContract;
|
this.closeContractPop();
|
if(this.tempidPp != 'tempId' && this.tempidPp != '' && this.contractId != '' && this.pageType == 'promotionorder'){
|
searchorderdetails({
|
methodTypeStr : this.pageType,
|
accountIdStr : this.accountid,
|
hospitalIdStr : this.hospitalId,
|
contractIdStr : this.contractId,
|
userWorkLocationStr : this.userWorkLocation,
|
accountNameStr : this.accountName,
|
proLimitAndDateList : this.proLimitAndDate,
|
editAbleStr : this.editAble
|
}).then(result=>{
|
if(result.result == 'Success'){
|
this.consumableorderdetailsRecordsview = result.consumableorderdetailsRecordsview;
|
this.getTableData();
|
this.showMyToast('搜索成功',result.errorMsg,'success');
|
}else{
|
console.log("Error:"+result.errorMsg);
|
if(result.errorMsg == '没有搜索到相关数据'){
|
this.showMyToast(result.errorMsg,'','error');
|
}else{
|
this.showMyToast('搜索产品失败',result.errorMsg,'error');
|
}
|
}
|
})
|
.catch(error=>{
|
console.log("Error:"+error);
|
this.showMyToast('搜索产品失败',error,'error');
|
})
|
this.tempidPp = 'tempId';
|
}
|
}else{
|
this.showMyToast('请选择合同','','error');
|
}
|
}
|
|
showMyToast(title,message,variant){
|
const evt = new ShowToastEvent({
|
title : title,
|
message: message,
|
variant: variant
|
});
|
this.dispatchEvent(evt);
|
}
|
}
|