Commit 89ec371c authored by allen.wang's avatar allen.wang

feat:init

parent 62507a1d
param(
[string]$ConfigPath = "C:\Users\niuniu\.codex\vip-report\config.yaml",
[string]$Slides = "S09,S10",
[string]$Slides = "S10",
[string]$ReportMonth = "",
[int]$ReportYear = 0,
[int]$CompareYear = 0,
[switch]$Render,
[string]$TemplatePath = "",
[string]$OutputPath = "C:\workspace\cursor\output\vip-report\generated-top-products.pptx",
[string]$CompareOutputPath = "C:\workspace\cursor\output\vip-report\generated-top-products.compare.json"
)
......@@ -13,7 +14,15 @@ $ErrorActionPreference = "Stop"
$root = Split-Path -Parent $PSScriptRoot
$workdir = "C:\workspace\cursor"
$opsPath = "C:\workspace\cursor\output\vip-report\render-ops.top-products.live.json"
$templatePath = "C:\Users\niuniu\Desktop\Report.pptx"
$fallbackTemplatePath = Join-Path $root "output\Report.clean.pptx"
if (-not $TemplatePath) {
$TemplatePath = $fallbackTemplatePath
}
if (-not (Test-Path -LiteralPath $TemplatePath)) {
throw "TemplatePath not found: $TemplatePath"
}
$pythonArgs = @(
"$root\scripts\sync_top_products_assets.py",
......@@ -33,8 +42,8 @@ if ($CompareYear -gt 0) {
python @pythonArgs
if ($Render) {
powershell -ExecutionPolicy Bypass -File "$root\bin\vip-report-render.ps1" -TemplatePath "$templatePath" -OutputPath "$OutputPath" -OperationsPath "$opsPath" | Out-Null
python "$root\scripts\compare_pptx.py" "$templatePath" "$OutputPath" --output "$CompareOutputPath"
powershell -ExecutionPolicy Bypass -File "$root\bin\vip-report-render.ps1" -TemplatePath "$TemplatePath" -OutputPath "$OutputPath" -OperationsPath "$opsPath" | Out-Null
python "$root\scripts\compare_pptx.py" "$TemplatePath" "$OutputPath" --output "$CompareOutputPath"
Write-Output $OutputPath
Write-Output $CompareOutputPath
} else {
......
......@@ -13,7 +13,20 @@ $ErrorActionPreference = "Stop"
$root = Split-Path -Parent $PSScriptRoot
$workdir = "C:\workspace\cursor"
$opsPath = "C:\workspace\cursor\output\vip-report\render-ops.warehouse-100060.live.json"
$localConfigPath = Join-Path $root "config.yaml"
if (-not (Test-Path -LiteralPath $ConfigPath) -and (Test-Path -LiteralPath $localConfigPath)) {
$ConfigPath = $localConfigPath
}
$templatePath = "C:\Users\niuniu\Desktop\Report.pptx"
$downloadTemplatePath = "C:\Users\allen.wang\Downloads\Report.pptx"
$fallbackTemplatePath = Join-Path $root "output\Report.clean.pptx"
if (-not (Test-Path -LiteralPath $templatePath) -and (Test-Path -LiteralPath $downloadTemplatePath)) {
$templatePath = $downloadTemplatePath
}
if (-not (Test-Path -LiteralPath $templatePath) -and (Test-Path -LiteralPath $fallbackTemplatePath)) {
$templatePath = $fallbackTemplatePath
}
$pythonArgs = @(
"$root\scripts\sync_warehouse_100060_assets.py",
......
......@@ -106,6 +106,24 @@ def build_specs(report_month: str, report_year: int, compare_year: int) -> dict[
"raw_screenshot_name": "monthly-sales-overview.png",
"note": "Overview 页面,负责 S02 主表与优先级最高的总览图块。",
},
{
"capture_id": "overview_s03",
"session": SESSION_NAME,
"hash_url": "#/views/ECMonthlySalesReport_17250004228820/Overview?:iid=1",
"inner_frame_fragment": "/views/ECMonthlySalesReport_17250004228820/Overview?",
"activate_sheet": "Overview",
"filters": [
{"field": "Brand", "values": ["CK"]},
{"field": "Sales Type", "values": ["GMV"]},
{"field": "Storename (group)", "values": ["CKC-VIP"]},
{"field": "Storename", "values": ["CKC-VIP"]},
{"field": "Month", "values": s02_month_values},
{"field": "月(daily)", "values": s02_month_values},
],
"params": {"year1": report_year, "year2": compare_year},
"raw_screenshot_name": "monthly-sales-overview-s03.png",
"note": "Overview 页面,负责 S03 四宫格的真实来源。",
},
{
"capture_id": "store_sales_detail",
"session": SESSION_NAME,
......@@ -189,30 +207,30 @@ def build_specs(report_month: str, report_year: int, compare_year: int) -> dict[
"shape_name": "图片 1",
"shape_id": 2,
"asset_name": "s03_kpi_lfl_quad",
"capture_id": "store_kpi_lfl",
"source_view": "Store KPI LFL",
"note": "S03 改为从 Store KPI LFL 抽取 GP/Con/ATV/Returnqty 四块后重组,贴齐模板四宫格顺序。",
"capture_id": "overview_s03",
"source_view": "Overview",
"note": "S03 从 Overview 抽取 GP/Con/ATV/Returnqty 四块后重组,贴齐模板四宫格顺序。",
"composite": {
"canvas": {"width": 1224, "height": 685, "background": "#FFFFFF"},
"panels": [
{
"panel_code": "gp",
"crop": {"left": 50, "top": 2360, "width": 1300, "height": 520},
"crop": {"left": 0, "top": 1540, "width": 620, "height": 370},
"dest": {"left": 0, "top": 0, "width": 598, "height": 328},
},
{
"panel_code": "con",
"crop": {"left": 50, "top": 1230, "width": 1300, "height": 520},
"crop": {"left": 620, "top": 1540, "width": 620, "height": 370},
"dest": {"left": 626, "top": 0, "width": 598, "height": 328},
},
{
"panel_code": "atv",
"crop": {"left": 50, "top": 1800, "width": 1300, "height": 520},
"crop": {"left": 0, "top": 1930, "width": 620, "height": 330},
"dest": {"left": 0, "top": 357, "width": 598, "height": 328},
},
{
"panel_code": "returnqty",
"crop": {"left": 50, "top": 2860, "width": 1300, "height": 500},
"crop": {"left": 620, "top": 1930, "width": 620, "height": 330},
"dest": {"left": 626, "top": 357, "width": 598, "height": 328},
},
],
......@@ -309,7 +327,16 @@ def build_configure_view_js(spec: dict[str, Any]) -> str:
if (activeSheet && typeof activeSheet.getWorksheets === 'function') {{
worksheets = activeSheet.getWorksheets();
}}
const targets = worksheets.length ? worksheets : [activeSheet];
// 同时覆盖 dashboard 本体与内部 worksheets,避免部分字段只在其一上生效。
const targets = [];
if (activeSheet) {{
targets.push(activeSheet);
}}
for (const worksheet of worksheets) {{
if (!targets.includes(worksheet)) {{
targets.push(worksheet);
}}
}}
const updateType = window.tableau.FilterUpdateType.REPLACE;
const filterApply = [];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment