19626
2023-06-20 9dca2b56fba9e2e3a0346235229e06d9e25fe5fe
修改页面以及按钮
12个文件已添加
1个文件已修改
390 ■■■■■ 已修改文件
force-app/main/default/classes/lexAgencyHospitalController.cls 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/lexAgencyHospitalController.cls-meta.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/lexSolutionProjectRequirementsController.cls 72 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/lexSolutionProjectRequirementsController.cls-meta.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexNewAgencyHospital/__tests__/lexNewAgencyHospital.test.js 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexNewAgencyHospital/lexNewAgencyHospital.html 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexNewAgencyHospital/lexNewAgencyHospital.js 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexNewAgencyHospital/lexNewAgencyHospital.js-meta.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexSubmitSolutionForApproval/__tests__/lexSubmitSolutionForApproval.test.js 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexSubmitSolutionForApproval/lexSubmitSolutionForApproval.html 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexSubmitSolutionForApproval/lexSubmitSolutionForApproval.js 148 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexSubmitSolutionForApproval/lexSubmitSolutionForApproval.js-meta.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/pages/ImprovedForecastTime.page 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/lexAgencyHospitalController.cls
New file
@@ -0,0 +1,17 @@
public with sharing class lexAgencyHospitalController {
    @AuraEnabled
    public static InitData queryForAgencyHospitalRecordType(String recordId){
        InitData res = new InitData();
        try {
            RecordType recordType = [
                select Id from RecordType where DeveloperName = 'AHospital' and SobjectType = 'Agency_Hospital_Link__c'
            ];
        } catch (Exception e) {
            throw new AuraHandledException(e.getMessage());
        }
    }
    class InitData{
    }
}
force-app/main/default/classes/lexAgencyHospitalController.cls-meta.xml
New file
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>57.0</apiVersion>
    <status>Active</status>
</ApexClass>
force-app/main/default/classes/lexSolutionProjectRequirementsController.cls
New file
@@ -0,0 +1,72 @@
public with sharing class lexSolutionProjectRequirementsController {
    @AuraEnabled
    public static InitData initSubmitSolutionForApprovalButton(String recordId){
        InitData res = new InitData();
        try {
            SolutionProjectRequirements__c so = [
                select
                Status__c,
                Submit_Date_YouWant__c,
                CreatedDate,
                Department_Class__r.Id,
                Product_Leader__c
                from SolutionProjectRequirements__c where Id =: recordId
            ];
            res.status = so.Status__c;
            res.submitDateYouWant = so.Submit_Date_YouWant__c;
            res.createdDate = so.CreatedDate;
            res.departmentClassId = so.Department_Class__r.Id;
            res.productLeader = so.Product_Leader__c;
        } catch (Exception e) {
            throw new AuraHandledException(e.getMessage());
        }
        return res;
    }
    @AuraEnabled
    public static string updateSubmitSolutionForApprovalButton(String recordId){
        SolutionProjectRequirements__c so = new SolutionProjectRequirements__c();
        try {
            so.Id = recordId;
            so.Submint_TF__c = true;
            so.Submitter__c = UserInfo.getUserId();
            update so;
            return '';
        } catch (Exception e) {
            return e.getMessage();
        }
    }
    @AuraEnabled
    public static List<Account> queryForAttachments(String Id){
        List<Account> accList = null;
        try {
            accList = [
                select id,
                Department_Class__r.OwnerId,
                Department_Class__r.Owner.SalesManager__c
                from Account where id =: Id
            ];
        } catch (Exception e) {
            throw new AuraHandledException(e.getMessage());
        }
        return accList;
    }
    class InitData{
        @AuraEnabled
        public String status;
        @AuraEnabled
        public Date submitDateYouWant;
        @AuraEnabled
        public Datetime createdDate;
        @AuraEnabled
        public String departmentClassId;
        @AuraEnabled
        public String userId;
        @AuraEnabled
        public String userName;
        @AuraEnabled
        public String productLeader;
    }
}
force-app/main/default/classes/lexSolutionProjectRequirementsController.cls-meta.xml
New file
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>57.0</apiVersion>
    <status>Active</status>
