gaoluyang
2026-10-26 baf77b7ac6be90c1dfc8d9536ae194f350f7cc7c
列表时间统一只展示年月日,库存最近更新时间用创建时间兜底

- 新增 toDateOnly 工具,el-table 原生列通过全局 formatter 兜底
- parseTime/formatDate 默认改为年月日,PIMTable 显式转换
- 库存管理各列表:update_time 为空时显示 create_time

Co-Authored-By: Claude Code <noreply@anthropic.com>
已添加1个文件
已修改24个文件
165 ■■■■■ 文件已修改
src/components/PIMTable/PIMTable.vue 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main.js 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/dateDisplay.js 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/index.js 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/ruoyi.js 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/collaborativeApproval/notificationManagement/meetDraft/index.vue 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/collaborativeApproval/notificationManagement/meetExamine/index.vue 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/collaborativeApproval/notificationManagement/meetPublish/index.vue 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/collaborativeApproval/notificationManagement/summary/index.vue 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/equipmentManagement/inspectionManagement/index.vue 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/equipmentManagement/upkeep/index.vue 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/financialManagement/payable/purchaseIn.vue 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/index.vue 4 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/inventoryManagement/stockManagement/BatchNoQtyDetail.vue 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/inventoryManagement/stockManagement/Qualified.vue 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/inventoryManagement/stockManagement/Record.vue 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/inventoryManagement/stockManagement/Unqualified.vue 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/officeProcessAutomation/ApproveManage/approve-template/approveTemplateConstants.js 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/procurementManagement/thePaymentLedger/index.vue 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/productionPlan/productionPlan/components/PIMTable.vue 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/qualityManagement/afterSalesTraceability/index.vue 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/reportAnalysis/dataDashboard/components/basic/center-top.vue 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/salesManagement/salesLedger/index.vue 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/salesManagement/strategyControl/index.vue 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/system/appVersion/index.vue 4 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/PIMTable/PIMTable.vue
@@ -178,15 +178,19 @@
             class="cell link"
             style="width: 100%"
             @click="goLink(scope.row, item.linkMethod)">
          <span v-if="!item.formatData">{{ scope.row[item.prop] }}</span>
          <span v-if="!item.formatData">{{
            toDateOnly(scope.row[item.prop])
          }}</span>
        </div>
        <!-- é»˜è®¤çº¯å±•示数据 -->
        <div v-else
             class="cell"
             style="width: 100%">
          <span v-if="!item.formatData">{{ scope.row[item.prop] }}</span>
          <span v-if="!item.formatData">{{
            toDateOnly(scope.row[item.prop])
          }}</span>
          <span v-else>{{
            formatters(scope.row[item.prop], item.formatData)
            toDateOnly(formatters(scope.row[item.prop], item.formatData))
          }}</span>
        </div>
      </template>
@@ -204,6 +208,7 @@
  import pagination from "./Pagination.vue";
  import { computed, ref, inject, getCurrentInstance } from "vue";
  import { ElMessage } from "element-plus";
  import { toDateOnly } from "@/utils/dateDisplay";
  // èŽ·å–å…¨å±€çš„ uploadHeader
  const { proxy } = getCurrentInstance();
src/main.js
@@ -58,6 +58,7 @@
import PageHeader from "@/components/PageHeader/index.vue";
import { getToken } from "@/utils/auth";
import { toDateOnly } from "@/utils/dateDisplay";
import {
  calculateTaxExclusiveTotalPrice,
  summarizeTable,
@@ -80,6 +81,7 @@
app.config.globalProperties.addDateRange = addDateRange;
app.config.globalProperties.selectDictLabel = selectDictLabel;
app.config.globalProperties.selectDictLabels = selectDictLabels;
app.config.globalProperties.formatDateOnly = toDateOnly;
app.config.globalProperties.javaApi = __BASE_API__;
app.config.globalProperties.HaveJson = (val) => {
  return JSON.parse(JSON.stringify(val));
@@ -116,4 +118,19 @@
});
app._context.components.ElDialog.props.closeOnClickModal.default = false;
// åˆ—表时间统一只展示年月日:未单独配置 formatter çš„表格列走这里
const tableColumnFormatter =
  app._context.components.ElTableColumn?.props?.formatter;
