From 57a496e7d0aa5630180e841f31d9c6b1215cc7a2 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期一, 02 十一月 2026 17:54:44 +0800
Subject: [PATCH] 列表插槽列的时间也只展示年月日

---
 src/main.js |   29 ++++++++++++++++++++++++++++-
 1 files changed, 28 insertions(+), 1 deletions(-)

diff --git a/src/main.js b/src/main.js
index d0282b7..9dccc9a 100644
--- a/src/main.js
+++ b/src/main.js
@@ -58,7 +58,7 @@
 import PageHeader from "@/components/PageHeader/index.vue";
 
 import { getToken } from "@/utils/auth";
-import { toDateOnly } from "@/utils/dateDisplay";
+import { toDateOnly, toDateOnlyVNode } from "@/utils/dateDisplay";
 import {
   calculateTaxExclusiveTotalPrice,
   summarizeTable,
@@ -133,4 +133,31 @@
   }
 }
 
+// 鍒楄〃鏃堕棿缁熶竴鍙睍绀哄勾鏈堟棩锛堟彃妲藉垪锛夛細<template #default> 閲岀殑鍐呭涓嶈蛋鍒� formatter锛�
+// 杩欓噷鎶� el-table-column 鐨勬墍鏈夋彃妲借緭鍑鸿繃涓�閬嶏紝绾枃鏈腑鐨勬棩鏈熸椂闂村彧淇濈暀骞存湀鏃ャ��
+const tableColumn = app._context.components.ElTableColumn;
+if (
+  tableColumn &&
+  typeof tableColumn.setup === "function" &&
+  !tableColumn.__dateOnlyPatched
+) {
+  const originalSetup = tableColumn.setup;
+  tableColumn.setup = function (props, ctx) {
+    try {
+      const slots = ctx.slots;
+      if (slots) {
+        Object.keys(slots).forEach((name) => {
+          const original = slots[name];
+          if (typeof original !== "function") return;
+          slots[name] = (scope) => toDateOnlyVNode(original(scope));
+        });
+      }
+    } catch (e) {
+      // 鎻掓Ы鍙鏃堕��鍥炲垪 formatter 鍏滃簳锛屼笉褰卞搷琛ㄦ牸娓叉煋
+    }
+    return originalSetup(props, ctx);
+  };
+  tableColumn.__dateOnlyPatched = true;
+}
+
 app.mount("#app");

--
Gitblit v1.9.3