From 744f42c5496e656a1f9927740a3b37c0b97a6cba Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期五, 14 七月 2023 14:34:12 +0800
Subject: [PATCH] lexcommunityupload0714
---
force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.js | 824 +++++++++++++++++++++++++++++-----------------------------
1 files changed, 418 insertions(+), 406 deletions(-)
diff --git a/force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.js b/force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.js
index 61b3805..d630908 100644
--- a/force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.js
+++ b/force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.js
@@ -1,429 +1,441 @@
-import { LightningElement, wire, api, track } from "lwc";
-import { NavigationMixin } from "lightning/navigation";
-import init from "@salesforce/apex/LexSaleAndDeliveryController.init"; //cleanUp
-import cleanUp from "@salesforce/apex/LexSaleAndDeliveryController.cleanUp";
-import { ShowToastEvent } from "lightning/platformShowToastEvent";
-import searchOrderInstatus from "@salesforce/apex/LexSaleAndDeliveryController.searchOrderInstatus";
-import searchConsumableorderdetails from "@salesforce/apex/LexSaleAndDeliveryController.searchConsumableorderdetails";
-import searchConsumableorFinish from "@salesforce/apex/LexSaleAndDeliveryController.searchConsumableorFinish";
+import { LightningElement, wire, api, track } from 'lwc';
+import { NavigationMixin } from 'lightning/navigation';
+import init from '@salesforce/apex/LexSaleAndDeliveryController.init'; //cleanUp
+import cleanUp from '@salesforce/apex/LexSaleAndDeliveryController.cleanUp';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import searchOrderInstatus from '@salesforce/apex/LexSaleAndDeliveryController.searchOrderInstatus';
+import searchConsumableorderdetails from '@salesforce/apex/LexSaleAndDeliveryController.searchConsumableorderdetails';
+import searchConsumableorFinish from '@salesforce/apex/LexSaleAndDeliveryController.searchConsumableorFinish';
//table css
-import { loadStyle } from "lightning/platformResourceLoader";
-import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable";
+import { loadStyle } from 'lightning/platformResourceLoader';
+import WrappedHeaderTable from '@salesforce/resourceUrl/lexdatatable';
const columns = [
- {
- label: "鍑哄簱鏃�",
- fieldName: "Outbound_Date__c",
- type: "date",
- hideDefaultActions: true,
- sortable: true,
- initialWidth: 180,
- wrapText: true
- },
- {
- label: "鍑哄簱鍗曞彿",
- fieldName: "url",
- type: "url",
- typeAttributes: {
- label: {
- fieldName: "Name"
- },
- target: "_blank"
+ {
+ label: '鍑哄簱鏃�',
+ fieldName: 'Outbound_Date__c',
+ type: 'date',
+ hideDefaultActions: true,
+ sortable: true,
+ initialWidth: 180,
+ wrapText: true
},
- hideDefaultActions: true,
- sortable: true,
- wrapText: true
- },
- {
- label: "瀹㈡埛鍚�",
- fieldName: "ShipmentAccount__c",
- hideDefaultActions: true,
- wrapText: true,
- sortable: true
- },
- {
- label: "绉戝",
- fieldName: "Order_ForCustomerText__c",
- hideDefaultActions: true,
- initialWidth: 100,
- wrapText: true
- },
- {
- label: "鍑哄簱鍗曠姸鎬�",
- fieldName: "SummonsStatus_c__c",
- hideDefaultActions: true,
- initialWidth: 100,
- sortable: true,
- wrapText: true
- },
- {
- label: "寮�绁ㄧ姸鎬�",
- fieldName: "Billed_Status__c",
- hideDefaultActions: true,
- initialWidth: 100,
- sortable: true,
- wrapText: true
- },
- {
- label: "鏈彂绁ㄩ噾棰�(鍏�)",
- fieldName: "InvoiceNotPro_money__c",
- hideDefaultActions: true,
- initialWidth: 125,
- type: "number",
- typeAttributes: {
- minimumFractionDigits: 2
+ {
+ label: '鍑哄簱鍗曞彿',
+ fieldName: 'url',
+ type: 'url',
+ typeAttributes: {
+ label: {
+ fieldName: 'Name'
+ },
+ target: '_blank'
+ },
+ hideDefaultActions: true,
+ sortable: true,
+ wrapText: true
},
- wrapText: true
- },
- {
- label: "鍒涘缓鏃ユ湡",
- fieldName: "CreatedDate",
- hideDefaultActions: true,
- sortable: true,
- wrapText: true,
- initialWidth: 180,
- type: "date",
- typeAttributes: {
- timeZone: "Asia/Shanghai",
- day: "numeric",
- month: "numeric",
- year: "numeric",
- hour: "2-digit",
- minute: "2-digit"
+ {
+ label: '瀹㈡埛鍚�',
+ fieldName: 'ShipmentAccount__c',
+ hideDefaultActions: true,
+ wrapText: true,
+ sortable: true
+ },
+ {
+ label: '绉戝',
+ fieldName: 'Order_ForCustomerText__c',
+ hideDefaultActions: true,
+ initialWidth: 100,
+ wrapText: true
+ },
+ {
+ label: '鍑哄簱鍗曠姸鎬�',
+ fieldName: 'SummonsStatus_c__c',
+ hideDefaultActions: true,
+ initialWidth: 100,
+ sortable: true,
+ wrapText: true
+ },
+ {
+ label: '寮�绁ㄧ姸鎬�',
+ fieldName: 'Billed_Status__c',
+ hideDefaultActions: true,
+ initialWidth: 100,
+ sortable: true,
+ wrapText: true
+ },
+ {
+ label: '鏈彂绁ㄩ噾棰�(鍏�)',
+ fieldName: 'InvoiceNotPro_money__c',
+ hideDefaultActions: true,
+ initialWidth: 125,
+ type: 'number',
+ typeAttributes: {
+ minimumFractionDigits: 2
+ },
+ wrapText: true
+ },
+ {
+ label: '鍒涘缓鏃ユ湡',
+ fieldName: 'CreatedDate',
+ hideDefaultActions: true,
+ sortable: true,
+ wrapText: true,
+ initialWidth: 180,
+ type: 'date',
+ typeAttributes: {
+ timeZone: 'Asia/Shanghai',
+ day: 'numeric',
+ month: 'numeric',
+ year: 'numeric',
+ hour: '2-digit',
+ minute: '2-digit'
+ }
}
- }
];
export default class LexSaleAndDelivery extends NavigationMixin(
- LightningElement
+ LightningElement
) {
- columns = columns;
- @track isShowSpinner = true;
- @track message = "";
- @track deliveryFromDate = "";
- @track deliveryToDate = "";
- @track deliveryOrderNo = "";
- @track contactName = "";
- @track data = [];
- @track userinfoId = "";
- @track accountid = "";
- @track agencyProType = "";
- @track userWorkLocation = "";
- @track showTable = false;
- @track hidecheckboxcolumn = true;
+ columns = columns;
+ @track isShowSpinner = true;
+ @track message = '';
+ @track deliveryFromDate = '';
+ @track deliveryToDate = '';
+ @track deliveryOrderNo = '';
+ @track contactName = '';
+ @track data = [];
+ @track userinfoId = '';
+ @track accountid = '';
+ @track agencyProType = '';
+ @track userWorkLocation = '';
+ @track showTable = false;
+ @track hidecheckboxcolumn = true;
- //鎺掑簭
- defaultSortDirection = "asc";
- sortDirection = "asc";
- sortedBy;
+ //鎺掑簭
+ defaultSortDirection = 'asc';
+ sortDirection = 'asc';
+ sortedBy;
- stylesLoaded = 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");
+ stylesLoaded = 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');
+ });
+ }
+ }
+
+ connectedCallback() {
+ init()
+ .then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ console.log('r = ' + JSON.stringify(r));
+ if (r.status == 'Success') {
+ this.userinfoId = r.entity.userinfoId;
+ this.accountid = r.entity.accountid;
+ this.agencyProType = r.entity.agencyProType;
+ this.userWorkLocation = r.entity.userWorkLocation;
+ this.data = r.entity.raesList;
+ for (var i in this.data) {
+ this.data[i]['url'] =
+ '/s/lexsummonscreat?ESetid=' + this.data[i].Id;
+ }
+ console.log('this.data = ' + JSON.stringify(this.data));
+ this.isShowSpinner = false;
+ this.showTable = true;
+ } else {
+ console.log('r = ' + JSON.stringify(r));
+ this.showMyToast('鍒濆鍖栧け璐�', r.msg, 'Error');
+ }
+ })
+ .catch((error) => {
+ console.log('error = ' + JSON.stringify(error));
+ this.showMyToast('閿欒', '鍒濆鍖栧け璐�', 'Error');
+ });
+ }
+
+ //鏂板缓鍑哄簱鍗�
+ neworderhead() {
+ this[NavigationMixin.Navigate]({
+ type: 'standard__webPage',
+ attributes: {
+ url: '/lexsummonscreat'
+ }
});
}
- }
- connectedCallback() {
- init()
- .then((r) => {
- r = JSON.parse(JSON.stringify(r));
- console.log("r = " + JSON.stringify(r));
- if (r.status == "Success") {
- this.userinfoId = r.entity.userinfoId;
- this.accountid = r.entity.accountid;
- this.agencyProType = r.entity.agencyProType;
- this.userWorkLocation = r.entity.userWorkLocation;
- this.data = r.entity.raesList;
- for (var i in this.data) {
- this.data[i]["url"] =
- "/s/lexsummonscreat?ESetid=" + this.data[i].Id;
- }
- console.log("this.data = " + JSON.stringify(this.data));
- this.isShowSpinner = false;
- this.showTable = true;
- } else {
- console.log("r = " + JSON.stringify(r));
- this.showMyToast("鍒濆鍖栧け璐�", r.msg, "Error");
- }
- })
- .catch((error) => {
- console.log("error = " + JSON.stringify(error));
- this.showMyToast("閿欒", "鍒濆鍖栧け璐�", "Error");
- });
- }
-
- //鏂板缓鍑哄簱鍗�
- neworderhead() {
- this[NavigationMixin.Navigate]({
- type: "standard__webPage",
- attributes: {
- url: "/lexsummonscreat"
- }
- });
- }
-
- //宸插嚭搴撴湭寮�绁ㄧ殑鍑哄簱鍗�
- searchOrderInstatusJs() {
- this.isShowSpinner = true;
- this.showTable = false;
- console.log("searchOrderInstatusJs");
- searchOrderInstatus({
- orderDate: this.deliveryFromDate,
- deliverDate: this.deliveryToDate,
- accountid: this.accountid,
- agencyProType: this.agencyProType,
- userWorkLocation: this.userWorkLocation,
- category1: this.deliveryOrderNo,
- category2: this.contactName
- })
- .then((r) => {
- r = JSON.parse(JSON.stringify(r));
- console.log("r = " + JSON.stringify(r));
- if (r.status == "Success") {
- this.data = r.entity.raesList;
- for (var i in this.data) {
- this.data[i]["url"] =
- "/s/lexsummonscreat?ESetid=" + this.data[i].Id;
- }
- this.message = r.msg;
- if (this.message == "娌℃湁鎼滅储鍒扮浉鍏冲嚭搴撳崟") {
- this.showMyToast("鎼滅储澶辫触", this.message, "Error");
- } else {
- this.showMyToast("鎼滅储鎴愬姛", this.message, "Success");
- }
- this.isShowSpinner = false;
- //this.isCssLoaded = true
- this.showTable = true;
- } else {
- this.showMyToast("閿欒", r.msg, "Error");
- }
- })
- .catch((error) => {
- console.log("error = " + JSON.stringify(error));
- });
- }
-
- //杩樻病鍑哄簱鐨勫嚭搴撳崟
- searchConsumableorderdetailsJs() {
- this.isShowSpinner = true;
- this.showTable = false;
- console.log("searchConsumableorderdetailsJs");
- console.log("this.deliveryFromDate = " + this.deliveryFromDate);
- console.log("this.deliveryToDate = " + this.deliveryToDate);
- searchConsumableorderdetails({
- orderDate: this.deliveryFromDate,
- deliverDate: this.deliveryToDate,
- accountid: this.accountid,
- agencyProType: this.agencyProType,
- userWorkLocation: this.userWorkLocation,
- category1: this.deliveryOrderNo,
- category2: this.contactName
- })
- .then((r) => {
- r = JSON.parse(JSON.stringify(r));
- console.log("r = " + JSON.stringify(r));
- if (r.status == "Success") {
- this.data = r.entity.raesList;
- for (var i in this.data) {
- this.data[i]["url"] =
- "/s/lexsummonscreat?ESetid=" + this.data[i].Id;
- }
- this.message = r.msg;
- if (this.message == "娌℃湁鎼滅储鍒扮浉鍏冲嚭搴撳崟") {
- this.showMyToast("鎼滅储澶辫触", this.message, "Error");
- } else {
- this.showMyToast("鎼滅储鎴愬姛", this.message, "Success");
- }
- this.isShowSpinner = false;
- this.showTable = true;
- } else {
- this.showMyToast("鎼滅储澶辫触", r.msg, "Error");
- }
- })
- .catch((error) => {
- console.log("error = " + JSON.stringify(error));
- this.showMyToast("鎼滅储澶辫触", "鎼滅储杩樻病鍑哄簱鐨勫嚭搴撳崟鍑洪敊", "Error");
- });
- }
-
- //宸插嚭搴撳凡寮�绁ㄧ殑鍑哄簱鍗�
- searchConsumableorFinishJs() {
- this.isShowSpinner = true;
- this.showTable = false;
- console.log("searchConsumableorFinishJs");
- searchConsumableorFinish({
- orderDate: this.deliveryFromDate,
- deliverDate: this.deliveryToDate,
- accountid: this.accountid,
- agencyProType: this.agencyProType,
- userWorkLocation: this.userWorkLocation,
- category1: this.deliveryOrderNo,
- category2: this.contactName
- })
- .then((r) => {
- r = JSON.parse(JSON.stringify(r));
- console.log("r = " + JSON.stringify(r));
- if (r.status == "Success") {
- this.data = r.entity.raesList;
- for (var i in this.data) {
- this.data[i]["url"] =
- "/s/lexsummonscreat?ESetid=" + this.data[i].Id;
- }
- this.message = r.msg;
- if (this.message == "娌℃湁鎼滅储鍒扮浉鍏冲嚭搴撳崟") {
- this.showMyToast("鎼滅储澶辫触", this.message, "Error");
- } else {
- this.showMyToast("鎼滅储鎴愬姛", this.message, "Success");
- }
- this.isShowSpinner = false;
- this.showTable = true;
- } else {
- this.showMyToast("鎼滅储澶辫触", r.msg, "Error");
- }
- })
- .catch((error) => {
- console.log("error = " + JSON.stringify(error));
- this.showMyToast("鎼滅储澶辫触", "鎼滅储宸插嚭搴撳凡寮�绁ㄧ殑鍑哄簱鍗曞嚭閿�", "Error");
- });
- }
-
- //娓呯┖
- clearJs() {
- this.deliveryFromDate = "";
- this.deliveryToDate = "";
- this.deliveryOrderNo = "";
- this.contactName = "";
- this.isShowSpinner = true;
- this.showTable = false;
- cleanUp({
- accountid: this.accountid,
- agencyProType: this.agencyProType,
- userWorkLocation: this.userWorkLocation
- })
- .then((r) => {
- r = JSON.parse(JSON.stringify(r));
- console.log("r = " + JSON.stringify(r));
- if (r.status == "Success") {
- this.data = r.entity.raesList;
- for (var i in this.data) {
- this.data[i]["url"] =
- "/s/lexsummonscreat?ESetid=" + this.data[i].Id;
- }
- this.message = r.msg;
- if (this.message == "娌℃湁鎼滅储鍒扮浉鍏冲嚭搴撳崟") {
- this.showMyToast("鎼滅储澶辫触", this.message, "Error");
- } else {
- this.showMyToast("鎼滅储鎴愬姛", this.message, "Success");
- }
- this.isShowSpinner = false;
- this.showTable = true;
- } else {
- this.showMyToast("鎼滅储澶辫触", r.msg, "Error");
- }
- })
- .catch((error) => {
- console.log("error = " + JSON.stringify(error));
- this.showMyToast("鎼滅储澶辫触", "鎼滅储澶辫触", "Error");
- });
- }
-
- //Capture the event fired from the paginator component
- 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;
+ //宸插嚭搴撴湭寮�绁ㄧ殑鍑哄簱鍗�
+ searchOrderInstatusJs() {
+ this.isShowSpinner = true;
+ this.showTable = false;
+ console.log('searchOrderInstatusJs');
+ searchOrderInstatus({
+ orderDate: this.deliveryFromDate,
+ deliverDate: this.deliveryToDate,
+ accountid: this.accountid,
+ agencyProType: this.agencyProType,
+ userWorkLocation: this.userWorkLocation,
+ category1: this.deliveryOrderNo,
+ category2: this.contactName
+ })
+ .then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ console.log('r = ' + JSON.stringify(r));
+ if (r.status == 'Success') {
+ this.data = r.entity.raesList;
+ for (var i in this.data) {
+ this.data[i]['url'] =
+ '/s/lexsummonscreat?ESetid=' + this.data[i].Id;
+ }
+ this.message = r.msg;
+ if (this.message == '娌℃湁鎼滅储鍒扮浉鍏冲嚭搴撳崟') {
+ this.showMyToast('鎼滅储澶辫触', this.message, 'Error');
+ } else {
+ this.showMyToast('鎼滅储鎴愬姛', this.message, 'Success');
+ }
+ this.isShowSpinner = false;
+ //this.isCssLoaded = true
+ this.showTable = true;
+ } else {
+ this.showMyToast('閿欒', r.msg, 'Error');
+ }
+ })
+ .catch((error) => {
+ console.log('error = ' + JSON.stringify(error));
+ });
}
- }
- //鎺掑簭
- onHandleSort(event) {
- const { fieldName: sortedBy, sortDirection } = event.detail;
- const cloneData = [...this.data];
- cloneData.sort(this.sortBy(sortedBy, sortDirection === "asc" ? 1 : -1));
- this.data = cloneData;
- this.sortDirection = sortDirection;
- this.sortedBy = sortedBy;
- }
+ //杩樻病鍑哄簱鐨勫嚭搴撳崟
+ searchConsumableorderdetailsJs() {
+ this.isShowSpinner = true;
+ this.showTable = false;
+ console.log('searchConsumableorderdetailsJs');
+ console.log('this.deliveryFromDate = ' + this.deliveryFromDate);
+ console.log('this.deliveryToDate = ' + this.deliveryToDate);
+ searchConsumableorderdetails({
+ orderDate: this.deliveryFromDate,
+ deliverDate: this.deliveryToDate,
+ accountid: this.accountid,
+ agencyProType: this.agencyProType,
+ userWorkLocation: this.userWorkLocation,
+ category1: this.deliveryOrderNo,
+ category2: this.contactName
+ })
+ .then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ console.log('r = ' + JSON.stringify(r));
+ if (r.status == 'Success') {
+ this.data = r.entity.raesList;
+ for (var i in this.data) {
+ this.data[i]['url'] =
+ '/s/lexsummonscreat?ESetid=' + this.data[i].Id;
+ }
+ this.message = r.msg;
+ if (this.message == '娌℃湁鎼滅储鍒扮浉鍏冲嚭搴撳崟') {
+ this.showMyToast('鎼滅储澶辫触', this.message, 'Error');
+ } else {
+ this.showMyToast('鎼滅储鎴愬姛', this.message, 'Success');
+ }
+ this.isShowSpinner = false;
+ this.showTable = true;
+ } else {
+ this.showMyToast('鎼滅储澶辫触', r.msg, 'Error');
+ }
+ })
+ .catch((error) => {
+ console.log('error = ' + JSON.stringify(error));
+ this.showMyToast(
+ '鎼滅储澶辫触',
+ '鎼滅储杩樻病鍑哄簱鐨勫嚭搴撳崟鍑洪敊',
+ 'Error'
+ );
+ });
+ }
- sortBy(field, reverse, primer) {
- const key = primer
- ? function (x) {
- return primer(x[field]);
+ //宸插嚭搴撳凡寮�绁ㄧ殑鍑哄簱鍗�
+ searchConsumableorFinishJs() {
+ this.isShowSpinner = true;
+ this.showTable = false;
+ console.log('searchConsumableorFinishJs');
+ searchConsumableorFinish({
+ orderDate: this.deliveryFromDate,
+ deliverDate: this.deliveryToDate,
+ accountid: this.accountid,
+ agencyProType: this.agencyProType,
+ userWorkLocation: this.userWorkLocation,
+ category1: this.deliveryOrderNo,
+ category2: this.contactName
+ })
+ .then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ console.log('r = ' + JSON.stringify(r));
+ if (r.status == 'Success') {
+ this.data = r.entity.raesList;
+ for (var i in this.data) {
+ this.data[i]['url'] =
+ '/s/lexsummonscreat?ESetid=' + this.data[i].Id;
+ }
+ this.message = r.msg;
+ if (this.message == '娌℃湁鎼滅储鍒扮浉鍏冲嚭搴撳崟') {
+ this.showMyToast('鎼滅储澶辫触', this.message, 'Error');
+ } else {
+ this.showMyToast('鎼滅储鎴愬姛', this.message, 'Success');
+ }
+ this.isShowSpinner = false;
+ this.showTable = true;
+ } else {
+ this.showMyToast('鎼滅储澶辫触', r.msg, 'Error');
+ }
+ })
+ .catch((error) => {
+ console.log('error = ' + JSON.stringify(error));
+ this.showMyToast(
+ '鎼滅储澶辫触',
+ '鎼滅储宸插嚭搴撳凡寮�绁ㄧ殑鍑哄簱鍗曞嚭閿�',
+ 'Error'
+ );
+ });
+ }
+
+ //娓呯┖
+ clearJs() {
+ this.deliveryFromDate = '';
+ this.deliveryToDate = '';
+ this.deliveryOrderNo = '';
+ this.contactName = '';
+ this.isShowSpinner = true;
+ this.showTable = false;
+ cleanUp({
+ accountid: this.accountid,
+ agencyProType: this.agencyProType,
+ userWorkLocation: this.userWorkLocation
+ })
+ .then((r) => {
+ r = JSON.parse(JSON.stringify(r));
+ console.log('r = ' + JSON.stringify(r));
+ if (r.status == 'Success') {
+ this.data = r.entity.raesList;
+ for (var i in this.data) {
+ this.data[i]['url'] =
+ '/s/lexsummonscreat?ESetid=' + this.data[i].Id;
+ }
+ this.message = r.msg;
+ if (this.message == '娌℃湁鎼滅储鍒扮浉鍏冲嚭搴撳崟') {
+ this.showMyToast('鎼滅储澶辫触', this.message, 'Error');
+ } else {
+ this.showMyToast('鎼滅储鎴愬姛', this.message, 'Success');
+ }
+ this.isShowSpinner = false;
+ this.showTable = true;
+ } else {
+ this.showMyToast('鎼滅储澶辫触', r.msg, 'Error');
+ }
+ })
+ .catch((error) => {
+ console.log('error = ' + JSON.stringify(error));
+ this.showMyToast('鎼滅储澶辫触', '鎼滅储澶辫触', 'Error');
+ });
+ }
+
+ //Capture the event fired from the paginator component
+ 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;
}
- : function (x) {
- return x[field];
+ }
+
+ //鎺掑簭
+ onHandleSort(event) {
+ const { fieldName: sortedBy, sortDirection } = event.detail;
+ const cloneData = [...this.data];
+ cloneData.sort(this.sortBy(sortedBy, sortDirection === 'asc' ? 1 : -1));
+ this.data = cloneData;
+ this.sortDirection = sortDirection;
+ this.sortedBy = sortedBy;
+ }
+
+ sortBy(field, reverse, primer) {
+ const key = primer
+ ? function (x) {
+ return primer(x[field]);
+ }
+ : function (x) {
+ return x[field];
+ };
+
+ return function (a, b) {
+ a = key(a);
+ b = key(b);
+ return reverse * ((a > b) - (b > a));
};
-
- return function (a, b) {
- a = key(a);
- b = key(b);
- return reverse * ((a > b) - (b > a));
- };
- }
-
- dataChange(event) {
- let fieldName = event.target.getAttribute("data-field");
- let value = event.detail.value;
- switch (fieldName) {
- case "deliveryFromDate":
- this.deliveryFromDate = value;
- break;
- case "deliveryToDate":
- this.deliveryToDate = value;
- break;
- case "deliveryOrderNo":
- this.deliveryOrderNo = value;
- break;
- case "contactName":
- this.contactName = value;
- break;
- default:
- console.log("no data");
}
- }
- editProductLimit() {
- this[NavigationMixin.Navigate]({
- type: "standard__webPage",
- attributes: {
- url: "/lexoutboundorderimport"
- }
- });
- }
-
- showMyToast(title, message, variant) {
- this.isShowSpinner = false;
- console.log("show custom message");
- var iconName = "";
- var content = "";
- if (variant.toLowerCase() == "success") {
- iconName = "utility:check";
- } else {
- iconName = "utility:error";
+ dataChange(event) {
+ let fieldName = event.target.getAttribute('data-field');
+ let value = event.detail.value;
+ switch (fieldName) {
+ case 'deliveryFromDate':
+ this.deliveryFromDate = value;
+ break;
+ case 'deliveryToDate':
+ this.deliveryToDate = value;
+ break;
+ case 'deliveryOrderNo':
+ this.deliveryOrderNo = value;
+ break;
+ case 'contactName':
+ this.contactName = value;
+ break;
+ default:
+ console.log('no data');
+ }
}
- 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);
- }
- @track isModalOpen = false;
- openModal() {
- this.isModalOpen = true;
- }
-}
+ editProductLimit() {
+ this[NavigationMixin.Navigate]({
+ type: 'standard__webPage',
+ attributes: {
+ url: '/lexoutboundorderimport'
+ }
+ });
+ }
+
+ showMyToast(title, message, variant) {
+ this.isShowSpinner = false;
+ console.log('show custom message');
+ var iconName = '';
+ var content = '';
+ if (variant.toLowerCase() == '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);
+ }
+
+ @track isModalOpen = false;
+ openModal() {
+ this.isModalOpen = true;
+ }
+}
\ No newline at end of file
--
Gitblit v1.9.1