From 82930f4e41c58b6f467215175c7d9c5db5d18fd4 Mon Sep 17 00:00:00 2001 From: xiaoshi <115949669+xiaoshi930@users.noreply.github.com> Date: Fri, 28 Nov 2025 12:15:06 +0800 Subject: [PATCH] Update xiaoshi-device-update-card.js --- xiaoshi-device-update-card.js | 71 ++++++++++++++++++++--------------- 1 file changed, 40 insertions(+), 31 deletions(-) diff --git a/xiaoshi-device-update-card.js b/xiaoshi-device-update-card.js index e0a36e7..3bd9c26 100644 --- a/xiaoshi-device-update-card.js +++ b/xiaoshi-device-update-card.js @@ -159,7 +159,6 @@ export class XiaoshiUpdateCard extends LitElement { align-items: center; padding: 16px; background: var(--bg-color, #fff); - border-radius: 12px; } @@ -189,7 +188,6 @@ export class XiaoshiUpdateCard extends LitElement { display: flex; align-items: center; justify-content: center; - } /*标题统计数字*/ @@ -271,7 +269,8 @@ export class XiaoshiUpdateCard extends LitElement { align-items: center; padding: 0px; border-bottom: 1px solid rgb(150,150,150,0.2); - margin: 0 24px 8px 32px; + margin: 0 32px 4px 32px; + padding: 4px 0 0 0; } /*设备、实体明细背景*/ @@ -279,7 +278,7 @@ export class XiaoshiUpdateCard extends LitElement { flex: 1; overflow-y: auto; min-height: 0; - padding: 0 0 8px 0; + padding: 4px 0; } .device-icon { @@ -294,7 +293,7 @@ export class XiaoshiUpdateCard extends LitElement { .device-name { font-weight: 500; color: var(--fg-color, #000); - margin-bottom: 4px; + margin: 2px 0; } .device-entity { @@ -306,7 +305,6 @@ export class XiaoshiUpdateCard extends LitElement { .device-details { font-size: 10px; color: var(--fg-color, #000); - margin-top: 4px; } .device-last-seen { @@ -327,13 +325,13 @@ export class XiaoshiUpdateCard extends LitElement { .no-devices { text-align: center; - padding: 8px 0 0 0; + padding: 8px 0; color: var(--fg-color, #000); } .loading { text-align: center; - padding: 0px; + padding: 10px 0px; color: var(--fg-color, #000); } @@ -409,12 +407,12 @@ export class XiaoshiUpdateCard extends LitElement { /* 备份信息独立容器 */ .backup-info { padding: 4px 0 4px 16px; - margin: 0 16px 0 30px; - border-bottom: 1px solid rgb(150,150,150,0.2); + margin: 0 32px 8px 32px; display: grid; grid-template-columns: auto auto auto; gap: 4px; align-items: center; + border-bottom: 1px solid rgb(150,150,150,0.2); } `; } @@ -469,6 +467,17 @@ export class XiaoshiUpdateCard extends LitElement { } } + _handleEntityClick(entity) { + navigator.vibrate(50); + // 点击实体时打开实体详情页 + if (entity.entity_id) { + // 使用您建议的第一种方式 + const evt = new Event('hass-more-info', { composed: true }); + evt.detail = { entityId: entity.entity_id }; + this.dispatchEvent(evt); + } + } + async _loadUpdateData() { if (!this.hass) return; @@ -542,14 +551,10 @@ export class XiaoshiUpdateCard extends LitElement { this._loading = false; } - - _handleRefresh() { this._loadUpdateData(); navigator.vibrate(50); } - - _handleUpdateClick(update) { navigator.vibrate(50); @@ -581,6 +586,10 @@ export class XiaoshiUpdateCard extends LitElement { if (confirmed) { this._executeUpdate(update); + // 延迟3秒后刷新数据,给更新操作足够时间完成 + setTimeout(() => { + this._loadUpdateData(); + }, 1000); } } @@ -822,19 +831,9 @@ export class XiaoshiUpdateCard extends LitElement { ${this._renderHAVersionInfo()} - -