|
|
@@ -173,7 +173,7 @@ function renderRawCases(rawCasesObj) {
|
|
|
rawCasesObj, sourceMap, detailMap, detailMapByUrl, reqId
|
|
|
};
|
|
|
|
|
|
- let statsHtml = '';
|
|
|
+ let totalStatsHtml = '';
|
|
|
const detailedCaseObj = rawCasesObj['case'] || rawCasesObj['case_detailed'];
|
|
|
if (detailedCaseObj) {
|
|
|
const cd = detailedCaseObj;
|
|
|
@@ -200,10 +200,10 @@ function renderRawCases(rawCasesObj) {
|
|
|
const displayWorkflowSuccess = cd.workflow_success !== undefined && cd.workflow_success !== null ? cd.workflow_success : (cd.success !== undefined && cd.success !== null ? cd.success : calcWorkflow);
|
|
|
const displayCapabilitiesSuccess = cd.capabilities_success !== undefined && cd.capabilities_success !== null ? cd.capabilities_success : calcCapabilities;
|
|
|
|
|
|
- statsHtml = `<div style="display:flex; gap:1rem; margin-bottom:1rem; padding:0.5rem 1rem; background:rgba(0, 0, 0, 0.03); border-radius:8px; align-items:center;">
|
|
|
+ totalStatsHtml = `<div style="display:flex; gap:1rem; margin-bottom:1rem; padding:0.5rem 1rem; background:rgba(0, 0, 0, 0.03); border-radius:8px; align-items:center;">
|
|
|
<div style="flex:1; text-align:center; display:flex; flex-direction:column; gap:2px;">
|
|
|
<span style="font-size:1.3rem; color:var(--text-main); font-weight:bold; line-height:1;">${cd.total}</span>
|
|
|
- <span style="color:var(--text-muted); font-size:0.75rem;">帖子总计</span>
|
|
|
+ <span style="color:var(--text-muted); font-size:0.75rem;">未被过滤的帖子总数</span>
|
|
|
</div>
|
|
|
<div style="flex:1; text-align:center; display:flex; flex-direction:column; gap:2px;">
|
|
|
<span style="font-size:1.3rem; color:var(--success); font-weight:bold; line-height:1;">${displayWorkflowSuccess}</span>
|
|
|
@@ -217,12 +217,34 @@ function renderRawCases(rawCasesObj) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ let filteredStatsHtml = '';
|
|
|
+ if (rawCasesObj['filtered_cases']) {
|
|
|
+ const fObj = rawCasesObj['filtered_cases'];
|
|
|
+ let totalFiltered = 0;
|
|
|
+ if (fObj.total !== undefined) totalFiltered = fObj.total;
|
|
|
+ else if (fObj.cases) totalFiltered = fObj.cases.length;
|
|
|
+ else if (fObj.sources) totalFiltered = fObj.sources.length;
|
|
|
+ else if (fObj.by_reason) {
|
|
|
+ Object.values(fObj.by_reason).forEach(r => {
|
|
|
+ if (r.sources) totalFiltered += r.sources.length;
|
|
|
+ else if (r.cases) totalFiltered += r.cases.length;
|
|
|
+ });
|
|
|
+ } else if (Array.isArray(fObj)) totalFiltered = fObj.length;
|
|
|
+
|
|
|
+ filteredStatsHtml = `<div style="display:flex; gap:1rem; margin-bottom:1rem; padding:0.5rem 1rem; background:rgba(0, 0, 0, 0.03); border-radius:8px; align-items:center;">
|
|
|
+ <div style="flex:1; text-align:center; display:flex; flex-direction:column; gap:2px;">
|
|
|
+ <span style="font-size:1.3rem; color:var(--text-main); font-weight:bold; line-height:1;">${totalFiltered}</span>
|
|
|
+ <span style="color:var(--text-muted); font-size:0.75rem;">被过滤的帖子数</span>
|
|
|
+ </div>
|
|
|
+ </div>`;
|
|
|
+ }
|
|
|
+
|
|
|
const allPlatforms = Object.keys(rawCasesObj).filter(p => p !== 'source' && p !== 'case_detailed' && p !== 'case' && p !== 'images');
|
|
|
const channelPlatforms = allPlatforms.filter(p => p !== 'filtered_cases' && p !== 'source_ex');
|
|
|
const hasFiltered = allPlatforms.includes('filtered_cases');
|
|
|
const hasExternal = allPlatforms.includes('source_ex');
|
|
|
|
|
|
- let html = statsHtml;
|
|
|
+ let html = '';
|
|
|
html += `<div class="sub-tabs">`;
|
|
|
html += `<button class="sub-tab-btn active" onclick="selectSubTab('total')">TOTAL</button>`;
|
|
|
if (hasFiltered) html += `<button class="sub-tab-btn" onclick="selectSubTab('filtered_cases')">FILTERED</button>`;
|
|
|
@@ -231,8 +253,13 @@ function renderRawCases(rawCasesObj) {
|
|
|
html += `<input type="file" id="input-upload-source-ex" accept=".json" style="display:none;">`;
|
|
|
html += `</div><div class="sub-tab-contents">`;
|
|
|
|
|
|
- const renderPaneContent = (pList) => {
|
|
|
+ const renderPaneContent = (pList, paneType) => {
|
|
|
let paneHtml = '';
|
|
|
+ if (paneType === 'total' && typeof totalStatsHtml !== 'undefined' && totalStatsHtml) {
|
|
|
+ paneHtml += totalStatsHtml;
|
|
|
+ } else if (paneType === 'filtered_cases' && typeof filteredStatsHtml !== 'undefined' && filteredStatsHtml) {
|
|
|
+ paneHtml += filteredStatsHtml;
|
|
|
+ }
|
|
|
let totalCases = 0;
|
|
|
let seenIds = new Set();
|
|
|
|
|
|
@@ -358,12 +385,12 @@ function renderRawCases(rawCasesObj) {
|
|
|
return paneHtml;
|
|
|
};
|
|
|
|
|
|
- html += `<div id="sub-tab-total" class="sub-tab-pane">${renderPaneContent([...channelPlatforms, 'source'])}</div>`;
|
|
|
- if (hasFiltered) html += `<div id="sub-tab-filtered_cases" class="sub-tab-pane hidden">${renderPaneContent(['filtered_cases'])}</div>`;
|
|
|
+ html += `<div id="sub-tab-total" class="sub-tab-pane">${renderPaneContent([...channelPlatforms, 'source'], 'total')}</div>`;
|
|
|
+ if (hasFiltered) html += `<div id="sub-tab-filtered_cases" class="sub-tab-pane hidden">${renderPaneContent(['filtered_cases'], 'filtered_cases')}</div>`;
|
|
|
if (hasExternal) {
|
|
|
html += `<div id="sub-tab-source_ex" class="sub-tab-pane hidden">`;
|
|
|
html += `<div style="margin-bottom: 1rem; text-align: right;"><button onclick="importAllExternalCases()" class="btn btn-primary btn-small">📥 全部导入 Source</button></div>`;
|
|
|
- html += renderPaneContent(['source_ex']);
|
|
|
+ html += renderPaneContent(['source_ex'], 'source_ex');
|
|
|
html += `</div>`;
|
|
|
}
|
|
|
|