Browse Source

refactor(blockingData/missedInspectionList): 用parseTime替代手动格式化时间

简化新增页面的默认时间赋值代码,使用封装好的工具函数统一处理时间格式
huoyi 3 weeks ago
parent
commit
c5029527d2
1 changed files with 3 additions and 4 deletions
  1. 3 4
      src/views/blockingData/missedInspectionList/index.vue

+ 3 - 4
src/views/blockingData/missedInspectionList/index.vue

@@ -350,6 +350,7 @@ import { listUser, selectUserLeaderListByCondition, getUser } from '@/api/system
350 350
 import { listCategory } from '@/api/system/category'
351 351
 import { useDict } from '@/utils/dict'
352 352
 import { getToken } from '@/utils/auth'
353
+import { parseTime } from '@/utils/ruoyi'
353 354
 import { UploadFilled } from '@element-plus/icons-vue'
354 355
 
355 356
 const { proxy } = getCurrentInstance()
@@ -611,10 +612,8 @@ function handleSelectionChange(selection) {
611 612
 /** 新增按钮操作 */
612 613
 function handleAdd() {
613 614
   reset()
614
-  // 设置默认当前时间
615
-  form.missCheckTime = new Date().toISOString().replace('T', ' ').substring(0, 16)
616
-  // 设置默认当前日期
617
-  form.reviewDate = new Date().toISOString().split('T')[0]
615
+  form.missCheckTime = parseTime(new Date(), '{y}-{m}-{d} {h}:{i}')
616
+  form.reviewDate = parseTime(new Date(), '{y}-{m}-{d}')
618 617
   open.value = true
619 618
   title.value = '添加漏检'
620 619
 }