force-app/main/default/classes/ConsumApplyApprovalProcessController.cls
New file @@ -0,0 +1,153 @@ public with sharing class ConsumApplyApprovalProcessController { @AuraEnabled public static InitDate initSubmitApprovalProcessController(String recordId) { InitDate res = new InitDate(); Consum_Apply__c apply = [SELECT Id, Request_Shipping_7days_Before__c, Request_shipping_day__c, Campaign__c, QIS_number__c, QIS_ID_Line__c, Status__c, Min_Consum_Can_Request_approval_Date__c, applyUser__c, JingliApprovalManager__c, SalesManager__c, BuchangApprovalManager__c, BuchangApprovalManagerSales__c, ZongjianApprovalManager__c, OwnerId FROM Consum_Apply__c WHERE Id = :recordId LIMIT 1]; res.id = apply.Id; res.shippingDays = apply.Request_Shipping_7days_Before__c; res.shippingDay = apply.Request_shipping_day__c; res.campaign = apply.Campaign__c; res.qISNumber = apply.QIS_number__c; res.qISIDLine = apply.QIS_ID_Line__c; res.status = apply.Status__c; res.minApprovalDate = apply.Min_Consum_Can_Request_approval_Date__c; res.applyUser = apply.applyUser__c; res.jingliManager = apply.JingliApprovalManager__c; res.salesManager = apply.SalesManager__c; res.buchangManager = apply.BuchangApprovalManager__c; res.buchangManagerSale = apply.BuchangApprovalManagerSales__c; res.zongjianManager = apply.ZongjianApprovalManager__c; res.owner = apply.OwnerId; return res; } public class InitDate{ @AuraEnabled public String id; @AuraEnabled public Date shippingDays;//希望到货日前7个工作日 @AuraEnabled public Date shippingDay;//希望到货日 @AuraEnabled public String campaign ;//学会 @AuraEnabled public String qISNumber;//QIS @AuraEnabled public String qISIDLine;//QIS的ID值 @AuraEnabled public String status;// 状态 @AuraEnabled public Date minApprovalDate;//最小可以提交申请日期 @AuraEnabled public String applyUser;//操作者 @AuraEnabled public String jingliManager;//CL6 经理级(服务) @AuraEnabled public String salesManager;//CL6 经理级 @AuraEnabled public String buchangManager;//CL5 总监级(服务) @AuraEnabled public String buchangManagerSale;//CL5 总监级 @AuraEnabled public String zongjianManager;//CL4 高级总监 @AuraEnabled public String owner;//所有人 } @AuraEnabled public static List<Campaign> selectCampaignById(String recordId){ List<Campaign> campaign=[SELECT Status, Rental_Apply_Flag__c FROM Campaign WHERE id =:recordId]; return campaign; } @AuraEnabled public static List<QIS_report__c> selectReportById(String recordId){ List<QIS_report__c> report=[SELECT id,next_action__c FROM QIS_report__c WHERE id =:recordId]; return report; } @AuraEnabled public static List<Consum_Apply_Equipment_Set__c> selectEquipmentById(String recordId){ List<Consum_Apply_Equipment_Set__c> equipment=[SELECT Id FROM Consum_Apply_Equipment_Set__c WHERE RetalFSetDetail_Cnt__c = 0 AND Consum_Apply__c =:recordId]; return equipment; } @AuraEnabled public static String approvalCheck(String recordId){ String res = ConsumApplyWebService.approvalCheck(recordId); return res; } @AuraEnabled public static String setSObjectShare(String applyUser,String parentId,List<String> userAccess, String ownerId){ String res = ControllerUtil.setSObjectShare('Consum_Apply__Share',applyUser,parentId,userAccess,ownerId); return res; } @AuraEnabled public static String updateConsumApply(String recordId){ Consum_Apply__c apply = [SELECT Id, Request_Shipping_7days_Before__c, Request_shipping_day__c, Campaign__c, QIS_number__c, QIS_ID_Line__c, Status__c, Min_Consum_Can_Request_approval_Date__c, applyUser__c, JingliApprovalManager__c, SalesManager__c, BuchangApprovalManager__c, BuchangApprovalManagerSales__c, ZongjianApprovalManager__c, OwnerId FROM Consum_Apply__c WHERE Id = :recordId LIMIT 1]; apply.Status__c = '填写完毕'; update apply; return '1'; } } force-app/main/default/classes/ConsumApplyApprovalProcessController.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/ConsumApplyEquipmentSetDefaultController.cls
New file @@ -0,0 +1,23 @@ public with sharing class ConsumApplyEquipmentSetDefaultController { @AuraEnabled public static InitDate defaultSelect(String recordId) { InitDate res = new InitDate(); Consum_Apply__c apply = [SELECT Id, Yi_loaner_arranged__c FROM Consum_Apply__c WHERE Id = :recordId LIMIT 1]; res.yiLoanerArranged = apply.Yi_loaner_arranged__c; return res; } public class InitDate{ @AuraEnabled public String id; @AuraEnabled public Decimal yiLoanerArranged; } } force-app/main/default/classes/ConsumApplyEquipmentSetDefaultController.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/ConsumApplyEquipmentSetReaController.cls
New file @@ -0,0 +1,26 @@ public with sharing class ConsumApplyEquipmentSetReaController { @AuraEnabled public static InitDate reassign(String recordId) { InitDate res = new InitDate(); Consum_Apply__c apply = [SELECT Id, Status__c FROM Consum_Apply__c WHERE Id = :recordId LIMIT 1]; res.status = apply.Status__c; return res; } public class InitDate{ @AuraEnabled public String id; @AuraEnabled public String status; } } force-app/main/default/classes/ConsumApplyEquipmentSetReaController.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/lexAssetMaintainHeaderSubmitApprovalProcess/__tests__/lexAssetMaintainHeaderSubmitApprovalProcess.test.js
New file @@ -0,0 +1,25 @@ import { createElement } from 'lwc'; import LexAssetMaintainHeaderSubmitApprovalProcess from 'c/lexAssetMaintainHeaderSubmitApprovalProcess'; describe('c-lex-asset-maintain-header-submit-approval-process', () => { 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-asset-maintain-header-submit-approval-process', { is: LexAssetMaintainHeaderSubmitApprovalProcess }); // Act document.body.appendChild(element); // Assert // const div = element.shadowRoot.querySelector('div'); expect(1).toBe(1); }); }); force-app/main/default/lwc/lexAssetMaintainHeaderSubmitApprovalProcess/lexAssetMaintainHeaderSubmitApprovalProcess.css
New file @@ -0,0 +1,22 @@ .outerBorderCss{ border: 1px solid #D4D4D4; border-radius : 5px; border-top : 3px solid #565959; } .borderCss{ border: 1px solid #D4D4D4; border-radius : 5px; margin-bottom : 7px; border-top : 3px solid #565959; } .headerDorderCss{ border-top: 1px solid #565959; border-bottom: 1px solid #D4D4D4; padding:3px; } .centerCss{ text-align: center; } .centerCss .left{ margin-left: 100px; }/* sample css file */ force-app/main/default/lwc/lexAssetMaintainHeaderSubmitApprovalProcess/lexAssetMaintainHeaderSubmitApprovalProcess.html
New file @@ -0,0 +1,5 @@ <template> <div class="sisToOPDHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> </template> force-app/main/default/lwc/lexAssetMaintainHeaderSubmitApprovalProcess/lexAssetMaintainHeaderSubmitApprovalProcess.js
New file @@ -0,0 +1,65 @@ import { LightningElement , wire, api} from 'lwc'; import { CurrentPageReference,NavigationMixin } from 'lightning/navigation'; import { CloseActionScreenEvent } from 'lightning/actions'; import { updateRecord } from 'lightning/uiRecordApi'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; import submitApply from '@salesforce/apex/AssetMaintainHeaderWebService.submitApply'; import applyPermission from '@salesforce/apex/AssetMaintainHeaderWebService.applyPermission'; export default class LexAssetMaintainHeaderSubmitApprovalProcess extends LightningElement { @api recordId; IsLoading = true; @wire(CurrentPageReference) getStateParameters(currentPageReference) { if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; console.log("str:"+str); this.recordId = str; } } } connectedCallback(){ applyPermission().then(res=>{ this.IsLoading = false; if(res=='false'){ this.showToast('没有提交申请的权限','error'); }else if(confirm('一旦提交此记录以待批准,根据您的设置您可能不再能够编辑此记录或将他从批准过程中调回。是否继续?')){ submitApply({ amhId: this.recordId }).then(result=>{ if(result=='1'){ this.showToast('已提交','success'); }else{ this.showToast(result,'error'); } }) }else{ this.IsLoading = false; this.showToast('已取消','error'); } }) } updateRecordView() { updateRecord({fields: { Id: this.recordId }}); } showToast(msg,type) { const event = new ShowToastEvent({ message: msg, variant: type }); if(type == 'success'){ this.updateRecordView(); } this.dispatchEvent(event); this.dispatchEvent(new CloseActionScreenEvent()); } } force-app/main/default/lwc/lexAssetMaintainHeaderSubmitApprovalProcess/lexAssetMaintainHeaderSubmitApprovalProcess.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" fqn="lexOCMSubmit"> <apiVersion>57.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/lexConsumApplyEquipmentSetConsumDefaultSelect/__tests__/lexConsumApplyEquipmentSetConsumDefaultSelect.test.js
New file @@ -0,0 +1,25 @@ import { createElement } from 'lwc'; import LexConsumApplyEquipmentSetConsumDefaultSelect from 'c/lexConsumApplyEquipmentSetConsumDefaultSelect'; describe('c-lex-consum-apply-equipment-set-consum-default-select', () => { 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-consum-apply-equipment-set-consum-default-select', { is: LexConsumApplyEquipmentSetConsumDefaultSelect }); // Act document.body.appendChild(element); // Assert // const div = element.shadowRoot.querySelector('div'); expect(1).toBe(1); }); }); force-app/main/default/lwc/lexConsumApplyEquipmentSetConsumDefaultSelect/lexConsumApplyEquipmentSetConsumDefaultSelect.css
New file @@ -0,0 +1,22 @@ .outerBorderCss{ border: 1px solid #D4D4D4; border-radius : 5px; border-top : 3px solid #565959; } .borderCss{ border: 1px solid #D4D4D4; border-radius : 5px; margin-bottom : 7px; border-top : 3px solid #565959; } .headerDorderCss{ border-top: 1px solid #565959; border-bottom: 1px solid #D4D4D4; padding:3px; } .centerCss{ text-align: center; } .centerCss .left{ margin-left: 100px; }/* sample css file */ force-app/main/default/lwc/lexConsumApplyEquipmentSetConsumDefaultSelect/lexConsumApplyEquipmentSetConsumDefaultSelect.html
New file @@ -0,0 +1,5 @@ <template> <div class="sisToOPDHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> </template> force-app/main/default/lwc/lexConsumApplyEquipmentSetConsumDefaultSelect/lexConsumApplyEquipmentSetConsumDefaultSelect.js
New file @@ -0,0 +1,54 @@ import { LightningElement , wire, api} from 'lwc'; import { CurrentPageReference,NavigationMixin } from 'lightning/navigation'; import { CloseActionScreenEvent } from 'lightning/actions'; import { updateRecord } from 'lightning/uiRecordApi'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; import defaultSelect from '@salesforce/apex/ConsumApplyEquipmentSetDefaultController.defaultSelect'; export default class LexConsumApplyEquipmentSetConsumDefaultSelect extends LightningElement { @api recordId; IsLoading = true; @wire(CurrentPageReference) getStateParameters(currentPageReference) { if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; console.log("str:"+str); this.recordId = str; } } } connectedCallback(){ this.IsLoading = false; defaultSelect({recordId:this.recordId}).then(result=>{ console.log('result--->'+result); if (result.yiLoanerArranged > 0 ) { this.showToast('出库之后不能点击查看默认分配按钮,如果有需要分配的明细请分单后继续操作','error') return; } window.open("/apex/ConsumDefaultSelect?pt_recid="+this.recordId, '_top'); // window.open("/apex/ConsumDefaultSelect?pt_recid={!Consum_Apply__c.Id}", "_top"); }) } showToast(msg,type) { const event = new ShowToastEvent({ title: '', message: msg, variant: type }); this.dispatchEvent(event); this.dispatchEvent(new CloseActionScreenEvent()); } updateRecordView(recordId) { updateRecord({fields: { Id: recordId }}); } } force-app/main/default/lwc/lexConsumApplyEquipmentSetConsumDefaultSelect/lexConsumApplyEquipmentSetConsumDefaultSelect.js-meta.xml
New file @@ -0,0 +1,19 @@ <?xml version="1.0" encoding="UTF-8"?> <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="LexConsumApplyEquipmentSetConsumDefaultSelect"> <apiVersion>57.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</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"/> </targetConfig> </targetConfigs> </LightningComponentBundle> force-app/main/default/lwc/lexConsumApplyEquipmentSetReassign/__tests__/lexConsumApplyEquipmentSetReassign.test.js
New file @@ -0,0 +1,25 @@ import { createElement } from 'lwc'; import LexConsumApplyEquipmentSetReassign from 'c/lexConsumApplyEquipmentSetReassign'; describe('c-lex-consum-apply-equipment-set-reassign', () => { 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-consum-apply-equipment-set-reassign', { is: LexConsumApplyEquipmentSetReassign }); // Act document.body.appendChild(element); // Assert // const div = element.shadowRoot.querySelector('div'); expect(1).toBe(1); }); }); force-app/main/default/lwc/lexConsumApplyEquipmentSetReassign/lexConsumApplyEquipmentSetReassign.css
New file @@ -0,0 +1,22 @@ .outerBorderCss{ border: 1px solid #D4D4D4; border-radius : 5px; border-top : 3px solid #565959; } .borderCss{ border: 1px solid #D4D4D4; border-radius : 5px; margin-bottom : 7px; border-top : 3px solid #565959; } .headerDorderCss{ border-top: 1px solid #565959; border-bottom: 1px solid #D4D4D4; padding:3px; } .centerCss{ text-align: center; } .centerCss .left{ margin-left: 100px; }/* sample css file */ force-app/main/default/lwc/lexConsumApplyEquipmentSetReassign/lexConsumApplyEquipmentSetReassign.html
New file @@ -0,0 +1,5 @@ <template> <div class="sisToOPDHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> </template> force-app/main/default/lwc/lexConsumApplyEquipmentSetReassign/lexConsumApplyEquipmentSetReassign.js
New file @@ -0,0 +1,56 @@ import { LightningElement , wire, api} from 'lwc'; import { CurrentPageReference,NavigationMixin } from 'lightning/navigation'; import { CloseActionScreenEvent } from 'lightning/actions'; import { updateRecord } from 'lightning/uiRecordApi'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; import reassign from '@salesforce/apex/ConsumApplyEquipmentSetReaController.reassign'; export default class LexConsumApplyEquipmentSetReassign extends LightningElement { @api recordId; @api consumEquipmentId; IsLoading = true; @wire(CurrentPageReference) getStateParameters(currentPageReference) { if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; console.log("str:"+str); this.recordId = str; } } } connectedCallback(){ this.IsLoading = false; reassign({recordId:this.recordId}).then(result=>{ console.log('result--->'+result); if (result.status != '已出库指示' ) { this.showToast('耗材请单没有出库指示不能重新分配','error') return; } if(confirm('你确定要重新分配吗')){ window.open("/apex/ConsumReassign?caid="+this.recordId); } // window.location.href = "/apex/ConsumReassign?caid={!Consum_Apply__c.Id}"; }) } showToast(msg,type) { const event = new ShowToastEvent({ title: '', message: msg, variant: type }); this.dispatchEvent(event); this.dispatchEvent(new CloseActionScreenEvent()); } updateRecordView(recordId) { updateRecord({fields: { Id: recordId }}); } } force-app/main/default/lwc/lexConsumApplyEquipmentSetReassign/lexConsumApplyEquipmentSetReassign.js-meta.xml
New file @@ -0,0 +1,20 @@ <?xml version="1.0" encoding="UTF-8"?> <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="LexConsumApplyEquipmentSetReassign"> <apiVersion>57.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</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="consumEquipmentId" type="String[]" label="consumEquipmentId"/> </targetConfig> </targetConfigs> </LightningComponentBundle> force-app/main/default/lwc/lexConsumApplySubmitApprovalProcess/__tests__/lexConsumApplySubmitApprovalProcess.test.js
New file @@ -0,0 +1,25 @@ import { createElement } from 'lwc'; import LexConsumApplySubmitApprovalProcess from 'c/lexConsumApplySubmitApprovalProcess'; describe('c-lex-consum-apply-submit-approval-process', () => { 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-consum-apply-submit-approval-process', { is: LexConsumApplySubmitApprovalProcess }); // Act document.body.appendChild(element); // Assert // const div = element.shadowRoot.querySelector('div'); expect(1).toBe(1); }); }); force-app/main/default/lwc/lexConsumApplySubmitApprovalProcess/lexConsumApplySubmitApprovalProcess.css
New file @@ -0,0 +1,22 @@ .outerBorderCss{ border: 1px solid #D4D4D4; border-radius : 5px; border-top : 3px solid #565959; } .borderCss{ border: 1px solid #D4D4D4; border-radius : 5px; margin-bottom : 7px; border-top : 3px solid #565959; } .headerDorderCss{ border-top: 1px solid #565959; border-bottom: 1px solid #D4D4D4; padding:3px; } .centerCss{ text-align: center; } .centerCss .left{ margin-left: 100px; }/* sample css file */ force-app/main/default/lwc/lexConsumApplySubmitApprovalProcess/lexConsumApplySubmitApprovalProcess.html
New file @@ -0,0 +1,5 @@ <template> <div class="sisToOPDHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> </template> force-app/main/default/lwc/lexConsumApplySubmitApprovalProcess/lexConsumApplySubmitApprovalProcess.js
New file @@ -0,0 +1,216 @@ import { LightningElement , wire, api} from 'lwc'; import { CurrentPageReference,NavigationMixin } from 'lightning/navigation'; import { CloseActionScreenEvent } from 'lightning/actions'; import { updateRecord } from 'lightning/uiRecordApi'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; import init from '@salesforce/apex/ConsumApplyApprovalProcessController.initSubmitApprovalProcessController'; import selectCampaignById from '@salesforce/apex/ConsumApplyApprovalProcessController.selectCampaignById'; import selectReportById from '@salesforce/apex/ConsumApplyApprovalProcessController.selectReportById'; import selectEquipmentById from '@salesforce/apex/ConsumApplyApprovalProcessController.selectEquipmentById'; import approvalCheck from '@salesforce/apex/ConsumApplyApprovalProcessController.approvalCheck'; import setSObjectShare from '@salesforce/apex/ConsumApplyApprovalProcessController.setSObjectShare'; import updateConsumApply from '@salesforce/apex/ConsumApplyApprovalProcessController.updateConsumApply'; // import setSObjectShare from '@salesforce/apex/ControllerUtil.setSObjectShare'; export default class LexConsumApplySubmitApprovalProcess extends LightningElement { @api recordId; id; shippingDays;//希望到货日前7个工作日 shippingDay;//希望到货日 campaign ;//学会 qISNumber;//QIS qISIDLine;//QIS的ID值 status;// 状态 minApprovalDate;//最小可以提交申请日期 applyUser;//操作者 jingliManager;//CL6 经理级(服务) salesManager;//CL6 经理级 buchangManager;//CL5 总监级(服务) buchangManagerSale;//CL5 总监级 zongjianManager;//CL4 高级总监 owner;//所有人 IsLoading = true; @wire(CurrentPageReference) getStateParameters(currentPageReference) { if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; console.log("str:"+str); this.recordId = str; } } } connectedCallback(){ init({recordId : this.recordId}).then( result => { console.log('result'+result); if(result!= null){ this.IsLoading = false; this.id = result.id; this.shippingDays = result.shippingDays; this.shippingDay = result.shippingDay; this.campaign = result.campaign; this.qISNumber = result.qISNumber; this.qISIDLine = result.qISIDLine; this.status = result.status; this.minApprovalDate = result.minApprovalDate; this.applyUser = result.applyUser; this.jingliManager = result.jingliManager; this.salesManager = result.salesManager; this.buchangManager = result.buchangManager; this.buchangManagerSale = result.buchangManagerSale; this.zongjianManager = result.zongjianManager; this.owner = result.owner; var date = new Date(); var day = date.getDate(); console.log('shipingDays'+this.shippingDays); if(this.shippingDays < day){ this.showToast('此申请已不满足(希望到货日-7工作日)前完成审批的情况,请重新修改申请。','error'); } if(!confirm('一旦提交此记录以待批准,根据您的设置您可能不再能够编辑此记录或将他从批准过程中调回。是否继续?\n\n※ 需要在' +this.shippingDays+'前完成审批,否则申请单自动取消。')){ console.log('2222222222'); this.IsLoading = false; this.showToast('已取消','error') } console.log('3333333333333'); if(this.shippingDay < day){ this.showToast('希望到货日不能早于申请提交日','error'); } if(this.campaign != null && this.campaign != ''){ console.log('qqqqqqqqqqqqqq'); var dataList = new Array(); selectCampaignById({recordId: this.campaign}).then(data =>{ console.log('iiiiiiiiiiii'); dataList = data; var interval = dataList[0].Status; if (interval == '草案中') { this.showToast('学会状态为草案中,不能提交','error'); } if (interval == '申请中') { this.showToast('学会状态为申请中,不能提','error'); } if (interval == '已结束') { this.showToast('学会状态为已结束,不能提交','error'); } if (interval == '已提交报告') { this.showToast('学会状态为已提交报告,不能提交','error'); } if (interval == '取消申请中') { this.showToast('学会状态为取消申请中,不能提交','error'); } if (interval == '取消') { this.showToast('学会状态为取消,不能提交','error'); } }) } console.log('9888888888'); if(this.qISNumber != null && this.qISNumber != ''){ var resList = new Array(); selectReportById({recordId:this.qISIDLine}).then(res=>{ resList = res; var interval = resList[0].next_action__c; if (interval == '送回') { this.showToast('QIS 已送回,不能再申请备品了','error'); } }) } console.log('wwwwwwwwwww'); var userAccess = new Array(); userAccess.push(this.applyUser+'_Edit'); userAccess.push(this.jingliManager+'_Read'); userAccess.push(this.salesManager+'_Read'); userAccess.push(this.buchangManager+'_Read'); userAccess.push(this.buchangManagerSale+'_Read'); userAccess.push(this.zongjianManager+'_Read'); console.log('yyyyyyyyyy'); setSObjectShare({applyUser:this.applyUser, parentId:this.Id, userAccess:userAccess, ownerId:this.owner}).then(res=>{ if(res!='OK'){ this.showToast(rtn,'error'); } }) // var rtn = setSObjectShare(Consum_Apply__Share,this.applyUser,this.Id,userAccess,this.owner); // if(rtn != 'OK'){ // this.showToast(rtn,'error'); // } //没有this.status == '引当完了'状态 if(this.status == '填写完毕' || this.status == '申请中' || this.status == '已批准' || this.status == '已出库指示' || this.status == '删除' || this.status == '取消'){ this.showToast('请备品申请状态确认,已经提交过的申请,不能重复提交','error'); } console.log('eeeeeeeeee'); if(this.minApprovalDate > day){ this.showToast('申请提交日到预计使用日必须在22个工作日以内才可以','error'); } var raesList = new Array(); console.log('ttttttttt'); selectEquipmentById({recordId:this.id}).then(raes=>{ raesList = raes; if(raesList.length > 0){ this.showToast('有没有明细的耗材备品配套一览,不能提交','error'); } }) console.log('99999999999'+this.id); approvalCheck({recordId:this.id}).then(re1=>{ if(re1 != '1'){ this.showToast(re1,'error'); } }) updateConsumApply({recordId:this.id}).then(re1=>{ if(re1 != '1'){ this.showToast(re1,'error'); }else{ this.showToast('已提交','success'); } }) }else{ console.log('444444444444'); this.IsLoading = false; this.showToast('result为空','error') } }) } updateRecordView() { updateRecord({fields: { Id: this.recordId }}); } showToast(msg,type) { const event = new ShowToastEvent({ message: msg, variant: type }); if(type == 'success'){ this.updateRecordView(); } this.dispatchEvent(event); this.dispatchEvent(new CloseActionScreenEvent()); } } force-app/main/default/lwc/lexConsumApplySubmitApprovalProcess/lexConsumApplySubmitApprovalProcess.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" fqn="lexOCMSubmit"> <apiVersion>57.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle>