You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
4.2 KiB
JavaScript

var p=(d,I,n)=>new Promise((m,t)=>{var g=r=>{try{u(n.next(r))}catch(c){t(c)}},x=r=>{try{u(n.throw(r))}catch(c){t(c)}},u=r=>r.done?m(r.value):Promise.resolve(r.value).then(g,x);u((n=n.apply(d,I)).next())});import{a as V,B as K}from"./index-DOVZCDDs.js";import{_ as P}from"./index-C-9S90nC.js";import{d as A,u as E}from"./index-D0hduhwK.js";import{u as O,_ as U}from"./useTable-nv9giSxv.js";import"./index-DduuDa4W.js";import{D as $}from"./dictEnum-DeC8h6ZR.js";import{u as z}from"./useRender-DWuk4S5z.js";import{bh as q,_ as G}from"./entry/index-DbrbbsCh-1723702159782.js";import{ap as k,y as W,a6 as j,aC as y,ao as H}from"./antd-BY-1PcYE.js";import{d as J,f as w,r as Q,o as X,_ as l,a8 as f,a9 as o,k as h,u as e,ad as S,ac as v,ak as Y,al as Z,$ as D,ab as ee,G as te,a1 as ae,F as R}from"./vue-aEZWZQSa.js";import"./useWindowSizeFn-DE1eO4db.js";import"./useForm-CWPDAxdO.js";import"./FormItem.vue_vue_type_script_lang-DQcDBttf.js";import"./componentMap-CVvNnVzI.js";import"./RadioButtonGroup.vue_vue_type_script_setup_true_lang-Czt7G3zm.js";import"./copyTextToClipboard-BBFF3Y3I.js";import"./onMountedOrActivated-BIJ0U1R1.js";import"./style-ZVTxFzof.js";import"./helper-nGdd1AW2.js";import"./BasicForm.vue_vue_type_style_index_0_lang-fWyk1YG7.js";import"./sortable.esm-CnNXHMH-.js";import"./useSortable-CyjTTtzk.js";import"./download-BsJ55YCN.js";import"./useLoading-CZUdUDy4.js";import"./index-ByoXcKeN.js";import"./dict-Ci6HGAuf.js";const{renderDict:re}=z(),se=[{dataIndex:"userName",title:"名称"},{dataIndex:"nickName",title:"昵称"},{dataIndex:"avatar",title:"头像",width:80},{dataIndex:"deptName",title:"部门"},{dataIndex:"phonenumber",title:"手机号"},{dataIndex:"status",title:"状态",customRender({value:d}){return re(d,$.NORMAL_DISABLE)}},{dataIndex:"createTime",title:"创建时间"}],oe=[{field:"userName",label:"用户账号",component:"Input"},{field:"phonenumber",label:"手机号码",component:"Input"}],le=J({name:"UserSelectModal",__name:"index",props:{multiple:{type:Boolean,required:!1,default:!0}},emits:["register","selectDone"],setup(d,{emit:I}){const n=d,m=w(""),t=Q({tree:[],selectDeptId:[]}),g=w(!0);function x(){return p(this,null,function*(){yield r()})}X(()=>p(this,null,function*(){const a=yield A();q(a,i=>{i.icon="el:group"}),t.tree=a,g.value=!1}));const[u,{reload:r,getSelectRows:c,setSelectedRows:C,setSelectedRowKeys:T}]=O({rowSelection:{type:n.multiple?"checkbox":"radio"},showSelectionBar:!0,clickToRowSelect:!0,clearSelectOnPageChange:!1,showIndexColumn:!1,size:"small",api:E,rowKey:"userId",useSearchForm:!0,formConfig:{schemas:oe,name:"user",baseColProps:{xs:24,sm:24,md:24,lg:8},labelWidth:80,resetFunc:()=>p(this,null,function*(){t.selectDeptId=[],m.value="",yield r()})},columns:se,beforeFetch(a){return t.selectDeptId.length===1&&(a.deptId=t.selectDeptId[0]),a}}),[N,{closeModal:M}]=V(B);function B(a){return p(this,null,function*(){a&&a.length&&T(a)})}const F=I;function L(){F("selectDone",c()),M(),b()}function b(){C([])}return(a,i)=>(l(),f(e(K),S(a.$attrs,{title:"用户选择",defaultFullscreen:"",canFullscreen:!1,onRegister:e(N),onOk:L,onCancel:b}),{default:o(()=>[h(e(H),null,{default:o(()=>[h(e(k),S({xs:24,sm:24,md:24,lg:4},{class:"h-[calc(100vh-80px)]"}),{default:o(()=>[h(e(W),{active:!0,paragraph:{rows:8},loading:g.value},{default:o(()=>[t.tree.length?(l(),f(e(P),{key:0,fieldNames:{title:"label",key:"id"},"tree-data":t.tree,showLine:{showLeafIcon:!1},search:!0,searchValue:m.value,"onUpdate:searchValue":i[0]||(i[0]=s=>m.value=s),defaultExpandAll:"",onSelect:x,selectedKeys:t.selectDeptId,"onUpdate:selectedKeys":i[1]||(i[1]=s=>t.selectDeptId=s)},null,8,["tree-data","searchValue","selectedKeys"])):v("",!0)]),_:1},8,["loading"])]),_:1},16),h(e(k),Y(Z({xs:24,sm:24,md:24,lg:20})),{default:o(()=>[h(e(U),{onRegister:e(u)},{tableTitle:o(()=>[(l(!0),D(R,null,ee(e(c)(),s=>(l(),f(e(j),{key:s.userId},{default:o(()=>[te(ae(s.nickName),1)]),_:2},1024))),128))]),bodyCell:o(({column:s,record:_})=>[s&&_&&s.dataIndex==="avatar"?(l(),D(R,{key:0},[_.avatar?(l(),f(e(y),{key:0,src:_.avatar},null,8,["src"])):(l(),f(e(y),{key:1,src:"https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png"}))],64)):v("",!0)]),_:1},8,["onRegister"])]),_:1},16)]),_:1})]),_:1},16,["onRegister"]))}}),Le=G(le,[["__scopeId","data-v-503fb061"]]);export{Le as default};