| | |
| | | import { LightningElement, api, track, wire } from "lwc"; |
| | | import { ShowToastEvent } from "lightning/platformShowToastEvent"; |
| | | import init from "@salesforce/apex/LexConInvoiceViewController.init"; |
| | | import save from "@salesforce/apex/LexConInvoiceViewController.save"; |
| | | import saveFile from "@salesforce/apex/LexConInvoiceViewController.saveFile"; |
| | | import saveAttachment from "@salesforce/apex/LexConInvoiceViewController.saveAttachment"; |
| | | import InvoiceorderSearch from "@salesforce/apex/LexConInvoiceViewController.InvoiceorderSearch"; |
| | | import deleteButton from "@salesforce/apex/LexConInvoiceViewController.deleteButton"; |
| | | import approval from "@salesforce/apex/LexConInvoiceViewController.approval"; |
| | | import conInvoiceListInit from "@salesforce/apex/LexConInvoiceList.init"; |
| | | import invoiceCodeSearch from "@salesforce/apex/LexConInvoiceList.invoiceCodeSearch"; |
| | | import hospitalInit from "@salesforce/apex/lexSearchAgencyHospitalController.init"; |
| | | 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/LexSummonsCreatController.deleteAtt"; |
| | | import { NavigationMixin } from "lightning/navigation"; |
| | | import { LightningElement, api, track, wire } from 'lwc'; |
| | | import { ShowToastEvent } from 'lightning/platformShowToastEvent'; |
| | | import init from '@salesforce/apex/LexConInvoiceViewController.init'; |
| | | import save from '@salesforce/apex/LexConInvoiceViewController.save'; |
| | | import saveFile from '@salesforce/apex/LexConInvoiceViewController.saveFile'; |
| | | import saveAttachment from '@salesforce/apex/LexConInvoiceViewController.saveAttachment'; |
| | | import InvoiceorderSearch from '@salesforce/apex/LexConInvoiceViewController.InvoiceorderSearch'; |
| | | import deleteButton from '@salesforce/apex/LexConInvoiceViewController.deleteButton'; |
| | | import approval from '@salesforce/apex/LexConInvoiceViewController.approval'; |
| | | import conInvoiceListInit from '@salesforce/apex/LexConInvoiceList.init'; |
| | | import invoiceCodeSearch from '@salesforce/apex/LexConInvoiceList.invoiceCodeSearch'; |
| | | import hospitalInit from '@salesforce/apex/lexSearchAgencyHospitalController.init'; |
| | | 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/LexSummonsCreatController.deleteAtt'; |
| | | import { NavigationMixin } from 'lightning/navigation'; |
| | | //table css |
| | | import { loadStyle } from "lightning/platformResourceLoader"; |
| | | import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable"; |
| | | import LexConInvoiceViewReport from "@salesforce/label/c.LexConInvoiceViewReport"; |
| | | import { loadStyle } from 'lightning/platformResourceLoader'; |
| | | import WrappedHeaderTable from '@salesforce/resourceUrl/lexdatatable'; |
| | | import LexConInvoiceViewReport from '@salesforce/label/c.LexConInvoiceViewReport'; |
| | | |
| | | const hospitalColumns = [ |
| | | { |
| | | label: "", |
| | | fieldName: "Id1", |
| | | type: "button", |
| | | initialWidth: 90, |
| | | hideDefaultActions: true, |
| | | typeAttributes: { |
| | | label: "选择", |
| | | name: "Id2", |
| | | size: 1 |
| | | { |
| | | label: '', |
| | | fieldName: 'Id1', |
| | | type: 'button', |
| | | initialWidth: 90, |
| | | hideDefaultActions: true, |
| | | typeAttributes: { |
| | | label: '选择', |
| | | name: 'Id2', |
| | | size: 1 |
| | | } |
| | | }, |
| | | { |
| | | label: '医院名称', |
| | | fieldName: 'Name', |
| | | hideDefaultActions: true, |
| | | wrapText: true |
| | | }, |
| | | { |
| | | label: '省份', |
| | | fieldName: 'stateMasterName', |
| | | hideDefaultActions: true |
| | | } |
| | | }, |
| | | { |
| | | label: "医院名称", |
| | | fieldName: "Name", |
| | | hideDefaultActions: true, |
| | | wrapText: true |
| | | }, |
| | | { |
| | | label: "省份", |
| | | fieldName: "stateMasterName", |
| | | hideDefaultActions: true |
| | | } |
| | | ]; |
| | | const invoiceDetailsColumns = [ |
| | | { |
| | | label: "出库日期", |
| | | fieldName: "esdetProductOutDate", |
| | | hideDefaultActions: true, |
| | | wrapText: true |
| | | }, |
| | | { |
| | | label: "出库单编码", |
| | | fieldName: "esdetInvoicedet1ODlinkName", |
| | | wrapText: true, |
| | | hideDefaultActions: true, |
| | | wrapText: true |
| | | }, |
| | | { |
| | | label: "产品型号", |
| | | fieldName: "esdetAssetModelNo", |
| | | hideDefaultActions: true, |
| | | wrapText: true, |
| | | initialWidth: 400 |
| | | }, |
| | | { |
| | | label: "单位", |
| | | fieldName: "esdetInvoiceUnit", |
| | | hideDefaultActions: true, |
| | | wrapText: true, |
| | | initialWidth: 50 |
| | | }, |
| | | { |
| | | label: "发票单价", |
| | | fieldName: "esdetInvoiceUnitprice", |
| | | hideDefaultActions: true, |
| | | wrapText: true, |
| | | type: "number", |
| | | typeAttributes: { |
| | | minimumFractionDigits: 2 |
| | | { |
| | | label: '出库日期', |
| | | fieldName: 'esdetProductOutDate', |
| | | hideDefaultActions: true, |
| | | wrapText: true |
| | | }, |
| | | { |
| | | label: '出库单编码', |
| | | fieldName: 'esdetInvoicedet1ODlinkName', |
| | | wrapText: true, |
| | | hideDefaultActions: true, |
| | | wrapText: true |
| | | }, |
| | | { |
| | | label: '产品型号', |
| | | fieldName: 'esdetAssetModelNo', |
| | | hideDefaultActions: true, |
| | | wrapText: true, |
| | | initialWidth: 400 |
| | | }, |
| | | { |
| | | label: '单位', |
| | | fieldName: 'esdetInvoiceUnit', |
| | | hideDefaultActions: true, |
| | | wrapText: true, |
| | | initialWidth: 50 |
| | | }, |
| | | { |
| | | label: '发票单价', |
| | | fieldName: 'esdetInvoiceUnitprice', |
| | | hideDefaultActions: true, |
| | | wrapText: true, |
| | | type: 'number', |
| | | typeAttributes: { |
| | | minimumFractionDigits: 2 |
| | | } |
| | | }, |
| | | { |
| | | label: '发票数量', |
| | | fieldName: 'esdetInvoicedCount', |
| | | cellAttributes: { alignment: 'right' }, |
| | | hideDefaultActions: true, |
| | | wrapText: true |
| | | }, |
| | | { |
| | | label: '发票票面金额(元)', |
| | | fieldName: 'esdetInvoicedProCostRMB', |
| | | hideDefaultActions: true, |
| | | wrapText: true, |
| | | cellAttributes: { alignment: 'right' }, |
| | | initialWidth: 145, |
| | | type: 'number', |
| | | typeAttributes: { |
| | | minimumFractionDigits: 2 |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | label: "发票数量", |
| | | fieldName: "esdetInvoicedCount", |
| | | cellAttributes: { alignment: "right" }, |
| | | hideDefaultActions: true, |
| | | wrapText: true |
| | | }, |
| | | { |
| | | label: "发票票面金额(元)", |
| | | fieldName: "esdetInvoicedProCostRMB", |
| | | hideDefaultActions: true, |
| | | wrapText: true, |
| | | cellAttributes: { alignment: "right" }, |
| | | initialWidth: 145, |
| | | type: "number", |
| | | typeAttributes: { |
| | | minimumFractionDigits: 2 |
| | | } |
| | | } |
| | | ]; |
| | | const invoiceColumns = [ |
| | | { |
| | | label: "发票日期", |
| | | fieldName: "Invoice_Date__c", |
| | | hideDefaultActions: true, |
| | | initialWidth: 150 |
| | | }, |
| | | { |
| | | label: "发票号", |
| | | type: "url", |
| | | fieldName: "NameUrl", |
| | | typeAttributes: { |
| | | label: { fieldName: "Name" } |
| | | { |
| | | label: '发票日期', |
| | | fieldName: 'Invoice_Date__c', |
| | | hideDefaultActions: true, |
| | | initialWidth: 150 |
| | | }, |
| | | hideDefaultActions: true |
| | | }, |
| | | { |
| | | label: "客户名", |
| | | fieldName: "ShipmentAccount__c", |
| | | hideDefaultActions: true, |
| | | wrapText: true |
| | | }, |
| | | { |
| | | label: "发票状态", |
| | | fieldName: "Invoice_status__c", |
| | | hideDefaultActions: true, |
| | | initialWidth: 100 |
| | | }, |
| | | { |
| | | label: "发票账面金额(元)", |
| | | fieldName: "Invoice_total_amount__c", |
| | | hideDefaultActions: true, |
| | | type: "number", |
| | | typeAttributes: { |
| | | minimumFractionDigits: 2 |
| | | { |
| | | label: '发票号', |
| | | type: 'url', |
| | | fieldName: 'NameUrl', |
| | | typeAttributes: { |
| | | label: { fieldName: 'Name' } |
| | | }, |
| | | hideDefaultActions: true |
| | | }, |
| | | initialWidth: 180 |
| | | }, |
| | | { |
| | | label: "发票附件", |
| | | fieldName: "Invoice_attachment__c", |
| | | type: "boolean", |
| | | hideDefaultActions: true, |
| | | initialWidth: 120 |
| | | }, |
| | | { |
| | | label: "发票明细附件", |
| | | fieldName: "Invoicedet_attachment__c", |
| | | type: "boolean", |
| | | hideDefaultActions: true, |
| | | initialWidth: 120 |
| | | } |
| | | { |
| | | label: '客户名', |
| | | fieldName: 'ShipmentAccount__c', |
| | | hideDefaultActions: true, |
| | | wrapText: true |
| | | }, |
| | | { |
| | | label: '发票状态', |
| | | fieldName: 'Invoice_status__c', |
| | | hideDefaultActions: true, |
| | | initialWidth: 100 |
| | | }, |
| | | { |
| | | label: '发票账面金额(元)', |
| | | fieldName: 'Invoice_total_amount__c', |
| | | hideDefaultActions: true, |
| | | type: 'number', |
| | | typeAttributes: { |
| | | minimumFractionDigits: 2 |
| | | }, |
| | | initialWidth: 180 |
| | | }, |
| | | { |
| | | label: '发票附件', |
| | | fieldName: 'Invoice_attachment__c', |
| | | type: 'boolean', |
| | | hideDefaultActions: true, |
| | | initialWidth: 120 |
| | | }, |
| | | { |
| | | label: '发票明细附件', |
| | | fieldName: 'Invoicedet_attachment__c', |
| | | type: 'boolean', |
| | | hideDefaultActions: true, |
| | | initialWidth: 120 |
| | | } |
| | | ]; |
| | | const detailsColumns = [ |
| | | { |
| | | label: "产品型号", |
| | | fieldName: "esdAssetModelNo", |
| | | hideDefaultActions: true, |
| | | initialWidth: 150, |
| | | wrapText: true |
| | | }, |
| | | { |
| | | label: "规格", |
| | | fieldName: "packingListManual", |
| | | hideDefaultActions: true, |
| | | initialWidth: 50 |
| | | }, |
| | | { |
| | | label: "出货单价(元)", |
| | | fieldName: "esdDeliveryListRMB", |
| | | hideDefaultActions: true, |
| | | initialWidth: 100, |
| | | type: "number", |
| | | typeAttributes: { |
| | | minimumFractionDigits: 2 |
| | | } |
| | | }, |
| | | { |
| | | label: "出货数量", |
| | | fieldName: "esdShipmentCount", |
| | | hideDefaultActions: true |
| | | }, |
| | | { |
| | | label: "返品数量", |
| | | fieldName: "esdRrturnProCount", |
| | | hideDefaultActions: true |
| | | }, |
| | | { |
| | | label: "出库单位", |
| | | fieldName: "esdBoxPiece", |
| | | hideDefaultActions: true |
| | | }, |
| | | { |
| | | label: "已发票数量", |
| | | fieldName: "esdInvoicedProcount", |
| | | hideDefaultActions: true, |
| | | type: "number", |
| | | typeAttributes: { |
| | | minimumFractionDigits: 2 |
| | | } |
| | | }, |
| | | { |
| | | label: "还没发票数量", |
| | | fieldName: "esdInvoiceProNotCount", |
| | | hideDefaultActions: true, |
| | | initialWidth: 100, |
| | | type: "number", |
| | | typeAttributes: { |
| | | minimumFractionDigits: 2 |
| | | } |
| | | }, |
| | | { |
| | | label: "开票单位", |
| | | hideDefaultActions: true, |
| | | type: "customUnit", |
| | | typeAttributes: { |
| | | unitValue: { fieldName: "unitValue" }, |
| | | unitOptions: { fieldName: "unitOptions" }, |
| | | recordId: { fieldName: "recordId" }, |
| | | isDisabled: { fieldName: "isDisabled" } |
| | | } |
| | | }, |
| | | { |
| | | label: "发票单价", |
| | | fieldName: "esdInvoiceUnitprice", |
| | | hideDefaultActions: true, |
| | | type: "number", |
| | | typeAttributes: { |
| | | minimumFractionDigits: 2 |
| | | { |
| | | label: '产品型号', |
| | | fieldName: 'esdAssetModelNo', |
| | | hideDefaultActions: true, |
| | | initialWidth: 150, |
| | | wrapText: true |
| | | }, |
| | | initialWidth: 130 |
| | | }, |
| | | { |
| | | label: "发票数量", |
| | | //fieldName: "invoiceCount", |
| | | hideDefaultActions: true, |
| | | type: "customShipment", |
| | | cellAttributes: { alignment: "right" }, |
| | | typeAttributes: { |
| | | recordId: { fieldName: "recordId" }, |
| | | shipmentNumber: { fieldName: "shipmentNumber" }, |
| | | isConinvoice: { fieldName: "isConinvoice" }, |
| | | esdInvoiceProNotCount: { fieldName: "esdInvoiceProNotCount" } |
| | | { |
| | | label: '规格', |
| | | fieldName: 'packingListManual', |
| | | hideDefaultActions: true, |
| | | initialWidth: 50 |
| | | }, |
| | | { |
| | | label: '出货单价(元)', |
| | | fieldName: 'esdDeliveryListRMB', |
| | | hideDefaultActions: true, |
| | | initialWidth: 100, |
| | | type: 'number', |
| | | typeAttributes: { |
| | | minimumFractionDigits: 2 |
| | | } |
| | | }, |
| | | { |
| | | label: '出货数量', |
| | | fieldName: 'esdShipmentCount', |
| | | hideDefaultActions: true |
| | | }, |
| | | { |
| | | label: '返品数量', |
| | | fieldName: 'esdRrturnProCount', |
| | | hideDefaultActions: true |
| | | }, |
| | | { |
| | | label: '出库单位', |
| | | fieldName: 'esdBoxPiece', |
| | | hideDefaultActions: true |
| | | }, |
| | | { |
| | | label: '已发票数量', |
| | | fieldName: 'esdInvoicedProcount', |
| | | hideDefaultActions: true, |
| | | type: 'number', |
| | | typeAttributes: { |
| | | minimumFractionDigits: 2 |
| | | } |
| | | }, |
| | | { |
| | | label: '还没发票数量', |
| | | fieldName: 'esdInvoiceProNotCount', |
| | | hideDefaultActions: true, |
| | | initialWidth: 100, |
| | | type: 'number', |
| | | typeAttributes: { |
| | | minimumFractionDigits: 2 |
| | | } |
| | | }, |
| | | { |
| | | label: '开票单位', |
| | | hideDefaultActions: true, |
| | | type: 'customUnit', |
| | | typeAttributes: { |
| | | unitValue: { fieldName: 'unitValue' }, |
| | | unitOptions: { fieldName: 'unitOptions' }, |
| | | recordId: { fieldName: 'recordId' }, |
| | | isDisabled: { fieldName: 'isDisabled' } |
| | | } |
| | | }, |
| | | { |
| | | label: '发票单价', |
| | | fieldName: 'esdInvoiceUnitprice', |
| | | hideDefaultActions: true, |
| | | type: 'number', |
| | | typeAttributes: { |
| | | minimumFractionDigits: 2 |
| | | }, |
| | | initialWidth: 130 |
| | | }, |
| | | { |
| | | label: '发票数量', |
| | | //fieldName: "invoiceCount", |
| | | hideDefaultActions: true, |
| | | type: 'customShipment', |
| | | cellAttributes: { alignment: 'right' }, |
| | | typeAttributes: { |
| | | recordId: { fieldName: 'recordId' }, |
| | | shipmentNumber: { fieldName: 'shipmentNumber' }, |
| | | isConinvoice: { fieldName: 'isConinvoice' }, |
| | | esdInvoiceProNotCount: { fieldName: 'esdInvoiceProNotCount' } |
| | | } |
| | | }, |
| | | { |
| | | label: '发票票面金额(元)', |
| | | cellAttributes: { alignment: 'right' }, |
| | | fieldName: 'invoiceAllprice', |
| | | hideDefaultActions: true, |
| | | type: 'number', |
| | | initialWidth: 150, |
| | | typeAttributes: { |
| | | minimumFractionDigits: 2 |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | label: "发票票面金额(元)", |
| | | cellAttributes: { alignment: "right" }, |
| | | fieldName: "invoiceAllprice", |
| | | hideDefaultActions: true, |
| | | type: "number", |
| | | initialWidth: 150, |
| | | typeAttributes: { |
| | | minimumFractionDigits: 2 |
| | | } |
| | | } |
| | | ]; |
| | | const customLabel = { |
| | | LexConInvoiceViewReport |
| | | LexConInvoiceViewReport |
| | | }; |
| | | export default class LexConInvoiceView extends NavigationMixin( |
| | | LightningElement |
| | | LightningElement |
| | | ) { |
| | | @track label = customLabel; |
| | | invoiceColumns = invoiceColumns; |
| | | detailsColumns = detailsColumns; |
| | | @track outboundColumns = [ |
| | | { |
| | | label: "出库日期", |
| | | fieldName: "esdOutboundDate", |
| | | hideDefaultActions: true, |
| | | wrapText: true |
| | | }, |
| | | { |
| | | label: "出库单编码", |
| | | fieldName: "esdNameUrl", |
| | | type: "url", |
| | | typeAttributes: { |
| | | label: { fieldName: "esdName" }, |
| | | target: "_blank" |
| | | }, |
| | | hideDefaultActions: true, |
| | | wrapText: true |
| | | } |
| | | ]; |
| | | @track outboundData = []; |
| | | @track outboundDataSumPrice = []; |
| | | @track invoiceData = []; |
| | | @track invoiceAllpriceData = []; |
| | | @track detailsSelectedRows = []; |
| | | @track showAttPop = false; |
| | | |
| | | @track invoiceId = ""; |
| | | @track orderId = ""; |
| | | @track userWorkLocation = ""; |
| | | @track deliveryId = ""; |
| | | @track cocId = ""; |
| | | @track statusEdit = ""; |
| | | @track coc = {}; |
| | | @track EditAble = false; |
| | | @track isChange = false; |
| | | @track sumPrice = 0.0; |
| | | @track OrderCode = ""; |
| | | @track ExistOutbound = false; |
| | | @track reopen = ""; |
| | | @track invoiceOrderRecoedschange = []; |
| | | @track isNew = ""; |
| | | @track outOrderStringListLwc = []; |
| | | @track outordercountMapLwc = {}; |
| | | @track selectedRows = []; |
| | | @track detailsInvoiceId = ""; |
| | | @track detailsCocId = ""; |
| | | @track detailsData = []; |
| | | @track invoiceAllprice = 0.0; |
| | | //状态 |
| | | @track invoiceStatusValue = ""; |
| | | @track invoiceStatusOptions = []; |
| | | get Options() { |
| | | return this.invoiceStatusOptions; |
| | | } |
| | | //出库从 |
| | | @track deliveryFromDate = ""; |
| | | //出库到 |
| | | @track deliveryToDate = ""; |
| | | //发票号 |
| | | @track category1 = ""; |
| | | //客户名 |
| | | @track category2 = ""; |
| | | @track ConInvoiceListAccountId = ""; |
| | | @track ConInvoiceListUserWorkLocation = ""; |
| | | @track ConInvoiceListAgencyProType = ""; |
| | | |
| | | //二级经销商 |
| | | @track provinceOptsMap = []; |
| | | @track secondaryDistributor = ""; |
| | | //客户名 |
| | | @track isModalOpen = false; |
| | | @track HospitalName = ""; |
| | | @track HospitalInfo = ""; |
| | | @track searchHospitalName = ""; |
| | | @track isDisabledHospitalName = false; |
| | | @track agencyProType = ""; |
| | | @track accountid = ""; |
| | | @track hospitalList = []; |
| | | hospitalColumns = hospitalColumns; |
| | | //发票日期 |
| | | @track InvoiceDate = ""; |
| | | //科室 |
| | | @track ForCustomerText = ""; |
| | | //备注 |
| | | @track InvoiceNote = ""; |
| | | |
| | | //发票明细 |
| | | @track invoiceOrderdetail1Recoeds = []; |
| | | invoiceDetailsColumns = invoiceDetailsColumns; |
| | | |
| | | //显示 |
| | | @track isShowSecondaryDistributor = false; |
| | | @track isEditInvoice = false; |
| | | @track isShowSpinner = true; |
| | | @track hideCheckbox = true; |
| | | @track done = false; |
| | | @track isConInvoiceList = true; |
| | | @track isDetailsShow = false; |
| | | |
| | | //disable |
| | | @track isDisabledEdit = false; |
| | | @track isDisabledReopen = false; |
| | | @track isDisabledDelete = false; |
| | | @track isDisabledAttachment = false; |
| | | @track isOpenReportDisabled = true; |
| | | |
| | | //文件上传 |
| | | @track showLoadingSpinner = false; |
| | | @track showPopSpinner = false; |
| | | @track UploadFile = "Upload File"; |
| | | @track fileName = ""; |
| | | @track fileData = []; |
| | | @track fileColumns = [ |
| | | { |
| | | label: "标题", |
| | | fieldName: "url", |
| | | type: "url", |
| | | typeAttributes: { label: { fieldName: "Title" }, target: "_blank" }, |
| | | hideDefaultActions: true |
| | | }, |
| | | { |
| | | label: "创建人", |
| | | type: "url", |
| | | fieldName: "CreatedByNameUrl", |
| | | typeAttributes: { |
| | | label: { fieldName: "CreatedByName" }, |
| | | target: "_blank" |
| | | }, |
| | | hideDefaultActions: true |
| | | }, |
| | | { |
| | | label: "上传日期", |
| | | type: "date", |
| | | typeAttributes: { |
| | | year: "numeric", |
| | | month: "long", |
| | | day: "2-digit", |
| | | hour: "2-digit", |
| | | minute: "2-digit" |
| | | }, |
| | | fieldName: "CreatedDate", |
| | | hideDefaultActions: true |
| | | }, |
| | | { |
| | | label: "附件类型", |
| | | type: "customAttachmentType", |
| | | typeAttributes: { |
| | | typeValue: { fieldName: "typeValue" }, |
| | | typeOptions: { fieldName: "typeOptions" }, |
| | | recordId: { fieldName: "recordId" }, |
| | | isDisabledAttachment: { fieldName: "isDisabledAttachment" } |
| | | }, |
| | | hideDefaultActions: true |
| | | }, |
| | | { |
| | | label: "", |
| | | type: "tableCellIcon", |
| | | typeAttributes: { |
| | | iconName: "utility:delete", |
| | | recordId: { |
| | | fieldName: "Id" |
| | | @track label = customLabel; |
| | | invoiceColumns = invoiceColumns; |
| | | detailsColumns = detailsColumns; |
| | | @track outboundColumns = [ |
| | | { |
| | | label: '出库日期', |
| | | fieldName: 'esdOutboundDate', |
| | | hideDefaultActions: true, |
| | | wrapText: true |
| | | }, |
| | | { |
| | | label: '出库单编码', |
| | | fieldName: 'esdNameUrl', |
| | | type: 'url', |
| | | typeAttributes: { |
| | | label: { fieldName: 'esdName' }, |
| | | target: '_blank' |
| | | }, |
| | | hideDefaultActions: true, |
| | | wrapText: true |
| | | } |
| | | }, |
| | | initialWidth: 50, |
| | | hideDefaultActions: true |
| | | ]; |
| | | @track outboundData = []; |
| | | @track outboundDataSumPrice = []; |
| | | @track invoiceData = []; |
| | | @track invoiceAllpriceData = []; |
| | | @track detailsSelectedRows = []; |
| | | @track showAttPop = false; |
| | | |
| | | @track invoiceId = ''; |
| | | @track orderId = ''; |
| | | @track userWorkLocation = ''; |
| | | @track deliveryId = ''; |
| | | @track cocId = ''; |
| | | @track statusEdit = ''; |
| | | @track coc = {}; |
| | | @track EditAble = false; |
| | | @track isChange = false; |
| | | @track sumPrice = 0.0; |
| | | @track OrderCode = ''; |
| | | @track ExistOutbound = false; |
| | | @track reopen = ''; |
| | | @track invoiceOrderRecoedschange = []; |
| | | @track isNew = ''; |
| | | @track outOrderStringListLwc = []; |
| | | @track outordercountMapLwc = {}; |
| | | @track selectedRows = []; |
| | | @track detailsInvoiceId = ''; |
| | | @track detailsCocId = ''; |
| | | @track detailsData = []; |
| | | @track invoiceAllprice = 0.0; |
| | | //状态 |
| | | @track invoiceStatusValue = ''; |
| | | @track invoiceStatusOptions = []; |
| | | get Options() { |
| | | return this.invoiceStatusOptions; |
| | | } |
| | | ]; |
| | | filesUploaded = []; |
| | | fileContents; |
| | | fileReader; |
| | | content; |
| | | MAX_FILE_SIZE = 1500000; |
| | | //出库从 |
| | | @track deliveryFromDate = ''; |
| | | //出库到 |
| | | @track deliveryToDate = ''; |
| | | //发票号 |
| | | @track category1 = ''; |
| | | //客户名 |
| | | @track category2 = ''; |
| | | @track ConInvoiceListAccountId = ''; |
| | | @track ConInvoiceListUserWorkLocation = ''; |
| | | @track ConInvoiceListAgencyProType = ''; |
| | | |
| | | stylesLoaded = false; |
| | | renderedCallback() { |
| | | if (!this.stylesLoaded) { |
| | | Promise.all([loadStyle(this, WrappedHeaderTable)]) |
| | | .then(() => { |
| | | console.log("Custom styles loaded"); |
| | | this.stylesLoaded = true; |
| | | }) |
| | | .catch((error) => { |
| | | console.error("Error loading custom styles"); |
| | | }); |
| | | //二级经销商 |
| | | @track provinceOptsMap = []; |
| | | @track secondaryDistributor = ''; |
| | | //客户名 |
| | | @track isModalOpen = false; |
| | | @track HospitalName = ''; |
| | | @track HospitalInfo = ''; |
| | | @track searchHospitalName = ''; |
| | | @track isDisabledHospitalName = false; |
| | | @track agencyProType = ''; |
| | | @track accountid = ''; |
| | | @track hospitalList = []; |
| | | hospitalColumns = hospitalColumns; |
| | | //发票日期 |
| | | @track InvoiceDate = ''; |
| | | //科室 |
| | | @track ForCustomerText = ''; |
| | | //备注 |
| | | @track InvoiceNote = ''; |
| | | |
| | | //发票明细 |
| | | @track invoiceOrderdetail1Recoeds = []; |
| | | invoiceDetailsColumns = invoiceDetailsColumns; |
| | | |
| | | //显示 |
| | | @track isShowSecondaryDistributor = false; |
| | | @track isEditInvoice = false; |
| | | @track isShowSpinner = true; |
| | | @track hideCheckbox = true; |
| | | @track done = false; |
| | | @track isConInvoiceList = true; |
| | | @track isDetailsShow = false; |
| | | |
| | | //disable |
| | | @track isDisabledEdit = false; |
| | | @track isDisabledReopen = false; |
| | | @track isDisabledDelete = false; |
| | | @track isDisabledAttachment = false; |
| | | @track isOpenReportDisabled = true; |
| | | |
| | | //文件上传 |
| | | @track showLoadingSpinner = false; |
| | | @track showPopSpinner = false; |
| | | @track UploadFile = 'Upload File'; |
| | | @track fileName = ''; |
| | | @track fileData = []; |
| | | @track fileColumns = [ |
| | | { |
| | | label: '标题', |
| | | fieldName: 'url', |
| | | type: 'url', |
| | | typeAttributes: { label: { fieldName: 'Title' }, target: '_blank' }, |
| | | hideDefaultActions: true |
| | | }, |
| | | { |
| | | label: '创建人', |
| | | type: 'url', |
| | | fieldName: 'CreatedByNameUrl', |
| | | typeAttributes: { |
| | | label: { fieldName: 'CreatedByName' }, |
| | | target: '_blank' |
| | | }, |
| | | hideDefaultActions: true |
| | | }, |
| | | { |
| | | label: '上传日期', |
| | | type: 'date', |
| | | typeAttributes: { |
| | | year: 'numeric', |
| | | month: 'long', |
| | | day: '2-digit', |
| | | hour: '2-digit', |
| | | minute: '2-digit' |
| | | }, |
| | | fieldName: 'CreatedDate', |
| | | hideDefaultActions: true |
| | | }, |
| | | { |
| | | label: '附件类型', |
| | | type: 'customAttachmentType', |
| | | typeAttributes: { |
| | | typeValue: { fieldName: 'typeValue' }, |
| | | typeOptions: { fieldName: 'typeOptions' }, |
| | | recordId: { fieldName: 'recordId' }, |
| | | isDisabledAttachment: { fieldName: 'isDisabledAttachment' } |
| | | }, |
| | | hideDefaultActions: true |
| | | }, |
| | | { |
| | | label: '', |
| | | type: 'tableCellIcon', |
| | | typeAttributes: { |
| | | iconName: 'utility:delete', |
| | | recordId: { |
| | | fieldName: 'Id' |
| | | } |
| | | }, |
| | | initialWidth: 50, |
| | | hideDefaultActions: true |
| | | } |
| | | ]; |
| | | filesUploaded = []; |
| | | fileContents; |
| | | fileReader; |
| | | content; |
| | | MAX_FILE_SIZE = 1500000; |
| | | |
| | | stylesLoaded = false; |
| | | renderedCallback() { |
| | | if (!this.stylesLoaded) { |
| | | Promise.all([loadStyle(this, WrappedHeaderTable)]) |
| | | .then(() => { |
| | | console.log('Custom styles loaded'); |
| | | this.stylesLoaded = true; |
| | | }) |
| | | .catch((error) => { |
| | | console.error('Error loading custom styles'); |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //获取链接参数 |
| | | getQueryString(name) { |
| | | console.log("getQueryString name " + name); |
| | | let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); |
| | | let r = window.location.search.substr(1).match(reg); |
| | | if (r != null) { |
| | | return decodeURIComponent(r[2]); |
| | | //获取链接参数 |
| | | getQueryString(name) { |
| | | console.log('getQueryString name ' + name); |
| | | let reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i'); |
| | | let r = window.location.search.substr(1).match(reg); |
| | | if (r != null) { |
| | | return decodeURIComponent(r[2]); |
| | | } |
| | | return null; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | connectedCallback() { |
| | | this.init(); |
| | | } |
| | | connectedCallback() { |
| | | this.init(); |
| | | } |
| | | |
| | | init() { |
| | | this.isShowSpinner = true; |
| | | this.deliveryId = this.getQueryString("deliveryId"); |
| | | this.deliveryId = this.deliveryId == null ? "" : this.deliveryId; |
| | | this.invoiceId = this.getQueryString("invoiceId"); |
| | | this.invoiceId = this.invoiceId == null ? "" : this.invoiceId; |
| | | this.orderId = this.getQueryString("orderId"); |
| | | this.orderId = this.orderId == null ? "" : this.orderId; |
| | | this.statusEdit = this.getQueryString("KeyWords"); |
| | | this.statusEdit = this.statusEdit == null ? "" : this.statusEdit; |
| | | this.reopen = this.getQueryString("reopen"); |
| | | this.reopen = this.reopen == null ? "" : this.reopen; |
| | | this.isNew = this.getQueryString("isNew"); |
| | | this.isNew = this.isNew == null ? "" : this.isNew; |
| | | console.log( |
| | | "this.deliveryId = " + |
| | | this.deliveryId + |
| | | " this.invoiceId = " + |
| | | this.invoiceId + |
| | | " this.statusEdit = " + |
| | | this.statusEdit |
| | | ); |
| | | if (this.invoiceId != "" && this.orderId != "") { |
| | | //进入coninvoiceDetails |
| | | detailsInit({ |
| | | orderIdLwc: this.orderId, |
| | | invoiceIdLwc: this.invoiceId |
| | | }) |
| | | .then((r) => { |
| | | r = JSON.parse(JSON.stringify(r)); |
| | | if (r.status == "Success") { |
| | | this.detailsInvoiceId = r.entity.invoicecode.Id; |
| | | this.detailsCocId = r.entity.coc.Id; |
| | | this.detailsData = r.entity.consumableorderdetails1Records; |
| | | for (var i in this.detailsData) { |
| | | this.detailsData[i]["Id"] = this.detailsData[i].esd.Id; |
| | | init() { |
| | | this.isShowSpinner = true; |
| | | this.deliveryId = this.getQueryString('deliveryId'); |
| | | this.deliveryId = this.deliveryId == null ? '' : this.deliveryId; |
| | | this.invoiceId = this.getQueryString('invoiceId'); |
| | | this.invoiceId = this.invoiceId == null ? '' : this.invoiceId; |
| | | this.orderId = this.getQueryString('orderId'); |
| | | this.orderId = this.orderId == null ? '' : this.orderId; |
| | | this.statusEdit = this.getQueryString('KeyWords'); |
| | | this.statusEdit = this.statusEdit == null ? '' : this.statusEdit; |
| | | this.reopen = this.getQueryString('reopen'); |
| | | this.reopen = this.reopen == null ? '' : this.reopen; |
| | | this.isNew = this.getQueryString('isNew'); |
| | | this.isNew = this.isNew == null ? '' : this.isNew; |
| | | console.log( |
| | | 'this.deliveryId = ' + |
| | | this.deliveryId + |
| | | ' this.invoiceId = ' + |
| | | this.invoiceId + |
| | | ' this.statusEdit = ' + |
| | | this.statusEdit |
| | | ); |
| | | if (this.invoiceId != '' && this.orderId != '') { |
| | | //进入coninvoiceDetails |
| | | detailsInit({ |
| | | orderIdLwc: this.orderId, |
| | | invoiceIdLwc: this.invoiceId |
| | | }) |
| | | .then((r) => { |
| | | r = JSON.parse(JSON.stringify(r)); |
| | | if (r.status == 'Success') { |
| | | this.detailsInvoiceId = r.entity.invoicecode.Id; |
| | | this.detailsCocId = r.entity.coc.Id; |
| | | this.detailsData = |
| | | r.entity.consumableorderdetails1Records; |
| | | for (var i in this.detailsData) { |
| | | this.detailsData[i]['Id'] = |
| | | this.detailsData[i].esd.Id; |
| | | |
| | | this.detailsData[i]["esdAssetModelNo"] = |
| | | this.detailsData[i].esd.Asset_Model_No__c; |
| | | this.detailsData[i]["packingListManual"] = |
| | | this.detailsData[i].Packing_list_manual; |
| | | this.detailsData[i]["esdDeliveryListRMB"] = |
| | | this.detailsData[i].esd.Delivery_List_RMB__c; |
| | | this.detailsData[i]["esdShipmentCount"] = |
| | | this.detailsData[i].esd.Shipment_Count__c; |
| | | this.detailsData[i]["esdRrturnProCount"] = |
| | | this.detailsData[i].esd.RrturnPro_count__c; |
| | | this.detailsData[i]["esdBoxPiece"] = |
| | | this.detailsData[i].esd.Box_Piece__c; |
| | | this.detailsData[i]['esdAssetModelNo'] = |
| | | this.detailsData[i].esd.Asset_Model_No__c; |
| | | this.detailsData[i]['packingListManual'] = |
| | | this.detailsData[i].Packing_list_manual; |
| | | this.detailsData[i]['esdDeliveryListRMB'] = |
| | | this.detailsData[i].esd.Delivery_List_RMB__c; |
| | | this.detailsData[i]['esdShipmentCount'] = |
| | | this.detailsData[i].esd.Shipment_Count__c; |
| | | this.detailsData[i]['esdRrturnProCount'] = |
| | | this.detailsData[i].esd.RrturnPro_count__c; |
| | | this.detailsData[i]['esdBoxPiece'] = |
| | | this.detailsData[i].esd.Box_Piece__c; |
| | | |
| | | this.detailsData[i]["esdInvoicedProcount"] = |
| | | this.detailsData[i].esd.Invoiced_Procount__c; |
| | | this.detailsData[i]["esdInvoiceProNotCount"] = |
| | | this.detailsData[i].esd.InvoiceProNot_count__c; |
| | | //开票单位 |
| | | //this.detailsData[i].esd.Box_Piece__c |
| | | //this.detailsData[i]['unitValue'] = this.detailsData[i].esd.Invoice_Unit__c; |
| | | this.detailsData[i]["unitValue"] = |
| | | this.detailsData[i].esd.Box_Piece__c; |
| | | console.log("unitValue = " + this.detailsData[i]["unitValue"]); |
| | | this.detailsData[i]["recordId"] = this.detailsData[i].esd.Id; |
| | | //disabled="{!IF(records.esd.Box_Piece__c =='个' || (records.esd.Box_Piece__c =='盒' && records.Packing_list_manual ==1),true,false)}" |
| | | //this.detailsData[i]['isDisabled'] = (this.detailsData[i].esd.Box_Piece__c == '个' || (this.detailsData[i].esd.Box_Piece__c =='盒' && this.detailsData[i].Packing_list_manual ==1)) ? true:false; |
| | | this.detailsData[i]["isDisabled"] = true; |
| | | let unitOptions = []; |
| | | for (var key in this.detailsData[i].Invoice_UnitOptsMap) { |
| | | let unitOption = {}; |
| | | unitOption["label"] = |
| | | this.detailsData[i].Invoice_UnitOptsMap[key]; |
| | | unitOption["value"] = key; |
| | | unitOptions.push(unitOption); |
| | | } |
| | | this.detailsData[i]["unitOptions"] = unitOptions; |
| | | 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; |
| | | this.detailsData[i]['esdInvoicedProcount'] = |
| | | this.detailsData[i].esd.Invoiced_Procount__c; |
| | | this.detailsData[i]['esdInvoiceProNotCount'] = |
| | | this.detailsData[i].esd.InvoiceProNot_count__c; |
| | | //开票单位 |
| | | //this.detailsData[i].esd.Box_Piece__c |
| | | //this.detailsData[i]['unitValue'] = this.detailsData[i].esd.Invoice_Unit__c; |
| | | this.detailsData[i]['unitValue'] = |
| | | this.detailsData[i].esd.Box_Piece__c; |
| | | console.log( |
| | | 'unitValue = ' + |
| | | this.detailsData[i]['unitValue'] |
| | | ); |
| | | this.detailsData[i]['recordId'] = |
| | | this.detailsData[i].esd.Id; |
| | | //disabled="{!IF(records.esd.Box_Piece__c =='个' || (records.esd.Box_Piece__c =='盒' && records.Packing_list_manual ==1),true,false)}" |
| | | //this.detailsData[i]['isDisabled'] = (this.detailsData[i].esd.Box_Piece__c == '个' || (this.detailsData[i].esd.Box_Piece__c =='盒' && this.detailsData[i].Packing_list_manual ==1)) ? true:false; |
| | | this.detailsData[i]['isDisabled'] = true; |
| | | let unitOptions = []; |
| | | for (var key in this.detailsData[i] |
| | | .Invoice_UnitOptsMap) { |
| | | let unitOption = {}; |
| | | unitOption['label'] = |
| | | this.detailsData[i].Invoice_UnitOptsMap[ |
| | | key |
| | | ]; |
| | | unitOption['value'] = key; |
| | | unitOptions.push(unitOption); |
| | | } |
| | | this.detailsData[i]['unitOptions'] = unitOptions; |
| | | 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.detailsSelectedRows.push(this.detailsData[i]["Id"]); |
| | | this.invoiceAllprice += this.detailsData[i]["invoiceAllprice"]; |
| | | } |
| | | } |
| | | if (this.detailsData[i].check) { |
| | | this.detailsSelectedRows.push( |
| | | this.detailsData[i]['Id'] |
| | | ); |
| | | this.invoiceAllprice += |
| | | this.detailsData[i]['invoiceAllprice']; |
| | | } |
| | | } |
| | | |
| | | console.log( |
| | | "this.detailsData = " + JSON.stringify(this.detailsData) |
| | | ); |
| | | console.log( |
| | | 'this.detailsData = ' + |
| | | JSON.stringify(this.detailsData) |
| | | ); |
| | | |
| | | let lastInvoiceAllprice = { |
| | | invoiceAllprice: this.invoiceAllprice |
| | | }; |
| | | this.invoiceAllpriceData.push(lastInvoiceAllprice); |
| | | console.log( |
| | | "this.invoiceAllpriceData = " + |
| | | JSON.stringify(this.invoiceAllpriceData) |
| | | ); |
| | | let lastInvoiceAllprice = { |
| | | invoiceAllprice: this.invoiceAllprice |
| | | }; |
| | | this.invoiceAllpriceData.push(lastInvoiceAllprice); |
| | | console.log( |
| | | 'this.invoiceAllpriceData = ' + |
| | | JSON.stringify(this.invoiceAllpriceData) |
| | | ); |
| | | |
| | | this.isShowSpinner = false; |
| | | this.isDetailsShow = true; |
| | | } else { |
| | | this.showMyToast("初始化失败", r.msg, "Error"); |
| | | } |
| | | }) |
| | | .catch((error) => { |
| | | this.isShowSpinner = false; |
| | | console.log("error = " + JSON.stringify(error)); |
| | | }); |
| | | } else if ( |
| | | this.deliveryId == "" && |
| | | this.invoiceId == "" && |
| | | this.isNew == "" |
| | | ) { |
| | | console.log("conInvoiceListInit"); |
| | | conInvoiceListInit() |
| | | .then((r) => { |
| | | r = JSON.parse(JSON.stringify(r)); |
| | | console.log("conInvoiceListInit r = " + JSON.stringify(r)); |
| | | if (r.status == "Success") { |
| | | this.ConInvoiceListAccountId = r.entity.accountid; |
| | | this.ConInvoiceListUserWorkLocation = r.entity.userWorkLocation; |
| | | |
| | | this.ConInvoiceListAgencyProType = r.entity.agencyProType; |
| | | //if (this.ConInvoiceListAgencyProType != 'ET') |
| | | this.isOpenReportDisabled = false; |
| | | this.invoiceData = r.entity.raesList; |
| | | for (var i in this.invoiceData) { |
| | | this.invoiceData[i]["NameUrl"] = |
| | | "/lexconinvoiceview?invoiceId=" + this.invoiceData[i].Id; |
| | | } |
| | | console.log( |
| | | "this.invoiceData = " + JSON.stringify(this.invoiceData) |
| | | ); |
| | | for (var key in r.entity.statusMap) { |
| | | let object = {}; |
| | | object["label"] = key; |
| | | object["value"] = r.entity.statusMap[key]; |
| | | this.invoiceStatusOptions.push(object); |
| | | } |
| | | this.invoiceStatusOptions = [...this.invoiceStatusOptions]; |
| | | console.log( |
| | | "this.invoiceStatusOptions = " + |
| | | JSON.stringify(this.invoiceStatusOptions) |
| | | ); |
| | | this.isShowSpinner = false; |
| | | } else { |
| | | this.showMyToast("初始化失败", r.msg, "Error"); |
| | | } |
| | | }) |
| | | .catch((error) => { |
| | | console.log("error = " + JSON.stringify(error)); |
| | | }); |
| | | } else { |
| | | console.log("init"); |
| | | this.isConInvoiceList = false; |
| | | init({ |
| | | invoiceId: this.invoiceId, |
| | | statusEdit: this.statusEdit, |
| | | deliveryId: this.deliveryId |
| | | }) |
| | | .then((r) => { |
| | | r = JSON.parse(JSON.stringify(r)); |
| | | console.log("r = " + JSON.stringify(r)); |
| | | if (r.status == "Success") { |
| | | this.coc = r.entity.coc; |
| | | this.cocId = this.coc.Id; |
| | | this.EditAble = r.entity.EditAble; |
| | | this.isChange = r.entity.isChange; |
| | | this.ExistOutbound = r.entity.ExistOutbound; |
| | | this.outboundData = r.entity.invoiceOrderRecoeds; |
| | | console.log( |
| | | "this.outboundData = " + JSON.stringify(this.outboundData) |
| | | ); |
| | | this.done = r.entity.done; |
| | | this.accountid = r.entity.accountid; |
| | | this.userWorkLocation = r.entity.userWorkLocation; |
| | | this.outOrderStringListLwc = r.entity.outOrderStringList; |
| | | this.outordercountMapLwc = r.entity.outordercountMap; |
| | | this.invoiceOrderRecoedschange = r.entity.invoiceOrderRecoedschange; |
| | | this.isDisabledEdit = |
| | | this.coc.Invoice_status__c == "提交" || |
| | | this.coc.Invoice_status__c == "已完成" |
| | | ? true |
| | | : false; |
| | | this.isDisabledReopen = |
| | | this.coc.Invoice_status__c == "提交" ? false : true; |
| | | this.isDisabledDelete = |
| | | this.coc.Invoice_status__c == "草案中" ? false : true; |
| | | this.isDisabledAttachment = |
| | | this.coc.Invoice_status__c == "已完成" ? true : false; |
| | | this.OrderCode = this.coc.Name; |
| | | this.InvoiceDate = this.coc.Invoice_Date__c; |
| | | |
| | | for (var i in this.outboundData) { |
| | | this.outboundData[i].Id = this.outboundData[i].esd.Id; |
| | | if (this.outboundData[i].check) |
| | | this.selectedRows.push(this.outboundData[i].esd.Id); |
| | | } |
| | | this.selectedRows = [...this.selectedRows]; |
| | | console.log( |
| | | "r.entity.attachmentRecoeds = " + |
| | | JSON.stringify(r.entity.attachmentRecoeds) |
| | | ); |
| | | if (!this.EditAble) { |
| | | //附件显示 |
| | | this.showLoadingSpinner = true; |
| | | this.fileData = r.entity.attachmentRecoeds; |
| | | for (var i in this.fileData) { |
| | | this.fileData[i]["Id"] = this.fileData[i].cvInfo.Id; |
| | | this.fileData[i]["recordId"] = this.fileData[i].cvInfo.Id; |
| | | this.fileData[i]["url"] = "/" + this.fileData[i].cvInfo.Id; |
| | | this.fileData[i]["Title"] = this.fileData[i].cvInfo.Title; |
| | | this.fileData[i]["CreatedByName"] = |
| | | this.fileData[i].cvInfo.Owner.Name; |
| | | this.fileData[i]["CreatedByNameUrl"] = |
| | | "/" + this.fileData[i].cvInfo.OwnerId; |
| | | this.fileData[i]["CreatedDate"] = |
| | | this.fileData[i].cvInfo.CreatedDate; |
| | | this.fileData[i]["attUrl"] = "/" + this.fileData[i].cvInfo.Id; |
| | | this.fileData[i]["downloadUrl"] = |
| | | "/sfc/servlet.shepherd/document/download/" + |
| | | this.fileData[i].cvInfo.ContentDocumentId + |
| | | "?operationContext=S1"; |
| | | if (this.isDisabledAttachment) { |
| | | console.log("进入this.isDisabledAttachment"); |
| | | this.fileData[i]["isDisabledAttachment"] = true; |
| | | } |
| | | let typeOptions = []; |
| | | for (var key in this.fileData[i].mailSelectOptsMap) { |
| | | let typeOption = {}; |
| | | typeOption["label"] = this.fileData[i].mailSelectOptsMap[key]; |
| | | typeOption["value"] = key; |
| | | typeOptions.push(typeOption); |
| | | } |
| | | this.fileData[i]["typeValue"] = |
| | | this.fileData[i].mailSelectOptsin == null |
| | | ? typeOptions[0].value |
| | | : this.fileData[i].mailSelectOptsin; |
| | | this.fileData[i]["typeOptions"] = typeOptions; |
| | | this.fileData[i]["mailSelectOptsin"] = |
| | | this.fileData[i].mailSelectOptsin == null |
| | | ? typeOptions[0].value |
| | | : this.fileData[i].mailSelectOptsin; |
| | | } |
| | | console.log("this.fileData = " + JSON.stringify(this.fileData)); |
| | | } |
| | | |
| | | //发票明细 |
| | | this.invoiceOrderdetail1Recoeds = |
| | | r.entity.invoiceOrderdetail1Recoeds; |
| | | for (var i in this.invoiceOrderdetail1Recoeds) { |
| | | this.invoiceOrderdetail1Recoeds[i]["esdetProductOutDate"] = |
| | | this.invoiceOrderdetail1Recoeds[i].esdet.Product_OutDate__c; |
| | | this.invoiceOrderdetail1Recoeds[i]["esdetInvoicedet1ODlinkName"] = |
| | | this.invoiceOrderdetail1Recoeds[ |
| | | i |
| | | ].esdet.Invoicedet1_OD_link__r.Name; |
| | | this.invoiceOrderdetail1Recoeds[i]["esdetAssetModelNo"] = |
| | | this.invoiceOrderdetail1Recoeds[i].esdet.Asset_Model_No__c; |
| | | this.invoiceOrderdetail1Recoeds[i]["esdetInvoiceUnit"] = |
| | | this.invoiceOrderdetail1Recoeds[i].esdet.Invoice_Unit__c; |
| | | this.invoiceOrderdetail1Recoeds[i]["esdetInvoiceUnitprice"] = |
| | | this.invoiceOrderdetail1Recoeds[i].esdet.Invoice_Unitprice__c; |
| | | this.invoiceOrderdetail1Recoeds[i]["esdetInvoicedCount"] = |
| | | this.invoiceOrderdetail1Recoeds[i].esdet.Invoiced_Count__c; |
| | | this.invoiceOrderdetail1Recoeds[i]["esdetInvoicedProCostRMB"] = |
| | | this.invoiceOrderdetail1Recoeds[i].esdet.InvoicedProCost_RMB__c; |
| | | } |
| | | //客户名 |
| | | this.HospitalName = r.entity.HospitalName; |
| | | this.HospitalInfo = r.entity.HospitalInfo; |
| | | this.agencyProType = r.entity.agencyProType; |
| | | //if (this.agencyProType != 'ET') |
| | | this.isOpenReportDisabled = false; |
| | | //科室 |
| | | this.ForCustomerText = this.coc.Order_ForCustomerText__c; |
| | | //备注 |
| | | this.InvoiceNote = this.coc.Invoice_Note__c; |
| | | //二级经销商 |
| | | for (var key in r.entity.provinceOptsMap) { |
| | | let object = {}; |
| | | object["label"] = r.entity.provinceOptsMap[key]; |
| | | object["value"] = key; |
| | | this.provinceOptsMap.push(object); |
| | | } |
| | | //出货一览columns |
| | | |
| | | if (this.EditAble) { |
| | | let object1 = { |
| | | label: "客户名", |
| | | fieldName: "hospitalName", |
| | | hideDefaultActions: true, |
| | | wrapText: true |
| | | }; |
| | | let object2 = { |
| | | label: "出货金额(元)", |
| | | fieldName: "shipmentAmount", |
| | | type: "number", |
| | | typeAttributes: { |
| | | minimumFractionDigits: 2 |
| | | }, |
| | | hideDefaultActions: true |
| | | }; |
| | | let object3 = { |
| | | label: "返品金额(元)", |
| | | fieldName: "returnAmount", |
| | | type: "number", |
| | | typeAttributes: { |
| | | minimumFractionDigits: 2 |
| | | }, |
| | | hideDefaultActions: true |
| | | }; |
| | | this.outboundColumns.push(object1); |
| | | this.outboundColumns.push(object2); |
| | | this.outboundColumns.push(object3); |
| | | } |
| | | let object4 = { |
| | | label: "未发票金额(元)", |
| | | fieldName: "uninvoicedAmount", |
| | | type: "number", |
| | | typeAttributes: { |
| | | minimumFractionDigits: 2 |
| | | }, |
| | | hideDefaultActions: true |
| | | }; |
| | | this.outboundColumns.push(object4); |
| | | |
| | | //出货一览Data |
| | | let index = 0; |
| | | for (var i in this.outboundData) { |
| | | this.outboundData[i]["esdOutboundDate"] = |
| | | this.outboundData[i].esd.Outbound_Date__c; |
| | | this.outboundData[i]["esdNameUrl"] = |
| | | "/s/lexsummonscreat?ESetid=" + this.outboundData[i].esd.Id; |
| | | this.outboundData[i]["esdName"] = this.outboundData[i].esd.Name; |
| | | if (this.EditAble) { |
| | | this.outboundData[i]["hospitalName"] = |
| | | this.outboundData[i].esd.ShipmentAccount__c; |
| | | this.outboundData[i]["shipmentAmount"] = |
| | | this.outboundData[i].esd.Shipment_total_amount__c; |
| | | this.outboundData[i]["returnAmount"] = |
| | | this.outboundData[i].esd.RrturnPro_total_amount__c; |
| | | } |
| | | this.outboundData[i]["uninvoicedAmount"] = |
| | | this.outboundData[i].esd.InvoiceNotPro_money__c; |
| | | this.outboundData[i]["invoiceFaceAmount"] = |
| | | this.keepTwoDecimalStr(this.outboundData[i].needInvoiceCount); |
| | | if ( |
| | | !( |
| | | this.outboundData[i].esd.Billed_Status__c == "全部开票" || |
| | | this.EditAble || |
| | | this.coc.Invoice_status__c != "草案中" |
| | | ) |
| | | ) { |
| | | console.log("进入 if"); |
| | | let url = |
| | | "/lexconinvoiceview?orderId=" + |
| | | this.outboundData[i].esd.Id + |
| | | "&invoiceId=" + |
| | | this.invoiceId; |
| | | this.outboundData[i]["invoiceFaceAmountUrl"] = url; |
| | | if (index == 0) { |
| | | let object5 = { |
| | | label: "发票票面金额(元)", |
| | | cellAttributes: { alignment: "right" }, |
| | | type: "url", |
| | | fieldName: "invoiceFaceAmountUrl", |
| | | typeAttributes: { |
| | | label: { |
| | | fieldName: "invoiceFaceAmount" |
| | | } |
| | | //target: "_blank", |
| | | }, |
| | | hideDefaultActions: true |
| | | }; |
| | | this.outboundColumns.push(object5); |
| | | index++; |
| | | } |
| | | } else { |
| | | console.log("进入 else"); |
| | | if (index == 0) { |
| | | let object5 = { |
| | | label: "发票票面金额(元)", |
| | | cellAttributes: { alignment: "right" }, |
| | | fieldName: "invoiceFaceAmount", |
| | | hideDefaultActions: true, |
| | | type: "number", |
| | | typeAttributes: { |
| | | minimumFractionDigits: 2 |
| | | this.isShowSpinner = false; |
| | | this.isDetailsShow = true; |
| | | } else { |
| | | this.showMyToast('初始化失败', r.msg, 'Error'); |
| | | } |
| | | }; |
| | | this.outboundColumns.push(object5); |
| | | index++; |
| | | }) |
| | | .catch((error) => { |
| | | this.isShowSpinner = false; |
| | | console.log('error = ' + JSON.stringify(error)); |
| | | }); |
| | | } else if ( |
| | | this.deliveryId == '' && |
| | | this.invoiceId == '' && |
| | | this.isNew == '' |
| | | ) { |
| | | console.log('conInvoiceListInit'); |
| | | conInvoiceListInit() |
| | | .then((r) => { |
| | | r = JSON.parse(JSON.stringify(r)); |
| | | console.log('conInvoiceListInit r = ' + JSON.stringify(r)); |
| | | if (r.status == 'Success') { |
| | | this.ConInvoiceListAccountId = r.entity.accountid; |
| | | this.ConInvoiceListUserWorkLocation = |
| | | r.entity.userWorkLocation; |
| | | |
| | | this.ConInvoiceListAgencyProType = |
| | | r.entity.agencyProType; |
| | | //if (this.ConInvoiceListAgencyProType != 'ET') |
| | | this.isOpenReportDisabled = false; |
| | | this.invoiceData = r.entity.raesList; |
| | | for (var i in this.invoiceData) { |
| | | this.invoiceData[i]['NameUrl'] = |
| | | '/lexconinvoiceview?invoiceId=' + |
| | | this.invoiceData[i].Id; |
| | | } |
| | | console.log( |
| | | 'this.invoiceData = ' + |
| | | JSON.stringify(this.invoiceData) |
| | | ); |
| | | for (var key in r.entity.statusMap) { |
| | | let object = {}; |
| | | object['label'] = key; |
| | | object['value'] = r.entity.statusMap[key]; |
| | | this.invoiceStatusOptions.push(object); |
| | | } |
| | | this.invoiceStatusOptions = [ |
| | | ...this.invoiceStatusOptions |
| | | ]; |
| | | console.log( |
| | | 'this.invoiceStatusOptions = ' + |
| | | JSON.stringify(this.invoiceStatusOptions) |
| | | ); |
| | | this.isShowSpinner = false; |
| | | } else { |
| | | this.showMyToast('初始化失败', r.msg, 'Error'); |
| | | } |
| | | }) |
| | | .catch((error) => { |
| | | console.log('error = ' + JSON.stringify(error)); |
| | | }); |
| | | } else { |
| | | console.log('init'); |
| | | this.isConInvoiceList = false; |
| | | init({ |
| | | invoiceId: this.invoiceId, |
| | | statusEdit: this.statusEdit, |
| | | deliveryId: this.deliveryId |
| | | }) |
| | | .then((r) => { |
| | | r = JSON.parse(JSON.stringify(r)); |
| | | console.log('r = ' + JSON.stringify(r)); |
| | | if (r.status == 'Success') { |
| | | this.coc = r.entity.coc; |
| | | this.cocId = this.coc.Id; |
| | | this.EditAble = r.entity.EditAble; |
| | | this.isChange = r.entity.isChange; |
| | | this.ExistOutbound = r.entity.ExistOutbound; |
| | | this.outboundData = r.entity.invoiceOrderRecoeds; |
| | | console.log( |
| | | 'this.outboundData = ' + |
| | | JSON.stringify(this.outboundData) |
| | | ); |
| | | this.done = r.entity.done; |
| | | this.accountid = r.entity.accountid; |
| | | this.userWorkLocation = r.entity.userWorkLocation; |
| | | this.outOrderStringListLwc = |
| | | r.entity.outOrderStringList; |
| | | this.outordercountMapLwc = r.entity.outordercountMap; |
| | | this.invoiceOrderRecoedschange = |
| | | r.entity.invoiceOrderRecoedschange; |
| | | this.isDisabledEdit = |
| | | this.coc.Invoice_status__c == '提交' || |
| | | this.coc.Invoice_status__c == '已完成' |
| | | ? true |
| | | : false; |
| | | this.isDisabledReopen = |
| | | this.coc.Invoice_status__c == '提交' ? false : true; |
| | | this.isDisabledDelete = |
| | | this.coc.Invoice_status__c == '草案中' |
| | | ? false |
| | | : true; |
| | | this.isDisabledAttachment = |
| | | this.coc.Invoice_status__c == '已完成' |
| | | ? true |
| | | : false; |
| | | this.OrderCode = this.coc.Name; |
| | | this.InvoiceDate = this.coc.Invoice_Date__c; |
| | | |
| | | for (var i in this.outboundData) { |
| | | this.outboundData[i].Id = |
| | | this.outboundData[i].esd.Id; |
| | | if (this.outboundData[i].check) |
| | | this.selectedRows.push( |
| | | this.outboundData[i].esd.Id |
| | | ); |
| | | } |
| | | this.selectedRows = [...this.selectedRows]; |
| | | console.log( |
| | | 'r.entity.attachmentRecoeds = ' + |
| | | JSON.stringify(r.entity.attachmentRecoeds) |
| | | ); |
| | | if (!this.EditAble) { |
| | | //附件显示 |
| | | this.showLoadingSpinner = true; |
| | | this.fileData = r.entity.attachmentRecoeds; |
| | | for (var i in this.fileData) { |
| | | this.fileData[i]['Id'] = |
| | | this.fileData[i].cvInfo.Id; |
| | | this.fileData[i]['recordId'] = |
| | | this.fileData[i].cvInfo.Id; |
| | | this.fileData[i]['url'] = |
| | | '/' + this.fileData[i].cvInfo.Id; |
| | | this.fileData[i]['Title'] = |
| | | this.fileData[i].cvInfo.Title; |
| | | this.fileData[i]['CreatedByName'] = |
| | | this.fileData[i].cvInfo.Owner.Name; |
| | | this.fileData[i]['CreatedByNameUrl'] = |
| | | '/' + this.fileData[i].cvInfo.OwnerId; |
| | | this.fileData[i]['CreatedDate'] = |
| | | this.fileData[i].cvInfo.CreatedDate; |
| | | this.fileData[i]['attUrl'] = |
| | | '/' + this.fileData[i].cvInfo.Id; |
| | | this.fileData[i]['downloadUrl'] = |
| | | '/sfc/servlet.shepherd/document/download/' + |
| | | this.fileData[i].cvInfo.ContentDocumentId + |
| | | '?operationContext=S1'; |
| | | if (this.isDisabledAttachment) { |
| | | console.log( |
| | | '进入this.isDisabledAttachment' |
| | | ); |
| | | this.fileData[i][ |
| | | 'isDisabledAttachment' |
| | | ] = true; |
| | | } |
| | | let typeOptions = []; |
| | | for (var key in this.fileData[i] |
| | | .mailSelectOptsMap) { |
| | | let typeOption = {}; |
| | | typeOption['label'] = |
| | | this.fileData[i].mailSelectOptsMap[key]; |
| | | typeOption['value'] = key; |
| | | typeOptions.push(typeOption); |
| | | } |
| | | this.fileData[i]['typeValue'] = |
| | | this.fileData[i].mailSelectOptsin == null |
| | | ? typeOptions[0].value |
| | | : this.fileData[i].mailSelectOptsin; |
| | | this.fileData[i]['typeOptions'] = typeOptions; |
| | | this.fileData[i]['mailSelectOptsin'] = |
| | | this.fileData[i].mailSelectOptsin == null |
| | | ? typeOptions[0].value |
| | | : this.fileData[i].mailSelectOptsin; |
| | | } |
| | | console.log( |
| | | 'this.fileData = ' + |
| | | JSON.stringify(this.fileData) |
| | | ); |
| | | } |
| | | |
| | | //发票明细 |
| | | this.invoiceOrderdetail1Recoeds = |
| | | r.entity.invoiceOrderdetail1Recoeds; |
| | | for (var i in this.invoiceOrderdetail1Recoeds) { |
| | | this.invoiceOrderdetail1Recoeds[i][ |
| | | 'esdetProductOutDate' |
| | | ] = |
| | | this.invoiceOrderdetail1Recoeds[ |
| | | i |
| | | ].esdet.Product_OutDate__c; |
| | | this.invoiceOrderdetail1Recoeds[i][ |
| | | 'esdetInvoicedet1ODlinkName' |
| | | ] = |
| | | this.invoiceOrderdetail1Recoeds[ |
| | | i |
| | | ].esdet.Invoicedet1_OD_link__r.Name; |
| | | this.invoiceOrderdetail1Recoeds[i][ |
| | | 'esdetAssetModelNo' |
| | | ] = |
| | | this.invoiceOrderdetail1Recoeds[ |
| | | i |
| | | ].esdet.Asset_Model_No__c; |
| | | this.invoiceOrderdetail1Recoeds[i][ |
| | | 'esdetInvoiceUnit' |
| | | ] = |
| | | this.invoiceOrderdetail1Recoeds[ |
| | | i |
| | | ].esdet.Invoice_Unit__c; |
| | | this.invoiceOrderdetail1Recoeds[i][ |
| | | 'esdetInvoiceUnitprice' |
| | | ] = |
| | | this.invoiceOrderdetail1Recoeds[ |
| | | i |
| | | ].esdet.Invoice_Unitprice__c; |
| | | this.invoiceOrderdetail1Recoeds[i][ |
| | | 'esdetInvoicedCount' |
| | | ] = |
| | | this.invoiceOrderdetail1Recoeds[ |
| | | i |
| | | ].esdet.Invoiced_Count__c; |
| | | this.invoiceOrderdetail1Recoeds[i][ |
| | | 'esdetInvoicedProCostRMB' |
| | | ] = |
| | | this.invoiceOrderdetail1Recoeds[ |
| | | i |
| | | ].esdet.InvoicedProCost_RMB__c; |
| | | } |
| | | //客户名 |
| | | this.HospitalName = r.entity.HospitalName; |
| | | this.HospitalInfo = r.entity.HospitalInfo; |
| | | this.agencyProType = r.entity.agencyProType; |
| | | //if (this.agencyProType != 'ET') |
| | | this.isOpenReportDisabled = false; |
| | | //科室 |
| | | this.ForCustomerText = |
| | | this.coc.Order_ForCustomerText__c; |
| | | //备注 |
| | | this.InvoiceNote = this.coc.Invoice_Note__c; |
| | | //二级经销商 |
| | | for (var key in r.entity.provinceOptsMap) { |
| | | let object = {}; |
| | | object['label'] = r.entity.provinceOptsMap[key]; |
| | | object['value'] = key; |
| | | this.provinceOptsMap.push(object); |
| | | } |
| | | //出货一览columns |
| | | |
| | | if (this.EditAble) { |
| | | let object1 = { |
| | | label: '客户名', |
| | | fieldName: 'hospitalName', |
| | | hideDefaultActions: true, |
| | | wrapText: true |
| | | }; |
| | | let object2 = { |
| | | label: '出货金额(元)', |
| | | fieldName: 'shipmentAmount', |
| | | type: 'number', |
| | | typeAttributes: { |
| | | minimumFractionDigits: 2 |
| | | }, |
| | | hideDefaultActions: true |
| | | }; |
| | | let object3 = { |
| | | label: '返品金额(元)', |
| | | fieldName: 'returnAmount', |
| | | type: 'number', |
| | | typeAttributes: { |
| | | minimumFractionDigits: 2 |
| | | }, |
| | | hideDefaultActions: true |
| | | }; |
| | | this.outboundColumns.push(object1); |
| | | this.outboundColumns.push(object2); |
| | | this.outboundColumns.push(object3); |
| | | } |
| | | let object4 = { |
| | | label: '未发票金额(元)', |
| | | fieldName: 'uninvoicedAmount', |
| | | type: 'number', |
| | | typeAttributes: { |
| | | minimumFractionDigits: 2 |
| | | }, |
| | | hideDefaultActions: true |
| | | }; |
| | | this.outboundColumns.push(object4); |
| | | |
| | | //出货一览Data |
| | | let index = 0; |
| | | for (var i in this.outboundData) { |
| | | this.outboundData[i]['esdOutboundDate'] = |
| | | this.outboundData[i].esd.Outbound_Date__c; |
| | | this.outboundData[i]['esdNameUrl'] = |
| | | '/s/lexsummonscreat?ESetid=' + |
| | | this.outboundData[i].esd.Id; |
| | | this.outboundData[i]['esdName'] = |
| | | this.outboundData[i].esd.Name; |
| | | if (this.EditAble) { |
| | | this.outboundData[i]['hospitalName'] = |
| | | this.outboundData[i].esd.ShipmentAccount__c; |
| | | this.outboundData[i]['shipmentAmount'] = |
| | | this.outboundData[ |
| | | i |
| | | ].esd.Shipment_total_amount__c; |
| | | this.outboundData[i]['returnAmount'] = |
| | | this.outboundData[ |
| | | i |
| | | ].esd.RrturnPro_total_amount__c; |
| | | } |
| | | this.outboundData[i]['uninvoicedAmount'] = |
| | | this.outboundData[i].esd.InvoiceNotPro_money__c; |
| | | this.outboundData[i]['invoiceFaceAmount'] = |
| | | this.keepTwoDecimalStr( |
| | | this.outboundData[i].needInvoiceCount |
| | | ); |
| | | if ( |
| | | !( |
| | | this.outboundData[i].esd.Billed_Status__c == |
| | | '全部开票' || |
| | | this.EditAble || |
| | | this.coc.Invoice_status__c != '草案中' |
| | | ) |
| | | ) { |
| | | console.log('进入 if'); |
| | | let url = |
| | | '/lexconinvoiceview?orderId=' + |
| | | this.outboundData[i].esd.Id + |
| | | '&invoiceId=' + |
| | | this.invoiceId; |
| | | this.outboundData[i]['invoiceFaceAmountUrl'] = |
| | | url; |
| | | if (index == 0) { |
| | | let object5 = { |
| | | label: '发票票面金额(元)', |
| | | cellAttributes: { alignment: 'right' }, |
| | | type: 'url', |
| | | fieldName: 'invoiceFaceAmountUrl', |
| | | typeAttributes: { |
| | | label: { |
| | | fieldName: 'invoiceFaceAmount' |
| | | } |
| | | //target: "_blank", |
| | | }, |
| | | hideDefaultActions: true |
| | | }; |
| | | this.outboundColumns.push(object5); |
| | | index++; |
| | | } |
| | | } else { |
| | | console.log('进入 else'); |
| | | if (index == 0) { |
| | | let object5 = { |
| | | label: '发票票面金额(元)', |
| | | cellAttributes: { alignment: 'right' }, |
| | | fieldName: 'invoiceFaceAmount', |
| | | hideDefaultActions: true, |
| | | type: 'number', |
| | | typeAttributes: { |
| | | minimumFractionDigits: 2 |
| | | } |
| | | }; |
| | | this.outboundColumns.push(object5); |
| | | index++; |
| | | } |
| | | } |
| | | //计算发票票面金额 |
| | | this.sumPrice += |
| | | this.outboundData[i].needInvoiceCount; |
| | | } |
| | | |
| | | //四舍五入 |
| | | //this.sumPrice = this.sumPrice.toFixed(2); |
| | | //如果不四舍五入 |
| | | console.log('start keepTwoDecimalStr'); |
| | | this.sumPrice = this.keepTwoDecimalStr(this.sumPrice); |
| | | console.log('end keepTwoDecimalStr = ' + this.sumPrice); |
| | | //加最后一行显示金额 |
| | | if (this.EditAble) { |
| | | let lastOutboundData = { |
| | | invoiceFaceAmount: this.sumPrice |
| | | }; |
| | | this.outboundDataSumPrice.push(lastOutboundData); |
| | | } |
| | | this.outboundColumns = [...this.outboundColumns]; |
| | | |
| | | this.isEditInvoice = !(!this.EditAble || this.isChange); |
| | | if ( |
| | | this.coc.SummonsForDirction__c == '销售给二级经销商' |
| | | ) |
| | | this.isShowSecondaryDistributor = true; |
| | | if ( |
| | | this.deliveryId == '' && |
| | | !this.ExistOutbound && |
| | | this.EditAble |
| | | ) |
| | | this.hideCheckbox = false; |
| | | this.isShowSpinner = false; |
| | | this.showLoadingSpinner = false; |
| | | } else { |
| | | this.showMyToast('失败', r.msg, 'Error'); |
| | | } |
| | | }) |
| | | .catch((error) => { |
| | | console.log('error = ' + JSON.stringify(error)); |
| | | }); |
| | | } |
| | | } |
| | | |
| | | //上传配置单 |
| | | uploadOrder(event) { |
| | | this.showAttPop = true; |
| | | } |
| | | |
| | | //关闭附件弹窗 |
| | | closePop() { |
| | | this.showAttPop = false; |
| | | this.filesUploaded = []; |
| | | this.fileName = null; |
| | | } |
| | | |
| | | //附件change事件 |
| | | 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); |
| | | } |
| | | } |
| | | |
| | | //移除附件 |
| | | removeAtt() { |
| | | this.filesUploaded = []; |
| | | 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(); |
| | | let rs = s.indexOf('.'); |
| | | if (rs < 0) { |
| | | rs = s.length; |
| | | s += '.'; |
| | | } |
| | | while (s.length <= rs + 2) { |
| | | s += '0'; |
| | | } |
| | | return s; |
| | | } |
| | | |
| | | dataChange(event) { |
| | | let fieldName = event.target.getAttribute('data-field'); |
| | | let value = event.detail.value; |
| | | console.log('fieldName = ' + fieldName + ' value = ' + value); |
| | | switch (fieldName) { |
| | | case 'OrderCode': |
| | | this.OrderCode = value; |
| | | this.coc['Name'] = value; |
| | | break; |
| | | case 'ForCustomerText': |
| | | this.ForCustomerText = value; |
| | | this.coc['Order_ForCustomerText__c'] = value; |
| | | break; |
| | | case 'InvoiceDate': |
| | | this.InvoiceDate = value; |
| | | this.coc['Invoice_Date__c'] = value; |
| | | break; |
| | | case 'secondaryDistributor': |
| | | this.secondaryDistributor = value; |
| | | break; |
| | | case 'deliveryFromDate': |
| | | this.deliveryFromDate = value; |
| | | break; |
| | | case 'deliveryToDate': |
| | | this.deliveryToDate = value; |
| | | break; |
| | | case 'category1': |
| | | this.category1 = value; |
| | | break; |
| | | case 'category2': |
| | | this.category2 = value; |
| | | break; |
| | | case 'invoiceStatus': |
| | | this.invoiceStatusValue = value; |
| | | break; |
| | | case 'searchHospitalName': |
| | | this.searchHospitalName = value; |
| | | break; |
| | | case 'InvoiceNote': |
| | | this.InvoiceNote = value; |
| | | this.coc['Invoice_Note__c'] = value; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | invoiceDateChange(event) { |
| | | this.InvoiceDate = event.detail.value; |
| | | this.coc['Invoice_Date__c'] = event.detail.value; |
| | | console.log('this.InvoiceDate = ' + this.InvoiceDate); |
| | | } |
| | | |
| | | //搜索客户名 |
| | | searchHospitalNameModal() { |
| | | console.log('searchHospitalNameModal'); |
| | | hospitalInit({ |
| | | ctype: this.agencyProType |
| | | }).then((r) => { |
| | | r = JSON.parse(JSON.stringify(r)); |
| | | if (r.status == 'Success') { |
| | | this.hospitalList = r.entity.at; |
| | | for (var i in this.hospitalList) { |
| | | this.hospitalList[i]['stateMasterName'] = |
| | | this.hospitalList[i].State_Master__r.Name; |
| | | } |
| | | } |
| | | //计算发票票面金额 |
| | | this.sumPrice += this.outboundData[i].needInvoiceCount; |
| | | console.log( |
| | | 'hospitalInit r = ' + JSON.stringify(this.hospitalList) |
| | | ); |
| | | this.isModalOpen = true; |
| | | } |
| | | |
| | | //四舍五入 |
| | | //this.sumPrice = this.sumPrice.toFixed(2); |
| | | //如果不四舍五入 |
| | | console.log("start keepTwoDecimalStr"); |
| | | this.sumPrice = this.keepTwoDecimalStr(this.sumPrice); |
| | | console.log("end keepTwoDecimalStr = " + this.sumPrice); |
| | | //加最后一行显示金额 |
| | | if (this.EditAble) { |
| | | let lastOutboundData = { |
| | | invoiceFaceAmount: this.sumPrice |
| | | }; |
| | | this.outboundDataSumPrice.push(lastOutboundData); |
| | | } |
| | | this.outboundColumns = [...this.outboundColumns]; |
| | | |
| | | this.isEditInvoice = !(!this.EditAble || this.isChange); |
| | | if (this.coc.SummonsForDirction__c == "销售给二级经销商") |
| | | this.isShowSecondaryDistributor = true; |
| | | if (this.deliveryId == "" && !this.ExistOutbound && this.EditAble) |
| | | this.hideCheckbox = false; |
| | | this.isShowSpinner = false; |
| | | this.showLoadingSpinner = false; |
| | | } else { |
| | | this.showMyToast("失败", r.msg, "Error"); |
| | | } |
| | | }) |
| | | .catch((error) => { |
| | | console.log("error = " + JSON.stringify(error)); |
| | | }); |
| | | } |
| | | } |
| | | |
| | | //上传配置单 |
| | | uploadOrder(event) { |
| | | this.showAttPop = true; |
| | | } |
| | | |
| | | //关闭附件弹窗 |
| | | closePop() { |
| | | this.showAttPop = false; |
| | | this.filesUploaded = []; |
| | | this.fileName = null; |
| | | } |
| | | |
| | | //附件change事件 |
| | | 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); |
| | | } |
| | | } |
| | | |
| | | //移除附件 |
| | | removeAtt() { |
| | | this.filesUploaded = []; |
| | | 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(); |
| | | let rs = s.indexOf("."); |
| | | if (rs < 0) { |
| | | rs = s.length; |
| | | s += "."; |
| | | } |
| | | while (s.length <= rs + 2) { |
| | | s += "0"; |
| | | } |
| | | return s; |
| | | } |
| | | |
| | | dataChange(event) { |
| | | let fieldName = event.target.getAttribute("data-field"); |
| | | let value = event.detail.value; |
| | | console.log("fieldName = " + fieldName + " value = " + value); |
| | | switch (fieldName) { |
| | | case "OrderCode": |
| | | this.OrderCode = value; |
| | | this.coc["Name"] = value; |
| | | break; |
| | | case "ForCustomerText": |
| | | this.ForCustomerText = value; |
| | | this.coc["Order_ForCustomerText__c"] = value; |
| | | break; |
| | | case "InvoiceDate": |
| | | this.InvoiceDate = value; |
| | | this.coc["Invoice_Date__c"] = value; |
| | | break; |
| | | case "secondaryDistributor": |
| | | this.secondaryDistributor = value; |
| | | break; |
| | | case "deliveryFromDate": |
| | | this.deliveryFromDate = value; |
| | | break; |
| | | case "deliveryToDate": |
| | | this.deliveryToDate = value; |
| | | break; |
| | | case "category1": |
| | | this.category1 = value; |
| | | break; |
| | | case "category2": |
| | | this.category2 = value; |
| | | break; |
| | | case "invoiceStatus": |
| | | this.invoiceStatusValue = value; |
| | | break; |
| | | case "searchHospitalName": |
| | | this.searchHospitalName = value; |
| | | break; |
| | | case "InvoiceNote": |
| | | this.InvoiceNote = value; |
| | | this.coc["Invoice_Note__c"] = value; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | invoiceDateChange(event) { |
| | | this.InvoiceDate = event.detail.value; |
| | | this.coc["Invoice_Date__c"] = event.detail.value; |
| | | console.log("this.InvoiceDate = " + this.InvoiceDate); |
| | | } |
| | | |
| | | //搜索客户名 |
| | | searchHospitalNameModal() { |
| | | console.log("searchHospitalNameModal"); |
| | | hospitalInit({ |
| | | ctype: this.agencyProType |
| | | }).then((r) => { |
| | | r = JSON.parse(JSON.stringify(r)); |
| | | if (r.status == "Success") { |
| | | this.hospitalList = r.entity.at; |
| | | for (var i in this.hospitalList) { |
| | | this.hospitalList[i]["stateMasterName"] = |
| | | this.hospitalList[i].State_Master__r.Name; |
| | | } |
| | | console.log("hospitalInit r = " + JSON.stringify(this.hospitalList)); |
| | | this.isModalOpen = true; |
| | | } |
| | | }); |
| | | } |
| | | |
| | | searchHospital() { |
| | | console.log("this.searchHospitalName = " + this.searchHospitalName); |
| | | serContact({ |
| | | searchName: this.searchHospitalName, |
| | | ctype: this.agencyProType |
| | | }).then((r) => { |
| | | r = JSON.parse(JSON.stringify(r)); |
| | | if (r.status == "Success") { |
| | | this.hospitalList = r.entity.at; |
| | | for (var i in this.hospitalList) { |
| | | this.hospitalList[i]["stateMasterName"] = |
| | | this.hospitalList[i].State_Master__r.Name; |
| | | } |
| | | console.log("hospitalInit r = " + JSON.stringify(this.hospitalList)); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | //选择客户名 |
| | | searchHandleRowAction(event) { |
| | | console.log("searchHandleRowAction"); |
| | | let row = event.detail.row; |
| | | this.HospitalInfo = row.Id; |
| | | this.HospitalName = row.Name; |
| | | console.log( |
| | | "this.HospitalInfo = " + |
| | | this.HospitalInfo + |
| | | " this.HospitalName = " + |
| | | this.HospitalName |
| | | ); |
| | | this.isModalOpen = false; |
| | | } |
| | | |
| | | //当客户名是空时。客户id也变为空 |
| | | clearAgencyI(event) { |
| | | this.HospitalName = event.target.value; |
| | | if (this.HospitalName == "" || this.HospitalName == null) { |
| | | this.HospitalInfo = ""; |
| | | } |
| | | console.log("this.HospitalName = " + this.HospitalName); |
| | | console.log("this.HospitalInfo = " + this.HospitalInfo); |
| | | } |
| | | |
| | | closeModal() { |
| | | this.isModalOpen = false; |
| | | } |
| | | |
| | | SaveJs() { |
| | | this.isShowSpinner = true; |
| | | let cloneData = this.outboundData; |
| | | |
| | | debugger; |
| | | const selectedRows = this.template |
| | | .querySelector("[data-field='outbound']") |
| | | .getSelectedRows(); |
| | | console.log("selectedRows = " + JSON.stringify(selectedRows)); |
| | | |
| | | for (var i in cloneData) { |
| | | let b = false; |
| | | for (var j in selectedRows) { |
| | | if (cloneData[i].esd.Id == selectedRows[j].esd.Id) { |
| | | b = true; |
| | | cloneData[i].check = true; |
| | | } |
| | | } |
| | | if (!b) { |
| | | cloneData[i].check = false; |
| | | } |
| | | delete cloneData[i].esdOutboundDate; |
| | | delete cloneData[i].esdNameUrl; |
| | | delete cloneData[i].esdName; |
| | | delete cloneData[i].hospitalName; |
| | | delete cloneData[i].shipmentAmount; |
| | | delete cloneData[i].returnAmount; |
| | | delete cloneData[i].uninvoicedAmount; |
| | | delete cloneData[i].invoiceFaceAmount; |
| | | delete cloneData[i].invoiceFaceAmountUrl; |
| | | } |
| | | |
| | | console.log("this.coc = " + JSON.stringify(this.coc)); |
| | | console.log("this.HospitalName = " + this.HospitalName); |
| | | console.log("this.HospitalInfo = " + this.HospitalInfo); |
| | | console.log("this.secondaryDistributor = " + this.secondaryDistributor); |
| | | console.log("this.outboundData = " + JSON.stringify(cloneData)); |
| | | console.log("this.deliveryId = " + this.deliveryId); |
| | | console.log("this.invoiceId = " + this.invoiceId); |
| | | console.log("this.accountid = " + this.accountid); |
| | | console.log("this.agencyProType = " + this.agencyProType); |
| | | console.log("this.reopen = " + this.reopen); |
| | | console.log( |
| | | "this.invoiceOrderRecoedschangeLwc = " + |
| | | JSON.stringify(this.invoiceOrderRecoedschange) |
| | | ); |
| | | save({ |
| | | cocLwc: this.coc, |
| | | HospitalNameLwc: this.HospitalName, |
| | | HospitalInfoLwc: this.HospitalInfo, |
| | | SecondDealerLwc: this.secondaryDistributor, |
| | | invoiceOrderRecoedsLwc: JSON.stringify(cloneData), |
| | | deliveryIdLwc: this.deliveryId, |
| | | invoiceIdLwc: this.invoiceId, |
| | | accountidLwc: this.accountid, |
| | | agencyProTypeLwc: this.agencyProType, |
| | | reopenLwc: this.reopen, |
| | | invoiceOrderRecoedschangeLwc: JSON.stringify( |
| | | this.invoiceOrderRecoedschange |
| | | ) |
| | | }) |
| | | .then((r) => { |
| | | r = JSON.parse(JSON.stringify(r)); |
| | | console.log("r = " + JSON.stringify(r)); |
| | | if (r.status == "Success" && r.msg == "") { |
| | | this.isShowSpinner = false; |
| | | console.log("save success"); |
| | | let url = "/lexconinvoiceview?invoiceId=" + r.entity.invoiceId; |
| | | console.log("url = " + url); |
| | | this[NavigationMixin.Navigate]({ |
| | | type: "standard__webPage", |
| | | attributes: { |
| | | url: url |
| | | searchHospital() { |
| | | console.log('this.searchHospitalName = ' + this.searchHospitalName); |
| | | serContact({ |
| | | searchName: this.searchHospitalName, |
| | | ctype: this.agencyProType |
| | | }).then((r) => { |
| | | r = JSON.parse(JSON.stringify(r)); |
| | | if (r.status == 'Success') { |
| | | this.hospitalList = r.entity.at; |
| | | for (var i in this.hospitalList) { |
| | | this.hospitalList[i]['stateMasterName'] = |
| | | this.hospitalList[i].State_Master__r.Name; |
| | | } |
| | | console.log( |
| | | 'hospitalInit r = ' + JSON.stringify(this.hospitalList) |
| | | ); |
| | | } |
| | | }); |
| | | } else { |
| | | this.showMyToast("保存失败", r.msg, "Error"); |
| | | } |
| | | }) |
| | | .catch((error) => { |
| | | console.log("error = " + JSON.stringify(error)); |
| | | }); |
| | | } |
| | | |
| | | //上传附件,直接就保存好,然后展示 |
| | | handleFilesChange(event) { |
| | | 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() { |
| | | 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.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() { |
| | | console.log("saveToFile"); |
| | | console.log("invoiceId = " + this.invoiceId); |
| | | console.log("fileName = " + this.fileName); |
| | | console.log("base64Data = " + encodeURIComponent(this.fileContents)); |
| | | saveFile({ |
| | | recordId: this.invoiceId, |
| | | fileName: this.fileName, |
| | | base64Data: encodeURIComponent(this.fileContents) |
| | | }) |
| | | .then((r) => { |
| | | r = JSON.parse(JSON.stringify(r)); |
| | | console.log("r = " + JSON.stringify(r)); |
| | | if (r != "") { |
| | | this.showPopSpinner = false; |
| | | this.showMyToast("上传成功", "", "Success"); |
| | | this.closePop(); |
| | | this.init(); |
| | | } else { |
| | | this.showMyToast("上传失败", r.msg, "Error"); |
| | | } |
| | | }) |
| | | .catch((error) => { |
| | | console.log("error = " + error.message); |
| | | this.showMyToast("错误", "上传失败", "Error"); |
| | | }); |
| | | } |
| | | |
| | | handleTypeChange(event) { |
| | | console.log("handleTypeChange"); |
| | | const typeDetail = event.detail; |
| | | console.log("typeDetail = " + JSON.stringify(typeDetail)); |
| | | for (var i in this.fileData) { |
| | | if (this.fileData[i].recordId == typeDetail.data.recordId) { |
| | | this.fileData[i].typeValue = typeDetail.data.typeValue; |
| | | this.fileData[i].mailSelectOptsin = typeDetail.data.typeValue; |
| | | } |
| | | //选择客户名 |
| | | searchHandleRowAction(event) { |
| | | console.log('searchHandleRowAction'); |
| | | let row = event.detail.row; |
| | | this.HospitalInfo = row.Id; |
| | | this.HospitalName = row.Name; |
| | | console.log( |
| | | 'this.HospitalInfo = ' + |
| | | this.HospitalInfo + |
| | | ' this.HospitalName = ' + |
| | | this.HospitalName |
| | | ); |
| | | this.isModalOpen = false; |
| | | } |
| | | console.log("this.fileData = " + JSON.stringify(this.fileData)); |
| | | } |
| | | |
| | | newInvoiceJs() { |
| | | let url = "/lexconinvoiceview?isNew=yes"; |
| | | console.log("url = " + url); |
| | | this[NavigationMixin.Navigate]({ |
| | | type: "standard__webPage", |
| | | attributes: { |
| | | url: url |
| | | } |
| | | }); |
| | | } |
| | | |
| | | saveAttachmentJs() { |
| | | debugger; |
| | | this.showLoadingSpinner = true; |
| | | let cloneData = this.deepClone(this.fileData); |
| | | for (var i in cloneData) { |
| | | delete cloneData[i].Id; |
| | | delete cloneData[i].recordId; |
| | | delete cloneData[i].url; |
| | | delete cloneData[i].Title; |
| | | delete cloneData[i].CreatedByName; |
| | | delete cloneData[i].CreatedByNameUrl; |
| | | delete cloneData[i].CreatedDate; |
| | | delete cloneData[i].typeValue; |
| | | delete cloneData[i].typeOptions; |
| | | delete cloneData[i].mailSelectOptsMap; |
| | | } |
| | | console.log("cloneData = " + JSON.stringify(cloneData)); |
| | | saveAttachment({ |
| | | attachmentRecoedsLwc: JSON.stringify(cloneData), |
| | | invoiceId: this.invoiceId |
| | | }) |
| | | .then((r) => { |
| | | r = JSON.parse(JSON.stringify(r)); |
| | | console.log("r = " + JSON.stringify(r)); |
| | | if (r.status == "Success") { |
| | | this.showLoadingSpinner = false; |
| | | this.isShowSpinner = true; |
| | | // const event = new ShowToastEvent({ |
| | | // title: 'Success', |
| | | // variant: 'Success', |
| | | // message: '保存成功', |
| | | // }); |
| | | // this.dispatchEvent(event); |
| | | this.showMyToast("附件保存成功", "", "Success"); |
| | | //this.init(); |
| | | setTimeout(function () { |
| | | //1秒后执行刷新 |
| | | window.location.reload(); |
| | | }, 2000); //单位是毫秒 |
| | | // let url = "/lexconinvoiceview?invoiceId=" + this.invoiceId; |
| | | // console.log('url = ' + url); |
| | | // this[NavigationMixin.Navigate]({ |
| | | // type: "standard__webPage", |
| | | // attributes: { |
| | | // url: url, |
| | | // }, |
| | | // }); |
| | | } else { |
| | | this.showMyToast("上传失败", r.msg, "Error"); |
| | | //当客户名是空时。客户id也变为空 |
| | | clearAgencyI(event) { |
| | | this.HospitalName = event.target.value; |
| | | if (this.HospitalName == '' || this.HospitalName == null) { |
| | | this.HospitalInfo = ''; |
| | | } |
| | | }) |
| | | .catch((error) => { |
| | | console.log("error = " + error.message); |
| | | this.showMyToast("错误", "上传失败", "Error"); |
| | | }); |
| | | } |
| | | console.log('this.HospitalName = ' + this.HospitalName); |
| | | console.log('this.HospitalInfo = ' + this.HospitalInfo); |
| | | } |
| | | |
| | | invoiceCodeSearchJs() { |
| | | this.isShowSpinner = true; |
| | | invoiceCodeSearch({ |
| | | orderDateLwc: |
| | | this.deliveryFromDate == null ? null : new Date(this.deliveryFromDate), |
| | | deliverDateLwc: |
| | | this.deliveryToDate == null ? null : new Date(this.deliveryToDate), |
| | | invoiceStatusLwc: this.invoiceStatusValue, |
| | | category1Lwc: this.category1, |
| | | category2Lwc: this.category2, |
| | | accountidLwc: this.ConInvoiceListAccountId, |
| | | userWorkLocationLwc: this.ConInvoiceListUserWorkLocation, |
| | | agencyProTypeLwc: this.ConInvoiceListAgencyProType |
| | | }) |
| | | .then((r) => { |
| | | r = JSON.parse(JSON.stringify(r)); |
| | | console.log("r = " + JSON.stringify(r)); |
| | | if (r.status == "Success") { |
| | | this.invoiceData = r.entity.raesList; |
| | | for (var i in this.invoiceData) { |
| | | this.invoiceData[i]["NameUrl"] = |
| | | "/lexconinvoiceview?invoiceId=" + this.invoiceData[i].Id; |
| | | } |
| | | console.log("this.invoiceData = " + JSON.stringify(this.invoiceData)); |
| | | this.isShowSpinner = false; |
| | | if (r.entity.raesListSize > 0) { |
| | | this.showMyToast( |
| | | "搜索成功", |
| | | "共检索到" + r.entity.raesListSize + "个发票", |
| | | "Success" |
| | | closeModal() { |
| | | this.isModalOpen = false; |
| | | } |
| | | |
| | | SaveJs() { |
| | | this.isShowSpinner = true; |
| | | let cloneData = this.outboundData; |
| | | |
| | | debugger; |
| | | const selectedRows = this.template |
| | | .querySelector("[data-field='outbound']") |
| | | .getSelectedRows(); |
| | | console.log('selectedRows = ' + JSON.stringify(selectedRows)); |
| | | |
| | | for (var i in cloneData) { |
| | | let b = false; |
| | | for (var j in selectedRows) { |
| | | if (cloneData[i].esd.Id == selectedRows[j].esd.Id) { |
| | | b = true; |
| | | cloneData[i].check = true; |
| | | } |
| | | } |
| | | if (!b) { |
| | | cloneData[i].check = false; |
| | | } |
| | | delete cloneData[i].esdOutboundDate; |
| | | delete cloneData[i].esdNameUrl; |
| | | delete cloneData[i].esdName; |
| | | delete cloneData[i].hospitalName; |
| | | delete cloneData[i].shipmentAmount; |
| | | delete cloneData[i].returnAmount; |
| | | delete cloneData[i].uninvoicedAmount; |
| | | delete cloneData[i].invoiceFaceAmount; |
| | | delete cloneData[i].invoiceFaceAmountUrl; |
| | | } |
| | | |
| | | console.log('this.coc = ' + JSON.stringify(this.coc)); |
| | | console.log('this.HospitalName = ' + this.HospitalName); |
| | | console.log('this.HospitalInfo = ' + this.HospitalInfo); |
| | | console.log('this.secondaryDistributor = ' + this.secondaryDistributor); |
| | | console.log('this.outboundData = ' + JSON.stringify(cloneData)); |
| | | console.log('this.deliveryId = ' + this.deliveryId); |
| | | console.log('this.invoiceId = ' + this.invoiceId); |
| | | console.log('this.accountid = ' + this.accountid); |
| | | console.log('this.agencyProType = ' + this.agencyProType); |
| | | console.log('this.reopen = ' + this.reopen); |
| | | console.log( |
| | | 'this.invoiceOrderRecoedschangeLwc = ' + |
| | | JSON.stringify(this.invoiceOrderRecoedschange) |
| | | ); |
| | | save({ |
| | | cocLwc: this.coc, |
| | | HospitalNameLwc: this.HospitalName, |
| | | HospitalInfoLwc: this.HospitalInfo, |
| | | SecondDealerLwc: this.secondaryDistributor, |
| | | invoiceOrderRecoedsLwc: JSON.stringify(cloneData), |
| | | deliveryIdLwc: this.deliveryId, |
| | | invoiceIdLwc: this.invoiceId, |
| | | accountidLwc: this.accountid, |
| | | agencyProTypeLwc: this.agencyProType, |
| | | reopenLwc: this.reopen, |
| | | invoiceOrderRecoedschangeLwc: JSON.stringify( |
| | | this.invoiceOrderRecoedschange |
| | | ) |
| | | }) |
| | | .then((r) => { |
| | | r = JSON.parse(JSON.stringify(r)); |
| | | console.log('r = ' + JSON.stringify(r)); |
| | | if (r.status == 'Success' && r.msg == '') { |
| | | this.isShowSpinner = false; |
| | | console.log('save success'); |
| | | let url = |
| | | '/lexconinvoiceview?invoiceId=' + r.entity.invoiceId; |
| | | console.log('url = ' + url); |
| | | this[NavigationMixin.Navigate]({ |
| | | type: 'standard__webPage', |
| | | attributes: { |
| | | url: url |
| | | } |
| | | }); |
| | | } else { |
| | | this.showMyToast('保存失败', r.msg, 'Error'); |
| | | } |
| | | }) |
| | | .catch((error) => { |
| | | console.log('error = ' + JSON.stringify(error)); |
| | | }); |
| | | } |
| | | |
| | | //上传附件,直接就保存好,然后展示 |
| | | handleFilesChange(event) { |
| | | 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() { |
| | | 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.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() { |
| | | console.log('saveToFile'); |
| | | console.log('invoiceId = ' + this.invoiceId); |
| | | console.log('fileName = ' + this.fileName); |
| | | console.log('base64Data = ' + encodeURIComponent(this.fileContents)); |
| | | saveFile({ |
| | | recordId: this.invoiceId, |
| | | fileName: this.fileName, |
| | | base64Data: encodeURIComponent(this.fileContents) |
| | | }) |
| | | .then((r) => { |
| | | r = JSON.parse(JSON.stringify(r)); |
| | | console.log('r = ' + JSON.stringify(r)); |
| | | if (r != '') { |
| | | this.showPopSpinner = false; |
| | | this.showMyToast('上传成功', '', 'Success'); |
| | | this.closePop(); |
| | | this.init(); |
| | | } else { |
| | | this.showMyToast('上传失败', r.msg, 'Error'); |
| | | } |
| | | }) |
| | | .catch((error) => { |
| | | console.log('error = ' + error.message); |
| | | this.showMyToast('错误', '上传失败', 'Error'); |
| | | }); |
| | | } |
| | | |
| | | handleTypeChange(event) { |
| | | console.log('handleTypeChange'); |
| | | const typeDetail = event.detail; |
| | | console.log('typeDetail = ' + JSON.stringify(typeDetail)); |
| | | for (var i in this.fileData) { |
| | | if (this.fileData[i].recordId == typeDetail.data.recordId) { |
| | | this.fileData[i].typeValue = typeDetail.data.typeValue; |
| | | this.fileData[i].mailSelectOptsin = typeDetail.data.typeValue; |
| | | } |
| | | } |
| | | console.log('this.fileData = ' + JSON.stringify(this.fileData)); |
| | | } |
| | | |
| | | newInvoiceJs() { |
| | | let url = '/lexconinvoiceview?isNew=yes'; |
| | | console.log('url = ' + url); |
| | | this[NavigationMixin.Navigate]({ |
| | | type: 'standard__webPage', |
| | | attributes: { |
| | | url: url |
| | | } |
| | | }); |
| | | } |
| | | |
| | | saveAttachmentJs() { |
| | | debugger; |
| | | this.showLoadingSpinner = true; |
| | | let cloneData = this.deepClone(this.fileData); |
| | | for (var i in cloneData) { |
| | | delete cloneData[i].Id; |
| | | delete cloneData[i].recordId; |
| | | delete cloneData[i].url; |
| | | delete cloneData[i].Title; |
| | | delete cloneData[i].CreatedByName; |
| | | delete cloneData[i].CreatedByNameUrl; |
| | | delete cloneData[i].CreatedDate; |
| | | delete cloneData[i].typeValue; |
| | | delete cloneData[i].typeOptions; |
| | | delete cloneData[i].mailSelectOptsMap; |
| | | } |
| | | console.log('cloneData = ' + JSON.stringify(cloneData)); |
| | | saveAttachment({ |
| | | attachmentRecoedsLwc: JSON.stringify(cloneData), |
| | | invoiceId: this.invoiceId |
| | | }) |
| | | .then((r) => { |
| | | r = JSON.parse(JSON.stringify(r)); |
| | | console.log('r = ' + JSON.stringify(r)); |
| | | if (r.status == 'Success') { |
| | | this.showLoadingSpinner = false; |
| | | this.isShowSpinner = true; |
| | | // const event = new ShowToastEvent({ |
| | | // title: 'Success', |
| | | // variant: 'Success', |
| | | // message: '保存成功', |
| | | // }); |
| | | // this.dispatchEvent(event); |
| | | this.showMyToast('附件保存成功', '', 'Success'); |
| | | //this.init(); |
| | | setTimeout(function () { |
| | | //1秒后执行刷新 |
| | | window.location.reload(); |
| | | }, 2000); //单位是毫秒 |
| | | // let url = "/lexconinvoiceview?invoiceId=" + this.invoiceId; |
| | | // console.log('url = ' + url); |
| | | // this[NavigationMixin.Navigate]({ |
| | | // type: "standard__webPage", |
| | | // attributes: { |
| | | // url: url, |
| | | // }, |
| | | // }); |
| | | } else { |
| | | this.showMyToast('上传失败', r.msg, 'Error'); |
| | | } |
| | | }) |
| | | .catch((error) => { |
| | | console.log('error = ' + error.message); |
| | | this.showMyToast('错误', '上传失败', 'Error'); |
| | | }); |
| | | } |
| | | |
| | | invoiceCodeSearchJs() { |
| | | this.isShowSpinner = true; |
| | | invoiceCodeSearch({ |
| | | orderDateLwc: |
| | | this.deliveryFromDate == null |
| | | ? null |
| | | : new Date(this.deliveryFromDate), |
| | | deliverDateLwc: |
| | | this.deliveryToDate == null |
| | | ? null |
| | | : new Date(this.deliveryToDate), |
| | | invoiceStatusLwc: this.invoiceStatusValue, |
| | | category1Lwc: this.category1, |
| | | category2Lwc: this.category2, |
| | | accountidLwc: this.ConInvoiceListAccountId, |
| | | userWorkLocationLwc: this.ConInvoiceListUserWorkLocation, |
| | | agencyProTypeLwc: this.ConInvoiceListAgencyProType |
| | | }) |
| | | .then((r) => { |
| | | r = JSON.parse(JSON.stringify(r)); |
| | | console.log('r = ' + JSON.stringify(r)); |
| | | if (r.status == 'Success') { |
| | | this.invoiceData = r.entity.raesList; |
| | | for (var i in this.invoiceData) { |
| | | this.invoiceData[i]['NameUrl'] = |
| | | '/lexconinvoiceview?invoiceId=' + |
| | | this.invoiceData[i].Id; |
| | | } |
| | | console.log( |
| | | 'this.invoiceData = ' + JSON.stringify(this.invoiceData) |
| | | ); |
| | | this.isShowSpinner = false; |
| | | if (r.entity.raesListSize > 0) { |
| | | this.showMyToast( |
| | | '搜索成功', |
| | | '共检索到' + r.entity.raesListSize + '个发票', |
| | | 'Success' |
| | | ); |
| | | } else { |
| | | this.showMyToast( |
| | | '搜索失败', |
| | | '没有搜索到相关发票', |
| | | 'Error' |
| | | ); |
| | | } |
| | | } else { |
| | | this.showMyToast('搜索失败', r.msg, 'Error'); |
| | | } |
| | | }) |
| | | .catch((error) => { |
| | | console.log('error = ' + error.message); |
| | | this.showMyToast('错误', '搜索失败', 'Error'); |
| | | }); |
| | | } |
| | | |
| | | ClearJs() { |
| | | this.deliveryFromDate = ''; |
| | | this.deliveryToDate = ''; |
| | | this.category1 = ''; |
| | | this.category2 = ''; |
| | | this.invoiceStatusValue = ''; |
| | | this.isShowSpinner = true; |
| | | conInvoiceListInit() |
| | | .then((r) => { |
| | | r = JSON.parse(JSON.stringify(r)); |
| | | console.log('conInvoiceListInit r = ' + JSON.stringify(r)); |
| | | if (r.status == 'Success') { |
| | | this.invoiceData = r.entity.raesList; |
| | | for (var i in this.invoiceData) { |
| | | this.invoiceData[i]['NameUrl'] = |
| | | '/lexconinvoiceview?invoiceId=' + |
| | | this.invoiceData[i].Id; |
| | | } |
| | | console.log( |
| | | 'this.invoiceData = ' + JSON.stringify(this.invoiceData) |
| | | ); |
| | | this.isShowSpinner = false; |
| | | } else { |
| | | this.showMyToast('搜索失败', r.msg, 'Error'); |
| | | } |
| | | }) |
| | | .catch((error) => { |
| | | console.log('error = ' + JSON.stringify(error)); |
| | | }); |
| | | } |
| | | |
| | | InvoiceorderSearchJs() { |
| | | this.isShowSpinner = true; |
| | | |
| | | debugger; |
| | | let cloneData = this.outboundData; |
| | | const selectedRows = this.template |
| | | .querySelector("[data-field='outbound']") |
| | | .getSelectedRows(); |
| | | console.log('selectedRows ' + JSON.stringify(selectedRows)); |
| | | for (var i in cloneData) { |
| | | let b = false; |
| | | for (var j in selectedRows) { |
| | | if (cloneData[i].esd.Id == selectedRows[j].esd.Id) { |
| | | b = true; |
| | | cloneData[i].check = true; |
| | | } |
| | | } |
| | | if (!b) { |
| | | cloneData[i].check = false; |
| | | } |
| | | delete cloneData[i].esdOutboundDate; |
| | | delete cloneData[i].esdNameUrl; |
| | | delete cloneData[i].esdName; |
| | | delete cloneData[i].hospitalName; |
| | | delete cloneData[i].shipmentAmount; |
| | | delete cloneData[i].returnAmount; |
| | | delete cloneData[i].uninvoicedAmount; |
| | | delete cloneData[i].invoiceFaceAmount; |
| | | delete cloneData[i].invoiceFaceAmountUrl; |
| | | } |
| | | |
| | | console.log('this.coc = ' + JSON.stringify(this.coc)); |
| | | console.log('this.invoiceId = ' + this.invoiceId); |
| | | console.log('this.accountid = ' + this.accountid); |
| | | console.log('this.userWorkLocation = ' + this.userWorkLocation); |
| | | console.log('this.agencyProType = ' + this.agencyProType); |
| | | console.log('this.HospitalInfo = ' + this.HospitalInfo); |
| | | console.log('SecondDealer = ' + this.secondaryDistributor); |
| | | console.log('invoiceOrderRecoedsLwc = ' + JSON.stringify(cloneData)); |
| | | |
| | | InvoiceorderSearch({ |
| | | cocLwc: this.coc, |
| | | invoiceIdLwc: this.invoiceId, |
| | | accountidLwc: this.accountid, |
| | | userWorkLocationLwc: this.userWorkLocation, |
| | | agencyProTypeLwc: this.agencyProType, |
| | | HospitalInfoLwc: this.HospitalInfo, |
| | | SecondDealerLwc: this.secondaryDistributor, |
| | | invoiceOrderRecoedsLwc: JSON.stringify(cloneData) |
| | | }) |
| | | .then((r) => { |
| | | r = JSON.parse(JSON.stringify(r)); |
| | | console.log('r = ' + JSON.stringify(r)); |
| | | if (r.status == 'Success') { |
| | | this.outboundData = r.entity.invoiceOrderRecoeds; |
| | | console.log( |
| | | 'this.outboundData = ' + |
| | | JSON.stringify(this.outboundData) |
| | | ); |
| | | let index = 0; |
| | | this.selectedRows = []; |
| | | for (var i in this.outboundData) { |
| | | 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; |
| | | this.outboundData[i]['esdNameUrl'] = |
| | | '/s/lexsummonscreat?ESetid=' + |
| | | this.outboundData[i].esd.Id; |
| | | this.outboundData[i]['esdName'] = |
| | | this.outboundData[i].esd.Name; |
| | | if (this.EditAble) { |
| | | this.outboundData[i]['hospitalName'] = |
| | | this.outboundData[i].esd.ShipmentAccount__c; |
| | | this.outboundData[i]['shipmentAmount'] = |
| | | this.outboundData[ |
| | | i |
| | | ].esd.Shipment_total_amount__c; |
| | | this.outboundData[i]['returnAmount'] = |
| | | this.outboundData[ |
| | | i |
| | | ].esd.RrturnPro_total_amount__c; |
| | | } |
| | | this.outboundData[i]['uninvoicedAmount'] = |
| | | this.outboundData[i].esd.InvoiceNotPro_money__c; |
| | | this.outboundData[i]['invoiceFaceAmount'] = |
| | | this.outboundData[i].needInvoiceCount; |
| | | if ( |
| | | !( |
| | | this.outboundData[i].esd.Billed_Status__c == |
| | | '全部开票' || |
| | | this.EditAble || |
| | | this.coc.Invoice_status__c != '草案中' |
| | | ) |
| | | ) { |
| | | //let url = "/ConInvoicedetails?orderId=" + this.outboundData[i].esd.Id + "&invoiceId=" + this.invoiceId; |
| | | let url = |
| | | '/s/lexconinvoiceview?orderId=' + |
| | | this.outboundData[i].esd.Id + |
| | | '&invoiceId=' + |
| | | this.invoiceId; |
| | | this.outboundData[i]['invoiceFaceAmountUrl'] = url; |
| | | |
| | | if (index == 0) { |
| | | let object5 = { |
| | | label: '发票票面金额(元)', |
| | | cellAttributes: { alignment: 'right' }, |
| | | type: 'url', |
| | | fieldName: 'invoiceFaceAmountUrl', |
| | | typeAttributes: { |
| | | label: { |
| | | fieldName: 'invoiceFaceAmount' |
| | | }, |
| | | target: '_blank' |
| | | }, |
| | | hideDefaultActions: true |
| | | }; |
| | | this.outboundColumns.push(object5); |
| | | index++; |
| | | } |
| | | } else { |
| | | if (index == 0) { |
| | | let object5 = { |
| | | label: '发票票面金额(元)', |
| | | cellAttributes: { alignment: 'right' }, |
| | | fieldName: 'invoiceFaceAmount', |
| | | hideDefaultActions: true |
| | | }; |
| | | this.outboundColumns.push(object5); |
| | | index++; |
| | | } |
| | | } |
| | | //计算发票票面金额 |
| | | this.sumPrice += this.outboundData[i].needInvoiceCount; |
| | | } |
| | | console.log( |
| | | 'this.selectedRows = ' + |
| | | JSON.stringify(this.selectedRows) |
| | | ); |
| | | this.isShowSpinner = false; |
| | | } else { |
| | | this.showMyToast('搜索失败', r.msg, 'Error'); |
| | | } |
| | | }) |
| | | .catch((error) => { |
| | | console.log('error = ' + error.message); |
| | | this.showMyToast('错误', '搜索失败', 'Error'); |
| | | }); |
| | | } |
| | | |
| | | getSelectedRows(event) { |
| | | // console.log("getSelectedRows "); |
| | | // for (var i in this.outboundData) { |
| | | // this.outboundData[i].check = false; |
| | | // } |
| | | // const selectedRows = event.detail.selectedRows; |
| | | // for (var i in this.outboundData) { |
| | | // for (var j in selectedRows) { |
| | | // if (this.outboundData[i].esd.Id == selectedRows[j].esd.Id) { |
| | | // //this.outboundData[i].check = !this.outboundData[i].check; |
| | | // this.outboundData[i].check = true; |
| | | // } |
| | | // } |
| | | // } |
| | | // console.log('this.outboundData = ' + JSON.stringify(this.outboundData)); |
| | | } |
| | | |
| | | deleteButtonJs() { |
| | | this.isShowSpinner = true; |
| | | deleteButton({ |
| | | cocLwc: this.coc, |
| | | invoiceIdLwc: this.invoiceId |
| | | }) |
| | | .then((r) => { |
| | | r = JSON.parse(JSON.stringify(r)); |
| | | console.log('r = ' + JSON.stringify(r)); |
| | | if (r.status == 'Success') { |
| | | this.isShowSpinner = false; |
| | | let url = '/lexconinvoiceview'; |
| | | console.log('url = ' + url); |
| | | this[NavigationMixin.Navigate]({ |
| | | type: 'standard__webPage', |
| | | attributes: { |
| | | url: url |
| | | } |
| | | }); |
| | | } else { |
| | | this.showMyToast('删除失败', r.msg, 'Error'); |
| | | } |
| | | }) |
| | | .catch((error) => { |
| | | console.log('error = ' + error.message); |
| | | }); |
| | | } |
| | | |
| | | SetEditAbleJs() { |
| | | let statusEditAbleJs = 'Redirect'; |
| | | let url = |
| | | '/lexconinvoiceview?invoiceId=' + |
| | | this.invoiceId + |
| | | '&KeyWords=' + |
| | | statusEditAbleJs; |
| | | console.log('url = ' + url); |
| | | this[NavigationMixin.Navigate]({ |
| | | type: 'standard__webPage', |
| | | attributes: { |
| | | url: url |
| | | } |
| | | }); |
| | | } |
| | | |
| | | approvalJs() { |
| | | this.isShowSpinner = true; |
| | | approval({ |
| | | outOrderStringListLwc: this.outOrderStringListLwc, |
| | | outordercountMapLwc: this.outordercountMapLwc, |
| | | invoiceIdLwc: this.invoiceId |
| | | }) |
| | | .then((r) => { |
| | | r = JSON.parse(JSON.stringify(r)); |
| | | console.log('r = ' + JSON.stringify(r)); |
| | | if (r.status == 'Success') { |
| | | this.isShowSpinner = false; |
| | | let url = |
| | | '/s/lexconinvoiceview?invoiceId=' + this.invoiceId; |
| | | console.log('url = ' + url); |
| | | window.open(url, '_self'); |
| | | // this[NavigationMixin.Navigate]({ |
| | | // type: "standard__webPage", |
| | | // attributes: { |
| | | // url: url, |
| | | // }, |
| | | // }); |
| | | } else { |
| | | this.showMyToast('错误', r.msg, 'Error'); |
| | | } |
| | | }) |
| | | .catch((error) => { |
| | | console.log('error = ' + error.message); |
| | | }); |
| | | } |
| | | |
| | | openReportJs() { |
| | | console.log('openReportJs'); |
| | | let reportUrl = this.label.LexConInvoiceViewReport; |
| | | let reportFilters = |
| | | '[{"operator":"equals","value":"' + |
| | | this.OrderCode + |
| | | '","column":"FK_NAME"}]'; |
| | | console.log('reportUrl = ' + reportUrl); |
| | | let url = |
| | | '/s/report/' + |
| | | reportUrl + |
| | | '?reportFilters=' + |
| | | encodeURIComponent(reportFilters); |
| | | window.open(url); |
| | | // this[NavigationMixin.Navigate]({ |
| | | // type: "standard__webPage", |
| | | // attributes: { |
| | | // url: url, |
| | | // target: '_blank' |
| | | // }, |
| | | // }); |
| | | } |
| | | |
| | | reopenJs() { |
| | | // statusEdit = 'Redirect'; |
| | | // PageReference ref = new Pagereference('/ConInvoiceView?invoiceId=' + invoiceId + '&reopen=isreopen' + '&KeyWords=' + statusEdit); |
| | | let statusEditAbleJs = 'Redirect'; |
| | | let url = |
| | | '/lexconinvoiceview?invoiceId=' + |
| | | this.invoiceId + |
| | | '&reopen=isreopen' + |
| | | '&KeyWords=' + |
| | | statusEditAbleJs; |
| | | console.log('url = ' + url); |
| | | this[NavigationMixin.Navigate]({ |
| | | type: 'standard__webPage', |
| | | attributes: { |
| | | url: url |
| | | } |
| | | }); |
| | | } |
| | | |
| | | showMyToast(title, message, variant) { |
| | | this.isShowSpinner = false; |
| | | this.showLoadingSpinner = false; |
| | | this.showPopSpinner = false; |
| | | this.showAttPop = false; |
| | | this.filesUploaded = []; |
| | | this.fileName = null; |
| | | console.log('show custom message'); |
| | | var iconName = ''; |
| | | var content = ''; |
| | | if (variant.toLowerCase() == 'success') { |
| | | iconName = 'utility:check'; |
| | | } else { |
| | | iconName = 'utility:error'; |
| | | } |
| | | if (message != '') { |
| | | content = |
| | | '<h2><strong>' + |
| | | title + |
| | | '<strong/></h2><h5>' + |
| | | message + |
| | | '</h5>'; |
| | | } else { |
| | | content = '<h2><strong>' + title + '<strong/></h2>'; |
| | | } |
| | | this.template |
| | | .querySelector('c-common-toast') |
| | | .showToast(variant, content, iconName, 10000); |
| | | } |
| | | |
| | | handleLoad() { |
| | | console.log('handleLoad'); |
| | | try { |
| | | const style = document.createElement('style'); |
| | | style.innerText = |
| | | '.hehe-layoutItem .slds-button__icon {display: none;}'; |
| | | this.template.querySelector('.hideHelpText').appendChild(style); |
| | | |
| | | const style2 = document.createElement('style'); |
| | | style2.innerText = |
| | | '.hehe-layoutItem .slds-form-element__label {padding : 0px}'; |
| | | this.template.querySelector('.hideHelpText').appendChild(style2); |
| | | |
| | | const style3 = document.createElement('style'); |
| | | style3.innerText = |
| | | '.readOnly .slds-form-element__label {padding-top: 7px;}'; |
| | | this.template.querySelector('.hideHelpText').appendChild(style3); |
| | | } catch (error) { |
| | | console.log(error); |
| | | } |
| | | } |
| | | |
| | | keepTwoDecimalStr(num) { |
| | | const result = Number(num.toString().match(/^\d+(?:\.\d{0,2})?/)); |
| | | let s = result.toString(); |
| | | let rs = s.indexOf('.'); |
| | | if (rs < 0) { |
| | | rs = s.length; |
| | | s += '.'; |
| | | } |
| | | while (s.length <= rs + 2) { |
| | | s += '0'; |
| | | } |
| | | return s; |
| | | } |
| | | |
| | | handleLoad2() { |
| | | console.log('handleLoad2'); |
| | | try { |
| | | const style = document.createElement('style'); |
| | | style.innerText = |
| | | '.hehe-layoutItem .slds-button__icon {display: none;}'; |
| | | this.template.querySelector('.hideHelpText').appendChild(style); |
| | | |
| | | const style2 = document.createElement('style'); |
| | | style2.innerText = |
| | | '.hehe-layoutItem .slds-form-element__label {padding : 0px}'; |
| | | this.template.querySelector('.hideHelpText').appendChild(style2); |
| | | } catch (error) { |
| | | console.log(error); |
| | | } |
| | | } |
| | | |
| | | handleUnitChange(event) { |
| | | console.log('handleUnitChange'); |
| | | this.invoiceAllpriceData[0].invoiceAllprice = 0.0; |
| | | const unitDetail = event.detail; |
| | | console.log('unitDetail = ' + JSON.stringify(unitDetail)); |
| | | for (var i in this.detailsData) { |
| | | if (this.detailsData[i].recordId == unitDetail.data.recordId) { |
| | | this.detailsData[i].unitValue = unitDetail.data.unitValue; |
| | | this.detailsData[i].esd.Invoice_Unit__c = |
| | | unitDetail.data.unitValue; |
| | | if ( |
| | | this.detailsSelectedRows.indexOf( |
| | | this.detailsData[i].recordId |
| | | ) == -1 |
| | | ) |
| | | this.detailsSelectedRows.push(this.detailsData[i].recordId); |
| | | } |
| | | } |
| | | this.detailsSelectedRows = [...this.detailsSelectedRows]; |
| | | |
| | | console.log( |
| | | 'this.detailsSelectedRows = ' + |
| | | JSON.stringify(this.detailsSelectedRows) |
| | | ); |
| | | for (var i in this.detailsData) { |
| | | this.detailsData[i].invoiceAllprice = 0.0; |
| | | for (var j in this.detailsSelectedRows) { |
| | | console.log( |
| | | 'this.detailsData[i].Id = ' + this.detailsData[i].Id |
| | | ); |
| | | console.log( |
| | | 'this.detailsSelectedRows[j] = ' + |
| | | this.detailsSelectedRows[j] |
| | | ); |
| | | if (this.detailsData[i].Id == this.detailsSelectedRows[j]) { |
| | | this.detailsData[i].invoiceAllprice = this.amend( |
| | | this.detailsData[i].shipmentNumber, |
| | | this.detailsData[i].esdInvoiceUnitprice, |
| | | '*' |
| | | ); |
| | | console.log( |
| | | 'this.detailsData[i].invoiceAllprice = ' + |
| | | this.detailsData[i].invoiceAllprice |
| | | ); |
| | | } |
| | | } |
| | | this.invoiceAllpriceData[0].invoiceAllprice = this.amend( |
| | | this.invoiceAllpriceData[0].invoiceAllprice, |
| | | this.detailsData[i].invoiceAllprice, |
| | | '+' |
| | | ); |
| | | } else { |
| | | this.showMyToast("搜索失败", "没有搜索到相关发票", "Error"); |
| | | } |
| | | } else { |
| | | this.showMyToast("搜索失败", r.msg, "Error"); |
| | | } |
| | | }) |
| | | .catch((error) => { |
| | | console.log("error = " + error.message); |
| | | this.showMyToast("错误", "搜索失败", "Error"); |
| | | }); |
| | | } |
| | | |
| | | ClearJs() { |
| | | this.deliveryFromDate = ""; |
| | | this.deliveryToDate = ""; |
| | | this.category1 = ""; |
| | | this.category2 = ""; |
| | | this.invoiceStatusValue = ""; |
| | | this.isShowSpinner = true; |
| | | conInvoiceListInit() |
| | | .then((r) => { |
| | | r = JSON.parse(JSON.stringify(r)); |
| | | console.log("conInvoiceListInit r = " + JSON.stringify(r)); |
| | | if (r.status == "Success") { |
| | | this.invoiceData = r.entity.raesList; |
| | | for (var i in this.invoiceData) { |
| | | this.invoiceData[i]["NameUrl"] = |
| | | "/lexconinvoiceview?invoiceId=" + this.invoiceData[i].Id; |
| | | } |
| | | console.log("this.invoiceData = " + JSON.stringify(this.invoiceData)); |
| | | this.isShowSpinner = false; |
| | | } else { |
| | | this.showMyToast("搜索失败", r.msg, "Error"); |
| | | } |
| | | }) |
| | | .catch((error) => { |
| | | console.log("error = " + JSON.stringify(error)); |
| | | }); |
| | | } |
| | | |
| | | InvoiceorderSearchJs() { |
| | | this.isShowSpinner = true; |
| | | |
| | | debugger; |
| | | let cloneData = this.outboundData; |
| | | const selectedRows = this.template |
| | | .querySelector("[data-field='outbound']") |
| | | .getSelectedRows(); |
| | | console.log("selectedRows " + JSON.stringify(selectedRows)); |
| | | for (var i in cloneData) { |
| | | let b = false; |
| | | for (var j in selectedRows) { |
| | | if (cloneData[i].esd.Id == selectedRows[j].esd.Id) { |
| | | b = true; |
| | | cloneData[i].check = true; |
| | | } |
| | | } |
| | | if (!b) { |
| | | cloneData[i].check = false; |
| | | } |
| | | delete cloneData[i].esdOutboundDate; |
| | | delete cloneData[i].esdNameUrl; |
| | | delete cloneData[i].esdName; |
| | | delete cloneData[i].hospitalName; |
| | | delete cloneData[i].shipmentAmount; |
| | | delete cloneData[i].returnAmount; |
| | | delete cloneData[i].uninvoicedAmount; |
| | | delete cloneData[i].invoiceFaceAmount; |
| | | delete cloneData[i].invoiceFaceAmountUrl; |
| | | this.detailsData = [...this.detailsData]; |
| | | this.invoiceAllpriceData = [...this.invoiceAllpriceData]; |
| | | } |
| | | |
| | | console.log("this.coc = " + JSON.stringify(this.coc)); |
| | | console.log("this.invoiceId = " + this.invoiceId); |
| | | console.log("this.accountid = " + this.accountid); |
| | | console.log("this.userWorkLocation = " + this.userWorkLocation); |
| | | console.log("this.agencyProType = " + this.agencyProType); |
| | | console.log("this.HospitalInfo = " + this.HospitalInfo); |
| | | console.log("SecondDealer = " + this.secondaryDistributor); |
| | | console.log("invoiceOrderRecoedsLwc = " + JSON.stringify(cloneData)); |
| | | |
| | | InvoiceorderSearch({ |
| | | cocLwc: this.coc, |
| | | invoiceIdLwc: this.invoiceId, |
| | | accountidLwc: this.accountid, |
| | | userWorkLocationLwc: this.userWorkLocation, |
| | | agencyProTypeLwc: this.agencyProType, |
| | | HospitalInfoLwc: this.HospitalInfo, |
| | | SecondDealerLwc: this.secondaryDistributor, |
| | | invoiceOrderRecoedsLwc: JSON.stringify(cloneData) |
| | | }) |
| | | .then((r) => { |
| | | r = JSON.parse(JSON.stringify(r)); |
| | | console.log("r = " + JSON.stringify(r)); |
| | | if (r.status == "Success") { |
| | | this.outboundData = r.entity.invoiceOrderRecoeds; |
| | | console.log( |
| | | "this.outboundData = " + JSON.stringify(this.outboundData) |
| | | ); |
| | | let index = 0; |
| | | this.selectedRows = []; |
| | | for (var i in this.outboundData) { |
| | | 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; |
| | | this.outboundData[i]["esdNameUrl"] = |
| | | "/s/lexsummonscreat?ESetid=" + this.outboundData[i].esd.Id; |
| | | this.outboundData[i]["esdName"] = this.outboundData[i].esd.Name; |
| | | if (this.EditAble) { |
| | | this.outboundData[i]["hospitalName"] = |
| | | this.outboundData[i].esd.ShipmentAccount__c; |
| | | this.outboundData[i]["shipmentAmount"] = |
| | | this.outboundData[i].esd.Shipment_total_amount__c; |
| | | this.outboundData[i]["returnAmount"] = |
| | | this.outboundData[i].esd.RrturnPro_total_amount__c; |
| | | } |
| | | this.outboundData[i]["uninvoicedAmount"] = |
| | | this.outboundData[i].esd.InvoiceNotPro_money__c; |
| | | this.outboundData[i]["invoiceFaceAmount"] = |
| | | this.outboundData[i].needInvoiceCount; |
| | | handleShipmentNumber(event) { |
| | | console.log('handleShipmentNumber'); |
| | | this.invoiceAllpriceData[0].invoiceAllprice = 0.0; |
| | | const numberDetail = event.detail; |
| | | console.log('numberDetail = ' + JSON.stringify(numberDetail)); |
| | | if (numberDetail.data.shipmentnumber == 0) { |
| | | if ( |
| | | !( |
| | | this.outboundData[i].esd.Billed_Status__c == "全部开票" || |
| | | this.EditAble || |
| | | this.coc.Invoice_status__c != "草案中" |
| | | ) |
| | | this.detailsSelectedRows.indexOf(numberDetail.data.recordId) != |
| | | -1 |
| | | ) { |
| | | //let url = "/ConInvoicedetails?orderId=" + this.outboundData[i].esd.Id + "&invoiceId=" + this.invoiceId; |
| | | let url = |
| | | "/s/lexconinvoiceview?orderId=" + |
| | | this.outboundData[i].esd.Id + |
| | | "&invoiceId=" + |
| | | this.invoiceId; |
| | | this.outboundData[i]["invoiceFaceAmountUrl"] = url; |
| | | |
| | | if (index == 0) { |
| | | let object5 = { |
| | | label: "发票票面金额(元)", |
| | | cellAttributes: { alignment: "right" }, |
| | | type: "url", |
| | | fieldName: "invoiceFaceAmountUrl", |
| | | typeAttributes: { |
| | | label: { |
| | | fieldName: "invoiceFaceAmount" |
| | | }, |
| | | target: "_blank" |
| | | }, |
| | | hideDefaultActions: true |
| | | }; |
| | | this.outboundColumns.push(object5); |
| | | index++; |
| | | } |
| | | } else { |
| | | if (index == 0) { |
| | | let object5 = { |
| | | label: "发票票面金额(元)", |
| | | cellAttributes: { alignment: "right" }, |
| | | fieldName: "invoiceFaceAmount", |
| | | hideDefaultActions: true |
| | | }; |
| | | this.outboundColumns.push(object5); |
| | | index++; |
| | | } |
| | | this.detailsSelectedRows.splice( |
| | | this.detailsSelectedRows.indexOf( |
| | | numberDetail.data.recordId |
| | | ), |
| | | 1 |
| | | ); |
| | | } |
| | | //计算发票票面金额 |
| | | this.sumPrice += this.outboundData[i].needInvoiceCount; |
| | | } |
| | | console.log( |
| | | "this.selectedRows = " + JSON.stringify(this.selectedRows) |
| | | ); |
| | | this.isShowSpinner = false; |
| | | } else { |
| | | this.showMyToast("搜索失败", r.msg, "Error"); |
| | | } |
| | | }) |
| | | .catch((error) => { |
| | | console.log("error = " + error.message); |
| | | this.showMyToast("错误", "搜索失败", "Error"); |
| | | }); |
| | | } |
| | | |
| | | getSelectedRows(event) { |
| | | // console.log("getSelectedRows "); |
| | | // for (var i in this.outboundData) { |
| | | // this.outboundData[i].check = false; |
| | | // } |
| | | // const selectedRows = event.detail.selectedRows; |
| | | // for (var i in this.outboundData) { |
| | | // for (var j in selectedRows) { |
| | | // if (this.outboundData[i].esd.Id == selectedRows[j].esd.Id) { |
| | | // //this.outboundData[i].check = !this.outboundData[i].check; |
| | | // this.outboundData[i].check = true; |
| | | // } |
| | | // } |
| | | // } |
| | | // console.log('this.outboundData = ' + JSON.stringify(this.outboundData)); |
| | | } |
| | | |
| | | deleteButtonJs() { |
| | | this.isShowSpinner = true; |
| | | deleteButton({ |
| | | cocLwc: this.coc, |
| | | invoiceIdLwc: this.invoiceId |
| | | }) |
| | | .then((r) => { |
| | | r = JSON.parse(JSON.stringify(r)); |
| | | console.log("r = " + JSON.stringify(r)); |
| | | if (r.status == "Success") { |
| | | this.isShowSpinner = false; |
| | | let url = "/lexconinvoiceview"; |
| | | console.log("url = " + url); |
| | | this[NavigationMixin.Navigate]({ |
| | | type: "standard__webPage", |
| | | attributes: { |
| | | url: url |
| | | } |
| | | }); |
| | | } else { |
| | | this.showMyToast("删除失败", r.msg, "Error"); |
| | | } |
| | | }) |
| | | .catch((error) => { |
| | | console.log("error = " + error.message); |
| | | }); |
| | | } |
| | | |
| | | SetEditAbleJs() { |
| | | let statusEditAbleJs = "Redirect"; |
| | | let url = |
| | | "/lexconinvoiceview?invoiceId=" + |
| | | this.invoiceId + |
| | | "&KeyWords=" + |
| | | statusEditAbleJs; |
| | | console.log("url = " + url); |
| | | this[NavigationMixin.Navigate]({ |
| | | type: "standard__webPage", |
| | | attributes: { |
| | | url: url |
| | | } |
| | | }); |
| | | } |
| | | |
| | | approvalJs() { |
| | | this.isShowSpinner = true; |
| | | approval({ |
| | | outOrderStringListLwc: this.outOrderStringListLwc, |
| | | outordercountMapLwc: this.outordercountMapLwc, |
| | | invoiceIdLwc: this.invoiceId |
| | | }) |
| | | .then((r) => { |
| | | r = JSON.parse(JSON.stringify(r)); |
| | | console.log("r = " + JSON.stringify(r)); |
| | | if (r.status == "Success") { |
| | | this.isShowSpinner = false; |
| | | let url = "/s/lexconinvoiceview?invoiceId=" + this.invoiceId; |
| | | console.log("url = " + url); |
| | | window.open(url, "_self"); |
| | | // this[NavigationMixin.Navigate]({ |
| | | // type: "standard__webPage", |
| | | // attributes: { |
| | | // url: url, |
| | | // }, |
| | | // }); |
| | | } else { |
| | | this.showMyToast("错误", r.msg, "Error"); |
| | | } |
| | | }) |
| | | .catch((error) => { |
| | | console.log("error = " + error.message); |
| | | }); |
| | | } |
| | | |
| | | openReportJs() { |
| | | console.log("openReportJs"); |
| | | let reportUrl = this.label.LexConInvoiceViewReport; |
| | | let reportFilters = |
| | | '[{"operator":"equals","value":"' + |
| | | this.OrderCode + |
| | | '","column":"FK_NAME"}]'; |
| | | console.log("reportUrl = " + reportUrl); |
| | | let url = |
| | | "/s/report/" + |
| | | reportUrl + |
| | | "?reportFilters=" + |
| | | encodeURIComponent(reportFilters); |
| | | window.open(url); |
| | | // this[NavigationMixin.Navigate]({ |
| | | // type: "standard__webPage", |
| | | // attributes: { |
| | | // url: url, |
| | | // target: '_blank' |
| | | // }, |
| | | // }); |
| | | } |
| | | |
| | | reopenJs() { |
| | | // statusEdit = 'Redirect'; |
| | | // PageReference ref = new Pagereference('/ConInvoiceView?invoiceId=' + invoiceId + '&reopen=isreopen' + '&KeyWords=' + statusEdit); |
| | | let statusEditAbleJs = "Redirect"; |
| | | let url = |
| | | "/lexconinvoiceview?invoiceId=" + |
| | | this.invoiceId + |
| | | "&reopen=isreopen" + |
| | | "&KeyWords=" + |
| | | statusEditAbleJs; |
| | | console.log("url = " + url); |
| | | this[NavigationMixin.Navigate]({ |
| | | type: "standard__webPage", |
| | | attributes: { |
| | | url: url |
| | | } |
| | | }); |
| | | } |
| | | |
| | | showMyToast(title, message, variant) { |
| | | this.isShowSpinner = false; |
| | | this.showLoadingSpinner = false; |
| | | this.showPopSpinner = false; |
| | | this.showAttPop = false; |
| | | this.filesUploaded = []; |
| | | this.fileName = null; |
| | | console.log("show custom message"); |
| | | var iconName = ""; |
| | | var content = ""; |
| | | if (variant.toLowerCase() == "success") { |
| | | iconName = "utility:check"; |
| | | } else { |
| | | iconName = "utility:error"; |
| | | } |
| | | if (message != "") { |
| | | content = |
| | | "<h2><strong>" + title + "<strong/></h2><h5>" + message + "</h5>"; |
| | | } else { |
| | | content = "<h2><strong>" + title + "<strong/></h2>"; |
| | | } |
| | | this.template |
| | | .querySelector("c-common-toast") |
| | | .showToast(variant, content, iconName, 10000); |
| | | } |
| | | |
| | | handleLoad() { |
| | | console.log("handleLoad"); |
| | | try { |
| | | const style = document.createElement("style"); |
| | | style.innerText = ".hehe-layoutItem .slds-button__icon {display: none;}"; |
| | | this.template.querySelector(".hideHelpText").appendChild(style); |
| | | |
| | | const style2 = document.createElement("style"); |
| | | style2.innerText = |
| | | ".hehe-layoutItem .slds-form-element__label {padding : 0px}"; |
| | | this.template.querySelector(".hideHelpText").appendChild(style2); |
| | | |
| | | const style3 = document.createElement("style"); |
| | | style3.innerText = |
| | | ".readOnly .slds-form-element__label {padding-top: 7px;}"; |
| | | this.template.querySelector(".hideHelpText").appendChild(style3); |
| | | } catch (error) { |
| | | console.log(error); |
| | | } |
| | | } |
| | | |
| | | keepTwoDecimalStr(num) { |
| | | const result = Number(num.toString().match(/^\d+(?:\.\d{0,2})?/)); |
| | | let s = result.toString(); |
| | | let rs = s.indexOf("."); |
| | | if (rs < 0) { |
| | | rs = s.length; |
| | | s += "."; |
| | | } |
| | | while (s.length <= rs + 2) { |
| | | s += "0"; |
| | | } |
| | | return s; |
| | | } |
| | | |
| | | handleLoad2() { |
| | | console.log("handleLoad2"); |
| | | try { |
| | | const style = document.createElement("style"); |
| | | style.innerText = ".hehe-layoutItem .slds-button__icon {display: none;}"; |
| | | this.template.querySelector(".hideHelpText").appendChild(style); |
| | | |
| | | const style2 = document.createElement("style"); |
| | | style2.innerText = |
| | | ".hehe-layoutItem .slds-form-element__label {padding : 0px}"; |
| | | this.template.querySelector(".hideHelpText").appendChild(style2); |
| | | } catch (error) { |
| | | console.log(error); |
| | | } |
| | | } |
| | | |
| | | handleUnitChange(event) { |
| | | console.log("handleUnitChange"); |
| | | this.invoiceAllpriceData[0].invoiceAllprice = 0.0; |
| | | const unitDetail = event.detail; |
| | | console.log("unitDetail = " + JSON.stringify(unitDetail)); |
| | | for (var i in this.detailsData) { |
| | | if (this.detailsData[i].recordId == unitDetail.data.recordId) { |
| | | this.detailsData[i].unitValue = unitDetail.data.unitValue; |
| | | this.detailsData[i].esd.Invoice_Unit__c = unitDetail.data.unitValue; |
| | | if ( |
| | | this.detailsSelectedRows.indexOf(this.detailsData[i].recordId) == -1 |
| | | ) |
| | | this.detailsSelectedRows.push(this.detailsData[i].recordId); |
| | | } |
| | | } |
| | | this.detailsSelectedRows = [...this.detailsSelectedRows]; |
| | | |
| | | console.log( |
| | | "this.detailsSelectedRows = " + JSON.stringify(this.detailsSelectedRows) |
| | | ); |
| | | for (var i in this.detailsData) { |
| | | this.detailsData[i].invoiceAllprice = 0.0; |
| | | for (var j in this.detailsSelectedRows) { |
| | | console.log("this.detailsData[i].Id = " + this.detailsData[i].Id); |
| | | console.log( |
| | | "this.detailsSelectedRows[j] = " + this.detailsSelectedRows[j] |
| | | 'start this.detailsSelectedRows = ' + |
| | | JSON.stringify(this.detailsSelectedRows) |
| | | ); |
| | | if (this.detailsData[i].Id == this.detailsSelectedRows[j]) { |
| | | this.detailsData[i].invoiceAllprice = this.amend( |
| | | this.detailsData[i].shipmentNumber, |
| | | this.detailsData[i].esdInvoiceUnitprice, |
| | | "*" |
| | | ); |
| | | console.log( |
| | | "this.detailsData[i].invoiceAllprice = " + |
| | | this.detailsData[i].invoiceAllprice |
| | | ); |
| | | } |
| | | } |
| | | this.invoiceAllpriceData[0].invoiceAllprice = this.amend( |
| | | this.invoiceAllpriceData[0].invoiceAllprice, |
| | | this.detailsData[i].invoiceAllprice, |
| | | "+" |
| | | ); |
| | | } |
| | | this.detailsData = [...this.detailsData]; |
| | | this.invoiceAllpriceData = [...this.invoiceAllpriceData]; |
| | | } |
| | | |
| | | handleShipmentNumber(event) { |
| | | console.log("handleShipmentNumber"); |
| | | this.invoiceAllpriceData[0].invoiceAllprice = 0.0; |
| | | const numberDetail = event.detail; |
| | | console.log("numberDetail = " + JSON.stringify(numberDetail)); |
| | | if (numberDetail.data.shipmentnumber == 0) { |
| | | if (this.detailsSelectedRows.indexOf(numberDetail.data.recordId) != -1) { |
| | | this.detailsSelectedRows.splice( |
| | | this.detailsSelectedRows.indexOf(numberDetail.data.recordId), |
| | | 1 |
| | | ); |
| | | } |
| | | } |
| | | console.log( |
| | | "start this.detailsSelectedRows = " + |
| | | JSON.stringify(this.detailsSelectedRows) |
| | | ); |
| | | console.log("numberDetail = " + JSON.stringify(numberDetail)); |
| | | for (var i in this.detailsData) { |
| | | if (this.detailsData[i].recordId == numberDetail.data.recordId) { |
| | | this.detailsData[i].shipmentNumber = Number( |
| | | numberDetail.data.shipmentnumber |
| | | ); |
| | | this.detailsData[i].invoiceCount = Number( |
| | | numberDetail.data.shipmentnumber |
| | | ); |
| | | if ( |
| | | this.detailsSelectedRows.indexOf(this.detailsData[i].recordId) == |
| | | -1 && |
| | | numberDetail.data.shipmentnumber != 0 |
| | | ) |
| | | this.detailsSelectedRows.push(this.detailsData[i].recordId); |
| | | } |
| | | } |
| | | |
| | | console.log( |
| | | "end this.detailsSelectedRows = " + |
| | | JSON.stringify(this.detailsSelectedRows) |
| | | ); |
| | | this.detailsSelectedRows = [...this.detailsSelectedRows]; |
| | | |
| | | console.log( |
| | | "this.detailsSelectedRows = " + JSON.stringify(this.detailsSelectedRows) |
| | | ); |
| | | for (var i in this.detailsData) { |
| | | this.detailsData[i].invoiceAllprice = 0.0; |
| | | for (var j in this.detailsSelectedRows) { |
| | | console.log("this.detailsData[i].Id = " + this.detailsData[i].Id); |
| | | console.log( |
| | | "this.detailsSelectedRows[j] = " + this.detailsSelectedRows[j] |
| | | ); |
| | | if (this.detailsData[i].Id == this.detailsSelectedRows[j]) { |
| | | this.detailsData[i].invoiceAllprice = this.amend( |
| | | this.detailsData[i].shipmentNumber, |
| | | this.detailsData[i].esdInvoiceUnitprice, |
| | | "*" |
| | | ); |
| | | console.log( |
| | | "this.detailsData[i].invoiceAllprice = " + |
| | | this.detailsData[i].invoiceAllprice |
| | | ); |
| | | } |
| | | } |
| | | this.invoiceAllpriceData[0].invoiceAllprice = this.amend( |
| | | this.invoiceAllpriceData[0].invoiceAllprice, |
| | | this.detailsData[i].invoiceAllprice, |
| | | "+" |
| | | ); |
| | | } |
| | | this.detailsData = [...this.detailsData]; |
| | | this.invoiceAllpriceData = [...this.invoiceAllpriceData]; |
| | | } |
| | | |
| | | detailsGetSelectedRows(event) { |
| | | console.log("detailsGetSelectedRows "); |
| | | this.invoiceAllpriceData[0].invoiceAllprice = 0.0; |
| | | let selectedRows = event.detail.selectedRows; |
| | | for (var i in this.detailsData) { |
| | | this.detailsData[i].invoiceAllprice = 0.0; |
| | | for (var j in selectedRows) { |
| | | if (this.detailsData[i].Id == selectedRows[j].esd.Id) { |
| | | this.detailsData[i].invoiceAllprice = this.amend( |
| | | this.detailsData[i].shipmentNumber, |
| | | this.detailsData[i].esdInvoiceUnitprice, |
| | | "*" |
| | | ); |
| | | console.log( |
| | | "this.detailsData[i].invoiceAllprice = " + |
| | | this.detailsData[i].invoiceAllprice |
| | | ); |
| | | } |
| | | } |
| | | this.invoiceAllpriceData[0].invoiceAllprice = this.amend( |
| | | this.invoiceAllpriceData[0].invoiceAllprice, |
| | | this.detailsData[i].invoiceAllprice, |
| | | "+" |
| | | ); |
| | | console.log( |
| | | "this.invoiceAllpriceData[0].invoiceAllprice = " + |
| | | this.invoiceAllpriceData[0].invoiceAllprice |
| | | ); |
| | | } |
| | | console.log("start this.detailsData = " + JSON.stringify(this.detailsData)); |
| | | this.detailsData = [...this.detailsData]; |
| | | console.log("end this.detailsData = " + JSON.stringify(this.detailsData)); |
| | | this.invoiceAllpriceData = [...this.invoiceAllpriceData]; |
| | | } |
| | | |
| | | ComputePrice(index, number, price) { |
| | | console.log("index = " + index); |
| | | console.log("number = " + number); |
| | | console.log("price = " + price); |
| | | let shipmentAmount = this.amend(number, price, "*"); |
| | | console.log("shipmentAmount = " + shipmentAmount); |
| | | let sumPrice = 0.0; |
| | | this.data[index].shipmentAmount = shipmentAmount; |
| | | for (var i in this.data) { |
| | | if (this.data[i].shipmentAmount) sumPrice += this.data[i].shipmentAmount; |
| | | } |
| | | this.sumPrice = sumPrice + "元"; |
| | | //存下选择行,不会被清空 |
| | | if (this.selectedRows.indexOf(this.data[index].Id) == -1) |
| | | this.selectedRows.push(this.data[index].Id); |
| | | this.data = [...this.data]; |
| | | this.selectedRows = [...this.selectedRows]; |
| | | console.log("this.selectedRows = " + JSON.stringify(this.selectedRows)); |
| | | console.log("this.data = " + JSON.stringify(this.data)); |
| | | } |
| | | |
| | | deepClone(obj) { |
| | | return JSON.parse(JSON.stringify(obj)); |
| | | } |
| | | |
| | | detailsSaveJs() { |
| | | this.isShowSpinner = true; |
| | | let cloneData = this.deepClone(this.detailsData); |
| | | |
| | | let selectedRows = this.template |
| | | .querySelector("c-lex-custom-lightning-datatable") |
| | | .getSelectedRows(); |
| | | console.log("selectedRows = " + JSON.stringify(selectedRows)); |
| | | |
| | | for (var i in cloneData) { |
| | | delete cloneData[i].Id; |
| | | delete cloneData[i].esdAssetModelNo; |
| | | delete cloneData[i].packingListManual; |
| | | delete cloneData[i].esdDeliveryListRMB; |
| | | delete cloneData[i].esdShipmentCount; |
| | | delete cloneData[i].esdRrturnProCount; |
| | | delete cloneData[i].esdBoxPiece; |
| | | delete cloneData[i].esdInvoicedProcount; |
| | | delete cloneData[i].esdInvoiceProNotCount; |
| | | delete cloneData[i].unitValue; |
| | | delete cloneData[i].recordId; |
| | | delete cloneData[i].unitOptions; |
| | | delete cloneData[i].esdInvoiceUnitprice; |
| | | delete cloneData[i].shipmentNumber; |
| | | delete cloneData[i].invoiceAllprice; |
| | | for (var j in selectedRows) { |
| | | if (cloneData[i].esd.Id == selectedRows[j].esd.Id) { |
| | | cloneData[i]["check"] = true; |
| | | } |
| | | } |
| | | } |
| | | console.log("cloneData = " + JSON.stringify(cloneData)); |
| | | |
| | | detailsSave({ |
| | | consumableorderdetails1RecordsLwc: JSON.stringify(cloneData), |
| | | invoiceIdLwc: this.invoiceId, |
| | | orderIdLwc: this.orderId |
| | | }) |
| | | .then((r) => { |
| | | r = JSON.parse(JSON.stringify(r)); |
| | | console.log("r = " + JSON.stringify(r)); |
| | | if (r.status == "Success") { |
| | | let url = "/lexconinvoiceview?invoiceId=" + this.invoiceId; |
| | | this[NavigationMixin.Navigate]({ |
| | | type: "standard__webPage", |
| | | attributes: { |
| | | url: url |
| | | console.log('numberDetail = ' + JSON.stringify(numberDetail)); |
| | | for (var i in this.detailsData) { |
| | | if (this.detailsData[i].recordId == numberDetail.data.recordId) { |
| | | this.detailsData[i].shipmentNumber = Number( |
| | | numberDetail.data.shipmentnumber |
| | | ); |
| | | this.detailsData[i].invoiceCount = Number( |
| | | numberDetail.data.shipmentnumber |
| | | ); |
| | | if ( |
| | | this.detailsSelectedRows.indexOf( |
| | | this.detailsData[i].recordId |
| | | ) == -1 && |
| | | numberDetail.data.shipmentnumber != 0 |
| | | ) |
| | | this.detailsSelectedRows.push(this.detailsData[i].recordId); |
| | | } |
| | | }); |
| | | } else { |
| | | this.showMyToast("保存失败", r.msg, "Error"); |
| | | } |
| | | }) |
| | | .catch((error) => { |
| | | console.log("error = " + error.message); |
| | | }); |
| | | } |
| | | |
| | | //num1 num2传入两个值 symbol +-*/符号 |
| | | amend(num1, num2, symbol) { |
| | | var str1 = num1.toString(), |
| | | str2 = num2.toString(), |
| | | result, |
| | | str1Length, |
| | | str2Length; |
| | | //解决整数没有小数点方法 |
| | | try { |
| | | str1Length = str1.split(".")[1].length; |
| | | } catch (error) { |
| | | str1Length = 0; |
| | | } |
| | | try { |
| | | str2Length = str2.split(".")[1].length; |
| | | } catch (error) { |
| | | str2Length = 0; |
| | | } |
| | | var step = Math.pow(10, Math.max(str1Length, str2Length)); |
| | | switch (symbol) { |
| | | case "+": |
| | | result = (num1 * step + num2 * step) / step; |
| | | break; |
| | | case "-": |
| | | result = (num1 * step - num2 * step) / step; |
| | | break; |
| | | case "*": |
| | | result = (num1 * step * (num2 * step)) / step / step; |
| | | break; |
| | | case "/": |
| | | result = (num1 * step) / (num2 * step); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | return result; |
| | | } |
| | | console.log( |
| | | 'end this.detailsSelectedRows = ' + |
| | | JSON.stringify(this.detailsSelectedRows) |
| | | ); |
| | | this.detailsSelectedRows = [...this.detailsSelectedRows]; |
| | | |
| | | //删除附件 |
| | | deleteAtt(event) { |
| | | this.isShowSpinner = true; |
| | | //var recordId = event.detail.data.recordId; |
| | | var recordId = event.target.getAttribute("data-fileid"); |
| | | console.log("attid:" + recordId); |
| | | deleteAtt({ |
| | | contentVersionId: recordId |
| | | }) |
| | | .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("删除失败", r.msg, "Error"); |
| | | console.log( |
| | | 'this.detailsSelectedRows = ' + |
| | | JSON.stringify(this.detailsSelectedRows) |
| | | ); |
| | | for (var i in this.detailsData) { |
| | | this.detailsData[i].invoiceAllprice = 0.0; |
| | | for (var j in this.detailsSelectedRows) { |
| | | console.log( |
| | | 'this.detailsData[i].Id = ' + this.detailsData[i].Id |
| | | ); |
| | | console.log( |
| | | 'this.detailsSelectedRows[j] = ' + |
| | | this.detailsSelectedRows[j] |
| | | ); |
| | | if (this.detailsData[i].Id == this.detailsSelectedRows[j]) { |
| | | this.detailsData[i].invoiceAllprice = this.amend( |
| | | this.detailsData[i].shipmentNumber, |
| | | this.detailsData[i].esdInvoiceUnitprice, |
| | | '*' |
| | | ); |
| | | console.log( |
| | | 'this.detailsData[i].invoiceAllprice = ' + |
| | | this.detailsData[i].invoiceAllprice |
| | | ); |
| | | } |
| | | } |
| | | this.invoiceAllpriceData[0].invoiceAllprice = this.amend( |
| | | this.invoiceAllpriceData[0].invoiceAllprice, |
| | | this.detailsData[i].invoiceAllprice, |
| | | '+' |
| | | ); |
| | | } |
| | | }) |
| | | .catch((error) => { |
| | | this.showMyToast("错误", error.message, "Error"); |
| | | }); |
| | | } |
| | | this.detailsData = [...this.detailsData]; |
| | | this.invoiceAllpriceData = [...this.invoiceAllpriceData]; |
| | | } |
| | | |
| | | detailsGetSelectedRows(event) { |
| | | console.log('detailsGetSelectedRows '); |
| | | this.invoiceAllpriceData[0].invoiceAllprice = 0.0; |
| | | let selectedRows = event.detail.selectedRows; |
| | | for (var i in this.detailsData) { |
| | | this.detailsData[i].invoiceAllprice = 0.0; |
| | | for (var j in selectedRows) { |
| | | if (this.detailsData[i].Id == selectedRows[j].esd.Id) { |
| | | this.detailsData[i].invoiceAllprice = this.amend( |
| | | this.detailsData[i].shipmentNumber, |
| | | this.detailsData[i].esdInvoiceUnitprice, |
| | | '*' |
| | | ); |
| | | console.log( |
| | | 'this.detailsData[i].invoiceAllprice = ' + |
| | | this.detailsData[i].invoiceAllprice |
| | | ); |
| | | } |
| | | } |
| | | this.invoiceAllpriceData[0].invoiceAllprice = this.amend( |
| | | this.invoiceAllpriceData[0].invoiceAllprice, |
| | | this.detailsData[i].invoiceAllprice, |
| | | '+' |
| | | ); |
| | | console.log( |
| | | 'this.invoiceAllpriceData[0].invoiceAllprice = ' + |
| | | this.invoiceAllpriceData[0].invoiceAllprice |
| | | ); |
| | | } |
| | | console.log( |
| | | 'start this.detailsData = ' + JSON.stringify(this.detailsData) |
| | | ); |
| | | this.detailsData = [...this.detailsData]; |
| | | console.log( |
| | | 'end this.detailsData = ' + JSON.stringify(this.detailsData) |
| | | ); |
| | | this.invoiceAllpriceData = [...this.invoiceAllpriceData]; |
| | | } |
| | | |
| | | ComputePrice(index, number, price) { |
| | | console.log('index = ' + index); |
| | | console.log('number = ' + number); |
| | | console.log('price = ' + price); |
| | | let shipmentAmount = this.amend(number, price, '*'); |
| | | console.log('shipmentAmount = ' + shipmentAmount); |
| | | let sumPrice = 0.0; |
| | | this.data[index].shipmentAmount = shipmentAmount; |
| | | for (var i in this.data) { |
| | | if (this.data[i].shipmentAmount) |
| | | sumPrice += this.data[i].shipmentAmount; |
| | | } |
| | | this.sumPrice = sumPrice + '元'; |
| | | //存下选择行,不会被清空 |
| | | if (this.selectedRows.indexOf(this.data[index].Id) == -1) |
| | | this.selectedRows.push(this.data[index].Id); |
| | | this.data = [...this.data]; |
| | | this.selectedRows = [...this.selectedRows]; |
| | | console.log('this.selectedRows = ' + JSON.stringify(this.selectedRows)); |
| | | console.log('this.data = ' + JSON.stringify(this.data)); |
| | | } |
| | | |
| | | deepClone(obj) { |
| | | return JSON.parse(JSON.stringify(obj)); |
| | | } |
| | | |
| | | detailsSaveJs() { |
| | | this.isShowSpinner = true; |
| | | let cloneData = this.deepClone(this.detailsData); |
| | | |
| | | let selectedRows = this.template |
| | | .querySelector('c-lex-custom-lightning-datatable') |
| | | .getSelectedRows(); |
| | | console.log('selectedRows = ' + JSON.stringify(selectedRows)); |
| | | |
| | | for (var i in cloneData) { |
| | | delete cloneData[i].Id; |
| | | delete cloneData[i].esdAssetModelNo; |
| | | delete cloneData[i].packingListManual; |
| | | delete cloneData[i].esdDeliveryListRMB; |
| | | delete cloneData[i].esdShipmentCount; |
| | | delete cloneData[i].esdRrturnProCount; |
| | | delete cloneData[i].esdBoxPiece; |
| | | delete cloneData[i].esdInvoicedProcount; |
| | | delete cloneData[i].esdInvoiceProNotCount; |
| | | delete cloneData[i].unitValue; |
| | | delete cloneData[i].recordId; |
| | | delete cloneData[i].unitOptions; |
| | | delete cloneData[i].esdInvoiceUnitprice; |
| | | delete cloneData[i].shipmentNumber; |
| | | delete cloneData[i].invoiceAllprice; |
| | | for (var j in selectedRows) { |
| | | if (cloneData[i].esd.Id == selectedRows[j].esd.Id) { |
| | | cloneData[i]['check'] = true; |
| | | } |
| | | } |
| | | } |
| | | console.log('cloneData = ' + JSON.stringify(cloneData)); |
| | | |
| | | detailsSave({ |
| | | consumableorderdetails1RecordsLwc: JSON.stringify(cloneData), |
| | | invoiceIdLwc: this.invoiceId, |
| | | orderIdLwc: this.orderId |
| | | }) |
| | | .then((r) => { |
| | | r = JSON.parse(JSON.stringify(r)); |
| | | console.log('r = ' + JSON.stringify(r)); |
| | | if (r.status == 'Success') { |
| | | let url = '/lexconinvoiceview?invoiceId=' + this.invoiceId; |
| | | this[NavigationMixin.Navigate]({ |
| | | type: 'standard__webPage', |
| | | attributes: { |
| | | url: url |
| | | } |
| | | }); |
| | | } else { |
| | | this.showMyToast('保存失败', r.msg, 'Error'); |
| | | } |
| | | }) |
| | | .catch((error) => { |
| | | console.log('error = ' + error.message); |
| | | }); |
| | | } |
| | | |
| | | //num1 num2传入两个值 symbol +-*/符号 |
| | | amend(num1, num2, symbol) { |
| | | var str1 = num1.toString(), |
| | | str2 = num2.toString(), |
| | | result, |
| | | str1Length, |
| | | str2Length; |
| | | //解决整数没有小数点方法 |
| | | try { |
| | | str1Length = str1.split('.')[1].length; |
| | | } catch (error) { |
| | | str1Length = 0; |
| | | } |
| | | try { |
| | | str2Length = str2.split('.')[1].length; |
| | | } catch (error) { |
| | | str2Length = 0; |
| | | } |
| | | var step = Math.pow(10, Math.max(str1Length, str2Length)); |
| | | switch (symbol) { |
| | | case '+': |
| | | result = (num1 * step + num2 * step) / step; |
| | | break; |
| | | case '-': |
| | | result = (num1 * step - num2 * step) / step; |
| | | break; |
| | | case '*': |
| | | result = (num1 * step * (num2 * step)) / step / step; |
| | | break; |
| | | case '/': |
| | | result = (num1 * step) / (num2 * step); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | //删除附件 |
| | | deleteAtt(event) { |
| | | this.isShowSpinner = true; |
| | | //var recordId = event.detail.data.recordId; |
| | | var recordId = event.target.getAttribute('data-fileid'); |
| | | console.log('attid:' + recordId); |
| | | deleteAtt({ |
| | | contentVersionId: recordId |
| | | }) |
| | | .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('删除失败', r.msg, 'Error'); |
| | | } |
| | | }) |
| | | .catch((error) => { |
| | | this.showMyToast('错误', error.message, 'Error'); |
| | | }); |
| | | } |
| | | } |