feat(M08-B): 补保洁员资料管理
This commit is contained in:
@@ -2,6 +2,9 @@
|
||||
<section class="panel">
|
||||
<div class="panel-toolbar">
|
||||
<el-form class="stats-filter" label-position="top">
|
||||
<el-form-item label="周期">
|
||||
<el-segmented :options="quickOptions" @update:model-value="applyQuickRange" />
|
||||
</el-form-item>
|
||||
<el-form-item label="开始">
|
||||
<el-input v-model="filterDraft.from" placeholder="2026-06-01" />
|
||||
</el-form-item>
|
||||
@@ -130,6 +133,11 @@ const emit = defineEmits<{
|
||||
}>();
|
||||
|
||||
const filterDraft = reactive({ ...props.filters });
|
||||
const quickOptions = [
|
||||
{ label: '今日', value: 'today' },
|
||||
{ label: '近7天', value: '7d' },
|
||||
{ label: '本月', value: 'month' }
|
||||
];
|
||||
|
||||
watch(
|
||||
() => props.filters,
|
||||
@@ -144,4 +152,26 @@ function emitFilter() {
|
||||
storeId: filterDraft.storeId.trim()
|
||||
});
|
||||
}
|
||||
|
||||
function applyQuickRange(value: string | number | boolean) {
|
||||
const now = new Date();
|
||||
const end = new Date(now.getFullYear(), now.getMonth(), now.getDate() + 1);
|
||||
let start = new Date(now.getFullYear(), now.getMonth(), now.getDate());
|
||||
if (value === '7d') {
|
||||
start = new Date(now.getFullYear(), now.getMonth(), now.getDate() - 6);
|
||||
}
|
||||
if (value === 'month') {
|
||||
start = new Date(now.getFullYear(), now.getMonth(), 1);
|
||||
}
|
||||
filterDraft.from = formatDate(start);
|
||||
filterDraft.to = formatDate(end);
|
||||
emitFilter();
|
||||
}
|
||||
|
||||
function formatDate(date: Date) {
|
||||
const year = date.getFullYear();
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0');
|
||||
const day = String(date.getDate()).padStart(2, '0');
|
||||
return `${year}-${month}-${day}`;
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user