From b5c5eb130ca0848124f9d136af4be142ad5aac07 Mon Sep 17 00:00:00 2001
From: binxie <137736985@qq.com>
Date: 星期一, 26 六月 2023 14:42:02 +0800
Subject: [PATCH] backup0626

---
 force-app/main/default/lwc/lexRemoveBox/lexRemoveBox.js |  310 ++++++++++++++++++++++++++-------------------------
 1 files changed, 156 insertions(+), 154 deletions(-)

diff --git a/force-app/main/default/lwc/lexRemoveBox/lexRemoveBox.js b/force-app/main/default/lwc/lexRemoveBox/lexRemoveBox.js
index cd935a9..440d3e2 100644
--- a/force-app/main/default/lwc/lexRemoveBox/lexRemoveBox.js
+++ b/force-app/main/default/lwc/lexRemoveBox/lexRemoveBox.js
@@ -1,79 +1,90 @@
-import { LightningElement, wire, api, track } from "lwc";
-import init from "@salesforce/apex/LexRemoveBoxController.init";
-import searchDeatail from "@salesforce/apex/LexRemoveBoxController.searchConsumableorderdetails";
-import saveconfirm from "@salesforce/apex/LexRemoveBoxController.removeBoxConfirm";
-import { ShowToastEvent } from "lightning/platformShowToastEvent";
+import { LightningElement, wire, api, track } from 'lwc';
+import init from '@salesforce/apex/LexRemoveBoxController.init';
+import searchDeatail from '@salesforce/apex/LexRemoveBoxController.searchConsumableorderdetails';
+import saveconfirm from '@salesforce/apex/LexRemoveBoxController.removeBoxConfirm';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
 // import { NavigationMixin } from 'lightning/navigation';
-//table css
+//table css 
 import { loadStyle } from "lightning/platformResourceLoader";
 import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable";
 
 const columns = [
   {
-    label: "娑堣�楀搧鍚嶇О",
-    fieldName: "Name__c",
-    wrapText: true,
-    hideDefaultActions: true
+    label: '娑堣�楀搧鍚嶇О',
+    fieldName: 'Name__c',
+    wrapText:true,
+    hideDefaultActions: true,
     // initialWidth: 400,
+
   },
   {
-    label: "瑙勬牸",
-    fieldName: "ProductPacking_list_manual__c",
+    label: '瑙勬牸',
+    fieldName: 'ProductPacking_list_manual__c',
     hideDefaultActions: true,
     initialWidth: 50,
-    cellAttributes: { alignment: "right" }
+    cellAttributes: { alignment: "right" },
+
+
   },
   {
-    label: "CFDA鐘舵��",
-    fieldName: "CFDA_Status__c",
+    label: 'CFDA鐘舵��',
+    fieldName: 'CFDA_Status__c',
     hideDefaultActions: true,
     initialWidth: 100,
-    wrapText: true
+    wrapText:true,
+
   },
   {
-    label: "娉ㄥ唽璇佺紪鐮佸彿",
-    fieldName: "Report_Product_Approbation__c",
+    label: '娉ㄥ唽璇佺紪鐮佸彿',
+    fieldName: 'Report_Product_Approbation__c',
     hideDefaultActions: true,
     initialWidth: 200,
-    wrapText: true
+    wrapText:true,
   },
   {
-    label: "娉ㄥ唽璇佹晥鏈�",
-    fieldName: "Report_Product_Expiration__c",
+    label: '娉ㄥ唽璇佹晥鏈�',
+    fieldName: 'Report_Product_Expiration__c',
     hideDefaultActions: true,
     initialWidth: 110,
-    wrapText: true
+    wrapText:true,
   },
   {
-    label: "BarCode",
-    fieldName: "Bar_Code__c",
+    label: 'BarCode',
+    fieldName: 'Bar_Code__c',
     hideDefaultActions: true,
-    wrapText: true
+    wrapText:true,
     // initialWidth:600,
   }
 ];
 
 const column = [
   {
-    label: "娑堣�楀搧鍚嶇О",
-    fieldName: "Name__c",
+    label: '娑堣�楀搧鍚嶇О',
+    fieldName: 'Name__c',
     hideDefaultActions: true,
-    wrapText: true
+    wrapText:true,
+
   },
   {
-    label: "BarCode",
-    fieldName: "Bar_Code__c",
+    label: 'BarCode',
+    fieldName: 'Bar_Code__c',
     hideDefaultActions: true,
-    wrapText: true
+    wrapText:true,
     // initialWidth:600,
-  },
+
+   
+  }
+  ,
   {
-    label: "閿欒鍘熷洜",
-    fieldName: "ErrorReason",
+    label: '閿欒鍘熷洜',
+    fieldName: 'ErrorReason',
     hideDefaultActions: true,
-    wrapText: true
+    wrapText:true,
   }
 ];
