dsh-data-dashboard 0.1.5 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,6 +2,7 @@
2
2
  export function createV10Presentation(model) {
3
3
  const cache = new WeakMap();
4
4
  const finite = value => typeof value === 'number' && Number.isFinite(value);
5
+ const available = item => item?.state === 'available' && finite(item.value);
5
6
  const text = value => typeof value === 'string' && value.trim().length > 0;
6
7
  const validDate = value => typeof value === 'string' && /^\d{4}-\d{2}-\d{2}$/.test(value)
7
8
  && Number.isFinite(Date.parse(`${value}T00:00:00Z`)) && new Date(`${value}T00:00:00Z`).toISOString().slice(0, 10) === value;
@@ -114,8 +115,7 @@ export function createV10Presentation(model) {
114
115
  const name = kind === 'quarter' ? `季度累计(${t.label})` : `${t.label}累计`;
115
116
  const actual = copy(t.actual, { label: name, note: `${t.detail};${t.actual.range ? `${t.actual.range.start} 至 ${t.actual.range.end}` : ''}` });
116
117
  if (!m.targets?.available) return [actual];
117
- const progress = t.progress ? `;时间进度 ${model.format(t.progress.value, 1, 1)}%(${t.progress.days}/${t.progress.totalDays} 天)` : '';
118
- return [actual, targetKpi({ ...t.attainment, note: `${t.attainment.note || t.attainment.reason || ''}${progress}` }, `${kind === 'quarter' ? '季度' : '财年'}目标达成率`)];
118
+ return [actual, targetKpi({ ...t.attainment, note: t.attainment.note || t.attainment.reason || '' }, `${kind === 'quarter' ? '季度' : '财年'}目标达成率`)];
119
119
  });
