From d77b6353ca9b59a6398df3eae9912f9fd766946d Mon Sep 17 00:00:00 2001
From: zhangzhengmei <zhangzhengmei@prec-tech.com>
Date: 星期六, 05 八月 2023 17:04:22 +0800
Subject: [PATCH] fix: lightning 页面确认

---
 force-app/main/default/lwc/lexCreateRepairFromQIS/lexCreateRepairFromQIS.js |  182 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 182 insertions(+), 0 deletions(-)

diff --git a/force-app/main/default/lwc/lexCreateRepairFromQIS/lexCreateRepairFromQIS.js b/force-app/main/default/lwc/lexCreateRepairFromQIS/lexCreateRepairFromQIS.js
new file mode 100644
index 0000000..69ef0be
--- /dev/null
+++ b/force-app/main/default/lwc/lexCreateRepairFromQIS/lexCreateRepairFromQIS.js
@@ -0,0 +1,182 @@
+import {
+    LightningElement,
+    wire,
+    api
+} from 'lwc';
+import {
+    CurrentPageReference
+} from "lightning/navigation";
+import {
+    CloseActionScreenEvent
+} from 'lightning/actions';
+import init from '@salesforce/apex/buttonQISReportCtl.init';
+import initUserName from '@salesforce/apex/buttonQISReportCtl.initUserName';
+import selecctAccountByAccountId from '@salesforce/apex/buttonQISReportCtl.selecctAccountByAccountId';
+
+export default class LexCreateRepairFromQIS extends LightningElement {
+    @api recordId;
+    str;
+    IsLoading = true;
+    Id;
+    Name;
+    RepairSalesPointProvinceChinaC;
+    Hospital;
+    HospitalId;
+    nextAction;
+    SpecialFollow;
+    HPID;
+    SourceOnCall;
+    DepartmentClassId;
+    DepartmentClass;
+    HospitalDepartment;
+    nonyushohin;
+    TrableOccurDaYCollect;
+    sourceForRepair;
+    OCMJudgementC
+    HospitalDepartmentId;
+    userId;
+    SourceOnCallId;
+    nonyushohinId;
+
+    @wire(CurrentPageReference)
+    getStateParameters(currentPageReference) {
+        if (currentPageReference) {
+            const urlValue = currentPageReference.state.recordId;
+            if (urlValue) {
+                let str = `${urlValue}`;
+                this.recordId = str;
+            }
+        }
+    }
+
+    connectedCallback() {
+        init({
+            recordId: this.recordId
+        }).then(result => {
+            console.log(result);
+            if (result != null) {
+                this.IsLoading = false;
+                this.Id = result.Id;
+                this.Name = result.Name;
+                this.SourceOnCallId = result.SourceOnCallId == undefined ? "" : result.SourceOnCallId;
+                this.nonyushohinId = result.nonyushohinId == undefined ? "" : result.nonyushohinId;
+                this.Hospital = result.Hospital == undefined ? "" : result.Hospital;
+                this.HospitalId = result.HospitalId == undefined ? "" : result.HospitalId;
+                this.nextAction = result.nextAction == undefined ? "" : result.nextAction;
+                this.SpecialFollow = result.SpecialFollow == undefined ? "" : result.SpecialFollow;
+                this.HPID = result.HPID == undefined ? "" : result.HPID;
+                this.SourceOnCall = result.SourceOnCall == undefined ? "" : result.SourceOnCall;
+                this.DepartmentClassId = result.DepartmentClassId == undefined ? "" : result.DepartmentClassId;
+                this.DepartmentClass = result.DepartmentClass == undefined ? "" : result.DepartmentClass;
+                this.HospitalDepartment = result.HospitalDepartment == undefined ? "" : result.HospitalDepartment;
+                this.nonyushohin = result.nonyushohin == undefined ? "" : result.nonyushohin;
+                this.TrableOccurDaYCollect = result.TrableOccurDaYCollect == undefined ? "" : result.TrableOccurDaYCollect;
+                this.sourceForRepair = result.sourceForRepair == undefined ? "" : result.sourceForRepair;
+                this.OCMJudgementC = result.OCMJudgementC == undefined ? "" : result.OCMJudgementC;
+                this.HospitalDepartmentId = result.HospitalDepartmentId == undefined ? "" : result.HospitalDepartmentId;
+                this.userId = result.userId;
+
+                initUserName({
+                    userId: this.userId
+                }).then(result => {
+                    console.log(result);
+                    if (result != null) {
+                        this.RepairSalesPointProvinceChinaC = result[0].RepairSalesPoint_Province_China__c;
+                    }
+                    this.CreateRepairFromQIS();
+                })
+
+                this.dispatchEvent(new CloseActionScreenEvent());
+            }
+        }).catch(error => {
+            console.log(error);
+        })
+    }
+
+    //鏂板缓淇悊QIS	
+    CreateRepairFromQIS() {
+        console.log("寮�濮�");
+        var newflag = false;
+        if ((this.OCMJudgementC == '璐ㄩ噺闂' && this.nextAction == '鏃犲伩缁翠慨' && this.SpecialFollow == '0') || (this.OCMJudgementC == '闈炶川閲忛棶棰�' && this.nextAction == '鏃犲伩缁翠慨' && this.SpecialFollow == '1') || (this.OCMJudgementC == '闈炶川閲忛棶棰�' && this.nextAction == '鏈夊伩缁翠慨' && this.SpecialFollow == '0') || (this.OCMJudgementC == '璐ㄩ噺闂+闈炶川閲忛棶棰�' && this.nextAction == '鏃犲伩缁翠慨' && this.SpecialFollow == '1') || (this.OCMJudgementC == '璐ㄩ噺闂+闈炶川閲忛棶棰�' && this.nextAction == '鏈夊伩缁翠慨+鏃犲伩缁翠慨' && this.SpecialFollow == '0')) {
+            newflag = true;
+        }
+        console.log(newflag);
+        if (newflag) {
+            selecctAccountByAccountId({
+                HospitalDepartmentId: this.HospitalDepartmentId
+            }).then(List => {
+                console.log(List);
+                var RecordTypeId;
+                var Incharge_Staff = '';
+                var Incharge_Staff_id = '';
+                var Work_Location = '';
+                if (List[0]['ParentId'] != null) {
+                    RecordTypeId = List[0]['Parent']['RecordType_DeveloperName__c'].substring(0, 15);
+                    console.log(RecordTypeId);
+                    var FSE_GI_Main_Leader__id = '';
+                    var FSE_GI_Main_Leader__name = '';
+                    var FSE_SP_Main_Leader__id = '';
+                    var FSE_SP_Main_Leader__name = '';
+                    if (List[0]['Parent']['Parent']['FSE_GI_Main_Leader__c'] != null) {
+                        FSE_GI_Main_Leader__id = List[0]['Parent']['Parent']['FSE_GI_Main_Leader__c'].substring(0, 15);
+                        FSE_GI_Main_Leader__name = List[0]['Parent']['Parent']['FSE_GI_Main_Leader__r']['Name'];
+                    }
+                    if (List[0]['Parent']['Parent']['FSE_SP_Main_Leader__c'] != null) {
+                        FSE_SP_Main_Leader__id = List[0]['Parent']['Parent']['FSE_SP_Main_Leader__c'].substring(0, 15);
+                        FSE_SP_Main_Leader__name = List[0]['Parent']['Parent']['FSE_SP_Main_Leader__r']['Name'];
+                    }
+                    if (List[0]['Parent']['RecordType_DeveloperName__c'] != null || List[0]['Parent']['RecordType_DeveloperName__c'] != undefined) {
+                        var recordId = List[0]['Parent']['RecordType_DeveloperName__c'].substring(0, 15);
+                        if (recordId == 'Department_Class_GI' || recordId == 'Department_Class_BF' || recordId == 'Department_Class_ET') {
+                            if (List[0]['Parent']['Parent']['FSE_GI_Main_Leader__c'] != null) {
+                                Work_Location = List[0]['Parent']['Parent']['FSE_GI_Main_Leader__r']['Work_Location__c'];
+                            }
+                        } else if (recordId == 'Department_Class_GS' || recordId == 'Department_Class_URO' || recordId == 'Department_Class_ENT' || recordId == 'Department_Class_GYN' || recordId == 'Department_Class_OTH') {
+                            if (List[0]['Parent']['Parent']['FSE_SP_Main_Leader__c'] != null) {
+                                Work_Location = List[0]['Parent']['Parent']['FSE_SP_Main_Leader__r']['Work_Location__c'];
+                            }
+
+                        }
+                    }
+                    if (RecordTypeId == 'Department_Class_GI') {
+                        Incharge_Staff = FSE_GI_Main_Leader__name;
+                        Incharge_Staff_id = FSE_GI_Main_Leader__id;
+                    }
+                    if (RecordTypeId == 'Department_Class_BF') {
+                        Incharge_Staff = FSE_GI_Main_Leader__name;
+                        Incharge_Staff_id = FSE_GI_Main_Leader__id;
+                    }
+                    if (RecordTypeId == 'Department_Class_ET') {
+                        Incharge_Staff = FSE_GI_Main_Leader__name;
+                        Incharge_Staff_id = FSE_GI_Main_Leader__id;
+                    }
+                    if (RecordTypeId == 'Department_Class_GS') {
+                        Incharge_Staff = FSE_SP_Main_Leader__name;
+                        Incharge_Staff_id = FSE_SP_Main_Leader__id;
+                    }
+                    if (RecordTypeId == 'Department_Class_URO') {
+                        Incharge_Staff = FSE_SP_Main_Leader__name;
+                        Incharge_Staff_id = FSE_SP_Main_Leader__id;
+                    }
+                    if (RecordTypeId == 'Department_Class_ENT') {
+                        Incharge_Staff = FSE_SP_Main_Leader__name;
+                        Incharge_Staff_id = FSE_SP_Main_Leader__id;
+                    }
+                    if (RecordTypeId == 'Department_Class_GYN') {
+                        Incharge_Staff = FSE_SP_Main_Leader__name;
+                        Incharge_Staff_id = FSE_SP_Main_Leader__id;
+                    }
+                    if (RecordTypeId == 'Department_Class_OTH') {
+                        Incharge_Staff = FSE_SP_Main_Leader__name;
+                        Incharge_Staff_id = FSE_SP_Main_Leader__id;
+                    }
+                }
+
+                window.open("/a0J/e?CF00N10000002FIJU_lkid=" + this.SourceOnCallId + "&CF00N10000002FIJU=" + this.SourceOnCall + "&CF00N10000002FIJZ_lkid=" + this.Id + "&CF00N10000002FIJZ=" + this.Name + "&CF00N10000002Dx66_lkid=" + this.HospitalId + "&CF00N10000002Dx66=" + this.Hospital + "&CF00N10000002Dx5t_lkid=" + this.DepartmentClassId + "&CF00N10000002Dx5t=" + this.DepartmentClass + "&CF00N10000002Dx5n_lkid=" + this.HospitalDepartmentId + "&CF00N10000002Dx5n=" + this.HospitalDepartment + "&CF00N10000002Dx1X_lkid=" + this.nonyushohinId + "&CF00N10000002Dx1X=" + this.nonyushohin + "&CF00N10000002EMHw_lkid=" + Incharge_Staff_id + "&CF00N10000002EMHw=" + Incharge_Staff + "&00N10000002Dx5y=" + this.TrableOccurDaYCollect + "&00N10000006P6SM=" + encodeURI(Work_Location) + "&00N10000002FH86=" + this.sourceForRepair + "&00N10000006P6Rn=" + this.RepairSalesPointProvinceChinaC + "&retURL=%2F" + this.Id);
+
+            })
+        } else {
+            alert("涓嶈兘鏂板缓淇悊");
+        }
+    }
+}
\ No newline at end of file

--
Gitblit v1.9.1