zhangqian
2023-07-04 586d34ae6c5a292e04fcf8ca1df711b6ea5204bf
新建耗材申请 学会 QIS 注残 opd

1
21个文件已添加
3个文件已修改
1136 ■■■■■ 已修改文件
force-app/main/default/lwc/lexConsumApply_FromAccount/lexConsumApply_FromAccount.html 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexConsumApply_FromAccount/lexConsumApply_FromAccount.js 98 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexConsumApply_FromAccount/lexConsumApply_FromAccount.js-meta.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexConsumApply_FromCampaign/lexConsumApply_FromCampaign.html 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexConsumApply_FromCampaign/lexConsumApply_FromCampaign.js 109 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexConsumApply_FromCampaign/lexConsumApply_FromCampaign.js-meta.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexConsumApply_FromOPDPlan/lexConsumApply_FromOPDPlan.html 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexConsumApply_FromOPDPlan/lexConsumApply_FromOPDPlan.js 100 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexConsumApply_FromOPDPlan/lexConsumApply_FromOPDPlan.js-meta.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexConsumApply_FromQIS/lexConsumApply_FromQIS.html 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexConsumApply_FromQIS/lexConsumApply_FromQIS.js 148 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexConsumApply_FromQIS/lexConsumApply_FromQIS.js-meta.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexConsumApply_FromRA/lexConsumApply_FromRA.html 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexConsumApply_FromRA/lexConsumApply_FromRA.js 113 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexConsumApply_FromRA/lexConsumApply_FromRA.js-meta.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexEquipmentRentalApply_FromQIS2/lexEquipmentRentalApply_FromQIS2.html 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexEquipmentRentalApply_FromQIS2/lexEquipmentRentalApply_FromQIS2.js 54 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexEquipmentRentalApply_FromQIS2/lexEquipmentRentalApply_FromQIS2.js-meta.xml 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexEquipmentRentalApply_FromSA/lexEquipmentRentalApply_FromSA.html 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexEquipmentRentalApply_FromSA/lexEquipmentRentalApply_FromSA.js 104 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexEquipmentRentalApply_FromSA/lexEquipmentRentalApply_FromSA.js-meta.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexNewSparePartsLoanApplication/lexNewSparePartsLoanApplication.html 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexNewSparePartsLoanApplication/lexNewSparePartsLoanApplication.js 275 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexNewSparePartsLoanApplication/lexNewSparePartsLoanApplication.js-meta.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexConsumApply_FromAccount/lexConsumApply_FromAccount.html
New file
@@ -0,0 +1,5 @@
<template>
    <div class="dispatchOCSMQARAHolder" if:true={IsLoading}>
        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
    </div>
</template>
force-app/main/default/lwc/lexConsumApply_FromAccount/lexConsumApply_FromAccount.js
New file
@@ -0,0 +1,98 @@
import { LightningElement,wire,track,api} from 'lwc';
import { CurrentPageReference, NavigationMixin} from "lightning/navigation";
import { CloseActionScreenEvent } from 'lightning/actions';
import  init  from '@salesforce/apex/lexConsumApply_FromAccountCtl.init';
import  fieldDefineApp  from '@salesforce/apex/lexConsumApply_FromAccountCtl.fieldDefineApp';
import UserInfo_Owner from '@salesforce/apex/lexConsumApply_FromAccountCtl.UserInfo_Owner';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import { encodeDefaultFieldValues } from 'lightning/pageReferenceUtils';
export default class LexConsumApply_FromAccount extends NavigationMixin(LightningElement) {
    @api recordId;
    IsLoading = true;
    @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(){
        console.log(this.recordId);
        init({
            recordId: this.recordId
        }).then(result=>{
            UserInfo_Owner({}).then(res=>{
                if(res.isFormalStuff == 'true'){
                    this.showToast('试用期内,不能申请','error');
                    return;
                }else{
                    fieldDefineApp({}).then(resp=>{
                        var fieldmap = new Map();
                        for (var i=0; i< resp.length; i++) {
                            var record = resp[i];
                            fieldmap.set(record.QualifiedApiName,record.DurableId.toString().split('.')[1]);
                        }
                    })
                    .catch(e=>{console.log(e)})
                    const defaultValues = encodeDefaultFieldValues({
                        Hospital__c:result.hospitalName,
                        Strategic_dept__c:result.departClass,
                        Account__c:result.name,
                        Name:'*',
                        demo_purpose2__c:'OPD试用',
                        Person_In_Charge__c:res.id,
                        applyUser__c:res.id
                    });
                    this[NavigationMixin.Navigate]({
                        type: 'standard__objectPage',
                        attributes: {
                            objectApiName: 'Consum_Apply__c',
                            actionName: 'new'
                        },
                        state:{
                            defaultFieldValues: defaultValues
                        }
                    })
                }
            })
            .catch(error => {
                console.log("error");
                console.log(error);
            })
        })
        .catch(error => {
            console.log("error");
            console.log(error);
        }).finally(() => {
            this.dispatchEvent(new CloseActionScreenEvent());
        });
    }
    showToast(message, type) {
        const evt = new ShowToastEvent({
            title: '',
            message: message,
            variant: type
        });
        this.dispatchEvent(evt);
        this.dispatchEvent(new CloseActionScreenEvent());
    }
}
force-app/main/default/lwc/lexConsumApply_FromAccount/lexConsumApply_FromAccount.js-meta.xml
New file
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexEquipmentRentalApply_FromSA">
    <apiVersion>56.0</apiVersion>
    <isExposed>true</isExposed>
    <targets>
        <target>lightning__AppPage</target>
        <target>lightning__RecordPage</target>
        <target>lightning__HomePage</target>
        <target>lightning__RecordAction</target>
    </targets>
</LightningComponentBundle>
force-app/main/default/lwc/lexConsumApply_FromCampaign/lexConsumApply_FromCampaign.html
New file
@@ -0,0 +1,5 @@
<template>
  <div class="dispatchOCSMQARAHolder" if:true={IsLoading}>
      <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
  </div>
