| | |
| | | import { ShowToastEvent } from 'lightning/platformShowToastEvent'; |
| | | import { encodeDefaultFieldValues } from 'lightning/pageReferenceUtils'; |
| | | |
| | | export default class LexConsumApply_FromQIS extends LightningElement { |
| | | // 新建耗材备品申请(QIS) |
| | | export default class LexConsumApply_FromQIS extends NavigationMixin(LightningElement) { |
| | | |
| | | @api recordId; |
| | | IsLoading = true; |
| | |
| | | rentalApp({ |
| | | recordId: this.recordId |
| | | }).then(result => { |
| | | console.log('rentalApp============' + result); |
| | | console.log('rentalApp============',result); |
| | | if(result.lenth > 0){ |
| | | const evt = new ShowToastEvent({ |
| | | title : 'Error', |
| | |
| | | init({ |
| | | recordId: this.recordId |
| | | }).then(result => { |
| | | console.log('init============',result); |
| | | this.IsLoading = false; |
| | | if (result != null) { |
| | | if(result.nextAction=='送回'){ |
| | | this.showToast('QIS对应方法为“送回”,不能申请','warning'); |
| | | this.showToast('QIS对应方法为“送回”,不能申请','error'); |
| | | return; |
| | | } |
| | | if(result.qISStatus=='草案中'){ |
| | | this.showToast('QIS状态为草案中,不能申请','warning'); |
| | | this.showToast('QIS状态为草案中,不能申请','error'); |
| | | return; |
| | | } |
| | | if(result.qISStatus=='FSE填写完毕'){ |
| | | this.showToast('QIS状态为FSE填写完毕,不能申请','warning'); |
| | | this.showToast('QIS状态为FSE填写完毕,不能申请','error'); |
| | | return; |
| | | } |
| | | if(result.qISStatus=='取消'){ |
| | | this.showToast('QIS状态为取消,不能申请','warning'); |
| | | this.showToast('QIS状态为取消,不能申请','error'); |
| | | return; |
| | | } |
| | | // if('{!$User.isFormal_Stuff__c}'=='true'){ |
| | |
| | | // window.top.location.href=url; |
| | | // } |
| | | UserInfo_Owner({}).then(res=>{ |
| | | if(res.isFormalStuff == 'true'){ |
| | | this.showToast('试用期内,不能申请','warning'); |
| | | if(res.isFormalStuff){ |
| | | this.showToast('试用期内,不能申请','error'); |
| | | return; |
| | | }else{ |
| | | // var query = "Select QualifiedApiName, EntityDefinition.KeyPrefix, DurableId From FieldDefinition WHERE EntityDefinition.QualifiedApiName = 'Consum_Apply__c'"; |
| | |
| | | .catch(e=>{console.log(e)}) |
| | | |
| | | const defaultValues = encodeDefaultFieldValues({ |
| | | QIS_Report__c: this.recordId, |
| | | Hospital: result.hospital, |
| | | Strategic_dept: result.departmentClass, |
| | | Account:result.hospitalDepartment, |
| | | demo_purpose2:'索赔QIS', |
| | | Hospital__c: result.hospital, |
| | | Strategic_dept__c: result.departmentClass, |
| | | Account__c:result.hospitalDepartment, |
| | | demo_purpose2__c:'索赔QIS', |
| | | Name:'*', |
| | | Person_In_Charge:res.lastName + res.firstName, |
| | | applyUser:res.lastName + res.firstName, |
| | | QIS_number:result.name |
| | | Person_In_Charge__c:res.id, |
| | | applyUser__c:res.id, |
| | | QIS_number__c:result.qisReportId |
| | | }); |
| | | |
| | | console.log('init============',result); |
| | | console.log('init============',defaultValues); |
| | | this[NavigationMixin.Navigate]({ |
| | | type: 'standard__objectPage', |
| | | attributes: { |
| | |
| | | actionName: 'new' |
| | | }, |
| | | state:{ |
| | | defaultFieldValues: this.defaultValues |
| | | defaultFieldValues: defaultValues |
| | | } |
| | | }) |
| | | }); |
| | | } |
| | | }) |
| | | this.dispatchEvent(new CloseActionScreenEvent()); |
| | |
| | | }).catch(error => { |
| | | console.log("error"); |
| | | console.log(error); |
| | | }).finally(() => { |
| | | |
| | | }); |
| | | }).catch(error => { |
| | | console.log("error"); |
| | | console.log(error); |
| | | }).finally(() => { |
| | | |
| | | }); |
| | | } |
| | | |
| | |
| | | variant: type |
| | | }); |
| | | this.dispatchEvent(evt); |
| | | this.dispatchEvent(new CloseActionScreenEvent()); |
| | | } |
| | | |
| | | } |