| | |
| | | <div class="toolbar"> |
| | | <template v-if="!isRollup"> |
| | | <span class="toolbar-label">报表期</span> |
| | | <el-date-picker v-model="period" type="month" placeholder="报表期(全部)" value-format="yyyy-MM" clearable style="width:150px" @change="doQuery"></el-date-picker> |
| | | <el-date-picker v-model="period" type="month" placeholder="报表期(全部)" value-format="yyyy-MM" clearable |
| | | style="width:150px" :picker-options="periodPickerOptions" @change="doQuery"></el-date-picker> |
| | | <span v-if="periodHint" class="toolbar-hint">{{ periodHint }}</span> |
| | | </template> |
| | | <span class="toolbar-sep"></span> |
| | | <span class="toolbar-label">数据类型</span> |
| | |
| | | <script> |
| | | import AppHeader from '@/components/AppHeader.vue' |
| | | import api from '@/api' |
| | | import { granularityOfImportType, disabledDateFor, granularityHint, snapPeriod } from '@/utils/periodGranularity' |
| | | export default { |
| | | components: { AppHeader }, |
| | | name: 'DataView', |
| | |
| | | } |
| | | }, |
| | | computed: { |
| | | periodGranularity() { return granularityOfImportType(this.type) }, |
| | | periodPickerOptions() { |
| | | const d = disabledDateFor(this.periodGranularity) |
| | | return d ? { disabledDate: d } : {} |
| | | }, |
| | | periodHint() { return granularityHint(this.periodGranularity) }, |
| | | canRollup() { |
| | | return (this.rollupTypes || []).some(t => t.type === this.type) |
| | | }, |
| | |
| | | return cols.map((c, i) => Object.assign({}, c, { fixed: i < count })) |
| | | } |
| | | }, |
| | | watch: { |
| | | // 选到能耗(季报)时把报表期对齐到季度末月 |
| | | periodGranularity() { |
| | | const snapped = snapPeriod(this.period, this.periodGranularity) |
| | | if (snapped && snapped !== this.period) { |
| | | this.period = snapped |
| | | const hint = granularityHint(this.periodGranularity) |
| | | if (hint) this.$message.warning(hint + '(已自动调整为 ' + snapped + ')') |
| | | } |
| | | } |
| | | }, |
| | | methods: { |
| | | // 数据查看统一列过滤:内部标识列不展示;报表期(由筛选条件体现)与所属地区(区划代码,已被市州列替代)不展示 |
| | | keepColumn(c) { |