+
+
+
 
 export default class LexRemoveBox extends LightningElement {
   columns = columns;
@@ -83,53 +94,51 @@
   @track errorDetail = [];
 
   // 鏄剧ず
-  @track showTable = false;
-  @track accountName;
-  @track userWorkLocation;
-  @track agencyProType;
-  @track barcode = "";
-  @track saveFLGbln = false;
+  @track showTable = false
+  @track accountName
+  @track userWorkLocation
+  @track agencyProType
+  @track barcode = ''
+  @track saveFLGbln = false
   @track dataSize = 0;
 
   //鍔犺浇妗�
-  @track showSpinner = false;
+  @track showSpinner = false
 
   renderedCallback() {
     if (!this.stylesLoaded) {
-      Promise.all([loadStyle(this, WrappedHeaderTable)])
-        .then(() => {
-          console.log("Custom styles loaded");
-          this.stylesLoaded = true;
-        })
-        .catch((error) => {
-          console.error("Error loading custom styles");
-        });
+        Promise.all([loadStyle(this, WrappedHeaderTable)])
+            .then(() => {
+                console.log("Custom styles loaded");
+                this.stylesLoaded = true;
+            })
+            .catch((error) => {
+                console.error("Error loading custom styles");
+            });
     }
-  }
+}
 
   //鍒濆鍖�
   connectedCallback() {
-    console.log("鍒濆鍖�");
+    console.log('鍒濆鍖�');
     this.showTable = false;
 
-    init()
-      .then((result) => {
-        result = JSON.parse(JSON.stringify(result));
-        console.log("result =" + JSON.stringify(result));
-        if ((result.status = "Success")) {
-          console.log("result");
-          this.agencyProType = result.entity.agencyProType;
-          this.userWorkLocation = result.entity.userWorkLocation;
-          this.accountName = result.entity.accountName;
-          // this.data = JSON.parse(result.entity.codPageRecords);
-          // this.showTable = true;
-        } else {
-          this.showMyToast("鍒濆鍖栧け璐�", result.msg, "error");
-        }
-      })
-      .catch((error) => {
-        console.log("error = " + JSON.stringify(error));
-      });
+    init().then((result) => {
+      result = JSON.parse(JSON.stringify(result));
+      console.log('result =' + JSON.stringify(result));
+      if (result.status = 'Success') {
+        console.log('result');
+        this.agencyProType = result.entity.agencyProType;
+        this.userWorkLocation = result.entity.userWorkLocation;
+        this.accountName = result.entity.accountName;
+        // this.data = JSON.parse(result.entity.codPageRecords);
+        // this.showTable = true;
+      } else {
+        this.showMyToast('鍒濆鍖栧け璐�',result.msg,'error');
+      }
+    }).catch((error) => {
+      console.log('error = ' + JSON.stringify(error));
+    });
   }
   //褰曞叆
   getDetails() {
@@ -138,112 +147,105 @@
       userWorkLocation: this.userWorkLocation,
       agencyProType: this.agencyProType,
       barcode: this.barcode
-    })
-      .then((result) => {
-        result = JSON.parse(JSON.stringify(result));
-        console.log("result =" + JSON.stringify(result));
-        if (result.status == "Success") {
-          console.log("鎴愬姛");
-          this.data = JSON.parse(
-            result.entity.ConsumableorderdetailsRecordsdummy
-          );
-          this.errorDetail = JSON.parse(
-            result.entity.ConsumableorderdetailsRecordserror
-          );
-          this.dataSize = result.entity.dataSize;
-          console.log("this.dataSize" + this.dataSize);
-          for (let i in this.data) {
-            this.data[i]["Name__c"] = this.data[i].Prod.Name__c;
-            this.data[i]["ProductPacking_list_manual__c"] =
-              this.data[i].esd.ProductPacking_list_manual__c;
-            this.data[i]["CFDA_Status__c"] = this.data[i].esd.CFDA_Status__c;
-            this.data[i]["Report_Product_Approbation__c"] =
-              this.data[i].esd.Report_Product_Approbation__c;
-            this.data[i]["Report_Product_Expiration__c"] =
-              this.data[i].esd.Report_Product_Expiration__c;
-            this.data[i]["Bar_Code__c"] = this.data[i].esd.Bar_Code__c;
-          }
-          for (let i in this.errorDetail) {
-            this.errorDetail[i]["Name__c"] = this.errorDetail[i].Prod.Name__c;
-            this.errorDetail[i]["Bar_Code__c"] =
-              this.errorDetail[i].esd.Bar_Code__c;
-            this.errorDetail[i]["ErrorReason"] =
-              this.errorDetail[i].ErrorReason;
-          }
-          this.showTables = true;
-          this.showTable = true;
-        } else {
-          console.log("result.msg = " + result.msg);
-          this.showMyToast("鑾峰彇澶辫触", result.msg, "error");
+    }).then((result) => {
+      result = JSON.parse(JSON.stringify(result));
+      console.log('result =' + JSON.stringify(result));
+      if (result.status == 'Success') {
+        console.log('鎴愬姛');
+        this.data = JSON.parse(result.entity.ConsumableorderdetailsRecordsdummy);
+        this.errorDetail = JSON.parse(result.entity.ConsumableorderdetailsRecordserror);
+        this.dataSize = result.entity.dataSize;
+        console.log('this.dataSize'+this.dataSize);
+        for (let i in this.data) {
+          this.data[i]['Name__c'] = this.data[i].Prod.Name__c;
+          this.data[i]['ProductPacking_list_manual__c'] = this.data[i].esd.ProductPacking_list_manual__c;
+          this.data[i]['CFDA_Status__c'] = this.data[i].esd.CFDA_Status__c;
+          this.data[i]['Report_Product_Approbation__c'] = this.data[i].esd.Report_Product_Approbation__c;
+          this.data[i]['Report_Product_Expiration__c'] = this.data[i].esd.Report_Product_Expiration__c;
+          this.data[i]['Bar_Code__c'] = this.data[i].esd.Bar_Code__c;
         }
-      })
-      .catch((error) => {
-        console.log("error = " + JSON.stringify(error));
-      });
+        for (let i in this.errorDetail) {
+          this.errorDetail[i]['Name__c'] = this.errorDetail[i].Prod.Name__c;
+          this.errorDetail[i]['Bar_Code__c'] = this.errorDetail[i].esd.Bar_Code__c;
+          this.errorDetail[i]['ErrorReason'] = this.errorDetail[i].ErrorReason;
+        }
+        this.showTables = true;
+        this.showTable = true;
+      } else{
+        console.log('result.msg = ' + result.msg);
+        this.showMyToast('鑾峰彇澶辫触',result.msg,'error');
+      }
+    }).catch((error) => {
+      console.log('error = ' + JSON.stringify(error));
+    });
+
   }
   //鑾峰彇褰撳墠杈撳叆鍊�
   handleChange(event) {
     let value = event.detail.value;
-    console.log("value" + value);
+    console.log('value' + value);
     this.barcode = value;
-    console.log("this.barcode" + this.barcode);
+    console.log('this.barcode' + this.barcode);
   }
   saveConfirm() {
-    console.log("杩涘叆纭");
+    console.log('杩涘叆纭');
     let msg = "纭鎷嗙洅鍚�";
-    if (this.dataSize > 0) {
-      if (confirm(msg) == true) {
-        this.removeBox();
-      }
+    if (this.dataSize>0) {
+        if (confirm(msg) == true) {
+            this.removeBox();
+        }
     } else {
-      this.removeBox();
+        this.removeBox();
     }
+
   }
-  removeBox() {
+  removeBox(){
     this.showSpinner = true;
     saveconfirm({
       saveConsumableorderdetailsRecordsdummy: JSON.stringify(this.data),
       accountName: this.accountName,
       userWorkLocation: this.userWorkLocation,
       agencyProType: this.agencyProType
-    })
-      .then((result) => {
-        result = JSON.parse(JSON.stringify(result));
-        console.log("result淇濆瓨 = " + JSON.stringify(result));
-        if (result.status == "Success") {
-          this.saveFLGbln = result.entity.saveFLGbln;
-          //  this.showSpinner = false;
-          if (this.saveFLGbln) {
-            this.showMyToast(result.msg, "", "success");
-            this.showSpinner = false;
-          }
-        } else {
-          console.log("result.msg = " + result.msg);
-          this.showMyToast("鎷嗙洅澶辫触", result.msg, "error");
+    }).then((result) => {
+      result = JSON.parse(JSON.stringify(result));
+      console.log('result淇濆瓨 = ' + JSON.stringify(result));
+      if (result.status == 'Success') {
+         this.saveFLGbln = result.entity.saveFLGbln;
+        //  this.showSpinner = false;
+         if(this.saveFLGbln){
+          this.showMyToast(result.msg,'','success');
           this.showSpinner = false;
-        }
-      })
+         }
+      } else {
+        console.log('result.msg = ' + result.msg);
+        this.showMyToast('鎷嗙洅澶辫触',result.msg,'error');
+        this.showSpinner = false;
+      }
+    })
       .catch((error) => {
-        console.log("error = " + JSON.stringify(error));
+        console.log('error = ' + JSON.stringify(error));
       });
+
+
   }
   showMyToast(title, message, variant) {
-    console.log("show custom message");
-    var iconName = "";
-    var content = "";
-    if (variant == "success") {
-      iconName = "utility:check";
-    } else {
-      iconName = "utility:error";
+    console.log('show custom message');
+    var iconName = '';
+    var content = '';
+    if(variant == 'success'){
+       iconName = 'utility:check';
+    }else{
+       iconName = 'utility:error';
     }
-    if (message != "") {
-      content =
-        "<h2><strong>" + title + "<strong/></h2><h5>" + message + "</h5>";
-    } else {
-      content = "<h2><strong>" + title + "<strong/></h2>";
+    if(message != ''){
+       content = '<h2><strong>'+title+'<strong/></h2><h5>'+message+'</h5>';
+    }else{
+       content = '<h2><strong>'+title+'<strong/></h2>';
     }
-    this.template
-      .querySelector("c-common-toast")
-      .showToast(variant, content, iconName, 10000);
-  }
-}
+    this.template.querySelector('c-common-toast').showToast(variant,content,iconName,10000);
+	}
+
+
+
+
+}
\ No newline at end of file

--
Gitblit v1.9.1