From fdef1f682351a5311fe96c5f0f1770a9623b985f Mon Sep 17 00:00:00 2001
From: zhangzhengmei <zhangzhengmei@prec-tech.com>
Date: 星期一, 17 四月 2023 16:42:16 +0800
Subject: [PATCH] 调拨申请->受理批量更新,取消,提交待审批 按钮修改

---
 force-app/main/default/lwc/lexDetailBulkUpdate/lexDetailBulkUpdate.js                    |   39 ++++++
 force-app/main/default/lwc/lexSubmitApprovalProcess/lexSubmitApprovalProcess.css         |   11 +
 force-app/main/default/lwc/lexCancelApply/lexCancelApply.html                            |    4 
 force-app/main/default/lwc/lexSubmitApprovalProcess/lexSubmitApprovalProcess.js          |  101 ++++++++++++++++
 force-app/main/default/lwc/lexSubmitApprovalProcess/lexSubmitApprovalProcess.html        |    5 
 force-app/main/default/lwc/lexCancelApply/lexCancelApply.js                              |  100 ++++++++++++++++
 force-app/main/default/lwc/lexDetailBulkUpdate/lexDetailBulkUpdate.html                  |    5 
 force-app/main/default/lwc/lexCancelApply/lexCancelApply.js-meta.xml                     |   11 +
 force-app/main/default/lwc/lexDetailBulkUpdate/lexDetailBulkUpdate.js-meta.xml           |   11 +
 force-app/main/default/lwc/lexDetailBulkUpdate/lexDetailBulkUpdate.css                   |   11 +
 force-app/main/default/lwc/lexSubmitApprovalProcess/lexSubmitApprovalProcess.js-meta.xml |   11 +
 11 files changed, 309 insertions(+), 0 deletions(-)

