| | |
| | | import save from '@salesforce/apex/LexOverdueStockController.save'; |
| | | import { ShowToastEvent } from 'lightning/platformShowToastEvent'; |
| | | import { NavigationMixin } from 'lightning/navigation'; |
| | | //table css |
| | | import { loadStyle } from "lightning/platformResourceLoader"; |
| | | import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable"; |
| | | |
| | | |
| | | //过期库存一览 |
| | |
| | | label: '消耗品名称', |
| | | fieldName: 'prodname', |
| | | type: 'prodname', |
| | | // initialWidth: 350, |
| | | wrapText: true, |
| | | initialWidth: 350, |
| | | |
| | | hideDefaultActions: true |
| | | |
| | | }, |
| | |
| | | label: '过期数量', |
| | | fieldName: 'overlimitCount', |
| | | hideDefaultActions: true, |
| | | cellAttributes: { alignment: 'right' } |
| | | |
| | | // initialWidth: 250, |
| | | |
| | | }, |
| | |
| | | label: '销存数量', |
| | | fieldName: 'pandian', |
| | | hideDefaultActions: true, |
| | | cellAttributes: { alignment: 'right' } |
| | | // initialWidth: 250, |
| | | // cellAttributes: { alignment: 'center' } |
| | | } |
| | |
| | | { |
| | | label: '单位', |
| | | fieldName: 'Box_Piece__c', |
| | | initialWidth : 250, |
| | | initialWidth : 80, |
| | | hideDefaultActions: true |
| | | }, |
| | | { |
| | | label: 'BarCode', |
| | | fieldName: 'Bar_Code__c', |
| | | wrapText: true, |
| | | hideDefaultActions: true, |
| | | initialWidth : 250 |
| | | initialWidth : 500, |
| | | }, |
| | | { |
| | | label: '使用期限', |
| | | fieldName: 'Sterilization_limit__c', |
| | | hideDefaultActions: true, |
| | | initialWidth : 250 |
| | | // initialWidth : 250 |
| | | } |
| | | , |
| | | { |
| | | label: '销存原因', |
| | | fieldName: 'diffReason', |
| | | hideDefaultActions: true, |
| | | initialWidth: 100 |
| | | initialWidth: 160 |
| | | } |
| | | ]; |
| | | |
| | |
| | | @track overdueList = []; |
| | | |
| | | |
| | | 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"); |
| | | }); |
| | | } |
| | | } |
| | | |
| | | |
| | | //初始化 |
| | | connectedCallback() { |
| | | console.log('初始化'); |
| | |
| | | // this.casesSpinner = false; |
| | | this.showSpinner = false; |
| | | }else { |
| | | console.log('Error:' + result.errorMsg); |
| | | const evt = new ShowToastEvent({ |
| | | title: '解析失败', |
| | | message: result.errorMsg, |
| | | variant: 'error' |
| | | }); |
| | | this.dispatchEvent(evt); |
| | | this.showMyToast('初始化失败',result.msg,'error'); |
| | | this.showSpinner = false; |
| | | } |
| | | }).catch((error) => { |
| | | console.log('error = ' + JSON.stringify(error)); |
| | |
| | | } |
| | | //barcode录入 |
| | | barcodeEntrys(){ |
| | | this.showSpinner = true; |
| | | |
| | | this.showTable = false; |
| | | console.log('code'+this.barcode); |
| | | console.log(' this.accountName'+ this.accountName); |
| | | console.log(' this.barcode'+ this.barcode); |
| | | |
| | | |
| | | this.showSpinner = true; |
| | | |
| | | barcodeEntry({ |
| | | accountNameLWC: this.accountName, |
| | | agencyProTypeLWC: this.agencyProType, |
| | |
| | | this.iSinventory = result.entity.iSinventory; |
| | | console.log('result录入'+JSON.stringify( result)); |
| | | console.log('overdueList==>'+JSON.stringify( this.overdueList)); |
| | | |
| | | |
| | | for(let i in this.overduePageRecords){ |
| | | if(this.overduePageRecords[i].Prod!=null){ |
| | | this.overduePageRecords[i]['Name__c'] = this.overduePageRecords[i].Prod.Name__c; |
| | |
| | | // this.showTables = true; |
| | | this.showTable = true; |
| | | }else{ |
| | | console.log('result.msg = ' + result.msg); |
| | | const evt = new ShowToastEvent({ |
| | | title: '录入失败', |
| | | message: result.msg, |
| | | variant: 'error' |
| | | }); |
| | | this.dispatchEvent(evt); |
| | | this.showMyToast('获取失败',result.msg,'error'); |
| | | this.showSpinner = false; |
| | | } |
| | | |
| | |
| | | //保存 |
| | | saveConfirm() { |
| | | console.log('进入销存确认'); |
| | | this.showSpinner = true; |
| | | debugger |
| | | var el = this.template.querySelector('c-lex-custom-lightning-datatable'); |
| | | if(el == null){ |
| | | //this.showMyToast('销存失败',result.msg,'error'); |
| | | return |
| | | } |
| | | this.showSpinner = true; |
| | | console.log('el = ' + el); |
| | | var selected = el.getSelectedRows(); |
| | | console.log('selected'); |
| | | this.selectedData = selected; |
| | | console.log('选中数据' + JSON.stringify(this.selectedData)); |
| | | console.log('this.overdueList'+this.overdueList); |
| | | save({ |
| | | iSinventory: this.iSinventory, |
| | | saveCodPageRecords: JSON.stringify(this.selectedData), |
| | | saveoverdueList:JSON.stringify(this.overdueList) |
| | | // saveoverdueList:JSON.stringify(this.overdueList) |
| | | saveoverdueList:this.overdueList |
| | | }).then((result) => { |
| | | result = JSON.parse(JSON.stringify(result)); |
| | | console.log('result保存 = ' + JSON.stringify(result)); |
| | |
| | | }); |
| | | this.showSpinner = false; |
| | | } else { |
| | | console.log('result.msg = ' + result.msg); |
| | | const evt = new ShowToastEvent({ |
| | | title: '失败', |
| | | message: result.msg, |
| | | variant: 'error' |
| | | }); |
| | | this.dispatchEvent(evt); |
| | | this.showMyToast('销存失败',result.msg,'error'); |
| | | this.showSpinner = false; |
| | | } |
| | | }) |
| | | .catch((error) => { |
| | | console.log('error = ' + JSON.stringify(error)); |
| | | this.showSpinner = false; |
| | | }); |
| | | } |
| | | |
| | | showMyToast(title, message, variant) { |
| | | console.log('show custom message'); |
| | | var iconName = ''; |
| | | var content = ''; |
| | | if(variant == '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); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | } |