import{r as $,a as G,b as H,c as J,e as s,j as z,k as o,l as c,q as O,i as P,u as i,v as Q,F as R,g as W,o as X,y as Y,t as Z}from"./app-OFnD_EfZ.js";import{_ as ee}from"./CustomTable-wjyxWH_G.js";import{r as te}from"./MagnifyingGlassIcon-BNDw92ps.js";import{r as ae}from"./PlusCircleIcon-DKkKuqdz.js";import{r as se}from"./PencilIcon-DlHVKXpT.js";/* empty css                                                    */const le={class:"sm:p-4 md:p-6"},oe={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center mb-4 gap-3 sm:gap-0 mt-4 sm:mt-0"},ne={class:"flex flex-col sm:flex-row gap-3 w-full sm:w-auto justify-between"},re={class:"relative w-full sm:w-64"},ce={class:"text-blue-900 hover:underline text-sm rounded border border-gray-200 shadow px-1 py-1"},xe={__name:"Index",setup(de){const d={0:{label:"失效",class:"text-red-600"},1:{label:"生效",class:"text-green-600"}},u={daily:"日",week:"週",month:"月",season:"季",year:"年"},n=$([]);G(async()=>{const a=await W.get("/api/dispatch");n.value=a.data.data.map(e=>{var l,t;return{...e,cycleLabel:u[e.cycle]||e.cycle,stateLabel:((l=d[e.state])==null?void 0:l.label)||e.state,stateClass:((t=d[e.state])==null?void 0:t.class)||""}})});const r=$(""),E=H(()=>{if(!r.value.trim())return n.value;const a=r.value.toLowerCase();return n.value.filter(e=>{var m,p,b,f,w,x,y,k,v,C,L,_,g,h,q,D,V,M,N,j,B;const l=((m=e.banklist)==null?void 0:m.name.toLowerCase())||"",t=((f=(b=(p=e.banklist)==null?void 0:p.equipment)==null?void 0:b.name)==null?void 0:f.toLowerCase())||"",F=((k=(y=(x=(w=e.banklist)==null?void 0:w.equipment)==null?void 0:x.category)==null?void 0:y.name)==null?void 0:k.toLowerCase())||"",T=((_=(L=(C=(v=e.banklist)==null?void 0:v.equipment)==null?void 0:C.factory)==null?void 0:L.name)==null?void 0:_.toLowerCase())||"",U=((q=(h=(g=e.banklist)==null?void 0:g.equipment)==null?void 0:h.department)==null?void 0:q.toLowerCase())||"",I=((D=u[e.cycle])==null?void 0:D.toLowerCase())||"",K=((V=e.startdate)==null?void 0:V.toLowerCase())||"",S=((N=(M=d[e.state])==null?void 0:M.label)==null?void 0:N.toLowerCase())||"",A=((B=(j=e.checker)==null?void 0:j.name)==null?void 0:B.toLowerCase())||"";return l.includes(a)||t.includes(a)||F.includes(a)||T.includes(a)||U.includes(a)||I.includes(a)||K.includes(a)||A.includes(a)||S.includes(a)})});return(a,e)=>{const l=O("router-link");return X(),J(R,null,[e[4]||(e[4]=s("h2",{class:"flex items-center text-xl sm:text-3xl px-3 pb-2 font-semibold text-black dark:text-white border-b-4 border-zinc-200"},[s("div",{class:"text-sm mr-2"},":::"),z(" 派工設定 ")],-1)),s("div",le,[s("div",oe,[s("div",null,[s("button",{onClick:e[0]||(e[0]=(...t)=>a.openCreateModal&&a.openCreateModal(...t)),class:"flex items-center bg-white text-lg text-blue-900 font-semibold px-2 py-1 rounded border border-blue-200 w-full sm:w-auto"},[o(l,{to:"/Dispatch/Create",class:"flex w-full justify-center"},{default:c(()=>[o(i(ae),{class:"w-7 h-7 text-blue-900 mr-1"}),e[3]||(e[3]=z(" 新增 ",-1))]),_:1,__:[3]})])]),s("div",ne,[s("div",re,[o(i(te),{class:"absolute left-2 top-1/2 transform -translate-y-1/2 w-5 h-5 text-gray-400"}),P(s("input",{"onUpdate:modelValue":e[1]||(e[1]=t=>r.value=t),type:"text",placeholder:"搜尋",class:"border rounded px-3 py-2 text-sm w-full sm:w-64 pl-8"},null,512),[[Q,r.value]])])])]),o(ee,{items:E.value,columns:[{label:"名稱",field:"banklist.name"},{label:"設備名稱",field:"banklist.equipment.name"},{label:"法定名稱",field:"banklist.equipment.category.name"},{label:"廠區",field:"banklist.equipment.factory.name"},{label:"部門",field:"banklist.equipment.department"},{label:"週期",field:"cycleLabel"},{label:"起始日期",field:"startdate"},{label:"檢核人員",field:"checker.name"},{label:"狀態",field:"stateLabel"}],modelValue:n.value,"onUpdate:modelValue":e[2]||(e[2]=t=>n.value=t),rows:7,selectable:!1},{"column-stateLabel":c(({data:t})=>[s("span",{class:Y(t.stateClass)},Z(t.stateLabel),3)]),action:c(({data:t})=>[s("button",ce,[o(l,{to:`/Dispatch/${t.id}/Edit`,class:"hover:underline text-sm"},{default:c(()=>[o(i(se),{class:"w-5 h-5"})]),_:2},1032,["to"])])]),_:1},8,["items","modelValue"])])],64)}}};export{xe as default};
