Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

2 Zeilen
4.8KB

  1. import{a as O}from"./unitManage.ad646f25.js";import{d as F,r as p,J as $,c as v,e as E,G as R,i as h,g as f,h as y,j as P,t as I,f as H,H as J,F as q,K as T,L as _}from"./index.e8b71da7.js";const Q={class:"unitBox"},W={class:"left"},X={class:"content"},Y={class:"right"},ee={class:"title"},ae={class:"content"},te={class:"dialog-footer"},le=F({name:"orgTree"}),oe=Object.assign(le,{props:{visible:{type:Boolean,default:!1},showCheckbox:{type:Boolean,default:!1},defaultData:Array,params:{type:Object,default:()=>{}},isPerson:{type:Boolean,default:!1},title:{type:String,default:"\u5355\u4F4D"},defaultExpandedkeys:{type:Array,default:()=>[]},defaultProps:{type:Object,default:()=>({children:"children",label:"title",value:"key",isLeaf:"isLeaf"})},type:{type:String,default:"UNIT"}},emits:["close","getSelectUnit"],setup(o,{emit:A}){const e=o,B=A,w=()=>{B("close"),V.value=""},S=()=>{B("getSelectUnit",n.value),w()},k=p(""),V=p(""),s=p(),K=async(a,t)=>{var d,i,m,b,g,C,u,x,D,M;if(a.level){let r;if(e.type==="LINE")if(r=await T({...e.params,parentCode:a.data.businessStripCode}),r.data){let c;e.isPerson&&e.showCheckbox?c=r.data.map(l=>({...l,disabled:l.type==="ORGANIZATION",isLeaf:l.type==="MEMBER"})):c=r.data.map(l=>({...l,isLeaf:l.type==="MEMBER"})),t(c)}else t([]);else{let c;(i=(d=a==null?void 0:a.data)==null?void 0:d.children)!=null&&i.length?(e.isPerson&&e.showCheckbox?c=(m=a==null?void 0:a.data)==null?void 0:m.children.map(l=>({...l,disabled:l.type==="ORGANIZATION",isLeaf:l.type==="MEMBER"})):c=(b=a==null?void 0:a.data)==null?void 0:b.children.map(l=>({...l,isLeaf:l.type==="MEMBER"})),t(c)):(r=await O({...e.params,organizationCode:a.data.key}),(C=(g=r.data)==null?void 0:g[0])!=null&&C.children?(e.isPerson&&e.showCheckbox?c=(x=(u=r.data)==null?void 0:u[0])==null?void 0:x.children.map(l=>({...l,disabled:l.type==="ORGANIZATION",isLeaf:l.type==="MEMBER"})):c=(M=(D=r.data)==null?void 0:D[0])==null?void 0:M.children.map(l=>({...l,isLeaf:l.type==="MEMBER"})),t(c)):t([]))}}_(()=>{e.showCheckbox?n.value&&n.value.length?s.value&&s.value.setCheckedNodes(n.value):s.value&&s.value.setCheckedKeys([]):n.value&&n.value.length?s.value&&s.value.setCurrentKey(n.value[0].key):s.value&&s.value.setCurrentKey(null)})};$(()=>e.visible,a=>{a&&_(async()=>{await L(),e.defaultData&&e.defaultData.length?n.value=[...e.defaultData]:(k.value=void 0,n.value=[])})});const j=async()=>{await L(k.value),_(()=>{s.value&&s.value.filter(k.value)})},G=p(!1),U=(a,t)=>(a,!0),n=p([]),z=(a,{checkedKeys:t,checkedNodes:d})=>{e.showCheckbox?t.includes(a[e.defaultProps.value])?n.value.push(a):n.value=n.value.filter(i=>i[e.defaultProps.value]!==a[e.defaultProps.value]):n.value=[a]},Z=(a,t,d)=>{n.value.splice(a,1),_(()=>{e.showCheckbox?s.value&&s.value.setChecked(t,!1):s.value&&s.value.setCurrentKey(null)})},N=p(),L=async a=>{N.value=[];let t;e.type==="LINE"?t=await T({}):t=await O({...e.params,organizationName:!e.isPerson&&a||void 0,employeeName:e.isPerson&&a||void 0,parentCode:void 0});let d;e.isPerson&&e.showCheckbox?d=t.data.map(i=>({...i,disabled:!0})):d=t.data.map(i=>({...i})),N.value=d};return(a,t)=>{const d=v("el-button"),i=v("el-input"),m=v("el-tree"),b=v("el-scrollbar"),g=v("el-tag"),C=v("el-dialog");return E(),R(C,{"model-value":e.visible,title:`\u9009\u62E9${o.title}`,width:800,"destroy-on-close":"","before-close":w},{footer:h(()=>[f("span",te,[y(d,{type:"primary",onClick:S},{default:h(()=>t[2]||(t[2]=[P("\u63D0\u4EA4")])),_:1}),y(d,{onClick:w},{default:h(()=>t[3]||(t[3]=[P("\u5173\u95ED")])),_:1})])]),default:h(()=>[f("div",Q,[f("div",W,[t[1]||(t[1]=f("div",{class:"title"},"\u5217\u8868",-1)),f("div",X,[y(i,{modelValue:k.value,"onUpdate:modelValue":t[0]||(t[0]=u=>k.value=u),class:"mb-16",placeholder:"\u6309\u540D\u79F0\u641C\u7D22"},{append:h(()=>[y(d,{icon:"Search",onClick:j})]),_:1},8,["modelValue"]),y(b,null,{default:h(()=>[y(m,{ref_key:"treeRef",ref:s,data:N.value,class:"filter-tree","node-key":o.defaultProps.value,"default-checked-keys":e.defaultData&&e.defaultData.length&&e.defaultData.map(u=>u[o.defaultProps.value])||[],"current-node-key":e.defaultData&&e.defaultData.length&&e.defaultData[0][o.defaultProps.value]||void 0,load:K,lazy:"",props:o.defaultProps,"show-checkbox":o.showCheckbox,"check-on-click-node":!o.showCheckbox,"check-strictly":"","highlight-current":!o.showCheckbox,"filter-node-method":U,"default-expand-all":G.value,"default-expanded-keys":o.defaultExpandedkeys,onCheck:z},null,8,["data","node-key","default-checked-keys","current-node-key","props","show-checkbox","check-on-click-node","highlight-current","default-expand-all","default-expanded-keys"])]),_:1})])]),f("div",Y,[f("div",ee,"\u5DF2\u9009"+I(o.title),1),f("div",ae,[(E(!0),H(q,null,J(n.value,(u,x)=>(E(),R(g,{key:u.key,closable:"",onClose:D=>Z(x,u.key,u.type)},{default:h(()=>[P(I(o.type==="LINE"?u.businessStripName:u.title),1)]),_:2},1032,["onClose"]))),128))])])])]),_:1},8,["model-value","title"])}}});export{oe as _};