import{a5 as O,r as P,av as k,aw as B,F as N}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 D}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 S}from"./FunctionCall.vue_vue_type_script_setup_true_name_FunctionCall_lang.1703796278973.js";import{d as h,v as $,k as m,l as _,V as J,o as y,c as g,a as u,b as p,u as r,B as U,z as q}from"./vue.1703796278973.js";const z=q("span",{style:{"line-height":"32px","padding-left":"24px"}}," 定时调用所选属性 ",-1),A=h({name:"WriteProperties"}),ee=h({...A,props:{value:{type:Object,default:()=>[]},action:{type:String,default:""},properties:{type:Array,default:()=>[]}},emits:["update:value","update:action"],setup(v,{expose:T,emit:d}){const s=v,l=$({reportKey:void 0,data:Object.keys(s.value).map(a=>({name:a,value:s.value[a]}))||[]}),j=m(),f=m();m([]);const w=(a,e)=>{var t;if(e==="enum")return(t=a.valueType.elements)==null?void 0:t.map(o=>({...o,label:o.text}));if(e==="boolean")return[{label:a.valueType.trueText,value:a.valueType.trueValue},{label:a.valueType.falseText,value:a.valueType.falseValue}]},i=_(()=>{const a=Object.keys(s.value);return a.length?a.map(e=>{var o;const t=s.properties.find(n=>n.id===e);if(console.log(t,s.value,e),t){const n=w(t,(o=t.valueType)==null?void 0:o.type);return{id:t.id,name:t.name,type:t.valueType?t.valueType.type:"-",format:t.valueType?t.valueType.format:void 0,options:n,value:s.value[e]}}return{id:e,name:e,type:"",format:void 0,options:void 0,value:void 0}}):[]});J(()=>{l.reportKey=Object.keys(s.value)[0]});const b=_(()=>!!l.reportKey),x=(a,e)=>{const t={[a]:void 0};j.value=[{id:a,value:void 0}],d("update:value",t),d("update:action",`修改${e.name}`)},K=a=>{var e;d("update:value",{[l.reportKey]:(e=a[0])==null?void 0:e.value})},C=[{validator(a,e){if(console.log(e,i.value),!(e!=null&&e.length)&&i.value.length)return Promise.reject("请选择属性值");{let t=e.find(o=>!o.value);if(t){const o=i.value.find(n=>n.id===t.name);return console.log(),Promise.reject(o!=null&&o.name?`请输入${o==null?void 0:o.name}值`:"请输入属性值")}}return Promise.resolve()}}];return T({validateFields:()=>new Promise(async a=>{var t;const e=await((t=f.value)==null?void 0:t.validateFields());a(e)})}),(a,e)=>{const t=O,o=P,n=k,V=B,F=N;return y(),g(F,{ref_key:"writeForm",ref:f,model:r(l),layout:"vertical",colon:!1},{default:u(()=>[p(V,{futter:[24,24]},{default:u(()=>[p(n,{span:10},{default:u(()=>[p(o,{name:"reportKey",rules:[{required:!0,message:"请输入修改值"}]},{default:u(()=>[p(t,{showSearch:"",style:{width:"100%"},placeholder:"请选择属性",value:r(l).reportKey,"onUpdate:value":e[0]||(e[0]=c=>r(l).reportKey=c),options:v.properties,"filter-option":r(D),onChange:x},null,8,["value","options","filter-option"])]),_:1})]),_:1}),p(n,{span:14},{default:u(()=>[z]),_:1}),r(b)?(y(),g(n,{key:0,span:24},{default:u(()=>[p(o,{name:"data",rules:C},{default:u(()=>[p(r(S),{value:r(l).data,"onUpdate:value":e[1]||(e[1]=c=>r(l).data=c),data:r(i),onChange:K},null,8,["value","data"])]),_:1})]),_:1})):U("",!0)]),_:1})]),_:1},8,["model"])}}});export{ee as _};
