import{_ as O}from"./index.170379627897331.js";import{I as A,r as F,a9 as V,a5 as E,K,aK as L,F as S}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{d as z,k as g,l as P,m as w,r as J,o as u,x,b as v,a as s,u as _,c as r,F as M,h as Y,t as R,A as $,B as b,M as G}from"./vue.1703796278973.js";import{_ as H}from"./_plugin-vue_export-helper.1703796278973.js";import"./index.17037962789733.js";import"./dayjs.min.1703796278973.js";import"./isArray.1703796278973.js";import"./editor.api.1703796278973.js";import"./preload-helper.1703796278973.js";import"./monaco.contribution.1703796278973.js";const Q={class:"request-table-container"},W=z({__name:"RequestTable",props:{value:null,valueType:{default:"input"},valueOptions:null,valid:{type:Boolean}},emits:["update:value","update:valid"],setup(C,{emit:d}){const a=C,D=[{title:"KEY",dataIndex:"label",key:"label",width:"40%"},{title:"VALUE",dataIndex:"value",key:"value",width:"40%"},{title:" ",dataIndex:"action",key:"action",width:"20%"}],t=g(1),c=g({tableData:P(()=>a.value.slice((t.value-1)*10,t.value*10))}),y=g();w(()=>c.value,l=>{var i;(i=y.value)==null||i.validate();const e=c.value.tableData.every(p=>p.label&&p.value||!p.label&&!p.value);d("update:valid",e)},{deep:!0}),a.value.length<1&&h(),w(()=>a.value,(l,e)=>{!e||l.length===e.length||(l.length>e.length?e.length%10===0&&l.length>10&&(t.value=t.value+1):e.length%10===1&&e.length>10&&(t.value=t.value-1))},{immediate:!0});function T(l){const e=a.value.slice(0,l++),i=a.value.slice(l,a.value.length);d("update:value",[...e,...i])}function h(){const l={label:"",value:""};d("update:value",[...a.value,l])}return(l,e)=>{const i=A,p=F,U=V,j=E,k=J("AIcon"),I=K,q=L,B=S,N=O;return u(),x("div",Q,[v(B,{ref_key:"formRef",ref:y,model:_(c),layout:"vertical"},{default:s(()=>[v(q,{columns:D,"data-source":_(c).tableData,pagination:!1,size:"small",bordered:""},{bodyCell:s(({column:m,record:n,index:f})=>[m.dataIndex==="label"?(u(),r(p,{key:0,name:["tableData",f+(_(t)-1)*10,"label"],rules:[{required:!!n.label&&!!n.value,message:"该字段为必填字段",trigger:"change"}]},{default:s(()=>[v(i,{value:n.label,"onUpdate:value":o=>n.label=o},null,8,["value","onUpdate:value"])]),_:2},1032,["name","rules"])):m.dataIndex==="value"?(u(),r(p,{key:1,name:["tableData",f+(_(t)-1)*10,"value"],rules:[{required:!!n.value&&!!n.label,message:"该字段为必填字段",trigger:"change"}]},{default:s(()=>[a.valueType==="input"?(u(),r(i,{key:0,value:n.value,"onUpdate:value":o=>n.value=o},null,8,["value","onUpdate:value"])):a.valueType==="select"?(u(),r(j,{key:1,value:n.value,"onUpdate:value":o=>n.value=o},{default:s(()=>[(u(!0),x(M,null,Y(a.valueOptions,o=>(u(),r(U,{value:o.value},{default:s(()=>[R($(o.label),1)]),_:2},1032,["value"]))),256))]),_:2},1032,["value","onUpdate:value"])):b("",!0)]),_:2},1032,["name","rules"])):m.dataIndex==="action"?(u(),r(I,{key:2,type:"link",onClick:o=>T((_(t)-1)*10+f)},{default:s(()=>[v(k,{type:"DeleteOutlined"})]),_:2},1032,["onClick"])):b("",!0)]),_:1},8,["data-source"])]),_:1},8,["model"]),a.value.length>10?(u(),r(N,{key:0,pageNum:_(t),"onUpdate:pageNum":e[0]||(e[0]=m=>G(t)?t.value=m:null),pageSize:10,total:a.value.length},null,8,["pageNum","total"])):b("",!0),v(I,{type:"dashed",onClick:h,class:"add-btn"},{default:s(()=>[v(k,{type:"PlusOutlined"}),R("新增 ")]),_:1})])}}});const ke=H(W,[["__scopeId","data-v-a6de0819"]]);export{ke as default};
