From ca743be68ec263a6d9d6c70410f894ed2bb1d293 Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@prec-tech.com>
Date: 星期一, 31 七月 2023 15:29:03 +0800
Subject: [PATCH] 耗材申请按钮

---
 force-app/main/default/lwc/lexConsumApply_FromQIS/lexConsumApply_FromQIS.js |   45 ++++++++++++++++++++++-----------------------
 1 files changed, 22 insertions(+), 23 deletions(-)

diff --git a/force-app/main/default/lwc/lexConsumApply_FromQIS/lexConsumApply_FromQIS.js b/force-app/main/default/lwc/lexConsumApply_FromQIS/lexConsumApply_FromQIS.js
index 237f4b1..f68583e 100644
--- a/force-app/main/default/lwc/lexConsumApply_FromQIS/lexConsumApply_FromQIS.js
+++ b/force-app/main/default/lwc/lexConsumApply_FromQIS/lexConsumApply_FromQIS.js
@@ -8,7 +8,8 @@
 import { ShowToastEvent } from 'lightning/platformShowToastEvent';
 import { encodeDefaultFieldValues } from 'lightning/pageReferenceUtils';
 
-export default class LexConsumApply_FromQIS extends LightningElement {
+// 鏂板缓鑰楁潗澶囧搧鐢宠(QIS)
+export default class LexConsumApply_FromQIS extends NavigationMixin(LightningElement) {
 
     @api recordId;
     IsLoading = true;
@@ -34,7 +35,7 @@
         rentalApp({
             recordId: this.recordId
         }).then(result => {
-            console.log('rentalApp============' + result);
+            console.log('rentalApp============',result);
             if(result.lenth > 0){
                 const evt = new ShowToastEvent({
                     title : 'Error',
@@ -47,22 +48,23 @@
             init({
                 recordId: this.recordId
             }).then(result => {
+                console.log('init============',result);
                 this.IsLoading = false;
                 if (result != null) {
                     if(result.nextAction=='閫佸洖'){
-                        this.showToast('QIS瀵瑰簲鏂规硶涓衡�滈�佸洖鈥濓紝涓嶈兘鐢宠','warning');
+                        this.showToast('QIS瀵瑰簲鏂规硶涓衡�滈�佸洖鈥濓紝涓嶈兘鐢宠','error');
                         return;
                     }
                     if(result.qISStatus=='鑽夋涓�'){
-                        this.showToast('QIS鐘舵�佷负鑽夋涓紝涓嶈兘鐢宠','warning');
+                        this.showToast('QIS鐘舵�佷负鑽夋涓紝涓嶈兘鐢宠','error');
                         return;
                     }
                     if(result.qISStatus=='FSE濉啓瀹屾瘯'){
-                        this.showToast('QIS鐘舵�佷负FSE濉啓瀹屾瘯锛屼笉鑳界敵璇�','warning');
+                        this.showToast('QIS鐘舵�佷负FSE濉啓瀹屾瘯锛屼笉鑳界敵璇�','error');
                         return;
                     }
                     if(result.qISStatus=='鍙栨秷'){
-                        this.showToast('QIS鐘舵�佷负鍙栨秷锛屼笉鑳界敵璇�','warning');
+                        this.showToast('QIS鐘舵�佷负鍙栨秷锛屼笉鑳界敵璇�','error');
                         return;
                     }
                     // if('{!$User.isFormal_Stuff__c}'=='true'){
@@ -72,8 +74,8 @@
                     //     window.top.location.href=url;
                     //     }
                     UserInfo_Owner({}).then(res=>{
-                        if(res.isFormalStuff == 'true'){
-                            this.showToast('璇曠敤鏈熷唴锛屼笉鑳界敵璇�','warning');
+                        if(res.isFormalStuff){
+                            this.showToast('璇曠敤鏈熷唴锛屼笉鑳界敵璇�','error');
                             return;
                         }else{
                             // var query = "Select QualifiedApiName, EntityDefinition.KeyPrefix, DurableId From FieldDefinition WHERE EntityDefinition.QualifiedApiName = 'Consum_Apply__c'";
@@ -97,17 +99,17 @@
                             .catch(e=>{console.log(e)})
 
                             const defaultValues = encodeDefaultFieldValues({
-								QIS_Report__c: this.recordId,
-								Hospital: result.hospital,
-								Strategic_dept: result.departmentClass,
-                                Account:result.hospitalDepartment,
-                                demo_purpose2:'绱㈣禂QIS',
+								Hospital__c: result.hospital,
+								Strategic_dept__c: result.departmentClass,
+                                Account__c:result.hospitalDepartment,
+                                demo_purpose2__c:'绱㈣禂QIS',
                                 Name:'*',
-                                Person_In_Charge:res.lastName + res.firstName,
-                                applyUser:res.lastName + res.firstName,
-                                QIS_number:result.name
+                                Person_In_Charge__c:res.id,
+                                applyUser__c:res.id,
+                                QIS_number__c:result.qisReportId
 							});
-
+                            console.log('init============',result);
+                            console.log('init============',defaultValues);
 							this[NavigationMixin.Navigate]({
 								type: 'standard__objectPage',
 								attributes: {
@@ -115,9 +117,9 @@
 									actionName: 'new'
 								},
 								state:{
-									defaultFieldValues: this.defaultValues
+									defaultFieldValues: defaultValues
 								}
-							})
+							});
                         }
                     })
                     this.dispatchEvent(new CloseActionScreenEvent());
@@ -126,14 +128,10 @@
             }).catch(error => {
                 console.log("error");
                 console.log(error);
-            }).finally(() => {
-                
             });
         }).catch(error => {
             console.log("error");
             console.log(error);
-        }).finally(() => {
-
         });        
     }
 
@@ -144,6 +142,7 @@
             variant: type
         });
         this.dispatchEvent(evt);
+        this.dispatchEvent(new CloseActionScreenEvent());
     }
 
 }
\ No newline at end of file

--
Gitblit v1.9.1