cnhis-design-vue 3.2.6-release.0 → 3.2.6-release.1
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/es/components/callback/src/components/render/popupMaps.d.ts +6 -2
- package/es/components/expand-field/index.d.ts +1109 -321
- package/es/components/expand-field/src/components/FormItemPerson.vue.d.ts +1109 -321
- package/es/components/expand-field/src/components/PersonModal.vue.d.ts +1109 -321
- package/es/components/expand-field/src/components/form.vue.d.ts +1109 -321
- package/es/components/expand-field/src/index.vue.d.ts +1109 -321
- package/es/components/fabric-chart/src/hooks/temperature/useOther.js +1 -1
- package/es/components/field-set/src/FieldSet.vue.d.ts +1 -1
- package/es/components/form-config/index.d.ts +12 -4
- package/es/components/form-config/src/FormConfig.vue.d.ts +12 -4
- package/es/components/form-config/src/components/FormConfigCreator.vue.d.ts +6 -2
- package/es/components/form-config/src/components/FormConfigEdit.vue.d.ts +6 -2
- package/es/components/form-render/index.d.ts +6 -2
- package/es/components/form-render/src/FormRender.vue.d.ts +5 -1
- package/es/components/form-render/src/FormRender.vue2.js +1 -1
- package/es/components/form-render/src/FormRenderWrapper.vue.d.ts +6 -2
- package/es/components/form-render/src/FormRenderWrapper.vue2.js +1 -1
- package/es/components/form-render/src/hooks/useFormEvent.d.ts +1 -1
- package/es/components/form-render/src/types/index.d.ts +4 -1
- package/es/components/iho-chat/index.d.ts +57 -27
- package/es/components/iho-chat/src/Index.vue.d.ts +58 -27
- package/es/components/iho-chat/src/Index.vue2.js +1 -1
- package/es/components/iho-chat/src/api/index.js +1 -1
- package/es/components/iho-chat/src/components/ChatFile.vue.d.ts +1 -1
- package/es/components/iho-chat/src/components/ChatFooter.vue.d.ts +9 -26
- package/es/components/iho-chat/src/components/ChatFooter.vue2.js +1 -1
- package/es/components/iho-chat/src/components/ChatHeader.vue.d.ts +2 -2
- package/es/components/iho-chat/src/components/ChatMain.vue.d.ts +3 -2
- package/es/components/iho-chat/src/components/ChatMain.vue2.js +1 -1
- package/es/components/iho-chat/src/components/ChatRecord.vue.d.ts +1 -1
- package/es/components/iho-chat/src/components/ChatSearch.vue.d.ts +10 -3
- package/es/components/iho-chat/src/components/ChatSearch.vue2.js +1 -1
- package/es/components/iho-chat/src/components/SiderList.vue2.js +1 -1
- package/es/components/iho-chat/src/components/Video.vue.d.ts +30 -25
- package/es/components/iho-chat/src/components/Video.vue.js +1 -0
- package/es/components/iho-chat/src/components/Video.vue2.js +1 -0
- package/es/components/iho-chat/src/hooks/useSession.js +1 -1
- package/es/components/iho-chat/src/types/index.d.ts +2 -0
- package/es/components/iho-chat/src/utils/index.d.ts +1 -1
- package/es/components/iho-chat/src/utils/index.js +1 -1
- package/es/components/iho-chat/style/index.css +1 -1
- package/es/components/index.css +1 -1
- package/es/components/info-header/index.d.ts +12 -4
- package/es/components/info-header/src/InfoHeader.vue.d.ts +12 -4
- package/es/components/info-header/src/components/infoDescription/index.vue.d.ts +6 -2
- package/es/components/info-header/src/components/patientInfo/index.vue.d.ts +6 -2
- package/es/components/recommend-search/index.d.ts +8 -8
- package/es/components/recommend-search/src/RecommendSearch.vue.d.ts +8 -8
- package/es/components/recommend-search/src/components/BaseSearch.d.ts +1 -1
- package/es/components/recommend-search/src/components/RecommendInput.vue.d.ts +3 -3
- package/es/components/recommend-search/src/components/RecommendSelect.vue.d.ts +3 -3
- package/es/components/select-person/index.d.ts +1109 -321
- package/es/components/select-person/index.js +1 -1
- package/es/components/select-person/src/SelectPerson.vue.d.ts +4 -10
- package/es/components/select-person/src/SelectPerson.vue2.js +1 -1
- package/es/components/select-person/src/SelectPersonType.vue.d.ts +314 -0
- package/es/components/select-person/src/SelectPersonType.vue.js +1 -0
- package/es/components/select-person/src/SelectPersonType.vue2.js +1 -0
- package/es/components/select-person/src/components/SearchMultiple.vue.js +1 -0
- package/es/components/select-person/src/components/SearchOrgAndStaff.vue.js +1 -0
- package/es/components/select-person/src/constants/index.d.ts +2 -0
- package/es/components/select-person/src/constants/index.js +1 -0
- package/es/components/select-person/src/index.vue.d.ts +1385 -0
- package/es/components/select-person/src/index.vue.js +1 -0
- package/es/components/select-person/src/index.vue2.js +1 -0
- package/es/components/shortcut-setter/index.d.ts +6 -2
- package/es/components/shortcut-setter/src/ShortcutSetter.vue.d.ts +6 -2
- package/es/shared/hooks/useAsyncQueue/index.d.ts +3 -0
- package/es/shared/hooks/useAsyncQueue/index.js +1 -1
- package/es/shared/package.json.js +1 -1
- package/package.json +2 -2
- package/es/components/select-person/src/SearchMultiple.vue.js +0 -1
- package/es/components/select-person/src/SearchOrgAndStaff.vue.js +0 -1
- /package/es/components/select-person/src/{SearchMultiple.vue.d.ts → components/SearchMultiple.vue.d.ts} +0 -0
- /package/es/components/select-person/src/{SearchMultiple.vue2.js → components/SearchMultiple.vue2.js} +0 -0
- /package/es/components/select-person/src/{SearchOrgAndStaff.vue.d.ts → components/SearchOrgAndStaff.vue.d.ts} +0 -0
- /package/es/components/select-person/src/{SearchOrgAndStaff.vue2.js → components/SearchOrgAndStaff.vue2.js} +0 -0
@@ -1 +1 @@
|
|
1
|
-
import{COMPONENT_NAMESPACE as
|
1
|
+
import{COMPONENT_NAMESPACE as r}from"../../shared/global/variable.js";import{safeComponentRegister as e}from"../../shared/utils/index.js";import o from"./src/index.vue.js";const s=o;s.install=function(o){e(o,s,r+"SelectPerson")};export{s as default};
|
@@ -180,11 +180,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
180
180
|
children: string;
|
181
181
|
};
|
182
182
|
};
|
183
|
-
}>> & {
|
184
|
-
|
185
|
-
onCheckWithLevel?: ((...args: any[]) => any) | undefined;
|
186
|
-
}>>;
|
187
|
-
emit: (event: "check" | "checkWithLevel", ...args: any[]) => void;
|
183
|
+
}>> & {}>>;
|
184
|
+
emit: any;
|
188
185
|
keyword: import("vue").Ref<string>;
|
189
186
|
checkedAll: import("vue").Ref<boolean>;
|
190
187
|
checkedKeys: import("vue").Ref<IKey[]>;
|
@@ -503,7 +500,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
503
500
|
checkedKeys: (string | number)[];
|
504
501
|
isMultiple: boolean;
|
505
502
|
}>;
|
506
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
503
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
507
504
|
defaultList: {
|
508
505
|
type: PropType<(IKey | ITag)[]>;
|
509
506
|
default: () => never[];
|
@@ -576,10 +573,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
576
573
|
children: string;
|
577
574
|
};
|
578
575
|
};
|
579
|
-
}
|
580
|
-
onCheck?: ((...args: any[]) => any) | undefined;
|
581
|
-
onCheckWithLevel?: ((...args: any[]) => any) | undefined;
|
582
|
-
}, {
|
576
|
+
}>>, {
|
583
577
|
data: ITreeOption[];
|
584
578
|
defaultList: (IKey | ITag)[];
|
585
579
|
searchPlaceholder: string;
|
@@ -1 +1 @@
|
|
1
|
-
import{defineComponent as e,ref as l,computed as t,reactive as n,watch as a,openBlock as i,createBlock as u,unref as r,withCtx as o,createVNode as c,createCommentVNode as s,withKeys as d,createTextVNode as p,toDisplayString as v,createElementBlock as h,Fragment as y,renderList as f,withDirectives as k,vShow as m,mergeProps as b,createElementVNode as g,renderSlot as _}from"vue";import{NGrid as T,NGi as w,NSpace as S,NInputGroup as C,NInput as x,NIcon as L,NButton as j,NTag as F,NCheckbox as O,NEmpty as D,NTree as E}from"naive-ui";import{CloseCircleSharp as N}from"@vicons/ionicons5";import{searchFilterTree as I,getExpandedKeys as P}from"./utils/index.js";import{cloneDeep as $}from"lodash-es";import{SelectItemTypesConfig as R,SelectRoleEnumsConfig as A,SearchTypeConfig as B}from"./types/enums.js";import K from"./SearchMultiple.vue.js";import U from"./SearchOrgAndStaff.vue.js";const q={key:0,class:"select-type-tags"},W={key:4,class:"tree-content"},H={key:0},M={class:"c-select-person__scroll",style:{height:"342px"}};var G=e({__name:"SelectPerson",props:{defaultList:{type:Array,default:()=>[]},data:{type:Array,default:()=>[]},searchPlaceholder:{type:String,default:"输入关键字搜索"},searchButtonText:{type:String,default:"搜索"},wordbook:{type:Object,default:()=>({})},wordbookChild:{type:Object,default:()=>({})},showCount:{type:Boolean,default:!0},showClear:{type:Boolean,default:!0},multiple:{type:Boolean,default:!0},searchInner:{type:Boolean,default:!1},searchFilter:{type:Object,default:()=>({})},treeSetting:{type:Object,default:()=>({})},queryLoadChildData:{type:Function,default:void 0},queryTreeSearch:{type:Function,default:()=>Promise.resolve([])},showSelectType:{type:Boolean,default:!1},roleData:{type:Array,default:()=>[]},roleFields:{type:Object,default:()=>({label:"name",key:"id",children:"children"})}},emits:["check","checkWithLevel"],setup(e,{expose:G,emit:z}){const J=e,Q={isOpen:!1,multiple:!1,customTitles:["联系人","部门"],itemHeight:250},V=[{key:"main",label:"选人员"},{key:"dept",label:"选科室"},{key:"role",label:"选角色"}],X={dept:"科室",role:"角色"},Y=l(""),Z=l(!1),ee=l([]),le=l([]),te=l([]),ne=l([]),ae=l([]),ie=l(!1),ue=$(function e(l){var t;for(let n=0,a=l.length;n<a;n++){const a=l[n],i=J.wordbook.children||"children";if(null==(t=a[i])?void 0:t.length){const l=De(a[i],[]);a.innerItemsNum=l.length,a.innerLeafs=l,a.children=e(a[i])}}return J.showSelectType?l:Ee(l,"")}(J.data)),re=l([]),oe=t((()=>!!J.queryLoadChildData)),ce=t((()=>{var e,l;return null!=(l=null==(e=null==J?void 0:J.treeSetting)?void 0:e.checkStrategy)?l:"child"})),se=t((()=>(null==J?void 0:J.searchFilter)&&Object.keys(null==J?void 0:J.searchFilter).length>0)),de=l("main"),pe=t((()=>se.value?{...$(Q),...J.searchFilter}:$(Q))),ve=t((()=>{var e,l;return null!=(l=null==(e=null==J?void 0:J.wordbookChild)?void 0:e.user_expand_keys)?l:[]})),he=t((()=>{if(J.showSelectType){return function(e,l){let t={};return e.reduce(((e,n)=>(!t[n[l]]&&(t[n[l]]=e.push(n)),e)),[])}([...ke.main.filter((e=>(e.itemType=R.PERSON,e[be.value]==A.STAFF))),...ke.dept.filter((e=>(e.itemType=R.DEPT,e[be.value]==A.DEPT))),...ke.role.filter((e=>(e.itemType=R.ROLE,e)))],"key")}let e=[];return ee.value.forEach((l=>{for(let t=0,n=ne.value.length;t<n;t++){const n=ne.value[t];if(n.key==l){e.push(n);break}}})),e})),ye=n({main:[],dept:[],role:[],temp:[]}),fe=n({main:[],dept:[],role:[]}),ke=n({main:[],dept:[],role:[]}),me=n({main:[],dept:[],role:[]}),be=t((()=>{var e;return(null==(e=J.wordbook)?void 0:e.type)||"type"})),ge=t((()=>J.wordbookChild.user_id_obj||J.wordbook.parent_id_obj||Date.now()));function _e(){ye.main=ye.temp=ue,Ce(ye.temp,null,(e=>{me.main.push(e.key)})),re.value=me.main,ye.dept=Te($(ue),(e=>{me.dept.push(e.key)})),ye.role=we($(J.roleData),(e=>{me.role.push(e.key)}))}function Te(e,l){return e.filter((e=>{var t;J.showSelectType&&(null==(t=e.children)?void 0:t.length)&&(e.children=Te(e.children,l));const n=e[be.value]==A.DEPT;return n&&xe(e,l),n}))}function we(e,l){const{label:t,key:n,children:a="children"}=J.roleFields;return e.map((e=>{var i;return e.key=e[n],e.label=e.title=e[t],(null==(i=e[a])?void 0:i.length)&&(e.children=we(e[a],l)),xe(e,l),e}))}function Se(e,l){var t,n;const a=["main","dept"].includes(l)?ge.value:null==(t=J.roleFields)?void 0:t.key;for(let t=0,i=e.length;t<i;t++){const i=e[t],u=ae.value.map((e=>e.key));fe[l].includes(i.key)&&!u.includes(i.key)&&ke[l].push({...i,key:i[a]}),(null==(n=i.children)?void 0:n.length)&&Se(i.children,l)}}function Ce(e,l,t){var n,a;for(let i=0,u=e.length;i<u;i++){const u=e[i];let r=ve.value.reduce(((e,l)=>e+(u[l]?`${u[l]},`:"")),"");u.title_expand_strs=r.slice(0,-1),u.title=Oe(u),u.label=Oe(u),u.parentNode=l,u.key||(u.key=u[J.wordbookChild.user_id_obj]||u[J.wordbook.parent_id_obj]||Date.now()),(null==(n=u.children)?void 0:n.length)?(Ce(u.children,u,t),je(u)):0===(null==(a=u.children)?void 0:a.length)&&Reflect.deleteProperty(u,"children"),xe(u,t)}}function xe(e,l){var t,n;switch(null!=(n=null==(t=null==J?void 0:J.treeSetting)?void 0:t.checkStrategy)?n:"child"){case"child":!function(e,l){e.disabled||e.children||!e.key||l&&l(e)}(e,l);break;case"parent":!function(e,l){e.disabled||e.tempTitle||!e.key||l&&l(e)}(e,l)}}async function Le(e){if(J.queryLoadChildData){const l=await J.queryLoadChildData(e);return l.children&&(l.children=l.children.map((e=>({...e,tempTitle:l.tempTitle?`${l.title}/${l.tempTitle}`:l.title})))),l}return e}function je(e){var l;(null==(l=e.children)?void 0:l.every((e=>e.disabled)))&&(e.disabled=!0)}function Fe({option:e}){var l,t;if((null==(l=e.children)?void 0:l.length)||oe.value&&!(null==e?void 0:e.isLeaf)){const l=J.wordbook.user_count_obj&&e[J.wordbook.user_count_obj]||"",t=l?`(${l})`:"",n=`${e.title}${t}`;return c("span",{title:n},[n])}{const l=null!=(t=e.title_expand_strs)?t:"";return c("p",{class:"user_item"},[c("span",{title:e.title},[e.title]),c("span",{class:"user_item_expand",title:l},[l])])}}function Oe(e){return e[J.wordbookChild.user_name_obj]||e[J.wordbook.parent_name_obj]||e.orgName||e.title||""}function De(e,l){var t;for(let n=0,a=e.length;n<a;n++){const a=e[n];(null==(t=a.children)?void 0:t.length)?De(a.children,l):!a.disabled&&l.push(a)}return l}function Ee(e,l){return e&&0!==e.length?e.map((e=>{var t;const n=Oe(e),a=l?`${n}/${l}`:n;return{...e,tempTitle:l,children:(null==(t=e.children)?void 0:t.length)?Ee(null==e?void 0:e.children,a):[]}})):[]}async function Ne(){var e,l;const t=null!=(l=null==(e=null==J?void 0:J.wordbook)?void 0:e.filter_key)?l:"keyword";if(ie.value=!!Y.value.trim(),oe.value)te.value=await J.queryTreeSearch(Y.value);else{const e=function(){const e={[B.SEARCH_ORG_STAFF]:se.value,[B.SEARCH_ORG]:J.searchInner},l=Object.keys(e).find((l=>e[l]));return null!=l?l:""}();te.value=I(e,ye.temp,Y.value,t)}le.value=te.value.length&&Y.value?P(te.value):[]}function Ie(e,l){var t,n;switch(null!=(n=null==(t=null==J?void 0:J.treeSetting)?void 0:t.checkStrategy)?n:"child"){case"child":!function(e,l){for(let t=0,n=e.length;t<n;t++){const n=e[t];if(!n.disabled&&(!n.children||n.isLeaf)&&(l&&!ee.value.includes(n.key)&&ee.value.push(n.key),!l)){const e=ee.value.findIndex((e=>e===n.key));ee.value.splice(e,1)}n.children&&Ie(n.children,l)}}(e,l);break;case"parent":!function(e,l){ee.value=[];for(let t=0,n=e.length;t<n;t++){const n=e[t];if(!n.disabled&&!n.tempTitle&&(l&&!ee.value.includes(n.key)&&ee.value.push(n.key),!l)){const e=ee.value.findIndex((e=>e===n.key));ee.value.splice(e,1)}}}(e,l)}}function Pe(e){Ie(te.value,e)}function $e(e){var l;for(let t=0,n=e.length;t<n;t++){const n=e[t],a=ae.value.map((e=>e.key));ee.value.includes(n.key)&&!a.includes(n.key)&&ne.value.push({key:n.key,name:n.title,parentName:n.tempTitle,innerItemsNum:n.innerItemsNum,innerLeafs:n.innerLeafs,originItem:n}),(null==(l=n.children)?void 0:l.length)&&$e(n.children)}}function Re(e){if(J.showSelectType){const l=de.value;ee.value=fe[l]=e}else ee.value=e}function Ae(){Object.keys(fe).forEach((e=>{fe[e]=ke[e]=[]})),ee.value=[]}function Be(e){ee.value=e}function Ke(){Y.value="",setTimeout((()=>{Ne()}))}return a((()=>J.data),(e=>{!function(){if(_e(),te.value=ye.temp,J.defaultList.length>0)if(oe.value)J.defaultList.forEach((e=>ee.value.push(e.key))),ne.value=$(J.defaultList),ae.value=$(J.defaultList);else{if(J.showSelectType){const e=de.value;return J.defaultList.forEach((e=>{e.itemType===R.PERSON&&(fe.main.push(e[ge.value]),ke.main.push(e)),e.itemType===R.DEPT&&(fe.dept.push(e[ge.value]),ke.dept.push(e)),e.itemType===R.ROLE&&(fe.role.push(e[J.roleFields.key]),ke.role.push(e))})),void(ee.value=fe[e])}J.defaultList.forEach((e=>ee.value.push(e))),$e(ye.temp)}}()}),{immediate:!0}),a((()=>ee),(e=>{if(J.showSelectType){const l=de.value;ke[l]=ae.value.filter((l=>e.value.includes(l.key))),Se(ye[l],l),J.showSelectType?Z.value=re.value.every((e=>ee.value.findIndex((l=>l===e))>-1)):Z.value=re.value.every((e=>ne.value.findIndex((l=>l.key===e))>-1));const t=he.value.map((e=>e.key));return z("check",t),void z("checkWithLevel",he.value)}ne.value=ae.value.filter((l=>e.value.includes(l.key))),$e(oe.value?te.value:ye.temp);const l=ne.value.filter((l=>e.value.includes(l.key)));z("check",e.value),z("checkWithLevel",l)}),{deep:!0}),a((()=>Y.value),(e=>{e||Ke()})),G({getCheckWithLevel:function(){var e;if(J.showSelectType)return null!=(e=he.value)?e:[];const l=ee.value,t=ne.value.filter((e=>l.includes(e.key)));return null!=t?t:[]}}),(l,t)=>(i(),u(r(T),{cols:2,class:"c-select-person"},{default:o((()=>[c(r(w),null,{default:o((()=>[c(r(S),{vertical:"",style:{"padding-right":"12px","border-right":"1px solid #e8e8e8"}},{default:o((()=>[c(r(C),{style:{"margin-bottom":"12px"}},{default:o((()=>[s(" clearable "),c(r(x),{class:"search-input",value:Y.value,"onUpdate:value":t[0]||(t[0]=e=>Y.value=e),placeholder:e.searchPlaceholder,onKeyup:d(Ne,["enter"])},{suffix:o((()=>[Y.value?(i(),u(r(L),{key:0,class:"search-clear",component:r(N),size:"16",onClick:Ke},null,8,["component"])):s("v-if",!0)])),_:1},8,["value","placeholder","onKeyup"]),c(r(j),{type:"primary",onClick:Ne},{default:o((()=>[p(v(e.searchButtonText),1)])),_:1})])),_:1}),e.showSelectType?(i(),h("div",q,[(i(),h(y,null,f(V,(e=>c(r(F),{round:"",checkable:"",checked:de.value===e.key,key:e.key,"onUpdate:checked":l=>function(e){de.value=e.key,te.value=ye.temp=ye[e.key],ee.value=fe[e.key],re.value=me[e.key]}(e)},{default:o((()=>[p(v(e.label),1)])),_:2},1032,["checked","onUpdate:checked"]))),64))])):s("v-if",!0),e.multiple&&!ie.value?k((i(),u(r(O),{key:1,checked:Z.value,"onUpdate:checked":[t[1]||(t[1]=e=>Z.value=e),Pe]},{default:o((()=>[p(" 全选 ")])),_:1},8,["checked"])),[[m,re.value.length<1e3]]):s("v-if",!0),s(" 支持选人 "),e.searchInner&&e.multiple&&ie.value&&"parent"===r(ce)?(i(),u(K,{key:2,treeData:te.value,checkedKeys:ee.value,onNotifyCheck:Be},null,8,["treeData","checkedKeys"])):r(se)&&ie.value&&"parent"===r(ce)?(i(),h(y,{key:3},[s(" 同时兼容选人和选部门 "),s(" v-else-if=\"isSearchFilter && multiple && isSearch && checkStrategyResult === 'parent'\" "),c(U,{treeData:te.value,checkedKeys:ee.value,searchFilter:r(pe),isMultiple:e.multiple,onNotifyCheck:Be,onNotifyClear:Ke},null,8,["treeData","checkedKeys","searchFilter","isMultiple"])],2112)):(i(),h("div",W,[0===te.value.length?(i(),u(r(D),{key:0,description:"暂无数据"})):(i(),u(r(E),b({key:1,"virtual-scroll":"",class:"c-select-person__scroll","checked-keys":ee.value,"expanded-keys":le.value,"onUpdate:expanded-keys":t[2]||(t[2]=e=>le.value=e),checkable:e.multiple,cascade:"","allow-checking-not-loaded":"",selectable:!e.multiple,"selected-keys":ee.value,"onUpdate:selected-keys":t[3]||(t[3]=e=>ee.value=e),data:te.value,"check-strategy":"child","render-label":Fe},e.treeSetting,{"onUpdate:checkedKeys":Re,onLoad:Le}),null,16,["checked-keys","expanded-keys","checkable","selectable","selected-keys","data"]))]))])),_:1})])),_:1}),c(r(w),null,{default:o((()=>[c(r(S),{vertical:"",style:{"padding-left":"12px"}},{default:o((()=>[c(r(S),{justify:"space-between",style:{"margin-bottom":"20px"}},{default:o((()=>[e.showCount?(i(),h("span",H,"已选择:"+v(r(he).length),1)):s("v-if",!0),e.showClear?(i(),h("span",{key:1,class:"c-select-person__clear-btn",onClick:Ae},"清空")):s("v-if",!0)])),_:1}),g("div",M,[(i(!0),h(y,null,f(r(he),(t=>(i(),h("span",{class:"c-select-person__tag-item",key:t.key},[s(" 标签插槽 "),_(l.$slots,"tag",{tag:t},(()=>[p(v(t.name)+" "+v(t.parentName?`(${t.parentName})`:"")+" "+v(t.innerItemsNum?`(${t.innerItemsNum}人)`:"")+" "+v(e.showSelectType&&X[t.itemType]?`(${X[t.itemType]})`:""),1)])),c(r(L),{class:"tag-close",component:r(N),onClick:e=>function(e){if(J.showSelectType){const l=e.itemType===R.PERSON?"main":e.itemType;return fe[l]=fe[l].filter((l=>l!==e.key)),ke[l]=ae.value.filter((e=>fe[l].includes(e.key))),Se(ye[l],l),void(de.value==l&&(ee.value=fe[l]))}ee.value=ee.value.filter((l=>l!==e.key))}(t)},null,8,["component","onClick"])])))),128))])])),_:3})])),_:3})])),_:3}))}});export{G as default};
|
1
|
+
import{defineComponent as e,inject as l,ref as t,computed as n,reactive as a,watch as i,openBlock as u,createBlock as r,unref as o,withCtx as c,createVNode as s,createCommentVNode as d,withKeys as p,createTextVNode as v,toDisplayString as h,createElementBlock as y,Fragment as f,renderList as k,withDirectives as m,vShow as b,mergeProps as g,createElementVNode as _,renderSlot as T}from"vue";import{NGrid as w,NGi as S,NSpace as x,NInputGroup as C,NInput as j,NIcon as L,NButton as F,NTag as O,NCheckbox as D,NEmpty as E,NTree as N}from"naive-ui";import{CloseCircleSharp as I}from"@vicons/ionicons5";import{searchFilterTree as P,getExpandedKeys as $}from"./utils/index.js";import{cloneDeep as R}from"lodash-es";import{SelectItemTypesConfig as A,SelectRoleEnumsConfig as B,SearchTypeConfig as K}from"./types/enums.js";import U from"./components/SearchMultiple.vue.js";import q from"./components/SearchOrgAndStaff.vue.js";import{InjectionSelectPersonEmits as H}from"./constants/index.js";const M={key:0,class:"select-type-tags"},W={key:4,class:"tree-content"},G={key:0},z={class:"c-select-person__scroll",style:{height:"342px"}};var J=e({__name:"SelectPerson",props:{defaultList:{type:Array,default:()=>[]},data:{type:Array,default:()=>[]},searchPlaceholder:{type:String,default:"输入关键字搜索"},searchButtonText:{type:String,default:"搜索"},wordbook:{type:Object,default:()=>({})},wordbookChild:{type:Object,default:()=>({})},showCount:{type:Boolean,default:!0},showClear:{type:Boolean,default:!0},multiple:{type:Boolean,default:!0},searchInner:{type:Boolean,default:!1},searchFilter:{type:Object,default:()=>({})},treeSetting:{type:Object,default:()=>({})},queryLoadChildData:{type:Function,default:void 0},queryTreeSearch:{type:Function,default:()=>Promise.resolve([])},showSelectType:{type:Boolean,default:!1},roleData:{type:Array,default:()=>[]},roleFields:{type:Object,default:()=>({label:"name",key:"id",children:"children"})}},setup(e,{expose:J}){const Q=e,V={isOpen:!1,multiple:!1,customTitles:["联系人","部门"],itemHeight:250},X=[{key:"main",label:"选人员"},{key:"dept",label:"选科室"},{key:"role",label:"选角色"}],Y={dept:"科室",role:"角色"},Z=l(H),ee=t(""),le=t(!1),te=t([]),ne=t([]),ae=t([]),ie=t([]),ue=t([]),re=t(!1),oe=R(function e(l){var t;for(let n=0,a=l.length;n<a;n++){const a=l[n],i=Q.wordbook.children||"children";if(null==(t=a[i])?void 0:t.length){const l=Ne(a[i],[]);a.innerItemsNum=l.length,a.innerLeafs=l,a.children=e(a[i])}}return Q.showSelectType?l:Ie(l,"")}(Q.data)),ce=t([]),se=n((()=>!!Q.queryLoadChildData)),de=n((()=>{var e,l;return null!=(l=null==(e=null==Q?void 0:Q.treeSetting)?void 0:e.checkStrategy)?l:"child"})),pe=n((()=>(null==Q?void 0:Q.searchFilter)&&Object.keys(null==Q?void 0:Q.searchFilter).length>0)),ve=t("main"),he=n((()=>pe.value?{...R(V),...Q.searchFilter}:R(V))),ye=n((()=>{var e,l;return null!=(l=null==(e=null==Q?void 0:Q.wordbookChild)?void 0:e.user_expand_keys)?l:[]})),fe=n((()=>{if(Q.showSelectType){return function(e,l){let t={};return e.reduce(((e,n)=>(!t[n[l]]&&(t[n[l]]=e.push(n)),e)),[])}([...be.main.filter((e=>(e.itemType=A.PERSON,e[_e.value]==B.STAFF))),...be.dept.filter((e=>(e.itemType=A.DEPT,e[_e.value]==B.DEPT))),...be.role.filter((e=>(e.itemType=A.ROLE,e)))],"key")}let e=[];return te.value.forEach((l=>{for(let t=0,n=ie.value.length;t<n;t++){const n=ie.value[t];if(n.key==l){e.push(n);break}}})),e})),ke=a({main:[],dept:[],role:[],temp:[]}),me=a({main:[],dept:[],role:[]}),be=a({main:[],dept:[],role:[]}),ge=a({main:[],dept:[],role:[]}),_e=n((()=>{var e;return(null==(e=Q.wordbook)?void 0:e.type)||"type"})),Te=n((()=>Q.wordbookChild.user_id_obj||Q.wordbook.parent_id_obj||Date.now()));function we(){ke.main=ke.temp=oe,je(ke.temp,null,(e=>{ge.main.push(e.key)})),ce.value=ge.main,ke.dept=Se(R(oe),(e=>{ge.dept.push(e.key)})),ke.role=xe(R(Q.roleData),(e=>{ge.role.push(e.key)}))}function Se(e,l){return e.filter((e=>{var t;Q.showSelectType&&(null==(t=e.children)?void 0:t.length)&&(e.children=Se(e.children,l));const n=e[_e.value]==B.DEPT;return n&&Le(e,l),n}))}function xe(e,l){const{label:t,key:n,children:a="children"}=Q.roleFields;return e.map((e=>{var i;return e.key=e[n],e.label=e.title=e[t],(null==(i=e[a])?void 0:i.length)&&(e.children=xe(e[a],l)),Le(e,l),e}))}function Ce(e,l){var t,n;const a=["main","dept"].includes(l)?Te.value:null==(t=Q.roleFields)?void 0:t.key;for(let t=0,i=e.length;t<i;t++){const i=e[t],u=ue.value.map((e=>e.key));me[l].includes(i.key)&&!u.includes(i.key)&&be[l].push({...i,key:i[a]}),(null==(n=i.children)?void 0:n.length)&&Ce(i.children,l)}}function je(e,l,t){var n,a;for(let i=0,u=e.length;i<u;i++){const u=e[i];let r=ye.value.reduce(((e,l)=>e+(u[l]?`${u[l]},`:"")),"");u.title_expand_strs=r.slice(0,-1),u.title=Ee(u),u.label=Ee(u),u.parentNode=l,u.key||(u.key=u[Q.wordbookChild.user_id_obj]||u[Q.wordbook.parent_id_obj]||Date.now()),(null==(n=u.children)?void 0:n.length)?(je(u.children,u,t),Oe(u)):0===(null==(a=u.children)?void 0:a.length)&&Reflect.deleteProperty(u,"children"),Le(u,t)}}function Le(e,l){var t,n;switch(null!=(n=null==(t=null==Q?void 0:Q.treeSetting)?void 0:t.checkStrategy)?n:"child"){case"child":!function(e,l){e.disabled||e.children||!e.key||l&&l(e)}(e,l);break;case"parent":!function(e,l){e.disabled||e.tempTitle||!e.key||l&&l(e)}(e,l)}}async function Fe(e){if(Q.queryLoadChildData){const l=await Q.queryLoadChildData(e);return l.children&&(l.children=l.children.map((e=>({...e,tempTitle:l.tempTitle?`${l.title}/${l.tempTitle}`:l.title})))),l}return e}function Oe(e){var l;(null==(l=e.children)?void 0:l.every((e=>e.disabled)))&&(e.disabled=!0)}function De({option:e}){var l,t;if((null==(l=e.children)?void 0:l.length)||se.value&&!(null==e?void 0:e.isLeaf)){const l=Q.wordbook.user_count_obj&&e[Q.wordbook.user_count_obj]||"",t=l?`(${l})`:"",n=`${e.title}${t}`;return s("span",{title:n},[n])}{const l=null!=(t=e.title_expand_strs)?t:"";return s("p",{class:"user_item"},[s("span",{title:e.title},[e.title]),s("span",{class:"user_item_expand",title:l},[l])])}}function Ee(e){return e[Q.wordbookChild.user_name_obj]||e[Q.wordbook.parent_name_obj]||e.orgName||e.title||""}function Ne(e,l){var t;for(let n=0,a=e.length;n<a;n++){const a=e[n];(null==(t=a.children)?void 0:t.length)?Ne(a.children,l):!a.disabled&&l.push(a)}return l}function Ie(e,l){return e&&0!==e.length?e.map((e=>{var t;const n=Ee(e),a=l?`${n}/${l}`:n;return{...e,tempTitle:l,children:(null==(t=e.children)?void 0:t.length)?Ie(null==e?void 0:e.children,a):[]}})):[]}async function Pe(){var e,l;const t=null!=(l=null==(e=null==Q?void 0:Q.wordbook)?void 0:e.filter_key)?l:"keyword";if(re.value=!!ee.value.trim(),se.value)ae.value=await Q.queryTreeSearch(ee.value);else{const e=function(){const e={[K.SEARCH_ORG_STAFF]:pe.value,[K.SEARCH_ORG]:Q.searchInner},l=Object.keys(e).find((l=>e[l]));return null!=l?l:""}();ae.value=P(e,ke.temp,ee.value,t)}ne.value=ae.value.length&&ee.value?$(ae.value):[]}function $e(e,l){var t,n;switch(null!=(n=null==(t=null==Q?void 0:Q.treeSetting)?void 0:t.checkStrategy)?n:"child"){case"child":!function(e,l){for(let t=0,n=e.length;t<n;t++){const n=e[t];if(!n.disabled&&(!n.children||n.isLeaf)&&(l&&!te.value.includes(n.key)&&te.value.push(n.key),!l)){const e=te.value.findIndex((e=>e===n.key));te.value.splice(e,1)}n.children&&$e(n.children,l)}}(e,l);break;case"parent":!function(e,l){te.value=[];for(let t=0,n=e.length;t<n;t++){const n=e[t];if(!n.disabled&&!n.tempTitle&&(l&&!te.value.includes(n.key)&&te.value.push(n.key),!l)){const e=te.value.findIndex((e=>e===n.key));te.value.splice(e,1)}}}(e,l)}}function Re(e){$e(ae.value,e)}function Ae(e){var l;for(let t=0,n=e.length;t<n;t++){const n=e[t],a=ue.value.map((e=>e.key));te.value.includes(n.key)&&!a.includes(n.key)&&ie.value.push({key:n.key,name:n.title,parentName:n.tempTitle,innerItemsNum:n.innerItemsNum,innerLeafs:n.innerLeafs,originItem:n}),(null==(l=n.children)?void 0:l.length)&&Ae(n.children)}}function Be(e){if(Q.showSelectType){const l=ve.value;te.value=me[l]=e}else te.value=e}function Ke(){Object.keys(me).forEach((e=>{me[e]=be[e]=[]})),te.value=[]}function Ue(e){te.value=e}function qe(){ee.value="",setTimeout((()=>{Pe()}))}return i((()=>Q.data),(e=>{!function(){if(we(),ae.value=ke.temp,Q.defaultList.length>0)if(se.value)Q.defaultList.forEach((e=>te.value.push(e.key))),ie.value=R(Q.defaultList),ue.value=R(Q.defaultList);else{if(Q.showSelectType){const e=ve.value;return Q.defaultList.forEach((e=>{e.itemType===A.PERSON&&(me.main.push(e[Te.value]),be.main.push(e)),e.itemType===A.DEPT&&(me.dept.push(e[Te.value]),be.dept.push(e)),e.itemType===A.ROLE&&(me.role.push(e[Q.roleFields.key]),be.role.push(e))})),void(te.value=me[e])}Q.defaultList.forEach((e=>te.value.push(e))),Ae(ke.temp)}}()}),{immediate:!0}),i((()=>te),(e=>{if(Q.showSelectType){const l=ve.value;be[l]=ue.value.filter((l=>e.value.includes(l.key))),Ce(ke[l],l),Q.showSelectType?le.value=ce.value.every((e=>te.value.findIndex((l=>l===e))>-1)):le.value=ce.value.every((e=>ie.value.findIndex((l=>l.key===e))>-1));const t=fe.value.map((e=>e.key));return Z("check",t),void Z("checkWithLevel",fe.value)}ie.value=ue.value.filter((l=>e.value.includes(l.key))),Ae(se.value?ae.value:ke.temp);const l=ie.value.filter((l=>e.value.includes(l.key)));Z("check",e.value),Z("checkWithLevel",l)}),{deep:!0}),i((()=>ee.value),(e=>{e||qe()})),J({getCheckWithLevel:function(){var e;if(Q.showSelectType)return null!=(e=fe.value)?e:[];const l=te.value,t=ie.value.filter((e=>l.includes(e.key)));return null!=t?t:[]}}),(l,t)=>(u(),r(o(w),{cols:2,class:"c-select-person"},{default:c((()=>[s(o(S),null,{default:c((()=>[s(o(x),{vertical:"",style:{"padding-right":"12px","border-right":"1px solid #e8e8e8"}},{default:c((()=>[s(o(C),{style:{"margin-bottom":"12px"}},{default:c((()=>[d(" clearable "),s(o(j),{class:"search-input",value:ee.value,"onUpdate:value":t[0]||(t[0]=e=>ee.value=e),placeholder:e.searchPlaceholder,onKeyup:p(Pe,["enter"])},{suffix:c((()=>[ee.value?(u(),r(o(L),{key:0,class:"search-clear",component:o(I),size:"16",onClick:qe},null,8,["component"])):d("v-if",!0)])),_:1},8,["value","placeholder","onKeyup"]),s(o(F),{type:"primary",onClick:Pe},{default:c((()=>[v(h(e.searchButtonText),1)])),_:1})])),_:1}),e.showSelectType?(u(),y("div",M,[(u(),y(f,null,k(X,(e=>s(o(O),{round:"",checkable:"",checked:ve.value===e.key,key:e.key,"onUpdate:checked":l=>function(e){ve.value=e.key,ae.value=ke.temp=ke[e.key],te.value=me[e.key],ce.value=ge[e.key]}(e)},{default:c((()=>[v(h(e.label),1)])),_:2},1032,["checked","onUpdate:checked"]))),64))])):d("v-if",!0),e.multiple&&!re.value?m((u(),r(o(D),{key:1,checked:le.value,"onUpdate:checked":[t[1]||(t[1]=e=>le.value=e),Re]},{default:c((()=>[v(" 全选 ")])),_:1},8,["checked"])),[[b,ce.value.length<1e3]]):d("v-if",!0),d(" 支持选人 "),e.searchInner&&e.multiple&&re.value&&"parent"===o(de)?(u(),r(U,{key:2,treeData:ae.value,checkedKeys:te.value,onNotifyCheck:Ue},null,8,["treeData","checkedKeys"])):o(pe)&&re.value&&"parent"===o(de)?(u(),y(f,{key:3},[d(" 同时兼容选人和选部门 "),d(" v-else-if=\"isSearchFilter && multiple && isSearch && checkStrategyResult === 'parent'\" "),s(q,{treeData:ae.value,checkedKeys:te.value,searchFilter:o(he),isMultiple:e.multiple,onNotifyCheck:Ue,onNotifyClear:qe},null,8,["treeData","checkedKeys","searchFilter","isMultiple"])],2112)):(u(),y("div",W,[0===ae.value.length?(u(),r(o(E),{key:0,description:"暂无数据"})):(u(),r(o(N),g({key:1,"virtual-scroll":"",class:"c-select-person__scroll","checked-keys":te.value,"expanded-keys":ne.value,"onUpdate:expanded-keys":t[2]||(t[2]=e=>ne.value=e),checkable:e.multiple,cascade:"","allow-checking-not-loaded":"",selectable:!e.multiple,"selected-keys":te.value,"onUpdate:selected-keys":t[3]||(t[3]=e=>te.value=e),data:ae.value,"check-strategy":"child","render-label":De},e.treeSetting,{"onUpdate:checkedKeys":Be,onLoad:Fe}),null,16,["checked-keys","expanded-keys","checkable","selectable","selected-keys","data"]))]))])),_:1})])),_:1}),s(o(S),null,{default:c((()=>[s(o(x),{vertical:"",style:{"padding-left":"12px"}},{default:c((()=>[s(o(x),{justify:"space-between",style:{"margin-bottom":"20px"}},{default:c((()=>[e.showCount?(u(),y("span",G,"已选择:"+h(o(fe).length),1)):d("v-if",!0),e.showClear?(u(),y("span",{key:1,class:"c-select-person__clear-btn",onClick:Ke},"清空")):d("v-if",!0)])),_:1}),_("div",z,[(u(!0),y(f,null,k(o(fe),(t=>(u(),y("span",{class:"c-select-person__tag-item",key:t.key},[d(" 标签插槽 "),T(l.$slots,"tag",{tag:t},(()=>[v(h(t.name)+" "+h(t.parentName?`(${t.parentName})`:"")+" "+h(t.innerItemsNum?`(${t.innerItemsNum}人)`:"")+" "+h(e.showSelectType&&Y[t.itemType]?`(${Y[t.itemType]})`:""),1)])),s(o(L),{class:"tag-close",component:o(I),onClick:e=>function(e){if(Q.showSelectType){const l=e.itemType===A.PERSON?"main":e.itemType;return me[l]=me[l].filter((l=>l!==e.key)),be[l]=ue.value.filter((e=>me[l].includes(e.key))),Ce(ke[l],l),void(ve.value==l&&(te.value=me[l]))}te.value=te.value.filter((l=>l!==e.key))}(t)},null,8,["component","onClick"])])))),128))])])),_:3})])),_:3})])),_:3}))}});export{J as default};
|
@@ -0,0 +1,314 @@
|
|
1
|
+
import { PropType } from 'vue';
|
2
|
+
import { type TreeOption } from 'naive-ui';
|
3
|
+
import { AnyObject } from '../../../shared/types';
|
4
|
+
type IKey = string | number;
|
5
|
+
type ITreeOption = TreeOption & AnyObject;
|
6
|
+
type IWordBook<T> = {
|
7
|
+
parent_id_obj: keyof T;
|
8
|
+
parent_name_obj: keyof T;
|
9
|
+
user_count_obj?: keyof T;
|
10
|
+
filter_key?: string;
|
11
|
+
[key: string]: any;
|
12
|
+
};
|
13
|
+
type IWordBookChild<T> = {
|
14
|
+
user_id_obj: keyof T;
|
15
|
+
user_name_obj: keyof T;
|
16
|
+
user_expand_keys?: string[];
|
17
|
+
};
|
18
|
+
type ITag = {
|
19
|
+
key: IKey;
|
20
|
+
[key: string]: any;
|
21
|
+
};
|
22
|
+
declare const _default: import("vue").DefineComponent<{
|
23
|
+
defaultList: {
|
24
|
+
type: PropType<(IKey | ITag)[]>;
|
25
|
+
default: () => never[];
|
26
|
+
};
|
27
|
+
data: {
|
28
|
+
type: PropType<ITreeOption[]>;
|
29
|
+
default: () => never[];
|
30
|
+
};
|
31
|
+
searchPlaceholder: {
|
32
|
+
type: StringConstructor;
|
33
|
+
default: string;
|
34
|
+
};
|
35
|
+
searchButtonText: {
|
36
|
+
type: StringConstructor;
|
37
|
+
default: string;
|
38
|
+
};
|
39
|
+
wordbook: {
|
40
|
+
type: PropType<IWordBook<ITreeOption>>;
|
41
|
+
default: () => {};
|
42
|
+
};
|
43
|
+
wordbookChild: {
|
44
|
+
type: PropType<IWordBookChild<ITreeOption>>;
|
45
|
+
default: () => {};
|
46
|
+
};
|
47
|
+
showCount: {
|
48
|
+
type: BooleanConstructor;
|
49
|
+
default: boolean;
|
50
|
+
};
|
51
|
+
showClear: {
|
52
|
+
type: BooleanConstructor;
|
53
|
+
default: boolean;
|
54
|
+
};
|
55
|
+
multiple: {
|
56
|
+
type: BooleanConstructor;
|
57
|
+
default: boolean;
|
58
|
+
};
|
59
|
+
searchInner: {
|
60
|
+
type: BooleanConstructor;
|
61
|
+
default: boolean;
|
62
|
+
};
|
63
|
+
searchFilter: {
|
64
|
+
type: PropType<AnyObject>;
|
65
|
+
default: () => {};
|
66
|
+
};
|
67
|
+
treeSetting: {
|
68
|
+
type: PropType<ITreeOption>;
|
69
|
+
default: () => {};
|
70
|
+
};
|
71
|
+
queryLoadChildData: {
|
72
|
+
type: PropType<(node: TreeOption) => Promise<AnyObject>>;
|
73
|
+
default: undefined;
|
74
|
+
};
|
75
|
+
queryTreeSearch: {
|
76
|
+
type: PropType<(keyWork: string) => Promise<Array<AnyObject>>>;
|
77
|
+
default: () => Promise<never[]>;
|
78
|
+
};
|
79
|
+
switchTypeProps: {
|
80
|
+
type: PropType<AnyObject[]>;
|
81
|
+
default: () => never[];
|
82
|
+
};
|
83
|
+
switchTypeData: {
|
84
|
+
type: PropType<AnyObject>;
|
85
|
+
default: () => {};
|
86
|
+
};
|
87
|
+
tagProps: {
|
88
|
+
type: PropType<AnyObject>;
|
89
|
+
default: () => {};
|
90
|
+
};
|
91
|
+
}, {
|
92
|
+
props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
|
93
|
+
defaultList: {
|
94
|
+
type: PropType<(IKey | ITag)[]>;
|
95
|
+
default: () => never[];
|
96
|
+
};
|
97
|
+
data: {
|
98
|
+
type: PropType<ITreeOption[]>;
|
99
|
+
default: () => never[];
|
100
|
+
};
|
101
|
+
searchPlaceholder: {
|
102
|
+
type: StringConstructor;
|
103
|
+
default: string;
|
104
|
+
};
|
105
|
+
searchButtonText: {
|
106
|
+
type: StringConstructor;
|
107
|
+
default: string;
|
108
|
+
};
|
109
|
+
wordbook: {
|
110
|
+
type: PropType<IWordBook<ITreeOption>>;
|
111
|
+
default: () => {};
|
112
|
+
};
|
113
|
+
wordbookChild: {
|
114
|
+
type: PropType<IWordBookChild<ITreeOption>>;
|
115
|
+
default: () => {};
|
116
|
+
};
|
117
|
+
showCount: {
|
118
|
+
type: BooleanConstructor;
|
119
|
+
default: boolean;
|
120
|
+
};
|
121
|
+
showClear: {
|
122
|
+
type: BooleanConstructor;
|
123
|
+
default: boolean;
|
124
|
+
};
|
125
|
+
multiple: {
|
126
|
+
type: BooleanConstructor;
|
127
|
+
default: boolean;
|
128
|
+
};
|
129
|
+
searchInner: {
|
130
|
+
type: BooleanConstructor;
|
131
|
+
default: boolean;
|
132
|
+
};
|
133
|
+
searchFilter: {
|
134
|
+
type: PropType<AnyObject>;
|
135
|
+
default: () => {};
|
136
|
+
};
|
137
|
+
treeSetting: {
|
138
|
+
type: PropType<ITreeOption>;
|
139
|
+
default: () => {};
|
140
|
+
};
|
141
|
+
queryLoadChildData: {
|
142
|
+
type: PropType<(node: TreeOption) => Promise<AnyObject>>;
|
143
|
+
default: undefined;
|
144
|
+
};
|
145
|
+
queryTreeSearch: {
|
146
|
+
type: PropType<(keyWork: string) => Promise<Array<AnyObject>>>;
|
147
|
+
default: () => Promise<never[]>;
|
148
|
+
};
|
149
|
+
switchTypeProps: {
|
150
|
+
type: PropType<AnyObject[]>;
|
151
|
+
default: () => never[];
|
152
|
+
};
|
153
|
+
switchTypeData: {
|
154
|
+
type: PropType<AnyObject>;
|
155
|
+
default: () => {};
|
156
|
+
};
|
157
|
+
tagProps: {
|
158
|
+
type: PropType<AnyObject>;
|
159
|
+
default: () => {};
|
160
|
+
};
|
161
|
+
}>> & {}>>;
|
162
|
+
emit: any;
|
163
|
+
keyword: import("vue").Ref<string>;
|
164
|
+
checkedAll: import("vue").Ref<boolean>;
|
165
|
+
checkedKeys: import("vue").Ref<IKey[]>;
|
166
|
+
expandedKeys: import("vue").Ref<IKey[]>;
|
167
|
+
treeData: import("vue").Ref<{
|
168
|
+
[x: string]: unknown;
|
169
|
+
key?: import("naive-ui/es/tree/src/interface").Key | undefined;
|
170
|
+
label?: string | undefined;
|
171
|
+
checkboxDisabled?: boolean | undefined;
|
172
|
+
disabled?: boolean | undefined;
|
173
|
+
isLeaf?: boolean | undefined;
|
174
|
+
children?: any[] | undefined;
|
175
|
+
prefix?: (() => import("vue").VNodeChild) | undefined;
|
176
|
+
suffix?: (() => import("vue").VNodeChild) | undefined;
|
177
|
+
}[]>;
|
178
|
+
isSearch: import("vue").Ref<boolean>;
|
179
|
+
allCheckedTreeKeys: import("vue").Ref<IKey[]>;
|
180
|
+
curSelectKey: any;
|
181
|
+
treeDataMiddle: any;
|
182
|
+
checkedTagsMiddle: import("vue").Ref<any[]>;
|
183
|
+
allCheckedKeysMiddle: any;
|
184
|
+
isSearchFilter: import("vue").ComputedRef<boolean>;
|
185
|
+
keyStr: import("vue").ComputedRef<string | number>;
|
186
|
+
onHandleLabelChange: (item: any) => void;
|
187
|
+
setSelectTagData: (tree: TreeOption[], operatorType: string) => void;
|
188
|
+
addTagToTemp: (tree: TreeOption[], operatorType: string) => void;
|
189
|
+
init: () => void;
|
190
|
+
setAllCheckedKeys: (tree: TreeOption, cb?: any) => void;
|
191
|
+
setAllCheckedKeysWithChild: (item: TreeOption, cb?: any) => void;
|
192
|
+
setAllCheckedKeysWithParent: (item: TreeOption, cb?: any) => void;
|
193
|
+
queryLoadChildNode: (node: TreeOption) => Promise<AnyObject>;
|
194
|
+
setDisabled: (data: TreeOption) => void;
|
195
|
+
renderLabel: ({ option }: {
|
196
|
+
option: TreeOption;
|
197
|
+
}) => JSX.Element;
|
198
|
+
getLabelName: (curProps: any, option: TreeOption) => {};
|
199
|
+
loopTrees: (treeObjs: any) => any;
|
200
|
+
transformData: (key: string, trees: TreeOption[], parentNode: TreeOption | null, cb?: any) => TreeOption[];
|
201
|
+
calculateRootItems: (trees: TreeOption[], items: TreeOption[]) => TreeOption[];
|
202
|
+
searchSetting: () => string;
|
203
|
+
onSearch: () => Promise<void>;
|
204
|
+
setTreeCheckd: (tree: TreeOption[], checked: boolean) => void;
|
205
|
+
setCheckdWithChild: (tree: TreeOption[], checked: boolean) => void;
|
206
|
+
setCheckdWithParent: (tree: TreeOption[], checked: boolean) => void;
|
207
|
+
checkedAllChange: (checked: boolean) => void;
|
208
|
+
updateTreeChecked: (keys: Array<IKey>) => void;
|
209
|
+
setCheckedAll: () => void;
|
210
|
+
clearAll: () => void;
|
211
|
+
closeTag: (tag: ITag) => void;
|
212
|
+
notifySearchClear: () => void;
|
213
|
+
getCheckWithLevel: () => any[];
|
214
|
+
NButton: any;
|
215
|
+
NInput: any;
|
216
|
+
NInputGroup: any;
|
217
|
+
NCheckbox: any;
|
218
|
+
NTree: any;
|
219
|
+
NTag: any;
|
220
|
+
NIcon: any;
|
221
|
+
NSpace: any;
|
222
|
+
NGrid: any;
|
223
|
+
NGi: any;
|
224
|
+
NEmpty: any;
|
225
|
+
CloseCircleSharp: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
226
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
227
|
+
defaultList: {
|
228
|
+
type: PropType<(IKey | ITag)[]>;
|
229
|
+
default: () => never[];
|
230
|
+
};
|
231
|
+
data: {
|
232
|
+
type: PropType<ITreeOption[]>;
|
233
|
+
default: () => never[];
|
234
|
+
};
|
235
|
+
searchPlaceholder: {
|
236
|
+
type: StringConstructor;
|
237
|
+
default: string;
|
238
|
+
};
|
239
|
+
searchButtonText: {
|
240
|
+
type: StringConstructor;
|
241
|
+
default: string;
|
242
|
+
};
|
243
|
+
wordbook: {
|
244
|
+
type: PropType<IWordBook<ITreeOption>>;
|
245
|
+
default: () => {};
|
246
|
+
};
|
247
|
+
wordbookChild: {
|
248
|
+
type: PropType<IWordBookChild<ITreeOption>>;
|
249
|
+
default: () => {};
|
250
|
+
};
|
251
|
+
showCount: {
|
252
|
+
type: BooleanConstructor;
|
253
|
+
default: boolean;
|
254
|
+
};
|
255
|
+
showClear: {
|
256
|
+
type: BooleanConstructor;
|
257
|
+
default: boolean;
|
258
|
+
};
|
259
|
+
multiple: {
|
260
|
+
type: BooleanConstructor;
|
261
|
+
default: boolean;
|
262
|
+
};
|
263
|
+
searchInner: {
|
264
|
+
type: BooleanConstructor;
|
265
|
+
default: boolean;
|
266
|
+
};
|
267
|
+
searchFilter: {
|
268
|
+
type: PropType<AnyObject>;
|
269
|
+
default: () => {};
|
270
|
+
};
|
271
|
+
treeSetting: {
|
272
|
+
type: PropType<ITreeOption>;
|
273
|
+
default: () => {};
|
274
|
+
};
|
275
|
+
queryLoadChildData: {
|
276
|
+
type: PropType<(node: TreeOption) => Promise<AnyObject>>;
|
277
|
+
default: undefined;
|
278
|
+
};
|
279
|
+
queryTreeSearch: {
|
280
|
+
type: PropType<(keyWork: string) => Promise<Array<AnyObject>>>;
|
281
|
+
default: () => Promise<never[]>;
|
282
|
+
};
|
283
|
+
switchTypeProps: {
|
284
|
+
type: PropType<AnyObject[]>;
|
285
|
+
default: () => never[];
|
286
|
+
};
|
287
|
+
switchTypeData: {
|
288
|
+
type: PropType<AnyObject>;
|
289
|
+
default: () => {};
|
290
|
+
};
|
291
|
+
tagProps: {
|
292
|
+
type: PropType<AnyObject>;
|
293
|
+
default: () => {};
|
294
|
+
};
|
295
|
+
}>>, {
|
296
|
+
data: ITreeOption[];
|
297
|
+
defaultList: (IKey | ITag)[];
|
298
|
+
searchPlaceholder: string;
|
299
|
+
searchButtonText: string;
|
300
|
+
wordbook: IWordBook<ITreeOption>;
|
301
|
+
wordbookChild: IWordBookChild<ITreeOption>;
|
302
|
+
showCount: boolean;
|
303
|
+
showClear: boolean;
|
304
|
+
multiple: boolean;
|
305
|
+
searchInner: boolean;
|
306
|
+
searchFilter: AnyObject;
|
307
|
+
treeSetting: ITreeOption;
|
308
|
+
queryLoadChildData: (node: TreeOption) => Promise<AnyObject>;
|
309
|
+
queryTreeSearch: (keyWork: string) => Promise<Array<AnyObject>>;
|
310
|
+
switchTypeProps: AnyObject[];
|
311
|
+
switchTypeData: AnyObject;
|
312
|
+
tagProps: AnyObject;
|
313
|
+
}>;
|
314
|
+
export default _default;
|
@@ -0,0 +1 @@
|
|
1
|
+
import e from"./SelectPersonType.vue2.js";import r from"../../../_virtual/_plugin-vue_export-helper.js";var o=r(e,[["__file","SelectPersonType.vue"]]);export{o as default};
|
@@ -0,0 +1 @@
|
|
1
|
+
import{defineComponent as e,inject as t,ref as l,reactive as a,computed as n,watch as o,openBlock as u,createBlock as i,unref as c,withCtx as r,createVNode as s,createCommentVNode as d,withKeys as p,createTextVNode as v,toDisplayString as h,createElementVNode as y,createElementBlock as f,Fragment as k,renderList as b,withDirectives as m,vShow as _,mergeProps as g,renderSlot as w}from"vue";import{NGrid as x,NGi as T,NSpace as j,NInputGroup as C,NInput as P,NIcon as S,NButton as K,NTag as L,NCheckbox as O,NEmpty as D,NTree as $}from"naive-ui";import{CloseCircleSharp as F}from"@vicons/ionicons5";import{searchFilterTree as U,getExpandedKeys as A}from"./utils/index.js";import{cloneDeep as B}from"lodash-es";import{SearchTypeConfig as I}from"./types/enums.js";import{InjectionSelectPersonEmits as R}from"./constants/index.js";const q={class:"select-type-tags"},E={class:"tree-content"},N={key:0},G={class:"c-select-person__scroll",style:{height:"342px"}};var H=e({__name:"SelectPersonType",props:{defaultList:{type:Array,default:()=>[]},data:{type:Array,default:()=>[]},searchPlaceholder:{type:String,default:"输入关键字搜索"},searchButtonText:{type:String,default:"搜索"},wordbook:{type:Object,default:()=>({})},wordbookChild:{type:Object,default:()=>({})},showCount:{type:Boolean,default:!0},showClear:{type:Boolean,default:!0},multiple:{type:Boolean,default:!0},searchInner:{type:Boolean,default:!1},searchFilter:{type:Object,default:()=>({})},treeSetting:{type:Object,default:()=>({})},queryLoadChildData:{type:Function,default:void 0},queryTreeSearch:{type:Function,default:()=>Promise.resolve([])},switchTypeProps:{type:Array,default:()=>[]},switchTypeData:{type:Object,default:()=>({})},tagProps:{type:Object,default:()=>({})}},setup(e,{expose:H}){const W=e,z=t(R),J=l(""),M=l(!1),Q=l([]),V=l([]),X=l([]),Y=l(!1),Z=l([]),ee=l(W.switchTypeProps[0].tabKey),te=l({}),le=l([]),ae=a({}),ne=n((()=>(null==W?void 0:W.searchFilter)&&Object.keys(null==W?void 0:W.searchFilter).length>0)),oe=n((()=>{const e=ee.value,t=W.switchTypeProps.find((t=>t.tabKey==e));return t&&(t.wordbookChild.user_id_obj||t.wordbook.parent_id_obj)||Date.now()}));function ue(e,t){le.value.map((e=>e.key)).forEach((e=>{Q.value.includes(e)||(le.value=le.value.filter((t=>t.key!=e)))})),ie(e)}function ie(e,t){var l;const a=le.value.map((e=>e.key));for(let t=0,n=e.length;t<n;t++){const n=e[t];Q.value.includes(n.key)&&!a.includes(n.key)&&le.value.push({...n,key:n[oe.value]}),(null==(l=n.children)?void 0:l.length)&&ie(n.children)}}function ce(){if(te.value=B(function(e){const t=Object.keys(W.switchTypeData);for(let l=0,a=t.length;l<a;l++)he(t[l],e[t[l]],null,(e=>{ae[t[l]]||(ae[t[l]]=[]),ae[t[l]].push(e.key)}));return e}(W.switchTypeData)),X.value=te.value[ee.value],Z.value=ae[ee.value],W.defaultList.length>0){let e=[];W.defaultList.forEach((t=>{e.push(t)})),Q.value=e}}function re(e,t){var l,a;switch(null!=(a=null==(l=null==W?void 0:W.treeSetting)?void 0:l.checkStrategy)?a:"child"){case"child":!function(e,t){e.disabled||e.children||!e.key||t&&t(e)}(e,t);break;case"parent":!function(e,t){e.disabled||e.tempTitle||!e.key||t&&t(e)}(e,t)}}async function se(e){if(W.queryLoadChildData){const t=await W.queryLoadChildData(e);return t.children&&(t.children=t.children.map((e=>({...e,tempTitle:t.tempTitle?`${t.title}/${t.tempTitle}`:t.title})))),t}return e}function de(e){var t;(null==(t=e.children)?void 0:t.every((e=>e.disabled)))&&(e.disabled=!0)}function pe({option:e}){var t;const l=null!=(t=e.title_expand_strs)?t:"";return s("p",{class:"user_item"},[s("span",{title:e.title},[e.title,v(" "),e.countText?`${e.countText}人`:""]),s("span",{class:"user_item_expand",title:l},[l?`(${l})`:""])])}function ve(e,t){return t[e.wordbookChild.user_name_obj]||t[e.wordbook.parent_name_obj]||t.orgName||t.title||""}function he(e,t,l,a){var n,o,u,i,c;for(let r=0,s=t.length;r<s;r++){const s=t[r],d=W.switchTypeProps.find((t=>t.tabKey==e));if(d){let t=(l?(null==(n=d.wordbookChild)?void 0:n.user_expand_keys)||[]:(null==(o=d.wordbook)?void 0:o.user_expand_keys)||[]).reduce(((e,t)=>e+(s[t]?`${s[t]},`:"")),"");s.title_expand_strs=t.slice(0,-1),s.parentNode=l,s.title=ve(d,s),s.label=ve(d,s),s.tempTitle=l&&l.tempTitle?`${s.title}/${l.tempTitle}}`:s.title,s.countText=s[d.wordbookChild.user_count_obj]||s[d.wordbook.user_count_obj]||"",s.key||(s.key=s[d.wordbookChild.user_id_obj]||s[d.wordbook.parent_id_obj]||Date.now());const r=(null==(u=null==d?void 0:d.wordbook)?void 0:u.children)||"children";if(null==(i=s[r])?void 0:i.length){const t=ye(s[r],[]);s.innerItemsNum=t.length,s.innerLeafs=t,s.children=he(e,s[r],s,a),de(s)}else 0===(null==(c=s[r])?void 0:c.length)&&Reflect.deleteProperty(s,"children");re(s,a)}}return t}function ye(e,t){var l;for(let a=0,n=e.length;a<n;a++){const n=e[a];(null==(l=n.children)?void 0:l.length)?ye(n.children,t):!n.disabled&&t.push(n)}return t}async function fe(){var e,t;const l=W.switchTypeProps.find((e=>e.tabKey==ee.value));if(l){const a=null!=(t=null==(e=null==l?void 0:l.wordbook)?void 0:e.filter_key)?t:"keyword";Y.value=!!J.value.trim();const n=function(){const e={[I.SEARCH_ORG_STAFF]:ne.value,[I.SEARCH_ORG]:W.searchInner},t=Object.keys(e).find((t=>e[t]));return null!=t?t:""}();X.value=U(n,te.value[ee.value],J.value,a),V.value=X.value.length&&J.value?A(X.value):[]}}function ke(e,t){var l,a;switch(null!=(a=null==(l=null==W?void 0:W.treeSetting)?void 0:l.checkStrategy)?a:"child"){case"child":!function(e,t){for(let l=0,a=e.length;l<a;l++){const a=e[l];if(!a.disabled&&(!a.children||a.isLeaf)&&(t&&!Q.value.includes(a.key)&&Q.value.push(a.key),!t)){const e=Q.value.findIndex((e=>e===a.key));Q.value.splice(e,1)}a.children&&ke(a.children,t)}}(e,t);break;case"parent":!function(e,t){Q.value=[];for(let l=0,a=e.length;l<a;l++){const a=e[l];if(!a.disabled&&!a.tempTitle&&(t&&!Q.value.includes(a.key)&&Q.value.push(a.key),!t)){const e=Q.value.findIndex((e=>e===a.key));Q.value.splice(e,1)}}}(e,t)}}function be(e){ke(X.value,e)}function me(e){Q.value=e}function _e(){M.value=Z.value.every((e=>Q.value.findIndex((t=>t===e))>-1))}function ge(){Q.value=le.value=[]}function we(){J.value="",setTimeout((()=>{fe()}))}return o((()=>W.switchTypeData),(e=>{ce()}),{immediate:!0}),o((()=>Q),(e=>{ue(te.value[ee.value],ee.value),_e();const t=le.value.map((e=>e.key));z("check",t),z("checkWithLevel",le.value)}),{immediate:!0,deep:!0}),o((()=>J.value),(e=>{e||we()})),H({getCheckWithLevel:function(){var e;return null!=(e=le.value)?e:[]}}),(t,l)=>(u(),i(c(x),{cols:2,class:"c-select-person"},{default:r((()=>[s(c(T),null,{default:r((()=>[s(c(j),{vertical:"",style:{"padding-right":"12px","border-right":"1px solid #e8e8e8"}},{default:r((()=>[s(c(C),{style:{"margin-bottom":"12px"}},{default:r((()=>[d(" clearable "),s(c(P),{class:"search-input",value:J.value,"onUpdate:value":l[0]||(l[0]=e=>J.value=e),placeholder:e.searchPlaceholder,onKeyup:p(fe,["enter"])},{suffix:r((()=>[J.value?(u(),i(c(S),{key:0,class:"search-clear",component:c(F),size:"16",onClick:we},null,8,["component"])):d("v-if",!0)])),_:1},8,["value","placeholder","onKeyup"]),s(c(K),{type:"primary",onClick:fe},{default:r((()=>[v(h(e.searchButtonText),1)])),_:1})])),_:1}),d(" tab类型切换 "),y("div",q,[(u(!0),f(k,null,b(e.switchTypeProps,(e=>(u(),i(c(L),{round:"",checkable:"",checked:ee.value===e.tabKey,key:e.tabKey,"onUpdate:checked":t=>function(e){ee.value=e.tabKey,X.value=te.value[e.tabKey],Z.value=ae[e.tabKey],_e()}(e)},{default:r((()=>[v(h(e.tabName),1)])),_:2},1032,["checked","onUpdate:checked"])))),128))]),e.multiple&&!Y.value?m((u(),i(c(O),{key:0,checked:M.value,"onUpdate:checked":[l[1]||(l[1]=e=>M.value=e),be]},{default:r((()=>[v(" 全选 ")])),_:1},8,["checked"])),[[_,Z.value.length<1e3]]):d("v-if",!0),y("div",E,[0===X.value.length?(u(),i(c(D),{key:0,description:"暂无数据"})):(u(),i(c($),g({key:1,"virtual-scroll":"",class:"c-select-person__scroll","checked-keys":Q.value,"expanded-keys":V.value,"onUpdate:expanded-keys":l[2]||(l[2]=e=>V.value=e),checkable:e.multiple,cascade:"","allow-checking-not-loaded":"",selectable:!e.multiple,"selected-keys":Q.value,"onUpdate:selected-keys":l[3]||(l[3]=e=>Q.value=e),data:X.value,"check-strategy":"child","render-label":pe},e.treeSetting,{"onUpdate:checkedKeys":me,onLoad:se}),null,16,["checked-keys","expanded-keys","checkable","selectable","selected-keys","data"]))])])),_:1})])),_:1}),s(c(T),null,{default:r((()=>[s(c(j),{vertical:"",style:{"padding-left":"12px"}},{default:r((()=>[s(c(j),{justify:"space-between",style:{"margin-bottom":"20px"}},{default:r((()=>[e.showCount?(u(),f("span",N,"已选择:"+h(le.value.length),1)):d("v-if",!0),e.showClear?(u(),f("span",{key:1,class:"c-select-person__clear-btn",onClick:ge},"清空")):d("v-if",!0)])),_:1}),y("div",G,[(u(!0),f(k,null,b(le.value,(l=>(u(),f("span",{class:"c-select-person__tag-item",key:l.key},[d(" 标签插槽 "),w(t.$slots,"tag",{tag:l},(()=>{var t,a;return[v(h((null==(t=e.tagProps)?void 0:t.title)&&l[e.tagProps.title]?l[e.tagProps.title]:l.title)+" ",1),y("span",null,h((null==(a=e.tagProps)?void 0:a.dept_origin)&&l[e.tagProps.dept_origin]?`(${l[e.tagProps.dept_origin]})`:""),1)]})),s(c(S),{class:"tag-close",component:c(F),onClick:e=>function(e){Q.value=Q.value.filter((t=>t!==e.key)),ue(te.value[ee.value],ee.value)}(l)},null,8,["component","onClick"])])))),128))])])),_:3})])),_:3})])),_:3}))}});export{H as default};
|
@@ -0,0 +1 @@
|
|
1
|
+
import e from"./SearchMultiple.vue2.js";import r from"../../../../_virtual/_plugin-vue_export-helper.js";var l=r(e,[["__file","SearchMultiple.vue"]]);export{l as default};
|
@@ -0,0 +1 @@
|
|
1
|
+
import r from"./SearchOrgAndStaff.vue2.js";import e from"../../../../_virtual/_plugin-vue_export-helper.js";var a=e(r,[["__file","SearchOrgAndStaff.vue"]]);export{a as default};
|
@@ -0,0 +1 @@
|
|
1
|
+
const e=Symbol("InjectionSelectPersonEmits");export{e as InjectionSelectPersonEmits};
|