From a4b8019d414735754babdefa9c339414981a91fe Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@prec-tech.com>
Date: 星期一, 10 七月 2023 15:48:24 +0800
Subject: [PATCH] 耗材备品配套一览 分单  选择明细 取消选择明细

---
 force-app/main/default/lwc/lexSplit_Apply/lexSplit_Apply.js                                |   43 ++++++++
 force-app/main/default/lwc/lexSplit_Apply/lexSplit_Apply.html                              |   13 ++
 force-app/main/default/lwc/lexConsumFixtureSetSelect/lexConsumFixtureSetSelect.js-meta.xml |   17 +++
 force-app/main/default/lwc/lexConsumFixtureSetSelect/lexConsumFixtureSetSelect.js          |   18 +++
 force-app/main/default/classes/LexCancelConsumDetailsCtl.cls                               |   43 ++++++++
 force-app/main/default/lwc/lexSplit_Apply/lexSplit_Apply.js-meta.xml                       |   18 +++
 force-app/main/default/lwc/lexCancelConsumDetails/lexCancelConsumDetails.html              |    5 +
 force-app/main/default/lwc/lexConsumFixtureSetSelect/lexConsumFixtureSetSelect.html        |    5 +
 force-app/main/default/classes/LexCancelConsumDetailsCtl.cls-meta.xml                      |    5 +
 force-app/main/default/lwc/lexCancelConsumDetails/lexCancelConsumDetails.js-meta.xml       |   17 +++
 force-app/main/default/lwc/lexCancelConsumDetails/lexCancelConsumDetails.js                |   55 +++++++++++
 force-app/main/default/lwc/lexSplit_Apply/LexSplit_Apply.css                               |   22 ++++
 12 files changed, 261 insertions(+), 0 deletions(-)

