Files
vueapp/dist/assets/pages-assessment-assessment.CwWm86GC.js
T
2026-06-11 17:48:46 +08:00

2 lines
13 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import{d as e,a,r as t,c as l,o as s,b as n,e as o,f as r,w as i,i as c,j as u,t as d,g as f,l as m,M as v,F as _,m as p,n as h,N as y,P as w,D as b,G as g,s as k,C as x,U as $,y as N,z as T,x as j,u as E,S as P,H as C,q as D}from"./index-pnQqyMoS.js";import{_ as F}from"./config-doctor.TgARj_nM.js";import{F as M,a as U,r as A,f as S}from"./session.CQodznPl.js";import{_ as O}from"./_plugin-vue_export-helper.BCo6x5W8.js";async function R(e){const a=await fetch(`${M}/evaluations/${e}`,{method:"GET",headers:U()});if(!a.ok)throw new Error(await A(a));const t=await a.json();if("OK"!==t.code||!t.data)throw new Error(t.message||"评价详情加载失败");return t.data}async function I(e){var a;const t=await fetch(`${M}/evaluations/${e}/download-pdf`,{method:"GET",headers:U("application/pdf")});if(!t.ok)throw new Error(await A(t));const l=t.headers.get("Content-Type")||"",s=function(e,a){var t,l;const s=null==(t=e.match(/filename\*=UTF-8''([^;]+)/i))?void 0:t[1];if(s)return decodeURIComponent(s);const n=null==(l=e.match(/filename="?([^"]+)"?/i))?void 0:l[1];return n||`training_record_${a}.pdf`}(t.headers.get("Content-Disposition")||"",e);if(l.includes("application/json")){const e=await t.json();if("OK"!==e.code||!(null==(a=e.data)?void 0:a.file_path))throw new Error(e.message||"PDF 下载失败");return{filePath:e.data.file_path,fileName:L(e.data.file_path,s)}}return{blob:await t.blob(),fileName:s}}function L(e,a){return e.split("?")[0].split("#")[0].split("/").filter(Boolean).pop()||a}const Y=O(e({__name:"assessment",setup(e){const O=a({date:"生成中",no:"生成中",caseTitle:"",score:0,scoreText:"--",level:"生成中",overallComment:"评价生成中,请稍候。"}),L=t(!1),Y=t(""),B=t(!1),X=t(null),G=t(null),K=t(null),V=t(!1),q=t(!1),z=t(!1),H=l((()=>264-264*O.score/100)),J=l((()=>O.overallComment||W.value)),W=l((()=>z.value?"评价生成失败,请稍后重试。":q.value?"本次评价暂无详细点评。":"评价生成中,请稍候。")),Q=l((()=>z.value?"评价生成失败,请稍后重试。":q.value?"暂无分项评分。":"分项评分生成中。")),Z=l((()=>z.value?"评价生成失败,暂无雷达图。":q.value?"暂无足够分项数据生成雷达图。":"雷达图生成中。")),ee=l((()=>{var e,a;const t=G.value||X.value;return t?Array.isArray(t.dimension_scores)&&t.dimension_scores.length>0?t.dimension_scores.map((e=>{const a=e.max_score>0?ce(Number(e.score)/Number(e.max_score)*100):ce(Number(e.score)),t=[e.comment,e.improvement?`改进建议:${e.improvement}`:""].filter(Boolean).join(" ");return{label:e.dimension,percent:a,displayScore:e.max_score>0?`${e.score}/${e.max_score}`:`${e.score}%`,analysis:t||"暂无分项解析。"}})):Array.isArray(t.score_details)&&t.score_details.length>0?t.score_details.map((e=>({label:e.dimension,percent:ce(Number(e.score)),displayScore:`${e.score}%`,analysis:e.comment||e.deducted_reason||"暂无分项解析。"}))):G.value&&Array.isArray(null==(e=X.value)?void 0:e.dimension_scores)&&X.value.dimension_scores.length>0?X.value.dimension_scores.map((e=>{const a=Number(e.score),t=Number(e.max_score),l=ce(t>0?a/t*100:a),s=[e.comment,e.improvement?`改进建议:${e.improvement}`:""].filter(Boolean).join(" ");return{label:e.dimension,percent:l,displayScore:t>0?`${e.score}/${e.max_score}`:`${e.score}%`,analysis:s||"暂无分项解析。"}})):G.value&&Array.isArray(null==(a=X.value)?void 0:a.score_details)&&X.value.score_details.length>0?X.value.score_details.map((e=>({label:e.dimension,percent:ce(Number(e.score)),displayScore:`${e.score}%`,analysis:e.comment||e.deducted_reason||"暂无分项解析。"}))):[]:[]})),ae=l((()=>{const e=ee.value.slice(0,6),a=e.length;return a<3?[]:e.map(((e,t)=>{const l=-Math.PI/2+2*Math.PI*t/a,s=e.percent/100*160,n=200+184*Math.cos(l),o=200+184*Math.sin(l);return{...e,axisX:ue(200+160*Math.cos(l)),axisY:ue(200+160*Math.sin(l)),labelX:ue(n),labelY:ue(o),pointX:ue(200+Math.cos(l)*s),pointY:ue(200+Math.sin(l)*s),anchor:n<170?"end":n>230?"start":"middle"}}))})),te=l((()=>ae.value.map((e=>`${e.pointX},${e.pointY}`)).join(" ")));let le=null;function se(){"function"==typeof y&&y().length>1?w():ne()}function ne(){b({url:"/pages/home/home"})}function oe(){g({url:"/pages/learning-assistant/learning-assistant"})}function re(e){le&&clearTimeout(le),Y.value=e,B.value=!0,le=setTimeout((()=>{B.value=!1}),2200)}function ie(e){return`${e.getFullYear()}${e.getMonth()+1}${e.getDate()}`}function ce(e){return Number.isFinite(e)?Math.max(0,Math.min(100,Math.round(e))):0}function ue(e){return Math.round(100*e)/100}function de(e){return e>=90?"优秀":e>=80?"优良":e>=70?"良好":e>=60?"合格":"待加强"}function fe(e){X.value=e,K.value=e.evaluation_id,O.no=`EV-${e.evaluation_id}`,ve(e.total_score),O.level=de(O.score),O.date=ie(new Date),O.overallComment=e.overall_comment||"本次评价暂无详细点评。"}function me(e){var a;G.value=e,K.value=e.evaluation_id,O.no=`EV-${e.evaluation_id}`,O.caseTitle=e.case_title||"",O.date=function(e){if(!e)return ie(new Date);const a=new Date(e);return Number.isNaN(a.getTime())?e:ie(a)}(e.created_at),ve(e.total_score),O.level=de(O.score),O.overallComment=e.overall_comment||(null==(a=X.value)?void 0:a.overall_comment)||"本次评价暂无详细点评。"}function ve(e){O.score=ce(Number(e)),O.scoreText=Number.isFinite(Number(e))?String(O.score):"--"}async function _e(){q.value=!1,z.value=!1;try{if("teaching"===x("clinical-thinking-case-mode")&&Boolean(pe(!1)))return void(await async function(){const e=pe(),a=function(){const e=x("clinical-thinking-teaching-evaluation");return e&&"object"==typeof e?e:null}();a&&fe(a);const t=await R(e);k("clinical-thinking-evaluation-detail",t),me(t),q.value=!0}());const e=S();O.no=`SID-${e}`;const a=await async function(e,a="percentage"){const t=await fetch(`${M}/sessions/${e}/evaluation`,{method:"POST",headers:U(),body:JSON.stringify({score_type:a})});if(!t.ok)throw new Error(await A(t));const l=await t.json();if("OK"!==l.code||!l.data)throw new Error(l.message||"评价生成失败");return l.data}(e,"percentage");k("clinical-thinking-evaluation",a),fe(a);const t=await R(a.evaluation_id);k("clinical-thinking-evaluation-detail",t),me(t),q.value=!0}catch(e){z.value=!0,X.value=null,G.value=null,K.value=null,O.date="--",O.no="--",O.caseTitle="",O.score=0,O.scoreText="--",O.level="生成失败",O.overallComment="评价生成失败,请稍后重试。",re(e instanceof Error?e.message:"评价生成失败")}finally{L.value=!1,D((()=>{setTimeout((()=>{L.value=!0}),120)}))}}function pe(e=!0){const a=x("clinical-thinking-teaching-evaluation-id"),t=Number(a);if(Number.isInteger(t)&&t>0)return t;if(e)throw new Error("未找到教学评价,请先完成教学题目");return 0}async function he(){if(K.value&&!V.value){V.value=!0;try{const e=await I(K.value);k("clinical-thinking-evaluation-pdf",{fileName:e.fileName,filePath:e.filePath||""}),await async function(e){if(e.blob){if("undefined"==typeof window||"undefined"==typeof document)return;const a=window.URL.createObjectURL(e.blob);return ye(a,e.fileName),void window.setTimeout((()=>{window.URL.revokeObjectURL(a)}),1e3)}if(!e.filePath)throw new Error("PDF 下载地址为空");const a=function(e){const a=e.trim();return/^https?:\/\//i.test(a)||a.startsWith("/")?a:`/${a}`}(e.filePath),t=e.fileName;if("undefined"==typeof window||"undefined"==typeof document)return void $({url:a,fail:()=>re("PDF 下载失败")});try{const e=await fetch(a,{method:"GET",credentials:"include"});if(!e.ok)throw new Error(`PDF 下载失败(${e.status}`);const l=await e.blob(),s=window.URL.createObjectURL(l);ye(s,t),window.setTimeout((()=>{window.URL.revokeObjectURL(s)}),1e3)}catch(l){ye(a,t)}}(e),re("PDF 已生成")}catch(e){re(e instanceof Error?e.message:"PDF 下载失败")}finally{V.value=!1}}}function ye(e,a){const t=document.createElement("a");t.href=e,t.download=a,t.rel="noopener",t.style.display="none",document.body.appendChild(t),t.click(),document.body.removeChild(t)}return s((()=>{_e()})),n((()=>{le&&clearTimeout(le)})),(e,a)=>{const t=N,l=T,s=j,n=E,y=P;return o(),r(t,{class:"assessment-page"},{default:i((()=>[c(t,{class:"top-app-bar"},{default:i((()=>[c(l,{class:"icon-button","aria-label":"返回",onClick:se},{default:i((()=>[c(t,{class:"back-icon"})])),_:1}),c(s,{class:"app-title"},{default:i((()=>[u("AI 学习助手")])),_:1})])),_:1}),c(y,{class:"report-content","scroll-y":""},{default:i((()=>[c(t,{class:"report-head"},{default:i((()=>[c(s,{class:"report-title"},{default:i((()=>[u("训练总结与 AI 评估报告")])),_:1}),c(t,{class:"report-meta"},{default:i((()=>[c(s,null,{default:i((()=>[u("评估日期:"+d(O.date),1)])),_:1}),c(s,null,{default:i((()=>[u("模拟编号:"+d(O.no),1)])),_:1}),O.caseTitle?(o(),r(s,{key:0},{default:i((()=>[u("病例:"+d(O.caseTitle),1)])),_:1})):f("",!0)])),_:1})])),_:1}),c(t,{class:"content-stack"},{default:i((()=>[c(t,{class:"overall-card"},{default:i((()=>[c(t,{class:"score-ring"},{default:i((()=>[(o(),m("svg",{class:"ring-svg",viewBox:"0 0 100 100"},[v("circle",{class:"ring-track",cx:"50",cy:"50",fill:"transparent",r:"42","stroke-width":"10"}),v("circle",{class:"ring-value",cx:"50",cy:"50",fill:"transparent",r:"42","stroke-dasharray":"264","stroke-dashoffset":H.value,"stroke-linecap":"round","stroke-width":"10"},null,8,["stroke-dashoffset"])])),c(t,{class:"score-center"},{default:i((()=>[c(s,{class:"score-value"},{default:i((()=>[u(d(O.scoreText),1)])),_:1}),c(s,{class:"score-total"},{default:i((()=>[u("/100")])),_:1})])),_:1})])),_:1}),c(t,{class:"overall-copy"},{default:i((()=>[c(s,{class:"overall-title"},{default:i((()=>[u("本次考核评价:"),c(s,{class:"primary-text"},{default:i((()=>[u(d(O.level),1)])),_:1})])),_:1}),c(s,{class:"overall-desc"},{default:i((()=>[u(d(O.overallComment),1)])),_:1})])),_:1})])),_:1}),c(t,{class:"report-card"},{default:i((()=>[c(t,{class:"section-heading"},{default:i((()=>[c(t,{class:"hub-icon"}),c(s,null,{default:i((()=>[u("临床胜任力雷达图")])),_:1})])),_:1}),c(t,{class:"radar-wrap"},{default:i((()=>[ae.value.length>=3?(o(),m("svg",{key:0,class:"radar-svg",viewBox:"0 0 400 400"},[v("circle",{class:"radar-grid",cx:"200",cy:"200",r:"160"}),v("circle",{class:"radar-grid",cx:"200",cy:"200",r:"120"}),v("circle",{class:"radar-grid",cx:"200",cy:"200",r:"80"}),v("circle",{class:"radar-grid",cx:"200",cy:"200",r:"40"}),(o(!0),m(_,null,p(ae.value,(e=>(o(),m("line",{key:`axis-${e.label}`,class:"radar-grid",x1:"200",x2:e.axisX,y1:"200",y2:e.axisY},null,8,["x2","y2"])))),128)),v("polygon",{class:"radar-area",points:te.value},null,8,["points"]),(o(!0),m(_,null,p(ae.value,(e=>(o(),r(s,{key:`label-${e.label}`,class:"radar-label","text-anchor":e.anchor,x:e.labelX,y:e.labelY},{default:i((()=>[u(d(e.label),1)])),_:2},1032,["text-anchor","x","y"])))),128))])):(o(),r(t,{key:1,class:"empty-data radar-empty"},{default:i((()=>[c(s,null,{default:i((()=>[u(d(Z.value),1)])),_:1})])),_:1}))])),_:1})])),_:1}),c(t,{class:"report-card"},{default:i((()=>[c(t,{class:"section-heading breakdown-title"},{default:i((()=>[c(t,{class:"analytics-icon"}),c(s,null,{default:i((()=>[u("分项得分与解析")])),_:1})])),_:1}),c(t,{class:"breakdown-list"},{default:i((()=>[0===ee.value.length?(o(),r(t,{key:0,class:"empty-data"},{default:i((()=>[c(s,null,{default:i((()=>[u(d(Q.value),1)])),_:1})])),_:1})):(o(!0),m(_,{key:1},p(ee.value,((e,a)=>(o(),r(t,{key:`${e.label}-${a}`,class:"breakdown-item"},{default:i((()=>[c(t,{class:"breakdown-head"},{default:i((()=>[c(s,null,{default:i((()=>[u(d(e.label),1)])),_:2},1024),c(s,{class:"breakdown-score"},{default:i((()=>[u(d(e.displayScore),1)])),_:2},1024)])),_:2},1024),c(t,{class:"progress-track"},{default:i((()=>[c(t,{class:"progress-fill",style:C({width:L.value?`${e.percent}%`:"0%"})},null,8,["style"])])),_:2},1024),c(t,{class:"analysis-box"},{default:i((()=>[c(s,null,{default:i((()=>[u(d(e.analysis),1)])),_:2},1024)])),_:2},1024)])),_:2},1024)))),128))])),_:1})])),_:1}),c(t,{class:"mentor-section"},{default:i((()=>[c(t,{class:"mentor-head"},{default:i((()=>[c(n,{class:"mentor-avatar",src:F,mode:"aspectFill"}),c(t,{class:"mentor-title-group"},{default:i((()=>[c(s,{class:"mentor-title"},{default:i((()=>[u("王主任点评")])),_:1}),c(s,{class:"mentor-subtitle"},{default:i((()=>[u("Director's Mentorship")])),_:1})])),_:1})])),_:1}),c(t,{class:"mentor-bubble"},{default:i((()=>[c(t,{class:"mentor-tail"}),c(s,{class:"mentor-copy"},{default:i((()=>[u(d(J.value),1)])),_:1}),c(t,{class:"mentor-action-row"},{default:i((()=>[c(l,{class:"read-button",onClick:oe},{default:i((()=>[c(s,null,{default:i((()=>[u("去查阅")])),_:1}),c(t,{class:"arrow-forward-icon"})])),_:1})])),_:1})])),_:1})])),_:1})])),_:1})])),_:1}),c(t,{class:"footer-actions"},{default:i((()=>[c(l,{class:h(["download-button",{disabled:!K.value||V.value}]),disabled:!K.value||V.value,onClick:he},{default:i((()=>[u(d(V.value?"PDF 生成中...":"下载完整 PDF 报告"),1)])),_:1},8,["class","disabled"]),c(l,{class:"next-button",onClick:ne},{default:i((()=>[u(" 开始下一轮强化训练 ")])),_:1})])),_:1}),c(t,{class:h(["toast",{visible:B.value}])},{default:i((()=>[u(d(Y.value),1)])),_:1},8,["class"])])),_:1})}}}),[["__scopeId","data-v-a9374911"]]);export{Y as default};