cd-personselector 1.2.8 → 1.2.9
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.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +95 -94
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(b,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(b=typeof globalThis<"u"?globalThis:b||self,e(b.CdPersonSelector={},b.Vue))})(this,function(b,e){"use strict";const ne={class:"cd-ps-container"},se={key:0,class:"cd-ps-search"},ce={key:0,class:"cd-ps-org-select"},de={class:"cd-ps-search-input"},ie={class:"cd-ps-content"},re={class:"cd-ps-left"},pe={key:0,class:"cd-ps-search-results"},me={class:"cd-ps-search-header"},fe={key:0,class:"cd-ps-loading"},he={key:1,class:"cd-ps-empty"},ke={key:2,class:"cd-ps-result-list"},_e=["onClick"],ue={class:"cd-ps-avatar"},ge={class:"cd-ps-info"},Ve={class:"cd-ps-name"},ye={class:"cd-ps-meta"},Ce={key:0},Be={key:1},Ne={key:2},Ee={class:"cd-ps-tree"},be={class:"cd-ps-node-name"},Se={key:0,class:"cd-ps-position"},xe={key:0,class:"cd-ps-count"},Ue={key:1,class:"cd-ps-empty"},we={class:"cd-ps-right"},Ie={class:"cd-ps-right-header"},De={class:"cd-ps-num"},Te={class:"cd-ps-right-list"},ze={key:0,class:"cd-ps-empty"},$e={key:1,class:"cd-ps-selected-list"},Pe={class:"cd-ps-item-info"},Oe={class:"cd-ps-info"},Le={class:"cd-ps-name"},Me={class:"cd-ps-meta"},Re={key:0},Fe={key:1},Ae={key:2},We={key:3},je=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},showOrg:{type:Boolean,default:!0},multiple:{type:Boolean,default:!0}},emits:["update:visible","update:modelValue","confirm","load-users","search","org-change"],setup(f,{expose:$,emit:_}){var oe,le;const c=f,u=_,C=e.ref(c.visible),g=e.ref(((le=(oe=c.tabs)==null?void 0:oe[0])==null?void 0:le.key)||""),V=e.ref(null),S=e.ref(""),i=e.ref([]),y=e.ref(new Map),P=e.ref({}),O=e.ref(!1),D=e.ref(!1),T=e.ref([]),j=e.computed(()=>c.tabs||[]),x=e.computed(()=>c.organizations||[]);e.computed(()=>c.tips||"");const J=e.computed(()=>c.showSearch),q=e.computed(()=>c.showOrg),G=e.computed(()=>c.dialogWidth),U=e.ref({});e.watch(()=>c.tabs,l=>{if(l&&l.length>0){const t={};l.forEach(s=>{t[s.key]=JSON.parse(JSON.stringify(s.tree))}),U.value=t,(!g.value||!l.find(s=>s.key===g.value))&&(g.value=l[0].key)}},{immediate:!0,deep:!0});function M(){if(c.modelValue&&c.modelValue.length>0){const l=c.modelValue[0];typeof l=="object"&&l!==null&&"id"in l?(i.value=c.modelValue.map(t=>t.id),y.value.clear(),c.modelValue.forEach(t=>{y.value.set(t.id,t)})):i.value=[...c.modelValue]}else i.value=[],y.value.clear()}e.watch(()=>c.modelValue,l=>{C.value&&l&&M()},{deep:!0}),e.watch(()=>c.visible,l=>{C.value=l,l&&(M(),c.organizations.length>0&&!V.value&&(V.value=c.organizations[0].id))}),e.watch(C,l=>{u("update:visible",l)});function H(l,t){t&&(P.value[l]=t)}function R(l,t){for(const s of l){if(s.id===t)return s;if(s.children){const r=R(s.children,t);if(r)return r}}return null}const o=e.computed(()=>i.value.map(l=>y.value.get(l)).filter(Boolean));function d(l,t){i.value.includes(l)||i.value.push(l),y.value.set(l,t)}function p(l){i.value=i.value.filter(t=>t!==l),y.value.delete(l)}const E=()=>{S.value=""},w=l=>{const t={};c.tabs.forEach(s=>{t[s.key]=[]}),U.value=t,u("org-change",l)};let n=null;const Q=()=>{if(n&&clearTimeout(n),!S.value.trim()){X();return}O.value=!0,D.value=!0,n=setTimeout(()=>ot(),300)},ot=()=>{T.value=[];const l=t=>{T.value=t.map(s=>({...s,isUser:!0})),D.value=!1};u("search",{keyword:S.value,orgId:V.value||void 0,callback:l})},X=()=>{n&&(clearTimeout(n),n=null),O.value=!1,S.value="",T.value=[],D.value=!1},lt=l=>{i.value.indexOf(l.id)>-1?p(l.id):(c.multiple||(i.value=[],y.value.clear()),d(l.id,{...l,isUser:!0,typeName:"搜索结果",orgId:V.value}),c.multiple||Y())};function at(l){const t=[],s=r=>{for(const m of r)t.push(m.id),m.children&&s(m.children)};return s(l),t}const nt=(l,t)=>{var h,B;const s=t==null?void 0:t.node;if(s){const N=s.value??((h=s.data)==null?void 0:h.id);if(N!==void 0){if(s.checked){c.multiple||(i.value=[],y.value.clear());const z=c.tabs.find(Z=>Z.key===g.value),L=z?z.name.replace(/^按/,""):"";d(N,{...s.data,typeName:L,orgId:V.value}),!c.multiple&&((B=s.data)!=null&&B.isUser)&&Y()}else p(N);return}}const r=U.value[g.value]||[],m=at(r),I=i.value.filter(N=>!m.includes(N));i.value=[...I,...l]};function ee(l,t,s){for(const r of l){if(r.id===t)return r.children=r.children||[],r.children.push(...s),r.loaded=!0,!0;if(r.children&&ee(r.children,t,s))return!0}return!1}async function st(l,t){const s=l.value,r=P.value[t];u("load-users",{tabKey:t,nodeId:s,node:l,callback:async I=>{if(I.length>0){const h=I.map(N=>{const{id:F,name:z,...L}=N;return{...L,id:F,name:N.displayName||z,isUser:!0}}),B=U.value[t];if(B&&ee(B,s,h),r){r.appendTo(s,h),l.data.loaded=!0,await e.nextTick();try{r.setItem(s,{expanded:!0})}catch{}}}else{l.data.loaded=!0;const h=U.value[t];if(h){const B=R(h,s);B&&(B.loaded=!0)}}}})}const ct=l=>{p(l)},te=()=>{i.value=[],y.value.clear()},Y=()=>{u("update:modelValue",i.value),u("confirm",o.value),C.value=!1},dt=()=>{C.value=!1};return $({clearSelection:te,appendUsers:(l,t,s)=>{const r=P.value[l];if(r&&s.length>0){const m=s.map(I=>{const{id:h,name:B,...N}=I;return{...N,id:h,name:I.displayName||B,isUser:!0}});r.appendTo(t,m)}}}),(l,t)=>{const s=e.resolveComponent("t-option"),r=e.resolveComponent("t-select"),m=e.resolveComponent("t-icon"),I=e.resolveComponent("t-input"),h=e.resolveComponent("t-button"),B=e.resolveComponent("t-loading"),N=e.resolveComponent("t-checkbox"),F=e.resolveComponent("t-tree"),z=e.resolveComponent("t-tab-panel"),L=e.resolveComponent("t-tabs"),Z=e.resolveComponent("t-dialog");return e.openBlock(),e.createBlock(Z,{visible:C.value,"onUpdate:visible":t[4]||(t[4]=a=>C.value=a),header:"选择人员",width:G.value,footer:!0,placement:"center","destroy-on-close":"",onConfirm:Y,onClose:dt},{default:e.withCtx(()=>[e.createElementVNode("div",ne,[J.value?(e.openBlock(),e.createElementBlock("div",se,[q.value&&x.value.length>0?(e.openBlock(),e.createElementBlock("div",ce,[e.createVNode(r,{modelValue:V.value,"onUpdate:modelValue":t[0]||(t[0]=a=>V.value=a),placeholder:"选择组织",style:{width:"200px"},onChange:w},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(x.value,a=>(e.openBlock(),e.createBlock(s,{key:a.id,value:a.id,label:a.displayName||a.name},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])])):e.createCommentVNode("",!0),e.createElementVNode("div",de,[e.createVNode(I,{modelValue:S.value,"onUpdate:modelValue":t[1]||(t[1]=a=>S.value=a),placeholder:"输入手机号/工号/姓名/部门/职位搜索",clearable:"",onInput:Q,onClear:X},{"prefix-icon":e.withCtx(()=>[e.createVNode(m,{name:"search"})]),_:1},8,["modelValue"])])])):e.createCommentVNode("",!0),e.createElementVNode("div",ie,[e.createElementVNode("div",re,[O.value?(e.openBlock(),e.createElementBlock("div",pe,[e.createElementVNode("div",me,[t[6]||(t[6]=e.createElementVNode("span",null,"搜索结果",-1)),e.createVNode(h,{size:"small",variant:"text",onClick:X},{default:e.withCtx(()=>[...t[5]||(t[5]=[e.createTextVNode("返回",-1)])]),_:1})]),D.value?(e.openBlock(),e.createElementBlock("div",fe,[e.createVNode(B),t[7]||(t[7]=e.createElementVNode("span",null,"搜索中...",-1))])):T.value.length===0?(e.openBlock(),e.createElementBlock("div",he,[e.createVNode(m,{name:"search",size:"48px",style:{color:"#ddd"}}),t[8]||(t[8]=e.createElementVNode("p",null,"未找到匹配的人员",-1))])):(e.openBlock(),e.createElementBlock("div",ke,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(T.value,a=>(e.openBlock(),e.createElementBlock("div",{key:a.id,class:e.normalizeClass(["cd-ps-result-item",{"cd-ps-selected":i.value.includes(a.id)}]),onClick:A=>lt(a)},[e.createVNode(N,{checked:i.value.includes(a.id),onClick:t[2]||(t[2]=e.withModifiers(()=>{},["stop"]))},null,8,["checked"]),e.createElementVNode("div",ue,[e.createVNode(m,{name:"user"})]),e.createElementVNode("div",ge,[e.createElementVNode("div",Ve,e.toDisplayString(a.displayName||a.name),1),e.createElementVNode("div",ye,[a.position?(e.openBlock(),e.createElementBlock("span",Ce,e.toDisplayString(a.position),1)):e.createCommentVNode("",!0),a.department?(e.openBlock(),e.createElementBlock("span",Be,e.toDisplayString(a.department),1)):e.createCommentVNode("",!0),a.phone?(e.openBlock(),e.createElementBlock("span",Ne,e.toDisplayString(a.phone),1)):e.createCommentVNode("",!0)])])],10,_e))),128))]))])):(e.openBlock(),e.createBlock(L,{key:1,modelValue:g.value,"onUpdate:modelValue":t[3]||(t[3]=a=>g.value=a),onChange:E},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(j.value,a=>(e.openBlock(),e.createBlock(z,{key:a.key,value:a.key,label:a.name},{default:e.withCtx(()=>{var A;return[e.createElementVNode("div",Ee,[((A=U.value[a.key])==null?void 0:A.length)>0?(e.openBlock(),e.createBlock(F,{key:0,ref_for:!0,ref:k=>H(a.key,k),data:U.value[a.key],keys:{value:"id",label:"name",children:"children"},hover:"",checkable:"","expand-all":!1,value:i.value,onChange:nt},{label:e.withCtx(({node:k})=>{var ae;return[e.createElementVNode("div",{class:e.normalizeClass(["cd-ps-node",{"cd-ps-node-user":k.data.isUser}])},[e.createVNode(m,{name:k.data.isUser?"user":a.icon||"folder"},null,8,["name"]),e.createElementVNode("span",be,[e.createTextVNode(e.toDisplayString(k.label)+" ",1),k.data.isUser&&k.data.position?(e.openBlock(),e.createElementBlock("span",Se,e.toDisplayString(k.data.position),1)):e.createCommentVNode("",!0)]),k.data.userCount&&!k.data.isUser?(e.openBlock(),e.createElementBlock("span",xe,"("+e.toDisplayString(k.data.userCount)+")",1)):e.createCommentVNode("",!0),!k.data.isUser&&!((ae=k.data.children)!=null&&ae.length)&&!k.data.loaded?(e.openBlock(),e.createBlock(h,{key:1,size:"small",variant:"text",class:"cd-ps-load-btn",onClick:e.withModifiers(rt=>st(k,a.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",Ue,[e.createVNode(m,{name:a.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",we,[e.createElementVNode("div",Ie,[t[12]||(t[12]=e.createElementVNode("span",{class:"cd-ps-title"},"已选择",-1)),e.createElementVNode("span",De,e.toDisplayString(o.value.length)+" 项",1),o.value.length>0?(e.openBlock(),e.createBlock(h,{key:0,size:"small",variant:"text",onClick:te},{default:e.withCtx(()=>[...t[11]||(t[11]=[e.createTextVNode("清空",-1)])]),_:1})):e.createCommentVNode("",!0)]),e.createElementVNode("div",Te,[o.value.length===0?(e.openBlock(),e.createElementBlock("div",ze,[e.createVNode(m,{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(o.value,a=>(e.openBlock(),e.createElementBlock("div",{key:a.id,class:e.normalizeClass(["cd-ps-selected-item",{"cd-ps-dept-item":!a.isUser}])},[e.createElementVNode("div",Pe,[e.createElementVNode("div",{class:e.normalizeClass(["cd-ps-avatar",{"cd-ps-avatar-dept":!a.isUser}])},[e.createVNode(m,{name:a.isUser?"user":"folder"},null,8,["name"])],2),e.createElementVNode("div",Oe,[e.createElementVNode("div",Le,e.toDisplayString(a.displayName||a.name),1),e.createElementVNode("div",Me,[a.isUser&&a.position?(e.openBlock(),e.createElementBlock("span",Re,e.toDisplayString(a.position),1)):e.createCommentVNode("",!0),a.isUser&&a.department?(e.openBlock(),e.createElementBlock("span",Fe,e.toDisplayString(a.department),1)):e.createCommentVNode("",!0),a.isUser?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",Ae,e.toDisplayString(a.typeName||"部门"),1)),!a.isUser&&a.userCount?(e.openBlock(),e.createElementBlock("span",We,e.toDisplayString(a.userCount)+"人",1)):e.createCommentVNode("",!0)])])]),e.createVNode(h,{size:"small",variant:"text",shape:"circle",onClick:A=>ct(a.id)},{icon:e.withCtx(()=>[e.createVNode(m,{name:"close"})]),_:1},8,["onClick"])],2))),128))]))])])])])]),_:1},8,["visible","width"])}}}),K=(f,$)=>{const _=f.__vccOpts||f;for(const[c,u]of $)_[c]=u;return _},W=K(je,[["__scopeId","data-v-d9ce1a42"]]),Je={class:"cd-input-select"},qe={key:0,class:"cd-input-select__panel"},Ge={class:"cd-input-select__option-content"},He={key:0,class:"cd-input-select__option-avatar"},Qe=["src","alt"],Xe={class:"cd-input-select__option-info"},Ye={class:"cd-input-select__option-name"},Ze={key:0,class:"cd-input-select__option-desc"},Ke={key:2,class:"ri-building-line cd-input-select__option-icon"},ve={key:1,class:"cd-input-select__loading"},et={key:2,class:"cd-input-select__empty"},v=K(e.defineComponent({name:"CdInputPersonSelector",__name:"InputSelect",props:{modelValue:{},multiple:{type:Boolean,default:!0},placeholder:{default:"搜索用户、部门、职位"},tabs:{},organizations:{}},emits:["update:modelValue","search","load-users"],setup(f,{emit:$}){const _=f,c=$,u=e.ref(!1),C=e.ref([]),g=e.ref(!1),V=e.ref([]),S=e.ref([]),i=e.ref(!1),y=e.ref(""),P=o=>o?o.substring(0,2).toUpperCase():"",O=o=>{const d=["#1890ff","#52c41a","#faad14","#f5222d","#722ed1","#13c2c2","#eb2f96","#fa8c16"];let p=0;for(let E=0;E<o.length;E++)p=o.charCodeAt(E)+((p<<5)-p);return d[Math.abs(p)%d.length]},D=o=>String(o).startsWith("dept-"),T=o=>_.modelValue.some(d=>d.id===o),j=o=>({id:o.id,name:o.displayName||o.name||o.title||String(o.id),avatar:o.avatar||"",department:o.department||"",position:o.position||"",phone:o.phone||"",isUser:o.isUser!==!1}),x=o=>{c("update:modelValue",o),S.value=o},J=o=>{o||(C.value=[],y.value="")},q=(o,d)=>{o?_.multiple?x([..._.modelValue,d]):(x([d]),i.value=!1):x(_.modelValue.filter(p=>p.id!==d.id))},G=(o,d)=>{const{trigger:p,index:E}=d;if((p==="tag-remove"||p==="backspace")&&(i.value=!1),p==="clear")V.value=[],x([]);else if(["tag-remove","backspace"].includes(p)){V.value=o;const w=[..._.modelValue];w.splice(E,1),x(w)}},U=o=>{o.stopPropagation(),o.preventDefault(),i.value=!1,g.value=!0},M=o=>{const d=o.map(j),p=new Set(_.modelValue.map(n=>n.id)),E=d.filter(n=>!p.has(n.id)),w=_.multiple?[..._.modelValue,...E]:d.slice(0,1);x(w),g.value=!1},H=o=>{c("load-users",o)},R=o=>{c("search",{keyword:o.keyword,callback:o.callback})};return e.watch(()=>_.modelValue,o=>{V.value=o.map(d=>d.id),S.value=o},{immediate:!0,deep:!0}),e.watch(y,o=>{if(!(o!=null&&o.trim())){C.value=[],u.value=!1;return}u.value=!0,c("search",{keyword:o,callback:d=>{C.value=d,u.value=!1,d.length>0&&(i.value=!0)}})}),(o,d)=>{var w;const p=e.resolveComponent("t-checkbox"),E=e.resolveComponent("t-select-input");return e.openBlock(),e.createElementBlock("div",Je,[e.createVNode(E,{value:V.value,inputValue:y.value,"onUpdate:inputValue":d[0]||(d[0]=n=>y.value=n),"popup-visible":i.value,"onUpdate:popupVisible":d[1]||(d[1]=n=>i.value=n),"input-props":{readonly:!1,disabled:!1},"tag-input-props":{excessTagsDisplayType:"break-line"},"popup-props":{overlayInnerStyle:{padding:"6px"},closeBtn:!0},placeholder:f.placeholder,loading:u.value,"allow-input":"",clearable:"",multiple:f.multiple,class:"cd-input-select__select",onPopupVisibleChange:J,onTagChange:G},{panel:e.withCtx(()=>[C.value.length>0?(e.openBlock(),e.createElementBlock("div",qe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(C.value,n=>(e.openBlock(),e.createBlock(p,{key:n.id,value:n.id,checked:T(n.id),class:"cd-input-select__option",onChange:Q=>q(Q,n)},{default:e.withCtx(()=>[e.createElementVNode("div",Ge,[n.avatar?(e.openBlock(),e.createElementBlock("div",He,[e.createElementVNode("img",{src:n.avatar,alt:n.name},null,8,Qe)])):(e.openBlock(),e.createElementBlock("div",{key:1,class:"cd-input-select__option-avatar cd-input-select__option-avatar--placeholder",style:e.normalizeStyle({backgroundColor:D(n.id)?"#e6f4ff":O(n.name),color:D(n.id)?"#0052d9":"#fff"})},e.toDisplayString(P(n.name)),5)),e.createElementVNode("div",Xe,[e.createElementVNode("div",Ye,e.toDisplayString(n.name),1),n.department||n.position?(e.openBlock(),e.createElementBlock("div",Ze,e.toDisplayString(n.department)+e.toDisplayString(n.department&&n.position?" · ":"")+e.toDisplayString(n.position),1)):e.createCommentVNode("",!0)]),D(n.id)?(e.openBlock(),e.createElementBlock("i",Ke)):e.createCommentVNode("",!0)])]),_:2},1032,["value","checked","onChange"]))),128))])):u.value?(e.openBlock(),e.createElementBlock("div",ve," 搜索中... ")):(e.openBlock(),e.createElementBlock("div",et," 暂无搜索结果 "))]),suffixIcon:e.withCtx(()=>[e.createElementVNode("i",{class:"ri-add-circle-line cd-input-select__add-icon",onClick:U})]),_:1},8,["value","inputValue","popup-visible","placeholder","loading","multiple"]),(w=f.tabs)!=null&&w.length&&g.value?(e.openBlock(),e.createBlock(W,{key:0,visible:g.value,"onUpdate:visible":d[2]||(d[2]=n=>g.value=n),modelValue:V.value,"onUpdate:modelValue":d[3]||(d[3]=n=>V.value=n),tabs:f.tabs,organizations:f.organizations||[],"show-org":!1,"show-search":!0,multiple:f.multiple,onConfirm:M,onLoadUsers:H,onSearch:R,onClose:d[4]||(d[4]=n=>g.value=!1)},null,8,["visible","modelValue","tabs","organizations","multiple"])):e.createCommentVNode("",!0)])}}}),[["__scopeId","data-v-efcc6df7"]]),tt={install(f){f.component("PersonSelector",W),f.component("CdInputPersonSelector",v)}};b.InputSelect=v,b.PersonSelector=W,b.default=tt,Object.defineProperties(b,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
1
|
+
(function(S,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(S=typeof globalThis<"u"?globalThis:S||self,e(S.CdPersonSelector={},S.Vue))})(this,function(S,e){"use strict";const ae={class:"cd-ps-container"},se={key:0,class:"cd-ps-search"},ce={key:0,class:"cd-ps-org-select"},de={class:"cd-ps-search-input"},ie={class:"cd-ps-content"},re={class:"cd-ps-left"},pe={key:0,class:"cd-ps-search-results"},me={class:"cd-ps-search-header"},fe={key:0,class:"cd-ps-loading"},he={key:1,class:"cd-ps-empty"},ke={key:2,class:"cd-ps-result-list"},_e=["onClick"],ue={class:"cd-ps-avatar"},ge={class:"cd-ps-info"},Ve={class:"cd-ps-name"},ye={class:"cd-ps-meta"},Ce={key:0},Be={key:1},Ne={key:2},Ee={class:"cd-ps-tree"},Se={class:"cd-ps-node-name"},be={key:0,class:"cd-ps-position"},xe={key:0,class:"cd-ps-count"},Ue={key:1,class:"cd-ps-empty"},we={class:"cd-ps-right"},Ie={class:"cd-ps-right-header"},De={class:"cd-ps-num"},Te={class:"cd-ps-right-list"},ze={key:0,class:"cd-ps-empty"},$e={key:1,class:"cd-ps-selected-list"},Pe={class:"cd-ps-item-info"},Oe={class:"cd-ps-info"},Le={class:"cd-ps-name"},Me={class:"cd-ps-meta"},Re={key:0},Fe={key:1},Ae={key:2},We={key:3},je=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},showOrg:{type:Boolean,default:!0},multiple:{type:Boolean,default:!0}},emits:["update:visible","update:modelValue","confirm","load-users","search","org-change"],setup(f,{expose:$,emit:_}){var oe,le;const c=f,u=_,C=e.ref(c.visible),g=e.ref(((le=(oe=c.tabs)==null?void 0:oe[0])==null?void 0:le.key)||""),V=e.ref(null),b=e.ref(""),i=e.ref([]),y=e.ref(new Map),P=e.ref({}),O=e.ref(!1),D=e.ref(!1),T=e.ref([]),J=e.computed(()=>c.tabs||[]),x=e.computed(()=>c.organizations||[]);e.computed(()=>c.tips||"");const q=e.computed(()=>c.showSearch),G=e.computed(()=>c.showOrg),H=e.computed(()=>c.dialogWidth),U=e.ref({});e.watch(()=>c.tabs,l=>{if(l&&l.length>0){const t={};l.forEach(s=>{t[s.key]=JSON.parse(JSON.stringify(s.tree))}),U.value=t,(!g.value||!l.find(s=>s.key===g.value))&&(g.value=l[0].key)}},{immediate:!0,deep:!0});function M(){if(c.modelValue&&c.modelValue.length>0){const l=c.modelValue[0];typeof l=="object"&&l!==null&&"id"in l?(i.value=c.modelValue.map(t=>t.id),y.value.clear(),c.modelValue.forEach(t=>{y.value.set(t.id,t)})):i.value=[...c.modelValue]}else i.value=[],y.value.clear()}e.watch(()=>c.modelValue,l=>{C.value&&l&&M()},{deep:!0}),e.watch(()=>c.visible,l=>{C.value=l,l&&(M(),c.organizations.length>0&&!V.value&&(V.value=c.organizations[0].id))}),e.watch(C,l=>{u("update:visible",l)});function Q(l,t){t&&(P.value[l]=t)}function R(l,t){for(const s of l){if(s.id===t)return s;if(s.children){const r=R(s.children,t);if(r)return r}}return null}const o=e.computed(()=>i.value.map(l=>y.value.get(l)).filter(Boolean));function d(l,t){i.value.includes(l)||i.value.push(l),y.value.set(l,t)}function p(l){i.value=i.value.filter(t=>t!==l),y.value.delete(l)}const E=()=>{b.value=""},w=l=>{const t={};c.tabs.forEach(s=>{t[s.key]=[]}),U.value=t,u("org-change",l)};let a=null;const X=()=>{if(a&&clearTimeout(a),!b.value.trim()){Y();return}O.value=!0,D.value=!0,a=setTimeout(()=>ot(),300)},ot=()=>{T.value=[];const l=t=>{T.value=t.map(s=>({...s,isUser:!0})),D.value=!1};u("search",{keyword:b.value,orgId:V.value||void 0,callback:l})},Y=()=>{a&&(clearTimeout(a),a=null),O.value=!1,b.value="",T.value=[],D.value=!1},lt=l=>{i.value.indexOf(l.id)>-1?p(l.id):(c.multiple||(i.value=[],y.value.clear()),d(l.id,{...l,isUser:!0,typeName:"搜索结果",orgId:V.value}),c.multiple||Z())};function nt(l){const t=[],s=r=>{for(const m of r)t.push(m.id),m.children&&s(m.children)};return s(l),t}const at=(l,t)=>{var h,B;const s=t==null?void 0:t.node;if(s){const N=s.value??((h=s.data)==null?void 0:h.id);if(N!==void 0){if(s.checked){c.multiple||(i.value=[],y.value.clear());const z=c.tabs.find(K=>K.key===g.value),L=z?z.name.replace(/^按/,""):"";d(N,{...s.data,typeName:L,orgId:V.value}),!c.multiple&&((B=s.data)!=null&&B.isUser)&&Z()}else p(N);return}}const r=U.value[g.value]||[],m=nt(r),I=i.value.filter(N=>!m.includes(N));i.value=[...I,...l]};function ee(l,t,s){for(const r of l){if(r.id===t)return r.children=r.children||[],r.children.push(...s),r.loaded=!0,!0;if(r.children&&ee(r.children,t,s))return!0}return!1}async function st(l,t){const s=l.value,r=P.value[t];u("load-users",{tabKey:t,nodeId:s,node:l,callback:async I=>{if(I.length>0){const h=I.map(N=>{const{id:F,name:z,...L}=N;return{...L,id:F,name:N.displayName||z,isUser:!0}}),B=U.value[t];if(B&&ee(B,s,h),r){r.appendTo(s,h),l.data.loaded=!0,await e.nextTick();try{r.setItem(s,{expanded:!0})}catch{}}}else{l.data.loaded=!0;const h=U.value[t];if(h){const B=R(h,s);B&&(B.loaded=!0)}}}})}const ct=l=>{p(l)},te=()=>{i.value=[],y.value.clear()},Z=()=>{u("update:modelValue",i.value),u("confirm",o.value),C.value=!1},dt=()=>{C.value=!1};return $({clearSelection:te,appendUsers:(l,t,s)=>{const r=P.value[l];if(r&&s.length>0){const m=s.map(I=>{const{id:h,name:B,...N}=I;return{...N,id:h,name:I.displayName||B,isUser:!0}});r.appendTo(t,m)}}}),(l,t)=>{const s=e.resolveComponent("t-option"),r=e.resolveComponent("t-select"),m=e.resolveComponent("t-icon"),I=e.resolveComponent("t-input"),h=e.resolveComponent("t-button"),B=e.resolveComponent("t-loading"),N=e.resolveComponent("t-checkbox"),F=e.resolveComponent("t-tree"),z=e.resolveComponent("t-tab-panel"),L=e.resolveComponent("t-tabs"),K=e.resolveComponent("t-dialog");return e.openBlock(),e.createBlock(K,{visible:C.value,"onUpdate:visible":t[4]||(t[4]=n=>C.value=n),header:"选择人员",width:H.value,footer:!0,placement:"center","destroy-on-close":"",onConfirm:Z,onClose:dt},{default:e.withCtx(()=>[e.createElementVNode("div",ae,[q.value?(e.openBlock(),e.createElementBlock("div",se,[G.value&&x.value.length>0?(e.openBlock(),e.createElementBlock("div",ce,[e.createVNode(r,{modelValue:V.value,"onUpdate:modelValue":t[0]||(t[0]=n=>V.value=n),placeholder:"选择组织",style:{width:"200px"},onChange:w},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(x.value,n=>(e.openBlock(),e.createBlock(s,{key:n.id,value:n.id,label:n.displayName||n.name},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])])):e.createCommentVNode("",!0),e.createElementVNode("div",de,[e.createVNode(I,{modelValue:b.value,"onUpdate:modelValue":t[1]||(t[1]=n=>b.value=n),placeholder:"输入手机号/工号/姓名/部门/职位搜索",clearable:"",onInput:X,onClear:Y},{"prefix-icon":e.withCtx(()=>[e.createVNode(m,{name:"search"})]),_:1},8,["modelValue"])])])):e.createCommentVNode("",!0),e.createElementVNode("div",ie,[e.createElementVNode("div",re,[O.value?(e.openBlock(),e.createElementBlock("div",pe,[e.createElementVNode("div",me,[t[6]||(t[6]=e.createElementVNode("span",null,"搜索结果",-1)),e.createVNode(h,{size:"small",variant:"text",onClick:Y},{default:e.withCtx(()=>[...t[5]||(t[5]=[e.createTextVNode("返回",-1)])]),_:1})]),D.value?(e.openBlock(),e.createElementBlock("div",fe,[e.createVNode(B),t[7]||(t[7]=e.createElementVNode("span",null,"搜索中...",-1))])):T.value.length===0?(e.openBlock(),e.createElementBlock("div",he,[e.createVNode(m,{name:"search",size:"48px",style:{color:"#ddd"}}),t[8]||(t[8]=e.createElementVNode("p",null,"未找到匹配的人员",-1))])):(e.openBlock(),e.createElementBlock("div",ke,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(T.value,n=>(e.openBlock(),e.createElementBlock("div",{key:n.id,class:e.normalizeClass(["cd-ps-result-item",{"cd-ps-selected":i.value.includes(n.id)}]),onClick:A=>lt(n)},[e.createVNode(N,{checked:i.value.includes(n.id),onClick:t[2]||(t[2]=e.withModifiers(()=>{},["stop"]))},null,8,["checked"]),e.createElementVNode("div",ue,[e.createVNode(m,{name:"user"})]),e.createElementVNode("div",ge,[e.createElementVNode("div",Ve,e.toDisplayString(n.displayName||n.name),1),e.createElementVNode("div",ye,[n.position?(e.openBlock(),e.createElementBlock("span",Ce,e.toDisplayString(n.position),1)):e.createCommentVNode("",!0),n.department?(e.openBlock(),e.createElementBlock("span",Be,e.toDisplayString(n.department),1)):e.createCommentVNode("",!0),n.phone?(e.openBlock(),e.createElementBlock("span",Ne,e.toDisplayString(n.phone),1)):e.createCommentVNode("",!0)])])],10,_e))),128))]))])):(e.openBlock(),e.createBlock(L,{key:1,modelValue:g.value,"onUpdate:modelValue":t[3]||(t[3]=n=>g.value=n),onChange:E},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(J.value,n=>(e.openBlock(),e.createBlock(z,{key:n.key,value:n.key,label:n.name},{default:e.withCtx(()=>{var A;return[e.createElementVNode("div",Ee,[((A=U.value[n.key])==null?void 0:A.length)>0?(e.openBlock(),e.createBlock(F,{key:0,ref_for:!0,ref:k=>Q(n.key,k),data:U.value[n.key],keys:{value:"id",label:"name",children:"children"},hover:"",checkable:"","expand-all":!1,value:i.value,onChange:at},{label:e.withCtx(({node:k})=>{var ne;return[e.createElementVNode("div",{class:e.normalizeClass(["cd-ps-node",{"cd-ps-node-user":k.data.isUser}])},[e.createVNode(m,{name:k.data.isUser?"user":n.icon||"folder"},null,8,["name"]),e.createElementVNode("span",Se,[e.createTextVNode(e.toDisplayString(k.label)+" ",1),k.data.isUser&&k.data.position?(e.openBlock(),e.createElementBlock("span",be,e.toDisplayString(k.data.position),1)):e.createCommentVNode("",!0)]),k.data.userCount&&!k.data.isUser?(e.openBlock(),e.createElementBlock("span",xe,"("+e.toDisplayString(k.data.userCount)+")",1)):e.createCommentVNode("",!0),!k.data.isUser&&!((ne=k.data.children)!=null&&ne.length)&&!k.data.loaded?(e.openBlock(),e.createBlock(h,{key:1,size:"small",variant:"text",class:"cd-ps-load-btn",onClick:e.withModifiers(rt=>st(k,n.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",Ue,[e.createVNode(m,{name:n.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",we,[e.createElementVNode("div",Ie,[t[12]||(t[12]=e.createElementVNode("span",{class:"cd-ps-title"},"已选择",-1)),e.createElementVNode("span",De,e.toDisplayString(o.value.length)+" 项",1),o.value.length>0?(e.openBlock(),e.createBlock(h,{key:0,size:"small",variant:"text",onClick:te},{default:e.withCtx(()=>[...t[11]||(t[11]=[e.createTextVNode("清空",-1)])]),_:1})):e.createCommentVNode("",!0)]),e.createElementVNode("div",Te,[o.value.length===0?(e.openBlock(),e.createElementBlock("div",ze,[e.createVNode(m,{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(o.value,n=>(e.openBlock(),e.createElementBlock("div",{key:n.id,class:e.normalizeClass(["cd-ps-selected-item",{"cd-ps-dept-item":!n.isUser}])},[e.createElementVNode("div",Pe,[e.createElementVNode("div",{class:e.normalizeClass(["cd-ps-avatar",{"cd-ps-avatar-dept":!n.isUser}])},[e.createVNode(m,{name:n.isUser?"user":"folder"},null,8,["name"])],2),e.createElementVNode("div",Oe,[e.createElementVNode("div",Le,e.toDisplayString(n.displayName||n.name),1),e.createElementVNode("div",Me,[n.isUser&&n.position?(e.openBlock(),e.createElementBlock("span",Re,e.toDisplayString(n.position),1)):e.createCommentVNode("",!0),n.isUser&&n.department?(e.openBlock(),e.createElementBlock("span",Fe,e.toDisplayString(n.department),1)):e.createCommentVNode("",!0),n.isUser?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",Ae,e.toDisplayString(n.typeName||"部门"),1)),!n.isUser&&n.userCount?(e.openBlock(),e.createElementBlock("span",We,e.toDisplayString(n.userCount)+"人",1)):e.createCommentVNode("",!0)])])]),e.createVNode(h,{size:"small",variant:"text",shape:"circle",onClick:A=>ct(n.id)},{icon:e.withCtx(()=>[e.createVNode(m,{name:"close"})]),_:1},8,["onClick"])],2))),128))]))])])])])]),_:1},8,["visible","width"])}}}),v=(f,$)=>{const _=f.__vccOpts||f;for(const[c,u]of $)_[c]=u;return _},W=v(je,[["__scopeId","data-v-d9ce1a42"]]),Je={class:"cd-input-select"},qe={key:0,class:"cd-input-select__panel"},Ge={class:"cd-input-select__option-content"},He={key:0,class:"cd-input-select__option-avatar"},Qe=["src","alt"],Xe={class:"cd-input-select__option-info"},Ye={class:"cd-input-select__option-name"},Ze={key:0,class:"cd-input-select__option-desc"},Ke={key:2,class:"ri-building-line cd-input-select__option-icon"},ve={key:1,class:"cd-input-select__loading"},et={key:2,class:"cd-input-select__empty"},j=v(e.defineComponent({name:"CdInputPersonSelector",__name:"InputSelect",props:{modelValue:{},multiple:{type:Boolean,default:!0},placeholder:{default:"搜索用户、部门、职位"},tabs:{},organizations:{}},emits:["update:modelValue","search","load-users"],setup(f,{emit:$}){const _=f,c=$,u=e.ref(!1),C=e.ref([]),g=e.ref(!1),V=e.ref([]),b=e.ref([]),i=e.ref(!1),y=e.ref(""),P=o=>o?o.substring(0,2).toUpperCase():"",O=o=>{const d=["#1890ff","#52c41a","#faad14","#f5222d","#722ed1","#13c2c2","#eb2f96","#fa8c16"];let p=0;for(let E=0;E<o.length;E++)p=o.charCodeAt(E)+((p<<5)-p);return d[Math.abs(p)%d.length]},D=o=>String(o).startsWith("dept-"),T=o=>_.modelValue.some(d=>d.id===o),J=o=>({id:o.id,name:o.displayName||o.name||o.title||String(o.id),avatar:o.avatar||"",department:o.department||"",position:o.position||"",phone:o.phone||"",isUser:o.isUser!==!1}),x=o=>{c("update:modelValue",o),b.value=o},q=o=>{o||(C.value=[],y.value="")},G=(o,d)=>{o?_.multiple?x([..._.modelValue,d]):(x([d]),i.value=!1):x(_.modelValue.filter(p=>p.id!==d.id))},H=(o,d)=>{const{trigger:p,index:E}=d;if((p==="tag-remove"||p==="backspace")&&(i.value=!1),p==="clear")V.value=[],x([]);else if(["tag-remove","backspace"].includes(p)){V.value=o;const w=[..._.modelValue];w.splice(E,1),x(w)}},U=o=>{o.stopPropagation(),o.preventDefault(),i.value=!1,g.value=!0},M=o=>{const d=o.map(J),p=new Set(_.modelValue.map(a=>a.id)),E=d.filter(a=>!p.has(a.id)),w=_.multiple?[..._.modelValue,...E]:d.slice(0,1);x(w),g.value=!1},Q=o=>{c("load-users",o)},R=o=>{c("search",{keyword:o.keyword,callback:o.callback})};return e.watch(()=>_.modelValue,o=>{V.value=o.map(d=>d.id),b.value=o},{immediate:!0,deep:!0}),e.watch(y,o=>{if(!(o!=null&&o.trim())){C.value=[],u.value=!1;return}u.value=!0,c("search",{keyword:o,callback:d=>{C.value=d,u.value=!1,d.length>0&&(i.value=!0)}})}),(o,d)=>{var w;const p=e.resolveComponent("t-checkbox"),E=e.resolveComponent("t-select-input");return e.openBlock(),e.createElementBlock("div",Je,[e.createVNode(E,{value:V.value,inputValue:y.value,"onUpdate:inputValue":d[0]||(d[0]=a=>y.value=a),"popup-visible":i.value,"onUpdate:popupVisible":d[1]||(d[1]=a=>i.value=a),"input-props":{readonly:!1,disabled:!1},"tag-input-props":{excessTagsDisplayType:"break-line"},"popup-props":{overlayInnerStyle:{padding:"6px"},closeBtn:!0},placeholder:f.placeholder,loading:u.value,"allow-input":"",clearable:"",multiple:f.multiple,class:"cd-input-select__select",onPopupVisibleChange:q,onTagChange:H},{panel:e.withCtx(()=>[C.value.length>0?(e.openBlock(),e.createElementBlock("div",qe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(C.value,a=>(e.openBlock(),e.createBlock(p,{key:a.id,value:a.id,checked:T(a.id),class:"cd-input-select__option",onChange:X=>G(X,a)},{default:e.withCtx(()=>[e.createElementVNode("div",Ge,[a.avatar?(e.openBlock(),e.createElementBlock("div",He,[e.createElementVNode("img",{src:a.avatar,alt:a.name},null,8,Qe)])):(e.openBlock(),e.createElementBlock("div",{key:1,class:"cd-input-select__option-avatar cd-input-select__option-avatar--placeholder",style:e.normalizeStyle({backgroundColor:D(a.id)?"#e6f4ff":O(a.name),color:D(a.id)?"#0052d9":"#fff"})},e.toDisplayString(P(a.name)),5)),e.createElementVNode("div",Xe,[e.createElementVNode("div",Ye,e.toDisplayString(a.name),1),a.department||a.position?(e.openBlock(),e.createElementBlock("div",Ze,e.toDisplayString(a.department)+e.toDisplayString(a.department&&a.position?" · ":"")+e.toDisplayString(a.position),1)):e.createCommentVNode("",!0)]),D(a.id)?(e.openBlock(),e.createElementBlock("i",Ke)):e.createCommentVNode("",!0)])]),_:2},1032,["value","checked","onChange"]))),128))])):u.value?(e.openBlock(),e.createElementBlock("div",ve," 搜索中... ")):(e.openBlock(),e.createElementBlock("div",et," 暂无搜索结果 "))]),suffixIcon:e.withCtx(()=>[e.createElementVNode("i",{class:"ri-add-circle-line cd-input-select__add-icon",onClick:U})]),_:1},8,["value","inputValue","popup-visible","placeholder","loading","multiple"]),(w=f.tabs)!=null&&w.length&&g.value?(e.openBlock(),e.createBlock(W,{key:0,visible:g.value,"onUpdate:visible":d[2]||(d[2]=a=>g.value=a),modelValue:V.value,"onUpdate:modelValue":d[3]||(d[3]=a=>V.value=a),tabs:f.tabs,organizations:f.organizations||[],"show-org":!1,"show-search":!0,multiple:f.multiple,onConfirm:M,onLoadUsers:Q,onSearch:R,onClose:d[4]||(d[4]=a=>g.value=!1)},null,8,["visible","modelValue","tabs","organizations","multiple"])):e.createCommentVNode("",!0)])}}}),[["__scopeId","data-v-efcc6df7"]]),tt={install(f){f.component("PersonSelector",W),f.component("CdInputPersonSelector",j)}};S.CdInputPersonSelector=j,S.InputSelect=j,S.PersonSelector=W,S.default=tt,Object.defineProperties(S,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { defineComponent as _e, ref as f, computed as A, watch as J, resolveComponent as N, createBlock as L, openBlock as
|
|
1
|
+
import { defineComponent as _e, ref as f, computed as A, watch as J, resolveComponent as N, createBlock as L, openBlock as a, withCtx as z, createElementVNode as u, createElementBlock as i, createCommentVNode as _, createVNode as b, Fragment as H, renderList as Q, createTextVNode as ee, normalizeClass as te, withModifiers as me, toDisplayString as h, nextTick as xe, normalizeStyle as Ne } from "vue";
|
|
2
2
|
const ze = { class: "cd-ps-container" }, Te = {
|
|
3
3
|
key: 0,
|
|
4
4
|
class: "cd-ps-search"
|
|
5
5
|
}, we = {
|
|
6
6
|
key: 0,
|
|
7
7
|
class: "cd-ps-org-select"
|
|
8
|
-
}, $e = { class: "cd-ps-search-input" },
|
|
8
|
+
}, $e = { class: "cd-ps-search-input" }, Pe = { class: "cd-ps-content" }, Be = { class: "cd-ps-left" }, De = {
|
|
9
9
|
key: 0,
|
|
10
10
|
class: "cd-ps-search-results"
|
|
11
11
|
}, Oe = { class: "cd-ps-search-header" }, Re = {
|
|
@@ -26,10 +26,10 @@ const ze = { class: "cd-ps-container" }, Te = {
|
|
|
26
26
|
}, Ze = {
|
|
27
27
|
key: 1,
|
|
28
28
|
class: "cd-ps-empty"
|
|
29
|
-
}, Ke = { class: "cd-ps-right" }, et = { class: "cd-ps-right-header" }, tt = { class: "cd-ps-num" }, lt = { class: "cd-ps-right-list" },
|
|
29
|
+
}, Ke = { class: "cd-ps-right" }, et = { class: "cd-ps-right-header" }, tt = { class: "cd-ps-num" }, lt = { class: "cd-ps-right-list" }, st = {
|
|
30
30
|
key: 0,
|
|
31
31
|
class: "cd-ps-empty"
|
|
32
|
-
},
|
|
32
|
+
}, at = {
|
|
33
33
|
key: 1,
|
|
34
34
|
class: "cd-ps-selected-list"
|
|
35
35
|
}, nt = { class: "cd-ps-item-info" }, ot = { class: "cd-ps-info" }, it = { class: "cd-ps-name" }, dt = { class: "cd-ps-meta" }, ct = { key: 0 }, ut = { key: 1 }, rt = { key: 2 }, pt = { key: 3 }, vt = /* @__PURE__ */ _e({
|
|
@@ -48,15 +48,15 @@ const ze = { class: "cd-ps-container" }, Te = {
|
|
|
48
48
|
emits: ["update:visible", "update:modelValue", "confirm", "load-users", "search", "org-change"],
|
|
49
49
|
setup(g, { expose: j, emit: C }) {
|
|
50
50
|
var ve, he;
|
|
51
|
-
const d = g, V = C, x = f(d.visible), S = f(((he = (ve = d.tabs) == null ? void 0 : ve[0]) == null ? void 0 : he.key) || ""), U = f(null),
|
|
51
|
+
const d = g, V = C, x = f(d.visible), S = f(((he = (ve = d.tabs) == null ? void 0 : ve[0]) == null ? void 0 : he.key) || ""), U = f(null), P = f(""), r = f([]), I = f(/* @__PURE__ */ new Map()), F = f({}), q = f(!1), M = f(!1), E = f([]), le = A(() => d.tabs || []), B = A(() => d.organizations || []);
|
|
52
52
|
A(() => d.tips || "");
|
|
53
|
-
const
|
|
53
|
+
const se = A(() => d.showSearch), ae = A(() => d.showOrg), ne = A(() => d.dialogWidth), D = f({});
|
|
54
54
|
J(() => d.tabs, (l) => {
|
|
55
55
|
if (l && l.length > 0) {
|
|
56
56
|
const e = {};
|
|
57
57
|
l.forEach((o) => {
|
|
58
58
|
e[o.key] = JSON.parse(JSON.stringify(o.tree));
|
|
59
|
-
}),
|
|
59
|
+
}), D.value = e, (!S.value || !l.find((o) => o.key === S.value)) && (S.value = l[0].key);
|
|
60
60
|
}
|
|
61
61
|
}, { immediate: !0, deep: !0 });
|
|
62
62
|
function X() {
|
|
@@ -96,16 +96,16 @@ const ze = { class: "cd-ps-container" }, Te = {
|
|
|
96
96
|
r.value = r.value.filter((e) => e !== l), I.value.delete(l);
|
|
97
97
|
}
|
|
98
98
|
const $ = () => {
|
|
99
|
-
|
|
99
|
+
P.value = "";
|
|
100
100
|
}, O = (l) => {
|
|
101
101
|
const e = {};
|
|
102
102
|
d.tabs.forEach((o) => {
|
|
103
103
|
e[o.key] = [];
|
|
104
|
-
}),
|
|
104
|
+
}), D.value = e, V("org-change", l);
|
|
105
105
|
};
|
|
106
106
|
let n = null;
|
|
107
107
|
const ie = () => {
|
|
108
|
-
if (n && clearTimeout(n), !
|
|
108
|
+
if (n && clearTimeout(n), !P.value.trim()) {
|
|
109
109
|
de();
|
|
110
110
|
return;
|
|
111
111
|
}
|
|
@@ -115,9 +115,9 @@ const ze = { class: "cd-ps-container" }, Te = {
|
|
|
115
115
|
const l = (e) => {
|
|
116
116
|
E.value = e.map((o) => ({ ...o, isUser: !0 })), M.value = !1;
|
|
117
117
|
};
|
|
118
|
-
V("search", { keyword:
|
|
118
|
+
V("search", { keyword: P.value, orgId: U.value || void 0, callback: l });
|
|
119
119
|
}, de = () => {
|
|
120
|
-
n && (clearTimeout(n), n = null), q.value = !1,
|
|
120
|
+
n && (clearTimeout(n), n = null), q.value = !1, P.value = "", E.value = [], M.value = !1;
|
|
121
121
|
}, be = (l) => {
|
|
122
122
|
r.value.indexOf(l.id) > -1 ? v(l.id) : (d.multiple || (r.value = [], I.value.clear()), c(l.id, { ...l, isUser: !0, typeName: "搜索结果", orgId: U.value }), d.multiple || ce());
|
|
123
123
|
};
|
|
@@ -143,7 +143,7 @@ const ze = { class: "cd-ps-container" }, Te = {
|
|
|
143
143
|
return;
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
|
-
const p =
|
|
146
|
+
const p = D.value[S.value] || [], m = Ce(p), R = r.value.filter((w) => !m.includes(w));
|
|
147
147
|
r.value = [...R, ...l];
|
|
148
148
|
};
|
|
149
149
|
function re(l, e, o) {
|
|
@@ -162,7 +162,7 @@ const ze = { class: "cd-ps-container" }, Te = {
|
|
|
162
162
|
const k = R.map((w) => {
|
|
163
163
|
const { id: Z, name: W, ...G } = w;
|
|
164
164
|
return { ...G, id: Z, name: w.displayName || W, isUser: !0 };
|
|
165
|
-
}), T =
|
|
165
|
+
}), T = D.value[e];
|
|
166
166
|
if (T && re(T, o, k), p) {
|
|
167
167
|
p.appendTo(o, k), l.data.loaded = !0, await xe();
|
|
168
168
|
try {
|
|
@@ -172,7 +172,7 @@ const ze = { class: "cd-ps-container" }, Te = {
|
|
|
172
172
|
}
|
|
173
173
|
} else {
|
|
174
174
|
l.data.loaded = !0;
|
|
175
|
-
const k =
|
|
175
|
+
const k = D.value[e];
|
|
176
176
|
if (k) {
|
|
177
177
|
const T = Y(k, o);
|
|
178
178
|
T && (T.loaded = !0);
|
|
@@ -203,9 +203,9 @@ const ze = { class: "cd-ps-container" }, Te = {
|
|
|
203
203
|
}
|
|
204
204
|
}), (l, e) => {
|
|
205
205
|
const o = N("t-option"), p = N("t-select"), m = N("t-icon"), R = N("t-input"), k = N("t-button"), T = N("t-loading"), w = N("t-checkbox"), Z = N("t-tree"), W = N("t-tab-panel"), G = N("t-tabs"), ue = N("t-dialog");
|
|
206
|
-
return
|
|
206
|
+
return a(), L(ue, {
|
|
207
207
|
visible: x.value,
|
|
208
|
-
"onUpdate:visible": e[4] || (e[4] = (
|
|
208
|
+
"onUpdate:visible": e[4] || (e[4] = (s) => x.value = s),
|
|
209
209
|
header: "选择人员",
|
|
210
210
|
width: ne.value,
|
|
211
211
|
footer: !0,
|
|
@@ -216,20 +216,20 @@ const ze = { class: "cd-ps-container" }, Te = {
|
|
|
216
216
|
}, {
|
|
217
217
|
default: z(() => [
|
|
218
218
|
u("div", ze, [
|
|
219
|
-
|
|
220
|
-
|
|
219
|
+
se.value ? (a(), i("div", Te, [
|
|
220
|
+
ae.value && B.value.length > 0 ? (a(), i("div", we, [
|
|
221
221
|
b(p, {
|
|
222
222
|
modelValue: U.value,
|
|
223
|
-
"onUpdate:modelValue": e[0] || (e[0] = (
|
|
223
|
+
"onUpdate:modelValue": e[0] || (e[0] = (s) => U.value = s),
|
|
224
224
|
placeholder: "选择组织",
|
|
225
225
|
style: { width: "200px" },
|
|
226
226
|
onChange: O
|
|
227
227
|
}, {
|
|
228
228
|
default: z(() => [
|
|
229
|
-
(
|
|
230
|
-
key:
|
|
231
|
-
value:
|
|
232
|
-
label:
|
|
229
|
+
(a(!0), i(H, null, Q(B.value, (s) => (a(), L(o, {
|
|
230
|
+
key: s.id,
|
|
231
|
+
value: s.id,
|
|
232
|
+
label: s.displayName || s.name
|
|
233
233
|
}, null, 8, ["value", "label"]))), 128))
|
|
234
234
|
]),
|
|
235
235
|
_: 1
|
|
@@ -237,8 +237,8 @@ const ze = { class: "cd-ps-container" }, Te = {
|
|
|
237
237
|
])) : _("", !0),
|
|
238
238
|
u("div", $e, [
|
|
239
239
|
b(R, {
|
|
240
|
-
modelValue:
|
|
241
|
-
"onUpdate:modelValue": e[1] || (e[1] = (
|
|
240
|
+
modelValue: P.value,
|
|
241
|
+
"onUpdate:modelValue": e[1] || (e[1] = (s) => P.value = s),
|
|
242
242
|
placeholder: "输入手机号/工号/姓名/部门/职位搜索",
|
|
243
243
|
clearable: "",
|
|
244
244
|
onInput: ie,
|
|
@@ -251,9 +251,9 @@ const ze = { class: "cd-ps-container" }, Te = {
|
|
|
251
251
|
}, 8, ["modelValue"])
|
|
252
252
|
])
|
|
253
253
|
])) : _("", !0),
|
|
254
|
-
u("div",
|
|
255
|
-
u("div",
|
|
256
|
-
q.value ? (
|
|
254
|
+
u("div", Pe, [
|
|
255
|
+
u("div", Be, [
|
|
256
|
+
q.value ? (a(), i("div", De, [
|
|
257
257
|
u("div", Oe, [
|
|
258
258
|
e[6] || (e[6] = u("span", null, "搜索结果", -1)),
|
|
259
259
|
b(k, {
|
|
@@ -267,24 +267,24 @@ const ze = { class: "cd-ps-container" }, Te = {
|
|
|
267
267
|
_: 1
|
|
268
268
|
})
|
|
269
269
|
]),
|
|
270
|
-
M.value ? (
|
|
270
|
+
M.value ? (a(), i("div", Re, [
|
|
271
271
|
b(T),
|
|
272
272
|
e[7] || (e[7] = u("span", null, "搜索中...", -1))
|
|
273
|
-
])) : E.value.length === 0 ? (
|
|
273
|
+
])) : E.value.length === 0 ? (a(), i("div", Le, [
|
|
274
274
|
b(m, {
|
|
275
275
|
name: "search",
|
|
276
276
|
size: "48px",
|
|
277
277
|
style: { color: "#ddd" }
|
|
278
278
|
}),
|
|
279
279
|
e[8] || (e[8] = u("p", null, "未找到匹配的人员", -1))
|
|
280
|
-
])) : (
|
|
281
|
-
(
|
|
282
|
-
key:
|
|
283
|
-
class: te(["cd-ps-result-item", { "cd-ps-selected": r.value.includes(
|
|
284
|
-
onClick: (K) => be(
|
|
280
|
+
])) : (a(), i("div", Me, [
|
|
281
|
+
(a(!0), i(H, null, Q(E.value, (s) => (a(), i("div", {
|
|
282
|
+
key: s.id,
|
|
283
|
+
class: te(["cd-ps-result-item", { "cd-ps-selected": r.value.includes(s.id) }]),
|
|
284
|
+
onClick: (K) => be(s)
|
|
285
285
|
}, [
|
|
286
286
|
b(w, {
|
|
287
|
-
checked: r.value.includes(
|
|
287
|
+
checked: r.value.includes(s.id),
|
|
288
288
|
onClick: e[2] || (e[2] = me(() => {
|
|
289
289
|
}, ["stop"]))
|
|
290
290
|
}, null, 8, ["checked"]),
|
|
@@ -292,36 +292,36 @@ const ze = { class: "cd-ps-container" }, Te = {
|
|
|
292
292
|
b(m, { name: "user" })
|
|
293
293
|
]),
|
|
294
294
|
u("div", We, [
|
|
295
|
-
u("div", Je, h(
|
|
295
|
+
u("div", Je, h(s.displayName || s.name), 1),
|
|
296
296
|
u("div", je, [
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
297
|
+
s.position ? (a(), i("span", Fe, h(s.position), 1)) : _("", !0),
|
|
298
|
+
s.department ? (a(), i("span", qe, h(s.department), 1)) : _("", !0),
|
|
299
|
+
s.phone ? (a(), i("span", Ge, h(s.phone), 1)) : _("", !0)
|
|
300
300
|
])
|
|
301
301
|
])
|
|
302
302
|
], 10, Ee))), 128))
|
|
303
303
|
]))
|
|
304
|
-
])) : (
|
|
304
|
+
])) : (a(), L(G, {
|
|
305
305
|
key: 1,
|
|
306
306
|
modelValue: S.value,
|
|
307
|
-
"onUpdate:modelValue": e[3] || (e[3] = (
|
|
307
|
+
"onUpdate:modelValue": e[3] || (e[3] = (s) => S.value = s),
|
|
308
308
|
onChange: $
|
|
309
309
|
}, {
|
|
310
310
|
default: z(() => [
|
|
311
|
-
(
|
|
312
|
-
key:
|
|
313
|
-
value:
|
|
314
|
-
label:
|
|
311
|
+
(a(!0), i(H, null, Q(le.value, (s) => (a(), L(W, {
|
|
312
|
+
key: s.key,
|
|
313
|
+
value: s.key,
|
|
314
|
+
label: s.name
|
|
315
315
|
}, {
|
|
316
316
|
default: z(() => {
|
|
317
317
|
var K;
|
|
318
318
|
return [
|
|
319
319
|
u("div", He, [
|
|
320
|
-
((K =
|
|
320
|
+
((K = D.value[s.key]) == null ? void 0 : K.length) > 0 ? (a(), L(Z, {
|
|
321
321
|
key: 0,
|
|
322
322
|
ref_for: !0,
|
|
323
|
-
ref: (y) => oe(
|
|
324
|
-
data:
|
|
323
|
+
ref: (y) => oe(s.key, y),
|
|
324
|
+
data: D.value[s.key],
|
|
325
325
|
keys: { value: "id", label: "name", children: "children" },
|
|
326
326
|
hover: "",
|
|
327
327
|
checkable: "",
|
|
@@ -336,19 +336,19 @@ const ze = { class: "cd-ps-container" }, Te = {
|
|
|
336
336
|
class: te(["cd-ps-node", { "cd-ps-node-user": y.data.isUser }])
|
|
337
337
|
}, [
|
|
338
338
|
b(m, {
|
|
339
|
-
name: y.data.isUser ? "user" :
|
|
339
|
+
name: y.data.isUser ? "user" : s.icon || "folder"
|
|
340
340
|
}, null, 8, ["name"]),
|
|
341
341
|
u("span", Qe, [
|
|
342
342
|
ee(h(y.label) + " ", 1),
|
|
343
|
-
y.data.isUser && y.data.position ? (
|
|
343
|
+
y.data.isUser && y.data.position ? (a(), i("span", Xe, h(y.data.position), 1)) : _("", !0)
|
|
344
344
|
]),
|
|
345
|
-
y.data.userCount && !y.data.isUser ? (
|
|
346
|
-
!y.data.isUser && !((fe = y.data.children) != null && fe.length) && !y.data.loaded ? (
|
|
345
|
+
y.data.userCount && !y.data.isUser ? (a(), i("span", Ye, "(" + h(y.data.userCount) + ")", 1)) : _("", !0),
|
|
346
|
+
!y.data.isUser && !((fe = y.data.children) != null && fe.length) && !y.data.loaded ? (a(), L(k, {
|
|
347
347
|
key: 1,
|
|
348
348
|
size: "small",
|
|
349
349
|
variant: "text",
|
|
350
350
|
class: "cd-ps-load-btn",
|
|
351
|
-
onClick: me((xt) => Se(y,
|
|
351
|
+
onClick: me((xt) => Se(y, s.key), ["stop"])
|
|
352
352
|
}, {
|
|
353
353
|
default: z(() => [...e[9] || (e[9] = [
|
|
354
354
|
ee("显示人员", -1)
|
|
@@ -359,9 +359,9 @@ const ze = { class: "cd-ps-container" }, Te = {
|
|
|
359
359
|
];
|
|
360
360
|
}),
|
|
361
361
|
_: 2
|
|
362
|
-
}, 1032, ["data", "value"])) : (
|
|
362
|
+
}, 1032, ["data", "value"])) : (a(), i("div", Ze, [
|
|
363
363
|
b(m, {
|
|
364
|
-
name:
|
|
364
|
+
name: s.icon || "folder-open",
|
|
365
365
|
size: "48px",
|
|
366
366
|
style: { color: "#ddd" }
|
|
367
367
|
}, null, 8, ["name"]),
|
|
@@ -380,7 +380,7 @@ const ze = { class: "cd-ps-container" }, Te = {
|
|
|
380
380
|
u("div", et, [
|
|
381
381
|
e[12] || (e[12] = u("span", { class: "cd-ps-title" }, "已选择", -1)),
|
|
382
382
|
u("span", tt, h(t.value.length) + " 项", 1),
|
|
383
|
-
t.value.length > 0 ? (
|
|
383
|
+
t.value.length > 0 ? (a(), L(k, {
|
|
384
384
|
key: 0,
|
|
385
385
|
size: "small",
|
|
386
386
|
variant: "text",
|
|
@@ -393,33 +393,33 @@ const ze = { class: "cd-ps-container" }, Te = {
|
|
|
393
393
|
})) : _("", !0)
|
|
394
394
|
]),
|
|
395
395
|
u("div", lt, [
|
|
396
|
-
t.value.length === 0 ? (
|
|
396
|
+
t.value.length === 0 ? (a(), i("div", st, [
|
|
397
397
|
b(m, {
|
|
398
398
|
name: "user-checked",
|
|
399
399
|
size: "64px",
|
|
400
400
|
style: { color: "#ddd" }
|
|
401
401
|
}),
|
|
402
402
|
e[13] || (e[13] = u("p", null, "暂无选择", -1))
|
|
403
|
-
])) : (
|
|
404
|
-
(
|
|
405
|
-
key:
|
|
406
|
-
class: te(["cd-ps-selected-item", { "cd-ps-dept-item": !
|
|
403
|
+
])) : (a(), i("div", at, [
|
|
404
|
+
(a(!0), i(H, null, Q(t.value, (s) => (a(), i("div", {
|
|
405
|
+
key: s.id,
|
|
406
|
+
class: te(["cd-ps-selected-item", { "cd-ps-dept-item": !s.isUser }])
|
|
407
407
|
}, [
|
|
408
408
|
u("div", nt, [
|
|
409
409
|
u("div", {
|
|
410
|
-
class: te(["cd-ps-avatar", { "cd-ps-avatar-dept": !
|
|
410
|
+
class: te(["cd-ps-avatar", { "cd-ps-avatar-dept": !s.isUser }])
|
|
411
411
|
}, [
|
|
412
412
|
b(m, {
|
|
413
|
-
name:
|
|
413
|
+
name: s.isUser ? "user" : "folder"
|
|
414
414
|
}, null, 8, ["name"])
|
|
415
415
|
], 2),
|
|
416
416
|
u("div", ot, [
|
|
417
|
-
u("div", it, h(
|
|
417
|
+
u("div", it, h(s.displayName || s.name), 1),
|
|
418
418
|
u("div", dt, [
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
!
|
|
419
|
+
s.isUser && s.position ? (a(), i("span", ct, h(s.position), 1)) : _("", !0),
|
|
420
|
+
s.isUser && s.department ? (a(), i("span", ut, h(s.department), 1)) : _("", !0),
|
|
421
|
+
s.isUser ? _("", !0) : (a(), i("span", rt, h(s.typeName || "部门"), 1)),
|
|
422
|
+
!s.isUser && s.userCount ? (a(), i("span", pt, h(s.userCount) + "人", 1)) : _("", !0)
|
|
423
423
|
])
|
|
424
424
|
])
|
|
425
425
|
]),
|
|
@@ -427,7 +427,7 @@ const ze = { class: "cd-ps-container" }, Te = {
|
|
|
427
427
|
size: "small",
|
|
428
428
|
variant: "text",
|
|
429
429
|
shape: "circle",
|
|
430
|
-
onClick: (K) => Ue(
|
|
430
|
+
onClick: (K) => Ue(s.id)
|
|
431
431
|
}, {
|
|
432
432
|
icon: z(() => [
|
|
433
433
|
b(m, { name: "close" })
|
|
@@ -480,7 +480,7 @@ const ze = { class: "cd-ps-container" }, Te = {
|
|
|
480
480
|
},
|
|
481
481
|
emits: ["update:modelValue", "search", "load-users"],
|
|
482
482
|
setup(g, { emit: j }) {
|
|
483
|
-
const C = g, d = j, V = f(!1), x = f([]), S = f(!1), U = f([]),
|
|
483
|
+
const C = g, d = j, V = f(!1), x = f([]), S = f(!1), U = f([]), P = f([]), r = f(!1), I = f(""), F = (t) => t ? t.substring(0, 2).toUpperCase() : "", q = (t) => {
|
|
484
484
|
const c = ["#1890ff", "#52c41a", "#faad14", "#f5222d", "#722ed1", "#13c2c2", "#eb2f96", "#fa8c16"];
|
|
485
485
|
let v = 0;
|
|
486
486
|
for (let $ = 0; $ < t.length; $++)
|
|
@@ -494,33 +494,33 @@ const ze = { class: "cd-ps-container" }, Te = {
|
|
|
494
494
|
position: t.position || "",
|
|
495
495
|
phone: t.phone || "",
|
|
496
496
|
isUser: t.isUser !== !1
|
|
497
|
-
}),
|
|
498
|
-
d("update:modelValue", t),
|
|
499
|
-
},
|
|
497
|
+
}), B = (t) => {
|
|
498
|
+
d("update:modelValue", t), P.value = t;
|
|
499
|
+
}, se = (t) => {
|
|
500
500
|
t || (x.value = [], I.value = "");
|
|
501
|
-
},
|
|
502
|
-
t ? C.multiple ?
|
|
501
|
+
}, ae = (t, c) => {
|
|
502
|
+
t ? C.multiple ? B([...C.modelValue, c]) : (B([c]), r.value = !1) : B(C.modelValue.filter((v) => v.id !== c.id));
|
|
503
503
|
}, ne = (t, c) => {
|
|
504
504
|
const { trigger: v, index: $ } = c;
|
|
505
505
|
if ((v === "tag-remove" || v === "backspace") && (r.value = !1), v === "clear")
|
|
506
|
-
U.value = [],
|
|
506
|
+
U.value = [], B([]);
|
|
507
507
|
else if (["tag-remove", "backspace"].includes(v)) {
|
|
508
508
|
U.value = t;
|
|
509
509
|
const O = [...C.modelValue];
|
|
510
|
-
O.splice($, 1),
|
|
510
|
+
O.splice($, 1), B(O);
|
|
511
511
|
}
|
|
512
|
-
},
|
|
512
|
+
}, D = (t) => {
|
|
513
513
|
t.stopPropagation(), t.preventDefault(), r.value = !1, S.value = !0;
|
|
514
514
|
}, X = (t) => {
|
|
515
515
|
const c = t.map(le), v = new Set(C.modelValue.map((n) => n.id)), $ = c.filter((n) => !v.has(n.id)), O = C.multiple ? [...C.modelValue, ...$] : c.slice(0, 1);
|
|
516
|
-
|
|
516
|
+
B(O), S.value = !1;
|
|
517
517
|
}, oe = (t) => {
|
|
518
518
|
d("load-users", t);
|
|
519
519
|
}, Y = (t) => {
|
|
520
520
|
d("search", { keyword: t.keyword, callback: t.callback });
|
|
521
521
|
};
|
|
522
522
|
return J(() => C.modelValue, (t) => {
|
|
523
|
-
U.value = t.map((c) => c.id),
|
|
523
|
+
U.value = t.map((c) => c.id), P.value = t;
|
|
524
524
|
}, { immediate: !0, deep: !0 }), J(I, (t) => {
|
|
525
525
|
if (!(t != null && t.trim())) {
|
|
526
526
|
x.value = [], V.value = !1;
|
|
@@ -535,7 +535,7 @@ const ze = { class: "cd-ps-container" }, Te = {
|
|
|
535
535
|
}), (t, c) => {
|
|
536
536
|
var O;
|
|
537
537
|
const v = N("t-checkbox"), $ = N("t-select-input");
|
|
538
|
-
return
|
|
538
|
+
return a(), i("div", ht, [
|
|
539
539
|
b($, {
|
|
540
540
|
value: U.value,
|
|
541
541
|
inputValue: I.value,
|
|
@@ -559,26 +559,26 @@ const ze = { class: "cd-ps-container" }, Te = {
|
|
|
559
559
|
clearable: "",
|
|
560
560
|
multiple: g.multiple,
|
|
561
561
|
class: "cd-input-select__select",
|
|
562
|
-
onPopupVisibleChange:
|
|
562
|
+
onPopupVisibleChange: se,
|
|
563
563
|
onTagChange: ne
|
|
564
564
|
}, {
|
|
565
565
|
panel: z(() => [
|
|
566
|
-
x.value.length > 0 ? (
|
|
567
|
-
(
|
|
566
|
+
x.value.length > 0 ? (a(), i("div", ft, [
|
|
567
|
+
(a(!0), i(H, null, Q(x.value, (n) => (a(), L(v, {
|
|
568
568
|
key: n.id,
|
|
569
569
|
value: n.id,
|
|
570
570
|
checked: E(n.id),
|
|
571
571
|
class: "cd-input-select__option",
|
|
572
|
-
onChange: (ie) =>
|
|
572
|
+
onChange: (ie) => ae(ie, n)
|
|
573
573
|
}, {
|
|
574
574
|
default: z(() => [
|
|
575
575
|
u("div", mt, [
|
|
576
|
-
n.avatar ? (
|
|
576
|
+
n.avatar ? (a(), i("div", _t, [
|
|
577
577
|
u("img", {
|
|
578
578
|
src: n.avatar,
|
|
579
579
|
alt: n.name
|
|
580
580
|
}, null, 8, gt)
|
|
581
|
-
])) : (
|
|
581
|
+
])) : (a(), i("div", {
|
|
582
582
|
key: 1,
|
|
583
583
|
class: "cd-input-select__option-avatar cd-input-select__option-avatar--placeholder",
|
|
584
584
|
style: Ne({
|
|
@@ -588,24 +588,24 @@ const ze = { class: "cd-ps-container" }, Te = {
|
|
|
588
588
|
}, h(F(n.name)), 5)),
|
|
589
589
|
u("div", kt, [
|
|
590
590
|
u("div", yt, h(n.name), 1),
|
|
591
|
-
n.department || n.position ? (
|
|
591
|
+
n.department || n.position ? (a(), i("div", bt, h(n.department) + h(n.department && n.position ? " · " : "") + h(n.position), 1)) : _("", !0)
|
|
592
592
|
]),
|
|
593
|
-
M(n.id) ? (
|
|
593
|
+
M(n.id) ? (a(), i("i", Ct)) : _("", !0)
|
|
594
594
|
])
|
|
595
595
|
]),
|
|
596
596
|
_: 2
|
|
597
597
|
}, 1032, ["value", "checked", "onChange"]))), 128))
|
|
598
|
-
])) : V.value ? (
|
|
598
|
+
])) : V.value ? (a(), i("div", Vt, " 搜索中... ")) : (a(), i("div", St, " 暂无搜索结果 "))
|
|
599
599
|
]),
|
|
600
600
|
suffixIcon: z(() => [
|
|
601
601
|
u("i", {
|
|
602
602
|
class: "ri-add-circle-line cd-input-select__add-icon",
|
|
603
|
-
onClick:
|
|
603
|
+
onClick: D
|
|
604
604
|
})
|
|
605
605
|
]),
|
|
606
606
|
_: 1
|
|
607
607
|
}, 8, ["value", "inputValue", "popup-visible", "placeholder", "loading", "multiple"]),
|
|
608
|
-
(O = g.tabs) != null && O.length && S.value ? (
|
|
608
|
+
(O = g.tabs) != null && O.length && S.value ? (a(), L(ke, {
|
|
609
609
|
key: 0,
|
|
610
610
|
visible: S.value,
|
|
611
611
|
"onUpdate:visible": c[2] || (c[2] = (n) => S.value = n),
|
|
@@ -630,6 +630,7 @@ const ze = { class: "cd-ps-container" }, Te = {
|
|
|
630
630
|
}
|
|
631
631
|
};
|
|
632
632
|
export {
|
|
633
|
+
It as CdInputPersonSelector,
|
|
633
634
|
It as InputSelect,
|
|
634
635
|
ke as PersonSelector,
|
|
635
636
|
zt as default
|