[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
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:
@ -1444,8 +1444,9 @@ function HoSoLinkRow({ ev, readOnly = false }: { ev: PeDetailBundle; readOnly?:
|
||||
{ev.hoSoLink}
|
||||
</a>
|
||||
) : (
|
||||
// Đường dẫn ổ cứng/ổ mạng (O:\…, \\server) → trình duyệt CHẶN mở file://
|
||||
// từ https nên bấm sẽ hụt → hiện chữ + nút Copy để dán vào File Explorer.
|
||||
// Đường dẫn ổ cứng/ổ mạng (O:\…, \\server) → render link file:// để BẤM-THỬ
|
||||
// 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} />
|
||||
)
|
||||
) : (
|
||||
@ -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
|
||||
// CHẶN mở file:// từ trang https nên KHÔNG render <a> bấm-mở (bấm sẽ hụt); thay
|
||||
// bằng Copy → người dùng dán vào File Explorer (máy có map ổ mạng là mở ngay).
|
||||
// Đổi đường dẫn Windows → URL file:// (O:\DATA\x → file:///O:/DATA/x · \\srv\share → file://srv/share).
|
||||
function toFileUrl(p: string): string {
|
||||
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 }) {
|
||||
const [copied, setCopied] = useState(false)
|
||||
const copy = async () => {
|
||||
@ -1472,9 +1482,15 @@ function PathWithCopy({ path }: { path: string }) {
|
||||
}
|
||||
return (
|
||||
<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}
|
||||
</code>
|
||||
</a>
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
|
||||
@ -1444,8 +1444,9 @@ function HoSoLinkRow({ ev, readOnly = false }: { ev: PeDetailBundle; readOnly?:
|
||||
{ev.hoSoLink}
|
||||
</a>
|
||||
) : (
|
||||
// Đường dẫn ổ cứng/ổ mạng (O:\…, \\server) → trình duyệt CHẶN mở file://
|
||||
// từ https nên bấm sẽ hụt → hiện chữ + nút Copy để dán vào File Explorer.
|
||||
// Đường dẫn ổ cứng/ổ mạng (O:\…, \\server) → render link file:// để BẤM-THỬ
|
||||
// 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} />
|
||||
)
|
||||
) : (
|
||||
@ -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
|
||||
// CHẶN mở file:// từ trang https nên KHÔNG render <a> bấm-mở (bấm sẽ hụt); thay
|
||||
// bằng Copy → người dùng dán vào File Explorer (máy có map ổ mạng là mở ngay).
|
||||
// Đổi đường dẫn Windows → URL file:// (O:\DATA\x → file:///O:/DATA/x · \\srv\share → file://srv/share).
|
||||
function toFileUrl(p: string): string {
|
||||
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 }) {
|
||||
const [copied, setCopied] = useState(false)
|
||||
const copy = async () => {
|
||||
@ -1472,9 +1482,15 @@ function PathWithCopy({ path }: { path: string }) {
|
||||
}
|
||||
return (
|
||||
<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}
|
||||
</code>
|
||||
</a>
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
|
||||
Reference in New Issue
Block a user