From d5f54652d25b2ace64087a7ea2da1ead1727a71b Mon Sep 17 00:00:00 2001
From: unknown <sunxia@prec-tech.com>
Date: 星期一, 29 五月 2023 16:12:32 +0800
Subject: [PATCH] 插队申请
---
force-app/main/default/lwc/rentalApplyJumpLWC/rentalApplyJumpLWC.js | 116 ++++++++++++++++++++++++++++++++++++++
force-app/main/default/lwc/rentalApplyJumpLWC/rentalApplyJumpLWC.js-meta.xml | 18 ++++++
force-app/main/default/lwc/rentalApplyJumpLWC/rentalApplyJumpLWC.html | 13 ++++
force-app/main/default/lwc/rentalApplyJumpLWC/rentalApplyJumpLWC.css | 22 +++++++
4 files changed, 169 insertions(+), 0 deletions(-)
diff --git a/force-app/main/default/lwc/rentalApplyJumpLWC/rentalApplyJumpLWC.css b/force-app/main/default/lwc/rentalApplyJumpLWC/rentalApplyJumpLWC.css
new file mode 100644
index 0000000..95c1c55
--- /dev/null
+++ b/force-app/main/default/lwc/rentalApplyJumpLWC/rentalApplyJumpLWC.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/rentalApplyJumpLWC/rentalApplyJumpLWC.html b/force-app/main/default/lwc/rentalApplyJumpLWC/rentalApplyJumpLWC.html
new file mode 100644
index 0000000..7063605
--- /dev/null
+++ b/force-app/main/default/lwc/rentalApplyJumpLWC/rentalApplyJumpLWC.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/rentalApplyJumpLWC/rentalApplyJumpLWC.js b/force-app/main/default/lwc/rentalApplyJumpLWC/rentalApplyJumpLWC.js
new file mode 100644
index 0000000..ed5dae0
--- /dev/null
+++ b/force-app/main/default/lwc/rentalApplyJumpLWC/rentalApplyJumpLWC.js
@@ -0,0 +1,116 @@
+import { LightningElement,api, track, wire } from 'lwc';
+import {CurrentPageReference} from 'lightning/navigation';
+import { CloseActionScreenEvent } from 'lightning/actions';
+import getUserId from '@salesforce/apex/RentalApplyControllerLWT.getUserId';
+import init from '@salesforce/apex/SelectSubstituteControllerLWT.initFromSelectSubstituteButton';
+import selectRentalApplyEquipmentSetByID from '@salesforce/apex/SelectSubstituteControllerLWT.selectRentalApplyEquipmentSetByID';
+import selectRentalApplyEquipmentSetByRACID from '@salesforce/apex/SelectSubstituteControllerLWT.selectRentalApplyEquipmentSetByRACID';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+
+export default class rentalApplyJumpLWC extends LightningElement {
+
+ @api recordId;
+ id;
+ @api rentalApplyIds;
+ RentalApplyId;
+ //鎻愮ず淇℃伅
+ msg;
+ IsLoading=true;
+
+ @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.recordId);
+ init({recordId:this.recordId}).then(result=>{
+ if(result!=null){
+ this.id=result.id;
+ this.RentalApplyId=result.RentalApplyId;
+ this.cancelSubmit().then(res=>{
+ this.IsLoading=false;
+ this.dispatchEvent(new CloseActionScreenEvent());
+ });
+ }
+ }).catch(err=>{
+ console.log("error:");
+ console.log(err);
+ }).finally(()=>{
+
+ });
+ }
+
+
+
+ async cancelSubmit(){
+ // 鍙垎閰嶄唬鏇垮搧鍓嶆彁1 -- 澶囧搧鍊熷嚭鐢宠鐨勭姸鎬侊細鈥滃凡鎵瑰噯鈥濆埌鈥滃凡鍑哄簱鎸囩ず鈥�
+ var userIdArr = ['00510000001O6HoAAK','00510000001O6I2AAK','00510000000gW9pAAE','00510000000gW9BAAU','00510000008pVbWAAU','00510000001OOMjAAO','00510000005sEEMAA2','00510000004pNOtAAM','00510000005QJ2eAAG','00510000007iCmcAAE','00510000006kIg8AAE','00510000004rbkzAAA','00510000003LMHuAAO','00510000000gW92AAE'];
+ //褰撳墠鐢ㄦ埛鐧诲綍id
+ var userId;
+ await getUserId().then(res=>{
+ userId=res;
+ })
+ .catch(err=>{
+ console.log("getUserIderr==="+err);
+ })
+ //TODO====
+ userId = '00510000001O6HoAAK';
+ if(userIdArr.indexOf(userId)== -1){
+ this.msg = '瀵逛笉璧蜂綘娌℃湁姝ゆ搷浣滅殑鏉冮檺锛�';
+ this.IsLoading = false;
+ return;
+ } else {
+ console.log('this.rentalApplyIds=='+this.rentalApplyIds);
+ if(this.rentalApplyIds == undefined || this.rentalApplyIds.length<1){
+ this.msg = '璇烽�夋嫨鍊熷嚭澶囧搧涓�瑙堣褰�';
+ this.IsLoading = false;
+ return;
+ }else{
+ let raid = this.RentalApplyId;
+ await selectRentalApplyEquipmentSetByRACID({recordId:this.recordId}).then(res=>{
+ console.log('selectRentalApplyEquipmentSetByRACID=='+JSON.stringify(res));
+
+ var allRecords = res;
+ var validSize= allRecords.length;
+ var canJump = false;
+ for(var i=0;i<validSize;i++){
+ if(allRecords[i].Allow_Adjust_Queue_Flag__c == true){
+ canJump = true;
+ break;
+ }
+ }
+ if(canJump == true){
+ this.msg = '璇烽�夋嫨鍊熷嚭澶囧搧涓�瑙堣褰曟湁宸茬粡鍏佽鎻掗槦鐨勶紝璇烽�夋嫨鏈厑璁哥殑涓�瑙�';
+ this.IsLoading = false;
+ return;
+ }else{
+ let records=[this.recordId];
+ window.open("/apex/RentalApplyJump?objId="+this.recordId+"&raesIds="+ this.rentalApplyIds, 'RentalApplyJump', 'width=700,height=300');
+ this.closeAction();
+ }
+ })
+ .catch(error=>{
+ console.log('selectRentalApplyEquipmentSetByRACIDerr==='+error);
+ })
+ }
+ }
+ }
+
+ closeAction() {
+ //杩斿洖褰撳墠鐨勫鍝佺敵璇�
+ window.open("/"+this.recordId,'_self');
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/rentalApplyJumpLWC/rentalApplyJumpLWC.js-meta.xml b/force-app/main/default/lwc/rentalApplyJumpLWC/rentalApplyJumpLWC.js-meta.xml
new file mode 100644
index 0000000..2d6e62b
--- /dev/null
+++ b/force-app/main/default/lwc/rentalApplyJumpLWC/rentalApplyJumpLWC.js-meta.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="rentalApplyJumpLWC">
+ <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