This commit is contained in:
zlwu committed 2026-05-25 15:14:06 +08:00
1 parent 575e63e7e8
commit 771f010a39
165 files changed
+67359 -21698

No files matched your search

@@ -22,9 +22,20 @@
clearable
/>
</el-form-item>
<el-form-item label="创建时间">
<el-date-picker
v-model="createTimeRange"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="YYYY-MM-DD"
style="width: 100%"
/>
</el-form-item>
</div>
<div class="filter-actions-row">
<span class="filter-hint">支持模糊查询。</span>
<span class="filter-hint">支持模糊查询;默认展示近 30 天内创建的客户。</span>
<div class="filter-actions-end">
<el-button class="btn-ghost" @click="handleReset"><el-icon><RefreshLeft /></el-icon>重置</el-button>
<el-button class="btn-main" type="primary" @click="handleSearch"><el-icon><Search /></el-icon>搜索</el-button>
@@ -239,7 +250,22 @@
defineOptions({ name: 'BizCustomer' })
function formatLocalDate(d: Date): string {
const y = d.getFullYear()
const m = String(d.getMonth() + 1).padStart(2, '0')
const day = String(d.getDate()).padStart(2, '0')
return `${y}-${m}-${day}`
}
function getDefaultCreateTimeRange(): [string, string] {
const end = new Date()
const start = new Date()
start.setDate(start.getDate() - 30)
return [formatLocalDate(start), formatLocalDate(end)]
}
const searchForm = reactive<{ keyword: string }>({ keyword: '' })
const createTimeRange = ref<[string, string] | null>(getDefaultCreateTimeRange())
const tableData = ref<Api.BizCustomer.CustomerItem[]>([])
const selectedRows = ref<Api.BizCustomer.CustomerItem[]>([])
const loading = ref(false)
@@ -303,7 +329,9 @@
const res = await fetchCustomerList({
page: pagination.page,
pageSize: pagination.pageSize,
keyword: searchForm.keyword || undefined
keyword: searchForm.keyword || undefined,
createTimeStart: createTimeRange.value?.[0] || undefined,
createTimeEnd: createTimeRange.value?.[1] || undefined
})
tableData.value = res.list || []
pagination.total = res.total ?? 0
@@ -319,6 +347,7 @@
function handleReset() {
searchForm.keyword = ''
createTimeRange.value = getDefaultCreateTimeRange()
pagination.page = 1
loadData()
}
@@ -412,7 +441,7 @@
}
// 输入检索条件时自动搜索(防抖 300ms)
watchDebounced(
searchForm,
[searchForm, createTimeRange],
() => {
pagination.page = 1
loadData()