'use strict'; /** * * * @author CaiAoLin * @date 2019/9/24 * @version */ const initialization = (() => { $(document).ready(function () { $.bootstrapLoading.start(); CommonAjax.get('/complementaryRation/api/initData', {}, res => { if (res.error) { alert('数据初始化失败,请重试。'); setTimeout(() => { window.location.href = '/' }, 1200); } else { const data = res.data; pageOprObj.rationTreeData = data.rationTreeData; pageOprObj.mixedTreeData = data.mixedTreeData; pageOprObj.mixedGLJData = data.mixedGLJData; rationGLJOprObj.distTypeTree = data.gljDistTypeCache; rationOprObj.rationsCodes = data.rationsCodes; rationOprObj.buildSheet($("#rationItemsSheet")[0]); // tabPanel 下有多个Spread时,相互之间不能正确显示。改成一个Spread下多个Sheet。 var rdSpread = sheetCommonObj.createSpread($("#rdSpread")[0], 4); rdSpread.options.allowUserDragFill = false; rdSpread.options.allowUserDragDrop = false; sheetCommonObj.spreadDefaultStyle(rdSpread); rationGLJOprObj.buildSheet(rdSpread.getSheet(0)); rationAssistOprObj.buildSheet(rdSpread.getSheet(1)); rationCoeOprObj.buildSheet(rdSpread.getSheet(2)); rationInstObj.buildSheet(rdSpread.getSheet(3)); rationInstObj.getInstallation(data.installationData); let rdSpreadEscSheets = []; rdSpreadEscSheets.push({sheet: rdSpread.getSheet(0), editStarting: rationGLJOprObj.onEditStarting, editEnded: rationGLJOprObj.onCellEditEnd}); rdSpreadEscSheets.push({sheet: rdSpread.getSheet(1), editStarting: rationAssistOprObj.onEditStarting, editEnded: rationAssistOprObj.onEditEnded}); rdSpreadEscSheets.push({sheet: rdSpread.getSheet(2), editStarting: rationCoeOprObj.onEditStarting, editEnded: rationCoeOprObj.onEditEnded}); rdSpreadEscSheets.push({sheet: rdSpread.getSheet(3), editStarting: rationInstObj.onEditStarting, editEnded: rationInstObj.onEditEnded}); sheetCommonObj.bindEscKey(rdSpread, rdSpreadEscSheets); pageOprObj.initPage(); $("#linkGLJ").click(function(){ rationGLJOprObj.bindRationGljDelOpr(); rdSpread.setActiveSheetIndex(0); }); $("#linkFZDE").click(function(){ rationAssistOprObj.bindRationAssDel(); rdSpread.setActiveSheetIndex(1); }); $("#linkFZTJ").click(function(){ rationCoeOprObj.bindRationCoeDel(); rdSpread.setActiveSheetIndex(2); }); $("#linkAZZJ").click(function(){ rationInstObj.bindRationInstDel(); rdSpread.setActiveSheetIndex(3); }); } $.bootstrapLoading.end(); }); //解决spreadjs sheet初始化没高度宽度 $('#modalCon').width($(window).width()*0.5); $('#gljSelTreeDiv').height($(window).height() - 300); $("#gljSelSheet").height($("#gljSelTreeDiv").height()-21.6); $("#gljSelSheet").width($('#modalCon').width() * 0.63); $(window).resize(function () { $('#modalCon').width($(window).width()*0.5); $('#gljSelTreeDiv').height($(window).height() - 300); $("#gljSelSheet").height($("#gljSelTreeDiv").height()-21.6); $("#gljSelSheet").width($('#modalCon').width()* 0.63); }); }); })();