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/lexRCSubmit/lexRCSubmit.js | 187 ++++++++++++++++++++++++++--------------------
1 files changed, 104 insertions(+), 83 deletions(-)
diff --git a/force-app/main/default/lwc/lexRCSubmit/lexRCSubmit.js b/force-app/main/default/lwc/lexRCSubmit/lexRCSubmit.js
index 24708a5..4da8f7c 100644
--- a/force-app/main/default/lwc/lexRCSubmit/lexRCSubmit.js
+++ b/force-app/main/default/lwc/lexRCSubmit/lexRCSubmit.js
@@ -1,28 +1,33 @@
import { LightningElement,wire,track,api} from 'lwc';
import { CurrentPageReference } from "lightning/navigation";
import { CloseActionScreenEvent } from 'lightning/actions';
-import { NavigationMixin } from 'lightning/navigation';
+import LightningConfirm from 'lightning/confirm';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import init from '@salesforce/apex/QISReportController.initForRCSubmitButton';
import updateQis from '@salesforce/apex/QISReportController.updateQisWithRC';
-import UserInfo_Owner from '@salesforce/apex/TaskFeedbackController.UserInfo_Owner';
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 lexRCSubmit extends LightningElement {
- @api recordId;
- IsLoading = true;
- qisReportId;
- qisStatus;
- OSHstaff;
- OSHstaffEmail;
- CancelQISReason;
- Rcid;
- RCinspectionDate;
- QISReplyDay;
- RCproblemnotfound;
- type;
+ @api recordId;
+ IsLoading = true;
+ qisReportId;
+ qisStatus;
+ OSHstaff;
+ OSHstaffEmail;
+ CancelQISReason;
+ Rcid;
+ RCinspectionDate;
+ QISReplyDay;
+ RCproblemnotfound;
+ type;
err;
- @wire(CurrentPageReference)
+ @wire(CurrentPageReference)
getStateParameters(currentPageReference) {
console.log(111);
console.log(currentPageReference);
@@ -52,7 +57,7 @@
this.RCinspectionDate = result.rCinspectionDate;
this.QISReplyDay = result.qISReplyDay;
this.RCproblemnotfound = result.rCproblemnotfound;
- if (this.qisStatus!='RC妫�娴嬩腑') {
+ if (this.qisStatus!='RC妫�娴嬩腑') {
const evt = new ShowToastEvent({
title : '宸茬粡鎻愪氦瀹℃壒',
message: '',
@@ -60,96 +65,112 @@
});
this.dispatchEvent(evt);
this.dispatchEvent(new CloseActionScreenEvent());
- return;
- }
- if (this.CancelQISReason!=null) {
- if (this.qisStatus == 'RC妫�娴嬬敵璇�') {
+ return;
+ }
+ console.log('this.RCproblemnotfound='+(this.QISReplyDay!=null && this.RCproblemnotfound));
+ if (this.CancelQISReason==null) {
+ if (this.qisStatus == 'RC妫�娴嬬敵璇�') {
const evt = new ShowToastEvent({
- title : '闇�瑕佸厛鐐瑰嚮锛籓CM鏈嶅姟鏈儴鏀跺埌瀹炵墿锛�',
- message: '',
+ title : '',
+ message: '闇�瑕佸厛鐐瑰嚮锛籓CM鏈嶅姟鏈儴鏀跺埌瀹炵墿锛�',
variant: 'error'
});
this.dispatchEvent(evt);
- this.dispatchEvent(new CloseActionScreenEvent());
- return;
- }
- if (this.Rcid ==null) {
- const evt = new ShowToastEvent({
- title : '鍒ゅ畾鎷呭綋蹇呴』濉啓',
- message: '',
- variant: 'error'
- });
- this.dispatchEvent(evt);
- this.dispatchEvent(new CloseActionScreenEvent());
- return;
- }
- if (this.RCinspectionDate == null) {
- const evt = new ShowToastEvent({
- title : 'OCM鏈嶅姟鏈儴杩樻病鏈夋娴嬪畬姣�',
- message: '',
- variant: 'error'
- });
- this.dispatchEvent(evt);
- this.dispatchEvent(new CloseActionScreenEvent());
- return;
- }
- if (this.QISReplyDay!=null && this.RCproblemnotfound) {
- const evt = new ShowToastEvent({
- title : '鏈�缁堝垽瀹氭椂锛岃鍙栨秷[鏁呴殰鏈彂鐜扮暀涓嬬户缁瀵焆骞堕�夋嫨[瀵瑰簲鏂规硶]',
- message: '',
- variant: 'error'
- });
- this.dispatchEvent(evt);
- this.dispatchEvent(new CloseActionScreenEvent());
- return;
- }
- if (confirm("涓�鏃︽彁浜ゆ璁板綍浠ュ緟鎵瑰噯锛屾牴鎹偍鐨勮缃偍鍙兘涓嶅啀鑳藉缂栬緫姝よ褰曟垨灏嗕粬浠庢壒鍑嗚繃绋嬩腑璋冨洖銆傛槸鍚︾户缁紵")) {
- this.type = '1';
- }else{
this.dispatchEvent(new CloseActionScreenEvent());
return;
}
- }else{
- if (confirm("涓�鏃︽彁浜ゅ叧闂璁板綍浠ュ緟鎵瑰噯锛屾牴鎹偍鐨勮缃偍鍙兘涓嶅啀鑳藉缂栬緫姝よ褰曟垨灏嗕粬浠庢壒鍑嗚繃绋嬩腑璋冨洖銆傛槸鍚︾户缁紵")) {
- this.type = '2';
- }else{
+ if (this.Rcid ==null) {
+ const evt = new ShowToastEvent({
+ title : '',
+ message: '鍒ゅ畾鎷呭綋蹇呴』濉啓',
+ variant: 'error'
+ });
+ this.dispatchEvent(evt);
this.dispatchEvent(new CloseActionScreenEvent());
return;
}
- }
- console.log('this.type='+this.type);
- // this.dispatchEvent(new CloseActionScreenEvent());
- this.updateQisSubmit();
+ if (this.RCinspectionDate == null) {
+ const evt = new ShowToastEvent({
+ title : '',
+ message: 'OCM鏈嶅姟鏈儴杩樻病鏈夋娴嬪畬姣�',
+ variant: 'error'
+ });
+ this.dispatchEvent(evt);
+ this.dispatchEvent(new CloseActionScreenEvent());
+ return;
+ }
+
+ if (this.QISReplyDay!=null && this.RCproblemnotfound) {
+ const evt = new ShowToastEvent({
+ title : '',
+ message: '鏈�缁堝垽瀹氭椂锛岃鍙栨秷[鏁呴殰鏈彂鐜扮暀涓嬬户缁瀵焆骞堕�夋嫨[瀵瑰簲鏂规硶]',
+ variant: 'error'
+ });
+ this.dispatchEvent(evt);
+ this.dispatchEvent(new CloseActionScreenEvent());
+ return;
+ }
+ LightningConfirm.open({
+ message: '涓�鏃︽彁浜ゆ璁板綍浠ュ緟鎵瑰噯锛屾牴鎹偍鐨勮缃偍鍙兘涓嶅啀鑳藉缂栬緫姝よ褰曟垨灏嗕粬浠庢壒鍑嗚繃绋嬩腑璋冨洖銆傛槸鍚︾户缁紵',
+ variant: 'headerless',
+ label: 'this is the aria-label value',
+ }).then(res=>{
+ if(res) {
+ this.type = '1';
+ console.log('this.type='+this.type);
+ this.updateQisSubmit();
+ }else{
+ this.dispatchEvent(new CloseActionScreenEvent());
+ return;
+ }
+
+ });
+ }else{
+ LightningConfirm.open({
+ message: '涓�鏃︽彁浜ゆ璁板綍浠ュ緟鎵瑰噯锛屾牴鎹偍鐨勮缃偍鍙兘涓嶅啀鑳藉缂栬緫姝よ褰曟垨灏嗕粬浠庢壒鍑嗚繃绋嬩腑璋冨洖銆傛槸鍚︾户缁紵',
+ variant: 'headerless',
+ label: 'this is the aria-label value',
+ }).then(res=>{
+ if(res) {
+ this.type = '2';
+ console.log('this.type='+this.type);
+ this.updateQisSubmit();
+ }else{
+ this.dispatchEvent(new CloseActionScreenEvent());
+ return;
+ }
+
+ });
+ }
+
+ // this.dispatchEvent(new CloseActionScreenEvent());
+
}).catch(error => {
console.log('error='+error);
}).finally(() => {
});
}
-
- updateRecordView(recordId) {
- updateRecord({fields: { Id: recordId }});
- }
-
updateQisSubmit(){
- updateQis({
- recordId: this.recordId,
- type: this.type,
- oldQIStatus: this.qisStatus
- }).then(result =>{
- console.log('result'+result);
+ updateQis({
+ recordId: this.recordId,
+ type: this.type,
+ oldQIStatus: this.qisStatus
+ }).then(result =>{
+ console.log('result'+result);
this.err = result;
- if (result!='鎴愬姛') {
+ if (result!='鎴愬姛') {
const evt = new ShowToastEvent({
- title : '鏇存柊澶辫触',
- message: this.err,
+ title : '',
+ message: '鏇存柊澶辫触'+this.err,
variant: 'error'
});
this.dispatchEvent(evt);
+ updateRecord({fields: { Id: this.recordId }});
}
+ updateRecord({fields: { Id: this.recordId }});
this.dispatchEvent(new CloseActionScreenEvent());
- this.updateRecordView(this.recordId);
- }).catch(error => {
+ }).catch(error => {
console.log('error='+error);
}).finally(() => {
--
Gitblit v1.9.1