import{C as l,D as e,L as u,M as a,ab as d,y as o,G as i,h as r}from"./element-plus-DSMJnpwa.js";import{d as t}from"./index-mv7arXuk.js";/* empty css                     *//* empty css                        *//* empty css               *//* empty css                  */import{_ as s}from"./index-9_f6rNAP.js";import{e as n,c as m}from"./index-nsQnTcne.js";import{B as p,g as b,a4 as c,aB as f,aE as v,H as g,L as _,M as V,O as h,P as C,F as B,ab as U,u as j,I as y,Y as T,d as x}from"./vue-vendor-DZekML78.js";import{u as M}from"./house-Dn7jiId_.js";import"./utils-cPVb2Haz.js";import"./index-CWCutGkV.js";const w={class:"AddBuildingBox"},N={class:"AddBuildingBody"},k={class:"addBuildingFormBody"},S=t(p({__name:"AddBuilding",setup(t){const p=M(),{proxy:S}=b(),{com_build_use:q}=c(S?.useDict("com_build_use")),I=f(),F=v(),A=x(),E=x({buildingName:"",buildToward:"",buildTall:"",buildingUse:"0",buildStructure:"",unitCount:null,floorCount:null}),H=x({buildingName:[{required:!0,message:"请输入楼栋名称",trigger:"blur"}],buildingUse:[{required:!0,message:"请选择楼栋类型",trigger:"blur"}],unitCount:[{required:!0,message:"请输入单元数",trigger:"blur"}],floorCount:[{required:!0,message:"请输入楼层数",trigger:"blur"}]}),L=I.query.buildingId;L&&p.currentBuildingInfoList.forEach(l=>{l.id==L&&(E.value.buildingName=l.buildingName,E.value.buildToward=l.buildToward,E.value.buildingUse=l.buildingUse,E.value.buildTall=l.buildTall,E.value.buildStructure=l.buildStructure,E.value.unitCount=l.unitCount,E.value.floorCount=l.floorCount)});const D=()=>{A.value?.validate(async l=>{l&&(L?n({...E.value,id:L}).then(l=>{r.success("修改成功"),p.updateHouse(),G()}).catch(l=>{r.error("修改失败")}):m({...E.value}).then(l=>{r.success("添加成功"),p.updateHouse(),G()}).catch(l=>{r.error("添加失败")}))})},G=()=>{A.value?.resetFields(),z()};function z(){F.push({path:"/house/houselist"})}return(r,t)=>{const n=e,m=l,p=a,b=u,c=d,f=o,v=i;return g(),_("div",w,[V(s,{title:"新建楼栋"},{operate:h(()=>[C("div",{class:"BackBox",onClick:z},"返回")]),_:1}),C("div",N,[t[9]||(t[9]=C("div",{class:"title"},"基本信息",-1)),C("div",k,[V(v,{class:"formBody",ref_key:"formRef",ref:A,model:E.value,rules:H.value,"label-width":"100px"},{default:h(()=>[V(m,{label:"楼栋名称",prop:"buildingName"},{default:h(()=>[V(n,{modelValue:E.value.buildingName,"onUpdate:modelValue":t[0]||(t[0]=l=>E.value.buildingName=l),modelModifiers:{trim:!0},placeholder:"请输入楼栋名称"},null,8,["modelValue"])]),_:1}),V(m,{label:"楼栋类型",prop:"buildingUse"},{default:h(()=>[V(b,{modelValue:E.value.buildingUse,"onUpdate:modelValue":t[1]||(t[1]=l=>E.value.buildingUse=l),placeholder:"选择楼栋类型"},{default:h(()=>[(g(!0),_(B,null,U(j(q),(l,e)=>(g(),y(p,{key:e,label:l.label,value:l.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),V(m,{label:"楼栋朝向",prop:"buildToward"},{default:h(()=>[V(n,{modelValue:E.value.buildToward,"onUpdate:modelValue":t[2]||(t[2]=l=>E.value.buildToward=l),modelModifiers:{trim:!0},placeholder:"请输入楼栋朝向"},null,8,["modelValue"])]),_:1}),V(m,{label:"楼高(m)",prop:"buildTail"},{default:h(()=>[V(n,{modelValue:E.value.buildTall,"onUpdate:modelValue":t[3]||(t[3]=l=>E.value.buildTall=l),modelModifiers:{trim:!0},placeholder:"请输入楼高(m)"},null,8,["modelValue"])]),_:1}),V(m,{label:"楼栋结构",prop:"buildStructure"},{default:h(()=>[V(n,{modelValue:E.value.buildStructure,"onUpdate:modelValue":t[4]||(t[4]=l=>E.value.buildStructure=l),modelModifiers:{trim:!0},placeholder:"请输入楼栋结构"},null,8,["modelValue"])]),_:1}),V(m,{label:"单元数",prop:"unitCount"},{default:h(()=>[V(c,{min:1,modelValue:E.value.unitCount,"onUpdate:modelValue":t[5]||(t[5]=l=>E.value.unitCount=l),modelModifiers:{trim:!0},placeholder:"单元数"},null,8,["modelValue"])]),_:1}),V(m,{label:"楼层",prop:"floorCount"},{default:h(()=>[V(c,{min:1,modelValue:E.value.floorCount,"onUpdate:modelValue":t[6]||(t[6]=l=>E.value.floorCount=l),modelModifiers:{trim:!0},placeholder:"楼层数"},null,8,["modelValue"])]),_:1}),V(m,{style:{"margin-top":"30px"}},{default:h(()=>[V(f,{type:"primary",onClick:D},{default:h(()=>[...t[7]||(t[7]=[T("确定",-1)])]),_:1}),V(f,{onClick:G},{default:h(()=>[...t[8]||(t[8]=[T("取消",-1)])]),_:1})]),_:1})]),_:1},8,["model","rules"])])])])}}}),[["__scopeId","data-v-1f17c5cc"]]);export{S as default};
