import{g as w}from"./index-B_ImzkRi.js";import{g as v,b as m}from"./index-BMymgPp9.js";import{bi as I,r as e,E as r}from"./index-XuO881sr.js";function N(t,n){const s=parseFloat(t),l=parseFloat(n);return!isNaN(s)&&!isNaN(l)?s-l:t.localeCompare(n,"zh-CN",{numeric:!0})}const E=I("house",()=>{const t=e(),n=e([]),s=e({id:null,villageId:null,villageName:"",buildingName:"",buildingUse:null,buildToward:"",buildTall:"",buildStructure:"",unitCount:null,floorCount:null,remark:""}),l=e([]),a=e([]),c=e(0),i=e(new Set),h=async o=>{const d=(await w()).rows.find(u=>u.choiceStatus===0);t.value=d;const g=await v(d.villageId,o);n.value=g.data,s.value=g.data[0],console.log(s.value);const p=await m(s.value.id);l.value=p.data,l.value.forEach(u=>{c.value=Math.max(c.value,u.actualFloorCount),u.floors_Json=JSON.parse(`[${u.floors.replaceAll("\\","")}]`),u.floors_Json.forEach(H=>{i.value.add(H.floorNo)})}),a.value=Array.from(i.value).sort(N)},f=e([]);return{currentVilageInfo:t,currentBuildingInfoList:n,currentBuildingInfo:s,currentHouseInfoList:l,currentFloorInfoList:a,checkoutHouses:f,checkoutHousesFun:o=>{f.value=o},initHouse:h,switchHouseType:o=>{v(t.value.villageId,o).then(()=>r.success("切换成功")).catch(()=>r.error("切换失败"))},switchBuilding:o=>{m(o).then(()=>r.success("切换成功"))},deleteHouseFun:o=>{console.log("删除房屋"),typeof o=="string"?console.log("单条删除"):Array.isArray(o)&&console.log("批量删除")}}});export{E as u};