</template>
force-app/main/default/lwc/lexConsumApply_FromCampaign/lexConsumApply_FromCampaign.js
New file
@@ -0,0 +1,109 @@
import { LightningElement,wire,track,api} from 'lwc';
import { CurrentPageReference, NavigationMixin} from "lightning/navigation";
import { CloseActionScreenEvent } from 'lightning/actions';
import  init  from '@salesforce/apex/LexConsumApply_FromCampaignCtl.init';
import  rentalApp  from '@salesforce/apex/LexConsumApply_FromCampaignCtl.rentalApp';
import UserInfo_Owner from '@salesforce/apex/LexConsumApply_FromCampaignCtl.UserInfo_Owner';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import { encodeDefaultFieldValues } from 'lightning/pageReferenceUtils';
export default class LexConsumApply_FromCampaign extends NavigationMixin(LightningElement) {
    @api recordId;
    IsLoading = true;
    @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(){
        console.log(this.recordId);
        UserInfo_Owner({}).then(res=>{
            if(res){
                init({
                    recordId: this.recordId
                }).then(result => {
                    this.IsLoading = false;
                    var ups = res.userprovince.slice(0,2);
                    if(res.isFormalStuff == 'true'){
                        this.showToast('试用期内,不能申请','error');
                    }else if(result.recordTypeId != result.servicetrainig && res.jobCategory == '销售服务'){
                        this.showToast('FSE不能申请该学会类型备品','error');
                    }else if((res.jobCategory == '销售服务' || res.jobCategory == '支援') && result.recordTypeId != result.servicetrainig && res.chargeProvince.indexOf((ups) == -1)){
                        this.showToast('与FSE所在省一致,才可使用备品','error');
                    }else if(result.status == '已结束'){
                        this.showToast('已结束,不能申请','error');
                    }else if(result.status == '已提交报告'){
                        this.showToast('已提交报告,不能申请','error');
                    }else if(result.status == '取消申请中'){
                        this.showToast('取消申请中,不能申请','error');
                    }else if(result.status == '取消'){
                        this.showToast('试用期内,不能申请','error');
                    }else{
                        rentalApp({})
                        .then(results=>{
                            var fieldmap = new Map();
                            for (var i=0; i< results.length; i++) {
                                var record = results[i];
                                fieldmap.set(record.QualifiedApiName,record.DurableId.toString().split('.')[1]);
                            }
                            // var url = "{!$Site.Prefix}/" + prefix + "/e?retURL=%2F{!URLENCODE(Campaign.Id)}"
                            // + "&CF" + fieldmap.get('Campaign__c') + "={!URLENCODE(Campaign.Name)}"
                            // + "&CF" + fieldmap.get('Campaign__c') + "_lkid={!URLENCODE(Campaign.Id)}"
                            // + "&Name={!URLENCODE('*')}"
                            // + "&" + fieldmap.get('demo_purpose2__c') + "={!URLENCODE('学会展会')}"
                            // + "&Name={!URLENCODE('*')}"
                            // + "&CF" + fieldmap.get('Person_In_Charge__c') + "={!URLENCODE($User.LastName&' '&$User.FirstName)}"
                            // + "&CF" + fieldmap.get('Person_In_Charge__c') + "_lkid={!URLENCODE($User.Id)}"
                            // + "&CF" + fieldmap.get('applyUser__c') + "={!URLENCODE($User.LastName&' '&$User.FirstName)}"
                            // + "&CF" + fieldmap.get('applyUser__c') + "_lkid={!URLENCODE($User.Id)}"
                            // + "";
                            const defaultValues = encodeDefaultFieldValues({
                                Campaign__c: result.campaignId,
                                Name:'*',
                                demo_purpose2__c:'学会展会',
                                Person_In_Charge__c:res.id,
                                applyUser__c:res.id
                            });
                            this[NavigationMixin.Navigate]({
                                type: 'standard__objectPage',
                                attributes: {
                                    objectApiName: 'Consum_Apply__c',
                                    actionName: 'new'
                                },
                                state:{
                                    defaultFieldValues: defaultValues
                                }
                            })
                        })
                    }
                })
            }
        })
    }
    showToast(message, type) {
        const evt = new ShowToastEvent({
            title: 'Error',
            message: message,
            variant: type
        });
        this.dispatchEvent(evt);
        this.dispatchEvent(new CloseActionScreenEvent());
    }
}
force-app/main/default/lwc/lexConsumApply_FromCampaign/lexConsumApply_FromCampaign.js-meta.xml
New file
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexConsumApply_FromCampaign">
    <apiVersion>56.0</apiVersion>
    <isExposed>true</isExposed>
    <targets>
        <target>lightning__AppPage</target>
        <target>lightning__RecordPage</target>
        <target>lightning__HomePage</target>
        <target>lightning__RecordAction</target>
    </targets>
</LightningComponentBundle>
force-app/main/default/lwc/lexConsumApply_FromOPDPlan/lexConsumApply_FromOPDPlan.html
New file
@@ -0,0 +1,5 @@
<template>
    <div class="dispatchOCSMQARAHolder" if:true={IsLoading}>
        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
    </div>
</template>
force-app/main/default/lwc/lexConsumApply_FromOPDPlan/lexConsumApply_FromOPDPlan.js
New file
@@ -0,0 +1,100 @@
import { LightningElement,wire,track,api} from 'lwc';
import { CurrentPageReference, NavigationMixin} from "lightning/navigation";
import { CloseActionScreenEvent } from 'lightning/actions';
import  init  from '@salesforce/apex/lexConsumApply_FromOPDPlanCtl.init';
import  fieldDefineApp  from '@salesforce/apex/lexConsumApply_FromOPDPlanCtl.fieldDefineApp';
import UserInfo_Owner from '@salesforce/apex/lexConsumApply_FromOPDPlanCtl.UserInfo_Owner';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import { encodeDefaultFieldValues } from 'lightning/pageReferenceUtils';
// 新建耗材申请(OPD计划)
export default class LexConsumApply_FromOPDPlan extends NavigationMixin(LightningElement) {
    @api recordId;
    IsLoading = true;
    @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(){
        console.log(this.recordId);
        init({
            recordId: this.recordId
        }).then(result=>{
            UserInfo_Owner({}).then(res=>{
                if(res.isFormalStuff == 'true'){
                    this.showToast('试用期内,不能申请','error');
                    return;
                }else{
                    fieldDefineApp({}).then(resp=>{
                        var fieldmap = new Map();
                        for (var i=0; i< resp.length; i++) {
                            var record = resp[i];
                            fieldmap.set(record.QualifiedApiName,record.DurableId.toString().split('.')[1]);
                        }
                    })
                    .catch(e=>{console.log(e)})
                    const defaultValues = encodeDefaultFieldValues({
                        OPD__c: result.opdPlan,
                        OPDPlan__c: result.name,
                        Rental_Apply__c:result.rentalApply2,
                        Hospital__c:result.hospitalName,
                        Strategic_dept__c:result.ocmCategoryName,
                        Account__c:result.accountLab,
                        Name:'*',
                        demo_purpose2__c:'OPD试用',
                        Person_In_Charge__c:res.id,
                        applyUser__c:res.id
                    });
                    console.log("defaultValues====> ",defaultValues);
                    this[NavigationMixin.Navigate]({
                        type: 'standard__objectPage',
                        attributes: {
                            objectApiName: 'Consum_Apply__c',
                            actionName: 'new'
                        },
                        state:{
                            defaultFieldValues: defaultValues
                        }
                    });
                }
            })
            .catch(error => {
                console.log("error ---> ",error);
            })
        })
        .catch(error => {
            console.log("error----");
            console.log(error);
        }).finally(() => {
            this.dispatchEvent(new CloseActionScreenEvent());
        });
    }
    showToast(message, type) {
        const evt = new ShowToastEvent({
            title: '',
            message: message,
            variant: type
        });
        this.dispatchEvent(evt);
        this.dispatchEvent(new CloseActionScreenEvent());
    }
}
force-app/main/default/lwc/lexConsumApply_FromOPDPlan/lexConsumApply_FromOPDPlan.js-meta.xml
New file
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>56.0</apiVersion>
    <isExposed>true</isExposed>
    <targets>
        <target>lightning__AppPage</target>
        <target>lightning__RecordPage</target>
        <target>lightning__HomePage</target>
        <target>lightning__RecordAction</target>
    </targets>
