From e6068da47c1bef5517c9e5fdc8c726766867ad4e Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期五, 14 七月 2023 15:10:02 +0800
Subject: [PATCH] Merge branch 'master' into LEXUpgrade2023-Deloitte
---
force-app/main/default/lwc/lexOverdueStock/lexOverdueStock.js | 561 +++++++++++++++++++++++++++++++++-----------------------
1 files changed, 331 insertions(+), 230 deletions(-)
diff --git a/force-app/main/default/lwc/lexOverdueStock/lexOverdueStock.js b/force-app/main/default/lwc/lexOverdueStock/lexOverdueStock.js
index d81b24d..24ac990 100644
--- a/force-app/main/default/lwc/lexOverdueStock/lexOverdueStock.js
+++ b/force-app/main/default/lwc/lexOverdueStock/lexOverdueStock.js
@@ -4,296 +4,397 @@
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";
-
+//table css
+import { loadStyle } from 'lightning/platformResourceLoader';
+import WrappedHeaderTable from '@salesforce/resourceUrl/lexdatatable';
//杩囨湡搴撳瓨涓�瑙�
const columns = [
{
- label: '鏄惁閿�瀛�',
- fieldName: 'iscount',
- type: 'checkbox',
- hideDefaultActions: true,
- initialWidth: 80,
+ label: '鏄惁閿�瀛�',
+ fieldName: 'iscount',
+ type: 'checkbox',
+ hideDefaultActions: true,
+ initialWidth: 80
},
{
- label: '娑堣�楀搧鍚嶇О',
- fieldName: 'prodname',
- type: 'prodname',
- wrapText: true,
- initialWidth: 350,
-
- hideDefaultActions: true
+ label: '娑堣�楀搧鍚嶇О',
+ fieldName: 'prodname',
+ type: 'prodname',
+ wrapText: true,
+ initialWidth: 350,
+ hideDefaultActions: true
},
{
- label: '鍗曚綅',
- fieldName: 'boxPiece',
- hideDefaultActions: true,
- // initialWidth: 250,
-
+ label: '鍗曚綅',
+ fieldName: 'boxPiece',
+ hideDefaultActions: true
+ // initialWidth: 250,
},
{
- label: '杩囨湡鏁伴噺',
- fieldName: 'overlimitCount',
- hideDefaultActions: true,
- cellAttributes: { alignment: 'right' }
-
- // initialWidth: 250,
-
+ label: '杩囨湡鏁伴噺',
+ fieldName: 'overlimitCount',
+ hideDefaultActions: true,
+ cellAttributes: { alignment: 'right' }
+
+ // initialWidth: 250,
},
{
- label: '閿�瀛樻暟閲�',
- fieldName: 'pandian',
- hideDefaultActions: true,
- cellAttributes: { alignment: 'right' }
- // initialWidth: 250,
- // cellAttributes: { alignment: 'center' }
+ label: '閿�瀛樻暟閲�',
+ fieldName: 'pandian',
+ hideDefaultActions: true,
+ cellAttributes: { alignment: 'right' }
+ // initialWidth: 250,
+ // cellAttributes: { alignment: 'center' }
}
- ];
- //閿�瀛樻槑缁�
+];
+//閿�瀛樻槑缁�
const column = [
-
{
- label: '娑堣�楀搧鍚嶇О',
- fieldName: 'Name__c',
- type: 'Name',
- // initialWidth : 300,
- hideDefaultActions: true,
- cellAttributes: { alignment: 'left' }
+ label: '娑堣�楀搧鍚嶇О',
+ fieldName: 'Name__c',
+ type: 'Name',
+ wrapText: true,
+ // initialWidth : 300,
+ hideDefaultActions: true,
+ cellAttributes: { alignment: 'left' }
},
{
- label: '鍗曚綅',
- fieldName: 'Box_Piece__c',
- initialWidth : 80,
- hideDefaultActions: true
+ label: '鍗曚綅',
+ fieldName: 'Box_Piece__c',
+ initialWidth: 80,
+ hideDefaultActions: true
},
{
- label: 'BarCode',
- fieldName: 'Bar_Code__c',
- wrapText: true,
- hideDefaultActions: true,
- initialWidth : 500,
+ label: 'BarCode',
+ fieldName: 'Bar_Code__c',
+ wrapText: true,
+ hideDefaultActions: true
+ // initialWidth: 500,
},
{
- label: '浣跨敤鏈熼檺',
- fieldName: 'Sterilization_limit__c',
- hideDefaultActions: true,
- // initialWidth : 250
+ label: '浣跨敤鏈熼檺',
+ fieldName: 'Sterilization_limit__c',
+ hideDefaultActions: true
+ // initialWidth : 250
+ },
+ {
+ label: '閿�瀛樺師鍥�',
+ fieldName: 'diffReason',
+ hideDefaultActions: true,
+ wrapText: true,
+ initialWidth: 160
}
- ,
- {
- label: '閿�瀛樺師鍥�',
- fieldName: 'diffReason',
- hideDefaultActions: true,
- initialWidth: 160
- }
- ];
+];
-
-export default class LexOverdueStock extends NavigationMixin (LightningElement ){
- columns = columns
- column = column
- @track data =[];
+export default class LexOverdueStock extends NavigationMixin(LightningElement) {
+ columns = columns;
+ column = column;
+ @track data = [];
@track overduePageRecords = [];
- @track iSinventory = false
-
+ @track iSinventory = false;
//鍔犺浇妗�
// @track casesSpinner = true;
- @track showSpinner =true;
+ @track showSpinner = true;
//鏄剧ず鍙�
- @track showbutton = false
+ @track showbutton = false;
@track showTable = false;
@track showTables = false;
//閿�瀛樹竴瑙堟暟鎹�
@track accountName;
@track agencyProType;
@track userWorkLocation;
- @track barcode = ''
- @track orderDetZaiku
+ @track barcode = '';
+ @track orderDetZaiku;
@track selectedRows = [];
@track codPageRecordsLWC;
@track Id;
@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");
- });
- }
- }
-
+ 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('鍒濆鍖�');
this.showSpinner = true;
- init().then((result) => {
- result = JSON.parse(JSON.stringify(result));
- console.log('result ='+JSON.stringify(result));
- console.log('result 1='+result.entity.codPageRecords);
- if(result.status = 'Success'){
- this.data = JSON.parse(result.entity.codPageRecords);
- this.codPageRecordsLWC = result.entity.codPageRecords;
- console.log('this.data'+this.data);
- this.accountName = result.entity.accountName;
- this.agencyProType = result.entity.agencyProType;
- this.userWorkLocation = result.entity.userWorkLocation;
- this.showTable = true;
- // this.casesSpinner = false;
+ init()
+ .then((result) => {
+ result = JSON.parse(JSON.stringify(result));
+ console.log('result =' + JSON.stringify(result));
+ console.log('result 1=' + result.entity.codPageRecords);
+ if ((result.status = 'Success')) {
+ this.data = JSON.parse(result.entity.codPageRecords);
+ this.codPageRecordsLWC = result.entity.codPageRecords;
+ console.log('this.data' + this.data);
+ this.accountName = result.entity.accountName;
+ this.agencyProType = result.entity.agencyProType;
+ this.userWorkLocation = result.entity.userWorkLocation;
+ for (var i in this.data) {
+ this.data[i]['key'] =
+ this.data[i]['prodid'] + this.data[i]['boxPiece'];
+ }
+ this.showTable = true;
+ // this.casesSpinner = false;
+ this.showSpinner = false;
+ } else {
+ this.showMyToast('鍒濆鍖栧け璐�', result.msg, 'error');
+ this.showSpinner = false;
+ }
+ })
+ .catch((error) => {
+ console.log('error = ' + JSON.stringify(error));
this.showSpinner = false;
- }else {
- this.showMyToast('鍒濆鍖栧け璐�',result.msg,'error');
- this.showSpinner = false;
- }
- }).catch((error) => {
- console.log('error = ' + JSON.stringify(error));
- });
+ });
}
//barcode褰曞叆
- barcodeEntrys(){
+ barcodeEntrys() {
this.showSpinner = true;
this.showTable = false;
- console.log('code'+this.barcode);
- console.log(' this.accountName'+ this.accountName);
- console.log(' this.barcode'+ this.barcode);
-
- if(this.barcode == ''||this.barcode==null){
- this.showMyToast('鑾峰彇澶辫触','璇疯緭鍏arCode鍙�','error');
- this.showSpinner = false;
+ console.log('code' + this.barcode);
+ console.log(' this.accountName' + this.accountName);
+ console.log(' this.barcode' + this.barcode);
+ const selectedRows = this.template
+ .querySelector('c-lex-custom-lightning-datatable')
+ .getSelectedRows();
+ console.log('selectedRows========> ' + JSON.stringify(selectedRows));
+ for (var i in this.data) {
+ this.data[i]['check'] = false;
+ }
+ for (var i in this.data) {
+ for (var j in selectedRows) {
+ if (
+ this.data[i].prodid + this.data[i]['boxPiece'] ==
+ selectedRows[j].prodid + selectedRows[j]['boxPiece']
+ ) {
+ this.data[i]['check'] = true;
+ }
+ }
}
barcodeEntry({
accountNameLWC: this.accountName,
agencyProTypeLWC: this.agencyProType,
- userWorkLocationLWC:this.userWorkLocation,
- barcodeLWC:this.barcode,
- codPageRecordsLWC:this.codPageRecordsLWC
- }).then((result)=>{
- result = JSON.parse(JSON.stringify(result));
- if (result.status == 'Success') {
- this.overduePageRecords = JSON.parse(result.entity.overduePageRecords);
- this.overdueList = result.entity.overdueList;
- 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;
+ userWorkLocationLWC: this.userWorkLocation,
+ barcodeLWC: this.barcode,
+ codPageRecordsLWC: JSON.stringify(this.data)
+ })
+ .then((result) => {
+ result = JSON.parse(JSON.stringify(result));
+ if (result.status == 'Success') {
+ this.overduePageRecords = JSON.parse(
+ result.entity.overduePageRecords
+ );
+ this.overdueList = result.entity.overdueList;
+ 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;
+ }
+ this.overduePageRecords[i]['Bar_Code__c'] =
+ this.overduePageRecords[
+ i
+ ].orderdetails2.Bar_Code__c;
+ this.overduePageRecords[i]['Box_Piece__c'] =
+ this.overduePageRecords[
+ i
+ ].orderdetails2.Box_Piece__c;
+ this.overduePageRecords[i]['Sterilization_limit__c'] =
+ this.overduePageRecords[
+ i
+ ].orderdetails2.Sterilization_limit__c;
+ }
+ this.data = JSON.parse(result.entity.codPageRecords);
+ console.log(' this.data' + JSON.stringify(this.data));
+ for (var i in this.data) {
+ this.data[i]['key'] =
+ this.data[i]['prodid'] + this.data[i]['boxPiece'];
+ }
+ for (var i in this.data) {
+ if (this.data[i]['check']) {
+ this.selectedRows.push(
+ this.data[i].prodid + this.data[i]['boxPiece']
+ );
+ console.log('selectedRows:' + this.selectedRows);
+ }
+ }
+ this.showSpinner = false;
+ this.showTable = true;
+ } else {
+ if (result.status == 'Success1') {
+ this.overduePageRecords = JSON.parse(
+ result.entity.overduePageRecords
+ );
+ this.overdueList = result.entity.overdueList;
+ 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;
+ }
+ this.overduePageRecords[i]['Bar_Code__c'] =
+ this.overduePageRecords[
+ i
+ ].orderdetails2.Bar_Code__c;
+ this.overduePageRecords[i]['Box_Piece__c'] =
+ this.overduePageRecords[
+ i
+ ].orderdetails2.Box_Piece__c;
+ this.overduePageRecords[i][
+ 'Sterilization_limit__c'
+ ] =
+ this.overduePageRecords[
+ i
+ ].orderdetails2.Sterilization_limit__c;
+ }
+ this.data = JSON.parse(result.entity.codPageRecords);
+ console.log(' this.data' + JSON.stringify(this.data));
+ for (var i in this.data) {
+ this.data[i]['key'] =
+ this.data[i]['prodid'] +
+ this.data[i]['boxPiece'];
+ }
+ for (var i in this.data) {
+ if (this.data[i]['check']) {
+ this.selectedRows.push(
+ this.data[i].prodid +
+ this.data[i]['boxPiece']
+ );
+ console.log(
+ 'selectedRows:' + this.selectedRows
+ );
+ }
+ }
+ this.showSpinner = false;
+ // this.showTables = true;
+ this.showTable = true;
+ } else {
+ console.log('Error:' + result.msg);
+ this.showMyToast(result.msg, '', 'error');
+ this.showSpinner = false;
+ this.showTable = true;
+ }
- }
- this.overduePageRecords[i]['Bar_Code__c'] = this.overduePageRecords[i].orderdetails2.Bar_Code__c;
- this.overduePageRecords[i]['Box_Piece__c'] = this.overduePageRecords[i].orderdetails2.Box_Piece__c;
- this.overduePageRecords[i]['Sterilization_limit__c'] = this.overduePageRecords[i].orderdetails2.Sterilization_limit__c;
- }
- this.data = JSON.parse(result.entity.codPageRecords);
- console.log(' this.data'+ JSON.stringify(this.data));
- for (var i in this.data) {
- if (this.data[i]['check']) {
- this.selectedRows.push(this.data[i].prodid);
- console.log('selectedRows:' + this.selectedRows);
- }
- }
- this.showSpinner = false;
- // this.showTables = true;
- this.showTable = true;
- }else{
- this.showMyToast('鑾峰彇澶辫触',result.msg,'error');
- this.showSpinner = false;
- }
-
- }).catch((error) => {
- console.log('error = ' + JSON.stringify(error));
- });
-
- }
- //鑾峰彇褰撳墠杈撳叆鍊�
- handleChange(event) {
- let value = event.detail.value;
- console.log('value' + value);
- this.barcode = value;
- console.log('this.barcode'+this.barcode);
- }
- getSelectedRows(event) {
- console.log('鎵撳嬀');
- const selectedRows = event.detail.selectedRows;
- console.log('this.selectedRows = ' + this.selectedRows);
- for (var i in this.data) {
- this.data[i]['check'] = false;
- }
- for (var i in this.data) {
- for (var j in selectedRows) {
- console.log('this.selectedRows111 = ' + selectedRows[j].prodid);
- console.log('this.selectedRows1112 = ' + this.data[i].prodid );
- if (this.data[i].prodid == selectedRows[j].prodid) {
- this.data[i]['check'] = true;
- }
- }
- }
- }
- //淇濆瓨
- saveConfirm() {
- console.log('杩涘叆閿�瀛樼‘璁�');
- this.showSpinner = true;
- var el = this.template.querySelector('c-lex-custom-lightning-datatable');
- var selected = el.getSelectedRows();
- 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:this.overdueList
- }).then((result) => {
- result = JSON.parse(JSON.stringify(result));
- console.log('result淇濆瓨 = ' + JSON.stringify(result));
- if (result.status == 'Success') {
- this[NavigationMixin.Navigate]({
- type: 'standard__recordPage',
- attributes: {
- recordId:result.entity.Id,
- objectApiName: 'Consumable_order__c',
- actionName: 'view'
+ // this.showMyToast('鑾峰彇澶辫触', result.msg, 'error');
+ // this.showSpinner = false;
}
+ })
+ .catch((error) => {
+ this.showSpinner = false;
+ console.log('error = ' + JSON.stringify(error));
});
- this.showSpinner = false;
- } else {
- this.showMyToast('閿�瀛樺け璐�',result.msg,'error');
- this.showSpinner = false;
+ }
+ //鑾峰彇褰撳墠杈撳叆鍊�
+ handleChange(event) {
+ let value = event.detail.value;
+ console.log('value' + value);
+ this.barcode = value;
+ console.log('this.barcode' + this.barcode);
+ }
+ getSelectedRows(event) {
+ let selectedRowsEvent = event.detail.selectedRows;
+ this.selectedRows = [];
+ for (var i in selectedRowsEvent) {
+ this.selectedRows.push(
+ selectedRowsEvent[i].prodid + this.data[i]['boxPiece']
+ );
}
- })
- .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';
+ console.log('this.selectedRows==>' + this.selectedRows);
}
- if(message != ''){
- content = '<h2><strong>'+title+'<strong/></h2><h5>'+message+'</h5>';
- }else{
- content = '<h2><strong>'+title+'<strong/></h2>';
+ //淇濆瓨
+ saveConfirm() {
+ console.log('杩涘叆閿�瀛樼‘璁�');
+ this.showSpinner = true;
+ //鏌ヨ鏈夊摢浜涢�夋嫨浜嗙殑鐒跺悗check
+ const selectedRows = this.template
+ .querySelector('c-lex-custom-lightning-datatable')
+ .getSelectedRows();
+ console.log('selectedRows========> ' + JSON.stringify(selectedRows));
+ for (var i in this.data) {
+ this.data[i]['check'] = false;
+ }
+ for (var i in this.data) {
+ for (var j in selectedRows) {
+ if (
+ this.data[i].prodid + this.data[i]['boxPiece'] ==
+ selectedRows[j].prodid + selectedRows[j]['boxPiece']
+ ) {
+ this.data[i]['check'] = true;
+ }
+ }
+ }
+ save({
+ iSinventory: this.iSinventory,
+ saveCodPageRecords: JSON.stringify(this.data),
+ // saveoverdueList:JSON.stringify(this.overdueList)
+ saveoverdueList: this.overdueList
+ })
+ .then((result) => {
+ result = JSON.parse(JSON.stringify(result));
+ console.log('result淇濆瓨 = ' + JSON.stringify(result));
+ if (result.status == 'Success') {
+ this[NavigationMixin.Navigate]({
+ type: 'standard__recordPage',
+ attributes: {
+ recordId: result.entity.Id,
+ objectApiName: 'Consumable_order__c',
+ actionName: 'view'
+ }
+ });
+ this.showSpinner = false;
+ } else {
+ this.showMyToast('閿�瀛樺け璐�', result.msg, 'error');
+ this.showSpinner = false;
+ }
+ })
+ .catch((error) => {
+ console.log('error = ' + JSON.stringify(error));
+ this.showSpinner = false;
+ });
}
- this.template.querySelector('c-common-toast').showToast(variant,content,iconName,10000);
- }
- }
\ No newline at end of file
+ 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);
+ }
+}
--
Gitblit v1.9.1