最近的项目中,涉及到了导出功能,觉得比较有用,记录一下。
  window.location="/cloud/dict/exportFromExcel?dictId="+currentID+"&dictItemNames="+dictItemNames;

也提下上传

 function uploadFile() {
            var formData = new FormData();
            var name = $("#dictInfo").val();
            var temp = $("#dictInfo");
            var dictId = currentID;
            formData.append("file", temp[0].files[0]);
            formData.append("name", name);
            formData.append("dictId", dictId);
            $.ajax({
                url: "/cloud/dict/importFromExcel",
                type: 'POST',
                data: formData,
                processData: false,
                contentType: false,
                success: function (res) {
                    layer.msg(res.msg);
                    setTimeout(function () {
                        location.reload();

                    },200)
                },
                error: function (res) {
                    layer.msg("网络异常,请稍后重试!");
                }
            });
        };

扫描二维码,在手机上阅读!