120
120
  const dayKpi = change => {
121
121
  if (!change) return pending('较昨日开瓶', '%', '当前数据未提供日度比较');
@@ -128,13 +128,23 @@ export function createV10Presentation(model) {
128
128
  const notes = [...(m.pending || []), '金额保留为来源元值;界面换算显示不改变计算。缺少记录不补业务零值。'];
129
129
  const trend = { monthly: [], daily: [], cumulative: [], note: '' };
130
130
  if (kind !== 'banquet' && kind !== 'terminal') {
131
- const field = kind === 'opening' ? 'bottles' : kind === 'inventory' ? 'records' : 'amount', unit = kind === 'opening' ? '瓶' : kind === 'inventory' ? '条' : '元';
132
- trend.monthly = (m.monthly || []).map(item => {
131
+ // 开瓶节奏以开瓶金额为主(2026-11-27),瓶数作为每柱的副信息。
132
+ const field = kind === 'inventory' ? 'records' : 'amount', unit = kind === 'inventory' ? '条' : '元';
133
+ // 月度节奏只画本板块来源覆盖的月份,最多 13 个月(到来源最新月,含去年同月),所选月一定在窗口内。
134
+ // 全局月份轴会被其他来源(如库存历史提交)拉长,直接使用会出现整排“—”、所选月被挤出画面。
135
+ const ownCover = model.payload.coverage?.[kind], selectedMonth = p.mode === 'range' ? p.month : f.month;
136
+ const shiftMonth = (month, offset) => new Date(Date.UTC(Number(month.slice(0, 4)), Number(month.slice(5)) - 1 + offset, 1)).toISOString().slice(0, 7);
137
+ const coverStart = ownCover?.start?.slice(0, 7), coverEnd = ownCover?.end?.slice(0, 7);
138
+ let windowEnd = coverEnd && /^\d{4}-\d{2}$/.test(coverEnd) ? coverEnd : null, windowStart = windowEnd ? shiftMonth(windowEnd, -12) : null;
139
+ if (windowStart && /^\d{4}-\d{2}$/.test(selectedMonth || '') && selectedMonth < windowStart) { windowStart = selectedMonth; windowEnd = shiftMonth(selectedMonth, 12); }
140
+ const inWindow = item => kind === 'inventory' || ((!coverStart || item.month >= coverStart) && (!coverEnd || item.month <= coverEnd)
141
+ && (!windowStart || (item.month >= windowStart && item.month <= windowEnd)));
142
+ trend.monthly = (m.monthly || []).filter(inWindow).map(item => {
133
143
  const selected = (inventoryVisit ? rows : scoped).filter(row => row.month === item.month);
134
- const metric = kind === 'inventory' ? measure(selected, field, item.month, unit) : copy(item);
135
- const negative = metric.state === 'available' && field === 'amount' ? sum(selected.filter(row => row.amount < 0), 'amount') : null;
144
+ const metric = kind === 'inventory' || kind === 'opening' ? measure(selected, field, kind === 'opening' ? '开瓶金额' : item.month, unit) : copy(item);
145
+ const negative = metric.state === 'available' && field === 'amount' && kind !== 'opening' ? sum(selected.filter(row => row.amount < 0), 'amount') : null;
136
146
  return { ...metric, key: item.month, month: item.month, label: item.month, negative, comparison: null,
137
- ...(kind === 'opening' ? { cashAmount: measure(selected, 'amount', '现金红包金额', '元', `${item.month};与本柱开瓶瓶数使用相同组织和月份范围。`) } : {}) };
147
+ ...(kind === 'opening' ? { bottles: measure(selected, 'bottles', '开瓶瓶数', '瓶', `${item.month};与本柱开瓶金额使用相同组织和月份范围。`) } : {}) };
138
148
  });
139
149
  const dates = [], coverage = model.payload.coverage[kind];
140
150
  if (/^\d{4}-\d{2}$/.test(f.month) && validDate(coverage?.start) && validDate(coverage?.end)) {
@@ -144,7 +154,7 @@ export function createV10Presentation(model) {
144
154
  }
145
155
  trend.daily = dates.map(date => {
146
156
  const selected = rows.filter(row => row.date === date), metric = measure(selected, field, date, unit);
147
- return { ...metric, key: date, date, label: date, negative: metric.state === 'available' && field === 'amount' ? sum(selected.filter(row => row.amount < 0), 'amount') : null, comparison: null };
157
+ return { ...metric, key: date, date, label: date, negative: metric.state === 'available' && field === 'amount' && kind !== 'opening' ? sum(selected.filter(row => row.amount < 0), 'amount') : null, comparison: null };
148
158
  });
149
159
  let accumulated = 0, negativeTotal = 0, known = true;
150
160
  trend.cumulative = trend.daily.map(item => {
@@ -160,13 +170,14 @@ export function createV10Presentation(model) {
160
170
  }
161
171
  trend.note = inventoryVisit ? '仅统计截至所选月最近一次盘点的提交日期分布;同一经销商产品只计最新候选,不表示各月库存趋势或全部历史提交次数。' : kind === 'inventory' ? '仅统计当前上传导出记录的提交日期分布;不重建各月历史库存或自动重新去重。' : '月度按已上传来源月份展示;日轴为所选月与来源覆盖期间的交集,缺日断开、不补零,累计遇到缺日或缺值保持未知,不推断季末集中或环比。';
162
172
  if (inventoryVisit) trend.inventoryMode = 'visit-history';
163
- } else trend.note = kind === 'banquet' ? '来源固定期间汇总,没有逐日日期,不构造月度或日度趋势。' : '签约结构遵循独立矩阵合同。';
173
+ } else trend.note = kind === 'banquet' ? '宴席来源只到执行月份,没有逐日日期,不构造日度趋势。' : '签约结构遵循独立矩阵合同。';
164
174
  if (kind === 'invoice') {
165
175
  ranking.title = '经销商 · 当月发票净额';
166
176
  ranking.items = group(rows, row => row.dealerCode, row => `${row.dealerCode} · ${row.dealerName || '未提供名称'}`, 'amount', '元', '发票净额', row => text(row.dealerCode));
167
177
  ranking.concentration = concentration(ranking.items, '当前范围发票净额合计');
178
+ // 2026-11-27 用户要求:发票详情不再展示经销商数与经销商排行。
168
179
  kpis = [copy(m.main), existing('正金额合计', '元'), existing('负金额合计', '元'), existing('当年截至所选月来源金额', '元'),
169
- distinct(rows, 'dealerCode', '来源经销商数'), targetKpi(m.targets?.attainment, '目标达成率')];
180
+ targetKpi(m.targets?.attainment, '目标达成率')];
170
181
  kpis.push(...cumulativeKpis());
171
182
  if (m.targets?.available) kpis.push(targetKpi(m.targets.ytdAttainment, '年累计目标达成率'), targetKpi(m.targets.month, p.mode === 'range' ? '区间目标' : '当月目标'), targetKpi(m.targets.ytd, '年累计目标'));
172
183
  }
@@ -208,17 +219,15 @@ export function createV10Presentation(model) {
208
219
  trend.note += '发票对照仅在来源关系已确认且组织、产品、实际期间一致时显示;空白对照不补零。';
209
220
  }
210
221
  if (kind === 'opening') {
211
- cities = group(rows, row => row.city, row => row.city, 'bottles', '瓶', '城市开瓶瓶数', row => text(row.city));
212
- ranking = { title: '开瓶城市 · 消费地', items: cities, concentration: concentration(cities, '当前范围开瓶瓶数合计') };
222
+ cities = group(rows, row => row.city, row => row.city, 'amount', '元', '城市开瓶金额', row => text(row.city));
223
+ ranking = { title: '开瓶城市 · 消费地', items: cities, concentration: concentration(cities, '当前范围开瓶金额合计') };
213
224
  const yearRows = scoped.filter(row => validDate(row.date) && row.date.slice(0, 4) === f.month.slice(0, 4) && (p.mode === 'range' ? row.date <= p.end : row.date.slice(0, 7) <= f.month));
214
- kpis = [copy(m.main), existing('现金红包金额', '元'), distinct(rows, 'city', '来源开瓶城市', '个'),
215
- measure(yearRows, 'bottles', '当年截至所选月来源开瓶', '瓶', '只累计当前上传中已有的当年记录,不推断未提供月份。'),
216
- cross('openingMovementRatio', '年累计开瓶 / 动销(瓶)', '%'), dayKpi(m.dayChange)];
225
+ // 2026-11-27:开瓶金额为主(万元显示),去掉“较昨日”。
226
+ kpis = [copy(existing('开瓶金额', '元'), { label: p.mode === 'range' ? '区间开瓶金额' : '当月开瓶金额' }), copy(m.main), existing('瓶均开瓶金额', '元/瓶'),
227
+ measure(yearRows, 'amount', '当年截至所选月开瓶金额', '元', '只累计当前上传中已有的当年记录,不推断未提供月份。'),
228
+ distinct(rows, 'city', '来源开瓶城市', '个'), cross('openingMovementRatio', '年累计开瓶 / 动销(瓶)', '%')];
217
229
  if (m.targets?.available) kpis.push(targetKpi(m.targets.attainment, '目标达成率'), targetKpi(m.targets.ytdAttainment, '年累计目标达成率'), targetKpi(m.targets.month, p.mode === 'range' ? '区间目标' : '当月目标'));
218
- dayChanges = (m.dayChange?.groups || []).map(item => ({ ...dayKpi(item), key: item.key, name: model.label(item.key) }));
219
- notes.push('较昨日开瓶:所选期间末日与其前一天的开瓶瓶数比较;任一天无来源记录时不计算,不补零。宴席开瓶与消费者开瓶的包含关系不保证,不计算宴席开瓶占比。');
220
- const yearAmount = measure(yearRows, 'amount', '当年来源现金红包金额', '元');
221
- notes.push(`${yearAmount.label}:${model.formatMetric(yearAmount)}${yearAmount.state === 'available' ? ' 元' : ''}。`, '城市只按来源城市字段分组,不推定城市编码或消费者身份。');
230
+ notes.push('宴席开瓶与消费者开瓶的包含关系不保证,不计算宴席开瓶占比。', '城市只按来源城市字段分组,不推定城市编码或消费者身份。');
222
231
  }
223
232
  if (kind === 'inventory') {
224
233
  ranking.title = inventoryVisit ? '经销商 · 最近盘点瓶数' : '经销商 · 当前导出盘点金额';
@@ -281,9 +290,9 @@ export function createV10Presentation(model) {
281
290
  if (!inventoryVisit) notes.push('盘点经销商按来源编码识别,记录条数不等于去重 SKU 数;当前导出不重复选择所谓“最新快照”。');
282
291
  }
283
292
  if (kind === 'banquet') {
284
- ranking.title = '执行单元 · 来源固定期间';
293
+ ranking.title = '执行单元 · 所选月份';
285
294
  ranking.items = group(rows, row => row.unit || orgKey(row, 'unit'), row => model.label(row.unit || orgKey(row, 'unit')), 'events', '场', '执行场次', fullIdentity);
286
- ranking.concentration = concentration(ranking.items, '当前组织范围、来源固定期间执行场次合计');
295
+ ranking.concentration = concentration(ranking.items, '当前组织范围、所选月份执行场次合计');
287
296
  const byUnit = new Map();
288
297
  for (const row of rows) { const key = row.unit || orgKey(row, 'unit'); if (!byUnit.has(key)) byUnit.set(key, []); byUnit.get(key).push(row); }
289
298
  efficiency = ranking.items.map(item => {
@@ -291,18 +300,18 @@ export function createV10Presentation(model) {
291
300
  const ready = item.state === 'available' && events.state === 'available' && bottles.state === 'available' && events.value > 0 && finite(bottles.value / events.value);
292
301
  return { key: item.key, name: item.name, records: item.records, events: events.value, bottles: bottles.value,
293
302
  ...(ready ? { label: '场均开瓶', unit: '瓶/场', value: bottles.value / events.value, state: 'available', reason: null } : pending('场均开瓶', '瓶/场', item.reason || '来源场次、瓶数不完整或场次不大于零')),
294
- note: '同一完整单元路径、同一来源固定期间:开瓶瓶数 / 执行场次;不设未经确认的最低场次门槛。' };
303
+ note: '同一完整单元路径、同一期间:开瓶瓶数 / 执行场次;不设未经确认的最低场次门槛。' };
295
304
  });
296
305
  sortValues(efficiency);
297
306
  const active = guard('events', '有执行的单元', '个') || (ranking.items.some(item => item.state !== 'available') ? pending('有执行的单元', '个', '完整单元路径或来源场次不足')
298
307
  : { label: '有执行的单元', unit: '个', value: ranking.items.filter(item => item.value > 0).length, state: 'available', reason: null, note: '完整单元路径汇总场次大于 0。' });
299
- kpis = [copy(m.main), existing('固定期间宴席开瓶', '瓶'), existing('场均开瓶', '瓶/场'), existing('售点推荐奖励', '元'), active,
308
+ kpis = [copy(m.main), existing('宴席开瓶', '瓶'), existing('场均开瓶', '瓶/场'), active,
300
309
  copy(ranking.concentration.find(item => item.n === 5), { label: 'Top 5 单元场次占比' })];
301
- notes.push('场均与执行排行仅按现有完整单元路径和固定期间汇总;奖励不求和,不计算宴席占消费者开瓶比例。');
310
+ notes.push('按执行月份统计;自定义区间按覆盖到的整月计入。不计算宴席占消费者开瓶比例。');
302
311
  }
303
- const primaryNotes = p.mode === 'range' ? { invoice: `按业务日期净计 ${p.label} 源金额。`, movement: `按扫码日期净计 ${p.label} 源金额。`, opening: `按抽奖日期统计 ${p.label} 来源开瓶瓶数。`,
304
- inventory: inventoryVisit ? `截至 ${p.end},每个经销商与完整产品名称的最近一次已知盘点;不是当天实时库存。` : `当前上传导出中截至 ${p.end} 的盘点记录。`, banquet: '按来源确认的固定期间汇总。', terminal: `按签约日期截至 ${p.end};遵循最新矩阵规则。` } : { invoice: '按业务日期净计当月源金额。', movement: '按扫码日期净计当月源金额。', opening: '按抽奖日期统计当月来源开瓶瓶数。',
305
- inventory: inventoryVisit ? '截至所选月,每个经销商与完整产品名称的最近一次已知盘点;不是当天实时库存。' : '当前上传导出中截至所选月的盘点记录。', banquet: '按来源确认的固定期间汇总。', terminal: '按签约日期截至所选月末;遵循最新矩阵规则。' };
312
+ const primaryNotes = p.mode === 'range' ? { invoice: `按业务日期净计 ${p.label} 源金额。`, movement: `按扫码日期净计 ${p.label} 源金额。`, opening: `按抽奖日期统计 ${p.label} 开瓶金额。`,
313
+ inventory: inventoryVisit ? `截至 ${p.end},每个经销商与完整产品名称的最近一次已知盘点;不是当天实时库存。` : `当前上传导出中截至 ${p.end} 的盘点记录。`, banquet: `按执行月份汇总 ${p.start.slice(0, 7)} 至 ${p.end.slice(0, 7)} 整月。`, terminal: `按签约日期截至 ${p.end};遵循最新矩阵规则。` } : { invoice: '按业务日期净计当月源金额。', movement: '按扫码日期净计当月源金额。', opening: '按抽奖日期统计当月开瓶金额。',
314
+ inventory: inventoryVisit ? '截至所选月,每个经销商与完整产品名称的最近一次已知盘点;不是当天实时库存。' : '当前上传导出中截至所选月的盘点记录。', banquet: '按执行月份汇总所选月。', terminal: '按签约日期截至所选月末;遵循最新矩阵规则。' };
306
315
  for (let index = 0; index < kpis.length; index++) {
307
316
  const item = kpis[index];
308
317
  if (index === 0) item.note = primaryNotes[kind] || item.note;
@@ -313,7 +322,7 @@ export function createV10Presentation(model) {
313
322
  if (item.key === 'inventorySellableMonths') item.note = '库存金额 ÷ 近三月月均扫码金额;未折算全月。';
314
323
  if (item.key === 'openingMovementRatio') item.note = '同组织、同期间的开瓶瓶数 ÷ 动销瓶数。';
315
324
  if (item.key === 'invoiceMovementYtdRatio') item.note = '同组织、同产品、同期间的累计扫码净额 ÷ 发票净额。';
316
- if (item.label === '场均开瓶') item.note = '固定期间宴席开瓶瓶数 ÷ 执行场次。';
325
+ if (item.label === '场均开瓶') item.note = '宴席开瓶瓶数 ÷ 执行场次。';
317
326
  if (item.label === 'Top 5 单元场次占比') item.note = '按完整单元路径汇总执行场次占比。';
318
327
  }
319
328
  if (p.mode === 'range') for (const item of kpis) if (item.label?.startsWith('当年截至所选月')) {
@@ -334,7 +343,7 @@ export function createV10Presentation(model) {
334
343
  if (events.state !== 'available' || bottles.state !== 'available') {
335
344
  displayed.average = pending(label, unit, events.reason || bottles.reason || '来源场次或瓶数规则未确认');
336
345
  } else if (!validDate(coverage?.start) || !validDate(coverage?.end) || coverage.start > coverage.end || coverage.status === 'pending') {
337
- displayed.average = pending(label, unit, '来源固定期间未确认,不计算派生场均');
346
+ displayed.average = pending(label, unit, '来源执行月份缺失,不计算派生场均');
338
347
  } else if (events.value <= 0 || !finite(bottles.value / events.value)) {
339
348
  displayed.average = pending(label, unit, '来源场次不大于零或比值不可表示');
340
349
  } else {
@@ -344,7 +353,12 @@ export function createV10Presentation(model) {
344
353
  }
345
354
  return displayed;
346
355
  });
347
- const result = { kpis, dayChanges, trend, organizations, brands, products, ranking, channels, cities, health, deviations, efficiency, ...(inventoryVisit ? { invalidMetrics, inventoryMode: 'visit-history', inventoryReviewSummary } : {}),
356
+ // 发票来源构成(公司发票 + 两个平台)与分销商动销参考(不计入动销合计)。
357
+ const total = kind === 'invoice' && available(m.main) ? m.main.value : null;
358
+ const platformSources = kind === 'invoice' ? (m.platformSources || []).map(item => ({ ...item, name: item.label, share: finite(total) && total !== 0 && available(item) ? item.value / total : null,
359
+ shareText: finite(total) && total !== 0 && available(item) ? `占发票 ${model.format(item.value / total * 100, 1, 1)}%` : '', note: item.key === 'company' ? '公司发票系统(销售收入明细)' : `${item.label}订单,已并入发票合计` })) : [];
360
+ const distributor = kind === 'movement' && data.distributor ? data.distributor : null;
361
+ const result = { kpis, dayChanges: [], trend, organizations, brands, products, ranking, channels, cities, health, deviations, efficiency, platformSources, distributor, ...(inventoryVisit ? { invalidMetrics, inventoryMode: 'visit-history', inventoryReviewSummary } : {}),
348
362
  rows: sourceRows, notes: [...new Set(notes)] };
349
363
  if (!byKind) { byKind = new Map(); cache.set(supplied, byKind); }
350
364
  byKind.set(cacheKey, result);
@@ -12,7 +12,7 @@ import { createV10Overview } from './v10-overview.mjs';
12
12
  export { createV10Model } from './v10-model.mjs';
13
13
  export const V10_TEMPLATE_SHA256 = 'b58e609411d0b9ab2d77d7079ea580e8210d11946999a8c11cea1fc34bf9b886';
14
14
  export const V10_SCRIPT_SHA256 = 'd11a689940d80a4010c5f45786ac2da7d3106cb8309216b4df2d55c8dac4599c';
15
- export const V10_RENDERER_VERSION = 20;
15
+ export const V10_RENDERER_VERSION = 22;
16
16
  export const V10_SHELL_SHA256 = 'd5118e6e2ec447cc22992c348e18ae719bfbda959a2b694352843c120522a5f1';
17
17
  const APPLICATION_MARKER = '/*__V10_APPLICATION__*/';
18
18
  const IDS = ['invoice', 'movement', 'opening', 'terminal', 'inventory', 'banquet'];
@@ -21,8 +21,9 @@ const NUMERIC = {
21
21
  invoice: ['amount'], movement: ['amount', 'bottles', 'boxes', 'cases'], opening: ['bottles', 'amount'],
22
22
  terminal: [], inventory: ['counted', 'system', 'countAmount', 'systemAmount', 'absoluteVariance', 'signedVariance', 'sourceVariance'], banquet: ['events', 'bottles'],
23
23
  };
24
- const TEXT = { invoice: ['brand', 'category', 'dealerCode', 'dealerName', 'productCode', 'productName'], movement: ['brand', 'category', 'quantityUnit', 'terminalCode', 'terminalName', 'channel', 'movementType', 'productCode', 'productName', 'variety', 'dealerCode', 'dealerName'], opening: ['city'], terminal: ['terminalCode', 'terminalName', 'star', 'agreementId', 'type', 'series', 'signLevel', 'signVariety'], inventory: ['brand', 'category', 'safety', 'dealerCode', 'dealerName', 'productCode', 'productName'], banquet: [] };
25
- const OPTIONAL_DISPLAY_TEXT = new Set(['productCode', 'productName', 'variety', 'terminalName', 'channel', 'movementType', 'agreementId', 'type', 'series', 'signLevel', 'signVariety']);
24
+ const TEXT = { invoice: ['brand', 'category', 'dealerCode', 'dealerName', 'productCode', 'productName', 'platform'], movement: ['brand', 'category', 'quantityUnit', 'terminalCode', 'terminalName', 'channel', 'movementType', 'productCode', 'productName', 'variety', 'dealerCode', 'dealerName'], opening: ['city'], terminal: ['terminalCode', 'terminalName', 'star', 'agreementId', 'type', 'series', 'signLevel', 'signVariety'], inventory: ['brand', 'category', 'safety', 'dealerCode', 'dealerName', 'productCode', 'productName'], banquet: [] };
25
+ const OPTIONAL_DISPLAY_TEXT = new Set(['productCode', 'productName', 'variety', 'terminalName', 'channel', 'movementType', 'agreementId', 'type', 'series', 'signLevel', 'signVariety', 'platform']);
26
+ const PLATFORMS = ['zang10', 'tunzhihu'];
26
27
  const hash = text => createHash('sha256').update(text).digest('hex');
27
28
  const isObject = value => value && typeof value === 'object' && !Array.isArray(value);
28
29
  const fail = message => { throw new Error(`v10 看板校验失败:${message}`); };
@@ -98,7 +99,7 @@ export function sanitizeV10Payload(input) {
98
99
  return [key, value];
99
100
  }));
100
101
  if (row.date !== null && !validDate(row.date)) fail(`${where}.date 无效`);
101
- if (id === 'banquet' && row.date !== null) fail('宴席必须保持来源固定期间');
102
+ if (id === 'invoice' && row.platform && !PLATFORMS.includes(row.platform)) fail(`${where}.platform 无效`);
102
103
  const clean = { org, orgPath, date: row.date };
103
104
  for (const key of NUMERIC[id]) {
104
105
  if (!(key in row)) fail(`${where}.${key} 缺失,不能静默补零`);
@@ -177,6 +178,34 @@ export function sanitizeV10Payload(input) {
177
178
  return { month: row.month, metric: row.metric, value: row.value, region: string(row.org.region ?? '', `${where}.region`), office: string(row.org.office ?? '', `${where}.office`), unit: string(row.org.unit ?? '', `${where}.unit`) };
178
179
  }) : [] };
179
180
  }
181
+ // 平台来源只保留文件名与期间(订单本身已并入发票记录)。
182
+ if (isObject(input.platforms)) {
183
+ result.platforms = {};
184
+ for (const id of PLATFORMS) {
185
+ const item = input.platforms[id];
186
+ if (!isObject(item)) continue;
187
+ const cover = isObject(item.coverage) ? item.coverage : {};
188
+ for (const key of ['start', 'end']) if (cover[key] != null && !validDate(cover[key])) fail(`${id} 期间 ${key} 无效`);
189
+ result.platforms[id] = { rows: Number.isSafeInteger(item.rows) ? item.rows : 0, coverage: { start: cover.start ?? null, end: cover.end ?? null },
190
+ originalName: item.source?.originalName ? string(item.source.originalName, `${id}.originalName`).replaceAll('\\', '/').split('/').at(-1) : null };
191
+ }
192
+ }
193
+ // 分销商动销:只作动销参考,不进入六个板块的记录。
194
+ const distributor = input.modules.distributor;
195
+ if (isObject(distributor) && distributor.state !== 'unavailable' && Array.isArray(distributor.records) && distributor.records.length) {
196
+ const cover = input.coverage.distributor || {};
197
+ result.distributor = { state: distributor.state, coverage: { start: validDate(cover.start) ? cover.start : null, end: validDate(cover.end) ? cover.end : null },
198
+ records: distributor.records.map((row, index) => {
199
+ const where = `distributor[${index}]`;
200
+ if (!Array.isArray(row.orgPath) || row.orgPath.length !== 6) fail(`${where} 缺少完整六级组织路径`);
201
+ if (row.date !== null && !validDate(row.date)) fail(`${where}.date 无效`);
202
+ for (const key of ['amount', 'quantity']) if (row[key] !== null && (typeof row[key] !== 'number' || !Number.isFinite(row[key]))) fail(`${where}.${key} 必须为有限数或 null`);
203
+ const orgPath = row.orgPath.map((value, i) => string(value, `${where}.orgPath[${i}]`));
204
+ return { org: Object.fromEntries(ORG.map((key, i) => [key, orgPath[i]])), orgPath, date: row.date, amount: row.amount, quantity: row.quantity,
205
+ distributorName: string(row.distributorName ?? '', `${where}.distributorName`), productName: string(row.productName ?? '', `${where}.productName`),
206
+ brand: string(row.brand ?? null, `${where}.brand`, true), category: string(row.category ?? null, `${where}.category`, true) };
207
+ }) };
208
+ }
180
209
  if (!IDS.some(id => result.modules[id].state !== 'unavailable' && result.modules[id].records.length) && !IDS.some(id => result.modules[id].reviewPending)) fail('零有效来源不能生成真实数据看板');
181
210
  return result;
182
211
  }
@@ -216,7 +245,13 @@ export function packV10Payload(payload) {
216
245
  }
217
246
  return [id, { ...module, records }];
218
247
  }));
219
- return { ...payload, organizationPaths: paths, modules };
248
+ const packed = { ...payload, organizationPaths: paths, modules };
249
+ if (payload.distributor) packed.distributor = { ...payload.distributor, records: payload.distributor.records.map(({ org, orgPath, ...row }) => {
250
+ const key = JSON.stringify(orgPath);
251
+ if (!keys.has(key)) { keys.set(key, paths.length); paths.push(orgPath); }
252
+ return { ...row, orgIndex: keys.get(key) };
253
+ }) };
254
+ return packed;
220
255
  }
