import{_ as z}from"./basicModal.vue_vue_type_script_setup_true_lang-CsJydKhW.js";import"./basicModal.vue_vue_type_style_index_0_lang-8QZP7ApW.js";import{az as H,aA as I}from"./template-rpthWlT9.js";import{B as U}from"./BasicForm-dL_oCSPM.js";import{u as A}from"./useForm-CKmgcynv.js";import{V as b,d as O,r as t,c as Z,o as j,l as f,w as v,j as g,k as D,cZ as G}from"./index-9PRMimni.js";import{u as N}from"./useModal-CO65vga3.js";const{t:s}=b(),W=[{field:"inspectionContentZh",slot:"zhSlot",label:s("hsqe.question.contentChinese"),defaultValue:"",componentProps:{placeholder:s("hsqe.question.contentChineseHint")},rules:[{required:!0,message:s("hsqe.question.contentChineseHint"),trigger:["blur","input"]}]},{field:"inspectionContentEn",slot:"enSlot",label:s("hsqe.question.contentEnglish"),defaultValue:"",componentProps:{placeholder:s("hsqe.question.contentEnglishHint")},rules:[{required:!0,message:s("hsqe.question.contentEnglishHint"),trigger:["blur","input"]}]}],se=O({__name:"Modal",emits:["success"],setup($,{expose:k,emit:F}){const h=F,{t:n}=b(),R=t(),_=G(),l=t(),c=t(),u=t(),r=t(),p=t(),[T,{submit:M,getFieldsValue:y,setFieldsValue:w}]=A({gridProps:{cols:1},layout:"horizontal",showActionButtonGroup:!1,schemas:W,labelWidth:"160px"}),[P,{openModal:C,closeModal:q,setProps:S,setSubLoading:m}]=N({title:n("common.addText"),subBtuText:n("common.okText"),cancelText:n("common.cancelText"),width:650});async function B(){C()}async function V(e){c.value=e.inspectionProperty,u.value=e.inspectionType,r.value=e.resultLevel,p.value=e.remarkFlag,e.id?(l.value=e.id,w(e)):l.value=null}async function E(){if(!await M()){m(!1);return}if(l.value){const i={...y(),inspectionProperty:c.value,inspectionType:u.value,resultLevel:r.value,remarkFlag:p.value,id:l.value};await I(i),_.success(n("common.optionsEditSuccessText")),h("success"),m(!1),q()}else{const i={...y(),inspectionProperty:c.value,inspectionType:u.value,resultLevel:r.value,remarkFlag:p.value};await H(i),_.success(n("common.optionsAddSuccessText")),h("success"),m(!1),q()}}return k({showModal:B,setProps:S,getData:V}),(e,i)=>{const x=D,L=z;return j(),Z(L,{ref:"modalRef",onRegister:f(P),class:"basicModal basicFormModal",onOnOk:E},{default:v(()=>[g(f(U),{ref_key:"contentFromRef",ref:R,onRegister:f(T)},{zhSlot:v(({model:o,field:a})=>[g(x,{value:o[a],"onUpdate:value":d=>o[a]=d,type:"textarea"},null,8,["value","onUpdate:value"])]),enSlot:v(({model:o,field:a})=>[g(x,{value:o[a],"onUpdate:value":d=>o[a]=d,type:"textarea"},null,8,["value","onUpdate:value"])]),_:1},8,["onRegister"])]),_:1},8,["onRegister"])}}});export{se as _};