</ApexClass>
force-app/main/default/lwc/lexNewAgencyHospital/__tests__/lexNewAgencyHospital.test.js
New file
@@ -0,0 +1,25 @@
import { createElement } from 'lwc';
import LexNewAgencyHospital from 'c/lexNewAgencyHospital';
describe('c-lex-new-agency-hospital', () => {
    afterEach(() => {
        // The jsdom instance is shared across test cases in a single file so reset the DOM
        while (document.body.firstChild) {
            document.body.removeChild(document.body.firstChild);
        }
    });
    it('TODO: test case generated by CLI command, please fill in test logic', () => {
        // Arrange
        const element = createElement('c-lex-new-agency-hospital', {
            is: LexNewAgencyHospital
        });
        // Act
        document.body.appendChild(element);
        // Assert
        // const div = element.shadowRoot.querySelector('div');
        expect(1).toBe(1);
    });
});
force-app/main/default/lwc/lexNewAgencyHospital/lexNewAgencyHospital.html
New file
@@ -0,0 +1,5 @@
<template>
    <div class="exampleHolder" if:true={IsLoading}>
        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
    </div>
</template>
force-app/main/default/lwc/lexNewAgencyHospital/lexNewAgencyHospital.js
New file
@@ -0,0 +1,59 @@
import { api, wire,LightningElement } from 'lwc';
import { CurrentPageReference } from "lightning/navigation";
import { CloseActionScreenEvent } from 'lightning/actions';
import { updateRecord } from 'lightning/uiRecordApi';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import { NavigationMixin } from 'lightning/navigation';
import { encodeDefaultFieldValues } from 'lightning/pageReferenceUtils';
export default class LexNewAgencyHospital extends LightningElement {
    @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;
          }
        }
    }
    updateRecordView(recordId) {
        updateRecord({fields: { Id: recordId }});
    }
    showToast(msg,type) {
        const event = new ShowToastEvent({
            title: '',
            message: msg,
            variant: type
        });
        this.dispatchEvent(event);
    }
    connectedCallback(){
        var doubleFlg = false;
        if(!doubleFlg) {
        doubleFlg = true;
        const defaultValues = encodeDefaultFieldValues({
            Agency__c: this.recordId,
            Name: '*'
        });
        this[NavigationMixin.Navigate]({
            type: 'standard__objectPage',
            attributes: {
                objectApiName: 'Agency_Hospital_Link__c',
                actionName: 'new'
            },
            state: {
                nooverride: '1',
                defaultFieldValues: defaultValues
            }
        });
        }
    }
}
force-app/main/default/lwc/lexNewAgencyHospital/lexNewAgencyHospital.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>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>
force-app/main/default/lwc/lexSubmitSolutionForApproval/__tests__/lexSubmitSolutionForApproval.test.js
New file
@@ -0,0 +1,25 @@
import { createElement } from 'lwc';
import LexSubmitSolutionForApproval from 'c/lexSubmitSolutionForApproval';
describe('c-lex-submit-solution-for-approval', () => {
    afterEach(() => {
        // The jsdom instance is shared across test cases in a single file so reset the DOM
        while (document.body.firstChild) {
            document.body.removeChild(document.body.firstChild);
        }
    });
    it('TODO: test case generated by CLI command, please fill in test logic', () => {
        // Arrange
        const element = createElement('c-lex-submit-solution-for-approval', {
            is: LexSubmitSolutionForApproval
        });
        // Act
        document.body.appendChild(element);
        // Assert
        // const div = element.shadowRoot.querySelector('div');
        expect(1).toBe(1);
    });
});
force-app/main/default/lwc/lexSubmitSolutionForApproval/lexSubmitSolutionForApproval.html
New file
@@ -0,0 +1,5 @@
<template>
    <div class="submitSolutionForApprovalHolder" if:true={IsLoading}>
        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
    </div>
</template>
force-app/main/default/lwc/lexSubmitSolutionForApproval/lexSubmitSolutionForApproval.js
New file
@@ -0,0 +1,148 @@
/*
 * @Description:
 * @version:
 * @Author: chen jing wu
 * @Date: 2023-06-20 14:37:24
 * @LastEditors: chen jing wu
 * @LastEditTime: 2023-06-20 17:50:52
 */
