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/lexInventory/lexInventory.js |  420 +++++++++++++++++++++++++++++++++++++----------------------
 1 files changed, 264 insertions(+), 156 deletions(-)

diff --git a/force-app/main/default/lwc/lexInventory/lexInventory.js b/force-app/main/default/lwc/lexInventory/lexInventory.js
index 9c9f098..d535c79 100644
--- a/force-app/main/default/lwc/lexInventory/lexInventory.js
+++ b/force-app/main/default/lwc/lexInventory/lexInventory.js
@@ -1,11 +1,15 @@
 import { LightningElement, wire, api, track } from "lwc";
 import oninit from "@salesforce/apex/LexInventoryController.init";
+// import sheetjs from '@salesforce/resourceUrl/sheetjs';
 import barcodeEntry from "@salesforce/apex/LexInventoryController.searchConsumableorderdetails";
-// import saveConfirm from '@salesforce/apex/LexInventoryController.saveConfirm';
 import save from "@salesforce/apex/LexInventoryController.save";
 import datainit from "@salesforce/apex/LexInventoryListController.init";
 import { ShowToastEvent } from "lightning/platformShowToastEvent";
 import { NavigationMixin } from "lightning/navigation";
+
+//table css 
+import { loadStyle } from "lightning/platformResourceLoader";
+import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable";
 
 //搴撳瓨鐩樼偣涓婚〉闈㈡暟鎹�
 const columns = [
@@ -14,64 +18,90 @@
 		fieldName: "iscount",
 		hideDefaultActions: true,
 		initialWidth: 80,
-		cellAttributes: { alignment: "left" },
+	
 	},
 	{
 		label: "娑堣�楀搧鍚嶇О",
 		fieldName: "Name__c",
 		hideDefaultActions: true,
-		initialWidth: 250,
-		cellAttributes: { alignment: "left" },
+		// initialWidth: 400,
+		wrapText:true
+		
 	},
 	{
 		label: "瑙勬牸",
+		initialWidth: 50,
 		fieldName: "Packing_list_manual__c",
+		cellAttributes: { alignment: "right" },
 		hideDefaultActions: true,
+		
+		
 	},
 	{
 		label: "鍗曚綅",
 		fieldName: "boxPiece",
+		initialWidth: 50,
 		hideDefaultActions: true,
+	
+		
 	},
 	{
 		label: "鏈夋晥鏈熷唴搴撳瓨",
 		fieldName: "limitCount",
+		initialWidth: 120,
 		hideDefaultActions: true,
+		cellAttributes: { alignment: "right" },
 	},
 
 	{
 		label: "杩囨湡搴撳瓨",
+		initialWidth: 100,
 		fieldName: "overlimitCount",
 		hideDefaultActions: true,
-		initialWidth: 100,
+		cellAttributes: { alignment: "right" },
+		
+
 	},
 	{
 		label: "鐩樼偣",
+		initialWidth: 50,
 		fieldName: "Pandian",
 		hideDefaultActions: true,
-		initialWidth: 100,
+		cellAttributes: { alignment: "right" },
+	
+		
 	},
 	{
 		label: "涓㈠け",
+		initialWidth: 50,
 		fieldName: "Diff",
 		hideDefaultActions: true,
-		initialWidth: 100,
+		cellAttributes: { alignment: "right" },
+		
+		
 	},
 	{
-		label: "瀵诲洖	",
+		label: "瀵诲洖",
+		initialWidth: 50,
 		fieldName: "refind",
 		hideDefaultActions: true,
-		initialWidth: 150,
+		cellAttributes: { alignment: "right" },
+	
+	
 	},
 	{
 		label: "宸紓鍘熷洜",
 		// fieldName: "DiffReason",
+		initialWidth: 200,
 		hideDefaultActions: true,
 		type: "customDiffReason",
 		typeAttributes: {
 			DiffReason: { fieldName: "DiffReason" },
 			ProdId: { fieldName: "ProdId" },
+			boxPiece: { fieldName: "boxPiece" }
+
 		},
+	
 	},
 ];
 
