| | |
| | | import serContact from "@salesforce/apex/lexSearchAgencyHospitalController.serContact"; |
| | | import detailsInit from "@salesforce/apex/LexConInvoicedetailsController.init"; |
| | | import detailsSave from "@salesforce/apex/LexConInvoicedetailsController.save"; |
| | | import deleteAtt from '@salesforce/apex/LexConsumableController.deleteAtt'; |
| | | import deleteAtt from '@salesforce/apex/LexSummonsCreatController.deleteAtt'; |
| | | import { NavigationMixin } from "lightning/navigation"; |
| | | //table css |
| | | import { loadStyle } from "lightning/platformResourceLoader"; |
| | |
| | | |
| | | const hospitalColumns = [ |
| | | { |
| | | label: "医院名称", |
| | | fieldName: "Name", |
| | | initialWidth: 400, |
| | | hideDefaultActions: true, |
| | | wrapText: true, |
| | | }, |
| | | { |
| | | label: "省份", |
| | | fieldName: "stateMasterName", |
| | | hideDefaultActions: true, |
| | | }, |
| | | { |
| | | label: "选择", |
| | | label: "", |
| | | fieldName: "Id1", |
| | | type: "button", |
| | | initialWidth: 90, |
| | | hideDefaultActions: true, |
| | | typeAttributes: { |
| | | label: "选择", |
| | |
| | | size: 1, |
| | | }, |
| | | }, |
| | | { |
| | | label: "医院名称", |
| | | fieldName: "Name", |
| | | hideDefaultActions: true, |
| | | wrapText: true, |
| | | }, |
| | | { |
| | | label: "省份", |
| | | fieldName: "stateMasterName", |
| | | hideDefaultActions: true, |
| | | } |
| | | ]; |
| | | const invoiceDetailsColumns = [ |
| | | { |
| | |
| | | hideDefaultActions: true, |
| | | wrapText: true, |
| | | cellAttributes: { alignment: 'right' }, |
| | | initialWidth:145, |
| | | type: "number", |
| | | typeAttributes: { |
| | | minimumFractionDigits: 2, |
| | |
| | | label: "产品型号", |
| | | fieldName: "esdAssetModelNo", |
| | | hideDefaultActions: true, |
| | | initialWidth: 200, |
| | | wrapText: true, |
| | | }, |
| | | { |
| | |
| | | typeAttributes: { |
| | | recordId: { fieldName: "recordId" }, |
| | | shipmentNumber: { fieldName: "shipmentNumber" }, |
| | | isConinvoice: { fieldName: "isConinvoice" }, |
| | | esdInvoiceProNotCount: { fieldName: "esdInvoiceProNotCount" }, |
| | | }, |
| | | }, |
| | | { |
| | |
| | | fieldName: "invoiceAllprice", |
| | | hideDefaultActions: true, |
| | | type: "number", |
| | | initialWidth: 150, |
| | | typeAttributes: { |
| | | minimumFractionDigits: 2, |
| | | }, |
| | |
| | | } |
| | | export default class LexConInvoiceView extends NavigationMixin(LightningElement) { |
| | | |
| | | @track label=customLabel; |
| | | @track label = customLabel; |
| | | invoiceColumns = invoiceColumns; |
| | | detailsColumns = detailsColumns; |
| | | @track outboundColumns = [ |
| | |
| | | |
| | | //文件上传 |
| | | @track showLoadingSpinner = false; |
| | | @track showPopSpinner = false; |
| | | @track UploadFile = "Upload File"; |
| | | @track fileName = ""; |
| | | @track fileData = []; |
| | |
| | | this.detailsData[i]['esdInvoiceUnitprice'] = this.detailsData[i].esd.Invoice_Unitprice__c; |
| | | //发票数量 |
| | | this.detailsData[i]['shipmentNumber'] = this.detailsData[i].invoiceCount; |
| | | this.detailsData[i]['isConinvoice'] = true; |
| | | this.detailsData[i]['invoiceAllprice'] = this.detailsData[i].invoiceAllprice; |
| | | |
| | | if (this.detailsData[i].check) { |
| | |
| | | this.ConInvoiceListUserWorkLocation = r.entity.userWorkLocation; |
| | | |
| | | this.ConInvoiceListAgencyProType = r.entity.agencyProType; |
| | | if (this.ConInvoiceListAgencyProType != 'ET') |
| | | //if (this.ConInvoiceListAgencyProType != 'ET') |
| | | this.isOpenReportDisabled = false; |
| | | this.invoiceData = r.entity.raesList; |
| | | for (var i in this.invoiceData) { |
| | |
| | | this.HospitalName = r.entity.HospitalName; |
| | | this.HospitalInfo = r.entity.HospitalInfo; |
| | | this.agencyProType = r.entity.agencyProType; |
| | | if (this.agencyProType != 'ET') |
| | | //if (this.agencyProType != 'ET') |
| | | this.isOpenReportDisabled = false; |
| | | //科室 |
| | | this.ForCustomerText = this.coc.Order_ForCustomerText__c; |
| | |
| | | label: '客户名', |
| | | fieldName: "hospitalName", |
| | | hideDefaultActions: true, |
| | | wrapText: true, |
| | | }; |
| | | let object2 = { |
| | | label: '出货金额(元)', |
| | |
| | | this.fileName = ''; |
| | | } |
| | | |
| | | //是否显示附件移除 |
| | | get attDelBtn() { |
| | | if (this.fileName != '' && this.fileName != null && this.fileName != '选择一个文件上传') { |
| | | return true; |
| | | } else { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | keepTwoDecimalStr(num) { |
| | | const result = Number(num.toString().match(/^\d+(?:\.\d{0,2})?/)); |
| | | let s = result.toString(); |
| | |
| | | cloneData[i].check = true; |
| | | } |
| | | } |
| | | if(!b){ |
| | | if (!b) { |
| | | cloneData[i].check = false; |
| | | } |
| | | delete cloneData[i].esdOutboundDate; |
| | |
| | | console.log("handleFilesChange"); |
| | | this.handleSave(); |
| | | // if (event.target.files.length > 0) { |
| | | // this.filesUploaded = event.target.files; |
| | | // this.fileName = event.target.files[0].name; |
| | | // this.handleSave(); |
| | | // } |
| | | } |
| | | |
| | | handleSave() { |
| | | this.isShowSpinner = true; |
| | | // this.filesUploaded = event.target.files; |
| | | // this.fileName = event.target.files[0].name; |
| | | // this.handleSave(); |
| | | // } |
| | | } |
| | | |
| | | handleSave() { |
| | | console.log("saveFile"); |
| | | if (this.filesUploaded.length > 0) { |
| | | this.showPopSpinner = true; |
| | | this.file = this.filesUploaded[0]; |
| | | if (this.file.size > this.MAX_FILE_SIZE) { |
| | | this.showMyToast('保存失败', '文件过大', 'Error'); |
| | | return; |
| | | } |
| | | this.showLoadingSpinner = true; |
| | | this.fileReader = new FileReader(); |
| | | |
| | | this.fileReader.onloadend = () => { |
| | |
| | | r = JSON.parse(JSON.stringify(r)); |
| | | console.log("r = " + JSON.stringify(r)); |
| | | if (r != '') { |
| | | this.showLoadingSpinner = false; |
| | | this.showMyToast('附件上传成功', '', 'Success'); |
| | | this.showPopSpinner = false; |
| | | this.showMyToast('上传成功', '', 'Success'); |
| | | this.closePop(); |
| | | this.init(); |
| | | } else { |
| | |
| | | } |
| | | |
| | | saveAttachmentJs() { |
| | | debugger |
| | | this.showLoadingSpinner = true; |
| | | let cloneData = this.fileData |
| | | let cloneData = this.deepClone(this.fileData) |
| | | for (var i in cloneData) { |
| | | delete cloneData[i].Id; |
| | | delete cloneData[i].recordId; |
| | |
| | | cloneData[i].check = true; |
| | | } |
| | | } |
| | | if(!b){ |
| | | if (!b) { |
| | | cloneData[i].check = false; |
| | | } |
| | | delete cloneData[i].esdOutboundDate; |
| | |
| | | let index = 0; |
| | | this.selectedRows = []; |
| | | for (var i in this.outboundData) { |
| | | |
| | | if(this.outboundData[i].check) |
| | | |
| | | if (this.outboundData[i].check) |
| | | this.selectedRows.push(this.outboundData[i].esd.Id) |
| | | this.outboundData[i].Id = this.outboundData[i].esd.Id; |
| | | this.outboundData[i]['esdOutboundDate'] = this.outboundData[i].esd.Outbound_Date__c; |
| | |
| | | let reportUrl = this.label.LexConInvoiceViewReport; |
| | | let reportFilters = '[{"operator":"equals","value":"' + this.OrderCode + '","column":"FK_NAME"}]'; |
| | | console.log('reportUrl = ' + reportUrl); |
| | | let url = "/report/"+ reportUrl +"?reportFilters=" + encodeURIComponent(reportFilters); |
| | | this[NavigationMixin.Navigate]({ |
| | | type: "standard__webPage", |
| | | attributes: { |
| | | url: url, |
| | | }, |
| | | }); |
| | | let url = "/s/report/" + reportUrl + "?reportFilters=" + encodeURIComponent(reportFilters); |
| | | window.open(url); |
| | | // this[NavigationMixin.Navigate]({ |
| | | // type: "standard__webPage", |
| | | // attributes: { |
| | | // url: url, |
| | | // target: '_blank' |
| | | // }, |
| | | // }); |
| | | } |
| | | |
| | | reopenJs() { |
| | |
| | | showMyToast(title, message, variant) { |
| | | this.isShowSpinner = false; |
| | | this.showLoadingSpinner = false; |
| | | this.showPopSpinner = false; |
| | | this.showAttPop = false; |
| | | this.filesUploaded = []; |
| | | this.fileName = null; |
| | |
| | | console.log("this.data = " + JSON.stringify(this.data)); |
| | | } |
| | | |
| | | deepClone(obj) { |
| | | return JSON.parse(JSON.stringify(obj)); |
| | | } |
| | | |
| | | detailsSaveJs() { |
| | | this.isShowSpinner = true; |
| | | let cloneData = this.detailsData; |
| | | let cloneData = this.deepClone(this.detailsData); |
| | | |
| | | let selectedRows = this.template.querySelector('c-lex-custom-lightning-datatable').getSelectedRows(); |
| | | console.log('selectedRows = ' + JSON.stringify(selectedRows)); |
| | |
| | | console.log('attid:' + recordId); |
| | | deleteAtt({ |
| | | contentVersionId: recordId |
| | | }).then(result => { |
| | | if (result.result == 'Success') { |
| | | }).then(r => { |
| | | r = JSON.parse(JSON.stringify(r)); |
| | | if (r.status == "Success") { |
| | | this.showMyToast('删除成功', '', 'Success'); |
| | | if (this.fileData.length == 1) |
| | | window.location.reload(); |
| | | else |
| | | this.init(); |
| | | } else { |
| | | this.showMyToast('删除失败', result.errorMsg, 'Error'); |
| | | this.showMyToast('删除失败', r.msg, 'Error'); |
| | | } |
| | | }).catch(error => { |
| | | this.showMyToast('错误', '删除失败', 'Error'); |
| | | this.showMyToast('错误', error.message, 'Error'); |
| | | }) |
| | | } |
| | | } |