袁伟杰:V2.0.004 ERP日期渲染问题

This commit is contained in:
yuan
2026-05-15 15:00:41 +08:00
parent 7859af83b2
commit eac6df3207
25 changed files with 75 additions and 123 deletions

View File

@@ -2,6 +2,7 @@ import { defineUniPages } from '@uni-helper/vite-plugin-uni-pages'
import { tabBar } from './src/tabbar/config' import { tabBar } from './src/tabbar/config'
export default defineUniPages({ export default defineUniPages({
pages: [],
globalStyle: { globalStyle: {
navigationStyle: 'default', navigationStyle: 'default',
navigationBarTitleText: '芋道管理系统', navigationBarTitleText: '芋道管理系统',

View File

@@ -261,6 +261,7 @@ import { createPurchaseOrder, getPurchaseOrder, updatePurchaseOrder } from '@/ap
import { getProductSimpleList } from '@/api/erp/product' import { getProductSimpleList } from '@/api/erp/product'
import { getSupplierSimpleList } from '@/api/erp/supplier' import { getSupplierSimpleList } from '@/api/erp/supplier'
import { getPurchaseRequisition, getPurchaseRequisitionPage } from '@/api/erp/purchase-requisition' import { getPurchaseRequisition, getPurchaseRequisitionPage } from '@/api/erp/purchase-requisition'
import { formatDate as formatDateValue } from '@/utils/date'
import { navigateBackPlus } from '@/utils' import { navigateBackPlus } from '@/utils'
const props = defineProps<{ const props = defineProps<{
@@ -318,14 +319,8 @@ function onSupplierConfirm({ value }: any) {
} }
/** 格式化日期 */ /** 格式化日期 */
function formatDate(dateVal?: string | number) { function formatDate(dateVal?: string | number | Date) {
if (!dateVal) return '-' return formatDateValue(dateVal) || '-'
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)
} }
/** 打开请购单选择弹窗 */ /** 打开请购单选择弹窗 */

View File

@@ -182,6 +182,7 @@ import {
updatePurchaseRequisitionStatus, updatePurchaseRequisitionStatus,
} from '@/api/erp/purchase-requisition' } from '@/api/erp/purchase-requisition'
import { useAccess } from '@/hooks/useAccess' import { useAccess } from '@/hooks/useAccess'
import { formatDate as formatDateValue } from '@/utils/date'
import { navigateBackPlus } from '@/utils' import { navigateBackPlus } from '@/utils'
const props = defineProps<{ const props = defineProps<{
@@ -276,15 +277,13 @@ function formatPrice(price?: number) {
} }
/** 格式化日期 */ /** 格式化日期 */
function formatDate(dateStr?: string) { function formatDate(dateStr?: string | number | Date) {
if (!dateStr) return '-' return formatDateValue(dateStr) || '-'
return dateStr.substring(0, 10)
} }
/** 格式化日期时间 */ /** 格式化日期时间 */
function formatDateTime(dateStr?: string) { function formatDateTime(dateStr?: string | number | Date) {
if (!dateStr) return '-' return formatDateValue(dateStr, 'YYYY-MM-DD HH:mm') || '-'
return dateStr.substring(0, 16).replace('T', ' ')
} }
/** 返回上一页 */ /** 返回上一页 */

View File

@@ -233,6 +233,7 @@ import {
REQUISITION_TYPE_OPTIONS, REQUISITION_TYPE_OPTIONS,
updatePurchaseRequisition, updatePurchaseRequisition,
} from '@/api/erp/purchase-requisition' } from '@/api/erp/purchase-requisition'
import { formatDate as formatDateValue } from '@/utils/date'
import { navigateBackPlus } from '@/utils' import { navigateBackPlus } from '@/utils'
const props = defineProps<{ const props = defineProps<{
@@ -347,14 +348,8 @@ function formatPrice(price?: number) {
} }
/** 格式化日期 */ /** 格式化日期 */
function formatDate(dateStr?: string) { function formatDate(dateStr?: string | number | Date) {
if (!dateStr) return '-' return formatDateValue(dateStr) || '-'
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)
} }
/** 返回上一页 */ /** 返回上一页 */

View File

@@ -219,6 +219,7 @@ import {
updatePurchaseRequisitionStatus, updatePurchaseRequisitionStatus,
} from '@/api/erp/purchase-requisition' } from '@/api/erp/purchase-requisition'
import { useAccess } from '@/hooks/useAccess' import { useAccess } from '@/hooks/useAccess'
import { formatDate as formatDateValue } from '@/utils/date'
import { getNavbarHeight, navigateBackPlus } from '@/utils' import { getNavbarHeight, navigateBackPlus } from '@/utils'
definePage({ definePage({
@@ -359,9 +360,8 @@ function formatPrice(price?: number) {
} }
/** 格式化日期 */ /** 格式化日期 */
function formatDate(dateStr?: string) { function formatDate(dateStr?: string | number | Date) {
if (!dateStr) return '-' return formatDateValue(dateStr) || '-'
return dateStr.substring(0, 10)
} }
/** 返回上一页 */ /** 返回上一页 */

View File

@@ -116,6 +116,7 @@ import { onMounted, ref } from 'vue'
import { useToast } from 'wot-design-uni' import { useToast } from 'wot-design-uni'
import { deleteStockCheck, getStockCheck, updateStockCheckStatus } from '@/api/erp/stock-check' import { deleteStockCheck, getStockCheck, updateStockCheckStatus } from '@/api/erp/stock-check'
import { useAccess } from '@/hooks/useAccess' import { useAccess } from '@/hooks/useAccess'
import { formatDate as formatDateValue } from '@/utils/date'
import { navigateBackPlus } from '@/utils' import { navigateBackPlus } from '@/utils'
const props = defineProps<{ const props = defineProps<{
@@ -146,9 +147,8 @@ function formatPrice(price?: number) {
} }
/** 格式化日期 */ /** 格式化日期 */
function formatDate(dateStr?: string) { function formatDate(dateStr?: string | number | Date) {
if (!dateStr) return '-' return formatDateValue(dateStr) || '-'
return dateStr.substring(0, 10)
} }
/** 返回上一页 */ /** 返回上一页 */

View File

@@ -169,6 +169,7 @@ import { computed, onMounted, ref } from 'vue'
import { useToast } from 'wot-design-uni' import { useToast } from 'wot-design-uni'
import { createStockCheck, getStockCheck, updateStockCheck } from '@/api/erp/stock-check' import { createStockCheck, getStockCheck, updateStockCheck } from '@/api/erp/stock-check'
import { getWarehouseSimpleList } from '@/api/erp/warehouse' import { getWarehouseSimpleList } from '@/api/erp/warehouse'
import { formatDate as formatDateValue } from '@/utils/date'
import { navigateBackPlus } from '@/utils' import { navigateBackPlus } from '@/utils'
const props = defineProps<{ const props = defineProps<{
@@ -240,14 +241,8 @@ function formatPrice(price?: number) {
} }
/** 格式化日期 */ /** 格式化日期 */
function formatDate(dateStr?: string) { function formatDate(dateStr?: string | number | Date) {
if (!dateStr) return '-' return formatDateValue(dateStr) || '-'
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)
} }
/** 返回上一页 */ /** 返回上一页 */

View File

@@ -164,6 +164,7 @@ import { computed, onMounted, reactive, ref } from 'vue'
import { useToast } from 'wot-design-uni' import { useToast } from 'wot-design-uni'
import { deleteStockCheck, getStockCheckPage, updateStockCheckStatus } from '@/api/erp/stock-check' import { deleteStockCheck, getStockCheckPage, updateStockCheckStatus } from '@/api/erp/stock-check'
import { useAccess } from '@/hooks/useAccess' import { useAccess } from '@/hooks/useAccess'
import { formatDate as formatDateValue } from '@/utils/date'
import { getNavbarHeight, navigateBackPlus } from '@/utils' import { getNavbarHeight, navigateBackPlus } from '@/utils'
definePage({ definePage({
@@ -229,9 +230,8 @@ function formatPrice(price?: number) {
} }
/** 格式化日期 */ /** 格式化日期 */
function formatDate(dateStr?: string) { function formatDate(dateStr?: string | number | Date) {
if (!dateStr) return '-' return formatDateValue(dateStr) || '-'
return dateStr.substring(0, 10)
} }
/** 返回上一页 */ /** 返回上一页 */

View File

@@ -104,6 +104,7 @@ import { onMounted, ref } from 'vue'
import { useToast } from 'wot-design-uni' import { useToast } from 'wot-design-uni'
import { deleteStockGain, getStockGain, updateStockGainStatus } from '@/api/erp/stock-gain' import { deleteStockGain, getStockGain, updateStockGainStatus } from '@/api/erp/stock-gain'
import { useAccess } from '@/hooks/useAccess' import { useAccess } from '@/hooks/useAccess'
import { formatDate as formatDateValue } from '@/utils/date'
import { navigateBackPlus } from '@/utils' import { navigateBackPlus } from '@/utils'
const props = defineProps<{ const props = defineProps<{
@@ -134,9 +135,8 @@ function formatPrice(price?: number) {
} }
/** 格式化日期 */ /** 格式化日期 */
function formatDate(dateStr?: string) { function formatDate(dateStr?: string | number | Date) {
if (!dateStr) return '-' return formatDateValue(dateStr) || '-'
return dateStr.substring(0, 10)
} }
/** 返回上一页 */ /** 返回上一页 */

View File

@@ -157,6 +157,7 @@ import { computed, onMounted, ref } from 'vue'
import { useToast } from 'wot-design-uni' import { useToast } from 'wot-design-uni'
import { createStockGain, getStockGain, updateStockGain } from '@/api/erp/stock-gain' import { createStockGain, getStockGain, updateStockGain } from '@/api/erp/stock-gain'
import { getWarehouseSimpleList } from '@/api/erp/warehouse' import { getWarehouseSimpleList } from '@/api/erp/warehouse'
import { formatDate as formatDateValue } from '@/utils/date'
import { navigateBackPlus } from '@/utils' import { navigateBackPlus } from '@/utils'
const props = defineProps<{ const props = defineProps<{
@@ -229,14 +230,8 @@ function formatPrice(price?: number) {
} }
/** 格式化日期 */ /** 格式化日期 */
function formatDate(dateStr?: string) { function formatDate(dateStr?: string | number | Date) {
if (!dateStr) return '-' return formatDateValue(dateStr) || '-'
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)
} }
/** 返回上一页 */ /** 返回上一页 */

View File

@@ -169,6 +169,7 @@ import { computed, onMounted, reactive, ref } from 'vue'
import { useToast } from 'wot-design-uni' import { useToast } from 'wot-design-uni'
import { deleteStockGain, getStockGainPage, updateStockGainStatus } from '@/api/erp/stock-gain' import { deleteStockGain, getStockGainPage, updateStockGainStatus } from '@/api/erp/stock-gain'
import { useAccess } from '@/hooks/useAccess' import { useAccess } from '@/hooks/useAccess'
import { formatDate as formatDateValue } from '@/utils/date'
import { getNavbarHeight, navigateBackPlus } from '@/utils' import { getNavbarHeight, navigateBackPlus } from '@/utils'
definePage({ definePage({
@@ -234,9 +235,8 @@ function formatPrice(price?: number) {
} }
/** 格式化日期 */ /** 格式化日期 */
function formatDate(dateStr?: string) { function formatDate(dateStr?: string | number | Date) {
if (!dateStr) return '-' return formatDateValue(dateStr) || '-'
return dateStr.substring(0, 10)
} }
/** 返回上一页 */ /** 返回上一页 */

View File

@@ -116,6 +116,7 @@ import { onMounted, ref } from 'vue'
import { useToast } from 'wot-design-uni' import { useToast } from 'wot-design-uni'
import { deleteStockIn, getStockIn, updateStockInStatus } from '@/api/erp/stock-in' import { deleteStockIn, getStockIn, updateStockInStatus } from '@/api/erp/stock-in'
import { useAccess } from '@/hooks/useAccess' import { useAccess } from '@/hooks/useAccess'
import { formatDate as formatDateValue } from '@/utils/date'
import { navigateBackPlus } from '@/utils' import { navigateBackPlus } from '@/utils'
const props = defineProps<{ const props = defineProps<{
@@ -146,9 +147,8 @@ function formatPrice(price?: number) {
} }
/** 格式化日期 */ /** 格式化日期 */
function formatDate(dateStr?: string) { function formatDate(dateStr?: string | number | Date) {
if (!dateStr) return '-' return formatDateValue(dateStr) || '-'
return dateStr.substring(0, 10)
} }
/** 返回上一页 */ /** 返回上一页 */

View File

@@ -173,6 +173,7 @@ import { useToast } from 'wot-design-uni'
import { createStockIn, getStockIn, updateStockIn } from '@/api/erp/stock-in' import { createStockIn, getStockIn, updateStockIn } from '@/api/erp/stock-in'
import { getSupplierSimpleList } from '@/api/erp/supplier' import { getSupplierSimpleList } from '@/api/erp/supplier'
import { getWarehouseSimpleList } from '@/api/erp/warehouse' import { getWarehouseSimpleList } from '@/api/erp/warehouse'
import { formatDate as formatDateValue } from '@/utils/date'
import { navigateBackPlus } from '@/utils' import { navigateBackPlus } from '@/utils'
const props = defineProps<{ const props = defineProps<{
@@ -259,14 +260,8 @@ function formatPrice(price?: number) {
} }
/** 格式化日期 */ /** 格式化日期 */
function formatDate(dateStr?: string) { function formatDate(dateStr?: string | number | Date) {
if (!dateStr) return '-' return formatDateValue(dateStr) || '-'
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)
} }
/** 返回上一页 */ /** 返回上一页 */

View File

@@ -169,6 +169,7 @@ import { computed, onMounted, reactive, ref } from 'vue'
import { useToast } from 'wot-design-uni' import { useToast } from 'wot-design-uni'
import { deleteStockIn, getStockInPage, updateStockInStatus } from '@/api/erp/stock-in' import { deleteStockIn, getStockInPage, updateStockInStatus } from '@/api/erp/stock-in'
import { useAccess } from '@/hooks/useAccess' import { useAccess } from '@/hooks/useAccess'
import { formatDate as formatDateValue } from '@/utils/date'
import { getNavbarHeight, navigateBackPlus } from '@/utils' import { getNavbarHeight, navigateBackPlus } from '@/utils'
definePage({ definePage({
@@ -234,9 +235,8 @@ function formatPrice(price?: number) {
} }
/** 格式化日期 */ /** 格式化日期 */
function formatDate(dateStr?: string) { function formatDate(dateStr?: string | number | Date) {
if (!dateStr) return '-' return formatDateValue(dateStr) || '-'
return dateStr.substring(0, 10)
} }
/** 返回上一页 */ /** 返回上一页 */

View File

@@ -104,6 +104,7 @@ import { onMounted, ref } from 'vue'
import { useToast } from 'wot-design-uni' import { useToast } from 'wot-design-uni'
import { deleteStockLoss, getStockLoss, updateStockLossStatus } from '@/api/erp/stock-loss' import { deleteStockLoss, getStockLoss, updateStockLossStatus } from '@/api/erp/stock-loss'
import { useAccess } from '@/hooks/useAccess' import { useAccess } from '@/hooks/useAccess'
import { formatDate as formatDateValue } from '@/utils/date'
import { navigateBackPlus } from '@/utils' import { navigateBackPlus } from '@/utils'
const props = defineProps<{ const props = defineProps<{
@@ -134,9 +135,8 @@ function formatPrice(price?: number) {
} }
/** 格式化日期 */ /** 格式化日期 */
function formatDate(dateStr?: string) { function formatDate(dateStr?: string | number | Date) {
if (!dateStr) return '-' return formatDateValue(dateStr) || '-'
return dateStr.substring(0, 10)
} }
/** 返回上一页 */ /** 返回上一页 */

View File

@@ -157,6 +157,7 @@ import { computed, onMounted, ref } from 'vue'
import { useToast } from 'wot-design-uni' import { useToast } from 'wot-design-uni'
import { createStockLoss, getStockLoss, updateStockLoss } from '@/api/erp/stock-loss' import { createStockLoss, getStockLoss, updateStockLoss } from '@/api/erp/stock-loss'
import { getWarehouseSimpleList } from '@/api/erp/warehouse' import { getWarehouseSimpleList } from '@/api/erp/warehouse'
import { formatDate as formatDateValue } from '@/utils/date'
import { navigateBackPlus } from '@/utils' import { navigateBackPlus } from '@/utils'
const props = defineProps<{ const props = defineProps<{
@@ -229,14 +230,8 @@ function formatPrice(price?: number) {
} }
/** 格式化日期 */ /** 格式化日期 */
function formatDate(dateStr?: string) { function formatDate(dateStr?: string | number | Date) {
if (!dateStr) return '-' return formatDateValue(dateStr) || '-'
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)
} }
/** 返回上一页 */ /** 返回上一页 */

View File

@@ -169,6 +169,7 @@ import { computed, onMounted, reactive, ref } from 'vue'
import { useToast } from 'wot-design-uni' import { useToast } from 'wot-design-uni'
import { deleteStockLoss, getStockLossPage, updateStockLossStatus } from '@/api/erp/stock-loss' import { deleteStockLoss, getStockLossPage, updateStockLossStatus } from '@/api/erp/stock-loss'
import { useAccess } from '@/hooks/useAccess' import { useAccess } from '@/hooks/useAccess'
import { formatDate as formatDateValue } from '@/utils/date'
import { getNavbarHeight, navigateBackPlus } from '@/utils' import { getNavbarHeight, navigateBackPlus } from '@/utils'
definePage({ definePage({
@@ -234,9 +235,8 @@ function formatPrice(price?: number) {
} }
/** 格式化日期 */ /** 格式化日期 */
function formatDate(dateStr?: string) { function formatDate(dateStr?: string | number | Date) {
if (!dateStr) return '-' return formatDateValue(dateStr) || '-'
return dateStr.substring(0, 10)
} }
/** 返回上一页 */ /** 返回上一页 */

View File

@@ -107,6 +107,7 @@ import { onMounted, ref } from 'vue'
import { useToast } from 'wot-design-uni' import { useToast } from 'wot-design-uni'
import { deleteStockMove, getStockMove, updateStockMoveStatus } from '@/api/erp/stock-move' import { deleteStockMove, getStockMove, updateStockMoveStatus } from '@/api/erp/stock-move'
import { useAccess } from '@/hooks/useAccess' import { useAccess } from '@/hooks/useAccess'
import { formatDate as formatDateValue } from '@/utils/date'
import { navigateBackPlus } from '@/utils' import { navigateBackPlus } from '@/utils'
const props = defineProps<{ const props = defineProps<{
@@ -137,9 +138,8 @@ function formatPrice(price?: number) {
} }
/** 格式化日期 */ /** 格式化日期 */
function formatDate(dateStr?: string) { function formatDate(dateStr?: string | number | Date) {
if (!dateStr) return '-' return formatDateValue(dateStr) || '-'
return dateStr.substring(0, 10)
} }
/** 返回上一页 */ /** 返回上一页 */

View File

@@ -166,6 +166,7 @@ import { computed, onMounted, ref } from 'vue'
import { useToast } from 'wot-design-uni' import { useToast } from 'wot-design-uni'
import { createStockMove, getStockMove, updateStockMove } from '@/api/erp/stock-move' import { createStockMove, getStockMove, updateStockMove } from '@/api/erp/stock-move'
import { getWarehouseSimpleList } from '@/api/erp/warehouse' import { getWarehouseSimpleList } from '@/api/erp/warehouse'
import { formatDate as formatDateValue } from '@/utils/date'
import { navigateBackPlus } from '@/utils' import { navigateBackPlus } from '@/utils'
const props = defineProps<{ const props = defineProps<{
@@ -238,14 +239,8 @@ function formatPrice(price?: number) {
} }
/** 格式化日期 */ /** 格式化日期 */
function formatDate(dateStr?: string) { function formatDate(dateStr?: string | number | Date) {
if (!dateStr) return '-' return formatDateValue(dateStr) || '-'
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)
} }
/** 返回上一页 */ /** 返回上一页 */

View File

@@ -164,6 +164,7 @@ import { computed, onMounted, reactive, ref } from 'vue'
import { useToast } from 'wot-design-uni' import { useToast } from 'wot-design-uni'
import { deleteStockMove, getStockMovePage, updateStockMoveStatus } from '@/api/erp/stock-move' import { deleteStockMove, getStockMovePage, updateStockMoveStatus } from '@/api/erp/stock-move'
import { useAccess } from '@/hooks/useAccess' import { useAccess } from '@/hooks/useAccess'
import { formatDate as formatDateValue } from '@/utils/date'
import { getNavbarHeight, navigateBackPlus } from '@/utils' import { getNavbarHeight, navigateBackPlus } from '@/utils'
definePage({ definePage({
@@ -229,9 +230,8 @@ function formatPrice(price?: number) {
} }
/** 格式化日期 */ /** 格式化日期 */
function formatDate(dateStr?: string) { function formatDate(dateStr?: string | number | Date) {
if (!dateStr) return '-' return formatDateValue(dateStr) || '-'
return dateStr.substring(0, 10)
} }
/** 返回上一页 */ /** 返回上一页 */

View File

@@ -125,6 +125,7 @@ import { onMounted, ref } from 'vue'
import { useToast } from 'wot-design-uni' import { useToast } from 'wot-design-uni'
import { deleteStockOut, getStockOut, updateStockOutStatus } from '@/api/erp/stock-out' import { deleteStockOut, getStockOut, updateStockOutStatus } from '@/api/erp/stock-out'
import { useAccess } from '@/hooks/useAccess' import { useAccess } from '@/hooks/useAccess'
import { formatDate as formatDateValue } from '@/utils/date'
import { navigateBackPlus } from '@/utils' import { navigateBackPlus } from '@/utils'
const props = defineProps<{ const props = defineProps<{
@@ -159,11 +160,8 @@ function formatPrice(price?: number) {
} }
/** 格式化日期 */ /** 格式化日期 */
function formatDate(dateStr?: string) { function formatDate(dateStr?: string | number | Date) {
if (!dateStr) { return formatDateValue(dateStr) || '-'
return '-'
}
return dateStr.substring(0, 10)
} }
/** 返回上一页 */ /** 返回上一页 */
@@ -191,7 +189,7 @@ function handleEdit() {
/** 去扫码执行 */ /** 去扫码执行 */
function handleTaskScan() { 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}` })
} }
/** 审批 */ /** 审批 */

View File

@@ -172,6 +172,7 @@ import { computed, onMounted, ref } from 'vue'
import { useToast } from 'wot-design-uni' import { useToast } from 'wot-design-uni'
import { createStockOut, getStockOut, updateStockOut } from '@/api/erp/stock-out' import { createStockOut, getStockOut, updateStockOut } from '@/api/erp/stock-out'
import { getWarehouseSimpleList } from '@/api/erp/warehouse' import { getWarehouseSimpleList } from '@/api/erp/warehouse'
import { formatDate as formatDateValue } from '@/utils/date'
import { navigateBackPlus } from '@/utils' import { navigateBackPlus } from '@/utils'
const props = defineProps<{ const props = defineProps<{
@@ -258,14 +259,8 @@ function formatPrice(price?: number) {
} }
/** 格式化日期 */ /** 格式化日期 */
function formatDate(dateStr?: string) { function formatDate(dateStr?: string | number | Date) {
if (!dateStr) return '-' return formatDateValue(dateStr) || '-'
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)
} }
/** 返回上一页 */ /** 返回上一页 */

View File

@@ -191,6 +191,7 @@ import { computed, onMounted, reactive, ref } from 'vue'
import { useToast } from 'wot-design-uni' import { useToast } from 'wot-design-uni'
import { deleteStockOut, getStockOutPage, updateStockOutStatus } from '@/api/erp/stock-out' import { deleteStockOut, getStockOutPage, updateStockOutStatus } from '@/api/erp/stock-out'
import { useAccess } from '@/hooks/useAccess' import { useAccess } from '@/hooks/useAccess'
import { formatDate as formatDateValue } from '@/utils/date'
import { getNavbarHeight, navigateBackPlus } from '@/utils' import { getNavbarHeight, navigateBackPlus } from '@/utils'
definePage({ definePage({
@@ -260,10 +261,8 @@ function formatPrice(price?: number) {
} }
/** 格式化日期 */ /** 格式化日期 */
function formatDate(dateStr?: string) { function formatDate(dateStr?: string | number | Date) {
if (!dateStr) return formatDateValue(dateStr) || '-'
return '-'
return dateStr.substring(0, 10)
} }
/** 返回上一页 */ /** 返回上一页 */
@@ -338,7 +337,7 @@ function handleEdit(item: StockOut) {
/** 去扫码执行 */ /** 去扫码执行 */
function handleTaskScan(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}` })
} }
/** 详情 */ /** 详情 */

View File

@@ -182,7 +182,7 @@ const menuGroupsData: MenuGroup[] = [
key: 'stockOutTaskScan', key: 'stockOutTaskScan',
name: '扫码销售出库', name: '扫码销售出库',
icon: 'scan', icon: 'scan',
url: '/pages-erp/stock-out/task-scan/index', url: '/pages-erp/stock-out/scan/index',
iconColor: '#cf1322', iconColor: '#cf1322',
permission: 'erp:stock-out:query', permission: 'erp:stock-out:query',
}, },

View File

@@ -19,16 +19,11 @@ export function formatDate(time?: FormatDate, format: Format = 'YYYY-MM-DD') {
if (!time) { if (!time) {
return '' return ''
} }
try { const date = dayjs.isDayjs(time) ? time : dayjs(time)
const date = dayjs.isDayjs(time) ? time : dayjs(time) if (!date.isValid()) {
if (!date.isValid()) {
throw new Error('Invalid date')
}
return date.format(format)
} catch (error) {
console.error(`Error formatting date: ${error}`)
return String(time ?? '') return String(time ?? '')
} }
return date.format(format)
} }
/** 格式化日期时间 */ /** 格式化日期时间 */