import { api, wire,LightningElement } 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 { ShowToastEvent } from 'lightning/platformShowToastEvent';
import LightningConfirm from 'lightning/confirm';
export default class LexSubmitSolutionForApproval extends LightningElement {
    @api recordId;
    status;
    submitDateYouWant;
    createdDate;
    departmentClassId;
    userId;
    userName;
    productLeader;
    @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;
          }
        }
    }
    showToast(msg,type) {
        const event = new ShowToastEvent({
            title: '',
            message: msg,
            variant: type
        });
        this.dispatchEvent(event);
    }
    updateRecordView(recordId) {
        updateRecord({fields: { Id: recordId }});
    }
    connectedCallback(){
        init({
            recordId: this.recordId
        }).then(result=>{
            this.status = result.status;
            this.submitDateYouWant = result.submitDateYouWant;
            this.createdDate = result.createdDate;
            this.departmentClassId = result.departmentClassId;
            this.userId = result.userId;
            this.userName = result.userName;
            this.submitSolutionForApproval();
        });
    }
    submitSolutionForApproval(){
        if(this.status == '07结案'){
            this.showToast('已结案','error');
            this.dispatchEvent(new CloseActionScreenEvent());
            return;
        }
        if(this.submitDateYouWant < this.createdDate + 3){
            this.showToast('希望提交日期不得小于三天,如紧急需求请邮件联络Solution担当','error');
            this.dispatchEvent(new CloseActionScreenEvent());
            return;
        }
        queryForAttachments({
            Id: this.departmentClassId
        }).then(result=>{
            var records = result;
            var header = this.productLeader;
            var usrname = this.userName;
            var rtn = '';
            if(header.contains(usrname.replaceAll(' ', ''))){
                rtn = 'Y';
            }else{
                rtn = 'N';
            }
            if(records.length > 0){
                if(rtn != 'Y' && this.userId != records[0].Department_Class__r.OwnerId && this.userId != records[0].Department_Class__r.Owner.SalesManager__c){
                    this.showToast('只允其战略科室主担、产品担当及省经理提交solution项目需求!','error');
                    this.dispatchEvent(new CloseActionScreenEvent());
                    return;
                }
            }
            //111111111111111111111111111111111111111111
            this.handleConfirmClick('一旦提交此记录以待批准,根据您的设置您可能不再能够编辑此记录或将他从批准过程中调回。是否继续?');
        });
    }
    async handleConfirmClick(msg) {
        const result = await LightningConfirm.open({
            message: msg,
            variant: 'headerless',
            label: 'this is the aria-label value',
        });
        console.log(result);
        if(result){
            updateSubmitSolutionForApprovalButton({
                recordId: this.recordId
            }).then(results=>{
                try {
                   if(results){
                        this.showToast(results,"error");
                        this.dispatchEvent(new CloseActionScreenEvent());
                   }
                } catch (error) {
                    if(err.faultstring !=undefined && err.faultstring.indexOf('INVALID_SESSION_ID') != -1) {
                        this.showToast('当前网页已登出,请您重新登录后刷新该网页!','error');
                        this.dispatchEvent(new CloseActionScreenEvent());
                    } else {
                        this.showToast(err.faultstring,'error');
                        this.dispatchEvent(new CloseActionScreenEvent());
                    }
                    return;
                }
                this.updateRecordView(this.recordId);
            });
            // isopd.Id = "{!SolutionProjectRequirements__c.Id}";
            // isopd.Submint_TF__c = true;
            // isopd.Submitter__c = "{!$User.Id}";
        }else{
            this.dispatchEvent(new CloseActionScreenEvent());
            return;
        }
    }
}
force-app/main/default/lwc/lexSubmitSolutionForApproval/lexSubmitSolutionForApproval.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>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>
force-app/main/default/pages/ImprovedForecastTime.page
@@ -1,4 +1,4 @@
<apex:page showHeader="false" sidebar="false" id="ImprovedForecastTimeApp" title="预测日期改变">
<apex:page showHeader="false" sidebar="false" id="ImprovedForecastTimeApp" title="预测日期改变" lightningStylesheets="true">
    <apex:includeLightning />
    <div style="width:100%;height:100%;" id="ImprovedForecastTimeApp" />