From 428f42fab44b654c69fbc461513203830743d7de Mon Sep 17 00:00:00 2001
From: 黄千龙 <huangqianlong@prec-tech.com>
Date: 星期二, 18 七月 2023 10:55:50 +0800
Subject: [PATCH] hql20230718更新lightning按钮
---
force-app/main/default/lwc/lexOCMSubmit/lexOCMSubmit.js | 119 ++++++++++++++++++++++++++++++++---------------------------
1 files changed, 64 insertions(+), 55 deletions(-)
diff --git a/force-app/main/default/lwc/lexOCMSubmit/lexOCMSubmit.js b/force-app/main/default/lwc/lexOCMSubmit/lexOCMSubmit.js
index 2f48924..d8e78dc 100644
--- a/force-app/main/default/lwc/lexOCMSubmit/lexOCMSubmit.js
+++ b/force-app/main/default/lwc/lexOCMSubmit/lexOCMSubmit.js
@@ -5,17 +5,24 @@
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import init from '@salesforce/apex/QISReportController.initForOCMSubmitButton';
import updateQis from '@salesforce/apex/QISReportController.updateQisWithOCM';
-
+import { updateRecord } from 'lightning/uiRecordApi';
+/*
+ * @Description: 鎻愪氦
+ * @Author: hql
+ * @Date: 2023-07-12 09:45:19
+ * @LastEditTime: 2023-07-12 15:44:33
+ * @LastEditors:
+ */
export default class lexOCMSubmit extends LightningElement {
- @api recordId;
- IsLoading = true;
- qisReportId;
- QISInstallDate;
- qisStatus;
- contractnumber;
- isaohuiproduct;
+ @api recordId;
+ IsLoading = true;
+ qisReportId;
+ QISInstallDate;
+ qisStatus;
+ contractnumber;
+ isaohuiproduct;
err;
- @wire(CurrentPageReference)
+ @wire(CurrentPageReference)
getStateParameters(currentPageReference) {
console.log(111);
console.log(currentPageReference);
@@ -41,49 +48,49 @@
this.QISInstallDate = result.qISInstallDate;
this.contractnumber = result.contractnumber;
this.isaohuiproduct = result.isaohuiproduct;
- if (this.qisStatus!='鑽夋涓�' && this.qisStatus!='鍙栨秷') {
- const evt = new ShowToastEvent({
- title : '宸茬粡鎻愪氦',
- message: '',
+ if (this.qisStatus!='鑽夋涓�' && this.qisStatus!='鍙栨秷') {
+ const evt = new ShowToastEvent({
+ title : '',
+ message: '宸茬粡鎻愪氦',
variant: 'error'
});
this.dispatchEvent(evt);
this.dispatchEvent(new CloseActionScreenEvent());
- return;
- }else{
- if (this.qisStatus == '鍙栨秷') {
- const evt = new ShowToastEvent({
- title : '鍙栨秷鍚庣殑QIS涓嶅厑璁稿啀鎻愪氦锛屽鏋滈渶瑕佹彁浜よ鐐瑰嚮\"澶嶅埗\"鎸夐挳閲嶆柊鐢熸垚涓�涓猀IS',
- message: '',
+ return;
+ }else{
+ if (this.qisStatus == '鍙栨秷') {
+ const evt = new ShowToastEvent({
+ title : '',
+ message: '鍙栨秷鍚庣殑QIS涓嶅厑璁稿啀鎻愪氦锛屽鏋滈渶瑕佹彁浜よ鐐瑰嚮\"澶嶅埗\"鎸夐挳閲嶆柊鐢熸垚涓�涓猀IS',
variant: 'error'
});
this.dispatchEvent(evt);
- this.dispatchEvent(new CloseActionScreenEvent());
- return;
- }
- }
-
- if (this.QISInstallDate == null) {
- const evt = new ShowToastEvent({
- title : '銆愯喘涔版棩鏈�/瀹夎鏃ユ湡銆戜负绌烘椂涓嶈兘鎻愪氦鐢宠',
- message: '',
+ this.dispatchEvent(new CloseActionScreenEvent());
+ return;
+ }
+ }
+
+ if (this.QISInstallDate == null) {
+ const evt = new ShowToastEvent({
+ title : '',
+ message: '銆愯喘涔版棩鏈�/瀹夎鏃ユ湡銆戜负绌烘椂涓嶈兘鎻愪氦鐢宠',
variant: 'error'
});
this.dispatchEvent(evt);
- this.dispatchEvent(new CloseActionScreenEvent());
- return;
- }
+ this.dispatchEvent(new CloseActionScreenEvent());
+ return;
+ }
- if (this.contractnumber == null) {
- const evt = new ShowToastEvent({
- title : '銆愰攢鍞悎鍚屼笂璁㈠崟鍙风爜銆戜负绌烘椂涓嶈兘鎻愪氦鐢宠',
- message: '',
+ if (this.contractnumber == null) {
+ const evt = new ShowToastEvent({
+ title : '',
+ message: '銆愰攢鍞悎鍚屼笂璁㈠崟鍙风爜銆戜负绌烘椂涓嶈兘鎻愪氦鐢宠',
variant: 'error'
});
this.dispatchEvent(evt);
- this.dispatchEvent(new CloseActionScreenEvent());
- return;
- }
+ this.dispatchEvent(new CloseActionScreenEvent());
+ return;
+ }
LightningConfirm.open({
message: '涓�鏃︽彁浜ゆ璁板綍浠ュ緟鎵瑰噯锛屾牴鎹偍鐨勮缃偍鍙兘涓嶅啀鑳藉缂栬緫姝よ褰曟垨灏嗕粬浠庢壒鍑嗚繃绋嬩腑璋冨洖銆傛槸鍚︾户缁紵',
variant: 'headerless',
@@ -106,24 +113,26 @@
});
}
updateQisSubmit(){
- updateQis({
- recordId: this.recordId
- }).then(result =>{
- console.log('result'+result);
- if (result!='鎴愬姛') {
+ updateQis({
+ recordId: this.recordId
+ }).then(result =>{
+ console.log('result'+result);
+ if (result!='鎴愬姛') {
this.err = result;
- const evt = new ShowToastEvent({
- title : '鏇存柊澶辫触',
- message: this.err,
- variant: 'error'
- });
- this.dispatchEvent(evt);
- }
+ const evt = new ShowToastEvent({
+ title : '',
+ message: '鏇存柊澶辫触'+this.err,
+ variant: 'error'
+ });
+ this.dispatchEvent(evt);
+ updateRecord({fields: { Id: this.recordId }});
+ }
this.dispatchEvent(new CloseActionScreenEvent());
- }).catch(error => {
- console.log('error='+error);
- }).finally(() => {
-
- });
+ updateRecord({fields: { Id: this.recordId }});
+ }).catch(error => {
+ console.log('error='+error);
+ }).finally(() => {
+
+ });
}
}
\ No newline at end of file
--
Gitblit v1.9.1