19626
2023-10-09 25f056535350a0b80bad50d2cc45311998e5d1cd
force-app/main/default/lwc/tenderLost/tenderLost.js
@@ -4,9 +4,14 @@
// import SearchParent from '@salesforce/apex/TenderLostController.SearchParent';
import InitData from '@salesforce/apex/TenderLostController.InitData';
import LinkedHospitals from '@salesforce/apex/TenderLostController.LinkedHospitals';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import { CloseActionScreenEvent } from 'lightning/actions';
export default class TenderLost extends LightningElement {
    @api
    recordid;
    @api
    url;
    //资金来源选项
    RelateOption=[
        {label:"政府拨款",value:"政府資金"},
@@ -61,8 +66,8 @@
    //初始化
    connectedCallback(){
        this.tenId = this.getQueryVariable('id');
        // this.tenId = this.getQueryVariable('id');
        this.tenId = this.recordid
        InitData({ParamIdStr:this.tenId}).then(response=>{
            this.opp=JSON.parse(response);
        });
@@ -105,19 +110,22 @@
    //保存数据逻辑
    saveFn(){
        if(this.opp.Fund_Basis__c == undefined || this.opp.Sales_Method__c == undefined || this.opp.AccountId == undefined){
            this.Alert("请不要输入空哦。",false,true);
            this.showToast("请不要输入空哦。",'error')
        }else{
            this.OnLoading(true);
            SaveData({JsonData:JSON.stringify(this.opp)}).then((response)=>{
                if (response != '' && response.indexOf('错误') < 0) {
                    this.OnLoading(false);
                    console.log(response);
                    this.Alert("保存成功",false,true);
                    window.open('/apex/PCLLostReportPage?pageStatus=Create&oppId=' + response + '&lostType=失单');
                    // this.Alert("保存成功",false,true);
                    this.showToast("保存成功",'success')
                    window.location.href = '/'+this.recordid
                    window.open('/lightning/n/PCLLostReportPageLwc#pageStatus=Create&oppId=' + response + '&lostType=失单');
                    // top.window.close();
                    // window.location.hash = "Refresh"+"=="+response;
                    top.window.close();
                }else{
                    this.Alert(response,true);
                    // this.Alert(response,true);
                    this.showToast(response,'error')
                }
            });
        }
@@ -139,10 +147,10 @@
        if (error) {
            this.TongzhiIcon = "standard:first_non_empty";
            this.BgColorStyle = "background-color:#f88568";
            this.BgColorStyle = "background-color:rgb(234, 0, 30)";
        }else{
            this.TongzhiIcon = "standard:account";
            this.BgColorStyle = "background-color:#69e669";
            this.BgColorStyle = "background-color:rgb(46, 132, 74)";
        }
        if (left) {
            this.IsLeftStyle = "left: 0.25rem"
@@ -150,7 +158,14 @@
            this.IsLeftStyle = ""
        }
    }
    showToast(msg,type) {
        const event = new ShowToastEvent({
            message: msg,
            variant: type
        });
        this.dispatchEvent(event);
        this.dispatchEvent(new CloseActionScreenEvent());
    }
    //关闭提示框
    CloseAlert(){
        this.closeOffRefresh();