if (tableColumnFormatter) {
  const formatCell = (row, column, cellValue) => toDateOnly(cellValue);
  if (typeof tableColumnFormatter === "function") {
    app._context.components.ElTableColumn.props.formatter = {
      type: Function,
      default: formatCell,
    };
  } else {
    tableColumnFormatter.default = formatCell;
  }
}
app.mount("#app");
src/utils/dateDisplay.js
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,32 @@
/**
 * åˆ—表展示用的日期处理:带时分秒的日期时间只保留年月日,
 * æœ¬æ¥å°±æ˜¯æ—¥æœŸã€æ—¶é—´æˆ–其它内容的值原样返回。
 */
const DATE_TIME_PATTERN =
  /^(\d{4})[-/å¹´](\d{1,2})[-/月](\d{1,2})日?[ T]\d{1,2}:\d{2}(?::\d{2})?(?:\.\d+)?(?:Z|[+-]\d{2}:?\d{2})?$/;
function pad2(value) {
  return String(value).padStart(2, "0");
}
export function toDateOnly(value) {
  if (value == null || value === "") return value;
  if (value instanceof Date) {
    if (Number.isNaN(value.getTime())) return value;
    return `${value.getFullYear()}-${pad2(value.getMonth() + 1)}-${pad2(
      value.getDate()
    )}`;
  }
  if (typeof value !== "string") {
    // å¯¹è±¡/数组按表格原有方式转成文本,避免把非字符串直接交给渲染层
    return typeof value === "object" ? String(value) : value;
  }
  const text = value.trim();
  const matched = text.match(DATE_TIME_PATTERN);
  if (!matched) return value;
  return `${matched[1]}-${pad2(matched[2])}-${pad2(matched[3])}`;
}
src/utils/index.js
@@ -12,14 +12,7 @@
      ? "0" + (date.getMonth() + 1)
      : date.getMonth() + 1;
  var day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
  var hours = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
  var minutes =
    date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
  var seconds =
    date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
  return (
    year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds
  );
  return year + "-" + month + "-" + day;
}
/**
src/utils/ruoyi.js
@@ -8,7 +8,7 @@
  if (arguments.length === 0 || !time) {
    return null
  }
  const format = pattern || '{y}-{m}-{d} {h}:{i}:{s}'
  const format = pattern || '{y}-{m}-{d}'
  let date
  if (typeof time === 'object') {
    date = time
src/views/collaborativeApproval/notificationManagement/meetDraft/index.vue
@@ -430,7 +430,11 @@
// æ ¼å¼åŒ–日期时间
const formatDateTime = (dateTime) => {
  if (!dateTime) return ''
  return dateTime.replace(' ', '\n')
  const matched = String(dateTime).match(
    /^(\d{4})[-/](\d{1,2})[-/](\d{1,2})/
  )
  if (!matched) return dateTime
  return `${matched[1]}-${matched[2].padStart(2, '0')}-${matched[3].padStart(2, '0')}`
}
// é¡µé¢åŠ è½½æ—¶èŽ·å–æ•°æ®
src/views/collaborativeApproval/notificationManagement/meetExamine/index.vue
@@ -305,7 +305,11 @@
// æ ¼å¼åŒ–日期时间
const formatDateTime = (dateTime) => {
  if (!dateTime) return ''
  return dateTime.replace(' ', '\n')
  const matched = String(dateTime).match(
    /^(\d{4})[-/](\d{1,2})[-/](\d{1,2})/
  )
  if (!matched) return dateTime
  return `${matched[1]}-${matched[2].padStart(2, '0')}-${matched[3].padStart(2, '0')}`
}
// æäº¤å®¡æ‰¹
src/views/collaborativeApproval/notificationManagement/meetPublish/index.vue
@@ -302,7 +302,11 @@
// æ ¼å¼åŒ–日期时间
const formatDateTime = (dateTime) => {
  if (!dateTime) return ''
  return dateTime.replace(' ', '\n')
  const matched = String(dateTime).match(
    /^(\d{4})[-/](\d{1,2})[-/](\d{1,2})/
  )
  if (!matched) return dateTime
  return `${matched[1]}-${matched[2].padStart(2, '0')}-${matched[3].padStart(2, '0')}`
}
// æäº¤å‘布
src/views/collaborativeApproval/notificationManagement/summary/index.vue
@@ -332,7 +332,11 @@
// æ ¼å¼åŒ–日期时间
const formatDateTime = (dateTime) => {
  if (!dateTime) return ''
  return dateTime.replace(' ', '\n')
  const matched = String(dateTime).match(
    /^(\d{4})[-/](\d{1,2})[-/](\d{1,2})/
  )
  if (!matched) return dateTime
  return `${matched[1]}-${matched[2].padStart(2, '0')}-${matched[3].padStart(2, '0')}`
}
// é¡µé¢åŠ è½½æ—¶èŽ·å–æ•°æ®
src/views/equipmentManagement/inspectionManagement/index.vue
@@ -197,7 +197,7 @@
      formatData: cell => {
        if (!cell) return "-";
        try {
          return dayjs(cell).format("YYYY-MM-DD HH:mm:ss");
          return dayjs(cell).format("YYYY-MM-DD");
        } catch {
          return cell;
        }
src/views/equipmentManagement/upkeep/index.vue
@@ -348,8 +348,7 @@
      prop: "registrationDate",
      label: "登记日期",
      minWidth: 100,
      formatData: cell =>
        cell ? dayjs(cell).format("YYYY-MM-DD HH:mm:ss") : "-",
      formatData: cell => (cell ? dayjs(cell).format("YYYY-MM-DD") : "-"),
    },
    {
      fixed: "right",
@@ -408,8 +407,7 @@
      label: "实际保养日期",
      align: "center",
      prop: "maintenanceActuallyTime",
      formatData: cell =>
        cell ? dayjs(cell).format("YYYY-MM-DD HH:mm:ss") : "-",
      formatData: cell => (cell ? dayjs(cell).format("YYYY-MM-DD") : "-"),
    },
    {
      label: "保养结果",
src/views/financialManagement/payable/purchaseIn.vue
@@ -58,7 +58,7 @@
        }"
                @pagination="changePage">
        <template #inboundDate="{ row }">
          {{ row.inboundDate ?? row.InboundDate ?? "" }}
          {{ formatDateOnly(row.inboundDate ?? row.InboundDate ?? "") }}
        </template>
      </PIMTable>
    </div>
src/views/index.vue
@@ -222,7 +222,7 @@
            <li v-for="item in todoList" :key="item.id" class="todo-item">
              <div class="todo-head">
                <span class="todo-no">待办编号:{{ item.approveId }}</span>
                <span class="todo-time">{{ item.approveTime }}</span>
                <span class="todo-time">{{ formatDateOnly(item.approveTime) }}</span>
              </div>
              <div class="todo-desc">部门:{{ item.approveDeptName }}</div>
              <div class="todo-desc">事由:{{ item.approveReason }}</div>
@@ -289,7 +289,7 @@
              </div>
              <div class="plan-meta">
                <span>计划 {{ item.planQty }}</span>
                <span>交期 {{ item.deliveryDate }}</span>
                <span>交期 {{ formatDateOnly(item.deliveryDate) }}</span>
              </div>
            </li>
          </ul>
src/views/inventoryManagement/stockManagement/BatchNoQtyDetail.vue
@@ -54,7 +54,11 @@
            label="最近更新时间"
            prop="updateTime"
            show-overflow-tooltip
          />
          >
            <template #default="scope">
              {{ formatDateOnly(scope.row.updateTime || scope.row.createTime) }}
            </template>
          </el-table-column>
          <el-table-column fixed="right" label="操作" min-width="180" align="center">
            <template #default="scope">
              <el-button
src/views/inventoryManagement/stockManagement/Qualified.vue
@@ -31,7 +31,11 @@
        <el-table-column label="冻结数量" prop="lockedQuantity" show-overflow-tooltip />
        <el-table-column label="库存预警数量" prop="warnNum"  show-overflow-tooltip />
        <el-table-column label="备注" prop="remark"  show-overflow-tooltip />
        <el-table-column label="最近更新时间" prop="updateTime" show-overflow-tooltip />
        <el-table-column label="最近更新时间" prop="updateTime" show-overflow-tooltip>
          <template #default="scope">
            {{ formatDateOnly(scope.row.updateTime || scope.row.createTime) }}
          </template>
        </el-table-column>
        <el-table-column fixed="right" label="操作" min-width="90" align="center">
          <template #default="scope">
            <el-button link type="primary" @click="showSubtractModal(scope.row)" :disabled="scope.row.unLockedQuantity === 0">领用</el-button>
src/views/inventoryManagement/stockManagement/Record.vue
@@ -107,7 +107,11 @@
                         show-overflow-tooltip />
        <el-table-column label="最近更新时间"
                         prop="updateTime"
                         show-overflow-tooltip />
                         show-overflow-tooltip>
          <template #default="scope">
            {{ formatDateOnly(scope.row.updateTime || scope.row.createTime) }}
          </template>
        </el-table-column>
        <el-table-column fixed="right"
                         label="操作"
                         min-width="80"
src/views/inventoryManagement/stockManagement/Unqualified.vue
@@ -26,7 +26,11 @@
        <el-table-column label="库存数量" prop="qualitity" show-overflow-tooltip />
        <el-table-column label="冻结数量" prop="lockedQuantity" show-overflow-tooltip />
        <el-table-column label="备注" prop="remark"  show-overflow-tooltip />
        <el-table-column label="最近更新时间" prop="updateTime" show-overflow-tooltip />
        <el-table-column label="最近更新时间" prop="updateTime" show-overflow-tooltip>
          <template #default="scope">
            {{ formatDateOnly(scope.row.updateTime || scope.row.createTime) }}
          </template>
        </el-table-column>
        <el-table-column fixed="right" label="操作" min-width="90" align="center">
          <template #default="scope">
            <el-button link type="primary" @click="showSubtractModal(scope.row)" :disabled="scope.row.unLockedQuantity === 0">领用</el-button>
src/views/officeProcessAutomation/ApproveManage/approve-template/approveTemplateConstants.js
@@ -159,16 +159,16 @@
  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");
  }
  if (typeof val === "number") {
    const d = val > 1e12 ? dayjs(val) : dayjs.unix(val);
    return d.isValid() ? d.format("YYYY-MM-DD HH:mm:ss") : "";
    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 HH:mm:ss") : s;
  return parsed.isValid() ? parsed.format("YYYY-MM-DD") : s;
}
export function formatDisplayTime(val) {
src/views/procurementManagement/thePaymentLedger/index.vue
@@ -55,8 +55,7 @@
  {
    label: "登记日期",
    prop: "registrationtDate",
    formatData: cell =>
      cell ? dayjs(cell).format("YYYY-MM-DD HH:mm:ss") : "-",
    formatData: cell => (cell ? dayjs(cell).format("YYYY-MM-DD") : "-"),
  },
]);
const tableData = ref([]);
src/views/productionPlan/productionPlan/components/PIMTable.vue
@@ -183,16 +183,20 @@
             class="cell link"
             style="width: 100%"
             @click="goLink(scope.row, item.linkMethod)">
          <span v-if="!item.formatData">{{ scope.row[item.prop] }}</span>
          <span v-if="!item.formatData">{{
            toDateOnly(scope.row[item.prop])
          }}</span>
        </div>
        <!-- é»˜è®¤çº¯å±•示数据 -->
        <div v-else
             class="cell"
             :class="item.className || ''"
             style="width: 100%">
          <span v-if="!item.formatData">{{ scope.row[item.prop] }}</span>
          <span v-if="!item.formatData">{{
            toDateOnly(scope.row[item.prop])
          }}</span>
          <span v-else>{{
            formatters(scope.row[item.prop], item.formatData)
            toDateOnly(formatters(scope.row[item.prop], item.formatData))
          }}</span>
        </div>
      </template>
@@ -210,6 +214,7 @@
  import pagination from "../../../../components/PIMTable/Pagination.vue";
  import { ref, inject, getCurrentInstance } from "vue";
  import { ElMessage } from "element-plus";
  import { toDateOnly } from "@/utils/dateDisplay";
  // èŽ·å–å…¨å±€çš„ uploadHeader
  const { proxy } = getCurrentInstance();
src/views/qualityManagement/afterSalesTraceability/index.vue
@@ -123,7 +123,7 @@
      <el-table-column label="联系方式" prop="contact" width="140" />
      <el-table-column label="反馈时间" prop="feedbackTime" width="160">
        <template #default="scope">
          <span>{{ scope.row.feedbackTime }}</span>
          <span>{{ formatDateOnly(scope.row.feedbackTime) }}</span>
        </template>
      </el-table-column>
      <el-table-column label="问题描述" prop="problemDesc" show-overflow-tooltip />
src/views/reportAnalysis/dataDashboard/components/basic/center-top.vue
@@ -97,7 +97,7 @@
              >
                <div class="todo-title">申请类型:{{ item.approveTypeName }}</div>
                <div class="todo-division">申请部门:{{ item.approveDeptName }}</div>
                <div class="todo-time">{{ item.approveTime }}</div>
                <div class="todo-time">{{ formatDateOnly(item.approveTime) }}</div>
              </div>
              
            </div>
src/views/salesManagement/salesLedger/index.vue
@@ -146,7 +146,7 @@
                <template #default="scope">
                  <div>
                    <div v-if="scope.row.shippingDate">
                      {{ scope.row.shippingDate }}
                      {{ formatDateOnly(scope.row.shippingDate) }}
                    </div>
                    <el-tag v-else type="info">- </el-tag>
                  </div>
src/views/salesManagement/strategyControl/index.vue
@@ -63,7 +63,7 @@
            </el-table-column>
            <el-table-column prop="validPeriod" label="有效期" width="200">
              <template #default="scope">
                {{ scope.row.startDate }} è‡³ {{ scope.row.endDate }}
                {{ formatDateOnly(scope.row.startDate) }} è‡³ {{ formatDateOnly(scope.row.endDate) }}
              </template>
            </el-table-column>
            <el-table-column prop="status" label="状态" width="80">
src/views/system/appVersion/index.vue
@@ -12,12 +12,12 @@
      <el-table-column label="版本号" prop="version" align="center" width="120"/>
      <el-table-column label="创建时间" prop="createTime" align="center" width="170">
        <template #default="scope">
          <span>{{ parseTime(scope.row.createTime, "{y}-{m}-{d} {h}:{i}:{s}") }}</span>
          <span>{{ parseTime(scope.row.createTime) }}</span>
        </template>
      </el-table-column>
      <el-table-column label="更新时间" prop="updateTime" align="center" width="170">
        <template #default="scope">
          <span>{{ parseTime(scope.row.updateTime, "{y}-{m}-{d} {h}:{i}:{s}") }}</span>
          <span>{{ parseTime(scope.row.updateTime) }}</span>
        </template>
      </el-table-column>
      <el-table-column label="创建人" prop="createUser" align="center" width="100"/>