221
256
  // Shared objects are restored in memory, so the offline file does not repeat a
222
257
  // full six-level organization hundreds of thousands of times. Keep this function
@@ -238,6 +273,7 @@ export function unpackV10Payload(payload) {
238
273
  return [id, { ...module, records: records.map(({ orgIndex, ...row }) => ({ ...row, org: orgs[orgIndex], orgPath: payload.organizationPaths[orgIndex] })) }];
239
274
  }));
240
275
  const { organizationPaths, ...rest } = payload;
276
+ if (payload.distributor) rest.distributor = { ...payload.distributor, records: payload.distributor.records.map(({ orgIndex, ...row }) => ({ ...row, org: orgs[orgIndex], orgPath: payload.organizationPaths[orgIndex] })) };
241
277
  return { ...rest, modules };
242
278
  }
243
279
  function once(source, search, replacement) {
@@ -102,14 +102,25 @@ function organization(moduleId, row, sourceFormat) {
102
102
  invoice: ['销售大区', '办事处', '客户主任单元'], movement: ['大区名称', '办事处名称', '主任单元名称'],
103
103
  opening: ['产品所属-大区', '产品所属-办事处', '产品所属-主任单元'], terminal: ['大区', '办事处', '主任单元'],
104
104
  inventory: ['大区名称', '办事处名称', '单元名称'], banquet: ['大区', '办事处', '主任单元'], target: ['大区', '办事处', '主任单元'],
105
+ zang10: ['大区', '办事处', '客户主任单元'], tunzhihu: ['大区', '办事处', '主任单元'], distributor: ['大区', '办事处', '客户主任单元'],
105
106
  }[moduleId];
106
- return [text(row.get('营销公司名称')), text(row.get('事业部名称', '事业部')), text(row.get('战区名称')), ...headers.map(header => text(row.get(header)))];
107
+ return [text(row.get('营销公司名称')), text(row.get('事业部名称', '事业部')), text(row.get('战区名称', '战区')), ...headers.map(header => text(row.get(header)))];
107
108
  }
