import{M as I,aW as L,r as M,F as B,W as O}from"./index.17037962789732.js";import"./index.170379627897337.js";import"./index.170379627897315.js";import"./index.170379627897318.js";import"./index.170379627897319.js";import{_ as W}from"./index.vue_vue_type_script_setup_true_name_ValueItem_lang.1703796278973.js";import"./index.1703796278973306.js";import{i as q}from"./instance.1703796278973.js";import{u as J}from"./instance.17037962789732.js";import{d as N,k,v as P,o as U,c as $,a as m,b as l,u as r,a5 as z}from"./vue.1703796278973.js";const ee=N({__name:"Save",props:{data:{type:Object,default:()=>{}}},emits:["close"],setup(a,{emit:d}){const h=a,c=k(!1),j=J(),p=k(),t=P({propertyValue:void 0}),w=()=>{d("close")},x={propertyValue:[{required:!0,message:"该字段是必填字段"}]},C=()=>{p.value.validate().then(async()=>{var o,n,s;c.value=!0,(await q(((o=j.current)==null?void 0:o.id)||"",{[(n=h.data)==null?void 0:n.id]:(s=z(t))==null?void 0:s.propertyValue}).finally(()=>{c.value=!1})).status===200&&(I.success("操作成功！"),d("close"),p.value.resetFields())}).catch(u=>{console.log("error",u)})};return(u,o)=>{const n=L,s=W,R=M,S=B,F=O;return U(),$(F,{maskClosable:!1,visible:!0,title:"编辑",onOk:C,onCancel:w,confirmLoading:r(c)},{default:m(()=>[l(n,{message:"当数据来源为设备时，填写的值将下发到设备",type:"warning",showIcon:""}),l(S,{rules:x,layout:"vertical",ref_key:"formRef",ref:p,model:r(t),style:{"margin-top":"20px"}},{default:m(()=>{var i;return[l(R,{name:"propertyValue",label:((i=a.data)==null?void 0:i.name)||"自定义属性"},{default:m(()=>{var f,y,_,v,g,V,b,T;return[l(s,{modelValue:r(t).propertyValue,"onUpdate:modelValue":o[0]||(o[0]=e=>r(t).propertyValue=e),itemType:((y=(f=a.data)==null?void 0:f.valueType)==null?void 0:y.type)||((_=a.data)==null?void 0:_.dataType),options:(((g=(v=a.data)==null?void 0:v.valueType)==null?void 0:g.type)||((V=a.data)==null?void 0:V.dataType))==="enum"?(((T=(b=a.data)==null?void 0:b.valueType)==null?void 0:T.elements)||[]).map(e=>({label:e==null?void 0:e.text,value:e==null?void 0:e.value})):void 0},null,8,["modelValue","itemType","options"])]}),_:1},8,["label"])]}),_:1},8,["model"])]),_:1},8,["confirmLoading"])}}});export{ee as _};
