1
chenjingwu
2024-05-24 84e0a7994d22fa5be5e5f8ae91ca4990ef495afd
force-app/main/default/lwc/improvedForecastTime/improvedForecastTime.js
@@ -5,6 +5,7 @@
import SystemModstamp from '@salesforce/schema/Account.SystemModstamp';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import { CloseActionScreenEvent } from 'lightning/actions';
import { updateRecord } from 'lightning/uiRecordApi';
import lwcCSS from '@salesforce/resourceUrl/lwcCSS';
import {loadStyle} from 'lightning/platformResourceLoader';
import lexDateCss from '@salesforce/resourceUrl/lexDateCss';
@@ -18,6 +19,9 @@
        {label:"提前",value:"提前"},
        {label:"延后",value:"延后"},
    ]
    updateRecordView(recordId) {
        updateRecord({fields: { Id: recordId }});
    }
        
    handleRelationFn(event){
@@ -158,14 +162,14 @@
    showToast(msg,type) {
        if(type == 'success'){
          const event = new ShowToastEvent({
            title: ' ',
            title: '',
            message: msg,
            variant: type
          });
          this.dispatchEvent(event);
        }else{
          const event = new ShowToastEvent({
            title: ' ',
            title: '',
            message: msg,
            variant: type,
            mode: 'sticky'
@@ -264,15 +268,19 @@
            SaveData({JsonData:JSON.stringify(this.opp)}).then((response)=>{
                if (response == '成功') {
                    this.OnLoading(false);
                    this.showToast("保存成功","success");
                    this.showToast("保存成功","success");
                    // window.location.hash = "Refresh"+"=="+this.oppId;
                    const closeEvent = new CustomEvent('closeaction', {
                        bubbles: true, // 允许事件冒泡至父组件
                        composed: true, // 允许事件穿越 Shadow DOM 界限
                    });
                    setTimeout(() => {
                        window.location = '/' + this.recordId;
                    }, 2000);
                    this.dispatchEvent(closeEvent);
                }else{
                    this.showToast(response,"error");
                    this.IsLoading = false;
                }
            });
        }