工单筛选日期控件对齐原型:可见文案、点选即弹日历。
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -67,6 +67,30 @@ 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 铺满热区兜底。
|
||||
*/
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
function dash(v: any) {
|
||||
const s = (v ?? "").toString().trim();
|
||||
return s ? s : "-";
|
||||
@@ -414,9 +438,34 @@ function refresh() {
|
||||
<option value="多段联运">多段联运</option>
|
||||
</select>
|
||||
<div class="toolbar-date-range" title="按创建时间筛选">
|
||||
<input v-model="filters.dateFrom" type="date" aria-label="创建时间起" />
|
||||
<span class="toolbar-date-sep">–</span>
|
||||
<input v-model="filters.dateTo" type="date" aria-label="创建时间止" />
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user