unknown
2023-08-23 50ce6a5e5ae7ac6ce3e6281acca9a0db568306e6
force-app/main/default/lwc/lexConsumApply_FromQIS/lexConsumApply_FromQIS.js
@@ -8,7 +8,8 @@
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;
@@ -34,7 +35,7 @@
        rentalApp({
            recordId: this.recordId
        }).then(result => {
            console.log('rentalApp============' + result);
            console.log('rentalApp============',result);
            if(result.lenth > 0){
                const evt = new ShowToastEvent({
                    title : 'Error',
@@ -47,22 +48,23 @@
            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'){
@@ -72,8 +74,8 @@
                    //     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'";
@@ -97,17 +99,17 @@
                            .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: {
@@ -115,9 +117,9 @@
                           actionName: 'new'
                        },
                        state:{
                           defaultFieldValues: this.defaultValues
                           defaultFieldValues: defaultValues
                        }
                     })
                     });
                        }
                    })
                    this.dispatchEvent(new CloseActionScreenEvent());
@@ -126,14 +128,10 @@
            }).catch(error => {
                console.log("error");
                console.log(error);
            }).finally(() => {
            });
        }).catch(error => {
            console.log("error");
            console.log(error);
        }).finally(() => {
        });        
    }
@@ -144,6 +142,7 @@
            variant: type
        });
        this.dispatchEvent(evt);
        this.dispatchEvent(new CloseActionScreenEvent());
    }
}