unknown
2023-08-23 dfff58b7cd897b824a129edba6b5cdae20bb1e5c
发起再注册分析并同步SAP

发起再注册分析并同步SAP
3个文件已添加
97 ■■■■■ 已修改文件
force-app/main/default/lwc/lexFSESubmit/lexFSESubmit.html 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexFSESubmit/lexFSESubmit.js 83 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexFSESubmit/lexFSESubmit.js-meta.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexFSESubmit/lexFSESubmit.html
New file
@@ -0,0 +1,3 @@
<template>
</template>
force-app/main/default/lwc/lexFSESubmit/lexFSESubmit.js
New file
@@ -0,0 +1,83 @@
import { LightningElement, track, wire, api } from 'lwc';
import { CurrentPageReference } from "lightning/navigation";
import { CloseActionScreenEvent } from 'lightning/actions';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import { updateRecord } from 'lightning/uiRecordApi';
import init from '@salesforce/apex/lexRepairAgainAnController.init';
import updateRepairAgainStatus from '@salesforce/apex/lexRepairAgainAnController.updateRepairAgainStatus';
//发起再注册分析并同步SAP
export default class lexFSESubmit extends LightningElement {
    @api recordId;
    IsLoading = true;
    @wire(CurrentPageReference)
    getStateParameters(currentPageReference) {
        if (currentPageReference) {
           const urlValue = currentPageReference.state.recordId;
           if (urlValue) {
             let str = `${urlValue}`;
             console.log("str");
             console.log(str);
             this.recordId = str;
           }
         }
    }
    connectedCallback () {
        init({
            recordId: this.recordId
        }).then(res=>{
            if(res){
                this.IsLoading = false;
                if(res.repairAgainStatus == '取消'){
                    this.showToast('取消后的再修理返品分析不允许再提交,如果需要提交请点击\"复制\"按钮重新生成一个再修理返品分析','warning');
                    return;
                }
                console.log('res==='+JSON.stringify(res));
                if(res.repairAgainStatus != '草案中' && res.repairAgainStatus != '取消'){
                    this.showToast('已经提交','warning');
                    return;
                }
                console.log(res.rCConfirmer+""===+res.repairLast);
                if(res.rCConfirmer == '' || res.repairLast == null){
                    this.showToast('【RC确认者】或【上次修理】为空时不能提交申请','warning');
                    return;
                }
                updateRepairAgainStatus({
                    recordId: this.recordId,
                    updateStatus: 'RC填写完毕'
                }).then(result=>{
                    if(result == 'SUCCESS'){
                        this.showToast('提交成功','success');
                        return;
                    }
                    if(result == 'ERROR'){
                        this.showToast('提交失败','error');
                        return;
                    }
                })
            }
        })
    }
    showToast(msg,type) {
        const event = new ShowToastEvent({
            message: msg,
            variant: type
        });
        if(type == 'success'){
            this.updateRecordView(this.recordId);
        }
        this.dispatchEvent(event);
        this.dispatchEvent(new CloseActionScreenEvent());
    }
    updateRecordView(recordId) {
        updateRecord({fields: { Id: recordId }});
    }
}
force-app/main/default/lwc/lexFSESubmit/lexFSESubmit.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="lexFSESubmit">
     <apiVersion>54.0</apiVersion>
    <isExposed>true</isExposed>
    <targets>
        <target>lightning__RecordPage</target>
        <target>lightning__AppPage</target>
        <target>lightning__HomePage</target>
        <target>lightning__RecordAction</target>
    </targets>
</LightningComponentBundle>