import{$ as e,H as t,L as n,P as r,V as i,Wt as a,_ as o,d as s,et as c,i as l,lt as u,p as d,st as f,u as p,v as m,z as h}from"./runtime-core.esm-bundler-DbRZbT7v.js";import{s as g}from"./index-Mgun2LFs.js";import"./request-DG5cMCYw.js";import{r as _,t as v}from"./nanny-Cr-ojRag.js";var y={class:`p-6 space-y-4`},b={class:`bg-white rounded-2xl border border-gray-100 shadow-sm p-4 flex items-center flex-wrap gap-3`},x={class:`bg-white rounded-2xl border border-gray-100 shadow-sm`},S={class:`flex items-center justify-between px-5 py-4 border-b border-gray-50`},C={class:`px-2`},w={class:`px-5 py-3 border-t border-gray-50`},T={__name:`index`,setup(T){let E=u([]),D=u(0),O=u(!1),k=u(!1),A=u(!1),j=u([]),M=f({nanny_id:``,start_date:``,end_date:``}),N=f({page:1,per_page:31}),P=f({nanny_id:``,nanny_order_id:``,schedule_date:``,type:1,remark:``}),F={1:`上班`,2:`休息`,3:`请假`},I={1:`success`,2:`info`,3:`warning`};async function L(){O.value=!0;try{let e=await _.getList({...M,...N});E.value=e.data?.list||e.data?.data||[],D.value=e.data?.total||0}finally{O.value=!1}}async function R(){try{let e=await v.getList({per_page:200,status:2});j.value=e.data?.list||e.data?.data||[]}catch{}}function z(){N.page=1,L()}function B(){Object.assign(M,{nanny_id:``,start_date:``,end_date:``}),z()}function V(){Object.assign(P,{nanny_id:``,nanny_order_id:``,schedule_date:``,type:1,remark:``}),k.value=!0}async function H(){if(!P.nanny_id||!P.schedule_date){g.warning(`请填写必要信息`);return}A.value=!0;try{await _.create(P),g.success(`排班成功`),k.value=!1,L()}finally{A.value=!1}}function U(e){N.page=e,L()}return r(()=>{L(),R()}),(r,u)=>{let f=i(`el-option`),g=i(`el-select`),_=i(`el-date-picker`),v=i(`el-button`),T=i(`el-table-column`),L=i(`el-tag`),R=i(`el-table`),W=i(`el-pagination`),G=i(`el-form-item`),K=i(`el-input`),q=i(`el-form`),J=i(`el-dialog`),Y=t(`loading`);return n(),d(`div`,y,[p(`div`,b,[m(g,{modelValue:M.nanny_id,"onUpdate:modelValue":u[0]||=e=>M.nanny_id=e,placeholder:`选择月嫂`,clearable:``,style:{width:`160px`}},{default:e(()=>[(n(!0),d(l,null,h(j.value,e=>(n(),s(f,{key:e.id,label:e.name,value:e.id},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`]),m(_,{modelValue:M.start_date,"onUpdate:modelValue":u[1]||=e=>M.start_date=e,type:`date`,"value-format":`YYYY-MM-DD`,placeholder:`开始日期`},null,8,[`modelValue`]),m(_,{modelValue:M.end_date,"onUpdate:modelValue":u[2]||=e=>M.end_date=e,type:`date`,"value-format":`YYYY-MM-DD`,placeholder:`结束日期`},null,8,[`modelValue`]),m(v,{type:`primary`,onClick:z},{default:e(()=>[...u[10]||=[o(`查询`,-1)]]),_:1}),m(v,{onClick:B},{default:e(()=>[...u[11]||=[o(`重置`,-1)]]),_:1})]),p(`div`,x,[p(`div`,S,[u[13]||=p(`div`,{class:`flex items-center gap-3`},[p(`span`,{class:`font-medium text-gray-700`},`排班记录`)],-1),m(v,{type:`primary`,onClick:V},{default:e(()=>[...u[12]||=[o(`新增排班`,-1)]]),_:1})]),p(`div`,C,[c((n(),s(R,{data:E.value,style:{width:`100%`}},{default:e(()=>[m(T,{label:`月嫂`,"min-width":`100`},{default:e(({row:e})=>[o(a(e.nanny?.name||`-`),1)]),_:1}),m(T,{prop:`schedule_date`,label:`日期`,width:`120`}),m(T,{label:`类型`,width:`90`,align:`center`},{default:e(({row:t})=>[m(L,{type:I[t.type],size:`small`},{default:e(()=>[o(a(F[t.type]),1)]),_:2},1032,[`type`])]),_:1}),m(T,{label:`关联订单`,"min-width":`120`},{default:e(({row:e})=>[o(a(e.order?.order_no||`-`),1)]),_:1}),m(T,{prop:`remark`,label:`备注`,"min-width":`150`})]),_:1},8,[`data`])),[[Y,O.value]])]),p(`div`,w,[m(W,{"current-page":N.page,"onUpdate:currentPage":u[3]||=e=>N.page=e,total:D.value,layout:`total,prev,pager,next`,background:``,onCurrentChange:U},null,8,[`current-page`,`total`])])]),m(J,{modelValue:k.value,"onUpdate:modelValue":u[9]||=e=>k.value=e,title:`新增排班`,width:`450px`,"destroy-on-close":``},{footer:e(()=>[m(v,{onClick:u[8]||=e=>k.value=!1},{default:e(()=>[...u[14]||=[o(`取消`,-1)]]),_:1}),m(v,{type:`primary`,loading:A.value,onClick:H},{default:e(()=>[...u[15]||=[o(`确定`,-1)]]),_:1},8,[`loading`])]),default:e(()=>[m(q,{"label-width":`80px`},{default:e(()=>[m(G,{label:`月嫂`},{default:e(()=>[m(g,{modelValue:P.nanny_id,"onUpdate:modelValue":u[4]||=e=>P.nanny_id=e,style:{width:`100%`}},{default:e(()=>[(n(!0),d(l,null,h(j.value,e=>(n(),s(f,{key:e.id,label:e.name,value:e.id},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`])]),_:1}),m(G,{label:`日期`},{default:e(()=>[m(_,{modelValue:P.schedule_date,"onUpdate:modelValue":u[5]||=e=>P.schedule_date=e,type:`date`,"value-format":`YYYY-MM-DD`,style:{width:`100%`}},null,8,[`modelValue`])]),_:1}),m(G,{label:`类型`},{default:e(()=>[m(g,{modelValue:P.type,"onUpdate:modelValue":u[6]||=e=>P.type=e,style:{width:`100%`}},{default:e(()=>[(n(),d(l,null,h(F,(e,t)=>m(f,{key:t,label:e,value:Number(t)},null,8,[`label`,`value`])),64))]),_:1},8,[`modelValue`])]),_:1}),m(G,{label:`备注`},{default:e(()=>[m(K,{modelValue:P.remark,"onUpdate:modelValue":u[7]||=e=>P.remark=e},null,8,[`modelValue`])]),_:1})]),_:1})]),_:1},8,[`modelValue`])])}}};export{T as default};