fix(主系统绑定): 回填绑定标为 backfill、绑定时间按本地时区
CI / server typecheck + tests (push) Canceled after 0s
CI / web typecheck + tests + miniprogram syntax (push) Canceled after 0s
CI / eslint (观察项,C7 骨架) (push) Canceled after 0s
CI / npm audit (critical 硬拦) (push) Canceled after 0s

迁移 20261031 两处回填的 source 由 manual 改 backfill(与超管手工登记可区分,符合设计 V10),新增迁移 20261041 回标存量行(按 note 精确识别、幂等),服务层 source 类型同步;BranchManagement 绑定弹层时间改本地时区(原按 UTC 截断,差 8 小时)。
This commit is contained in:
雨天
2026-10-13 10:45:56 +08:00
parent 93b75ad5f9
commit 17957fe120
6 changed files with 94 additions and 9 deletions
+11 -2
View File
@@ -5,7 +5,8 @@ import { useAuth } from '../../hooks/useAuth';
import { notify } from '../../utils/notify';
import { confirmDialog } from '../../utils/confirmDialog';
import { MenuLabel } from '../../components/MenuLabel';
import { useT } from '../../i18n';
import { useT, useI18n } from '../../i18n';
import { UI_LOCALE_BCP47 } from '../../i18n/config';
import { isPlatformBranchCode } from '../../utils/platformBranch';
import { BRANCH_TAX_LEVELS, normalizeBranchTaxLevel } from '../../utils/branchTaxLevel';
import { SearchableSelect } from '../../components/ui/SearchableSelect';
@@ -92,7 +93,15 @@ function validateLogin(value: string, t: (k: string, v?: Record<string, string |
export const BranchManagement: React.FC = () => {
const t = useT();
const { locale } = useI18n();
const { hasRole } = useAuth();
/** 绑定时间按**本地时区**显示(后端给的是 UTC ISO;此前 `slice(0,19)` 直接切字符 ⇒ 差 8 小时) */
const formatBoundAt = (iso: string | null | undefined) => {
const raw = String(iso || '').trim();
if (!raw) return '-';
const d = new Date(raw);
return Number.isNaN(d.getTime()) ? raw : d.toLocaleString(UI_LOCALE_BCP47[locale]);
};
const [branches, setBranches] = useState<Branch[]>([]);
const { initialLoading: loading, refreshing, startLoad, finishLoad } = useListLoadState();
const [saving, setSaving] = useState(false);
@@ -754,7 +763,7 @@ export const BranchManagement: React.FC = () => {
</span>
</td>
<td className="px-3 py-2 text-xs text-slate-500">
{(item.status === 'active' ? item.boundAt : item.unboundAt || item.boundAt)?.slice(0, 19).replace('T', ' ') || '-'}
{formatBoundAt(item.status === 'active' ? item.boundAt : item.unboundAt || item.boundAt)}
</td>
</tr>
))}