"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/day.js"),i=require("../../../common/libraries/apiLoading.js"),r=require("../../../gen/Apis.js"),n=require("../../../common/libraries/naviHelper.js"),t=o.useWorkStore(),s={getShow:()=>{var o,n;i.getApiLoading(r.Apis.Emergency.EmergencyEvents.Show,null==(n=null==(o=e.useModel)?void 0:o.formData)?void 0:n.value).then(o=>{var i,r,n;e.useModel.formData.value={...null==o?void 0:o.data,project_name:null==(r=null==(i=null==o?void 0:o.data)?void 0:i.asset_project)?void 0:r.name,emergency_time:l.showDay(null==(n=null==o?void 0:o.data)?void 0:n.emergency_time)}})},init(){var o,l,i,r,n;console.log("init",null==t?void 0:t.selectWorkProject),(null==(o=null==t?void 0:t.selectWorkProject)?void 0:o.id)&&(e.useModel.formData.value={...null==(i=null==(l=e.useModel)?void 0:l.formData)?void 0:i.value,project_name:null==(r=null==t?void 0:t.selectWorkProject)?void 0:r.name,asset_projects_id:null==(n=null==t?void 0:t.selectWorkProject)?void 0:n.id})},handleSubmit(){var o,l,t,s,a;let d=null==(l=null==(o=e.useModel)?void 0:o.formData)?void 0:l.value;return(null==d?void 0:d.asset_projects_id)?(null==d?void 0:d.name)?(null==d?void 0:d.two_emergency_categories_id)?(null==d?void 0:d.two_emergency_categories_id)&&1!==(null==(t=null==d?void 0:d.two_emergency_categories_id)?void 0:t.length)?(null==d?void 0:d.emergency_event_levels_id)&&(null==d?void 0:d.emergency_event_levels_id)?(null==d?void 0:d.emergency_time)?(null==d?void 0:d.emergency_location)?(null==d?void 0:d.emergency_description)?(null==d?void 0:d.emergency_cause)?(null==d?void 0:d.cause_result)?(d.two_emergency_categories_id=(null==(s=null==d?void 0:d.two_emergency_categories_id)?void 0:s.length)?null==(a=null==d?void 0:d.two_emergency_categories_id)?void 0:a[1]:null==d?void 0:d.two_emergency_categories_id,void i.getApiLoading(r.Apis.Emergency.EmergencyEvents.Update,d).then(e=>{n.showToastBack("提交成功！",1,!0),console.log(e)})):n.showToast("请设置结果！"):n.showToast("请输入原因！"):n.showToast("请输入事件描述！"):n.showToast("请输入事发地点！"):n.showToast("请选择发生时间！"):n.showToast("请选择等级！"):n.showToast("请选择2级分类！"):n.showToast("请选择分类！"):n.showToast("请输入事件名称！"):n.showToast("请选择项目！")}};exports.method=s;
