新增表格文档支持Excel(.xlsx)文件导入

This commit is contained in:
yangjian 2021-05-23 10:12:20 +08:00
parent 39f6bb6a00
commit c3e2b174e2
4 changed files with 22957 additions and 3 deletions

View File

@ -1,9 +1,15 @@
## 版本更新记录
### v0.6.7 2021-04
### v0.6.7 2021-05
- [新增]表格文档支持Excel文件(.xlsx格式)导入;
- [修复]XSS过滤漏洞
- [修复]分享文档内容渲染问题;
- [修复]文集导入保存排序时部分文档状态未变的问题;
- [修复]管理员无法批量删除其他用户文集的问题;
- [优化]文档类型标识;
- [优化]文档标签相关页面;
- [优化]后台检测更新逻辑;
- [优化]文档分享码输入页面样式;
### v0.6.6 2021-04-11

22903
static/luckysheet/dist/luckyexcel.umd.js vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -238,6 +238,7 @@
<!-- 在线表格 -->
<script src="{% static 'luckysheet/dist/plugins/js/plugin.js' %}?version={{mrdoc_version}}"></script>
<script src="{% static 'luckysheet/dist/luckysheet.umd.js' %}?version={{mrdoc_version}}"></script>
<script src="{% static 'luckysheet/dist/luckyexcel.umd.js' %}?version={{mrdoc_version}}"></script>
{% include 'app_doc/editor/tpl_editor_table.html' %}
{% endif %}
<script>

View File

@ -17,10 +17,16 @@
<dd><input type="checkbox" name="show-children" title="显示下级文档" lay-skin="primary"></dd>
</dl>
</li>
{% if editor_mode != 4 %}
<li class="layui-nav-item mrdoc-import-doc-item">
<a href="javascript:;"><i class="fa fa-upload layui-hide-md"></i><span class="layui-hide-xs">导入</span></a>
<dl class="layui-nav-child mrdoc-import-doc-child"> <!-- 二级菜单 -->
{% if editor_mode == 4 %}
<dd><a href="javascript:void(0);" id="import-excel">
<svg t="1608814405819" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3399" xmlns:xlink="http://www.w3.org/1999/xlink" width="20" height="20"><defs><style type="text/css"></style></defs><path d="M0 0h475.904v335.36H0z" fill="#52adff" p-id="3400"></path><path d="M591.36 667.050667H1024V1024H591.36z" fill="#1892ff" p-id="3401"></path><path d="M0 450.730667h475.904V1024H0z" fill="#83c5fd" p-id="3402"></path><path d="M591.36 0H1024v551.68H591.36z" fill="#52afff" p-id="3403"></path></svg>
Excel(.xlsx)</a>
</dd>
{% else %}
<dd><a href="javascript:void(0);" id="sel-doctemp">
<svg t="1608814405819" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3399" xmlns:xlink="http://www.w3.org/1999/xlink" width="20" height="20"><defs><style type="text/css"></style></defs><path d="M0 0h475.904v335.36H0z" fill="#52adff" p-id="3400"></path><path d="M591.36 667.050667H1024V1024H591.36z" fill="#1892ff" p-id="3401"></path><path d="M0 450.730667h475.904V1024H0z" fill="#83c5fd" p-id="3402"></path><path d="M591.36 0H1024v551.68H591.36z" fill="#52afff" p-id="3403"></path></svg>
文档模板</a>
@ -35,9 +41,10 @@
<dd><a href="javascript:void(0);" id="import-doc-docx">
<svg t="1608815050013" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7356" xmlns:xlink="http://www.w3.org/1999/xlink" width="20" height="20"><defs><style type="text/css"></style></defs><path d="M535.119473 0h69.599248v95.247413C729.226717 96.331138 853.614299 93.92286 977.881468 96.331138a40.459078 40.459078 0 0 1 44.914393 45.516463c2.047037 234.566322 0 469.614299 1.204139 703.819379-1.204139 24.082785 2.287865 50.694262-11.318909 72.248354-16.978363 12.041392-38.893697 10.837253-58.761994 12.041392h-349.200376V1023.518344h-72.248354C354.980245 990.886171 177.490122 960.541863 0 928.752587V95.488241C178.33302 63.578551 356.786453 32.511759 535.119473 0z" fill="#2A5699" p-id="7357"></path><path d="M604.718721 131.010348H988.598307v761.979304H604.718721v-95.247413h302.479774v-48.165569H604.718721v-59.002822h302.479774v-48.16557H604.718721v-59.002822h302.479774v-48.165569H604.718721v-60.206961h302.479774V428.673565H604.718721v-60.206961h302.479774v-46.96143H604.718721v-59.604892h302.479774V214.336783H604.718721zM240.827846 341.373471c22.156162-1.324553 44.19191-2.287865 66.348071-3.492003 15.533396 80.4365 31.30762 160.632173 48.165569 240.827845 13.125118-82.724365 27.695202-165.087488 41.783632-247.571025 23.239887-0.842897 46.479774-2.167451 69.719661-3.612418-26.370649 115.356538-49.369708 231.796802-78.148636 346.430856-19.386642 10.355597-48.165569 0-71.52587 1.204139C301.034807 596.169332 283.093133 517.779868 269.245532 438.667921c-13.606773 76.944497-31.30762 153.16651-46.841016 229.508937-22.39699-1.204139-44.793979-2.528692-67.311383-4.094073-19.266228-104.760113-42.024459-208.918156-60.206962-313.919097 19.868297-0.963311 39.857008-1.806209 60.206962-2.528693 12.041392 75.860771 25.648166 151.360301 36.124177 227.341487 16.135466-77.907808 32.873001-155.695202 49.610536-233.603011z" fill="#FFFFFF" p-id="7358"></path></svg>
Word文档(.docx)</a></dd>
{% endif %}
</dl>
</li>
{% endif %}
<li class="layui-nav-item mrdoc-import-doc-item">
<a href="javascript:;"><i class="fa fa-edit layui-hide-md"></i><span class="layui-hide-xs">编辑器</span></a>
<dl class="layui-nav-child mrdoc-import-doc-child"> <!-- 二级菜单 -->
@ -170,6 +177,7 @@
});
})
var tree = layui.tree;
var upload = layui.upload;
//选择文集
form.on('select(project)', function(data){
console.log('选择文集:',data.value); //得到被选中的值
@ -415,5 +423,41 @@
function selectLocalFile(){
$("#insert-local-file").trigger("click");
};
// 导入Excel
upload.render({
elem:'#import-excel',
url:'',
auto:false,
exts:'xlsx',
choose:function(obj){
obj.preview(function(index,file,result){
LuckyExcel.transformExcelToLucky(file, function(exportJson, luckysheetfile){
luckysheet.create({
container: 'luckysheet', // luckysheet is the container id
data:exportJson.sheets,
title:exportJson.info.name,
userInfo:exportJson.info.name.creator,
lang: 'zh',
showGridLines:true,
allowEdit:true,
showinfobar: false, // 是否显示顶部信息栏
showsheetbar: true, // 是否显示底部sheet页按钮
showstatisticBar: true, // 是否显示底部计数栏
sheetBottomConfig: true, // sheet页下方的添加行按钮和回到顶部按钮配置
userInfo: false, // 右上角的用户信息展示样式
// plugins: ['chart'],
showstatisticBarConfig: {
count:false,
view:false,
zoom:false,
},
});
});
});
},
})
</script>
{% endblock %}