123
chenjingwu
2024-04-19 450f9922c8b9435e219e9ee44ccc90df581dcd60
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 == '是'){