| 12 |
- import{r as e,_ as l,a,d as t,bm as o,bn as s,D as d,e as c,z as r,A as i,t as n,F as u,G as p,a5 as v,az as m,q as h}from"./element-plus.DYHj_7Hl.js";import{M as f,bl as g,aL as C,s as w,ar as b,A as _,bJ as x,aY as y,v as V,au as M,bb as z,I as j,bk as k,aU as B,q as S,bq as O,u as H,F,aX as U,t as E,H as P,aq as q,aS as L,as as D}from"./@vue.DbmRtknU.js";import{_ as R}from"./index.KDUAIHt0.js";import{E as A}from"./exceljs.DLSZe_6I.js";import{e as T}from"./@vueuse.0G3dmZIi.js";const Z={class:"curd-dialog-header"},$=["id"],I={class:"curd-dialog-header__actions"},K=R(f({inheritAttrs:!1,__name:"EnhancedDialog",props:{modelValue:{type:Boolean},title:{},width:{},draggable:{type:Boolean,default:!0},dialogClass:{},modalClass:{}},emits:["update:modelValue","close","opened"],setup(c,{emit:r}){const i=c,n=r,u=g(),p=B(!1),v=S(()=>{const e=u.class;return[i.dialogClass,e].filter(Boolean)}),m=S({get:()=>i.modelValue,set:e=>n("update:modelValue",e)}),h=S(()=>{const e={...u};return delete e.class,e});return(r,i)=>{const u=t,f=a,g=l,B=e;return C(),w(B,b({modelValue:m.value,"onUpdate:modelValue":i[1]||(i[1]=e=>m.value=e),width:c.width,draggable:c.draggable,fullscreen:p.value,"show-close":!1,class:v.value,"modal-class":c.modalClass,"align-center":"","destroy-on-close":""},h.value,{onClose:i[2]||(i[2]=e=>n("close")),onOpened:i[3]||(i[3]=e=>n("opened"))}),_({header:x(({titleId:e,titleClass:l,close:a})=>[V("div",Z,[V("span",{id:e,class:M(l)},z(c.title),11,$),V("div",I,[j(g,{content:p.value?"还原":"全屏",placement:"top"},{default:x(()=>[j(f,{text:"",circle:"",type:"primary",onClick:i[0]||(i[0]=e=>p.value=!p.value)},{default:x(()=>[j(u,null,{default:x(()=>[p.value?(C(),w(k(o),{key:0})):(C(),w(k(s),{key:1}))]),_:1})]),_:1})]),_:1},8,["content"]),j(g,{content:"关闭",placement:"top"},{default:x(()=>[j(f,{text:"",circle:"",onClick:a},{default:x(()=>[j(u,null,{default:x(()=>[j(k(d))]),_:1})]),_:1},8,["onClick"])]),_:2},1024)])])]),default:x(()=>[y(r.$slots,"default",{},void 0,!0)]),_:2},[r.$slots.footer?{name:"footer",fn:x(()=>[y(r.$slots,"footer",{},void 0,!0)]),key:"0"}:void 0]),1040,["modelValue","width","draggable","fullscreen","class","modal-class"])}}}),[["__scopeId","data-v-69b91a77"]]),W={class:"curd-export-modal-host"},G={style:{"padding-right":"var(--el-dialog-padding-primary)"}},J=f({__name:"ExportModal",props:q({contentConfig:{},queryParams:{},pageData:{},selectionData:{}},{modelValue:{type:Boolean,required:!0,default:!1},modelModifiers:{}}),emits:["update:modelValue"],setup(e,{expose:l}){const t=e,o=O(e,"modelValue"),s=B(),d=L({filename:"",sheetname:"",fields:[],origin:"current"
- /* CURRENT */}),f={fields:[{required:!0,message:"请选择字段"}],origin:[{required:!0,message:"请选择数据源"}]},g=S(()=>t.contentConfig.cols.map(e=>(e.initFn&&e.initFn(e),void 0===e.show&&(e.show=!0),void 0!==e.prop&&void 0===e.columnKey&&void 0===e["column-key"]&&(e.columnKey=e.prop),"selection"===e.type&&void 0===e.reserveSelection&&void 0===e["reserve-selection"]&&(e.reserveSelection=!0),e)));function b(){var e;o.value=!1,null==(e=s.value)||e.resetFields(),D(()=>{var e;null==(e=s.value)||e.clearValidate()})}(()=>{const e=[];g.value.forEach(l=>{void 0!==l.prop&&e.push(l.prop)}),d.fields=e})();const _=T(()=>{var e;null==(e=s.value)||e.validate(e=>{e&&(!function(){try{const e=d.filename?d.filename:t.contentConfig.permPrefix||"export",l=d.sheetname?d.sheetname:"sheet",a=new A.Workbook,o=a.addWorksheet(l),s=[];if(g.value.forEach(e=>{e.label&&e.prop&&d.fields.includes(e.prop)&&s.push({header:e.label,key:e.prop})}),o.columns=s,"remote"===d.origin)if(t.contentConfig.exportsAction){const l=t.queryParams??{};t.contentConfig.exportsAction(l).then(l=>{o.addRows(l),a.xlsx.writeBuffer().then(l=>{y(l,e)}).catch(e=>{h.error("导出远程数据失败")})}).catch(e=>{h.error("获取远程数据失败")})}else h.error("未配置exportsAction");else if("selected"===d.origin){const l=t.selectionData??[];o.addRows(l),a.xlsx.writeBuffer().then(l=>{y(l,e)}).catch(e=>{h.error("导出选中数据失败")})}else{const l=t.pageData??[];o.addRows(l),a.xlsx.writeBuffer().then(l=>{y(l,e)}).catch(e=>{h.error("导出当前数据失败")})}}catch(e){h.error("导出失败")}}(),b())})},3e3);function y(e,l){try{const a=new Blob([e],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8"}),t=window.URL.createObjectURL(a),o=document.createElement("a");o.href=t,o.download=l,document.body.appendChild(o),o.click(),document.body.removeChild(o),window.URL.revokeObjectURL(t)}catch(a){h.error("保存文件失败")}}return l({handleCloseExportsModal:b}),(l,h)=>{const y=n,M=i,z=p,B=u,S=m,O=v,q=r,L=c,D=a;return C(),H("div",W,[j(K,{modelValue:o.value,"onUpdate:modelValue":h[4]||(h[4]=e=>o.value=e),title:"导出数据",width:"600px","dialog-class":"curd-embed-dialog",onClose:b},{footer:x(()=>[V("div",G,[j(D,{type:"primary",onClick:k(_)},{default:x(()=>[...h[5]||(h[5]=[P("确 定",-1)])]),_:1},8,["onClick"]),j(D,{onClick:b},{default:x(()=>[...h[6]||(h[6]=[P("取 消",-1)])]),_:1})])]),default:x(()=>[j(L,{"max-height":"60vh"},{default:x(()=>[j(q,{ref_key:"exportsFormRef",ref:s,style:{"padding-right":"var(--el-dialog-padding-primary)"},model:d,rules:f},{default:x(()=>[j(M,{label:"文件名",prop:"filename"},{default:x(()=>[j(y,{modelValue:d.filename,"onUpdate:modelValue":h[0]||(h[0]=e=>d.filename=e),placeholder:"请输入文件名",clearable:""},null,8,["modelValue"])]),_:1}),j(M,{label:"工作表名",prop:"sheetname"},{default:x(()=>[j(y,{modelValue:d.sheetname,"onUpdate:modelValue":h[1]||(h[1]=e=>d.sheetname=e),placeholder:"请输入工作表名",clearable:""},null,8,["modelValue"])]),_:1}),j(M,{label:"数据源",prop:"origin"},{default:x(()=>[j(B,{modelValue:d.origin,"onUpdate:modelValue":h[2]||(h[2]=e=>d.origin=e)},{default:x(()=>{var l,a;return[j(z,{label:"当前数据 (当前页的数据)",value:"current",disabled:!(null==(l=e.pageData)?void 0:l.length)},null,8,["value","disabled"]),j(z,{label:"选中数据 (所有选中的数据)",value:"selected",disabled:!(null==(a=e.selectionData)?void 0:a.length)},null,8,["value","disabled"]),j(z,{label:"全量数据 (所有分页的数据)",value:"remote",disabled:!t.contentConfig.exportsAction},null,8,["value","disabled"])]}),_:1},8,["modelValue"])]),_:1}),j(M,{label:"字段",prop:"fields"},{default:x(()=>[j(O,{modelValue:d.fields,"onUpdate:modelValue":h[3]||(h[3]=e=>d.fields=e)},{default:x(()=>[(C(!0),H(F,null,U(g.value,e=>(C(),H(F,{key:e.prop},[e.prop?(C(),w(S,{key:0,value:e.prop,label:e.label},null,8,["value","label"])):E("",!0)],64))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1},8,["model"])]),_:1})]),_:1},8,["modelValue"])])}}}),X=Object.freeze(Object.defineProperty({__proto__:null,default:"data:image/svg+xml,%3csvg%20t='1765953898889'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='6018'%20width='200'%20height='200'%3e%3cpath%20d='M603.904%20244.992c134.4%200%20243.3536%20108.9536%20243.3536%20243.3536v202.8032c0%20134.4-108.9536%20243.3536-243.3536%20243.3536H320c-134.4%200-243.3536-108.9536-243.3536-243.3536V488.3456c0-134.4%20108.9536-243.3536%20243.3536-243.3536h283.904z%20m0%2081.1008H320c-89.6%200-162.2528%2072.6528-162.2528%20162.2528v202.8032c0%2089.6%2072.6528%20162.2528%20162.2528%20162.2528h283.904c89.6%200%20162.2528-72.6528%20162.2528-162.2528V488.3456c0-89.6-72.6528-162.2528-162.2528-162.2528z'%20p-id='6019'%3e%3c/path%3e%3cpath%20d='M340.224%20508.6208c27.0336%200%2040.5504%2013.5168%2040.5504%2040.5504v81.1008c0%2027.0336-13.5168%2040.5504-40.5504%2040.5504-27.0336%200-40.5504-13.5168-40.5504-40.5504v-81.1008c0-27.0336%2013.5168-40.5504%2040.5504-40.5504zM583.2192%20501.3504c15.2576-11.4176%2036.864-8.3456%2048.2816%206.912a34.4832%2034.4832%200%200%201-6.912%2048.2816l-44.3904%2033.28%2044.3904%2033.28a34.53952%2034.53952%200%200%201%209.472%2044.3392l-2.56%203.9424c-11.4176%2015.2576-33.024%2018.3296-48.2816%206.912l-59.4944-44.5952c-13.7728-10.3424-21.9136-26.5728-21.9136-43.8272s8.0896-33.4848%2021.9136-43.8272l59.4944-44.5952zM883.5072%20261.12l-19.7632%2047.3088c-2.7648%206.656-9.2672%2010.9568-16.4864%2010.9568s-13.6704-4.3008-16.4864-10.9568L811.008%20261.12a44.416%2044.416%200%200%200-19.7632-21.9648l-34.8672-19.0976c-5.7344-3.1232-9.2672-9.1136-9.2672-15.6672s3.5328-12.544%209.2672-15.6672l34.8672-19.0464a44.89728%2044.89728%200%200%200%2019.7632-21.9648l19.7632-47.3088c2.7648-6.656%209.2672-10.9568%2016.4864-10.9568s13.6704%204.3008%2016.4864%2010.9568l19.7632%2047.3088a44.416%2044.416%200%200%200%2019.7632%2021.9648l34.8672%2019.0976c5.7344%203.1232%209.2672%209.1136%209.2672%2015.6672s-3.584%2012.544-9.2672%2015.6672l-34.8672%2019.0464c-8.9088%204.864-15.872%2012.6464-19.7632%2021.9648z'%20p-id='6020'%3e%3c/path%3e%3c/svg%3e"},Symbol.toStringTag,{value:"Module"})),Y=Object.freeze(Object.defineProperty({__proto__:null,default:"data:image/svg+xml,%3csvg%20t='1640574422482'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='3140'%20width='128'%20height='128'%3e%3cpath%20d='M913.29536%20941.04064c0.0256%2024.82688-16.54784%2044.96384-37.0176%2044.98432l-708.23936%200.6912c-20.46464%200.02048-37.07904-20.08576-37.10464-44.91264l-0.83968-859.02848c-0.0256-24.82688%2016.54784-44.96384%2037.0176-44.98432l521.10848-0.50688%20224.39424%20210.50368%200.68096%20693.25312z'%20fill='%23e6e6e6'%20p-id='3141'%3e%3c/path%3e%3cpath%20d='M913.29536%20253.26592l-189.11744%200.18432c-20.46464%200.02048-37.07904-20.08576-37.10464-44.91264l-0.16384-165.77024%20226.38592%20210.49856z'%20fill='%23C4BCB1'%20p-id='3142'%3e%3c/path%3e%3cpath%20d='M720.72192%20396.84096a22.54848%2022.54848%200%200%201-22.54848%2022.54848H326.13376a22.54848%2022.54848%200%200%201%200-45.09696h372.0448a22.54848%2022.54848%200%200%201%2022.54336%2022.54848zM720.72192%20565.95456a22.54848%2022.54848%200%200%201-22.54848%2022.54848H326.13376a22.54848%2022.54848%200%200%201%200-45.09696h372.0448a22.54848%2022.54848%200%200%201%2022.54336%2022.54848zM720.72192%20746.33728a22.54848%2022.54848%200%200%201-22.54848%2022.54848H326.13376a22.54848%2022.54848%200%200%201%200-45.09696h372.0448a22.54848%2022.54848%200%200%201%2022.54336%2022.54848z'%20fill='%238a8a8a'%20p-id='3143'%3e%3c/path%3e%3c/svg%3e"},Symbol.toStringTag,{value:"Module"})),N=Object.freeze(Object.defineProperty({__proto__:null,default:"data:image/svg+xml,%3csvg%20t='1642407370336'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='6354'%20width='200'%20height='200'%3e%3cpath%20d='M952.888889%20281.6V910.222222c0%2062.862222-50.915556%20113.777778-113.777778%20113.777778H156.444444c-62.862222%200-113.777778-50.915556-113.777777-113.777778V113.777778c0-62.862222%2050.915556-113.777778%20113.777777-113.777778h514.844445L952.888889%20281.6z'%20fill='%2385BCFF'%20p-id='6355'%3e%3c/path%3e%3cpath%20d='M676.664889%20167.822222V0l281.6%20281.6h-167.822222c-62.862222%200-113.777778-50.915556-113.777778-113.777778'%20fill='%23529EE0'%20p-id='6356'%3e%3c/path%3e%3cpath%20d='M685.824%20363.804444a53.76%2053.76%200%200%201%2053.731556%2053.731556v307.029333a53.76%2053.76%200%200%201-53.731556%2053.731556H309.76a53.731556%2053.731556%200%200%201-53.731556-53.76V417.564444c0-29.667556%2024.035556-53.731556%2053.731556-53.731555H685.795556z%20m-72.903111%20149.674667l-138.183111%20146.545778-80.583111-62.805333-92.131556%2094.208v31.402666c0%2011.548444%2010.325333%2020.906667%2023.04%2020.906667h345.400889c12.714667%200%2023.04-9.386667%2023.04-20.906667v-125.610666l-80.583111-83.740445z%20m-227.896889-85.532444a32.085333%2032.085333%200%201%200%200%2064.142222%2032.085333%2032.085333%200%200%200%200-64.142222z'%20fill='%23FFFFFF'%20p-id='6357'%3e%3c/path%3e%3c/svg%3e"},Symbol.toStringTag,{value:"Module"})),Q=Object.freeze(Object.defineProperty({__proto__:null,default:"data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='currentColor'%3e%3cpath%20d='M8%203v2H4v4H2V3h6zM2%2021v-6h2v4h4v2H2zm20%200h-6v-2h4v-4h2v6zm0-12h-2V5h-4V3h6v6z'/%3e%3c/svg%3e"},Symbol.toStringTag,{value:"Module"})),ee=Object.freeze(Object.defineProperty({__proto__:null,default:"data:image/svg+xml,%3csvg%20t='1725812178308'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='4564'%20width='200'%20height='200'%3e%3cpath%20d='M512%201024C229.234%201024%200%20794.766%200%20512S229.234%200%20512%200s512%20229.234%20512%20512-229.234%20512-512%20512z%20m259.157-568.889l-290.759%200.014c-13.966%200-25.287%2011.321-25.287%2025.273l-0.028%2063.218c0%2013.966%2011.306%2025.287%2025.273%2025.287H657.38c13.966%200%2025.287%2011.307%2025.287%2025.273v12.644a75.847%2075.847%200%200%201-75.847%2075.847H366.606a25.287%2025.287%200%200%201-25.287-25.273v-240.2a75.847%2075.847%200%200%201%2075.847-75.846l353.92-0.015c13.966%200%2025.273-11.306%2025.287-25.273l0.071-63.189c0-13.966-11.306-25.287-25.272-25.301l-353.992%200.014c-104.718-0.014-189.624%2084.892-189.624%20189.61v353.963c0%2013.967%2011.32%2025.287%2025.287%2025.287h372.935c94.265%200%20170.666-76.401%20170.666-170.666v-145.38c0-13.952-11.32-25.273-25.287-25.273z'%20p-id='4565'%3e%3c/path%3e%3c/svg%3e"},Symbol.toStringTag,{value:"Module"})),le=Object.freeze(Object.defineProperty({__proto__:null,default:"data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20viewBox='0%200%201024%201024'%20data-v-149482e7=''%3e%3cpath%20d='M511.6%2076.3C264.3%2076.2%2064%20276.4%2064%20523.5C64%20718.9%20189.3%20885%20363.8%20946c23.5%205.9%2019.9-10.8%2019.9-22.2v-77.5c-135.7%2015.9-141.2-73.9-150.3-88.9C215%20726%20171.5%20718%20184.5%20703c30.9-15.9%2062.4%204%2098.9%2057.9c26.4%2039.1%2077.9%2032.5%20104%2026c5.7-23.5%2017.9-44.5%2034.7-60.8c-140.6-25.2-199.2-111-199.2-213c0-49.5%2016.3-95%2048.3-131.7c-20.4-60.5%201.9-112.3%204.9-120c58.1-5.2%20118.5%2041.6%20123.2%2045.3c33-8.9%2070.7-13.6%20112.9-13.6c42.4%200%2080.2%204.9%20113.5%2013.9c11.3-8.6%2067.3-48.8%20121.3-43.9c2.9%207.7%2024.7%2058.3%205.5%20118c32.4%2036.8%2048.9%2082.7%2048.9%20132.3c0%20102.2-59%20188.1-200%20212.9a127.5%20127.5%200%200%201%2038.1%2091v112.5c.8%209%200%2017.9%2015%2017.9c177.1-59.7%20304.6-227%20304.6-424.1c0-247.2-200.4-447.3-447.5-447.3z'%20fill='currentColor'%3e%3c/path%3e%3c/svg%3e"},Symbol.toStringTag,{value:"Module"})),ae=Object.freeze(Object.defineProperty({__proto__:null,default:"data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='currentColor'%3e%3cpath%20d='M18.5753%2013.7114C19.0742%2013.7114%2019.4733%2013.2873%2019.4733%2012.8134C19.4733%2012.3145%2019.0742%2011.9155%2018.5753%2011.9155C18.0765%2011.9155%2017.6774%2012.3145%2017.6774%2012.8134C17.6774%2013.3123%2018.0765%2013.7114%2018.5753%2013.7114ZM14.1497%2013.7114C14.6485%2013.7114%2015.0476%2013.2873%2015.0476%2012.8134C15.0476%2012.3145%2014.6485%2011.9155%2014.1497%2011.9155C13.6508%2011.9155%2013.2517%2012.3145%2013.2517%2012.8134C13.2517%2013.3123%2013.6508%2013.7114%2014.1497%2013.7114ZM20.717%2018.7516C20.5942%2018.8253%2020.5205%2018.9482%2020.5451%2019.1202C20.5451%2019.1693%2020.5451%2019.2185%2020.5696%2019.2676C20.6679%2019.6854%2020.8643%2020.349%2020.8643%2020.3736C20.8643%2020.4473%2020.8889%2020.4964%2020.8889%2020.5456C20.8889%2020.6685%2020.7907%2020.7668%2020.6679%2020.7668C20.6187%2020.7668%2020.5942%2020.7422%2020.5451%2020.7176L19.0961%2019.882C18.9978%2019.8329%2018.875%2019.7837%2018.7522%2019.7837C18.6786%2019.7837%2018.6049%2019.7837%2018.5558%2019.8083C17.8681%2020.0049%2017.1559%2020.1032%2016.3946%2020.1032C12.7352%2020.1032%209.78815%2017.6456%209.78815%2014.5983C9.78815%2011.5509%2012.7352%209.09329%2016.3946%209.09329C20.0539%209.09329%2023.001%2011.5509%2023.001%2014.5983C23.001%2016.2448%2022.1168%2017.7439%2020.717%2018.7516ZM16.6737%208.09757C16.581%208.09473%2016.488%208.09329%2016.3946%208.09329C12.2199%208.09329%208.78815%2010.9536%208.78815%2014.5983C8.78815%2015.1519%208.86733%2015.6874%209.01626%2016.1975H8.92711C8.04096%2016.1975%207.15481%2016.0503%206.3425%2015.8296C6.26866%2015.805%206.19481%2015.805%206.12097%2015.805C5.97327%2015.805%205.82558%2015.8541%205.7025%2015.9277L3.95482%2016.9334C3.90559%2016.958%203.85635%2016.9825%203.80712%2016.9825C3.65943%2016.9825%203.53636%2016.8599%203.53636%2016.7127C3.53636%2016.6391%203.56097%2016.59%203.58559%2016.5164C3.6102%2016.4919%203.83174%2015.6824%203.95482%2015.1918C3.95482%2015.1427%203.97943%2015.0691%203.97943%2015.0201C3.97943%2014.8238%203.88097%2014.6766%203.75789%2014.5785C2.05944%2013.3765%201.00098%2011.5858%201.00098%209.59876C1.00098%205.94369%204.5702%203%208.95173%203C12.7157%203%2015.8802%205.16856%2016.6737%208.09757ZM11.5199%208.51604C12.0927%208.51604%2012.5462%208.03871%2012.5462%207.4898C12.5462%206.91701%2012.0927%206.46356%2011.5199%206.46356C10.9471%206.46356%2010.4937%206.91701%2010.4937%207.4898C10.4937%208.06258%2010.9471%208.51604%2011.5199%208.51604ZM6.26045%208.51604C6.83324%208.51604%207.28669%208.03871%207.28669%207.4898C7.28669%206.91701%206.83324%206.46356%206.26045%206.46356C5.68767%206.46356%205.23421%206.91701%205.23421%207.4898C5.23421%208.06258%205.68767%208.51604%206.26045%208.51604Z'%3e%3c/path%3e%3c/svg%3e"},Symbol.toStringTag,{value:"Module"}));export{K as E,J as _,X as a,N as b,Q as c,Y as f,ee as g,le as i,ae as w};
|