|
@@ -59,14 +59,7 @@
|
|
|
|
|
|
<body style="background: #fff;">
|
|
|
<div class="layui-inline" id="monthSelect" style="width: 100%">
|
|
|
- <div class="layui-input-inline">
|
|
|
- <form>
|
|
|
-
|
|
|
- </form>
|
|
|
- </div>
|
|
|
- <div style="float: right;padding-right: 10px" id="shareBtn">
|
|
|
- <button id="share" class="btn btn-primary" style="padding:3px 6px;font-size: 18px;margin-right: 10px;width: 100px">分享</button>
|
|
|
- </div>
|
|
|
+ <div style="float: right;padding-right: 10px" id="topBtn"></div>
|
|
|
</div>
|
|
|
<div style="height:90%;width: 100%;">
|
|
|
<div id="luckysheet" style="width:100%;height:100%">
|
|
@@ -100,9 +93,31 @@
|
|
|
var toolBar = '';
|
|
|
var type = '';
|
|
|
var emptyExcel = false;
|
|
|
+ var showToolBar = true;
|
|
|
$(function () {
|
|
|
userId = JSON.parse(window.top.sessionStorage.userInfo).loginNo
|
|
|
})
|
|
|
+
|
|
|
+ //增加完权限之后解除新增按钮的锁定
|
|
|
+ function enableUpload() {
|
|
|
+ document.getElementById("enableUpload")["disabled"] = false;
|
|
|
+ document.getElementById("enableUpload").innerHTML = '新增';
|
|
|
+ }
|
|
|
+ //锁定新增按钮
|
|
|
+ function disableUpload() {
|
|
|
+ document.getElementById("enableUpload")["disabled"] = true;
|
|
|
+ document.getElementById("enableUpload").innerHTML = '新增(请先设置权限)';
|
|
|
+ }
|
|
|
+ function enableSave() {
|
|
|
+ document.getElementById("enableSave")["disabled"] = false;
|
|
|
+ document.getElementById("enableSave").innerHTML = '保存';
|
|
|
+ }
|
|
|
+
|
|
|
+ function disableSave() {
|
|
|
+ document.getElementById("enableSave")["disabled"] = true;
|
|
|
+ document.getElementById("enableSave").innerHTML = '保存(请先设置权限)';
|
|
|
+ }
|
|
|
+
|
|
|
layui.use(['laydate', 'form'], function () {
|
|
|
var laydate = layui.laydate;
|
|
|
var form = layui.form;
|
|
@@ -126,33 +141,47 @@
|
|
|
var url = '/market/cIncomeExcelTemplate/getExcelInfo';
|
|
|
util.ajaxJson("数据加载中", ctx + url,
|
|
|
{
|
|
|
- "id": excelId ? excelId : '', "type": type
|
|
|
- }, function (res) {
|
|
|
- if (res.result == 0) {
|
|
|
- // 查看和修改时 下拉框赋值
|
|
|
- excelInfo = res.body.excelInfo;
|
|
|
- excelLevel = res.body.excelLevel;
|
|
|
- isAdmin = res.body.isExcelAdmin;
|
|
|
- emptyExcel = res.body.emptyExcel;
|
|
|
- console.log(type);
|
|
|
- if (isAdmin) {
|
|
|
- toolBar += '<input id="imports" type="file" class="btn btn-primary" style="padding:3px 6px;font-size: 12px;margin-right: 10px;"></input>';
|
|
|
- toolBar += '<button id="exports" class="btn btn-primary btn-danger" style="padding:3px 6px;font-size: 12px;margin-right: 10px;">导出</button>';
|
|
|
+ "excelId": excelId ? excelId : '', "type": type
|
|
|
+ }, function (res) {
|
|
|
+ if (res.result == 0) {
|
|
|
+ // 查看和修改时 下拉框赋值
|
|
|
+ excelInfo = res.body.excelInfo;
|
|
|
+ excelLevel = res.body.excelLevel;
|
|
|
+ isAdmin = res.body.isExcelAdmin;
|
|
|
+ emptyExcel = res.body.emptyExcel;
|
|
|
+ console.log(type);
|
|
|
+ if (isAdmin) {
|
|
|
+ toolBar += '<span style="color: red">*</span><span style="padding:0px 6px;font-size: 16px;">模板类型</span><input type="text" id="templateType" style="padding:0px 6px;width: 100px;height: 25px">';
|
|
|
+ toolBar += '<button id="share" class="btn btn-primary btn-primary" style="padding:3px 6px;font-size: 16px;margin-right: 10px;margin-left:10px;width: 80px">权限设置</button>'
|
|
|
+ toolBar += '<input id="imports" type="file" class="btn btn-primary" style="padding:3px 6px;font-size: 14px;margin-right: 10px;width: 180px"></input>';
|
|
|
+ toolBar += '<button id="fullScreen" class="btn btn-primary" style="padding:3px 6px;font-size: 16px;margin-right: 10px;">全屏显示</button>' +
|
|
|
+ '<button id="exitFullScreen" class="btn btn-primary" style="padding:3px 6px;font-size: 16px;margin-right: 10px;display:none">退出全屏</button>';
|
|
|
+ //toolBar += '<button id="exports" class="btn btn-primary btn-danger" style="padding:3px 6px;font-size: 12px;margin-right: 10px;">导出</button>';
|
|
|
+ if (type == '1') {
|
|
|
+ toolBar += '<button id="enableUpload" class="btn btn-primary btn-primary" style="padding:3px 6px;font-size: 16px;margin-right: 10px;" disabled>新增(请先设置权限)</button>';
|
|
|
+ } else if (type == '2') {
|
|
|
+ window.parent['setAuth'](excelId);
|
|
|
+ toolBar += '<button id="enableSave" class="btn btn-primary btn-primary" style="padding:3px 6px;font-size: 16px;margin-right: 10px;">保存</button>';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (type == '3') {
|
|
|
+ toolBar = '<button id="fullScreen" class="btn btn-primary" style="padding:3px 6px;font-size: 16px;margin-right: 10px;">全屏显示</button>' +
|
|
|
+ '<button id="exitFullScreen" class="btn btn-primary" style="padding:3px 6px;font-size: 16px;margin-right: 10px;display:none">退出全屏</button>';
|
|
|
+ showToolBar = false;
|
|
|
+ }
|
|
|
+ //toolBar += '<button id="saves" class="btn btn-primary btn-danger" style=" padding:3px 6px; font-size: 12px; margin-right: 10px;">保存</button>';
|
|
|
+ var eJson = res.body.excelJson;
|
|
|
+ var cellData = luckysheet.transToCellData(eJson[0].data);
|
|
|
+ eJson[0].celldata = cellData;
|
|
|
+ $("#topBtn").html(toolBar);
|
|
|
+ initExcel(res.body.excelJson);
|
|
|
}
|
|
|
- toolBar += '<button id="saves" class="btn btn-primary btn-danger" style=" padding:3px 6px; font-size: 12px; margin-right: 10px;">保存</button>';
|
|
|
- toolBar += '<button id="fullScreen" class="btn btn-primary" style="padding:3px 6px;font-size: 12px;margin-right: 10px;">全屏显示</button>' +
|
|
|
- '<button id="exitFullScreen" class="btn btn-primary" style="padding:3px 6px;font-size: 12px;margin-right: 10px;display:none">退出全屏</button>';
|
|
|
- var eJson = res.body.excelJson;
|
|
|
- var cellData = luckysheet.transToCellData(eJson[0].data);
|
|
|
- eJson[0].celldata = cellData;
|
|
|
- initExcel(res.body.excelJson);
|
|
|
- }
|
|
|
- });
|
|
|
+ });
|
|
|
initExcel()
|
|
|
}
|
|
|
|
|
|
// 表格初始化
|
|
|
- function initExcel(data,name) {
|
|
|
+ function initExcel(data, name) {
|
|
|
if (type == '1') {
|
|
|
flag = true
|
|
|
} else {
|
|
@@ -162,7 +191,7 @@
|
|
|
adminFlag = true;
|
|
|
}
|
|
|
var fileName = excelInfo.name;
|
|
|
- if ($.trim(name)!=''){
|
|
|
+ if ($.trim(name) != '') {
|
|
|
fileName = name;
|
|
|
}
|
|
|
try {
|
|
@@ -176,45 +205,45 @@
|
|
|
sheet: false //sheet页显示
|
|
|
},
|
|
|
showstatisticBar: false, // 底部计数
|
|
|
- showtoolbar: true,
|
|
|
+ showtoolbar: showToolBar,
|
|
|
myFolderUrl: '',
|
|
|
showtoolbarConfig: {
|
|
|
- undoRedo: true, //撤销重做,注意撤消重做是两个按钮,由这一个配置决定显示还是隐藏
|
|
|
- paintFormat: true, //格式刷
|
|
|
- currencyFormat: true, //货币格式
|
|
|
- percentageFormat: true, //百分比格式
|
|
|
- numberDecrease: true, // '减少小数位数'
|
|
|
- numberIncrease: true, // '增加小数位数
|
|
|
- moreFormats: true, // '更多格式'
|
|
|
- font: true, // '字体'
|
|
|
- fontSize: true, // '字号大小'
|
|
|
- bold: true, // '粗体 (Ctrl+B)'
|
|
|
- italic: true, // '斜体 (Ctrl+I)'
|
|
|
- strikethrough: true, // '删除线 (Alt+Shift+5)'
|
|
|
- underline: true, // '下划线 (Alt+Shift+6)'
|
|
|
- textColor: true, // '文本颜色'
|
|
|
- fillColor: true, // '单元格颜色'
|
|
|
- border: true, // '边框'
|
|
|
- mergeCell: true, // '合并单元格'
|
|
|
- horizontalAlignMode: true, // '水平对齐方式'
|
|
|
- verticalAlignMode: true, // '垂直对齐方式'
|
|
|
- textWrapMode: true, // '换行方式'
|
|
|
- textRotateMode: false, // '文本旋转方式'
|
|
|
- image: false, // '插入图片'
|
|
|
- link: false, // '插入链接'
|
|
|
- chart: false, // '图表'(图标隐藏,但是如果配置了chart插件,右击仍然可以新建图表)
|
|
|
- postil: false, //'批注'
|
|
|
- pivotTable: false, //'数据透视表'
|
|
|
- function: true, // '公式'
|
|
|
- frozenMode: false, // '冻结方式'
|
|
|
- sortAndFilter: true, // '排序和筛选'
|
|
|
- conditionalFormat: false, // '条件格式'
|
|
|
- dataVerification: false, // '数据验证'
|
|
|
- splitColumn: true, // '分列'
|
|
|
- screenshot: false, // '截图'
|
|
|
- findAndReplace: true, // '查找替换'
|
|
|
- protection: false, // '工作表保护'
|
|
|
- print: false, // '打印'
|
|
|
+ undoRedo: showToolBar, //撤销重做,注意撤消重做是两个按钮,由这一个配置决定显示还是隐藏
|
|
|
+ paintFormat: showToolBar, //格式刷
|
|
|
+ currencyFormat: showToolBar, //货币格式
|
|
|
+ percentageFormat: showToolBar, //百分比格式
|
|
|
+ numberDecrease: showToolBar, // '减少小数位数'
|
|
|
+ numberIncrease: showToolBar, // '增加小数位数
|
|
|
+ moreFormats: showToolBar, // '更多格式'
|
|
|
+ font: showToolBar, // '字体'
|
|
|
+ fontSize: showToolBar, // '字号大小'
|
|
|
+ bold: showToolBar, // '粗体 (Ctrl+B)'
|
|
|
+ italic: showToolBar, // '斜体 (Ctrl+I)'
|
|
|
+ strikethrough: showToolBar, // '删除线 (Alt+Shift+5)'
|
|
|
+ underline: showToolBar, // '下划线 (Alt+Shift+6)'
|
|
|
+ textColor: showToolBar, // '文本颜色'
|
|
|
+ fillColor: showToolBar, // '单元格颜色'
|
|
|
+ border: showToolBar, // '边框'
|
|
|
+ mergeCell: showToolBar, // '合并单元格'
|
|
|
+ horizontalAlignMode: showToolBar, // '水平对齐方式'
|
|
|
+ verticalAlignMode: showToolBar, // '垂直对齐方式'
|
|
|
+ textWrapMode: showToolBar, // '换行方式'
|
|
|
+ textRotateMode: showToolBar, // '文本旋转方式'
|
|
|
+ image: showToolBar, // '插入图片'
|
|
|
+ link: showToolBar, // '插入链接'
|
|
|
+ chart: showToolBar, // '图表'(图标隐藏,但是如果配置了chart插件,右击仍然可以新建图表)
|
|
|
+ postil: showToolBar, //'批注'
|
|
|
+ pivotTable: showToolBar, //'数据透视表'
|
|
|
+ function: showToolBar, // '公式'
|
|
|
+ frozenMode: showToolBar, // '冻结方式'
|
|
|
+ sortAndFilter: showToolBar, // '排序和筛选'
|
|
|
+ conditionalFormat: showToolBar, // '条件格式'
|
|
|
+ dataVerification: showToolBar, // '数据验证'
|
|
|
+ splitColumn: showToolBar, // '分列'
|
|
|
+ screenshot: showToolBar, // '截图'
|
|
|
+ findAndReplace: showToolBar, // '查找替换'
|
|
|
+ protection: showToolBar, // '工作表保护'
|
|
|
+ print: showToolBar, // '打印'
|
|
|
},
|
|
|
showinfobar: true, // 顶部信息 文件名称 按钮
|
|
|
allowUpdate: false, // 是否允许操作表格后的后台更新 在线文档websocket时为true
|
|
@@ -228,7 +257,7 @@
|
|
|
view: false, // 打印视图
|
|
|
zoom: false, // 缩放
|
|
|
},
|
|
|
- functionButton: toolBar,
|
|
|
+ functionButton: '',
|
|
|
cellRightClickConfig: {
|
|
|
copy: false, // 复制
|
|
|
copyAs: false, // 复制为
|
|
@@ -274,29 +303,17 @@
|
|
|
} catch (err) {
|
|
|
console.log(err)
|
|
|
}
|
|
|
- if (isAdmin == false) {
|
|
|
-
|
|
|
- } else {
|
|
|
-
|
|
|
- }
|
|
|
- if (emptyExcel == true) {
|
|
|
-
|
|
|
- } else {
|
|
|
-
|
|
|
- }
|
|
|
- if (excelInfo.shareStatus == '1') {
|
|
|
-
|
|
|
- } else {
|
|
|
-
|
|
|
+ if (type == '2') {
|
|
|
+ $("#templateType").val(excelInfo.typeName);
|
|
|
}
|
|
|
initHandel();
|
|
|
}
|
|
|
|
|
|
-
|
|
|
// 绑定按钮事件
|
|
|
function initHandel() {
|
|
|
$("#fullScreen").on("click", function () {
|
|
|
fullScreen();
|
|
|
+ $('#monthSelect').show()
|
|
|
})
|
|
|
//退出全屏
|
|
|
$("#exitFullScreen").on("click", function () {
|
|
@@ -305,6 +322,46 @@
|
|
|
//分享
|
|
|
$('#share').off("click").click(function () {
|
|
|
window.parent['showAuthDialog']('true');
|
|
|
+ if (type == '1') {
|
|
|
+ disableUpload();
|
|
|
+ } else if (type == '2') {
|
|
|
+ disableSave();
|
|
|
+ }
|
|
|
+ realExitFullScreen();
|
|
|
+ });
|
|
|
+ //修改
|
|
|
+ $('#enableSave').off("click").click(function () {
|
|
|
+ var excelId = $(window.parent.document).find("#excelId").attr("value");
|
|
|
+ var sheetName = luckysheet.getSheet().name;
|
|
|
+ var excelData = luckysheet.getSheet(sheetName);
|
|
|
+ var templateType = $("#templateType").val();
|
|
|
+ var excelName = luckysheet.toJson().title;
|
|
|
+ if ($.trim(templateType) == '') {
|
|
|
+ window.top.$vm.$message({
|
|
|
+ message: '请输入模板类型',
|
|
|
+ type: 'info'
|
|
|
+ })
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //调用vue页面方法执行新增/修改
|
|
|
+ window.parent['addNewTemplate'](excelName, excelData, templateType);
|
|
|
+ });
|
|
|
+ //新增
|
|
|
+ $('#enableUpload').off("click").click(function () {
|
|
|
+ var excelId = $(window.parent.document).find("#excelId").attr("value");
|
|
|
+ var sheetName = luckysheet.getSheet().name;
|
|
|
+ var excelData = luckysheet.getSheet(sheetName);
|
|
|
+ var templateType = $("#templateType").val();
|
|
|
+ var excelName = luckysheet.toJson().title;
|
|
|
+ if ($.trim(templateType) == '') {
|
|
|
+ window.top.$vm.$message({
|
|
|
+ message: '请输入模板类型',
|
|
|
+ type: 'info'
|
|
|
+ })
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //调用vue页面方法执行新增/修改
|
|
|
+ window.parent['addNewTemplate'](excelName, excelData, templateType);
|
|
|
});
|
|
|
// 保存
|
|
|
$('#saves').off("click").click(function () {
|
|
@@ -428,7 +485,36 @@
|
|
|
}
|
|
|
|
|
|
getData()
|
|
|
- })
|
|
|
+ });
|
|
|
+
|
|
|
+ //退出全屏,而不是切换
|
|
|
+ function realExitFullScreen() {
|
|
|
+ $('#monthSelect').show()
|
|
|
+ //$("#exitFullScreen").css("display", "");
|
|
|
+ $("#fullScreen").css("display", "show");
|
|
|
+ $('.excel-style').css('width', '100%')
|
|
|
+ $('.excel-style').css('height', '97%')
|
|
|
+ var isFullscreen = document.fullScreenElement //W3C
|
|
|
+ ||
|
|
|
+ document.msFullscreenElement //IE
|
|
|
+ ||
|
|
|
+ document.mozFullScreenElement //火狐
|
|
|
+ ||
|
|
|
+ document.webkitFullscreenElement //谷歌
|
|
|
+ ||
|
|
|
+ false;
|
|
|
+ if (isFullscreen) {
|
|
|
+ if (document.exitFullscreen) {
|
|
|
+ document.exitFullscreen();
|
|
|
+ } else if (document.msExitFullscreen) {
|
|
|
+ document.msExitFullscreen();
|
|
|
+ } else if (document.mozCancelFullScreen) {
|
|
|
+ document.mozCancelFullScreen();
|
|
|
+ } else if (document.webkitCancelFullScreen) {
|
|
|
+ document.webkitCancelFullScreen();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
</script>
|
|
|
</body>
|