diff --git a/inventory-web/src/views/material/buyOdoo.vue b/inventory-web/src/views/material/buyOdoo.vue index ca3625b..65319ab 100644 --- a/inventory-web/src/views/material/buyOdoo.vue +++ b/inventory-web/src/views/material/buyOdoo.vue @@ -540,11 +540,21 @@ + + > + + @@ -1103,6 +1113,13 @@ const safeHref = (url: any): string | null => { return /^https?:\/\//i.test(s) ? s : null; }; +// 编辑弹窗里的「打开」按钮(与 list.vue 同款)。 +const openLink = (url: any) => { + const href = safeHref(url); + if (!href) return ElMessage.warning('请填写以 http:// 或 https:// 开头的链接'); + window.open(href, '_blank', 'noopener,noreferrer'); +}; + const hasFieldPermission = (field: string) => { if (userStore.role === 'SUPER_ADMIN' || userStore.username === 'IRIS') return true; const code = permissionMap[field]; diff --git a/inventory-web/src/views/material/list.vue b/inventory-web/src/views/material/list.vue index 3d5bca4..e719224 100644 --- a/inventory-web/src/views/material/list.vue +++ b/inventory-web/src/views/material/list.vue @@ -549,11 +549,24 @@ + + > + + @@ -1130,6 +1143,14 @@ const safeHref = (url: any): string | null => { return /^https?:\/\//i.test(s) ? s : null; }; +// 编辑弹窗里的「打开」按钮:在表单里直接跳转,不必复制网址另开标签页。 +// 走 safeHref 白名单 —— 非法值给出明确提示,而不是静默无反应。 +const openLink = (url: any) => { + const href = safeHref(url); + if (!href) return ElMessage.warning('请填写以 http:// 或 https:// 开头的链接'); + window.open(href, '_blank', 'noopener,noreferrer'); +}; + // ★ 附件备注(产品图备注 / 说明书备注)的**写**权限,与读权限分离。 // 两端必须与后端同口径: // 读 → material_list:files (本区块整体可见,6 个角色)