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