| | |
| | | </el-aside> |
| | | <el-main> |
| | | <h3>导入数据查看</h3> |
| | | <el-form :inline="true"> |
| | | <el-form-item label="数据类型"> |
| | | <el-radio-group v-model="type" @change="loadData"> |
| | | <el-radio-button label="h2032">H203-2月报</el-radio-button> |
| | | <el-radio-button label="transportAuth">运政车辆</el-radio-button> |
| | | <el-radio-button label="trackMileage">轨迹里程</el-radio-button> |
| | | <el-radio-button label="scaleSplit">规上规下拆分</el-radio-button> |
| | | <el-radio-button label="freightTurnover">货运量周转量</el-radio-button> |
| | | <el-radio-button label="h2031">H203-1旅客月报</el-radio-button> |
| | | <el-radio-button label="passengerAuth">旅客运政车辆</el-radio-button> |
| | | <el-radio-button label="cityBus">城市公交月报</el-radio-button> |
| | | <el-radio-button label="cityTaxi">巡游出租月报</el-radio-button> |
| | | <el-radio-button label="cityTaxiAuth">出租车运政车辆</el-radio-button> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | <el-form-item label="报表期"> |
| | | <el-date-picker v-model="period" type="month" placeholder="全部" value-format="yyyy-MM" clearable style="width:140px" @change="loadData"></el-date-picker> |
| | | </el-form-item> |
| | | <el-form-item label="关键字"> |
| | | <el-input v-model="keyword" placeholder="企业/市州名称" clearable style="width:200px" @keyup.enter.native="loadData"></el-input> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="loadData">查询</el-button> |
| | | <el-button type="success" icon="el-icon-full-screen" @click="toggleFullscreen">全屏查看</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div style="color:#909399;font-size:12px;margin-bottom:6px"> |
| | | 共 {{ total }} 条记录,当前第 {{ page }} 页 |
| | | <div class="toolbar"> |
| | | <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> |
| | | <span class="toolbar-sep"></span> |
| | | <span class="toolbar-label">数据类型</span> |
| | | <el-select v-model="type" size="small" style="width:300px" placeholder="选择数据类型" filterable |
| | | :title="currentTypeLabel" @change="onTypeSelect"> |
| | | <el-option-group v-for="g in modules" :key="g.key" :label="g.name"> |
| | | <el-option v-for="t in g.types" :key="t.value" :label="t.label" :value="t.value"></el-option> |
| | | </el-option-group> |
| | | </el-select> |
| | | <el-input v-model="keyword" placeholder="企业/市州名称" clearable style="width:180px" @keyup.enter.native="doQuery"></el-input> |
| | | <el-button type="primary" size="small" @click="doQuery">查询</el-button> |
| | | <el-button size="small" icon="el-icon-full-screen" @click="toggleFullscreen">全屏查看</el-button> |
| | | </div> |
| | | <div class="load-hint">共 {{ total }} 条记录,已加载 {{ records.length }} 条</div> |
| | | <div class="table-wrap" ref="tableWrap"> |
| | | <div class="table-area"> |
| | | <el-table :data="records" border v-loading="loading" size="small" style="width:100%" height="100%"> |
| | | <el-table-column v-for="c in columns" :key="c.prop" :prop="c.prop" :label="c.label" :min-width="c.width" show-overflow-tooltip> |
| | | <el-table-column v-for="c in renderColumns" :key="c.prop" :prop="c.prop" :label="c.label" :min-width="c.width" :fixed="c.fixed ? 'left' : false" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | <span>{{ formatCell(scope.row[c.prop]) }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | <el-pagination style="margin-top:15px;text-align:right" |
| | | background layout="total, prev, pager, next, sizes" |
| | | :total="total" :current-page.sync="page" :page-size.sync="size" |
| | | :page-sizes="[20, 50, 100]" @current-change="loadData" @size-change="loadData"> |
| | | </el-pagination> |
| | | </div> |
| | | |
| | | </el-main> |
| | | </el-container> |
| | | </el-container> |
| | |
| | | name: 'DataView', |
| | | data() { |
| | | return { |
| | | modules: [ |
| | | { |
| | | key: 'freight', name: '道路货运', types: [ |
| | | { value: 'h2032', label: '道路货物运输月度生产情况' }, |
| | | { value: 'transportAuth', label: '运政车辆' }, |
| | | { value: 'trackMileage', label: '轨迹里程' }, |
| | | { value: 'scaleSplit', label: '规上规下拆分' }, |
| | | { value: 'freightTurnover', label: '货运量周转量' } |
| | | ] |
| | | }, |
| | | { |
| | | key: 'passenger', name: '公路旅客', types: [ |
| | | { value: 'h2031', label: '公路旅客运输月度生产情况' }, |
| | | { value: 'passengerAuth', label: '运政车辆数' }, |
| | | { value: 'passengerIndividual', label: '个体客运量/周转量' } |
| | | ] |
| | | }, |
| | | { |
| | | key: 'city', name: '城市客运', types: [ |
| | | { value: 'cityBus', label: '城市公共交通月度运营情况' }, |
| | | { value: 'cityTaxi', label: '巡游出租汽车运营服务情况月报' }, |
| | | { value: 'cityTaxiAuth', label: '出租车运政车辆' }, |
| | | { value: 'wycTotal', label: '网约车总数' }, |
| | | { value: 'wycOrder', label: '网约车订单及全省总量' } |
| | | ] |
| | | }, |
| | | { |
| | | key: 'invest', name: '投资', types: [ |
| | | { value: 'investmentProject', label: '投资项目基础表' }, |
| | | { value: 'investmentMonthly', label: '市州月报项目进度' }, |
| | | { value: 'investmentSystem', label: '投资系统每月导入项目表' } |
| | | ] |
| | | }, |
| | | { |
| | | key: 'energy', name: '能耗', types: [ |
| | | { value: 'energyVehicle', label: '车辆能耗季度数据' }, |
| | | { value: 'energyAuth', label: '能耗运政车辆数' } |
| | | ] |
| | | } |
| | | ], |
| | | activeModule: 'freight', |
| | | type: 'h2032', |
| | | period: '', |
| | | keyword: '', |
| | | page: 1, |
| | | size: 20, |
| | | size: 50, |
| | | total: 0, |
| | | records: [], |
| | | columns: [], |
| | |
| | | loadingMore: false |
| | | } |
| | | }, |
| | | computed: { |
| | | currentTypeLabel() { |
| | | for (const g of this.modules) { |
| | | const t = g.types.find(x => x.value === this.type) |
| | | if (t) return g.name + ' · ' + t.label |
| | | } |
| | | return this.type |
| | | }, |
| | | activeTypes() { |
| | | const g = this.modules.find(x => x.key === this.activeModule) || this.modules[0] |
| | | return g |
| | | }, |
| | | visibleColumns() { |
| | | const hiddenProps = ['enterpriseCode', 'unifiedCreditCode', 'reportUnit'] |
| | | const hiddenLabels = ['企业代码', '统一社会信用代码', '填报单位'] |
| | | return (this.columns || []).filter(c => |
| | | hiddenProps.indexOf(c.prop) < 0 && hiddenLabels.indexOf(c.label) < 0) |
| | | }, |
| | | // 左侧冻结"这是谁的数据"所需列:横向滚动时企业名称/市州不会跑出视野。 |
| | | // 只冻结从第 1 列开始的一段连续列,避免冻结列之间被普通列打断。 |
| | | renderColumns() { |
| | | const stickyProps = ['reportPeriod', 'regionCode', 'city', 'regionName', 'periodType', |
| | | 'enterpriseName', 'projectName', 'plateNo'] |
| | | const nameProps = ['enterpriseName', 'projectName', 'plateNo'] |
| | | const cols = this.visibleColumns |
| | | let limit = -1 |
| | | for (let i = 0; i < cols.length && i < 6; i++) { |
| | | if (nameProps.indexOf(cols[i].prop) >= 0) { limit = Math.min(i, 3); break } |
| | | } |
| | | if (limit < 0) { |
| | | // 表里没有名称列(如货运量周转量)时,冻结开头的连续标识列 |
| | | limit = 0 |
| | | while (limit + 1 < cols.length && limit < 2 && stickyProps.indexOf(cols[limit + 1].prop) >= 0) { |
| | | limit++ |
| | | } |
| | | } |
| | | return cols.map((c, i) => Object.assign({}, c, { fixed: i <= limit && stickyProps.indexOf(c.prop) >= 0 })) |
| | | } |
| | | }, |
| | | methods: { |
| | | onModuleChange(key) { |
| | | const g = this.modules.find(x => x.key === key) |
| | | if (!g || !g.types.length) return |
| | | if (!g.types.some(t => t.value === this.type)) { |
| | | this.type = g.types[0].value |
| | | } |
| | | this.doQuery() |
| | | }, |
| | | onTypeSelect() { |
| | | const g = this.modules.find(x => x.types.some(t => t.value === this.type)) |
| | | if (g) this.activeModule = g.key |
| | | this.doQuery() |
| | | }, |
| | | doQuery() { |
| | | this.page = 1 |
| | | this.records = [] |
| | | this.loadData() |
| | | }, |
| | | loadData() { |
| | | this.loading = true |
| | | this.loadingMore = false |
| | |
| | | }).then(res => { |
| | | const d = res.data || {} |
| | | this.records = d.records || [] |
| | | this.columns = d.columns || [] |
| | | this.columns = (d.columns || []).filter(c => ['enterpriseCode', 'unifiedCreditCode', 'reportUnit'].indexOf(c.prop) < 0 && ['企业代码', '统一社会信用代码', '填报单位'].indexOf(c.label) < 0) |
| | | this.total = d.total || 0 |
| | | if (this.page > 1 && this.records.length === 0) { |
| | | this.page = 1 |
| | |
| | | this.records = this.records.concat(addRows) |
| | | this.page = nextPage |
| | | if (d.total != null) this.total = d.total |
| | | if (d.columns && d.columns.length) this.columns = d.columns |
| | | if (d.columns && d.columns.length) this.columns = d.columns.filter(c => ['enterpriseCode', 'unifiedCreditCode', 'reportUnit'].indexOf(c.prop) < 0 && ['企业代码', '统一社会信用代码', '填报单位'].indexOf(c.label) < 0) |
| | | }).catch(e => { |
| | | if (e && e._toast) return |
| | | this.$message.error('加载更多失败') |
| | |
| | | </script> |
| | | <style scoped> |
| | | .el-header { background: #409EFF; color: white; line-height: 60px; font-size: 18px; } |
| | | #app .table-wrap { |
| | | display: flex; |
| | | flex-direction: column; |
| | | height: calc(100vh - 330px); |
| | | min-height: 300px; |
| | | } |
| | | #app .table-area { |
| | | flex: 1 1 auto; |
| | | min-height: 0; |
| | | overflow: hidden; |
| | | } |
| | | #app .table-area .el-table { |
| | | width: 100%; |
| | | height: 100%; |
| | | } |
| | | #app .table-wrap .el-pagination { |
| | | flex: none; |
| | | margin-top: 8px; |
| | | } |
| | | #app .table-area:fullscreen { |
| | | padding: 20px; |
| | | background: #fff; |
| | | overflow: auto; |
| | | } |
| | | #app .table-wrap:fullscreen { |
| | | padding: 20px; |
| | | background: #fff; |
| | | overflow: auto; |
| | | display: flex; |
| | | flex-direction: column; |
| | | height: 100vh; |
| | | } |
| | | #app .table-wrap:fullscreen .table-area { |
| | | flex: 1 1 auto; |
| | | min-height: 0; |
| | | } |
| | | #app .table-wrap:fullscreen .el-pagination { |
| | | flex: none; |
| | | } |
| | | .type-row { margin-bottom: 10px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; } |
| | | .type-label { color: #606266; font-weight: 600; } |
| | | .filter-row { margin-bottom: 4px; } |
| | | #app .toolbar { display:flex; align-items:center; gap:10px; flex-wrap:wrap; padding:8px 12px; background:#FAFAFA; border:1px solid #EBEEF5; border-radius:8px; margin-bottom:8px; } |
| | | #app .toolbar-label { color:#606266; font-weight:600; white-space:nowrap; } |
| | | #app .toolbar-sep { width:1px; height:22px; background:#DCDFE6; margin:0 2px; } |
| | | #app .load-hint { color:#909399; font-size:12px; margin-bottom:6px; } |
| | | #app .table-wrap { display:flex; flex-direction:column; height:calc(100vh - 250px); min-height:300px; } |
| | | #app .table-area { flex:1 1 auto; min-height:0; overflow:hidden; } |
| | | #app .table-area .el-table { width:100%; height:100%; } |
| | | #app .table-area:fullscreen { padding:20px; background:#fff; overflow:auto; } |
| | | #app .table-wrap:fullscreen { padding:20px; background:#fff; overflow:auto; display:flex; flex-direction:column; height:100vh; } |
| | | #app .table-wrap:fullscreen .table-area { flex:1 1 auto; min-height:0; } |
| | | </style> |