fix: 日期选择合并为daterange; 搜索框+日期选择移至标题行

- 两个独立month picker合并为一个daterange选择器
- 日期选择+搜索框移至我的工作数据标题同行
- 搜索框增加搜索按钮
- 移除新建按钮

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-07-13 01:25:52 +08:00
parent 7699e88578
commit 392380ab51
+18 -17
View File
@@ -14,8 +14,7 @@ const loading = ref(false)
const allManagers = ref<any[]>([])
// Date range filter
const dateFrom = ref('')
const dateTo = ref('')
const dateRange = ref<any>(null)
const searchText = ref('')
const pageSize = ref(25)
@@ -30,7 +29,10 @@ const page = ref<Record<string, number>>({ visits: 1, notes: 1, plans: 1, mini:
const total = ref<Record<string, number>>({ visits: 0, notes: 0, plans: 0, mini: 0, key: 0 })
function getDateRange() {
return { from: dateFrom.value, to: dateTo.value }
if (dateRange.value && Array.isArray(dateRange.value) && dateRange.value.length === 2) {
return { from: dateRange.value[0], to: dateRange.value[1] }
}
return { from: '', to: '' }
}
const customers = ref<any[]>([])
const allUsers = ref<any[]>([])
@@ -344,20 +346,17 @@ const notesByDate = computed(() => {
<template>
<div class="workspace" v-loading="loading">
<div class="page-head">
<h2 class="page-title">我的工作数据</h2>
<div class="page-rule"></div>
</div>
<!-- Filter Bar -->
<div class="filter-bar">
<div class="filter-row">
<el-date-picker v-model="dateFrom" type="month" placeholder="开始月份" size="small" style="width:140px" value-format="YYYY-MM-DD" @change="onFilterChange" />
<span style="color:var(--warm-gray);font-size:13px"></span>
<el-date-picker v-model="dateTo" type="month" placeholder="结束月份" size="small" style="width:140px" value-format="YYYY-MM-DD" @change="onFilterChange" />
<el-button v-if="dateFrom || dateTo" size="small" @click="dateFrom='';dateTo='';onFilterChange()">清除</el-button>
<el-input v-model="searchText" placeholder="搜索..." clearable size="small" style="width:180px" @keyup.enter="onFilterChange" @clear="onFilterChange" />
<el-button type="primary" size="small" @click="openCreate(activeTab === 'notes' ? 'note' : activeTab === 'plans' ? 'plan' : activeTab === 'mini' ? 'mini' : activeTab === 'key' ? 'key' : 'visit')" style="margin-left:auto">+ 新建</el-button>
<div class="page-head-row">
<h2 class="page-title">我的工作数据</h2>
<div class="page-head-controls">
<el-date-picker v-model="dateRange" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" size="small" style="width:260px" value-format="YYYY-MM-DD" @change="onFilterChange" />
<el-button v-if="dateRange" size="small" @click="dateRange=null;onFilterChange()">清除</el-button>
<el-input v-model="searchText" placeholder="搜索..." clearable size="small" style="width:180px" @keyup.enter="onFilterChange" @clear="onFilterChange">
<template #append><el-button @click="onFilterChange">🔍</el-button></template>
</el-input>
</div>
</div>
<div class="page-rule"></div>
</div>
<el-card>
@@ -637,7 +636,9 @@ const notesByDate = computed(() => {
<style scoped>
.page-head { margin-bottom: 20px; }
.page-title { margin: 0; font-family: var(--font-heading); font-size: 22px; font-weight: 400; color: var(--ink); letter-spacing: 0.06em; }
.page-head-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.page-head-controls { display: flex; align-items: center; gap: 8px; }
.page-title { margin: 0; font-family: var(--font-heading); font-size: 22px; font-weight: 400; color: var(--ink); letter-spacing: 0.06em; white-space: nowrap; }
.page-rule { width: 32px; height: 3px; background: var(--gold); margin-top: 12px; }
.date-group { margin-bottom: 20px; }
.date-title { display: flex; align-items: center; margin: 12px 0 8px; font-family: var(--font-heading); font-size: 14px; color: var(--ink); letter-spacing: 0.04em; }