ray-template/js/TablePro-Ce1OT4eD.js

2 lines
7.8 KiB
JavaScript

import{V as _,W as J,P as Q,v as q,X as Z,Y as $}from"./hooks-yKQIzKXx.js";import{k as ee}from"./utils-DJWgFDlo.js";import"./currency.js@2.0.4-9OAR_aOO.js";import"./print-js@1.6.0-BdoEj60G.js";import{a as te}from"./vue-hooks-plus@2.2.1_vue@3.5.12_typescript@5.6.3_--wFVw10U.js";import"./js-cookie@3.0.5-Z_8Sd105.js";import"./lodash@4.17.21-Cw59kuJw.js";import"./screenfull@5.2.0-DmMZCkhi.js";import"./jsbarcode@3.11.6-DGNGFp02.js";import"./@logicflow_core@2.0.6-CHqfytjt.js";import"./mobx-preact@3.0.0_mobx@5.15.7_preact@10.22.0-q-IhwcFu.js";import"./preact@10.22.0-D1_UwAj3.js";import"./instance-DGp8AH04.js";import{M as x}from"./mockjs@1.1.0-CxlURkif.js";import{d as L}from"./dayjs@1.11.10-C8LoRVP6.js";import{ag as v,L as j,G as ae,ak as ue,c as f,O as m,N as U,H as I,al as V,an as T,v as oe}from"./naive-ui@2.40.1_vue@3.5.12_typescript@5.6.3_-D3cUk1tG.js";import{l as re,b as e,F as le,I as l,p as ie}from"./@vue_runtime-core@3.5.12-rIgKm_Vg.js";import{k as c}from"./@vue_reactivity@3.5.12-Bs6EYLxJ.js";import"./lodash-es@4.17.21-B-5kLwAl.js";import"./@vueuse_core@11.1.0_vue@3.5.12_typescript@5.6.3_-ZDBD96r1.js";import"./@vueuse_shared@11.1.0_vue@3.5.12_typescript@5.6.3_-DnrABUGp.js";import"./pinia-plugin-persistedstate@4.1.1_pinia@2.2.4_typescript@5.6.3_vue@3.5.12_typescript@5.6.3____dh65odvamx6uymfx32yexjadga-_Zka_ujQ.js";import"./destr@2.0.3-CVtkxrq9.js";import"./deep-pick-omit@1.2.1-CegYQlcN.js";import"./pinia@2.2.4_typescript@5.6.3_vue@3.5.12_typescript@5.6.3_-BdVsFNKX.js";import"./vue-demi@0.14.10_vue@3.5.12_typescript@5.6.3_-Dq6ymT-8.js";import"./html-to-image@1.11.11-BOFdlgi9.js";import"./vue-router@4.3.2_vue@3.5.12_typescript@5.6.3_-Brd4YmBy.js";import"./vue-i18n@9.13.1_vue@3.5.12_typescript@5.6.3_-DVUVmCuN.js";import"./@intlify_shared@9.13.1-BxU0OzX2.js";import"./@intlify_core-base@9.13.1-C6DqbPB6.js";import"./@intlify_message-compiler@9.13.1-GrLDMuy_.js";import"./echarts@5.5.0-CezqL3m-.js";import"./zrender@5.5.0-DW8ownf1.js";import"./tslib@2.3.0-BDyQ-Jie.js";import"./@vue_runtime-dom@3.5.12-BKraWVUW.js";import"./@vue_shared@3.5.12--5_uv9t5.js";import"./interactjs@1.10.26-DZL_TZzP.js";import"./call-bind@1.0.7-Cpj98o6Y.js";import"./mobx@5.15.7-CEMJDQot.js";import"./uuid@9.0.1-CQkTLCs1.js";import"./classnames@2.5.1-nUTIn1-D.js";import"./mousetrap@1.6.5-BTGDluHR.js";import"./mobx-utils@5.6.2_mobx@5.15.7-C1xBETkd.js";import"./axios@1.7.5-C8DqakIB.js";import"./date-fns@3.6.0-q9PkOyxq.js";import"./seemly@0.3.8-DjGKl9dV.js";import"./vueuc@0.4.64_vue@3.5.12_typescript@5.6.3_-BcAtcaHt.js";import"./evtd@0.2.4-CI_DDEu_.js";import"./@css-render_vue3-ssr@0.15.14_vue@3.5.12_typescript@5.6.3_-BZYDXyJG.js";import"./vooks@0.2.12_vue@3.5.12_typescript@5.6.3_--iLh4DJ5.js";import"./vdirs@0.1.8_vue@3.5.12_typescript@5.6.3_-C0KV5pCE.js";import"./@juggle_resize-observer@3.4.0-C8OzoCMD.js";import"./css-render@0.15.14-C5toWlUr.js";import"./@emotion_hash@0.8.0-WldOFDRm.js";import"./treemate@0.3.11-DKekKYbv.js";import"./date-fns-tz@3.1.3_date-fns@3.6.0-ztskLDQQ.js";import"./async-validator@4.2.5-DKvM95Vc.js";import"./@css-render_plugin-bem@0.15.14_css-render@0.15.14-Be8eOoM-.js";function se(a){return typeof a=="function"||Object.prototype.toString.call(a)==="[object Object]"&&!ie(a)}const ft=re({name:"TableProDemo",setup(){const{format:a}=$(),[b,{runTableRequest:h,getCurrentTableRequestParams:E,print:D,downloadCsv:n}]=_(),i=c([]),g=[{type:"selection"},{title:"Name",key:"name"},{title:"Sign Status",key:"statusText"},{title:"Sign Time",key:"signTimeStart",render:u=>a(u.signTimeStart)+" ~ "+a(u.signTimeEnd)},{title:"Age",key:"age"},{title:"Address",key:"address"},{title:"Tags",key:"tags",render:u=>u.tags.map(o=>e(oe,{type:"info",bordered:!1,style:"margin-right: 6px"},se(o)?o:{default:()=>[o]}))},{title:"Remark",key:"remark"}],y=c(0),F=c({}),k=c((()=>{const d=[],o=L().valueOf();for(let r=0;r<30;r++)d.push({key:ee(),name:x.Random.cname(),age:r+20,address:x.Random.city(),tags:["nice","developer"],remark:"我是一条很长很长的备注",status:r%2===0?"success":"error",statusText:r%2===0?"在线":"离线",signTimeStart:L(o).add(r*2,"year").valueOf(),signTimeEnd:L(o).add(r+5,"day").valueOf()});return d})()),w=c({pagination:!0,manual:!1}),[G,{checkedRowKeysBind:O,getKeys:P,getRows:A,clearKey:R,clearAll:t,selectKey:z}]=J(i,g,{rowKey:"key",onChange:(u,d,o)=>{}}),M=c(!0),C=u=>u==null,H=u=>new Promise(d=>{const{page:o=1,pageSize:r=10,name:K,status:N,signTimeStart:B,signTimeEnd:S}=u||{};let s=k.value;const Y=k.value.length;K&&(s=s.filter(p=>p.name.includes(K))),N&&(s=s.filter(p=>p.status===N)),B&&S&&(s=s.filter(p=>p.signTimeStart>=B&&p.signTimeEnd<=S)),s=s.slice((o-1)*r,o*r),setTimeout(()=>{d({code:0,data:s,total:C(N)&&C(K)&&(C(B)||C(S))?Y:s.length,message:"success",page:o,pageSize:r})},1e3)}),{run:W,loading:X}=te(H,{onSuccess:u=>{const{data:d,total:o}=u;i.value=d,y.value=o}});return{tableDataRef:i,baseColumns:g,itemCountRef:y,loadingGetPersonList:X,runGetPersonList:W,conditionRef:F,radioRef:w,runTableRequest:h,tableProRegister:b,print:D,downloadCsv:n,checkedRowKeysBind:O,checkedRowKeys:G,getKeys:P,getRows:A,clearKey:R,clearAll:t,collapseRef:M,selectKey:z}},render(){const{tableDataRef:a,baseColumns:b,itemCountRef:h,loadingGetPersonList:E,runGetPersonList:D,conditionRef:n,radioRef:i,runTableRequest:g,tableProRegister:y,print:F,downloadCsv:k,checkedRowKeysBind:w,getKeys:G,getRows:O,clearKey:P,clearAll:A,selectKey:R}=this;return e(f,{vertical:!0},{default:()=>[e(Q,{open:this.collapseRef,bordered:!0},{default:()=>e(le,null,[e(v,{label:"用户名"},{default:()=>[e(j,{value:n.name,"onUpdate:value":t=>n.name=t,clearable:!0},null)]}),e(v,{label:"状态"},{default:()=>[e(ae,{value:n.status,"onUpdate:value":t=>n.status=t,clearable:!0,options:[{label:"成功",value:"success"},{label:"失败",value:"error"}]},null)]}),e(v,{label:"登陆时间"},{default:()=>[e(ue,{type:"datetimerange",value:n.RangeTime,"onUpdate:value":t=>n.RangeTime=t,clearable:!0},null)]}),e(v,{label:"演示折叠的条件框"},{default:()=>[e(j,{readonly:!0,placeholder:"我只是为了占位"},null)]})]),action:()=>e(f,null,{default:()=>[e(m,{type:"primary",onClick:()=>g(),loading:E},{default:()=>[l("查询")]})]}),collapse:t=>t?e(m,{onClick:()=>this.collapseRef=!0,secondary:!0},{default:()=>"受控展开",icon:()=>e(q,{name:"dark",size:"18"},null)}):e(m,{onClick:()=>this.collapseRef=!1,secondary:!0},{default:()=>"受控收起",icon:()=>e(q,{name:"light",size:"18"},null)})}),e(U,{title:"常用高级拓展功能"},{default:()=>[e(f,null,{default:()=>[e(I,{label:"分页"},{default:()=>[e(V,{value:i.pagination,"onUpdate:value":t=>i.pagination=t},{default:()=>[e(T,{value:!0},{default:()=>[l("显示分页")]}),e(T,{value:!1},{default:()=>[l("隐藏分页")]})]})]}),e(I,{label:"自动更新"},{default:()=>[e(V,{value:i.manual,"onUpdate:value":t=>i.manual=t},{default:()=>[e(T,{value:!1},{default:()=>[l("自动更新")]}),e(T,{value:!0},{default:()=>[l("取消自动")]})]})]})]})]}),e(U,{title:"useTablePro 部分方法"},{default:()=>[e(f,null,{default:()=>[e(m,{type:"primary",onClick:()=>F()},{default:()=>[l("打印")]}),e(m,{type:"primary",onClick:()=>k()},{default:()=>[l("下载 csv")]})]})]}),e(U,{title:"useCheckedRowKeys 部分方法"},{default:()=>[e(f,null,{default:()=>[e(m,{type:"primary",onClick:()=>{const t=a[1].key;R(t)}},{default:()=>[l("选中第二行")]}),e(m,{type:"primary",onClick:()=>{const t=a[1].key;P(t)}},{default:()=>[l("取消选中第二行")]}),e(m,{type:"primary",onClick:()=>{a==null||a.forEach(t=>R(t.key))}},{default:()=>[l("选中当前页面所有行")]}),e(m,{type:"primary",onClick:()=>{A()}},{default:()=>[l("取消所有已选中行")]})]})]}),e(Z,{onRegister:y,data:a,columns:b,loading:E,paginationCount:h,request:D,requestConfig:{params:n,formatRangeTime:[{key:"RangeTime",target:["signTimeStart","signTimeEnd"]}]},showPagination:i.pagination,manual:i.manual,rowKey:t=>t.key,checkedRowKeys:this.checkedRowKeys,"onUpdate:checkedRowKeys":t=>this.checkedRowKeys=t,onUpdateCheckedRowKeys:w},null)]})}});export{ft as default};