mirror of
https://github.com/XiaoDaiGua-Ray/ray-template.git
synced 2025-04-06 03:57:49 +08:00
2 lines
7.8 KiB
JavaScript
2 lines
7.8 KiB
JavaScript
import{W as Y,X as Z,Q as _,z as j,Y as J,Z as $}from"./hooks-DKN08swi.js";import{k as ee}from"./utils-DMI3ftdH.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.13_typescript@5.6.3_-3eMKHOaU.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-CzbCXUZF.js";import{M as q}from"./mockjs@1.1.0-CxlURkif.js";import{d as L}from"./dayjs@1.11.10-C8LoRVP6.js";import{af as T,L as x,G as ae,aj as ue,c as f,O as m,N as U,H as I,ak as z,am as b,v as oe}from"./naive-ui@2.40.1_vue@3.5.13_typescript@5.6.3_-Bx4bEkBQ.js";import{l as re,b as e,F as le,I as l,p as ie}from"./@vue_runtime-core@3.5.13-BEg_yh4N.js";import{k as c}from"./@vue_reactivity@3.5.13-Ch1DBDRK.js";import"./lodash-es@4.17.21-B-5kLwAl.js";import"./@vueuse_core@11.2.0_vue@3.5.13_typescript@5.6.3_-qLonknDl.js";import"./@vueuse_shared@11.2.0_vue@3.5.13_typescript@5.6.3_-C-DuMGMJ.js";import"./pinia-plugin-persistedstate@4.1.1_pinia@2.2.4_typescript@5.6.3_vue@3.5.13_typescript@5.6.3____yt6biirdeg4kqzievtaggbt2mm-_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.13_typescript@5.6.3_-BSK3SS9R.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.3.2_vue@3.5.13_typescript@5.6.3_-BP6RbFeK.js";import"./vue-i18n@9.13.1_vue@3.5.13_typescript@5.6.3_-B3N1nvv4.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-C65RY-Xl.js";import"./zrender@5.6.0-1zVsYK9t.js";import"./tslib@2.3.0-BDyQ-Jie.js";import"./@vue_runtime-dom@3.5.13-BO5HcqNg.js";import"./@vue_shared@3.5.13-Dh1pNJXy.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.13_typescript@5.6.3_-BkAdx2tT.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_-BRDj2ZMK.js";import"./vooks@0.2.12_vue@3.5.13_typescript@5.6.3_-B9mUPMHL.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-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}=$(),[v,{runTableRequest:h,getCurrentTableRequestParams:E,print:D,downloadCsv:n}]=Y(),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:q.Random.cname(),age:r+20,address:q.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:V}]=Z(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 X=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))?X:s.length,message:"success",page:o,pageSize:r})},1e3)}),{run:Q,loading:W}=te(H,{onSuccess:u=>{const{data:d,total:o}=u;i.value=d,y.value=o}});return{tableDataRef:i,baseColumns:g,itemCountRef:y,loadingGetPersonList:W,runGetPersonList:Q,conditionRef:F,radioRef:w,runTableRequest:h,tableProRegister:v,print:D,downloadCsv:n,checkedRowKeysBind:O,checkedRowKeys:G,getKeys:P,getRows:A,clearKey:R,clearAll:t,collapseRef:M,selectKey:V}},render(){const{tableDataRef:a,baseColumns:v,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(_,{open:this.collapseRef,bordered:!0},{default:()=>e(le,null,[e(T,{label:"用户名"},{default:()=>[e(x,{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(x,{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(j,{name:"dark",size:"18"},null)}):e(m,{onClick:()=>this.collapseRef=!1,secondary:!0},{default:()=>"受控收起",icon:()=>e(j,{name:"light",size:"18"},null)})}),e(U,{title:"常用高级拓展功能"},{default:()=>[e(f,null,{default:()=>[e(I,{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(I,{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(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(J,{onRegister:y,data:a,columns:v,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};
|