From 256deea77ed43c414c927e6d8c8d455bc643196e Mon Sep 17 00:00:00 2001
From: zhangzhengmei <zhangzhengmei@prec-tech.com>
Date: 星期一, 17 四月 2023 16:24:04 +0800
Subject: [PATCH] 调拨申请—》调拨明细确认单PDF 按钮修改
---
force-app/main/default/classes/TransferApplyController.cls-meta.xml | 5 +
force-app/main/default/lwc/lexTransferApplyPDF/lexTransferApplyPDF.js-meta.xml | 11 +++
force-app/main/default/lwc/lexTransferApplyPDF/lexTransferApplyPDF.js | 92 ++++++++++++++++++++++++++++++
force-app/main/default/lwc/lexTransferApplyPDF/lexTransferApplyPDF.css | 11 +++
force-app/main/default/classes/TransferApplyController.cls | 31 ++++++++++
force-app/main/default/lwc/lexTransferApplyPDF/lexTransferApplyPDF.html | 5 +
6 files changed, 155 insertions(+), 0 deletions(-)
diff --git a/force-app/main/default/classes/TransferApplyController.cls b/force-app/main/default/classes/TransferApplyController.cls
new file mode 100644
index 0000000..864e606
--- /dev/null
+++ b/force-app/main/default/classes/TransferApplyController.cls
@@ -0,0 +1,31 @@
+public with sharing class TransferApplyController {
+ public TransferApplyController() {
+
+ }
+ @AuraEnabled
+ public static list<TransferApplySummary__c> transferApplyPDF(string transferApplyId) {
+
+ try {
+ // var sql = "select Id from TransferApplySummary__c where TransferApply__c =
+ //'{!TransferApply__c.Id}' and ApprovalDetails__c > 0 and TAS_Status__c != '鍙栨秷'";
+ list<TransferApplySummary__c> reports = [
+ select id from TransferApplySummary__c
+ where TransferApply__c = :transferApplyId
+ and ApprovalDetails__c > 0
+ and TAS_Status__c != '鍙栨秷'];
+ return reports;
+ }catch ( Exception e) {
+ System.debug(LoggingLevel.ERROR,'TransferApplySummary__c TransferApplyPDF Error : ' + e);
+ }
+ return null;
+
+ }
+
+ @AuraEnabled
+ public static Boolean applyPermission()
+ {
+ Schema.DescribeSobjectResult schemaMap = Schema.describeSObjects(new String[]{'TransferApply__c'})[0];
+ return schemaMap.isCreateable();
+ }
+
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/TransferApplyController.cls-meta.xml b/force-app/main/default/classes/TransferApplyController.cls-meta.xml
new file mode 100644
index 0000000..d75b058
--- /dev/null
+++ b/force-app/main/default/classes/TransferApplyController.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>51.0</apiVersion>
+ <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/lwc/lexTransferApplyPDF/lexTransferApplyPDF.css b/force-app/main/default/lwc/lexTransferApplyPDF/lexTransferApplyPDF.css
new file mode 100644
index 0000000..af18c76
--- /dev/null
+++ b/force-app/main/default/lwc/lexTransferApplyPDF/lexTransferApplyPDF.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/lexTransferApplyPDF/lexTransferApplyPDF.html b/force-app/main/default/lwc/lexTransferApplyPDF/lexTransferApplyPDF.html
new file mode 100644
index 0000000..2688153
--- /dev/null
+++ b/force-app/main/default/lwc/lexTransferApplyPDF/lexTransferApplyPDF.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/lexTransferApplyPDF/lexTransferApplyPDF.js b/force-app/main/default/lwc/lexTransferApplyPDF/lexTransferApplyPDF.js
new file mode 100644
index 0000000..c41b11e
--- /dev/null
+++ b/force-app/main/default/lwc/lexTransferApplyPDF/lexTransferApplyPDF.js
@@ -0,0 +1,92 @@
+import { LightningElement, track, wire,api } from 'lwc';
+import {CurrentPageReference,NavigationMixin} from 'lightning/navigation';
+import { CloseActionScreenEvent } from 'lightning/actions';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+
+
+
+import transferApplyPDF from '@salesforce/apex/TransferApplyController.transferApplyPDF';
+export default class lexTransferApplyPDF extends LightningElement {
+ @api recordId;
+ transferApplyPDFRes;
+ 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);
+ transferApplyPDF({
+ transferApplyId : this.recordId
+ }).then(result => {
+ console.log(result);
+ this.transferApplyPDFRes = result;
+ this.cancelSubmit().then(res=>{
+ this.IsLoading=false;
+ this.dispatchEvent(new CloseActionScreenEvent());
+ });
+
+ }).catch( error =>{
+ console.log(error);
+ });
+ }
+ async cancelSubmit(){
+ let records = new Array();
+ records = this.transferApplyPDFRes;
+ var size =records.length;
+ if(size>0){
+ var length = size%10 ==0? size/10 : parseInt(size/10) +1;
+ for(var i =0;i<length;i++){
+ window.open('/apex/TransferApplyPDF?raid='+this.recordId+'&page=' + i);
+ }
+ }else{
+ this.showToast('','褰撳墠鐨勭敵璇峰崟涓病鏈夊凡鎵瑰噯澶囧搧銆�','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")}
+var foo = function() {
+
+ var sql = "select Id from TransferApplySummary__c where TransferApply__c = '{!TransferApply__c.Id}' and ApprovalDetails__c > 0 and TAS_Status__c != '鍙栨秷'";
+ //Yi_StockDown__c->ApprovalDetails__c 20210805 ljh SFDC-C56D3K 宸蹭笅鏋�->宸叉壒鍑�
+ var sqlResult = sforce.connection.query(sql);
+ var records = sqlResult.getArray("records");
+ var size =records.length;
+ if(size>0){
+ var length = size%10 ==0? size/10 : parseInt(size/10) +1;
+ for(var i =0;i<length;i++){
+ window.open('/apex/TransferApplyPDF?raid={!TransferApply__c.Id}&page=' + i);
+ }
+ }else{
+ alert('褰撳墠鐨勭敵璇峰崟涓病鏈夊凡鎵瑰噯澶囧搧銆�');
+ }
+}
+foo();
+*/
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexTransferApplyPDF/lexTransferApplyPDF.js-meta.xml b/force-app/main/default/lwc/lexTransferApplyPDF/lexTransferApplyPDF.js-meta.xml
new file mode 100644
index 0000000..0a37c91
--- /dev/null
+++ b/force-app/main/default/lwc/lexTransferApplyPDF/lexTransferApplyPDF.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexTransferApplyPDF">
+ <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