"use strict";const e=require("../../../common/vendor.js"),l=require("../../../gen/Apis.js"),o=require("../../../common/libraries/apiLoading.js");require("../../../common/libraries/userUserLogin.js");const a=require("../../../common/libraries/naviHelper.js");require("../../../common/libraries/request.js");const s=require("../../../common/store/useWeAppAuthStore.js"),u=require("../../../common/store/useWorkStore.js"),d=require("./model.js"),n=u.useWorkStore(),i=s.useWeAppAuthStore(),t=()=>{var e,a;o.getApiLoading(l.Apis.Activity.ActivityEnrolls.List,null==(a=null==(e=d.useModel)?void 0:e.formData)?void 0:a.value).then((e=>{d.useModel.listData.value=[...d.useModel.listData.value,...e.data],d.useModel.metaData.value=e.meta,console.log(e)}))},r={getList:t,init(){var e,l,o,a,s,u,t,r,v,m,p,h,_,c,f,g,D;(null==(e=null==n?void 0:n.selectWorkHouse)?void 0:e.asset_house)?d.useModel.formData.value={...d.useModel.formData.value,asset_houses_id:null==(o=null==(l=null==n?void 0:n.selectWorkHouse)?void 0:l.asset_house)?void 0:o.id,full_name:null==(s=null==(a=null==n?void 0:n.selectWorkHouse)?void 0:a.asset_house)?void 0:s.full_name,apply_phone:d.useModel.formData.value.apply_phone||(null==(t=null==(u=null==i?void 0:i.data)?void 0:u.user)?void 0:t.phone)||"",apply_name:d.useModel.formData.value.apply_name||(null==(v=null==(r=null==i?void 0:i.data)?void 0:r.user)?void 0:v.name)||""}:d.useModel.formData.value={...d.useModel.formData.value,asset_houses_id:null==(p=null==(m=null==i?void 0:i.data)?void 0:m.selected_house)?void 0:p.id,full_name:null==(_=null==(h=null==i?void 0:i.data)?void 0:h.selected_house)?void 0:_.full_name,apply_phone:d.useModel.formData.value.apply_phone||(null==(f=null==(c=null==i?void 0:i.data)?void 0:c.user)?void 0:f.phone)||"",apply_name:d.useModel.formData.value.apply_name||(null==(D=null==(g=null==i?void 0:i.data)?void 0:g.user)?void 0:D.name)||""}},loadMore(e){d.useModel.formData.value.page=e,this.getList()},handleTabsChange(e,l){d.useModel.currentTabs.value=e,d.useModel.formData.value={page:1,status:null==l?void 0:l.value},d.useModel.listData.value=[],t(),console.log(e,"e")},handleToSelectHouse(){e.index.navigateTo({url:"/INDEX/asset_houses/index?type=work_add"})},handleSubmit(){var e,s,u,n,i,t;let r=null==(s=null==(e=d.useModel)?void 0:e.formData)?void 0:s.value;if(!(null==r?void 0:r.asset_houses_id))return a.showToast("请选择房屋!");if(!(null==r?void 0:r.apply_name))return a.showToast("请设置申请人姓名!");if(!(null==r?void 0:r.apply_phone))return a.showToast("请设置申请人手机号!");for(let l=0;l<(null==(u=null==r?void 0:r.goods)?void 0:u.length);l++)if(!(null==(n=null==r?void 0:r.goods[l])?void 0:n.name))return a.showToast("请设置物品名称!");if(!(null==r?void 0:r.passed_time))return a.showToast("请选择放行日期!");o.getApiLoading(l.Apis.GoodsReleases.GoodsReleases.Store,null==(t=null==(i=d.useModel)?void 0:i.formData)?void 0:t.value).then((e=>{a.showToastBack("提交成功！",1,!0),console.log(e)}))},handleAddGoods(){d.useModel.formData.value.goods.push({name:"",number:1,remark:""})},handleDeleteGoods(e){d.useModel.formData.value.goods.splice(e,1)}};exports.method=r;
