import useModel from './model'
import { getApiLoading } from '@/common/libraries/apiLoading'
import { Apis } from '@/gen/Apis'

const getList = () => {
  getApiLoading(Apis.WorkOrder.HouseWorkOrders.UnassignedList, useModel?.formData?.value).then(
    res => {
      useModel.listData.value = [...useModel.listData.value, ...res?.data]
      useModel.metaData.value = res?.meta
    }
  )
}

export default {
  getList,
  handleLoad(res: any) {
    useModel.formData.value.page = res?.page
    getList()
  },
  handleToDetail(e: { id: string; type?: string }) {
    uni.navigateTo({
      url: `/INDEX/task/show/index?id=${e?.id}`
    })
  }
}
