From a8628cfe2640797ba9265e9be46c42430d9e7eba Mon Sep 17 00:00:00 2001
From: twysparks <twysparks@163.com>
Date: 星期一, 26 六月 2023 10:01:44 +0800
Subject: [PATCH] 服务按钮样式调整
---
force-app/main/default/lwc/lexCreateNewServiceContract/lexCreateNewServiceContract.js | 50 +++++++++++++++++++++++++++++++++-----------------
1 files changed, 33 insertions(+), 17 deletions(-)
diff --git a/force-app/main/default/lwc/lexCreateNewServiceContract/lexCreateNewServiceContract.js b/force-app/main/default/lwc/lexCreateNewServiceContract/lexCreateNewServiceContract.js
index 40602be..e49d936 100644
--- a/force-app/main/default/lwc/lexCreateNewServiceContract/lexCreateNewServiceContract.js
+++ b/force-app/main/default/lwc/lexCreateNewServiceContract/lexCreateNewServiceContract.js
@@ -10,8 +10,14 @@
CloseActionScreenEvent
} from 'lightning/actions';
import init from '@salesforce/apex/buttonAccountCtl.init';
+import {
+ NavigationMixin
+} from 'lightning/navigation';
+import {
+ encodeDefaultFieldValues
+} from 'lightning/pageReferenceUtils';
-export default class LexCreateNewServiceContract extends LightningElement {
+export default class LexCreateNewServiceContract extends NavigationMixin(LightningElement) {
@api recordId;
str;
IsLoading = true;
@@ -41,10 +47,10 @@
if (result != null) {
this.IsLoading = false;
this.Id = result.Id;
- this.HospitalC = result.HospitalC;
- this.HospitalIdC = result.HospitalIdC;
- this.DepartmentClassC = result.DepartmentClassC;
- this.DepartmentClassIdC = result.DepartmentClassIdC;
+ this.HospitalC = result.HospitalC == undefined ? "" : result.HospitalC;;
+ this.HospitalIdC = result.HospitalIdC == undefined ? "" : result.HospitalIdC;;
+ this.DepartmentClassC = result.DepartmentClassC == undefined ? "" : result.DepartmentClassC;;
+ this.DepartmentClassIdC = result.DepartmentClassIdC == undefined ? "" : result.DepartmentClassIdC;;
this.Name = result.Name;
this.CreateNewServiceContract();
@@ -57,20 +63,30 @@
// 鏂板缓鏂版湇鍔″悎鍚�
CreateNewServiceContract() {
- var Hospital = this.HospitalC;
- var Hospitalid = this.HospitalIdC;
- var Department = this.DepartmentClassC;
- var Departmentid = this.DepartmentClassIdC;
- var accountname = this.Name;
- var accountid = this.Id;
+ const url = encodeDefaultFieldValues({
+ Hospital__c: this.HospitalC,
+ Department_Class__c: this.DepartmentClassC,
+ Department__c: this.Id
+ });
+ this[NavigationMixin.Navigate]({
+ type: 'standard__objectPage',
+ attributes: {
+ objectApiName: 'Maintenance_Contract__c',
+ actionName: 'new'
+ },
+ state: {
+ nooverride: '1',
+ defaultFieldValues: url
+ }
+ });
+ this.dispatchEvent(new CloseActionScreenEvent());
+ // var url = 'a0H/e?CF00N10000002Dx56=' + Hospital + '&CF00N10000002Dx56_lkid=' +
+ // Hospitalid + '&CF00N10000002Dx4p=' + Department + '&CF00N10000002Dx4p_lkid=' +
+ // Departmentid + '&CF00N10000002Dx4q=' + accountname + '&CF00N10000002Dx4q_lkid=' +
+ // accountid + '&RecordType=01210000000gTYq';
- var url = 'a0H/e?CF00N10000002Dx56=' + Hospital + '&CF00N10000002Dx56_lkid=' +
- Hospitalid + '&CF00N10000002Dx4p=' + Department + '&CF00N10000002Dx4p_lkid=' +
- Departmentid + '&CF00N10000002Dx4q=' + accountname + '&CF00N10000002Dx4q_lkid=' +
- accountid + '&RecordType=01210000000gTYq';
-
- console.log(url);
+ // console.log(url);
// window.top.location.href = url;
}
--
Gitblit v1.9.1