feat: 优化凭证和开票记录的日期范围查询,使用 dayjs 精确处理起止时间
This commit is contained in:
parent
948ac409df
commit
def0d75840
@ -1,5 +1,6 @@
|
||||
<script setup>
|
||||
import { h, onMounted, ref, resolveDirective, withDirectives } from 'vue'
|
||||
import dayjs from 'dayjs'
|
||||
import { NButton, NInput, NTag, NSelect, NDatePicker } from 'naive-ui'
|
||||
|
||||
import CommonPage from '@/components/page/CommonPage.vue'
|
||||
@ -7,7 +8,7 @@ import QueryBarItem from '@/components/query-bar/QueryBarItem.vue'
|
||||
import CrudTable from '@/components/table/CrudTable.vue'
|
||||
import InvoiceModal from './InvoiceModal.vue'
|
||||
|
||||
import { formatDate } from '@/utils'
|
||||
import { formatDate, formatDateTime } from '@/utils'
|
||||
import api from '@/api'
|
||||
|
||||
defineOptions({ name: '开票记录' })
|
||||
@ -20,6 +21,18 @@ const vPermission = resolveDirective('permission')
|
||||
const invoiceModalVisible = ref(false)
|
||||
const invoiceModalMode = ref('view') // 'send' 或 'view'
|
||||
const currentInvoice = ref(null)
|
||||
const submittedDateRange = ref(null)
|
||||
|
||||
const handleDateRangeChange = (val) => {
|
||||
if (val && val.length === 2) {
|
||||
queryItems.value.submitted_start = dayjs(val[0]).startOf('day').format('YYYY-MM-DD HH:mm:ss')
|
||||
queryItems.value.submitted_end = dayjs(val[1]).endOf('day').format('YYYY-MM-DD HH:mm:ss')
|
||||
} else {
|
||||
queryItems.value.submitted_start = null
|
||||
queryItems.value.submitted_end = null
|
||||
}
|
||||
$table.value?.handleSearch()
|
||||
}
|
||||
|
||||
// 状态选项
|
||||
const statusOptions = [
|
||||
@ -271,12 +284,12 @@ async function handleInvoiceConfirm(formData) {
|
||||
<template #queryBar>
|
||||
<QueryBarItem label="提交时间" :label-width="80">
|
||||
<NDatePicker
|
||||
v-model:value="queryItems.submitted_at"
|
||||
v-model:value="submittedDateRange"
|
||||
type="daterange"
|
||||
clearable
|
||||
placeholder="请选择提交时间"
|
||||
style="width: 280px"
|
||||
@update:value="$table?.handleSearch()"
|
||||
@update:value="handleDateRangeChange"
|
||||
/>
|
||||
</QueryBarItem>
|
||||
<QueryBarItem label="手机号" :label-width="80">
|
||||
|
||||
@ -1,18 +1,31 @@
|
||||
<script setup>
|
||||
import { h, onMounted, ref } from 'vue'
|
||||
import dayjs from 'dayjs'
|
||||
import { NTag, NButton, NInput, NSelect, NDatePicker } from 'naive-ui'
|
||||
|
||||
import CommonPage from '@/components/page/CommonPage.vue'
|
||||
import QueryBarItem from '@/components/query-bar/QueryBarItem.vue'
|
||||
import CrudTable from '@/components/table/CrudTable.vue'
|
||||
|
||||
import { formatDate } from '@/utils'
|
||||
import { formatDate, formatDateTime } from '@/utils'
|
||||
import api from '@/api'
|
||||
|
||||
defineOptions({ name: '交易记录' })
|
||||
|
||||
const $table = ref(null)
|
||||
const queryItems = ref({})
|
||||
const submittedDateRange = ref(null)
|
||||
|
||||
const handleDateRangeChange = (val) => {
|
||||
if (val && val.length === 2) {
|
||||
queryItems.value.submitted_start = dayjs(val[0]).startOf('day').format('YYYY-MM-DD HH:mm:ss')
|
||||
queryItems.value.submitted_end = dayjs(val[1]).endOf('day').format('YYYY-MM-DD HH:mm:ss')
|
||||
} else {
|
||||
queryItems.value.submitted_start = null
|
||||
queryItems.value.submitted_end = null
|
||||
}
|
||||
$table.value?.handleSearch()
|
||||
}
|
||||
|
||||
const statusOptions = [
|
||||
{ label: '全部', value: '' },
|
||||
@ -83,12 +96,12 @@ const columns = [
|
||||
<template #queryBar>
|
||||
<QueryBarItem label="凭证时间" :label-width="80">
|
||||
<NDatePicker
|
||||
v-model:value="queryItems.created_at"
|
||||
v-model:value="submittedDateRange"
|
||||
type="daterange"
|
||||
clearable
|
||||
placeholder="请选择凭证时间"
|
||||
style="width: 280px"
|
||||
@update:value="$table?.handleSearch()"
|
||||
@update:value="handleDateRangeChange"
|
||||
/>
|
||||
</QueryBarItem>
|
||||
<QueryBarItem label="手机号" :label-width="80">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user