From 07390e2fcb4adf27c928335bf27ae7939c5a80ad Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期二, 23 五月 2023 11:28:12 +0800
Subject: [PATCH] bakcup20230523
---
force-app/main/default/lwc/lexOCSMNogoods/lexOCSMNogoods.js | 170 +++++++++++++++++++++++++++-----------------------------
1 files changed, 83 insertions(+), 87 deletions(-)
diff --git a/force-app/main/default/lwc/lexOCSMNogoods/lexOCSMNogoods.js b/force-app/main/default/lwc/lexOCSMNogoods/lexOCSMNogoods.js
index f7be272..d9f159f 100644
--- a/force-app/main/default/lwc/lexOCSMNogoods/lexOCSMNogoods.js
+++ b/force-app/main/default/lwc/lexOCSMNogoods/lexOCSMNogoods.js
@@ -1,101 +1,97 @@
-import { LightningElement,wire,track,api} from 'lwc';
-import { CurrentPageReference } from "lightning/navigation";
-import { CloseActionScreenEvent } from 'lightning/actions';
-import { NavigationMixin } from 'lightning/navigation';
-import { ShowToastEvent } from 'lightning/platformShowToastEvent';
-import { updateRecord } from 'lightning/uiRecordApi';
-import init from '@salesforce/apex/QISReportController.initForlexRCRecievedButton';
-import updateQis from '@salesforce/apex/QISReportController.updateQisForRCRecieved';
+import {
+ LightningElement,
+ wire,
+ api
+} from 'lwc';
+import {
+ CurrentPageReference
+} from "lightning/navigation";
+import {
+ CloseActionScreenEvent
+} from 'lightning/actions';
+import {
+ ShowToastEvent
+} from 'lightning/platformShowToastEvent';
+import init from '@salesforce/apex/buttonQISReportCtl.init';
+import updateQisForRCRecieved from '@salesforce/apex/buttonQISReportCtl.updateQisForRCRecieved';
export default class lexOCSMNogoods extends LightningElement {
- @api recordId;
- err;
- IsLoading = true;
- qisReportId;
- qisStatus;
- isAEProfile;
- isCNBuy;
- @wire(CurrentPageReference)
- getStateParameters(currentPageReference) {
- console.log(111);
- console.log(currentPageReference);
+ @api recordId;
+ str;
+ IsLoading = true;
+ Id;
+ userId;
+ QISStatusC;
+ isAEProfileC;
+ isCNBuyC;
+ isPAEProfileC;
- if (currentPageReference) {
- const urlValue = currentPageReference.state.recordId;
- if (urlValue) {
- let str = `${urlValue}`;
- console.log("str");
- console.log(str);
- this.recordId = str;
- }
- }
- }
+ @wire(CurrentPageReference)
+ getStateParameters(currentPageReference) {
+ if (currentPageReference) {
+ const urlValue = currentPageReference.state.recordId;
+ if (urlValue) {
+ let str = `${urlValue}`;
+ this.recordId = str;
+ }
+ }
+ }
- connectedCallback () {
+ connectedCallback() {
init({
recordId: this.recordId
}).then(result => {
- this.IsLoading = false;
- this.qisReportId = result.Id;
- this.qisStatus = result.qIStatus;
- this.isAEProfile = result.isAEProfile;
- this.isCNBuy = result.isCNBuy;
- console.log('this.qisStatus='+this.qisStatus);
- if (this.qisStatus!='RC妫�娴嬬敵璇�') {
- const evt = new ShowToastEvent({
- title : 'OCM鏈嶅姟鏈儴宸茬粡鏀跺埌瀹炵墿',
- message: '',
- variant: 'error'
- });
- this.dispatchEvent(evt);
+ console.log(result);
+ if (result != null) {
+ this.IsLoading = false;
+ this.Id = result.Id;
+ this.userId = result.userId;
+ this.QISStatusC = result.QISStatusC;
+ this.isAEProfileC = result.isAEProfileC;
+ this.isPAEProfileC = result.isPAEProfileC;
+ this.isCNBuyC = result.isCNBuyC;
+
+ this.OCSMNogoods();
this.dispatchEvent(new CloseActionScreenEvent());
- return;
- }else{
- if (this.isAEProfile == null || this.isPAEProfile == null || this.isCNBuy != 'true') {
- const evt = new ShowToastEvent({
- title : '瀹夊叏淇℃伅鏈垽瀹氾紝璇疯仈绯昏川閲忔硶瑙勯儴',
- message: '',
- variant: 'error'
- });
- this.dispatchEvent(evt);
- this.dispatchEvent(new CloseActionScreenEvent());
- return;
- }else{
- this.updateQisSubmit();
- }
- }
+ }
}).catch(error => {
- console.log('error='+error);
- }).finally(() => {
-
- });
+ console.log(error);
+ })
}
- updateRecordView(recordId) {
- updateRecord({fields: { Id: recordId }});
- }
-
- updateQisSubmit(){
- updateQis({
- recordId: this.recordId
- }).then(result =>{
-
- console.log('result'+result);
- this.err = result;
- if (result!='鎴愬姛') {
- const evt = new ShowToastEvent({
- title : '鏇存柊澶辫触',
- message: this.err,
- variant: 'error'
- });
- this.dispatchEvent(evt);
+ //OCSM鏃犲疄鐗╅�佽揪
+ OCSMNogoods() {
+ if (this.QISStatusC != 'RC妫�娴嬬敵璇�') {
+ this.ShowToastEvent("OCM鏈嶅姟鏈儴宸茬粡鏀跺埌瀹炵墿", "error");
+ } else {
+ if ((this.isAEProfileC == undefined || this.isPAEProfileC == undefined) && this.isCNBuyC != 'true') {
+ this.ShowToastEvent("瀹夊叏淇℃伅鏈垽瀹氾紝璇疯仈绯昏川閲忔硶瑙勯儴", "error");
+ var btns = document.getElementsByName('rc_recieved');
+ for (var i = 0; i < btns.length; i++) {
+ btns[i].disabled = true;
+ btns[i].className = 'btnDisabled';
+ }
+ } else {
+ updateQisForRCRecieved({
+ QId: this.Id,
+ uid: this.userId
+ }).then(result => {
+ console.log(result);
+ if (result.length > 0) {
+ alert(result);
}
- this.dispatchEvent(new CloseActionScreenEvent());
- this.updateRecordView(this.recordId);
- }).catch(error => {
- console.log('error='+error);
- }).finally(() => {
-
- });
+ })
+ }
+ }
+ }
+
+ // 寮圭獥
+ ShowToastEvent(msg, type) {
+ const event = new ShowToastEvent({
+ title: '',
+ message: msg,
+ variant: type
+ });
+ this.dispatchEvent(event);
}
}
\ No newline at end of file
--
Gitblit v1.9.1