From 626f3c3bb25e204568019e8d568e2d7547d1037a Mon Sep 17 00:00:00 2001
From: 黄千龙 <huangqianlong@prec-tech.com>
Date: 星期三, 09 八月 2023 10:54:08 +0800
Subject: [PATCH] 20230809修改伟意按钮同步

---
 force-app/main/default/lwc/lexQISCloneButton/lexQISCloneButton.js                           |   49 +++++
 force-app/main/default/lwc/lexCreateQISFromAsset/lexCreateQISFromAsset.js-meta.xml          |   11 +
 force-app/main/default/lwc/lexDiscountRequest/lexDiscountRequest.js                         |    2 
 force-app/main/default/lwc/lexOSHNogoods/lexOSHNogoods.js                                   |    2 
 force-app/main/default/lwc/lexRentalApplyDiscountApproval/lexRentalApplyDiscountApproval.js |    2 
 force-app/main/default/lwc/lexApplyForRepair/lexApplyForRepair.js                           |   28 ++
 force-app/main/default/lwc/lexSCSubmit/lexSCSubmit.js                                       |    2 
 force-app/main/default/lwc/lexCreateQISFromAsset/lexCreateQISFromAsset.js                   |  219 ++++++++++++++++++++++++
 force-app/main/default/lwc/lexSendQISToEtQ/lexSendQISToEtQ.js                               |  136 ++++++++------
 force-app/main/default/lwc/lexQISMBCrequestNew/lexQISMBCrequestNew.js-meta.xml              |    1 
 force-app/main/default/lwc/lexCreateQISFromAsset/lexCreateQISFromAsset.css                  |   12 +
 force-app/main/default/lwc/lexSendQISToEtQ/lexSendQISToEtQ.html                             |    1 
 force-app/main/default/lwc/lexQISCloneButton/lexQISCloneButton.js-meta.xml                  |    9 +
 force-app/main/default/lwc/lexQISMBCrequestNew/lexQISMBCrequestNew.js                       |   29 ++
 force-app/main/default/lwc/lexCreateQISFromAsset/lexCreateQISFromAsset.html                 |   15 +
 force-app/main/default/lwc/lexServiceCutPriceApply/lexServiceCutPriceApply.js               |    2 
 force-app/main/default/lwc/lexQISMBCrequestNew/lexQISMBCrequestNew.html                     |    2 
 17 files changed, 445 insertions(+), 77 deletions(-)

diff --git a/force-app/main/default/lwc/lexApplyForRepair/lexApplyForRepair.js b/force-app/main/default/lwc/lexApplyForRepair/lexApplyForRepair.js
index 33dbd59..f99da45 100644
--- a/force-app/main/default/lwc/lexApplyForRepair/lexApplyForRepair.js
+++ b/force-app/main/default/lwc/lexApplyForRepair/lexApplyForRepair.js
@@ -10,11 +10,12 @@
     CloseActionScreenEvent
 } from 'lightning/actions';
 import init from '@salesforce/apex/buttonRepairSubOrderCtl.init';
+import { NavigationMixin } from 'lightning/navigation';
 import {
     ShowToastEvent
 } from 'lightning/platformShowToastEvent';
 
-export default class LexApplyForRepair extends LightningElement {
+export default class lexApplyForRepair extends NavigationMixin(LightningElement) {
     @api recordId;
     str;
     IsLoading = true;
@@ -36,7 +37,7 @@
         init({
             recordId: this.recordId
         }).then(result => {
-            console.log(result);
+            // console.log(result);
             if (result != null) {
                 this.IsLoading = false;
                 this.Id = result.Id;
@@ -47,9 +48,7 @@
             }
         }).catch(error => {
             console.log(error);
-        }).finally(() => {
-
-        });
+        })
     }
 
     //鐢宠淇悊
@@ -59,8 +58,23 @@
             this.ShowToastEvent("鎶ヤ慨瀛愬崟鐨勭姸鎬佷笉鏄� 寰呭鐞� 鏃犳硶鐢宠淇悊", "error")
             return;
         }
