diff --git a/pages.config.ts b/pages.config.ts index abb0a92..222c879 100644 --- a/pages.config.ts +++ b/pages.config.ts @@ -2,6 +2,7 @@ import { defineUniPages } from '@uni-helper/vite-plugin-uni-pages' import { tabBar } from './src/tabbar/config' export default defineUniPages({ + pages: [], globalStyle: { navigationStyle: 'default', navigationBarTitleText: '芋道管理系统', diff --git a/src/pages-erp/purchase-order/form/index.vue b/src/pages-erp/purchase-order/form/index.vue index 5afcc40..81f4b99 100644 --- a/src/pages-erp/purchase-order/form/index.vue +++ b/src/pages-erp/purchase-order/form/index.vue @@ -261,6 +261,7 @@ import { createPurchaseOrder, getPurchaseOrder, updatePurchaseOrder } from '@/ap import { getProductSimpleList } from '@/api/erp/product' import { getSupplierSimpleList } from '@/api/erp/supplier' import { getPurchaseRequisition, getPurchaseRequisitionPage } from '@/api/erp/purchase-requisition' +import { formatDate as formatDateValue } from '@/utils/date' import { navigateBackPlus } from '@/utils' const props = defineProps<{ @@ -318,14 +319,8 @@ function onSupplierConfirm({ value }: any) { } /** 格式化日期 */ -function formatDate(dateVal?: string | number) { - if (!dateVal) return '-' - if (typeof dateVal === 'number') { - const d = new Date(dateVal) - const pad = (n: number) => n.toString().padStart(2, '0') - return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}` - } - return String(dateVal).substring(0, 10) +function formatDate(dateVal?: string | number | Date) { + return formatDateValue(dateVal) || '-' } /** 打开请购单选择弹窗 */ diff --git a/src/pages-erp/purchase-requisition/detail/index.vue b/src/pages-erp/purchase-requisition/detail/index.vue index 9fd4dfd..b1529e8 100644 --- a/src/pages-erp/purchase-requisition/detail/index.vue +++ b/src/pages-erp/purchase-requisition/detail/index.vue @@ -182,6 +182,7 @@ import { updatePurchaseRequisitionStatus, } from '@/api/erp/purchase-requisition' import { useAccess } from '@/hooks/useAccess' +import { formatDate as formatDateValue } from '@/utils/date' import { navigateBackPlus } from '@/utils' const props = defineProps<{ @@ -276,15 +277,13 @@ function formatPrice(price?: number) { } /** 格式化日期 */ -function formatDate(dateStr?: string) { - if (!dateStr) return '-' - return dateStr.substring(0, 10) +function formatDate(dateStr?: string | number | Date) { + return formatDateValue(dateStr) || '-' } /** 格式化日期时间 */ -function formatDateTime(dateStr?: string) { - if (!dateStr) return '-' - return dateStr.substring(0, 16).replace('T', ' ') +function formatDateTime(dateStr?: string | number | Date) { + return formatDateValue(dateStr, 'YYYY-MM-DD HH:mm') || '-' } /** 返回上一页 */ diff --git a/src/pages-erp/purchase-requisition/form/index.vue b/src/pages-erp/purchase-requisition/form/index.vue index bd8778f..c4d0400 100644 --- a/src/pages-erp/purchase-requisition/form/index.vue +++ b/src/pages-erp/purchase-requisition/form/index.vue @@ -233,6 +233,7 @@ import { REQUISITION_TYPE_OPTIONS, updatePurchaseRequisition, } from '@/api/erp/purchase-requisition' +import { formatDate as formatDateValue } from '@/utils/date' import { navigateBackPlus } from '@/utils' const props = defineProps<{ @@ -347,14 +348,8 @@ function formatPrice(price?: number) { } /** 格式化日期 */ -function formatDate(dateStr?: string) { - if (!dateStr) return '-' - if (typeof dateStr === 'number') { - const d = new Date(dateStr) - const pad = (n: number) => n.toString().padStart(2, '0') - return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}` - } - return dateStr.substring(0, 10) +function formatDate(dateStr?: string | number | Date) { + return formatDateValue(dateStr) || '-' } /** 返回上一页 */ diff --git a/src/pages-erp/purchase-requisition/index.vue b/src/pages-erp/purchase-requisition/index.vue index 1626940..abb8e14 100644 --- a/src/pages-erp/purchase-requisition/index.vue +++ b/src/pages-erp/purchase-requisition/index.vue @@ -219,6 +219,7 @@ import { updatePurchaseRequisitionStatus, } from '@/api/erp/purchase-requisition' import { useAccess } from '@/hooks/useAccess' +import { formatDate as formatDateValue } from '@/utils/date' import { getNavbarHeight, navigateBackPlus } from '@/utils' definePage({ @@ -359,9 +360,8 @@ function formatPrice(price?: number) { } /** 格式化日期 */ -function formatDate(dateStr?: string) { - if (!dateStr) return '-' - return dateStr.substring(0, 10) +function formatDate(dateStr?: string | number | Date) { + return formatDateValue(dateStr) || '-' } /** 返回上一页 */ diff --git a/src/pages-erp/stock-check/detail/index.vue b/src/pages-erp/stock-check/detail/index.vue index 83ad44e..ac65187 100644 --- a/src/pages-erp/stock-check/detail/index.vue +++ b/src/pages-erp/stock-check/detail/index.vue @@ -116,6 +116,7 @@ import { onMounted, ref } from 'vue' import { useToast } from 'wot-design-uni' import { deleteStockCheck, getStockCheck, updateStockCheckStatus } from '@/api/erp/stock-check' import { useAccess } from '@/hooks/useAccess' +import { formatDate as formatDateValue } from '@/utils/date' import { navigateBackPlus } from '@/utils' const props = defineProps<{ @@ -146,9 +147,8 @@ function formatPrice(price?: number) { } /** 格式化日期 */ -function formatDate(dateStr?: string) { - if (!dateStr) return '-' - return dateStr.substring(0, 10) +function formatDate(dateStr?: string | number | Date) { + return formatDateValue(dateStr) || '-' } /** 返回上一页 */ diff --git a/src/pages-erp/stock-check/form/index.vue b/src/pages-erp/stock-check/form/index.vue index 51f1450..a352f82 100644 --- a/src/pages-erp/stock-check/form/index.vue +++ b/src/pages-erp/stock-check/form/index.vue @@ -169,6 +169,7 @@ import { computed, onMounted, ref } from 'vue' import { useToast } from 'wot-design-uni' import { createStockCheck, getStockCheck, updateStockCheck } from '@/api/erp/stock-check' import { getWarehouseSimpleList } from '@/api/erp/warehouse' +import { formatDate as formatDateValue } from '@/utils/date' import { navigateBackPlus } from '@/utils' const props = defineProps<{ @@ -240,14 +241,8 @@ function formatPrice(price?: number) { } /** 格式化日期 */ -function formatDate(dateStr?: string) { - if (!dateStr) return '-' - if (typeof dateStr === 'number') { - const d = new Date(dateStr) - const pad = (n: number) => n.toString().padStart(2, '0') - return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}` - } - return dateStr.substring(0, 10) +function formatDate(dateStr?: string | number | Date) { + return formatDateValue(dateStr) || '-' } /** 返回上一页 */ diff --git a/src/pages-erp/stock-check/index.vue b/src/pages-erp/stock-check/index.vue index f64c831..d9c240c 100644 --- a/src/pages-erp/stock-check/index.vue +++ b/src/pages-erp/stock-check/index.vue @@ -164,6 +164,7 @@ import { computed, onMounted, reactive, ref } from 'vue' import { useToast } from 'wot-design-uni' import { deleteStockCheck, getStockCheckPage, updateStockCheckStatus } from '@/api/erp/stock-check' import { useAccess } from '@/hooks/useAccess' +import { formatDate as formatDateValue } from '@/utils/date' import { getNavbarHeight, navigateBackPlus } from '@/utils' definePage({ @@ -229,9 +230,8 @@ function formatPrice(price?: number) { } /** 格式化日期 */ -function formatDate(dateStr?: string) { - if (!dateStr) return '-' - return dateStr.substring(0, 10) +function formatDate(dateStr?: string | number | Date) { + return formatDateValue(dateStr) || '-' } /** 返回上一页 */ diff --git a/src/pages-erp/stock-gain/detail/index.vue b/src/pages-erp/stock-gain/detail/index.vue index 994122b..e7488a0 100644 --- a/src/pages-erp/stock-gain/detail/index.vue +++ b/src/pages-erp/stock-gain/detail/index.vue @@ -104,6 +104,7 @@ import { onMounted, ref } from 'vue' import { useToast } from 'wot-design-uni' import { deleteStockGain, getStockGain, updateStockGainStatus } from '@/api/erp/stock-gain' import { useAccess } from '@/hooks/useAccess' +import { formatDate as formatDateValue } from '@/utils/date' import { navigateBackPlus } from '@/utils' const props = defineProps<{ @@ -134,9 +135,8 @@ function formatPrice(price?: number) { } /** 格式化日期 */ -function formatDate(dateStr?: string) { - if (!dateStr) return '-' - return dateStr.substring(0, 10) +function formatDate(dateStr?: string | number | Date) { + return formatDateValue(dateStr) || '-' } /** 返回上一页 */ diff --git a/src/pages-erp/stock-gain/form/index.vue b/src/pages-erp/stock-gain/form/index.vue index 1892665..ee69cb0 100644 --- a/src/pages-erp/stock-gain/form/index.vue +++ b/src/pages-erp/stock-gain/form/index.vue @@ -157,6 +157,7 @@ import { computed, onMounted, ref } from 'vue' import { useToast } from 'wot-design-uni' import { createStockGain, getStockGain, updateStockGain } from '@/api/erp/stock-gain' import { getWarehouseSimpleList } from '@/api/erp/warehouse' +import { formatDate as formatDateValue } from '@/utils/date' import { navigateBackPlus } from '@/utils' const props = defineProps<{ @@ -229,14 +230,8 @@ function formatPrice(price?: number) { } /** 格式化日期 */ -function formatDate(dateStr?: string) { - if (!dateStr) return '-' - if (typeof dateStr === 'number') { - const d = new Date(dateStr) - const pad = (n: number) => n.toString().padStart(2, '0') - return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}` - } - return dateStr.substring(0, 10) +function formatDate(dateStr?: string | number | Date) { + return formatDateValue(dateStr) || '-' } /** 返回上一页 */ diff --git a/src/pages-erp/stock-gain/index.vue b/src/pages-erp/stock-gain/index.vue index cc29778..767b692 100644 --- a/src/pages-erp/stock-gain/index.vue +++ b/src/pages-erp/stock-gain/index.vue @@ -169,6 +169,7 @@ import { computed, onMounted, reactive, ref } from 'vue' import { useToast } from 'wot-design-uni' import { deleteStockGain, getStockGainPage, updateStockGainStatus } from '@/api/erp/stock-gain' import { useAccess } from '@/hooks/useAccess' +import { formatDate as formatDateValue } from '@/utils/date' import { getNavbarHeight, navigateBackPlus } from '@/utils' definePage({ @@ -234,9 +235,8 @@ function formatPrice(price?: number) { } /** 格式化日期 */ -function formatDate(dateStr?: string) { - if (!dateStr) return '-' - return dateStr.substring(0, 10) +function formatDate(dateStr?: string | number | Date) { + return formatDateValue(dateStr) || '-' } /** 返回上一页 */ diff --git a/src/pages-erp/stock-in/detail/index.vue b/src/pages-erp/stock-in/detail/index.vue index 870c81b..19ae192 100644 --- a/src/pages-erp/stock-in/detail/index.vue +++ b/src/pages-erp/stock-in/detail/index.vue @@ -116,6 +116,7 @@ import { onMounted, ref } from 'vue' import { useToast } from 'wot-design-uni' import { deleteStockIn, getStockIn, updateStockInStatus } from '@/api/erp/stock-in' import { useAccess } from '@/hooks/useAccess' +import { formatDate as formatDateValue } from '@/utils/date' import { navigateBackPlus } from '@/utils' const props = defineProps<{ @@ -146,9 +147,8 @@ function formatPrice(price?: number) { } /** 格式化日期 */ -function formatDate(dateStr?: string) { - if (!dateStr) return '-' - return dateStr.substring(0, 10) +function formatDate(dateStr?: string | number | Date) { + return formatDateValue(dateStr) || '-' } /** 返回上一页 */ diff --git a/src/pages-erp/stock-in/form/index.vue b/src/pages-erp/stock-in/form/index.vue index 9d6a42a..c6e18a4 100644 --- a/src/pages-erp/stock-in/form/index.vue +++ b/src/pages-erp/stock-in/form/index.vue @@ -173,6 +173,7 @@ import { useToast } from 'wot-design-uni' import { createStockIn, getStockIn, updateStockIn } from '@/api/erp/stock-in' import { getSupplierSimpleList } from '@/api/erp/supplier' import { getWarehouseSimpleList } from '@/api/erp/warehouse' +import { formatDate as formatDateValue } from '@/utils/date' import { navigateBackPlus } from '@/utils' const props = defineProps<{ @@ -259,14 +260,8 @@ function formatPrice(price?: number) { } /** 格式化日期 */ -function formatDate(dateStr?: string) { - if (!dateStr) return '-' - if (typeof dateStr === 'number') { - const d = new Date(dateStr) - const pad = (n: number) => n.toString().padStart(2, '0') - return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}` - } - return dateStr.substring(0, 10) +function formatDate(dateStr?: string | number | Date) { + return formatDateValue(dateStr) || '-' } /** 返回上一页 */ diff --git a/src/pages-erp/stock-in/index.vue b/src/pages-erp/stock-in/index.vue index b2e86b7..055dd4c 100644 --- a/src/pages-erp/stock-in/index.vue +++ b/src/pages-erp/stock-in/index.vue @@ -169,6 +169,7 @@ import { computed, onMounted, reactive, ref } from 'vue' import { useToast } from 'wot-design-uni' import { deleteStockIn, getStockInPage, updateStockInStatus } from '@/api/erp/stock-in' import { useAccess } from '@/hooks/useAccess' +import { formatDate as formatDateValue } from '@/utils/date' import { getNavbarHeight, navigateBackPlus } from '@/utils' definePage({ @@ -234,9 +235,8 @@ function formatPrice(price?: number) { } /** 格式化日期 */ -function formatDate(dateStr?: string) { - if (!dateStr) return '-' - return dateStr.substring(0, 10) +function formatDate(dateStr?: string | number | Date) { + return formatDateValue(dateStr) || '-' } /** 返回上一页 */ diff --git a/src/pages-erp/stock-loss/detail/index.vue b/src/pages-erp/stock-loss/detail/index.vue index cbd0343..9caafe8 100644 --- a/src/pages-erp/stock-loss/detail/index.vue +++ b/src/pages-erp/stock-loss/detail/index.vue @@ -104,6 +104,7 @@ import { onMounted, ref } from 'vue' import { useToast } from 'wot-design-uni' import { deleteStockLoss, getStockLoss, updateStockLossStatus } from '@/api/erp/stock-loss' import { useAccess } from '@/hooks/useAccess' +import { formatDate as formatDateValue } from '@/utils/date' import { navigateBackPlus } from '@/utils' const props = defineProps<{ @@ -134,9 +135,8 @@ function formatPrice(price?: number) { } /** 格式化日期 */ -function formatDate(dateStr?: string) { - if (!dateStr) return '-' - return dateStr.substring(0, 10) +function formatDate(dateStr?: string | number | Date) { + return formatDateValue(dateStr) || '-' } /** 返回上一页 */ diff --git a/src/pages-erp/stock-loss/form/index.vue b/src/pages-erp/stock-loss/form/index.vue index fd2894c..111edc2 100644 --- a/src/pages-erp/stock-loss/form/index.vue +++ b/src/pages-erp/stock-loss/form/index.vue @@ -157,6 +157,7 @@ import { computed, onMounted, ref } from 'vue' import { useToast } from 'wot-design-uni' import { createStockLoss, getStockLoss, updateStockLoss } from '@/api/erp/stock-loss' import { getWarehouseSimpleList } from '@/api/erp/warehouse' +import { formatDate as formatDateValue } from '@/utils/date' import { navigateBackPlus } from '@/utils' const props = defineProps<{ @@ -229,14 +230,8 @@ function formatPrice(price?: number) { } /** 格式化日期 */ -function formatDate(dateStr?: string) { - if (!dateStr) return '-' - if (typeof dateStr === 'number') { - const d = new Date(dateStr) - const pad = (n: number) => n.toString().padStart(2, '0') - return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}` - } - return dateStr.substring(0, 10) +function formatDate(dateStr?: string | number | Date) { + return formatDateValue(dateStr) || '-' } /** 返回上一页 */ diff --git a/src/pages-erp/stock-loss/index.vue b/src/pages-erp/stock-loss/index.vue index 9f33f83..f2f7368 100644 --- a/src/pages-erp/stock-loss/index.vue +++ b/src/pages-erp/stock-loss/index.vue @@ -169,6 +169,7 @@ import { computed, onMounted, reactive, ref } from 'vue' import { useToast } from 'wot-design-uni' import { deleteStockLoss, getStockLossPage, updateStockLossStatus } from '@/api/erp/stock-loss' import { useAccess } from '@/hooks/useAccess' +import { formatDate as formatDateValue } from '@/utils/date' import { getNavbarHeight, navigateBackPlus } from '@/utils' definePage({ @@ -234,9 +235,8 @@ function formatPrice(price?: number) { } /** 格式化日期 */ -function formatDate(dateStr?: string) { - if (!dateStr) return '-' - return dateStr.substring(0, 10) +function formatDate(dateStr?: string | number | Date) { + return formatDateValue(dateStr) || '-' } /** 返回上一页 */ diff --git a/src/pages-erp/stock-move/detail/index.vue b/src/pages-erp/stock-move/detail/index.vue index 3fd977a..fc3991e 100644 --- a/src/pages-erp/stock-move/detail/index.vue +++ b/src/pages-erp/stock-move/detail/index.vue @@ -107,6 +107,7 @@ import { onMounted, ref } from 'vue' import { useToast } from 'wot-design-uni' import { deleteStockMove, getStockMove, updateStockMoveStatus } from '@/api/erp/stock-move' import { useAccess } from '@/hooks/useAccess' +import { formatDate as formatDateValue } from '@/utils/date' import { navigateBackPlus } from '@/utils' const props = defineProps<{ @@ -137,9 +138,8 @@ function formatPrice(price?: number) { } /** 格式化日期 */ -function formatDate(dateStr?: string) { - if (!dateStr) return '-' - return dateStr.substring(0, 10) +function formatDate(dateStr?: string | number | Date) { + return formatDateValue(dateStr) || '-' } /** 返回上一页 */ diff --git a/src/pages-erp/stock-move/form/index.vue b/src/pages-erp/stock-move/form/index.vue index fd97e16..b0c8454 100644 --- a/src/pages-erp/stock-move/form/index.vue +++ b/src/pages-erp/stock-move/form/index.vue @@ -166,6 +166,7 @@ import { computed, onMounted, ref } from 'vue' import { useToast } from 'wot-design-uni' import { createStockMove, getStockMove, updateStockMove } from '@/api/erp/stock-move' import { getWarehouseSimpleList } from '@/api/erp/warehouse' +import { formatDate as formatDateValue } from '@/utils/date' import { navigateBackPlus } from '@/utils' const props = defineProps<{ @@ -238,14 +239,8 @@ function formatPrice(price?: number) { } /** 格式化日期 */ -function formatDate(dateStr?: string) { - if (!dateStr) return '-' - if (typeof dateStr === 'number') { - const d = new Date(dateStr) - const pad = (n: number) => n.toString().padStart(2, '0') - return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}` - } - return dateStr.substring(0, 10) +function formatDate(dateStr?: string | number | Date) { + return formatDateValue(dateStr) || '-' } /** 返回上一页 */ diff --git a/src/pages-erp/stock-move/index.vue b/src/pages-erp/stock-move/index.vue index 4fe6c2a..9d2b265 100644 --- a/src/pages-erp/stock-move/index.vue +++ b/src/pages-erp/stock-move/index.vue @@ -164,6 +164,7 @@ import { computed, onMounted, reactive, ref } from 'vue' import { useToast } from 'wot-design-uni' import { deleteStockMove, getStockMovePage, updateStockMoveStatus } from '@/api/erp/stock-move' import { useAccess } from '@/hooks/useAccess' +import { formatDate as formatDateValue } from '@/utils/date' import { getNavbarHeight, navigateBackPlus } from '@/utils' definePage({ @@ -229,9 +230,8 @@ function formatPrice(price?: number) { } /** 格式化日期 */ -function formatDate(dateStr?: string) { - if (!dateStr) return '-' - return dateStr.substring(0, 10) +function formatDate(dateStr?: string | number | Date) { + return formatDateValue(dateStr) || '-' } /** 返回上一页 */ diff --git a/src/pages-erp/stock-out/detail/index.vue b/src/pages-erp/stock-out/detail/index.vue index 531ef0c..c4d12e8 100644 --- a/src/pages-erp/stock-out/detail/index.vue +++ b/src/pages-erp/stock-out/detail/index.vue @@ -125,6 +125,7 @@ import { onMounted, ref } from 'vue' import { useToast } from 'wot-design-uni' import { deleteStockOut, getStockOut, updateStockOutStatus } from '@/api/erp/stock-out' import { useAccess } from '@/hooks/useAccess' +import { formatDate as formatDateValue } from '@/utils/date' import { navigateBackPlus } from '@/utils' const props = defineProps<{ @@ -159,11 +160,8 @@ function formatPrice(price?: number) { } /** 格式化日期 */ -function formatDate(dateStr?: string) { - if (!dateStr) { - return '-' - } - return dateStr.substring(0, 10) +function formatDate(dateStr?: string | number | Date) { + return formatDateValue(dateStr) || '-' } /** 返回上一页 */ @@ -191,7 +189,7 @@ function handleEdit() { /** 去扫码执行 */ function handleTaskScan() { - uni.navigateTo({ url: `/pages-erp/stock-out/task-scan/index?id=${props.id}` }) + uni.navigateTo({ url: `/pages-erp/stock-out/scan/index?id=${props.id}` }) } /** 审批 */ diff --git a/src/pages-erp/stock-out/form/index.vue b/src/pages-erp/stock-out/form/index.vue index 2fc7685..c0fe89e 100644 --- a/src/pages-erp/stock-out/form/index.vue +++ b/src/pages-erp/stock-out/form/index.vue @@ -172,6 +172,7 @@ import { computed, onMounted, ref } from 'vue' import { useToast } from 'wot-design-uni' import { createStockOut, getStockOut, updateStockOut } from '@/api/erp/stock-out' import { getWarehouseSimpleList } from '@/api/erp/warehouse' +import { formatDate as formatDateValue } from '@/utils/date' import { navigateBackPlus } from '@/utils' const props = defineProps<{ @@ -258,14 +259,8 @@ function formatPrice(price?: number) { } /** 格式化日期 */ -function formatDate(dateStr?: string) { - if (!dateStr) return '-' - if (typeof dateStr === 'number') { - const d = new Date(dateStr) - const pad = (n: number) => n.toString().padStart(2, '0') - return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}` - } - return dateStr.substring(0, 10) +function formatDate(dateStr?: string | number | Date) { + return formatDateValue(dateStr) || '-' } /** 返回上一页 */ diff --git a/src/pages-erp/stock-out/index.vue b/src/pages-erp/stock-out/index.vue index 9906c66..11b5476 100644 --- a/src/pages-erp/stock-out/index.vue +++ b/src/pages-erp/stock-out/index.vue @@ -191,6 +191,7 @@ import { computed, onMounted, reactive, ref } from 'vue' import { useToast } from 'wot-design-uni' import { deleteStockOut, getStockOutPage, updateStockOutStatus } from '@/api/erp/stock-out' import { useAccess } from '@/hooks/useAccess' +import { formatDate as formatDateValue } from '@/utils/date' import { getNavbarHeight, navigateBackPlus } from '@/utils' definePage({ @@ -260,10 +261,8 @@ function formatPrice(price?: number) { } /** 格式化日期 */ -function formatDate(dateStr?: string) { - if (!dateStr) - return '-' - return dateStr.substring(0, 10) +function formatDate(dateStr?: string | number | Date) { + return formatDateValue(dateStr) || '-' } /** 返回上一页 */ @@ -338,7 +337,7 @@ function handleEdit(item: StockOut) { /** 去扫码执行 */ function handleTaskScan(item: StockOut) { - uni.navigateTo({ url: `/pages-erp/stock-out/task-scan/index?id=${item.id}` }) + uni.navigateTo({ url: `/pages-erp/stock-out/scan/index?id=${item.id}` }) } /** 详情 */ diff --git a/src/pages/index/index.ts b/src/pages/index/index.ts index 94cf256..6de5750 100644 --- a/src/pages/index/index.ts +++ b/src/pages/index/index.ts @@ -182,7 +182,7 @@ const menuGroupsData: MenuGroup[] = [ key: 'stockOutTaskScan', name: '扫码销售出库', icon: 'scan', - url: '/pages-erp/stock-out/task-scan/index', + url: '/pages-erp/stock-out/scan/index', iconColor: '#cf1322', permission: 'erp:stock-out:query', }, diff --git a/src/utils/date.ts b/src/utils/date.ts index 1e876bc..b44005d 100644 --- a/src/utils/date.ts +++ b/src/utils/date.ts @@ -19,16 +19,11 @@ export function formatDate(time?: FormatDate, format: Format = 'YYYY-MM-DD') { if (!time) { return '' } - try { - const date = dayjs.isDayjs(time) ? time : dayjs(time) - if (!date.isValid()) { - throw new Error('Invalid date') - } - return date.format(format) - } catch (error) { - console.error(`Error formatting date: ${error}`) + const date = dayjs.isDayjs(time) ? time : dayjs(time) + if (!date.isValid()) { return String(time ?? '') } + return date.format(format) } /** 格式化日期时间 */