@@ -80,24 +110,29 @@
 	{
 		label: "娑堣�楀搧鍚嶇О",
 		fieldName: "Name__c",
+		wrapText: true,
 		hideDefaultActions: true,
-		cellAttributes: { alignment: "left" },
 	},
 	{
 		label: "鍗曚綅",
 		fieldName: "Box_Piece__c",
 		hideDefaultActions: true,
+		initialWidth: 50,
+	
 	},
 	{
 		label: "BarCode",
 		fieldName: "Bar_Code__c",
 		hideDefaultActions: true,
-		// initialWidth: 150,
+		wrapText: true,
+	    initialWidth: 500,
 	},
 	{
 		label: "璋冩暣鍘熷洜",
 		fieldName: "DiffReason",
 		hideDefaultActions: true,
+		wrapText: true,
+		
 	},
 ];
 //鐩樼偣鏄庣粏
@@ -106,36 +141,48 @@
 		label: "娑堣�楀搧鍚嶇О",
 		fieldName: "Name__c",
 		hideDefaultActions: true,
-		initialWidth: 250,
+		// initialWidth: 250,
 		wrapText: true,
-		cellAttributes: { alignment: "left" },
+	
 
 	},
 	{
 		label: "搴撳瓨",
 		fieldName: "Count_Sum__c",
 		hideDefaultActions: true,
+		initialWidth: 100,
+		cellAttributes: { alignment: "right" },
+	
 	},
 	{
 		label: "鐩樼偣",
 		fieldName: "inventory_sum__c",
 		hideDefaultActions: true,
-		initialWidth: 150,
+		initialWidth: 100,
+		cellAttributes: { alignment: "right" },
+	
 	},
 	{
 		label: "涓㈠け",
 		fieldName: "Diff__c",
 		hideDefaultActions: true,
+		initialWidth: 100,
+		cellAttributes: { alignment: "right" },
+	
 	},
 	{
 		label: "瀵诲洖",
 		fieldName: "Product_Refind__c",
 		hideDefaultActions: true,
+		initialWidth: 100,
+		cellAttributes: { alignment: "right" },
+		
 	},
 	{
 		label: "宸紓鍘熷洜",
 		fieldName: "Lose_reason__c",
 		hideDefaultActions: true,
+	
 	},
 ];
 
@@ -145,24 +192,28 @@
 		label: "娑堣�楀搧鍚嶇О",
 		fieldName: "Name__c",
 		wrapText: true,
-		cellAttributes: { alignment: "left" },
+		hideDefaultActions: true,
+	
 	},
 	{
 		label: "浜у搧鍨嬪彿",
 		fieldName: "Asset_Model_No__c",
 		hideDefaultActions: true,
+	
 	},
 	{
 		label: "宸紓鍘熷洜",
 		fieldName: "Lose_reason__c",
 		hideDefaultActions: true,
 		initialWidth: 150,
+	
 	},
 	{
 		label: "鏄惁涓㈠け",
 		type: "boolean",
 		fieldName: "Lose_Flag__c",
 		hideDefaultActions: true,
+		
 	},
 ];
 
@@ -195,7 +246,7 @@
 	//鍒嗛〉start
 	@track sortBy = "";
 	@track sortDirection = "asc";
-	@track pageSize = 5;
+	@track pageSize = 10;
 	error;
 	records;
 	currentPageToken = 0;
@@ -205,7 +256,7 @@
 	@track pageNumber = 1;
 	@track paginationVisibility = false;
 	@track totalPages = 1;
-	pageSizeOptions = [5, 10, 25, 50, 75, 100];
+	pageSizeOptions = [10, 25, 50, 100];
 	@track recordStart = 0;
 	@track recordEnd = 0;
 	//end
@@ -229,6 +280,11 @@
 	@track conId;
 	@track detailData = [];
 	@track adjustdata = [];
+	@track detalipan = [];
+
+
+	//瀵煎嚭csv 
+	xlsDataHeader = ['娑堣�楀搧鍚嶇О', '鍗曚綅', 'barCode', '璋冩暣鍘熷洜'];
 
 	//鑾峰彇閾炬帴鍙傛暟
 	getQueryString(name) {
@@ -240,10 +296,23 @@
 		}
 		return null;
 	}
+	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");
+                });
+        }
+    }
+
 
 	connectedCallback() {
 		console.log("===>鍒濆鍖�");
-	
+
 		//鑾峰彇ESetid
 		this.eSetId = this.getQueryString("eSetId");
 		this.eSetId = this.eSetId == null ? "" : this.eSetId;
@@ -256,52 +325,49 @@
 			this.showcount = false;
 			this.EditAble = true;
 		}
