[CLAUDE] FE-PE: Link hồ sơ ổ mạng — render link file:// bấm-thử mở Explorer + giữ Copy dự phòng (x2 app SHA256)
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 4m38s

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
pqhuy1987
2026-06-16 14:52:25 +07:00
parent 6df1b2d7c1
commit 536dd6b569
2 changed files with 46 additions and 14 deletions

View File

@ -1444,8 +1444,9 @@ function HoSoLinkRow({ ev, readOnly = false }: { ev: PeDetailBundle; readOnly?:
{ev.hoSoLink} {ev.hoSoLink}
</a> </a>
) : ( ) : (
// Đường dẫn ổ cứng/ổ mạng (O:\…, \\server) → trình duyệt CHẶN mở file:// // Đường dẫn ổ cứng/ổ mạng (O:\…, \\server) → render link file:// để BẤM-THỬ
// từ https nên bấm sẽ hụt → hiện chữ + nút Copy để dán vào File Explorer. // mở File Explorer (chạy nếu máy/trình duyệt cho phép, vd máy domain map sẵn
// ổ mạng) + nút Copy dự phòng (default Chrome chặn https→file:// thì dùng Copy).
<PathWithCopy path={ev.hoSoLink} /> <PathWithCopy path={ev.hoSoLink} />
) )
) : ( ) : (
@ -1456,9 +1457,18 @@ function HoSoLinkRow({ ev, readOnly = false }: { ev: PeDetailBundle; readOnly?:
) )
} }
// e.bis — Đường dẫn ổ cứng/ổ mạng (không phải http) → chữ + nút Copy. Trình duyệt // Đổi đường dẫn Windows → URL file:// (O:\DATA\x → file:///O:/DATA/x · \\srv\share → file://srv/share).
// CHẶN mở file:// từ trang https nên KHÔNG render <a> bấm-mở (bấm sẽ hụt); thay function toFileUrl(p: string): string {
// bằng Copy → người dùng dán vào File Explorer (máy có map ổ mạng là mở ngay). const slashed = p.trim().replace(/\\/g, '/')
const url = slashed.startsWith('//') ? 'file:' + slashed : 'file:///' + slashed
return encodeURI(url)
}
// e.bis — Đường dẫn ổ cứng/ổ mạng (không phải http). Render LINK file:// để BẤM-THỬ
// mở File Explorer + nút Copy dự phòng. Bấm-mở chỉ chạy khi máy được cấu hình:
// Edge bật policy IntranetFileLinksEnabled (GPO 1 lần/domain, KHÔNG cài per-máy) +
// host trong Intranet Zone. Default Chrome/Edge CHẶN https→file:// (bấm no-op) →
// khi đó dùng nút Copy dán vào File Explorer (máy đã map ổ mạng là mở ngay).
function PathWithCopy({ path }: { path: string }) { function PathWithCopy({ path }: { path: string }) {
const [copied, setCopied] = useState(false) const [copied, setCopied] = useState(false)
const copy = async () => { const copy = async () => {
@ -1472,9 +1482,15 @@ function PathWithCopy({ path }: { path: string }) {
} }
return ( return (
<div className="flex max-w-2xl items-start gap-2"> <div className="flex max-w-2xl items-start gap-2">
<code className="min-w-0 flex-1 break-all rounded bg-slate-50 px-2 py-1 text-[13px] text-brand-800 ring-1 ring-slate-200"> <a
href={toFileUrl(path)}
target="_blank"
rel="noopener noreferrer"
className="min-w-0 flex-1 break-all rounded bg-slate-50 px-2 py-1 text-[13px] text-brand-700 ring-1 ring-slate-200 transition hover:bg-brand-50 hover:underline"
title="Bấm mở trong File Explorer (cần Edge + IT bật policy). Không mở được thì bấm Copy rồi dán vào File Explorer."
>
{path} {path}
</code> </a>
<Button <Button
type="button" type="button"
variant="outline" variant="outline"

View File

@ -1444,8 +1444,9 @@ function HoSoLinkRow({ ev, readOnly = false }: { ev: PeDetailBundle; readOnly?:
{ev.hoSoLink} {ev.hoSoLink}
</a> </a>
) : ( ) : (
// Đường dẫn ổ cứng/ổ mạng (O:\…, \\server) → trình duyệt CHẶN mở file:// // Đường dẫn ổ cứng/ổ mạng (O:\…, \\server) → render link file:// để BẤM-THỬ
// từ https nên bấm sẽ hụt → hiện chữ + nút Copy để dán vào File Explorer. // mở File Explorer (chạy nếu máy/trình duyệt cho phép, vd máy domain map sẵn
// ổ mạng) + nút Copy dự phòng (default Chrome chặn https→file:// thì dùng Copy).
<PathWithCopy path={ev.hoSoLink} /> <PathWithCopy path={ev.hoSoLink} />
) )
) : ( ) : (
@ -1456,9 +1457,18 @@ function HoSoLinkRow({ ev, readOnly = false }: { ev: PeDetailBundle; readOnly?:
) )
} }
// e.bis — Đường dẫn ổ cứng/ổ mạng (không phải http) → chữ + nút Copy. Trình duyệt // Đổi đường dẫn Windows → URL file:// (O:\DATA\x → file:///O:/DATA/x · \\srv\share → file://srv/share).
// CHẶN mở file:// từ trang https nên KHÔNG render <a> bấm-mở (bấm sẽ hụt); thay function toFileUrl(p: string): string {
// bằng Copy → người dùng dán vào File Explorer (máy có map ổ mạng là mở ngay). const slashed = p.trim().replace(/\\/g, '/')
const url = slashed.startsWith('//') ? 'file:' + slashed : 'file:///' + slashed
return encodeURI(url)
}
// e.bis — Đường dẫn ổ cứng/ổ mạng (không phải http). Render LINK file:// để BẤM-THỬ
// mở File Explorer + nút Copy dự phòng. Bấm-mở chỉ chạy khi máy được cấu hình:
// Edge bật policy IntranetFileLinksEnabled (GPO 1 lần/domain, KHÔNG cài per-máy) +
// host trong Intranet Zone. Default Chrome/Edge CHẶN https→file:// (bấm no-op) →
// khi đó dùng nút Copy dán vào File Explorer (máy đã map ổ mạng là mở ngay).
function PathWithCopy({ path }: { path: string }) { function PathWithCopy({ path }: { path: string }) {
const [copied, setCopied] = useState(false) const [copied, setCopied] = useState(false)
const copy = async () => { const copy = async () => {
@ -1472,9 +1482,15 @@ function PathWithCopy({ path }: { path: string }) {
} }
return ( return (
<div className="flex max-w-2xl items-start gap-2"> <div className="flex max-w-2xl items-start gap-2">
<code className="min-w-0 flex-1 break-all rounded bg-slate-50 px-2 py-1 text-[13px] text-brand-800 ring-1 ring-slate-200"> <a
href={toFileUrl(path)}
target="_blank"
rel="noopener noreferrer"
className="min-w-0 flex-1 break-all rounded bg-slate-50 px-2 py-1 text-[13px] text-brand-700 ring-1 ring-slate-200 transition hover:bg-brand-50 hover:underline"
title="Bấm mở trong File Explorer (cần Edge + IT bật policy). Không mở được thì bấm Copy rồi dán vào File Explorer."
>
{path} {path}
</code> </a>
<Button <Button
type="button" type="button"
variant="outline" variant="outline"