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/lexinventoryViewLWC/lexinventoryViewLWC.js | 170 ++++++++++++++++++++++++++++++++++++++++----------------
1 files changed, 122 insertions(+), 48 deletions(-)
diff --git a/force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.js b/force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.js
index 1ae2e49..05fffbb 100644
--- a/force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.js
+++ b/force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.js
@@ -1,16 +1,20 @@
import { LightningElement, wire, api, track } from 'lwc';
import oninit from "@salesforce/apex/LexInventoryViewController.init";
-import oninit2 from "@salesforce/apex/LexInventoryViewController.init2";
import { ShowToastEvent } from "lightning/platformShowToastEvent";
import searchOrder from "@salesforce/apex/LexInventoryViewController.searchConsumableorderdetails";
import categoryAllload from "@salesforce/apex/LexInventoryViewController.categoryAllload";
import { NavigationMixin } from "lightning/navigation";
+//table css
+import { loadStyle } from "lightning/platformResourceLoader";
+import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable";
+
+
export default class LexinventoryViewLWC extends NavigationMixin(LightningElement) {
//鍒嗛〉start
@track sortBy = "";
//@track sortDirection = "asc";
- @track pageSize = 5;
+ @track pageSize = 10;
error;
records;
currentPageToken = 0;
@@ -20,7 +24,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
@@ -48,7 +52,8 @@
@track showSpinners = false;
//鍖婚櫌鐗逛环
@track hasHos = false;
-
+ //琛ㄥご鏍峰紡
+ stylesLoaded = false;
@track columns = [
@@ -58,13 +63,15 @@
type: "Name",
sortable: true,
hideDefaultActions: true,
- initialWidth: 250,
+ // initialWidth: 300,
wrapText: true,
cellAttributes: { alignment: "left" }
},
{
label: "绗笁鍒嗙被",
fieldName: "Category3__c",
+ initialWidth: 90,
+ cellAttributes: { alignment: "left" },
hideDefaultActions: true,
sortable: true,
wrapText: true,
@@ -72,6 +79,8 @@
{
label: "绗洓鍒嗙被",
fieldName: "Category4__c",
+ cellAttributes: { alignment: "left" },
+ initialWidth: 90,
hideDefaultActions: true,
wrapText: true,
sortable: true,
@@ -80,6 +89,8 @@
{
label: "绗簲鍒嗙被",
fieldName: "Category5__c",
+ cellAttributes: { alignment: "left" },
+ initialWidth: 90,
hideDefaultActions: true,
wrapText: true,
sortable: true,
@@ -89,50 +100,71 @@
{
label: "瑙勬牸",
fieldName: "packing_list",
+ cellAttributes: { alignment: "right" },
+ initialWidth: 55,
wrapText: true,
hideDefaultActions: true,
},
{
label: "鍗曚綅",
fieldName: "BoxPiece",
+ cellAttributes: { alignment: "left" },
+ initialWidth: 55,
wrapText: true,
hideDefaultActions: true,
},
{
label: "娉ㄥ唽璇佺紪鐮佸彿",
fieldName: "approbation_No",
+ cellAttributes: { alignment: "left" },
wrapText: true,
- initialWidth: 100,
+ initialWidth: 155,
hideDefaultActions: true,
},
{
label: "娉ㄥ唽鏈夋晥鏈�",
fieldName: "expiration_Date",
+ cellAttributes: { alignment: "left" },
wrapText: true,
hideDefaultActions: true,
- initialWidth: 150
+ initialWidth: 100
},
{
label: "CFDA鐘舵��",
fieldName: "SFDA_Status__c",
+ cellAttributes: { alignment: "left" },
+ initialWidth: 80,
+ wrapText: true,
hideDefaultActions: true,
},
{
label: "浣跨敤鏈熼檺",
fieldName: "guaranteeperiod",
+ cellAttributes: { alignment: "left" },
hideDefaultActions: true,
- initialWidth: 100
+ initialWidth: 95
},
{
- label: "鏈夋晥鏈熷唴搴撳瓨",
- fieldName: "limitCount",
+ label:'鏈夋晥鏈熷唴搴撳瓨',
+ type: "customInventoryColor",
+ cellAttributes: {alignment: "right" },
+ typeAttributes: {
+ value: { fieldName:"limitCount"},
+ upperlimit: { fieldName: "upperlimit" },
+ lowerlimit: { fieldName: "lowerlimit" },
+ boxPrice:{ fieldName: "BoxPiece" },
+ },
hideDefaultActions: true,
- sortable: true,
+
+ initialWidth:95
},
+
{
label: "杩囨湡搴撳瓨",
fieldName: "overlimitCount",
hideDefaultActions: true,
+ cellAttributes: { alignment: "right" },
+ initialWidth:75
}
];
defaultSortDirection = "asc";
@@ -140,6 +172,21 @@
sortedBy;
+
+ 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() {
this.loader = true;
this.init();
@@ -154,6 +201,8 @@
sortOrderLWC: this.sortDirection
}).then((result) => {
result = JSON.parse(JSON.stringify(result));
+ console.log("result.pageRecords = " + JSON.stringify(result.entity.pageRecords));
+ console.log("result.consumableorderdetailsRecords = " + JSON.stringify(result.entity.consumableorderdetailsRecords));
console.log("result.status = " + result.status);
console.log("result = " + JSON.stringify(result));
console.log("result 1= " + JSON.stringify(result.entity));
@@ -213,13 +262,18 @@
this.category5Options = option3ValueTemp;
this.hasHos = result.entity.hasHos;
console.log('this.hasHos'+this.hasHos);
+ //棰滆壊鏍囪
+
//hasHos = true 鍖婚櫌鐗逛环
if (this.hasHos) {
let object1 = {
label: "鍖婚櫌鐗逛环",
fieldName: "hospitalSpecialOffer__c",
hideDefaultActions: true,
- type:'boolean'
+ type:'boolean',
+ cellAttributes: { alignment: "left" },
+ initialWidth:75
+
};
this.columns.push(object1);
console.log(' this.columns'+ this.columns);
@@ -235,15 +289,8 @@
}
this.showSpinner = false;
} else {
- this.loader = false;
- console.log("Error:" + result.errorMsg);
- const evt = new ShowToastEvent({
- title: "瑙f瀽澶辫触",
- message: result.errorMsg,
- variant: "error"
- });
- this.dispatchEvent(evt);
- this.showSpinner = false;
+ // this.showToast("Error",'Error', result.msg);
+ this.showMyToast('鍒濆鍖栧け璐�','result.msg','error');
}
}).catch((error) => {
this.loader = false;
@@ -343,7 +390,7 @@
}
} else {
console.log("result = " + JSON.stringify(result));
- this.showToast("Error", result.msg);
+ this.showMyToast(result.msg,'','error');
}
}).catch((error) => {
console.log("error" + JSON.stringify(error));
@@ -377,12 +424,8 @@
console.log('this.totalPages = ' + this.totalPages);
this.paginationVisibility = this.totalPages > 1 ? true : false;
console.log('this.sortDirection = ' + this.sortDirection);
- const evt = new ShowToastEvent({
- title: "鎼滅储鎴愬姛",
- message: result.msg,
- variant: "Success"
- });
- this.dispatchEvent(evt);
+ // this.showToast("Success",'鎼滅储鎴愬姛', result.msg);
+ this.showMyToast('鎼滅储鎴愬姛',result.msg,'success');
this.data = result.entity.pageRecords;
console.log('鎼滅储Data==>'+JSON.stringify(this.data));
for (var i in this.data) {
@@ -397,12 +440,8 @@
console.log('this.data = ' + JSON.stringify(this.data));
this.showTable = true;
} else {
- const evt = new ShowToastEvent({
- title: "",
- message: result.msg,
- variant: "Success"
- });
- this.dispatchEvent(evt);
+ // this.showToast("Error",'Error', result.msg);
+ this.showMyToast('鎼滅储澶辫触','result.msg','error');
}
})
.catch((error) => {
@@ -467,12 +506,23 @@
orderDetZaikuListLWC: JSON.stringify(this.orderDetZaikuList),
accountName: this.accountName,
agencyProType: this.agencyProType,
- userWorkLocation: this.userWorkLocation
+ userWorkLocation: this.userWorkLocation,
+ pageSizeLWC: this.pageSize,
+ pageTokenLWC: this.currentPageToken,
})
.then((result) => {
console.log("result鎼滅储 = " + JSON.stringify(result));
result = JSON.parse(JSON.stringify(result));
if (result.status == "Success") {
+
+ 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);
this.data = result.entity.pageRecords;
for (var i in this.data) {
@@ -484,20 +534,12 @@
}
this.showSpinner = false;
this.showTable = true;
- const evt = new ShowToastEvent({
- title: "鎼滅储鎴愬姛",
- message: result.msg,
- variant: "Success"
- });
- this.dispatchEvent(evt);
+ this.showMyToast('鎼滅储鎴愬姛',result.msg,'success');
+ // this.showToast("Success",'鎼滅储鎴愬姛', result.msg);
this.showSpinner = false;
} else {
- const evt = new ShowToastEvent({
- title: "",
- message: result.msg,
- variant: "Success"
- });
- this.dispatchEvent(evt);
+ // this.showToast("Error", 'Error',result.msg);
+ this.showMyToast('鎼滅储澶辫触','result.msg','error');
}
})
.catch((error) => {
@@ -578,6 +620,38 @@
get nextButtonDisabled() {
return this.nextPageToken === undefined;
}
+ 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);
-
+
+ // showToast(type,title,msg) {
+ // this.showSpinner = false;
+ // let mode = '';
+ // if (type.toLowerCase() != 'success') {
+ // mode = 'sticky';
+ // } else {
+ // mode = 'dismissable';
+ // }
+ // const event = new ShowToastEvent({
+ // title: title,
+ // variant: type,
+ // message: msg,
+ // mode: mode
+ // });
+ // this.dispatchEvent(event);
+ // }
+ }
}
\ No newline at end of file
--
Gitblit v1.9.1