import{d as $,r as s,H as q,z as H,c as J,b as p,a as e,q as K,w as o,i as O,aY as Y,Z,bc as A,a0 as G,B as h,b2 as Q,h as i,b0 as R,g as W,t as v,b1 as X,J as ee,K as te,L as le,b3 as ae,b4 as oe,C as c,o as j}from"./index-DqVhJ65C.js";/* empty css               *//* empty css                  *//* empty css                     *//* empty css                  *//* empty css                      *//* empty css                        *//* empty css                    */import"./el-tooltip-l0sNRNKZ.js";const ne={class:"p-6"},se={class:"bg-white dark:bg-gray-800 rounded-lg shadow-sm p-6"},ie={class:"flex justify-between items-center mb-6"},re={class:"mt-4 flex justify-end"},ye=$({__name:"TicketList",setup(ue){const y=s([]),m=s(!1),u=s(!1),_=s(!1),w=s(0),k=s(10),x=s(1),n=q({subject:"",priority:1,content:""}),f=async()=>{m.value=!0;try{const t=await h.get("/tickets",{params:{page:x.value,limit:k.value}});t.code===0&&(y.value=t.data.data,w.value=t.data.total)}catch(t){console.error(t)}finally{m.value=!1}},T=t=>{x.value=t,f()},B=async()=>{if(!n.subject||!n.content)return c.warning("请填写完整");_.value=!0;try{const t=await h.post("/ticket",n);t.code===0?(c.success("提交成功"),u.value=!1,n.subject="",n.content="",f()):c.error(t.message)}catch(t){c.error(t.message)}finally{_.value=!1}},S=t=>t===2?"danger":t===1?"warning":"info",z=t=>t===2?"紧急":t===1?"重要":"一般",D=t=>t===2?"info":t===1?"warning":"success",L=t=>t===2?"已关闭":t===1?"处理中":"待回复";return H(()=>{f()}),(t,l)=>{const d=O,r=R,V=W("router-link"),E=X,P=Q,U=A,C=le,b=te,g=oe,I=ae,N=ee,F=G,M=Y;return j(),J("div",ne,[p("div",se,[p("div",ie,[l[7]||(l[7]=p("h2",{class:"text-xl font-medium dark:text-gray-100"},"我的工单",-1)),e(d,{type:"primary",onClick:l[0]||(l[0]=a=>u.value=!0)},{default:o(()=>[...l[6]||(l[6]=[i("提交工单",-1)])]),_:1})]),K((j(),Z(P,{data:y.value},{default:o(()=>[e(r,{prop:"id",label:"ID",width:"80"}),e(r,{prop:"subject",label:"标题","min-width":"200","show-overflow-tooltip":""},{default:o(({row:a})=>[e(V,{to:"/dashboard/tickets/detail/"+a.id,class:"text-blue-600 hover:underline"},{default:o(()=>[i(v(a.subject),1)]),_:2},1032,["to"])]),_:1}),e(r,{prop:"priority",label:"优先级",width:"100"},{default:o(({row:a})=>[e(E,{type:S(a.priority)},{default:o(()=>[i(v(z(a.priority)),1)]),_:2},1032,["type"])]),_:1}),e(r,{prop:"status",label:"状态",width:"100"},{default:o(({row:a})=>[e(E,{type:D(a.status)},{default:o(()=>[i(v(L(a.status)),1)]),_:2},1032,["type"])]),_:1}),e(r,{prop:"create_time",label:"提交时间",width:"180"}),e(r,{label:"操作",width:"100"},{default:o(({row:a})=>[e(V,{to:"/dashboard/tickets/detail/"+a.id},{default:o(()=>[e(d,{link:"",type:"primary"},{default:o(()=>[...l[8]||(l[8]=[i("查看",-1)])]),_:1})]),_:1},8,["to"])]),_:1})]),_:1},8,["data"])),[[M,m.value]]),p("div",re,[e(U,{background:"",layout:"prev, pager, next",total:w.value,"page-size":k.value,onCurrentChange:T},null,8,["total","page-size"])])]),e(F,{modelValue:u.value,"onUpdate:modelValue":l[5]||(l[5]=a=>u.value=a),title:"提交工单",width:"600px"},{footer:o(()=>[e(d,{onClick:l[4]||(l[4]=a=>u.value=!1)},{default:o(()=>[...l[9]||(l[9]=[i("取消",-1)])]),_:1}),e(d,{type:"primary",loading:_.value,onClick:B},{default:o(()=>[...l[10]||(l[10]=[i("提交",-1)])]),_:1},8,["loading"])]),default:o(()=>[e(N,{model:n,"label-width":"80px"},{default:o(()=>[e(b,{label:"标题"},{default:o(()=>[e(C,{modelValue:n.subject,"onUpdate:modelValue":l[1]||(l[1]=a=>n.subject=a),placeholder:"请简要描述问题"},null,8,["modelValue"])]),_:1}),e(b,{label:"优先级"},{default:o(()=>[e(I,{modelValue:n.priority,"onUpdate:modelValue":l[2]||(l[2]=a=>n.priority=a)},{default:o(()=>[e(g,{label:"一般",value:0}),e(g,{label:"重要",value:1}),e(g,{label:"紧急",value:2})]),_:1},8,["modelValue"])]),_:1}),e(b,{label:"内容"},{default:o(()=>[e(C,{modelValue:n.content,"onUpdate:modelValue":l[3]||(l[3]=a=>n.content=a),type:"textarea",rows:6,placeholder:"请详细描述您遇到的问题..."},null,8,["modelValue"])]),_:1})]),_:1},8,["model"])]),_:1},8,["modelValue"])])}}});export{ye as default};
