From 54cfb70a431eed6ec0c972c523ba684f4981e6e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E8=87=AA=E8=BE=BE?= <980324341@qq.com> Date: Fri, 9 Oct 2026 20:56:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B6=E5=8F=A3(=E6=97=B6=E9=97=B4=E6=8E=A7?= =?UTF-8?q?=E4=BB=B6):=20=E5=90=8E=E7=AE=A1=208=20=E5=AF=B9=E8=B5=B7?= =?UTF-8?q?=E6=AD=A2=E5=8A=A0=20min/max=20=E7=A6=81=E9=80=89=20+=20?= =?UTF-8?q?=E5=80=92=E6=8C=82=E4=BA=A4=E6=8D=A2=EF=BC=8C=E5=B9=B6=E8=90=BD?= =?UTF-8?q?=E5=85=A8=E9=A1=B9=E7=9B=AE=E5=B0=BA=E5=AD=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 指令是"项目所有的前端时间控件 开始日期不能晚于结束日期"。普查(ops 仓 scripts/_census_time_controls.py)数出 55 个控件实例、21 个成对区间,裸奔的是 后管 8 对与麦象控制台 2 对:起止能选到倒挂,查询恒定返回空表且页面没有任何提示。 - utils/datetime.ts 新增 orderedPair;8 页两头各绑 :max/:min,并在 @change 把 倒挂的两端交换回状态——min/max 只灰掉日历面板里的非法日,手输、粘贴仍能越界。 - tests/date-range-order.test.ts(10 例):分母硬钉 19/2/30/4 实例与 8/0/11/2 对, 含真文件反例自证(裸对、只一头、只有 min/max、换成没登记的写法都要露出来); 同时钉住财务系统与麦象的分母,那两面回归也会在这支判红。 - tests/mount/date-range-order.mount.test.ts(3 例):真组件填倒挂值 → 两头落回 有序,且发出去的 startDate/endDate 同一条。 - 摘掉 DedupeRegistryPage 导出与 DuplicateCheckPage 查询里的两条 "开始日期不能晚于结束日期"拦截(交换接管后够不着,属死分支), task-254 那条"导出需做日期区间校验"的钉子改指 min/max + clampDatePair。 验证:npm test 1792 passed / 0 failed、vitest mount 10 passed、vue-tsc rc=0。 --- .../src/pages/account/UserSecretUsagePage.vue | 13 +- .../src/pages/asin/DedupeRegistryPage.vue | 18 +- .../src/pages/records/DeviceLogsPage.vue | 13 +- .../src/pages/records/RecordsHistoryPage.vue | 13 +- .../pages/task-center/TaskCenterBoardPage.vue | 13 +- .../src/pages/tasks/DuplicateCheckPage.vue | 16 +- .../src/pages/tasks/ImageVideoTasksPage.vue | 12 +- .../src/pages/tasks/ShopDataTasksPage.vue | 12 +- admin-frontend-vue/src/utils/datetime.ts | 9 + .../tests/date-range-order.test.ts | 311 ++++++++++++++++++ .../mount/date-range-order.mount.test.ts | 80 +++++ admin-frontend-vue/tests/task-254.test.ts | 2 +- 12 files changed, 479 insertions(+), 33 deletions(-) create mode 100644 admin-frontend-vue/tests/date-range-order.test.ts create mode 100644 admin-frontend-vue/tests/mount/date-range-order.mount.test.ts diff --git a/admin-frontend-vue/src/pages/account/UserSecretUsagePage.vue b/admin-frontend-vue/src/pages/account/UserSecretUsagePage.vue index e82b0c26e..3e34ea436 100644 --- a/admin-frontend-vue/src/pages/account/UserSecretUsagePage.vue +++ b/admin-frontend-vue/src/pages/account/UserSecretUsagePage.vue @@ -2,7 +2,7 @@ import { computed, onMounted, ref, watch } from 'vue' import { ElMessage } from 'element-plus' import OldPagination from '@/components/OldPagination.vue' -import { todayDateInput } from '@/utils/datetime' +import { orderedPair, todayDateInput } from '@/utils/datetime' import { fetchUserSecretUsage, type AdminUserSecretUsageRow, @@ -24,6 +24,13 @@ const pageSize = ref(15) const keyword = ref('') const startDate = ref(todayDateInput()) const endDate = ref(todayDateInput()) +/** min/max 挡不住手输,落值后把倒挂的起止交换回来。 */ +function clampDatePair(): void { + const [s, e] = orderedPair(startDate.value, endDate.value) + startDate.value = s + endDate.value = e +} + const groupFilter = ref(null) const groupOptions = ref([]) @@ -127,11 +134,11 @@ onMounted(load)
- +
- +
diff --git a/admin-frontend-vue/src/pages/asin/DedupeRegistryPage.vue b/admin-frontend-vue/src/pages/asin/DedupeRegistryPage.vue index 6eaf9e468..f05aefb1b 100644 --- a/admin-frontend-vue/src/pages/asin/DedupeRegistryPage.vue +++ b/admin-frontend-vue/src/pages/asin/DedupeRegistryPage.vue @@ -1,5 +1,5 @@