cd-personselector 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/index.mjs +254 -230
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/PersonSelector.vue +48 -2
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(p,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(p=typeof globalThis<"u"?globalThis:p||self,e(p.CdPersonSelector={},p.Vue))})(this,function(p,e){"use strict";const j={class:"cd-ps-container"},J={key:0,class:"cd-ps-tips"},q={key:1,class:"cd-ps-search"},A={key:0,class:"cd-ps-org-select"},G={class:"cd-ps-search-input"},H={class:"cd-ps-content"},K={class:"cd-ps-left"},Q={key:0,class:"cd-ps-search-results"},X={class:"cd-ps-search-header"},Y={key:0,class:"cd-ps-loading"},Z={key:1,class:"cd-ps-empty"},v={key:2,class:"cd-ps-result-list"},ee=["onClick"],te={class:"cd-ps-avatar"},oe={class:"cd-ps-info"},le={class:"cd-ps-name"},ne={class:"cd-ps-meta"},se={key:0},ae={key:1},ce={key:2},de={class:"cd-ps-tree"},re={key:0,class:"cd-ps-count"},ie={key:1,class:"cd-ps-empty"},pe={class:"cd-ps-right"},me={class:"cd-ps-right-header"},ke={class:"cd-ps-num"},he={class:"cd-ps-right-list"},fe={key:0,class:"cd-ps-empty"},_e={key:1,class:"cd-ps-selected-list"},ye={class:"cd-ps-item-info"},Ne={class:"cd-ps-info"},Ve={class:"cd-ps-name"},Be={class:"cd-ps-meta"},Ce={key:0},ge={key:1},Ee={key:2},ue={key:3},P=((h,U)=>{const x=h.__vccOpts||h;for(const[a,k]of U)x[a]=k;return x})(e.defineComponent({__name:"PersonSelector",props:{visible:{type:Boolean,default:!1},tabs:{default:()=>[]},organizations:{default:()=>[]},modelValue:{default:()=>[]},dialogWidth:{default:"900px"},tips:{default:""},showSearch:{type:Boolean,default:!0}},emits:["update:visible","update:modelValue","confirm","load-users","search"],setup(h,{expose:U,emit:x}){var F,W;const a=h,k=x,f=e.ref(a.visible),_=e.ref(((W=(F=a.tabs)==null?void 0:F[0])==null?void 0:W.key)||""),C=e.ref(null),y=e.ref(""),c=e.ref([]),w=e.ref({}),D=e.ref(!1),S=e.ref(!1),N=e.ref([]),Se=e.computed(()=>a.tabs||[]),O=e.computed(()=>a.organizations||[]),R=e.computed(()=>a.tips||""),be=e.computed(()=>a.showSearch),Ue=e.computed(()=>a.dialogWidth),g=e.ref({});e.watch(()=>a.tabs,l=>{if(l&&l.length>0){const t={};l.forEach(n=>{t[n.key]=JSON.parse(JSON.stringify(n.tree))}),g.value=t,(!_.value||!l.find(n=>n.key===_.value))&&(_.value=l[0].key)}},{immediate:!0,deep:!0}),e.watch(()=>a.visible,l=>{f.value=l,l&&(c.value=a.modelValue?[...a.modelValue]:[],a.organizations.length>0&&!C.value&&(C.value=a.organizations[0].id))}),e.watch(f,l=>{k("update:visible",l)});function we(l,t){t&&(w.value[l]=t)}function L(l,t){for(const n of l){if(n.id===t)return n;if(n.children){const s=L(n.children,t);if(s)return s}}return null}const E=e.computed(()=>{const l=[];return c.value.forEach(t=>{const n=N.value.find(s=>s.id===t);if(n){l.push({...n,typeName:"搜索结果"});return}for(const s of a.tabs){const d=g.value[s.key]||[],i=L(d,t);if(i){l.push({...i,typeName:s.name});break}}}),l}),De=()=>{y.value=""},ze=()=>{};let V=null;const Te=()=>{if(V&&clearTimeout(V),!y.value.trim()){z();return}D.value=!0,S.value=!0,V=setTimeout(()=>Ie(),300)},Ie=()=>{N.value=[];const l=t=>{N.value=t.map(n=>({...n,isUser:!0})),S.value=!1};k("search",{keyword:y.value,orgId:C.value||void 0,callback:l})},z=()=>{V&&(clearTimeout(V),V=null),D.value=!1,y.value="",N.value=[],S.value=!1},Pe=l=>{const t=c.value.indexOf(l.id);t>-1?c.value.splice(t,1):c.value.push(l.id)};function Oe(l){const t=[],n=s=>{for(const d of s)t.push(d.id),d.children&&n(d.children)};return n(l),t}const Re=l=>{const t=g.value[_.value]||[],n=Oe(t),s=c.value.filter(d=>!n.includes(d));c.value=[...s,...l]};async function Le(l,t){const n=l.value,s=w.value[t];k("load-users",{tabKey:t,nodeId:n,node:l,callback:async i=>{if(i.length>0){const m=i.map(B=>{const{id:u,name:T,...I}=B;return{...I,id:u,name:B.displayName||T,isUser:!0}});if(s){s.appendTo(n,m),l.data.loaded=!0,await e.nextTick();try{s.setItem(n,{expanded:!0})}catch{}}}else l.data.loaded=!0}})}const Me=l=>{c.value=c.value.filter(t=>t!==l)},M=()=>{c.value=[]},Fe=()=>{k("update:modelValue",c.value),k("confirm",E.value),f.value=!1},We=()=>{f.value=!1};return U({clearSelection:M,appendUsers:(l,t,n)=>{const s=w.value[l];if(s&&n.length>0){const d=n.map(i=>{const{id:m,name:B,...u}=i;return{...u,id:m,name:i.displayName||B,isUser:!0}});s.appendTo(t,d)}}}),(l,t)=>{const n=e.resolveComponent("t-icon"),s=e.resolveComponent("t-option"),d=e.resolveComponent("t-select"),i=e.resolveComponent("t-input"),m=e.resolveComponent("t-button"),B=e.resolveComponent("t-loading"),u=e.resolveComponent("t-checkbox"),T=e.resolveComponent("t-tree"),I=e.resolveComponent("t-tab-panel"),$e=e.resolveComponent("t-tabs"),je=e.resolveComponent("t-dialog");return e.openBlock(),e.createBlock(je,{visible:f.value,"onUpdate:visible":t[4]||(t[4]=o=>f.value=o),header:"选择人员",width:Ue.value,footer:!0,"destroy-on-close":"",onConfirm:Fe,onClose:We},{default:e.withCtx(()=>[e.createElementVNode("div",j,[R.value?(e.openBlock(),e.createElementBlock("div",J,[e.createVNode(n,{name:"info-circle"}),e.createElementVNode("span",null,e.toDisplayString(R.value),1)])):e.createCommentVNode("",!0),be.value?(e.openBlock(),e.createElementBlock("div",q,[O.value.length>0?(e.openBlock(),e.createElementBlock("div",A,[e.createVNode(d,{modelValue:C.value,"onUpdate:modelValue":t[0]||(t[0]=o=>C.value=o),placeholder:"选择组织",style:{width:"200px"},onChange:ze},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(O.value,o=>(e.openBlock(),e.createBlock(s,{key:o.id,value:o.id,label:o.displayName||o.name},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])])):e.createCommentVNode("",!0),e.createElementVNode("div",G,[e.createVNode(i,{modelValue:y.value,"onUpdate:modelValue":t[1]||(t[1]=o=>y.value=o),placeholder:"搜索",clearable:"",onInput:Te,onClear:z},{"prefix-icon":e.withCtx(()=>[e.createVNode(n,{name:"search"})]),_:1},8,["modelValue"])])])):e.createCommentVNode("",!0),e.createElementVNode("div",H,[e.createElementVNode("div",K,[D.value?(e.openBlock(),e.createElementBlock("div",Q,[e.createElementVNode("div",X,[t[6]||(t[6]=e.createElementVNode("span",null,"搜索结果",-1)),e.createVNode(m,{size:"small",variant:"text",onClick:z},{default:e.withCtx(()=>[...t[5]||(t[5]=[e.createTextVNode("返回",-1)])]),_:1})]),S.value?(e.openBlock(),e.createElementBlock("div",Y,[e.createVNode(B),t[7]||(t[7]=e.createElementVNode("span",null,"搜索中...",-1))])):N.value.length===0?(e.openBlock(),e.createElementBlock("div",Z,[e.createVNode(n,{name:"search",size:"48px",style:{color:"#ddd"}}),t[8]||(t[8]=e.createElementVNode("p",null,"未找到匹配的人员",-1))])):(e.openBlock(),e.createElementBlock("div",v,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(N.value,o=>(e.openBlock(),e.createElementBlock("div",{key:o.id,class:e.normalizeClass(["cd-ps-result-item",{"cd-ps-selected":c.value.includes(o.id)}]),onClick:b=>Pe(o)},[e.createVNode(u,{checked:c.value.includes(o.id),onClick:t[2]||(t[2]=e.withModifiers(()=>{},["stop"]))},null,8,["checked"]),e.createElementVNode("div",te,[e.createVNode(n,{name:"user"})]),e.createElementVNode("div",oe,[e.createElementVNode("div",le,e.toDisplayString(o.displayName||o.name),1),e.createElementVNode("div",ne,[o.position?(e.openBlock(),e.createElementBlock("span",se,e.toDisplayString(o.position),1)):e.createCommentVNode("",!0),o.department?(e.openBlock(),e.createElementBlock("span",ae,e.toDisplayString(o.department),1)):e.createCommentVNode("",!0),o.phone?(e.openBlock(),e.createElementBlock("span",ce,e.toDisplayString(o.phone),1)):e.createCommentVNode("",!0)])])],10,ee))),128))]))])):(e.openBlock(),e.createBlock($e,{key:1,modelValue:_.value,"onUpdate:modelValue":t[3]||(t[3]=o=>_.value=o),onChange:De},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Se.value,o=>(e.openBlock(),e.createBlock(I,{key:o.key,value:o.key,label:o.name},{default:e.withCtx(()=>{var b;return[e.createElementVNode("div",de,[((b=g.value[o.key])==null?void 0:b.length)>0?(e.openBlock(),e.createBlock(T,{key:0,ref_for:!0,ref:r=>we(o.key,r),data:g.value[o.key],keys:{value:"id",label:"name",children:"children"},hover:"",checkable:"","expand-all":!1,value:c.value,onChange:Re},{label:e.withCtx(({node:r})=>{var $;return[e.createElementVNode("div",{class:e.normalizeClass(["cd-ps-node",{"cd-ps-node-user":r.data.isUser}])},[e.createVNode(n,{name:r.data.isUser?"user":o.icon||"folder"},null,8,["name"]),e.createElementVNode("span",null,e.toDisplayString(r.label),1),r.data.userCount&&!r.data.isUser?(e.openBlock(),e.createElementBlock("span",re,"("+e.toDisplayString(r.data.userCount)+")",1)):e.createCommentVNode("",!0),!r.data.isUser&&!(($=r.data.children)!=null&&$.length)&&!r.data.loaded?(e.openBlock(),e.createBlock(m,{key:1,size:"small",variant:"text",class:"cd-ps-load-btn",onClick:e.withModifiers(Ae=>Le(r,o.key),["stop"])},{default:e.withCtx(()=>[...t[9]||(t[9]=[e.createTextVNode("显示人员",-1)])]),_:1},8,["onClick"])):e.createCommentVNode("",!0)],2)]}),_:2},1032,["data","value"])):(e.openBlock(),e.createElementBlock("div",ie,[e.createVNode(n,{name:o.icon||"folder-open",size:"48px",style:{color:"#ddd"}},null,8,["name"]),t[10]||(t[10]=e.createElementVNode("p",null,"暂无数据",-1))]))])]}),_:2},1032,["value","label"]))),128))]),_:1},8,["modelValue"]))]),e.createElementVNode("div",pe,[e.createElementVNode("div",me,[t[12]||(t[12]=e.createElementVNode("span",{class:"cd-ps-title"},"已选择",-1)),e.createElementVNode("span",ke,e.toDisplayString(E.value.length)+" 项",1),E.value.length>0?(e.openBlock(),e.createBlock(m,{key:0,size:"small",variant:"text",onClick:M},{default:e.withCtx(()=>[...t[11]||(t[11]=[e.createTextVNode("清空",-1)])]),_:1})):e.createCommentVNode("",!0)]),e.createElementVNode("div",he,[E.value.length===0?(e.openBlock(),e.createElementBlock("div",fe,[e.createVNode(n,{name:"user-checked",size:"64px",style:{color:"#ddd"}}),t[13]||(t[13]=e.createElementVNode("p",null,"暂无选择",-1))])):(e.openBlock(),e.createElementBlock("div",_e,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(E.value,o=>(e.openBlock(),e.createElementBlock("div",{key:o.id,class:e.normalizeClass(["cd-ps-selected-item",{"cd-ps-dept-item":!o.isUser}])},[e.createElementVNode("div",ye,[e.createElementVNode("div",{class:e.normalizeClass(["cd-ps-avatar",{"cd-ps-avatar-dept":!o.isUser}])},[e.createVNode(n,{name:o.isUser?"user":"folder"},null,8,["name"])],2),e.createElementVNode("div",Ne,[e.createElementVNode("div",Ve,e.toDisplayString(o.displayName||o.name),1),e.createElementVNode("div",Be,[o.isUser&&o.position?(e.openBlock(),e.createElementBlock("span",Ce,e.toDisplayString(o.position),1)):e.createCommentVNode("",!0),o.isUser&&o.department?(e.openBlock(),e.createElementBlock("span",ge,e.toDisplayString(o.department),1)):e.createCommentVNode("",!0),o.isUser?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",Ee,e.toDisplayString(o.typeName||"部门"),1)),!o.isUser&&o.userCount?(e.openBlock(),e.createElementBlock("span",ue,e.toDisplayString(o.userCount)+"人",1)):e.createCommentVNode("",!0)])])]),e.createVNode(m,{size:"small",variant:"text",shape:"circle",onClick:b=>Me(o.id)},{icon:e.withCtx(()=>[e.createVNode(n,{name:"close"})]),_:1},8,["onClick"])],2))),128))]))])])])])]),_:1},8,["visible","width"])}}}),[["__scopeId","data-v-c8a828cf"]]),xe={install(h){h.component("PersonSelector",P)}};p.PersonSelector=P,p.default=xe,Object.defineProperties(p,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
1
|
+
(function(f,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(f=typeof globalThis<"u"?globalThis:f||self,e(f.CdPersonSelector={},f.Vue))})(this,function(f,e){"use strict";const q={class:"cd-ps-container"},A={key:0,class:"cd-ps-tips"},G={key:1,class:"cd-ps-search"},H={key:0,class:"cd-ps-org-select"},Q={class:"cd-ps-search-input"},X={class:"cd-ps-content"},Y={class:"cd-ps-left"},Z={key:0,class:"cd-ps-search-results"},K={class:"cd-ps-search-header"},v={key:0,class:"cd-ps-loading"},ee={key:1,class:"cd-ps-empty"},te={key:2,class:"cd-ps-result-list"},oe=["onClick"],le={class:"cd-ps-avatar"},ne={class:"cd-ps-info"},se={class:"cd-ps-name"},ae={class:"cd-ps-meta"},ce={key:0},de={key:1},re={key:2},ie={class:"cd-ps-tree"},pe={key:0,class:"cd-ps-count"},me={key:1,class:"cd-ps-empty"},fe={class:"cd-ps-right"},ke={class:"cd-ps-right-header"},he={class:"cd-ps-num"},_e={class:"cd-ps-right-list"},ye={key:0,class:"cd-ps-empty"},Ne={key:1,class:"cd-ps-selected-list"},Ve={class:"cd-ps-item-info"},Ce={class:"cd-ps-info"},Be={class:"cd-ps-name"},ue={class:"cd-ps-meta"},ge={key:0},Ee={key:1},Se={key:2},xe={key:3},R=((y,w)=>{const x=y.__vccOpts||y;for(const[d,k]of w)x[d]=k;return x})(e.defineComponent({__name:"PersonSelector",props:{visible:{type:Boolean,default:!1},tabs:{default:()=>[]},organizations:{default:()=>[]},modelValue:{default:()=>[]},dialogWidth:{default:"900px"},tips:{default:""},showSearch:{type:Boolean,default:!0}},emits:["update:visible","update:modelValue","confirm","load-users","search"],setup(y,{expose:w,emit:x}){var $,j;const d=y,k=x,N=e.ref(d.visible),V=e.ref(((j=($=d.tabs)==null?void 0:$[0])==null?void 0:j.key)||""),g=e.ref(null),C=e.ref(""),a=e.ref([]),D=e.ref({}),T=e.ref(!1),b=e.ref(!1),B=e.ref([]),Ue=e.computed(()=>d.tabs||[]),L=e.computed(()=>d.organizations||[]),M=e.computed(()=>d.tips||""),we=e.computed(()=>d.showSearch),De=e.computed(()=>d.dialogWidth),h=e.ref({});e.watch(()=>d.tabs,n=>{if(n&&n.length>0){const t={};n.forEach(l=>{t[l.key]=JSON.parse(JSON.stringify(l.tree))}),h.value=t,(!V.value||!n.find(l=>l.key===V.value))&&(V.value=n[0].key)}},{immediate:!0,deep:!0}),e.watch(()=>d.visible,n=>{N.value=n,n&&(a.value=d.modelValue?[...d.modelValue]:[],d.organizations.length>0&&!g.value&&(g.value=d.organizations[0].id))}),e.watch(N,n=>{k("update:visible",n)});function Te(n,t){t&&(D.value[n]=t)}function z(n,t){for(const l of n){if(l.id===t)return l;if(l.children){const s=z(l.children,t);if(s)return s}}return null}const E=e.computed(()=>{const n=[];return a.value.forEach(t=>{const l=B.value.find(s=>s.id===t);if(l){n.push({...l,typeName:"搜索结果"});return}for(const s of d.tabs){const i=h.value[s.key]||[],p=z(i,t);if(p){n.push({...p,typeName:s.name});break}}}),n}),ze=()=>{C.value=""},Ie=()=>{};let u=null;const Pe=()=>{if(u&&clearTimeout(u),!C.value.trim()){I();return}T.value=!0,b.value=!0,u=setTimeout(()=>Oe(),300)},Oe=()=>{B.value=[];const n=t=>{B.value=t.map(l=>({...l,isUser:!0})),b.value=!1};k("search",{keyword:C.value,orgId:g.value||void 0,callback:n})},I=()=>{u&&(clearTimeout(u),u=null),T.value=!1,C.value="",B.value=[],b.value=!1},Re=n=>{const t=a.value.indexOf(n.id);t>-1?a.value.splice(t,1):a.value.push(n.id)};function Le(n){const t=[],l=s=>{for(const i of s)t.push(i.id),i.children&&l(i.children)};return l(n),t}const Me=(n,t)=>{var r;const l=t==null?void 0:t.node;if(l){const c=l.value??((r=l.data)==null?void 0:r.id);if(c!==void 0){n.includes(c)?a.value.includes(c)||(a.value=[...a.value,c]):a.value=a.value.filter(S=>S!==c);return}}const s=h.value[V.value]||[],i=Le(s),p=a.value.filter(c=>!i.includes(c));a.value=[...p,...n]};function F(n,t,l){for(const s of n){if(s.id===t)return s.children=s.children||[],s.children.push(...l),s.loaded=!0,!0;if(s.children&&F(s.children,t,l))return!0}return!1}async function Fe(n,t){const l=n.value,s=D.value[t];k("load-users",{tabKey:t,nodeId:l,node:n,callback:async p=>{if(p.length>0){const r=p.map(_=>{const{id:S,name:P,...O}=_;return{...O,id:S,name:_.displayName||P,isUser:!0}}),c=h.value[t];if(c&&F(c,l,r),s){s.appendTo(l,r),n.data.loaded=!0,await e.nextTick();try{s.setItem(l,{expanded:!0})}catch{}}}else{n.data.loaded=!0;const r=h.value[t];if(r){const c=z(r,l);c&&(c.loaded=!0)}}}})}const We=n=>{a.value=a.value.filter(t=>t!==n)},W=()=>{a.value=[]},$e=()=>{k("update:modelValue",a.value),k("confirm",E.value),N.value=!1},je=()=>{N.value=!1};return w({clearSelection:W,appendUsers:(n,t,l)=>{const s=D.value[n];if(s&&l.length>0){const i=l.map(p=>{const{id:r,name:c,..._}=p;return{..._,id:r,name:p.displayName||c,isUser:!0}});s.appendTo(t,i)}}}),(n,t)=>{const l=e.resolveComponent("t-icon"),s=e.resolveComponent("t-option"),i=e.resolveComponent("t-select"),p=e.resolveComponent("t-input"),r=e.resolveComponent("t-button"),c=e.resolveComponent("t-loading"),_=e.resolveComponent("t-checkbox"),S=e.resolveComponent("t-tree"),P=e.resolveComponent("t-tab-panel"),O=e.resolveComponent("t-tabs"),Je=e.resolveComponent("t-dialog");return e.openBlock(),e.createBlock(Je,{visible:N.value,"onUpdate:visible":t[4]||(t[4]=o=>N.value=o),header:"选择人员",width:De.value,footer:!0,"destroy-on-close":"",onConfirm:$e,onClose:je},{default:e.withCtx(()=>[e.createElementVNode("div",q,[M.value?(e.openBlock(),e.createElementBlock("div",A,[e.createVNode(l,{name:"info-circle"}),e.createElementVNode("span",null,e.toDisplayString(M.value),1)])):e.createCommentVNode("",!0),we.value?(e.openBlock(),e.createElementBlock("div",G,[L.value.length>0?(e.openBlock(),e.createElementBlock("div",H,[e.createVNode(i,{modelValue:g.value,"onUpdate:modelValue":t[0]||(t[0]=o=>g.value=o),placeholder:"选择组织",style:{width:"200px"},onChange:Ie},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(L.value,o=>(e.openBlock(),e.createBlock(s,{key:o.id,value:o.id,label:o.displayName||o.name},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])])):e.createCommentVNode("",!0),e.createElementVNode("div",Q,[e.createVNode(p,{modelValue:C.value,"onUpdate:modelValue":t[1]||(t[1]=o=>C.value=o),placeholder:"搜索",clearable:"",onInput:Pe,onClear:I},{"prefix-icon":e.withCtx(()=>[e.createVNode(l,{name:"search"})]),_:1},8,["modelValue"])])])):e.createCommentVNode("",!0),e.createElementVNode("div",X,[e.createElementVNode("div",Y,[T.value?(e.openBlock(),e.createElementBlock("div",Z,[e.createElementVNode("div",K,[t[6]||(t[6]=e.createElementVNode("span",null,"搜索结果",-1)),e.createVNode(r,{size:"small",variant:"text",onClick:I},{default:e.withCtx(()=>[...t[5]||(t[5]=[e.createTextVNode("返回",-1)])]),_:1})]),b.value?(e.openBlock(),e.createElementBlock("div",v,[e.createVNode(c),t[7]||(t[7]=e.createElementVNode("span",null,"搜索中...",-1))])):B.value.length===0?(e.openBlock(),e.createElementBlock("div",ee,[e.createVNode(l,{name:"search",size:"48px",style:{color:"#ddd"}}),t[8]||(t[8]=e.createElementVNode("p",null,"未找到匹配的人员",-1))])):(e.openBlock(),e.createElementBlock("div",te,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(B.value,o=>(e.openBlock(),e.createElementBlock("div",{key:o.id,class:e.normalizeClass(["cd-ps-result-item",{"cd-ps-selected":a.value.includes(o.id)}]),onClick:U=>Re(o)},[e.createVNode(_,{checked:a.value.includes(o.id),onClick:t[2]||(t[2]=e.withModifiers(()=>{},["stop"]))},null,8,["checked"]),e.createElementVNode("div",le,[e.createVNode(l,{name:"user"})]),e.createElementVNode("div",ne,[e.createElementVNode("div",se,e.toDisplayString(o.displayName||o.name),1),e.createElementVNode("div",ae,[o.position?(e.openBlock(),e.createElementBlock("span",ce,e.toDisplayString(o.position),1)):e.createCommentVNode("",!0),o.department?(e.openBlock(),e.createElementBlock("span",de,e.toDisplayString(o.department),1)):e.createCommentVNode("",!0),o.phone?(e.openBlock(),e.createElementBlock("span",re,e.toDisplayString(o.phone),1)):e.createCommentVNode("",!0)])])],10,oe))),128))]))])):(e.openBlock(),e.createBlock(O,{key:1,modelValue:V.value,"onUpdate:modelValue":t[3]||(t[3]=o=>V.value=o),onChange:ze},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Ue.value,o=>(e.openBlock(),e.createBlock(P,{key:o.key,value:o.key,label:o.name},{default:e.withCtx(()=>{var U;return[e.createElementVNode("div",ie,[((U=h.value[o.key])==null?void 0:U.length)>0?(e.openBlock(),e.createBlock(S,{key:0,ref_for:!0,ref:m=>Te(o.key,m),data:h.value[o.key],keys:{value:"id",label:"name",children:"children"},hover:"",checkable:"","expand-all":!1,value:a.value,onChange:Me},{label:e.withCtx(({node:m})=>{var J;return[e.createElementVNode("div",{class:e.normalizeClass(["cd-ps-node",{"cd-ps-node-user":m.data.isUser}])},[e.createVNode(l,{name:m.data.isUser?"user":o.icon||"folder"},null,8,["name"]),e.createElementVNode("span",null,e.toDisplayString(m.label),1),m.data.userCount&&!m.data.isUser?(e.openBlock(),e.createElementBlock("span",pe,"("+e.toDisplayString(m.data.userCount)+")",1)):e.createCommentVNode("",!0),!m.data.isUser&&!((J=m.data.children)!=null&&J.length)&&!m.data.loaded?(e.openBlock(),e.createBlock(r,{key:1,size:"small",variant:"text",class:"cd-ps-load-btn",onClick:e.withModifiers(Ge=>Fe(m,o.key),["stop"])},{default:e.withCtx(()=>[...t[9]||(t[9]=[e.createTextVNode("显示人员",-1)])]),_:1},8,["onClick"])):e.createCommentVNode("",!0)],2)]}),_:2},1032,["data","value"])):(e.openBlock(),e.createElementBlock("div",me,[e.createVNode(l,{name:o.icon||"folder-open",size:"48px",style:{color:"#ddd"}},null,8,["name"]),t[10]||(t[10]=e.createElementVNode("p",null,"暂无数据",-1))]))])]}),_:2},1032,["value","label"]))),128))]),_:1},8,["modelValue"]))]),e.createElementVNode("div",fe,[e.createElementVNode("div",ke,[t[12]||(t[12]=e.createElementVNode("span",{class:"cd-ps-title"},"已选择",-1)),e.createElementVNode("span",he,e.toDisplayString(E.value.length)+" 项",1),E.value.length>0?(e.openBlock(),e.createBlock(r,{key:0,size:"small",variant:"text",onClick:W},{default:e.withCtx(()=>[...t[11]||(t[11]=[e.createTextVNode("清空",-1)])]),_:1})):e.createCommentVNode("",!0)]),e.createElementVNode("div",_e,[E.value.length===0?(e.openBlock(),e.createElementBlock("div",ye,[e.createVNode(l,{name:"user-checked",size:"64px",style:{color:"#ddd"}}),t[13]||(t[13]=e.createElementVNode("p",null,"暂无选择",-1))])):(e.openBlock(),e.createElementBlock("div",Ne,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(E.value,o=>(e.openBlock(),e.createElementBlock("div",{key:o.id,class:e.normalizeClass(["cd-ps-selected-item",{"cd-ps-dept-item":!o.isUser}])},[e.createElementVNode("div",Ve,[e.createElementVNode("div",{class:e.normalizeClass(["cd-ps-avatar",{"cd-ps-avatar-dept":!o.isUser}])},[e.createVNode(l,{name:o.isUser?"user":"folder"},null,8,["name"])],2),e.createElementVNode("div",Ce,[e.createElementVNode("div",Be,e.toDisplayString(o.displayName||o.name),1),e.createElementVNode("div",ue,[o.isUser&&o.position?(e.openBlock(),e.createElementBlock("span",ge,e.toDisplayString(o.position),1)):e.createCommentVNode("",!0),o.isUser&&o.department?(e.openBlock(),e.createElementBlock("span",Ee,e.toDisplayString(o.department),1)):e.createCommentVNode("",!0),o.isUser?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",Se,e.toDisplayString(o.typeName||"部门"),1)),!o.isUser&&o.userCount?(e.openBlock(),e.createElementBlock("span",xe,e.toDisplayString(o.userCount)+"人",1)):e.createCommentVNode("",!0)])])]),e.createVNode(r,{size:"small",variant:"text",shape:"circle",onClick:U=>We(o.id)},{icon:e.withCtx(()=>[e.createVNode(l,{name:"close"})]),_:1},8,["onClick"])],2))),128))]))])])])])]),_:1},8,["visible","width"])}}}),[["__scopeId","data-v-b51aed83"]]),be={install(y){y.component("PersonSelector",R)}};f.PersonSelector=R,f.default=be,Object.defineProperties(f,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/index.mjs
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
const
|
|
1
|
+
import { defineComponent as ge, ref as y, computed as w, watch as H, resolveComponent as k, createBlock as U, openBlock as a, withCtx as g, createElementVNode as o, createElementBlock as d, createCommentVNode as v, createVNode as p, toDisplayString as h, Fragment as L, renderList as W, createTextVNode as Q, normalizeClass as $, withModifiers as le, nextTick as Ce } from "vue";
|
|
2
|
+
const be = { class: "cd-ps-container" }, Ne = {
|
|
3
3
|
key: 0,
|
|
4
4
|
class: "cd-ps-tips"
|
|
5
|
-
},
|
|
5
|
+
}, Ue = {
|
|
6
6
|
key: 1,
|
|
7
7
|
class: "cd-ps-search"
|
|
8
|
-
},
|
|
8
|
+
}, xe = {
|
|
9
9
|
key: 0,
|
|
10
10
|
class: "cd-ps-org-select"
|
|
11
|
-
},
|
|
11
|
+
}, Se = { class: "cd-ps-search-input" }, Ve = { class: "cd-ps-content" }, ze = { class: "cd-ps-left" }, Ie = {
|
|
12
12
|
key: 0,
|
|
13
13
|
class: "cd-ps-search-results"
|
|
14
|
-
},
|
|
14
|
+
}, Te = { class: "cd-ps-search-header" }, we = {
|
|
15
15
|
key: 0,
|
|
16
16
|
class: "cd-ps-loading"
|
|
17
|
-
},
|
|
17
|
+
}, De = {
|
|
18
18
|
key: 1,
|
|
19
19
|
class: "cd-ps-empty"
|
|
20
20
|
}, Re = {
|
|
21
21
|
key: 2,
|
|
22
22
|
class: "cd-ps-result-list"
|
|
23
|
-
}, Be = ["onClick"], Oe = { class: "cd-ps-avatar" },
|
|
23
|
+
}, Be = ["onClick"], Oe = { class: "cd-ps-avatar" }, Pe = { class: "cd-ps-info" }, Ee = { class: "cd-ps-name" }, Le = { class: "cd-ps-meta" }, We = { key: 0 }, $e = { key: 1 }, Je = { key: 2 }, Me = { class: "cd-ps-tree" }, Ae = {
|
|
24
24
|
key: 0,
|
|
25
25
|
class: "cd-ps-count"
|
|
26
|
-
},
|
|
26
|
+
}, Fe = {
|
|
27
27
|
key: 1,
|
|
28
28
|
class: "cd-ps-empty"
|
|
29
|
-
},
|
|
29
|
+
}, je = { class: "cd-ps-right" }, qe = { class: "cd-ps-right-header" }, Ge = { class: "cd-ps-num" }, He = { class: "cd-ps-right-list" }, Qe = {
|
|
30
30
|
key: 0,
|
|
31
31
|
class: "cd-ps-empty"
|
|
32
|
-
},
|
|
32
|
+
}, Xe = {
|
|
33
33
|
key: 1,
|
|
34
34
|
class: "cd-ps-selected-list"
|
|
35
|
-
},
|
|
35
|
+
}, Ye = { class: "cd-ps-item-info" }, Ze = { class: "cd-ps-info" }, Ke = { class: "cd-ps-name" }, et = { class: "cd-ps-meta" }, tt = { key: 0 }, st = { key: 1 }, lt = { key: 2 }, at = { key: 3 }, nt = /* @__PURE__ */ ge({
|
|
36
36
|
__name: "PersonSelector",
|
|
37
37
|
props: {
|
|
38
38
|
visible: { type: Boolean, default: !1 },
|
|
@@ -44,153 +44,177 @@ const Ce = { class: "cd-ps-container" }, be = {
|
|
|
44
44
|
showSearch: { type: Boolean, default: !0 }
|
|
45
45
|
},
|
|
46
46
|
emits: ["update:visible", "update:modelValue", "confirm", "load-users", "search"],
|
|
47
|
-
setup(
|
|
48
|
-
var
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
if (
|
|
47
|
+
setup(x, { expose: J, emit: O }) {
|
|
48
|
+
var ee, te;
|
|
49
|
+
const r = x, C = O, S = y(r.visible), V = y(((te = (ee = r.tabs) == null ? void 0 : ee[0]) == null ? void 0 : te.key) || ""), D = y(null), z = y(""), i = y([]), M = y({}), A = y(!1), P = y(!1), I = y([]), ae = w(() => r.tabs || []), X = w(() => r.organizations || []), Y = w(() => r.tips || ""), ne = w(() => r.showSearch), oe = w(() => r.dialogWidth), b = y({});
|
|
50
|
+
H(() => r.tabs, (l) => {
|
|
51
|
+
if (l && l.length > 0) {
|
|
52
52
|
const e = {};
|
|
53
|
-
|
|
54
|
-
e[
|
|
55
|
-
}),
|
|
53
|
+
l.forEach((s) => {
|
|
54
|
+
e[s.key] = JSON.parse(JSON.stringify(s.tree));
|
|
55
|
+
}), b.value = e, (!V.value || !l.find((s) => s.key === V.value)) && (V.value = l[0].key);
|
|
56
56
|
}
|
|
57
|
-
}, { immediate: !0, deep: !0 }),
|
|
58
|
-
|
|
59
|
-
}),
|
|
60
|
-
|
|
57
|
+
}, { immediate: !0, deep: !0 }), H(() => r.visible, (l) => {
|
|
58
|
+
S.value = l, l && (i.value = r.modelValue ? [...r.modelValue] : [], r.organizations.length > 0 && !D.value && (D.value = r.organizations[0].id));
|
|
59
|
+
}), H(S, (l) => {
|
|
60
|
+
C("update:visible", l);
|
|
61
61
|
});
|
|
62
|
-
function
|
|
63
|
-
e && (
|
|
62
|
+
function de(l, e) {
|
|
63
|
+
e && (M.value[l] = e);
|
|
64
64
|
}
|
|
65
|
-
function
|
|
66
|
-
for (const
|
|
67
|
-
if (
|
|
68
|
-
if (
|
|
69
|
-
const
|
|
70
|
-
if (
|
|
65
|
+
function F(l, e) {
|
|
66
|
+
for (const s of l) {
|
|
67
|
+
if (s.id === e) return s;
|
|
68
|
+
if (s.children) {
|
|
69
|
+
const n = F(s.children, e);
|
|
70
|
+
if (n) return n;
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
return null;
|
|
74
74
|
}
|
|
75
|
-
const R =
|
|
76
|
-
const
|
|
77
|
-
return
|
|
78
|
-
const
|
|
79
|
-
if (
|
|
80
|
-
|
|
75
|
+
const R = w(() => {
|
|
76
|
+
const l = [];
|
|
77
|
+
return i.value.forEach((e) => {
|
|
78
|
+
const s = I.value.find((n) => n.id === e);
|
|
79
|
+
if (s) {
|
|
80
|
+
l.push({ ...s, typeName: "搜索结果" });
|
|
81
81
|
return;
|
|
82
82
|
}
|
|
83
|
-
for (const
|
|
84
|
-
const
|
|
85
|
-
if (
|
|
86
|
-
|
|
83
|
+
for (const n of r.tabs) {
|
|
84
|
+
const f = b.value[n.key] || [], _ = F(f, e);
|
|
85
|
+
if (_) {
|
|
86
|
+
l.push({ ..._, typeName: n.name });
|
|
87
87
|
break;
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
|
-
}),
|
|
91
|
-
}),
|
|
92
|
-
|
|
93
|
-
},
|
|
90
|
+
}), l;
|
|
91
|
+
}), ie = () => {
|
|
92
|
+
z.value = "";
|
|
93
|
+
}, ce = () => {
|
|
94
94
|
};
|
|
95
|
-
let
|
|
96
|
-
const
|
|
97
|
-
if (
|
|
98
|
-
|
|
95
|
+
let T = null;
|
|
96
|
+
const re = () => {
|
|
97
|
+
if (T && clearTimeout(T), !z.value.trim()) {
|
|
98
|
+
j();
|
|
99
99
|
return;
|
|
100
100
|
}
|
|
101
|
-
|
|
102
|
-
},
|
|
103
|
-
|
|
104
|
-
const
|
|
105
|
-
|
|
101
|
+
A.value = !0, P.value = !0, T = setTimeout(() => ue(), 300);
|
|
102
|
+
}, ue = () => {
|
|
103
|
+
I.value = [];
|
|
104
|
+
const l = (e) => {
|
|
105
|
+
I.value = e.map((s) => ({ ...s, isUser: !0 })), P.value = !1;
|
|
106
106
|
};
|
|
107
|
-
|
|
108
|
-
},
|
|
109
|
-
|
|
110
|
-
},
|
|
111
|
-
const e =
|
|
112
|
-
e > -1 ?
|
|
107
|
+
C("search", { keyword: z.value, orgId: D.value || void 0, callback: l });
|
|
108
|
+
}, j = () => {
|
|
109
|
+
T && (clearTimeout(T), T = null), A.value = !1, z.value = "", I.value = [], P.value = !1;
|
|
110
|
+
}, pe = (l) => {
|
|
111
|
+
const e = i.value.indexOf(l.id);
|
|
112
|
+
e > -1 ? i.value.splice(e, 1) : i.value.push(l.id);
|
|
113
113
|
};
|
|
114
|
-
function
|
|
115
|
-
const e = [],
|
|
116
|
-
for (const
|
|
117
|
-
e.push(
|
|
114
|
+
function ve(l) {
|
|
115
|
+
const e = [], s = (n) => {
|
|
116
|
+
for (const f of n)
|
|
117
|
+
e.push(f.id), f.children && s(f.children);
|
|
118
118
|
};
|
|
119
|
-
return l
|
|
119
|
+
return s(l), e;
|
|
120
120
|
}
|
|
121
|
-
const
|
|
122
|
-
|
|
123
|
-
|
|
121
|
+
const he = (l, e) => {
|
|
122
|
+
var u;
|
|
123
|
+
const s = e == null ? void 0 : e.node;
|
|
124
|
+
if (s) {
|
|
125
|
+
const c = s.value ?? ((u = s.data) == null ? void 0 : u.id);
|
|
126
|
+
if (c !== void 0) {
|
|
127
|
+
l.includes(c) ? i.value.includes(c) || (i.value = [...i.value, c]) : i.value = i.value.filter((B) => B !== c);
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
const n = b.value[V.value] || [], f = ve(n), _ = i.value.filter((c) => !f.includes(c));
|
|
132
|
+
i.value = [..._, ...l];
|
|
124
133
|
};
|
|
125
|
-
|
|
126
|
-
const
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
134
|
+
function Z(l, e, s) {
|
|
135
|
+
for (const n of l) {
|
|
136
|
+
if (n.id === e)
|
|
137
|
+
return n.children = n.children || [], n.children.push(...s), n.loaded = !0, !0;
|
|
138
|
+
if (n.children && Z(n.children, e, s))
|
|
139
|
+
return !0;
|
|
140
|
+
}
|
|
141
|
+
return !1;
|
|
142
|
+
}
|
|
143
|
+
async function fe(l, e) {
|
|
144
|
+
const s = l.value, n = M.value[e];
|
|
145
|
+
C("load-users", { tabKey: e, nodeId: s, node: l, callback: async (_) => {
|
|
146
|
+
if (_.length > 0) {
|
|
147
|
+
const u = _.map((N) => {
|
|
148
|
+
const { id: B, name: q, ...G } = N;
|
|
149
|
+
return { ...G, id: B, name: N.displayName || q, isUser: !0 };
|
|
150
|
+
}), c = b.value[e];
|
|
151
|
+
if (c && Z(c, s, u), n) {
|
|
152
|
+
n.appendTo(s, u), l.data.loaded = !0, await Ce();
|
|
135
153
|
try {
|
|
136
|
-
|
|
154
|
+
n.setItem(s, { expanded: !0 });
|
|
137
155
|
} catch {
|
|
138
156
|
}
|
|
139
157
|
}
|
|
140
|
-
} else
|
|
141
|
-
|
|
158
|
+
} else {
|
|
159
|
+
l.data.loaded = !0;
|
|
160
|
+
const u = b.value[e];
|
|
161
|
+
if (u) {
|
|
162
|
+
const c = F(u, s);
|
|
163
|
+
c && (c.loaded = !0);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
142
166
|
} });
|
|
143
167
|
}
|
|
144
|
-
const _e = (
|
|
145
|
-
|
|
146
|
-
},
|
|
147
|
-
|
|
148
|
-
}, he = () => {
|
|
149
|
-
g("update:modelValue", r.value), g("confirm", R.value), x.value = !1;
|
|
168
|
+
const _e = (l) => {
|
|
169
|
+
i.value = i.value.filter((e) => e !== l);
|
|
170
|
+
}, K = () => {
|
|
171
|
+
i.value = [];
|
|
150
172
|
}, me = () => {
|
|
151
|
-
|
|
173
|
+
C("update:modelValue", i.value), C("confirm", R.value), S.value = !1;
|
|
174
|
+
}, ke = () => {
|
|
175
|
+
S.value = !1;
|
|
152
176
|
};
|
|
153
|
-
return
|
|
154
|
-
clearSelection:
|
|
155
|
-
appendUsers: (
|
|
156
|
-
const
|
|
157
|
-
if (
|
|
158
|
-
const
|
|
159
|
-
const { id:
|
|
160
|
-
return { ...
|
|
177
|
+
return J({
|
|
178
|
+
clearSelection: K,
|
|
179
|
+
appendUsers: (l, e, s) => {
|
|
180
|
+
const n = M.value[l];
|
|
181
|
+
if (n && s.length > 0) {
|
|
182
|
+
const f = s.map((_) => {
|
|
183
|
+
const { id: u, name: c, ...N } = _;
|
|
184
|
+
return { ...N, id: u, name: _.displayName || c, isUser: !0 };
|
|
161
185
|
});
|
|
162
|
-
|
|
186
|
+
n.appendTo(e, f);
|
|
163
187
|
}
|
|
164
188
|
}
|
|
165
|
-
}), (
|
|
166
|
-
const
|
|
167
|
-
return a(),
|
|
168
|
-
visible:
|
|
169
|
-
"onUpdate:visible": e[4] || (e[4] = (t) =>
|
|
189
|
+
}), (l, e) => {
|
|
190
|
+
const s = k("t-icon"), n = k("t-option"), f = k("t-select"), _ = k("t-input"), u = k("t-button"), c = k("t-loading"), N = k("t-checkbox"), B = k("t-tree"), q = k("t-tab-panel"), G = k("t-tabs"), ye = k("t-dialog");
|
|
191
|
+
return a(), U(ye, {
|
|
192
|
+
visible: S.value,
|
|
193
|
+
"onUpdate:visible": e[4] || (e[4] = (t) => S.value = t),
|
|
170
194
|
header: "选择人员",
|
|
171
|
-
width:
|
|
195
|
+
width: oe.value,
|
|
172
196
|
footer: !0,
|
|
173
197
|
"destroy-on-close": "",
|
|
174
|
-
onConfirm:
|
|
175
|
-
onClose:
|
|
198
|
+
onConfirm: me,
|
|
199
|
+
onClose: ke
|
|
176
200
|
}, {
|
|
177
|
-
default:
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
])) :
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
modelValue:
|
|
187
|
-
"onUpdate:modelValue": e[0] || (e[0] = (t) =>
|
|
201
|
+
default: g(() => [
|
|
202
|
+
o("div", be, [
|
|
203
|
+
Y.value ? (a(), d("div", Ne, [
|
|
204
|
+
p(s, { name: "info-circle" }),
|
|
205
|
+
o("span", null, h(Y.value), 1)
|
|
206
|
+
])) : v("", !0),
|
|
207
|
+
ne.value ? (a(), d("div", Ue, [
|
|
208
|
+
X.value.length > 0 ? (a(), d("div", xe, [
|
|
209
|
+
p(f, {
|
|
210
|
+
modelValue: D.value,
|
|
211
|
+
"onUpdate:modelValue": e[0] || (e[0] = (t) => D.value = t),
|
|
188
212
|
placeholder: "选择组织",
|
|
189
213
|
style: { width: "200px" },
|
|
190
|
-
onChange:
|
|
214
|
+
onChange: ce
|
|
191
215
|
}, {
|
|
192
|
-
default:
|
|
193
|
-
(a(!0),
|
|
216
|
+
default: g(() => [
|
|
217
|
+
(a(!0), d(L, null, W(X.value, (t) => (a(), U(n, {
|
|
194
218
|
key: t.id,
|
|
195
219
|
value: t.id,
|
|
196
220
|
label: t.displayName || t.name
|
|
@@ -198,135 +222,135 @@ const Ce = { class: "cd-ps-container" }, be = {
|
|
|
198
222
|
]),
|
|
199
223
|
_: 1
|
|
200
224
|
}, 8, ["modelValue"])
|
|
201
|
-
])) :
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
modelValue:
|
|
205
|
-
"onUpdate:modelValue": e[1] || (e[1] = (t) =>
|
|
225
|
+
])) : v("", !0),
|
|
226
|
+
o("div", Se, [
|
|
227
|
+
p(_, {
|
|
228
|
+
modelValue: z.value,
|
|
229
|
+
"onUpdate:modelValue": e[1] || (e[1] = (t) => z.value = t),
|
|
206
230
|
placeholder: "搜索",
|
|
207
231
|
clearable: "",
|
|
208
|
-
onInput:
|
|
209
|
-
onClear:
|
|
232
|
+
onInput: re,
|
|
233
|
+
onClear: j
|
|
210
234
|
}, {
|
|
211
|
-
"prefix-icon":
|
|
212
|
-
|
|
235
|
+
"prefix-icon": g(() => [
|
|
236
|
+
p(s, { name: "search" })
|
|
213
237
|
]),
|
|
214
238
|
_: 1
|
|
215
239
|
}, 8, ["modelValue"])
|
|
216
240
|
])
|
|
217
|
-
])) :
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
e[6] || (e[6] =
|
|
223
|
-
|
|
241
|
+
])) : v("", !0),
|
|
242
|
+
o("div", Ve, [
|
|
243
|
+
o("div", ze, [
|
|
244
|
+
A.value ? (a(), d("div", Ie, [
|
|
245
|
+
o("div", Te, [
|
|
246
|
+
e[6] || (e[6] = o("span", null, "搜索结果", -1)),
|
|
247
|
+
p(u, {
|
|
224
248
|
size: "small",
|
|
225
249
|
variant: "text",
|
|
226
|
-
onClick:
|
|
250
|
+
onClick: j
|
|
227
251
|
}, {
|
|
228
|
-
default:
|
|
229
|
-
|
|
252
|
+
default: g(() => [...e[5] || (e[5] = [
|
|
253
|
+
Q("返回", -1)
|
|
230
254
|
])]),
|
|
231
255
|
_: 1
|
|
232
256
|
})
|
|
233
257
|
]),
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
e[7] || (e[7] =
|
|
237
|
-
])) :
|
|
238
|
-
|
|
258
|
+
P.value ? (a(), d("div", we, [
|
|
259
|
+
p(c),
|
|
260
|
+
e[7] || (e[7] = o("span", null, "搜索中...", -1))
|
|
261
|
+
])) : I.value.length === 0 ? (a(), d("div", De, [
|
|
262
|
+
p(s, {
|
|
239
263
|
name: "search",
|
|
240
264
|
size: "48px",
|
|
241
265
|
style: { color: "#ddd" }
|
|
242
266
|
}),
|
|
243
|
-
e[8] || (e[8] =
|
|
244
|
-
])) : (a(),
|
|
245
|
-
(a(!0),
|
|
267
|
+
e[8] || (e[8] = o("p", null, "未找到匹配的人员", -1))
|
|
268
|
+
])) : (a(), d("div", Re, [
|
|
269
|
+
(a(!0), d(L, null, W(I.value, (t) => (a(), d("div", {
|
|
246
270
|
key: t.id,
|
|
247
|
-
class:
|
|
248
|
-
onClick: (
|
|
271
|
+
class: $(["cd-ps-result-item", { "cd-ps-selected": i.value.includes(t.id) }]),
|
|
272
|
+
onClick: (E) => pe(t)
|
|
249
273
|
}, [
|
|
250
|
-
|
|
251
|
-
checked:
|
|
252
|
-
onClick: e[2] || (e[2] =
|
|
274
|
+
p(N, {
|
|
275
|
+
checked: i.value.includes(t.id),
|
|
276
|
+
onClick: e[2] || (e[2] = le(() => {
|
|
253
277
|
}, ["stop"]))
|
|
254
278
|
}, null, 8, ["checked"]),
|
|
255
|
-
|
|
256
|
-
|
|
279
|
+
o("div", Oe, [
|
|
280
|
+
p(s, { name: "user" })
|
|
257
281
|
]),
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
t.position ? (a(),
|
|
262
|
-
t.department ? (a(),
|
|
263
|
-
t.phone ? (a(),
|
|
282
|
+
o("div", Pe, [
|
|
283
|
+
o("div", Ee, h(t.displayName || t.name), 1),
|
|
284
|
+
o("div", Le, [
|
|
285
|
+
t.position ? (a(), d("span", We, h(t.position), 1)) : v("", !0),
|
|
286
|
+
t.department ? (a(), d("span", $e, h(t.department), 1)) : v("", !0),
|
|
287
|
+
t.phone ? (a(), d("span", Je, h(t.phone), 1)) : v("", !0)
|
|
264
288
|
])
|
|
265
289
|
])
|
|
266
290
|
], 10, Be))), 128))
|
|
267
291
|
]))
|
|
268
|
-
])) : (a(),
|
|
292
|
+
])) : (a(), U(G, {
|
|
269
293
|
key: 1,
|
|
270
|
-
modelValue:
|
|
271
|
-
"onUpdate:modelValue": e[3] || (e[3] = (t) =>
|
|
272
|
-
onChange:
|
|
294
|
+
modelValue: V.value,
|
|
295
|
+
"onUpdate:modelValue": e[3] || (e[3] = (t) => V.value = t),
|
|
296
|
+
onChange: ie
|
|
273
297
|
}, {
|
|
274
|
-
default:
|
|
275
|
-
(a(!0),
|
|
298
|
+
default: g(() => [
|
|
299
|
+
(a(!0), d(L, null, W(ae.value, (t) => (a(), U(q, {
|
|
276
300
|
key: t.key,
|
|
277
301
|
value: t.key,
|
|
278
302
|
label: t.name
|
|
279
303
|
}, {
|
|
280
|
-
default:
|
|
281
|
-
var
|
|
304
|
+
default: g(() => {
|
|
305
|
+
var E;
|
|
282
306
|
return [
|
|
283
|
-
|
|
284
|
-
((
|
|
307
|
+
o("div", Me, [
|
|
308
|
+
((E = b.value[t.key]) == null ? void 0 : E.length) > 0 ? (a(), U(B, {
|
|
285
309
|
key: 0,
|
|
286
310
|
ref_for: !0,
|
|
287
|
-
ref: (
|
|
288
|
-
data:
|
|
311
|
+
ref: (m) => de(t.key, m),
|
|
312
|
+
data: b.value[t.key],
|
|
289
313
|
keys: { value: "id", label: "name", children: "children" },
|
|
290
314
|
hover: "",
|
|
291
315
|
checkable: "",
|
|
292
316
|
"expand-all": !1,
|
|
293
|
-
value:
|
|
294
|
-
onChange:
|
|
317
|
+
value: i.value,
|
|
318
|
+
onChange: he
|
|
295
319
|
}, {
|
|
296
|
-
label:
|
|
297
|
-
var
|
|
320
|
+
label: g(({ node: m }) => {
|
|
321
|
+
var se;
|
|
298
322
|
return [
|
|
299
|
-
|
|
300
|
-
class:
|
|
323
|
+
o("div", {
|
|
324
|
+
class: $(["cd-ps-node", { "cd-ps-node-user": m.data.isUser }])
|
|
301
325
|
}, [
|
|
302
|
-
|
|
303
|
-
name:
|
|
326
|
+
p(s, {
|
|
327
|
+
name: m.data.isUser ? "user" : t.icon || "folder"
|
|
304
328
|
}, null, 8, ["name"]),
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
!
|
|
329
|
+
o("span", null, h(m.label), 1),
|
|
330
|
+
m.data.userCount && !m.data.isUser ? (a(), d("span", Ae, "(" + h(m.data.userCount) + ")", 1)) : v("", !0),
|
|
331
|
+
!m.data.isUser && !((se = m.data.children) != null && se.length) && !m.data.loaded ? (a(), U(u, {
|
|
308
332
|
key: 1,
|
|
309
333
|
size: "small",
|
|
310
334
|
variant: "text",
|
|
311
335
|
class: "cd-ps-load-btn",
|
|
312
|
-
onClick:
|
|
336
|
+
onClick: le((it) => fe(m, t.key), ["stop"])
|
|
313
337
|
}, {
|
|
314
|
-
default:
|
|
315
|
-
|
|
338
|
+
default: g(() => [...e[9] || (e[9] = [
|
|
339
|
+
Q("显示人员", -1)
|
|
316
340
|
])]),
|
|
317
341
|
_: 1
|
|
318
|
-
}, 8, ["onClick"])) :
|
|
342
|
+
}, 8, ["onClick"])) : v("", !0)
|
|
319
343
|
], 2)
|
|
320
344
|
];
|
|
321
345
|
}),
|
|
322
346
|
_: 2
|
|
323
|
-
}, 1032, ["data", "value"])) : (a(),
|
|
324
|
-
|
|
347
|
+
}, 1032, ["data", "value"])) : (a(), d("div", Fe, [
|
|
348
|
+
p(s, {
|
|
325
349
|
name: t.icon || "folder-open",
|
|
326
350
|
size: "48px",
|
|
327
351
|
style: { color: "#ddd" }
|
|
328
352
|
}, null, 8, ["name"]),
|
|
329
|
-
e[10] || (e[10] =
|
|
353
|
+
e[10] || (e[10] = o("p", null, "暂无数据", -1))
|
|
330
354
|
]))
|
|
331
355
|
])
|
|
332
356
|
];
|
|
@@ -337,61 +361,61 @@ const Ce = { class: "cd-ps-container" }, be = {
|
|
|
337
361
|
_: 1
|
|
338
362
|
}, 8, ["modelValue"]))
|
|
339
363
|
]),
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
e[12] || (e[12] =
|
|
343
|
-
|
|
344
|
-
R.value.length > 0 ? (a(),
|
|
364
|
+
o("div", je, [
|
|
365
|
+
o("div", qe, [
|
|
366
|
+
e[12] || (e[12] = o("span", { class: "cd-ps-title" }, "已选择", -1)),
|
|
367
|
+
o("span", Ge, h(R.value.length) + " 项", 1),
|
|
368
|
+
R.value.length > 0 ? (a(), U(u, {
|
|
345
369
|
key: 0,
|
|
346
370
|
size: "small",
|
|
347
371
|
variant: "text",
|
|
348
|
-
onClick:
|
|
372
|
+
onClick: K
|
|
349
373
|
}, {
|
|
350
|
-
default:
|
|
351
|
-
|
|
374
|
+
default: g(() => [...e[11] || (e[11] = [
|
|
375
|
+
Q("清空", -1)
|
|
352
376
|
])]),
|
|
353
377
|
_: 1
|
|
354
|
-
})) :
|
|
378
|
+
})) : v("", !0)
|
|
355
379
|
]),
|
|
356
|
-
|
|
357
|
-
R.value.length === 0 ? (a(),
|
|
358
|
-
|
|
380
|
+
o("div", He, [
|
|
381
|
+
R.value.length === 0 ? (a(), d("div", Qe, [
|
|
382
|
+
p(s, {
|
|
359
383
|
name: "user-checked",
|
|
360
384
|
size: "64px",
|
|
361
385
|
style: { color: "#ddd" }
|
|
362
386
|
}),
|
|
363
|
-
e[13] || (e[13] =
|
|
364
|
-
])) : (a(),
|
|
365
|
-
(a(!0),
|
|
387
|
+
e[13] || (e[13] = o("p", null, "暂无选择", -1))
|
|
388
|
+
])) : (a(), d("div", Xe, [
|
|
389
|
+
(a(!0), d(L, null, W(R.value, (t) => (a(), d("div", {
|
|
366
390
|
key: t.id,
|
|
367
|
-
class:
|
|
391
|
+
class: $(["cd-ps-selected-item", { "cd-ps-dept-item": !t.isUser }])
|
|
368
392
|
}, [
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
class:
|
|
393
|
+
o("div", Ye, [
|
|
394
|
+
o("div", {
|
|
395
|
+
class: $(["cd-ps-avatar", { "cd-ps-avatar-dept": !t.isUser }])
|
|
372
396
|
}, [
|
|
373
|
-
|
|
397
|
+
p(s, {
|
|
374
398
|
name: t.isUser ? "user" : "folder"
|
|
375
399
|
}, null, 8, ["name"])
|
|
376
400
|
], 2),
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
t.isUser && t.position ? (a(),
|
|
381
|
-
t.isUser && t.department ? (a(),
|
|
382
|
-
t.isUser ?
|
|
383
|
-
!t.isUser && t.userCount ? (a(),
|
|
401
|
+
o("div", Ze, [
|
|
402
|
+
o("div", Ke, h(t.displayName || t.name), 1),
|
|
403
|
+
o("div", et, [
|
|
404
|
+
t.isUser && t.position ? (a(), d("span", tt, h(t.position), 1)) : v("", !0),
|
|
405
|
+
t.isUser && t.department ? (a(), d("span", st, h(t.department), 1)) : v("", !0),
|
|
406
|
+
t.isUser ? v("", !0) : (a(), d("span", lt, h(t.typeName || "部门"), 1)),
|
|
407
|
+
!t.isUser && t.userCount ? (a(), d("span", at, h(t.userCount) + "人", 1)) : v("", !0)
|
|
384
408
|
])
|
|
385
409
|
])
|
|
386
410
|
]),
|
|
387
|
-
|
|
411
|
+
p(u, {
|
|
388
412
|
size: "small",
|
|
389
413
|
variant: "text",
|
|
390
414
|
shape: "circle",
|
|
391
|
-
onClick: (
|
|
415
|
+
onClick: (E) => _e(t.id)
|
|
392
416
|
}, {
|
|
393
|
-
icon:
|
|
394
|
-
|
|
417
|
+
icon: g(() => [
|
|
418
|
+
p(s, { name: "close" })
|
|
395
419
|
]),
|
|
396
420
|
_: 1
|
|
397
421
|
}, 8, ["onClick"])
|
|
@@ -406,17 +430,17 @@ const Ce = { class: "cd-ps-container" }, be = {
|
|
|
406
430
|
}, 8, ["visible", "width"]);
|
|
407
431
|
};
|
|
408
432
|
}
|
|
409
|
-
}),
|
|
410
|
-
const O =
|
|
411
|
-
for (const [
|
|
412
|
-
O[
|
|
433
|
+
}), ot = (x, J) => {
|
|
434
|
+
const O = x.__vccOpts || x;
|
|
435
|
+
for (const [r, C] of J)
|
|
436
|
+
O[r] = C;
|
|
413
437
|
return O;
|
|
414
|
-
},
|
|
415
|
-
install(
|
|
416
|
-
|
|
438
|
+
}, dt = /* @__PURE__ */ ot(nt, [["__scopeId", "data-v-b51aed83"]]), rt = {
|
|
439
|
+
install(x) {
|
|
440
|
+
x.component("PersonSelector", dt);
|
|
417
441
|
}
|
|
418
442
|
};
|
|
419
443
|
export {
|
|
420
|
-
|
|
421
|
-
|
|
444
|
+
dt as PersonSelector,
|
|
445
|
+
rt as default
|
|
422
446
|
};
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.cd-ps-container[data-v-
|
|
1
|
+
.cd-ps-container[data-v-b51aed83]{display:flex;flex-direction:column;gap:16px;min-height:500px}.cd-ps-tips[data-v-b51aed83]{display:flex;align-items:center;gap:8px;padding:12px;background-color:#e8f4ff;border-radius:4px;font-size:13px;color:#0052d9}.cd-ps-search[data-v-b51aed83]{display:flex;gap:12px;align-items:center}.cd-ps-org-select[data-v-b51aed83]{flex-shrink:0}.cd-ps-search-input[data-v-b51aed83]{flex:1}.cd-ps-content[data-v-b51aed83]{display:flex;gap:0;height:450px;border:1px solid #dfe1e6;border-radius:4px;overflow:hidden}.cd-ps-left[data-v-b51aed83]{width:480px;flex-shrink:0;border-right:1px solid #dfe1e6;display:flex;flex-direction:column;background-color:#fafafa}.cd-ps-left[data-v-b51aed83] .t-tabs__nav-container{padding:0 8px;background-color:#fff}.cd-ps-left[data-v-b51aed83] .t-tabs__content{flex:1;overflow:hidden}.cd-ps-tree[data-v-b51aed83]{height:100%;overflow-y:auto;padding:8px}.cd-ps-tree[data-v-b51aed83]::-webkit-scrollbar{width:6px}.cd-ps-tree[data-v-b51aed83]::-webkit-scrollbar-track{background:#f1f1f1}.cd-ps-tree[data-v-b51aed83]::-webkit-scrollbar-thumb{background:#c1c1c1;border-radius:3px}.cd-ps-node[data-v-b51aed83]{display:flex;align-items:center;gap:6px;font-size:14px;width:100%}[data-v-b51aed83] .t-tree__label{flex:1}[data-v-b51aed83] .t-checkbox__label{width:100%}.cd-ps-node-user[data-v-b51aed83]{font-size:13px;color:#666}.cd-ps-count[data-v-b51aed83]{color:#999;font-size:12px}.cd-ps-load-btn[data-v-b51aed83]{margin-left:auto;color:#0052d9;font-size:12px;flex-shrink:0}.cd-ps-empty[data-v-b51aed83]{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:60px 20px;color:#999}.cd-ps-empty p[data-v-b51aed83]{margin-top:16px;font-size:14px}.cd-ps-search-results[data-v-b51aed83]{display:flex;flex-direction:column;height:100%}.cd-ps-search-header[data-v-b51aed83]{display:flex;justify-content:space-between;align-items:center;padding:12px 16px;background:#fff;border-bottom:1px solid #dfe1e6;font-weight:500}.cd-ps-loading[data-v-b51aed83]{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:60px 20px;gap:12px;color:#999}.cd-ps-result-list[data-v-b51aed83]{flex:1;overflow-y:auto;padding:8px}.cd-ps-result-item[data-v-b51aed83]{display:flex;align-items:center;gap:10px;padding:10px 12px;background:#fff;border-radius:4px;border:1px solid #e5e7eb;margin-bottom:8px;cursor:pointer;transition:all .2s}.cd-ps-result-item[data-v-b51aed83]:hover{border-color:#0052d9;background:#f0f5ff}.cd-ps-result-item.cd-ps-selected[data-v-b51aed83]{border-color:#0052d9;background:#e8f4ff}.cd-ps-avatar[data-v-b51aed83]{width:32px;height:32px;border-radius:50%;background:#667eea;display:flex;align-items:center;justify-content:center;color:#fff;font-size:16px;flex-shrink:0}.cd-ps-result-item .cd-ps-avatar[data-v-b51aed83]{width:36px;height:36px}.cd-ps-avatar-dept[data-v-b51aed83]{background:linear-gradient(135deg,#f5af19,#f12711)}.cd-ps-info[data-v-b51aed83]{flex:1;min-width:0}.cd-ps-name[data-v-b51aed83]{font-size:13px;font-weight:500;color:#333;margin-bottom:4px}.cd-ps-result-item .cd-ps-name[data-v-b51aed83]{font-size:14px}.cd-ps-meta[data-v-b51aed83]{display:flex;flex-wrap:wrap;gap:6px;font-size:11px;color:#999}.cd-ps-result-item .cd-ps-meta[data-v-b51aed83]{font-size:12px}.cd-ps-meta span[data-v-b51aed83]:before{content:"•";margin-right:4px}.cd-ps-meta span[data-v-b51aed83]:first-child:before{display:none}.cd-ps-right[data-v-b51aed83]{flex:1;display:flex;flex-direction:column;overflow:hidden;background-color:#fafafa}.cd-ps-right-header[data-v-b51aed83]{display:flex;align-items:center;padding:12px 16px;border-bottom:1px solid #dfe1e6;background-color:#fff}.cd-ps-title[data-v-b51aed83]{font-weight:500;font-size:14px;color:#333}.cd-ps-num[data-v-b51aed83]{font-size:13px;color:#0052d9;font-weight:600;margin-left:8px;flex:1}.cd-ps-right-list[data-v-b51aed83]{flex:1;overflow-y:auto;padding:8px}.cd-ps-right-list[data-v-b51aed83]::-webkit-scrollbar{width:6px}.cd-ps-right-list[data-v-b51aed83]::-webkit-scrollbar-track{background:#f1f1f1}.cd-ps-right-list[data-v-b51aed83]::-webkit-scrollbar-thumb{background:#c1c1c1;border-radius:3px}.cd-ps-selected-list[data-v-b51aed83]{display:flex;flex-direction:column;gap:8px}.cd-ps-selected-item[data-v-b51aed83]{display:flex;align-items:center;justify-content:space-between;padding:10px 12px;background:#fff;border-radius:4px;border:1px solid #e5e7eb;transition:all .2s}.cd-ps-selected-item[data-v-b51aed83]:hover{border-color:#0052d9;box-shadow:0 2px 4px #0052d91a}.cd-ps-dept-item[data-v-b51aed83]{border-color:#f5af19}.cd-ps-item-info[data-v-b51aed83]{flex:1;min-width:0;display:flex;align-items:center;gap:10px}
|
package/package.json
CHANGED
package/src/PersonSelector.vue
CHANGED
|
@@ -268,12 +268,44 @@ function getAllNodeIds(tree: TreeNode[]): (number | string)[] {
|
|
|
268
268
|
traverse(tree);
|
|
269
269
|
return ids;
|
|
270
270
|
}
|
|
271
|
-
const handleTreeCheck = (checkedIds: (number | string)[]) => {
|
|
271
|
+
const handleTreeCheck = (checkedIds: (number | string)[], context: any) => {
|
|
272
|
+
// TDesign Tree change 事件: context 包含 node 和 e
|
|
273
|
+
const node = context?.node;
|
|
274
|
+
if (node) {
|
|
275
|
+
const nodeId = node.value ?? node.data?.id;
|
|
276
|
+
if (nodeId !== undefined) {
|
|
277
|
+
const isChecked = checkedIds.includes(nodeId);
|
|
278
|
+
if (isChecked) {
|
|
279
|
+
if (!selectedIds.value.includes(nodeId)) {
|
|
280
|
+
selectedIds.value = [...selectedIds.value, nodeId];
|
|
281
|
+
}
|
|
282
|
+
} else {
|
|
283
|
+
selectedIds.value = selectedIds.value.filter(id => id !== nodeId);
|
|
284
|
+
}
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
// 降级处理:完整替换当前 tab 的选中项
|
|
272
289
|
const currentTreeData = internalTreeData.value[activeTab.value] || [];
|
|
273
290
|
const currentTreeNodeIds = getAllNodeIds(currentTreeData);
|
|
274
291
|
const otherSelectedIds = selectedIds.value.filter(id => !currentTreeNodeIds.includes(id));
|
|
275
292
|
selectedIds.value = [...otherSelectedIds, ...checkedIds];
|
|
276
293
|
};
|
|
294
|
+
// 递归更新 internalTreeData 中的节点
|
|
295
|
+
function addChildrenToNode(tree: TreeNode[], parentId: number | string, children: TreeNode[]): boolean {
|
|
296
|
+
for (const node of tree) {
|
|
297
|
+
if (node.id === parentId) {
|
|
298
|
+
node.children = node.children || [];
|
|
299
|
+
node.children.push(...children);
|
|
300
|
+
node.loaded = true;
|
|
301
|
+
return true;
|
|
302
|
+
}
|
|
303
|
+
if (node.children && addChildrenToNode(node.children, parentId, children)) {
|
|
304
|
+
return true;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
return false;
|
|
308
|
+
}
|
|
277
309
|
async function handleLoadUsers(node: any, tabKey: string) {
|
|
278
310
|
const nodeId = node.value;
|
|
279
311
|
const treeRef = treeRefs.value[tabKey];
|
|
@@ -283,13 +315,27 @@ async function handleLoadUsers(node: any, tabKey: string) {
|
|
|
283
315
|
const { id, name, ...rest } = user;
|
|
284
316
|
return { ...rest, id, name: user.displayName || name, isUser: true };
|
|
285
317
|
});
|
|
318
|
+
// 同步更新 internalTreeData
|
|
319
|
+
const treeData = internalTreeData.value[tabKey];
|
|
320
|
+
if (treeData) {
|
|
321
|
+
addChildrenToNode(treeData, nodeId, userNodes);
|
|
322
|
+
}
|
|
323
|
+
// 更新 UI 树
|
|
286
324
|
if (treeRef) {
|
|
287
325
|
treeRef.appendTo(nodeId, userNodes);
|
|
288
326
|
node.data.loaded = true;
|
|
289
327
|
await nextTick();
|
|
290
328
|
try { treeRef.setItem(nodeId, { expanded: true }); } catch { /* ignore */ }
|
|
291
329
|
}
|
|
292
|
-
} else {
|
|
330
|
+
} else {
|
|
331
|
+
node.data.loaded = true;
|
|
332
|
+
// 标记节点已加载
|
|
333
|
+
const treeData = internalTreeData.value[tabKey];
|
|
334
|
+
if (treeData) {
|
|
335
|
+
const targetNode = findNodeById(treeData, nodeId);
|
|
336
|
+
if (targetNode) targetNode.loaded = true;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
293
339
|
};
|
|
294
340
|
emit('load-users', { tabKey, nodeId, node, callback });
|
|
295
341
|
}
|