diff --git a/force-app/main/default/lwc/lexCancelApply/lexCancelApply.html b/force-app/main/default/lwc/lexCancelApply/lexCancelApply.html
new file mode 100644
index 0000000..66974ff
--- /dev/null
+++ b/force-app/main/default/lwc/lexCancelApply/lexCancelApply.html
@@ -0,0 +1,4 @@
+<template>
+
+    
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCancelApply/lexCancelApply.js b/force-app/main/default/lwc/lexCancelApply/lexCancelApply.js
new file mode 100644
index 0000000..04cee1d
--- /dev/null
+++ b/force-app/main/default/lwc/lexCancelApply/lexCancelApply.js
@@ -0,0 +1,100 @@
+import { LightningElement, track, wire, api } from 'lwc';
+import LightningConfirm from 'lightning/confirm';
+import {CurrentPageReference,NavigationMixin} from 'lightning/navigation';
+import { CloseActionScreenEvent } from 'lightning/actions';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+
+
+import cancelApply from '@salesforce/apex/TransferApplyWebService.cancelApply';
+
+export default class lexCancelApply extends LightningElement {
+	 @api recordId;
+	 IsLoading=true;
+	 cancelResult;
+  
+
+    @wire(CurrentPageReference)
+	getStateParameters(currentPageReference){
+		console.log("杩涘叆椤甸潰");
+		console.log(currentPageReference);
+		if(currentPageReference){
+			const urvalue=currentPageReference.state.recordId;
+			if(urvalue){
+				let str=`${urvalue}`;
+				console.log('str');
+				console.log(str);
+				this.recordId=str;
+				
+			}
+		}
+	}
+	connectedCallback() {
+		console.log('this.raeSetId:' + this.recordId);
+		
+		LightningConfirm.open({
+	        message: '纭畾鍙栨秷锛�',
+	        variant: 'headerless',
+	        label: 'this is the aria-label value',
+	        
+	    }).then(cancel=>{
+	  //   	this.IsLoading=false;
+			// this.dispatchEvent(new CloseActionScreenEvent());
+	    	if(cancel) {
+	    		cancelApply({
+					taId : this.recordId
+				}).then(result => {
+					this.cancelResult = result;
+					this.cancelSubmit().then(res=>{
+						this.IsLoading=false;
+						this.dispatchEvent(new CloseActionScreenEvent());
+					});	
+							
+				}).catch( error =>{
+					console.log(error);
+				}).finally(()=>{
+
+					
+				});
+	    	}
+	    	
+	    });
+		
+		
+	}
+
+	async cancelSubmit(){
+		if(this.cancelResult == '1') {
+			await this.showToast("",'鍙栨秷鎴愬姛',"success"); 
+			window.location.href = window.location;
+					
+		} else {
+			console.log("result:",this.cancelResult);
+			await this.showToast("",this.cancelResult,"warning"); 	
+		}
+			
+    }
+    showToast(_title,_message,_variant) {
+        const event = new ShowToastEvent({
+            title: _title,
+            message:_message,
+            variant: _variant,
+        });
+        this.dispatchEvent(event);
+    }
+	
+}
+
+//old js
+
+// {!REQUIRESCRIPT('/soap/ajax/51.0/connection.js')}
+// {!REQUIRESCRIPT('/soap/ajax/51.0/apex.js')}
+// if (confirm("纭畾鍙栨秷锛�")) {
+// var rs = sforce.apex.execute("TransferApplyWebService","cancelApply",{taId:'{!TransferApply__c.Id}'});
+// if(rs == '1'){
+// alert('鍙栨秷鎴愬姛');
+// window.location.href = window.location;
+// }
+// else{
+// alert(rs);
+// }
+// }
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCancelApply/lexCancelApply.js-meta.xml b/force-app/main/default/lwc/lexCancelApply/lexCancelApply.js-meta.xml
new file mode 100644
index 0000000..f004c4d
--- /dev/null
+++ b/force-app/main/default/lwc/lexCancelApply/lexCancelApply.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexCancelApply">
+    <apiVersion>51.0</apiVersion>
+    <isExposed>true</isExposed>
+    <targets>
+        <target>lightning__AppPage</target>
+        <target>lightning__RecordPage</target>
+        <target>lightning__HomePage</target>
+        <target>lightning__RecordAction</target>
+    </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexDetailBulkUpdate/lexDetailBulkUpdate.css b/force-app/main/default/lwc/lexDetailBulkUpdate/lexDetailBulkUpdate.css
new file mode 100644
index 0000000..af18c76
--- /dev/null
+++ b/force-app/main/default/lwc/lexDetailBulkUpdate/lexDetailBulkUpdate.css
@@ -0,0 +1,11 @@
+.Holder{
+	position: relative;
+	display: inline-block;
+	width: 80px;
+	height: 80px;
+	text-align: center;
+}
+
+.container .uiContainerManager{
+	display : none !important;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexDetailBulkUpdate/lexDetailBulkUpdate.html b/force-app/main/default/lwc/lexDetailBulkUpdate/lexDetailBulkUpdate.html
new file mode 100644
index 0000000..2ef2898
--- /dev/null
+++ b/force-app/main/default/lwc/lexDetailBulkUpdate/lexDetailBulkUpdate.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/lexDetailBulkUpdate/lexDetailBulkUpdate.js b/force-app/main/default/lwc/lexDetailBulkUpdate/lexDetailBulkUpdate.js
new file mode 100644
index 0000000..fedf726
--- /dev/null
+++ b/force-app/main/default/lwc/lexDetailBulkUpdate/lexDetailBulkUpdate.js
@@ -0,0 +1,39 @@
+import { LightningElement, track, wire, api } from 'lwc';
+import {CurrentPageReference} from 'lightning/navigation';
+import { CloseActionScreenEvent } from 'lightning/actions';
+
+export default class lexDetailBulkUpdate extends LightningElement {
+	@api recordId;
+  
+
+    @wire(CurrentPageReference)
+	getStateParameters(currentPageReference){
+		console.log("杩涘叆椤甸潰");
+		console.log(currentPageReference);
+		if(currentPageReference){
+			const urvalue=currentPageReference.state.recordId;
+			if(urvalue){
+				let str=`${urvalue}`;
+				console.log('str');
+				console.log(str);
+				this.recordId=str;
+			}
+		}
+	}
+
+	connectedCallback(){
+
+		this.cancelSubmit().then(res=>{
+			this.IsLoading=false;
+			this.dispatchEvent(new CloseActionScreenEvent());
+		});
+	}
+
+	async cancelSubmit(){
+		window.open('/apex/TransferApplySelectDetailSub?id='+this.recordId,'DetailBulkUpdateLWC', 'width=600,height=200');
+	}
+
+	//old js
+	// window.open("/apex/TransferApplySelectDetailSub?Id={!URLENCODE(TransferApply__c.Id)}");
+
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexDetailBulkUpdate/lexDetailBulkUpdate.js-meta.xml b/force-app/main/default/lwc/lexDetailBulkUpdate/lexDetailBulkUpdate.js-meta.xml
new file mode 100644
index 0000000..b41eb1f
--- /dev/null
+++ b/force-app/main/default/lwc/lexDetailBulkUpdate/lexDetailBulkUpdate.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexDetailBulkUpdate">
+    <apiVersion>51.0</apiVersion>
+    <isExposed>true</isExposed>
+    <targets>
+        <target>lightning__AppPage</target>
+        <target>lightning__RecordPage</target>
+        <target>lightning__HomePage</target>
+        <target>lightning__RecordAction</target>
+    </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSubmitApprovalProcess/lexSubmitApprovalProcess.css b/force-app/main/default/lwc/lexSubmitApprovalProcess/lexSubmitApprovalProcess.css
new file mode 100644
index 0000000..af18c76
--- /dev/null
+++ b/force-app/main/default/lwc/lexSubmitApprovalProcess/lexSubmitApprovalProcess.css
@@ -0,0 +1,11 @@
+.Holder{
+	position: relative;
+	display: inline-block;
+	width: 80px;
+	height: 80px;
+	text-align: center;
+}
+
+.container .uiContainerManager{
+	display : none !important;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSubmitApprovalProcess/lexSubmitApprovalProcess.html b/force-app/main/default/lwc/lexSubmitApprovalProcess/lexSubmitApprovalProcess.html
new file mode 100644
index 0000000..404c915
--- /dev/null
+++ b/force-app/main/default/lwc/lexSubmitApprovalProcess/lexSubmitApprovalProcess.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/lexSubmitApprovalProcess/lexSubmitApprovalProcess.js b/force-app/main/default/lwc/lexSubmitApprovalProcess/lexSubmitApprovalProcess.js
new file mode 100644
index 0000000..2a9ab34
--- /dev/null
+++ b/force-app/main/default/lwc/lexSubmitApprovalProcess/lexSubmitApprovalProcess.js
@@ -0,0 +1,101 @@
+import { LightningElement, track, wire,api } from 'lwc';
+import {CurrentPageReference,NavigationMixin} from 'lightning/navigation';
+import { CloseActionScreenEvent } from 'lightning/actions';
+import LightningConfirm from 'lightning/confirm';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+
+
+
+import applyPermission from '@salesforce/apex/TransferApplyController.applyPermission';
+import submitApply from '@salesforce/apex/TransferApplyWebService.submitApply';
+
+export default class lexSubmitApprovalProcess extends LightningElement {
+	@api recordId;
+	transferApplyPermission;
+	IsLoading=true;
+
+	@wire(CurrentPageReference)
+	getStateParameters(currentPageReference) {
+		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.transferApplyId:' + this.recordId);
+		applyPermission().then(result => {
+			console.log(result);
+			this.transferApplyPermission = result;			
+			this.cancelSubmit();	
+					
+		}).catch( error =>{
+			console.log(error);
+		});
+	}
+	
+	cancelSubmit(){
+		if (this.transferApplyPermission == false) {
+			this.showToast('','娌℃湁鎻愪氦鐢宠鐨勬潈闄�','warning');
+		} else{
+			LightningConfirm.open({
+	            message: '涓�鏃︽彁浜ゆ璁板綍浠ュ緟鎵瑰噯锛屾牴鎹偍鐨勮缃偍鍙兘涓嶅啀鑳藉缂栬緫姝よ褰曟垨灏嗕粬浠庢壒鍑嗚繃绋嬩腑璋冨洖銆傛槸鍚︾户缁紵',
+	            variant: 'headerless',
+	          
+	        }).then(cancel=>{
+	        	if(cancel) {
+	    			submitApply({taId:this.recordId}).then(submitRes=>{
+						if(submitRes == '1'){
+							this.showToast('','鎻愪氦鎴愬姛','success');
+							window.location.href = window.location;
+						}else{
+							this.showToast("",submitRes,"warning");
+						}
+						this.IsLoading=false;
+						this.dispatchEvent(new CloseActionScreenEvent());
+					});	
+	        	}
+	        });
+			
+		}		
+    }
+    
+    showToast(_title,_message,_variant) {
+        const event = new ShowToastEvent({
+            title: _title,
+            message:_message,
+            variant: _variant,
+        });
+        this.dispatchEvent(event);
+    }
+}
+
+//old js
+/*
+{!REQUIRESCRIPT('/soap/ajax/51.0/connection.js')}
+{!REQUIRESCRIPT('/soap/ajax/51.0/apex.js')}
+var result = sforce.connection.describeSObject('TransferApply__c');
+if (result.createable == 'false') {
+	alert('娌℃湁鎻愪氦鐢宠鐨勬潈闄�');
+}
+else{
+	if (confirm("涓�鏃︽彁浜ゆ璁板綍浠ュ緟鎵瑰噯锛屾牴鎹偍鐨勮缃偍鍙兘涓嶅啀鑳藉缂栬緫姝よ褰曟垨灏嗕粬浠庢壒鍑嗚繃绋嬩腑璋冨洖銆傛槸鍚︾户缁紵")) {
+		var rs = sforce.apex.execute("TransferApplyWebService","submitApply",{taId:'{!TransferApply__c.Id}'});
+		if(rs == '1'){
+			alert('鎻愪氦鎴愬姛');
+			window.location.href = window.location;
+		}
+		else{
+			alert(rs);
+		}
+	}
+}
+*/
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSubmitApprovalProcess/lexSubmitApprovalProcess.js-meta.xml b/force-app/main/default/lwc/lexSubmitApprovalProcess/lexSubmitApprovalProcess.js-meta.xml
new file mode 100644
index 0000000..4fe44a7
--- /dev/null
+++ b/force-app/main/default/lwc/lexSubmitApprovalProcess/lexSubmitApprovalProcess.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexSubmitApprovalProcess">
+    <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>
\ No newline at end of file

--
Gitblit v1.9.1