From 6a0907fce051418977f2d02ac408d890c28ee273 Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期二, 18 八月 2026 09:51:34 +0800
Subject: [PATCH] fix: 日期格式化
---
src/views/safeProduction/lineInspection/index.vue | 22 +++++++++++++++-------
1 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/src/views/safeProduction/lineInspection/index.vue b/src/views/safeProduction/lineInspection/index.vue
index e758125..3d1078b 100644
--- a/src/views/safeProduction/lineInspection/index.vue
+++ b/src/views/safeProduction/lineInspection/index.vue
@@ -343,10 +343,10 @@
{{ inspectionDetail.lineName || "--" }}
</el-descriptions-item>
<el-descriptions-item label="璁″垝宸℃鏃堕棿">
- {{ inspectionDetail.planTime || "--" }}
+ {{ formatDateOnly(inspectionDetail.planTime) }}
</el-descriptions-item>
<el-descriptions-item label="瀹為檯宸℃鏃堕棿">
- {{ inspectionDetail.actualInspectionTime || "--" }}
+ {{ formatDateOnly(inspectionDetail.actualInspectionTime) }}
</el-descriptions-item>
<el-descriptions-item label="宸℃缁撴灉">
<el-tag :type="getInspectionResultType(inspectionDetail.inspectionResult)" size="small">
@@ -476,7 +476,7 @@
{{ currentInspection.lineName || "--" }}
</el-descriptions-item>
<el-descriptions-item label="璁″垝鏃堕棿">
- {{ currentInspection.planTime || "--" }}
+ {{ formatDateOnly(currentInspection.planTime) }}
</el-descriptions-item>
<el-descriptions-item label="宸℃椤圭洰" :span="2">
{{ currentInspection.inspectionProject || "--" }}
@@ -1051,6 +1051,7 @@
import { computed, getCurrentInstance, onMounted, reactive, ref } from "vue";
import { Delete, Plus, Search } from "@element-plus/icons-vue";
import { ElMessage, ElMessageBox } from "element-plus";
+import dayjs from "dayjs";
import PIMTable from "@/components/PIMTable/PIMTable.vue";
import ImageUpload from "@/components/AttachmentUpload/image/index.vue";
import { userListNoPage } from "@/api/system/user.js";
@@ -1080,6 +1081,13 @@
const { hidden_danger_type } = proxy.useDict("hidden_danger_type");
const userStore = useUserStore();
const currentUserId = computed(() => Number(userStore.id));
+const formatDateOnly = value => {
+ if (!value) {
+ return "--";
+ }
+ const date = dayjs(value);
+ return date.isValid() ? date.format("YYYY-MM-DD") : "--";
+};
const activeTab = ref("task");
const tableLoading = ref(false);
@@ -1402,9 +1410,9 @@
{ label: "宸℃鍚嶇О", prop: "inspectionName", minWidth: 135, showOverflowTooltip: true, align: "left" },
{ label: "绾胯矾鍚嶇О", prop: "lineName", minWidth: 130, showOverflowTooltip: true, align: "left" },
{ label: "宸℃椤圭洰", prop: "inspectionProject", minWidth: 150, showOverflowTooltip: true, align: "left" },
- { label: "璁″垝宸℃鏃堕棿", prop: "planTime", width: 165, showOverflowTooltip: true, align: "center" },
+ { label: "璁″垝宸℃鏃堕棿", prop: "planTime", width: 165, showOverflowTooltip: true, align: "center", formatData: formatDateOnly },
{ label: "宸℃缁撴灉", prop: "inspectionResult", width: 90, dataType: "slot", slot: "inspectionResult", align: "center" },
- { label: "瀹為檯宸℃鏃堕棿", prop: "actualInspectionTime", width: 165, showOverflowTooltip: true, align: "center" },
+ { label: "瀹為檯宸℃鏃堕棿", prop: "actualInspectionTime", width: 165, showOverflowTooltip: true, align: "center", formatData: formatDateOnly },
{ label: "宸℃浜�", prop: "inspectorName", minWidth: 105, dataType: "slot", slot: "inspectorName", align: "center" },
{ label: "鐘舵��", prop: "status", width: 90, dataType: "slot", slot: "status", align: "center" }
];
@@ -1414,9 +1422,9 @@
{ label: "宸℃鍚嶇О", prop: "inspectionName", minWidth: 135, showOverflowTooltip: true, align: "left" },
{ label: "绾胯矾鍚嶇О", prop: "lineName", minWidth: 130, showOverflowTooltip: true, align: "left" },
{ label: "宸℃椤圭洰", prop: "inspectionProject", minWidth: 145, showOverflowTooltip: true, align: "left" },
- { label: "璁″垝宸℃鏃堕棿", prop: "planTime", width: 165, showOverflowTooltip: true, align: "center" },
+ { label: "璁″垝宸℃鏃堕棿", prop: "planTime", width: 165, showOverflowTooltip: true, align: "center", formatData: formatDateOnly },
{ label: "宸℃缁撴灉", prop: "inspectionResult", width: 90, dataType: "slot", slot: "inspectionResult", align: "center" },
- { label: "瀹為檯宸℃鏃堕棿", prop: "actualInspectionTime", width: 165, showOverflowTooltip: true, align: "center" },
+ { label: "瀹為檯宸℃鏃堕棿", prop: "actualInspectionTime", width: 165, showOverflowTooltip: true, align: "center", formatData: formatDateOnly },
{ label: "宸℃浜�", prop: "inspectorName", minWidth: 105, dataType: "slot", slot: "inspectorName", align: "center" },
{ label: "鐘舵��", prop: "status", width: 90, dataType: "slot", slot: "status", align: "center" },
{
--
Gitblit v1.9.3