| | |
| | | /** |
| | | * @description : |
| | | * @author : ChangeMeIn@UserSettingsUnder.SFDoc |
| | | * @group : |
| | | * @last modified on : 07-19-2023 |
| | | * @last modified by : ChangeMeIn@UserSettingsUnder.SFDoc |
| | | **/ |
| | | global without sharing class AssetWebService { |
| | | |
| | | private static Set<String> assStatus = new Set<String>{'不明','废弃','未使用', '廃棄'}; |
| | | |
| | | @AuraEnabled |
| | | public static string methodName(){ |
| | | try { |
| | | |
| | | } catch (Exception e) { |
| | | throw new AuraHandledException(e.getMessage()); |
| | | } |
| | | } |
| | | WebService static String createLostReport(String assetId) { |
| | | return createLostReportCheck(assetId, true); |
| | | } |
| | |
| | | /** |
| | | * @description : |
| | | * @author : ChangeMeIn@UserSettingsUnder.SFDoc |
| | | * @group : |
| | | * @last modified on : 07-19-2023 |
| | | * @last modified by : ChangeMeIn@UserSettingsUnder.SFDoc |
| | | **/ |
| | | global class UpdateAssetToCurrentMCWebService { |
| | | |
| | | @AuraEnabled |
| | | WebService static void UpdateAssetToCurrentMC(String targetAssetId ){ |
| | | UpdateAssetToCurrentMCBatch u = new UpdateAssetToCurrentMCBatch(); |
| | | /*************************Insert 20160603 趙徳芳 Start*************************/ |
| New file |
| | |
| | | public with sharing class lexSubAuthorizedButtonController { |
| | | //button 取消 |
| | | @AuraEnabled |
| | | public static SubAuthorized__c init(String recordId){ |
| | | SubAuthorized__c res = new SubAuthorized__c(); |
| | | try{ |
| | | res = [SELECT Status__c |
| | | From SubAuthorized__c |
| | | WHERE Id = : recordId]; |
| | | } |
| | | catch(Exception e){ |
| | | System.debug(LoggingLevel.INFO, '*** e: ' + e); |
| | | } |
| | | return res; |
| | | } |
| | | |
| | | @AuraEnabled |
| | | public static void updateStatuById(String Id){ |
| | | try{ |
| | | SubAuthorized__c res = new SubAuthorized__c(); |
| | | res.Id = Id; |
| | | res.Status__c = '已取消'; |
| | | update res; |
| | | } |
| | | catch(Exception e){ |
| | | System.debug(LoggingLevel.INFO, '*** e: ' + e); |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>51.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| New file |
| | |
| | | <template> |
| | | <div class="Attachment" if:true={IsLoading}> |
| | | <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> |
| | | </div> |
| | | </template> |
| New file |
| | |
| | | //author : kkbes add lexSubAuthorizedButtonController |
| | | import { LightningElement, track, wire,api } from 'lwc'; |
| | | import { CurrentPageReference } from "lightning/navigation"; |
| | | import { CloseActionScreenEvent } from 'lightning/actions'; |
| | | import { ShowToastEvent } from 'lightning/platformShowToastEvent'; |
| | | import LightningConfirm from 'lightning/confirm'; |
| | | |
| | | const event1 = new ShowToastEvent({ |
| | | message: |
| | | "已经取消!!", |
| | | variant : 'error' |
| | | }); |
| | | const event2 = new ShowToastEvent({ |
| | | message: |
| | | "已取消", |
| | | variant : 'success' |
| | | }); |
| | | import init from '@salesforce/apex/lexSubAuthorizedButtonController.init'; |
| | | import updateStatuById from '@salesforce/apex/lexSubAuthorizedButtonController.updateStatuById'; |
| | | export default class lexCancelSubAuthorizedButton extends LightningElement { |
| | | |
| | | @api recordId; |
| | | SubAuthorized; |
| | | IsLoading=true; |
| | | |
| | | @wire(CurrentPageReference) |
| | | getStateParameters(currentPageReference) { |
| | | if (currentPageReference) { |
| | | const urlValue = currentPageReference.state.recordId; |
| | | if (urlValue) { |
| | | let str = `${urlValue}`; |
| | | this.recordId = str; |
| | | } |
| | | } |
| | | } |
| | | |
| | | connectedCallback(){ |
| | | init({ |
| | | recordId: this.recordId |
| | | }).then(result => { |
| | | if (result != null) { |
| | | this.SubAuthorized = result; |
| | | this.Cancle().then(result=>{ |
| | | this.IsLoading=false; |
| | | this.dispatchEvent(new CloseActionScreenEvent()); |
| | | }); |
| | | } |
| | | }).catch(error => { |
| | | const eventInItError = new ShowToastEvent({ |
| | | message: |
| | | error.message, |
| | | variant : 'error' |
| | | |
| | | }); |
| | | this.dispatchEvent(eventInItError); |
| | | }); |
| | | |
| | | } |
| | | |
| | | |
| | | async Cancle(){ |
| | | var Status = this.SubAuthorized.Status__c; |
| | | if(Status =='已取消'){ |
| | | this.dispatchEvent(event1); |
| | | return; |
| | | } |
| | | if(Status !='草案中' && Status !='申请中' && Status !='已批准'){ |
| | | const event3 = new ShowToastEvent({ |
| | | message: |
| | | Status +'状态不能取消', |
| | | variant : 'error' |
| | | }); |
| | | this.dispatchEvent(event3); |
| | | return; |
| | | } |
| | | await updateStatuById().then(result=>{ |
| | | this.dispatchEvent(event2); |
| | | location.href = this.SubAuthorized.Id; |
| | | }).catch(error=>{ |
| | | const eventError = new ShowToastEvent({ |
| | | message: |
| | | error.message, |
| | | variant : 'error' |
| | | }); |
| | | this.dispatchEvent(eventError); |
| | | }) |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexCancelSubAuthorizedButton"> |
| | | <apiVersion>51.0</apiVersion> |
| | | <isExposed>true</isExposed> |
| | | <targets> |
| | | <target>lightning__RecordPage</target> |
| | | <target>lightning__AppPage</target> |
| | | <target>lightning__HomePage</target> |
| | | <target>lightning__RecordAction</target> |
| | | </targets> |
| | | </LightningComponentBundle> |
| New file |
| | |
| | | <template> |
| | | <div class="Attachment" if:true={IsLoading}> |
| | | <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> |
| | | </div> |
| | | </template> |
| New file |
| | |
| | | //修改了createLostReport方法 |
| | | import { LightningElement, track, wire,api } from 'lwc'; |
| | | import { CurrentPageReference } from "lightning/navigation"; |
| | | import { CloseActionScreenEvent } from 'lightning/actions'; |
| | | import { ShowToastEvent } from 'lightning/platformShowToastEvent'; |
| | | import LightningConfirm from 'lightning/confirm'; |
| | | |
| | | import createReport from '@salesforce/apex/AssetWebService.createLostReport'; |
| | | export default class lexCreateLostReportAsset extends LightningElement { |
| | | |
| | | @api recordId; |
| | | IsLoading=true; |
| | | |
| | | @wire(CurrentPageReference) |
| | | getStateParameters(currentPageReference) { |
| | | if (currentPageReference) { |
| | | const urlValue = currentPageReference.state.recordId; |
| | | if (urlValue) { |
| | | let str = `${urlValue}`; |
| | | this.recordId = str; |
| | | } |
| | | } |
| | | } |
| | | |
| | | connectedCallback(){ |
| | | this.CreateLostReport().then(result=>{ |
| | | this.IsLoading=false; |
| | | this.dispatchEvent(new CloseActionScreenEvent()); |
| | | }); |
| | | |
| | | } |
| | | |
| | | async CreateLostReport(){ |
| | | const result1 = await LightningConfirm.open({ |
| | | message: '是否创建遗失报告?', |
| | | variant: 'headerless', |
| | | label: 'this is the aria-label value', |
| | | }); |
| | | if(!result1){ |
| | | return; |
| | | } |
| | | var rs = await createReport({assetId : this.recordId}); |
| | | var arr = String(rs).split(':'); |
| | | console.log(arr[0]); |
| | | console.log(arr[1]); |
| | | if (arr[0] == '1') { |
| | | window.open('/apex/LostReportEditAsset?assetid=' + arr[1]); |
| | | } |
| | | else { |
| | | const event = new ShowToastEvent({ |
| | | message: |
| | | arr[1], |
| | | variant : 'error' |
| | | }); |
| | | this.dispatchEvent(event); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexCreateLostReportAsset"> |
| | | <apiVersion>51.0</apiVersion> |
| | | <isExposed>true</isExposed> |
| | | <targets> |
| | | <target>lightning__RecordPage</target> |
| | | <target>lightning__AppPage</target> |
| | | <target>lightning__HomePage</target> |
| | | <target>lightning__RecordAction</target> |
| | | </targets> |
| | | </LightningComponentBundle> |
| New file |
| | |
| | | <template> |
| | | <div class="Attachment" if:true={IsLoading}> |
| | | <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> |
| | | </div> |
| | | </template> |
| New file |
| | |
| | | import { LightningElement, track, wire,api } from 'lwc'; |
| | | import { CurrentPageReference } from "lightning/navigation"; |
| | | |
| | | import { CloseActionScreenEvent } from 'lightning/actions'; |
| | | export default class lexProductRepairQuoteAsset extends LightningElement { |
| | | @api recordId; |
| | | IsLoading=true; |
| | | |
| | | @wire(CurrentPageReference) |
| | | getStateParameters(currentPageReference) { |
| | | if (currentPageReference) { |
| | | const urlValue = currentPageReference.state.recordId; |
| | | if (urlValue) { |
| | | let str = `${urlValue}`; |
| | | this.recordId = str; |
| | | } |
| | | } |
| | | } |
| | | |
| | | connectedCallback(){ |
| | | this.ProductRepairQuoteAsset() |
| | | .then(result => { |
| | | this.closeScreen(); |
| | | |
| | | }).catch(error => { |
| | | const event3 = new ShowToastEvent({ |
| | | message: |
| | | error.message, |
| | | variant : 'error' |
| | | }); |
| | | this.dispatchEvent(event3); |
| | | }); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | async ProductRepairQuoteAsset(){ |
| | | window.open ('/apex/ProductRepairQuote?productid='+this.recordId+'&flag=asset', '', 'height=250, width=500, top=300, left=350,location=no') |
| | | } |
| | | |
| | | closeScreen(){ |
| | | this.IsLoading=false; |
| | | this.dispatchEvent(new CloseActionScreenEvent()); |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexProductRepairQuoteAsset"> |
| | | <apiVersion>51.0</apiVersion> |
| | | <isExposed>true</isExposed> |
| | | <targets> |
| | | <target>lightning__RecordPage</target> |
| | | <target>lightning__AppPage</target> |
| | | <target>lightning__HomePage</target> |
| | | <target>lightning__RecordAction</target> |
| | | </targets> |
| | | </LightningComponentBundle> |
| New file |
| | |
| | | <template> |
| | | <div class="Attachment" if:true={IsLoading}> |
| | | <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> |
| | | </div> |
| | | </template> |
| New file |
| | |
| | | import { LightningElement, track, wire,api } from 'lwc'; |
| | | import { CurrentPageReference } from "lightning/navigation"; |
| | | import { CloseActionScreenEvent } from 'lightning/actions'; |
| | | import { ShowToastEvent } from 'lightning/platformShowToastEvent'; |
| | | |
| | | import UpdateAssetToCurrentMC from '@salesforce/apex/UpdateAssetToCurrentMCWebService.UpdateAssetToCurrentMC'; |
| | | export default class lexRepairContractReflectAsset extends LightningElement { |
| | | |
| | | @api recordId; |
| | | IsLoading=true; |
| | | |
| | | @wire(CurrentPageReference) |
| | | getStateParameters(currentPageReference) { |
| | | if (currentPageReference) { |
| | | const urlValue = currentPageReference.state.recordId; |
| | | if (urlValue) { |
| | | let str = `${urlValue}`; |
| | | this.recordId = str; |
| | | } |
| | | } |
| | | } |
| | | |
| | | connectedCallback(){ |
| | | UpdateAssetToCurrentMC({targetAssetId:this.recordId}) |
| | | .then(result => { |
| | | const event1 = new ShowToastEvent({ |
| | | message: |
| | | "维修合同反映成功", |
| | | variant: 'success' |
| | | }); |
| | | this.dispatchEvent(event1); |
| | | this.closeScreen(); |
| | | |
| | | }).catch(error => { |
| | | const event3 = new ShowToastEvent({ |
| | | message: |
| | | '维修合同反映失败,异常信息:'+error.message, |
| | | variant : 'error' |
| | | }); |
| | | this.dispatchEvent(event3); |
| | | }); |
| | | |
| | | } |
| | | closeScreen(){ |
| | | this.IsLoading=false; |
| | | this.dispatchEvent(new CloseActionScreenEvent()); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexRepairContractReflectAsset"> |
| | | <apiVersion>51.0</apiVersion> |
| | | <isExposed>true</isExposed> |
| | | <targets> |
| | | <target>lightning__RecordPage</target> |
| | | <target>lightning__AppPage</target> |
| | | <target>lightning__HomePage</target> |
| | | <target>lightning__RecordAction</target> |
| | | </targets> |
| | | </LightningComponentBundle> |