import{a5 as W,b as X,r,ah as Y,o as m,y as _,q as n,v as g,p as s,P as $,x as h,n as o,s as S,c as y,F as C,A as F,aH as T,aI as U,c5 as Z,c0 as x,k as j,j as ee,E as ae,i as le,m as oe,l as te,bv as ne,D as se}from"./index.8d733f79.js";import{d as de,e as ue,f as re}from"./components.b31a8293.js";const ie={class:"content-wrap"},me={class:"dialog-footer"},pe=W({name:"PositionMapModal"}),_e=Object.assign(pe,{emits:["confirm"],setup(ce,{expose:q,emit:b}){const{t:p}=X(),{proxy:c}=se(),f=r(!1),L=r(""),B=r([{label:"\u90E8\u4EF6",value:0},{label:"\u6D4B\u70B9",value:1}]),d=r(0),i=r(""),u=r({name:"",paramIdList:[]}),t=r({name:"",componentId:""}),P=r([]),I=r([]),M=Y({name:[{required:!0,message:p("pointNameP"),trigger:"blur"}],componentId:[{required:!0,message:p("superComponentP"),trigger:"change"}]});function O(e,a){L.value=p(e==="add"?"add":"edit"),f.value=!0,i.value=e,e==="add"?(d.value=0,E(),G()):(d.value=a.dataType,a.dataType===0?(u.value={...u.value,...a},A(a.id),E()):a.dataType===1&&(t.value={...t.value,...a}))}const A=e=>{de({id:e}).then(a=>{u.value.name=a.data.name,u.value.paramIdList=a.data.paramIdList})},E=()=>{ue().then(e=>{P.value=e.data})},G=()=>{re().then(e=>{I.value=e.data})};function H(){d.value===0&&c.$refs.componentFormRef.validate(e=>{e&&(i.value==="edit"&&(u.value.isSync=1),b("confirm",u.value,d.value,i.value))}),d.value===1&&c.$refs.pointFormRef.validate(e=>{if(e){if(t.value.name.indexOf(".")!==-1){c.$modal.msgError(p("pointNameValidate"));return}if(i.value==="add")t.value.componentIdentifier=I.value.find(a=>a.id===t.value.componentId).identifier,b("confirm",t.value,d.value,i.value);else{const a={id:t.value.id,name:t.value.name,pointIdentifier:t.value.identifier,componentIdentifier:t.value.componentIdentifier,isSync:1};b("confirm",a,d.value,i.value)}}})}function V(){f.value=!1}const z=()=>{u.value={name:"",paramIdList:[]},t.value={name:"",componentId:""},c.$refs.componentFormRef.resetFields(),c.$refs.pointFormRef.resetFields()};return q({showModal:O,closeModal:V}),(e,a)=>{const J=Z,K=x,v=j,k=ee,N=ae,R=le,w=oe,D=te,Q=ne;return m(),_(Q,{title:o(L),modelValue:o(f),"onUpdate:modelValue":a[5]||(a[5]=l=>S(f)?f.value=l:null),width:"500px","align-center":!0,onClose:V,onClosed:z},{footer:n(()=>[g("div",me,[s(D,{onClick:V},{default:n(()=>[$(h(e.$t("cancel")),1)]),_:1}),s(D,{type:"primary",onClick:H},{default:n(()=>[$(h(e.$t("confirm")),1)]),_:1})])]),default:n(()=>[g("div",ie,[s(v,{label:e.$t("type"),rules:[{required:!0}]},{default:n(()=>[s(K,{modelValue:o(d),"onUpdate:modelValue":a[0]||(a[0]=l=>S(d)?d.value=l:null),disabled:o(i)==="edit"},{default:n(()=>[(m(!0),y(C,null,F(o(B),l=>(m(),_(J,{key:l.value,value:l.value},{default:n(()=>[$(h(l.label),1)]),_:2},1032,["value"]))),128))]),_:1},8,["modelValue","disabled"])]),_:1},8,["label"]),T(g("div",null,[s(w,{ref:"componentFormRef",model:o(u)},{default:n(()=>[s(v,{label:e.$t("componentName"),prop:"name",rules:[{required:!0,message:e.$t("componentNameP"),trigger:"blur"}]},{default:n(()=>[s(k,{modelValue:o(u).name,"onUpdate:modelValue":a[1]||(a[1]=l=>o(u).name=l),placeholder:e.$t("componentNameP"),maxlength:"20"},null,8,["modelValue","placeholder"])]),_:1},8,["label","rules"]),s(v,{label:e.$t("linkComponentParams"),prop:"paramIdList",style:{height:"auto","min-height":"74px"}},{default:n(()=>[s(R,{modelValue:o(u).paramIdList,"onUpdate:modelValue":a[2]||(a[2]=l=>o(u).paramIdList=l),filterable:"",multiple:"",placeholder:e.$t("linkComponentParamsP")},{default:n(()=>[(m(!0),y(C,null,F(o(P),l=>(m(),_(N,{key:l.id,label:l.name,value:l.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1},8,["model"])],512),[[U,o(d)===0]]),T(g("div",null,[s(w,{ref:"pointFormRef",model:o(t),rules:M},{default:n(()=>[s(v,{label:e.$t("pointName"),prop:"name"},{default:n(()=>[s(k,{modelValue:o(t).name,"onUpdate:modelValue":a[3]||(a[3]=l=>o(t).name=l),placeholder:e.$t("pointNameP"),maxlength:"20"},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),s(v,{label:e.$t("superComponent"),prop:"componentId"},{default:n(()=>[s(R,{modelValue:o(t).componentId,"onUpdate:modelValue":a[4]||(a[4]=l=>o(t).componentId=l),placeholder:e.$t("superComponentP"),filterable:"",disabled:o(i)==="edit"},{default:n(()=>[(m(!0),y(C,null,F(o(I),l=>(m(),_(N,{key:l.id,label:l.name,value:l.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","disabled"])]),_:1},8,["label"])]),_:1},8,["model","rules"])],512),[[U,o(d)===1]])])]),_:1},8,["title","modelValue"])}}});export{_e as default};
