force-app/main/default/lwc/lexOPDReportConsumFlowLwc/__tests__/lexOPDReportConsumFlowLwc.test.js
New file @@ -0,0 +1,25 @@ import { createElement } from 'lwc'; import LexOPDReportConsumFlowLwc from 'c/lexOPDReportConsumFlowLwc'; describe('c-lex-opd-report-consum-flow-lwc', () => { 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-opd-report-consum-flow-lwc', { is: LexOPDReportConsumFlowLwc }); // Act document.body.appendChild(element); // Assert // const div = element.shadowRoot.querySelector('div'); expect(1).toBe(1); }); }); force-app/main/default/lwc/lexOPDReportConsumFlowLwc/lexOPDReportConsumFlowLwc.css
New file @@ -0,0 +1,22 @@ .holder{ position: relative; display: inline-block; width: 80px; height: 80px; text-align: center; } .container .uiContainerManager{ display : none !important; } .toast{ border: 1px solid #c9c9c9; border-radius: 10px; width: 50%; margin: 0 auto; font-size: 18px; font-weight: bold; padding: 10px 20px; background: #feb75d; display: flex; } force-app/main/default/lwc/lexOPDReportConsumFlowLwc/lexOPDReportConsumFlowLwc.html
New file @@ -0,0 +1,13 @@ <template> <div class="holder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> <div if:false={IsLoading} class="toast"> <span style="padding: 10px;">{msg}</span> <button class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse" onclick={closeAction} title="Close" style="background-color: #e5e4e2;margin-top: 15px;"> <lightning-icon class="greyIcon" icon-name="utility:close" alternative-text="Connected" variant="inverse" size="small" title="Close" style="color: black;"></lightning-icon> <span class="slds-assistive-text">Close</span> </button> </div> </template> force-app/main/default/lwc/lexOPDReportConsumFlowLwc/lexOPDReportConsumFlowLwc.js
New file @@ -0,0 +1,68 @@ /* * @Description: * @version: * @Author: chen jing wu * @Date: 2023-05-16 13:37:44 * @LastEditors: chen jing wu * @LastEditTime: 2023-05-16 15:18:25 */ import { LightningElement,api, track, wire } from 'lwc'; import {CurrentPageReference} from 'lightning/navigation'; import { CloseActionScreenEvent } from 'lightning/actions'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; import { NavigationMixin } from 'lightning/navigation'; export default class LexOPDReportConsumFlowLwc extends LightningElement { @api recordId; @api raStatus; @api productCategory; @api name; @api hospitalId; @api hospital; @api strategicDeptId; @api strategicDept; @api accountId; @api account; @api rentalApplyId; msg; Isloading = true; connectedCallback(){ console.log(this.recordId); var status = this.raStatus; if(status != "已出库" && status != "申请者已收货" && status != "待消耗" && status != "已回寄" && status != "完了"){ this.msg = "耗材借出状态:" + status + ",不能创建报告书!"; this.Isloading = false; return; } var Product_category = this.productCategory; var strs ; var url if(Product_category =='ET'){ strs='&RecordType=01210000000NPDz' }else if(Product_category =='DISP'){ strs='&RecordType=01210000000NPDp' }else{ strs = ''; } if(strs.length<=0){ url = '/setup/ui/recordtypeselect.jsp?retURL=%2F' + this.rentalApplyId + '&save_new_url=%2Fa0B%2Fe%3FretURL%3D%252Fa0B%252Fo'; }else{ url = '/a0B/e?retURL=%2Fa0B%2Fo' + strs; } url += '&CF00N100000098rY2=' + this.name + '&CF00N100000098rY2_lkid=' + this.recordId + '&CF00N10000002DPUD=' + this.hospital + '&CF00N10000002DPUD_lkid=' + this.hospitalId + '&CF00N10000002Dh0f=' + this.strategicDept + '&CF00N10000002Dh0f_lkid=' + this.strategicDeptId + '&CF00N10000002CWW4=' + this.account + '&CF00N10000002CWW4_lkid=' + this.accountId +'&ent=01I10000000SWfe'; window.open(url); this.closeAction(); } closeAction() { //返回当前的备品申请 window.open("/"+this.recordId,'_self'); } } force-app/main/default/lwc/lexOPDReportConsumFlowLwc/lexOPDReportConsumFlowLwc.js-meta.xml
New file @@ -0,0 +1,32 @@ <?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__AppPage</target> <target>lightning__RecordPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> <!-- 屏幕流配置 --> <target>lightning__FlowScreen</target> </targets> <!-- 定义变量 --> <targetConfigs> <targetConfig targets="lightning__FlowScreen"> <!-- name js中使用的变量,从屏幕流中获取参数 label 在屏幕流的该LWC的设置中显示 --> <property name="recordId" type="String" label="recordId"/> <property name="raStatus" type="String" label="raStatus"/> <property name="productCategory" type="String" label="productCategory"/> <property name="name" type="String" label="name"/> <property name="hospitalId" type="String" label="hospitalId"/> <property name="strategicDeptId" type="String" label="strategicDeptId"/> <property name="accountId" type="String" label="accountId"/> <property name="rentalApplyId" type="String" label="rentalApplyId"/> <property name="account" type="String" label="account"/> <property name="strategicDept" type="String" label="strategicDept"/> <property name="hospital" type="String" label="hospital"/> </targetConfig> </targetConfigs> </LightningComponentBundle> force-app/main/default/lwc/lexOPDReportFlowLwc/__tests__/lexOPDReportFlowLwc.test.js
New file @@ -0,0 +1,25 @@ import { createElement } from 'lwc'; import LexOPDReportFlowLwc from 'c/lexOPDReportFlowLwc'; describe('c-lex-opd-report-flow-lwc', () => { 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-opd-report-flow-lwc', { is: LexOPDReportFlowLwc }); // Act document.body.appendChild(element); // Assert // const div = element.shadowRoot.querySelector('div'); expect(1).toBe(1); }); }); force-app/main/default/lwc/lexOPDReportFlowLwc/lexOPDReportFlowLwc.css
New file @@ -0,0 +1,22 @@ .holder{ position: relative; display: inline-block; width: 80px; height: 80px; text-align: center; } .container .uiContainerManager{ display : none !important; } .toast{ border: 1px solid #c9c9c9; border-radius: 10px; width: 50%; margin: 0 auto; font-size: 18px; font-weight: bold; padding: 10px 20px; background: #feb75d; display: flex; } force-app/main/default/lwc/lexOPDReportFlowLwc/lexOPDReportFlowLwc.html
New file @@ -0,0 +1,13 @@ <template> <div class="holder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> <div if:false={IsLoading} class="toast"> <span style="padding: 10px;">{msg}</span> <button class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse" onclick={closeAction} title="Close" style="background-color: #e5e4e2;margin-top: 15px;"> <lightning-icon class="greyIcon" icon-name="utility:close" alternative-text="Connected" variant="inverse" size="small" title="Close" style="color: black;"></lightning-icon> <span class="slds-assistive-text">Close</span> </button> </div> </template> force-app/main/default/lwc/lexOPDReportFlowLwc/lexOPDReportFlowLwc.js
New file @@ -0,0 +1,103 @@ import { LightningElement,api, track, wire } from 'lwc'; import {CurrentPageReference} from 'lightning/navigation'; import { CloseActionScreenEvent } from 'lightning/actions'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; import { NavigationMixin } from 'lightning/navigation'; export default class LexOPDReportFlowLwc extends NavigationMixin(LightningElement) { @api recordId; @api assetReturnDay2; @api demoPurpose2; @api followUPOpp; @api followUPOppId; @api opdPlan; @api opdPlanId; @api raStatus; @api name; @api hospitalId; @api hospital; @api strategicDeptId; @api strategicDept; @api accountId; @api account; msg; Isloading = true; connectedCallback(){ var status = this.raStatus; if(status != "已出库" && status != "申请者已收货" && status != "医院已装机确认" && status != "已回寄" && status != "已回收" && status != "完了" && status != "欠品中"){ this.msg = "备品借出状态:" + status + ",不能创建报告书!"; this.Isloading = false; return; } //var d = new Date("{!Rental_Apply__c.Asset_return_day2__c}"); //var d15 = new Date("{!Rental_Apply__c.Asset_return_day2__c}"); //d15.setDate(d.getDate()+7); //if(status == "已回寄" && ( new Date()< d || new Date() > d15)){ // alert("备品借出状态:" + status + ",但不在回寄日之后7天之内,不能创建报告书!"); // return; //} //2021/7/15 fxk Start var str; var url; str='&RecordType=01210000000RLTi'; url = '/a0B/e?retURL=%2Fa0B%2Fo'+str; //2021/7/15 fxk End //SWAG-BVW8CW 20201217 让user自己选择recordtype //目的2为---试用(有询价) 带询价 var demo_purpose2 = this.demoPurpose2; var strs ; if(demo_purpose2=='试用(有询价)'){ strs='&CF00N10000002DT68=' + this.followUPOpp + '&CF00N10000002DT68_lkid=' + this.followUPOppId + '&00N10000002DHk5=跟进询价' } //window.open('/a0B/e?retURL=%2F{!Rental_Apply__c.Id}'+ //'&RecordType=01210000000Qekj&ent=01I10000000SWfe'+ //Before Update by LiJun 20220321 start /*window.open(url += '&CF00N10000004maf3={!Rental_Apply__c.Name}' + '&CF00N10000004maf3_lkid={!Rental_Apply__c.Id}' + '&CF00N10000002DPUD={!Rental_Apply__c.Hospital__c}'+ '&CF00N10000002DPUD_lkid={!Rental_Apply__c.HospitalId__c}'+ '&CF00N10000002Dh0f={!Rental_Apply__c.Strategic_dept__c}' + '&CF00N10000002Dh0f_lkid={!Rental_Apply__c.Strategic_deptId__c}'+ '&CF00N10000008ps6d={!Rental_Apply__c.OPDPlan__c}' + '&CF00N10000008ps6d_lkid={!Rental_Apply__c.OPDPlanId__c}'+ '&CF00N10000002CWW4={!Rental_Apply__c.Account__c}'+ '&CF00N10000002CWW4_lkid={!Rental_Apply__c.AccountId__c}'+strs) }*/ //Before Update by LiJun 20220321 end //After Update by LiJun 20220321 start url = url + '&CF00N10000004maf3=' + this.name + '&CF00N10000004maf3_lkid=' + this.recordId + '&CF00N10000002DPUD=' + this.hospital + '&CF00N10000002DPUD_lkid=' + this.hospitalId + '&CF00N10000002Dh0f=' + this.strategicDept + '&CF00N10000002Dh0f_lkid='+ this.strategicDeptId + '&CF00N10000008ps6d=' + this.opdPlan + '&CF00N10000008ps6d_lkid=' + this.opdPlanId + '&CF00N10000002CWW4=' + this.account + '&CF00N10000002CWW4_lkid=' + this.accountId; if(strs){ url= url+strs; } window.open(url); this.closeAction(); //After Update by LiJun 20220321 end } closeAction() { //返回当前的备品申请 this[NavigationMixin.Navigate]({ type: 'standard__recordPage', attributes: { recordId: this.recordId, actionName: 'view' } }); } } force-app/main/default/lwc/lexOPDReportFlowLwc/lexOPDReportFlowLwc.js-meta.xml
New file @@ -0,0 +1,36 @@ <?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__AppPage</target> <target>lightning__RecordPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> <!-- 屏幕流配置 --> <target>lightning__FlowScreen</target> </targets> <!-- 定义变量 --> <targetConfigs> <targetConfig targets="lightning__FlowScreen"> <!-- name js中使用的变量,从屏幕流中获取参数 label 在屏幕流的该LWC的设置中显示 --> <property name="recordId" type="String" label="recordId"/> <property name="raStatus" type="String" label="raStatus"/> <property name="name" type="String" label="name"/> <property name="hospitalId" type="String" label="hospitalId"/> <property name="strategicDeptId" type="String" label="strategicDeptId"/> <property name="accountId" type="String" label="accountId"/> <property name="account" type="String" label="account"/> <property name="strategicDept" type="String" label="strategicDept"/> <property name="hospital" type="String" label="hospital"/> <property name="assetReturnDay2" type="String" label="assetReturnDay2"/> <property name="demoPurpose2" type="String" label="demoPurpose2"/> <property name="followUPOpp" type="String" label="followUPOpp"/> <property name="followUPOppId" type="String" label="followUPOppId"/> <property name="opdPlan" type="String" label="opdPlan"/> <property name="opdPlanId" type="String" label="opdPlanId"/> </targetConfig> </targetConfigs> </LightningComponentBundle>