From 6fa942d0e7a5c6f3524c0d60b7b550ae7f137ec5 Mon Sep 17 00:00:00 2001
From: twysparks <twysparks@163.com>
Date: 星期三, 29 三月 2023 15:49:33 +0800
Subject: [PATCH] tt
---
force-app/main/default/lwc/lexUploadToSap/lexUploadToSap.html | 5
force-app/main/default/lwc/lexSubmitForApproval/lexSubmitForApproval.js-meta.xml | 11 +
force-app/main/default/lwc/lexInsPageBtn/lexInsPageBtn.html | 5
force-app/main/default/lwc/lexCreateReportMaintenanceContract/lexCreateReportMaintenanceContract.js | 68 ++++++
force-app/main/default/lwc/lexSubmitForApproval/lexSubmitForApproval.js | 70 ++++++
force-app/main/default/lwc/lexUploadToSap/lexUploadToSap.js | 167 +++++++++++++++
force-app/main/default/lwc/lexCopyPIInspectionReport/lexCopyPIInspectionReport.js | 56 +++++
force-app/main/default/lwc/lexCreateReportMaintenanceContract/lexCreateReportMaintenanceContract.html | 5
force-app/main/default/lwc/lexInsPageBtn/lexInsPageBtn.js | 61 +++++
force-app/main/default/lwc/lexPreContractSubmit/lexPreContractSubmit.js | 102 +++++++++
force-app/main/default/lwc/lexPreContractSubmit/lexPreContractSubmit.js-meta.xml | 11 +
force-app/main/default/lwc/lexSubmitForApproval/lexSubmitForApproval.html | 5
force-app/main/default/lwc/lexCreateReportMaintenanceContract/lexCreateReportMaintenanceContract.js-meta.xml | 11 +
force-app/main/default/lwc/lexInsPageBtn/lexInsPageBtn.js-meta.xml | 11 +
force-app/main/default/lwc/lexUploadToSap/lexUploadToSap.js-meta.xml | 11 +
force-app/main/default/lwc/lexPreContractSubmit/lexPreContractSubmit.html | 5
force-app/main/default/lwc/lexCopyPIInspectionReport/lexCopyPIInspectionReport.html | 5
force-app/main/default/lwc/lexCopyPIInspectionReport/lexCopyPIInspectionReport.js-meta.xml | 11 +
18 files changed, 620 insertions(+), 0 deletions(-)
diff --git a/force-app/main/default/lwc/lexCopyPIInspectionReport/lexCopyPIInspectionReport.html b/force-app/main/default/lwc/lexCopyPIInspectionReport/lexCopyPIInspectionReport.html
new file mode 100644
index 0000000..d044dbb
--- /dev/null
+++ b/force-app/main/default/lwc/lexCopyPIInspectionReport/lexCopyPIInspectionReport.html
@@ -0,0 +1,5 @@
+<template>
+ <div class="exampleHolder" if:true={IsLoading}>
+ <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+ </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCopyPIInspectionReport/lexCopyPIInspectionReport.js b/force-app/main/default/lwc/lexCopyPIInspectionReport/lexCopyPIInspectionReport.js
new file mode 100644
index 0000000..afc128d
--- /dev/null
+++ b/force-app/main/default/lwc/lexCopyPIInspectionReport/lexCopyPIInspectionReport.js
@@ -0,0 +1,56 @@
+import {
+ LightningElement,
+ wire,
+ api
+} from 'lwc';
+import {
+ CurrentPageReference
+} from "lightning/navigation";
+import {
+ CloseActionScreenEvent
+} from 'lightning/actions';
+
+import init from '@salesforce/apex/otherButtonSpotInspectionReportCtl.init';
+
+export default class LexCopyPIInspectionReport extends LightningElement {
+ @api recordId;
+ str;
+ IsLoading = true;
+ Id;
+ RecordTypeId;
+
+ @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.RecordTypeId = result.RecordTypeId;
+
+ this.CopyPI();
+ this.dispatchEvent(new CloseActionScreenEvent());
+ }
+ }).catch(error => {
+ console.log(error);
+ }).finally(() => {
+
+ });
+ }
+
+ CopyPI() {
+ window.location.href = '/' + this.Id + '/e?newclone=1';
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCopyPIInspectionReport/lexCopyPIInspectionReport.js-meta.xml b/force-app/main/default/lwc/lexCopyPIInspectionReport/lexCopyPIInspectionReport.js-meta.xml
new file mode 100644
index 0000000..3392981
--- /dev/null
+++ b/force-app/main/default/lwc/lexCopyPIInspectionReport/lexCopyPIInspectionReport.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/lexCreateReportMaintenanceContract/lexCreateReportMaintenanceContract.html b/force-app/main/default/lwc/lexCreateReportMaintenanceContract/lexCreateReportMaintenanceContract.html
new file mode 100644
index 0000000..d044dbb
--- /dev/null
+++ b/force-app/main/default/lwc/lexCreateReportMaintenanceContract/lexCreateReportMaintenanceContract.html
@@ -0,0 +1,5 @@
+<template>
+ <div class="exampleHolder" if:true={IsLoading}>
+ <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+ </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCreateReportMaintenanceContract/lexCreateReportMaintenanceContract.js b/force-app/main/default/lwc/lexCreateReportMaintenanceContract/lexCreateReportMaintenanceContract.js
new file mode 100644
index 0000000..9c7fadd
--- /dev/null
+++ b/force-app/main/default/lwc/lexCreateReportMaintenanceContract/lexCreateReportMaintenanceContract.js
@@ -0,0 +1,68 @@
+import {
+ LightningElement,
+ wire,
+ api
+} from 'lwc';
+import {
+ CurrentPageReference
+} from "lightning/navigation";
+import {
+ CloseActionScreenEvent
+} from 'lightning/actions';
+import init from '@salesforce/apex/otherButtonMaintenanceContractCtl.init';
+
+export default class LexCreateReportMaintenanceContract extends LightningElement {
+ @api recordId;
+ str;
+ IsLoading = true;
+ Id;
+ RecordTypeDeveloperNameC;
+ EstimateTargetC;
+
+ @wire(CurrentPageReference)
+ getStateParameters(currentPageReference) {
+ if (currentPageReference) {
+ const urlValue = currentPageReference.state.recordId;
+ if (urlValue) {
+ let str = `${urlValue}`;
+ this.recordId = str;
+ }
+ }
+ }
+
+ connectedCallback() {
+ console.log(this.recordId);
+ init({
+ recordId: this.recordId
+ }).then(result => {
+ console.log(result);
+ if (result != null) {
+ this.IsLoading = false;
+ this.Id = result.Id;
+ this.RecordTypeDeveloperNameC = result.RecordTypeDeveloperNameC;
+ this.EstimateTargetC = result.EstimateTargetC;
+
+ this.CreateReport();
+ this.dispatchEvent(new CloseActionScreenEvent());
+ }
+ }).catch(error => {
+ console.log(error);
+ }).finally(() => {
+
+ });
+ }
+
+ CreateReport() {
+ var MaintenanceContractId = this.Id;
+ var RecordTypeName = this.RecordTypeDeveloperNameC;
+ var EstimateTarget = this.EstimateTargetC;
+
+ var url = '';
+ if (EstimateTarget == "缁忛攢鍟�" && (RecordTypeName == "NewMaintenance_Contract" || RecordTypeName == "VM_Contract")) {
+ url = "/apex/MoreMaintenanceContractPop?Id=" + MaintenanceContractId + "&RecordTypeName=" + RecordTypeName;
+ } else {
+ url = "http://powerbi.olympus.com.cn/Home/Login";
+ }
+ window.open(url, '_bank');
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCreateReportMaintenanceContract/lexCreateReportMaintenanceContract.js-meta.xml b/force-app/main/default/lwc/lexCreateReportMaintenanceContract/lexCreateReportMaintenanceContract.js-meta.xml
new file mode 100644
index 0000000..3392981
--- /dev/null
+++ b/force-app/main/default/lwc/lexCreateReportMaintenanceContract/lexCreateReportMaintenanceContract.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/lexInsPageBtn/lexInsPageBtn.html b/force-app/main/default/lwc/lexInsPageBtn/lexInsPageBtn.html
new file mode 100644
index 0000000..d044dbb
--- /dev/null
+++ b/force-app/main/default/lwc/lexInsPageBtn/lexInsPageBtn.html
@@ -0,0 +1,5 @@
+<template>
+ <div class="exampleHolder" if:true={IsLoading}>
+ <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+ </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexInsPageBtn/lexInsPageBtn.js b/force-app/main/default/lwc/lexInsPageBtn/lexInsPageBtn.js
new file mode 100644
index 0000000..38e1d2b
--- /dev/null
+++ b/force-app/main/default/lwc/lexInsPageBtn/lexInsPageBtn.js
@@ -0,0 +1,61 @@
+import {
+ LightningElement,
+ wire,
+ api
+} from 'lwc';
+import {
+ CurrentPageReference
+} from "lightning/navigation";
+import {
+ CloseActionScreenEvent
+} from 'lightning/actions';
+import init from '@salesforce/apex/otherButtonSpotInspectionReportCtl.init';
+
+export default class LexInsPageBtn extends LightningElement {
+ @api recordId;
+ str;
+ IsLoading = true;
+ Id;
+ RecordTypeId;
+
+ @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.RecordTypeId = result.RecordTypeId;
+
+ this.insPageBtn();
+ this.dispatchEvent(new CloseActionScreenEvent());
+ }
+ }).catch(error => {
+ console.log(error);
+ }).finally(() => {
+
+ });
+ }
+
+ insPageBtn() {
+ var url;
+ if (this.RecordTypeId == '01210000000aLii') {
+ url = '/apex/OFSInsReportLayoutForVm';
+ } else {
+ url = '/apex/OFSInsReportLayout';
+ }
+ window.open(url += '?id=' + this.Id)
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexInsPageBtn/lexInsPageBtn.js-meta.xml b/force-app/main/default/lwc/lexInsPageBtn/lexInsPageBtn.js-meta.xml
new file mode 100644
index 0000000..3392981
--- /dev/null
+++ b/force-app/main/default/lwc/lexInsPageBtn/lexInsPageBtn.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/lexPreContractSubmit/lexPreContractSubmit.html b/force-app/main/default/lwc/lexPreContractSubmit/lexPreContractSubmit.html
new file mode 100644
index 0000000..d044dbb
--- /dev/null
+++ b/force-app/main/default/lwc/lexPreContractSubmit/lexPreContractSubmit.html
@@ -0,0 +1,5 @@
+<template>
+ <div class="exampleHolder" if:true={IsLoading}>
+ <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+ </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexPreContractSubmit/lexPreContractSubmit.js b/force-app/main/default/lwc/lexPreContractSubmit/lexPreContractSubmit.js
new file mode 100644
index 0000000..ed6e02c
--- /dev/null
+++ b/force-app/main/default/lwc/lexPreContractSubmit/lexPreContractSubmit.js
@@ -0,0 +1,102 @@
+import {
+ LightningElement,
+ wire,
+ api
+} from 'lwc';
+import {
+ CurrentPageReference
+} from "lightning/navigation";
+import {
+ CloseActionScreenEvent
+} from 'lightning/actions';
+import init from '@salesforce/apex/otherButtonMaintenanceContractCtl.init';
+import processResults from '@salesforce/apex/otherButtonMaintenanceContractCtl.processResults';
+
+export default class LexPreContractSubmit extends LightningElement {
+ @api recordId;
+ str;
+ IsLoading = true;
+ oldIsRecognitionModelC;
+ uploadToRMTimeC;
+ IsRecognitionModelTrueC;
+ MCApprovalStatusC;
+ ContractprintCompletedC;
+ Id;
+
+ @wire(CurrentPageReference)
+ getStateParameters(currentPageReference) {
+ if (currentPageReference) {
+ const urlValue = currentPageReference.state.recordId;
+ if (urlValue) {
+ let str = `${urlValue}`;
+ this.recordId = str;
+ }
+ }
+ }
+
+ connectedCallback() {
+ console.log(this.recordId);
+ init({
+ recordId: this.recordId
+ }).then(result => {
+ console.log(result);
+ if (result != null) {
+ this.IsLoading = false;
+ this.oldIsRecognitionModelC = result.oldIsRecognitionModelC;
+ this.uploadToRMTimeC = result.uploadToRMTimeC;
+ this.IsRecognitionModelTrueC = result.IsRecognitionModelTrueC;
+ this.MCApprovalStatusC = result.MCApprovalStatusC;
+ this.ContractprintCompletedC = result.ContractprintCompletedC;
+ this.Id = result.Id;
+
+ this.preContractSubmit();
+ this.dispatchEvent(new CloseActionScreenEvent());
+ }
+ }).catch(error => {
+ console.log(error);
+ }).finally(() => {
+
+ });
+ }
+
+ preContractSubmit() {
+ //update wangweipeng 2022/01/04 start
+ //鍒ゆ柇鏄惁闇�瑕佸厛涓婁紶璁ゆ鍚堝悓鍚楋紝濡傛灉闇�瑕侀偅涔堝垽鏂粬鏄惁宸茬粡涓婁紶锛屽鏋滀笂浼狅紝閭d箞鍒ゆ柇浠栨槸鍚﹀畬鎴愯娆撅紝濡傛灉閮芥弧瓒筹紝閭d箞鎵嶈兘姝e父璧版帴鍙d笂浼燬AP
+ //鍒ゆ柇鏄娆惧悎鍚屽悧
+ if (this.oldIsRecognitionModelC) {
+ if (this.uploadToRMTimeC == null) { //鍒ゆ柇鏄惁宸茬粡涓婁紶璁ゆ鍚堝悓
+ alert('褰撳墠缁翠慨鍚堝悓鐨勭粡閿�鍟嗘槸鍏堟瀵硅薄锛岄渶瑕佸厛銆愪笂浼犺娆惧悎鍚屻�戯紝鐒跺悗瀹屾垚璁ゆ浠ュ悗鎵嶈兘澶嶆牳銆�');
+ return;
+ } else {
+ //鍒ゆ柇鏄惁瀹屾垚璁ゆ
+ if (!this.IsRecognitionModelTrueC) {
+ alert('褰撳墠缁翠慨鍚堝悓娌℃湁瀹屾垚璁ゆ锛屼笉鑳借繘琛屽鏍搞��');
+ return;
+ }
+ }
+ }
+ //update wangweipeng 2022/01/04 end
+ var status = this.MCApprovalStatusC;
+ if (status != 'Draft' && status != 'Reject' && status != undefined) {
+ alert('澶嶆牳宸茬粡鎻愪氦锛岃纭鐘舵�併��');
+ return;
+ }
+ var con_no = this.ContractprintCompletedC;
+ if (con_no == '') {
+ alert('鍚堝悓鐩栫珷瀹屾瘯涓虹┖锛屼笉鑳芥彁浜ゅ悎鍚屽鏍哥敵璇枫��');
+ return;
+ }
+ if (!confirm("涓�鏃︽彁浜ゆ璁板綍浠ュ緟鎵瑰噯锛屾牴鎹偍鐨勮缃偍鍙兘涓嶅啀鑳藉缂栬緫姝よ褰曟垨灏嗕粬浠庢壒鍑嗚繃绋嬩腑璋冨洖銆傛槸鍚︾户缁紵")) {
+ return;
+ }
+ processResults({
+ recordId: this.recordId
+ }).catch(error => {
+ if (error.body.pageErrors[0] != null) {
+ var errmsg = error.body.pageErrors[0].message.toString();
+ alert(errmsg + '_sys');
+ return;
+ }
+ })
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexPreContractSubmit/lexPreContractSubmit.js-meta.xml b/force-app/main/default/lwc/lexPreContractSubmit/lexPreContractSubmit.js-meta.xml
new file mode 100644
index 0000000..3392981
--- /dev/null
+++ b/force-app/main/default/lwc/lexPreContractSubmit/lexPreContractSubmit.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/lexSubmitForApproval/lexSubmitForApproval.html b/force-app/main/default/lwc/lexSubmitForApproval/lexSubmitForApproval.html
new file mode 100644
index 0000000..d044dbb
--- /dev/null
+++ b/force-app/main/default/lwc/lexSubmitForApproval/lexSubmitForApproval.html
@@ -0,0 +1,5 @@
+<template>
+ <div class="exampleHolder" if:true={IsLoading}>
+ <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+ </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSubmitForApproval/lexSubmitForApproval.js b/force-app/main/default/lwc/lexSubmitForApproval/lexSubmitForApproval.js
new file mode 100644
index 0000000..a601b08
--- /dev/null
+++ b/force-app/main/default/lwc/lexSubmitForApproval/lexSubmitForApproval.js
@@ -0,0 +1,70 @@
+import {
+ LightningElement,
+ wire,
+ api
+} from 'lwc';
+import {
+ CurrentPageReference
+} from "lightning/navigation";
+import {
+ CloseActionScreenEvent
+} from 'lightning/actions';
+import init from '@salesforce/apex/otherButtonMaintenanceContractCtl.init';
+import selectRecords from '@salesforce/apex/otherButtonMaintenanceContractCtl.selectRecords';
+
+export default class LexSubmitForApproval extends LightningElement {
+ @api recordId;
+ str;
+ IsLoading = true;
+ Id;
+
+ @wire(CurrentPageReference)
+ getStateParameters(currentPageReference) {
+ if (currentPageReference) {
+ const urlValue = currentPageReference.state.recordId;
+ if (urlValue) {
+ let str = `${urlValue}`;
+ this.recordId = str;
+ }
+ }
+ }
+
+ connectedCallback() {
+ console.log(this.recordId);
+ init({
+ recordId: this.recordId
+ }).then(result => {
+ console.log(result);
+ if (result != null) {
+ this.IsLoading = false;
+ this.Id = result.Id;
+
+ this.SubmitForApproval();
+ this.dispatchEvent(new CloseActionScreenEvent());
+ }
+ }).catch(error => {
+ console.log(error);
+ }).finally(() => {
+
+ });
+ }
+
+ SubmitForApproval() {
+ var url = '';
+ selectRecords({
+ recordId: this.Id
+ }).then(result => {
+ console.log(result);
+ if (result.length > 0) {
+ url = "/apex/SubmitForApprovalPage?id=" + result[0].Id;
+ } else {
+ url = "/apex/SubmitForApprovalPage?mcId=" + this.Id;
+ }
+ window.open(url, '', 'height=350, width=600, top=200, left=350,location=no');
+ }).catch(error => {
+ console.log("error");
+ }).finally(() => {
+
+ });
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSubmitForApproval/lexSubmitForApproval.js-meta.xml b/force-app/main/default/lwc/lexSubmitForApproval/lexSubmitForApproval.js-meta.xml
new file mode 100644
index 0000000..3392981
--- /dev/null
+++ b/force-app/main/default/lwc/lexSubmitForApproval/lexSubmitForApproval.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/lexUploadToSap/lexUploadToSap.html b/force-app/main/default/lwc/lexUploadToSap/lexUploadToSap.html
new file mode 100644
index 0000000..d044dbb
--- /dev/null
+++ b/force-app/main/default/lwc/lexUploadToSap/lexUploadToSap.html
@@ -0,0 +1,5 @@
+<template>
+ <div class="exampleHolder" if:true={IsLoading}>
+ <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+ </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexUploadToSap/lexUploadToSap.js b/force-app/main/default/lwc/lexUploadToSap/lexUploadToSap.js
new file mode 100644
index 0000000..82f0cd4
--- /dev/null
+++ b/force-app/main/default/lwc/lexUploadToSap/lexUploadToSap.js
@@ -0,0 +1,167 @@
+import {
+ LightningElement,
+ wire,
+ api
+} from 'lwc';
+import {
+ CurrentPageReference
+} from "lightning/navigation";
+import {
+ CloseActionScreenEvent
+} from 'lightning/actions';
+import init from '@salesforce/apex/otherButtonMaintenanceContractCtl.init';
+import updateColunm from '@salesforce/apex/MaintenanceContractSetColunmWebService.updateColunm';
+import updateFirstContract from '@salesforce/apex/updateFirstServiceContractWebService.updateFirstContract';
+import Check_plan from '@salesforce/apex/MaintenanceContractWebService.Check_plan';
+import up2sap from '@salesforce/apex/MaintenanceContractWebService.up2sap';
+export default class LexUploadToSap extends LightningElement {
+ @api recordId;
+ str;
+ IsLoading = true;
+ MCApprovalStatusC;
+ MaintenanceContractNoC;
+ uploadToSapTimeC;
+ oldIsRecognitionModelC;
+ uploadToRMTimeC;
+ IsRecognitionModelTrueC;
+ Id;
+ URFContractFC;
+ urfFlag;
+ rtn1;
+ rtn;
+ @wire(CurrentPageReference)
+ getStateParameters(currentPageReference) {
+ if (currentPageReference) {
+ const urlValue = currentPageReference.state.recordId;
+ if (urlValue) {
+ let str = `${urlValue}`;
+ this.recordId = str;
+ }
+ }
+ }
+
+ connectedCallback() {
+ console.log(this.recordId);
+ init({
+ recordId: this.recordId
+ }).then(result => {
+ console.log(result);
+ if (result != null) {
+ this.IsLoading = false;
+ this.MCApprovalStatusC = result.MCApprovalStatusC;
+ this.MaintenanceContractNoC = result.MaintenanceContractNoC;
+ this.uploadToSapTimeC = result.uploadToSapTimeC;
+ this.oldIsRecognitionModelC = result.oldIsRecognitionModelC;
+ this.uploadToRMTimeC = result.uploadToRMTimeC;
+ this.IsRecognitionModelTrueC = result.IsRecognitionModelTrueC;
+ this.Id = result.Id;
+ this.URFContractFC = result.URFContractFC;
+
+ this.uploadToSap();
+ this.dispatchEvent(new CloseActionScreenEvent());
+ }
+ }).catch(error => {
+ console.log(error);
+ }).finally(() => {
+
+ });
+ }
+
+ uploadToSap() {
+ if (this.MCApprovalStatusC != 'Pass') {
+ alert("鍚堝悓澶嶆牳鎵瑰噯鍚庢墠鍙互涓婁紶SAP銆�");
+ } else if (this.MaintenanceContractNoC == undefined) {
+ alert('缁翠慨鍚堝悓绠$悊缂栫爜涓虹┖锛屼笉鑳戒笂浼燬AP銆�');
+ } else if (this.uploadToSapTimeC != undefined) {
+ alert('宸茬粡涓婁紶SAP锛屼笉鑳介噸澶嶄笂浼犮��');
+ } else {
+ //update wangweipeng 2021/11/20 start
+ //鍒ゆ柇鏄惁闇�瑕佸厛涓婁紶璁ゆ鍚堝悓鍚楋紝濡傛灉闇�瑕侀偅涔堝垽鏂粬鏄惁宸茬粡涓婁紶锛屽鏋滀笂浼狅紝閭d箞鍒ゆ柇浠栨槸鍚﹀畬鎴愯娆撅紝濡傛灉閮芥弧瓒筹紝閭d箞鎵嶈兘姝e父璧版帴鍙d笂浼燬AP
+ //鍒ゆ柇鏄娆惧悎鍚屽悧
+ if (this.oldIsRecognitionModelC) {
+ //鍒ゆ柇鏄惁宸茬粡涓婁紶璁ゆ鍚堝悓
+ if (this.uploadToRMTimeC == undefined) {
+ console.log("a");
+ alert('褰撳墠缁翠慨鍚堝悓鐨勭粡閿�鍟嗘槸鍏堟瀵硅薄锛岄渶瑕佸厛銆愪笂浼犺娆惧悎鍚屻�戯紝鐒跺悗瀹屾垚璁ゆ浠ュ悗鎵嶈兘涓婁紶SAP銆�');
+ return;
+ } else {
+ //鍒ゆ柇鏄惁瀹屾垚璁ゆ
+ if (!this.IsRecognitionModelTrueC) {
+ console.log("b");
+ alert('褰撳墠缁翠慨鍚堝悓娌℃湁瀹屾垚璁ゆ锛屼笉鑳戒笂浼燬AP銆�');
+ return;
+ }
+ }
+ }
+ //update wangweipeng 2021/11/20 end
+ // sforce.connection.sessionId = this.api.sessionId;
+ // var mcid = this.Id;
+ // var result = sforce.apex.execute("MaintenanceContractSetColunmWebService", "updateColunm", {
+ // mcid: mcid
+ // });
+ updateColunm({
+ mcid: this.Id
+ }).then(result=>{
+ console.log("updateColunm" + result);
+ if (result != '1') {
+ console.log("c");
+ alert('涓婁紶SAP澶辫触,鍥犱负 鏉ュ勾鍚堝悓鐩稿叧淇℃伅淇敼澶辫触');
+ //location.href = "/" + this.Id;
+ }
+ });
+
+ //棣栨鏈嶅姟鍚堝悓璧嬪��
+ // var updateResult = sforce.apex.execute("updateFirstServiceContractWebService", "updateFirstContract", {
+ // mcid: mcid
+ // });
+ updateFirstContract({
+ mcid: this.Id
+ }).then(result=>{
+ console.log("updateFirstContract:" + result);
+ if (result != '1') {
+ alert(result);
+ }
+ });
+
+ //URF闄愭鍚堝悓2鏈� LY 20220811 start
+ this.urfFlag = this.URFContractFC;
+ this.rtn1 = '1';
+ this.rtn = '1';
+ if (this.urfFlag == 'false') {
+ // rtn1 = sforce.apex.execute("MaintenanceContractWebService", "Check_plan", {
+ // mcidList: mcid
+ // });
+ Check_plan({
+ mcidList: this.Id
+ }).then(result=>{
+ console.log("Check_plan:" + result);
+ this.rtn1 = result;
+ });
+ }
+ console.log("rtn1" + this.rtn1);
+ //URF闄愭鍚堝悓2鏈� LY 20220811 end
+ if (this.rtn1 == '1') {
+ // var rtn = sforce.apex.execute("MaintenanceContractWebService", "up2sap", {
+ // mcid: mcid
+ // });
+ up2sap({
+ mcid: this.Id
+ }).then(result=>{
+ console.log("up2sap:" + result);
+ this.rtn = result;
+ });
+ console.log("rtn" + this.rtn);
+ if (this.rtn == '1') {
+ alert("涓婁紶SAP鎴愬姛");
+ window.location.replace("https://ocsm--partial.sandbox.lightning.force.com/lightning/r/Maintenance_Contract__c/" + this.recordId + "/view");
+ //window.location.href = "/" + this.Id;
+ } else {
+ alert(this.rtn);
+ }
+ } else {
+ alert(this.rtn1);
+ }
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexUploadToSap/lexUploadToSap.js-meta.xml b/force-app/main/default/lwc/lexUploadToSap/lexUploadToSap.js-meta.xml
new file mode 100644
index 0000000..3392981
--- /dev/null
+++ b/force-app/main/default/lwc/lexUploadToSap/lexUploadToSap.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
--
Gitblit v1.9.1