import{c as A,u as F}from"./group-DxznlajQ.js";import{g as R}from"./gitDictData-jrP3nJ1a.js";import{d as S,V as q,u as U,r as p,ay as B,aw as D,c as N,o as M,t as O,w as r,j as t,c8 as z,c9 as H,p as x,l as n,_ as K,k as $,aA as G}from"./index-9PRMimni.js";const Y=S({__name:"ItemForm",props:{permissionList:{type:Array},isEdit:{type:Boolean,defalut:!1},resultList:{type:Array},isShowSubmit:{type:Boolean,defalut:!1}},emits:["change"],setup(I,{expose:T,emit:P}){const b=P,m=I;T({submit:V,handleReset:g,setData:E});const{t:a}=q(),v=U(),C={status:{required:!0,message:a("drill.addPlan.rulesForStatus"),trigger:"change"},projectEnglish:{required:!0,message:a("drill.addPlan.rulesForEProject"),trigger:"blur"},projectChinese:{required:!0,message:a("drill.addPlan.rulesForCProject"),trigger:"blur"},peroId:{required:!0,message:a("drill.addPlan.rulesForPeriod"),trigger:"change"},exerciseType:{required:!0,message:a("drill.addPlan.rulesForShipType"),trigger:"change"},exerciseVesselType:{required:!0,message:a("drill.addPlan.rulesForDrillCategory"),trigger:"change"}},y=()=>({id:null,projectChinese:"",projectEnglish:"",exerciseType:"",exerciseVesselType:"",peroId:"",remark:"",status:"Active"}),L=p([{label:"Dry Bulk OIL",value:"248"},{label:"CHEMICALS TANKER",value:"250"}]),h=p([]),j=p([]),d=p(),i=p(!1),l=p(y());B(()=>m.resultList,(o,e)=>{console.log("resultList 发生变化:",o,e)},{deep:!0});function E(o){l.value=o,d.value?.restoreValidation()}function V(o){i.value=!0,d.value.validate(e=>{if(e)i.value=!1,v.error(a("drill.addPlan.rulesForEmpty"));else{let c=Object.assign(l.value,{groupName:o.groupName,groupId:o.id});m.isEdit?F(l.value).then(()=>{i.value=!1,v.success(a("drill.manage.editSuccess")),g(),b("change")}).catch(()=>{i.value=!1}):A(c).then(()=>{i.value=!1,v.success(a("drill.manage.addSuccess")),g(),b("change")}).catch(()=>{i.value=!1})}})}function g(){d.value.restoreValidation(),l.value=Object.assign(l.value,y())}return D(async()=>{const{projectTypeList:o,getPeriodList:e}=await R();j.value=e.list,h.value=o.list,l.value={...m.resultList}}),(o,e)=>{const c=H,k=z,u=K,f=$,_=G,w=O;return M(),N(w,{model:l.value,rules:C,ref_key:"formRef",ref:d,"label-placement":"left","label-width":180,"require-mark-placement":"left"},{default:r(()=>[t(u,{label:n(a)("drill.manage.formStatus"),path:"status"},{default:r(()=>[t(k,{value:l.value.status,"onUpdate:value":e[0]||(e[0]=s=>l.value.status=s)},{default:r(()=>[t(c,{label:"Active",value:"Active"},{default:r(()=>e[7]||(e[7]=[x(" Active")])),_:1}),t(c,{label:"Inactive",value:"Inactive"},{default:r(()=>e[8]||(e[8]=[x(" Inactive")])),_:1})]),_:1},8,["value"])]),_:1},8,["label"]),t(u,{label:n(a)("drill.manage.formItemEnglish"),path:"projectEnglish"},{default:r(()=>[t(f,{placeholder:"",value:l.value.projectEnglish,"onUpdate:value":e[1]||(e[1]=s=>l.value.projectEnglish=s)},null,8,["value"])]),_:1},8,["label"]),t(u,{label:n(a)("drill.manage.formItemChinese"),path:"projectChinese"},{default:r(()=>[t(f,{placeholder:"",value:l.value.projectChinese,"onUpdate:value":e[2]||(e[2]=s=>l.value.projectChinese=s)},null,8,["value"])]),_:1},8,["label"]),t(u,{label:n(a)("drill.manage.tablePeroid"),path:"peroId"},{default:r(()=>[t(_,{"label-field":"value","value-field":"value",value:l.value.peroId,"onUpdate:value":e[3]||(e[3]=s=>l.value.peroId=s),options:j.value},null,8,["value","options"])]),_:1},8,["label"]),t(u,{label:n(a)("drill.manage.formType"),path:"exerciseVesselType"},{default:r(()=>[t(_,{value:l.value.exerciseVesselType,"onUpdate:value":e[4]||(e[4]=s=>l.value.exerciseVesselType=s),options:L.value},null,8,["value","options"])]),_:1},8,["label"]),t(u,{label:n(a)("drill.manage.formCategory"),path:"exerciseType"},{default:r(()=>[t(_,{value:l.value.exerciseType,"onUpdate:value":e[5]||(e[5]=s=>l.value.exerciseType=s),options:h.value},null,8,["value","options"])]),_:1},8,["label"]),t(u,{label:n(a)("drill.manage.formRemark"),path:"remark"},{default:r(()=>[t(f,{value:l.value.remark,"onUpdate:value":e[6]||(e[6]=s=>l.value.remark=s),placeholder:"Textarea",type:"textarea",autosize:{minRows:3,maxRows:5}},null,8,["value"])]),_:1},8,["label"])]),_:1},8,["model"])}}});export{Y as _};
