From df2328ea56438bf534ad2df79d7f761606cd9cce Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期五, 26 六月 2026 17:34:40 +0800
Subject: [PATCH] 已完成状态的生产订单,工艺路线不能修改,新增编辑按钮都不要展示
---
src/views/index.vue | 489 ++++++++++++++++++++++++++++++++++++++++--------------
1 files changed, 361 insertions(+), 128 deletions(-)
diff --git a/src/views/index.vue b/src/views/index.vue
index 49f8b05..4a03b41 100644
--- a/src/views/index.vue
+++ b/src/views/index.vue
@@ -113,39 +113,42 @@
<div class="panel-title-row">
<div class="panel-title">鐢熶骇璁㈠崟杩涘害</div>
<el-radio-group v-model="orderFilter" size="small">
- <el-radio-button label="all">鍏ㄩ儴</el-radio-button>
- <el-radio-button label="in_progress">杩涜涓�</el-radio-button>
- <el-radio-button label="completed">宸插畬鎴�</el-radio-button>
- <el-radio-button label="paused">宸叉殏鍋�</el-radio-button>
+ <el-radio-button :value="'all'">鍏ㄩ儴({{ orderProgressMeta.total }})</el-radio-button>
+ <el-radio-button :value="'waiting'">寰呭紑濮�({{ orderProgressMeta.waitingCount }})</el-radio-button>
+ <el-radio-button :value="'inProgress'">杩涜涓�({{ orderProgressMeta.inProgressCount }})</el-radio-button>
+ <el-radio-button :value="'completed'">宸插畬鎴�({{ orderProgressMeta.completedCount }})</el-radio-button>
+ <el-radio-button :value="'end'">宸茬粨鏉�({{ orderProgressMeta.endCount }})</el-radio-button>
</el-radio-group>
</div>
- <el-table :data="filteredOrders" stripe>
- <el-table-column prop="orderNo" label="璁㈠崟缂栧彿" min-width="150" />
- <el-table-column prop="productName" label="浜у搧鍚嶇О" min-width="120" />
- <el-table-column prop="planQty" label="璁″垝鏁伴噺" min-width="90" />
- <el-table-column prop="completedQty" label="宸插畬鎴�" min-width="90" />
- <el-table-column label="瀹屾垚鐜�" min-width="180">
- <template #default="{ row }">
- <div class="table-progress">
- <el-progress
- :stroke-width="8"
- :percentage="row.completionRate"
- :show-text="false"
- status="success"
- />
- <span>{{ row.completionRate }}%</span>
- </div>
- </template>
- </el-table-column>
- <el-table-column prop="deliveryDate" label="浜ゆ湡" min-width="110" />
- <el-table-column label="鐘舵��" min-width="90">
- <template #default="{ row }">
- <el-tag :type="getOrderStatusType(row.status)" effect="light">
- {{ getOrderStatusText(row.status) }}
- </el-tag>
- </template>
- </el-table-column>
- </el-table>
+ <div class="order-table-wrap">
+ <el-table :data="filteredOrders" stripe max-height="440">
+ <el-table-column prop="orderNo" label="璁㈠崟缂栧彿" min-width="150" />
+ <el-table-column prop="productName" label="浜у搧鍚嶇О" min-width="120" />
+ <el-table-column prop="planQty" label="璁″垝鏁伴噺" min-width="90" />
+ <el-table-column prop="completedQty" label="宸插畬鎴�" min-width="90" />
+ <el-table-column label="瀹屾垚鐜�" min-width="180">
+ <template #default="{ row }">
+ <div class="table-progress">
+ <el-progress
+ :stroke-width="8"
+ :percentage="row.completionRate"
+ :show-text="false"
+ status="success"
+ />
+ <span>{{ row.completionRate }}%</span>
+ </div>
+ </template>
+ </el-table-column>
+ <el-table-column prop="deliveryDate" label="浜ゆ湡" min-width="110" />
+ <el-table-column label="鐘舵��" min-width="90">
+ <template #default="{ row }">
+ <el-tag :type="getOrderStatusType(row.status)" effect="light">
+ {{ row.statusLabel || getOrderStatusText(row.status) }}
+ </el-tag>
+ </template>
+ </el-table-column>
+ </el-table>
+ </div>
</div>
<div v-if="visiblePanels.contract" class="cockpit-panel contract-panel">
@@ -213,7 +216,7 @@
<div v-if="visiblePanels.todo" class="cockpit-panel todo-panel">
<div class="panel-title-row">
<div class="panel-title">寰呭姙浜嬮」</div>
- <span class="panel-more">鏇村</span>
+ <span class="panel-more" @click="openTodoDialog">鏇村</span>
</div>
<ul class="todo-list" v-if="todoList.length > 0">
<li v-for="item in todoList" :key="item.id" class="todo-item">
@@ -231,7 +234,6 @@
<div v-if="visiblePanels.realtime" class="cockpit-panel realtime-panel">
<div class="panel-title-row">
<div class="panel-title">鐢熶骇瀹炴椂鐪嬫澘</div>
- <span class="panel-more">鏇村</span>
</div>
<div class="realtime-grid">
<div class="realtime-item" v-for="item in realtimeBoard" :key="item.key">
@@ -277,7 +279,7 @@
<div v-if="visiblePanels.plan" class="cockpit-panel plan-panel">
<div class="panel-title-row">
<div class="panel-title">浠婃棩鐢熶骇璁″垝</div>
- <span class="panel-more">{{ todayPlanList.length }}椤�</span>
+ <span class="panel-more">{{ todayPlanTotal }}椤�</span>
</div>
<ul class="plan-list">
<li v-for="item in todayPlanList" :key="item.orderNo" class="plan-item">
@@ -319,7 +321,7 @@
<div class="process-selection-wrapper">
<el-checkbox-group v-model="tempProcessIds">
<div class="process-grid">
- <el-checkbox v-for="item in processOptions" :key="item.id" :label="item.id" border>
+ <el-checkbox v-for="item in processOptions" :key="item.id" :value="item.id" border>
{{ item.name }}
</el-checkbox>
</div>
@@ -331,6 +333,18 @@
<el-button type="primary" @click="handleProcessDialogConfirm">纭</el-button>
</span>
</template>
+ </el-dialog>
+
+ <el-dialog v-model="todoDialogVisible" title="鍏ㄩ儴寰呭姙浜嬮」" width="900px" append-to-body destroy-on-close>
+ <div v-loading="todoDialogLoading" class="todo-dialog-body">
+ <el-table :data="todoDialogList" stripe max-height="520">
+ <el-table-column prop="approveId" label="寰呭姙缂栧彿" min-width="160" />
+ <el-table-column prop="approveDeptName" label="閮ㄩ棬/妯℃澘" min-width="160" />
+ <el-table-column prop="approveReason" label="浜嬬敱" min-width="240" show-overflow-tooltip />
+ <el-table-column prop="approveUserName" label="鍙戣捣浜�" min-width="120" />
+ <el-table-column prop="approveTime" label="鏃堕棿" min-width="170" />
+ </el-table>
+ </div>
</el-dialog>
</div>
</template>
@@ -363,8 +377,12 @@
getBusiness,
homeTodos,
processDataProductionStatistics,
+ productionOrderProgress,
+ productionOverview,
+ productionRealtimeBoard,
qualityInspectionStatistics,
statisticsReceivablePayable,
+ todayProductionPlan,
} from "@/api/viewIndex.js";
import { list } from "@/api/productionManagement/productionProcess";
@@ -436,6 +454,37 @@
processNum: 0,
factoryNum: 0,
});
+
+const productionOverviewData = ref({
+ totalOutput: 0,
+ totalScrap: 0,
+ yieldRate: 0,
+});
+
+const realtimeBoardData = ref({
+ deviceOee: { value: 0, compareYesterday: 0 },
+ orderAchievementRate: { value: 0, compareYesterday: 0 },
+ defectRate: { value: 0, compareYesterday: 0 },
+});
+
+const orderProgressMeta = ref({
+ status: "all",
+ tab: "all",
+ bizDate: null,
+ total: 0,
+ pageNum: 1,
+ pageSize: 10,
+ waitingCount: 0,
+ inProgressCount: 0,
+ completedCount: 0,
+ endCount: 0,
+});
+
+const todayPlanList = ref([]);
+const todayPlanTotal = ref(0);
+const todoDialogVisible = ref(false);
+const todoDialogLoading = ref(false);
+const todoDialogList = ref([]);
const sum = ref(0);
const yny = ref(0);
@@ -792,102 +841,96 @@
key: "production",
title: "鐢熶骇鎬昏",
desc: "绱浜у嚭(浠�)",
- value: formatNumber(processTotals.value.output),
+ value: formatNumber(productionOverviewData.value.totalOutput),
subLabel: "绱鎶ュ簾",
- subValue: formatNumber(processTotals.value.scrap),
- trend: `鑹巼 ${ratioText(processTotals.value.output, processTotals.value.input)}`,
+ subValue: formatNumber(productionOverviewData.value.totalScrap),
+ trend: `鑹巼 ${Number(productionOverviewData.value.yieldRate || 0).toFixed(2)}%`,
icon: Operation,
visible: visibleModules.value.production,
},
].filter((item) => item.visible));
-const productionOrders = ref([
- {
- orderNo: "MO-20260518-001",
- productName: "鏅鸿兘鎺у埗鍣�",
- planQty: 1000,
- completedQty: 860,
- completionRate: 86,
- deliveryDate: "2026-05-20",
- status: "in_progress",
- },
- {
- orderNo: "MO-20260518-002",
- productName: "鐢垫簮妯″潡",
- planQty: 800,
- completedQty: 640,
- completionRate: 80,
- deliveryDate: "2026-05-22",
- status: "in_progress",
- },
- {
- orderNo: "MO-20260518-003",
- productName: "浼犳劅鍣ㄧ粍浠�",
- planQty: 500,
- completedQty: 150,
- completionRate: 30,
- deliveryDate: "2026-05-25",
- status: "paused",
- },
- {
- orderNo: "MO-20260518-004",
- productName: "缁撴瀯浠禔",
- planQty: 1200,
- completedQty: 1200,
- completionRate: 100,
- deliveryDate: "2026-05-15",
- status: "completed",
- },
-]);
+const productionOrders = ref([]);
+const orderFilterOptions = ["all", "waiting", "inProgress", "completed", "end"];
+const orderFilterAliasMap = {
+ 1: "waiting",
+ 2: "inProgress",
+ 3: "completed",
+ 5: "end",
+};
const orderFilter = ref("all");
-const filteredOrders = computed(() => {
- if (orderFilter.value === "all") return productionOrders.value;
- return productionOrders.value.filter((item) => item.status === orderFilter.value);
-});
+const filteredOrders = computed(() => productionOrders.value);
-const todayPlanList = computed(() =>
- productionOrders.value
- .slice()
- .sort((a, b) => dayjs(a.deliveryDate).valueOf() - dayjs(b.deliveryDate).valueOf())
- .slice(0, 5)
-);
+const normalizeOrderFilter = (value, fallback = "all") => {
+ const safeFallback = orderFilterOptions.includes(fallback) ? fallback : "all";
+ const text = String(value ?? "").trim();
+ if (orderFilterAliasMap[text]) {
+ return orderFilterAliasMap[text];
+ }
+ return orderFilterOptions.includes(text) ? text : safeFallback;
+};
-const avgCompletionRate = computed(() => {
- if (!productionOrders.value.length) return 0;
- const total = productionOrders.value.reduce((acc, cur) => acc + Number(cur.completionRate || 0), 0);
- return Number((total / productionOrders.value.length).toFixed(1));
-});
+const parseCount = (value) => {
+ if (value === null || value === undefined || value === "") return null;
+ const num = Number(value);
+ return Number.isFinite(num) ? num : null;
+};
+
+const resolveProgressCount = (rawValue, currentStatus, targetStatus, total) => {
+ const count = parseCount(rawValue);
+ if (count !== null) return count;
+ return currentStatus === targetStatus ? total : 0;
+};
+
+const getCompareTrend = (value) => {
+ const num = Number(value || 0);
+ if (num > 0) return "up";
+ if (num < 0) return "down";
+ return "flat";
+};
+
+const getCompareText = (value) => {
+ const num = Number(value || 0);
+ const abs = Math.abs(num).toFixed(2);
+ if (num > 0) return `杈冩槰鏃� 鈫� ${abs}%`;
+ if (num < 0) return `杈冩槰鏃� 鈫� ${abs}%`;
+ return "杈冩槰鏃� 鎸佸钩";
+};
const realtimeBoard = computed(() => {
- const oee = ratioNumber(processTotals.value.output, processTotals.value.input);
- const defectRate = ratioNumber(processTotals.value.scrap, processTotals.value.input);
+ const oee = Number(realtimeBoardData.value.deviceOee?.value || 0);
+ const orderAchievement = Number(realtimeBoardData.value.orderAchievementRate?.value || 0);
+ const defectRate = Number(realtimeBoardData.value.defectRate?.value || 0);
+ const oeeCompare = Number(realtimeBoardData.value.deviceOee?.compareYesterday || 0);
+ const orderCompare = Number(realtimeBoardData.value.orderAchievementRate?.compareYesterday || 0);
+ const defectCompare = Number(realtimeBoardData.value.defectRate?.compareYesterday || 0);
return [
{
key: "oee",
label: "璁惧 OEE",
percent: clampPercent(oee),
- display: `${oee.toFixed(1)}%`,
- delta: "杈冩槰鏃� 鈫� 4.0%",
- trend: "up",
+ display: `${oee.toFixed(2)}%`,
+ delta: getCompareText(oeeCompare),
+ trend: getCompareTrend(oeeCompare),
color: "#2d8cff",
},
{
key: "order",
label: "璁㈠崟杈炬垚鐜�",
- percent: clampPercent(avgCompletionRate.value),
- display: `${avgCompletionRate.value.toFixed(1)}%`,
- delta: "杈冩槰鏃� 鈫� 2.6%",
- trend: "up",
+ percent: clampPercent(orderAchievement),
+ display: `${orderAchievement.toFixed(2)}%`,
+ delta: getCompareText(orderCompare),
+ trend: getCompareTrend(orderCompare),
color: "#31d2ff",
},
{
key: "defect",
label: "涓嶈壇鐜�",
percent: clampPercent(defectRate),
- display: `${defectRate.toFixed(1)}%`,
- delta: "杈冩槰鏃� 鈫� 0.5%",
- trend: "down",
+ display: `${defectRate.toFixed(2)}%`,
+ delta: getCompareText(defectCompare),
+ trend: getCompareTrend(defectCompare),
color: "#f6a23f",
},
];
@@ -1111,20 +1154,149 @@
const getOrderStatusText = (status) => {
const mapping = {
- in_progress: "杩涜涓�",
- completed: "宸插畬鎴�",
- paused: "鏆傚仠",
+ 1: "寰呭紑濮�",
+ 2: "杩涜涓�",
+ 3: "宸插畬鎴�",
+ 5: "宸茬粨鏉�",
};
return mapping[status] || "鏈煡";
};
const getOrderStatusType = (status) => {
const mapping = {
- in_progress: "success",
- completed: "primary",
- paused: "warning",
+ 1: "info",
+ 2: "success",
+ 3: "primary",
+ 4: "warning",
};
return mapping[status] || "info";
+};
+
+const formatDueDate = (value) => {
+ if (!value) return "--";
+ const date = dayjs(value);
+ return date.isValid() ? date.format("YYYY-MM-DD") : "--";
+};
+
+const mapOrderProgressRecord = (item = {}) => ({
+ orderNo: item.orderNo || "--",
+ productName: item.productName || "--",
+ planQty: Number(item.plannedQuantity || 0),
+ completedQty: Number(item.completedQuantity || 0),
+ completionRate: clampPercent(Number(item.completionRate || 0)),
+ deliveryDate: formatDueDate(item.dueDate),
+ status: Number(item.status || 0),
+ statusLabel: item.statusLabel || "",
+});
+
+const mapTodayPlanRecord = (item = {}) => ({
+ orderNo: item.orderNo || "--",
+ productName: item.productName || "--",
+ planQty: Number(item.plannedQuantity || 0),
+ deliveryDate: formatDueDate(item.dueDate),
+ status: Number(item.status || 0),
+ statusLabel: item.statusLabel || "",
+});
+
+const refreshProductionOverview = async () => {
+ try {
+ const res = await productionOverview();
+ const data = res?.data || {};
+ productionOverviewData.value = {
+ totalOutput: Number(data.totalOutput || 0),
+ totalScrap: Number(data.totalScrap || 0),
+ yieldRate: Number(data.yieldRate || 0),
+ };
+ } catch {
+ productionOverviewData.value = {
+ totalOutput: 0,
+ totalScrap: 0,
+ yieldRate: 0,
+ };
+ }
+};
+
+const refreshProductionRealtimeBoard = async () => {
+ try {
+ const res = await productionRealtimeBoard();
+ const data = res?.data || {};
+ realtimeBoardData.value = {
+ deviceOee: {
+ value: Number(data.deviceOee?.value || 0),
+ compareYesterday: Number(data.deviceOee?.compareYesterday || 0),
+ },
+ orderAchievementRate: {
+ value: Number(data.orderAchievementRate?.value || 0),
+ compareYesterday: Number(data.orderAchievementRate?.compareYesterday || 0),
+ },
+ defectRate: {
+ value: Number(data.defectRate?.value || 0),
+ compareYesterday: Number(data.defectRate?.compareYesterday || 0),
+ },
+ };
+ } catch {
+ realtimeBoardData.value = {
+ deviceOee: { value: 0, compareYesterday: 0 },
+ orderAchievementRate: { value: 0, compareYesterday: 0 },
+ defectRate: { value: 0, compareYesterday: 0 },
+ };
+ }
+};
+
+const refreshProductionOrderProgress = async () => {
+ try {
+ const res = await productionOrderProgress({
+ status: orderFilter.value,
+ tab: orderFilter.value,
+ pageNum: -1,
+ pageSize: -1,
+ });
+ const data = res?.data || {};
+ const statusValue = normalizeOrderFilter(data.status, orderFilter.value);
+ const total = Number(data.total || 0);
+ orderProgressMeta.value = {
+ status: statusValue,
+ tab: data.tab || orderFilter.value,
+ bizDate: data.bizDate || null,
+ total,
+ pageNum: Number(data.pageNum || 1),
+ pageSize: Number(data.pageSize || 10),
+ waitingCount: resolveProgressCount(data.waitingCount, statusValue, "waiting", total),
+ inProgressCount: resolveProgressCount(data.inProgressCount, statusValue, "inProgress", total),
+ completedCount: resolveProgressCount(data.completedCount, statusValue, "completed", total),
+ endCount: resolveProgressCount(data.endCount, statusValue, "end", total),
+ };
+ productionOrders.value = (data.records || []).map(mapOrderProgressRecord);
+ } catch {
+ orderProgressMeta.value = {
+ status: orderFilter.value,
+ tab: orderFilter.value,
+ bizDate: null,
+ total: 0,
+ pageNum: 1,
+ pageSize: 10,
+ waitingCount: 0,
+ inProgressCount: 0,
+ completedCount: 0,
+ endCount: 0,
+ };
+ productionOrders.value = [];
+ }
+};
+
+const refreshTodayProductionPlan = async () => {
+ try {
+ const res = await todayProductionPlan({
+ limit: 1000,
+ planDate: nowDate.value,
+ });
+ const data = res?.data || {};
+ todayPlanTotal.value = Number(data.total || 0);
+ todayPlanList.value = (data.records || []).map(mapTodayPlanRecord);
+ } catch {
+ todayPlanTotal.value = 0;
+ todayPlanList.value = [];
+ }
};
const getBusinessData = async () => {
@@ -1149,11 +1321,27 @@
todoList.value = res.data || [];
};
+const openTodoDialog = async () => {
+ todoDialogVisible.value = true;
+ todoDialogLoading.value = true;
+ try {
+ const res = await homeTodos();
+ todoDialogList.value = res.data || [];
+ } catch {
+ todoDialogList.value = [];
+ } finally {
+ todoDialogLoading.value = false;
+ }
+};
+
const statisticsReceivable = async () => {
const res = await statisticsReceivablePayable({ type: 1 });
+ const data = res?.data || {};
+ const payableMoney = Number(data.payableMoney ?? 0);
+ const receivableMoney = Number(data.receivableMoney ?? 0);
barSeries.value[0].data = [
- { value: res.data.payableMoney, itemStyle: { color: barColors2[0] } },
- { value: res.data.receivableMoney, itemStyle: { color: barColors2[1] } },
+ { value: payableMoney, itemStyle: { color: barColors2[0] } },
+ { value: receivableMoney, itemStyle: { color: barColors2[1] } },
];
};
@@ -1163,15 +1351,16 @@
barSeries1.value[0].data = [];
barSeries1.value[1].data = [];
barSeries1.value[2].data = [];
- (res.data.item || []).forEach((item) => {
+ const data = res.data || {};
+ (data.item || []).forEach((item) => {
xAxis1.value[0].data.push(item.date);
barSeries1.value[0].data.push(item.supplierNum);
barSeries1.value[1].data.push(item.processNum);
barSeries1.value[2].data.push(item.factoryNum);
});
- qualityStatisticsObject.value.supplierNum = res.data.supplierNum;
- qualityStatisticsObject.value.processNum = res.data.processNum;
- qualityStatisticsObject.value.factoryNum = res.data.factoryNum;
+ qualityStatisticsObject.value.supplierNum = data.supplierNum || 0;
+ qualityStatisticsObject.value.processNum = data.processNum || 0;
+ qualityStatisticsObject.value.factoryNum = data.factoryNum || 0;
};
const getAmountHalfYearNum = async () => {
@@ -1238,11 +1427,20 @@
router.push(path).catch(() => {});
};
+watch(orderFilter, () => {
+ if (visiblePanels.value.order) {
+ refreshProductionOrderProgress();
+ }
+});
+
onMounted(() => {
updateNowTime();
clockTimer = setInterval(updateNowTime, 1000);
if (dashboardCards.value.length > 0) {
getBusinessData();
+ }
+ if (visibleModules.value.production) {
+ refreshProductionOverview();
}
if (visiblePanels.value.contract) {
analysisCustomer();
@@ -1260,6 +1458,15 @@
if (visiblePanels.value.process) {
getProcessList();
refreshProcessStats();
+ }
+ if (visiblePanels.value.order) {
+ refreshProductionOrderProgress();
+ }
+ if (visiblePanels.value.realtime) {
+ refreshProductionRealtimeBoard();
+ }
+ if (visiblePanels.value.plan) {
+ refreshTodayProductionPlan();
}
});
@@ -1561,6 +1768,34 @@
font-size: 14px;
color: #2563eb;
cursor: pointer;
+}
+
+.todo-dialog-body {
+ min-height: 220px;
+}
+
+.plan-panel {
+ overflow: hidden;
+}
+
+.plan-list {
+ margin: 10px 0 0;
+ padding: 0 4px 0 0;
+ list-style: none;
+ display: flex;
+ flex-direction: column;
+ gap: 8px;
+ max-height: 300px;
+ overflow-y: auto;
+}
+
+.plan-list::-webkit-scrollbar {
+ width: 6px;
+}
+
+.plan-list::-webkit-scrollbar-thumb {
+ border-radius: 999px;
+ background: rgba(37, 99, 235, 0.28);
}
.todo-list {
@@ -1953,6 +2188,10 @@
color: #f59e0b;
}
+.realtime-delta.flat {
+ color: #64748b;
+}
+
.warning-list {
margin-top: 10px;
display: flex;
@@ -2012,6 +2251,13 @@
.order-panel {
min-height: 0;
+ display: flex;
+ flex-direction: column;
+}
+
+.order-table-wrap {
+ flex: 1;
+ min-height: 0;
}
.quick-panel {
@@ -2051,25 +2297,12 @@
transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
-.plan-panel {
- min-height: 236px;
-}
-
.quality-panel {
min-height: 0;
}
.receipt-panel {
min-height: 340px;
-}
-
-.plan-list {
- margin: 10px 0 0;
- padding: 0;
- list-style: none;
- display: flex;
- flex-direction: column;
- gap: 8px;
}
.plan-item {
--
Gitblit v1.9.3