| | |
| | | <span v-if="!it.ready" class="cov-bad" style="margin-left:10px">{{ it.note }}</span> |
| | | <span v-if="it.ready && it.audited === false" class="cov-bad" style="margin-left:10px">未审核</span> |
| | | </div> |
| | | <table class="preview-summary" v-if="it.summary && it.summary.length"> |
| | | <table class="preview-summary wb-table" v-if="it.key === 'summaryWorkbook' && it.summary && it.summary.length"> |
| | | <thead> |
| | | <tr><th style="width:44%">指标</th><th style="width:30%">数据</th><th>同比</th></tr> |
| | | </thead> |
| | | <tbody> |
| | | <template v-for="(sec, si) in wbRows(it.summary)"> |
| | | <tr v-for="(row, ri) in sec.rows" :key="si + '-' + ri"> |
| | | <td v-if="ri === 0" :rowspan="sec.rows.length" class="wb-sec">{{ sec.name }}</td> |
| | | <td class="wb-label">{{ row.label }}</td> |
| | | <td class="wb-value">{{ row.value === null ? '—' : fmtVal(row.value) }}</td> |
| | | <td class="wb-yoy" :class="{ 'yoy-empty': row.yoy === null }">{{ row.yoy === null ? '—' : row.yoy }}</td> |
| | | </tr> |
| | | </template> |
| | | </tbody> |
| | | </table> |
| | | <div v-if="it.key === 'summaryWorkbook' && wbMissing(it.summary)" class="wb-note"> |
| | | 部分指标缺少上年同期({{ wbPrevYear() }})基期数据,同比暂未计算 |
| | | </div> |
| | | <table class="preview-summary" v-else-if="it.summary && it.summary.length"> |
| | | <tbody> |
| | | <tr v-for="(s, i) in it.summary" :key="i"> |
| | | <td>{{ s.label }}</td> |
| | |
| | | } |
| | | return String(v) |
| | | }, |
| | | wbRows(summary) { |
| | | const get = (key) => { |
| | | const hit = (summary || []).find(x => x.label === key) |
| | | return hit && hit.value !== null && hit.value !== undefined && hit.value !== '' ? hit.value : null |
| | | } |
| | | const pct = (key) => { |
| | | const v = get(key) |
| | | return v === null ? null : this.fmtVal(v) + '%' |
| | | } |
| | | const mk = (defs) => defs.map(d => ({ |
| | | label: d[0], |
| | | value: get(d[1]), |
| | | yoy: d[2] ? pct(d[2]) : null |
| | | })) |
| | | return [ |
| | | { |
| | | name: '道路货运', |
| | | rows: mk([ |
| | | ['当月货运量(万吨)', '全省货运量·当月'], |
| | | ['当月货物周转量(万吨)', '全省货物周转量·当月', '全省货物周转量·当月同比'], |
| | | ['累计货运量(万吨)', '全省货运量·累计'], |
| | | ['累计货物周转量(万吨公里)', '全省货物周转量·累计', '全省货物周转量·累计同比'] |
| | | ]) |
| | | }, |
| | | { |
| | | name: '城市客运', |
| | | rows: mk([ |
| | | ['当月城市客运量:', '城市客运量·当月'], |
| | | ['当月城市客运周转量', '城市客运周转量·当月'], |
| | | ['累计城市客运量:', '城市客运量·累计'], |
| | | ['累计城市客运周转量', '城市客运周转量·累计'] |
| | | ]) |
| | | }, |
| | | { |
| | | name: '中口径', |
| | | rows: mk([ |
| | | ['当月中口径客运量', '中口径客运量·当月'], |
| | | ['当月中口径周转量', '中口径周转量·当月'], |
| | | ['累计中口径客运量', '中口径客运量·累计'], |
| | | ['累计中口径周转量', '中口径周转量·累计'] |
| | | ]) |
| | | } |
| | | ] |
| | | }, |
| | | wbMissing(summary) { |
| | | let total = 0 |
| | | let have = 0 |
| | | ;(summary || []).forEach(x => { |
| | | if (String(x.label).indexOf('同比') >= 0) return |
| | | total++ |
| | | if (x.value !== null && x.value !== undefined && x.value !== '') have++ |
| | | }) |
| | | return total > 0 && have < total |
| | | }, |
| | | wbPrevYear() { |
| | | const m = /^(\d{4})-(\d{2})$/.exec(this.previewPeriod || '') |
| | | if (!m) return '上年同期' |
| | | return (Number(m[1]) - 1) + '-' + m[2] |
| | | }, |
| | | coverageText(it) { |
| | | const cov = it.monthCoverage || [] |
| | | if (!cov.length) return '无数据' |
| | |
| | | @media (max-width: 900px) { |
| | | .panel-head { flex-direction: column; align-items: flex-start; } |
| | | } |
| | | .wb-table th { background:#f5f7fa; } |
| | | .wb-sec { background:#F7F9FC; font-weight:600; text-align:center; color:#303133; } |
| | | .wb-label { color:#303133; } |
| | | .wb-value { text-align:right; font-variant-numeric: tabular-nums; } |
| | | .wb-yoy { text-align:right; color:#606266; } |
| | | .wb-yoy.yoy-empty { color:#C0C4CC; } |
| | | .wb-note { color:#E6A23C; font-size:12px; margin:2px 0 8px; } |
| | | </style> |