import{P as e,O as l,C as a,L as u,M as o,D as r,y as d,G as s,h as t}from"./element-plus-DSMJnpwa.js";import{d as n}from"./index-mv7arXuk.js";/* empty css                     *//* empty css               *//* empty css               *//* empty css               *//* empty css                  */import{_ as i}from"./index-9_f6rNAP.js";import{j as m,k as p}from"./index-nsQnTcne.js";import{g as v,u as f,a as c}from"./index-BWFdQ-0V.js";import{B as h,aB as _,aE as b,H as g,L as V,M as y,P as A,O as j,F as N,ab as k,I as B,Y as x,d as I}from"./vue-vendor-DZekML78.js";import"./utils-cPVb2Haz.js";const U={class:"AddBuildingBox"},q={class:"AddBuildingBody"},C={class:"addBuildingFormBody"},w=n(h({__name:"addStoreRoom",setup(n){const h=_(),w=b(),M=I(),O=I({id:null,buildingId:"",unitNo:"",storeroomNo:"",houseArea:null,shareArea:null,internalArea:null,houseId:"",status:0,remark:""}),F=I({buildingId:[{required:!0,message:"请选择楼栋",trigger:"blur"}],unitNo:[{required:!0,message:"请选择单元",trigger:"blur"}],storeroomNo:[{required:!0,message:"请输入储藏室号",trigger:"blur"}]}),G=I(null),L=I([]),P=I([]);var R;function D(e){p(e).then(e=>{L.value=Array.from({length:e.data.unitCount}).map((e,l)=>({no:l+1,name:l+1+"单元"}))})}m().then(e=>{P.value=e.rows}),h.query.id&&(G.value=h.query.id,R=G.value,v(R).then(e=>{O.value={...O.value,...e.data}}));const E=()=>{M.value?.validate(async e=>{if(e){const e={...O.value};null!==G.value?f(e).then(()=>{t.success("修改成功"),H()}):c(e).then(()=>{t.success("添加成功"),H()})}})},H=()=>{w.push({path:"/house/storeroom"})};return(t,n)=>{const m=o,p=u,v=a,f=l,c=e,h=r,_=d,b=s;return g(),V("div",U,[y(i,{title:G.value?"编辑储藏室":"添加储藏室"},null,8,["title"]),A("div",q,[n[9]||(n[9]=A("div",{class:"title"},"基本信息",-1)),A("div",C,[y(b,{class:"formBody","label-position":"left",ref_key:"formRef",ref:M,model:O.value,rules:F.value,"label-width":"100px"},{default:j(()=>[y(c,null,{default:j(()=>[y(f,{span:11},{default:j(()=>[y(v,{label:"楼栋",prop:"buildingId"},{default:j(()=>[y(p,{onChange:D,modelValue:O.value.buildingId,"onUpdate:modelValue":n[0]||(n[0]=e=>O.value.buildingId=e),placeholder:"请选择楼栋"},{default:j(()=>[(g(!0),V(N,null,k(P.value,e=>(g(),B(m,{key:e.id,label:e.buildingName,value:e.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1}),y(f,{span:2}),y(f,{span:11},{default:j(()=>[y(v,{label:"单元",prop:"unit"},{default:j(()=>[y(p,{modelValue:O.value.unitNo,"onUpdate:modelValue":n[1]||(n[1]=e=>O.value.unitNo=e),placeholder:"请选择单元"},{default:j(()=>[(g(!0),V(N,null,k(L.value,e=>(g(),B(m,{key:e.no,label:e.name,value:e.no},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1}),y(c,null,{default:j(()=>[y(f,{span:11},{default:j(()=>[y(v,{label:"储藏室号",prop:"storeroomNo"},{default:j(()=>[y(h,{modelValue:O.value.storeroomNo,"onUpdate:modelValue":n[2]||(n[2]=e=>O.value.storeroomNo=e),modelModifiers:{number:!0},placeholder:"请输入储藏室号"},null,8,["modelValue"])]),_:1})]),_:1}),y(f,{span:2}),y(f,{span:11},{default:j(()=>[y(v,{label:"建筑面积",prop:"houseArea"},{default:j(()=>[y(h,{modelValue:O.value.houseArea,"onUpdate:modelValue":n[3]||(n[3]=e=>O.value.houseArea=e),placeholder:"请输入建筑面积"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),y(c,null,{default:j(()=>[y(f,{span:11},{default:j(()=>[y(v,{label:"公摊面积",prop:"shareArea"},{default:j(()=>[y(h,{modelValue:O.value.shareArea,"onUpdate:modelValue":n[4]||(n[4]=e=>O.value.shareArea=e),placeholder:"请输入公摊面积"},null,8,["modelValue"])]),_:1})]),_:1}),y(f,{span:2}),y(f,{span:11},{default:j(()=>[y(v,{label:"实用面积",prop:"internalArea"},{default:j(()=>[y(h,{modelValue:O.value.internalArea,"onUpdate:modelValue":n[5]||(n[5]=e=>O.value.internalArea=e),placeholder:"请输入实用面积"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),y(v,{label:"备注",prop:"remark"},{default:j(()=>[y(h,{type:"textarea",rows:5,modelValue:O.value.remark,"onUpdate:modelValue":n[6]||(n[6]=e=>O.value.remark=e),placeholder:"请输入备注"},null,8,["modelValue"])]),_:1}),y(v,{style:{"margin-top":"30px"}},{default:j(()=>[y(_,{type:"primary",onClick:E},{default:j(()=>[...n[7]||(n[7]=[x("提交",-1)])]),_:1}),y(_,{onClick:H},{default:j(()=>[...n[8]||(n[8]=[x("取消",-1)])]),_:1})]),_:1})]),_:1},8,["model","rules"])])])])}}}),[["__scopeId","data-v-4d7c1811"]]);export{w as default};