</LightningComponentBundle>
force-app/main/default/lwc/lexConsumApply_FromQIS/lexConsumApply_FromQIS.html
New file
@@ -0,0 +1,5 @@
<template>
    <div class="dispatchOCSMQARAHolder" if:true={IsLoading}>
        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
    </div>
</template>
force-app/main/default/lwc/lexConsumApply_FromQIS/lexConsumApply_FromQIS.js
New file
@@ -0,0 +1,148 @@
import { LightningElement,wire,track,api} from 'lwc';
import { CurrentPageReference, NavigationMixin} from "lightning/navigation";
import { CloseActionScreenEvent } from 'lightning/actions';
import  init  from '@salesforce/apex/LexConsumApply_FromQISCtl.init';
import  rentalApp  from '@salesforce/apex/LexConsumApply_FromQISCtl.rentalApp';
import  fieldDefineApp  from '@salesforce/apex/LexConsumApply_FromQISCtl.fieldDefineApp';
import UserInfo_Owner from '@salesforce/apex/LexConsumApply_FromQISCtl.UserInfo_Owner';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import { encodeDefaultFieldValues } from 'lightning/pageReferenceUtils';
// 新建耗材备品申请(QIS)
export default class LexConsumApply_FromQIS extends NavigationMixin(LightningElement) {
    @api recordId;
    IsLoading = true;
    @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(){
        console.log(this.recordId);
        rentalApp({
            recordId: this.recordId
        }).then(result => {
            console.log('rentalApp============',result);
            if(result.lenth > 0){
                const evt = new ShowToastEvent({
                    title : 'Error',
                    message : '同一个QIS记录不能重复申请备品',
                    variant : 'error'
                });
                this.dispatchEvent(evt);
                return;
            }
            init({
                recordId: this.recordId
            }).then(result => {
                console.log('init============',result);
                this.IsLoading = false;
                if (result != null) {
                    if(result.nextAction=='送回'){
                        this.showToast('QIS对应方法为“送回”,不能申请','error');
                        return;
                    }
                    if(result.qISStatus=='草案中'){
                        this.showToast('QIS状态为草案中,不能申请','error');
                        return;
                    }
                    if(result.qISStatus=='FSE填写完毕'){
                        this.showToast('QIS状态为FSE填写完毕,不能申请','error');
                        return;
                    }
                    if(result.qISStatus=='取消'){
                        this.showToast('QIS状态为取消,不能申请','error');
                        return;
                    }
                    // if('{!$User.isFormal_Stuff__c}'=='true'){
                    //     alert('试用期内,不能申请');
                    //     }else{
                    //     var url = "/a0t/e?retURL=%2F{!URLENCODE(QIS_Report__c.Id)}&CF00N10000003Mp1d={!URLENCODE(QIS_Report__c.Hospital__c)}&CF00N10000003Mp1d_lkid={!URLENCODE(QIS_Report__c.HospitalId__c)}&CF00N10000003O3V6={!URLENCODE(QIS_Report__c.Department_Class__c)}&CF00N10000003O3V6_lkid={!URLENCODE(QIS_Report__c.Department_ClassId__c)}&CF00N10000003Mp2R={!URLENCODE(QIS_Report__c.Hospital_Department__c)}&CF00N10000003Mp2R_lkid={!URLENCODE(QIS_Report__c.Hospital_DepartmentId__c)}&00N10000003Msk0={!URLENCODE('维修代用')}&00N10000003Msk5={!URLENCODE('索赔QIS')}&Name={!URLENCODE('*')}&CF00N10000005HzRr={!URLENCODE($User.LastName&' '&$User.FirstName)}&CF00N10000005HzRr_lkid={!URLENCODE($User.Id)}&CF00N10000005HzRz={!URLENCODE($User.LastName&' '&$User.FirstName)}&CF00N10000005HzRz_lkid={!URLENCODE($User.Id)}&00N10000003OJzc={!URLENCODE($User.LastName&' '&$User.FirstName)}&CF00N10000004o2Mg={!URLENCODE(QIS_Report__c.Name)}&CF00N10000004o2Mg_lkid={!URLENCODE(QIS_Report__c.Id)}&CF00N10000008r73m={!URLENCODE( QIS_Report__c.Repair__c)}&CF00N10000008r73m_lkid={!URLENCODE( QIS_Report__c.RepairId__c )}&";
                    //     window.top.location.href=url;
                    //     }
                    UserInfo_Owner({}).then(res=>{
                        if(res.isFormalStuff == 'true'){
                            this.showToast('试用期内,不能申请','error');
                            return;
                        }else{
                            // var query = "Select QualifiedApiName, EntityDefinition.KeyPrefix, DurableId From FieldDefinition WHERE EntityDefinition.QualifiedApiName = 'Consum_Apply__c'";
                            // var records = sforce.connection.query(query).getArray('records');
                            // var prefix = records[0].EntityDefinition.KeyPrefix.toString();
                            // var fieldmap = new Map();
                            // for (var i=0; i< records.length; i++) {
                            //     var record = records[i];
                            //     fieldmap.set(record.QualifiedApiName,record.DurableId.toString().split('.')[1]);
                            // }
                            fieldDefineApp({}).then(resp=>{
                                var fieldmap = new Map();
                                for (var i=0; i< resp.length; i++) {
                                    var record = resp[i];
                                    fieldmap.set(record.QualifiedApiName,record.DurableId.toString().split('.')[1]);
                                }
                            })
                            .catch(e=>{console.log(e)})
                            const defaultValues = encodeDefaultFieldValues({
                                Hospital__c: result.hospital,
                                Strategic_dept__c: result.departmentClass,
                                Account__c:result.hospitalDepartment,
                                demo_purpose2__c:'索赔QIS',
                                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: {
                                    objectApiName: 'Consum_Apply__c',
                                    actionName: 'new'
                                },
                                state:{
                                    defaultFieldValues: defaultValues
                                }
                            });
                        }
                    })
                    this.dispatchEvent(new CloseActionScreenEvent());
                    // window.location.reload();
                }
            }).catch(error => {
                console.log("error");
                console.log(error);
            });
        }).catch(error => {
            console.log("error");
            console.log(error);
        });
    }
    showToast(message, type) {
        const evt = new ShowToastEvent({
            title: '',
            message: message,
            variant: type
        });
        this.dispatchEvent(evt);
        this.dispatchEvent(new CloseActionScreenEvent());
    }
}
force-app/main/default/lwc/lexConsumApply_FromQIS/lexConsumApply_FromQIS.js-meta.xml
New file
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>56.0</apiVersion>
    <isExposed>true</isExposed>
    <targets>
        <target>lightning__AppPage</target>
        <target>lightning__RecordPage</target>
        <target>lightning__HomePage</target>
        <target>lightning__RecordAction</target>
    </targets>
