Files
qhmes/web-dist/js/DeptSelectModal-BB7o3IIg.js

2 lines
8.8 KiB
Java
Raw Normal View History

2026-06-16 18:19:57 +08:00
var ie=Object.defineProperty,ue=Object.defineProperties;var ce=Object.getOwnPropertyDescriptors;var ne=Object.getOwnPropertySymbols;var fe=Object.prototype.hasOwnProperty,de=Object.prototype.propertyIsEnumerable;var le=(t,a,l)=>a in t?ie(t,a,{enumerable:!0,configurable:!0,writable:!0,value:l}):t[a]=l,_=(t,a)=>{for(var l in a||(a={}))fe.call(a,l)&&le(t,l,a[l]);if(ne)for(var l of ne(a))de.call(a,l)&&le(t,l,a[l]);return t},oe=(t,a)=>ue(t,ce(a));var P=(t,a,l)=>new Promise((K,S)=>{var C=u=>{try{c(l.next(u))}catch(s){S(s)}},f=u=>{try{c(l.throw(u))}catch(s){S(s)}},c=u=>u.done?K(u.value):Promise.resolve(u.value).then(C,f);c((l=l.apply(t,a)).next())});import{B as ye}from"./index-BDvqZ5j4.js";import{d as he,fp as me,fq as pe,i as ge,as as ee,aO as ve,b2 as ke,fr as Se,fs as Ce,d1 as be,bH as Ke,au as Te,bY as De,aR as we,aS as Ee}from"./index-X7Y8jykP.js";import{t as Ae}from"./props-BWd0f6uH.js";import{B as Be}from"./index-Bzmv9Ie7.js";import{S as te,r as p,h as Ie,c as Le,n as ae,u as z,b as se,e as Oe,K as j,C as Pe,z as A,f as b,A as y,y as M,H as q,B as re,E as B}from"./vue-vendor-DNhG1Cve.js";import{T as Me}from"./TreeIcon-7lwypClM.js";import{a as Ve}from"./useModal-DaJ3Bflg.js";import"./index-CfNJyBRj.js";import{D as $e}from"./dropdown-jkliuVyN.js";function He(t,a,l,K,S){const C=te("selectOptions",p([])),f=te("selectValues",se({})),c=te("loadingEcho",p(!1)),u=p([]),s=p([]),h=p([]),T=p(!1),D=p(K.multiple?l.checkStrictly:!0),V=Le(()=>D.value);let I=!0,d=[];const k=p([]),$=l.enableAutoExpand!==!1;Ie(f,({value:e})=>{if(e&&e.length>0){if(ge(e,d))return;d=e,c.value=I,I=!1,L(null,e.join(",")).finally(()=>{c.value=!1})}},{immediate:!0});function g(){const e=z(t);return e||null}function x(e){return P(this,null,function*(){var n;if(!e||e.length===0)return[];try{const o=yield pe({departId:e.join(","),orgCode:(n=l.params)==null?void 0:n.orgCode});if(o){const r=[];return(o instanceof Map?Array.from(o.values()):Object.values(o)).forEach(m=>{if(m&&m.parentIds&&Array.isArray(m.parentIds)){const O=m.parentIds.filter(w=>!e.includes(w));r.push(...O)}}),[...new Set(r)]}return[]}catch(o){return[]}})}function F(){ae(()=>{l.defaultExpandLevel&&l.defaultExpandLevel>0&&g().filterByLevel(l.defaultExpandLevel),s.value=f.value,k.value.length>0&&g().setExpandedKeys(k.value)}).then(()=>{k.value.length>0&&setTimeout(()=>{g().setExpandedKeys(k.value)},100)})}function U(e,n){if(l.checkable==!1){s.value=l.checkStrictly?e.checked:e;const{selectedNodes:o}=n;let r=[];o.forEach(i=>{r.push(i)}),h.value=r}}function Q(e,n){if(n&&l.checkable==!0){if(!K.multiple){if(n.checked){s.value=[n.node.eventKey];let i=l.rowKey,m=n.checkedNodes.find(O=>O[i]===n.node.eventKey);h.value=[m]}else s.value=[],h.value=[];return}s.value=D.value?e.checked:e;const{checkedNodes:o}=n;let r=[];o.forEach(i=>{r.push(i)}),h.value=r}}function W(e){return P(this,null,function*(){g().checkAll(e),yield ae(),s.value=g().getCheckedKeys(),e?Y():h.value=[]})}function Y(){let e="";z(s).length>0&&(e=s.value.join(",")),a({ids:e}).then(n=>{h.value=n})}function G(e){g().expandAll(e)}function L(e,n){return P(this,null,function*(){var O;let o={},r="";e&&(r=e.eventKey,o.pid=e.value),n&&(r="",o.ids=n),(O=l.params)!=null&&O.departIds&&(o.departIds=l.params.departIds);let i=yield a(o),m=i;if(l.onlyShowCompany&&(i=J(i)),l.izOnlySelectDepartPost&&R(i),l.izShowDepartNameAbbr&&(i=X(i)),l.serverTreeData||(i=me(i,l,r),i.length==0&&e&&N(r,u.value)),T.value==!0){if(!e)u.value=i;else return new Promise(w=>{if(!e.children){w();return}const E=z(t);E&&(E.updateNodeByKey(e.eventKey,{children:i}),E.setExpandedKeys([e.eventKey,...E.getExpandedKeys()])),w()});F()}else{const w=[];m.forEach(E=>{w.push({label:E[l.labelKey],value:E[l.rowKey]})}),C.value=w}})}function J(e){return e.filter(o=>o.orgCategory&&["1","4"].includes(o.orgCategory))}function X(e){const n=e;return n.forEach(o=>{o.title=o.departNameAbbr||o.title}),n}function N(e,n){if(n&&n.length>0)for(let o of n)if(o.key==e){o.child||(o.isLeaf=!0);break}else N(e,o.children)}function Z(e){const n=[],o=[];h.value.forEach(r=>{n.push({label:r[l.labelKey],value:r[l.rowKey]})}),s.