工单创建时间改用 Ant RangePicker,一次弹层选起止并与筛选同步。
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
* 详情/关单弹窗必须用 AdminModal:本工程 ant-design-vue 3 的 a-modal 只认 visible,
|
||||
* v-model:open 不会弹出(账号/角色页已统一走 AdminModal)。
|
||||
*/
|
||||
import { onMounted, reactive, ref, watch } from "vue";
|
||||
import { computed, onMounted, reactive, ref, watch } from "vue";
|
||||
import { message, Modal } from "ant-design-vue";
|
||||
import {
|
||||
getWorkOrderDetail,
|
||||
@@ -67,29 +67,20 @@ const closeOpen = ref(false);
|
||||
const current = ref<TicketRow | null>(null);
|
||||
const closeReason = ref("");
|
||||
|
||||
/** 创建时间起止:原生 date 叠在文案上,点文字也能弹出日历 */
|
||||
const dateFromRef = ref<HTMLInputElement | null>(null);
|
||||
const dateToRef = ref<HTMLInputElement | null>(null);
|
||||
|
||||
/**
|
||||
* 打开系统日期面板。
|
||||
* 点「开始/结束日期」文案时调用;优先 HTMLInputElement.showPicker。
|
||||
* 不在此处再 el.click(),避免与 input 的 click 互相重入。
|
||||
* WebKit 另靠 CSS 把 calendar-picker-indicator 铺满热区兜底。
|
||||
* 创建时间范围:与 filters.dateFrom/dateTo 双向同步。
|
||||
* RangePicker 一次弹层点选起止两天;valueFormat 固定 YYYY-MM-DD 给列表 API。
|
||||
*/
|
||||
function openDatePicker(which: "from" | "to") {
|
||||
const el = which === "from" ? dateFromRef.value : dateToRef.value;
|
||||
if (!el) return;
|
||||
try {
|
||||
if (typeof (el as HTMLInputElement & { showPicker?: () => void }).showPicker === "function") {
|
||||
(el as HTMLInputElement & { showPicker: () => void }).showPicker();
|
||||
} else {
|
||||
el.focus();
|
||||
}
|
||||
} catch {
|
||||
el.focus();
|
||||
}
|
||||
}
|
||||
const dateRange = computed({
|
||||
get(): [string, string] | undefined {
|
||||
if (!filters.dateFrom && !filters.dateTo) return undefined;
|
||||
return [filters.dateFrom || "", filters.dateTo || ""];
|
||||
},
|
||||
set(v: [string, string] | null | undefined) {
|
||||
filters.dateFrom = v?.[0] ? String(v[0]) : "";
|
||||
filters.dateTo = v?.[1] ? String(v[1]) : "";
|
||||
},
|
||||
});
|
||||
|
||||
function dash(v: any) {
|
||||
const s = (v ?? "").toString().trim();
|
||||
@@ -438,34 +429,19 @@ function refresh() {
|
||||
<option value="多段联运">多段联运</option>
|
||||
</select>
|
||||
<div class="toolbar-date-range" title="按创建时间筛选">
|
||||
<ProtoIcon name="calendar" :size="14" class="toolbar-date-icon" />
|
||||
<div class="toolbar-date-part" @click="openDatePicker('from')">
|
||||
<span class="toolbar-date-label" :class="{ 'is-placeholder': !filters.dateFrom }">
|
||||
{{ filters.dateFrom || "开始日期" }}
|
||||
</span>
|
||||
<input
|
||||
ref="dateFromRef"
|
||||
v-model="filters.dateFrom"
|
||||
type="date"
|
||||
class="toolbar-date-native"
|
||||
aria-label="创建时间起"
|
||||
@click.stop="openDatePicker('from')"
|
||||
/>
|
||||
</div>
|
||||
<span class="toolbar-date-sep">至</span>
|
||||
<div class="toolbar-date-part" @click="openDatePicker('to')">
|
||||
<span class="toolbar-date-label" :class="{ 'is-placeholder': !filters.dateTo }">
|
||||
{{ filters.dateTo || "结束日期" }}
|
||||
</span>
|
||||
<input
|
||||
ref="dateToRef"
|
||||
v-model="filters.dateTo"
|
||||
type="date"
|
||||
class="toolbar-date-native"
|
||||
aria-label="创建时间止"
|
||||
@click.stop="openDatePicker('to')"
|
||||
/>
|
||||
</div>
|
||||
<a-range-picker
|
||||
v-model:value="dateRange"
|
||||
class="toolbar-range-picker"
|
||||
value-format="YYYY-MM-DD"
|
||||
separator="至"
|
||||
:placeholder="['开始日期', '结束日期']"
|
||||
:allow-clear="true"
|
||||
:input-read-only="true"
|
||||
>
|
||||
<template #suffixIcon>
|
||||
<ProtoIcon name="calendar" :size="14" />
|
||||
</template>
|
||||
</a-range-picker>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user