|
|
3.不同状态的预约的预约项目无法一起选中`,Fd={__name:"YuYue202506",props:{reg_num:{type:String},entrust_ids:{type:String},episode_id:{type:String},appointment_type:{type:[String,Number]},dotype:{type:Number},do_user:{default:"",type:[String,Number]},special_privileges:{type:Array,default:()=>[]},scope:{type:String,default:"all"}},setup(lt){const w=lt;let A=v(null),j=v(null),p=v([]);const me=s=>s?s.requestComment?`${s.entrust}(${s.requestComment})`:s.entrust:"";let pe=v([]),ie=v(!1),H=v(!1),re=v(["1"]),$e=v(!0),ue=v([]),ke=v([]),O=v(""),L=v(0),U=v([]),J=v([]),h=v([]),ee=v(!0),Se=v([]),te=v([]),Ee=v("add"),_e=v(""),Ce=v([]),De=v([]),ce=v([]),ot=v(0),qe=v(!1),fe=v(!0),Le=v(""),Ue=v(""),ae=v(!1),X=v(!1),ge=v(""),xe=v(null),he=v(null),le=v(!1),We=v(""),de=v(!1),Ie=v(""),ne=v(!1),Te=v(""),W=v(!1),Me=v([]),je=v(!1),be=v(!1),He=v(null);const Ze=Re(()=>{const s=Me.value.find(e=>e.dept_mismatch);return s?{his:s.entrust_dept_name||"",appoint:s.appointment_dept_name||""}:{his:"",appoint:""}}),Ke=()=>{W.value=!1,Fe(He.value)},rt=({row:s})=>s.check_status==="fail"?"precheck-fail-row":"",pt=s=>{let e=["周日","周一","周二","周三","周四","周五","周六"];const t=new Date(s).getDay();return e[t]},Qe=Re(()=>{const s=h.value.map(t=>{var o;return(o=t.department_resources)==null?void 0:o.department_resources_name}).filter(Boolean),e=[...new Set(s)];if(e.length!==1)return 0;const d=e[0];return p.value.filter(t=>{var o;return((o=t.department_resources)==null?void 0:o.department_resources_name)===d}).length}),Xe=Re(()=>w.special_privileges.includes("emergency")),ut=Re(()=>{const s=p.value.filter(d=>!!(d.list_status===1&&d.reservation_date||d.list_status===0&&d.temp_plan_id&&d.reservation_date));return s.length<2?!1:new Set(s.map(d=>d.reservation_date)).size>1});let Ne=null;const _t=()=>{Ne&&clearTimeout(Ne),Ne=setTimeout(()=>{K(),Ne=null},500)},mt=s=>{var d,t,o,l,i,n,r,g,M,R;if(U.value=[],J.value=[],ue.value=[],ke.value=[],pe.value=[],O.value="",h.value=s,console.log("11111",h.value),h.value.forEach((x,u)=>{U.value.push(x.id),J.value.push(x.entrust_id)}),h.value.every(x=>{var u;return x.roster_id===((u=h.value[0])==null?void 0:u.roster_id)}))L.value=(d=h.value[0])==null?void 0:d.roster_id,L.value!==0&&L.value&&(_e.value=(t=h.value[0])==null?void 0:t.reservation_date,Tt(dt(),(o=h.value[0])==null?void 0:o.reservation_date)&&((l=h.value[0])!=null&&l.reservation_date)?se.value=Be((i=h.value[0])==null?void 0:i.reservation_date):se.value=Be(dt()),O.value=(r=(n=h.value[0])==null?void 0:n.department_resources)==null?void 0:r.department_resources_name);else if(L.value=0,h.value.length>0){const x=(M=(g=h.value[0])==null?void 0:g.department_resources)==null?void 0:M.execute_department_id;if(x&&h.value.every(b=>{var S;return((S=b.department_resources)==null?void 0:S.execute_department_id)===x})){const b=(R=h.value[0].department_resources)==null?void 0:R.department_resources_name;b&&(O.value=b)}}Se.value.forEach(x=>{h.value.find(u=>u===x)||(Ee.value="cancel")}),h.value.length==0&&(Ee.value="add",Se.value=[]),console.log(Ee.value),J.value.length>0&&ee.value&&(Ee.value==="add"&&h.value[0].list_status==0?fe.value?ht():K():_t()),xe.value&&p.value.findIndex(u=>U.value.includes(u.id))+1===xe.value.idx&&(ge.value=xe.value.html,X.value=!0,xe.value=null),he.value&&p.value.findIndex(u=>U.value.includes(u.id))+1===he.value.idx&&(Te.value=he.value.html,ne.value=!0,he.value=null),ct()},ct=()=>{var d,t;if(h.value.length===0){$e.value=!0;return}const s=(t=(d=h.value[0])==null?void 0:d.department_resources)==null?void 0:t.execute_department_id;if(s==null){$e.value=!0;return}const e=h.value.every(o=>{var l;return((l=o.department_resources)==null?void 0:l.execute_department_id)===s});$e.value=!e},ft=s=>h.value.findIndex(e=>e.id===s.id)>-1,gt=({row:s,rowIndex:e})=>{if(s.tishi_msg!="")return"disabled-row";if(ft(s))return"selected-row"},xt=(s,e)=>s.tishi_msg=="";let ye=v([]);const Ve=(s,e)=>{let d=U.value;p.value=[],ie.value=!0,Pt({regnum:w.reg_num,entrustid:w.entrust_ids,episodeid:w.episode_id,appointment_type:w.appointment_type}).then(t=>{var o;if(ie.value=!1,t.status){if(t.data.info.length>0){let l=t.data.info;if(j.value=l[0].maininfo,l.forEach((i,n)=>{var g,M;let r=i.maininfo;r.tishi_msg=i.msg,r.limosis=(g=i.iteminfo[0])==null?void 0:g.limosis,p.value.push(r),i.msg!=""&&i.msg!=null&&ye.value.push({msg:i.msg,item_name:(M=i.iteminfo[0])==null?void 0:M.item_name})}),t.data.no_appointment_dept&&t.data.no_appointment_dept.length>0){const i=[...new Set(t.data.no_appointment_dept.map(r=>r.resource_name))],n=[...new Set(t.data.no_appointment_dept.map(r=>r.item_name))];Le.value="注意:"+i.join(",")+"下属的"+n.join(",")+"项目属于不用预约项目!"}if(t.data.no_schedule&&t.data.no_schedule.length>0){const i=[...new Set(t.data.no_schedule.map(r=>r.resource_name))],n=[...new Set(t.data.no_schedule.map(r=>r.item_name))];Ue.value="注意:"+i.join(",")+"下属的"+n.join(",")+"项目未配置排班计划,请联系检查室!"}if(d.length>0&&!e)d.forEach((i,n)=>{p.value.forEach((r,g)=>{i==r.id&&A.value.toggleRowSelection(p.value[g],!0)})});else{for(let i=0;i<p.value.length;i++)if(p.value[i].tishi_msg==""&&p.value[i].list_status===0){A.value.toggleRowSelection(p.value[i],!0);const n=(o=p.value[i].department_resources)==null?void 0:o.department_resources_name;n&&p.value.forEach(r=>{var g;r.id!==p.value[i].id&&r.list_status===0&&r.tishi_msg===""&&((g=r.department_resources)==null?void 0:g.department_resources_name)===n&&A.value.toggleRowSelection(r,!0)}),p.value[i].roster_id!=null&&(L.value=p.value[i].roster_id,O.value=n);break}if(U.value.length===0){const i=p.value.find(n=>n.tishi_msg==="");i&&(ee.value=!1,e&&d.length>0?d.forEach(n=>{const r=p.value.find(g=>g.id===n);r&&A.value.toggleRowSelection(r,!0)}):A.value.toggleRowSelection(i,!0),ee.value=!0)}}Ae.value&&(Ae.value=!1,ye.value.length>0&&(console.log("22222222222222",ye.value),ae.value=!0)),De.value=JSON.parse(JSON.stringify(p.value)),s&&s()}}else G.error(t.msg)})},ht=()=>{let s=[],e=h.value.length;if(h.value[e-1].list_status!=0)return!1;p.value.forEach((d,t)=>{d.list_status==0&&d.tishi_msg==""&&(d.id==h.value[e-1].id?s.push({name:d.entrust,rowid:t,first:1}):s.push({name:d.entrust,rowid:t,first:0}))}),s.length>=2?(ie.value=!0,Yt({items:s}).then(d=>{ie.value=!1,d.status?(s.forEach((o,l)=>{ee.value=!1,A.value.toggleRowSelection(p.value[o.rowid],!1)}),d.data.rowids.forEach((o,l)=>{ee.value=!1,A.value.toggleRowSelection(p.value[o],!0)}),Se.value=h.value,K()):G.error(d.msg),ee.value=!0})):(Se.value=h.value,K())};let se=v([]);const K=()=>{if(J.value.length==0)return G.error("请选择检查项目"),!1;H.value=!0;const s=[...J.value].sort().join(",");Ot({regnum:w.reg_num,entrustid:J.value,episodeid:w.episode_id,appointment_type:w.appointment_type,date:se.value,scope:w.scope,do_user:w.do_user}).then(e=>{H.value=!1;const d=[...J.value].sort().join(",");if(s===d)if(pe.value=[],ue.value=[],e.status){let t=e.data.plan_list,o=e.data.zhanWeiCount,l=e.data.is_emergency;if(ce.value=t,ot.value=o,t.length>0){t.some(x=>x.department_resources_name===O.value)||(O.value=t[0].department_resources_name);const n=new Set,r=new Set;t.forEach(x=>{if(x.no_plan){r.add(x.department_resources_name);return}if(x.department_resources_name==O.value){const u=`${x.begin_time.substring(0,5)}-${x.end_time.substring(0,5)}`;n.add(u)}r.add(x.department_resources_name)});const g=Array.from(r);if(ke.value.length>0){const x=[],u=[...g];ke.value.forEach(b=>{const S=u.indexOf(b);S!==-1&&(x.push(b),u.splice(S,1))}),ue.value=[...x,...u]}else ue.value=g;ke.value=[...ue.value],Array.from(n).sort().forEach(x=>{const u={time_range:x};se.value.forEach(b=>{const S=t.find(m=>!m.no_plan&&`${m.begin_time.substring(0,5)}-${m.end_time.substring(0,5)}`===x&&m.date===b&&m.department_resources_name==O.value);let a=!1;S?(S.plan_enable===!0&&(a=!0),l===!0&&S.plan_enable===!0&&Xe.value==!0&&(a=!0),u[b]={use_count:`${S.used_count}/${S.count}`,id:S.id,enable:a}):u[b]={use_count:"0/0",id:null,enable:a}}),pe.value.push(u)}),L.value=0;const R=et();if(R.length>0)te.value=R,L.value=R[0];else{te.value=[];const x=t.find(u=>u.department_resources_name==O.value&&u.plan_enable===!0);x&&(L.value=x.id)}if(!qe.value){qe.value=!0;const x=p.value.filter(u=>u.list_status===0);if(x.length>0){const u=x.map(b=>{var S;return{id:b.id,entrust_id:b.entrust_id,department_resources_name:((S=b.department_resources)==null?void 0:S.department_resources_name)||"",date:b.reservation_date||"",begin_time:b.period_begin_time||"",end_time:b.period_end_time||""}});we({type:"optimal_time",regnum:w.reg_num,entrustid:J.value,episodeid:w.episode_id,appointment_type:w.appointment_type,items:u,scope:w.scope,do_user:w.do_user}).then(b=>{if(b.status){b.data.forEach(y=>{const T=p.value.find(Y=>Y.id===y.id);T&&(T.department_resources||(T.department_resources={}),T.department_resources.department_resources_name=y.department_resources_name,T.reservation_date=y.date,T.period_begin_time=y.begin_time,T.period_end_time=y.end_time,T.temp_plan_id=y.plan_id)});const S={};b.data.forEach(y=>{var Y,q;const T=y.department_resources_name;S[T]||(S[T]={items:[],timeSlots:new Set,dates:new Set}),S[T].items.push(y),S[T].timeSlots.add(((Y=y.begin_time)==null?void 0:Y.substring(0,5))+"-"+((q=y.end_time)==null?void 0:q.substring(0,5))),S[T].dates.add(y.date)});const a=[];for(const[y,T]of Object.entries(S))(T.timeSlots.size>1||T.dates.size>1)&&T.items.forEach(Y=>{var C,E;const q=p.value.findIndex($=>$.id===Y.id);a.push({idx:q!==-1?q+1:"",room:Y.department_resources_name,date:Y.date,timeSlot:((C=Y.begin_time)==null?void 0:C.substring(0,5))+"-"+((E=Y.end_time)==null?void 0:E.substring(0,5)),entrust:me(p.value.find($=>$.id===Y.id))})});if(a.length>0){let y='<table style="width:100%;border-collapse:collapse;font-size:14px;">';y+='<tr style="background:#d5dce6;"><td style="padding:4px 8px;border:1px solid #ddd;font-weight:700;">序号</td><td style="padding:4px 8px;border:1px solid #ddd;font-weight:700;">项目名称</td><td style="padding:4px 8px;border:1px solid #ddd;font-weight:700;">检查室</td><td style="padding:4px 8px;border:1px solid #ddd;font-weight:700;">日期</td><td style="padding:4px 8px;border:1px solid #ddd;font-weight:700;">时间段</td></tr>';let T="",Y="#f5f5f5";a.sort((E,$)=>E.idx-$.idx).forEach(E=>{E.timeSlot!==T&&(Y=Y==="#fff"?"#d5dce6":"#fff",T=E.timeSlot),y+='<tr style="background:'+Y+';"><td style="padding:4px 8px;border:1px solid #ddd;">'+E.idx+'</td><td style="padding:4px 8px;border:1px solid #ddd;">'+E.entrust+'</td><td style="padding:4px 8px;border:1px solid #ddd;">'+E.room+'</td><td style="padding:4px 8px;border:1px solid #ddd;">'+E.date+'</td><td style="padding:4px 8px;border:1px solid #ddd;">'+E.timeSlot+"</td></tr>"}),y+="</table>";const q=Math.min(...a.map(E=>E.idx));p.value.findIndex(E=>U.value.includes(E.id))+1===q?(ge.value=y,X.value=!0):xe.value={html:y,idx:q}}const m=new Set(b.data.map(y=>y.id)),I=u.filter(y=>!m.has(y.id));if(I.length>0){let y='<table style="width:100%;border-collapse:collapse;font-size:14px;">';y+='<tr style="background:#d5dce6;"><td style="padding:4px 8px;border:1px solid #ddd;font-weight:700;">序号</td><td style="padding:4px 8px;border:1px solid #ddd;font-weight:700;">项目名称</td><td style="padding:4px 8px;border:1px solid #ddd;font-weight:700;">排班资源</td><td style="padding:4px 8px;border:1px solid #ddd;font-weight:700;">日期</td><td style="padding:4px 8px;border:1px solid #ddd;font-weight:700;">时间段</td><td style="padding:4px 8px;border:1px solid #ddd;font-weight:700;">结果</td></tr>';let T=1;b.data.forEach(E=>{var ve,ze,nt;const $=((ve=p.value.find(Mt=>Mt.id===E.id))==null?void 0:ve.entrust)||"";y+='<tr><td style="padding:4px 8px;border:1px solid #ddd;">'+T+++'</td><td style="padding:4px 8px;border:1px solid #ddd;">'+$+'</td><td style="padding:4px 8px;border:1px solid #ddd;">'+E.department_resources_name+'</td><td style="padding:4px 8px;border:1px solid #ddd;">'+E.date+'</td><td style="padding:4px 8px;border:1px solid #ddd;">'+((ze=E.begin_time)==null?void 0:ze.substring(0,5))+"-"+((nt=E.end_time)==null?void 0:nt.substring(0,5))+'</td><td style="padding:4px 8px;border:1px solid #ddd;color:green;">✅ 成功匹配</td></tr>'}),I.forEach(E=>{var ve;const $=((ve=p.value.find(ze=>ze.id===E.id))==null?void 0:ve.entrust)||"";y+='<tr><td style="padding:4px 8px;border:1px solid #ddd;">'+T+++'</td><td style="padding:4px 8px;border:1px solid #ddd;">'+$+'</td><td style="padding:4px 8px;border:1px solid #ddd;" colspan="3">—</td><td style="padding:4px 8px;border:1px solid #ddd;color:red;">❌ 未找到合适号源</td></tr>'}),y+="</table>";const Y=I.map(E=>p.value.findIndex($=>$.id===E.id)+1).filter(E=>E>0),q=Math.min(...Y);p.value.findIndex(E=>U.value.includes(E.id))+1===q?(Te.value=y,ne.value=!0):he.value={html:y,idx:q}}const B=et();B.length>0&&(te.value=B,L.value=B[0])}})}}}}else G.error(e.msg)})},bt=s=>{O.value=s,L.value=0,te.value=[],K()},et=()=>{const s=[];for(const e of p.value)if(U.value.includes(e.id)&&e.list_status===0&&e.temp_plan_id){const d=ce.value.find(t=>t.id===e.temp_plan_id&&t.department_resources_name===O.value);d&&!s.includes(d.id)&&s.push(d.id)}for(const e of p.value)if(U.value.includes(e.id)&&e.list_status===1&&e.roster_id){const d=ce.value.find(t=>t.id===e.roster_id&&t.department_resources_name===O.value);d&&!s.includes(d.id)&&s.push(d.id)}return s},yt=s=>{if(console.log(s),s==null)return;const e=ce.value.find(d=>d.id===s);e&&(L.value=s,te.value=[s],St(),h.value.forEach(d=>{const t=p.value.find(o=>o.id===d.id);t&&(t.department_resources||(t.department_resources={}),t.department_resources.department_resources_name=e.department_resources_name,t.reservation_date=e.date,t.period_begin_time=e.begin_time,t.period_end_time=e.end_time,t.temp_plan_id=s)}))},vt=()=>{if(J.value.length===0){G.error("请选择检查项目");return}H.value=!0,h.value.forEach(d=>{const t=De.value.find(l=>l.id===d.id);if(!t)return;const o=p.value.find(l=>l.id===d.id);o&&(o.department_resources=t.department_resources,o.reservation_date=t.reservation_date,o.period_begin_time=t.period_begin_time,o.period_end_time=t.period_end_time,o.temp_plan_id=void 0)});const s=h.value.filter(d=>d.list_status===0).map(d=>{var t;return{id:d.id,entrust_id:d.entrust_id,department_resources_name:((t=d.department_resources)==null?void 0:t.department_resources_name)||"",date:d.reservation_date||"",begin_time:d.period_begin_time||"",end_time:d.period_end_time||""}}),e=p.value.filter(d=>!U.value.includes(d.id)&&d.list_status===0&&d.temp_plan_id).map(d=>d.temp_plan_id);we({type:"optimal_time",regnum:w.reg_num,entrustid:J.value,episodeid:w.episode_id,appointment_type:w.appointment_type,items:s,occupied_plan_ids:e,scope:w.scope,do_user:w.do_user}).then(d=>{if(H.value=!1,d.status){d.data.forEach(n=>{const r=p.value.find(g=>g.id===n.id);r&&(r.department_resources||(r.department_resources={}),r.department_resources.department_resources_name=n.department_resources_name,r.reservation_date=n.date,r.period_begin_time=n.begin_time,r.period_end_time=n.end_time,r.temp_plan_id=n.plan_id)});const t={};d.data.forEach(n=>{var g,M;const r=n.department_resources_name;t[r]||(t[r]={items:[],timeSlots:new Set,dates:new Set}),t[r].items.push(n),t[r].timeSlots.add(((g=n.begin_time)==null?void 0:g.substring(0,5))+"-"+((M=n.end_time)==null?void 0:M.substring(0,5))),t[r].dates.add(n.date)});const o=[];for(const[n,r]of Object.entries(t))(r.timeSlots.size>1||r.dates.size>1)&&r.items.forEach(g=>{var R,x;const M=p.value.findIndex(u=>u.id===g.id);o.push({idx:M!==-1?M+1:"",room:g.department_resources_name,date:g.date,timeSlot:((R=g.begin_time)==null?void 0:R.substring(0,5))+"-"+((x=g.end_time)==null?void 0:x.substring(0,5)),entrust:me(p.value.find(u=>u.id===g.id))})});if(o.length>0){let n='<table style="width:100%;border-collapse:collapse;font-size:14px;">';n+='<tr style="background:#d5dce6;"><td style="padding:4px 8px;border:1px solid #ddd;font-weight:700;">序号</td><td style="padding:4px 8px;border:1px solid #ddd;font-weight:700;">项目名称</td><td style="padding:4px 8px;border:1px solid #ddd;font-weight:700;">检查室</td><td style="padding:4px 8px;border:1px solid #ddd;font-weight:700;">日期</td><td style="padding:4px 8px;border:1px solid #ddd;font-weight:700;">时间段</td></tr>';let r="",g="#f5f5f5";o.sort((M,R)=>M.idx-R.idx).forEach(M=>{M.timeSlot!==r&&(g=g==="#fff"?"#d5dce6":"#fff",r=M.timeSlot),n+='<tr style="background:'+g+';"><td style="padding:4px 8px;border:1px solid #ddd;">'+M.idx+'</td><td style="padding:4px 8px;border:1px solid #ddd;">'+M.entrust+'</td><td style="padding:4px 8px;border:1px solid #ddd;">'+M.room+'</td><td style="padding:4px 8px;border:1px solid #ddd;">'+M.date+'</td><td style="padding:4px 8px;border:1px solid #ddd;">'+M.timeSlot+"</td></tr>"}),n+="</table>",ge.value=n,X.value=!0}const l=new Set(d.data.map(n=>n.id)),i=s.filter(n=>!l.has(n.id));if(i.length>0){let n='<table style="width:100%;border-collapse:collapse;font-size:14px;">';n+='<tr style="background:#d5dce6;"><td style="padding:4px 8px;border:1px solid #ddd;font-weight:700;">序号</td><td style="padding:4px 8px;border:1px solid #ddd;font-weight:700;">项目名称</td><td style="padding:4px 8px;border:1px solid #ddd;font-weight:700;">排班资源</td><td style="padding:4px 8px;border:1px solid #ddd;font-weight:700;">日期</td><td style="padding:4px 8px;border:1px solid #ddd;font-weight:700;">时间段</td><td style="padding:4px 8px;border:1px solid #ddd;font-weight:700;">结果</td></tr>';let r=1;d.data.forEach(g=>{var R,x;const M=me(p.value.find(u=>u.id===g.id));n+='<tr><td style="padding:4px 8px;border:1px solid #ddd;">'+r+++'</td><td style="padding:4px 8px;border:1px solid #ddd;">'+M+'</td><td style="padding:4px 8px;border:1px solid #ddd;">'+g.department_resources_name+'</td><td style="padding:4px 8px;border:1px solid #ddd;">'+g.date+'</td><td style="padding:4px 8px;border:1px solid #ddd;">'+((R=g.begin_time)==null?void 0:R.substring(0,5))+"-"+((x=g.end_time)==null?void 0:x.substring(0,5))+'</td><td style="padding:4px 8px;border:1px solid #ddd;color:green;">✅ 成功匹配</td></tr>'}),i.forEach(g=>{const M=me(p.value.find(R=>R.id===g.id));n+='<tr><td style="padding:4px 8px;border:1px solid #ddd;">'+r+++'</td><td style="padding:4px 8px;border:1px solid #ddd;">'+M+'</td><td style="padding:4px 8px;border:1px solid #ddd;" colspan="3">—</td><td style="padding:4px 8px;border:1px solid #ddd;color:red;">❌ 未找到合适号源</td></tr>'}),n+="</table>",Te.value=n,ne.value=!0}else d.data.length===0&&oe.confirm("所有项目均未匹配到合适号源,请重新选择号源","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"error",showCancelButton:!1});d.data.length>0&&(O.value=d.data[0].department_resources_name,te.value=d.data.map(n=>n.plan_id),L.value=d.data[0].plan_id,K())}else G.error(d.msg)})},wt=()=>{if(J.value.length===0){G.error("请选择检查项目");return}H.value=!0,h.value.forEach(d=>{const t=De.value.find(l=>l.id===d.id);if(!t)return;const o=p.value.find(l=>l.id===d.id);o&&(o.department_resources=t.department_resources,o.reservation_date=t.reservation_date,o.period_begin_time=t.period_begin_time,o.period_end_time=t.period_end_time,o.temp_plan_id=void 0)});const s=h.value.filter(d=>d.list_status===0).map(d=>{var t;return{id:d.id,entrust_id:d.entrust_id,department_resources_name:((t=d.department_resources)==null?void 0:t.department_resources_name)||"",date:d.reservation_date||"",begin_time:d.period_begin_time||"",end_time:d.period_end_time||""}}),e=p.value.filter(d=>!U.value.includes(d.id)&&d.list_status===0&&d.temp_plan_id).map(d=>d.temp_plan_id);we({type:"full_day",regnum:w.reg_num,entrustid:J.value,episodeid:w.episode_id,appointment_type:w.appointment_type,items:s,occupied_plan_ids:e,scope:w.scope,do_user:w.do_user}).then(d=>{if(H.value=!1,d.status)if(d.data.forEach(t=>{const o=p.value.find(l=>l.id===t.id);o&&(o.department_resources||(o.department_resources={}),o.department_resources.department_resources_name=t.department_resources_name,o.reservation_date=t.date,o.period_begin_time=t.begin_time,o.period_end_time=t.end_time,o.temp_plan_id=t.plan_id)}),d.data.length>0){const t={};d.data.forEach(l=>{var n,r;const i=l.department_resources_name;t[i]||(t[i]={items:[],timeSlots:new Set,dates:new Set}),t[i].items.push(l),t[i].timeSlots.add(((n=l.begin_time)==null?void 0:n.substring(0,5))+"-"+((r=l.end_time)==null?void 0:r.substring(0,5))),t[i].dates.add(l.date)});const o=[];for(const[l,i]of Object.entries(t))(i.timeSlots.size>1||i.dates.size>1)&&i.items.forEach(n=>{var g,M;const r=p.value.findIndex(R=>R.id===n.id);o.push({idx:r!==-1?r+1:"",room:n.department_resources_name,date:n.date,timeSlot:((g=n.begin_time)==null?void 0:g.substring(0,5))+"-"+((M=n.end_time)==null?void 0:M.substring(0,5)),entrust:me(p.value.find(R=>R.id===n.id))})});if(o.length>0){let l='<table style="width:100%;border-collapse:collapse;font-size:14px;">';l+='<tr style="background:#d5dce6;"><td style="padding:4px 8px;border:1px solid #ddd;font-weight:700;">序号</td><td style="padding:4px 8px;border:1px solid #ddd;font-weight:700;">项目名称</td><td style="padding:4px 8px;border:1px solid #ddd;font-weight:700;">检查室</td><td style="padding:4px 8px;border:1px solid #ddd;font-weight:700;">日期</td><td style="padding:4px 8px;border:1px solid #ddd;font-weight:700;">时间段</td></tr>';let i="",n="#f5f5f5";o.sort((r,g)=>r.idx-g.idx).forEach(r=>{r.timeSlot!==i&&(n=n==="#fff"?"#d5dce6":"#fff",i=r.timeSlot),l+='<tr style="background:'+n+';"><td style="padding:4px 8px;border:1px solid #ddd;">'+r.idx+'</td><td style="padding:4px 8px;border:1px solid #ddd;">'+r.entrust+'</td><td style="padding:4px 8px;border:1px solid #ddd;">'+r.room+'</td><td style="padding:4px 8px;border:1px solid #ddd;">'+r.date+'</td><td style="padding:4px 8px;border:1px solid #ddd;">'+r.timeSlot+"</td></tr>"}),l+="</table>",ge.value=l,X.value=!0}O.value=d.data[0].department_resources_name,te.value=d.data.map(l=>l.plan_id),L.value=d.data[0].plan_id,K()}else oe.confirm("未找到任何一天可满足所有检查项目的号源","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning",showCancelButton:!1});else G.error(d.msg)})},kt=()=>{if(J.value.length===0){G.error("请选择检查项目");return}H.value=!0,h.value.forEach(d=>{const t=De.value.find(l=>l.id===d.id);if(!t)return;const o=p.value.find(l=>l.id===d.id);o&&(o.department_resources=t.department_resources,o.reservation_date=t.reservation_date,o.period_begin_time=t.period_begin_time,o.period_end_time=t.period_end_time,o.temp_plan_id=void 0)});const s=h.value.filter(d=>d.list_status===0).map(d=>{var t;return{id:d.id,entrust_id:d.entrust_id,department_resources_name:((t=d.department_resources)==null?void 0:t.department_resources_name)||"",date:d.reservation_date||"",begin_time:d.period_begin_time||"",end_time:d.period_end_time||""}}),e=p.value.filter(d=>!U.value.includes(d.id)&&d.list_status===0&&d.temp_plan_id).map(d=>d.temp_plan_id);we({type:"same_day_slot",regnum:w.reg_num,entrustid:J.value,episodeid:w.episode_id,appointment_type:w.appointment_type,items:s,occupied_plan_ids:e,scope:w.scope,do_user:w.do_user}).then(d=>{if(H.value=!1,d.status)if(d.data.length>0){const t={};d.data.forEach(l=>{var n,r;const i=l.department_resources_name;t[i]||(t[i]={timeSlots:new Set}),t[i].timeSlots.add(((n=l.begin_time)==null?void 0:n.substring(0,5))+"-"+((r=l.end_time)==null?void 0:r.substring(0,5)))});let o=!1;for(const l of Object.values(t))if(l.timeSlots.size>1){o=!0;break}if(o){oe.confirm("未找到同一时段号源,无法匹配","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning",showCancelButton:!1});return}d.data.forEach(l=>{const i=p.value.find(n=>n.id===l.id);i&&(i.department_resources||(i.department_resources={}),i.department_resources.department_resources_name=l.department_resources_name,i.reservation_date=l.date,i.period_begin_time=l.begin_time,i.period_end_time=l.end_time,i.temp_plan_id=l.plan_id)}),O.value=d.data[0].department_resources_name,te.value=d.data.map(l=>l.plan_id),L.value=d.data[0].plan_id,K()}else oe.confirm("未找到同一时段号源,无法匹配","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning",showCancelButton:!1});else G.error(d.msg)})},St=()=>{H.value=!0;const s=ce.value.find(o=>o.id===L.value);if(!s){H.value=!1;return}const e=s.date+" "+s.begin_time,d=s.date+" "+s.end_time,t=s.department_resources_name;$t({reg_num:w.reg_num,planid:L.value}).then(o=>{var i;H.value=!1;let l=[];if(!o.status&&((i=o.data)!=null&&i.conflicts)&&(l=l.concat(o.data.conflicts.filter(n=>n.room_name!==t))),p.value.forEach(n=>{var R,x,u,b;if(n.list_status!==0||!n.temp_plan_id||!n.reservation_date||((R=n.department_resources)==null?void 0:R.department_resources_name)===t)return;const g=n.reservation_date+" "+n.period_begin_time,M=n.reservation_date+" "+n.period_end_time;g<=d&&e<=M&&(l.some(a=>a.entrust===n.entrust&&a.date===n.reservation_date)||l.push({entrust:n.entrust,date:n.reservation_date,begin_time:(x=n.period_begin_time)==null?void 0:x.substring(0,5),end_time:(u=n.period_end_time)==null?void 0:u.substring(0,5),room_name:((b=n.department_resources)==null?void 0:b.department_resources_name)||""}))}),l.length>0){let n='<table style="width:100%;border-collapse:collapse;font-size:14px;">';n+='<tr style="background:#f5f5f5;"><td style="padding:4px 8px;border:1px solid #ddd;font-weight:700;">序号</td><td style="padding:4px 8px;border:1px solid #ddd;font-weight:700;">项目名称</td><td style="padding:4px 8px;border:1px solid #ddd;font-weight:700;">检查室</td><td style="padding:4px 8px;border:1px solid #ddd;font-weight:700;">日期</td><td style="padding:4px 8px;border:1px solid #ddd;font-weight:700;">时间段</td></tr>',l.forEach((r,g)=>{n+='<tr><td style="padding:4px 8px;border:1px solid #ddd;">'+(g+1)+'</td><td style="padding:4px 8px;border:1px solid #ddd;">'+r.entrust+'</td><td style="padding:4px 8px;border:1px solid #ddd;">'+(r.room_name||"")+'</td><td style="padding:4px 8px;border:1px solid #ddd;">'+r.date+'</td><td style="padding:4px 8px;border:1px solid #ddd;">'+r.begin_time+"-"+r.end_time+"</td></tr>"}),n+="</table>",We.value=n,le.value=!0}})},Je=async s=>{if(J.length==0)return G.error("请选择检查项目"),!1;if(L.value==0||L.value==""||L.value==null)return G.error("请选择号源"),!1;const e={};U.value.forEach(l=>{const i=p.value.find(r=>r.id===l),n=(i==null?void 0:i.temp_plan_id)||(i==null?void 0:i.roster_id);n&&(e[n]||(e[n]=[]),e[n].push(l))});const d=Object.entries(e).map(([l,i])=>({planid:Number(l),mainlistid:i})),t=await Lt({groups:d,appointment_type:w.appointment_type,dotype:s,do_user:w.do_user,is_emergency:s==111?1:null});if(!t.status){G.error(t.msg);return}if(t.data.dept_check_enabled!=="1"){const l=s===2?"确定改约至此时间吗?":"确定预约此时间吗?";oe.confirm(l,"提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(()=>{Fe(s)}).catch(()=>{});return}if(t.data.has_fail){Me.value=t.data.list||[],je.value=t.data.has_mismatch||!1,be.value=!0,He.value=s,W.value=!0;return}if(t.data.has_mismatch){Me.value=t.data.list||[],je.value=!0,be.value=!1,He.value=s,W.value=!0;return}const o=s===2?"确定改约至此时间吗?":"确定预约此时间吗?";oe.confirm(o,"提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(()=>{Fe(s)}).catch(()=>{})},Fe=async s=>{var M,R,x;H.value=!0;const e={};p.value.forEach(u=>{var b;!U.value.includes(u.id)&&u.temp_plan_id&&(e[u.id]={temp_plan_id:u.temp_plan_id,department_resources_name:(b=u.department_resources)==null?void 0:b.department_resources_name,reservation_date:u.reservation_date,period_begin_time:u.period_begin_time,period_end_time:u.period_end_time})}),console.log("tempPlanCache 缓存:",JSON.parse(JSON.stringify(e)));const d={};let t=!1;if(U.value.forEach(u=>{const b=p.value.find(a=>a.id===u),S=(b==null?void 0:b.temp_plan_id)||(b==null?void 0:b.roster_id);if(!S){t=!0;return}d[S]||(d[S]=[]),d[S].push(u)}),t){H.value=!1,G.error("存在未分配号源的项目,请先选择号源");return}const o=Object.keys(d);if(o.length===1){const u=Number(o[0]),b=d[u];it({mainlistid:b,planid:u,appointment_type:w.appointment_type,dotype:s,do_user:w.do_user,is_emergency:s==111?1:null}).then(S=>{var a,m,I,B;if(H.value=!1,S.status){if(Ce.value.forEach((y,T)=>{y.label=="开启申请单pdf"&&y.value}),Ve(()=>{var q;ee.value=!1;const y=[...U.value],T=p.value.filter(C=>C.list_status===0&&C.tishi_msg==="");if(T.length===0)y.forEach(C=>{const E=p.value.find($=>$.id===C);E&&A.value.toggleRowSelection(E,!0)});else{A.value.clearSelection();const C=new Set(T.map(E=>{var $;return($=E.department_resources)==null?void 0:$.department_resources_name}).filter(Boolean));p.value.forEach(E=>{var $;E.tishi_msg===""&&(E.list_status===0||C.has(($=E.department_resources)==null?void 0:$.department_resources_name))&&A.value.toggleRowSelection(E,!0)})}if(ee.value=!0,p.value.forEach(C=>{e[C.id]&&(console.log("回填 temp_plan_id:",C.id,e[C.id].temp_plan_id),C.temp_plan_id=e[C.id].temp_plan_id,C.department_resources||(C.department_resources={}),C.department_resources.department_resources_name=e[C.id].department_resources_name,C.reservation_date=e[C.id].reservation_date,C.period_begin_time=e[C.id].period_begin_time,C.period_end_time=e[C.id].period_end_time)}),console.log("回填后 entrustTableDate:",JSON.parse(JSON.stringify(p.value.map(C=>({id:C.id,temp_plan_id:C.temp_plan_id,list_status:C.list_status}))))),setTimeout(()=>{console.log("延迟检查 temp_plan_id:",JSON.parse(JSON.stringify(p.value.map(C=>({id:C.id,temp_plan_id:C.temp_plan_id,list_status:C.list_status})))))},2e3),h.value.length>0){const C=(q=h.value[0].department_resources)==null?void 0:q.department_resources_name;C&&(O.value=C)}if(h.value.some(C=>C.list_status===0)||K(),re.value.length>0){const C=b.map(E=>p.value.find($=>$.id===E)).filter(Boolean).map(E=>E.entrust_id);C.length>0&&Ge(C)}},!0),((m=(a=S.data)==null?void 0:a.fail_items)==null?void 0:m.length)>0){let y='<table style="width:100%;border-collapse:collapse;font-size:14px;">';y+='<tr style="background:#f5f5f5;"><td style="padding:4px 8px;border:1px solid #ddd;font-weight:700;">序号</td><td style="padding:4px 8px;border:1px solid #ddd;font-weight:700;">项目名称</td><td style="padding:4px 8px;border:1px solid #ddd;font-weight:700;">结果</td></tr>',S.data.fail_items.forEach((T,Y)=>{y+='<tr><td style="padding:4px 8px;border:1px solid #ddd;">'+(Y+1)+'</td><td style="padding:4px 8px;border:1px solid #ddd;">'+T.name+'</td><td style="padding:4px 8px;border:1px solid #ddd;color:red;">'+T.reason+"</td></tr>"}),y+="</table>",Ie.value=y,de.value=!0}}else if(((B=(I=S.data)==null?void 0:I.fail_items)==null?void 0:B.length)>0){let y='<table style="width:100%;border-collapse:collapse;font-size:14px;">';y+='<tr style="background:#f5f5f5;"><td style="padding:4px 8px;border:1px solid #ddd;font-weight:700;">序号</td><td style="padding:4px 8px;border:1px solid #ddd;font-weight:700;">项目名称</td><td style="padding:4px 8px;border:1px solid #ddd;font-weight:700;">结果</td></tr>',S.data.fail_items.forEach((T,Y)=>{y+='<tr><td style="padding:4px 8px;border:1px solid #ddd;">'+(Y+1)+'</td><td style="padding:4px 8px;border:1px solid #ddd;">'+T.name+'</td><td style="padding:4px 8px;border:1px solid #ddd;color:red;">'+T.reason+"</td></tr>"}),y+="</table>",Ie.value=y,de.value=!0}else oe.confirm(S.msg,"提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"error",showCancelButton:!1}).then(()=>{}).catch(()=>{})});return}const l=[],i=[],n=[];for(const u of o){const b=Number(u),S=d[u];try{const a=await it({mainlistid:S,planid:b,appointment_type:w.appointment_type,dotype:s,do_user:w.do_user,is_emergency:s==111?1:null});a.status?((((M=a.data)==null?void 0:M.mainlistids)||S).forEach(I=>{var y;const B=p.value.find(T=>T.id===I);if(B){const T=(B.period_begin_time?B.period_begin_time.substring(0,5):"")+"-"+(B.period_end_time?B.period_end_time.substring(0,5):"");l.push({name:B.entrust,room:((y=B.department_resources)==null?void 0:y.department_resources_name)||"",date:B.reservation_date||"",time:T}),n.push(B.entrust_id)}}),((x=(R=a.data)==null?void 0:R.fail_items)==null?void 0:x.length)>0&&a.data.fail_items.forEach(I=>{i.push({name:I.name,msg:I.reason})})):S.forEach(m=>{const I=p.value.find(B=>B.id===m);I&&i.push({name:I.entrust,msg:a.msg})})}catch{S.forEach(m=>{const I=p.value.find(B=>B.id===m);I&&i.push({name:I.entrust,msg:"请求异常"})})}}H.value=!1;let r='<table style="width:100%;border-collapse:collapse;font-size:14px;">';r+='<tr style="background:#f5f5f5;"><td style="padding:4px 8px;border:1px solid #ddd;font-weight:700;">序号</td><td style="padding:4px 8px;border:1px solid #ddd;font-weight:700;">项目名称</td><td style="padding:4px 8px;border:1px solid #ddd;font-weight:700;">检查室</td><td style="padding:4px 8px;border:1px solid #ddd;font-weight:700;">日期</td><td style="padding:4px 8px;border:1px solid #ddd;font-weight:700;">时间段</td><td style="padding:4px 8px;border:1px solid #ddd;font-weight:700;">结果</td></tr>';let g=1;l.forEach(u=>{r+='<tr><td style="padding:4px 8px;border:1px solid #ddd;">'+g+++'</td><td style="padding:4px 8px;border:1px solid #ddd;">'+u.name+'</td><td style="padding:4px 8px;border:1px solid #ddd;">'+u.room+'</td><td style="padding:4px 8px;border:1px solid #ddd;">'+u.date+'</td><td style="padding:4px 8px;border:1px solid #ddd;">'+u.time+'</td><td style="padding:4px 8px;border:1px solid #ddd;color:green;">预约成功</td></tr>'}),i.forEach(u=>{r+='<tr><td style="padding:4px 8px;border:1px solid #ddd;">'+g+++'</td><td style="padding:4px 8px;border:1px solid #ddd;">'+u.name+'</td><td style="padding:4px 8px;border:1px solid #ddd;" colspan="3">—</td><td style="padding:4px 8px;border:1px solid #ddd;color:red;">'+u.msg+"</td></tr>"}),r+="</table>",Ie.value=r,de.value=!0,l.length>0&&(Ve(()=>{var a;ee.value=!1;const u=[...U.value],b=p.value.filter(m=>m.list_status===0&&m.tishi_msg==="");if(b.length===0)u.forEach(m=>{const I=p.value.find(B=>B.id===m);I&&A.value.toggleRowSelection(I,!0)});else{A.value.clearSelection();const m=new Set(b.map(I=>{var B;return(B=I.department_resources)==null?void 0:B.department_resources_name}).filter(Boolean));p.value.forEach(I=>{var B;I.tishi_msg===""&&(I.list_status===0||m.has((B=I.department_resources)==null?void 0:B.department_resources_name))&&A.value.toggleRowSelection(I,!0)})}if(ee.value=!0,p.value.forEach(m=>{e[m.id]&&(console.log("回填 temp_plan_id:",m.id,e[m.id].temp_plan_id),m.temp_plan_id=e[m.id].temp_plan_id,m.department_resources||(m.department_resources={}),m.department_resources.department_resources_name=e[m.id].department_resources_name,m.reservation_date=e[m.id].reservation_date,m.period_begin_time=e[m.id].period_begin_time,m.period_end_time=e[m.id].period_end_time)}),console.log("回填后 entrustTableDate:",JSON.parse(JSON.stringify(p.value.map(m=>({id:m.id,temp_plan_id:m.temp_plan_id,list_status:m.list_status}))))),setTimeout(()=>{console.log("延迟检查 temp_plan_id:",JSON.parse(JSON.stringify(p.value.map(m=>({id:m.id,temp_plan_id:m.temp_plan_id,list_status:m.list_status})))))},2e3),h.value.length>0){const m=(a=h.value[0].department_resources)==null?void 0:a.department_resources_name;m&&(O.value=m)}h.value.some(m=>m.list_status===0)||K(),re.value.length>0&&Ge(n)},!0),Ce.value.forEach((u,b)=>{u.label=="开启申请单pdf"&&u.value}))},Et=()=>{oe.confirm("确定取消预约吗?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(async()=>{const s={};p.value.forEach(t=>{var o;!U.value.includes(t.id)&&t.temp_plan_id&&(s[t.id]={temp_plan_id:t.temp_plan_id,department_resources_name:(o=t.department_resources)==null?void 0:o.department_resources_name,reservation_date:t.reservation_date,period_begin_time:t.period_begin_time,period_end_time:t.period_end_time})});const e=h.value.map(t=>{var o;return{id:t.id,entrust_id:t.entrust_id,department_resources_name:((o=t.department_resources)==null?void 0:o.department_resources_name)||"",date:t.reservation_date||"",begin_time:t.period_begin_time||"",end_time:t.period_end_time||""}});ie.value=!0;const d=await Ut({ids:h.value.map(t=>t.id),reg_num:h.value[0].reg_num,do_user:w.do_user});d.status?(G.success("取消成功"),ie.value=!1,Ve(()=>{p.value.forEach(o=>{s[o.id]&&(o.temp_plan_id=s[o.id].temp_plan_id,o.department_resources||(o.department_resources={}),o.department_resources.department_resources_name=s[o.id].department_resources_name,o.reservation_date=s[o.id].reservation_date,o.period_begin_time=s[o.id].period_begin_time,o.period_end_time=s[o.id].period_end_time)});const t=e;if(t.length>0){const o=p.value.filter(l=>!t.find(i=>i.id===l.id)&&l.list_status===0&&l.temp_plan_id).map(l=>l.temp_plan_id);we({type:"optimal_time",regnum:w.reg_num,entrustid:t.map(l=>l.entrust_id),episodeid:w.episode_id,appointment_type:w.appointment_type,items:t,occupied_plan_ids:o,scope:w.scope,do_user:w.do_user}).then(l=>{l.status&&l.data.length>0&&(l.data.forEach(i=>{const n=p.value.find(r=>r.id===i.id);n&&(n.department_resources||(n.department_resources={}),n.department_resources.department_resources_name=i.department_resources_name,n.reservation_date=i.date,n.period_begin_time=i.begin_time,n.period_end_time=i.end_time,n.temp_plan_id=i.plan_id)}),O.value=l.data[0].department_resources_name,te.value=l.data.map(i=>i.plan_id),L.value=l.data[0].plan_id)})}},!0)):(G.error(d.msg||"取消失败"),ie.value=!1)})},Ct=()=>{jt({config_arrs:["开启申请单pdf","医生端打印"]}).then(s=>{s.status&&(Ce.value=s.data.list,Ce.value.forEach((e,d)=>{console.log(w.appointment_type),e.label=="医生端打印"&&e.value==="0"&&w.appointment_type==1&&(re.value=[])}))})},Ge=s=>{const e=s||J.value,d=h.value.filter(l=>e.includes(l.entrust_id)&&l.list_status!=1);if(d.length>0){const l={0:"未预约",2:"登记",3:"完成"};ye.value=d.map(i=>({item_name:i.entrust,msg:l[i.list_status]||"未知状态"})),ae.value=!0;return}const o="https://yj.dev.cjy.net.cn/api/GetCheckPdf?Dev=1&Type=group&"+e.map(l=>"OrderNoList[]="+l).join("&");fetch(o).then(l=>l.blob()).then(l=>{const i=URL.createObjectURL(l),n=document.createElement("iframe");n.style.display="none",n.src=i,n.onload=()=>{n.contentWindow.print(),URL.revokeObjectURL(i)},document.body.appendChild(n)})},Dt=()=>{O.value="",se.value=Be(_e.value),console.log(se.value),K()};function It(s){const e=s.getFullYear(),d=String(s.getMonth()+1).padStart(2,"0"),t=String(s.getDate()).padStart(2,"0");return`${e}-${d}-${t}`}function Be(s=new Date,e=15){const d=new Date(s),t=[];if(isNaN(d.getTime()))throw new Error("无效的日期格式");for(let o=0;o<e;o++){const l=new Date(d);l.setDate(d.getDate()+o);const i=It(l);t.push(i)}return t}function tt(s){if(!/^\d{4}-\d{2}-\d{2}$/.test(s))return!1;const d=new Date(s);return d.toString()!=="Invalid Date"&&!isNaN(d.getTime())}function Tt(s,e){if(!tt(s)||!tt(e))return console.error("日期格式不正确,请使用 YYYY-MM-DD"),!1;const d=new Date(s);return(new Date(e)-d)/(1e3*60*60*24)>15}function dt(){const s=new Date,e=s.getFullYear(),d=String(s.getMonth()+1).padStart(2,"0"),t=String(s.getDate()).padStart(2,"0");return`${e}-${d}-${t}`}let Ae=v(!1);return Vt(()=>{Ae.value=!0,Ct(),se.value=Be(),Ve(()=>{h.value.some(e=>e.list_status===0)||K()})}),(s,e)=>{var S;const d=Q("el-alert"),t=Q("el-table-column"),o=Q("el-tag"),l=Q("el-table"),i=Q("el-button"),n=Q("el-checkbox"),r=Q("el-checkbox-group"),g=Q("el-tooltip"),M=Q("el-date-picker"),R=Q("el-empty"),x=Q("el-dialog"),u=Q("el-icon"),b=Bt("loading");return D(),z("div",Ht,[c(j)?(D(),z("div",Jt,[k("div",Ft,[k("span",Gt,N(c(j).user_name),1),V("("+N(c(j).user_sex_label)+" "+N(c(j).age)+"岁)",1)]),k("div",At,[V(N(c(j).patient_type_label)+"号:",1),k("span",qt,N(c(j).patient_type==0?(S=c(j).episodeid)==null?void 0:S.slice(-10):c(j).reg_num),1)]),k("div",Wt,[e[22]||(e[22]=V("电话:",-1)),k("span",Zt,N(c(j).user_phone),1)]),c(j).warddesc?(D(),z("div",Kt,[e[23]||(e[23]=V("病区:",-1)),k("span",Qt,N(c(j).warddesc),1)])):P("",!0),c(j).bedno?(D(),z("div",Xt,[e[24]||(e[24]=V("床号:",-1)),k("span",ed,N(c(j).bedno),1)])):P("",!0),c(j).diagnosisName?(D(),z("div",td,[e[25]||(e[25]=V("诊断:",-1)),k("span",dd,N(c(j).diagnosisName),1)])):P("",!0)])):(D(),z("div",nd," 获取患者信息失败 ")),ut.value?(D(),Z(d,{key:2,type:"danger",closable:!1,"show-icon":"",style:{"margin-bottom":"8px"}},{title:_(()=>[...e[26]||(e[26]=[k("span",{style:{"font-weight":"700",color:"#f56c6c"}},"患者所有检查项目未预约至同一天,请注意是否需手动调整预约",-1)])]),_:1})):P("",!0),c(Le)?(D(),Z(d,{key:3,type:"warning",closable:!1,"show-icon":"",style:{"margin-bottom":"8px"}},{title:_(()=>[k("span",ad,N(c(Le)),1)]),_:1})):P("",!0),c(Ue)?(D(),Z(d,{key:4,type:"warning",closable:!1,"show-icon":"",style:{"margin-bottom":"8px"}},{title:_(()=>[k("span",sd,N(c(Ue)),1)]),_:1})):P("",!0),k("div",id,[at((D(),Z(l,{data:c(p),style:{width:"100%"},"row-key":"id",ref_key:"entrustTableRef",ref:A,"row-class-name":gt,onSelectionChange:mt},{default:_(()=>[f(t,{type:"selection",width:"36",selectable:xt}),f(t,{prop:"tishi_msg",width:"200"},{header:_(()=>[k("div",null,[k("div",null,"共 "+N(c(p).length)+" 项,已选 "+N(c(U).length)+" 项",1),Qe.value>0?(D(),z("div",ld,"同检查室项目 "+N(Qe.value)+" 项",1)):P("",!0)])]),default:_(a=>[k("span",od,N(a.$index+1),1),a.row.tishi_msg!=""?(D(),z("span",rd,N(a.row.tishi_msg),1)):(D(),z("span",pd,"正常"))]),_:1}),f(t,{prop:"list_status",label:"预约状态",width:"80"},{default:_(a=>[a.row.list_status===0?(D(),Z(o,{key:0,class:"ml-2",type:"info"},{default:_(()=>[...e[27]||(e[27]=[V("未预约",-1)])]),_:1})):P("",!0),a.row.list_status===1?(D(),Z(o,{key:1,class:"ml-2",type:"success"},{default:_(()=>[...e[28]||(e[28]=[V("已预约",-1)])]),_:1})):P("",!0),a.row.list_status===2?(D(),Z(o,{key:2,class:"ml-2"},{default:_(()=>[...e[29]||(e[29]=[V("登记",-1)])]),_:1})):P("",!0),a.row.list_status===3?(D(),Z(o,{key:3,class:"ml-2",type:"warning"},{default:_(()=>[...e[30]||(e[30]=[V("完成",-1)])]),_:1})):P("",!0)]),_:1}),f(t,{label:"项目","show-overflow-tooltip":""},{default:_(a=>[V(N(a.row.entrust)+N(a.row.requestComment?"("+a.row.requestComment+")":""),1)]),_:1}),f(t,{prop:"is_pay",label:"是否交费",width:"60",align:"center"},{default:_(a=>[a.row.is_pay==1?(D(),z("span",ud,"是")):P("",!0),a.row.is_pay==0?(D(),z("span",_d,"否")):P("",!0)]),_:1}),f(t,{prop:"his_is_emergency",label:"是否加急",width:"60",align:"center"},{default:_(a=>[a.row.his_is_emergency==1?(D(),z("span",md,"是")):P("",!0),a.row.his_is_emergency==0?(D(),z("span",cd,"否")):P("",!0)]),_:1}),f(t,{prop:"department_resources.department_resources_name",label:"排班",width:"220"}),f(t,{prop:"reservation_date",label:"预约日期",width:"120"}),f(t,{prop:"check_begin_time",label:"预约时间",width:"120"},{default:_(a=>[a.row.period_begin_time&&a.row.period_end_time?(D(),z("span",fd,N(a.row.period_begin_time.substring(0,5))+"~"+N(a.row.period_end_time.substring(0,5)),1)):P("",!0)]),_:1}),f(t,{prop:"limosis",label:"是否空腹",width:"60",align:"center"},{default:_(a=>[a.row.limosis==0?(D(),z("span",gd,"否")):(D(),z("span",xd,"是"))]),_:1}),f(t,{prop:"reservation_department",label:"申请科室",width:"150"}),f(t,{prop:"",label:"医嘱时间",width:"200"},{default:_(a=>[V(N(a.row.entrust_date)+" "+N(a.row.entrust_time),1)]),_:1}),f(t,{prop:"docotr",label:"申请医生",width:"80"})]),_:1},8,["data"])),[[b,c(ie)]])]),k("div",hd,[k("div",bd,[k("div",yd,[(D(!0),z(Pe,null,Ye(c(ue),(a,m)=>(D(),z("div",{key:m,class:st({"ZhenShiButton zhenshiButton_active":c(O)===a,ZhenShiButton:c(O)!==a}),onClick:I=>bt(a)},N(a),11,vd))),128)),e[41]||(e[41]=k("div",{class:"shuxian"},null,-1)),Xe.value?(D(),Z(i,{key:0,class:"do_button",type:"danger",onClick:e[0]||(e[0]=a=>Je(111))},{default:_(()=>[...e[31]||(e[31]=[V("加急预约",-1)])]),_:1})):P("",!0),f(i,{class:"do_button",type:"success",onClick:e[1]||(e[1]=a=>Je(1))},{default:_(()=>[...e[32]||(e[32]=[V("预约",-1)])]),_:1}),f(i,{class:"do_button",type:"warning",onClick:e[2]||(e[2]=a=>Je(2))},{default:_(()=>[...e[33]||(e[33]=[V("更改预约时间",-1)])]),_:1}),f(i,{class:"do_button",type:"danger",onClick:e[3]||(e[3]=a=>Et())},{default:_(()=>[...e[34]||(e[34]=[V("取消预约",-1)])]),_:1}),f(i,{onClick:e[4]||(e[4]=a=>Ge())},{default:_(()=>[...e[35]||(e[35]=[V("打印申请单",-1)])]),_:1}),k("div",wd,[f(r,{modelValue:c(re),"onUpdate:modelValue":e[5]||(e[5]=a=>F(re)?re.value=a:re=a)},{default:_(()=>[f(n,{label:"1"},{default:_(()=>[...e[36]||(e[36]=[V("预约完成后打印申请单",-1)])]),_:1})]),_:1},8,["modelValue"]),f(g,{placement:"top",content:Jd,"popper-class":"tip-pre-line"},{default:_(()=>[f(n,{modelValue:c(fe),"onUpdate:modelValue":e[6]||(e[6]=a=>F(fe)?fe.value=a:fe=a)},{default:_(()=>[...e[37]||(e[37]=[V("自动选中能一起预约的检查项目",-1)])]),_:1},8,["modelValue"])]),_:1})]),f(g,{placement:"top",content:"点击此按钮,系统会推荐最近能用的时间段号源,多个检查项目可能会跨天跨时间段","popper-class":"tip-pre-line"},{default:_(()=>[f(i,{class:"do_button_recommend",type:"primary",style:{"margin-left":"20px",width:"120px"},onClick:vt},{default:_(()=>[...e[38]||(e[38]=[V("推荐最近时间号源",-1)])]),_:1})]),_:1}),f(g,{placement:"top",content:"点击此按钮,系统会推荐最近的能在同一天完成检查的号源","popper-class":"tip-pre-line"},{default:_(()=>[f(i,{class:"do_button_recommend",type:"primary",style:{width:"120px"},onClick:wt},{default:_(()=>[...e[39]||(e[39]=[V("推荐同一天号源",-1)])]),_:1})]),_:1}),f(g,{placement:"top",content:"点击此按钮,系统会推荐最近的能在同一天同一时间段完成检查的号源","popper-class":"tip-pre-line"},{default:_(()=>[f(i,{class:"do_button_recommend",type:"primary",onClick:kt},{default:_(()=>[...e[40]||(e[40]=[V("推荐同一天同一时间段号源",-1)])]),_:1})]),_:1})]),k("div",null,[f(M,{modelValue:c(_e),"onUpdate:modelValue":e[7]||(e[7]=a=>F(_e)?_e.value=a:_e=a),type:"date",placeholder:"跳转日期",onChange:e[8]||(e[8]=a=>Dt())},null,8,["modelValue"])])]),at((D(),z("div",kd,[k("table",Sd,[c(h).length>0?(D(),z("tr",Ed,[e[42]||(e[42]=k("td",{style:{width:"120px"}},null,-1)),(D(!0),z(Pe,null,Ye(c(se),(a,m)=>(D(),z("td",Cd,N(a.substring(5,10))+" "+N(pt(a)),1))),256))])):P("",!0),c(se).length>0&&c(pe).length>0?(D(!0),z(Pe,{key:1},Ye(c(pe),(a,m)=>(D(),z("tr",{key:m,class:"table_plan_row"},[(D(!0),z(Pe,null,Ye(a,(I,B)=>(D(),z("td",{key:B,class:st({planActive:c(te).includes(I.id)&&I.id!==0&&I.id,plandisable:!I.enable&&B!=="time_range"}),onClick:y=>yt(I.id)},[B=="time_range"?(D(),z("span",Id,N(I),1)):P("",!0),k("span",null,N(I.use_count),1)],10,Dd))),128))]))),128)):P("",!0)]),c(h).length==0?(D(),z("div",Td,[f(R,{description:"请选择项目"})])):P("",!0),c(h).length>0&&c(pe).length==0?(D(),z("div",Md,[f(R,{description:"暂无号源"})])):P("",!0)])),[[b,c(H)]])]),f(x,{modelValue:c(ae),"onUpdate:modelValue":e[10]||(e[10]=a=>F(ae)?ae.value=a:ae=a),title:"提示",width:"500"},{footer:_(()=>[k("div",Nd,[f(i,{type:"primary",onClick:e[9]||(e[9]=a=>F(ae)?ae.value=!1:ae=!1)},{default:_(()=>[...e[43]||(e[43]=[V(" 确定 ",-1)])]),_:1})])]),default:_(()=>[e[44]||(e[44]=k("div",{style:{"margin-bottom":"12px","font-weight":"700",color:"#f56c6c"}},"以下检查暂不可打印申请单",-1)),f(l,{data:c(ye),style:{width:"100%"},"row-key":"id"},{default:_(()=>[f(t,{prop:"item_name",label:"项目名称"}),f(t,{prop:"msg",label:"异常提示"})]),_:1},8,["data"])]),_:1},8,["modelValue"]),f(x,{modelValue:c(X),"onUpdate:modelValue":e[12]||(e[12]=a=>F(X)?X.value=a:X=a),title:"提示",width:"800"},{footer:_(()=>[f(i,{type:"primary",onClick:e[11]||(e[11]=a=>F(X)?X.value=!1:X=!1)},{default:_(()=>[...e[46]||(e[46]=[V("确定",-1)])]),_:1})]),default:_(()=>[k("div",Vd,[f(u,{class:"el-icon-warning",style:{color:"#e6a23c","font-size":"24px","flex-shrink":"0","margin-top":"2px"}},{default:_(()=>[f(c(Oe))]),_:1}),k("div",null,[e[45]||(e[45]=k("p",{style:{margin:"0 0 12px 0","font-weight":"700"}},"最近可用的同一时间段号源数量不足,无法把当前全部检查项目预约在同一时间段,系统已经自动拆分。",-1)),k("div",{innerHTML:c(ge)},null,8,Bd)])])]),_:1},8,["modelValue"]),f(x,{modelValue:c(le),"onUpdate:modelValue":e[14]||(e[14]=a=>F(le)?le.value=a:le=a),title:"时段冲突",width:"800"},{footer:_(()=>[f(i,{type:"primary",onClick:e[13]||(e[13]=a=>F(le)?le.value=!1:le=!1)},{default:_(()=>[...e[48]||(e[48]=[V("我知道了",-1)])]),_:1})]),default:_(()=>[k("div",zd,[f(u,{style:{color:"#F56C6C","font-size":"24px","flex-shrink":"0","margin-top":"2px"}},{default:_(()=>[f(c(Oe))]),_:1}),k("div",null,[e[47]||(e[47]=k("p",{style:{margin:"0 0 12px 0","font-weight":"700"}}," 以下项目与当前选择的时间段存在冲突,请确认是否继续预约: ",-1)),k("div",{innerHTML:c(We)},null,8,Rd)])])]),_:1},8,["modelValue"]),f(x,{modelValue:c(de),"onUpdate:modelValue":e[16]||(e[16]=a=>F(de)?de.value=a:de=a),title:"预约结果",width:"800"},{footer:_(()=>[f(i,{type:"primary",onClick:e[15]||(e[15]=a=>F(de)?de.value=!1:de=!1)},{default:_(()=>[...e[49]||(e[49]=[V("确定",-1)])]),_:1})]),default:_(()=>[k("div",Pd,[f(u,{style:{color:"#e6a23c","font-size":"24px","flex-shrink":"0","margin-top":"2px"}},{default:_(()=>[f(c(Oe))]),_:1}),k("div",{innerHTML:c(Ie)},null,8,Yd)])]),_:1},8,["modelValue"]),f(x,{modelValue:c(ne),"onUpdate:modelValue":e[18]||(e[18]=a=>F(ne)?ne.value=a:ne=a),title:"预约推荐结果",width:"800"},{footer:_(()=>[f(i,{type:"primary",onClick:e[17]||(e[17]=a=>F(ne)?ne.value=!1:ne=!1)},{default:_(()=>[...e[50]||(e[50]=[V("确定",-1)])]),_:1})]),default:_(()=>[k("div",Od,[f(u,{style:{color:"#e6a23c","font-size":"24px","flex-shrink":"0","margin-top":"2px"}},{default:_(()=>[f(c(Oe))]),_:1}),k("div",{innerHTML:c(Te)},null,8,$d)])]),_:1},8,["modelValue"]),f(x,{modelValue:c(W),"onUpdate:modelValue":e[21]||(e[21]=a=>F(W)?W.value=a:W=a),title:"预约确认",width:"800","close-on-click-modal":!1,onKeyup:Rt(Ke,["enter"])},{footer:_(()=>[c(be)?P("",!0):(D(),Z(i,{key:0,onClick:e[19]||(e[19]=a=>F(W)?W.value=!1:W=!1)},{default:_(()=>[...e[54]||(e[54]=[V("取消",-1)])]),_:1})),c(be)?P("",!0):(D(),Z(i,{key:1,type:"primary",onClick:Ke},{default:_(()=>[...e[55]||(e[55]=[V("确认",-1)])]),_:1})),c(be)?(D(),Z(i,{key:2,type:"primary",onClick:e[20]||(e[20]=a=>F(W)?W.value=!1:W=!1)},{default:_(()=>[...e[56]||(e[56]=[V("确认",-1)])]),_:1})):P("",!0)]),default:_(()=>[c(je)?(D(),Z(d,{key:0,type:"warning",closable:!1,"show-icon":"",style:{"margin-bottom":"12px"}},{title:_(()=>[k("span",Ld,[e[51]||(e[51]=V("HIS中选择的执行科室是“",-1)),k("span",Ud,N(Ze.value.his),1),e[52]||(e[52]=V("”,预约选择的执行科室是“",-1)),k("span",jd,N(Ze.value.appoint),1),e[53]||(e[53]=V("”,是否按照预约选择的执行科室进行调整?",-1))])]),_:1})):P("",!0),f(l,{data:c(Me),style:{width:"100%"},"max-height":"400","row-class-name":rt},{default:_(()=>[f(t,{prop:"item_name",label:"项目名称","min-width":"140"}),f(t,{label:"HIS中执行科室","min-width":"180"},{default:_(a=>[k("div",null,N(a.row.entrust_dept_name),1)]),_:1}),f(t,{label:"预约系统中执行科室","min-width":"180"},{default:_(a=>[k("div",{style:zt({color:a.row.dept_mismatch?"#f56c6c":"inherit"})},N(a.row.appointment_dept_name),5)]),_:1}),f(t,{label:"预约时间","min-width":"160"},{default:_(a=>{var m,I;return[k("div",null,N(a.row.appointment_date)+" "+N((m=a.row.begin_time)==null?void 0:m.substring(0,5))+"-"+N((I=a.row.end_time)==null?void 0:I.substring(0,5)),1),a.row.check_status==="fail"?(D(),z("div",Hd,N(a.row.check_msg),1)):P("",!0)]}),_:1})]),_:1},8,["data"])]),_:1},8,["modelValue"])])}}},Ad=Nt(Fd,[["__scopeId","data-v-1154f5d8"]]);export{Ad as Y};
|