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