From cd05a7b0ab8dd5838f8998fb36fc0435fd9c5b84 Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期二, 11 七月 2023 14:07:40 +0800
Subject: [PATCH] LEX Community Code Deploy0711
---
force-app/main/default/lwc/lexTopPage/lexTopPage.js | 1513 ++++++++++++++++++++++++++++-----------------------------
1 files changed, 748 insertions(+), 765 deletions(-)
diff --git a/force-app/main/default/lwc/lexTopPage/lexTopPage.js b/force-app/main/default/lwc/lexTopPage/lexTopPage.js
index 2af5fa4..47589c0 100644
--- a/force-app/main/default/lwc/lexTopPage/lexTopPage.js
+++ b/force-app/main/default/lwc/lexTopPage/lexTopPage.js
@@ -1,793 +1,776 @@
-import { LightningElement, wire, api, track } from 'lwc';
-import { ShowToastEvent } from 'lightning/platformShowToastEvent';
-import { NavigationMixin } from 'lightning/navigation';
-import initPage from '@salesforce/apex/LexTopPageController.initPage';
-import initTotalNum from '@salesforce/apex/LexConsumableGoodsInfo.initTotalNum';
-import initArrDet from '@salesforce/apex/LexConsumableGoodsInfo.initArrDet';
-import initArrDetAll from '@salesforce/apex/LexConsumableGoodsInfo.initArrDetAll';
-import initDeliveryDet from '@salesforce/apex/LexConsumableGoodsInfo.initDeliveryDet';
-import initDeliveryDetAll from '@salesforce/apex/LexConsumableGoodsInfo.initDeliveryDetAll';
-import initNotArrDet from '@salesforce/apex/LexConsumableGoodsInfo.initNotArrDet';
-import initNotArrDetAll from '@salesforce/apex/LexConsumableGoodsInfo.initNotArrDetAll';
-import initMoreThan7 from '@salesforce/apex/LexConsumableGoodsInfo.initMoreThan7';
-import initMoreThan7All from '@salesforce/apex/LexConsumableGoodsInfo.initMoreThan7All';
+import { LightningElement, wire, api, track } from "lwc";
+import { ShowToastEvent } from "lightning/platformShowToastEvent";
+import { NavigationMixin } from "lightning/navigation";
+import initPage from "@salesforce/apex/LexTopPageController.initPage";
+import initTotalNum from "@salesforce/apex/LexConsumableGoodsInfo.initTotalNum";
+import initArrDet from "@salesforce/apex/LexConsumableGoodsInfo.initArrDet";
+import initArrDetAll from "@salesforce/apex/LexConsumableGoodsInfo.initArrDetAll";
+import initDeliveryDet from "@salesforce/apex/LexConsumableGoodsInfo.initDeliveryDet";
+import initDeliveryDetAll from "@salesforce/apex/LexConsumableGoodsInfo.initDeliveryDetAll";
+import initNotArrDet from "@salesforce/apex/LexConsumableGoodsInfo.initNotArrDet";
+import initNotArrDetAll from "@salesforce/apex/LexConsumableGoodsInfo.initNotArrDetAll";
+import initMoreThan7 from "@salesforce/apex/LexConsumableGoodsInfo.initMoreThan7";
+import initMoreThan7All from "@salesforce/apex/LexConsumableGoodsInfo.initMoreThan7All";
//table css
-import { loadStyle } from 'lightning/platformResourceLoader';
-import WrappedHeaderTable from '@salesforce/resourceUrl/lexdatatable';
+import { loadStyle } from "lightning/platformResourceLoader";
+import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable";
export default class LexTopPage extends NavigationMixin(LightningElement) {
- @track title = [];
- @track raesList = [];
- @track column = [];
- @track overlimitdateorderdetails = [];
- @track productLimitRecords = [];
- @track accountInfo;
- @track accountId;
- @track userPro_Type;
- @track pageRecords = [];
- @track csvData = [];
- @track product_Limit;
- @track over_view = false;
- @track overlimit = false;
- @track hasHos = false;
- @track activeSections = ['A', 'B', 'C'];
- @track isRender = false;
- @track consumableorderdetailsRecordsview;
- @track showSpinner = true;
- @track showPage = false;
- //
- @track showPop = false;
- @track popTitle;
- @track totalNum;
- @track orderNumberArrived;
- @track deliveryDetailCount;
- @track orderNumberNotarrive;
- @track moreThanSevenDays;
- stylesLoaded = false;
+ @track title = [];
+ @track raesList = [];
+ @track column = [];
+ @track overlimitdateorderdetails = [];
+ @track productLimitRecords = [];
+ @track accountInfo;
+ @track accountId;
+ @track userPro_Type;
+ @track pageRecords = [];
+ @track csvData = [];
+ @track product_Limit;
+ @track over_view = false;
+ @track overlimit = false;
+ @track hasHos = false;
+ @track activeSections = ["A", "B", "C"];
+ @track isRender = false;
+ @track consumableorderdetailsRecordsview;
+ @track showSpinner = true;
+ @track showPage = false;
+ //
+ @track showPop = false;
+ @track popTitle;
+ @track totalNum;
+ @track orderNumberArrived;
+ @track deliveryDetailCount;
+ @track orderNumberNotarrive;
+ @track moreThanSevenDays;
+ stylesLoaded = false;
- @track showTable = false;
- @track hidecheckboxcolumn = true;
- //鎺掑簭
- defaultSortDirection = 'asc';
- sortDirection = 'asc';
- sortedBy;
+ @track showTable = false;
+ @track hidecheckboxcolumn = true;
+ //鎺掑簭
+ defaultSortDirection = "asc";
+ sortDirection = "asc";
+ sortedBy;
- //鍒嗛〉start
- @track sortBy = '';
- @track pageSize = 10;
- error;
- records;
- currentPageToken = 0;
- nextPageToken = this.pageSize;
- @track totalRecords = 0;
- @track loader = false;
- @track pageNumber = 1;
- @track paginationVisibility = false;
- @track totalPages = 1;
- pageSizeOptions = [10, 25, 50, 100];
- @track recordStart = 0;
- @track recordEnd = 0;
- //end
+ //鍒嗛〉start
+ @track sortBy = "";
+ @track pageSize = 10;
+ error;
+ records;
+ currentPageToken = 0;
+ nextPageToken = this.pageSize;
+ @track totalRecords = 0;
+ @track loader = false;
+ @track pageNumber = 1;
+ @track paginationVisibility = false;
+ @track totalPages = 1;
+ pageSizeOptions = [10, 25, 50, 100];
+ @track recordStart = 0;
+ @track recordEnd = 0;
+ //end
- //鏄惁涓�鐩存樉绀烘彁绀�
- @track isNoteStay = true;
+ //鏄惁涓�鐩存樉绀烘彁绀�
+ @track isNoteStay = true;
- //鏈叏閮ㄥ彂璐ц鍗曟槑缁哻ol
- @track colms = [
- {
- label: '娑堣�楀搧璁㈠崟鍚嶇О',
- type: 'customOutputGood',
- typeAttributes: {
- outputValue: { fieldName: 'Name' },
- type: 'Title',
- recordId: { fieldName: 'Id' }
- },
- hideDefaultActions: true,
- initialWidth: 200
- },
- {
- label: 'SAP鍚堝悓鍙�',
- fieldName: 'ContractNo__c',
- hideDefaultActions: true,
- initialWidth: 180
- },
- {
- label: '璁㈠崟鎬绘暟',
- type: 'customOutputGood',
- typeAttributes: {
- outputValue: { fieldName: 'Total_num__c' },
- type: 'TotalNum',
- recordId: { fieldName: 'Id' }
- },
- hideDefaultActions: true,
- initialWidth: 100
- },
- {
- label: '宸插埌璐ф暟閲�',
- type: 'customOutputGood',
- typeAttributes: {
- outputValue: { fieldName: 'OrderNumber_arrived__c' },
- type: 'ArrDet',
- recordId: { fieldName: 'Id' }
- },
- hideDefaultActions: true,
- initialWidth: 110
- },
- {
- label: '寰呯郴缁熸搷浣滃叆搴撴暟閲�',
- type: 'customOutputGood',
- typeAttributes: {
- outputValue: { fieldName: 'Delivery_detail_count__c' },
- type: 'DeliveryDet',
- recordId: { fieldName: 'Id' }
- },
- hideDefaultActions: true,
- initialWidth: 180
- },
- {
- label: '杩樻病鍙戣揣鏁伴噺',
- type: 'customOutputGood',
- typeAttributes: {
- outputValue: { fieldName: 'OrderNumber_notarrive__c' },
- type: 'NotArrDet',
- recordId: { fieldName: 'Id' }
- },
- hideDefaultActions: true,
- initialWidth: 120
- },
- {
- label: '鍙戣揣涓冨ぉ杩樻湭鍒拌揣鏁�',
- type: 'customOutputGood',
- typeAttributes: {
- outputValue: { fieldName: 'More_than_seven_days__c' },
- type: 'MoreThan7',
- recordId: { fieldName: 'Id' }
- },
- hideDefaultActions: true,
- initialWidth: 180
- },
- {
- label: '鏈�鏂板彂璐ф棩鏈�',
- fieldName: 'Shipment_date__c',
- hideDefaultActions: true,
- initialWidth: 140
- },
- {
- label: '棣栨鍙戣揣鏃ユ湡',
- fieldName: 'First_Delivery__c',
- hideDefaultActions: true,
- initialWidth: 140
- }
- ];
-
- @track colms2 = [
- { label: '浜у搧鍨嬪彿', fieldName: 'prodModel', hideDefaultActions: true },
- {
- label: '鏁伴噺',
- fieldName: 'recordCount',
- hideDefaultActions: true,
- initialWidth: 60,
- cellAttributes: { alignment: 'center' }
- }
- ];
-
- //浣跨敤鏈熼檺灏忎簬涓�骞寸殑浜у搧col
- @track colm3 = [
- { label: '浜у搧鍨嬪彿', fieldName: 'prodName', hideDefaultActions: true },
- {
- label: '鏁伴噺',
- fieldName: 'countid',
- hideDefaultActions: true,
- cellAttributes: { alignment: 'left' }
- },
- {
- label: '鍗曚綅',
- fieldName: 'BoxPiece',
- hideDefaultActions: true,
- cellAttributes: { alignment: 'left' }
- }
- ];
-
- //缁忛攢鍟嗗簱瀛樹笂涓嬮檺col
- @track colm4 = [
- { label: '浜у搧鍨嬪彿', fieldName: 'prodName', hideDefaultActions: true },
- {
- label: '搴撳瓨涓嬮檺',
- fieldName: 'limitLow',
- hideDefaultActions: true,
- cellAttributes: { alignment: 'left' }
- },
- {
- label: '搴撳瓨涓婇檺',
- fieldName: 'limitUp',
- hideDefaultActions: true,
- cellAttributes: { alignment: 'left' }
- }
- ];
- @track columns = [
- {
- label: '娑堣�楀搧鍚嶇О',
- fieldName: 'Name__c',
- type: 'Name',
- sortable: true,
- hideDefaultActions: true,
- wrapText: true,
- cellAttributes: { alignment: 'left' }
- },
- {
- label: '瑙勬牸',
- fieldName: 'packing_list',
- cellAttributes: { alignment: 'right' },
- initialWidth: 50,
- wrapText: true,
- hideDefaultActions: true
- },
- {
- label: '绗笁鍒嗙被',
- fieldName: 'Category3__c',
- initialWidth: 85,
- cellAttributes: { alignment: 'left' },
- hideDefaultActions: true,
- wrapText: true
- },
- {
- label: '绗洓鍒嗙被',
- fieldName: 'Category4__c',
- cellAttributes: { alignment: 'left' },
- initialWidth: 85,
- hideDefaultActions: true,
- wrapText: true
- },
- {
- label: '绗簲鍒嗙被',
- fieldName: 'Category5__c',
- cellAttributes: { alignment: 'left' },
- initialWidth: 85,
- hideDefaultActions: true,
- wrapText: true,
- sortable: true
- },
- {
- label: 'CFDA鐘舵��',
- fieldName: 'SFDA_Status__c',
- cellAttributes: { alignment: 'left' },
- initialWidth: 80,
- hideDefaultActions: true
- },
- {
- label: '娉ㄥ唽璇佺紪鐮佸彿',
- fieldName: 'approbation_No',
- cellAttributes: { alignment: 'left' },
- wrapText: true,
- initialWidth: 155,
- hideDefaultActions: true
- },
- {
- label: '娉ㄥ唽璇佹晥鏈�',
- fieldName: 'expiration_Date',
- cellAttributes: { alignment: 'left' },
- wrapText: true,
- hideDefaultActions: true,
- initialWidth: 100
- },
- {
- label: '浜у搧鏁伴噺涓嬮檺',
- fieldName: 'lowerlimit',
- cellAttributes: { alignment: 'right' },
- wrapText: true,
- hideDefaultActions: true,
- initialWidth: 100
- },
- {
- label: '浣跨敤鏈熼檺',
- fieldName: 'guaranteeperiod',
- cellAttributes: { alignment: 'left' },
- hideDefaultActions: true,
- initialWidth: 95
- },
-
- {
- label: '鏈夋晥鏈熷唴搴撳瓨',
- type: 'customInventoryColor',
- cellAttributes: { alignment: 'right' },
- typeAttributes: {
- value: { fieldName: 'limitCount' },
- upperlimit: { fieldName: 'upperlimit' },
- lowerlimit: { fieldName: 'lowerlimit' },
- boxPrice: { fieldName: 'BoxPiece' }
- },
- hideDefaultActions: true,
-
- initialWidth: 95
- },
- {
- label: '杩囨湡搴撳瓨',
- fieldName: 'overlimitCount',
- hideDefaultActions: true,
- cellAttributes: { alignment: 'right' },
- initialWidth: 75
- },
- {
- label: '鍗曚綅',
- fieldName: 'BoxPiece',
- cellAttributes: { alignment: 'left' },
- initialWidth: 50,
- wrapText: true,
- hideDefaultActions: true
- }
- ];
-
- 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');
- });
- }
+ //鏈叏閮ㄥ彂璐ц鍗曟槑缁哻ol
+ @track colms = [
+ {
+ label: "娑堣�楀搧璁㈠崟鍚嶇О",
+ type: "customOutputGood",
+ typeAttributes: {
+ outputValue: { fieldName: "Name" },
+ type: "Title",
+ recordId: { fieldName: "Id" }
+ },
+ hideDefaultActions: true,
+ // initialWidth: 200,
+ wrapText: true
+ },
+ {
+ label: "SAP鍚堝悓鍙�",
+ fieldName: "ContractNo__c",
+ hideDefaultActions: true,
+ wrapText: true,
+ initialWidth: 180
+ },
+ {
+ label: "璁㈠崟鎬绘暟",
+ type: "customOutputGood",
+ typeAttributes: {
+ outputValue: { fieldName: "Total_num__c" },
+ type: "TotalNum",
+ recordId: { fieldName: "Id" }
+ },
+ hideDefaultActions: true,
+ initialWidth: 100
+ },
+ {
+ label: "宸插埌璐ф暟閲�",
+ type: "customOutputGood",
+ typeAttributes: {
+ outputValue: { fieldName: "OrderNumber_arrived__c" },
+ type: "ArrDet",
+ recordId: { fieldName: "Id" }
+ },
+ hideDefaultActions: true,
+ initialWidth: 100
+ },
+ {
+ label: "寰呯郴缁熸搷浣滃叆搴撴暟閲�",
+ type: "customOutputGood",
+ typeAttributes: {
+ outputValue: { fieldName: "Delivery_detail_count__c" },
+ type: "DeliveryDet",
+ recordId: { fieldName: "Id" }
+ },
+ hideDefaultActions: true,
+ initialWidth: 150
+ },
+ {
+ label: "杩樻病鍙戣揣鏁伴噺",
+ type: "customOutputGood",
+ typeAttributes: {
+ outputValue: { fieldName: "OrderNumber_notarrive__c" },
+ type: "NotArrDet",
+ recordId: { fieldName: "Id" }
+ },
+ hideDefaultActions: true,
+ initialWidth: 120
+ },
+ {
+ label: "鍙戣揣涓冨ぉ杩樻湭鍒拌揣鏁�",
+ type: "customOutputGood",
+ typeAttributes: {
+ outputValue: { fieldName: "More_than_seven_days__c" },
+ type: "MoreThan7",
+ recordId: { fieldName: "Id" }
+ },
+ hideDefaultActions: true,
+ initialWidth: 150
+ },
+ {
+ label: "鏈�鏂板彂璐ф棩鏈�",
+ fieldName: "Shipment_date__c",
+ hideDefaultActions: true,
+ initialWidth: 105
+ },
+ {
+ label: "棣栨鍙戣揣鏃ユ湡",
+ fieldName: "First_Delivery__c",
+ hideDefaultActions: true,
+ initialWidth: 105
}
+ ];
- connectedCallback() {
- this.loader = true;
- this.init();
+ @track colms2 = [
+ { label: "浜у搧鍨嬪彿", fieldName: "prodModel", hideDefaultActions: true },
+ {
+ label: "鏁伴噺",
+ fieldName: "recordCount",
+ hideDefaultActions: true,
+ initialWidth: 60,
+ cellAttributes: { alignment: "center" }
}
- init() {
- this.showSpinner = true;
- initPage({
- pageSizeLWC: this.pageSize,
- pageTokenLWC: this.currentPageToken
+ ];
+
+ //浣跨敤鏈熼檺灏忎簬涓�骞寸殑浜у搧col
+ @track colm3 = [
+ { label: "浜у搧鍨嬪彿", fieldName: "prodName", hideDefaultActions: true },
+ {
+ label: "鏁伴噺",
+ fieldName: "countid",
+ hideDefaultActions: true,
+ cellAttributes: { alignment: "left" }
+ },
+ {
+ label: "鍗曚綅",
+ fieldName: "BoxPiece",
+ hideDefaultActions: true,
+ cellAttributes: { alignment: "left" }
+ }
+ ];
+
+ //缁忛攢鍟嗗簱瀛樹笂涓嬮檺col
+ @track colm4 = [
+ { label: "浜у搧鍨嬪彿", fieldName: "prodName", hideDefaultActions: true },
+ {
+ label: "搴撳瓨涓嬮檺",
+ fieldName: "limitLow",
+ hideDefaultActions: true,
+ cellAttributes: { alignment: "left" }
+ },
+ {
+ label: "搴撳瓨涓婇檺",
+ fieldName: "limitUp",
+ hideDefaultActions: true,
+ cellAttributes: { alignment: "left" }
+ }
+ ];
+ @track columns = [
+ {
+ label: "娑堣�楀搧鍚嶇О",
+ fieldName: "Name__c",
+ type: "Name",
+ sortable: true,
+ hideDefaultActions: true,
+ wrapText: true,
+ cellAttributes: { alignment: "left" }
+ },
+ {
+ label: "瑙勬牸",
+ fieldName: "packing_list",
+ cellAttributes: { alignment: "right" },
+ initialWidth: 50,
+ wrapText: true,
+ hideDefaultActions: true
+ },
+ {
+ label: "绗笁鍒嗙被",
+ fieldName: "Category3__c",
+ initialWidth: 85,
+ cellAttributes: { alignment: "left" },
+ hideDefaultActions: true,
+ wrapText: true
+ },
+ {
+ label: "绗洓鍒嗙被",
+ fieldName: "Category4__c",
+ cellAttributes: { alignment: "left" },
+ initialWidth: 85,
+ hideDefaultActions: true,
+ wrapText: true
+ },
+ {
+ label: "绗簲鍒嗙被",
+ fieldName: "Category5__c",
+ cellAttributes: { alignment: "left" },
+ initialWidth: 85,
+ hideDefaultActions: true,
+ wrapText: true,
+ sortable: true
+ },
+ {
+ label: "CFDA鐘舵��",
+ fieldName: "SFDA_Status__c",
+ cellAttributes: { alignment: "left" },
+ initialWidth: 80,
+ hideDefaultActions: true
+ },
+ {
+ label: "娉ㄥ唽璇佺紪鐮佸彿",
+ fieldName: "approbation_No",
+ cellAttributes: { alignment: "left" },
+ wrapText: true,
+ initialWidth: 155,
+ hideDefaultActions: true
+ },
+ {
+ label: "娉ㄥ唽璇佹晥鏈�",
+ fieldName: "expiration_Date",
+ cellAttributes: { alignment: "left" },
+ wrapText: true,
+ hideDefaultActions: true,
+ initialWidth: 100
+ },
+ {
+ label: "浜у搧鏁伴噺涓嬮檺",
+ fieldName: "lowerlimit",
+ cellAttributes: { alignment: "right" },
+ wrapText: true,
+ hideDefaultActions: true,
+ initialWidth: 100
+ },
+ {
+ label: "浣跨敤鏈熼檺",
+ fieldName: "guaranteeperiod",
+ cellAttributes: { alignment: "left" },
+ hideDefaultActions: true,
+ initialWidth: 95
+ },
+
+ {
+ label: "鏈夋晥鏈熷唴搴撳瓨",
+ type: "customInventoryColor",
+ cellAttributes: { alignment: "right" },
+ typeAttributes: {
+ value: { fieldName: "limitCount" },
+ upperlimit: { fieldName: "upperlimit" },
+ lowerlimit: { fieldName: "lowerlimit" },
+ boxPrice: { fieldName: "BoxPiece" }
+ },
+ hideDefaultActions: true,
+
+ initialWidth: 95
+ },
+ {
+ label: "杩囨湡搴撳瓨",
+ fieldName: "overlimitCount",
+ hideDefaultActions: true,
+ cellAttributes: { alignment: "right" },
+ initialWidth: 75
+ },
+ {
+ label: "鍗曚綅",
+ fieldName: "BoxPiece",
+ cellAttributes: { alignment: "left" },
+ initialWidth: 50,
+ wrapText: true,
+ hideDefaultActions: true
+ }
+ ];
+
+ renderedCallback() {
+ if (!this.stylesLoaded) {
+ Promise.all([loadStyle(this, WrappedHeaderTable)])
+ .then(() => {
+ console.log("Custom styles loaded");
+ this.stylesLoaded = true;
})
- .then((result) => {
- this.isNoteStay = result.isNoteStay;
- console.log('isNoteStay:' + result.isNoteStay);
- if (result.result == 'Success') {
- //鍒嗛〉start
- this.nextPageToken = result.paginatedAccounts.nextPageToken;
- this.totalRecords = result.paginatedAccounts.totalRecords;
- this.recordStart = result.paginatedAccounts.recordStart;
- this.recordEnd = result.paginatedAccounts.recordEnd;
- this.totalPages = Math.ceil(
- result.paginatedAccounts.totalRecords / this.pageSize
- );
- console.log('this.totalPages = ' + this.totalPages);
- this.paginationVisibility =
- this.totalPages > 1 ? true : false;
- console.log('this.sortDirection = ' + this.sortDirection);
- this.loader = false;
- //鍒嗛〉end
- this.title = result.title;
- this.totalNum = result.totalNum;
- this.orderNumberArrived = result.orderNumberArrived;
- this.deliveryDetailCount = result.deliveryDetailCount;
- this.orderNumberNotarrive = result.orderNumberNotarrive;
- this.moreThanSevenDays = result.moreThanSevenDays;
- this.raesList = result.raesList;
- this.raesList.push({
- Id: '1',
- Name: '寰呮搷浣滃叆搴撹鍗曟眹鎬�',
- Total_num__c: this.totalNum,
- OrderNumber_arrived__c: this.orderNumberArrived,
- Delivery_detail_count__c: this.deliveryDetailCount,
- OrderNumber_notarrive__c: this.orderNumberNotarrive,
- More_than_seven_days__c: this.moreThanSevenDays
- });
- this.column = result.column;
- this.accountInfo = result.accountInfo;
- this.accountId = result.accountInfo.Id;
- this.pageRecords = result.pageRecords;
- this.overlimitdateorderdetails =
- result.overlimitdateorderdetails;
- this.over_view = result.over_view;
- this.overlimit = result.overlimit;
- this.hasHos = result.hasHos;
- this.product_Limit = result.product_Limit;
- console.log('result==>' + JSON.stringify(result));
- for (var i in this.pageRecords) {
- this.pageRecords[i]['Name__c'] =
- this.pageRecords[i].Prod.Name__c;
- this.pageRecords[i]['Category3__c'] =
- this.pageRecords[i].Prod.Category3__c;
- this.pageRecords[i]['Category4__c'] =
- this.pageRecords[i].Prod.Category3__c;
- this.pageRecords[i]['Category5__c'] =
- this.pageRecords[i].Prod.Category3__c;
- this.pageRecords[i]['SFDA_Status__c'] =
- this.pageRecords[i].Prod.SFDA_Status__c;
- }
- //hasHos = true 鍖婚櫌鐗逛环
- if (this.hasHos) {
- let object1 = {
- label: '鍖婚櫌鐗逛环',
- fieldName: 'hospitalSpecialOffer',
- hideDefaultActions: true,
- type: 'boolean',
- cellAttributes: { alignment: 'left' },
- initialWidth: 75
- };
- this.columns.push(object1);
- console.log(' this.columns' + this.columns);
- for (var j in this.pageRecords) {
- this.pageRecords[j]['Name__c'] =
- this.pageRecords[j].Prod.Name__c;
- this.pageRecords[j]['Category3__c'] =
- this.pageRecords[j].Prod.Category3__c;
- this.pageRecords[j]['Category4__c'] =
- this.pageRecords[j].Prod.Category3__c;
- this.pageRecords[j]['Category5__c'] =
- this.pageRecords[j].Prod.Category3__c;
- this.pageRecords[j]['SFDA_Status__c'] =
- this.pageRecords[j].Prod.SFDA_Status__c;
- this.pageRecords[j]['hospitalSpecialOffer__c'] =
- this.pageRecords[j].hospitalSpecialOffer;
- }
- }
- this.showTable = true;
- if (
- this.product_Limit != null &&
- this.product_Limit != ''
- ) {
- var records = this.product_Limit.split(',');
- for (var i in records) {
- var parms = records[i].split('|');
- var record = new Object();
- record['prodName'] = parms[0];
- record['limitLow'] = parms[1];
- record['limitUp'] = parms[2];
- this.productLimitRecords.push(record);
- }
- }
- // this.productLimitRecords = records;
- console.log(
- 'productLimitRecords:' +
- JSON.stringify(this.productLimitRecords)
- );
- console.log('product_Limit:' + this.product_Limit);
- this.consumableorderdetailsRecordsview =
- result.consumableorderdetailsRecordsview;
- //add by WangXueqin 2023/05/05
- this.userPro_Type = result.userPro_Type;
- console.log('this.accountId:' + this.accountId);
- console.log(
- 'this.accountInfo:' + JSON.stringify(this.accountInfo)
- );
- this.showSpinner = false;
- this.showPage = true;
- // this.showMyToast('鍒濆鍖栭〉闈㈡垚鍔�', '', 'success');
- } else {
- this.showPage = true;
- this.showSpinner = false;
- console.log('Error:' + result.errorMsg);
- this.showMyToast(
- '鍒濆鍖栭〉闈㈠け璐�',
- result.errorMsg,
- 'error'
- );
- }
- })
- .catch((error) => {
- this.showSpinner = false;
- console.log('Error:' + error);
- this.showMyToast(
- '鍒濆鍖栭〉闈㈠け璐�',
- JSON.stringify(error),
- 'error'
- );
- });
- }
-
- //鐐瑰嚮閾炬帴
- clickLick(event) {
- var outputValue = event.detail.data.value;
- var outputType = event.detail.data.type;
- var recordId = event.detail.data.recordId;
- console.log(
- 'click:' + outputValue + '---' + outputType + '---' + recordId
- );
- if (outputType == 'Title') {
- const config = {
- type: 'standard__webPage',
- attributes: {
- url: '/lexarrivegoods?ESetId=' + recordId
- }
- };
- this[NavigationMixin.Navigate](config);
- } else if (outputType == 'TotalNum') {
- this.popTitle = '鎵�鏈変骇鍝佷竴瑙�';
- initTotalNum({ ordId: recordId, type: '' }).then((result) => {
- if (result.result == 'Success') {
- this.recordList = result.recordList;
- console.log('data:' + JSON.stringify(this.recordList));
- this.showPop = true;
- } else {
- this.showMyToast(
- '鍔犺浇鎵�鏈変骇鍝佷竴瑙堥〉闈㈠け璐�',
- result.errorMsg,
- 'error'
- );
- }
- });
- } else if (outputType == 'ArrDet') {
- if (recordId == '1') {
- this.popTitle = '鎵�鏈夊凡鍒拌揣浜у搧涓�瑙�';
- initArrDetAll({ type: '' }).then((result) => {
- if (result.result == 'Success') {
- this.recordList = result.recordList;
- console.log('data:' + JSON.stringify(this.recordList));
- this.showPop = true;
- } else {
- this.showMyToast(
- '鍔犺浇鎵�鏈夊凡鍒拌揣浜у搧涓�瑙堥〉闈㈠け璐�',
- result.errorMsg,
- 'error'
- );
- }
- });
- } else {
- this.popTitle = '宸插埌璐т骇鍝佷竴瑙�';
- initArrDet({ orderId: recordId }).then((result) => {
- if (result.result == 'Success') {
- this.recordList = result.recordList;
- console.log('data:' + JSON.stringify(this.recordList));
- this.showPop = true;
- } else {
- this.showMyToast(
- '鍔犺浇宸插埌璐т骇鍝佷竴瑙堥〉闈㈠け璐�',
- result.errorMsg,
- 'error'
- );
- }
- });
- }
- } else if (outputType == 'DeliveryDet') {
- if (recordId == '1') {
- this.popTitle = '鎵�鏈夊凡鍙戣揣杩樻病鍒拌揣浜у搧涓�瑙�';
- initDeliveryDetAll({ type: '' }).then((result) => {
- if (result.result == 'Success') {
- this.recordList = result.recordList;
- console.log('data:' + JSON.stringify(this.recordList));
- this.showPop = true;
- } else {
- this.showMyToast(
- '鍔犺浇鎵�鏈夊凡鍙戣揣杩樻病鍒拌揣浜у搧涓�瑙堥〉闈㈠け璐�',
- result.errorMsg,
- 'error'
- );
- }
- });
- } else {
- this.popTitle = '鏈埌璐т骇鍝佷竴瑙�';
- initDeliveryDet({ orderId: recordId }).then((result) => {
- if (result.result == 'Success') {
- this.recordList = result.recordList;
- console.log('data:' + JSON.stringify(this.recordList));
- this.showPop = true;
- } else {
- this.showMyToast(
- '鍔犺浇鏈埌璐т骇鍝佷竴瑙堥〉闈㈠け璐�',
- result.errorMsg,
- 'error'
- );
- }
- });
- }
- } else if (outputType == 'NotArrDet') {
- if (recordId == '1') {
- this.popTitle = '鎵�鏈夎繕娌″彂璐т骇鍝佷竴瑙�';
- initNotArrDetAll({ type: '' }).then((result) => {
- if (result.result == 'Success') {
- this.recordList = result.recordList;
- console.log('data:' + JSON.stringify(this.recordList));
- this.showPop = true;
- } else {
- this.showMyToast(
- '鍔犺浇鎵�鏈夎繕娌″彂璐т骇鍝佷竴瑙堥〉闈㈠け璐�',
- result.errorMsg,
- 'error'
- );
- }
- });
- } else {
- this.popTitle = '杩樻病鍙戣揣鏁伴噺';
- initNotArrDet({ orderId: recordId }).then((result) => {
- if (result.result == 'Success') {
- this.recordList = result.recordList;
- console.log('data:' + JSON.stringify(this.recordList));
- this.showPop = true;
- } else {
- this.showMyToast(
- '鍔犺浇杩樻病鍙戣揣鏁伴噺椤甸潰澶辫触',
- result.errorMsg,
- 'error'
- );
- }
- });
- }
- } else if (outputType == 'MoreThan7') {
- if (recordId == '1') {
- this.popTitle = '鎵�鏈夊彂璐т竷澶╄繕鏈埌璐ф暟';
- initMoreThan7All({ type: '' }).then((result) => {
- if (result.result == 'Success') {
- this.recordList = result.recordList;
- console.log('data:' + JSON.stringify(this.recordList));
- this.showPop = true;
- } else {
- this.showMyToast(
- '鍔犺浇鎵�鏈夊彂璐т竷澶╄繕鏈埌璐ф暟椤甸潰澶辫触',
- result.errorMsg,
- 'error'
- );
- }
- });
- } else {
- this.popTitle = '鍙戣揣涓冨ぉ杩樻湭鍒拌揣鏁�';
- initMoreThan7({ orderId: recordId }).then((result) => {
- if (result.result == 'Success') {
- this.recordList = result.recordList;
- console.log('data:' + JSON.stringify(this.recordList));
- this.showPop = true;
- } else {
- this.showMyToast(
- '鍔犺浇鍙戣揣涓冨ぉ杩樻湭鍒拌揣鏁伴〉闈㈠け璐�',
- result.errorMsg,
- 'error'
- );
- }
- });
- }
- }
- }
-
- //鍏抽棴寮圭獥
- closePop() {
- this.showPop = false;
- }
-
- editProductLimit(event) {
- //add by Wang Xueqin 2023/05/05
- let url =
- '/LexProductLimitEdit?accountid=' +
- this.accountId +
- '&userPro_Type=' +
- this.userPro_Type;
- const config = {
- type: 'standard__webPage',
- attributes: {
- url: url
- }
- };
- this[NavigationMixin.Navigate](config);
- }
-
- //鏂板缓娑堣�楀搧璁㈠崟
- newOrder() {
- this[NavigationMixin.Navigate]({
- type: 'standard__objectPage',
- attributes: {
- objectApiName: 'Consumable_order__c',
- actionName: 'new'
- },
- state: {
- useRecordTypeCheck: 1
- }
+ .catch((error) => {
+ console.error("Error loading custom styles");
});
}
+ }
- showMyToast(title, message, variant) {
- console.log('show custom message');
- var iconName = '';
- var content = '';
- if (variant == 'success') {
- iconName = 'utility:check';
+ connectedCallback() {
+ this.loader = true;
+ this.init();
+ }
+ init() {
+ this.showSpinner = true;
+ initPage({
+ pageSizeLWC: this.pageSize,
+ pageTokenLWC: this.currentPageToken
+ })
+ .then((result) => {
+ this.isNoteStay = result.isNoteStay;
+ console.log("isNoteStay:" + result.isNoteStay);
+ if (result.result == "Success") {
+ //鍒嗛〉start
+ this.nextPageToken = result.paginatedAccounts.nextPageToken;
+ this.totalRecords = result.paginatedAccounts.totalRecords;
+ this.recordStart = result.paginatedAccounts.recordStart;
+ this.recordEnd = result.paginatedAccounts.recordEnd;
+ this.totalPages = Math.ceil(
+ result.paginatedAccounts.totalRecords / this.pageSize
+ );
+ console.log("this.totalPages = " + this.totalPages);
+ this.paginationVisibility = this.totalPages > 1 ? true : false;
+ console.log("this.sortDirection = " + this.sortDirection);
+ this.loader = false;
+ //鍒嗛〉end
+ this.title = result.title;
+ this.totalNum = result.totalNum;
+ this.orderNumberArrived = result.orderNumberArrived;
+ this.deliveryDetailCount = result.deliveryDetailCount;
+ this.orderNumberNotarrive = result.orderNumberNotarrive;
+ this.moreThanSevenDays = result.moreThanSevenDays;
+ this.raesList = result.raesList;
+ this.raesList.push({
+ Id: "1",
+ Name: "寰呮搷浣滃叆搴撹鍗曟眹鎬�",
+ Total_num__c: this.totalNum,
+ OrderNumber_arrived__c: this.orderNumberArrived,
+ Delivery_detail_count__c: this.deliveryDetailCount,
+ OrderNumber_notarrive__c: this.orderNumberNotarrive,
+ More_than_seven_days__c: this.moreThanSevenDays
+ });
+ this.column = result.column;
+ this.accountInfo = result.accountInfo;
+ this.accountId = result.accountInfo.Id;
+ this.pageRecords = result.pageRecords;
+ this.overlimitdateorderdetails = result.overlimitdateorderdetails;
+ this.over_view = result.over_view;
+ this.overlimit = result.overlimit;
+ this.hasHos = result.hasHos;
+ this.product_Limit = result.product_Limit;
+ console.log("result==>" + JSON.stringify(result));
+ for (var i in this.pageRecords) {
+ this.pageRecords[i]["Name__c"] = this.pageRecords[i].Prod.Name__c;
+ this.pageRecords[i]["Category3__c"] =
+ this.pageRecords[i].Prod.Category3__c;
+ this.pageRecords[i]["Category4__c"] =
+ this.pageRecords[i].Prod.Category3__c;
+ this.pageRecords[i]["Category5__c"] =
+ this.pageRecords[i].Prod.Category3__c;
+ this.pageRecords[i]["SFDA_Status__c"] =
+ this.pageRecords[i].Prod.SFDA_Status__c;
+ }
+ //hasHos = true 鍖婚櫌鐗逛环
+ if (this.hasHos) {
+ let object1 = {
+ label: "鍖婚櫌鐗逛环",
+ fieldName: "hospitalSpecialOffer",
+ hideDefaultActions: true,
+ type: "boolean",
+ cellAttributes: { alignment: "left" },
+ initialWidth: 75
+ };
+ this.columns.push(object1);
+ console.log(" this.columns" + this.columns);
+ for (var j in this.pageRecords) {
+ this.pageRecords[j]["Name__c"] = this.pageRecords[j].Prod.Name__c;
+ this.pageRecords[j]["Category3__c"] =
+ this.pageRecords[j].Prod.Category3__c;
+ this.pageRecords[j]["Category4__c"] =
+ this.pageRecords[j].Prod.Category3__c;
+ this.pageRecords[j]["Category5__c"] =
+ this.pageRecords[j].Prod.Category3__c;
+ this.pageRecords[j]["SFDA_Status__c"] =
+ this.pageRecords[j].Prod.SFDA_Status__c;
+ this.pageRecords[j]["hospitalSpecialOffer__c"] =
+ this.pageRecords[j].hospitalSpecialOffer;
+ }
+ }
+ this.showTable = true;
+ if (this.product_Limit != null && this.product_Limit != "") {
+ var records = this.product_Limit.split(",");
+ for (var i in records) {
+ var parms = records[i].split("|");
+ var record = new Object();
+ record["prodName"] = parms[0];
+ record["limitLow"] = parms[1];
+ record["limitUp"] = parms[2];
+ this.productLimitRecords.push(record);
+ }
+ }
+ // this.productLimitRecords = records;
+ console.log(
+ "productLimitRecords:" + JSON.stringify(this.productLimitRecords)
+ );
+ console.log("product_Limit:" + this.product_Limit);
+ this.consumableorderdetailsRecordsview =
+ result.consumableorderdetailsRecordsview;
+ //add by WangXueqin 2023/05/05
+ this.userPro_Type = result.userPro_Type;
+ console.log("this.accountId:" + this.accountId);
+ console.log("this.accountInfo:" + JSON.stringify(this.accountInfo));
+ this.showSpinner = false;
+ this.showPage = true;
+ // this.showMyToast('鍒濆鍖栭〉闈㈡垚鍔�', '', 'success');
} else {
- iconName = 'utility:error';
+ this.showPage = true;
+ this.showSpinner = false;
+ console.log("Error:" + result.errorMsg);
+ this.showMyToast("鍒濆鍖栭〉闈㈠け璐�", result.errorMsg, "error");
}
- if (message != '') {
- content =
- '<h2><strong>' +
- title +
- '<strong/></h2><h5>' +
- message +
- '</h5>';
+ })
+ .catch((error) => {
+ this.showSpinner = false;
+ console.log("Error:" + error);
+ this.showMyToast("鍒濆鍖栭〉闈㈠け璐�", JSON.stringify(error), "error");
+ });
+ }
+
+ //鐐瑰嚮閾炬帴
+ clickLick(event) {
+ var outputValue = event.detail.data.value;
+ var outputType = event.detail.data.type;
+ var recordId = event.detail.data.recordId;
+ console.log("click:" + outputValue + "---" + outputType + "---" + recordId);
+ if (outputType == "Title") {
+ const config = {
+ type: "standard__webPage",
+ attributes: {
+ url: "/lexarrivegoods?ESetId=" + recordId
+ }
+ };
+ this[NavigationMixin.Navigate](config);
+ } else if (outputType == "TotalNum") {
+ this.popTitle = "鎵�鏈変骇鍝佷竴瑙�";
+ initTotalNum({ ordId: recordId, type: "" }).then((result) => {
+ if (result.result == "Success") {
+ this.recordList = result.recordList;
+ console.log("data:" + JSON.stringify(this.recordList));
+ this.showPop = true;
} else {
- content = '<h2><strong>' + title + '<strong/></h2>';
+ this.showMyToast(
+ "鍔犺浇鎵�鏈変骇鍝佷竴瑙堥〉闈㈠け璐�",
+ result.errorMsg,
+ "error"
+ );
}
- this.template
- .querySelector('c-common-toast')
- .showToast(variant, content, iconName, 10000);
- // var mode;
- // if(this.isNoteStay){
- // mode ='sticky';
- // }else{
- // mode = 'dismissable';
- // }
- // const evt = new ShowToastEvent({
- // title: title,
- // message: message,
- // variant: variant,
- // mode: mode
- // });
- // this.dispatchEvent(evt);
+ });
+ } else if (outputType == "ArrDet") {
+ if (recordId == "1") {
+ this.popTitle = "鎵�鏈夊凡鍒拌揣浜у搧涓�瑙�";
+ initArrDetAll({ type: "" }).then((result) => {
+ if (result.result == "Success") {
+ this.recordList = result.recordList;
+ console.log("data:" + JSON.stringify(this.recordList));
+ this.showPop = true;
+ } else {
+ this.showMyToast(
+ "鍔犺浇鎵�鏈夊凡鍒拌揣浜у搧涓�瑙堥〉闈㈠け璐�",
+ result.errorMsg,
+ "error"
+ );
+ }
+ });
+ } else {
+ this.popTitle = "宸插埌璐т骇鍝佷竴瑙�";
+ initArrDet({ orderId: recordId }).then((result) => {
+ if (result.result == "Success") {
+ this.recordList = result.recordList;
+ console.log("data:" + JSON.stringify(this.recordList));
+ this.showPop = true;
+ } else {
+ this.showMyToast(
+ "鍔犺浇宸插埌璐т骇鍝佷竴瑙堥〉闈㈠け璐�",
+ result.errorMsg,
+ "error"
+ );
+ }
+ });
+ }
+ } else if (outputType == "DeliveryDet") {
+ if (recordId == "1") {
+ this.popTitle = "鎵�鏈夊凡鍙戣揣杩樻病鍒拌揣浜у搧涓�瑙�";
+ initDeliveryDetAll({ type: "" }).then((result) => {
+ if (result.result == "Success") {
+ this.recordList = result.recordList;
+ console.log("data:" + JSON.stringify(this.recordList));
+ this.showPop = true;
+ } else {
+ this.showMyToast(
+ "鍔犺浇鎵�鏈夊凡鍙戣揣杩樻病鍒拌揣浜у搧涓�瑙堥〉闈㈠け璐�",
+ result.errorMsg,
+ "error"
+ );
+ }
+ });
+ } else {
+ this.popTitle = "鏈埌璐т骇鍝佷竴瑙�";
+ initDeliveryDet({ orderId: recordId }).then((result) => {
+ if (result.result == "Success") {
+ this.recordList = result.recordList;
+ console.log("data:" + JSON.stringify(this.recordList));
+ this.showPop = true;
+ } else {
+ this.showMyToast(
+ "鍔犺浇鏈埌璐т骇鍝佷竴瑙堥〉闈㈠け璐�",
+ result.errorMsg,
+ "error"
+ );
+ }
+ });
+ }
+ } else if (outputType == "NotArrDet") {
+ if (recordId == "1") {
+ this.popTitle = "鎵�鏈夎繕娌″彂璐т骇鍝佷竴瑙�";
+ initNotArrDetAll({ type: "" }).then((result) => {
+ if (result.result == "Success") {
+ this.recordList = result.recordList;
+ console.log("data:" + JSON.stringify(this.recordList));
+ this.showPop = true;
+ } else {
+ this.showMyToast(
+ "鍔犺浇鎵�鏈夎繕娌″彂璐т骇鍝佷竴瑙堥〉闈㈠け璐�",
+ result.errorMsg,
+ "error"
+ );
+ }
+ });
+ } else {
+ this.popTitle = "杩樻病鍙戣揣鏁伴噺";
+ initNotArrDet({ orderId: recordId }).then((result) => {
+ if (result.result == "Success") {
+ this.recordList = result.recordList;
+ console.log("data:" + JSON.stringify(this.recordList));
+ this.showPop = true;
+ } else {
+ this.showMyToast(
+ "鍔犺浇杩樻病鍙戣揣鏁伴噺椤甸潰澶辫触",
+ result.errorMsg,
+ "error"
+ );
+ }
+ });
+ }
+ } else if (outputType == "MoreThan7") {
+ if (recordId == "1") {
+ this.popTitle = "鎵�鏈夊彂璐т竷澶╄繕鏈埌璐ф暟";
+ initMoreThan7All({ type: "" }).then((result) => {
+ if (result.result == "Success") {
+ this.recordList = result.recordList;
+ console.log("data:" + JSON.stringify(this.recordList));
+ this.showPop = true;
+ } else {
+ this.showMyToast(
+ "鍔犺浇鎵�鏈夊彂璐т竷澶╄繕鏈埌璐ф暟椤甸潰澶辫触",
+ result.errorMsg,
+ "error"
+ );
+ }
+ });
+ } else {
+ this.popTitle = "鍙戣揣涓冨ぉ杩樻湭鍒拌揣鏁�";
+ initMoreThan7({ orderId: recordId }).then((result) => {
+ if (result.result == "Success") {
+ this.recordList = result.recordList;
+ console.log("data:" + JSON.stringify(this.recordList));
+ this.showPop = true;
+ } else {
+ this.showMyToast(
+ "鍔犺浇鍙戣揣涓冨ぉ杩樻湭鍒拌揣鏁伴〉闈㈠け璐�",
+ result.errorMsg,
+ "error"
+ );
+ }
+ });
+ }
}
- //鎺掑簭
+ }
- sortByMethod(field, reverse, primer) {
- const key = primer
- ? function (x) {
- return primer(x[field]);
- }
- : function (x) {
- return x[field];
- };
+ //鍏抽棴寮圭獥
+ closePop() {
+ this.showPop = false;
+ }
- return function (a, b) {
- a = key(a);
- b = key(b);
- return reverse * ((a > b) - (b > a));
+ editProductLimit(event) {
+ //add by Wang Xueqin 2023/05/05
+ //let url =
+ // '/LexProductLimitEdit?accountid=' +
+ // this.accountId +
+ // '&userPro_Type=' +
+ // this.userPro_Type;
+ let url =
+ "/lexproductlimitedit?accountid=" +
+ this.accountId +
+ "&userPro_Type=" +
+ this.userPro_Type;
+ const config = {
+ type: "standard__webPage",
+ attributes: {
+ url: url
+ }
+ };
+ this[NavigationMixin.Navigate](config);
+ }
+
+ //鏂板缓娑堣�楀搧璁㈠崟
+ newOrder() {
+ this[NavigationMixin.Navigate]({
+ type: "standard__objectPage",
+ attributes: {
+ objectApiName: "Consumable_order__c",
+ actionName: "new"
+ },
+ state: {
+ useRecordTypeCheck: 1
+ }
+ });
+ }
+
+ 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);
+ // var mode;
+ // if(this.isNoteStay){
+ // mode ='sticky';
+ // }else{
+ // mode = 'dismissable';
+ // }
+ // const evt = new ShowToastEvent({
+ // title: title,
+ // message: message,
+ // variant: variant,
+ // mode: mode
+ // });
+ // this.dispatchEvent(evt);
+ }
+ //鎺掑簭
+
+ sortByMethod(field, reverse, primer) {
+ const key = primer
+ ? function (x) {
+ return primer(x[field]);
+ }
+ : function (x) {
+ return x[field];
};
- }
- onHandleSort(event) {
- console.log('Sort');
- this.sortBy = event.detail.fieldName;
- this.sortDirection = event.detail.sortDirection;
- this.currentPageToken = 0;
- console.log('this.sortBy = ' + this.sortBy);
- console.log('this.sortDirection = ' + this.sortDirection);
- const { fieldName: sortedBy, sortDirection } = event.detail;
- const cloneData = [...this.pageRecords];
- cloneData.sort(
- this.sortByMethod(sortedBy, sortDirection === 'asc' ? 1 : -1)
- );
- this.pageRecords = cloneData;
- this.sortDirection = sortDirection;
- this.sortedBy = sortedBy;
- }
- //鍒嗛〉
- handlePaginatorChange(event) {
- this.recordsToDisplay = event.detail.recordsToDisplay;
- this.preSelected = event.detail.preSelected;
- if (this.recordsToDisplay && this.recordsToDisplay > 0) {
- this.rowNumberOffset = this.recordsToDisplay[0].rowNumber - 1;
- } else {
- this.rowNumberOffset = 0;
- }
- }
- handlePrevious() {
- this.currentPageToken =
- Number(this.currentPageToken) - Number(this.pageSize);
- this.init();
- }
+ return function (a, b) {
+ a = key(a);
+ b = key(b);
+ return reverse * ((a > b) - (b > a));
+ };
+ }
- handleNext() {
- this.currentPageToken =
- Number(this.currentPageToken) + Number(this.pageSize);
- this.init();
+ onHandleSort(event) {
+ console.log("Sort");
+ this.sortBy = event.detail.fieldName;
+ this.sortDirection = event.detail.sortDirection;
+ this.currentPageToken = 0;
+ console.log("this.sortBy = " + this.sortBy);
+ console.log("this.sortDirection = " + this.sortDirection);
+ const { fieldName: sortedBy, sortDirection } = event.detail;
+ const cloneData = [...this.pageRecords];
+ cloneData.sort(
+ this.sortByMethod(sortedBy, sortDirection === "asc" ? 1 : -1)
+ );
+ this.pageRecords = cloneData;
+ this.sortDirection = sortDirection;
+ this.sortedBy = sortedBy;
+ }
+ //鍒嗛〉
+ handlePaginatorChange(event) {
+ this.recordsToDisplay = event.detail.recordsToDisplay;
+ this.preSelected = event.detail.preSelected;
+ if (this.recordsToDisplay && this.recordsToDisplay > 0) {
+ this.rowNumberOffset = this.recordsToDisplay[0].rowNumber - 1;
+ } else {
+ this.rowNumberOffset = 0;
}
- handleFirst() {
- this.currentPageToken = 0;
- this.init();
- }
+ }
+ handlePrevious() {
+ this.currentPageToken =
+ Number(this.currentPageToken) - Number(this.pageSize);
+ this.init();
+ }
- handleLast() {
- this.currentPageToken =
- this.totalPages > 1 ? (this.totalPages - 1) * this.pageSize : 0;
- this.init();
- }
+ handleNext() {
+ this.currentPageToken =
+ Number(this.currentPageToken) + Number(this.pageSize);
+ this.init();
+ }
+ handleFirst() {
+ this.currentPageToken = 0;
+ this.init();
+ }
- handlePageschange(event) {
- console.log(event.detail);
- this.pageSize = event.detail;
- this.currentPageToken = 0;
- this.init();
- }
- get previousButtonDisabled() {
- return this.currentPageToken === 0;
- }
+ handleLast() {
+ this.currentPageToken =
+ this.totalPages > 1 ? (this.totalPages - 1) * this.pageSize : 0;
+ this.init();
+ }
- get nextButtonDisabled() {
- return this.nextPageToken === undefined;
- }
-}
\ No newline at end of file
+ handlePageschange(event) {
+ console.log(event.detail);
+ this.pageSize = event.detail;
+ this.currentPageToken = 0;
+ this.init();
+ }
+ get previousButtonDisabled() {
+ return this.currentPageToken === 0;
+ }
+
+ get nextButtonDisabled() {
+ return this.nextPageToken === undefined;
+ }
+}
--
Gitblit v1.9.1