diff --git a/force-app/main/default/classes/LexCancelConsumDetailsCtl.cls b/force-app/main/default/classes/LexCancelConsumDetailsCtl.cls
new file mode 100644
index 0000000..a2548a5
--- /dev/null
+++ b/force-app/main/default/classes/LexCancelConsumDetailsCtl.cls
@@ -0,0 +1,43 @@
+public with sharing class LexCancelConsumDetailsCtl {
+    public LexCancelConsumDetailsCtl() {
+
+    }
+
+    @AuraEnabled
+    public static List<Consum_Apply_Equipment_Set__c> splitApplyButton(String recordId){
+
+        try{
+            List<Consum_Apply_Equipment_Set__c> report=[select RAES_Status__c from Consum_Apply_Equipment_Set__c where Consum_Apply__c =: recordId];
+            return report;
+        }catch(Exception e){
+            System.debug(LoggingLevel.INFO,'Consum_Apply_Equipment_Set__c Cancel Error : ' + e);
+        }
+        return null;
+    }
+
+    @AuraEnabled
+    public static InitData init(String recordId){
+        InitData res = new initData();
+        try {
+            Consum_Apply__c rep = [select Id,Yi_loaner_arranged__c from Consum_Apply__c where Id =: recordId];
+            res.consumApplyId = rep.Id;
+            res.yiLoaner = rep.Yi_loaner_arranged__c;
+            Consum_Apply_Equipment_Set__c repSet = [select Id,Yi_loaner_arranged__c from Consum_Apply_Equipment_Set__c where Id =: recordId];
+            res.equipmentyiLoaner = repSet.Yi_loaner_arranged__c;
+            return res;
+        } catch (Exception e) {
+            throw new AuraHandledException(e.getMessage());
+        }
+    }
+    public class InitData{
+        @AuraEnabled
+        public String consumApplyId;
+        @AuraEnabled
+        public Decimal yiLoaner;
+        @AuraEnabled
+        public Decimal equipmentyiLoaner;
+    }
+
+
+
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexCancelConsumDetailsCtl.cls-meta.xml b/force-app/main/default/classes/LexCancelConsumDetailsCtl.cls-meta.xml
new file mode 100644
index 0000000..45cccbd
--- /dev/null
+++ b/force-app/main/default/classes/LexCancelConsumDetailsCtl.cls-meta.xml
@@ -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>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCancelConsumDetails/lexCancelConsumDetails.html b/force-app/main/default/lwc/lexCancelConsumDetails/lexCancelConsumDetails.html
new file mode 100644
index 0000000..90324b8
--- /dev/null
+++ b/force-app/main/default/lwc/lexCancelConsumDetails/lexCancelConsumDetails.html
@@ -0,0 +1,5 @@
+<template>
+    <div class="Holder" 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/lexCancelConsumDetails/lexCancelConsumDetails.js b/force-app/main/default/lwc/lexCancelConsumDetails/lexCancelConsumDetails.js
new file mode 100644
index 0000000..5f4c139
--- /dev/null
+++ b/force-app/main/default/lwc/lexCancelConsumDetails/lexCancelConsumDetails.js
@@ -0,0 +1,55 @@
+import { LightningElement,wire,track,api} from 'lwc';
+import { CurrentPageReference, NavigationMixin} from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import  init  from '@salesforce/apex/LexCancelConsumDetailsCtl.init';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+
+// 20230705 鑰楁潗澶囧搧閰嶅涓�瑙� 鑷畾涔夋寜閽垨閾炬帴锛氬彇娑堟槑缁嗙敵璇�
+export default class LexCancelConsumDetails extends NavigationMixin(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(){
+        console.log(this.recordId);
+        init({
+            recordId: this.recordId
+        }).then(res=>{
+            this.IsLoading = false;
+            if(res){
+                if(res.consumApplyId > 0 && res.equipmentyiLoaner == 0){
+                    this.showToast('鍑哄簱涔嬪悗 鑰屼笖 娌℃湁鏈垎閰嶆槑缁�, 涓嶈兘鐐瑰嚮鍙栨秷鏄庣粏鐢宠鎸夐挳','error');
+                }else{
+                    window.open("/apex/ConsumAssignCancel?pt_recid="+this.recordId);
+                }
+            }
+            this.dispatchEvent(new CloseActionScreenEvent());
+        })
+        .catch(err=>{console.log(err)})
+    }
+
+    showToast(message, type) {
+        const evt = new ShowToastEvent({
+            title: 'Error',
+            message: message,
+            variant: type
+        });
+        this.dispatchEvent(evt);
+        this.dispatchEvent(new CloseActionScreenEvent());
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCancelConsumDetails/lexCancelConsumDetails.js-meta.xml b/force-app/main/default/lwc/lexCancelConsumDetails/lexCancelConsumDetails.js-meta.xml
new file mode 100644
index 0000000..641e278
--- /dev/null
+++ b/force-app/main/default/lwc/lexCancelConsumDetails/lexCancelConsumDetails.js-meta.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>51.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">
+            <property name="recordId" type="String" label="recordId"/>
+        </targetConfig>
+    </targetConfigs>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexConsumFixtureSetSelect/lexConsumFixtureSetSelect.html b/force-app/main/default/lwc/lexConsumFixtureSetSelect/lexConsumFixtureSetSelect.html
new file mode 100644
index 0000000..90324b8
--- /dev/null
+++ b/force-app/main/default/lwc/lexConsumFixtureSetSelect/lexConsumFixtureSetSelect.html
@@ -0,0 +1,5 @@
+<template>
+    <div class="Holder" 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/lexConsumFixtureSetSelect/lexConsumFixtureSetSelect.js b/force-app/main/default/lwc/lexConsumFixtureSetSelect/lexConsumFixtureSetSelect.js
new file mode 100644
index 0000000..05e7819
--- /dev/null
+++ b/force-app/main/default/lwc/lexConsumFixtureSetSelect/lexConsumFixtureSetSelect.js
@@ -0,0 +1,18 @@
+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 LexConsumFixtureSetSelect extends LightningElement {
+
+    @api recordId;
+    IsLoading=true;
+
+	connectedCallback(){
+		if (this.recordId) {
+		    window.open("/apex/ConsumFixtureSetSelect?pt_recid="+this.recordId, "_top");
+		}
+	}
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexConsumFixtureSetSelect/lexConsumFixtureSetSelect.js-meta.xml b/force-app/main/default/lwc/lexConsumFixtureSetSelect/lexConsumFixtureSetSelect.js-meta.xml
new file mode 100644
index 0000000..641e278
--- /dev/null
+++ b/force-app/main/default/lwc/lexConsumFixtureSetSelect/lexConsumFixtureSetSelect.js-meta.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>51.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">
+            <property name="recordId" type="String" label="recordId"/>
+        </targetConfig>
+    </targetConfigs>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSplit_Apply/LexSplit_Apply.css b/force-app/main/default/lwc/lexSplit_Apply/LexSplit_Apply.css
new file mode 100644
index 0000000..95c1c55
--- /dev/null
+++ b/force-app/main/default/lwc/lexSplit_Apply/LexSplit_Apply.css
@@ -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;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSplit_Apply/lexSplit_Apply.html b/force-app/main/default/lwc/lexSplit_Apply/lexSplit_Apply.html
new file mode 100644
index 0000000..e91bff2
--- /dev/null
+++ b/force-app/main/default/lwc/lexSplit_Apply/lexSplit_Apply.html
@@ -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>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSplit_Apply/lexSplit_Apply.js b/force-app/main/default/lwc/lexSplit_Apply/lexSplit_Apply.js
new file mode 100644
index 0000000..2438a73
--- /dev/null
+++ b/force-app/main/default/lwc/lexSplit_Apply/lexSplit_Apply.js
@@ -0,0 +1,43 @@
+import { LightningElement,wire,track,api} from 'lwc';
+import { CurrentPageReference, NavigationMixin} from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import  splitApplyButton  from '@salesforce/apex/LexCancelConsumDetailsCtl.splitApplyButton';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+
+// 鑰楁潗澶囧搧閰嶅涓�瑙� 鑷畾涔夋寜閽垨閾炬帴锛氬垎鍗�
+export default class LexSplit_Apply extends NavigationMixin(LightningElement) {
+	@api recordId;
+	//鍙幏鍙栧綋鍓峫ist閫変腑鐨勪竴瑙圛d
+	@api rentalApplyIds;
+    IsLoading=true;
+    //鎻愮ず淇℃伅
+    msg;
+
+	connectedCallback(){
+		console.log(this.recordId);
+		console.log(JSON.stringify(this.rentalApplyIds));
+		if (this.recordId && JSON.stringify(this.rentalApplyIds)) {
+            splitApplyButton({
+                recordId: this.recordId
+            }).then(res=>{
+                this.IsLoading = false;
+                if(res && res.length == 1){
+                    this.msg = '杩欎釜鐢宠鍗曞彧鏈変竴鏉¤�楁潗澶囧搧涓�瑙堬紝涓嶈兘鍒嗗崟';
+                }else if(res.length == this.rentalApplyIds.length){
+                    this.msg = '涓嶈兘鍏ㄩ�夎�楁潗澶囧搧涓�瑙堝垎鍗�';
+                }else{
+                    window.open("/apex/ConsumApplySplit?objId="+this.recordId+"&raesIds="+this.rentalApplyIds, 'ConsumApplySplit', 'width=800,height=300');
+                }
+            })
+		    
+			this.closeAction();
+		}else{
+			this.msg = '璇烽�夋嫨鍊熷嚭澶囧搧涓�瑙堣褰�';
+			this.IsLoading = false;
+		}
+	}
+    closeAction() {
+        //杩斿洖褰撳墠鐨勫鍝佺敵璇�
+		window.open("/"+this.recordId,'_self');
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSplit_Apply/lexSplit_Apply.js-meta.xml b/force-app/main/default/lwc/lexSplit_Apply/lexSplit_Apply.js-meta.xml
new file mode 100644
index 0000000..af7b80e
--- /dev/null
+++ b/force-app/main/default/lwc/lexSplit_Apply/lexSplit_Apply.js-meta.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>51.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">
+            <property name="recordId" type="String" label="recordId"/>
+            <property name="rentalApplyIds" type="String[]" label="rentalApplyIds"/>
+        </targetConfig>
+    </targetConfigs>
+</LightningComponentBundle>
\ No newline at end of file

--
Gitblit v1.9.1