import{a5 as x,r as C,av as D,aw as F,F as b}from"./index.17037962789732.js";import"./index.170379627897318.js";import"./index.170379627897319.js";import"./index.170379627897327.js";import"./index.170379627897316.js";import"./index.170379627897317.js";import{f as S}from"./comm.1703796278973.js";import"./index.vue_vue_type_script_setup_true_name_Timer_lang.1703796278973.js";import"./TopCard.vue_vue_type_style_index_0_scoped_817d9095_lang.1703796278973.js";import"./TriggerWay.vue_vue_type_style_index_0_scoped_1bb0f74d_lang.1703796278973.js";import{_ as N}from"./FunctionCall.vue_vue_type_script_setup_true_name_FunctionCall_lang.1703796278973.js";import{d as P,k as O,v as $,l as A,o as B,c as J,a as d,b as c,u as m,t as U}from"./vue.1703796278973.js";const q=P({name:"InvokeFunction"}),Z=P({...q,props:{functionId:{type:String,default:void 0},functionParameters:{type:Array,default:()=>[]},action:{type:String,default:""},functions:{type:Array,default:()=>[]}},emits:["update:functionParameters","update:functionId","update:action"],setup(v,{expose:g,emit:l}){const e=v,h=O(),s=$({functionId:e.functionId,functionData:e.functionParameters}),w=n=>{var o;const t=n==null?void 0:n.type;return t==="boolean"?[{label:(n==null?void 0:n.falseText)||"是",value:(n==null?void 0:n.falseValue)||!1},{label:(n==null?void 0:n.trueText)||"否",value:(n==null?void 0:n.trueValue)||!0}]:t==="enum"?(o=n==null?void 0:n.elements)==null?void 0:o.map(a=>({...a,label:a.text})):n==null?void 0:n.elements},_=A(()=>{var o,a,f;const n=e.functions.find(u=>u.id===s.functionId),t=[];if(n){const u=((o=n.input)==null?void 0:o.properties)||n.inputs;for(const i of u)t.push({id:i.id,name:i.name,type:((a=i.valueType)==null?void 0:a.type)||"-",format:((f=i.valueType)==null?void 0:f.format)||void 0,options:w(i.valueType),value:void 0})}return t}),I=[{validator(n,t){if(!(t!=null&&t.length)&&_.value.length)return Promise.reject("请输入功能值");{let o=t.find(a=>a.value===void 0);if(o){const a=_.value.find(f=>f.id===o.name);return Promise.reject(a!=null&&a.name?`请输入${a==null?void 0:a.name}值`:"请输入功能值")}}return Promise.resolve()}}],j=(n,t)=>{s.functionData=[],l("update:action",`执行${t.name}`),l("update:functionId",n),l("update:functionParameters",[])},k=n=>{l("update:functionParameters",n)};return g({validateFields:()=>new Promise(async n=>{var o;const t=await((o=h.value)==null?void 0:o.validateFields());n(t)})}),(n,t)=>{const o=x,a=C,f=D,u=F,i=b;return B(),J(i,{ref_key:"invokeForm",ref:h,model:m(s),layout:"vertical",colon:!1},{default:d(()=>[c(u,{gutter:24},{default:d(()=>[c(f,{span:10},{default:d(()=>[c(a,{name:"functionId",rules:[{required:!0,message:"请选择功能"}]},{default:d(()=>[c(o,{showSearch:"",allowClear:"",value:m(s).functionId,"onUpdate:value":t[0]||(t[0]=r=>m(s).functionId=r),style:{width:"100%"},placeholder:"请选择功能",options:v.functions,filterOption:m(S),onSelect:j},null,8,["value","options","filterOption"])]),_:1})]),_:1}),c(f,{span:14},{default:d(()=>[c(a,null,{default:d(()=>[U("定时调用所选功能")]),_:1})]),_:1}),c(f,{span:24},{default:d(()=>[c(a,{name:"functionData",rules:I},{default:d(()=>[c(m(N),{value:m(s).functionData,"onUpdate:value":t[1]||(t[1]=r=>m(s).functionData=r),data:m(_),onChange:k},null,8,["value","data"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])}}});export{Z as _};