108
109
 
109
110
  function recordDate(moduleId, row, date1904) {
110
- const header = { invoice: '业务日期', movement: '扫码日期', opening: '抽奖日期', terminal: '签约日期', inventory: '提交时间' }[moduleId];
111
+ if (moduleId === 'zang10' || moduleId === 'banquet') return monthDay(moduleId === 'zang10' ? row.get('订单归属年月') : row.get('执行时间(月)'), date1904);
112
+ const header = { invoice: '业务日期', movement: '扫码日期', opening: '抽奖日期', terminal: '签约日期', inventory: '提交时间', tunzhihu: '业务日期', distributor: '动销日期 (日)' }[moduleId];
111
113
  return header ? sourceDate(row.get(header), date1904) : null;
112
114
  }
115
+ /** Month-only source values (202307, 2023-07, 2023/7, 2023年7月, Excel date) → first day of that month. */
116
+ export function monthDay(value, date1904 = false) {
117
+ if (value === null || value === undefined) return null;
118
+ if (value instanceof Date || (typeof value === 'number' && value > 0 && value < 100000)) { const day = sourceDate(value, date1904); return day ? `${day.slice(0, 7)}-01` : null; }
119
+ const raw = text(value), match = raw.match(/^(\d{4})(?:[-/年.]?)(\d{1,2})(?:月)?(?:[-/]\d{1,2})?(?:[ T].*)?$/);
120
+ if (!match) return null;
121
+ const month = Number(match[2]);
122
+ return month >= 1 && month <= 12 ? `${match[1]}-${String(month).padStart(2, '0')}-01` : null;
123
+ }
113
124
 
