lxr 2 nedēļas atpakaļ
vecāks
revīzija
079c058cf5
1 mainītis faili ar 45 papildinājumiem un 22 dzēšanām
  1. 45 22
      src/views/storeDecoration/personnelConfig/index.vue

+ 45 - 22
src/views/storeDecoration/personnelConfig/index.vue

@@ -416,6 +416,23 @@ const approvalStatusEnum = [
   { label: "已驳回", value: 2 }
 ];
 
+/** 列表/详情:统一为 YYYY-MM-DD HH:mm:ss */
+const formatTime = (time: string | null | undefined) => {
+  if (!time) return "";
+  try {
+    const date = new Date(time);
+    const y = date.getFullYear();
+    const m = String(date.getMonth() + 1).padStart(2, "0");
+    const d = String(date.getDate()).padStart(2, "0");
+    const h = String(date.getHours()).padStart(2, "0");
+    const min = String(date.getMinutes()).padStart(2, "0");
+    const s = String(date.getSeconds()).padStart(2, "0");
+    return `${y}-${m}-${d} ${h}:${min}:${s}`;
+  } catch {
+    return time;
+  }
+};
+
 // 表格配置项
 const columns = reactive<ColumnProps<any>[]>([
   {
@@ -496,7 +513,24 @@ const columns = reactive<ColumnProps<any>[]>([
   {
     prop: "createdTime",
     label: "提交时间",
-    width: 180
+    width: 190,
+    render: (scope: any) => {
+      const t = scope.row.submissionTime || scope.row.createdTime;
+      return t ? formatTime(t) : "—";
+    },
+    search: {
+      el: "date-picker",
+      props: {
+        type: "datetimerange",
+        "range-separator": "至",
+        "start-placeholder": "开始时间",
+        "end-placeholder": "结束时间",
+        format: "YYYY-MM-DD HH:mm:ss",
+        "value-format": "YYYY-MM-DD HH:mm:ss"
+      },
+      order: 5,
+      span: 2
+    }
   },
   { prop: "operation", label: "操作", fixed: "right", minWidth: 350 }
 ]);
@@ -586,10 +620,16 @@ const getTableList = (params: any) => {
   if (params.approvalStatus !== undefined && params.approvalStatus !== null && params.approvalStatus !== "") {
     newParams.status = params.approvalStatus; // 审核状态 -> status
   }
-  // 处理日期范围 - 使用 startCreatedTime 和 endCreatedTime
-  if (params.dateRange && Array.isArray(params.dateRange) && params.dateRange.length === 2) {
-    newParams.startCreatedTime = params.dateRange[0];
-    newParams.endCreatedTime = params.dateRange[1];
+  // 提交时间:ProTable 搜索项 prop 为 createdTime,值为 [start, end]
+  const submissionRange =
+    params.createdTime && Array.isArray(params.createdTime) && params.createdTime.length === 2
+      ? params.createdTime
+      : params.dateRange && Array.isArray(params.dateRange) && params.dateRange.length === 2
+        ? params.dateRange
+        : null;
+  if (submissionRange) {
+    newParams.startCreatedTime = submissionRange[0];
+    newParams.endCreatedTime = submissionRange[1];
   }
 
   // 使用新的搜索接口
@@ -600,7 +640,6 @@ const getTableList = (params: any) => {
   });
 };
 
-// 格式化时间
 // 获取背景图片/视频列表
 const getBackgroundImageList = (backgroundUrl: string | null | undefined): string[] => {
   if (!backgroundUrl) return [];
@@ -630,22 +669,6 @@ const handleVideoPreviewInForm = (url: string) => {
   previewVideoVisible.value = true;
 };
 
-const formatTime = (time: string | null | undefined) => {
-  if (!time) return "";
-  try {
-    const date = new Date(time);
-    const y = date.getFullYear();
-    const m = String(date.getMonth() + 1).padStart(2, "0");
-    const d = String(date.getDate()).padStart(2, "0");
-    const h = String(date.getHours()).padStart(2, "0");
-    const min = String(date.getMinutes()).padStart(2, "0");
-    const s = String(date.getSeconds()).padStart(2, "0");
-    return `${y}-${m}-${d} ${h}:${min}:${s}`;
-  } catch {
-    return time;
-  }
-};
-
 // 弹窗标题
 const dialogTitle = computed(() => (editId.value !== null ? "编辑" : "新建"));