-        var url = '/apex/ChoiceAsset?Id=' + this.Id + '&Type=Repair';
-        window.open(url, '鐢宠淇悊', 'height=700, width=1000, top=200, left=200, toolbar=no, menubar=no, scrollbars=no, location=no, status=no');
+        const paramMap = {
+                Id: this.recordId// 娣诲姞鍙傛暟鍒癠RL涓紝鏇挎崲paramName鍜宲aramValue涓哄疄闄呯殑鍙傛暟鍚嶅拰鍊�
+              };
+        this[NavigationMixin.Navigate]({
+            type: 'standard__webPage',
+            attributes: {
+              url: '/lightning/n/Tab5',
+              target: '_blank' // 鏇挎崲涓轰綘鐨勮嚜瀹氫箟椤甸潰鐨凙PI鍚嶇О鎴朥RL
+            },
+            state: {
+              params: JSON.stringify(paramMap)
+            }
+          });
+        
+
+        // var url = '/apex/ChoiceAsset?Id=' + this.Id + '&Type=Repair';
+        // window.open(url, '鐢宠淇悊', 'height=700, width=1000, top=200, left=200, toolbar=no, menubar=no, scrollbars=no, location=no, status=no');
     }
 
     ShowToastEvent(msg, type) {
diff --git a/force-app/main/default/lwc/lexCreateQISFromAsset/lexCreateQISFromAsset.css b/force-app/main/default/lwc/lexCreateQISFromAsset/lexCreateQISFromAsset.css
new file mode 100644
index 0000000..e9fe316
--- /dev/null
+++ b/force-app/main/default/lwc/lexCreateQISFromAsset/lexCreateQISFromAsset.css
@@ -0,0 +1,12 @@
+.toast{
+	border: 1px solid #c9c9c9;
+	border-radius: 10px; 
+	width: 50%;
+	margin: 0 auto;
+	font-size: 18px;
+	font-weight: bold;
+	padding: 10px 20px;
+	background: #EA001E;
+	display: flex;
+	color: white;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCreateQISFromAsset/lexCreateQISFromAsset.html b/force-app/main/default/lwc/lexCreateQISFromAsset/lexCreateQISFromAsset.html
new file mode 100644
index 0000000..0c84cf0
--- /dev/null
+++ b/force-app/main/default/lwc/lexCreateQISFromAsset/lexCreateQISFromAsset.html
@@ -0,0 +1,15 @@
+<template>
+    <div class="exampleHolder" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+        <lightning-button onclick={handleConfirmClick} label="Open Confirm Modal"></lightning-button>
+        <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button>    </div>
+    </div>
+    <div if:false={IsLoading} class="toast">
+		<span style="padding: 10px;">{msg}</span>
+		<button class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse" onclick={closeAction} title="Close" style="background-color: #e5e4e2;margin-top: 15px;">
+                <lightning-icon class="greyIcon" icon-name="utility:close" alternative-text="Connected" variant="inverse" size="small"
+                    title="Close"  style="color: black;"></lightning-icon>
+              <span class="slds-assistive-text">Close</span>
+        </button>
+	</div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCreateQISFromAsset/lexCreateQISFromAsset.js b/force-app/main/default/lwc/lexCreateQISFromAsset/lexCreateQISFromAsset.js
new file mode 100644
index 0000000..2bab6b2
--- /dev/null
+++ b/force-app/main/default/lwc/lexCreateQISFromAsset/lexCreateQISFromAsset.js
@@ -0,0 +1,219 @@
+import {
+	LightningElement,
+	wire,
+	api
+} from 'lwc';
+import {
+	CurrentPageReference
+} from "lightning/navigation";
+import {
+	CloseActionScreenEvent
+} from 'lightning/actions';
+import init from '@salesforce/apex/buttonAssetCtl.init';
+import selecctRepairByFomatToday from '@salesforce/apex/buttonAssetCtl.selecctRepairByFomatToday';
+import selecctQISReportrByFomatToday from '@salesforce/apex/buttonAssetCtl.selecctQISReportrByFomatToday';
+import selectCASE from '@salesforce/apex/buttonAssetCtl.selectCASE';
+import selectNullvalue from '@salesforce/apex/buttonAssetCtl.selectNullvalue';
+import LightningConfirm from 'lightning/confirm';
+import {
+	NavigationMixin
+} from 'lightning/navigation';
+import {
+	encodeDefaultFieldValues
+} from 'lightning/pageReferenceUtils';
+import {
+	ShowToastEvent
+} from 'lightning/platformShowToastEvent';
+
+export default class lexCreateQISFromAsset extends NavigationMixin(LightningElement) {
+	@api recordId;
+	str;
+	IsLoading = true;
+	Id;
+	day1;
+	AssetMarkC;
+	AssetOwnerC;
+	InstallDate;
+	PostingDateC;
+	AssetDayC;
+	SerialNumber;
+	OrderNoC;
+	ProductIDC;
+	HospitalId;
+	HospitalC;
+	DepartmentClassId;
+	DepartmentClassC;
+	Name;
+	AccountId;
+	msg;
+	Old_Repair_Name = '';
+	Instration_date_consumable = null;
+	Customer_asset_or_loaner = '';
+	fomatToday;
+
+	@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.Id = result.Id;
+				this.day1 = result.day1;
+				this.AssetMarkC = result.AssetMarkC;
+				this.AssetOwnerC = result.AssetOwnerC;
+				this.InstallDate = result.InstallDate;
+				this.PostingDateC = result.PostingDateC;
+				this.AssetDayC = result.AssetDayC;
+				this.SerialNumber = result.SerialNumber;
+				this.OrderNoC = result.OrderNoC;
+				this.ProductIDC = result.ProductIDC;
+				this.HospitalId = result.HospitalId;
+				this.HospitalC = result.HospitalC;
+				this.DepartmentClassId = result.DepartmentClassId;
+				this.DepartmentClassC = result.DepartmentClassC;
+				this.Name = result.Name;
+				this.AccountId = result.AccountId;
+
+
+				this.CreateQISFromAsset();
+			}
+		}).catch(error => {
+			console.log(error);
+		})
+	}
+
+	// 鏂板缓鎺堣/鑰冩牳鎶ュ憡	
+	CreateQISFromAsset() {
+		this.fomatToday = this.day1;
+		selecctQISReportrByFomatToday({
+			AssetId: this.Id,
+			fomatToday: this.fomatToday
+		}).then(records => {
+			console.log(records);
+			if (this.AssetMarkC == null || this.AssetMarkC == undefined) {
+				this.ShowToastEvent('淇濇湁璁惧鏍囪涓虹┖锛岃鑱旂郴绠$悊鍛樿ˉ鍏呫��!', "error");
+				this.dispatchEvent(new CloseActionScreenEvent());
+				return;
+			}
+			if (records.length >= 1) {
+				this.handleConfirmClick01('璇风‘璁ゆ浠舵槸鍚﹀睘浜�10澶╁唴閲嶅鎶ュ憡锛屽鏋滄槸锛岃浣跨敤鍘烸IS閲岀殑澶嶅埗鍔熻兘閲嶆柊鎻愪氦銆�');
+			} else {
+				this.ss();
+			}
+		})
+	}
+
+	ss() {
+		selecctRepairByFomatToday({
+			AssetId: this.Id,
+			fomatToday: this.fomatToday
+		}).then(records2 => {
+			if (this.AssetMarkC == '鑰楁潗') {
+				selectCASE({
+					AssetOwnerC: this.AssetOwnerC
+				}).then(result => {
+					console.log(result);
+					this.Customer_asset_or_loaner = result;
+				})
+
+				selectNullvalue({
+					InstallDate: this.InstallDate,
+					PostingDateC: this.PostingDateC,
+					AssetDayC: this.AssetDayC
+				}).then(result => {
+					console.log(result);
+					this.Instration_date_consumable = result;
+
+				})
+			}
+			if (records2.length >= 1) {
+				this.Old_Repair_Name = records2[0].Name;
+			}
+			if (records2.length >= 1) {
+				this.handleConfirmClick02('璇风‘璁ゆ浠舵槸鍚﹀睘浜�10澶╁唴閲嶅鎶ュ憡锛屽鏋滄槸锛岄渶鎸夌収鍘熷厛鐨勭淮淇俊鎭~鍐欍��');
+			} else {
+				this.ll();
+			}
+		})
+	}
+
+	ll() {
+
+		const url = encodeDefaultFieldValues({
+			Name: "*",
+			Hospital__c: this.HospitalId,
+			Department_Class__c: this.DepartmentClassId,
+			nonyushohin__c: this.Id,
+			Generation_Source__c: "淇濇湁璁惧",
+			Lots_No__c: this.SerialNumber,
+			sell__c: this.Customer_asset_or_loaner,
+			Instration_date_consumable__c: this.Instration_date_consumable,
+			consumable__c: this.ProductIDC,
+			contract_number_ET__c: this.OrderNoC,
+			Hospital_Department__c: this.AccountId,
+			Old_Repair_Name__c: this.Old_Repair_Name
+		});
+		this[NavigationMixin.Navigate]({
+			type: 'standard__objectPage',
+			attributes: {
+				objectApiName: 'QIS_Report__c',
+				actionName: 'new'
+			},
+			state: {
+				nooverride: '1',
+				defaultFieldValues: url
+			}
+		});
+		this.dispatchEvent(new CloseActionScreenEvent());
+	}
+
+	async handleConfirmClick01(msg) {
+		const result = await LightningConfirm.open({
+			message: msg,
+			variant: 'headerless',
+			label: 'this is the aria-label value'
+		});
+		if (result) {
+			this.ss();
+		} else {
+			this.dispatchEvent(new CloseActionScreenEvent());
+		}
+	}
+
+	async handleConfirmClick02(msg) {
+		const result = await LightningConfirm.open({
+			message: msg,
+			variant: 'headerless',
+			label: 'this is the aria-label value'
+		});
+		if (result) {
+			this.ll();
+		} else {
+			this.dispatchEvent(new CloseActionScreenEvent());
+		}
+	}
+
+	ShowToastEvent(msg, type) {
+		const event = new ShowToastEvent({
+			title: '',
+			message: msg,
+			variant: type
+		});
+		this.dispatchEvent(event);
+	}
+
+	closeAction() {
+		location.reload();
+	}
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCreateQISFromAsset/lexCreateQISFromAsset.js-meta.xml b/force-app/main/default/lwc/lexCreateQISFromAsset/lexCreateQISFromAsset.js-meta.xml
new file mode 100644
index 0000000..3392981
--- /dev/null
+++ b/force-app/main/default/lwc/lexCreateQISFromAsset/lexCreateQISFromAsset.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>54.0</apiVersion>
+	<isExposed>true</isExposed>
+	<targets>
+		<target>lightning__RecordPage</target>
+		<target>lightning__AppPage</target>
+		<target>lightning__HomePage</target>
+		<target>lightning__RecordAction</target>
+	</targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexDiscountRequest/lexDiscountRequest.js b/force-app/main/default/lwc/lexDiscountRequest/lexDiscountRequest.js
index c014f30..1ee2859 100644
--- a/force-app/main/default/lwc/lexDiscountRequest/lexDiscountRequest.js
+++ b/force-app/main/default/lwc/lexDiscountRequest/lexDiscountRequest.js
@@ -17,7 +17,7 @@
     ShowToastEvent
 } from 'lightning/platformShowToastEvent';
 
