19626
2023-09-09 e14d6d0619330cad423f06493e3aa2371faa2a8f
force-app/main/default/lwc/lexSubmitSolutionForApproval/lexSubmitSolutionForApproval.js
@@ -4,19 +4,23 @@
 * @Author: chen jing wu
 * @Date: 2023-06-20 14:37:24
 * @LastEditors: chen jing wu
 * @LastEditTime: 2023-07-07 16:11:12
 * @LastEditTime: 2023-08-29 14:07:08
 */
import { api, wire,LightningElement } from 'lwc';
import { api, wire,LightningElement, track } from 'lwc';
import { CurrentPageReference } from "lightning/navigation";
import { CloseActionScreenEvent } from 'lightning/actions';
import updateSubmitSolutionForApprovalButton  from '@salesforce/apex/lexSolutionProjectRequirementsController.updateSubmitSolutionForApprovalButton';
import init  from '@salesforce/apex/lexSolutionProjectRequirementsController.initSubmitSolutionForApprovalButton';
import queryForAttachments  from '@salesforce/apex/lexSolutionProjectRequirementsController.queryForAttachments';
import { updateRecord } from 'lightning/uiRecordApi';
import { updateRecord,getRecord } from 'lightning/uiRecordApi';
import STATUS_FIELD from "@salesforce/schema/SolutionProjectRequirements__c.Status__c";
import { refreshApex } from '@salesforce/apex';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import LightningConfirm from 'lightning/confirm';
export default class LexSubmitSolutionForApproval extends LightningElement {
    @wire(getRecord, { recordId: '$recordId', fields: [STATUS_FIELD] })
    record;
    @api recordId;
    status;
    submitDateYouWant;
@@ -42,9 +46,10 @@
    }
    showToast(msg,type) {
        const event = new ShowToastEvent({
            title: '',
            title: ' ',
            message: msg,
            variant: type
            variant: type,
            mode: 'sticky'
        });
        this.dispatchEvent(event);
    }
@@ -79,13 +84,12 @@
            this.dispatchEvent(new CloseActionScreenEvent());
            return;
        }
        if(this.submitDateYouWant < this.createdDate + 3){
        this.createdDate.setDate(this.createdDate.getDate() + 3);
        if(this.submitDateYouWant.getTime() < this.createdDate.getTime()){
            this.showToast('希望提交日期不得小于三天,如紧急需求请邮件联络Solution担当','error');
            this.dispatchEvent(new CloseActionScreenEvent());
            return;
        }
        console.log("start");
        queryForAttachments({
            Id: this.departmentClassId
        }).then(result=>{
@@ -118,7 +122,7 @@
        const result = await LightningConfirm.open({
            message: msg,
            variant: 'headerless',
            label: 'this is the aria-label value',
            label: 'this is the aria-label value'
        });
        console.log(result);
        if(result){
@@ -129,7 +133,13 @@
                   if(results){
                        this.showToast(results,"error");
                        this.dispatchEvent(new CloseActionScreenEvent());
                   }
                   } else{
                        setTimeout(() => {
                            refreshApex(this.record);
                            this.dispatchEvent(new CloseActionScreenEvent());
                        }, 1000);
                   }
                } catch (error) {
                    if(err.faultstring !=undefined && err.faultstring.indexOf('INVALID_SESSION_ID') != -1) {
                        this.showToast('当前网页已登出,请您重新登录后刷新该网页!','error');
@@ -140,8 +150,6 @@
                    }
                    return;
                }
                this.updateRecordView(this.recordId);
                this.dispatchEvent(new CloseActionScreenEvent());
            });
            // isopd.Id = "{!SolutionProjectRequirements__c.Id}";
            // isopd.Submint_TF__c = true;