|
@@ -35,19 +35,7 @@ function custom(){
|
|
|
$(".data tr").each(function() {
|
|
$(".data tr").each(function() {
|
|
|
$(this).find('td:eq(3)').css("width","25%");
|
|
$(this).find('td:eq(3)').css("width","25%");
|
|
|
});}
|
|
});}
|
|
|
-$(".whlabelerror").click(function() {
|
|
|
|
|
- var f = "";
|
|
|
|
|
- $(".select").each(function() {
|
|
|
|
|
- f = f + $(this).attr("name") + "=" + $(this).children("option:selected").val() + "&";
|
|
|
|
|
- });
|
|
|
|
|
- $("input:text").each(function() {
|
|
|
|
|
- f = f + $(this).attr("name") + "=" + encodeURIComponent($(this).val()) + "&";
|
|
|
|
|
- });
|
|
|
|
|
- $("input:hidden").each(function() {
|
|
|
|
|
- f = f + $(this).attr("name") + "=" + $(this).val() + "&";
|
|
|
|
|
- });
|
|
|
|
|
-window.location.href = "/whlabel/errorexcel?excel=1&"+f;
|
|
|
|
|
-});
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
$(".whlabeldr0kc").click(function() {
|
|
$(".whlabeldr0kc").click(function() {
|
|
|
var dr = $(this);
|
|
var dr = $(this);
|
|
@@ -91,6 +79,67 @@ success: function(a) {
|
|
|
</script>
|
|
</script>
|
|
|
<script type="text/javascript" src="{$theme}js/time.js"></script>
|
|
<script type="text/javascript" src="{$theme}js/time.js"></script>
|
|
|
<script type="text/javascript" src="{$theme}js/laydate.js"></script>
|
|
<script type="text/javascript" src="{$theme}js/laydate.js"></script>
|
|
|
|
|
+<script src="{$theme}js/excel/xlxs.js"></script>
|
|
|
|
|
+<script>
|
|
|
|
|
+$(".whlabelerror").click(function() {
|
|
|
|
|
+ var f = "";
|
|
|
|
|
+ $(".select").each(function() {
|
|
|
|
|
+ f = f + $(this).attr("name") + "=" + $(this).children("option:selected").val() + "&";
|
|
|
|
|
+ });
|
|
|
|
|
+ $("input:text").each(function() {
|
|
|
|
|
+ f = f + $(this).attr("name") + "=" + encodeURIComponent($(this).val()) + "&";
|
|
|
|
|
+ });
|
|
|
|
|
+ $("input:hidden").each(function() {
|
|
|
|
|
+ f = f + $(this).attr("name") + "=" + $(this).val() + "&";
|
|
|
|
|
+ });
|
|
|
|
|
+ let url = "/whlabel/errorexceljs?excel=1&"+f;
|
|
|
|
|
+
|
|
|
|
|
+ layx.load('loadId','导出中,请稍后',{shadable:0.6});
|
|
|
|
|
+ $.get(url,{},function(res){
|
|
|
|
|
+ layx.destroy('loadId');
|
|
|
|
|
+ if(res.code == 1){
|
|
|
|
|
+ importDataNoCol(res.data)
|
|
|
|
|
+ }else{
|
|
|
|
|
+ layx.alert('错误',res.msg,function(id,button){
|
|
|
|
|
+ },{dialogIcon:'error'});
|
|
|
|
|
+ }
|
|
|
|
|
+ },'json')
|
|
|
|
|
+
|
|
|
|
|
+});
|
|
|
|
|
+
|
|
|
|
|
+//导出第一行不含合并单元格的
|
|
|
|
|
+function importDataNoCol(data){
|
|
|
|
|
+ const fileName = data.title+'.xlsx' ;
|
|
|
|
|
+ // 将数据转换为工作表
|
|
|
|
|
+
|
|
|
|
|
+ // 创建工作表
|
|
|
|
|
+ const worksheet = XLSX.utils.aoa_to_sheet(data.data);
|
|
|
|
|
+
|
|
|
|
|
+ // 定义合并区域
|
|
|
|
|
+ const merges = data.merges;
|
|
|
|
|
+ worksheet['!cols'] = data.cols;
|
|
|
|
|
+
|
|
|
|
|
+ // 应用合并
|
|
|
|
|
+ worksheet["!merges"] = merges;
|
|
|
|
|
+
|
|
|
|
|
+ // 设置标题样式(仅在Excel中可见)
|
|
|
|
|
+ worksheet.A1.s = {
|
|
|
|
|
+ font: { sz: 20, name: "微软雅黑", bold: true },
|
|
|
|
|
+ alignment: { horizontal: "center" }
|
|
|
|
|
+ };
|
|
|
|
|
+ // 创建工作簿
|
|
|
|
|
+ const workbook = XLSX.utils.book_new();
|
|
|
|
|
+ XLSX.utils.book_append_sheet(workbook, worksheet, data.title);
|
|
|
|
|
+
|
|
|
|
|
+ // 导出文件
|
|
|
|
|
+ XLSX.writeFile(workbook, fileName);
|
|
|
|
|
+
|
|
|
|
|
+ alert('EXCEL已导出为 :'+fileName)
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ return ;
|
|
|
|
|
+}
|
|
|
|
|
+</script>
|
|
|
<div style="display:none;">
|
|
<div style="display:none;">
|
|
|
<input id="upload-file" name="files" accept="image/xls,image/xlsx" type="file">
|
|
<input id="upload-file" name="files" accept="image/xls,image/xlsx" type="file">
|
|
|
</div>
|
|
</div>
|