From 450f9922c8b9435e219e9ee44ccc90df581dcd60 Mon Sep 17 00:00:00 2001
From: chenjingwu <chenjingwu@prec-tech.com>
Date: 星期五, 19 四月 2024 17:28:23 +0800
Subject: [PATCH] 123

---
 force-app/main/default/lwc/relevant/relevant.js |   84 +++++++++++++++++++++++++++++------------
 1 files changed, 59 insertions(+), 25 deletions(-)

diff --git a/force-app/main/default/lwc/relevant/relevant.js b/force-app/main/default/lwc/relevant/relevant.js
index 37f9cee..8d71653 100644
--- a/force-app/main/default/lwc/relevant/relevant.js
+++ b/force-app/main/default/lwc/relevant/relevant.js
@@ -1,4 +1,4 @@
-import { LightningElement, track } from 'lwc';
+import { LightningElement, track,api } from 'lwc';
 
 
 import GetInspectById from '@salesforce/apex/InspectCheckController.GetInspectById';
@@ -28,11 +28,12 @@
 
 import SearchUserByIds from '@salesforce/apex/InspectCheckController.SearchUserByIds';
 
-
 import {ShowToastEvent} from 'lightning/platformShowToastEvent';
-
+import lwcCSS from '@salesforce/resourceUrl/lwcCSS';						
+import {loadStyle} from 'lightning/platformResourceLoader'	
+import tnederDeletePageCss from '@salesforce/resourceUrl/tnederDeletePageCss';			
 export default class test01 extends LightningElement {
-
+@api recordid;
 //鎻愮ず
 Tongzhishow=false;  //鎻愮ず鏄剧ず鐨勬爣璇�
 SaveShowText="鎿嶄綔鎴愬姛";//鎻愮ず妗嗙殑鏂囨湰
@@ -75,6 +76,23 @@
     // }
     this.closeOffRefresh();
 }
+showToast(msg,type) {
+    if(type == "success"){
+        const event = new ShowToastEvent({
+            message: msg,
+            variant: type
+        });
+        // this.isTrue = false;
+        this.dispatchEvent(event);
+    }else{
+        const event = new ShowToastEvent({
+            message: msg,
+            variant: type,
+            mode:"sticky"
+        });
+        this.dispatchEvent(event);
+    }
+}
 closeOffRefresh(){
     if (this.Tongzhishow == true) {
         this.Tongzhishow = false;
@@ -95,6 +113,7 @@
 }
 
 //鏄剧ず涓庨殣钘�
+isTrue = false;
 isShi = true;  //閫夌潃 鏄� 鐨勬爣璇�
 isFou = false; //閫夌潃 鍚� 鐨勬爣璇�
 isOther = false;  //閫夌潃 鍏朵粬 鐨勬爣璇�
@@ -122,8 +141,12 @@
     }
     paramIdStr = '' 
     connectedCallback(){
+        Promise.all([			
+            loadStyle(this, lwcCSS),			
+            loadStyle(this, tnederDeletePageCss)	
+        ]);			
         // this.OnLoadingWait(5000)
-        var paramId =  this.getQueryVariable('id');
+        var paramId =  this.recordid;
         if (paramId == null || paramId == '') {
             return ;
         }
@@ -140,7 +163,12 @@
             var response=JSON.parse(result);
             if (response!=undefined && response.length == 1) {
                 var tempData  = response[0];
-              
+                console.log(tempData.IsRelateProject__c,"鏄惁鏈夊��")
+                if(tempData.IsRelateProject__c == undefined){
+                    this.isTrue = false;
+                }else{
+                    this.isTrue = true;
+                }
                 this.checkDatas(tempData);
 
                 this.InspectData   = tempData;
@@ -426,6 +454,7 @@
         this.InspectData.IsRelateProject__c = value;
 
         if (value == "鏄�") {
+            this.isTrue = true;
             this.isShi = true;
             this.isFou = false;
             this.isOther = false;
@@ -440,7 +469,8 @@
         }
 
         if (value == "鍚�") {
-            // this.isShi = false;
+            this.isTrue = true;
+            this.isShi = false;
             this.isFou = true;
 
             // if (this.InspectData.irrelevantReasons__c = '8.鍏朵粬(鎵嬪啓)'||this.InspectData.irrelevantReasons__c == '1.鍏抽敭璇嶄笉鐩稿叧') {
@@ -461,11 +491,11 @@
         if (flag) {
            
             if (this.isOther) {
-                this.dispatchDivStyle="position: absolute;left: 30px;top: 210px;width: 600px;height: 500px;background-color: white;z-index: 998;";
-                this.dispatchButtonStyle = 'margin-top: 10px;z-index: 999;position: absolute;left: 30px;top: 210px;'; 
+                this.dispatchDivStyle="position: absolute;left: 30px;top: 215px;width: 600px;height: 55%;background-color: white;z-index: 998;";
+                this.dispatchButtonStyle = 'margin-top: 15px;z-index: 999;position: absolute;left: 30px;top: 210px;'; 
             }else{
-                this.dispatchDivStyle="position: absolute;left: 30px;top: 150px;width: 600px;height: 500px;background-color: white;z-index: 998;";
-                this.dispatchButtonStyle = 'margin-top: 10px;z-index: 999;position: absolute;left: 30px;top: 150px;'; 
+                this.dispatchDivStyle="position: absolute;left: 30px;top: 150px;width: 600px;height: 55%;background-color: white;z-index: 998;";
+                this.dispatchButtonStyle = 'margin-top: 15px;z-index: 999;position: absolute;left: 30px;top: 150px;'; 
             }
         }else{
             this.dispatchDivStyle="";
@@ -514,7 +544,7 @@
 
         if(this.checkZLSKIsRepeate()== false)
         {
-            this.Alert("淇濆瓨澶辫触",true,true);
+            this.showToast("淇濆瓨澶辫触",'error');
             return;
         }
         //鍒ゆ柇鏄惁涓虹┖
@@ -531,41 +561,42 @@
 
         }
        
-    //鍒ゆ柇 IsRelateProject__c
+        //鍒ゆ柇 IsRelateProject__c
         if (this.InspectData.IsRelateProject__c == undefined || this.InspectData.IsRelateProject__c == "" ) {
             this.xgxLy = "slds-form-element slds-has-error"
-            this.xgxLyFlag = true;
+            // this.xgxLyFlag = true;
             flag = false;
         }else{
             this.xgxLy = "slds-form-element"
-            this.xgxLyFlag = false;
+            // this.xgxLyFlag = false;
         }
-    //鍒ゆ柇 irrelevantReasons__c
+        //鍒ゆ柇 irrelevantReasons__c
         if (this.InspectData.irrelevantReasons__c == undefined | this.InspectData.irrelevantReasons__c == "" && this.InspectData.IsRelateProject__c != undefined && this.InspectData.IsRelateProject__c == "鍚�") {
             this.bxgLy = "slds-form-element slds-has-error"
-            this.bxgLyFlag = true;
+            this.dispatchDivStyle="position: absolute;left: 30px;top: 223px;width: 600px;height: 55%;background-color: white;z-index: 998;";
+            // this.bxgLyFlag = true;
             flag = false;
         }else{
             this.bxgLy = "slds-form-element"
-            this.bxgLyFlag = false;
+            // this.bxgLyFlag = false;
         }
          //鍒ゆ柇 irrelevantReasons__c
         // if ( (this.InspectData.irrelevantReasons__c == '8.鍏朵粬(鎵嬪啓)'||this.InspectData.irrelevantReasons__c== '1.鍏抽敭璇嶄笉鐩稿叧') && this.InspectData.irrelevantReasonOther__c == "") {
         if (this.InspectData.irrelevantReasons__c == '8.鍏朵粬(鎵嬪啓)' && this.InspectData.irrelevantReasonOther__c == "") {
             this.qtLy="slds-form-element slds-has-error";
-            this.qtLyFlag = true;
+            // this.qtLyFlag = true;
             flag = false;
         }else{
             this.qtLy="slds-form-element";
-            this.qtLyFlag = false;
+            // this.qtLyFlag = false;
         }
          //鍒ゆ柇 Hospital__c
         
         if ((this.InspectData.Hospital__c == undefined || this.InspectData.Hospital__c ==  ''  ) && this.InspectData.IsRelateProject__c == "鏄�" ) {
-            this.isErrorShowYY = true;
+            // this.isErrorShowYY = true;
             flag = false;
         }else{
-            this.isErrorShowYY = false;
+            // this.isErrorShowYY = false;
         }
 
         //鍒ゆ柇 AccountOwner__c
@@ -605,7 +636,7 @@
                 // });
                 if (response == '鎴愬姛') {
                   
-                    this.Alert("淇濆瓨鎴愬姛",false,true); 
+                    this.showToast("淇濆瓨鎴愬姛",'success'); 
                     //淇濆瓨鎴愬姛 璁剧疆缁勪欢涓虹鐢�
                     var buttons = this.template.querySelectorAll('button');
                     buttons.forEach(fileInput=>{
@@ -634,9 +665,12 @@
                     checkboxgroup.forEach(group=>{
                         group.disabled = true;
                     })
-                    window.location.hash = "Refresh"+"=="+this.paramIdStr;
+                    setTimeout(() => {
+                        window.location.href = '/'+this.recordid
+                    },3000)
+                    // window.location.hash = "Refresh"+"=="+this.paramIdStr;
                 }else{
-                    this.Alert(response,true);
+                    this.showToast(response,'error');
                 }
                 debugger
                 if(this.InspectData.IsRelateProject__c == '鏄�'){

--
Gitblit v1.9.1