</LightningComponentBundle>
force-app/main/default/lwc/lexConsumApply_FromRA/lexConsumApply_FromRA.html
New file
@@ -0,0 +1,5 @@
<template>
    <div class="dispatchOCSMQARAHolder" if:true={IsLoading}>
        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
    </div>
</template>
force-app/main/default/lwc/lexConsumApply_FromRA/lexConsumApply_FromRA.js
New file
@@ -0,0 +1,113 @@
import { LightningElement,wire,track,api} from 'lwc';
import { CurrentPageReference, NavigationMixin} from "lightning/navigation";
import { CloseActionScreenEvent } from 'lightning/actions';
import  init  from '@salesforce/apex/lexConsumApply_FromRACtl.init';
import  fieldDefineApp  from '@salesforce/apex/lexConsumApply_FromRACtl.fieldDefineApp';
import UserInfo_Owner from '@salesforce/apex/lexConsumApply_FromRACtl.UserInfo_Owner';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import { encodeDefaultFieldValues } from 'lightning/pageReferenceUtils';
// 新建耗材申请
export default class LexConsumApply_FromRA extends NavigationMixin(LightningElement) {
@api recordId;
    IsLoading = true;
    @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(){
        console.log(this.recordId);
        UserInfo_Owner({}).then(res=>{
            this.IsLoading = false;
            if(res.isFormalStuff == 'true'){
                this.showToast('试用期内,不能申请','error');
                return;
            }else{
                fieldDefineApp({}).then(resp=>{
                    var fieldmap = new Map();
                    for (var i=0; i< resp.length; i++) {
                        var record = resp[i];
                        fieldmap.set(record.QualifiedApiName,record.DurableId.toString().split('.')[1]);
                    }
                })
                .catch(e=>{console.log(e)})
                init({
                    recordId: this.recordId
                }).then(result=>{
                    console.log('result.rentalHospital'+result.rentalHospital);
                    if(result){
                        const defaultValues = encodeDefaultFieldValues({
                            Rental_Apply__c: result.rentalApplyId,
                            demo_purpose2__c:result.demoPurpose2,
                            Campaign__c: result.rentalCampaign,
                            QIS_number__c:result.rentalQISNumber,
                            QISRepair__c:result.rentalQISRepair,
                            OPD__c:result.rentalOPD,
                            OPDPlan__c:result.rentalOPDPlan,
                            Hospital__c:result.rentalHospital,
                            Strategic_dept__c:result.rentalStrategicDept,
                            Account__c:result.rentalAccount,
                            ApplyPerson_Phone__c:result.rentalApplyPersonPhone,
                            Phone_number__c:result.rentalPhoneNumber,
                            Request_shipping_day__c:result.rentalRequestShippingDay,
                            Loaner_medical_Staff__c:result.rentalLoanerMedicalStaff,
                            Shipment_address__c:result.rentalShipmentAddress,
                            Dealer__c:result.rentalDealer,
                            direct_send__c:result.rentalDirectSend,
                            pickup_time__c:result.rentalPickupTime,
                            Loaner_received_staff__c:result.rentalLoanerReceivedStaff,
                            Loaner_received_staff_phone__c:result.rentalLoanerReceivedStaffPhone,
                            Post_Code__c:result.rentalPostCode,
                            direct_shippment_address__c:result.rentalDirectShippmentAddress,
                            Name:'*',
                            Person_In_Charge__c:res.id,
                            applyUser__c:res.id
                        });
                        console.log('init============',result);
                        console.log('init============',defaultValues);
                        this[NavigationMixin.Navigate]({
                            type: 'standard__objectPage',
                            attributes: {
                                objectApiName: 'Consum_Apply__c',
                                actionName: 'new'
                            },
                            state:{
                                defaultFieldValues: defaultValues
                            }
                        });
                    }
                }).catch(e=>{console.log(e)})
            }
            this.dispatchEvent(new CloseActionScreenEvent());
        })
        .catch(err=>{console.log(err)})
    }
    showToast(message, type) {
        const evt = new ShowToastEvent({
            title: '',
            message: message,
            variant: type
        });
        this.dispatchEvent(evt);
        this.dispatchEvent(new CloseActionScreenEvent());
    }
}
force-app/main/default/lwc/lexConsumApply_FromRA/lexConsumApply_FromRA.js-meta.xml
New file
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>56.0</apiVersion>
    <isExposed>true</isExposed>
    <targets>
        <target>lightning__AppPage</target>
        <target>lightning__RecordPage</target>
        <target>lightning__HomePage</target>
        <target>lightning__RecordAction</target>
    </targets>
</LightningComponentBundle>
force-app/main/default/lwc/lexEquipmentRentalApply_FromQIS2/lexEquipmentRentalApply_FromQIS2.html
@@ -1,5 +1,6 @@
<template>
    <div class="dispatchOCSMQARAHolder" if:true={IsLoading}>
        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
        <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button>
    </div>
