mirror of
https://github.com/XiaoDaiGua-Ray/ray-template.git
synced 2025-04-05 19:42:07 +08:00
2 lines
7.8 KiB
JavaScript
2 lines
7.8 KiB
JavaScript
import{X as _,Y as $,T as J,z as G,Z as Q,$ as W}from"./hooks-Bj7ZB3r7.js";import{m as ee}from"./utils-B8caOipb.js";import"./currency.js@2.0.4-9OAR_aOO.js";import"./print-js@1.6.0-CSPo0Tcq.js";import{a as te}from"./vue-hooks-plus@2.2.1_vue@3.5.13_typescript@5.6.3_-DeuJXZu8.js";import"./js-cookie@3.0.5-Z_8Sd105.js";import"./lodash@4.17.21-DdnujIRq.js";import"./screenfull@5.2.0-Beyjefx-.js";import"./jsbarcode@3.11.6-oBoQ6a3L.js";import"./@logicflow_core@2.0.6-RNiIy_D6.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-7NKHtLUb.js";import{M as I}from"./mockjs@1.1.0-lzRjfrGS.js";import{d as U}from"./dayjs@1.11.13-DmclB1g0.js";import{ag as T,M as O,H as ae,ak as ue,e as f,P as m,N as L,I as j,al as z,an as b,w as oe}from"./naive-ui@2.40.3_vue@3.5.13_typescript@5.6.3_-CZFQeI4L.js";import{l as re,b as e,F as le,I as l,p as ie}from"./@vue_runtime-core@3.5.13-FNhVYeFi.js";import{k as c}from"./@vue_reactivity@3.5.13-BUI-9P27.js";import"./lodash-es@4.17.21-B-5kLwAl.js";import"./@vueuse_core@12.0.0_typescript@5.6.3-DSJFxvR9.js";import"./@vueuse_shared@12.0.0_typescript@5.6.3-DhXqtHXH.js";import"./pinia-plugin-persistedstate@4.1.3_pinia@2.3.0_typescript@5.6.3_vue@3.5.13_typescript@5.6.3____kx5gunx5jwh3gvgzh5d2u2kbi4-_Zka_ujQ.js";import"./destr@2.0.3-CVtkxrq9.js";import"./deep-pick-omit@1.2.1-CegYQlcN.js";import"./pinia@2.3.0_typescript@5.6.3_vue@3.5.13_typescript@5.6.3_-zdc5zJ8x.js";import"./vue-demi@0.14.10_vue@3.5.13_typescript@5.6.3_-Dq6ymT-8.js";import"./html-to-image@1.11.11-BOFdlgi9.js";import"./vue-router@4.4.0_vue@3.5.13_typescript@5.6.3_-CdXxuyUY.js";import"./@vue_runtime-dom@3.5.13-C1AIWBZo.js";import"./@vue_shared@3.5.13-DbMIZLZJ.js";import"./interactjs@1.10.27-dRxyG-hL.js";import"./call-bind@1.0.7-Cpj98o6Y.js";import"./vue-i18n@9.13.1_vue@3.5.13_typescript@5.6.3_-e4Dl3Spz.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.1-BLGAYSDN.js";import"./zrender@5.6.0-9xYeh_X5.js";import"./tslib@2.3.0-BDyQ-Jie.js";import"./mobx@5.15.7-CEMJDQot.js";import"./uuid@9.0.1-CQkTLCs1.js";import"./classnames@2.5.1-CXGZkgDa.js";import"./mousetrap@1.6.5-CZlDLqk3.js";import"./mobx-utils@5.6.2_mobx@5.15.7-C1xBETkd.js";import"./axios@1.7.9-upsvKRUO.js";import"./date-fns@3.6.0-C0m45l1x.js";import"./seemly@0.3.8-BnJ6M8Cl.js";import"./vueuc@0.4.64_vue@3.5.13_typescript@5.6.3_-g_YJteXV.js";import"./evtd@0.2.4-CI_DDEu_.js";import"./@css-render_vue3-ssr@0.15.14_vue@3.5.13_typescript@5.6.3_-1AdBj0rS.js";import"./vooks@0.2.12_vue@3.5.13_typescript@5.6.3_-DTvtyBlr.js";import"./vdirs@0.1.8_vue@3.5.13_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-8suFmB8o.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}=W(),[h,{runTableRequest:v,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),w=c({}),k=c((()=>{const d=[],o=U().valueOf();for(let r=0;r<30;r++)d.push({key:ee(),name:I.Random.cname(),age:r+20,address:I.Random.city(),tags:["nice","developer"],remark:"我是一条很长很长的备注",status:r%2===0?"success":"error",statusText:r%2===0?"在线":"离线",signTimeStart:U(o).add(r*2,"year").valueOf(),signTimeEnd:U(o).add(r+5,"day").valueOf()});return d})()),F=c({pagination:!0,manual:!1}),[q,{checkedRowKeysBind:x,getKeys:P,getRows:A,clearKey:R,clearAll:t,selectKey:M}]=$(i,g,{rowKey:"key",onChange:(u,d,o)=>{}}),V=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 Z=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))?Z:s.length,message:"success",page:o,pageSize:r})},1e3)}),{run:X,loading:Y}=te(H,{onSuccess:u=>{const{data:d,total:o}=u;i.value=d,y.value=o}});return{tableDataRef:i,baseColumns:g,itemCountRef:y,loadingGetPersonList:Y,runGetPersonList:X,conditionRef:w,radioRef:F,runTableRequest:v,tableProRegister:h,print:D,downloadCsv:n,checkedRowKeysBind:x,checkedRowKeys:q,getKeys:P,getRows:A,clearKey:R,clearAll:t,collapseRef:V,selectKey:M}},render(){const{tableDataRef:a,baseColumns:h,itemCountRef:v,loadingGetPersonList:E,runGetPersonList:D,conditionRef:n,radioRef:i,runTableRequest:g,tableProRegister:y,print:w,downloadCsv:k,checkedRowKeysBind:F,getKeys:q,getRows:x,clearKey:P,clearAll:A,selectKey:R}=this;return e(f,{vertical:!0},{default:()=>[e(J,{open:this.collapseRef,bordered:!0},{default:()=>e(le,null,[e(T,{label:"用户名"},{default:()=>[e(O,{value:n.name,"onUpdate:value":t=>n.name=t,clearable:!0},null)]}),e(T,{label:"状态"},{default:()=>[e(ae,{value:n.status,"onUpdate:value":t=>n.status=t,clearable:!0,options:[{label:"成功",value:"success"},{label:"失败",value:"error"}]},null)]}),e(T,{label:"登陆时间"},{default:()=>[e(ue,{type:"datetimerange",value:n.RangeTime,"onUpdate:value":t=>n.RangeTime=t,clearable:!0},null)]}),e(T,{label:"演示折叠的条件框"},{default:()=>[e(O,{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(G,{name:"dark",size:"18"},null)}):e(m,{onClick:()=>this.collapseRef=!1,secondary:!0},{default:()=>"受控收起",icon:()=>e(G,{name:"light",size:"18"},null)})}),e(L,{title:"常用高级拓展功能"},{default:()=>[e(f,null,{default:()=>[e(j,{label:"分页"},{default:()=>[e(z,{value:i.pagination,"onUpdate:value":t=>i.pagination=t},{default:()=>[e(b,{value:!0},{default:()=>[l("显示分页")]}),e(b,{value:!1},{default:()=>[l("隐藏分页")]})]})]}),e(j,{label:"自动更新"},{default:()=>[e(z,{value:i.manual,"onUpdate:value":t=>i.manual=t},{default:()=>[e(b,{value:!1},{default:()=>[l("自动更新")]}),e(b,{value:!0},{default:()=>[l("取消自动")]})]})]})]})]}),e(L,{title:"useTablePro 部分方法"},{default:()=>[e(f,null,{default:()=>[e(m,{type:"primary",onClick:()=>w()},{default:()=>[l("打印")]}),e(m,{type:"primary",onClick:()=>k()},{default:()=>[l("下载 csv")]})]})]}),e(L,{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(Q,{onRegister:y,data:a,columns:h,loading:E,paginationCount:v,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:F},null)]})}});export{ft as default};
|