import{_ as U,a5 as F,b as j,r as B,ah as R,b1 as W,$ as q,o as _,y as z,q as d,v as s,p as a,P as N,x as m,n as x,c as g,t as b,s as A,ak as O,j as G,l as H,bv as J,a0 as K,a1 as Q,D as X}from"./index.8d733f79.js";import{E as Y}from"./el-text.54dc8292.js";import{c as Z,S as ee}from"./deviceTree.170dfbd9.js";const k=c=>(K("data-v-85cb81bc"),c=c(),Q(),c),te={style:{display:"flex","flex-direction":"column"}},oe={class:"pasteTip"},le={style:{"margin-left":"10px"}},se={class:"tree-content common-border"},ne={style:{"margin-bottom":"0px"}},ae={key:0,style:{"margin-bottom":"8px"}},de=k(()=>s("span",{class:"dangerColor"},"* ",-1)),ie={key:1},ce=k(()=>s("span",{class:"dangerColor"},"* ",-1)),re={key:2,style:{margin:"6px 0"}},ue={class:"dialog-footer"},pe=F({name:"PasteModal"}),_e=Object.assign(pe,{emits:["saveData"],setup(c,{expose:D,emit:S}){const{t:r}=j(),{proxy:u}=X(),i=B(!1),y=R({treeList:[],targetNodeId:"",curLevel:""}),{treeList:p,targetNodeId:v,curLevel:P}=W(y);function w(e,t){v.value=t.id||"",P.value=t.level,i.value=!0,M(e)}function M(e){Z({nodeId:e.id}).then(t=>{e.children=t.data||[],p.value=[e]})}function T(){C(p.value,!1,e=>{e||ee(v.value,p.value[0]).then(()=>{setTimeout(()=>{S("saveData",{refreshId:v.value})},0),u.$modal.msgSuccess(r("saveSuccess")),f()}).catch(()=>{})})}function C(e,t,n){for(let o=0;o<e.length;o++){if(!e[o].label){if(e[o].level===1){u.$modal.msgError(r("orgNameP")),t=!0,n(!0);return}else if(e[o].level===2){u.$modal.msgError(r("deviceNameP")),t=!0,n(!0);return}}if(e[o].level===2&&!e[o].deviceCode&&!t){u.$modal.msgError(r("deviceCodeP")),t=!0,n(!0);return}if(e[o].children&&e[o].children.length&&!t){C(e[o].children,t,n);return}if(t)break}t||n(!1)}function f(){p.value=[],i.value=!1}return D({showModal:w}),(e,t)=>{const n=q("WarningFilled"),o=O,V=G,E=Y,I=H,L=J;return _(),z(L,{title:e.$t("paste"),modelValue:x(i),"onUpdate:modelValue":t[0]||(t[0]=$=>A(i)?i.value=$:null),width:"600px","align-center":!0,"append-to-body":"",onClose:f},{footer:d(()=>[s("div",ue,[a(I,{onClick:f},{default:d(()=>[N(m(e.$t("cancel")),1)]),_:1}),a(I,{type:"primary",onClick:T},{default:d(()=>[N(m(e.$t("confirm")),1)]),_:1})])]),default:d(()=>[s("div",te,[s("div",oe,[a(o,{style:{color:"#EDD72F","font-size":"20px"}},{default:d(()=>[a(n)]),_:1}),s("div",le,m(e.$t("confirmCode")),1)]),s("div",se,[a(E,{style:{width:"100%"},class:"pasteTree",data:x(y).treeList,props:{label:"label",children:"children"},"default-expand-all":"","node-key":"id","expand-on-click-node":!1},{default:d(({node:$,data:l})=>[s("div",ne,[l.level!==3?(_(),g("div",ae,[de,a(V,{modelValue:l.label,"onUpdate:modelValue":h=>l.label=h,class:"tree-input",placeholder:e.$t("inputP")+(l.level==1?e.$t("orgName"):e.$t("deviceName"))},null,8,["modelValue","onUpdate:modelValue","placeholder"])])):b("",!0),l.level===2?(_(),g("div",ie,[ce,a(V,{modelValue:l.deviceCode,"onUpdate:modelValue":h=>l.deviceCode=h,class:"tree-input",placeholder:e.$t("deviceCodeP")},null,8,["modelValue","onUpdate:modelValue","placeholder"])])):b("",!0),l.level===3?(_(),g("div",re,m(l.label),1)):b("",!0)])]),_:1},8,["data"])])])]),_:1},8,["title","modelValue"])}}}),he=U(_e,[["__scopeId","data-v-85cb81bc"]]);export{he as default};
