| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447 |
- <template>
- <div class="energy-statistics">
- <el-card shadow="never" class="statistics-card">
- <!-- 主内容区 -->
- <ele-split-layout
- width="220px"
- allow-collapse
- :right-style="{ overflow: 'hidden' }"
- >
- <!-- 左侧树形菜单 -->
- <left-sidebar
- ref="leftSidebarRef"
- :active-tab.sync="activeTab"
- @tab-change="activeTabChange"
- @node-click="handleNodeClick"
- @first-node="handleFirstNode"
- />
- <!-- 右侧内容区 -->
- <template v-slot:content>
- <div class="right-content">
- <!-- 搜索区域 -->
- <div class="search-area">
- <seek-page
- :seekList="seekList"
- @search="handleSearch"
- @reset="handleReset"
- :maxLength="4"
- style="flex: 1"
- ></seek-page>
- </div>
- <!-- 列表视图 -->
- <div class="list-view">
- <ele-pro-table
- ref="table"
- row-key="id"
- :columns="columns"
- :datasource="datasource"
- :cache-key="cacheKeyUrl"
- :initLoad="false"
- autoAmendPage
- height="calc(100vh - 300px)"
- >
- <template v-slot:type="{ row }">
- {{ getTypeText(row.type) }}
- </template>
- <template v-slot:energyType="{ row }">
- {{ getEnergyTypeText(row.energyType) }}
- </template>
- <template v-slot:timeRange="{ row }">
- {{ row.startTime }} 至 {{ row.endTime }}
- </template>
- <template v-slot:action="{ row }">
- <el-link
- type="primary"
- :underline="false"
- @click="handleView(row)"
- >
- 查看
- </el-link>
- </template>
- </ele-pro-table>
- </div>
- </div>
- </template>
- </ele-split-layout>
- </el-card>
- </div>
- </template>
- <script>
- import dictMixins from '@/mixins/dictMixins';
- import tableColumnsMixin from '@/mixins/tableColumnsMixin';
- import { getPage } from '@/api/energyConsumptionStatistics/index.js';
- import { energyConsumingUnitList } from '@/enum/dict.js';
- import LeftSidebar from './components/LeftSidebar.vue';
- export default {
- mixins: [dictMixins, tableColumnsMixin],
- components: {
- LeftSidebar
- },
- data() {
- return {
- // 搜索表单
- searchForm: {
- energyType: '',
- meterType: '',
- keyword: '',
- timeRange: []
- },
- // 当前激活的标签页
- activeTab: 'org',
- areaId: '',
- categoryLevelId: '',
- substanceId: '',
- // 表格列配置
- columns: [
- {
- columnKey: 'index',
- label: '序号',
- type: 'index',
- width: 55,
- align: 'center',
- fixed: 'left'
- },
- {
- prop: 'substanceCode',
- label: '表计设备编码',
- align: 'center',
- minWidth: 150,
- showOverflowTooltip: true
- },
- {
- prop: 'substanceName',
- label: '表计设备名称',
- align: 'center',
- minWidth: 150,
- showOverflowTooltip: true
- },
- {
- prop: 'meterEquipmentNumber',
- label: '表计设备编号',
- align: 'center',
- minWidth: 150,
- showOverflowTooltip: true
- },
- {
- prop: 'meterType',
- label: '表计类型',
- align: 'center',
- minWidth: 100,
- formatter: (_row, _column, cellValue) => {
- return this.getDictValue('表计类型', _row.meterType);
- },
- showOverflowTooltip: true
- },
- {
- prop: 'correlationSubstanceName',
- label: '关联设备',
- align: 'center',
- minWidth: 120,
- showOverflowTooltip: true
- },
- {
- prop: 'areaName',
- label: '区域',
- align: 'center',
- minWidth: 150,
- showOverflowTooltip: true
- },
- {
- prop: 'energyClassificationName',
- label: '用能分类',
- align: 'center',
- minWidth: 100,
- showOverflowTooltip: true
- },
- {
- prop: 'energyTypeName',
- label: '能源名称',
- align: 'center',
- minWidth: 120,
- showOverflowTooltip: true
- },
- {
- prop: 'meterReadingMethod',
- label: '数据来源',
- align: 'center',
- formatter: (_row, _column, cellValue) => {
- return _row.meterReadingMethod == 1 ? '手动录入' : '自动采集';
- },
- minWidth: 120,
- showOverflowTooltip: true
- },
- {
- prop: 'lastMeterReadingTime',
- label: '上期抄表时间',
- align: 'center',
- minWidth: 180,
- showOverflowTooltip: true
- },
- {
- prop: 'currentMeterReadingTime',
- label: '本期抄表时间',
- align: 'center',
- minWidth: 180,
- showOverflowTooltip: true
- },
- {
- prop: 'currentUsage',
- label: '本期用量',
- align: 'center',
- minWidth: 120,
- showOverflowTooltip: true
- },
- {
- prop: 'unit',
- label: '单位',
- align: 'center',
- minWidth: 80,
- showOverflowTooltip: true
- },
- {
- prop: 'unitPrice',
- label: '单价',
- align: 'center',
- minWidth: 80,
- showOverflowTooltip: true
- },
- {
- prop: 'total',
- label: '价格单位',
- align: 'center',
- minWidth: 120,
- formatter: (row) => {
- return energyConsumingUnitList
- .find((item) => item.value == row.energyClassificationCode)
- ?.priceUnit.find((item) => item.value == row.priceUnit)?.label;
- },
- showOverflowTooltip: true
- },
- {
- prop: 'currentExpenses',
- label: '本期费用(元',
- align: 'center',
- minWidth: 130,
- showOverflowTooltip: true
- }
- ],
- cacheKeyUrl: 'ems-energy-statistics-list'
- };
- },
- computed: {
- seekList() {
- return [
- {
- label: '关键词',
- value: 'keyword',
- type: 'input',
- placeholder: '表计编码、名称、编号'
- },
- {
- label: '用能分类',
- value: 'energyClassificationCode',
- type: 'select',
- placeholder: ' ',
- planList: energyConsumingUnitList
- },
- {
- label: '抄表方式',
- value: 'meterReadingMethod',
- type: 'select',
- placeholder: ' ',
- planList: [
- { label: '自动采集', value: 0 },
- { label: '手动录入', value: 1 }
- ]
- },
- {
- label: '抄表时间',
- value: 'createTime',
- type: 'date',
- width: 300,
- valueAr: [
- 'currentMeterReadingTimeStart',
- 'currentMeterReadingTimeEnd'
- ]
- }
- ];
- }
- },
- created() {
- // 数据在 LeftSidebar 组件内部获取
- },
- methods: {
- activeTabChange() {
- this.categoryLevelId = '';
- this.areaId = '';
- this.substanceId = '';
- // Tab切换时重置条件,由用户手动选择节点或使用默认
- this.$refs.table.reload({ page: 1 });
- },
- // 处理第一个节点(由 LeftSidebar 组件加载完成后触发)
- handleFirstNode(data) {
- this.handleNodeClick(data);
- },
- // 搜索
- handleSearch(where) {
- this.searchForm = { ...where };
- this.$refs.table.reload({ page: 1 });
- },
- // 重置
- handleReset() {
- this.searchForm = {
- energyType: '',
- meterType: '',
- keyword: '',
- timeRange: []
- };
- this.$refs.table.reload({ page: 1 });
- },
- // 树节点点击
- handleNodeClick(data) {
- this.categoryLevelId = '';
- this.substanceId = '';
- this.areaId = '';
- if (this.activeTab == 'org') {
- if (data.nodeType == 'instance') {
- this.substanceId = data.id;
- } else {
- this.categoryLevelId = data.id;
- }
- } else {
- this.areaId = data.id;
- }
- this.$refs.table.reload({ page: 1 });
- },
- // 表格数据源
- async datasource({ page, limit, where }) {
- return await getPage({
- pageNum: page,
- size: limit,
- ...where,
- ...this.searchForm,
- areaId: this.areaId,
- categoryLevelId: this.categoryLevelId,
- substanceId:this.substanceId
- });
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- .energy-statistics {
- .statistics-card {
- height: calc(100vh - 100px);
- ::v-deep .el-card__body {
- height: 100%;
- padding: 15px;
- }
- }
- ::v-deep .ele-split-layout {
- .ele-split-layout-left {
- padding: 0;
- background: transparent;
- border: none;
- }
- .ele-split-layout-right {
- padding: 0;
- }
- .ele-split-layout-trigger {
- width: 8px;
- background: #f0f0f0;
- border-left: 1px solid #e0e0e0;
- border-right: 1px solid #e0e0e0;
- &:hover {
- background: #d0d0d0;
- }
- .ele-split-layout-trigger-icon {
- color: #909399;
- }
- }
- }
- .left-sidebar {
- height: 100%;
- ::v-deep .el-tabs--border-card {
- box-shadow: none;
- border: 1px solid #ebeef5;
- height: 100%;
- .el-tabs__header {
- background-color: #f5f7fa;
- border-bottom: 1px solid #ebeef5;
- margin: 0;
- .el-tabs__nav {
- width: 100%;
- display: flex;
- }
- .el-tabs__item {
- flex: 1;
- height: 39px;
- line-height: 39px;
- font-size: 13px;
- padding: 0;
- text-align: center;
- &.is-active {
- background-color: #fff;
- border-bottom-color: #fff;
- }
- }
- }
- .el-tabs__content {
- padding: 10px;
- height: calc(100% - 40px);
- overflow-y: auto;
- }
- }
- ::v-deep .el-tree {
- padding: 0;
- }
- }
- .right-content {
- flex: 1;
- min-width: 0;
- padding-left: 15px;
- .search-area {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 10px;
- padding-bottom: 10px;
- border-bottom: 1px solid #ebeef5;
- }
- .list-view {
- ::v-deep .ele-pro-table {
- .el-table {
- border: 1px solid #ebeef5;
- border-radius: 4px;
- }
- }
- }
- }
- }
- </style>
|