"use strict";const e=require("./model.js");require("../../../common/libraries/request.js"),require("../../../common/store/useWatermarkStore.js"),require("../../../common/store/useWeAppAuthStore.js");const o=require("../../../common/store/useWorkStore.js"),l=require("../../../common/libraries/apiLoading.js"),s=require("../../../gen/Apis.js"),i=require("../../../common/libraries/naviHelper.js"),r=o.useWorkStore(),t={getList:()=>{var o,i;l.getApiLoading(s.Apis.WorkOrder.HouseWorkOrders.List,null==(i=null==(o=e.useModel)?void 0:o.formData)?void 0:i.value).then(o=>{e.useModel.listData.value=[...e.useModel.listData.value,...null==o?void 0:o.data],e.useModel.metaData.value=null==o?void 0:o.meta})},init(){var o,l,s,i,t;console.log("init",null==r?void 0:r.selectWorkProject),(null==(o=null==r?void 0:r.selectWorkProject)?void 0:o.id)&&(e.useModel.formData.value={...null==(s=null==(l=e.useModel)?void 0:l.formData)?void 0:s.value,project_name:null==(i=null==r?void 0:r.selectWorkProject)?void 0:i.name,asset_projects_id:null==(t=null==r?void 0:r.selectWorkProject)?void 0:t.id})},handleSubmit(){var o,r,t,n;let u=null==(r=null==(o=e.useModel)?void 0:o.formData)?void 0:r.value;return(null==u?void 0:u.asset_projects_id)?(null==u?void 0:u.name)?(null==u?void 0:u.two_emergency_categories_id)?1===(null==(t=null==u?void 0:u.two_emergency_categories_id)?void 0:t.length)?i.showToast("请选择2级分类！"):(null==u?void 0:u.emergency_event_levels_id)&&(null==u?void 0:u.emergency_event_levels_id)?(null==u?void 0:u.emergency_time)?(null==u?void 0:u.emergency_location)?(null==u?void 0:u.emergency_description)?(null==u?void 0:u.emergency_cause)?(null==u?void 0:u.cause_result)?(u.two_emergency_categories_id=null==(n=null==u?void 0:u.two_emergency_categories_id)?void 0:n[1],void l.getApiLoading(s.Apis.Emergency.EmergencyEvents.Store,u).then(e=>{i.showToastBack("提交成功！",1,!0),console.log(e)})):i.showToast("请设置结果！"):i.showToast("请输入原因！"):i.showToast("请输入事件描述！"):i.showToast("请输入事发地点！"):i.showToast("请选择发生时间！"):i.showToast("请选择等级！"):i.showToast("请选择分类！"):i.showToast("请输入事件名称！"):i.showToast("请选择项目！")}};exports.method=t;
