123 |
- import{e as $,r as K,ai as Y,G as Z,f as I,a0 as h,ae as ee,g as u,h as b,t as te,p as w,q as m,A as i,x as A,F as V,Q as L,y as O,z as oe,R as ae,j as y,L as ne,aE as le,aF as se}from"./vue.e266cb73.js";import{S as re}from"./sortable.esm.1e7dbfeb.js";import{u as ie}from"./themeConfig.ed8e6a95.js";import{ad as ce}from"./index.dcc65bf7.js";import{_ as de}from"./_plugin-vue_export-helper.c27b6911.js";import"./index.f84209b0.js";const pe=()=>{let t=window.navigator.userAgent;if(t.indexOf("MSIE")>=0)return"ie";if(t.indexOf("Firefox")>=0)return"Firefox";if(t.indexOf("Chrome")>=0)return"Chrome";if(t.indexOf("Opera")>=0)return"Opera";if(t.indexOf("Safari")>=0)return"Safari"},he=(t,g)=>{pe()=="ie"?ue(t):me(t,g)},ue=(t,g)=>{let c=t,a=new ActiveXObject("Excel.Application"),r=a.Workbooks.Add(),d=r.Worksheets(1),f=document.body.createTextRange();f.moveToElementText(c),f.select,f.execCommand("Copy"),d.Paste(),a.Visible=!0;try{let e=a.Application.GetSaveAsFilename("Excel.xls","Excel Spreadsheets (*.xls), *.xls")}catch(e){print("Nested catch caught "+e)}finally{r.SaveAs(fname),r.Close(savechanges=!1),a.Quit(),a=null,window.setInterval("Cleanup();",1),window.setInterval("Cleanup();",1)}},me=function(){const t="data:application/vnd.ms-excel;base64,",g='<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"><head><meta charset="UTF-8"><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--></head><body><table>{table}</table></body></html>',c=function(r){return window.btoa(unescape(encodeURIComponent(r)))},a=(r,d)=>r.replace(/{(\w+)}/g,(f,e)=>d[e]);return(r,d)=>{const e=t+c(a(g,{worksheet:d,table:r}));if(navigator.userAgent.indexOf("Firefox")>-1)window.location.href=e;else{const x=document.createElement("a");x.href=e,x.download=d||"";let n;window.MouseEvent?n=new MouseEvent("click"):(n=document.createEvent("MouseEvents"),n.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null)),x.dispatchEvent(n)}}}(),fe=(t,g,c)=>{const a={image:x,text:e};let r=t.reduce((n,p)=>(n+=`<th>${p.title}</th>`,n),"");r=`<thead><tr>${r}</tr></thead>`;let d=g.reduce((n,p)=>{const T=t.reduce((v,_)=>(v+=a[_.type||"text"](p[_.key],_),v),"");return n+=`<tr>${T}</tr>`,n},"");d=`<tbody>${d}</tbody>`;const f=r+d;he(f,c);function e(n){return`<td style="text-align: center">${n}</td>`}function x(n,p){return p=Object.assign({width:40,height:60},p),`<td style="width: ${p.width}px; height: ${p.height}px; text-align: center; vertical-align: middle"><img src="${n}" width=${p.width} height=${p.height}></td>`}};const ge=t=>(le("data-v-6ed6a16f"),t=t(),se(),t),xe={class:"table-container"},ke=["src","width","height"],be={class:"table-footer mt15"},_e={class:"table-footer-tool"},we={class:"tool-box"},ye=["data-key"],ve=ge(()=>y("i",{class:"fa fa-arrows-alt handle cursor-pointer"},null,-1)),Ce=$({name:"netxTable"}),Se=$({...Ce,props:{data:{type:Array,default:()=>[]},header:{type:Array,default:()=>[]},config:{type:Object,default:()=>{}}},emits:["delRow","pageChange","sortHeader"],setup(t,{expose:g,emit:c}){const a=t,r=K(),d=ie(),{themeConfig:f}=Y(d),e=Z({page:{pageNum:1,pageSize:10},selectlist:[],checkListAll:!0,checkListIndeterminate:!1}),x=I(()=>!!a.config.isBorder),n=I(()=>a.config),p=I(()=>a.header.filter(l=>l.isCheck)),T=l=>{l?a.header.forEach(s=>s.isCheck=!0):a.header.forEach(s=>s.isCheck=!1),e.checkListIndeterminate=!1},v=()=>{const l=a.header.filter(s=>s.isCheck).length;e.checkListAll=l===a.header.length,e.checkListIndeterminate=l>0&&l<a.header.length},_=l=>{e.selectlist=l},R=l=>{c("delRow",l)},W=l=>{e.page.pageSize=l,c("pageChange",e.page)},U=l=>{e.page.pageNum=l,c("pageChange",e.page)},F=()=>{e.page.pageNum=1,e.page.pageSize=10,c("pageChange",e.page)},B=()=>{if(e.selectlist.length<=0)return ce.warning("请先选择要导出的数据");fe(a.header,e.selectlist,`${f.value.globalTitle} ${new Date().toLocaleString()}`)},D=()=>{c("pageChange",e.page)},H=()=>{ne(()=>{const l=re.create(r.value,{handle:".handle",dataIdAttr:"data-key",animation:150,onEnd:()=>{const s=[];l.toArray().forEach(k=>{a.header.forEach(C=>{C.key===k&&s.push({...C})})}),c("sortHeader",s)}})})};return g({pageReset:F}),(l,s)=>{const k=h("el-table-column"),C=h("el-button"),M=h("el-popconfirm"),j=h("el-empty"),q=h("el-table"),G=h("el-pagination"),S=h("SvgIcon"),P=h("el-tooltip"),E=h("el-checkbox"),Q=h("el-scrollbar"),X=h("el-popover"),J=ee("loading");return u(),b("div",xe,[te((u(),w(q,ae({data:t.data,border:x.value},l.$attrs,{"row-key":"id",stripe:"",style:{width:"100%"},onSelectionChange:_}),{empty:m(()=>[i(j,{description:"暂无数据"})]),default:m(()=>[t.config.isSelection?(u(),w(k,{key:0,type:"selection","reserve-selection":!0,width:"30"})):A("v-if",!0),t.config.isSerialNo?(u(),w(k,{key:1,type:"index",label:"序号",width:"60"})):A("v-if",!0),(u(!0),b(V,null,L(p.value,(o,z)=>(u(),w(k,{key:z,"show-overflow-tooltip":"",prop:o.key,width:o.colWidth,label:o.title},{default:m(N=>[o.type==="image"?(u(),b("img",{key:0,src:N.row[o.key],width:o.width,height:o.height},null,8,ke)):(u(),b(V,{key:1},[O(oe(N.row[o.key]),1)],64))]),_:2},1032,["prop","width","label"]))),128)),t.config.isOperate?(u(),w(k,{key:2,label:"操作",width:"100"},{default:m(o=>[i(M,{title:"确定删除吗?",onConfirm:z=>R(o.row)},{reference:m(()=>[i(C,{text:"",type:"primary"},{default:m(()=>[O("删除")]),_:1})]),_:2},1032,["onConfirm"])]),_:1})):A("v-if",!0)]),_:1},16,["data","border"])),[[J,t.config.loading]]),y("div",be,[i(G,{"current-page":e.page.pageNum,"onUpdate:currentPage":s[0]||(s[0]=o=>e.page.pageNum=o),"page-size":e.page.pageSize,"onUpdate:pageSize":s[1]||(s[1]=o=>e.page.pageSize=o),"pager-count":5,"page-sizes":[10,20,30],total:t.config.total,layout:"total, sizes, prev, pager, next, jumper",background:"",onSizeChange:W,onCurrentChange:U},null,8,["current-page","page-size","total"]),y("div",_e,[i(S,{name:"iconfont icon-yunxiazai_o",size:22,title:"导出",onClick:B}),i(S,{name:"iconfont icon-shuaxin",size:22,title:"刷新",onClick:D}),i(X,{placement:"top-end",trigger:"click",transition:"el-zoom-in-top","popper-class":"table-tool-popper",width:300,persistent:!1,onShow:H},{reference:m(()=>[i(S,{name:"iconfont icon-quanjushezhi_o",size:22,title:"设置"})]),default:m(()=>[y("div",we,[i(P,{content:"拖动进行排序",placement:"top-start"},{default:m(()=>[i(S,{name:"fa fa-question-circle-o",size:17,class:"ml11",color:"#909399"})]),_:1}),i(E,{modelValue:e.checkListAll,"onUpdate:modelValue":s[2]||(s[2]=o=>e.checkListAll=o),indeterminate:e.checkListIndeterminate,class:"ml10 mr1",label:"列显示",onChange:T},null,8,["modelValue","indeterminate"]),i(E,{modelValue:n.value.isSerialNo,"onUpdate:modelValue":s[3]||(s[3]=o=>n.value.isSerialNo=o),class:"ml12 mr1",label:"序号"},null,8,["modelValue"]),i(E,{modelValue:n.value.isSelection,"onUpdate:modelValue":s[4]||(s[4]=o=>n.value.isSelection=o),class:"ml12 mr1",label:"多选"},null,8,["modelValue"])]),i(Q,null,{default:m(()=>[y("div",{ref_key:"toolSetRef",ref:r,class:"tool-sortable"},[(u(!0),b(V,null,L(t.header,o=>(u(),b("div",{class:"tool-sortable-item",key:o.key,"data-key":o.key},[ve,i(E,{modelValue:o.isCheck,"onUpdate:modelValue":z=>o.isCheck=z,size:"default",class:"ml12 mr8",label:o.title,onChange:v},null,8,["modelValue","onUpdate:modelValue","label"])],8,ye))),128))],512)]),_:1})]),_:1})])])])}}});const Ne=de(Se,[["__scopeId","data-v-6ed6a16f"],["__file","C:/Users/89282/Desktop/lechang_storage/lechang_storage/vue-next-admin/src/components/table/index.vue"]]);export{Ne as default};
- //# sourceMappingURL=index.14501449.js.map
|