From 87861ae5f1ed5456685f97f8a8e7625e47b9576d Mon Sep 17 00:00:00 2001
From: KKbes <1620284052@qq.com>
Date: 星期四, 13 四月 2023 11:12:26 +0800
Subject: [PATCH] Merge branch 'LEX_dev' of http://47.92.229.245:8089/r/lightningupdate into LEX_dev

---
 force-app/main/default/lwc/lexPreContractSubmit/lexPreContractSubmit.js |  116 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 116 insertions(+), 0 deletions(-)

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..1340680
--- /dev/null
+++ b/force-app/main/default/lwc/lexPreContractSubmit/lexPreContractSubmit.js
@@ -0,0 +1,116 @@
+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';
+import {
+    ShowToastEvent
+} from 'lightning/platformShowToastEvent';
+
+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() {
+        if (this.oldIsRecognitionModelC) {
+            if (this.uploadToRMTimeC == null) {
+                this.ShowToastEvent('褰撳墠缁翠慨鍚堝悓鐨勭粡閿�鍟嗘槸鍏堟瀵硅薄锛岄渶瑕佸厛銆愪笂浼犺娆惧悎鍚屻�戯紝鐒跺悗瀹屾垚璁ゆ浠ュ悗鎵嶈兘澶嶆牳銆�', "error")
+                // alert('褰撳墠缁翠慨鍚堝悓鐨勭粡閿�鍟嗘槸鍏堟瀵硅薄锛岄渶瑕佸厛銆愪笂浼犺娆惧悎鍚屻�戯紝鐒跺悗瀹屾垚璁ゆ浠ュ悗鎵嶈兘澶嶆牳銆�');
+                return;
+            } else {
+                if (!this.IsRecognitionModelTrueC) {
+                    this.ShowToastEvent('褰撳墠缁翠慨鍚堝悓娌℃湁瀹屾垚璁ゆ锛屼笉鑳借繘琛屽鏍搞��', "error")
+                    // alert('褰撳墠缁翠慨鍚堝悓娌℃湁瀹屾垚璁ゆ锛屼笉鑳借繘琛屽鏍搞��');
+                    return;
+                }
+            }
+        }
+        var status = this.MCApprovalStatusC;
+        if (status != 'Draft' && status != 'Reject' && status != undefined) {
+            this.ShowToastEvent('澶嶆牳宸茬粡鎻愪氦锛岃纭鐘舵�併��', "success")
+            // alert('澶嶆牳宸茬粡鎻愪氦锛岃纭鐘舵�併��');
+            return;
+        }
+        var con_no = this.ContractprintCompletedC;
+        if (con_no == '') {
+            this.ShowToastEvent('鍚堝悓鐩栫珷瀹屾瘯涓虹┖锛屼笉鑳芥彁浜ゅ悎鍚屽鏍哥敵璇枫��', "error")
+            // 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');
+                this.ShowToastEvent(errmsg + '_sys', "error")
+                return;
+            }
+        })
+    }
+
+    // 寮圭獥
+    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