-export default class LexDiscountRequest extends LightningElement {
+export default class lexDiscountRequest extends LightningElement {
     @api recordId;
     str;
     IsLoading = true;
diff --git a/force-app/main/default/lwc/lexOSHNogoods/lexOSHNogoods.js b/force-app/main/default/lwc/lexOSHNogoods/lexOSHNogoods.js
index e20f6c2..8094441 100644
--- a/force-app/main/default/lwc/lexOSHNogoods/lexOSHNogoods.js
+++ b/force-app/main/default/lwc/lexOSHNogoods/lexOSHNogoods.js
@@ -15,7 +15,7 @@
     ShowToastEvent
 } from 'lightning/platformShowToastEvent';
 
-export default class LexOSHNogoods extends LightningElement {
+export default class lexOSHNogoods extends LightningElement {
     @api recordId;
     str;
     IsLoading = true;
diff --git a/force-app/main/default/lwc/lexQISCloneButton/lexQISCloneButton.js b/force-app/main/default/lwc/lexQISCloneButton/lexQISCloneButton.js
new file mode 100644
index 0000000..85b9439
--- /dev/null
+++ b/force-app/main/default/lwc/lexQISCloneButton/lexQISCloneButton.js
@@ -0,0 +1,49 @@
+import { LightningElement, api } from 'lwc';
+import { NavigationMixin } from 'lightning/navigation';
+import { CloseActionScreenEvent } from 'lightning/actions';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import checkStatus from '@salesforce/apex/LexQISCloneButtonController.checkStatus'
+
+
+export default class lexQISCloneButton extends NavigationMixin(LightningElement) {
+    @api recordId;
+    
+    connectedCallback(){ 
+        window.clearTimeout(this.delayTimeout);
+        this.delayTimeout = setTimeout(() => {
+            this.handleClick();
+        }, 0);
+    }
+
+    handleClick(){
+        checkStatus({recordId: this.recordId})
+            .then(result => {
+                console.log('result:', result);
+                if (result) { 
+                    var pageurl = '/lightning/cmp/c__LexQISPIPLAura?c__isClone=true&c__recordId=' + this.recordId;
+                    this.navigate(pageurl); 
+                } else {
+                    const evt = new ShowToastEvent({
+                        title: 'Warning',
+                        message: '鐘舵�佷负鍙栨秷鐨凲IS鎵嶅彲浠ヨ澶嶅埗骞舵柊寤�',
+                        variant: 'warning',
+                        mode: 'dismissable'
+                    }); 
+                    this.dispatchEvent(evt);
+                }
+                this.dispatchEvent(new CloseActionScreenEvent());
+            }) 
+    }
+    navigate(pageurl) {
+        this[NavigationMixin.GenerateUrl]({
+            type: 'standard__webPage',
+            attributes: {
+                url: pageurl
+            }
+        }).then(generatedUrl => {
+            setTimeout(() => {
+                window.open(generatedUrl, '_self');
+            }, 0);
+        });
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexQISCloneButton/lexQISCloneButton.js-meta.xml b/force-app/main/default/lwc/lexQISCloneButton/lexQISCloneButton.js-meta.xml
new file mode 100644
index 0000000..4b8dbc3
--- /dev/null
+++ b/force-app/main/default/lwc/lexQISCloneButton/lexQISCloneButton.js-meta.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>57.0</apiVersion>
+    <isExposed>true</isExposed>
+     <targets>
+          <target>lightning__RecordAction</target>
+          <target>lightning__RecordPage</target>
+     </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexQISMBCrequestNew/lexQISMBCrequestNew.html b/force-app/main/default/lwc/lexQISMBCrequestNew/lexQISMBCrequestNew.html
index 87f391a..15a028e 100644
--- a/force-app/main/default/lwc/lexQISMBCrequestNew/lexQISMBCrequestNew.html
+++ b/force-app/main/default/lwc/lexQISMBCrequestNew/lexQISMBCrequestNew.html
@@ -1,6 +1,6 @@
 <template>
     <div class="exampleHolder" if:true={IsLoading}>
         <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
-        <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button>
+        <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button>  
     </div>
 </template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexQISMBCrequestNew/lexQISMBCrequestNew.js b/force-app/main/default/lwc/lexQISMBCrequestNew/lexQISMBCrequestNew.js
index e879bed..92c75d2 100644
--- a/force-app/main/default/lwc/lexQISMBCrequestNew/lexQISMBCrequestNew.js
+++ b/force-app/main/default/lwc/lexQISMBCrequestNew/lexQISMBCrequestNew.js
@@ -11,10 +11,16 @@
 } from 'lightning/actions';
 import init from '@salesforce/apex/buttonQISReportCtl.init';
 import {
+    NavigationMixin
+} from 'lightning/navigation';
+import {
+    encodeDefaultFieldValues
+} from 'lightning/pageReferenceUtils';
+import {
     ShowToastEvent
 } from 'lightning/platformShowToastEvent';
 
-export default class LexQISMBCrequestNew extends LightningElement {
+export default class lexQISMBCrequestNew extends NavigationMixin(LightningElement) {
     @api recordId;
     str;
     IsLoading = true;
@@ -46,6 +52,7 @@
 
                 this.QISMBCRequestNew();
                 this.dispatchEvent(new CloseActionScreenEvent());
+
             }
         }).catch(error => {
             console.log(error);
@@ -55,13 +62,27 @@
     // 鏂板缓QIS M-BC鐢宠.
     QISMBCRequestNew() {
         var status = this.QISStatusC;
-
         if (status != '瀹屾瘯' && status != '宸插洖绛�' && status != '鍙栨秷') {
             this.ShowToastEvent("QIS娌℃湁瀹℃壒瀹屾瘯鎴栧彇娑堬紝涓嶅彲浠ュ垱寤篞IS M-BC!", "error");
             return;
         }
-        var url = "a20/e?retURL=%2Fa20%2Fo&Name=" + this.Name + "&CF00N10000006Q4NP_lkid=" + this.Id;
-        window.top.location.href = url;
+        const url = encodeDefaultFieldValues({
+            Name: this.Name,
+            QIS_request_name__c: this.Id
+        });
+        this[NavigationMixin.Navigate]({
+            type: 'standard__objectPage',
+            attributes: {
+                objectApiName: 'QIS_M_BC__c',
+                actionName: 'new'
+            },
+            state: {
+                nooverride: '1',
+                defaultFieldValues: url
+            }
+        });
+        // var url = "a20/e?retURL=%2Fa20%2Fo&Name=" + this.Name + "&CF00N10000006Q4NP_lkid=" + this.Id;
+        // window.open(url);
     }
 
     ShowToastEvent(msg, type) {
diff --git a/force-app/main/default/lwc/lexQISMBCrequestNew/lexQISMBCrequestNew.js-meta.xml b/force-app/main/default/lwc/lexQISMBCrequestNew/lexQISMBCrequestNew.js-meta.xml
index 3392981..12078fb 100644
--- a/force-app/main/default/lwc/lexQISMBCrequestNew/lexQISMBCrequestNew.js-meta.xml
+++ b/force-app/main/default/lwc/lexQISMBCrequestNew/lexQISMBCrequestNew.js-meta.xml
@@ -7,5 +7,6 @@
 		<target>lightning__AppPage</target>
 		<target>lightning__HomePage</target>
 		<target>lightning__RecordAction</target>
+		<target>lightning__FlowScreen</target> 
 	</targets>
 </LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexRentalApplyDiscountApproval/lexRentalApplyDiscountApproval.js b/force-app/main/default/lwc/lexRentalApplyDiscountApproval/lexRentalApplyDiscountApproval.js
index b0cd788..4fb76fa 100644
--- a/force-app/main/default/lwc/lexRentalApplyDiscountApproval/lexRentalApplyDiscountApproval.js
+++ b/force-app/main/default/lwc/lexRentalApplyDiscountApproval/lexRentalApplyDiscountApproval.js
@@ -16,7 +16,7 @@
     ShowToastEvent
 } from 'lightning/platformShowToastEvent';
 
-export default class LexRentalApplyDiscountApproval extends LightningElement {
+export default class lexRentalApplyDiscountApproval extends LightningElement {
     @api recordId;
     str;
     IsLoading = true;
diff --git a/force-app/main/default/lwc/lexSCSubmit/lexSCSubmit.js b/force-app/main/default/lwc/lexSCSubmit/lexSCSubmit.js
index 905ac6c..2b53fb1 100644
--- a/force-app/main/default/lwc/lexSCSubmit/lexSCSubmit.js
+++ b/force-app/main/default/lwc/lexSCSubmit/lexSCSubmit.js
@@ -16,7 +16,7 @@
 } from 'lightning/platformShowToastEvent';
 import LightningConfirm from 'lightning/confirm';
 
-export default class LexSCSubmit extends LightningElement {
+export default class lexSCSubmit extends LightningElement {
     @api recordId;
     str;
     IsLoading = true;
diff --git a/force-app/main/default/lwc/lexSendQISToEtQ/lexSendQISToEtQ.html b/force-app/main/default/lwc/lexSendQISToEtQ/lexSendQISToEtQ.html
index aaa4cbd..62dbf20 100644
--- a/force-app/main/default/lwc/lexSendQISToEtQ/lexSendQISToEtQ.html
+++ b/force-app/main/default/lwc/lexSendQISToEtQ/lexSendQISToEtQ.html
@@ -2,5 +2,6 @@
     <div class="toReportHolder" if:true={IsLoading}>
         <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
         <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button>
+        <lightning-button onclick={handleConfirmClick} label="Open Confirm Modal"></lightning-button>
     </div>
 </template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSendQISToEtQ/lexSendQISToEtQ.js b/force-app/main/default/lwc/lexSendQISToEtQ/lexSendQISToEtQ.js
index 8cee80b..38d4eff 100644
--- a/force-app/main/default/lwc/lexSendQISToEtQ/lexSendQISToEtQ.js
+++ b/force-app/main/default/lwc/lexSendQISToEtQ/lexSendQISToEtQ.js
@@ -17,8 +17,9 @@
 import {
     ShowToastEvent
 } from 'lightning/platformShowToastEvent';
+import LightningConfirm from 'lightning/confirm';
 
-export default class LexSendQISToEtQ extends LightningElement {
+export default class lexSendQISToEtQ extends LightningElement {
     @api recordId;
     str;
     IsLoading = true;
@@ -32,6 +33,7 @@
     ETQUPLOADSTATUSC;
     AEDetermineResultC;
     profileName;
+    statu = '';
 
     @wire(CurrentPageReference)
     getStateParameters(currentPageReference) {
@@ -50,7 +52,6 @@
         }).then(result => {
             console.log(result);
             if (result != null) {
-                this.IsLoading = false;
                 this.Id = result.Id;
                 this.userId = result.userId;
                 this.profileId = result.profileId;
@@ -72,7 +73,6 @@
                         this.myReload();
                     }
                 })
-                this.dispatchEvent(new CloseActionScreenEvent());
             }
         }).catch(error => {
             console.log(error);
@@ -89,31 +89,51 @@
 
     // 鍙戦�丵IS鍒癊tQ	
     SendQISToEtQ() {
-        console.log(this.profileName);
-        var QId = this.Id;
-        var uid = this.userId;
-
         if (this.profileName != "2F7_OSH鎷呭綋" && this.profileName != "2F7_OSH璐ㄩ噺娉曡") {
-            alert("鎮ㄦ病鏈夊彂閫丵IS鍒癊tQ鐨勬潈闄愩��");
+            this.ShowToastEvent("鎮ㄦ病鏈夊彂閫丵IS鍒癊tQ鐨勬潈闄愩��", "error");
+            this.dispatchEvent(new CloseActionScreenEvent());
             return;
         }
         if (this.PAEDetermineC == undefined) {
-            alert("OCSM QARA鐨凱AE鍒ゅ畾鏄┖鐨勬椂鍊欙紝涓嶅彲浠ュ彂閫佸埌EtQ銆�");
+            this.ShowToastEvent("OCSM QARA鐨凱AE鍒ゅ畾鏄┖鐨勬椂鍊欙紝涓嶅彲浠ュ彂閫佸埌EtQ銆�", "error");
+            this.dispatchEvent(new CloseActionScreenEvent());
             return;
         }
         if (this.AEDetermineResultC == "nonAE" && this.PAEDetermineC == "nonPAE" && this.PAEDetermineACC == "nonPAE" && this.OCMJudgementC == undefined && this.QISFinalJudgementC == undefined) {
-            alert("nonAE骞秐onPAE鐨凲IS鍚屾鍒癊tQ鐨勬椂鍊欙紝妫�娴嬬粨璁�(OCSM)鏄繀濉殑銆備笉鍙互鍙戦�佸埌EtQ銆�");
+            this.ShowToastEvent("nonAE骞秐onPAE鐨凲IS鍚屾鍒癊tQ鐨勬椂鍊欙紝妫�娴嬬粨璁�(OCSM)鏄繀濉殑銆備笉鍙互鍙戦�佸埌EtQ銆�", "error");
+            this.dispatchEvent(new CloseActionScreenEvent());
             return;
         }
         if (this.ETQUPLOADSTATUSC == "3") {
-            if (!confirm("鏄惁娓呯┖EtQ鍚屾鐘舵�侊紝閲嶆柊鍚屾鏁版嵁锛�")) {
-                return;
-            }
+            this.handleConfirmClick("鏄惁娓呯┖EtQ鍚屾鐘舵�侊紝閲嶆柊鍚屾鏁版嵁锛�");
+        } else {
+            this.ll();
         }
+    }
 
-        var statu = '';
+    myReload() {
+        selectQISReportC({
+            QId: this.Id
+        }).then(record => {
+            console.log(record);
+            if (record[0].AsyncData__c == 'true' && record[0].ETQ_UPLOAD_STATUS__c != '3' || record[0].Complaint_Number__c != null) {
+                var btns = document.getElementsByName("sendqistoetq");
+                for (var i = 0; i < btns.length; i++) {
+                    btns[i].disabled = true;
+                    btns[i].className = 'btnDisabled';
+                }
+                this.ShowToastEvent('璇IS涔嬪墠宸茬粡鍙戦�佽繃浜�', "error");
+                this.dispatchEvent(new CloseActionScreenEvent());
+                return;
+            } else {
+                this.SendQISToEtQ();
+            }
+        })
+    }
+
+    ll() {
         if (this.AEDetermineResultC != undefined && this.PAEDetermineC != undefined && this.PAEDetermineACC == undefined) {
-            statu = "Q1";
+            this.statu = "Q1";
         } else if (
             (this.AEDetermineResultC != undefined && this.PAEDetermineC != undefined && this.PAEDetermineACC != "nonPAE" && this.PAEDetermineACC != undefined) ||
             (this.AEDetermineResultC == "nonAE" && this.PAEDetermineC == "nonPAE" && this.PAEDetermineACC == "nonPAE") &&
@@ -123,61 +143,43 @@
                     (this.QISFinalJudgementC == undefined || this.QISFinalJudgementC == "璐ㄩ噺闂")) ||
                 (this.OCMJudgementC == "闈炶川閲忛棶棰�" || this.OCMJudgementC == "鐜拌薄鏈彂鐜�") &&
                 this.QISFinalJudgementC == "璐ㄩ噺闂")) {
-            statu = "Q2";
+            this.statu = "Q2";
         } else if ((this.AEDetermineResultC == "nonAE" && this.PAEDetermineC == "nonPAE" && this.PAEDetermineACC == "nonPAE") &&
             ((this.OCMJudgementC == undefined || this.OCMJudgementC == "璐ㄩ噺闂" || this.OCMJudgementC == "璐ㄩ噺闂+闈炶川閲忛棶棰�") && this.QISFinalJudgementC == "闈炶川閲忛棶棰�") ||
             ((this.OCMJudgementC == "闈炶川閲忛棶棰�" || this.OCMJudgementC == "鐜拌薄鏈彂鐜�") && (this.QISFinalJudgementC == undefined || this.QISFinalJudgementC == "闈炶川閲忛棶棰�"))) {
-            statu = "Q3";
+            this.statu = "Q3";
         }
-        try {
-            updateQISReportC({
-                QId: QId,
-                uid: uid
-            })
+        updateQISReportC({
+            QId: this.Id,
+            uid: this.userId
+        })
 
-            var qisreports = new Array()
-            qisreports[0] = this.Id;
+        var qisreports = new Array()
+        qisreports[0] = this.Id;
 
-            var statuArr = new Array();
-            statuArr.push(statu);
+        var statuArr = new Array();
+        statuArr.push(this.statu);
 
-            sendToETQ({
-                iflog_Id: "",
-                rowDataSFDC: "",
-                repairIds: qisreports,
-                statu: statuArr[0]
-            }).then(result => {
-                alert(result);
-            })
-
-            alert("鍙戦�佹垚鍔�!")
-            var btns = document.getElementsByName("sendqistoetq");
-            for (var i = 0; i < btns.length; i++) {
-                btns[i].disabled = true;
-                btns[i].className = 'btnDisabled';
-            }
-            location.reload();
-        } catch (error) {
-            alert("鍙戦�丵IS鍒癊tQ澶辫触" + error.faultstring + ' code:' + error.faultcode)
-        }
-    }
-
-    myReload() {
-        selectQISReportC({
-            QId: this.Id
-        }).then(record => {
-        console.log(record);
-            if (record[0].AsyncData__c == 'true' && record[0].ETQ_UPLOAD_STATUS__c != '3' || record[0].Complaint_Number__c != null) {
-                var btns = document.getElementsByName("sendqistoetq");
-                for (var i = 0; i < btns.length; i++) {
-                    btns[i].disabled = true;
-                    btns[i].className = 'btnDisabled';
-                }
-                alert('璇IS涔嬪墠宸茬粡鍙戦�佽繃浜�')
+        sendToETQ({
+            iflog_Id: "",
+            rowDataSFDC: "",
+            repairIds: qisreports,
+            statu: statuArr[0]
+        }).then(result => {
+            if (result == "鍙戦�佹垚鍔�!") {
+                this.ShowToastEvent(result, "success");
+                this.dispatchEvent(new CloseActionScreenEvent());
             } else {
-                this.SendQISToEtQ();
+                this.ShowToastEvent("鍙戦�丵IS鍒癊tQ澶辫触," + result, "error");
+                this.dispatchEvent(new CloseActionScreenEvent());
             }
         })
+
+        var btns = document.getElementsByName("sendqistoetq");
+        for (var i = 0; i < btns.length; i++) {
+            btns[i].disabled = true;
+            btns[i].className = 'btnDisabled';
+        }
     }
 
     // 寮圭獥
@@ -189,4 +191,18 @@
         });
         this.dispatchEvent(event);
     }
+
+    async handleConfirmClick(msg) {
+        const result = await LightningConfirm.open({
+            message: msg,
+            variant: 'headerless',
+            label: 'this is the aria-label value'
+        });
+
+        if (result) {
+            this.ll();
+        } else {
+            this.dispatchEvent(new CloseActionScreenEvent());
+        }
+    }
 }
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexServiceCutPriceApply/lexServiceCutPriceApply.js b/force-app/main/default/lwc/lexServiceCutPriceApply/lexServiceCutPriceApply.js
index 33d2a1b..e9609e2 100644
--- a/force-app/main/default/lwc/lexServiceCutPriceApply/lexServiceCutPriceApply.js
+++ b/force-app/main/default/lwc/lexServiceCutPriceApply/lexServiceCutPriceApply.js
@@ -18,7 +18,7 @@
 } from 'lightning/platformShowToastEvent';
 
 
-export default class LexServiceCutPriceApply extends LightningElement {
+export default class lexServiceCutPriceApply extends LightningElement {
     @api recordId;
     str;
     IsLoading = true;

--
Gitblit v1.9.1