| | |
| | | import init from "@salesforce/apex/LexOutboundorderImportController.init"; |
| | | import importCSVFile from "@salesforce/apex/LexOutboundorderImportController.importCSVFile"; |
| | | import dataImport from "@salesforce/apex/LexOutboundorderImportController.dataImport"; |
| | | //table css |
| | | import { loadStyle } from "lightning/platformResourceLoader"; |
| | | import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable"; |
| | | |
| | | const columns = [ |
| | | { |
| | | label: "出库单名称", |
| | | fieldName: "orderName", |
| | | hideDefaultActions: true, |
| | | initialWidth: 200 |
| | | }, |
| | | { |
| | | label: "目的", |
| | |
| | | label: "医院名称", |
| | | fieldName: "hospitalName", |
| | | hideDefaultActions: true, |
| | | initialWidth: 300 |
| | | }, |
| | | { |
| | | label: "科室", |
| | |
| | | @track secondAgencyMap = {}; |
| | | @track hospitalSysMap = {}; |
| | | |
| | | 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"); |
| | | }); |
| | | } |
| | | } |
| | | |
| | | connectedCallback() { |
| | | init().then((r) => { |
| | | r = JSON.parse(JSON.stringify(r)); |
| | |
| | | this.isShowSpinner = false; |
| | | } else { |
| | | console.log("r = " + JSON.stringify(r)); |
| | | this.showToast("Error", r.msg); |
| | | this.showMyToast('初始化失败', r.msg, 'Error') |
| | | } |
| | | }) |
| | | .catch((error) => { |
| | | }).catch((error) => { |
| | | console.log("error = " + JSON.stringify(error)); |
| | | this.showToast("Error", error.message); |
| | | this.showMyToast('错误', '初始化失败', 'Error') |
| | | }); |
| | | } |
| | | |
| | |
| | | this.fileReader.readAsDataURL(this.file); |
| | | } else { |
| | | this.fileName = "选择一个csv文件上传"; |
| | | this.showToast("Error", '选择一个csv文件上传'); |
| | | this.showMyToast('上传失败', '选择一个csv文件上传', 'Error') |
| | | } |
| | | } |
| | | |
| | |
| | | this.data[i]['orderOrderForCustomerText'] = this.data[i].order.Order_ForCustomerText__c; |
| | | this.data[i]['orderOutboundDate'] = this.data[i].order.Outbound_Date__c; |
| | | } |
| | | this.showToast("Error", r.msg); |
| | | this.showMyToast('导入失败', r.msg, 'Error') |
| | | } else { |
| | | console.log("r.msg = " + JSON.stringify(r.msg)); |
| | | this.showToast("Error", r.msg); |
| | | this.showMyToast('导入失败', r.msg, 'Error') |
| | | } |
| | | }).catch((error) => { |
| | | console.log("error = " + JSON.stringify(error.message)); |
| | | this.showToast("Error", error.message); |
| | | this.showMyToast('导入错误', '导入失败', 'Error') |
| | | }); |
| | | } |
| | | |
| | |
| | | if (r.status == "Success" && r.msg == "") { |
| | | this.saveFLGbln = true; |
| | | console.log("dataImport success"); |
| | | this.showToast("Success", '保存成功'); |
| | | this.showMyToast('成功', '保存成功', 'Success') |
| | | } else if (r.msg != "") { |
| | | console.log("r.msg = " + JSON.stringify(r.msg)); |
| | | this.showToast("Error", r.msg); |
| | | this.showMyToast('保存失败', r.msg, 'Error') |
| | | } else { |
| | | console.log("r.msg = " + JSON.stringify(r.msg)); |
| | | this.showToast("Error", r.msg); |
| | | this.showMyToast('保存失败', r.msg, 'Error') |
| | | } |
| | | }).catch((error) => { |
| | | console.log("error = " + JSON.stringify(error.message)); |
| | | this.showToast("Error", error.message); |
| | | this.showMyToast('错误', '保存失败', 'Error') |
| | | }); |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | showToast(type, msg) { |
| | | showMyToast(title, message, variant) { |
| | | this.isShowSpinner = false; |
| | | const event = new ShowToastEvent({ |
| | | title: type, |
| | | variant: type, |
| | | message: msg, |
| | | }); |
| | | this.dispatchEvent(event); |
| | | 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); |
| | | } |
| | | } |