</template>
force-app/main/default/lwc/lexEquipmentRentalApply_FromQIS2/lexEquipmentRentalApply_FromQIS2.js
@@ -1,8 +1,8 @@
import { LightningElement,wire,track,api} from 'lwc';
import { CurrentPageReference, NavigationMixin} from "lightning/navigation";
import { CloseActionScreenEvent } from 'lightning/actions';
import  init  from '@salesforce/apex/LexEquipmentRentalApply_FromQISCtl.rentalApp';
import  rentalApp  from '@salesforce/apex/LexEquipmentRentalApply_FromQISCtl.init';
import  rentalApp  from '@salesforce/apex/LexEquipmentRentalApply_FromQISCtl.rentalApp';
import  init  from '@salesforce/apex/LexEquipmentRentalApply_FromQISCtl.init';
import UserInfo_Owner from '@salesforce/apex/LexEquipmentRentalApply_FromQISCtl.UserInfo_Owner';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import { encodeDefaultFieldValues } from 'lightning/pageReferenceUtils';
@@ -33,7 +33,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,48 +47,49 @@
                recordId: this.recordId
            }).then(result => {
                this.IsLoading = false;
                console.log('init============',result);
                if (result != null) {
                    if(result.nextAction=='送回'){
                        this.showToast('QIS对应方法为“送回”,不能申请','warning');
                        this.showToast('QIS对应方法为“送回”,不能申请','error');
                        return;
                    }
                    if(result.qISStatus=='草案中'){
                        this.showToast('QIS状态为草案中,不能申请','warning');
                        // this.msg =  'QIS状态为草案中,不能申请';
                        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'){
                        alert('试用期内,不能申请');
                        }else{
                        var url = "/a0t/e?retURL=%2F{!URLENCODE(QIS_Report__c.Id)}&CF00N10000003Mp1d={!URLENCODE(QIS_Report__c.Hospital__c)}&CF00N10000003Mp1d_lkid={!URLENCODE(QIS_Report__c.HospitalId__c)}&CF00N10000003O3V6={!URLENCODE(QIS_Report__c.Department_Class__c)}&CF00N10000003O3V6_lkid={!URLENCODE(QIS_Report__c.Department_ClassId__c)}&CF00N10000003Mp2R={!URLENCODE(QIS_Report__c.Hospital_Department__c)}&CF00N10000003Mp2R_lkid={!URLENCODE(QIS_Report__c.Hospital_DepartmentId__c)}&00N10000003Msk0={!URLENCODE('维修代用')}&00N10000003Msk5={!URLENCODE('索赔QIS')}&Name={!URLENCODE('*')}&CF00N10000005HzRr={!URLENCODE($User.LastName&' '&$User.FirstName)}&CF00N10000005HzRr_lkid={!URLENCODE($User.Id)}&CF00N10000005HzRz={!URLENCODE($User.LastName&' '&$User.FirstName)}&CF00N10000005HzRz_lkid={!URLENCODE($User.Id)}&00N10000003OJzc={!URLENCODE($User.LastName&' '&$User.FirstName)}&CF00N10000004o2Mg={!URLENCODE(QIS_Report__c.Name)}&CF00N10000004o2Mg_lkid={!URLENCODE(QIS_Report__c.Id)}&CF00N10000008r73m={!URLENCODE( QIS_Report__c.Repair__c)}&CF00N10000008r73m_lkid={!URLENCODE( QIS_Report__c.RepairId__c )}&";
                        window.top.location.href=url;
                        }
                    // if('{!$User.isFormal_Stuff__c}'=='true'){
                    //     alert('试用期内,不能申请');
                    //     }else{
                    //     var url = "/a0t/e?retURL=%2F{!URLENCODE(QIS_Report__c.Id)}&CF00N10000003Mp1d={!URLENCODE(QIS_Report__c.Hospital__c)}&CF00N10000003Mp1d_lkid={!URLENCODE(QIS_Report__c.HospitalId__c)}&CF00N10000003O3V6={!URLENCODE(QIS_Report__c.Department_Class__c)}&CF00N10000003O3V6_lkid={!URLENCODE(QIS_Report__c.Department_ClassId__c)}&CF00N10000003Mp2R={!URLENCODE(QIS_Report__c.Hospital_Department__c)}&CF00N10000003Mp2R_lkid={!URLENCODE(QIS_Report__c.Hospital_DepartmentId__c)}&00N10000003Msk0={!URLENCODE('维修代用')}&00N10000003Msk5={!URLENCODE('索赔QIS')}&Name={!URLENCODE('*')}&CF00N10000005HzRr={!URLENCODE($User.LastName&' '&$User.FirstName)}&CF00N10000005HzRr_lkid={!URLENCODE($User.Id)}&CF00N10000005HzRz={!URLENCODE($User.LastName&' '&$User.FirstName)}&CF00N10000005HzRz_lkid={!URLENCODE($User.Id)}&00N10000003OJzc={!URLENCODE($User.LastName&' '&$User.FirstName)}&CF00N10000004o2Mg={!URLENCODE(QIS_Report__c.Name)}&CF00N10000004o2Mg_lkid={!URLENCODE(QIS_Report__c.Id)}&CF00N10000008r73m={!URLENCODE( QIS_Report__c.Repair__c)}&CF00N10000008r73m_lkid={!URLENCODE( QIS_Report__c.RepairId__c )}&";
                    //     window.top.location.href=url;
                    //     }
                    UserInfo_Owner({}).then(res=>{
                        if(res.isFormalStuff == 'true'){
                            this.showToast('试用期内,不能申请','warning');
                            this.showToast('试用期内,不能申请','error');
                            return;
                        }else{
                            const defaultValues = encodeDefaultFieldValues({
                                QIS_Report__c: this.recordId,
                                Hospital: result.hospital,
                                Strategic_dept: result.departmentClass,
                                Account:result.hospitalDepartment,
                                Demo_purpose1:'维修代用',
                                demo_purpose2:'索赔QIS',
                                Hospital__c: result.hospital,
                                Strategic_dept__c: result.departmentClass,
                                Account__c:result.hospitalDepartment,
                                Demo_purpose1__c:'维修代用',
                                demo_purpose2__c:'索赔QIS',
                                Name:'*',
                                Person_In_Charge:res.lastName + res.firstName,
                                applyUser:res.lastName + res.firstName,
                                Loaner_received_staff:res.lastName + res.firstName,
                                QIS_number:result.name,
                                QISRepair:result.repair
                                Person_In_Charge__c:res.lastName + res.firstName,
                                applyUser__c:res.lastName + res.firstName,
                                Loaner_received_staff__c:res.lastName + res.firstName,
                                QIS_number__c:result.name,
                                QISRepair__c:result.repair
                            });
                            this[NavigationMixin.Navigate]({
@@ -122,11 +123,12 @@
    showToast(message, type) {
        const evt = new ShowToastEvent({
            title: '',
            title: 'Error',
            message: message,
            variant: type
        });
        this.dispatchEvent(evt);
        this.dispatchEvent(new CloseActionScreenEvent());
    }
}
force-app/main/default/lwc/lexEquipmentRentalApply_FromQIS2/lexEquipmentRentalApply_FromQIS2.js-meta.xml
@@ -1,21 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>56.0</apiVersion>
    <isExposed>false</isExposed>
    <isExposed>true</isExposed>
    <targets>
        <target>lightning__AppPage</target>
        <target>lightning__RecordPage</target>
        <target>lightning__HomePage</target>
        <target>lightning__RecordAction</target>
        <!-- 屏幕流配置 -->
        <target>lightning__FlowScreen</target>
    </targets>
    <!-- 定义变量 -->
    <targetConfigs>
        <targetConfig targets="lightning__FlowScreen">
            <!-- name js中使用的变量,从屏幕流中获取参数  label 在屏幕流的该LWC的设置中显示 -->
            <property name="recordId" type="String" label="recordId"/>
            <!-- <property name="rentalApplyIds" type="String[]" label="rentalApplyIds"/> -->
        </targetConfig>
    </targetConfigs>
        <target>lightning__RecordPage</target>
        <target>lightning__AppPage</target>
        <target>lightning__HomePage</target>
        <target>lightning__RecordAction</target>
    </targets>
</LightningComponentBundle>
force-app/main/default/lwc/lexEquipmentRentalApply_FromSA/lexEquipmentRentalApply_FromSA.html
New file
@@ -0,0 +1,5 @@
<template>
    <div class="dispatchOCSMQARAHolder" if:true={IsLoading}>
        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
    </div>
</template>
force-app/main/default/lwc/lexEquipmentRentalApply_FromSA/lexEquipmentRentalApply_FromSA.js
New file
@@ -0,0 +1,104 @@
import { LightningElement,wire,track,api} from 'lwc';
import { CurrentPageReference, NavigationMixin} from "lightning/navigation";
import { CloseActionScreenEvent } from 'lightning/actions';
import  init  from '@salesforce/apex/lexEquipmentRentalApply_FromSACtl.init';
import UserInfo_Owner from '@salesforce/apex/lexEquipmentRentalApply_FromSACtl.UserInfo_Owner';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import { encodeDefaultFieldValues } from 'lightning/pageReferenceUtils';
import RentalApplyCheckForSAoneEle  from '@salesforce/apex/RentalApplyWebService.RentalApplyCheckForSAoneEle';
//     新建备品借出申请(注残)
export default class LexEquipmentRentalApply_FromSA extends LightningElement {
    @api recordId;
    IsLoading = true;
    @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(){
        console.log(this.recordId);
        // if(rtn == 'Fin'){
        //     var url = '/a0t/e?CF00N10000006pvpb={!URLENCODE(Statu_Achievements__c.Name)}&CF00N10000006pvpb_lkid={!URLENCODE(Statu_Achievements__c.Id)}&retURL=%2F{!URLENCODE(Statu_Achievements__c.Id)}&CF00N10000003Mp1d={!URLENCODE(Statu_Achievements__c.Opp_Hospitalo__c)}&CF00N10000003Mp1d_lkid={!URLENCODE(Statu_Achievements__c.Opp_Hospital_Id__c)}&Name={!URLENCODE('*')}&00N10000003Msk0={!URLENCODE('产品试用')}&00N10000003Msk5={!URLENCODE('已购待货')}&CF00N10000003O3V6={!URLENCODE(Statu_Achievements__c.Opp_DeptClass__c)}&CF00N10000003O3V6_lkid={!URLENCODE(Statu_Achievements__c.Opp_DeptClass_Id__c)}&CF00N10000003Mp2R={!Statu_Achievements__c.Opp_ClassName__c}&CF00N10000003Mp2R_lkid={!URLENCODE(Statu_Achievements__c.Opp_Class_Id__c)}&CF00N10000005HzRr={!URLENCODE($User.LastName&' '&$User.FirstName)}&CF00N10000005HzRr_lkid={!URLENCODE($User.Id)}&CF00N10000005HzRz={!URLENCODE($User.LastName&' '&$User.FirstName)}&CF00N10000005HzRz_lkid={!URLENCODE($User.Id)}&00N10000003OJzc={!URLENCODE($User.LastName&' '&$User.FirstName)}&CF00N10000003O3VB={!URLENCODE(Statu_Achievements__c.Opportunity__c)}&CF00N10000003O3VB_lkid={!URLENCODE(Statu_Achievements__c.OpportunityId__c)}'
        //     window.top.location.href = url;
        //     }else{
        //     alert(rtn );
        //     }
        RentalApplyCheckForSAoneEle({SaID:this.recordId})
        .then(res=>{
            if(res == 'Fin'){
                init({
                    recordId: this.recordId
                }).then(result => {
                    this.IsLoading = false;
                    if (result != null) {
                        UserInfo_Owner({}).then(res=>{
                            if(res.isFormalStuff == 'true'){
                                this.showToast('试用期内,不能申请','warning');
                                return;
                            }else{
                                const defaultValues = encodeDefaultFieldValues({
                                    Statu_Achievements__c: result.achievement,
                                    retURL:this.recordId,
                                    Hospital__c: result.hospital,
                                    Name:'*',
                                    Strategic_dept__c: result.departmentClass,
                                    Account__c:result.oppClassName,
                                    Demo_purpose1__c:'产品试用',
                                    demo_purpose2__c:'已购待货',
                                    Person_In_Charge__c:res.lastName + res.firstName,
                                    applyUser__c:res.lastName + res.firstName,
                                    Loaner_received_staff__c:res.lastName + res.firstName,
                                    Follow_UP_Opp__c:result.opportunity
                                });
                                this[NavigationMixin.Navigate]({
                                    type: 'standard__objectPage',
                                    attributes: {
                                        objectApiName: 'Rental_Apply__c',
                                        actionName: 'new'
                                    },
                                    state:{
                                        defaultFieldValues: this.defaultValues
                                    }
                                })
                            }
                        })
                        this.dispatchEvent(new CloseActionScreenEvent());
                        // window.location.reload();
                    }
                }).catch(error => {
                    console.log("error");
                    console.log(error);
                })
            }else{
                this.showToast(res,'error');
                return;
            }
        })
        .catch(err=>{console.log(err)})
    }
    showToast(message, type) {
        const evt = new ShowToastEvent({
            title: 'Error',
            message: message,
            variant: type
        });
        this.dispatchEvent(evt);
        this.dispatchEvent(new CloseActionScreenEvent());
    }
}
force-app/main/default/lwc/lexEquipmentRentalApply_FromSA/lexEquipmentRentalApply_FromSA.js-meta.xml
New file
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>56.0</apiVersion>
    <isExposed>true</isExposed>
    <targets>
        <target>lightning__RecordPage</target>
        <target>lightning__AppPage</target>
        <target>lightning__HomePage</target>
        <target>lightning__RecordAction</target>
    </targets>
</LightningComponentBundle>
force-app/main/default/lwc/lexNewSparePartsLoanApplication/lexNewSparePartsLoanApplication.html
New file
@@ -0,0 +1,5 @@
<template>
    <div class="dispatchOCSMQARAHolder" if:true={IsLoading}>
        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
    </div>
</template>
force-app/main/default/lwc/lexNewSparePartsLoanApplication/lexNewSparePartsLoanApplication.js
New file
@@ -0,0 +1,275 @@
import { LightningElement,wire,track,api} from 'lwc';
import { CurrentPageReference, NavigationMixin} from "lightning/navigation";
import { CloseActionScreenEvent } from 'lightning/actions';
import  init  from '@salesforce/apex/lexNewSparePartsLoanApplicationCtl.init';
import UserInfo_Owner from '@salesforce/apex/lexNewSparePartsLoanApplicationCtl.UserInfo_Owner';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import { encodeDefaultFieldValues } from 'lightning/pageReferenceUtils';
// 新建备品借出申请 opd计划
export default class LexNewSparePartsLoanApplication extends NavigationMixin(LightningElement) {
    @api recordId;
    defaultValues1;
    IsLoading = true;
    @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(){
        console.log(this.recordId);
        init({
            recordId: this.recordId
        }).then(result => {
            this.IsLoading = false;
            if (result != null) {
                console.log("-------result--------------",JSON.stringify(result))
                if (result.opdStayOrNot == '已离职') {
                    this.showToast('所有人已经离职,请联系系统管理员修改所有人。','error');
                    return;
                }
                if (result.opdIFApproved == true && result.opdApprovedNo == ''){
                this.showToast('需要决裁时,决裁编码不能为空','error');
                return;
                }
                if (result.opdIFApproved == true && result.opdApprovedNo != '' && result.opdStatusProcessState.indexOf(result.opdApprovedStatus)!= -1 && result.opdApprovedStatus != '草稿' ){
                this.showToast('已申请决裁但决裁状态不符合条件','error');
                return;
                }
                var HaveValue = "{!OPDPlan__c.Rental_Apply2__c}";
                if (result.opdRentalApply2 != '' && result.opdType != '学会') {
                    this.showToast('一个OPD计划只可关联创建一个备品申请单','error');
                    return;
                }
                if (result.opdStatus != '计划中') {
                this.showToast('OPD计划的状态不是计划中,不能新建备品借出申请','error');
                return;
                }
                UserInfo_Owner({}).then(res=>{
                    console.log("-------UserInfo_Owner------------",res);
                    if(res.isFormalStuff == 'true'){
                        this.showToast('试用期内,不能申请','error');
                        return;
                    }
                    console.log("-------UserInfo_Owner---1111---------",result);
                    if (result.opdType == '学会' && result.opdCampaignId != '') {
                        console.log("-------UserInfo_Owner---2222---------");
                        if (result.opdRentalApplyFlag < 7) {
                        this.showToast("申请提交必须在7天(含)以上才可以",'error');
                        return;
                        }
                        var ups = res.userProvince.slice(0, 2);
                        if (result.opdCampaignTypeId != '01210000000R26P' && res.userJobCategory == '销售服务' ) {
                        this.showToast('FSE不能申请该学会类型备品','error');
                        return;
                        } else if ((res.userJobCategory == '销售服务' || res.userJobCategory == '支援') && result.opdCampaignTypeId == '01210000000R26P' && result.opdInternalinchargeprovince.indexOf(ups) == -1) {
                        this.showToast("与FSE所在省一致,才可使用备品",'error');
                        return;
                        } else if (result.opdCampaignStatus == '已结束') {
                        this.showToast("已结束,不能申请",'error');
                        return;
                        } else if (result.opdCampaignStatus == '已提交报告') {
                        this.showToast("已提交报告,不能申请",'error');
                        return;
                        } else if (result.opdCampaignStatus == '取消申请中') {
                        this.showToast("取消申请中,不能申请",'error');
                        return;
                        } else if (result.opdCampaignStatus == '取消') {
                        this.showToast("已经取消,不能申请",'error');
                        return;
                        }
                    }
                    if (result.opdOriginalOpdPlan == '') {
                        if (result.opdOriginalOpdPlanApplication == '') {
                            if (result.opdType == '学会' && result.opdCampaignId != '') {
                                // var purposeStr = '&00N10000003Msk0=产品试用' +
                                // '&00N10000003Msk5=学会展会' +
                                // '&CF00N10000003Mp2q_lkid={!URLENCODE(OPDPlan__c.CampaignId__c)}' +
                                // '&CF00N10000003Mp2q={!URLENCODE(OPDPlan__c.CampaignName__c)}';
                                const defaultValues = encodeDefaultFieldValues({
                                    // OPDPlan__c:this.recordId,
                                    Demo_purpose1__c:'产品试用',
                                    demo_purpose2__c:'学会展会',
                                    Campaign__c:result.opdCampaign,
                                    Account__c:result.opdAccountLaboratory,
                                    Strategic_dept__c:result.opdOCMcategoryName,
                                    Hospital__c:result.opdHospitalName,
                                    OPDPlan__c:opdName,
                                    Person_In_Charge__c:res.lastName + res.firstName,
                                    applyUser__c:res.lastName + res.firstName,
                                    Loaner_received_staff__c:res.lastName + res.firstName,
                                    IsJump__c:result.opdIsJump,
                                    JumpCause__c:result.opdJumpCause,
                                    Name:'*',
                                    Approved_State_Create__c:result.ApprovedStatus,
                                    ApprovedNo_Create__c:result.opdApprovedNo
                                });
                                this.navigateEvents(defaultValues);
                            } else if (result.opdOpportunityId != '') {
                                // var purposeStr = '&00N10000003Msk0=产品试用' +
                                // '&00N10000003Msk5=试用(有询价)' +
                                // '&CF00N10000003O3VB_lkid={!OPDPlan__c.Related_Opportunity1_IDId__c}' +
                                // '&CF00N10000003O3VB={!HTMLENCODE(OPDPlan__c.Related_Opportunity1_Name__c)}';
                                console.log("--------defaultValues------")
                                const defaultValues = encodeDefaultFieldValues({
                                    // OPDPlan__c:this.recordId,
                                    Demo_purpose1__c:'产品试用',
                                    demo_purpose2__c:'试用(有询价)',
                                    Follow_UP_Opp__c:result.opdRelatedOpportunity1Name,
                                    Account__c:result.opdAccountLaboratory,
                                    // Strategic_dept__c:result.opdOCMcategoryName,
                                    // Hospital__c:result.opdHospitalName,
                                    // OPDPlan__c:opdName,
                                    // Person_In_Charge__c:res.lastName + res.firstName,
                                    // applyUser__c:res.lastName + res.firstName,
                                    // Loaner_received_staff__c:res.lastName + res.firstName,
                                    // IsJump__c:result.opdIsJump,
                                    // JumpCause__c:result.opdJumpCause,
                                    // Name:'*',
                                    // Approved_State_Create__c:result.ApprovedStatus,
                                    // ApprovedNo_Create__c:result.opdApprovedNo
                                });
                                console.log("--------defaultValues---1111---",defaultValues);
                                this.navigateEvents(defaultValues);
                            } else {
                                console.log("-------UserInfo_Owner---77777---------");
                                // var purposeStr = '&00N10000003Msk0=产品试用' +
                                // '&00N10000003Msk5=试用(无询价)' +
                                // '&00N100000098amW={!OPDPlan__c.NoOpp_Reason__c}';
                                const defaultValues = encodeDefaultFieldValues({
                                    // OPDPlan__c:this.recordId,
                                    Demo_purpose1__c:'产品试用',
                                    demo_purpose2__c:'试用(有询价)',
                                    NoOpp_Reason__c:result.opdNoOppReason,
                                    Account__c:result.opdAccountLaboratory,
                                    Strategic_dept__c:result.opdOCMcategoryName,
                                    Hospital__c:result.opdHospitalName,
                                    OPDPlan__c:opdName,
                                    Person_In_Charge__c:res.lastName + res.firstName,
                                    applyUser__c:res.lastName + res.firstName,
                                    Loaner_received_staff__c:res.lastName + res.firstName,
                                    IsJump__c:result.opdIsJump,
                                    JumpCause__c:result.opdJumpCause,
                                    Name:'*',
                                    Approved_State_Create__c:result.ApprovedStatus,
                                    ApprovedNo_Create__c:result.opdApprovedNo
                                });
                                this.navigateEvents(defaultValues);
                            }
                            // var urlStr = '&CF00N10000003Mp2R={!HTMLENCODE(OPDPlan__c.Account_Laboratory__c)}' +
                            // '&CF00N10000003O3V6={!HTMLENCODE(OPDPlan__c.OCM_category_Name__c)}' +
                            // '&CF00N10000003Mp1d={!HTMLENCODE(OPDPlan__c.HospitalName__c)}' +
                            // '&CF00N10000008ps61={!HTMLENCODE(OPDPlan__c.Name)}' +
                            // '&CF00N10000005HzRr={!URLENCODE($User.LastName&' '&$User.FirstName)}' +
                            // '&CF00N10000005HzRz={!URLENCODE($User.LastName&' '&$User.FirstName)}' +
                            // '&00N10000003OJzc={!URLENCODE($User.LastName&' '&$User.FirstName)}' +
                            // '&00N100000098dmS={!OPDPlan__c.IsJump__c}' +
                            // '&00N100000098dmI={!HTMLENCODE(OPDPlan__c.JumpCause__c)}' +
                            // '&Name=*'+
                            // '&00N10000009HBWg= {!OPDPlan__c.Approved_Status__c} ' +
                            // '&00N10000009HBXK= {!OPDPlan__c.Approved_No__c} '; //// 20220211 sx add 备品借出申请-决裁控制 No.2
                            // window.open('/a0t/e?retURL=%2F{!OPDPlan__c.Id}' + purposeStr + urlStr );
                        } else {
                            const defaultValues = encodeDefaultFieldValues({
                                // OPDPlan__c:this.recordId,
                                Cancel_Reason__c:'',
                                Loaner_cancel_reason__c:'',
                                Loaner_cancel_request__c:'',
                                Request_demo_time__c:'',
                                Request_approval_time__c:'',
                                Application_accept_time__c:'',
                                Response__c:'',
                                Status__c:'草案中',
                                Zsq_Rental_Apply__c:result.opdRentalApplyName,
                                OPDPlan__c:result.opdName,
                                Assign_Person__c:'',
                                Old_Rental_Apply__c:'',
                                Split_Apply_Reason__c:''
                            });
                            this.navigateEvents(defaultValues);
                            // var url = "/{!OPDPlan__c.originalOpdRentalApply__c}/e?newclone=1&retURL=%2F{!OPDPlan__c.originalOpdRentalApply__c}&common.udd.actions.ActionsUtilORIG_URI=%2F{!OPDPlan__c.RentalApplyId__c}%2Fe&cloneli=1&00N10000007MNF8=&00N100000098uKJ=&00N10000004oFTC=&00N10000003O1JF=&00N10000003O1JK=&00N10000006pvpZ=&00N10000003O1JU=&00N10000006gY9x=&00N10000003Mp2H=草案中&CF00N10000009EKKp_lkid={!OPDPlan__c.RentalApplyId__c}&CF00N10000009EKKp={!OPDPlan__c.RentalApplyName__c}&CF00N10000008ps61={!OPDPlan__c.Name}&CF00N10000008ps61_lkid={!OPDPlan__c.Id}&CF00N10000008poFM=&CF00N10000008poFM_lkid=&CF00N10000005HzRq=&CF00N10000005HzRq_lkid=&00N10000007oQKh=";
                            // window.open(url);
                        }
                    }else {
                        console.log("-------UserInfo_Owner---00000--else-------");
                        const defaultValues = encodeDefaultFieldValues({
                            // OPDPlan__c:this.recordId,
                            Cancel_Reason__c:'',
                            Loaner_cancel_reason__c:'',
                            Loaner_cancel_request__c:'',
                            Request_shipping_day__c:'',
                            Hope_Lonaer_date_Num__c:'',
                            Request_return_day__c:'',
                            Status__c:'草案中',
                            Zsq_Rental_Apply__c:result.opdRentalApplyName,
                            OPDPlan__c:result.opdName,
                            Assign_Person__c:'',
                            Old_Rental_Apply__c:'',
                            Split_Apply_Reason__c:''
                        });
                        console.log("-------UserInfo_Owner---00000--else-------" + defaultValues);
                        this.navigateEvents(defaultValues);
                    //     var url = "/{!OPDPlan__c.RentalApplyId__c}/e?newclone=1&retURL=%2F{!OPDPlan__c.RentalApplyId__c}&common.udd.actions.ActionsUtilORIG_URI=%2F{!OPDPlan__c.RentalApplyId__c}%2Fe&cloneli=1&00N10000007MNF8=&00N100000098uKJ=&00N10000004oFTC=&00N10000003Ntz7=&00N10000008rG1M=&00N10000005HzRw=&00N10000003Mp2H=草案中&CF00N10000009EKKp_lkid={!OPDPlan__c.RentalApplyId__c}&CF00N10000009EKKp={!OPDPlan__c.RentalApplyName__c}&CF00N10000008ps61={!OPDPlan__c.Name}&CF00N10000008ps61_lkid={!OPDPlan__c.Id}&CF00N10000008poFM=&CF00N10000008poFM_lkid=&CF00N10000005HzRq=&CF00N10000005HzRq_lkid=&00N10000007oQKh=";
                    //     window.open(url);
                    }
                })
                this.dispatchEvent(new CloseActionScreenEvent());
                // window.location.reload();
            }
        }).catch(error => {
            console.log("error");
            console.log(error);
        });
    }
    showToast(message, type) {
        const evt = new ShowToastEvent({
            title: 'Error',
            message: message,
            variant: type
        });
        this.dispatchEvent(evt);
        this.dispatchEvent(new CloseActionScreenEvent());
    }
    navigateEvents(defaultValues){
        console.log("--------navigateEvents------",defaultValues)
        this[NavigationMixin.Navigate]({
            type: 'standard__objectPage',
            attributes: {
                objectApiName: 'Rental_Apply__c',
                actionName: 'new'
            },
            state:{
                defaultFieldValues: defaultValues
            }
        })
    }
}
force-app/main/default/lwc/lexNewSparePartsLoanApplication/lexNewSparePartsLoanApplication.js-meta.xml
New file
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>56.0</apiVersion>
    <isExposed>true</isExposed>
    <targets>
        <target>lightning__RecordPage</target>
        <target>lightning__AppPage</target>
        <target>lightning__HomePage</target>
        <target>lightning__RecordAction</target>
    </targets>
</LightningComponentBundle>