import { getApiLoading } from '@/common/libraries/apiLoading'
import { Apis } from '@/gen/Apis'
import useModel from './model'
import { showToastBack, showToast } from '@/common/libraries/naviHelper'
import { useWeAppAuthStore, useWorkStore } from '@/common'
import getUserLogin from '@/common/libraries/userUserLogin'
const work = useWorkStore()
const auth = useWeAppAuthStore()

const getHouseList = () => {
  getApiLoading(Apis.Archive.HouseOccupants.List, {}).then(res => {
    useModel.dataList.value = res?.data
    useModel.metaData.value = res?.meta
    console.log(res)
  })
}
export default {
  getHouseList,
  handleTableChange(e: number) {
    useModel.current.value = e
    if (e) {
      useModel.dataList.value = []
    } else {
      getHouseList()
    }
    console.log(e, 'eee')
  },
  toNext() {
    if (!useModel?.formData?.value?.asset_houses_id) {
      return showToastBack('请选择房屋！')
    }
    uni.navigateTo({
      url: '/INDEX/collection/confirm'
    })
  },
  handleSelect(e: any) {
    useModel.formData.value.asset_houses_id = e?.asset_houses_id
  }
}
