Commit 11a78305 by 周业恒

media_list

parent 91bdc728
Pipeline #20522 passed with stages
in 1 minute 8 seconds
...@@ -168,11 +168,27 @@ ...@@ -168,11 +168,27 @@
<script type="text/javascript"> <script type="text/javascript">
var media_export_name="<?php $export_values=''; foreach ($medias as $key => $media) { $export_values=$export_values.'\r\n'.$media['_id']." ".$media['media_name']; } echo $export_values; ?>" var media_export_name="<?php $export_values=''; foreach ($medias as $key => $media) { $export_values=$export_values.'<tr><td>${'.$media['_id'].`'\t'}</td>'`.'<td>${'.$media['media_name'].`'\t'}</td>'`.'</tr>'; } echo $export_values; ?>"
function export_media_id(){ function export_media_id(){
alert(media_export_name) //alert(media_export_name)
}
const worksheet = 'Sheet1'
const uri = 'data:application/vnd.ms-excel;base64,';
// 下载的表格模板数据
const template = `<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><!--[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>${media_export_name}</table></body></html>`;
// 下载模板
window.location.href = uri + base64(template);
}
const base64 = s => window.btoa(unescape(encodeURIComponent(s)));
function x_admin_show(url){ function x_admin_show(url){
window.location.href = url; window.location.href = url;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment