/* * @Description: 医院科室-变更保有设备所属按钮 权限判断 * @version: * @Author: zzm * @Date: 2024-02-29 14:36:32 * @LastEditors: zzm * @LastEditTime: 2024-02-29 14:36:32 */ import { LightningElement,wire,track,api} from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/AssetModifyBelongsController.getcheckABCUser'; import { encodeDefaultFieldValues } from 'lightning/pageReferenceUtils'; import lwcCSS from '@salesforce/resourceUrl/lwcCSS'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; import {loadStyle} from 'lightning/platformResourceLoader'; export default class LexAssetModifyBelongs extends LightningElement { @api recordId; @wire(CurrentPageReference) getStateParameters(currentPageReference) { console.log(111); console.log(currentPageReference); if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; console.log("str"); console.log(str); this.recordId = str; } } } connectedCallback () { Promise.all([ loadStyle(this, lwcCSS) ]); console.log(this.recordId); init().then(result => { console.log(result); if (result==true || result=='true') { window.location.href='/apex/AssetModifyBelongs?accountId='+this.recordId; this.dispatchEvent(new CloseActionScreenEvent()); }else{ this.showToast('没有提交变更的权限','error'); console.log("else"); this.IsLoading = false; this.dispatchEvent(new CloseActionScreenEvent()); } }).catch(error => { console.log("error"); console.log(error); }).finally(() => { }); } showToast(msg,type) { if(type == "success"){ const event = new ShowToastEvent({ message: msg, variant: type }); this.dispatchEvent(event); }else{ const event = new ShowToastEvent({ message: msg, variant: type, mode:'sticky' }); this.dispatchEvent(event); } // this.dispatchEvent(event); this.dispatchEvent(new CloseActionScreenEvent()); } }