From 628ffa98fa49282347008b94f4db58ad08a77673 Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@prec-tech.com>
Date: 星期一, 15 五月 2023 14:32:13 +0800
Subject: [PATCH] 耗材备品申请 取消
---
force-app/main/default/classes/lexConsumablesLostController.cls-meta.xml | 5 +
force-app/main/default/lwc/lexConsumablesLost/lexConsumablesLost.js | 73 ++++++++++++++++++++++++
force-app/main/default/lwc/lexConsumablesLost/lexConsumablesLost.js-meta.xml | 11 +++
force-app/main/default/lwc/lexConsumablesLost/lexConsumablesLost.html | 5 +
force-app/main/default/classes/lexConsumablesLostController.cls | 29 +++++++++
5 files changed, 123 insertions(+), 0 deletions(-)
diff --git a/force-app/main/default/classes/lexConsumablesLostController.cls b/force-app/main/default/classes/lexConsumablesLostController.cls
new file mode 100644
index 0000000..cef1fe2
--- /dev/null
+++ b/force-app/main/default/classes/lexConsumablesLostController.cls
@@ -0,0 +1,29 @@
+public with sharing class lexConsumablesLostController {
+ // 鑰楁潗澶囧搧鐢宠 鍙栨秷
+ @AuraEnabled
+ public static InitData lexConsumablesLostController(String recordId) {
+ InitData res = new initData();
+ try{
+ Consum_Apply__c report = [SELECT Id,Status__c,RA_Status__c,Yi_loaner_arranged__c FROM Consum_Apply__c WHERE Id = :recordId LIMIT 1];
+ res.Id = report.Id;
+ res.statusTf = report.Status__c;
+ res.raStatusTf = report.RA_Status__c;
+ res.yiLoanerArr = report.Yi_loaner_arranged__c;
+ System.debug(LoggingLevel.INFO, '*** zq: ' + res);
+ }catch(Exception e){
+ System.debug(LoggingLevel.INFO, '*** zq: ' + e);
+ }
+ return res;
+ }
+
+ public class InitData{
+ @AuraEnabled
+ public String Id;
+ @AuraEnabled
+ public String statusTf;
+ @AuraEnabled
+ public String raStatusTf;
+ @AuraEnabled
+ public Decimal yiLoanerArr;
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/lexConsumablesLostController.cls-meta.xml b/force-app/main/default/classes/lexConsumablesLostController.cls-meta.xml
new file mode 100644
index 0000000..9bbf7b4
--- /dev/null
+++ b/force-app/main/default/classes/lexConsumablesLostController.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <status>Active</status>
+</ApexClass>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexConsumablesLost/lexConsumablesLost.html b/force-app/main/default/lwc/lexConsumablesLost/lexConsumablesLost.html
new file mode 100644
index 0000000..d044dbb
--- /dev/null
+++ b/force-app/main/default/lwc/lexConsumablesLost/lexConsumablesLost.html
@@ -0,0 +1,5 @@
+<template>
+ <div class="exampleHolder" if:true={IsLoading}>
+ <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+ </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexConsumablesLost/lexConsumablesLost.js b/force-app/main/default/lwc/lexConsumablesLost/lexConsumablesLost.js
new file mode 100644
index 0000000..880e9e5
--- /dev/null
+++ b/force-app/main/default/lwc/lexConsumablesLost/lexConsumablesLost.js
@@ -0,0 +1,73 @@
+import { LightningElement,wire,track,api} from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import updateForSubmitButton from '@salesforce/apex/ReportController.updateForSubmitButton';
+import { updateRecord } from 'lightning/uiRecordApi';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+
+import init from '@salesforce/apex/lexConsumablesLostController.lexConsumablesLostController';
+
+export default class LexConsumablesLost extends LightningElement {
+
+ @api recordId;
+ IsLoading = true;
+ @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;
+ }
+ }
+ }
+
+ connectedCallback(){
+ this.IsLoading = false;
+ // this.submit();
+ init({recordId:this.recordId})
+ .then(result=>{
+ console.log("LexConsumablesLost------>>>",result)
+ if (result.statusTf == "鍙栨秷" ) {
+ this.showToast('宸茬粡鍙栨秷锛�','error')
+ return;
+ }
+ if (result.statusTf == "鍒犻櫎" ) {
+ this.showToast('宸茬粡鍒犻櫎锛�','error')
+ return;
+ }
+ //鐘舵�佷负缁堟鐨勪笉鑳芥彁浜ゅ鎵�
+ if(result.raStatusTf == "宸插嚭搴�" || result.yiLoanerArr > 0){
+ this.showToast('澶囧搧宸茬粡鍑哄簱锛屼笉鑳藉彇娑堬紒','error')
+ return;
+ }
+ window.open("/apex/ConsumApplyCancel?objId="+this.recordId, 'ConsumApplyCancel', 'width=500,height=250');
+ // window.open("/apex/ConsumApplyCancel?objId={!URLENCODE(Consum_Apply__c.Id)}", 'ConsumApplyCancel', 'width=500,height=250');
+ })
+ .catch(e=>{console.log(e)})
+ .finally(()=>{
+ this.dispatchEvent(new CloseActionScreenEvent());
+ })
+ }
+
+
+ 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 }});
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexConsumablesLost/lexConsumablesLost.js-meta.xml b/force-app/main/default/lwc/lexConsumablesLost/lexConsumablesLost.js-meta.xml
new file mode 100644
index 0000000..3392981
--- /dev/null
+++ b/force-app/main/default/lwc/lexConsumablesLost/lexConsumablesLost.js-meta.xml
@@ -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>
\ No newline at end of file
--
Gitblit v1.9.1