114
125
  export async function inspectWorkbook({ file, moduleId, sha256, validation }) {
115
126
  if (!moduleById.has(moduleId)) throw new Error('没有这个资料入口。');
@@ -25,7 +25,7 @@ const MAX_BYTES = uploadLimits.fileBytes;
25
25
  const knownModules = new Set(moduleDefinitions.map(m => m.id));
26
26
  // How often each board is expected to be refreshed. Only used for reminders.
27
27
  const CYCLES = ['daily', 'weekly', 'monthly', 'irregular'];
28
- export const DEFAULT_CYCLES = { invoice: 'daily', movement: 'daily', opening: 'daily', terminal: 'weekly', inventory: 'monthly', banquet: 'irregular', target: 'monthly' };
28
+ export const DEFAULT_CYCLES = { invoice: 'daily', movement: 'daily', opening: 'daily', terminal: 'weekly', inventory: 'monthly', banquet: 'monthly', target: 'monthly', zang10: 'monthly', tunzhihu: 'monthly', distributor: 'weekly' };
29
29
  const publicFiles = new Map([['/', ['board.html', 'text/html; charset=utf-8']], ['/board', ['board.html', 'text/html; charset=utf-8']], ['/admin', ['index.html', 'text/html; charset=utf-8']], ['/board.js', ['board.js', 'text/javascript; charset=utf-8']], ['/board.css', ['board.css', 'text/css; charset=utf-8']], ['/admin.js', ['admin.js', 'text/javascript; charset=utf-8']], ['/admin.css', ['admin.css', 'text/css; charset=utf-8']]]);
30
30
  for (const [file, type] of [['review.js', 'text/javascript'], ['review.css', 'text/css'], ['org-mapping.js', 'text/javascript']]) publicFiles.set(`/${file}`, [file, `${type}; charset=utf-8`]);
31
31
 
@@ -1,60 +1,63 @@
1
1
  {
2
2
  "name": "dsh-data-dashboard",
3
- "version": "0.1.5",
4
- "builtAt": "2026-11-27T01:17:00.339Z",
5
- "sourceCommit": "e405e18a01cf4ba970551ba47ad0367fdfc025da",
3
+ "version": "0.1.7",
4
+ "builtAt": "2026-11-30T05:48:43.461Z",
5
+ "sourceCommit": "e4f5b4cffe452a4b3d72971eb0f9e530fe042ab7",
6
6
  "sourceDirty": false,
7
7
  "files": {
8
8
  "README.md": "ae7f24665cd16f9d729d719ef2335c328d14e0c8b791e40c5c39c8a61d8783d6",
9
9
  "assets/theater-board.svg": "896b0573d86494e4c31b11bde56cecd517b509bd3bf940a24742ac565f164afc",
10
- "backend/incremental/flow.mjs": "d4fc15a45380b548cfec74fb46025eaee0373d2faf3b7f4ad2db9d9a4486d100",
10
+ "backend/incremental/flow.mjs": "2aa3abfce940990d17bf5f4bd466afd269aa56cb1999d9ea55fe5706b03c0b75",
11
11
  "backend/incremental/jobs.mjs": "3c706c735f5acd357f9578bc014fc4598024ba631c954d51a0f11ff06b8fd780",
12
12
  "backend/incremental/xlsx-rows.mjs": "4d840c2401bb0e6157d36f3a0df4e7750bee3209ea6ddb40b70fd9d7cd4e2447",
13
13
  "backend/job-worker.mjs": "a9cfa26a77d72926e8485f274a441ae2f919555aee31288776d4e0abc5de9c50",
14
- "backend/modules.mjs": "0aee556332a186fb7a728858d4643a07da8570e4d155c57204996b01692ffe69",
15
- "backend/modules/banquet/index.mjs": "66747cfdf75ceb16fc2d00c56b78e629d7b7aebe935e3c9415f1ce955b691fa9",
14
+ "backend/modules.mjs": "80f0d3f0639ab15a6745d5be275f22d42d364173f4216f49e94d8e2cf1862919",
15
+ "backend/modules/banquet/index.mjs": "44d8f4994256d3d735df132e239288bd82631b09799ea6815d63f4f36966197d",
16
+ "backend/modules/distributor/index.mjs": "4d08a4d165e23b955a57fede552c61a95be426a02a9313324cece3ec32fea9e4",
16
17
  "backend/modules/inventory/index.mjs": "621937531da92a607f9a54b622f599aeff36cbd7c7814140f202c0e9cc2727f7",
17
18
  "backend/modules/inventory/legacy-fields.mjs": "0de131399a9f5399bf7959ae57af8c52e5c8ab53170910bac3e4bdd21f3be057",
18
19
  "backend/modules/invoice/index.mjs": "4d4f0bce05d3a0e385d5a301365d056bd7954427b5038c69393c77724cdd6473",
19
20
  "backend/modules/movement/index.mjs": "9179dd5726cd698a521bfaaa6e1a1452912dc1b34ceb3b7395d8e8d75c802abb",
20
- "backend/modules/opening/index.mjs": "e6f11fc58689848251511ac332cdc3ffc419d7907adcabd3b7440985bcf410fc",
21
+ "backend/modules/opening/index.mjs": "84f6b2a85150aff9ca76633675304c260ba40b8ef6bb1c4c0d196887fa43bc39",
21
22
  "backend/modules/target/index.mjs": "d644e882b3b7476c6b8b8985f23aa714b15b0ac902a880137bbf951ac407ee6d",
22
23
  "backend/modules/terminal/index.mjs": "cd65735c7dd277e7bc137e9d49c5e15f5b5d99da7c91e93480711351a6f016ea",
24
+ "backend/modules/tunzhihu/index.mjs": "ae90f4b6c412a5b7b16da57f9d4f0d2ce94355b3192b6099e0d24a50c3297c54",
25
+ "backend/modules/zang10/index.mjs": "4e777ad06f080bf1294b1286f1cd429f2bdc1fa5821f42031751d1022d65d8e0",
23
26
  "backend/public/admin.css": "085ef21c7dee63aedb4b7b4eefe99b7d913581d23085933edfc270abf9720897",
24
- "backend/public/admin.js": "47cf02725ba2f8570ff79f3e83131667217ac3196ca9bbccc95c9152ef1cbe07",
27
+ "backend/public/admin.js": "e4322fff1b0dae036c6ee0cefd03d101bdfb8579b78746751b16a7434268b8b7",
25
28
  "backend/public/board.css": "c7a03188cfbb9f174f0375d48f511a454b60eb58dc4bf0a7e469633e43f12a91",
26
29
  "backend/public/board.html": "e731c85e60aa1acd8ae3fca73094754b3d6b8254313e359b3d93a85a2b82d264",
27
- "backend/public/board.js": "76b71d3dc156b84f0e6042c6958a6ecb7702dea42cb978b0df84129d1fa04f6d",
30
+ "backend/public/board.js": "a48c3ea374a7f3e2595f4202432968bf4445f240eaf3654071a32218ad0dbadb",
28
31
  "backend/public/index.html": "ee6513a26671f374696cd3b4d6dc6ffcbb9f4935ee6fca36adb1ec56279768ec",
29
32
  "backend/public/org-mapping.js": "66ac67a2efa3405d1cb705e4d61ec20307e54142818bac6993e7585a8d5ead5b",
30
33
  "backend/public/review.css": "6fd7366dccd877335f0897577f8cb56a30a2232fe0e779bef84d75757b78b56f",
31
34
  "backend/public/review.js": "cd6bd9ad50e458bc13d7a6b41c6c2ad800cf297a05279a7908b02518bc4ae53c",
32
- "backend/real-data/generate-dashboard.mjs": "e9d88b345ef35651f22b713c9ec88687df24e794f5ee85870cb76c7ece642766",
35
+ "backend/real-data/generate-dashboard.mjs": "24247052d2e4ff8b1b8dc0f13e6de98c7786ecbc149516a3b0291b7499489dc6",
33
36
  "backend/real-data/inventory-history.mjs": "863345fc46ef2c66e1f5279823f408a7ee2b78a421574176c7221b79d44d5a50",
34
37
  "backend/real-data/organization-mapping.mjs": "4e64d9a1930f774f24a3d8d544a9aad4877bc1f1c5010a69fbde1b022348f1c4",
35
- "backend/real-data/source-payload.mjs": "f2f04697dac7ee7d62f5bb1f3304b552118ff8854c8dae7fb4e0575d4fdb3679",
38
+ "backend/real-data/source-payload.mjs": "87a489c4423d15ddfeda4aaba173c7e1eee6e0b57e666776b7ce4d7b70886b87",
36
39
  "backend/real-data/terminal-components.mjs": "e7c7399e9459964d25cee0c0f7d72834e6480603d6c64b9f41c581319db9c12a",
37
40
  "backend/real-data/terminal-structure.css": "17ca1107abff93b48e5d129a3943b01b2f6ff7113eeede589f51634861069e26",
38
41
  "backend/real-data/terminal-structure.mjs": "a06b4f0eb91e0c2aea6c8f75ff898017787a4269d4e1630866fb31796ead462e",
39
- "backend/real-data/v10-components.mjs": "f83ff9ac02c2ac814069740e6d08a237c5c2f358c6e5b0be1a749684e9183343",
42
+ "backend/real-data/v10-components.mjs": "fdcbb1418c4331d5615512c06167e2ffe7539e4edf3f970e7cb0d86a2ff7f285",
40
43
  "backend/real-data/v10-details.css": "a0c12a87ea7fd2974051f0e7b6c00a6057fe8e60515abd6c53aa52b93e8cf924",
41
- "backend/real-data/v10-details.mjs": "740c3246fbf5fbbd8ae806dc3e042f4a8d5ce9cea31553fe45a1ea77a6514195",
44
+ "backend/real-data/v10-details.mjs": "e21f8742823cd21f628d158527a6eac613b2f1ac14e2672248f143e487068f6b",
42
45
  "backend/real-data/v10-layout.css": "2efc29f10d984a8629ef87aae1c72cbdc09658a3553407732c2359931a66cdbd",
43
- "backend/real-data/v10-model.mjs": "0f3fddedf6284d897a88ba29014ec4879c5433ba59c6b6344218f884507824d4",
44
- "backend/real-data/v10-overview-data.mjs": "54835189ee28f8fb5c27f399d9d74dc1bf7ebf5f4a9f66f2c0a2e13455ca4eeb",
45
- "backend/real-data/v10-overview.css": "296050d284913ffc52ac89672ff212bf96592785a5491e574a8bf4c990363a99",
46
- "backend/real-data/v10-overview.mjs": "9cf6aff3304039dde3bcaa205607e9f64553b0645242436a5be9ba8469f55ecc",
47
- "backend/real-data/v10-presentation.mjs": "2b23265c8cc2e8caf3982b6ceea494b25ebd4c4f078097aa635ddd5970cfeb86",
46
+ "backend/real-data/v10-model.mjs": "30837c7bb4f5d2370d99ac88fa972a42a3cf4f237667e94126d378b4f98f4d75",
47
+ "backend/real-data/v10-overview-data.mjs": "1f4f1bcca8206228757e3510eeba334607976e9762db3d882717e674b958c333",
48
+ "backend/real-data/v10-overview.css": "3416e27dc73ab261d4ccf11e9cfd97e7b64541ab12fe977b7e397dc4adbe60e5",
49
+ "backend/real-data/v10-overview.mjs": "98d0093d5824b9928e9fc876a9ea0bdc3a4caa76dbadf61f74bbdbcaea4a58b1",
50
+ "backend/real-data/v10-presentation.mjs": "b54f0b766c0e6ff38cd2625db2a8443f066b075ceda934d45280a3bf5ceecf5f",
48
51
  "backend/real-data/v10-shell.html": "d5118e6e2ec447cc22992c348e18ae719bfbda959a2b694352843c120522a5f1",
49
- "backend/real-data/v10-template.mjs": "375258305a3d15454b3cf0088fdda5ad0164b023228539257ed81947bf220253",
52
+ "backend/real-data/v10-template.mjs": "0523c50cde4db93952c9353a72720f4eb8c7d9bb503dcaed48c3fa473f386026",
50
53
  "backend/recognition/fingerprint.mjs": "652340bf7b1f1617c03d53e5c5724154ffabc262c0a522e498ba015671420528",
51
54
  "backend/recognition/headers.mjs": "1cadc4fb39b8a1d7decddae666c827b00903b7f14cfd9e7f4974f2042f07fc02",
52
55
  "backend/recognition/module-definition.mjs": "2aaea663fcc2a52c193637135ad762c7c2af35da96aa12d89742ab6606ed7801",
53
56
  "backend/recognition/result.mjs": "4afe8df9046258424091e556de8337bf283837bd07a1c8c14f765bd11eaa98b5",
54
57
  "backend/recognition/upload-limits.mjs": "8fde2d6c62ab7f0bfa1a945d34efc462087b895fd25e92cf5d5c34c97d738ace",
55
- "backend/review-engine.mjs": "9c13e5684b4697f09b5bda808266095ae3acd40474124d4dd021ff067b547e1d",
58
+ "backend/review-engine.mjs": "852373424d48d7d35d75e35c0baaecc9fea7484565a58be96f366db517395309",
56
59
  "backend/review-service.mjs": "c9d4526b952e07c7c9a5d9c5ef9ccaf6bd108527057dd605e24107312d1bb02f",
57
- "backend/server.mjs": "1f1bf71cfbf05331b1602b6d6c1f2f7adf7d6e94cbedd992b3b9cb66688ca896",
60
+ "backend/server.mjs": "21ed2f05a4821a3832ebf2ee69841f19b8117079ff78aa1b08151fce45835e12",
58
61
  "backend/store.mjs": "1e74edc99a577fa9a72a43722a35b6cee7c0c5582b49a5786bbc676412602f0b",
59
62
  "backend/target-template.mjs": "fa33f13b8ee56da7a2bc44c1c474d879817e270bddad03350799143f7fe78b43",
60
63
  "backend/validate-workbook.mjs": "2f86c034e4af578b7971486e81e86912f69a086c877c516223350b52931cc377",
@@ -70,11 +73,11 @@
70
73
  "lib/market-index.mjs": "c016b827c730bdd8717a643ae1e8a1b32d845ac7b9f4f80914571acf34fbe21a",
71
74
  "lib/package-audit.mjs": "fcddbf4e8a6eec68bf1c2cbd01a6569fcd6301b50677f367a08fc0476f44561b",
72
75
  "lib/settings.mjs": "b05040be7d56020b33b1c7e4e8208830360a0935e191960d8e13038fce6f16e0",
73
- "lib/tool-definitions.mjs": "a3fa67c261627e140025d200f624885510f8857bf77c3f219efc53cbc4ea1300",
74
- "lib/tools.mjs": "78cf680319cc2e5868b01c76c55a369ee034e9a5be2dc6a3865462dd1ed2c172",
76
+ "lib/tool-definitions.mjs": "1ca9009007cbaabcaab63b5f098611d92d5fd3729312870eea903d0860be3c18",
77
+ "lib/tools.mjs": "dd920e4b586e726081b2e4e268223f708c2dd202b3f5217fcd7053405f75861b",
75
78
  "locale/en.json": "e7a5b39324d6162e7d29957fbc7a0f4bde9c588de2000c874f058df5520f472c",
76
79
  "locale/zh.json": "dd29dcecb35aa6e95a295af228fd39f833c1f492cc5ca41567bb6945ab134510",
77
- "package-lock.json": "4f21205e3a251a6fe55654efcef180a92a9229f65f574738d5d86edecf5da709",
78
- "package.json": "12c40f4aa60dac9e9e137cc000094f8f8db0859aa3c04137cafcbb8a9f600fd7"
80
+ "package-lock.json": "1d9271123b860f6d833ba6033900c22e59792cd3d8825f2f4b98a90c96adc6bc",
81
+ "package.json": "2f606a3c350456eb37c1a3cf137287dd461568a8ce113b095b6bd981a44ad9f3"
79
82
  }
80
83
  }
@@ -17,7 +17,7 @@ export function toolDefinitions(queries, { HarnessError } = {}) {
17
17
  return [
18
18
  {
19
19
  name: 'theater_board_status',
20
- description: `战区经营看板:查看七类资料(发票、动销、开瓶、签约、库存、宴席、经营目标)的当前文件、上传时间、数据起止日、是否超期待更新,以及最近一次生成的看板时间和打开链接。${shared}`,
20
+ description: `战区经营看板:查看各类资料(发票、藏10与吞之乎平台销售、动销、分销商动销、开瓶、签约、库存、宴席、经营目标)的当前文件、上传时间、数据起止日、是否超期待更新,以及最近一次生成的看板时间和打开链接。${shared}`,
21
21
  parameters: {},
22
22
  output: { schema: json, render },
23
23
  isConcurrencySafe: () => true,
@@ -26,7 +26,7 @@ export function toolDefinitions(queries, { HarnessError } = {}) {
26
26
  },
27
27
  {
28
28
  name: 'theater_board_summary',
29
- description: `战区经营看板:按月份或日期区间、大区/办事处/主任单元,返回发票销售、终端动销、消费者开瓶的主指标、当年累计和经营目标达成率(与看板同一口径)。三个板块分别统计,不要自行计算它们之间的比例。组织名称请先用 theater_board_organizations 确认。${shared}`,
29
+ description: `战区经营看板:按月份或日期区间、大区/办事处/主任单元,返回发票销售(含藏10、吞之乎平台)、终端动销、消费者开瓶的主指标、季度与财年累计和经营目标达成率(与看板同一口径)。三个板块分别统计,不要自行计算它们之间的比例。组织名称请先用 theater_board_organizations 确认。${shared}`,
30
30
  parameters: {
31
31
  month: { type: 'string', description: '月份 YYYY-MM;与 start/end 二选一;都不填为看板默认最近月份' },
32
32
  start: { type: 'string', description: '区间开始 YYYY-MM-DD(需与 end 同时给出)' },
package/lib/tools.mjs CHANGED
@@ -231,7 +231,11 @@ export function createBoardQueries({ dataDir, backendDir, port, problem = () =>
231
231
  modules[id] = {
232
232
  title: m.title, state: m.state, main: shape(m.main, model),
233
233
  ...(id === 'opening' ? {} : { ytd: shape(m.extra.find(item => item.label === '当年截至所选月来源金额'), model) }),
234
- targets: { attainment: shape(t.attainment, model), ytdAttainment: shape(t.ytdAttainment, model), target: shape(t.month, model), ytdTarget: shape(t.ytd, model) },
234
+ targets: { attainment: shape(t.attainment, model), ytdAttainment: shape(t.ytdAttainment, model), target: shape(t.month, model), ytdTarget: shape(t.ytd, model),
235
+ // 2026-11-27:公司按季度考核,季度与财年(7 月起)累计达成与看板首屏同一口径。
236
+ ...Object.fromEntries(['quarter', 'fiscal'].filter(kind => t[kind]).map(kind => [kind, { label: t[kind].label, start: t[kind].start, end: t[kind].periodEnd,
237
+ actual: shape(t[kind].actual, model), target: shape(t[kind].target, model), attainment: shape(t[kind].attainment, model) }])) },
238
+ ...(id === 'invoice' && m.platformSources ? { sources: m.platformSources.map(item => ({ key: item.key, label: item.label, records: item.records, value: shape(item, model) })) } : {}),
235
239
  records: m.recordCount, notes: [...m.pending],
236
240
  };
237
241
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-data-dashboard",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "license": "UNLICENSED",
5
5
  "description": "战区经营看板 DSH 插件:在 DeepSeek Harness 左侧栏打开本机战区看板(看板 / 更新数据 / 历史版本)",
6
6
  "type": "module",