"use strict";const e=require("../../common/vendor.js");require("../../common/libraries/request.js");const o=require("../../common/store/useWeAppAuthStore.js"),l=require("../../common/store/useWorkStore.js"),a=require("./model.js"),u=require("../../gen/Apis.js"),s=require("../../common/libraries/apiLoading.js"),n=require("../../common/libraries/naviHelper.js"),d=o.useWeAppAuthStore(),t=l.useWorkStore(),r={init(){var e,o,l,u,s,n,r,i,v,m,h,p,c,f,_;a.useModel.formData.value={...a.useModel.formData.value,reporter_phone:a.useModel.formData.value.reporter_phone||(null==(o=null==(e=null==d?void 0:d.data)?void 0:e.user)?void 0:o.phone)||"",reporter_name:a.useModel.formData.value.reporter_name||(null==(u=null==(l=null==d?void 0:d.data)?void 0:l.user)?void 0:u.name)||"",contact_phone:a.useModel.formData.value.contact_phone||(null==(n=null==(s=null==d?void 0:d.data)?void 0:s.user)?void 0:n.phone)},(null==(r=null==t?void 0:t.selectWorkHouse)?void 0:r.asset_house)?a.useModel.formData.value={...a.useModel.formData.value,asset_houses_id:null==(v=null==(i=null==t?void 0:t.selectWorkHouse)?void 0:i.asset_house)?void 0:v.id,full_name:null==(h=null==(m=null==t?void 0:t.selectWorkHouse)?void 0:m.asset_house)?void 0:h.full_name}:a.useModel.formData.value={...a.useModel.formData.value,asset_houses_id:null==(c=null==(p=null==d?void 0:d.data)?void 0:p.selected_house)?void 0:c.id,full_name:null==(_=null==(f=null==d?void 0:d.data)?void 0:f.selected_house)?void 0:_.full_name}},handleChangeType(e){"Complaint"===(null==e?void 0:e.value)&&(a.useModel.formData.value.location=""),console.log("handleChangeType",e)},handleSubmit(){var e,o,l,d,t,r,i,v,m,h,p,c,f,_,M,D,g,y,T,k,q,w,S,W;return console.log("handleSubmit",a.useModel.formData.value),(null==(l=null==(o=null==(e=a.useModel)?void 0:e.formData)?void 0:o.value)?void 0:l.type)?"MyHome"!==(null==(r=null==(t=null==(d=a.useModel)?void 0:d.formData)?void 0:t.value)?void 0:r.location)||a.useModel.formData.value.asset_houses_id?"Complaint"!==(null==(m=null==(v=null==(i=a.useModel)?void 0:i.formData)?void 0:v.value)?void 0:m.type)||(null==(p=null==(h=a.useModel)?void 0:h.formData.value)?void 0:p.complaint_type)?a.useModel.formData.value.content?"MyHome"!==(null==(_=null==(f=null==(c=a.useModel)?void 0:c.formData)?void 0:f.value)?void 0:_.location)||"Complaint"===(null==(g=null==(D=null==(M=a.useModel)?void 0:M.formData)?void 0:D.value)?void 0:g.type)||a.useModel.formData.value.expect_start_time?"Complaint"===(null==(k=null==(T=null==(y=a.useModel)?void 0:y.formData)?void 0:T.value)?void 0:k.type)||(null==(w=null==(q=a.useModel)?void 0:q.formData.value)?void 0:w.reporter_phone)&&(null==(W=null==(S=a.useModel)?void 0:S.formData.value)?void 0:W.reporter_name)?void s.getApiLoading(u.Apis.WorkOrder.HouseWorkOrders.Store,a.useModel.formData.value).then((e=>{n.showToastBack("提交成功！",1,!0),console.log(e)})):n.showToast("请输入联系人和电话！"):n.showToast("请选择上门时间！"):n.showToast("请输入问题描述！"):n.showToast("请选择投诉类型！"):n.showToast("请选择房屋！"):n.showToast("请选择工单类型！")},handleToSelectHouse(){e.index.navigateTo({url:"/INDEX/asset_houses/index?type=work_add"})},handleSwitchChange(e){var o;a.useModel.formData.value.is_anonymous=null==(o=null==e?void 0:e.detail)?void 0:o.value,console.log(e,"e")}};exports.method=r;
