From ae8abf10439475e838d49a3fd5e400c61b7f5174 Mon Sep 17 00:00:00 2001
From: LiJinHuan <lijinhuan@prec-tech.com>
Date: 星期二, 06 六月 2023 13:13:56 +0800
Subject: [PATCH] Merge branch 'LEX_dev' of http://47.92.229.245:8089/r/lightningupdate into LEX_dev
---
force-app/main/default/classes/lexConsumApply_FromAccountCtl.cls | 71 ++++++++++++++
force-app/main/default/lwc/lexConsumApply_FromAccount/lexConsumApply_FromAccount.html | 5 +
force-app/main/default/lwc/lexConsumApply_FromAccount/lexConsumApply_FromAccount.js-meta.xml | 20 ++++
force-app/main/default/lwc/lexConsumApply_FromAccount/lexConsumApply_FromAccount.js | 97 +++++++++++++++++++
force-app/main/default/classes/lexConsumApply_FromAccountCtl.cls-meta.xml | 5 +
force-app/main/default/lwc/lexEquipmentRentalApply_FromQIS2/lexEquipmentRentalApply_FromQIS2.js | 26 ++--
force-app/main/default/lwc/lexEquipmentRentalApply_FromSA/lexEquipmentRentalApply_FromSA.js | 20 ++--
7 files changed, 221 insertions(+), 23 deletions(-)
diff --git a/force-app/main/default/classes/lexConsumApply_FromAccountCtl.cls b/force-app/main/default/classes/lexConsumApply_FromAccountCtl.cls
new file mode 100644
index 0000000..d360ecb
--- /dev/null
+++ b/force-app/main/default/classes/lexConsumApply_FromAccountCtl.cls
@@ -0,0 +1,71 @@
+public with sharing class lexConsumApply_FromAccountCtl {
+ public lexConsumApply_FromAccountCtl() {
+
+ }
+ @AuraEnabled
+ public static List<FieldDefinition> fieldDefineApp(){
+ try {
+ List<FieldDefinition> rep = [Select QualifiedApiName, EntityDefinition.KeyPrefix, DurableId From FieldDefinition WHERE EntityDefinition.QualifiedApiName = 'Consum_Apply__c'];
+ return rep;
+ } catch (Exception e) {
+ throw new AuraHandledException(e.getMessage());
+ }
+ }
+
+ //鑾峰彇褰撳墠鐧诲綍浜虹殑 id
+ @AuraEnabled
+ public static UserResult UserInfo_Owner() {
+ UserResult result = new UserResult();
+ ID myUserID = UserInfo.getUserId();
+ try {
+ User tempUser =
+ [select Id,isFormal_Stuff__c,FirstName,LastName from user where id = : myUserID ];
+ result.id = tempUser.Id;
+ result.isFormalStuff = tempUser.isFormal_Stuff__c;
+ result.firstName = tempUser.FirstName;
+ result.lastName = tempUser.LastName;
+ } catch (exception e) {
+
+ result.result = e.getMessage();
+ }
+ return result;
+ }
+
+ @AuraEnabled
+ public static InitData init(String recordId){
+ InitData res = new initData();
+ try {
+ Account rep = [select Id,Name,Hospital__c,Department_Class__c from Account where Id =: recordId];
+ res.name = rep.Name;
+ res.hospitalName = rep.Hospital__c;
+ res.departClass = rep.Department_Class__c;
+ return res;
+ } catch (Exception e) {
+ throw new AuraHandledException(e.getMessage());
+ }
+ }
+ public class InitData{
+ @AuraEnabled
+ public String hospitalName;
+ @AuraEnabled
+ public String departClass;
+ @AuraEnabled
+ public String name;
+ }
+
+ public class UserResult {
+ @AuraEnabled
+ public string result;
+ public UserResult( ) {
+ result = 'Success';
+ }
+ @AuraEnabled
+ public string id;
+ @AuraEnabled
+ public Boolean isFormalStuff;
+ @AuraEnabled
+ public string firstName;
+ @AuraEnabled
+ public string lastName;
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/lexConsumApply_FromAccountCtl.cls-meta.xml b/force-app/main/default/classes/lexConsumApply_FromAccountCtl.cls-meta.xml
new file mode 100644
index 0000000..45cccbd
--- /dev/null
+++ b/force-app/main/default/classes/lexConsumApply_FromAccountCtl.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/lexConsumApply_FromAccount/lexConsumApply_FromAccount.html b/force-app/main/default/lwc/lexConsumApply_FromAccount/lexConsumApply_FromAccount.html
new file mode 100644
index 0000000..ae58c6c
--- /dev/null
+++ b/force-app/main/default/lwc/lexConsumApply_FromAccount/lexConsumApply_FromAccount.html
@@ -0,0 +1,5 @@
+<template>
+ <div class="dispatchOCSMQARAHolder" 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/lexConsumApply_FromAccount/lexConsumApply_FromAccount.js b/force-app/main/default/lwc/lexConsumApply_FromAccount/lexConsumApply_FromAccount.js
new file mode 100644
index 0000000..161d51d
--- /dev/null
+++ b/force-app/main/default/lwc/lexConsumApply_FromAccount/lexConsumApply_FromAccount.js
@@ -0,0 +1,97 @@
+import { LightningElement,wire,track,api} from 'lwc';
+import { CurrentPageReference, NavigationMixin} from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import init from '@salesforce/apex/lexConsumApply_FromAccountCtl.init';
+import fieldDefineApp from '@salesforce/apex/lexConsumApply_FromAccountCtl.fieldDefineApp';
+import UserInfo_Owner from '@salesforce/apex/lexConsumApply_FromAccountCtl.UserInfo_Owner';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import { encodeDefaultFieldValues } from 'lightning/pageReferenceUtils';
+
+export default class LexConsumApply_FromAccount extends 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(result=>{
+ UserInfo_Owner({}).then(res=>{
+ if(res.isFormalStuff == 'true'){
+ this.showToast('璇曠敤鏈熷唴锛屼笉鑳界敵璇�','warning');
+ return;
+ }else{
+
+ fieldDefineApp({}).then(resp=>{
+ var fieldmap = new Map();
+ for (var i=0; i< resp.length; i++) {
+ var record = resp[i];
+ fieldmap.set(record.QualifiedApiName,record.DurableId.toString().split('.')[1]);
+ }
+
+ })
+ .catch(e=>{console.log(e)})
+
+ const defaultValues = encodeDefaultFieldValues({
+ Hospital__c:result.hospitalName,
+ Strategic_dept__c:result.departClass,
+ Account__c:result.name,
+ Name:'*',
+ demo_purpose2__c:'OPD璇曠敤',
+ Person_In_Charge__c:res.lastName + res.firstName,
+ applyUser__c:res.lastName + res.firstName
+ });
+
+ this[NavigationMixin.Navigate]({
+ type: 'standard__objectPage',
+ attributes: {
+ objectApiName: 'Consum_Apply__c',
+ actionName: 'new'
+ },
+ state:{
+ defaultFieldValues: this.defaultValues
+ }
+ })
+ }
+ })
+ .catch(error => {
+ console.log("error");
+ console.log(error);
+ })
+ })
+
+ .catch(error => {
+ console.log("error");
+ console.log(error);
+ }).finally(() => {
+ this.dispatchEvent(new CloseActionScreenEvent());
+ });
+ }
+
+ showToast(message, type) {
+ const evt = new ShowToastEvent({
+ title: '',
+ message: message,
+ variant: type
+ });
+ this.dispatchEvent(evt);
+ }
+
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexConsumApply_FromAccount/lexConsumApply_FromAccount.js-meta.xml b/force-app/main/default/lwc/lexConsumApply_FromAccount/lexConsumApply_FromAccount.js-meta.xml
new file mode 100644
index 0000000..622f243
--- /dev/null
+++ b/force-app/main/default/lwc/lexConsumApply_FromAccount/lexConsumApply_FromAccount.js-meta.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexEquipmentRentalApply_FromSA">
+ <apiVersion>56.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">
+ <!-- name js涓娇鐢ㄧ殑鍙橀噺锛屼粠灞忓箷娴佷腑鑾峰彇鍙傛暟 label 鍦ㄥ睆骞曟祦鐨勮LWC鐨勮缃腑鏄剧ず -->
+ <property name="recordId" type="String" label="recordId"/>
+ </targetConfig>
+ </targetConfigs>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexEquipmentRentalApply_FromQIS2/lexEquipmentRentalApply_FromQIS2.js b/force-app/main/default/lwc/lexEquipmentRentalApply_FromQIS2/lexEquipmentRentalApply_FromQIS2.js
index 55736c9..7f74e42 100644
--- a/force-app/main/default/lwc/lexEquipmentRentalApply_FromQIS2/lexEquipmentRentalApply_FromQIS2.js
+++ b/force-app/main/default/lwc/lexEquipmentRentalApply_FromQIS2/lexEquipmentRentalApply_FromQIS2.js
@@ -1,9 +1,9 @@
import { LightningElement,wire,track,api} from 'lwc';
import { CurrentPageReference, NavigationMixin} from "lightning/navigation";
import { CloseActionScreenEvent } from 'lightning/actions';
-import init from '@salesforce/apex/lexEquipmentRentalApply_FromQISCtl.rentalApp';
-import rentalApp from '@salesforce/apex/lexEquipmentRentalApply_FromQISCtl.init';
-import UserInfo_Owner from '@salesforce/apex/lexEquipmentRentalApply_FromQISCtl.UserInfo_Owner';
+import init from '@salesforce/apex/LexEquipmentRentalApply_FromQISCtl.rentalApp';
+import rentalApp from '@salesforce/apex/LexEquipmentRentalApply_FromQISCtl.init';
+import UserInfo_Owner from '@salesforce/apex/LexEquipmentRentalApply_FromQISCtl.UserInfo_Owner';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import { encodeDefaultFieldValues } from 'lightning/pageReferenceUtils';
@@ -78,17 +78,17 @@
}else{
const defaultValues = encodeDefaultFieldValues({
QIS_Report__c: this.recordId,
- Hospital: result.hospital,
- Strategic_dept: result.departmentClass,
- Account:result.hospitalDepartment,
- Demo_purpose1:'缁翠慨浠g敤',
- demo_purpose2:'绱㈣禂QIS',
+ Hospital__c: result.hospital,
+ Strategic_dept__c: result.departmentClass,
+ Account__c:result.hospitalDepartment,
+ Demo_purpose1__c:'缁翠慨浠g敤',
+ demo_purpose2__c:'绱㈣禂QIS',
Name:'*',
- Person_In_Charge:res.lastName + res.firstName,
- applyUser:res.lastName + res.firstName,
- Loaner_received_staff:res.lastName + res.firstName,
- QIS_number:result.name,
- QISRepair:result.repair
+ Person_In_Charge__c:res.lastName + res.firstName,
+ applyUser__c:res.lastName + res.firstName,
+ Loaner_received_staff__c:res.lastName + res.firstName,
+ QIS_number__c:result.name,
+ QISRepair__c:result.repair
});
this[NavigationMixin.Navigate]({
diff --git a/force-app/main/default/lwc/lexEquipmentRentalApply_FromSA/lexEquipmentRentalApply_FromSA.js b/force-app/main/default/lwc/lexEquipmentRentalApply_FromSA/lexEquipmentRentalApply_FromSA.js
index 0794680..7b0a7bb 100644
--- a/force-app/main/default/lwc/lexEquipmentRentalApply_FromSA/lexEquipmentRentalApply_FromSA.js
+++ b/force-app/main/default/lwc/lexEquipmentRentalApply_FromSA/lexEquipmentRentalApply_FromSA.js
@@ -51,18 +51,18 @@
return;
}else{
const defaultValues = encodeDefaultFieldValues({
- Statu_Achievements: result.achievement,
+ Statu_Achievements__c: result.achievement,
retURL:this.recordId,
- Hospital: result.hospital,
+ Hospital__c: result.hospital,
Name:'*',
- Strategic_dept: result.departmentClass,
- Account:result.oppClassName,
- Demo_purpose1:'浜у搧璇曠敤',
- demo_purpose2:'宸茶喘寰呰揣',
- Person_In_Charge:res.lastName + res.firstName,
- applyUser:res.lastName + res.firstName,
- Loaner_received_staff:res.lastName + res.firstName,
- Follow_UP_Opp:result.opportunity
+ Strategic_dept__c: result.departmentClass,
+ Account__c:result.oppClassName,
+ Demo_purpose1__c:'浜у搧璇曠敤',
+ demo_purpose2__c:'宸茶喘寰呰揣',
+ Person_In_Charge__c:res.lastName + res.firstName,
+ applyUser__c:res.lastName + res.firstName,
+ Loaner_received_staff__c:res.lastName + res.firstName,
+ Follow_UP_Opp__c:result.opportunity
});
this[NavigationMixin.Navigate]({
--
Gitblit v1.9.1