From 71b93327e8f3fb3bffffc7c033c1f782e7b6ab32 Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期一, 22 五月 2023 17:37:16 +0800
Subject: [PATCH] test
---
force-app/main/default/lwc/lexOverdueStock/lexOverdueStock.js | 104 +++++++++++++++++++++++++++++++++------------------
1 files changed, 67 insertions(+), 37 deletions(-)
diff --git a/force-app/main/default/lwc/lexOverdueStock/lexOverdueStock.js b/force-app/main/default/lwc/lexOverdueStock/lexOverdueStock.js
index a79600b..711461c 100644
--- a/force-app/main/default/lwc/lexOverdueStock/lexOverdueStock.js
+++ b/force-app/main/default/lwc/lexOverdueStock/lexOverdueStock.js
@@ -4,6 +4,9 @@
import save from '@salesforce/apex/LexOverdueStockController.save';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import { NavigationMixin } from 'lightning/navigation';
+//table css
+import { loadStyle } from "lightning/platformResourceLoader";
+import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable";
//杩囨湡搴撳瓨涓�瑙�
@@ -19,7 +22,9 @@
label: '娑堣�楀搧鍚嶇О',
fieldName: 'prodname',
type: 'prodname',
- // initialWidth: 350,
+ wrapText: true,
+ initialWidth: 350,
+
hideDefaultActions: true
},
@@ -34,6 +39,8 @@
label: '杩囨湡鏁伴噺',
fieldName: 'overlimitCount',
hideDefaultActions: true,
+ cellAttributes: { alignment: 'right' }
+
// initialWidth: 250,
},
@@ -41,6 +48,7 @@
label: '閿�瀛樻暟閲�',
fieldName: 'pandian',
hideDefaultActions: true,
+ cellAttributes: { alignment: 'right' }
// initialWidth: 250,
// cellAttributes: { alignment: 'center' }
}
@@ -59,27 +67,28 @@
{
label: '鍗曚綅',
fieldName: 'Box_Piece__c',
- initialWidth : 250,
+ initialWidth : 80,
hideDefaultActions: true
},
{
label: 'BarCode',
fieldName: 'Bar_Code__c',
+ wrapText: true,
hideDefaultActions: true,
- initialWidth : 250
+ initialWidth : 500,
},
{
label: '浣跨敤鏈熼檺',
fieldName: 'Sterilization_limit__c',
hideDefaultActions: true,
- initialWidth : 250
+ // initialWidth : 250
}
,
{
label: '閿�瀛樺師鍥�',
fieldName: 'diffReason',
hideDefaultActions: true,
- initialWidth: 100
+ initialWidth: 160
}
];
@@ -111,6 +120,20 @@
@track overdueList = [];
+ 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('鍒濆鍖�');
@@ -131,13 +154,8 @@
// this.casesSpinner = false;
this.showSpinner = false;
}else {
- console.log('Error:' + result.errorMsg);
- const evt = new ShowToastEvent({
- title: '瑙f瀽澶辫触',
- message: result.errorMsg,
- variant: 'error'
- });
- this.dispatchEvent(evt);
+ this.showMyToast('鍒濆鍖栧け璐�',result.msg,'error');
+ this.showSpinner = false;
}
}).catch((error) => {
console.log('error = ' + JSON.stringify(error));
@@ -145,10 +163,15 @@
}
//barcode褰曞叆
barcodeEntrys(){
- this.showSpinner = true;
+
this.showTable = false;
console.log('code'+this.barcode);
console.log(' this.accountName'+ this.accountName);
+ console.log(' this.barcode'+ this.barcode);
+
+
+ this.showSpinner = true;
+
barcodeEntry({
accountNameLWC: this.accountName,
agencyProTypeLWC: this.agencyProType,
@@ -163,8 +186,6 @@
this.iSinventory = result.entity.iSinventory;
console.log('result褰曞叆'+JSON.stringify( result));
console.log('overdueList==>'+JSON.stringify( this.overdueList));
-
-
for(let i in this.overduePageRecords){
if(this.overduePageRecords[i].Prod!=null){
this.overduePageRecords[i]['Name__c'] = this.overduePageRecords[i].Prod.Name__c;
@@ -186,13 +207,7 @@
// this.showTables = true;
this.showTable = true;
}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;
}
@@ -228,15 +243,24 @@
//淇濆瓨
saveConfirm() {
console.log('杩涘叆閿�瀛樼‘璁�');
- this.showSpinner = true;
+ debugger
var el = this.template.querySelector('c-lex-custom-lightning-datatable');
+ if(el == null){
+ //this.showMyToast('閿�瀛樺け璐�',result.msg,'error');
+ return
+ }
+ this.showSpinner = true;
+ console.log('el = ' + el);
var selected = el.getSelectedRows();
+ console.log('selected');
this.selectedData = selected;
console.log('閫変腑鏁版嵁' + JSON.stringify(this.selectedData));
+ console.log('this.overdueList'+this.overdueList);
save({
iSinventory: this.iSinventory,
saveCodPageRecords: JSON.stringify(this.selectedData),
- saveoverdueList:JSON.stringify(this.overdueList)
+ // saveoverdueList:JSON.stringify(this.overdueList)
+ saveoverdueList:this.overdueList
}).then((result) => {
result = JSON.parse(JSON.stringify(result));
console.log('result淇濆瓨 = ' + JSON.stringify(result));
@@ -251,25 +275,31 @@
});
this.showSpinner = 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;
});
}
+ 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
+ }
\ No newline at end of file
--
Gitblit v1.9.1