import{Q as I}from"./QSpace-B1cqOrzT.js";import{a as K,r as u,ac as j,c as O,d as T,o as b,w as c,f as s,e as l,W as U,t as i,v as n,y as f,cW as V,i as R,x as q,V as g,a0 as W,j as z}from"./index-CS0Lg7FU.js";import{Q as E}from"./QTree-DLpPRsSO.js";import{Q as M}from"./QScrollArea-RUmdgHY-.js";import{C as P}from"./ClosePopup-MvdAeGt1.js";import{_ as $}from"./_plugin-vue_export-helper-BrVfw-gY.js";const F={class:"row items-center dynamic-dialog-top"},G={class:"col-9 text-weight-bold"},H={class:"col-3 text-weight-bold"},J=["onClick"],L={class:"col-9"},X=["src"],Y={style:{"margin-left":"3px"}},Z={class:"col-3"},ee={__name:"AddAssObj",props:{data:{type:Array,default:()=>[]},titlename:{type:String,default:""},checkRowKeys:{type:Array,default:()=>[]}},emits:["cancel","add"],setup(m,{expose:w,emit:x}){const{t:o}=K(),y=m,p=x;let C=u(null);const d=u([]),h=u([]);let v=u(!0);j(()=>y.data.length,t=>{v.value=t===0},{immediate:!0});const _=O(()=>y.data.map(t=>({...t,selectable:!t.disabled,children:t.children?t.children.map(e=>({...e,selectable:!e.disabled})):void 0})));function Q(t){d.value=[...t]}const S=t=>{if(t.disabled||!t.selectable)return;const e=[...d.value],a=t.key;e.includes(a)?d.value=e.filter(D=>D!==a):d.value=[...e,a]};function A(){return d.value.map(e=>k(_.value,e)).filter(e=>e&&!e.disabled)}function k(t,e){for(const a of t){if(a.key===e)return a;if(a.children){const r=k(a.children,e);if(r)return r}}return null}function N(){p("cancel")}function B(){const t=A();p("add",t)}return w({initSelectKeys:Q}),(t,e)=>(b(),T(g,{class:"add-ass-obj-dialog",style:{height:"80vh",display:"flex","flex-direction":"column"}},{default:c(()=>[s(U,{class:"row items-center q-pb-none"},{default:c(()=>[l("div",null,i(m.titlename)+i(n(o)("taskInfo.assObjOnBranch")),1),s(I),s(f,{dense:"",flat:"",round:"",icon:"close",size:"md",color:"grey-6",onClick:N})]),_:1}),l("div",F,[l("div",G,i(n(o)("taskInfo.name")),1),l("div",H,i(n(o)("taskInfo.assigned")),1)]),s(M,{style:{height:"calc(80vh - 155px)"}},{default:c(()=>[s(E,{ref_key:"assTreeRef",ref:C,nodes:_.value,"node-key":"key","label-key":"name","selected-color":"primary","tick-strategy":"leaf",ticked:d.value,"onUpdate:ticked":e[0]||(e[0]=a=>d.value=a),expanded:h.value,"onUpdate:expanded":e[1]||(e[1]=a=>h.value=a),"no-nodes-label":n(v)?n(o)("notify.loading"):n(o)("taskInfo.empty")},{"default-header":c(a=>[l("div",{class:"row items-center full-width dynamic-list",onClick:V(r=>S(a.node),["stop"])},[l("div",L,[a.node.iconUrlName?(b(),R("img",{key:0,src:a.node.iconUrlName,class:"img-icon"},null,8,X)):q("",!0),l("span",Y,i(a.node.name),1)]),l("div",Z,i(a.node.branch),1)],8,J)]),_:1},8,["nodes","ticked","expanded","no-nodes-label"])]),_:1}),s(g,{square:"",class:"card-btn-bottom"},{default:c(()=>[s(W,{align:"right"},{default:c(()=>[z(s(f,{outline:"",rounded:"",label:n(o)("notify.cancel"),color:"primary",style:{width:"24vw"}},null,8,["label"]),[[P]]),s(f,{unelevated:"",rounded:"",style:{width:"65vw"},label:n(o)("notify.ok"),color:"primary",onClick:B},null,8,["label"])]),_:1})]),_:1})]),_:1}))}},de=$(ee,[["__scopeId","data-v-49a26343"]]);export{de as A};
