import{G as f,d as k,a as y,j as e,F as v}from"./index-b983ad9b.js";import{r as h}from"./react-b0e0d18a.js";/* empty css                *//* empty css              *//* empty css              *//* empty css              */import"./Room-7ae51b0a.js";/* empty css              *//* empty css              *//* empty css              *//* empty css              *//* empty css              *//* empty css              */import{m as E,f as j,s as B}from"./index.module-32df86df.js";import{y as F,p as C,b,F as l,t as w,o as I,B as P}from"./antd-8ca2e36c.js";const p=new Map;class u{constructor(t){this.setData(t)}setData(t){Object.assign(this,t)}static async findByEvent(t,i,c){const r=f(),{items:n}=await r.get({path:`api/v1/event/${t}/actions`,query:i});return n==null?void 0:n.map(m=>{let o=p.get(m.id);return o?o.setData(m):(o=new u(m),p.set(o.id,o)),o})}static async findByPk(t){let i=p.get(t);if(i===void 0){const r=await f().get(`api/v1/event-action/${t}`);i=new u(r),p.set(t,i)}return i}static async create({eventId:t,...i}){const r=await f().post(`api/v1/event/${t}/action`,i),n=new u(r);return p.set(n.id,n),n}}const S=u;function $({event:a,onFinish:t,noHandled:i}){const[c]=l.useForm(),[r,n]=h.useState(!1),m=()=>{n(!0)};return y(l,{form:c,onFinish:async s=>{if(!a.id||String(s.comment).trim()===""&&!s.isFalse&&!s.isHandled){n(!1);return}try{await S.create({...s,eventId:a.id}),t&&t()}catch{}n(!1)},className:B.commentForm,children:[e(l.Item,{name:"isFalse",valuePropName:"checked",style:{display:"inline-block",width:"calc(50% - 8px)"},children:e(w,{disabled:a.isFalse,children:"这是误报"})}),!i&&e(l.Item,{name:"isHandled",valuePropName:"checked",style:{display:"inline-block",width:"calc(50% - 8px)",margin:"0 8px"},children:e(w,{disabled:!!a.handledAt,children:"已处置"})}),e(l.Item,{name:"comment",children:e(I.TextArea,{autoSize:{minRows:2}})}),e(l.Item,{children:e(P,{htmlType:"submit",loading:r,onClick:m,type:"primary",children:"提交"})})]})}function A({event:a,noHandled:t,update:i}){const[c,r]=h.useState(),[n,m]=h.useReducer(s=>s+1,0),{user:o}=k();return h.useEffect(()=>{if(r(void 0),!a||!a.id)return;let s=!0;return S.findByEvent(a.id,{},!0).then(d=>{s&&r(d!=null&&d.length?d:void 0)}),()=>{s=!1}},[a,n,i]),y("div",{style:{paddingLeft:8,paddingRight:8},children:[e(F,{author:o.name,content:e($,{event:a,onFinish:async()=>{await E.findByPk(a.id,!0),m()},noHandled:t})},n),c&&e(C,{className:"comment-list",itemLayout:"horizontal",dataSource:c,renderItem:({user:s,isFalse:d,comment:g,createdAt:x})=>e("li",{children:e(F,{author:s.name,content:y(v,{children:[d&&e(b,{children:"确认误报"}),g&&e(b,{children:g})]}),datetime:j(new Date(x))})})})]})}const U=Object.freeze(Object.defineProperty({__proto__:null,default:A},Symbol.toStringTag,{value:"Module"}));export{A as E,S as a,U as b};
