import { LightningElement,wire,track,api} from 'lwc';
|
import { CurrentPageReference } from "lightning/navigation";
|
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
|
import { loadStyle } from "lightning/platformResourceLoader";
|
import lwcCSS from '@salesforce/resourceUrl/lwcCSS';
|
import initData from '@salesforce/apex/lexTmsformController.initData';
|
import initData2 from '@salesforce/apex/lexTmsformController.initData2';
|
import searchUser from '@salesforce/apex/lexTmsformController.searchUser';
|
import saveTms from '@salesforce/apex/lexTmsformController.saveTms';
|
import selectState_Master from '@salesforce/apex/lexConsumabletargetformController.selectState_Master';
|
import ConsumCategory2 from '@salesforce/label/c.ConsumCategory2';
|
|
|
export default class lexTmsform extends LightningElement {
|
@wire(CurrentPageReference)
|
getStateParameters(currentPageReference) {
|
if (currentPageReference) {
|
const urlValue = currentPageReference.state.fragment;
|
if (urlValue) {
|
this.location = urlValue;
|
}
|
}
|
}
|
@track
|
showData;
|
@track
|
searchflgStart = true ;
|
@track
|
threemonthAug;
|
@track
|
savedataList = [];
|
@track
|
kucunMonth;
|
@track
|
kucunMonth2;
|
@track
|
showData3;
|
@track
|
totalNumberAll;
|
@track
|
totalNumberAll2;
|
@track
|
cc2 = ConsumCategory2;
|
@track
|
ifENG = false;
|
@track
|
ifET = true;
|
@track
|
Dealer_Name;
|
@track
|
extractedParts={};
|
@track
|
DealerName;
|
@track
|
isLoading = false;
|
@track
|
ifnum = true;
|
@track
|
productTypeValue = '';
|
@track
|
productTypeOpt = [{label:'ET耗材',value:'ET耗材'},
|
{label:'外科耗材',value:'外科耗材'}];
|
@track
|
productTypeValue = 'ET耗材'; // 设置默认值
|
|
// @track
|
// SalesdepartmentOpt = [
|
// {label:'全国',value:'全国'},
|
// {label:'1.华北',value:'1.华北'},
|
// {label:'2.东北',value:'2.东北'},
|
// {label:'3.西北',value:'3.西北'},
|
// {label:'4.西南',value:'4.西南'},
|
// {label:'5.华东',value:'5.华东'},
|
// {label:'6.华南',value:'6.华南'}];
|
// @track
|
// SalesdepartmentValue = '全国'; // 设置默认值
|
|
@track
|
Hideflgs = false;
|
@track
|
monthView1 = true;
|
@track
|
monthView2 = true;
|
@track
|
monthView3 = true;
|
@track
|
monthView4 = true;
|
@track
|
monthView5 = true;
|
@track
|
monthView6 = true;
|
@track
|
monthView7 = true;
|
@track
|
monthView8 = true;
|
@track
|
monthView9 = true;
|
@track
|
monthView10 = true;
|
@track
|
monthView11 = true;
|
@track
|
monthView12 = true;
|
@track
|
monthViewtotal = true;
|
@track
|
monthViewannual = true;
|
//展示所有行
|
ExpandAllRow(){
|
if (this.showData3 !=null) {
|
this.showData3.forEach(item=>{
|
if(!item.flg){
|
item.Hideflg = true;
|
}else{
|
item.Hideflg2 = true;
|
}
|
});
|
this.Hideflgs= true;
|
}
|
|
}
|
//展示行
|
ExpandRow(event){
|
var Category2 = event.target.name;
|
var fg = false;
|
this.showData3.forEach(item=>{
|
if(!item.flg&&item.Category2 === Category2){
|
item.Hideflg = true;
|
}else if(item.flg&&item.Category2 === Category2){
|
item.Hideflg2 = true;
|
}
|
if(item.Hideflg){
|
fg = true;
|
}
|
});
|
this.Hideflgs= fg;
|
}
|
//隐藏所有行
|
HideAllRow(){
|
this.showData3.forEach(item=>{
|
if(!item.flg){
|
item.Hideflg = false;
|
}else{
|
item.Hideflg2 = false;
|
}
|
});
|
this.Hideflgs= false;
|
}
|
//隐藏行
|
HideRow(event){
|
var Category2 = event.target.name;
|
var fg = false;
|
this.showData3.forEach(item=>{
|
if(!item.flg&&item.Category2 === Category2){
|
item.Hideflg = false;
|
}else if(item.flg&&item.Category2 === Category2){
|
item.Hideflg2 = false;
|
}
|
if(item.Hideflg){
|
fg = true;
|
}
|
});
|
this.Hideflgs= fg;
|
}
|
//省
|
@track
|
provinceValue = '';
|
opt = [{label:'无',value:''}];
|
get provinceOpt() {
|
if(this.opt.length<=1){
|
selectState_Master().then(rtnv=>{
|
rtnv.forEach(item=>{
|
this.opt.push({label:item.Name,value:item.Name});
|
});
|
return this.opt;
|
});
|
}else{
|
return this.opt;
|
}
|
}
|
|
@track
|
SearchCode = '';
|
@track searchTerm = '';
|
productTypeChange(event){
|
this.productTypeValue = event.detail.value;
|
}
|
SalesdepartmentChange(event){
|
this.SalesdepartmentValue = event.detail.value;
|
}
|
provinceChange(event){
|
this.provinceValue = event.detail.value;
|
if (this.provinceValue!='' && this.DealerName !=null && this.DealerName !='') {
|
var currentDate = new Date();
|
var currentMonth = currentDate.getMonth() + 1;
|
this.monthViewtotal = false;
|
this.monthViewannual = false;
|
if (currentMonth ==1) {
|
this.monthView1 = false;
|
this.monthView2 = false;
|
this.monthView3 = false;
|
}else if(currentMonth ==2){
|
this.monthView2 = false;
|
this.monthView3 = false;
|
}else if(currentMonth ==3){
|
this.monthView3 = false;
|
}else if(currentMonth ==4){
|
this.monthView1 = false;
|
this.monthView2 = false;
|
this.monthView3 = false;
|
this.monthView11 = false;
|
this.monthView12 = false;
|
this.monthView10 = false;
|
this.monthView4 = false;
|
this.monthView5 = false;
|
this.monthView6 = false;
|
this.monthView7 = false;
|
this.monthView8 = false;
|
this.monthView9 = false;
|
}else if(currentMonth ==5){
|
this.monthView1 = false;
|
this.monthView2 = false;
|
this.monthView3 = false;
|
this.monthView11 = false;
|
this.monthView12 = false;
|
this.monthView10 = false;
|
this.monthView5 = false;
|
this.monthView6 = false;
|
this.monthView7 = false;
|
this.monthView8 = false;
|
this.monthView9 = false;
|
}else if(currentMonth ==6){
|
this.monthView1 = false;
|
this.monthView2 = false;
|
this.monthView3 = false;
|
this.monthView11 = false;
|
this.monthView12 = false;
|
this.monthView10 = false;
|
this.monthView6 = false;
|
this.monthView7 = false;
|
this.monthView8 = false;
|
this.monthView9 = false;
|
}else if(currentMonth ==7){
|
this.monthView1 = false;
|
this.monthView2 = false;
|
this.monthView3 = false;
|
this.monthView11 = false;
|
this.monthView12 = false;
|
this.monthView10 = false;
|
this.monthView7 = false;
|
this.monthView8 = false;
|
this.monthView9 = false;
|
}else if(currentMonth ==8){
|
this.monthView1 = false;
|
this.monthView2 = false;
|
this.monthView3 = false;
|
this.monthView11 = false;
|
this.monthView12 = false;
|
this.monthView10 = false;
|
this.monthView8 = false;
|
this.monthView9 = false;
|
}else if(currentMonth ==9){
|
this.monthView1 = false;
|
this.monthView2 = false;
|
this.monthView3 = false;
|
this.monthView11 = false;
|
this.monthView12 = false;
|
this.monthView10 = false;
|
this.monthView9 = false;
|
}else if(currentMonth ==10){
|
this.monthView1 = false;
|
this.monthView2 = false;
|
this.monthView3 = false;
|
this.monthView11 = false;
|
this.monthView12 = false;
|
this.monthView10 = false;
|
}else if(currentMonth ==11){
|
this.monthView1 = false;
|
this.monthView2 = false;
|
this.monthView3 = false;
|
this.monthView11 = false;
|
this.monthView12 = false;
|
}else if(currentMonth ==12){
|
this.monthView1 = false;
|
this.monthView2 = false;
|
this.monthView3 = false;
|
this.monthView12 = false;
|
}
|
}else{
|
this.monthView1= true;
|
this.monthView2= true;
|
this.monthView3= true;
|
this.monthView4= true;
|
this.monthView5= true;
|
this.monthView6= true;
|
this.monthView7= true;
|
this.monthView8= true;
|
this.monthView9= true;
|
this.monthView10= true;
|
this.monthView11= true;
|
this.monthView12= true;
|
}
|
}
|
AccountChange(event){
|
|
this.Dealer_Name = event.detail.value;
|
this.DealerName = event.detail.value.toString();
|
this.searchProduct();
|
if (this.provinceValue!='' && this.DealerName !=null && this.DealerName !='') {
|
var currentDate = new Date();
|
var currentMonth = currentDate.getMonth() + 1;
|
this.monthViewtotal = false;
|
this.monthViewannual = false;
|
if (currentMonth ==1) {
|
this.monthView1 = false;
|
this.monthView2 = false;
|
this.monthView3 = false;
|
}else if(currentMonth ==2){
|
this.monthView2 = false;
|
this.monthView3 = false;
|
}else if(currentMonth ==3){
|
this.monthView3 = false;
|
}else if(currentMonth ==4){
|
this.monthView1 = false;
|
this.monthView2 = false;
|
this.monthView3 = false;
|
this.monthView11 = false;
|
this.monthView12 = false;
|
this.monthView10 = false;
|
this.monthView4 = false;
|
this.monthView5 = false;
|
this.monthView6 = false;
|
this.monthView7 = false;
|
this.monthView8 = false;
|
this.monthView9 = false;
|
}else if(currentMonth ==5){
|
this.monthView1 = false;
|
this.monthView2 = false;
|
this.monthView3 = false;
|
this.monthView11 = false;
|
this.monthView12 = false;
|
this.monthView10 = false;
|
this.monthView5 = false;
|
this.monthView6 = false;
|
this.monthView7 = false;
|
this.monthView8 = false;
|
this.monthView9 = false;
|
}else if(currentMonth ==6){
|
this.monthView1 = false;
|
this.monthView2 = false;
|
this.monthView3 = false;
|
this.monthView11 = false;
|
this.monthView12 = false;
|
this.monthView10 = false;
|
this.monthView6 = false;
|
this.monthView7 = false;
|
this.monthView8 = false;
|
this.monthView9 = false;
|
}else if(currentMonth ==7){
|
this.monthView1 = false;
|
this.monthView2 = false;
|
this.monthView3 = false;
|
this.monthView11 = false;
|
this.monthView12 = false;
|
this.monthView10 = false;
|
this.monthView7 = false;
|
this.monthView8 = false;
|
this.monthView9 = false;
|
}else if(currentMonth ==8){
|
this.monthView1 = false;
|
this.monthView2 = false;
|
this.monthView3 = false;
|
this.monthView11 = false;
|
this.monthView12 = false;
|
this.monthView10 = false;
|
this.monthView8 = false;
|
this.monthView9 = false;
|
}else if(currentMonth ==9){
|
this.monthView1 = false;
|
this.monthView2 = false;
|
this.monthView3 = false;
|
this.monthView11 = false;
|
this.monthView12 = false;
|
this.monthView10 = false;
|
this.monthView9 = false;
|
}else if(currentMonth ==10){
|
this.monthView1 = false;
|
this.monthView2 = false;
|
this.monthView3 = false;
|
this.monthView11 = false;
|
this.monthView12 = false;
|
this.monthView10 = false;
|
}else if(currentMonth ==11){
|
this.monthView1 = false;
|
this.monthView2 = false;
|
this.monthView3 = false;
|
this.monthView11 = false;
|
this.monthView12 = false;
|
}else if(currentMonth ==12){
|
this.monthView1 = false;
|
this.monthView2 = false;
|
this.monthView3 = false;
|
this.monthView12 = false;
|
}
|
}else{
|
this.monthView1= true;
|
this.monthView2= true;
|
this.monthView3= true;
|
this.monthView4= true;
|
this.monthView5= true;
|
this.monthView6= true;
|
this.monthView7= true;
|
this.monthView8= true;
|
this.monthView9= true;
|
this.monthView10= true;
|
this.monthView11= true;
|
this.monthView12= true;
|
}
|
|
}
|
renderedCallback(){
|
Promise.all([
|
loadStyle(this, lwcCSS)
|
]);
|
}
|
|
location = '';
|
handleSearchChange(event) {
|
this.searchTerm = event.target.value;
|
}
|
|
|
connectedCallback() {
|
|
this.extractedParts = this.cc2.split(',');
|
console.log('extractedParts='+this.extractedParts);
|
var today = new Date();
|
var year = today.getFullYear();
|
this.fiscalYearValue = 'FY'+String(year);
|
this.showData2=[{id:'1',flg:true,Hospital__rId:"11",titleName:'目标',Apr:0,May:0,June:0,July:0,Aug:0,Sept:0,Oct:0,Nov:0,Dec:0,Jan:0,Feb:0,Mar:0,YTDTotal:0,annual:0},
|
{id:'2',flg:true,Hospital__rId:"12",titleName:'OLY订货',Apr:0,May:0,June:0,July:0,Aug:0,Sept:0,Oct:0,Nov:0,Dec:0,Jan:0,Feb:0,Mar:0,YTDTotal:0,annual:0},
|
{id:'3',flg:true,Hospital__rId:"13",titleName:'OLY发货',Apr:0,May:0,June:0,July:0,Aug:0,Sept:0,Oct:0,Nov:0,Dec:0,Jan:0,Feb:0,Mar:0,YTDTotal:0,annual:0},
|
{id:'4',flg:true,Hospital__rId:"4",titleName:'今年注残',Apr:0,May:0,June:0,July:0,Aug:0,Sept:0,Oct:0,Nov:0,Dec:0,Jan:0,Feb:0,Mar:0,YTDTotal:0,annual:0},
|
{id:'5',flg:true,Hospital__rId:"5",titleName:'总库存金额',Apr:0,May:0,June:0,July:0,Aug:0,Sept:0,Oct:0,Nov:0,Dec:0,Jan:0,Feb:0,Mar:0,YTDTotal:0,annual:0},
|
{id:'6',flg:true,Hospital__rId:"14",titleName:'未付款金额',Apr:0,May:0,June:0,July:0,Aug:0,Sept:0,Oct:0,Nov:0,Dec:0,Jan:0,Feb:0,Mar:0,YTDTotal:0,annual:0},
|
{id:'7',flg:true,Hospital__rId:"6",titleName:'发货达成率',Apr:'0',May:'0',June:'0',July:'0',Aug:'0',Sept:'0',Oct:'0',Nov:'0',Dec:'0',Jan:'0',Feb:'0',Mar:'0',YTDTotal:'0',annual:'0'},
|
{id:'8',flg:true,Hospital__rId:"7",titleName:'IMS发货',Apr:0,May:0,June:0,July:0,Aug:0,Sept:0,Oct:0,Nov:0,Dec:0,Jan:0,Feb:0,Mar:0,YTDTotal:0,annual:0},
|
{id:'9',flg:true,Hospital__rId:"8",titleName:'TMS-IMS',Apr:0,May:0,June:0,July:0,Aug:0,Sept:0,Oct:0,Nov:0,Dec:0,Jan:0,Feb:0,Mar:0,YTDTotal:0,annual:0},
|
{id:'12',flg:true,Hospital__rId:"1",titleName:'TMS预测达成',Apr:0,May:0,June:0,July:0,Aug:0,Sept:0,Oct:0,Nov:0,Dec:0,Jan:0,Feb:0,Mar:0,YTDTotal:0,annual:0},
|
{id:'13',flg:true,Hospital__rId:"2",titleName:'预测库存',Apr:0,May:0,June:0,July:0,Aug:0,Sept:0,Oct:0,Nov:0,Dec:0,Jan:0,Feb:0,Mar:0,YTDTotal:0,annual:0},
|
{id:'10',flg:true,flg2:true,Hospital__rId:"9",titleName:'IMS预测',Apr:0,May:0,June:0,July:0,Aug:0,Sept:0,Oct:0,Nov:0,Dec:0,Jan:0,Feb:0,Mar:0,YTDTotal:0,annual:0},
|
{id:'11',flg:true,flg2:true,Hospital__rId:"10",titleName:'TMS预测',Apr:0,May:0,June:0,July:0,Aug:0,Sept:0,Oct:0,Nov:0,Dec:0,Jan:0,Feb:0,Mar:0,YTDTotal:0,annual:0}
|
|
];
|
|
this.searchUsers();
|
|
}
|
onChangeFn(event){
|
var a = event.target.title;
|
var b = event.target.name;
|
var c = event.target.value;
|
if (a != null && b != null && c !=null) {
|
var d = a+'-'+b+'-'+c;
|
this.savedataList.push(d);
|
}
|
console.log('this.savedataList='+this.savedataList);
|
}
|
//市
|
@track
|
City_MasterValue = '';
|
City_MasterChange(event){
|
this.City_MasterValue = event.detail.value;
|
}
|
searchUsers(){
|
|
searchUser({
|
|
}).then(result =>{
|
|
this.provinceValue = result.OCM_man_province__c;
|
this.SalesdepartmentValue = result.Salesdepartment__c;
|
this.searchProduct();
|
}).catch(error =>{
|
; const evt = new ShowToastEvent({
|
title : error,
|
message: '',
|
variant: 'error',
|
mode: 'sticky'
|
});
|
this.dispatchEvent(evt);
|
return;
|
})
|
}
|
searchProduct(){
|
this.isLoading = true;
|
// if ((this.DealerName == null || this.DealerName == '') && !this.searchflgStart) {
|
// const evt = new ShowToastEvent({
|
// title : '请输入经销商',
|
// message: '',
|
// variant: 'error',
|
// mode: 'sticky'
|
// });
|
// this.isLoading = false;
|
// this.dispatchEvent(evt);
|
// return;
|
// }
|
// if ((this.provinceValue == null || this.provinceValue == '') && !this.searchflgStart) {
|
// const evt = new ShowToastEvent({
|
// title : '请输入省',
|
// message: '',
|
// variant: 'error',
|
// mode: 'sticky'
|
// });
|
// this.isLoading = false;
|
// this.dispatchEvent(evt);
|
// return;
|
// }
|
console.log('this.DealerName='+this.DealerName);
|
initData({
|
SalesdepartmentValue:this.SalesdepartmentValue,
|
provinceValue:this.provinceValue,
|
City_MasterValue:this.City_MasterValue,
|
productTypeValue:this.productTypeValue,
|
customerTypeValue:this.customerTypeValue,
|
fiscalYearValue:this.fiscalYearValue,
|
Dealer_Name:this.DealerName
|
})
|
.then(result=>{
|
console.log('initData start');
|
this.threemonthAug = result.threemonthAug;
|
|
var data2 = this.showData2;
|
var showSumRowMap2 = new Map();
|
data2.forEach(element => {
|
var obj = {...{},...element};
|
if (obj.Hospital__rId == '11') {
|
obj.Apr = result.FY_P_4.toLocaleString();
|
obj.May = result.FY_P_5.toLocaleString();
|
obj.June = result.FY_P_6.toLocaleString();
|
obj.July = result.FY_P_7.toLocaleString();
|
obj.Aug = result.FY_P_8.toLocaleString();
|
obj.Sept = result.FY_P_9.toLocaleString();
|
obj.Oct = result.FY_P_10.toLocaleString();
|
obj.Nov = result.FY_P_11.toLocaleString();
|
obj.Dec = result.FY_P_12.toLocaleString();
|
obj.Jan = result.FY_P_1.toLocaleString();
|
obj.Feb = result.FY_P_2.toLocaleString();
|
obj.Mar = result.FY_P_3.toLocaleString();
|
obj.annual = result.annual_1.toLocaleString();
|
obj.YTDTotal = result.YTDTotal1.toLocaleString();
|
}
|
if (obj.Hospital__rId == '7') {
|
obj.Apr = result.IMS_Shipments_4.toLocaleString();
|
obj.May = result.IMS_Shipments_5.toLocaleString();
|
obj.June = result.IMS_Shipments_6.toLocaleString();
|
obj.July = result.IMS_Shipments_7.toLocaleString();
|
obj.Aug = result.IMS_Shipments_8.toLocaleString();
|
obj.Sept = result.IMS_Shipments_9.toLocaleString();
|
obj.Oct = result.IMS_Shipments_10.toLocaleString();
|
obj.Nov = result.IMS_Shipments_11.toLocaleString();
|
obj.Dec = result.IMS_Shipments_12.toLocaleString();
|
obj.Jan = result.IMS_Shipments_1.toLocaleString();
|
obj.Feb = result.IMS_Shipments_2.toLocaleString();
|
obj.Mar = result.IMS_Shipments_3.toLocaleString();
|
obj.annual = result.annual_7.toLocaleString();
|
obj.YTDTotal = result.YTDTotal7.toLocaleString();
|
}
|
if (obj.Hospital__rId == '12') {
|
obj.Apr = result.FY_O_4.toLocaleString();
|
obj.May = result.FY_O_5.toLocaleString();
|
obj.June = result.FY_O_6.toLocaleString();
|
obj.July = result.FY_O_7.toLocaleString();
|
obj.Aug = result.FY_O_8.toLocaleString();
|
obj.Sept = result.FY_O_9.toLocaleString();
|
obj.Oct = result.FY_O_10.toLocaleString();
|
obj.Nov = result.FY_O_11.toLocaleString();
|
obj.Dec = result.FY_O_12.toLocaleString();
|
obj.Jan = result.FY_O_1.toLocaleString();
|
obj.Feb = result.FY_O_2.toLocaleString();
|
obj.Mar = result.FY_O_3.toLocaleString();
|
obj.annual = result.annual_2.toLocaleString();
|
obj.YTDTotal = result.YTDTotal2.toLocaleString();
|
}
|
if (obj.Hospital__rId == '13') {
|
obj.Apr = result.FY_S_4.toLocaleString();
|
obj.May = result.FY_S_5.toLocaleString();
|
obj.June = result.FY_S_6.toLocaleString();
|
obj.July = result.FY_S_7.toLocaleString();
|
obj.Aug = result.FY_S_8.toLocaleString();
|
obj.Sept = result.FY_S_9.toLocaleString();
|
obj.Oct = result.FY_S_10.toLocaleString();
|
obj.Nov = result.FY_S_11.toLocaleString();
|
obj.Dec = result.FY_S_12.toLocaleString();
|
obj.Jan = result.FY_S_1.toLocaleString();
|
obj.Feb = result.FY_S_2.toLocaleString();
|
obj.Mar = result.FY_S_3.toLocaleString();
|
obj.annual = result.annual_3.toLocaleString();
|
obj.YTDTotal = result.YTDTotal3.toLocaleString();
|
}
|
if (obj.Hospital__rId == '14') {
|
obj.Apr = result.TMS_Unpaid_amount_4.toLocaleString();
|
obj.May = result.TMS_Unpaid_amount_5.toLocaleString();
|
obj.June = result.TMS_Unpaid_amount_6.toLocaleString();
|
obj.July = result.TMS_Unpaid_amount_7.toLocaleString();
|
obj.Aug = result.TMS_Unpaid_amount_8.toLocaleString();
|
obj.Sept = result.TMS_Unpaid_amount_9.toLocaleString();
|
obj.Oct = result.TMS_Unpaid_amount_10.toLocaleString();
|
obj.Nov = result.TMS_Unpaid_amount_11.toLocaleString();
|
obj.Dec = result.TMS_Unpaid_amount_12.toLocaleString();
|
obj.Jan = result.TMS_Unpaid_amount_1.toLocaleString();
|
obj.Feb = result.TMS_Unpaid_amount_2.toLocaleString();
|
obj.Mar = result.TMS_Unpaid_amount_3.toLocaleString();
|
obj.annual = result.annual_14.toLocaleString();
|
obj.YTDTotal = result.YTDTotal14.toLocaleString();
|
}
|
if (obj.Hospital__rId == '4') {
|
obj.Apr = result.FY_BO_4.toLocaleString();
|
obj.May = result.FY_BO_5.toLocaleString();
|
obj.June = result.FY_BO_6.toLocaleString();
|
obj.July = result.FY_BO_7.toLocaleString();
|
obj.Aug = result.FY_BO_8.toLocaleString();
|
obj.Sept = result.FY_BO_9.toLocaleString();
|
obj.Oct = result.FY_BO_10.toLocaleString();
|
obj.Nov = result.FY_BO_11.toLocaleString();
|
obj.Dec = result.FY_BO_12.toLocaleString();
|
obj.Jan = result.FY_BO_1.toLocaleString();
|
obj.Feb = result.FY_BO_2.toLocaleString();
|
obj.Mar = result.FY_BO_3.toLocaleString();
|
obj.annual = result.annual_4.toLocaleString();
|
obj.YTDTotal = result.YTDTotal4.toLocaleString().toLocaleString();
|
}
|
if (obj.Hospital__rId == '5') {
|
obj.Apr = result.FY_I_4.toLocaleString();
|
obj.May = result.FY_I_5.toLocaleString();
|
obj.June = result.FY_I_6.toLocaleString();
|
obj.July = result.FY_I_7.toLocaleString();
|
obj.Aug = result.FY_I_8.toLocaleString();
|
obj.Sept = result.FY_I_9.toLocaleString();
|
obj.Oct = result.FY_I_10.toLocaleString();
|
obj.Nov = result.FY_I_11.toLocaleString();
|
obj.Dec = result.FY_I_12.toLocaleString();
|
obj.Jan = result.FY_I_1.toLocaleString();
|
obj.Feb = result.FY_I_2.toLocaleString();
|
obj.Mar = result.FY_I_3.toLocaleString();
|
obj.annual = result.annual_5.toLocaleString();
|
obj.YTDTotal = result.YTDTotal5.toLocaleString();
|
}
|
if (obj.Hospital__rId == '6') {
|
obj.Apr = result.FY_SP_4;
|
obj.May = result.FY_SP_5;
|
obj.June = result.FY_SP_6;
|
obj.July = result.FY_SP_7;
|
obj.Aug = result.FY_SP_8;
|
obj.Sept = result.FY_SP_9;
|
obj.Oct = result.FY_SP_10;
|
obj.Nov = result.FY_SP_11;
|
obj.Dec = result.FY_SP_12;
|
obj.Jan = result.FY_SP_1;
|
obj.Feb = result.FY_SP_2;
|
obj.Mar = result.FY_SP_3;
|
obj.annual = result.annual_6;
|
obj.YTDTotal = result.YTDTotal6;
|
}
|
if (obj.Hospital__rId == '9') {
|
obj.Apr = result.IMS_Prediction_4.toLocaleString();
|
obj.May = result.IMS_Prediction_5.toLocaleString();
|
obj.June = result.IMS_Prediction_6.toLocaleString();
|
obj.July = result.IMS_Prediction_7.toLocaleString();
|
obj.Aug = result.IMS_Prediction_8.toLocaleString();
|
obj.Sept = result.IMS_Prediction_9.toLocaleString();
|
obj.Oct = result.IMS_Prediction_10.toLocaleString();
|
obj.Nov = result.IMS_Prediction_11.toLocaleString();
|
obj.Dec = result.IMS_Prediction_12.toLocaleString();
|
obj.Jan = result.IMS_Prediction_1.toLocaleString();
|
obj.Feb = result.IMS_Prediction_2.toLocaleString();
|
obj.Mar = result.IMS_Prediction_3.toLocaleString();
|
obj.annual = result.annual_9.toLocaleString();
|
obj.YTDTotal = result.YTDTotal9.toLocaleString();
|
}
|
if (obj.Hospital__rId == '10') {
|
obj.Apr = result.TMS_Prediction_4.toLocaleString();
|
obj.May = result.TMS_Prediction_5.toLocaleString();
|
obj.June = result.TMS_Prediction_6.toLocaleString();
|
obj.July = result.TMS_Prediction_7.toLocaleString();
|
obj.Aug = result.TMS_Prediction_8.toLocaleString();
|
obj.Sept = result.TMS_Prediction_9.toLocaleString();
|
obj.Oct = result.TMS_Prediction_10.toLocaleString();
|
obj.Nov = result.TMS_Prediction_11.toLocaleString();
|
obj.Dec = result.TMS_Prediction_12.toLocaleString();
|
obj.Jan = result.TMS_Prediction_1.toLocaleString();
|
obj.Feb = result.TMS_Prediction_2.toLocaleString();
|
obj.Mar = result.TMS_Prediction_3.toLocaleString();
|
obj.annual = result.annual_10.toLocaleString();
|
obj.YTDTotal = result.YTDTotal10.toLocaleString();
|
}
|
if (obj.Hospital__rId == '1') {
|
obj.Apr = result.TMS_PredictionFulfillment_4.toLocaleString();
|
obj.May = result.TMS_PredictionFulfillment_5.toLocaleString();
|
obj.June = result.TMS_PredictionFulfillment_6.toLocaleString();
|
obj.July = result.TMS_PredictionFulfillment_7.toLocaleString();
|
obj.Aug = result.TMS_PredictionFulfillment_8.toLocaleString();
|
obj.Sept = result.TMS_PredictionFulfillment_9.toLocaleString();
|
obj.Oct = result.TMS_PredictionFulfillment_10.toLocaleString();
|
obj.Nov = result.TMS_PredictionFulfillment_11.toLocaleString();
|
obj.Dec = result.TMS_PredictionFulfillment_12.toLocaleString();
|
obj.Jan = result.TMS_PredictionFulfillment_1.toLocaleString();
|
obj.Feb = result.TMS_PredictionFulfillment_2.toLocaleString();
|
obj.Mar = result.TMS_PredictionFulfillment_3.toLocaleString();
|
obj.annual = result.annual_11.toLocaleString();
|
obj.YTDTotal = result.YTDTotal11.toLocaleString();
|
}
|
if (obj.Hospital__rId == '2') {
|
obj.Apr = result.StockAmount_4.toLocaleString();
|
obj.May = result.StockAmount_5.toLocaleString();
|
obj.June = result.StockAmount_6.toLocaleString();
|
obj.July = result.StockAmount_7.toLocaleString();
|
obj.Aug = result.StockAmount_8.toLocaleString();
|
obj.Sept = result.StockAmount_9.toLocaleString();
|
obj.Oct = result.StockAmount_10.toLocaleString();
|
obj.Nov = result.StockAmount_11.toLocaleString();
|
obj.Dec = result.StockAmount_12.toLocaleString();
|
obj.Jan = result.StockAmount_1.toLocaleString();
|
obj.Feb = result.StockAmount_2.toLocaleString();
|
obj.Mar = result.StockAmount_3.toLocaleString();
|
obj.annual = result.annual_22.toLocaleString();
|
obj.YTDTotal = result.YTDTotal22.toLocaleString();
|
}
|
if (obj.Hospital__rId == '8') {
|
obj.Apr = result.FY_TI_4.toLocaleString();
|
obj.May = result.FY_TI_5.toLocaleString();
|
obj.June = result.FY_TI_6.toLocaleString();
|
obj.July = result.FY_TI_7.toLocaleString();
|
obj.Aug = result.FY_TI_8.toLocaleString();
|
obj.Sept = result.FY_TI_9.toLocaleString();
|
obj.Oct = result.FY_TI_10.toLocaleString();
|
obj.Nov = result.FY_TI_11.toLocaleString();
|
obj.Dec = result.FY_TI_12.toLocaleString();
|
obj.Jan = result.FY_TI_1.toLocaleString();
|
obj.Feb = result.FY_TI_2.toLocaleString();
|
obj.Mar = result.FY_TI_3.toLocaleString();
|
obj.annual = result.annual_8.toLocaleString();
|
obj.YTDTotal = result.YTDTotal8.toLocaleString();
|
}
|
|
showSumRowMap2.set(element.Hospital__rId,obj);
|
});
|
var data3 = [];
|
const mapvalue2 =[...showSumRowMap2.values()];
|
mapvalue2.forEach(item=>{
|
data3 = data3.concat(item);
|
});
|
this.showData2 = data3;
|
this.searchProduct2();
|
}).catch(error => {
|
const evt = new ShowToastEvent({
|
title : error,
|
message: '',
|
variant: 'error',
|
mode: 'sticky'
|
});
|
this.dispatchEvent(evt);
|
return;
|
}).finally(() => {
|
});
|
|
}
|
searchProduct2(){
|
this.isLoading = true;
|
initData2({
|
SalesdepartmentValue:this.SalesdepartmentValue,
|
provinceValue:this.provinceValue,
|
City_MasterValue:this.City_MasterValue,
|
productTypeValue:this.productTypeValue,
|
customerTypeValue:this.customerTypeValue,
|
fiscalYearValue:this.fiscalYearValue,
|
Dealer_Name:this.DealerName
|
})
|
.then(result=>{
|
console.log('initData2 start');
|
this.totalNumberAll = result[0].totalNumberAll;
|
this.totalNumberAll2 = result[0].totalNumberAll2;
|
console.log('this.totalNumberAll='+result[0].totalNumberAll);
|
console.log('this.totalNumberAll2='+result[0].totalNumberAll2);
|
console.log('this.totalNumberAll='+this.totalNumberAll);
|
console.log('this.totalNumberAll2='+this.totalNumberAll2);
|
console.log('this.threemonthAug='+this.threemonthAug);
|
|
if (this.threemonthAug!=0 && this.threemonthAug !='') {
|
this.kucunMonth = (this.totalNumberAll/this.threemonthAug);
|
this.kucunMonth = new Intl.NumberFormat('en-US', { maximumFractionDigits: 0 }).format(this.kucunMonth);
|
this.kucunMonth2 = (this.totalNumberAll2/this.threemonthAug).toLocaleString();
|
}else{
|
this.kucunMonth = 0;
|
this.kucunMonth2 = 0;
|
}
|
|
result.sort((a, b) => (a.key > b.key) ? 1 : -1);
|
this.showData3 = result;
|
this.createTotalRow();
|
this.SummaryRowCount();
|
|
}).catch(error => {
|
const evt = new ShowToastEvent({
|
title : error,
|
message: '',
|
variant: 'error',
|
mode: 'sticky'
|
});
|
this.dispatchEvent(evt);
|
return;
|
this.isLoading = false;
|
}).finally(() => {
|
this.isLoading = false;
|
this.searchflgStart = false;
|
});
|
}
|
//生成汇总行临时数据
|
createTotalRow(){
|
var data = this.showData3;
|
var rowmap = new Map();
|
data.forEach(item=>{
|
if(rowmap.has(item.Category2)){
|
var dataList = rowmap.get(item.Category2);
|
item.flg=false;
|
item.Hideflg=false;
|
dataList.push(item);
|
rowmap.set(item.Category2,dataList);
|
}else{
|
var dataList = [];
|
var obj = {Category2:item.Category2,
|
totalNumber:item.totalNumber,
|
totalNumberLast:item.totalNumberLast,
|
Hideflg2:false,
|
flg:true
|
};
|
dataList.push(obj);
|
item.flg=false;
|
item.Hideflg=false;
|
dataList.push(item);
|
rowmap.set(item.Category2,dataList);
|
}
|
});
|
var data2 = [];
|
const mapvalue =[...rowmap.values()];
|
mapvalue.forEach(item=>{
|
data2 = data2.concat(item);
|
});
|
this.showData3 = data2;
|
}
|
|
|
SummaryRowCount(){
|
var data = this.showData3;
|
var showSumRowMap = new Map();
|
data.forEach(element => {
|
if(!element.flg){
|
if(showSumRowMap.has(element.Category2)){
|
var obj = showSumRowMap.get(element.Category2);
|
|
showSumRowMap.set(element.Category2,obj);
|
}else{
|
var obj = {...{},...element};
|
obj.Id = '';
|
obj.flg = true;
|
obj.Hideflg = false;
|
showSumRowMap.set(element.Category2,obj);
|
}
|
}
|
});
|
var dataNewList = [];
|
data.forEach(item=>{
|
if(item.flg){
|
var Hideflg2s = item.Hideflg2;
|
item = showSumRowMap.get(item.Category2);
|
item.Hideflg2 = Hideflg2s;
|
}
|
dataNewList.push(item);
|
});
|
this.showData3 = [].concat(dataNewList);
|
}
|
@track
|
fiscalYearValue = '';
|
get fiscalYearOpt() {
|
var today = new Date();
|
var year = today.getFullYear();
|
var month = today.getMonth()+1;
|
var i = 2023;
|
var j = month<4 ? year:year+1;
|
var l = j+1;
|
var fistList = [
|
{label:'FY'+String(i),value:'FY'+String(i)},
|
// {label:'FY'+String(j),value:'FY'+String(j)},
|
];
|
var lastList = [];
|
var k = j-i;
|
for (let index = 0; index < k; index++) {
|
lastList.unshift({label:'FY'+String(j),value:'FY'+String(j)});
|
j--;
|
}
|
lastList.push({label:'FY'+String(l),value:'FY'+String(l)})
|
return fistList.concat(lastList);
|
}
|
fiscalYearChange(event){
|
this.fiscalYearValue = event.detail.value;
|
}
|
@track
|
customerTypeValue = '';
|
// @track
|
// customerTypeOpt = [{label:'无',value:''},
|
// {label:'其他',value:'其他'},
|
// {label:'电圈套器',value:'电圈套器'},
|
// {label:'先端帽',value:'先端帽'},
|
// {label:'热活检钳',value:'热活检钳'},
|
// {label:'活检钳',value:'活检钳'},
|
// {label:'异物钳',value:'异物钳'},
|
// {label:'气囊',value:'气囊'},
|
// {label:'取石气囊',value:'取石气囊'},
|
// {label:'喷洒管',value:'喷洒管'},
|
// {label:'造影管',value:'造影管'},
|
// {label:'结扎装置',value:'结扎装置'},
|
// {label:'取石网篮',value:'取石网篮'},
|
// {label:'内引流',value:'内引流'},
|
// {label:'注射针(胃镜)-200',value:'注射针(胃镜)-200'},
|
// {label:'吸引活检针-EZ3P以外',value:'吸引活检针-EZ3P以外'},
|
// {label:'碎石器',value:'碎石器'},
|
// {label:'止血夹',value:'止血夹'},
|
// {label:'热探头',value:'热探头'},
|
// {label:'IT系粘膜切开刀',value:'IT系粘膜切开刀'},
|
// {label:'其他胆膵',value:'其他胆膵'},
|
// {label:'吸引活检针-Visishot2以外',value:'吸引活检针-Visishot2以外'},
|
// {label:'活检套装',value:'活检套装'},
|
// {label:'胆道金属支架',value:'胆道金属支架'},
|
// {label:'刮勺',value:'刮勺'},
|
// {label:'清洗刷',value:'清洗刷'},
|
// {label:'导丝-G-240',value:'导丝-G-240'},
|
// {label:'吸引活检针-EZ3P',value:'吸引活检针-EZ3P'},
|
// {label:'扩张气囊',value:'扩张气囊'},
|
// {label:'先端系粘膜切开刀-DualJ',value:'先端系粘膜切开刀-DualJ'},
|
// {label:'剪刀钳',value:'剪刀钳'},
|
// {label:'活瓣',value:'活瓣'},
|
// {label:'一次性使用抓取钳',value:'一次性使用抓取钳'},
|
// {label:'注射针(肠镜)-200',value:'注射针(肠镜)-200'},
|
// {label:'吸引活检针-Visishot2',value:'吸引活检针-Visishot2'},
|
// {label:'CF',value:'CF'},
|
// {label:'粘膜切开刀',value:'粘膜切开刀'},
|
// {label:'鼻胆引流管',value:'鼻胆引流管'},
|
// {label:'先端系粘膜切开刀-DualJ以外',value:'先端系粘膜切开刀-DualJ以外'},
|
// {label:'高频治疗钳',value:'高频治疗钳'},
|
// {label:'注射针(胃镜)-400',value:'注射针(胃镜)-400'},
|
// {label:'注射针(肠镜)-400',value:'注射针(肠镜)-400'},
|
// {label:'导丝-G-260',value:'导丝-G-260'},
|
// {label:'乳头切开刀-三腔',value:'乳头切开刀-三腔'},
|
// {label:'吸引活检针-EZ3P以外',value:'吸引活检针-EZ3P以外'},
|
// {label:'乳头切开刀-其他',value:'乳头切开刀-其他'},
|
// {label:'细胞刷',value:'细胞刷'}];
|
@track
|
customerTypeValue = ''; // 设置默认值
|
customerTypeChange(event){
|
this.customerTypeValue = event.detail.value;
|
}
|
SubmitApproval(){
|
|
}
|
saveList(){
|
if ((this.DealerName == null || this.DealerName == '') && !this.searchflgStart) {
|
const evt = new ShowToastEvent({
|
title : '请输入经销商',
|
message: '',
|
variant: 'error',
|
mode: 'sticky'
|
});
|
this.isLoading = false;
|
this.dispatchEvent(evt);
|
return;
|
}
|
this.IsLoading = true;
|
saveTms({
|
savedataList:this.savedataList,
|
Dealer_Name:this.DealerName,
|
fiscalYearValue:this.fiscalYearValue,
|
productTypeValue:this.productTypeValue,
|
provinceValue:this.provinceValue
|
|
}).then(result=>{
|
if(result === 'success'){
|
const evt = new ShowToastEvent({
|
title : '数据已保存',
|
message: '',
|
variant: 'success',
|
mode: 'sticky'
|
});
|
this.isLoading = false;
|
this.dispatchEvent(evt);
|
// setTimeout(() => {
|
// window.location.reload();
|
// }, 3000);
|
}else{
|
const evt = new ShowToastEvent({
|
title : result,
|
message: '',
|
variant: 'error',
|
mode: 'sticky'
|
});
|
this.isLoading = false;
|
this.dispatchEvent(evt);
|
return;
|
}
|
})
|
}
|
}
|