-	
+
 	}
-	init(){
+	init() {
+
 		this.showSpinner = true;
 		oninit()
-		.then((result) => {
-			console.log("1112" + JSON.stringify(result));
-			result = JSON.parse(JSON.stringify(result));
-			console.log("result.status = " + result.status);
-			console.log("ConsumableorderdetailsRecordsview= " + result.entity.ConsumableorderdetailsRecordsview);
-			this.ConsumableorderdetailsRecordsview = JSON.parse(result.entity.ConsumableorderdetailsRecordsview);
-			this.consumableorderdetailsRecords = result.entity.consumableorderdetailsRecords;
-			console.log("consumableorderdetailsRecords= " + result.entity.consumableorderdetailsRecords);
-			console.log("浼犲弬绫诲瀷", typeof this.consumableorderdetailsRecords);
-			if (result.status == "Success") {
-				this.data = [];
-				this.data = this.ConsumableorderdetailsRecordsview[0];
-				console.log("this.data ==>" + JSON.stringify(this.data));
-				for (let i in this.data) {
-					this.data[i]["Name__c"] = this.data[i].Prod.Name__c;
-					this.data[i]["Packing_list_manual__c"] = this.data[i].Prod.Packing_list_manual__c;
+			.then((result) => {
+				console.log("1112" + JSON.stringify(result));
+				result = JSON.parse(JSON.stringify(result));
+				console.log("result.status = " + result.status);
+				console.log("ConsumableorderdetailsRecordsview= " + result.entity.ConsumableorderdetailsRecordsview);
+				this.ConsumableorderdetailsRecordsview = JSON.parse(result.entity.ConsumableorderdetailsRecordsview);
+				this.consumableorderdetailsRecords = result.entity.consumableorderdetailsRecords;
+				console.log("consumableorderdetailsRecords= " + result.entity.consumableorderdetailsRecords);
+				console.log("浼犲弬绫诲瀷", typeof this.consumableorderdetailsRecords);
+				if (result.status == "Success") {
+					this.data = [];
+					this.data = this.ConsumableorderdetailsRecordsview[0];
+					console.log("this.data ==>" + JSON.stringify(this.data));
+					for (let i in this.data) {
+						this.data[i]["key"] = this.data[i]["ProdId"] + this.data[i]["boxPiece"];
+						this.data[i]["Name__c"] = this.data[i].Prod.Name__c;
+						this.data[i]["Packing_list_manual__c"] = this.data[i].Prod.Packing_list_manual__c;
+					}
+					this.accountName = result.entity.accountName;
+					this.agencyProType = result.entity.agencyProType;
+					this.userWorkLocation = result.entity.userWorkLocation;
+					this.showSpinner = false;
+					this.accountid = result.entity.accountid;
+					this.showTable = true;
+				} else {
+					this.showMyToast('鍒濆鍖栧け璐�',result.msg,'error');
+					this.showSpinner = false;
 				}
-				this.accountName = result.entity.accountName;
-				this.agencyProType = result.entity.agencyProType;
-				this.userWorkLocation = result.entity.userWorkLocation;
+			})
+			.catch((error) => {
+				console.log("error = " + JSON.stringify(error));
 				this.showSpinner = false;
-				this.accountid = result.entity.accountid;
-				this.showTable = true;
-			} else {
-				console.log("Error:" + result.errorMsg);
-				const evt = new ShowToastEvent({
-					title: "瑙f瀽澶辫触",
-					message: result.errorMsg,
-					variant: "error",
-				});
-				this.dispatchEvent(evt);
-			}
-		})
-		.catch((error) => {
-			console.log("error = " + JSON.stringify(error));
-		});
-	//榛樿灞曞紑鏍�
-	this.activeSections = ["dataExpand"];
-	this.showTable = false;
-	this.showbutton = false;
-
+			});
+		//榛樿灞曞紑鏍�
+		this.activeSections = ["dataExpand"];
+		this.showTable = false;
+		this.showbutton = false;
 	}
 
 	//褰曞叆barcode
@@ -310,20 +376,30 @@
 		this.showTable = false;
 		this.showbutton = false;
 		this.showSpinner = true;
-		this.selectedRows = [];
-		  //鏌ヨ鏈夊摢浜涢�夋嫨浜嗙殑鐒跺悗check
-		  const selectedRows = this.template.querySelector('c-lex-custom-lightning-datatable').getSelectedRows();
-		  console.log('selectedRows========> ' + JSON.stringify(selectedRows));
-		  for (var i in this.data) {
+		
+		//鏌ヨ鏈夊摢浜涢�夋嫨浜嗙殑鐒跺悗check
+		const selectedRows = this.template.querySelector('c-lex-custom-lightning-datatable').getSelectedRows();
+		console.log('selectedRows========> ' + JSON.stringify(selectedRows));
+		for (var i in this.data) {
 			this.data[i]["check"] = false;
 		}
 		for (var i in this.data) {
 			for (var j in selectedRows) {
-				if (this.data[i].ProdId == selectedRows[j].ProdId) {
+				if (this.data[i].ProdId+this.data[i]["boxPiece"] == selectedRows[j].ProdId+ selectedRows[j]["boxPiece"]) {
 					this.data[i]["check"] = true;
 				}
+				// console.log('this.data[i].ProdId+this.data[i]["boxPiece"]'+this.data[i].ProdId+this.data[i]["boxPiece"]);
+				console.log('selectedRows[j].ProdId+this.data[i]["boxPiece"]'+selectedRows[j].ProdId+selectedRows[j]["boxPiece"]);
+
 			}
 		}
+		if(this.barcode == ''||this.barcode == null){
+			this.showMyToast('鑾峰彇澶辫触','璇疯緭鍏arCode鍙�','error');
+
+		}
+		console.log('this.data--->'+JSON.stringify(this.data));
+		console.log('this.currentPageToken'+this.currentPageToken);
+		this.selectedRows = [];
 		barcodeEntry({
 			accountName: this.accountName,
 			agencyProType: this.agencyProType,
@@ -340,36 +416,46 @@
 				result = JSON.parse(JSON.stringify(result));
 				console.log("result ===>" + JSON.stringify(result));
 				if (result.status == "Success1") {
-					console.log('test');
-					this.codPageRecords = JSON.parse(result.entity.codPageRecords);
-					for (var i in this.codPageRecords) {
-						this.codPageRecords[i]["Name__c"] = this.codPageRecords[i].Prod.Name__c;
-						this.codPageRecords[i]["Box_Piece__c"] = this.codPageRecords[i].orderdetails2.Box_Piece__c;
-						this.codPageRecords[i]["Bar_Code__c"] = this.codPageRecords[i].orderdetails2.Bar_Code__c;
-					}
-					this.data = JSON.parse(result.entity.consumableorderdetailsRecords);
-					for (var i in this.data) {
-						this.data[i]["Name__c"] = this.data[i].Prod.Name__c;
-						this.data[i]["Packing_list_manual__c"] = this.data[i].Prod.Packing_list_manual__c;
-					}
-					for (var i in this.data) {
-						if (this.data[i]["check"]) {
-							this.selectedRows.push(this.data[i].ProdId);
-							console.log("selectedRows:" + this.selectedRows);
+						//鍒嗛〉start
+						this.nextPageToken = result.entity.paginatedAccounts.nextPageToken;
+						this.totalRecords = result.entity.paginatedAccounts.totalRecords;
+						this.recordStart = result.entity.paginatedAccounts.recordStart;
+						this.recordEnd = result.entity.paginatedAccounts.recordEnd;
+						this.totalPages = Math.ceil(result.entity.paginatedAccounts.totalRecords / this.pageSize);
+						console.log('this.totalPages = ' + this.totalPages);
+						this.paginationVisibility = this.totalPages > 1 ? true : false;
+						console.log('this.sortDirection = ' + this.sortDirection);
+						//鍒嗛〉end
+						this.codPageRecords = JSON.parse(result.entity.codPageRecords);
+						for (var i in this.codPageRecords) {
+							this.codPageRecords[i]["Name__c"] = this.codPageRecords[i].Prod.Name__c;
+							this.codPageRecords[i]["Box_Piece__c"] = this.codPageRecords[i].orderdetails2.Box_Piece__c;
+							this.codPageRecords[i]["Bar_Code__c"] = this.codPageRecords[i].orderdetails2.Bar_Code__c;
 						}
-					}
-					this.iSinventory = result.entity.iSinventory;
-					this.pandiandetailsMap = result.entity.pandiandetailsMap;
-					this.reSet1 = result.entity.reSet1;
-					console.log("iSinventory:" + this.iSinventory);
-					this.showTable = true;
-					this.showbutton = true;
-					this.showSpinner = false;
-					console.log('status2');
-					console.log('pandiandetailsMap' + this.pandiandetailsMap);
-					console.log("this.codPageRecords=11111 " + result.entity.codPageRecords);
-					console.log("result褰曞叆= " + JSON.stringify(result));
-					console.log("result涓婚〉鏁版嵁= " + result.entity.consumableorderdetailsRecords);
+						this.pageCodeRecords = result.entity.pageCodeRecords;
+						for (var i in this.pageCodeRecords) {
+							this.pageCodeRecords[i]["Name__c"] = this.pageCodeRecords[i].Prod.Name__c;
+							this.pageCodeRecords[i]["Box_Piece__c"] = this.pageCodeRecords[i].orderdetails2.Box_Piece__c;
+							this.pageCodeRecords[i]["Bar_Code__c"] = this.pageCodeRecords[i].orderdetails2.Bar_Code__c;
+						}
+						this.data = JSON.parse(result.entity.consumableorderdetailsRecords);
+						for (var i in this.data) {
+							this.data[i]["key"] = this.data[i]["ProdId"] + this.data[i]["boxPiece"];
+							this.data[i]["Name__c"] = this.data[i].Prod.Name__c;
+							this.data[i]["Packing_list_manual__c"] = this.data[i].Prod.Packing_list_manual__c;
+							if (this.data[i]["check"]) {
+								this.selectedRows.push(this.data[i].ProdId + this.data[i]["boxPiece"]);
+								console.log("selectedRows:" + this.selectedRows);
+							}
+						}
+						this.iSinventory = result.entity.iSinventory;
+						this.pandiandetailsMap = result.entity.pandiandetailsMap;
+						this.reSet = result.entity.reSet;
+						console.log("iSinventory:" + this.iSinventory);
+						this.showTable = true;
+						this.showbutton = true;
+						this.showSpinner = false;
+						console.log("result褰曞叆= " + JSON.stringify(result));
 				}
 				else {
 					if (result.status == "Sucess") {
@@ -383,26 +469,25 @@
 						this.paginationVisibility = this.totalPages > 1 ? true : false;
 						console.log('this.sortDirection = ' + this.sortDirection);
 						//鍒嗛〉end
-						// this.codPageRecords = JSON.parse(result.entity.codPageRecords);
+						this.codPageRecords = JSON.parse(result.entity.codPageRecords);
+						for (var i in this.codPageRecords) {
+							this.codPageRecords[i]["Name__c"] = this.codPageRecords[i].Prod.Name__c;
+							this.codPageRecords[i]["Box_Piece__c"] = this.codPageRecords[i].orderdetails2.Box_Piece__c;
+							this.codPageRecords[i]["Bar_Code__c"] = this.codPageRecords[i].orderdetails2.Bar_Code__c;
+						}
 						this.pageCodeRecords = result.entity.pageCodeRecords;
 						for (var i in this.pageCodeRecords) {
 							this.pageCodeRecords[i]["Name__c"] = this.pageCodeRecords[i].Prod.Name__c;
 							this.pageCodeRecords[i]["Box_Piece__c"] = this.pageCodeRecords[i].orderdetails2.Box_Piece__c;
 							this.pageCodeRecords[i]["Bar_Code__c"] = this.pageCodeRecords[i].orderdetails2.Bar_Code__c;
 						}
-						// for (var i in this.codPageRecords) {
-						// 	this.codPageRecords[i]["Name__c"] = this.codPageRecords[i].Prod.Name__c;
-						// 	this.codPageRecords[i]["Box_Piece__c"] = this.codPageRecords[i].orderdetails2.Box_Piece__c;
-						// 	this.codPageRecords[i]["Bar_Code__c"] = this.codPageRecords[i].orderdetails2.Bar_Code__c;
-						// }
 						this.data = JSON.parse(result.entity.consumableorderdetailsRecords);
 						for (var i in this.data) {
+							this.data[i]["key"] = this.data[i]["ProdId"] + this.data[i]["boxPiece"];
 							this.data[i]["Name__c"] = this.data[i].Prod.Name__c;
 							this.data[i]["Packing_list_manual__c"] = this.data[i].Prod.Packing_list_manual__c;
-						}
-						for (var i in this.data) {
 							if (this.data[i]["check"]) {
-								this.selectedRows.push(this.data[i].ProdId);
+								this.selectedRows.push(this.data[i].ProdId + this.data[i]["boxPiece"]);
 								console.log("selectedRows:" + this.selectedRows);
 							}
 						}
@@ -416,12 +501,7 @@
 						console.log("result褰曞叆= " + JSON.stringify(result));
 					} else {
 						console.log('Error:' + result.msg);
-						const evt = new ShowToastEvent({
-							title: '',
-							message: result.msg,
-							variant: 'error'
-						});
-						this.dispatchEvent(evt);
+						this.showMyToast(result.msg,'','error');
 						this.showSpinner = false;
 						this.showTable = true;
 					}
@@ -438,57 +518,58 @@
 		this.barcode = value;
 	}
 
-	getSelectedRows(event) {
-		let selectedRowsEvent = event.detail.selectedRows;
-        this.selectedRows = [];
-        for (var i in selectedRowsEvent) {
-            this.selectedRows.push(selectedRowsEvent[i].ProdId)
-        }
-		// const selectedRows = event.detail.selectedRows;
-		// console.log("this.selectedRows = " + JSON.stringify(selectedRows));
-		// for (var i in selectedRows) {
-		// 	this.selectedRows.push(selectedRows[i].ProdId);
-		// }
+	// getSelectedRows(event) {
+	// 		let selectedRowsEvent = event.detail.selectedRows;
+	// 	    this.selectedRows = [];
+	// 	    for (var i in selectedRowsEvent) {
+	// 	        this.selectedRows.push(selectedRowsEvent[i].ProdId+this.data[i]["boxPiece"]);
+	// 	    }
+	// 	const selectedRows = event.detail.selectedRows;
+	// 	console.log("this.selectedRows = " + JSON.stringify(selectedRows));
+	// 	for (var i in selectedRows) {
+	// 		this.selectedRows.push(selectedRows[i].ProdId+this.data[i]["boxPiece"]);
+	// 	}
 
-	}
+	// }
 
 	//瀵煎嚭涓篶sv
 	exportData() {
-		console.log("瀵煎嚭");
 		// Prepare a html table
-		let doc = "<table>";
+		let doc = '<table>';
 		// Add styles for the table
-		doc += "<style>";
-		doc += "table, th, td {";
-		doc += "    border: 1px solid black;";
-		doc += "    border-collapse: collapse;";
-		doc += "}";
-		doc += "</style>";
+		doc += '<style>';
+		doc += 'table, th, td {';
+		doc += '    border: 1px solid black;';
+		doc += '    border-collapse: collapse;';
+		doc += '}';
+		doc += '</style>';
 		// Add all the Table Headers
-		doc += "<tr>";
-		this.columnHeader.forEach((element) => {
-			doc += "<th>" + element + "</th>";
+		doc += '<tr>';
+		this.columnHeader.forEach(element => {
+			doc += '<th>' + element + '</th>'
 		});
-		doc += "</tr>";
+		doc += '</tr>';
 		// Add the data rows
-		this.codPageRecords.forEach((record) => {
-			doc += "<tr>";
-			doc += "<th>" + record.Name__c + "</th>";
-			doc += "<th>" + record.Box_Piece__c + "</th>";
-			doc += "<th>" + record.Bar_Code__c + "</th>";
-			doc += "<th>" + record.DiffReason + "</th>";
-			doc += "</tr>";
+		this.codPageRecords.forEach(record => {
+			doc += '<tr>';
+			doc += '<th>' + record.Name__c + '</th>';
+			doc += '<th>' + record.Box_Piece__c + '</th>';
+			doc += '<th>' + record.Bar_Code__c + '</th>';
+			doc += '<th>' + record.DiffReason + '</th>';
+			doc += '</tr>';
 		});
-		doc += "</table>";
-		var element = "data:application/vnd.ms-excel," + encodeURIComponent(doc);
-		let downloadElement = document.createElement("a");
+		doc += '</table>';
+		console.log('doc' + doc);
+		var element = 'data:application/vnd.ms-excel,' + encodeURIComponent(doc);
+		let downloadElement = document.createElement('a');
 		downloadElement.href = element;
-		downloadElement.target = "_self";
+		downloadElement.target = '_self';
 		// use .csv as extension on below line if you want to export data as csv
-		downloadElement.download = "搴撳瓨鍙樺寲鏄庣粏.xls";
+		downloadElement.download = '鍦ㄥ簱璋冩暣涓�瑙�.xls';
 		document.body.appendChild(downloadElement);
 		downloadElement.click();
 	}
+
 
 	//鑷畾涔塪ataType
 
@@ -497,7 +578,10 @@
 		// this.numberDetail = numberDetail;
 		console.log("numberDetail" + JSON.stringify(numberDetail));
 		for (var i in this.data) {
-			if (this.data[i]["ProId"] == numberDetail.data.ProId) {
+			console.log('this.data[i]["key"]' + this.data[i]["key"]);
+			console.log('numberDetail.data.ProdId+numberDetail.data.boxPiece' + numberDetail.data.ProdId + numberDetail.data.boxPiece);
+
+			if (this.data[i]["key"] == numberDetail.data.ProdId + numberDetail.data.boxPiece) {
 				this.data[i]["DiffReason"] = numberDetail.data.DiffReason;
 			}
 		}
@@ -539,35 +623,30 @@
 					// this.EditAble = true;
 					// this.showcount = false;
 				} else {
-					console.log("result.msg = " + result.msg);
-					const evt = new ShowToastEvent({
-						title: "澶辫触",
-						message: result.msg,
-						variant: "error",
-					});
-					this.dispatchEvent(evt);
+					this.showMyToast('鐩樼偣澶辫触',result.msg,'error');
 					this.showSpinner = false;
 				}
 			})
 			.catch((error) => {
 				console.log("error = " + JSON.stringify(error));
+				this.showSpinner = false;
 			});
 	}
 
 	inits() {
+		this.showSpinner = true
 		datainit({
 			eSetId: this.eSetId,
 		})
 			.then((result) => {
 				result = JSON.parse(JSON.stringify(result));
 				console.log('鐩樼偣涓�瑙�===>' + JSON.stringify(result));
+				
 				for (var i in result.entity.qs) {
 					this.conId = result.entity.qs[i].Id;
 				}
 				console.log("this.conId" + typeof this.conId);
-				this.detailData = JSON.parse(
-					result.entity.consumableorderdetailsRecords
-				);
+				this.detailData = JSON.parse(result.entity.consumableorderdetailsRecords);
 				if (result.entity.ConsumableorderdetailsRecordsError != null) {
 					this.adjustdata = JSON.parse(
 						result.entity.ConsumableorderdetailsRecordsError
@@ -587,11 +666,13 @@
 						this.adjustdata[i].Lose_Flag__c = this.adjustdata[i].orderdetails2.Lose_Flag__c;
 					}
 				}
+				this.showSpinner = false;
 				console.log("result鐩樼偣Id" + JSON.stringify(this.conId));
 				console.log("璋冩暣鏄庣粏" + JSON.stringify(this.adjustdata));
 			})
 			.catch((error) => {
 				console.log("error = " + JSON.stringify(error));
+				this.showSpinner = false;
 			});
 	}
 	//鍒嗛〉
@@ -628,4 +709,31 @@
 	get nextButtonDisabled() {
 		return this.nextPageToken === undefined;
 	}
+
+	handleLoad2() {
+        console.log('handleLoad2')
+        try {
+            const style2 = document.createElement('style');
+            style2.innerText = '.hehe-layoutItem  .slds-form-element__label {padding : 0px}';
+            this.template.querySelector('.hideHelpText').appendChild(style2);
+        } catch (error) {
+            console.log(error);
+        }
+    }
+	showMyToast(title, message, variant) {
+        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>';
+        }
+        this.template.querySelector('c-common-toast').showToast(variant,content,iconName,10000);
+	}
 }
\ No newline at end of file

--
Gitblit v1.9.1