From 048f7b0855d05293e80c9bf5dbf0620f064f13f4 Mon Sep 17 00:00:00 2001
From: 黄千龙 <huangqianlong@prec-tech.com>
Date: 星期四, 11 五月 2023 10:51:19 +0800
Subject: [PATCH] Merge branch 'LEX_dev' of http://47.92.229.245:8089/r/lightningupdate into LEX_dev
---
force-app/main/default/lwc/lexRentalApplyEquipmentRentalPDF/lexRentalApplyEquipmentRentalPDF.css | 11 ++
force-app/main/default/lwc/lexTenderingHospitalButton/lexTenderingHospitalButton.js | 30 -----
force-app/main/default/lwc/lexTenderingLostButton/lexTenderingLostButton.js | 57 ++---------
force-app/main/default/lwc/lexRentalApplyEquipmentRentalPDF/lexRentalApplyEquipmentRentalPDF.js | 63 ++++++++++++
force-app/main/default/classes/rentalApplyEquipmentRentalPDFController.cls | 12 +-
force-app/main/default/lwc/lexRentalApplyEquipmentRentalPDF/lexRentalApplyEquipmentRentalPDF.html | 4
force-app/main/default/lwc/lexTenderingAttachmentButton/lexTenderingAttachmentButton.js | 30 -----
force-app/main/default/classes/TenderingButtonController.cls | 19 +++
force-app/main/default/classes/LightingButtonConstant.cls | 5 +
force-app/main/default/lwc/lexRentalApplyEquipmentRentalPDF/lexRentalApplyEquipmentRentalPDF.js-meta.xml | 11 ++
10 files changed, 139 insertions(+), 103 deletions(-)
diff --git a/force-app/main/default/classes/LightingButtonConstant.cls b/force-app/main/default/classes/LightingButtonConstant.cls
index 32e127b..f29bf2c 100644
--- a/force-app/main/default/classes/LightingButtonConstant.cls
+++ b/force-app/main/default/classes/LightingButtonConstant.cls
@@ -86,6 +86,11 @@
public static final String CN_NO = '鍚�';
public static final String VOC_NAME = 'VOC';
public static final String OK = 'OK';
+ public static final String LU_SHENG_NAME = '闄� 鑳�';
+ public static final String HU_DI_AN_NAME = '鑳� 杩畨';
+ public static final String SYSTEM_PROFILE_NAME = '绯荤粺绠$悊鍛�';
+ public static final String TwoS1_Sales_Hospital = '2S1_閿�鍞尰闄㈡媴褰�';
+ public static final String TwoS4_Sales_Manager = '2S4_閿�鍞鐞嗚��';
public static final String SOBJECT_NAME_OF_REPORT_SHARE ='Report__Share';
public static final String SOBJECT_NAME_OF_VOC_SHARE = 'VOCShare__c';
public static final String REPAIR_FIELD_DOJ_STATUS_NOT_OBJECT = '闈炲璞�';
diff --git a/force-app/main/default/classes/TenderingButtonController.cls b/force-app/main/default/classes/TenderingButtonController.cls
index 47b080d..5e01974 100644
--- a/force-app/main/default/classes/TenderingButtonController.cls
+++ b/force-app/main/default/classes/TenderingButtonController.cls
@@ -11,6 +11,9 @@
res.opportunityNum = String.valueOf(report.OpportunityNum__c);
res.isRelateProject = report.IsRelateProject__c;
res.profileId = UserInfo.getProfileId();
+ res.systemProfileId = getProfileIdByName(LightingButtonConstant.SYSTEM_PROFILE_NAME);
+ res.SalesManagerId = getProfileIdByName(LightingButtonConstant.SYSTEM_PROFILE_NAME);
+ res.SalesHospitalId = getProfileIdByName(LightingButtonConstant.SYSTEM_PROFILE_NAME);
res.Environment_Url = System.Label.Environment_Url;
System.debug(LoggingLevel.INFO, '*** xu: ' + res);
}catch(Exception e){
@@ -19,6 +22,16 @@
return res;
}
+ @AuraEnabled
+ public static string getProfileIdByName(String name){
+ Profile profile = null;
+ try {
+ profile = [select Id from Profile where Name =:name];
+ } catch (Exception e) {
+ throw new AuraHandledException(e.getMessage());
+ }
+ return profile.Id;
+ }
// var sql = "select id from Tender_Opportunity_Link__c where Tender_information__c='" + '{!Tender_information__c.Id}'+ "'";
// var sqlResult = sforce.connection.query(sql);
@AuraEnabled
@@ -49,6 +62,12 @@
@AuraEnabled
public String profileId;
@AuraEnabled
+ public String systemProfileId;
+ @AuraEnabled
+ public String SalesManagerId;
+ @AuraEnabled
+ public String SalesHospitalId;
+ @AuraEnabled
public String Environment_Url;
}
}
\ No newline at end of file
diff --git a/force-app/main/default/classes/rentalApplyEquipmentRentalPDFController.cls b/force-app/main/default/classes/rentalApplyEquipmentRentalPDFController.cls
index 9959c74..372a2e2 100644
--- a/force-app/main/default/classes/rentalApplyEquipmentRentalPDFController.cls
+++ b/force-app/main/default/classes/rentalApplyEquipmentRentalPDFController.cls
@@ -1,12 +1,12 @@
-public with sharing class rentalApplyEquipmentRentalPDFController {
- public rentalApplyEquipmentRentalPDFController() {
-
- }
+public with sharing class RentalApplyEquipmentRentalPDFController {
+
@AuraEnabled
public static InitData initJumptoPDFButton(String recordId) {
InitData res = new InitData();
try {
+ Rental_Apply__c ra = [SELECT Id,Shipment_requested_cnt__c from Rental_Apply__c where Id = :recordId];
List<Rental_Apply_Equipment_Set__c> raeSet = [SELECT Id from Rental_Apply_Equipment_Set__c where Rental_Apply__c = :recordId and Yi_Shipment_request__c > 0 and RAES_Status__c != '鍙栨秷'];
+ res.shipmentRequestedCnt = Integer.valueOf(ra.Shipment_requested_cnt__c);
Integer setLength = raeSet.size();
res.pageLength = Math.mod(setLength,10)== 0 ? setLength/10 : Math.round(setLength) +1 ;
}catch(Exception e){
@@ -17,9 +17,11 @@
public class InitData{
@AuraEnabled
- public String Id;
+ public String id;
@AuraEnabled
public Integer pageLength;
+ @AuraEnabled
+ public Integer shipmentRequestedCnt;
}
}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexRentalApplyEquipmentRentalPDF/lexRentalApplyEquipmentRentalPDF.css b/force-app/main/default/lwc/lexRentalApplyEquipmentRentalPDF/lexRentalApplyEquipmentRentalPDF.css
new file mode 100644
index 0000000..fbb1bbe
--- /dev/null
+++ b/force-app/main/default/lwc/lexRentalApplyEquipmentRentalPDF/lexRentalApplyEquipmentRentalPDF.css
@@ -0,0 +1,11 @@
+.rentalApplyCanleButtonHolder{
+ 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/lexRentalApplyEquipmentRentalPDF/lexRentalApplyEquipmentRentalPDF.html b/force-app/main/default/lwc/lexRentalApplyEquipmentRentalPDF/lexRentalApplyEquipmentRentalPDF.html
new file mode 100644
index 0000000..e9bebad
--- /dev/null
+++ b/force-app/main/default/lwc/lexRentalApplyEquipmentRentalPDF/lexRentalApplyEquipmentRentalPDF.html
@@ -0,0 +1,4 @@
+<template>
+<div class="rentalApplyCanleButtonHolder" if:true={IsLoding}>
+<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/lexRentalApplyEquipmentRentalPDF/lexRentalApplyEquipmentRentalPDF.js b/force-app/main/default/lwc/lexRentalApplyEquipmentRentalPDF/lexRentalApplyEquipmentRentalPDF.js
new file mode 100644
index 0000000..911a425
--- /dev/null
+++ b/force-app/main/default/lwc/lexRentalApplyEquipmentRentalPDF/lexRentalApplyEquipmentRentalPDF.js
@@ -0,0 +1,63 @@
+import { LightningElement, track, wire, api } from 'lwc';
+import {CurrentPageReference,NavigationMixin} from 'lightning/navigation';
+import { CloseActionScreenEvent } from 'lightning/actions';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import { updateRecord } from 'lightning/uiRecordApi';
+
+import init from '@salesforce/apex/rentalApplyEquipmentRentalPDFController.initJumptoPDFButton';
+export default class lexRentalApplyEquipmentRentalPDF extends LightningElement {
+ @api recordId;
+ 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.recordId' + this.recordId);
+ init({
+ recordId : this.recordId
+ }).then(result => {
+ if(result != null) {
+ if(result.shipmentRequestedCnt > 0){
+ this.IsLoading = false;
+ let num = result.pageLength;
+ window.open("https://ocsm--partial.sandbox.lightning.force.com/apex/FixtureRentalPDF?raid=" + this.recordId + "&page=" + num);
+ this.dispatchEvent(new CloseActionScreenEvent());
+ }else{
+ this.showToast('褰撳墠鐨勭敵璇峰崟涓病鏈夊凡鍑哄簱鎸囩ず鐨勯厤濂椼��','error');
+ }
+ }
+ })
+ .catch( error =>{
+ console.log(error);
+ })
+ }
+
+ showToast(msg,type) {
+ const event = new ShowToastEvent({
+ message: msg,
+ variant: type
+ });
+ if(type == 'success'){
+ this.updateRecordView();
+ }
+ 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/lexRentalApplyEquipmentRentalPDF/lexRentalApplyEquipmentRentalPDF.js-meta.xml b/force-app/main/default/lwc/lexRentalApplyEquipmentRentalPDF/lexRentalApplyEquipmentRentalPDF.js-meta.xml
new file mode 100644
index 0000000..a670e66
--- /dev/null
+++ b/force-app/main/default/lwc/lexRentalApplyEquipmentRentalPDF/lexRentalApplyEquipmentRentalPDF.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
diff --git a/force-app/main/default/lwc/lexTenderingAttachmentButton/lexTenderingAttachmentButton.js b/force-app/main/default/lwc/lexTenderingAttachmentButton/lexTenderingAttachmentButton.js
index 3c58a8d..f32c741 100644
--- a/force-app/main/default/lwc/lexTenderingAttachmentButton/lexTenderingAttachmentButton.js
+++ b/force-app/main/default/lwc/lexTenderingAttachmentButton/lexTenderingAttachmentButton.js
@@ -2,7 +2,6 @@
import { CurrentPageReference } from "lightning/navigation";
import { CloseActionScreenEvent } from 'lightning/actions';
import init from '@salesforce/apex/TenderingButtonController.initTenderingController';
-import { ShowToastEvent } from 'lightning/platformShowToastEvent';
export default class lexTenderingAttachmentButton extends LightningElement {
@api recordId;//褰撳墠杩欐潯鏁版嵁鐨刬d
id;//杩斿洖鍊肩殑id Tender_information__c鎷涙爣椤圭洰鐨刬d
@@ -18,37 +17,16 @@
}
}
}
-
+ //鎷涙爣椤圭洰鏌ョ湅闄勪欢
connectedCallback(){
init({
recordId: this.recordId
}).then(result => {
this.IsLoading = false;
this.id = result.Id;
- this.AttachmentButton();
+ window.open(`/apex/TenderInformationUploadPdf?id=${this.id}`);
this.dispatchEvent(new CloseActionScreenEvent());
- }).catch(error => {
- console.log("error"+error);
- }).finally(() => {
-
- });
+ })
}
- //鏌ョ湅闄勪欢
- AttachmentButton(){
- window.open(`/apex/TenderInformationUploadPdf?id=${this.id}`);
- }
-
- showToast(msg,type) {
- const event = new ShowToastEvent({
- message: msg,
- variant: type
- });
- this.dispatchEvent(event);
- }
-}
-
-// var From= function(){
-// window.open( "/apex/TenderInformationUploadPdf?id={!URLENCODE(Tender_information__c.Id)}");
-// }
-// From();
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexTenderingHospitalButton/lexTenderingHospitalButton.js b/force-app/main/default/lwc/lexTenderingHospitalButton/lexTenderingHospitalButton.js
index 6999b54..46b2353 100644
--- a/force-app/main/default/lwc/lexTenderingHospitalButton/lexTenderingHospitalButton.js
+++ b/force-app/main/default/lwc/lexTenderingHospitalButton/lexTenderingHospitalButton.js
@@ -24,46 +24,22 @@
init({
recordId: this.recordId
}).then(result => {
- console.log(result)
this.IsLoading = false;
this.id = result.Id;
this.name = result.name;
this.Environment_Url = result.Environment_Url
this.HospitalButton();
this.dispatchEvent(new CloseActionScreenEvent());
- }).catch(error => {
- console.log("error"+error);
- }).finally(() => {
-
- });
+ })
}
- //鏂板缓鍖婚櫌
+ //鎷涙爣椤圭洰鏂板缓鍖婚櫌
HospitalButton(){
var url = this.Environment_Url+'001/e?CF00N10000009I0o7='+encodeURIComponent(this.name)
+'&CF00N10000009I0o7_lkid='+encodeURIComponent(this.id)
+'&00N10000009HFQT='+encodeURIComponent('鎷涙爣椤圭洰')
+'&RecordType=01210000000QemG'
+'&retURL='+ encodeURIComponent(this.id);
- console.log('url',url)
window.location.href = url;
}
-}
-
-
-// var foo = function() {
-
-// var TenderId = '{!Tender_information__c.Id}';
-// var Tendername = '{!Tender_information__c.Name}';
-// var HospitalSource= '鎷涙爣椤圭洰';
-
-// var url = '{!$Label.Environment_Url}'+'001/e?CF00N10000009I0o7='+encodeURIComponent(Tendername)
-// +'&CF00N10000009I0o7_lkid='+encodeURIComponent(TenderId)
-// +'&00N10000009HFQT='+encodeURIComponent(HospitalSource)
-
-// +'&RecordType=01210000000QemG'
-// +'&retURL='+ encodeURIComponent(TenderId);
-// window.top.location.href = url;
-
-// }
-// foo();
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexTenderingLostButton/lexTenderingLostButton.js b/force-app/main/default/lwc/lexTenderingLostButton/lexTenderingLostButton.js
index a4576e1..680d893 100644
--- a/force-app/main/default/lwc/lexTenderingLostButton/lexTenderingLostButton.js
+++ b/force-app/main/default/lwc/lexTenderingLostButton/lexTenderingLostButton.js
@@ -6,9 +6,11 @@
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
export default class lexTenderingLostButton extends LightningElement {
@api recordId;//褰撳墠杩欐潯鏁版嵁鐨刬d
- id;//杩斿洖鍊肩殑id Tender_information__c鎷涙爣椤圭洰鐨刬d
status;//鐘舵��
profileId;//profileId id
+ systemProfileId;
+ SalesManagerId;
+ SalesHospitalId;
IsLoading = true;
@wire(CurrentPageReference)
@@ -28,23 +30,21 @@
recordId: this.recordId
}).then(result => {
this.IsLoading = false;
- this.id = result.Id;
this.status = result.status;
- this.profileId = result.profileId.slice(0,15);
+ this.profileId = result.profileId;
+ this.systemProfileId = result.systemProfileId;
+ this.SalesManagerId = result.SalesManagerId;
+ this.SalesHospitalId = result.SalesHospitalId;
this.LoseButton();
this.dispatchEvent(new CloseActionScreenEvent());
- }).catch(error => {
- console.log("error"+error);
- }).finally(() => {
-
- });
+ })
}
- //澶卞崟
+ //鎷涙爣椤圭洰 澶卞崟
LoseButton(){
- sqlResult({id: this.id}).then(result=>{
+ sqlResult({id: this.recordId}).then(result=>{
//绠�妗f潈闄� 2S1_閿�鍞尰闄㈡媴褰� 2S4_閿�鍞鐞嗚�� 绯荤粺绠$悊鍛�
- if (this.profileId != '00e10000000xnp2' && this.profileId != '00e10000000xnpH' && this.profileId != '00e10000000Y3o5') {
+ if (this.profileId != this.SalesManagerId && this.profileId != this.SalesHospitalId && this.profileId != this.systemProfileId) {
this.showToast("鎮ㄦ病鏈夋潈闄愶紝鏃犳硶鍒涘缓璇环鎻愪氦澶卞崟銆�","error");
return;
}
@@ -62,7 +62,7 @@
return;
}
}
- window.open(`/apex/TenderLostPage?id=${this.id}`,'','height=500,width=800,top=200,left=250,location=no');
+ window.open(`/apex/TenderLostPage?id=${this.recordId}`,'','height=500,width=800,top=200,left=250,location=no');
})
}
showToast(msg,type) {
@@ -73,36 +73,3 @@
this.dispatchEvent(event);
}
}
-
-
-// var sql = "select id from Tender_Opportunity_Link__c where Tender_information__c='" + '{!Tender_information__c.Id}'+ "'";
-// var sqlResult = sforce.connection.query(sql);
-
-
-// //绠�妗f潈闄� 2S1_閿�鍞尰闄㈡媴褰� 2S4_閿�鍞鐞嗚�� 绯荤粺绠$悊鍛�
-// if ('{!$Profile.Id}' != '00e10000000xnp2' && '{!$Profile.Id}' != '00e10000000xnpH' && '{!$Profile.Id}' != '00e10000000Y3o5') {
-// alert("鎮ㄦ病鏈夋潈闄愶紝鏃犳硶鍒涘缓璇环鎻愪氦澶卞崟銆�");
-// return;
-// }
-
-// // 鍒ゆ柇鍐呴儴纭鐘舵��
-// if({!Tender_information__c.status__c == '01.寰呯‘璁�'|| Tender_information__c.status__c == '02.涓嶇浉鍏�'}){
-// alert('鐘舵�佷负寰呯‘璁ゆ垨涓嶇浉鍏筹紝涓嶅彲浠ュ仛澶卞崟銆�');
-// return;
-// }
-
-// // 鍒ゆ柇鏄惁闇�瑕佹柊寤鸿浠�
-// if({!Tender_information__c.status__c == '05.璇环涓�'|| Tender_information__c.status__c == '06.鎴愪氦' || Tender_information__c.status__c == '07.閮ㄥ垎鎴愪氦' || Tender_information__c.status__c == '08.澶卞崟'} || sqlResult.size > 0){
-// if(!confirm('姝ら」鐩凡鍏宠仈璇环锛岃纭疄鏄惁鏂板缓璇环鎻愪氦澶卞崟銆�')) {
-// return;
-// }
-// }
-
-// // 鍒ゆ柇鏄惁闇�瑕佹柊寤鸿浠�
-// //if(sqlResult.size > 0){
-// //if(!confirm('宸叉湁鍏宠仈璇环锛屾槸鍚﹀垱寤烘柊鐨勮浠枫��')) {
-// //return;
-// //}
-// //}
-
-// window.open('/apex/TenderLostPage?id={!Tender_information__c.Id}','','height=500,width=800,top=200,left=250,location=no');
\ No newline at end of file
--
Gitblit v1.9.1