From dd004276162a2bf9d042ff0aaa569dc30a95d827 Mon Sep 17 00:00:00 2001 From: binxie <137736985@qq.com> Date: 星期一, 26 六月 2023 14:23:26 +0800 Subject: [PATCH] newbackup0626 --- force-app/main/default/lwc/lexConsumableAccountInfoPrint/lexConsumableAccountInfoPrint.js | 111 ++++++++++++++++++++++++++++++++++--------------------- 1 files changed, 68 insertions(+), 43 deletions(-) diff --git a/force-app/main/default/lwc/lexConsumableAccountInfoPrint/lexConsumableAccountInfoPrint.js b/force-app/main/default/lwc/lexConsumableAccountInfoPrint/lexConsumableAccountInfoPrint.js index 03621bb..ab29dde 100644 --- a/force-app/main/default/lwc/lexConsumableAccountInfoPrint/lexConsumableAccountInfoPrint.js +++ b/force-app/main/default/lwc/lexConsumableAccountInfoPrint/lexConsumableAccountInfoPrint.js @@ -1,5 +1,5 @@ import { LightningElement, wire, api, track } from 'lwc'; -import { ShowToastEvent } from "lightning/platformShowToastEvent"; +import { ShowToastEvent } from 'lightning/platformShowToastEvent'; import accountInit from '@salesforce/apex/LexConsumableAccountInfoController.init'; export default class LexConsumableAccountInfoPrint extends LightningElement { @@ -25,12 +25,12 @@ postalCode: '', address: '', parentName: '' - } + }; //鑾峰彇閾炬帴鍙傛暟 getQueryString(name) { - console.log("getQueryString name " + name); - let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); + 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]); @@ -38,48 +38,73 @@ return null; } - connectedCallback(){ - this.AccId = this.getQueryString("AccId"); + connectedCallback() { + this.AccId = this.getQueryString('AccId'); this.AccId = this.AccId == null ? '' : this.AccId; if (this.AccId != '') { console.log('this.AccId = ' + this.AccId); accountInit({ accId: this.AccId - }).then((r) => { - r = JSON.parse(JSON.stringify(r)); - console.log('r = ' + JSON.stringify(r)); - if (r.status == 'Success') { - this.accountDataInfo.name = r.entity.obj.Name; - this.accountDataInfo.ownerName = r.entity.obj.Owner == null ? '' : r.entity.obj.Owner.Name; - this.accountDataInfo.site = r.entity.obj.site; - this.accountDataInfo.isActive = r.entity.obj.Is_Active__c; - this.accountDataInfo.aliasName2 = r.entity.obj.Alias_Name2__c; - this.accountDataInfo.banOnUseReason = r.entity.obj.Ban_On_Use_Reason__c; - this.accountDataInfo.grade = r.entity.obj.Grade__c; - this.accountDataInfo.attributeType = r.entity.obj.Attribute_Type__c; - this.accountDataInfo.oCMCategory = r.entity.obj.OCM_Category__c; - this.accountDataInfo.specialityType = r.entity.obj.Speciality_Type__c; - this.accountDataInfo.stateMasterName = r.entity.obj.State_Master__r == null ? '' : r.entity.obj.State_Master__r.Name; - this.accountDataInfo.phone = r.entity.obj.Phone; - this.accountDataInfo.cityMasterName = r.entity.obj.City_Master__r == null ? '' : r.entity.obj.City_Master__r.Name; - this.accountDataInfo.phoneCall = r.entity.obj.PhoneCall__c; - this.accountDataInfo.town = r.entity.obj.Town__c; - this.accountDataInfo.fax = r.entity.obj.Fax; - this.accountDataInfo.street = r.entity.obj.Street__c; - this.accountDataInfo.postalCode = r.entity.obj.Postal_Code__c; - this.accountDataInfo.address = r.entity.obj.Address__c; - this.accountDataInfo.parentName = r.entity.obj.Parent == null ? '' : r.entity.obj.Parent.Name; - console.log('this.accountDataInfo = ' + JSON.stringify(this.accountDataInfo)); - this.isShowAccountInfo = true; - this.isShowSpinner = false; - } else { - console.log('r = ' + JSON.stringify(r)) - this.showToast('Error', r.msg); - } - }).catch((error) => { - console.log('error = ' + JSON.stringify(error)) - this.showToast('Error', r.msg); }) + .then((r) => { + r = JSON.parse(JSON.stringify(r)); + console.log('r = ' + JSON.stringify(r)); + if (r.status == 'Success') { + this.accountDataInfo.name = r.entity.obj.Name; + this.accountDataInfo.ownerName = + r.entity.obj.Owner == null + ? '' + : r.entity.obj.Owner.Name; + this.accountDataInfo.site = r.entity.obj.site; + this.accountDataInfo.isActive = + r.entity.obj.Is_Active__c; + this.accountDataInfo.aliasName2 = + r.entity.obj.Alias_Name2__c; + this.accountDataInfo.banOnUseReason = + r.entity.obj.Ban_On_Use_Reason__c; + this.accountDataInfo.grade = r.entity.obj.Grade__c; + this.accountDataInfo.attributeType = + r.entity.obj.Attribute_Type__c; + this.accountDataInfo.oCMCategory = + r.entity.obj.OCM_Category__c; + this.accountDataInfo.specialityType = + r.entity.obj.Speciality_Type__c; + this.accountDataInfo.stateMasterName = + r.entity.obj.State_Master__r == null + ? '' + : r.entity.obj.State_Master__r.Name; + this.accountDataInfo.phone = r.entity.obj.Phone; + this.accountDataInfo.cityMasterName = + r.entity.obj.City_Master__r == null + ? '' + : r.entity.obj.City_Master__r.Name; + this.accountDataInfo.phoneCall = + r.entity.obj.PhoneCall__c; + this.accountDataInfo.town = r.entity.obj.Town__c; + this.accountDataInfo.fax = r.entity.obj.Fax; + this.accountDataInfo.street = r.entity.obj.Street__c; + this.accountDataInfo.postalCode = + r.entity.obj.Postal_Code__c; + this.accountDataInfo.address = r.entity.obj.Address__c; + this.accountDataInfo.parentName = + r.entity.obj.Parent == null + ? '' + : r.entity.obj.Parent.Name; + console.log( + 'this.accountDataInfo = ' + + JSON.stringify(this.accountDataInfo) + ); + this.isShowAccountInfo = true; + this.isShowSpinner = false; + } else { + console.log('r = ' + JSON.stringify(r)); + this.showToast('Error', r.msg); + } + }) + .catch((error) => { + console.log('error = ' + JSON.stringify(error)); + this.showToast('Error', r.msg); + }); } } @@ -93,11 +118,11 @@ this.dispatchEvent(event); } - printPage(){ + printPage() { window.print(); } - closePage(){ - window.location.href = "/s/lexconsumableaccount"; + closePage() { + window.location.href = '/s/lexconsumableaccount'; } } \ No newline at end of file -- Gitblit v1.9.1