import{r as k,I as T,aK as g,F as j}from"./index.17037962789732.js";import"./index.170379627897318.js";import"./index.170379627897319.js";import"./index.1703796278973305.js";import"./index.170379627897315.js";import"./index.170379627897317.js";import"./index.1703796278973301.js";import"./index.1703796278973302.js";import"./index.170379627897332.js";import"./index.1703796278973303.js";import"./index.170379627897339.js";import"./index.170379627897316.js";import"./index.170379627897314.js";import"./index.1703796278973304.js";import{_ as C}from"./index.vue_vue_type_script_setup_true_name_ValueItem_lang.1703796278973.js";import{d as U,v as B,k as E,w as R,o as u,x as F,b as l,a as m,u as _,c}from"./vue.1703796278973.js";const K={class:"inputs"},Z=U({__name:"EditTable",props:{modelValue:{type:Array,default:""}},emits:["update:modelValue"],setup(f,{expose:v,emit:y}){const b=f,x=[{title:"参数名称",dataIndex:"name",with:"33%"},{title:"类型",dataIndex:"valueType",with:"33%"},{title:"值",dataIndex:"value",with:"34%"}],a=B({dataSource:[]}),s=E();R(()=>{a.dataSource=b.modelValue||[]});const h=()=>{y("update:modelValue",a.dataSource)};return v({onSave:()=>new Promise((p,d)=>{s.value.validate().then(()=>{p([...a.dataSource])}).catch(()=>{d(!1)})})}),(p,d)=>{const I=C,i=k,V=T,S=g,w=j;return u(),F("div",K,[l(w,{ref_key:"formRef",ref:s,model:_(a)},{default:m(()=>[l(S,{rowKey:"id",columns:x,"data-source":_(a).dataSource,bordered:"",pagination:!1},{bodyCell:m(({column:t,record:e,index:r})=>[t.dataIndex==="value"?(u(),c(i,{key:0,name:["dataSource",r,"value"],rules:[{required:!0,message:e.type==="enum"||e.type==="boolean"?"请选择":"请输入"}]},{default:m(()=>{var o;return[l(I,{modelValue:e.value,"onUpdate:modelValue":n=>e.value=n,itemType:e.type,options:e.type==="enum"?(((o=e==null?void 0:e.dataType)==null?void 0:o.elements)||[]).map(n=>({label:n.text,value:n.value})):e.type==="boolean"?[{label:"是",value:!0},{label:"否",value:!1}]:void 0,onChange:h},null,8,["modelValue","onUpdate:modelValue","itemType","options"])]}),_:2},1032,["name","rules"])):(u(),c(i,{key:1,name:["dataSource",r,t.dataIndex]},{default:m(()=>[l(V,{readonly:"",bordered:!1,value:e[t.dataIndex],"onUpdate:value":o=>e[t.dataIndex]=o},null,8,["value","onUpdate:value"])]),_:2},1032,["name"]))]),_:1},8,["data-source"])]),_:1},8,["model"])])}}});export{Z as _};
