本卡屬 FR-169(母卡 (建卡後補 Case No)),卡 F1,批 2。只改 FE(compliance-manager-fe)。依賴:P1。

這張卡做什麼(白話)

前端這邊做「看得到效果」的最小一段:①一個共用對話框元件 ProtectedDownloadDialog——照雛形畫面①:提示「密碼只顯示這一次」、密碼框、複製鈕、按過複製「下載」鈕才亮、7z 格式多一句「要用 7-Zip 或 Keka 開」;②一支共用 composable useProtectedDownload——先看安全政策開關(開啟才跳對話框),在瀏覽器端產 16 碼密碼,確認後把密碼放 HTTP header 送出去下載,密碼不進 URL、不進 Pinia、不進 localStorage,下載完清掉;③安全政策頁「登入」段後面加一個「檔案下載保護」開關(照兩階段驗證那個開關的寫法),關閉時頁頂出現警示;④先把稽核計畫與結案報告兩處下載改走它。i18n 的 key 本卡一次佔好,後面 F2 只接線不碰 i18n。

reuse/extend/new

new:src/composables/useProtectedDownload.js(先問 /security-policy 開關快取;開啟→開 ProtectedDownloadDialog 產密碼(crypto.getRandomValues,16 碼四段去 0O1lI)→確認後 axios blob 帶 X-File-Password;關閉→直接下載;檔名用既有 filenameFromHeaders、下載用既有 downloadBlob),取代各 composable 內重複的 axios blob 段。new:src/components/common/ProtectedDownloadDialog.vue(照雛形①:提示列、密碼框、複製後下載鈕才亮、7z 提醒依 needs7zip 顯示)。extend:SecurityPolicyForm.vue 登入段後加「檔案下載保護」InputSwitch(照 MFA 那段形狀)+關閉時頁頂 Message 警示;useApExportDownload.js、useClosingReport.js 改走新 composable。i18n 兩語言 key 本卡一次佔好(含 F2 會用的)

在哪裡

repo:~/Projects/Billows/Audit-Manager/compliance-manager-fe
改既有:src/composables/useApExportDownload.js
改既有:src/composables/useClosingReport.js
改既有:src/views/security-policy/SecurityPolicyForm.vue
改既有:src/config/locales/i18n/zh-tw/security-policy.json
改既有:src/config/locales/i18n/en/security-policy.json
改既有:src/config/locales/i18n/zh-tw/common.json
改既有:src/config/locales/i18n/en/common.json
新開:src/composables/useProtectedDownload.js
新開:src/components/common/ProtectedDownloadDialog.vue

怎麼做

驗收(首腦照這個驗)

稽核計畫頁按匯出 Word:對話框顯示 19 字元密碼、「下載」鈕灰到按「複製」才亮、下載後對話框關閉;DevTools Network 看請求 header 有 X-File-Password、URL 無密碼;localStorage/Pinia 無密碼;再按一次密碼不同;匯出 ZIP 對話框多 7-Zip 提醒;安全政策頁多一個開關、關掉存檔後頁頂出現警示、再按匯出不跳對話框;grep -rn border-left src/components/common/ProtectedDownloadDialog.vue 為 0;http://<IP>:5173 非 localhost 開頁實測 crypto.getRandomValues 可用

必讀