import{a5 as M,r as P,Y as E,a0 as U}from"./index.17037962789732.js";import"./index.170379627897336.js";import"./index.170379627897318.js";import"./index.170379627897319.js";import"./index.170379627897316.js";import"./index.170379627897317.js";import{u as A}from"./metadata.1703796278973.js";import{P as B,a as R}from"./data.17037962789732.js";import{_,C as q,M as z}from"./index.1703796278973319.js";import{d as g,k as F,w as N,m as O,p as V,r as I,o as s,x as f,c,a as o,b as r,u as a,B as p,F as y,h as J,M as L,t as W}from"./vue.1703796278973.js";const Q=g({name:"ExpandsForm"}),te=g({...Q,props:{value:{type:Object},type:{type:String},name:{type:Array,default:()=>[],required:!0},id:{type:String},config:{type:Array,default:()=>[]},valueType:{type:Object,default:()=>({})}},emits:["update:value"],setup(t,{emit:v}){const d=t,e=F({});N(()=>{e.value=d.value||{}}),O(e,()=>{v("update:value",e.value)},{deep:!0,immediate:!0});const b=A();V(()=>{var u;(d.type==="product"||!((u=d.value)!=null&&u.source))&&v("update:value",{source:"device",...d.value})});const w=u=>u.every(i=>i.id&&i.name&&i.value)?Promise.resolve():Promise.reject(new Error("请输入指标配置")),k=u=>{u==="manual"?e.value.type=["write"]:u==="rule"?e.value.type=["report"]:e.value.type=[]};return(u,n)=>{const i=M,m=P,x=I("AIcon"),C=E,j=U;return s(),f(y,null,[t.type==="product"?(s(),c(m,{key:0,label:"来源",name:t.name.concat(["source"]),rules:[{required:!0,message:"请选择来源"}]},{default:o(()=>[r(i,{value:a(e).source,"onUpdate:value":n[0]||(n[0]=l=>a(e).source=l),options:a(B),size:"small",disabled:a(b).model.action==="edit",onChange:k},null,8,["value","options","disabled"])]),_:1},8,["name"])):p("",!0),t.type==="product"&&a(e).source==="rule"?(s(),c(_,{key:1,value:a(e).virtualRule,"onUpdate:value":n[1]||(n[1]=l=>a(e).virtualRule=l),name:t.name.concat(["virtualRule"]),id:t.id,showWindow:a(e).source==="rule"},null,8,["value","name","id","showWindow"])):p("",!0),r(m,{label:"读写类型",name:t.name.concat(["type"]),rules:[{required:!0,message:"请选择读写类型"}]},{default:o(()=>[r(i,{value:a(e).type,"onUpdate:value":n[2]||(n[2]=l=>a(e).type=l),options:a(R),mode:"multiple",size:"small",disabled:["manual","rule"].includes(a(e).source)},null,8,["value","options","disabled"])]),_:1},8,["name"]),t.config.length>0?(s(),c(m,{key:2,label:"其他配置"},{default:o(()=>[(s(!0),f(y,null,J(t.config,(l,S)=>(s(),c(m,{key:S},{default:o(()=>[r(q,{value:a(e),"onUpdate:value":n[3]||(n[3]=T=>L(e)?e.value=T:null),config:l,name:t.name},null,8,["value","config","name"])]),_:2},1024))),128))]),_:1})):p("",!0),t.type==="product"&&["int","float","double","long","date","string","boolean"].includes(t.valueType.type)?(s(),c(m,{key:3,name:t.name.concat(["metrics"]),rules:[{validator:()=>w(a(e).metrics),message:"请输入指标配置"}]},{label:o(()=>[r(j,null,{default:o(()=>[W(" 指标配置 "),r(C,{title:"场景联动页面可引用指标配置作为触发条件"},{default:o(()=>[r(x,{type:"QuestionCircleOutlined",style:{color:"rgb(136, 136, 136)","font-size":"12px"}})]),_:1})]),_:1})]),default:o(()=>[r(z,{value:a(e).metrics,"onUpdate:value":n[4]||(n[4]=l=>a(e).metrics=l),type:t.valueType.type,enum:t.valueType,name:t.name.concat(["metrics"])},null,8,["value","type","enum","name"])]),_:1},8,["name","rules"])):p("",!0)],64)}}});export{te as _};
