import{a as x}from"./arrow_r.acf187a8.js";import{s as t}from"./Form.module.f0e327b6.js";import{F as I}from"./Fetch.e6ea9900.js";import{s as o}from"./index.9b0ee734.js";import"./index.87202aac.js";import{o as b}from"./index.a42041f7.js";import{r as m,a as i,j as e}from"./react.b0bedc10.js";import{M as k}from"./md5.171e6df9.js";import{b as E,f as D,F as A,B as $,T as d,e as y}from"./zarm.80120c4d.js";import{u as _}from"./index.a3f0fe79.js";import{F as j}from"./Plus.92b0b989.js";import{F as R}from"./Close.c1c6d2c9.js";import"./Patrol.49bc16dd.js";import"./Project.fe0152f3.js";const M=()=>{document.title="\u968F\u624B\u62CD\u9690\u60A3";const F=_(),{roomCheckedWithLinkRadio:n}=o.ProjectStore,c=m.exports.useMemo(()=>o.ItemStore.selectedItems,[o.ItemStore.selectedItems]),h=m.exports.useMemo(()=>o.ItemStore.content,[o.ItemStore.content]),l=m.exports.useMemo(()=>o.ItemStore.files,[o.ItemStore.files]),{getSnapshotConfig:g}=o.RoomStore,[u,v]=m.exports.useState();m.exports.useEffect(()=>{(async()=>{const s=await g();s!=null&&s.content&&v(s.content)})()},[]);const B=s=>{const r=l.concat(s);if(r.length>4){d.show("\u6700\u591A\u53EA\u80FD\u4E0A\u4F20\u56DB\u5F20\u7167\u7247");return}o.ItemStore.setFiles(r)},C=s=>{const r=[].concat(l);r.splice(s,1),o.ItemStore.setFiles(r)},N=async()=>{if(!h)return d.show("\u8BF7\u586B\u5199\u68C0\u67E5\u60C5\u51B5");if(!n)return d.show("\u8BF7\u9009\u62E9\u623F\u95F4");const s=new FormData,r=k.hashStr(`${u==null?void 0:u.project_id}|${n.id}`);if(s.append("remark",h),s.append("is_create","1"),s.append("anon_submit_token",r),l.map((a,p)=>{s.append(`file${p}item`,a.file)}),c&&c.length){let a="";c.map((p,w)=>{w==0?a=`${p}`:a=`${a},${p}`}),s.append("items",a)}const f=await I.post({url:`/project/${u==null?void 0:u.project_id}/room/${n.id}/record`,form:s});f.code==200?(d.show("\u63D0\u4EA4\u6210\u529F"),o.ItemStore.setContent(""),o.ItemStore.setFiles([]),o.ItemStore.setSelectedItems([])):d.show(f.msg)},S=()=>l.map((s,r)=>e(y,{style:{margin:"5px 0px",width:"10px",height:"10px"},shape:"circle",text:e("span",{className:t.close,children:e(R,{size:"sm",onClick:()=>C(r)})}),children:e("div",{children:e("a",{href:s.thumbnail,target:"_blank",rel:"noopener noreferrer",children:e("img",{style:{padding:"5px",width:"60px",height:"60px"},src:s.thumbnail,alt:""})})})},+r));return i("div",{className:t.body,children:[i(E,{title:"\u9009\u62E9\u623F\u95F4",className:t.cell,children:[e("div",{className:t.value,onClick:()=>{F("/room-select-link")},children:n?n.label:e("span",{className:t.placeholder,children:"\u8BF7\u9009\u62E9"})}),e("img",{src:x,className:t.arrowR,alt:""})]}),i("div",{className:t.operation,children:[i("div",{className:t.middle,children:[e("div",{className:t.content,children:"* \u68C0\u67E5\u60C5\u51B5"}),e(D,{className:t.input,rows:5,type:"text",placeholder:"\u8BF7\u8F93\u5165\u9690\u60A3\u63CF\u8FF0\uFF1B\u82E5\u60A8\u65B9\u4FBF\u8BF7\u4E00\u5E76\u5F55\u5165\u60A8\u7684\u59D3\u540D\u3001\u7535\u8BDD\uFF0C\u4FBF\u4E8E\u540E\u7EED\u6838\u5B9E\u8054\u7CFB",value:h,onChange:o.ItemStore.setContent}),e("div",{className:t.content,children:"\u73B0\u573A\u7167\u7247"}),i("div",{className:t.img,children:[e("div",{children:S()}),e("div",{children:l.length<4&&e(E,{className:t.file,children:e(A,{multiple:!0,accept:"image/*",onChange:B,children:e(j,{size:"sm",style:{color:"rgb(192, 189, 189)"}})})})})]})]}),i("div",{className:t["operation-other"],children:[e("div",{className:t.content,children:"\u5173\u8054\u68C0\u67E5\u9879"}),i("div",{className:t.item,children:[i("div",{className:t.total,children:["\u5DF2\u9009\u62E9",c&&c.length||0,"\u6761\u5173\u8054\u9879\u76EE"]}),e($,{size:"xs",theme:"primary",className:t.button,onClick:()=>{F(`/item-selector/${u==null?void 0:u.project_id}`)},children:"\u9009\u62E9\u68C0\u67E5\u9879"})]})]})]}),e("div",{className:t.button_bar,children:e("div",{onClick:N,className:t.button_1,children:"\u63D0\u4EA4"})})]})};var X=b(M);export{X as default};
