From d8b5f4beee560f2ae0acaaf55931adcad18a0d4a Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期五, 21 八月 2026 11:15:56 +0800
Subject: [PATCH] feat(table): 统一表格日期字段展示格式为YYYY-MM-DD
---
src/views/officeProcessAutomation/ApproveManage/approve-template/approveTemplateConstants.js | 39 ++++++++-----------
src/views/financialManagement/payable/purchaseReturn.vue | 24 ------------
src/views/financialManagement/receivable/salesReturn.vue | 24 ------------
3 files changed, 17 insertions(+), 70 deletions(-)
diff --git a/src/views/financialManagement/payable/purchaseReturn.vue b/src/views/financialManagement/payable/purchaseReturn.vue
index 45ec41b..8d42a2e 100644
--- a/src/views/financialManagement/payable/purchaseReturn.vue
+++ b/src/views/financialManagement/payable/purchaseReturn.vue
@@ -85,30 +85,6 @@
{ label: "閫�璐у崟鍙�", prop: "returnNo", minWidth: "150" },
{ label: "渚涘簲鍟�", prop: "supplierName", minWidth: "180" },
{ label: "鍏宠仈鍏ュ簱鍗曞彿", prop: "inboundBatches", minWidth: "150" },
- {
- label: "鍙戣揣绫诲瀷",
- prop: "shippingType",
- minWidth: "110",
- formatData: (val) => ({ 1: "璐ц溅", 2: "蹇��" }[String(val)] || "--"),
- },
- {
- label: "鍙戣揣杞︾墝鍙�",
- prop: "truckPlateNo",
- minWidth: "140",
- formatData: (_val, row) => (String(row?.shippingType) === "1" ? row?.truckPlateNo || "--" : "--"),
- },
- {
- label: "蹇�掑叕鍙�",
- prop: "expressCompany",
- minWidth: "140",
- formatData: (_val, row) => (String(row?.shippingType) === "2" ? row?.expressCompany || "--" : "--"),
- },
- {
- label: "蹇�掑崟鍙�",
- prop: "expressNo",
- minWidth: "150",
- formatData: (_val, row) => (String(row?.shippingType) === "2" ? row?.expressNo || "--" : "--"),
- },
{ label: "閫�璐ф棩鏈�", prop: "preparedAt", minWidth: "170",dataType: "date"},
{
label: "閫�娆炬�婚",
diff --git a/src/views/financialManagement/receivable/salesReturn.vue b/src/views/financialManagement/receivable/salesReturn.vue
index f3c98c4..d6af451 100644
--- a/src/views/financialManagement/receivable/salesReturn.vue
+++ b/src/views/financialManagement/receivable/salesReturn.vue
@@ -77,30 +77,6 @@
{ label: "閫�璐у崟鍙�", prop: "returnNo", minWidth: "150" },
{ label: "瀹㈡埛鍚嶇О", prop: "customerName", minWidth: "180" },
{ label: "鍏宠仈鍙戣揣鍗曞彿", prop: "shippingNo", minWidth: "150" },
- {
- label: "鍙戣揣绫诲瀷",
- prop: "shippingType",
- minWidth: "110",
- formatData: (val) => ({ 1: "璐ц溅", 2: "蹇��" }[String(val)] || "--"),
- },
- {
- label: "鍙戣揣杞︾墝鍙�",
- prop: "truckPlateNo",
- minWidth: "140",
- formatData: (_val, row) => (String(row?.shippingType) === "1" ? row?.truckPlateNo || "--" : "--"),
- },
- {
- label: "蹇�掑叕鍙�",
- prop: "expressCompany",
- minWidth: "140",
- formatData: (_val, row) => (String(row?.shippingType) === "2" ? row?.expressCompany || "--" : "--"),
- },
- {
- label: "蹇�掑崟鍙�",
- prop: "expressNo",
- minWidth: "150",
- formatData: (_val, row) => (String(row?.shippingType) === "2" ? row?.expressNo || "--" : "--"),
- },
{ label: "閫�璐ф棩鏈�", prop: "makeTime", minWidth: "170",dataType: "date" },
{
label: "閫�娆炬�婚",
diff --git a/src/views/officeProcessAutomation/ApproveManage/approve-template/approveTemplateConstants.js b/src/views/officeProcessAutomation/ApproveManage/approve-template/approveTemplateConstants.js
index e92dc97..285309f 100644
--- a/src/views/officeProcessAutomation/ApproveManage/approve-template/approveTemplateConstants.js
+++ b/src/views/officeProcessAutomation/ApproveManage/approve-template/approveTemplateConstants.js
@@ -155,31 +155,26 @@
return { createdTime, updatedTime, createTime: createdTime, updateTime: updatedTime };
}
+function normalizeTimeValue(val) {
+ if (val == null || val === "") return "";
+ if (Array.isArray(val) && val.length >= 3) {
+ const [y, m, d, h = 0, min = 0, s = 0] = val;
+ // return dayjs(new Date(y, m - 1, d, h, min, s)).format("YYYY-MM-DD HH:mm:ss");
+ return dayjs(new Date(y, m - 1, d, h, min, s)).format("YYYY-MM-DD");
-/**
- * @param {any} val 鏃堕棿鍊�
- * @param {boolean} [onlyDate=true] true:鍙勾鏈堟棩锛宖alse:骞存湀鏃ユ椂鍒嗙
- */
-function normalizeTimeValue(val, onlyDate = true) {
- if (val == null || val === "") return "";
- const fmt = onlyDate ? "YYYY-MM-DD" : "YYYY-MM-DD HH:mm:ss";
-
- if (Array.isArray(val) && val.length >= 3) {
- const [y, m, d, h = 0, min = 0, s = 0] = val;
- return dayjs(new Date(y, m - 1, d, h, min, s)).format(fmt);
- }
- if (typeof val === "number") {
- const d = val > 1e12 ? dayjs(val) : dayjs.unix(val);
- return d.isValid() ? d.format(fmt) : "";
- }
- const s = String(val).trim();
- if (!s) return "";
- const parsed = dayjs(s.includes("T") ? s : s.replace(/-/g, "/"));
- return parsed.isValid() ? parsed.format(fmt) : s;
+ }
+ if (typeof val === "number") {
+ const d = val > 1e12 ? dayjs(val) : dayjs.unix(val);
+ return d.isValid() ? d.format("YYYY-MM-DD") : "";
+ }
+ const s = String(val).trim();
+ if (!s) return "";
+ const parsed = dayjs(s.includes("T") ? s : s.replace(/-/g, "/"));
+ return parsed.isValid() ? parsed.format("YYYY-MM-DD") : s;
}
-export function formatDisplayTime(val,onlyDate) {
- const t = normalizeTimeValue(val,onlyDate);
+export function formatDisplayTime(val) {
+ const t = normalizeTimeValue(val);
return t || "鈥�";
}
--
Gitblit v1.9.3