import{d as I,Y as L,r as g,z as N,c as _,q as S,aY as Y,Z as A,w as o,B as w,C as m,a$ as F,b as a,F as M,j as R,x,a as n,h as y,t as r,a5 as q,L as U,i as Z,E as G,u as H,au as J,b1 as K,o as c}from"./index-DqVhJ65C.js";/* empty css                *//* empty css                  *//* empty css               */const O={class:"p-6"},P={class:"flex justify-between items-center"},Q={class:"flex items-center gap-4"},W={class:"text-xl font-medium dark:text-gray-100"},X={class:"text-gray-500 text-sm"},ee={class:"space-y-6"},te={class:"flex-shrink-0"},ae={class:"text-xs text-gray-400 mb-1"},se={class:"whitespace-pre-wrap text-sm dark:text-gray-200"},oe={key:0,class:"mt-8 border-t pt-6 dark:border-gray-700"},ne={class:"mt-4 flex justify-end"},le={key:1,class:"mt-8 text-center text-gray-500"},me=I({__name:"TicketDetail",setup(re){const k=L().params.id,s=g(null),p=g(!1),i=g(""),v=g(!1),b=async()=>{p.value=!0;try{const e=await w.get(`/ticket/${k}`);e.code===0?s.value=e.data:m.error(e.message)}catch(e){console.error(e)}finally{p.value=!1}},E=async()=>{if(!i.value)return m.warning("请输入内容");v.value=!0;try{const e=await w.post(`/ticket/${k}/reply`,{content:i.value});e.code===0?(m.success("回复成功"),i.value="",b()):m.error(e.message)}catch(e){m.error(e.message)}finally{v.value=!1}},C=e=>e===2?"info":e===1?"warning":"success",B=e=>e===2?"已关闭":e===1?"待回复":"处理中";return N(()=>{b()}),(e,l)=>{const V=G,h=Z,T=K,$=q,j=U,D=F,z=Y;return c(),_("div",O,[S((c(),A(D,{class:"max-w-4xl mx-auto dark:bg-gray-800 dark:border-gray-700"},{header:o(()=>{var d,u,t;return[a("div",P,[a("div",Q,[n(h,{circle:"",onClick:l[0]||(l[0]=f=>e.$router.back())},{default:o(()=>[n(V,null,{default:o(()=>[n(H(J))]),_:1})]),_:1}),a("h2",W,r((d=s.value)==null?void 0:d.subject),1),n(T,{type:C((u=s.value)==null?void 0:u.status)},{default:o(()=>{var f;return[y(r(B((f=s.value)==null?void 0:f.status)),1)]}),_:1},8,["type"])]),a("span",X,"#"+r((t=s.value)==null?void 0:t.id),1)])]}),default:o(()=>{var d,u;return[a("div",ee,[(c(!0),_(M,null,R((d=s.value)==null?void 0:d.replies,t=>(c(),_("div",{key:t.id,class:x(["flex gap-4",t.is_admin?"flex-row-reverse":""])},[a("div",te,[n($,{size:40,class:x(t.is_admin?"bg-blue-600":"bg-gray-400")},{default:o(()=>[y(r(t.is_admin?"Admin":"You"),1)]),_:2},1032,["class"])]),a("div",{class:x(["max-w-[70%] rounded-lg p-4",t.is_admin?"bg-blue-50 dark:bg-blue-900/30 text-right":"bg-gray-50 dark:bg-gray-700"])},[a("div",ae,r(t.create_time),1),a("div",se,r(t.content),1)],2)],2))),128))]),((u=s.value)==null?void 0:u.status)!==2?(c(),_("div",oe,[n(j,{modelValue:i.value,"onUpdate:modelValue":l[1]||(l[1]=t=>i.value=t),type:"textarea",rows:4,placeholder:"请输入回复内容..."},null,8,["modelValue"]),a("div",ne,[n(h,{type:"primary",loading:v.value,onClick:E},{default:o(()=>[...l[2]||(l[2]=[y("发送回复",-1)])]),_:1},8,["loading"])])])):(c(),_("div",le," 此工单已关闭 "))]}),_:1})),[[z,p.value]])])}}});export{me as default};
