This commit is contained in:
‘937886381’
2025-12-09 16:55:39 +08:00
parent a907c7273e
commit 2d200dd1a6
24 changed files with 201 additions and 210 deletions

View File

@@ -68,3 +68,11 @@ export function getOperateCockpit(data) {
});
}
export function getOrderDetail(data) {
return request({
url: "/lb/operate-cockpit/getOrderDetail",
method: "post",
data: data,
});
}

View File

@@ -155,9 +155,9 @@ export default {
methods: {
getData(obj) {
getProductSaleAnalysis({
startTime: 1762704000000,
endTime: 1762790400000,
mode: 1
startTime: obj.startTime,
endTime: obj.endTime,
mode: obj.mode,
}).then((res) => {
console.log(res);
this.productSaleData = [

View File

@@ -98,44 +98,40 @@ export default {
const mode = this.activeTime + 1; // 1=日2=月3=年
const defaultMoment = moment(); // 默认当前时间
// 处理选择的日期转为moment对象兼容不同选择器格式
console.log('this.date', this.date);
const targetMoment = this.date
? moment(this.date, this.getPickerType === 'date' ? 'YYYY-MM-DD' : (this.getPickerType === 'month' ? 'YYYY-MM' : 'YYYY'))
: defaultMoment;
// 验证日期有效性
if (!targetMoment.isValid()) {
console.error('无效日期:', this.date);
return { startTime, endTime, mode };
}
// 1. 日维度:当天0点 → 次日0点
// 1. 日维度:00:00:00 → 23:59:59无毫秒
if (this.activeTime === 0) {
startTime = targetMoment.startOf('day').valueOf(); // 当天00:00:00 时间戳
endTime = targetMoment.add(1, 'day').startOf('day').valueOf(); // 次日00:00:00 时间戳
startTime = targetMoment.startOf('day').millisecond(0).valueOf();
endTime = targetMoment.endOf('day').millisecond(0).valueOf();
}
// 2. 月维度当月1日0点 → 次月1日0点
// 2. 月维度当月1日00:00:00 → 当月最后一天23:59:59无毫秒
else if (this.activeTime === 1) {
startTime = targetMoment.startOf('month').valueOf(); // 当月1日00:00:00 时间戳
endTime = targetMoment.add(1, 'month').startOf('month').valueOf(); // 次月1日00:00:00 时间戳
startTime = targetMoment.startOf('month').millisecond(0).valueOf();
endTime = targetMoment.endOf('month').millisecond(0).valueOf();
}
// 3. 年维度当年1月1日0点 → 次年1月1日0点
// 3. 年维度当年1月1日00:00:00 → 当年最后一天23:59:59无毫秒
else if (this.activeTime === 2) {
startTime = targetMoment.startOf('year').valueOf(); // 当年1月1日00:00:00 时间戳
endTime = targetMoment.add(1, 'year').startOf('year').valueOf(); // 次年1月1日00:00:00 时间戳
startTime = targetMoment.startOf('year').millisecond(0).valueOf();
endTime = targetMoment.endOf('year').millisecond(0).valueOf();
}
// 调试输出(格式化显示,便于验证)
// 调试输出:验证是否去掉毫秒
console.log('时间范围计算结果:', {
mode,
startTime: moment(startTime).format('YYYY-MM-DD HH:mm:ss'),
endTime: moment(endTime).format('YYYY-MM-DD HH:mm:ss'),
startTimeStamp: startTime,
endTimeStamp: endTime
startTime: moment(startTime * 1000).format('YYYY-MM-DD HH:mm:ss'), // 格式2025-11-30 00:00:00
endTime: moment(endTime * 1000).format('YYYY-MM-DD HH:mm:ss'), // 格式2025-11-30 23:59:59无毫秒
startTimeStamp: startTime, // 秒级时间戳1764422400
endTimeStamp: endTime // 秒级时间戳1764508799
});
return { startTime, endTime, mode };

View File

@@ -103,44 +103,40 @@ export default {
const mode = this.activeTime + 1; // 1=日2=月3=年
const defaultMoment = moment(); // 默认当前时间
// 处理选择的日期转为moment对象兼容不同选择器格式
console.log('this.date', this.date);
const targetMoment = this.date
? moment(this.date, this.getPickerType === 'date' ? 'YYYY-MM-DD' : (this.getPickerType === 'month' ? 'YYYY-MM' : 'YYYY'))
: defaultMoment;
// 验证日期有效性
if (!targetMoment.isValid()) {
console.error('无效日期:', this.date);
return { startTime, endTime, mode };
}
// 1. 日维度:当天0点 → 次日0点
// 1. 日维度:00:00:00 → 23:59:59无毫秒
if (this.activeTime === 0) {
startTime = targetMoment.startOf('day').valueOf(); // 当天00:00:00 时间戳
endTime = targetMoment.add(1, 'day').startOf('day').valueOf(); // 次日00:00:00 时间戳
startTime = targetMoment.startOf('day').millisecond(0).valueOf();
endTime = targetMoment.endOf('day').millisecond(0).valueOf();
}
// 2. 月维度当月1日0点 → 次月1日0点
// 2. 月维度当月1日00:00:00 → 当月最后一天23:59:59无毫秒
else if (this.activeTime === 1) {
startTime = targetMoment.startOf('month').valueOf(); // 当月1日00:00:00 时间戳
endTime = targetMoment.add(1, 'month').startOf('month').valueOf(); // 次月1日00:00:00 时间戳
startTime = targetMoment.startOf('month').millisecond(0).valueOf();
endTime = targetMoment.endOf('month').millisecond(0).valueOf();
}
// 3. 年维度当年1月1日0点 → 次年1月1日0点
// 3. 年维度当年1月1日00:00:00 → 当年最后一天23:59:59无毫秒
else if (this.activeTime === 2) {
startTime = targetMoment.startOf('year').valueOf(); // 当年1月1日00:00:00 时间戳
endTime = targetMoment.add(1, 'year').startOf('year').valueOf(); // 次年1月1日00:00:00 时间戳
startTime = targetMoment.startOf('year').millisecond(0).valueOf();
endTime = targetMoment.endOf('year').millisecond(0).valueOf();
}
// 调试输出(格式化显示,便于验证)
// 调试输出:验证是否去掉毫秒
console.log('时间范围计算结果:', {
mode,
startTime: moment(startTime).format('YYYY-MM-DD HH:mm:ss'),
endTime: moment(endTime).format('YYYY-MM-DD HH:mm:ss'),
startTimeStamp: startTime,
endTimeStamp: endTime
startTime: moment(startTime * 1000).format('YYYY-MM-DD HH:mm:ss'), // 格式2025-11-30 00:00:00
endTime: moment(endTime * 1000).format('YYYY-MM-DD HH:mm:ss'), // 格式2025-11-30 23:59:59无毫秒
startTimeStamp: startTime, // 秒级时间戳1764422400
endTimeStamp: endTime // 秒级时间戳1764508799
});
return { startTime, endTime, mode };

View File

@@ -162,9 +162,9 @@ export default {
getData(obj) {
// obj.levelId = 1
getCostAnalysisList({
startTime: 1762704000000,
endTime: 1762790400000,
mode:1
startTime: obj.startTime,
endTime: obj.endTime,
mode: obj.mode,
}).then((res) => {
this.costOverviews = res.data.costOverviews
this.piecesCostViews = res.data.piecesCostViews

View File

@@ -111,44 +111,40 @@ export default {
const mode = this.activeTime + 1; // 1=日2=月3=年
const defaultMoment = moment(); // 默认当前时间
// 处理选择的日期转为moment对象兼容不同选择器格式
console.log('this.date', this.date);
const targetMoment = this.date
? moment(this.date, this.getPickerType === 'date' ? 'YYYY-MM-DD' : (this.getPickerType === 'month' ? 'YYYY-MM' : 'YYYY'))
: defaultMoment;
// 验证日期有效性
if (!targetMoment.isValid()) {
console.error('无效日期:', this.date);
return { startTime, endTime, mode };
}
// 1. 日维度:当天0点 → 次日0点
// 1. 日维度:00:00:00 → 23:59:59无毫秒
if (this.activeTime === 0) {
startTime = targetMoment.startOf('day').valueOf(); // 当天00:00:00 时间戳
endTime = targetMoment.add(1, 'day').startOf('day').valueOf(); // 次日00:00:00 时间戳
startTime = targetMoment.startOf('day').millisecond(0).valueOf();
endTime = targetMoment.endOf('day').millisecond(0).valueOf();
}
// 2. 月维度当月1日0点 → 次月1日0点
// 2. 月维度当月1日00:00:00 → 当月最后一天23:59:59无毫秒
else if (this.activeTime === 1) {
startTime = targetMoment.startOf('month').valueOf(); // 当月1日00:00:00 时间戳
endTime = targetMoment.add(1, 'month').startOf('month').valueOf(); // 次月1日00:00:00 时间戳
startTime = targetMoment.startOf('month').millisecond(0).valueOf();
endTime = targetMoment.endOf('month').millisecond(0).valueOf();
}
// 3. 年维度当年1月1日0点 → 次年1月1日0点
// 3. 年维度当年1月1日00:00:00 → 当年最后一天23:59:59无毫秒
else if (this.activeTime === 2) {
startTime = targetMoment.startOf('year').valueOf(); // 当年1月1日00:00:00 时间戳
endTime = targetMoment.add(1, 'year').startOf('year').valueOf(); // 次年1月1日00:00:00 时间戳
startTime = targetMoment.startOf('year').millisecond(0).valueOf();
endTime = targetMoment.endOf('year').millisecond(0).valueOf();
}
// 调试输出(格式化显示,便于验证)
// 调试输出:验证是否去掉毫秒
console.log('时间范围计算结果:', {
mode,
startTime: moment(startTime).format('YYYY-MM-DD HH:mm:ss'),
endTime: moment(endTime).format('YYYY-MM-DD HH:mm:ss'),
startTimeStamp: startTime,
endTimeStamp: endTime
startTime: moment(startTime * 1000).format('YYYY-MM-DD HH:mm:ss'), // 格式2025-11-30 00:00:00
endTime: moment(endTime * 1000).format('YYYY-MM-DD HH:mm:ss'), // 格式2025-11-30 23:59:59无毫秒
startTimeStamp: startTime, // 秒级时间戳1764422400
endTimeStamp: endTime // 秒级时间戳1764508799
});
return { startTime, endTime, mode };

View File

@@ -110,44 +110,40 @@ export default {
const mode = this.activeTime + 1; // 1=日2=月3=年
const defaultMoment = moment(); // 默认当前时间
// 处理选择的日期转为moment对象兼容不同选择器格式
console.log('this.date', this.date);
const targetMoment = this.date
? moment(this.date, this.getPickerType === 'date' ? 'YYYY-MM-DD' : (this.getPickerType === 'month' ? 'YYYY-MM' : 'YYYY'))
: defaultMoment;
// 验证日期有效性
if (!targetMoment.isValid()) {
console.error('无效日期:', this.date);
return { startTime, endTime, mode };
}
// 1. 日维度:当天0点 → 次日0点
// 1. 日维度:00:00:00 → 23:59:59无毫秒
if (this.activeTime === 0) {
startTime = targetMoment.startOf('day').valueOf(); // 当天00:00:00 时间戳
endTime = targetMoment.add(1, 'day').startOf('day').valueOf(); // 次日00:00:00 时间戳
startTime = targetMoment.startOf('day').millisecond(0).valueOf();
endTime = targetMoment.endOf('day').millisecond(0).valueOf();
}
// 2. 月维度当月1日0点 → 次月1日0点
// 2. 月维度当月1日00:00:00 → 当月最后一天23:59:59无毫秒
else if (this.activeTime === 1) {
startTime = targetMoment.startOf('month').valueOf(); // 当月1日00:00:00 时间戳
endTime = targetMoment.add(1, 'month').startOf('month').valueOf(); // 次月1日00:00:00 时间戳
startTime = targetMoment.startOf('month').millisecond(0).valueOf();
endTime = targetMoment.endOf('month').millisecond(0).valueOf();
}
// 3. 年维度当年1月1日0点 → 次年1月1日0点
// 3. 年维度当年1月1日00:00:00 → 当年最后一天23:59:59无毫秒
else if (this.activeTime === 2) {
startTime = targetMoment.startOf('year').valueOf(); // 当年1月1日00:00:00 时间戳
endTime = targetMoment.add(1, 'year').startOf('year').valueOf(); // 次年1月1日00:00:00 时间戳
startTime = targetMoment.startOf('year').millisecond(0).valueOf();
endTime = targetMoment.endOf('year').millisecond(0).valueOf();
}
// 调试输出(格式化显示,便于验证)
// 调试输出:验证是否去掉毫秒
console.log('时间范围计算结果:', {
mode,
startTime: moment(startTime).format('YYYY-MM-DD HH:mm:ss'),
endTime: moment(endTime).format('YYYY-MM-DD HH:mm:ss'),
startTimeStamp: startTime,
endTimeStamp: endTime
startTime: moment(startTime * 1000).format('YYYY-MM-DD HH:mm:ss'), // 格式2025-11-30 00:00:00
endTime: moment(endTime * 1000).format('YYYY-MM-DD HH:mm:ss'), // 格式2025-11-30 23:59:59无毫秒
startTimeStamp: startTime, // 秒级时间戳1764422400
endTimeStamp: endTime // 秒级时间戳1764508799
});
return { startTime, endTime, mode };

View File

@@ -169,9 +169,9 @@ export default {
// startTime: this.startTime,
// endTime: this.endTime,
// mode: this.mode,
startTime: 1762704000000,
endTime: 1762790400000,
mode: 1,
startTime: this.dateData.startTime,
endTime: this.dateData.endTime,
mode: this.dateData.mode,
trendName: "燃料成本",
levelId: this.levelId ? this.levelId :1
};

View File

@@ -170,9 +170,9 @@ export default {
// startTime: this.startTime,
// endTime: this.endTime,
// mode: this.mode,
startTime: 1762704000000,
endTime: 1762790400000,
mode: 1,
startTime: this.dateData.startTime,
endTime: this.dateData.endTime,
mode: this.dateData.mode,
trendName: "燃动力成本",
levelId: this.levelId ? this.levelId : 1
};

View File

@@ -22,7 +22,7 @@
grid-template-columns: 560px 745px 560px ;
">
<coreBottomLeft :purchase="purchase" :inventory="inventory" />
<orderProgress @getData="getOrderData" :baseOrder="baseOrder" :orderOutput="orderOutput" />
<orderProgress @getData="getOrderData" :baseOrder="orderTableData" :orderOutput="orderOutput" />
<keyWork :importantWork="importantWork" />
</div>
</div>
@@ -39,7 +39,7 @@ import coreBottomLeft from './components/coreBottomLeft.vue'
import orderProgress from './components/orderProgress.vue'
import keyWork from './components/keyWork.vue'
// import moment from 'moment'
import { getOperateCockpit } from '@/api/cockpit'
import { getOperateCockpit, getOrderDetail } from '@/api/cockpit'
export default {
name: 'DayReport',
components: { ReportHeader, coreSalesKPIs, keyProductionIndicators, coreBottomLeft, keyWork, orderProgress, financeCosts },
@@ -49,6 +49,7 @@ export default {
timer: null,
beilv: 1,
value: 100,
orderTableData:[],
productData: {},
purchase: {},
dateData:{},
@@ -107,13 +108,14 @@ export default {
}
},
methods: {
getOrderData(num) {
this.getData({
startTime: this.dateData.startTime,
endTime: this.dateData.endTime,
timeDim: this.dateData.mode,
async getOrderData(num) {
const res = await getOrderDetail({
// startTime: this.dateData.startTime,
// endTime: this.dateData.endTime,
// timeDim: this.dateData.mode,
baseId: num
})
this.orderTableData = res.data
},
getData(obj) {
console.log('obj', obj);

View File

@@ -143,7 +143,7 @@ export default {
getSalesRevenueData({
startTime: obj.startTime,
endTime: obj.endTime,
timeDim: 1
timeDim: obj.mode
}).then((res) => {
console.log(res);
this.saleData = res.data.SaleData

View File

@@ -170,9 +170,9 @@ export default {
// startTime: this.startTime,
// endTime: this.endTime,
// mode: this.mode,
startTime: 1762704000000,
endTime: 1762790400000,
mode: 1,
startTime: this.dateData.startTime,
endTime: this.dateData.endTime,
mode: this.dateData.mode,
trendName: "包装物辅材成本",
levelId: this.levelId ? this.levelId : 1
};

View File

@@ -170,9 +170,9 @@ export default {
// startTime: this.startTime,
// endTime: this.endTime,
// mode: this.mode,
startTime: 1762704000000,
endTime: 1762790400000,
mode: 1,
startTime: this.dateData.startTime,
endTime: this.dateData.endTime,
mode: this.dateData.mode,
trendName: "制造费用成本",
levelId: this.levelId ? this.levelId : 1
};

View File

@@ -158,9 +158,9 @@ export default {
methods: {
getData(obj) {
getProfitAnalysisData({
startTime: 1762704000000,
endTime: 1762790400000,
mode: 1
startTime: obj.startTime,
endTime: obj.endTime,
mode: obj.mode,
}).then((res) => {
this.profitTotalData = res.data.overviewProfitData.filter(item => {

View File

@@ -160,9 +160,9 @@ export default {
// startTime: this.startTime,
// endTime: this.endTime,
// mode: this.mode,
startTime: 1762704000290,
endTime: 1762790399290,
mode: 1,
startTime: this.dateData.startTime,
endTime: this.dateData.endTime,
mode: this.dateData.mode,
// analysisObject: this.analysisObject,
analysisObject: ["石灰石"],
levelId: this.levelId ? this.levelId : 1

View File

@@ -156,11 +156,11 @@ export default {
// this.dateData = obj
// console.log('obj', obj);
getCostAnalysisXXCostList({
startTime: "1762704000290",
endTime: "1762790399290",
mode: 1,
startTime: this.dateData.startTime,
endTime: this.dateData.endTime,
mode: this.dateData.mode,
trendName: "原料成本",
levelId: 2
levelId: this.levelId
}).then((res) => {
this.itemData = res.data[0].map((item) => {
return {

View File

@@ -185,9 +185,9 @@ export default {
// startTime: this.startTime,
// endTime: this.endTime,
// mode: this.mode,
startTime: 1762704000000,
endTime: 1762790400000,
mode: 1,
startTime: this.dateData.startTime,
endTime: this.dateData.endTime,
mode: this.dateData.mode,
analysisObject: this.analysisObject,
levelId: this.levelId ? this.levelId : 1
};

View File

@@ -186,9 +186,9 @@ export default {
// startTime: this.startTime,
// endTime: this.endTime,
// mode: this.mode,
startTime: 1762704000000,
endTime: 1762790400000,
mode: 1,
startTime: this.dateData.startTime,
endTime: this.dateData.endTime,
mode: this.dateData.mode,
analysisObject: this.analysisObject,
levelId: this.levelId ? this.levelId : 1
};

View File

@@ -180,9 +180,9 @@ export default {
// startTime: this.startTime,
// endTime: this.endTime,
// mode: this.mode,
startTime: 1762704000000,
endTime: 1762790400000,
mode: 1,
startTime: this.dateData.startTime,
endTime: this.dateData.endTime,
mode: this.dateData.mode,
analysisObject: this.analysisObject,
levelId: this.levelId ? this.levelId : 1
};

View File

@@ -186,9 +186,9 @@ export default {
// startTime: this.startTime,
// endTime: this.endTime,
// mode: this.mode,
startTime: 1762704000000,
endTime: 1762790400000,
mode: 1,
startTime: this.dateData.startTime,
endTime: this.dateData.endTime,
mode: this.dateData.mode,
analysisObject: this.analysisObject,
levelId: this.levelId ? this.levelId : 1
};