index-legacy-a561af25-1734950731618.js 3.4 KB

1
  1. System.register(["./index-legacy-4630884d-1734950731618.js"],(function(e,a){"use strict";var t,s,i,r,p,h,n,o,c,g;return{setters:[e=>{t=e.d,s=e.a,i=e.e,r=e.r,p=e.q,h=e.T,n=e.A,o=e.U,c=e.f,g=e.be}],execute:function(){var a=document.createElement("style");a.textContent="._pagination_10j50_1{margin-top:.625vw;justify-content:flex-end;--n-item-size: max(2.08333333vw, 36Px) !important}\n",document.head.appendChild(a);class l{saveKey="searchs";initSearch={form:{},page:{}};searchs={};key="";constructor(e){this.key=e,this.searchs=this.parse()}save(){localStorage.setItem(this.saveKey,JSON.stringify(this.searchs))}parse(){let e={...u};try{const a=localStorage.getItem(this.saveKey);e=JSON.parse(a)||e}catch(a){}return e}get(e){const a=e||this.key;return this.searchs[a]||(this.searchs[a]={...u}),this.searchs[a]}remove(e){return this.searchs&&this.searchs[this.key]&&(e?delete this.searchs[this.key][e]:delete this.searchs[this.key],this.save()),this.searchs}getSearchs(){return this.searchs}removeByKey(e){return console.log("真正的删",e),delete this.searchs[e],this.save(),this.searchs}removeAll(){return this.searchs={},localStorage.setItem(this.saveKey,JSON.stringify(this.searchs)),this.searchs}removeByRouter(e){this.searchs=this.parse();for(const a in this.searchs)e!==a&&e!==this.searchs[a]?.bind||(console.log("清除的页面",a),this.removeByKey(a))}removeByOtherRouter(e){this.searchs=this.parse();for(const a in this.searchs)e===a||e===this.searchs[a]?.bind||this.removeByKey(a)}update(e,a,t){this.searchs=this.parse();const s=a||this.key;return this.searchs[s]||(this.searchs[s]={...u}),t?this.searchs[s][t]=e:this.searchs[s]=e,this.save(),this.searchs}}e("S",l);const u={form:{},page:{}},d="_pagination_10j50_1";e("P",t({name:"table-container",props:{page:{type:Number,default:1,required:!0},pageSize:{type:Number,default:10},pageTotal:{type:Number,default:0},saveKey:{type:String,default:""},sync:{type:Boolean,default:!1},checkedRowKeysRef:{type:Object},disabled:{type:Boolean,default:!1},pageSizes:{type:Array,default:()=>[10,20,30,40]}},emits:["update:page","update:pageSize","list"],setup(e,{emit:a}){const t=s(),u=i({pageInformation:null}),y=r(0);y.value=Math.ceil(e.pageTotal/e.pageSize);const v=e=>{a("update:page",e),a("list"),f()},m=e=>{a("update:pageSize",e),a("update:page",1),a("list"),f()};p((()=>{if(e.sync){const s=new l(e.saveKey||t.path),i=s.get(e.saveKey||t.path);if(u.pageInformation=i,i&&i.page)for(const e in i.page)if(i.page.hasOwnProperty(e)&&["page","pageSize"].includes(e)){const t=i.page[e];a(`update:${e}`,t)}e.saveKey&&s.update(t.path,void 0,"bind")}window.addEventListener("watchStorage",z)})),h((()=>{window.removeEventListener("watchStorage",z)})),n((()=>e.pageSize),(()=>{y.value=Math.ceil(e.pageTotal/e.pageSize),f()})),n((()=>e.page),(()=>{f()})),n((()=>e.pageTotal),(()=>{y.value=Math.ceil(e.pageTotal/e.pageSize),f()}));const S=o({get:()=>e.page,set(e){a("update:page",e)}}),f=()=>{e.sync&&new l(e.saveKey||t.path).update({page:e.page,pageCount:y.value,pageSize:e.pageSize,saveKey:e.saveKey},void 0,"page")},z=()=>{const e=u.pageInformation&&u.pageInformation.page?u.pageInformation.page:null;S.value=e&&e.page?e.page:1};return()=>c(g,{disabled:e.disabled,class:d,page:e.page,"onUpdate:page":a=>e.page=a,displayOrder:["quick-jumper","pages","size-picker"],pageCount:y.value,showQuickJumper:!0,showSizePicker:!0,pageSize:e.pageSize,prefix:()=>`共 ${e.pageTotal} 条`,pageSizes:e.pageSizes,onUpdatePage:v,onUpdatePageSize:m},null)}}))}}}));