From 80e73d98a876af4b6c9efff7c74e908b056d8f4e Mon Sep 17 00:00:00 2001
From: chenlu <1320612696@qq.com>
Date: 星期三, 26 十一月 2025 11:28:39 +0800
Subject: [PATCH] 添加生产报表默认查询时间相关配置部分代码
---
north-glass-erp/northglass-erp/src/views/pp/report/TeamOutput.vue | 141 ++++++++++++++++++++++++++++++++--------------
1 files changed, 98 insertions(+), 43 deletions(-)
diff --git a/north-glass-erp/northglass-erp/src/views/pp/report/TeamOutput.vue b/north-glass-erp/northglass-erp/src/views/pp/report/TeamOutput.vue
index 3f8166d..59aa234 100644
--- a/north-glass-erp/northglass-erp/src/views/pp/report/TeamOutput.vue
+++ b/north-glass-erp/northglass-erp/src/views/pp/report/TeamOutput.vue
@@ -9,10 +9,12 @@
import footSum from "@/hook/footSum"
import {addListener, toolbarButtonClickEvent} from "@/hook/mouseMove"
import {VxeUI} from "vxe-pc-ui";
+import companyInfo from "@/stores/sd/companyInfo";
//璇█鑾峰彇
const {t} = useI18n()
let router = useRouter()
let filterData = ref({})
+const company = companyInfo()
//鎻愪氦鐨勮〃鍗�
const form = reactive({
date1: '',
@@ -65,6 +67,7 @@
return includeEnd ? diffDays + 1 : diffDays
}
+const times=company.reportTime
//鑾峰彇涓冨ぉ鍓嶅埌褰撳墠鏃堕棿
function getNowTime() {
const pad = (n) => n.toString().padStart(2, '0');
@@ -73,7 +76,7 @@
const year = date.getFullYear();
const month = pad(date.getMonth() + 1);
const day = pad(date.getDate());
- return `${year}-${month}-${day} 08:00:00`;
+ return `${year}-${month}-${day} ${times}`;
};
const now = new Date();
@@ -112,7 +115,7 @@
let year = date.getFullYear();
let month = pad(date.getMonth() + 1);
let day = pad(date.getDate());
-let newEndTime = `${year}-${month}-${day} 08:00:00`;
+let newEndTime = `${year}-${month}-${day} ${times}`;
//绗竴娆″姞杞芥暟鎹�
request.post(`/report/teamOutput/1/${total.pageSize}/${startTime}/${newEndTime}/${selectProcesses}`, filterData.value).then((res) => {
@@ -136,14 +139,28 @@
//椤佃剼缈婚〉鏌ヨ
const selectPageList = () => {
gridOptions.loading = true
+ // 瑙f瀽 company.reportTime
+ const [reportHourStr, reportMinuteStr] = company.reportTime.split(":");
+ const reportHour = parseInt(reportHourStr);
+ const reportMinute = parseInt(reportMinuteStr);
+
+ // 鍘熷 form.date1 鏄棩鏈熷璞℃暟缁�
const rawStart = new Date(form.date1[0]);
const rawEnd = new Date(form.date1[1]);
- // 濡傛灉鏃堕棿閮ㄥ垎鏄� 00:00锛屽垯璁剧疆涓� 08:00
- if (rawStart.getHours() === 8 || rawStart.getHours() === 0) {
- rawStart.setHours(8, 0, 0, 0);
+
+ // 鍒ゆ柇鏃堕棿閮ㄥ垎鏄惁闇�瑕佷慨姝d负 company.reportTime
+ const isZeroOrReport = (dateObj) => {
+ const h = dateObj.getHours();
+ const m = dateObj.getMinutes();
+ // 鍒ゆ柇鏉′欢锛氭槸 00:00 鎴栬�呮槸 reportTime 瀵瑰簲鐨勬椂闂�
+ return (h === 0 && m === 0) || (h === reportHour && m === reportMinute);
+ };
+
+ if (isZeroOrReport(rawStart)) {
+ rawStart.setHours(reportHour, reportMinute, 0, 0);
}
- if (rawEnd.getHours() === 8 || rawEnd.getHours() === 0) {
- rawEnd.setHours(8, 0, 0, 0);
+ if (isZeroOrReport(rawEnd)) {
+ rawEnd.setHours(reportHour, reportMinute, 0, 0);
}
const startTime = formatDateTime(rawStart);
const endPlusOne = new Date(rawEnd);
@@ -178,48 +195,71 @@
//鐐瑰嚮鏌ヨ
const getWorkOrder = () => {
- gridOptions.loading = true
+ gridOptions.loading = true;
+
+ // 瑙f瀽 company.reportTime
+ const [reportHourStr, reportMinuteStr] = company.reportTime.split(":");
+ const reportHour = parseInt(reportHourStr);
+ const reportMinute = parseInt(reportMinuteStr);
+
// 鍘熷 form.date1 鏄棩鏈熷璞℃暟缁�
const rawStart = new Date(form.date1[0]);
const rawEnd = new Date(form.date1[1]);
- // 濡傛灉鏃堕棿閮ㄥ垎鏄� 00:00锛屽垯璁剧疆涓� 08:00
- if (rawStart.getHours() === 8 || rawStart.getHours() === 0) {
- rawStart.setHours(8, 0, 0, 0);
+
+ // 鍒ゆ柇鏃堕棿閮ㄥ垎鏄惁闇�瑕佷慨姝d负 company.reportTime
+ const isZeroOrReport = (dateObj) => {
+ const h = dateObj.getHours();
+ const m = dateObj.getMinutes();
+ // 鍒ゆ柇鏉′欢锛氭槸 00:00 鎴栬�呮槸 reportTime 瀵瑰簲鐨勬椂闂�
+ return (h === 0 && m === 0) || (h === reportHour && m === reportMinute);
+ };
+
+ if (isZeroOrReport(rawStart)) {
+ rawStart.setHours(reportHour, reportMinute, 0, 0);
}
- if (rawEnd.getHours() === 8 || rawEnd.getHours() === 0) {
- rawEnd.setHours(8, 0, 0, 0);
+ if (isZeroOrReport(rawEnd)) {
+ rawEnd.setHours(reportHour, reportMinute, 0, 0);
}
+ // 鏍煎紡鍖�
const startTime = formatDateTime(rawStart);
+
const endPlusOne = new Date(rawEnd);
endPlusOne.setDate(endPlusOne.getDate());
const newEndTime = formatDateTime(endPlusOne);
- const selectProcesses = procseeValue.value;
- const timeDifference = getDaysBetween(startTime, newEndTime)
- if (timeDifference>180){
- ElMessage.warning(t('report.theTimeLimitCannotExceed180Days'))
- gridOptions.loading = false
- return
- }
- form.date1 = [startTime, newEndTime];
- request.post(`/report/teamOutput/${pageNum.value}/${total.pageSize}/${startTime}/${newEndTime}/${selectProcesses}`, filterData.value).then((res) => {
- if (res.code == 200) {
- total.value = res.data.footSum
- total.dataTotal = res.data.total.total * 1
- total.pageTotal = res.data.total.pageTotal
- pageTotal.value = res.data.total
- produceList = res.data.data
- produceList.forEach(item => {
- item.mmTotal = sumMmValues(item.workProcessName);
+ const selectProcesses = procseeValue.value;
+
+ const timeDifference = getDaysBetween(startTime, newEndTime);
+ if (timeDifference > 180) {
+ ElMessage.warning(t('report.theTimeLimitCannotExceed180Days'));
+ gridOptions.loading = false;
+ return;
+ }
+
+ form.date1 = [startTime, newEndTime];
+
+ request.post(`/report/teamOutput/${pageNum.value}/${total.pageSize}/${startTime}/${newEndTime}/${selectProcesses}`, filterData.value)
+ .then((res) => {
+ if (res.code == 200) {
+ total.value = res.data.footSum;
+ total.dataTotal = res.data.total.total * 1;
+ total.pageTotal = res.data.total.pageTotal;
+ pageTotal.value = res.data.total;
+
+ produceList = res.data.data;
+ produceList.forEach(item => {
+ item.mmTotal = sumMmValues(item.workProcessName);
+ });
+
+ xGrid.value.loadData(produceList);
+ gridOptions.loading = false;
+ } else {
+ ElMessage.warning(res.msg);
+ }
});
- xGrid.value.loadData(produceList)
- gridOptions.loading = false
- } else {
- ElMessage.warning(res.msg)
- }
- })
}
+
const sumMmValues = (workProcessName) => {
if (!workProcessName) return 0;
@@ -261,14 +301,28 @@
filterData.value[column.property] = value
}
+ // 瑙f瀽 company.reportTime
+ const [reportHourStr, reportMinuteStr] = company.reportTime.split(":");
+ const reportHour = parseInt(reportHourStr);
+ const reportMinute = parseInt(reportMinuteStr);
+
+ // 鍘熷 form.date1 鏄棩鏈熷璞℃暟缁�
const rawStart = new Date(form.date1[0]);
const rawEnd = new Date(form.date1[1]);
- // 濡傛灉鏃堕棿閮ㄥ垎鏄� 00:00锛屽垯璁剧疆涓� 08:00
- if (rawStart.getHours() === 8 || rawStart.getHours() === 0) {
- rawStart.setHours(8, 0, 0, 0);
+
+ // 鍒ゆ柇鏃堕棿閮ㄥ垎鏄惁闇�瑕佷慨姝d负 company.reportTime
+ const isZeroOrReport = (dateObj) => {
+ const h = dateObj.getHours();
+ const m = dateObj.getMinutes();
+ // 鍒ゆ柇鏉′欢锛氭槸 00:00 鎴栬�呮槸 reportTime 瀵瑰簲鐨勬椂闂�
+ return (h === 0 && m === 0) || (h === reportHour && m === reportMinute);
+ };
+
+ if (isZeroOrReport(rawStart)) {
+ rawStart.setHours(reportHour, reportMinute, 0, 0);
}
- if (rawEnd.getHours() === 8 || rawEnd.getHours() === 0) {
- rawEnd.setHours(8, 0, 0, 0);
+ if (isZeroOrReport(rawEnd)) {
+ rawEnd.setHours(reportHour, reportMinute, 0, 0);
}
const startTime = formatDateTime(rawStart);
const endPlusOne = new Date(rawEnd);
@@ -362,7 +416,8 @@
{field: 'code', width: 100, title: t('reportingWorks.glassNumber')},
{field: 'width', width: 90, title: t('order.width')},
{field: 'height', width: 90, title: t('order.height')},
- {field: 'mmTotal', width: 90, title: t('order.totalThickness')},
+ {field: 'thicknessSum',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, width: 90, title: t('order.totalThickness')},
+ {field: 'thicknessArea', width: 90, title: t('report.thicknessArea')},
{
field: 'deviceName', width: 140, title: t('machine.basicName'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }
},
@@ -397,7 +452,7 @@
if (columnIndex === 0) {
return t('basicData.total')
}
- const List = ["completedQuantity",'area',]
+ const List = ["completedQuantity",'area','thicknessArea']
if (List.includes(column.field)) {
//return footSum(data, column.field)
return total.value?.[column.field] ?? 0
--
Gitblit v1.8.0