From 00e147ec892cb1e89d0698787a8c60da1014cdb7 Mon Sep 17 00:00:00 2001
From: binxie <137736985@qq.com>
Date: 星期一, 26 六月 2023 17:42:22 +0800
Subject: [PATCH] Community升级
---
force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.js | 435 ++++++++++++++++++++++++-----------------------------
1 files changed, 199 insertions(+), 236 deletions(-)
diff --git a/force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.js b/force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.js
index 0dd889b..e57180a 100644
--- a/force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.js
+++ b/force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.js
@@ -1,29 +1,28 @@
import { LightningElement, wire, api, track } from 'lwc';
import { NavigationMixin } from 'lightning/navigation';
-import init from '@salesforce/apex/LexSaleAndDeliveryController.init';//cleanUp
+import init from '@salesforce/apex/LexSaleAndDeliveryController.init'; //cleanUp
import cleanUp from '@salesforce/apex/LexSaleAndDeliveryController.cleanUp';
-import { ShowToastEvent } from "lightning/platformShowToastEvent";
+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";
+//table css
+import { loadStyle } from 'lightning/platformResourceLoader';
+import WrappedHeaderTable from '@salesforce/resourceUrl/lexdatatable';
const columns = [
{
label: '鍑哄簱鏃�',
fieldName: 'Outbound_Date__c',
type: 'date',
- initialWidth: 100,
hideDefaultActions: true,
- sortable: true
+ sortable: true,
+ wrapText: true
},
{
label: '鍑哄簱鍗曞彿',
fieldName: 'url',
type: 'url',
- initialWidth: 175,
typeAttributes: {
label: {
fieldName: 'Name'
@@ -31,7 +30,8 @@
target: '_blank'
},
hideDefaultActions: true,
- sortable: true
+ sortable: true,
+ wrapText: true
},
{
label: '瀹㈡埛鍚�',
@@ -44,127 +44,52 @@
label: '绉戝',
fieldName: 'Order_ForCustomerText__c',
hideDefaultActions: true,
- initialWidth: 120
+ wrapText: true
},
{
label: '鍑哄簱鍗曠姸鎬�',
fieldName: 'SummonsStatus_c__c',
hideDefaultActions: true,
sortable: true,
- initialWidth: 100
+ wrapText: true
},
{
label: '寮�绁ㄧ姸鎬�',
fieldName: 'Billed_Status__c',
hideDefaultActions: true,
sortable: true,
- initialWidth: 100
+ wrapText: true
},
{
label: '鏈彂绁ㄩ噾棰�(鍏�)',
fieldName: 'InvoiceNotPro_money__c',
hideDefaultActions: true,
- type: "number",
+ type: 'number',
typeAttributes: {
- minimumFractionDigits: 2,
+ minimumFractionDigits: 2
},
- initialWidth: 150
+ wrapText: true
},
{
label: '鍒涘缓鏃ユ湡',
fieldName: 'CreatedDate',
hideDefaultActions: true,
sortable: true,
- type: "date",
+ wrapText: true,
+ type: 'date',
typeAttributes: {
- timeZone: "Asia/Shanghai",
- day: "numeric",
- month: "numeric",
- year: "numeric",
- hour: "2-digit",
- minute: "2-digit"
- },
- initialWidth: 200
+ timeZone: 'Asia/Shanghai',
+ day: 'numeric',
+ month: 'numeric',
+ year: 'numeric',
+ hour: '2-digit',
+ minute: '2-digit'
+ }
}
];
-
-const editColumns = [
- {
- label: '鍑哄簱鏃�',
- fieldName: 'Outbound_Date__c',
- type: 'date',
- hideDefaultActions: true,
- sortable: true
- },
- {
- label: '鍑哄簱鍗曞彿',
- fieldName: 'url',
- type: 'url',
- typeAttributes: {
- label: {
- fieldName: 'Name'
- },
- target: '_blank'
- },
- hideDefaultActions: true,
- sortable: true
- },
- {
- label: '瀹㈡埛鍚�',
- fieldName: 'ShipmentAccount__c',
- hideDefaultActions: true,
- sortable: true
- },
- {
- label: '绉戝',
- fieldName: 'Order_ForCustomerText__c',
- hideDefaultActions: true
- },
- {
- label: '鍑哄簱鍗曠姸鎬�',
- fieldName: 'SummonsStatus_c__c',
- hideDefaultActions: true,
- sortable: true,
- initialWidth: 100
- },
- {
- label: '寮�绁ㄧ姸鎬�',
- fieldName: 'Billed_Status__c',
- hideDefaultActions: true,
- sortable: true,
- initialWidth: 100
- },
- {
- label: '鏈彂绁ㄩ噾棰�(鍏�)',
- fieldName: 'InvoiceNotPro_money__c',
- hideDefaultActions: true,
- initialWidth: 150
- },
- {
- label: '鍒涘缓鏃ユ湡',
- fieldName: 'CreatedDate',
- hideDefaultActions: true,
- sortable: true
- },
- // {
- // label: '鍗曚綅',
- // hideDefaultActions: true,
- // type:'customUnit',
- // },
- // {
- // label: '鍑鸿揣鏁伴噺',
- // hideDefaultActions: true,
- // type:'customShipment',
-
- // },
- // {
- // label: '鍑鸿揣鍗曚环(鍏�)',
- // hideDefaultActions: true,
- // type:'customShipmentUnitPrice',
-
- // }
-];
-export default class LexSaleAndDelivery extends NavigationMixin(LightningElement) {
+export default class LexSaleAndDelivery extends NavigationMixin(
+ LightningElement
+) {
columns = columns;
@track isShowSpinner = true;
@track message = '';
@@ -179,51 +104,53 @@
@track userWorkLocation = '';
@track showTable = false;
@track hidecheckboxcolumn = true;
- stylesLoaded = false;
//鎺掑簭
defaultSortDirection = 'asc';
sortDirection = 'asc';
sortedBy;
- 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.showToast('Error', r.msg);
- }
- }).catch((error) => {
- console.log('error = ' + JSON.stringify(error))
- })
- }
-
+ stylesLoaded = false;
renderedCallback() {
- debugger
if (!this.stylesLoaded) {
Promise.all([loadStyle(this, WrappedHeaderTable)])
.then(() => {
- console.log("Custom styles loaded");
+ console.log('Custom styles loaded');
this.stylesLoaded = true;
})
.catch((error) => {
- console.error("Error loading custom styles");
+ 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');
+ });
}
//鏂板缓鍑哄簱鍗�
@@ -249,29 +176,32 @@
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.showToast('Error', this.message);
- } else {
- this.showToast('Success', this.message);
- }
- this.isShowSpinner = false;
- //this.isCssLoaded = true
- this.showTable = true;
- } else {
- this.showToast('Error', r.msg);
- }
- }).catch((error) => {
- console.log('error = ' + JSON.stringify(error))
})
+ .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));
+ });
}
//杩樻病鍑哄簱鐨勫嚭搴撳崟
@@ -289,28 +219,36 @@
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.showToast('Error', this.message);
- } else {
- this.showToast('Success', this.message);
- }
- this.isShowSpinner = false;
- this.showTable = true;
- } else {
- this.showToast('Error', r.msg);
- }
- }).catch((error) => {
- console.log('error = ' + JSON.stringify(error))
})
+ .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'
+ );
+ });
}
//宸插嚭搴撳凡寮�绁ㄧ殑鍑哄簱鍗�
@@ -326,28 +264,36 @@
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.showToast('Error', this.message);
- } else {
- this.showToast('Success', this.message);
- }
- this.isShowSpinner = false;
- this.showTable = true;
- } else {
- this.showToast('Error', r.msg);
- }
- }).catch((error) => {
- console.log('error = ' + JSON.stringify(error))
})
+ .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'
+ );
+ });
}
//娓呯┖
@@ -361,29 +307,33 @@
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.showToast('Error', this.message);
- } else {
- this.showToast('Success', this.message);
- }
- this.isShowSpinner = false;
- this.showTable = true;
- } else {
- this.showToast('Error', r.msg);
- }
- }).catch((error) => {
- console.log('error = ' + JSON.stringify(error))
+ 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
@@ -410,11 +360,11 @@
sortBy(field, reverse, primer) {
const key = primer
? function (x) {
- return primer(x[field]);
- }
+ return primer(x[field]);
+ }
: function (x) {
- return x[field];
- };
+ return x[field];
+ };
return function (a, b) {
a = key(a);
@@ -423,27 +373,25 @@
};
}
-
dataChange(event) {
- let fieldName = event.target.getAttribute("data-field");
+ let fieldName = event.target.getAttribute('data-field');
let value = event.detail.value;
switch (fieldName) {
case 'deliveryFromDate':
this.deliveryFromDate = value;
- break
+ break;
case 'deliveryToDate':
this.deliveryToDate = value;
- break
+ break;
case 'deliveryOrderNo':
this.deliveryOrderNo = value;
- break
+ break;
case 'contactName':
this.contactName = value;
- break
+ break;
default:
console.log('no data');
}
-
}
editProductLimit() {
@@ -455,14 +403,29 @@
});
}
- showToast(type, msg) {
+ showMyToast(title, message, variant) {
this.isShowSpinner = false;
- const event = new ShowToastEvent({
- title: type,
- variant: type,
- message: msg
- });
- this.dispatchEvent(event);
+ 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;
--
Gitblit v1.9.1