From 7454e4fe769b5148309b8a932fbf2bc03b41b376 Mon Sep 17 00:00:00 2001
From: liangxiaozhen <liangxiaozhen>
Date: 星期日, 06 八月 2023 19:06:33 +0800
Subject: [PATCH] G级页面简单修改
---
force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.js | 1174 ++++++++++++++++++++++++++++++++-------------------------
1 files changed, 658 insertions(+), 516 deletions(-)
diff --git a/force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.js b/force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.js
index 1ae2e49..ff6c1ae 100644
--- a/force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.js
+++ b/force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.js
@@ -1,298 +1,366 @@
import { LightningElement, wire, api, track } from 'lwc';
-import oninit from "@salesforce/apex/LexInventoryViewController.init";
-import oninit2 from "@salesforce/apex/LexInventoryViewController.init2";
-import { ShowToastEvent } from "lightning/platformShowToastEvent";
-import searchOrder from "@salesforce/apex/LexInventoryViewController.searchConsumableorderdetails";
-import categoryAllload from "@salesforce/apex/LexInventoryViewController.categoryAllload";
-import { NavigationMixin } from "lightning/navigation";
+import oninit from '@salesforce/apex/LexInventoryViewController.init';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import searchOrder from '@salesforce/apex/LexInventoryViewController.searchConsumableorderdetails';
+import categoryAllload from '@salesforce/apex/LexInventoryViewController.categoryAllload';
+import { NavigationMixin } from 'lightning/navigation';
-export default class LexinventoryViewLWC extends NavigationMixin(LightningElement) {
- //鍒嗛〉start
- @track sortBy = "";
- //@track sortDirection = "asc";
- @track pageSize = 5;
- error;
- records;
- currentPageToken = 0;
- nextPageToken = this.pageSize;
- @track totalRecords = 0;
- @track loader = false;
- @track pageNumber = 1;
- @track paginationVisibility = false;
- @track totalPages = 1;
- pageSizeOptions = [5, 10, 25, 50, 75, 100];
- @track recordStart = 0;
- @track recordEnd = 0;
- //end
+//table css
+import { loadStyle } from 'lightning/platformResourceLoader';
+import WrappedHeaderTable from '@salesforce/resourceUrl/lexdatatable';
- @track data = [];
- @track message = "";
- @track Name;
- @track CategoryThree;
+export default class LexinventoryViewLWC extends NavigationMixin(
+ LightningElement
+) {
+ //鍒嗛〉start
+ @track sortBy = '';
+ //@track sortDirection = "asc";
+ @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 category3Options = [];
- @track CategoryFour;
- @track category4Options = [];
- @track CategoryFive;
- @track category5Options = [];
- @track orderDetZaikuList = [];
- @track accountName;
- @track agencyProType;
- @track userWorkLocation;
- @track value = "";
- @track showTable = false;
- @track hidecheckboxcolumn = true;
- @track check = false;
- //鍔犺浇
- @track showSpinner = false;
- @track showSpinners = false;
- //鍖婚櫌鐗逛环
- @track hasHos = false;
+ @track data = [];
+ @track message = '';
+ @track Name;
+ @track CategoryThree;
+ @track category3Options = [];
+ @track CategoryFour;
+ @track category4Options = [];
+ @track CategoryFive;
+ @track category5Options = [];
+ @track orderDetZaikuList = [];
+ @track accountName;
+ @track agencyProType;
+ @track userWorkLocation;
+ @track value = '';
+ @track showTable = false;
+ @track hidecheckboxcolumn = true;
+ @track check = false;
+ @track productkucun;
+ //鍔犺浇
+ @track showSpinner = false;
+ @track showSpinners = false;
+ //鍖婚櫌鐗逛环
+ @track hasHos = false;
+ //琛ㄥご鏍峰紡
+ stylesLoaded = false;
+ @track columns = [
+ {
+ label: '娑堣�楀搧鍚嶇О',
+ fieldName: 'Name__c',
+ type: 'Name',
+ sortable: true,
+ hideDefaultActions: true,
+ initialWidth: 300,
+ wrapText: true,
+ cellAttributes: { alignment: 'left' }
+ },
+ {
+ label: '绗笁鍒嗙被',
+ fieldName: 'Category3__c',
+ initialWidth: 120,
+ cellAttributes: { alignment: 'left' },
+ hideDefaultActions: true,
+ sortable: true,
+ wrapText: true
+ },
+ {
+ label: '绗洓鍒嗙被',
+ fieldName: 'Category4__c',
+ cellAttributes: { alignment: 'left' },
+ initialWidth: 120,
+ hideDefaultActions: true,
+ wrapText: true,
+ sortable: true
+ },
+ {
+ label: '绗簲鍒嗙被',
+ fieldName: 'Category5__c',
+ cellAttributes: { alignment: 'left' },
+ initialWidth: 120,
+ hideDefaultActions: true,
+ wrapText: true,
+ sortable: true
+ },
- @track columns = [
- {
- label: "娑堣�楀搧鍚嶇О",
- fieldName: "Name__c",
- type: "Name",
- sortable: true,
- hideDefaultActions: true,
- initialWidth: 250,
- wrapText: true,
- cellAttributes: { alignment: "left" }
- },
- {
- label: "绗笁鍒嗙被",
- fieldName: "Category3__c",
- hideDefaultActions: true,
- sortable: true,
- wrapText: true,
- },
- {
- label: "绗洓鍒嗙被",
- fieldName: "Category4__c",
- hideDefaultActions: true,
- wrapText: true,
- sortable: true,
-
- },
- {
- label: "绗簲鍒嗙被",
- fieldName: "Category5__c",
- hideDefaultActions: true,
- wrapText: true,
- sortable: true,
-
- },
-
- {
- label: "瑙勬牸",
- fieldName: "packing_list",
- wrapText: true,
- hideDefaultActions: true,
- },
- {
- label: "鍗曚綅",
- fieldName: "BoxPiece",
- wrapText: true,
- hideDefaultActions: true,
- },
- {
- label: "娉ㄥ唽璇佺紪鐮佸彿",
- fieldName: "approbation_No",
- wrapText: true,
- initialWidth: 100,
- hideDefaultActions: true,
- },
- {
- label: "娉ㄥ唽鏈夋晥鏈�",
- fieldName: "expiration_Date",
- wrapText: true,
- hideDefaultActions: true,
- initialWidth: 150
- },
- {
- label: "CFDA鐘舵��",
- fieldName: "SFDA_Status__c",
- hideDefaultActions: true,
- },
- {
- label: "浣跨敤鏈熼檺",
- fieldName: "guaranteeperiod",
- hideDefaultActions: true,
- initialWidth: 100
- },
- {
- label: "鏈夋晥鏈熷唴搴撳瓨",
- fieldName: "limitCount",
- hideDefaultActions: true,
- sortable: true,
- },
- {
- label: "杩囨湡搴撳瓨",
- fieldName: "overlimitCount",
- hideDefaultActions: true,
- }
- ];
- defaultSortDirection = "asc";
- sortDirection = "asc";
- sortedBy;
+ {
+ label: '瑙勬牸',
+ fieldName: 'packing_list',
+ cellAttributes: { alignment: 'right' },
+ initialWidth: 55,
+ wrapText: true,
+ hideDefaultActions: true
+ },
+ {
+ label: '鍗曚綅',
+ fieldName: 'BoxPiece',
+ cellAttributes: { alignment: 'left' },
+ initialWidth: 55,
+ wrapText: true,
+ hideDefaultActions: true
+ },
+ {
+ label: '娉ㄥ唽璇佺紪鐮佸彿',
+ fieldName: 'approbation_No',
+ cellAttributes: { alignment: 'left' },
+ wrapText: true,
+ initialWidth: 200,
+ hideDefaultActions: true
+ },
+ {
+ label: '娉ㄥ唽鏈夋晥鏈�',
+ fieldName: 'expiration_Date',
+ cellAttributes: { alignment: 'left' },
+ wrapText: true,
+ hideDefaultActions: true,
+ initialWidth: 110
+ },
+ {
+ label: 'CFDA鐘舵��',
+ fieldName: 'SFDA_Status__c',
+ cellAttributes: { alignment: 'left' },
+ initialWidth: 95,
+ wrapText: true,
+ hideDefaultActions: true
+ },
+ {
+ label: '浣跨敤鏈熼檺',
+ fieldName: 'guaranteeperiod',
+ cellAttributes: { alignment: 'left' },
+ hideDefaultActions: true,
+ initialWidth: 105
+ },
+ {
+ label: '鏈夋晥鏈熷唴搴撳瓨',
+ type: 'customInventoryColor',
+ fieldName: 'limitCount',
+ sortable: true,
+ cellAttributes: { alignment: 'right' },
+ typeAttributes: {
+ value: { fieldName: 'limitCount' },
+ upperlimit: { fieldName: 'upperlimit' },
+ lowerlimit: { fieldName: 'lowerlimit' },
+ boxPrice: { fieldName: 'BoxPiece' }
+ },
+ hideDefaultActions: true,
+ initialWidth: 150
+ },
+ {
+ label: '杩囨湡搴撳瓨',
+ fieldName: 'overlimitCount',
+ hideDefaultActions: true,
+ cellAttributes: { alignment: 'right' },
+ initialWidth: 80
+ }
+ ];
+ defaultSortDirection = 'asc';
+ sortDirection = 'asc';
+ sortedBy;
- connectedCallback() {
- this.loader = true;
- this.init();
- }
+ 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');
+ });
+ }
+ }
- init() {
- this.showSpinner = true;
- oninit({
- pageSizeLWC: this.pageSize,
- pageTokenLWC: this.currentPageToken,
- sortFieldLWC: this.sortBy,
- sortOrderLWC: this.sortDirection
- }).then((result) => {
- result = JSON.parse(JSON.stringify(result));
- console.log("result.status = " + result.status);
- console.log("result = " + JSON.stringify(result));
- console.log("result 1= " + JSON.stringify(result.entity));
- console.log("result 2= " + JSON.stringify(result.entity.pageRecords));
- console.log("result.entity.categoryOptionMap 2= " + JSON.stringify(result.entity.categoryOptionMap));
- console.log("result.entity.categoryOptionMap 2= " + JSON.stringify(result.entity.category4OptionMap));
- console.log("result.entity.categoryOptionMap 2= " + JSON.stringify(result.entity.category5OptionMap));
- if (result.status == "Success") {
- console.log('result.entity.paginatedAccounts = ' + JSON.stringify(result.entity.paginatedAccounts));
- this.nextPageToken = result.entity.paginatedAccounts.nextPageToken;
- this.totalRecords = result.entity.paginatedAccounts.totalRecords;
- this.recordStart = result.entity.paginatedAccounts.recordStart;
- this.recordEnd = result.entity.paginatedAccounts.recordEnd;
- this.totalPages = Math.ceil(result.entity.paginatedAccounts.totalRecords / this.pageSize);
- console.log('this.totalPages = ' + this.totalPages);
- this.paginationVisibility = this.totalPages > 1 ? true : false;
+ connectedCallback() {
+ this.loader = true;
+ this.init();
+ }
- this.loader = false;
- this.data = result.entity.pageRecords;
+ init() {
+ this.showSpinner = true;
+ oninit({
+ pageSizeLWC: this.pageSize,
+ pageTokenLWC: this.currentPageToken,
+ sortFieldLWC: this.sortBy,
+ sortOrderLWC: this.sortDirection
+ })
+ .then((result) => {
+ result = JSON.parse(JSON.stringify(result));
+ console.log(
+ 'result.pageRecords = ' +
+ JSON.stringify(result.entity.pageRecords)
+ );
+ console.log(
+ 'result.consumableorderdetailsRecords = ' +
+ JSON.stringify(
+ result.entity.consumableorderdetailsRecords
+ )
+ );
+ console.log('result.status = ' + result.status);
+ console.log('result = ' + JSON.stringify(result));
+ console.log('result 1= ' + JSON.stringify(result.entity));
+ console.log(
+ 'result 2= ' + JSON.stringify(result.entity.pageRecords)
+ );
+ if (result.status == 'Success') {
+ console.log(
+ 'result.entity.paginatedAccounts = ' +
+ JSON.stringify(result.entity.paginatedAccounts)
+ );
+ this.nextPageToken =
+ result.entity.paginatedAccounts.nextPageToken;
+ this.totalRecords =
+ result.entity.paginatedAccounts.totalRecords;
+ this.recordStart =
+ result.entity.paginatedAccounts.recordStart;
+ this.recordEnd = result.entity.paginatedAccounts.recordEnd;
+ this.totalPages = Math.ceil(
+ result.entity.paginatedAccounts.totalRecords /
+ this.pageSize
+ );
+ console.log('this.totalPages = ' + this.totalPages);
+ this.paginationVisibility =
+ this.totalPages > 1 ? true : false;
- for (var i in this.data) {
- this.data[i]["Name__c"] = this.data[i].Prod.Name__c;
- this.data[i]["Category3__c"] = this.data[i].Prod.Category3__c;
- this.data[i]["Category4__c"] = this.data[i].Prod.Category3__c;
- this.data[i]["Category5__c"] = this.data[i].Prod.Category3__c;
- this.data[i]["SFDA_Status__c"] = this.data[i].Prod.SFDA_Status__c;
- }
- this.showTable = true;
- this.orderDetZaikuList = result.entity.orderDetZaikuList;
- this.accountName = result.entity.accountName;
- this.agencyProType = result.entity.agencyProType;
- this.userWorkLocation = result.entity.userWorkLocation;
- let option1ValueTemp = [];
- for (var key in result.entity.categoryOptionMap) {
- let object = {};
- object['label'] = result.entity.categoryOptionMap[key];
- object['value'] = key;
- option1ValueTemp.push(object);
- }
- this.category3Options = option1ValueTemp;
- console.log(' this.optionscatone===>' + JSON.stringify(this.optionscatone));
- let option2ValueTemp = [];
- for (var key in result.entity.category4OptionMap) {
- let object = {};
- object["label"] = result.entity.category4OptionMap[key];
- object["value"] = key;
- option2ValueTemp.push(object);
- }
- this.category4Options = option2ValueTemp;
- let option3ValueTemp = [];
- for (var key in result.entity.category5OptionMap) {
- let object = {};
- object["label"] = result.entity.category5OptionMap[key];
- object["value"] = key;
- option3ValueTemp.push(object);
- }
- this.category5Options = option3ValueTemp;
- this.hasHos = result.entity.hasHos;
- console.log('this.hasHos'+this.hasHos);
- //hasHos = true 鍖婚櫌鐗逛环
- if (this.hasHos) {
- let object1 = {
- label: "鍖婚櫌鐗逛环",
- fieldName: "hospitalSpecialOffer__c",
- hideDefaultActions: true,
- type:'boolean'
- };
- this.columns.push(object1);
- console.log(' this.columns'+ this.columns);
- for (var j in this.data) {
- this.data[j]["Name__c"] = this.data[j].Prod.Name__c;
- this.data[j]["Category3__c"] = this.data[j].Prod.Category3__c;
- this.data[j]["Category4__c"] = this.data[j].Prod.Category3__c;
- this.data[j]["Category5__c"] = this.data[j].Prod.Category3__c;
- this.data[j]["SFDA_Status__c"] = this.data[j].Prod.SFDA_Status__c;
- this.data[j]["hospitalSpecialOffer__c"] = this.data[j].hospitalSpecialOffer;
- console.log('this.data[j].hospitalSpecialOffer__c'+this.data[j].hospitalSpecialOffer);
- }
+ this.loader = false;
+ this.data = result.entity.pageRecords;
+ this.productkucun = result.entity.productkucun;
+
+ for (var i in this.data) {
+ this.data[i]['Name__c'] = this.data[i].Prod.Name__c;
+ this.data[i]['Category3__c'] =
+ this.data[i].Prod.Category3__c;
+ this.data[i]['Category4__c'] =
+ this.data[i].Prod.Category4__c;
+ this.data[i]['Category5__c'] =
+ this.data[i].Prod.Category5__c;
+ this.data[i]['SFDA_Status__c'] =
+ this.data[i].Prod.SFDA_Status__c;
+ }
+ this.showTable = true;
+ this.orderDetZaikuList = result.entity.orderDetZaikuList;
+ this.accountName = result.entity.accountName;
+ this.agencyProType = result.entity.agencyProType;
+ this.userWorkLocation = result.entity.userWorkLocation;
+ let option1ValueTemp = [];
+ for (var key in result.entity.categoryOptionMap) {
+ let object = {};
+ object['label'] = result.entity.categoryOptionMap[key];
+ object['value'] = key;
+ option1ValueTemp.push(object);
+ }
+ this.category3Options = option1ValueTemp;
+ console.log(
+ ' this.optionscatone===>' +
+ JSON.stringify(this.optionscatone)
+ );
+ let option2ValueTemp = [];
+ for (var key in result.entity.category4OptionMap) {
+ let object = {};
+ object['label'] = result.entity.category4OptionMap[key];
+ object['value'] = key;
+ option2ValueTemp.push(object);
+ }
+ this.category4Options = option2ValueTemp;
+ let option3ValueTemp = [];
+ for (var key in result.entity.category5OptionMap) {
+ let object = {};
+ object['label'] = result.entity.category5OptionMap[key];
+ object['value'] = key;
+ option3ValueTemp.push(object);
+ }
+ this.category5Options = option3ValueTemp;
+ this.hasHos = result.entity.hasHos;
+ console.log('this.hasHos' + this.hasHos);
+ //棰滆壊鏍囪
+
+ //hasHos = true 鍖婚櫌鐗逛环
+ if (this.hasHos) {
+ let object1 = {
+ label: '鍖婚櫌鐗逛环',
+ fieldName: 'hospitalSpecialOffer__c',
+ hideDefaultActions: true,
+ type: 'boolean',
+ cellAttributes: { alignment: 'left' },
+ initialWidth: 80
+ };
+ this.columns.push(object1);
+ console.log(' this.columns' + this.columns);
+ for (var j in this.data) {
+ this.data[j]['Name__c'] = this.data[j].Prod.Name__c;
+ this.data[j]['Category3__c'] =
+ this.data[j].Prod.Category3__c;
+ this.data[j]['Category4__c'] =
+ this.data[j].Prod.Category4__c;
+ this.data[j]['Category5__c'] =
+ this.data[j].Prod.Category5__c;
+ this.data[j]['SFDA_Status__c'] =
+ this.data[j].Prod.SFDA_Status__c;
+ this.data[j]['hospitalSpecialOffer__c'] =
+ this.data[j].hospitalSpecialOffer;
+ console.log(
+ 'this.data[j].hospitalSpecialOffer__c' +
+ this.data[j].hospitalSpecialOffer
+ );
+ }
+ }
+ this.showSpinner = false;
+ } else {
+ // this.showToast("Error",'Error', result.msg);
+ this.showMyToast('鍒濆鍖栧け璐�', result.msg, 'error');
}
- this.showSpinner = false;
- } else {
- this.loader = false;
- console.log("Error:" + result.errorMsg);
- const evt = new ShowToastEvent({
- title: "瑙f瀽澶辫触",
- message: result.errorMsg,
- variant: "error"
- });
- this.dispatchEvent(evt);
- this.showSpinner = false;
- }
- }).catch((error) => {
- this.loader = false;
- this.showSpinner = false;
- console.log("error = " + JSON.stringify(error));
- });
- }
+ })
+ .catch((error) => {
+ this.loader = false;
+ this.showSpinner = false;
+ console.log('error = ' + JSON.stringify(error));
+ });
+ }
- 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;
- }
- }
-
- handleChange(event) {
- let fieldName = event.target.getAttribute("data-field");
- let value = event.detail.value;
- console.log("======>fieldName" + fieldName);
- console.log("======>value" + value);
- switch (fieldName) {
- case "Name":
- this.Name = value;
- break;
- case "CategoryThree":
- this.CategoryThree = value;
- break;
- case "CategoryFour":
- this.CategoryFour = value;
- break;
- case "CategoryFive":
- this.CategoryFive = value;
- break;
- default:
- console.log("no data");
- }
- }
- dataChange(event) {
- let fieldName = event.target.getAttribute("data-field");
+ handleChange(event) {
+ let fieldName = event.target.getAttribute('data-field');
let value = event.detail.value;
- console.log("fieldName = " + fieldName + " value = " + value);
+ console.log('======>fieldName' + fieldName);
+ console.log('======>value' + value);
switch (fieldName) {
- case "Name":
- this.Name = value;
- break;
- case "CategoryThree":
+ case 'Name':
+ this.Name = value;
+ break;
+ case 'CategoryThree':
+ this.CategoryThree = value;
+ break;
+ case 'CategoryFour':
+ this.CategoryFour = value;
+ break;
+ case 'CategoryFive':
+ this.CategoryFive = value;
+ break;
+ default:
+ console.log('no data');
+ }
+ }
+ dataChange(event) {
+ let fieldName = event.target.getAttribute('data-field');
+ let value = event.detail.value;
+ console.log('fieldName = ' + fieldName + ' value = ' + value);
+ switch (fieldName) {
+ case 'Name':
+ this.Name = value;
+ break;
+ case 'CategoryThree':
this.CategoryThree = value;
//璋冪敤鍚庡彴鏄剧ず绗洓浜斿垎绫�
this.showAllCate();
@@ -301,211 +369,250 @@
this.CategoryFive = '';
}
break;
- case "CategoryFour":
- this.Category4 = value;
+ case 'CategoryFour':
+ this.CategoryFour = value;
//璋冪敤鍚庡彴鏄剧ず绗簲鍒嗙被
this.showCate();
if (this.CategoryFour == '') {
this.CategoryFive = '';
}
break;
- case "CategoryFive":
+ case 'CategoryFive':
this.CategoryFive = value;
break;
}
}
-
- showAllCate() {
+ showAllCate() {
categoryAllload({
category3LWC: this.CategoryThree,
- agencyProTypeLWC:this.agencyProType
- }).then((result) => {
- result = JSON.parse(JSON.stringify(result));
- console.log("result = " + JSON.stringify(result));
- if (result.status == "Success") {
- this.category4Options = [];
- this.category5Options = [];
- //绗�4鍒嗙被
- for (var key in result.entity.category4OptionMap) {
- let object = {};
- object["label"] = result.entity.category4OptionMap[key];
- object["value"] = key;
- this.category4Options.push(object);
+ agencyProTypeLWC: this.agencyProType
+ })
+ .then((result) => {
+ result = JSON.parse(JSON.stringify(result));
+ console.log('result = ' + JSON.stringify(result));
+ if (result.status == 'Success') {
+ this.category4Options = [];
+ this.category5Options = [];
+ //绗�4鍒嗙被
+ for (var key in result.entity.category4OptionMap) {
+ let object = {};
+ object['label'] = result.entity.category4OptionMap[key];
+ object['value'] = key;
+ this.category4Options.push(object);
+ }
+ console.log(
+ 'this.category4Options = ' +
+ JSON.stringify(this.category4Options)
+ );
+ //绗�5鍒嗙被
+ for (var key in result.entity.category5OptionMap) {
+ let object = {};
+ object['label'] = result.entity.category5OptionMap[key];
+ object['value'] = key;
+ this.category5Options.push(object);
+ }
+ } else {
+ console.log('result = ' + JSON.stringify(result));
+ this.showMyToast(result.msg, '', 'error');
}
- console.log("this.category4Options = " + JSON.stringify(this.category4Options));
- //绗�5鍒嗙被
- for (var key in result.entity.category5OptionMap) {
- let object = {};
- object["label"] = result.entity.category5OptionMap[key];
- object["value"] = key;
- this.category5Options.push(object);
+ })
+ .catch((error) => {
+ console.log('error' + JSON.stringify(error));
+ });
+ }
+
+ searchOrderDetail() {
+ this.showTable = false;
+ this.showSpinner = true;
+ searchOrder({
+ category1: this.Name,
+ Category3: this.CategoryThree,
+ Category4: this.CategoryFour,
+ Category5: this.CategoryFive,
+ orderDetZaikuListLWC: JSON.stringify(this.orderDetZaikuList),
+ accountName: this.accountName,
+ agencyProType: this.agencyProType,
+ userWorkLocation: this.userWorkLocation,
+ pageSizeLWC: this.pageSize,
+ pageTokenLWC: this.currentPageToken,
+ productkucunLWC: this.productkucun
+
+ // sortFieldLWC: this.sortBy,
+ // sortOrderLWC: this.sortDirection
+ })
+ .then((result) => {
+ result = JSON.parse(JSON.stringify(result));
+ if (result.status == 'Success') {
+ this.nextPageToken =
+ result.entity.paginatedAccounts.nextPageToken;
+ this.totalRecords =
+ result.entity.paginatedAccounts.totalRecords;
+ this.recordStart =
+ result.entity.paginatedAccounts.recordStart;
+ this.recordEnd = result.entity.paginatedAccounts.recordEnd;
+ this.totalPages = Math.ceil(
+ result.entity.paginatedAccounts.totalRecords /
+ this.pageSize
+ );
+ console.log(
+ 'result.entity.paginatedAccounts = ' +
+ JSON.stringify(result.entity.paginatedAccounts)
+ );
+ console.log('this.totalPages = ' + this.totalPages);
+ this.paginationVisibility =
+ this.totalPages > 1 ? true : false;
+ console.log('this.sortDirection = ' + this.sortDirection);
+ // this.showToast("Success",'鎼滅储鎴愬姛', result.msg);
+ // this.showMyToast('鎼滅储鎴愬姛',result.msg,'success');
+ this.data = result.entity.pageRecords;
+ console.log('鎼滅储Data==>' + JSON.stringify(this.data));
+ for (var i in this.data) {
+ this.data[i]['Name__c'] = this.data[i].Prod.Name__c;
+ this.data[i]['Category3__c'] =
+ this.data[i].Prod.Category3__c;
+ this.data[i]['Category4__c'] =
+ this.data[i].Prod.Category4__c;
+ this.data[i]['Category5__c'] =
+ this.data[i].Prod.Category5__c;
+ this.data[i]['SFDA_Status__c'] =
+ this.data[i].Prod.SFDA_Status__c;
+ this.data[i]['hospitalSpecialOffer__c'] =
+ this.data[i].hospitalSpecialOffer;
+ this.data[i]['guaranteeperiod'] =
+ this.data[i].guaranteeperiod;
+ }
+ this.data = [...this.data];
+ console.log('this.data = ' + JSON.stringify(this.data));
+ this.showTable = true;
+ this.showSpinner = false;
+ } else {
+ this.nextPageToken = this.pageSize;
+ this.totalRecords = 0;
+ this.recordStart = 0;
+ this.recordEnd = 0;
+ this.totalPages = 0;
+
+ // this.showToast("Error",'Error', result.msg);
+ // this.showMyToast('鎼滅储澶辫触',result.msg,'error');
+ this.showSpinner = false;
}
- } else {
- console.log("result = " + JSON.stringify(result));
- this.showToast("Error", result.msg);
+ })
+ .catch((error) => {
+ console.log('error = ' + JSON.stringify(error));
+ this.showSpinner = false;
+ });
+ }
+ inventoryCount() {
+ this[NavigationMixin.Navigate]({
+ type: 'standard__webPage',
+ attributes: {
+ url: '/lexinventory'
}
- }).catch((error) => {
- console.log("error" + JSON.stringify(error));
});
}
- searchOrderDetail() {
- this.showTable = false;
- searchOrder({
- category1: this.Name,
- Category3: this.CategoryThree,
- Category4: this.CategoryFour,
- Category5: this.CategoryFive,
- orderDetZaikuListLWC: JSON.stringify(this.orderDetZaikuList),
- accountName: this.accountName,
- agencyProType: this.agencyProType,
- userWorkLocation: this.userWorkLocation,
- pageSizeLWC: this.pageSize,
- pageTokenLWC: this.currentPageToken,
- // sortFieldLWC: this.sortBy,
- // sortOrderLWC: this.sortDirection
- })
- .then((result) => {
- result = JSON.parse(JSON.stringify(result));
- if (result.status == "Success") {
- this.nextPageToken = result.entity.paginatedAccounts.nextPageToken;
- this.totalRecords = result.entity.paginatedAccounts.totalRecords;
- this.recordStart = result.entity.paginatedAccounts.recordStart;
- this.recordEnd = result.entity.paginatedAccounts.recordEnd;
- this.totalPages = Math.ceil(result.entity.paginatedAccounts.totalRecords / this.pageSize);
- console.log('this.totalPages = ' + this.totalPages);
- this.paginationVisibility = this.totalPages > 1 ? true : false;
- console.log('this.sortDirection = ' + this.sortDirection);
- const evt = new ShowToastEvent({
- title: "鎼滅储鎴愬姛",
- message: result.msg,
- variant: "Success"
- });
- this.dispatchEvent(evt);
- this.data = result.entity.pageRecords;
- console.log('鎼滅储Data==>'+JSON.stringify(this.data));
- for (var i in this.data) {
- this.data[i]["Name__c"] = this.data[i].Prod.Name__c;
- this.data[i]["Category3__c"] = this.data[i].Prod.Category3__c;
- this.data[i]["Category4__c"] = this.data[i].Prod.Category3__c;
- this.data[i]["Category5__c"] = this.data[i].Prod.Category3__c;
- this.data[i]["SFDA_Status__c"] = this.data[i].Prod.SFDA_Status__c;
- this.data[i]["hospitalSpecialOffer__c"] = this.data[i].hospitalSpecialOffer;
- }
- this.data = [...this.data];
- console.log('this.data = ' + JSON.stringify(this.data));
- this.showTable = true;
- } else {
- const evt = new ShowToastEvent({
- title: "",
- message: result.msg,
- variant: "Success"
- });
- this.dispatchEvent(evt);
- }
- })
- .catch((error) => {
- console.log("error = " + JSON.stringify(error));
- });
- }
- inventoryCount() {
- this[NavigationMixin.Navigate]({
- type: 'standard__webPage',
- attributes: {
- url: '/lexInventory'
- }
- });
- }
+ handleExpired() {
+ console.log('杩囨湡搴撳瓨鍛㈤攢瀛�');
+ this[NavigationMixin.Navigate]({
+ type: 'standard__webPage',
+ attributes: {
+ url: '/lexoverduestock'
+ }
+ });
+ }
+ removeBox() {
+ this[NavigationMixin.Navigate]({
+ type: 'standard__webPage',
+ attributes: {
+ url: '/lexremovebox'
+ }
+ });
+ }
+ cancelremoveBox() {
+ this[NavigationMixin.Navigate]({
+ type: 'standard__webPage',
+ attributes: {
+ url: '/lexcancelremovebox'
+ }
+ });
+ }
- handleExpired() {
- console.log('杩囨湡搴撳瓨鍛㈤攢瀛�');
- this[NavigationMixin.Navigate]({
- type: 'standard__webPage',
- attributes: {
- url: '/lexoverdueStock'
- }
- });
+ clearAll() {
+ this.showSpinner = true;
+ this.showTable = false;
+ this.Name = '';
+ this.CategoryThree = '';
+ this.CategoryFour = '';
+ this.CategoryFive = '';
+ this.template.querySelectorAll('lightning-combobox').forEach((each) => {
+ each.value = null;
+ });
+ console.log(' this.CategoryThree' + this.CategoryThree);
+ console.log('鏁版嵁鍒楄〃' + this.data);
+ searchOrder({
+ category1: this.Name,
+ Category3: this.CategoryThree,
+ Category4: this.CategoryFour,
+ Category5: this.CategoryFive,
+ orderDetZaikuListLWC: JSON.stringify(this.orderDetZaikuList),
+ accountName: this.accountName,
+ agencyProType: this.agencyProType,
+ userWorkLocation: this.userWorkLocation,
+ pageSizeLWC: this.pageSize,
+ pageTokenLWC: this.currentPageToken
+ })
+ .then((result) => {
+ console.log('result鎼滅储 = ' + JSON.stringify(result));
+ result = JSON.parse(JSON.stringify(result));
+ if (result.status == 'Success') {
+ this.nextPageToken =
+ result.entity.paginatedAccounts.nextPageToken;
+ this.totalRecords =
+ result.entity.paginatedAccounts.totalRecords;
+ this.recordStart =
+ result.entity.paginatedAccounts.recordStart;
+ this.recordEnd = result.entity.paginatedAccounts.recordEnd;
+ this.totalPages = Math.ceil(
+ result.entity.paginatedAccounts.totalRecords /
+ this.pageSize
+ );
+ console.log('this.totalPages = ' + this.totalPages);
+ this.paginationVisibility =
+ this.totalPages > 1 ? true : false;
+ console.log('this.sortDirection = ' + this.sortDirection);
+ this.data = result.entity.pageRecords;
- }
- removeBox() {
- this[NavigationMixin.Navigate]({
- type: 'standard__webPage',
- attributes: {
- url: '/lexremovebox'
- }
- });
+ for (var i in this.data) {
+ this.data[i]['Name__c'] = this.data[i].Prod.Name__c;
+ this.data[i]['Category3__c'] =
+ this.data[i].Prod.Category3__c;
+ this.data[i]['Category4__c'] =
+ this.data[i].Prod.Category4__c;
+ this.data[i]['Category5__c'] =
+ this.data[i].Prod.Category5__c;
+ this.data[i]['SFDA_Status__c'] =
+ this.data[i].Prod.SFDA_Status__c;
+ this.data[i]['guaranteeperiod'] =
+ this.data[i].guaranteeperiod;
+ }
+ this.showSpinner = false;
+ this.showTable = true;
+ // this.showMyToast('鎼滅储鎴愬姛',result.msg,'success');
+ // this.showToast("Success",'鎼滅储鎴愬姛', result.msg);
+ } else {
+ // this.showToast("Error", 'Error',result.msg);
+ // this.showMyToast('鎼滅储澶辫触',result.msg,'error');
+ this.showSpinner = false;
+ }
+ })
+ .catch((error) => {
+ console.log('error = ' + JSON.stringify(error));
+ this.showSpinner = false;
+ });
+ }
- }
- cancelremoveBox() {
- this[NavigationMixin.Navigate]({
- type: 'standard__webPage',
- attributes: {
- url: '/lexCancelRemoveBox'
- }
- });
-
- }
-
- clearAll() {
- this.showSpinner = true;
- this.showTable = false;
- this.Name = '';
- this.CategoryThree = '';
- this.CategoryFour = '';
- this.CategoryFive = '';
- this.template.querySelectorAll("lightning-combobox").forEach((each) => {
- each.value = null;
- });
- console.log(' this.CategoryThree' + this.CategoryThree);
- console.log('鏁版嵁鍒楄〃' + this.data);
- searchOrder({
- category1: this.Name,
- Category3: this.CategoryThree,
- Category4: this.CategoryFour,
- Category5: this.CategoryFive,
- orderDetZaikuListLWC: JSON.stringify(this.orderDetZaikuList),
- accountName: this.accountName,
- agencyProType: this.agencyProType,
- userWorkLocation: this.userWorkLocation
- })
- .then((result) => {
- console.log("result鎼滅储 = " + JSON.stringify(result));
- result = JSON.parse(JSON.stringify(result));
- if (result.status == "Success") {
- this.data = result.entity.pageRecords;
-
- for (var i in this.data) {
- this.data[i]["Name__c"] = this.data[i].Prod.Name__c;
- this.data[i]["Category3__c"] = this.data[i].Prod.Category3__c;
- this.data[i]["Category4__c"] = this.data[i].Prod.Category3__c;
- this.data[i]["Category5__c"] = this.data[i].Prod.Category3__c;
- this.data[i]["SFDA_Status__c"] = this.data[i].Prod.SFDA_Status__c;
- }
- this.showSpinner = false;
- this.showTable = true;
- const evt = new ShowToastEvent({
- title: "鎼滅储鎴愬姛",
- message: result.msg,
- variant: "Success"
- });
- this.dispatchEvent(evt);
- this.showSpinner = false;
- } else {
- const evt = new ShowToastEvent({
- title: "",
- message: result.msg,
- variant: "Success"
- });
- this.dispatchEvent(evt);
- }
- })
- .catch((error) => {
- console.log("error = " + JSON.stringify(error));
- });
- }
-
- sortByMethod(field, reverse, primer) {
+ sortByMethod(field, reverse, primer) {
const key = primer
? function (x) {
return primer(x[field]);
@@ -521,63 +628,98 @@
};
}
- 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)
- // if('limitCount' != this.sortBy)
- // this.searchOrderDetail();
- // else{
- // const { fieldName: sortedBy, sortDirection } = event.detail;
- // const cloneData = [...this.data];
- // cloneData.sort(this.sortByMethod(sortedBy, sortDirection === 'asc' ? 1 : -1));
- // this.data = cloneData;
- // this.sortDirection = sortDirection;
- // this.sortedBy = sortedBy;
- // }
- const { fieldName: sortedBy, sortDirection } = event.detail;
- const cloneData = [...this.data];
- cloneData.sort(this.sortByMethod(sortedBy, sortDirection === 'asc' ? 1 : -1));
- this.data = cloneData;
- this.sortDirection = sortDirection;
- this.sortedBy = sortedBy;
- }
+ 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);
+ // if('limitCount' != this.sortBy)
+ // this.searchOrderDetail();
+ // else{
+ // const { fieldName: sortedBy, sortDirection } = event.detail;
+ // const cloneData = [...this.data];
+ // cloneData.sort(this.sortByMethod(sortedBy, sortDirection === 'asc' ? 1 : -1));
+ // this.data = cloneData;
+ // this.sortDirection = sortDirection;
+ // this.sortedBy = sortedBy;
+ // }
+ const { fieldName: sortedBy, sortDirection } = event.detail;
+ const cloneData = [...this.data];
+ cloneData.sort(
+ this.sortByMethod(sortedBy, sortDirection === 'asc' ? 1 : -1)
+ );
+ this.data = 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.searchOrderDetail();
- }
+ handlePrevious() {
+ this.currentPageToken =
+ Number(this.currentPageToken) - Number(this.pageSize);
+ this.searchOrderDetail();
+ }
- handleNext() {
- this.currentPageToken = Number(this.currentPageToken) + Number(this.pageSize);
- this.searchOrderDetail();
- }
- handleFirst() {
- this.currentPageToken = 0;
- this.searchOrderDetail();
- }
+ handleNext() {
+ this.currentPageToken =
+ Number(this.currentPageToken) + Number(this.pageSize);
+ this.searchOrderDetail();
+ }
+ handleFirst() {
+ this.currentPageToken = 0;
+ this.searchOrderDetail();
+ }
- handleLast() {
- this.currentPageToken = this.totalPages > 1 ? (this.totalPages - 1) * this.pageSize : 0;
- this.searchOrderDetail();
- }
+ handleLast() {
+ this.currentPageToken =
+ this.totalPages > 1 ? (this.totalPages - 1) * this.pageSize : 0;
+ this.searchOrderDetail();
+ }
- handlePageschange(event) {
- console.log(event.detail);
- this.pageSize = event.detail;
- this.currentPageToken = 0;
- this.searchOrderDetail();
- }
- get previousButtonDisabled() {
- return this.currentPageToken === 0;
- }
+ handlePageschange(event) {
+ console.log(event.detail);
+ this.pageSize = event.detail;
+ this.currentPageToken = 0;
+ this.searchOrderDetail();
+ }
+ get previousButtonDisabled() {
+ return this.currentPageToken === 0;
+ }
- get nextButtonDisabled() {
- return this.nextPageToken === undefined;
- }
-
-
+ get nextButtonDisabled() {
+ return this.nextPageToken === undefined;
+ }
+ showMyToast(title, message, variant) {
+ console.log('show custom message');
+ var iconName = '';
+ var content = '';
+ if (variant == 'success') {
+ iconName = 'utility:check';
+ } else {
+ iconName = 'utility:error';
+ }
+ if (message != '') {
+ content =
+ '<h2><strong>' +
+ title +
+ '<strong/></h2><h5>' +
+ message +
+ '</h5>';
+ } else {
+ content = '<h2><strong>' + title + '<strong/></h2>';
+ }
+ this.template
+ .querySelector('c-common-toast')
+ .showToast(variant, content, iconName, 10000);
+ }
}
\ No newline at end of file
--
Gitblit v1.9.1