import { useWeAppAuthStore } from '@/common'
import useModel from './model'
import { Apis } from '@/gen/Apis'
import { getApiLoading } from '@/common/libraries/apiLoading'
const auth = useWeAppAuthStore()
import { showToastBack, showToast } from '@/common/libraries/naviHelper'
export default {
  init(data: any) {
    useModel.formData.value = data
  },
  handleSubmit() {
    let data = useModel?.formData?.value
    if (!data?.expect_start_time) {
      return showToast('请选择新时间！')
    }
    if (data?.day === `${data?.expect_start_time}:00`) {
      return showToast('与原时间相同！')
    }
    getApiLoading(Apis.WorkOrder.HouseWorkOrders.ChangeExpectTime, data).then(res => {
      showToastBack('提交成功！', 1, true)
      console.log(res)
    })
  }
}
