浏览代码

增加日期格式化工具

tongshangming 3 年之前
父节点
当前提交
7fe7e70b28
共有 3 个文件被更改,包括 11 次插入5 次删除
  1. 0 4
      src/components/ProTable.vue
  2. 5 0
      src/utils/utils.ts
  3. 6 1
      src/views/miniprogram/Feedback.vue

+ 0 - 4
src/components/ProTable.vue

@@ -291,10 +291,6 @@ defineExpose({
 </template>
 
 <style scoped>
-:deep(.el-table th.el-table__cell) {
-  background-color: #f5f7fa;
-  color: rgb(31, 34, 37);
-}
 .vxe-toolbar {
   padding-top: 0;
 }

+ 5 - 0
src/utils/utils.ts

@@ -0,0 +1,5 @@
+import dayjs from 'dayjs'
+
+export const formatDate = (date: any, format = 'YYYY-MM-DD HH:mm') => {
+  return dayjs(date).format(format)
+}

+ 6 - 1
src/views/miniprogram/Feedback.vue

@@ -1,4 +1,5 @@
 <script setup lang="ts">
+import { formatDate } from '@/utils/utils'
 import type { BasicForm, ICRUD } from '@/types/form'
 import { getAdviceList, saveAdvice, deleteAdvice } from '@/api/miniprogram'
 
@@ -59,7 +60,11 @@ const handleReply = () => {
     :tableConfig="{ showEdit: false }"
   >
     <vxe-column field="content" title="反馈内容"></vxe-column>
-    <vxe-column field="createDate" title="反馈时间"></vxe-column>
+    <vxe-column field="createDate" title="反馈时间">
+      <template #default="{ row }">
+        {{ formatDate(row.createDate) }}
+      </template>
+    </vxe-column>
     <template #operateBefore="{ row }">
       <el-button type="primary" size="small" @click="openDiolog(row)">回复</el-button>
     </template>