概述
这个 demo 一边挂载 ScenarioPanel,一边监听方案变化事件,把操作过程写成日志。
实现思路
先从 JSON 里载入带方案的工作簿。
再绑定 ScenarioChanging 和 ScenarioChanged,分别记录变更前后状态。
对“盈亏平衡”方案做保护,避免它被更新、激活或删除。
代码解析
这段逻辑在方案真正变更前先做拦截,所以被保护的“盈亏平衡”方案不会被更新、激活或删除。
运行效果
右侧会显示方案面板和事件日志。
每次方案变化都会追加一条记录。
“盈亏平衡”方案触发受保护操作时会被取消。
var PROTECTED_SCENARIO_NAME = '盈亏平衡';
var spread;
var scenarioPanel;
var eventIndex = 0;
var scenarioDisplayNames = {
'盈亏平衡': '盈亏平衡',
'保守预测': '保守预测',
'乐观预测': '乐观预测'
};
window.onload = function () {
spread = new GC.Spread.Sheets.Workbook(document.getElementById('ss'), { sheetCount: 1 });
initSpread(spread);
};
function initSpread(workbook) {
bindEventLogControls();
workbook.suspendPaint();
workbook.fromJSON(json);
workbook.resumePaint();
bindScenarioEvents(workbook);
scenarioPanel = new GC.Spread.Sheets.Scenarios.ScenarioPanel('scenarioPanelHost');
scenarioPanel.attach(workbook);
}
function bindScenarioEvents(workbook) {
var events = GC.Spread.Sheets.Events;
workbook.bind(events.ScenarioChanging, function (sender, args) {
var blocked = isProtectedScenarioChange(args);
if (blocked) {
args.cancel = true;
}
appendLog(formatScenarioEvent('方案变更前', args, blocked));
});
workbook.bind(events.ScenarioChanged, function (sender, args) {
appendLog(formatScenarioEvent('方案已变更', args, false));
});
}
function isProtectedScenarioChange(args) {
var scenario = args && args.scenario;
var originScenario = args && args.originScenario;
return !!scenario && (scenario.name === PROTECTED_SCENARIO_NAME || (originScenario && originScenario.name === PROTECTED_SCENARIO_NAME)) && (args.action === 'update' || args.action === 'activated' || args.action === 'remove');
}
function formatScenarioEvent(eventName, args, blocked) {
var scenario = args.scenario || {};
var originScenario = args.originScenario;
var parts = [
++eventIndex + '. ' + eventName,
'操作=' + toActionText(args.action),
'方案=' + getScenarioDisplayName(scenario.name || ''),
'负责人=' + getScenarioOwner(scenario.userId),
'覆盖=' + countOverrideCells(scenario)
];
if (originScenario) {
parts.push('来源=' + getScenarioDisplayName(originScenario.name));
}
if (blocked) {
parts.push('已取消:盈亏平衡方案禁止更新、激活和删除');
}
return parts.join(' | ');
}
function toActionText(action) {
var actions = {
add: '新增方案',
update: '更新方案',
remove: '删除方案',
apply: '应用方案',
restore: '还原方案',
activated: '激活方案捕获',
deactivated: '取消方案捕获'
};
return actions[action] || action;
}
function countOverrideCells(scenario) {
var count = 0;
(scenario.overrides || []).forEach(function (override) {
if (override.cells) {
count += override.cells.length;
return;
}
var dataTable = override.dataTable || {};
Object.keys(dataTable).forEach(function (row) {
count += Object.keys(dataTable[row] || {}).length;
});
});
return count + ' 个单元格';
}
function getScenarioOwner(userId) {
var users = json.users || [];
for (var i = 0; i < users.length; i++) {
if (users[i].id === userId) {
return users[i].name;
}
}
return userId || '未知负责人';
}
function getScenarioDisplayName(name) {
return scenarioDisplayNames[name] || name || '无';
}
function bindEventLogControls() {
document.getElementById('clearEventLog').addEventListener('click', clearEventLog);
}
function clearEventLog() {
eventIndex = 0;
document.getElementById('scenarioEventLog').value = '';
}
function appendLog(message) {
var eventLog = document.getElementById('scenarioEventLog');
eventLog.value = eventLog.value ? eventLog.value + '\n' + message : message;
eventLog.scrollTop = eventLog.scrollHeight;
}
<!doctype html>
<html style="height:100%;font-size:14px;">
<head>
<meta charset="utf-8" />
<meta name="spreadjs culture" content="zh-cn" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" type="text/css" href="$DEMOROOT$/zh/purejs/node_modules/@grapecity-software/spread-sheets/styles/gc.spread.sheets.excel2013white.css">
<script src="$DEMOROOT$/zh/purejs/node_modules/@grapecity-software/spread-sheets/dist/gc.spread.sheets.all.min.js" type="text/javascript"></script>
<script src="$DEMOROOT$/zh/purejs/node_modules/@grapecity-software/spread-sheets-resources-zh/dist/gc.spread.sheets.resources.zh.min.js" type="text/javascript"></script>
<script src="$DEMOROOT$/spread/source/js/license.js" type="text/javascript"></script>
<script src="data.js" type="text/javascript"></script>
<script src="app.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="styles.css">
</head>
<body>
<div class="sample-tutorial">
<div id="ss" class="sample-spreadsheets"></div>
<div class="options-container">
<div id="scenarioPanelHost" class="scenario-panel-host"></div>
<div class="event-log-section">
<div class="event-log-header">
<label for="scenarioEventLog">方案事件日志</label>
<button type="button" id="clearEventLog">清空</button>
</div>
<textarea id="scenarioEventLog" readonly></textarea>
</div>
</div>
</div>
</body>
</html>
var json = {
"version": "18.0.0",
"name": "",
"docProps": {
"docPropsApp": {},
"docPropsCore": {}
},
"sheetCount": 1,
"users": [
{
"id": "{483FF98B-BB90-4EB4-8329-761CD05F2BAE}",
"name": "Ethan(销售副总裁)",
"color": "#26A69A"
},
{
"id": "{483FF98B-BB90-4EB4-8329-761CD56778AE}",
"name": "Emma(财务总监)",
"color": "#A6A634"
}
],
"customList": [],
"defaultSheetTabStyles": {},
"builtInFileIcons": {},
"sheets": {
"年度电风扇销售预测": {
"name": "年度电风扇销售预测",
"isSelected": true,
"rowCount": 21,
"columnCount": 7,
"activeRow": 9,
"activeCol": 3,
"visible": 1,
"theme": "Office",
"data": {
"dataTable": {
"0": {
"0": {
"value": "使用上方面板新增、应用、编辑、激活、还原或删除方案。",
"style": {
"autoFormatter": {},
"vAlign": 0,
"font": "14.6667px Calibri",
"fontSize": "14.6667px",
"fontFamily": "Calibri"
}
}
},
"1": {
"0": {
"value": "盈亏平衡方案禁止更新、激活和删除。",
"style": {
"autoFormatter": {},
"vAlign": 0,
"font": "14.6667px Calibri",
"fontSize": "14.6667px",
"fontFamily": "Calibri"
}
}
},
"2": {
"0": {
"value": "电风扇年度销售预测",
"style": {
"autoFormatter": {},
"font": "bold 16px Arial",
"fontWeight": "bold",
"fontSize": "16px",
"fontFamily": "Arial"
}
}
},
"3": {
"0": {
"value": "前四个月为实际销量,剩余月份为全年预测输入。"
}
},
"4": {
"0": {
"value": "月份",
"style": {
"backColor": "#e8f4ff",
"font": "bold 12px Arial",
"fontWeight": "bold",
"fontSize": "12px",
"fontFamily": "Arial"
}
},
"1": {
"value": "销量",
"style": {
"backColor": "#e8f4ff",
"font": "bold 12px Arial",
"fontWeight": "bold",
"fontSize": "12px",
"fontFamily": "Arial"
}
},
"2": {
"value": "单价",
"style": {
"backColor": "#e8f4ff",
"font": "bold 12px Arial",
"fontWeight": "bold",
"fontSize": "12px",
"fontFamily": "Arial"
}
},
"3": {
"value": "收入",
"style": {
"backColor": "#e8f4ff",
"font": "bold 12px Arial",
"fontWeight": "bold",
"fontSize": "12px",
"fontFamily": "Arial"
}
},
"4": {
"value": "成本",
"style": {
"backColor": "#e8f4ff",
"font": "bold 12px Arial",
"fontWeight": "bold",
"fontSize": "12px",
"fontFamily": "Arial"
}
},
"5": {
"value": "利润",
"style": {
"backColor": "#e8f4ff",
"font": "bold 12px Arial",
"fontWeight": "bold",
"fontSize": "12px",
"fontFamily": "Arial"
}
}
},
"5": {
"0": {
"value": "一月",
"style": {
"backColor": "#eef8f1"
}
},
"1": {
"value": 622,
"style": {
"backColor": "#eef8f1",
"formatter": "#,##0"
}
},
"2": {
"value": 48,
"style": {
"backColor": "#eef8f1",
"formatter": "$#,##0.00"
}
},
"3": {
"value": 29856,
"style": {
"backColor": "#eef8f1",
"formatter": "$#,##0.00"
},
"formula": {
"si": 0
}
},
"4": {
"value": 17416,
"style": {
"backColor": "#eef8f1",
"formatter": "$#,##0.00"
},
"formula": {
"si": 1
}
},
"5": {
"value": 12440,
"style": {
"backColor": "#eef8f1",
"formatter": "$#,##0.00"
},
"formula": {
"si": 2
}
}
},
"6": {
"0": {
"value": "二月",
"style": {
"backColor": "#eef8f1"
}
},
"1": {
"value": 631,
"style": {
"backColor": "#eef8f1",
"formatter": "#,##0"
}
},
"2": {
"value": 48,
"style": {
"backColor": "#eef8f1",
"formatter": "$#,##0.00"
}
},
"3": {
"value": 30288,
"style": {
"backColor": "#eef8f1",
"formatter": "$#,##0.00"
},
"formula": {
"si": 0
}
},
"4": {
"value": 17668,
"style": {
"backColor": "#eef8f1",
"formatter": "$#,##0.00"
},
"formula": {
"si": 1
}
},
"5": {
"value": 12620,
"style": {
"backColor": "#eef8f1",
"formatter": "$#,##0.00"
},
"formula": {
"si": 2
}
}
},
"7": {
"0": {
"value": "三月",
"style": {
"backColor": "#eef8f1"
}
},
"1": {
"value": 713,
"style": {
"backColor": "#eef8f1",
"formatter": "#,##0"
}
},
"2": {
"value": 48,
"style": {
"backColor": "#eef8f1",
"formatter": "$#,##0.00"
}
},
"3": {
"value": 34224,
"style": {
"backColor": "#eef8f1",
"formatter": "$#,##0.00"
},
"formula": {
"si": 0
}
},
"4": {
"value": 19964,
"style": {
"backColor": "#eef8f1",
"formatter": "$#,##0.00"
},
"formula": {
"si": 1
}
},
"5": {
"value": 14260,
"style": {
"backColor": "#eef8f1",
"formatter": "$#,##0.00"
},
"formula": {
"si": 2
}
}
},
"8": {
"0": {
"value": "四月",
"style": {
"backColor": "#eef8f1"
}
},
"1": {
"value": 854,
"style": {
"backColor": "#eef8f1",
"formatter": "#,##0"
}
},
"2": {
"value": 48,
"style": {
"backColor": "#eef8f1",
"formatter": "$#,##0.00"
}
},
"3": {
"value": 40992,
"style": {
"backColor": "#eef8f1",
"formatter": "$#,##0.00"
},
"formula": {
"si": 0
}
},
"4": {
"value": 23912,
"style": {
"backColor": "#eef8f1",
"formatter": "$#,##0.00"
},
"formula": {
"si": 1
}
},
"5": {
"value": 17080,
"style": {
"backColor": "#eef8f1",
"formatter": "$#,##0.00"
},
"formula": {
"si": 2
}
}
},
"9": {
"0": {
"value": "五月",
"style": {
"backColor": "#fff8dc"
}
},
"1": {
"style": {
"backColor": "#fff8dc",
"formatter": "#,##0"
}
},
"2": {
"style": {
"backColor": "#fff8dc",
"hAlign": 3,
"vAlign": 0,
"themeFont": "Body",
"formatter": "$#,##0.00",
"imeMode": 1
}
},
"3": {
"value": 0,
"style": {
"backColor": "#fff8dc",
"formatter": "$#,##0.00"
},
"formula": {
"si": 0
}
},
"4": {
"value": 0,
"style": {
"backColor": "#fff8dc",
"formatter": "$#,##0.00"
},
"formula": {
"si": 1
}
},
"5": {
"value": 0,
"style": {
"backColor": "#fff8dc",
"formatter": "$#,##0.00"
},
"formula": {
"si": 2
}
}
},
"10": {
"0": {
"value": "六月",
"style": {
"backColor": "#fff8dc"
}
},
"1": {
"style": {
"backColor": "#fff8dc",
"formatter": "#,##0"
}
},
"2": {
"style": {
"backColor": "#fff8dc",
"hAlign": 3,
"vAlign": 0,
"themeFont": "Body",
"formatter": "$#,##0.00",
"imeMode": 1
}
},
"3": {
"value": 0,
"style": {
"backColor": "#fff8dc",
"formatter": "$#,##0.00"
},
"formula": {
"si": 0
}
},
"4": {
"value": 0,
"style": {
"backColor": "#fff8dc",
"formatter": "$#,##0.00"
},
"formula": {
"si": 1
}
},
"5": {
"value": 0,
"style": {
"backColor": "#fff8dc",
"formatter": "$#,##0.00"
},
"formula": {
"si": 2
}
}
},
"11": {
"0": {
"value": "七月",
"style": {
"backColor": "#fff8dc"
}
},
"1": {
"style": {
"backColor": "#fff8dc",
"hAlign": 3,
"vAlign": 0,
"themeFont": "Body",
"formatter": "#,##0",
"imeMode": 1
}
},
"2": {
"style": {
"backColor": "#fff8dc",
"hAlign": 3,
"vAlign": 0,
"themeFont": "Body",
"formatter": "$#,##0.00",
"imeMode": 1
}
},
"3": {
"value": 0,
"style": {
"backColor": "#fff8dc",
"formatter": "$#,##0.00"
},
"formula": {
"si": 0
}
},
"4": {
"value": 0,
"style": {
"backColor": "#fff8dc",
"formatter": "$#,##0.00"
},
"formula": {
"si": 1
}
},
"5": {
"value": 0,
"style": {
"backColor": "#fff8dc",
"formatter": "$#,##0.00"
},
"formula": {
"si": 2
}
}
},
"12": {
"0": {
"value": "八月",
"style": {
"backColor": "#fff8dc"
}
},
"1": {
"style": {
"backColor": "#fff8dc",
"hAlign": 3,
"vAlign": 0,
"themeFont": "Body",
"formatter": "#,##0",
"imeMode": 1
}
},
"2": {
"style": {
"backColor": "#fff8dc",
"hAlign": 3,
"vAlign": 0,
"themeFont": "Body",
"formatter": "$#,##0.00",
"imeMode": 1
}
},
"3": {
"value": 0,
"style": {
"backColor": "#fff8dc",
"formatter": "$#,##0.00"
},
"formula": {
"si": 0
}
},
"4": {
"value": 0,
"style": {
"backColor": "#fff8dc",
"formatter": "$#,##0.00"
},
"formula": {
"si": 1
}
},
"5": {
"value": 0,
"style": {
"backColor": "#fff8dc",
"formatter": "$#,##0.00"
},
"formula": {
"si": 2
}
}
},
"13": {
"0": {
"value": "九月",
"style": {
"backColor": "#fff8dc"
}
},
"1": {
"style": {
"backColor": "#fff8dc",
"hAlign": 3,
"vAlign": 0,
"themeFont": "Body",
"formatter": "#,##0",
"imeMode": 1
}
},
"2": {
"style": {
"backColor": "#fff8dc",
"hAlign": 3,
"vAlign": 0,
"themeFont": "Body",
"formatter": "$#,##0.00",
"imeMode": 1
}
},
"3": {
"value": 0,
"style": {
"backColor": "#fff8dc",
"formatter": "$#,##0.00"
},
"formula": {
"si": 0
}
},
"4": {
"value": 0,
"style": {
"backColor": "#fff8dc",
"formatter": "$#,##0.00"
},
"formula": {
"si": 1
}
},
"5": {
"value": 0,
"style": {
"backColor": "#fff8dc",
"formatter": "$#,##0.00"
},
"formula": {
"si": 2
}
}
},
"14": {
"0": {
"value": "十月",
"style": {
"backColor": "#fff8dc"
}
},
"1": {
"style": {
"backColor": "#fff8dc",
"hAlign": 3,
"vAlign": 0,
"themeFont": "Body",
"formatter": "#,##0",
"imeMode": 1
}
},
"2": {
"style": {
"backColor": "#fff8dc",
"hAlign": 3,
"vAlign": 0,
"themeFont": "Body",
"formatter": "$#,##0.00",
"imeMode": 1
}
},
"3": {
"value": 0,
"style": {
"backColor": "#fff8dc",
"formatter": "$#,##0.00"
},
"formula": {
"si": 0
}
},
"4": {
"value": 0,
"style": {
"backColor": "#fff8dc",
"formatter": "$#,##0.00"
},
"formula": {
"si": 1
}
},
"5": {
"value": 0,
"style": {
"backColor": "#fff8dc",
"formatter": "$#,##0.00"
},
"formula": {
"si": 2
}
}
},
"15": {
"0": {
"value": "十一月",
"style": {
"backColor": "#fff8dc"
}
},
"1": {
"style": {
"backColor": "#fff8dc",
"hAlign": 3,
"vAlign": 0,
"themeFont": "Body",
"formatter": "#,##0",
"imeMode": 1
}
},
"2": {
"style": {
"backColor": "#fff8dc",
"hAlign": 3,
"vAlign": 0,
"themeFont": "Body",
"formatter": "$#,##0.00",
"imeMode": 1
}
},
"3": {
"value": 0,
"style": {
"backColor": "#fff8dc",
"formatter": "$#,##0.00"
},
"formula": {
"si": 0
}
},
"4": {
"value": 0,
"style": {
"backColor": "#fff8dc",
"formatter": "$#,##0.00"
},
"formula": {
"si": 1
}
},
"5": {
"value": 0,
"style": {
"backColor": "#fff8dc",
"formatter": "$#,##0.00"
},
"formula": {
"si": 2
}
}
},
"16": {
"0": {
"value": "十二月",
"style": {
"backColor": "#fff8dc"
}
},
"1": {
"style": {
"backColor": "#fff8dc",
"hAlign": 3,
"vAlign": 0,
"themeFont": "Body",
"formatter": "#,##0",
"imeMode": 1
}
},
"2": {
"style": {
"backColor": "#fff8dc",
"hAlign": 3,
"vAlign": 0,
"themeFont": "Body",
"formatter": "$#,##0.00",
"imeMode": 1
}
},
"3": {
"value": 0,
"style": {
"backColor": "#fff8dc",
"formatter": "$#,##0.00"
},
"formula": {
"si": 0
}
},
"4": {
"value": 0,
"style": {
"backColor": "#fff8dc",
"formatter": "$#,##0.00"
},
"formula": {
"si": 1
}
},
"5": {
"value": 0,
"style": {
"backColor": "#fff8dc",
"formatter": "$#,##0.00"
},
"formula": {
"si": 2
}
}
},
"17": {
"0": {
"value": "年度合计",
"style": {
"backColor": "#dff3e3",
"font": "bold 12px Arial",
"fontWeight": "bold",
"fontSize": "12px",
"fontFamily": "Arial"
}
},
"1": {
"value": 2820,
"style": {
"backColor": "#dff3e3",
"font": "bold 12px Arial",
"formatter": "#,##0",
"fontWeight": "bold",
"fontSize": "12px",
"fontFamily": "Arial"
},
"formula": {
"si": 3
}
},
"2": {
"style": {
"backColor": "#dff3e3",
"font": "bold 12px Arial",
"fontWeight": "bold",
"fontSize": "12px",
"fontFamily": "Arial"
}
},
"3": {
"value": 135360,
"style": {
"backColor": "#dff3e3",
"font": "bold 12px Arial",
"formatter": "$#,##0.00",
"fontWeight": "bold",
"fontSize": "12px",
"fontFamily": "Arial"
},
"formula": {
"si": 3
}
},
"4": {
"value": 78960,
"style": {
"backColor": "#dff3e3",
"font": "bold 12px Arial",
"formatter": "$#,##0.00",
"fontWeight": "bold",
"fontSize": "12px",
"fontFamily": "Arial"
},
"formula": {
"si": 3
}
},
"5": {
"value": 56400,
"style": {
"backColor": "#dff3e3",
"font": "bold 12px Arial",
"formatter": "$#,##0.00",
"fontWeight": "bold",
"fontSize": "12px",
"fontFamily": "Arial"
},
"formula": {
"si": 3
}
}
},
"19": {
"0": {
"value": "方案覆盖单元格",
"style": {
"font": "bold 12px Arial",
"fontWeight": "bold",
"fontSize": "12px",
"fontFamily": "Arial"
}
},
"1": {
"value": "B8:C15",
"style": {
"font": "bold 12px Arial",
"fontWeight": "bold",
"fontSize": "12px",
"fontFamily": "Arial"
}
}
}
},
"defaultDataNode": {
"style": {
"themeFont": "Body"
}
}
},
"rowHeaderData": {
"defaultDataNode": {
"style": {
"themeFont": "Body"
}
}
},
"colHeaderData": {
"defaultDataNode": {
"style": {
"themeFont": "Body"
}
}
},
"columns": [
{
"size": 143
},
{
"size": 88
},
{
"size": 92
},
{
"size": 116
},
{
"size": 108
},
{
"size": 116
}
],
"defaultData": {},
"leftCellIndex": 0,
"topCellIndex": 0,
"selections": {
"0": {
"row": 9,
"col": 3,
"rowCount": 1,
"colCount": 1
},
"length": 1
},
"rowOutlines": {
"items": []
},
"columnOutlines": {
"items": []
},
"cellStates": {},
"states": {},
"outlineColumnOptions": {},
"autoMergeRangeInfos": [],
"sharedFormulas": {
"0": {
"formula": "B6*C6",
"baseRow": 5,
"baseColumn": 3,
"lastRow": 16,
"lastColumn": 3
},
"1": {
"formula": "B6*28",
"baseRow": 5,
"baseColumn": 4,
"lastRow": 16,
"lastColumn": 4
},
"2": {
"formula": "D6-E6",
"baseRow": 5,
"baseColumn": 5,
"lastRow": 16,
"lastColumn": 5
},
"3": {
"formula": "SUM(B6:B17)",
"baseRow": 17,
"baseColumn": 1,
"lastRow": 17,
"lastColumn": 5
},
"nextIndex": 4
},
"printInfo": {
"paperSize": {
"width": 850,
"height": 1100,
"kind": 1
}
},
"gridline": {
"showVerticalGridline": false
},
"index": 0,
"order": 0
}
},
"sheetTabCount": 0,
"namedPatterns": {},
"scenarios": {
"盈亏平衡": {
"name": "盈亏平衡",
"userId": "{483FF98B-BB90-4EB4-8329-761CD56778AE}",
"overrides": [
{
"sheetName": "年度电风扇销售预测",
"dataTable": {
"9": {
"1": {
"value": 900
},
"2": {
"value": 48
}
},
"10": {
"1": {
"value": 1000
},
"2": {
"value": 48
}
},
"11": {
"1": {
"value": 1200
},
"2": {
"value": 48
}
},
"12": {
"1": {
"value": 1200
},
"2": {
"value": 48
}
},
"13": {
"1": {
"value": 1000
},
"2": {
"value": 48
}
},
"14": {
"1": {
"value": 800
},
"2": {
"value": 48
}
},
"15": {
"1": {
"value": 600
},
"2": {
"value": 48
}
},
"16": {
"1": {
"value": 600
},
"2": {
"value": 48
}
}
}
}
]
},
"保守预测": {
"name": "保守预测",
"userId": "{483FF98B-BB90-4EB4-8329-761CD05F2BAE}",
"overrides": [
{
"sheetName": "年度电风扇销售预测",
"dataTable": {
"9": {
"1": {
"value": 960
},
"2": {
"value": 48
}
},
"10": {
"1": {
"value": 1100
},
"2": {
"value": 48
}
},
"11": {
"1": {
"value": 1800
},
"2": {
"value": 48
}
},
"12": {
"1": {
"value": 1800
},
"2": {
"value": 48
}
},
"13": {
"1": {
"value": 1200
},
"2": {
"value": 48
}
},
"14": {
"1": {
"value": 800
},
"2": {
"value": 48
}
},
"15": {
"1": {
"value": 600
},
"2": {
"value": 48
}
},
"16": {
"1": {
"value": 600
},
"2": {
"value": 48
}
}
}
}
]
},
"乐观预测": {
"name": "乐观预测",
"userId": "{483FF98B-BB90-4EB4-8329-761CD05F2BAE}",
"overrides": [
{
"sheetName": "年度电风扇销售预测",
"dataTable": {
"9": {
"1": {
"value": 1000
},
"2": {
"value": 48
}
},
"10": {
"1": {
"value": 1400
},
"2": {
"value": 55
}
},
"11": {
"1": {
"value": 2300
},
"2": {
"value": 55
}
},
"12": {
"1": {
"value": 2300
},
"2": {
"value": 55
}
},
"13": {
"1": {
"value": 1400
},
"2": {
"value": 48
}
},
"14": {
"1": {
"value": 1000
},
"2": {
"value": 48
}
},
"15": {
"1": {
"value": 700
},
"2": {
"value": 48
}
},
"16": {
"1": {
"value": 700
},
"2": {
"value": 48
}
}
}
}
]
}
},
"scenarioAdditionalInfo": {
"appliedScenarios": {},
"baseValues": {}
},
"pivotCaches": {}
};
html,
body {
height: 100%;
margin: 0;
overflow: hidden;
}
.sample-tutorial {
position: relative;
height: 100%;
overflow: hidden;
font-family: Arial, sans-serif;
}
.sample-spreadsheets {
width: calc(100% - 380px);
height: 100%;
overflow: hidden;
float: left;
}
.options-container {
float: right;
width: 380px;
height: 100%;
box-sizing: border-box;
background: #fafafa;
border-left: 1px solid #ddd;
overflow: hidden;
display: flex;
flex-direction: column;
}
.scenario-panel-host {
flex: 1 1 58%;
min-height: 0;
padding: 6px;
box-sizing: border-box;
border-bottom: 1px solid #ddd;
overflow: hidden;
}
.event-log-section {
flex: 0 0 42%;
min-height: 150px;
padding: 12px;
box-sizing: border-box;
display: flex;
flex-direction: column;
gap: 8px;
}
.event-log-header {
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
}
.event-log-section label {
color: #333;
font-weight: bold;
font-size: 12px;
}
.event-log-header button {
padding: 4px 10px;
border: 1px solid #bbb;
border-radius: 4px;
background: #fff;
color: #333;
cursor: pointer;
font-size: 12px;
}
.event-log-header button:hover {
background: #f0f0f0;
}
.event-log-section textarea {
flex: 1 1 auto;
min-height: 0;
width: 100%;
box-sizing: border-box;
resize: none;
border: 1px solid #ccc;
border-radius: 4px;
padding: 8px;
background: #fff;
color: #333;
font: 12px/1.4 Consolas, Monaco, monospace;
}