diff --git a/klp-ui/src/api/ems/dashboard/timer.js b/klp-ui/src/api/ems/dashboard/timer.js new file mode 100644 index 00000000..5b39f90b --- /dev/null +++ b/klp-ui/src/api/ems/dashboard/timer.js @@ -0,0 +1,19 @@ +import request from '@/utils/request' + +// 近期能耗情况汇总 +export function getRecentEnergySummary(query) { + return request({ + url: '/ems/energyConsumption/getEnergySummary', + method: 'get', + params: query + }) +} + +// 近期能耗趋势 +export function getRecentEnergyTrend(query) { + return request({ + url: '/ems/energyConsumption/getEnergyTrend', + method: 'get', + params: query + }) +} \ No newline at end of file diff --git a/klp-ui/src/assets/styles/element-ui.scss b/klp-ui/src/assets/styles/element-ui.scss index 83dc7dff..e5a12d8e 100644 --- a/klp-ui/src/assets/styles/element-ui.scss +++ b/klp-ui/src/assets/styles/element-ui.scss @@ -1051,7 +1051,7 @@ body { // background-color: $--color-background-light; border-radius: 6px 6px 0 0; padding: 0 var(--spacing-base); - box-shadow: inset 0 -1px 0 $--border-color-light; + // box-shadow: inset 0 -1px 0 $--border-color-light; } // 标签项 @@ -1128,11 +1128,10 @@ body { // 标签内容区 .el-tabs__content { - padding: var(--spacing-lg); + // padding: var(--spacing-lg); background-color: $--metal-gradient-light; - border: 1px solid $--border-color-light; - border-radius: 0 0 6px 6px; - min-height: 100px; // 确保有基本高度 + // border: 1px solid $--border-color-light; + // border-radius: 0 0 6px 6px; } // 卡片类型标签页 @@ -1150,14 +1149,15 @@ body { .el-tabs__item { border: 1px solid $--border-color-light; border-bottom: none; - border-radius: 6px 6px 0 0; + // border-radius: 6px 6px 0 0; margin: 0 2px; background-color: $--metal-gradient-light; &.is-active { border-color: $--border-color-light; border-bottom-color: $--metal-gradient-light; - background-color: $--metal-gradient-light; + background-color: $--color-primary; + color: $--metal-gradient-light; position: relative; bottom: -1px; } diff --git a/klp-ui/src/layout/components/Sidebar/index.vue b/klp-ui/src/layout/components/Sidebar/index.vue index 58afab11..c990e28d 100644 --- a/klp-ui/src/layout/components/Sidebar/index.vue +++ b/klp-ui/src/layout/components/Sidebar/index.vue @@ -53,8 +53,5 @@ export default { return !this.sidebar.opened; } }, - mounted() { - console.log(this.sidebarRouters, sidebar); - } }; diff --git a/klp-ui/src/views/components/AllApplications.vue b/klp-ui/src/views/components/AllApplications.vue index 2270f02f..7ede6331 100644 --- a/klp-ui/src/views/components/AllApplications.vue +++ b/klp-ui/src/views/components/AllApplications.vue @@ -104,7 +104,7 @@ export default { filteredMenus() { const filterHidden = (menus) => { return menus - .filter(menu => menu.hidden!== true) + .filter(menu => menu.hidden !== true) .map(menu => { if (menu.children) { menu.children = filterHidden(menu.children) diff --git a/klp-ui/src/views/ems/dashboard/index.vue b/klp-ui/src/views/ems/dashboard/index.vue index b4019a19..23bffafe 100644 --- a/klp-ui/src/views/ems/dashboard/index.vue +++ b/klp-ui/src/views/ems/dashboard/index.vue @@ -1,9 +1,12 @@ @@ -39,10 +44,9 @@ import { listEnergyType } from "@/api/ems/energyType"; import { listLocation } from "@/api/ems/location"; import Overview from "./panels/Overview.vue"; -import RecentTrend from "./panels/RecentTrend.vue"; -import YearToYear from "./panels/YearToYear.vue"; +import RecentTrend from "./panels/RecentTrends.vue"; +import YearToYear from "./panels/YearOnYear.vue"; import MonthToMonth from "./panels/MonthToMonth.vue"; -import Overview from "./panels/Overview.vue"; export default { name: "Dashboard", @@ -57,6 +61,7 @@ export default { energyTypeList: [], energyType: '', locationId: '', + deviceId: '', locationList: [ ], defaultProps: { @@ -70,11 +75,16 @@ export default { this.getEnergyTypeList(); this.getLocationList(); }, - watch: { - // 当选择的区域变化时重新获取设备列表 - locationId: { - + computed: { + showRight() { + return this.energyType && (this.deviceId || this.locationId); }, + energyUnit() { + return this.energyTypeList.find(item => item.energyTypeId === this.energyType)?.unit; + }, + energyName() { + return this.energyTypeList.find(item => item.energyTypeId === this.energyType)?.name; + } }, methods: { getEnergyTypeList() { @@ -84,13 +94,27 @@ export default { }, getLocationList() { listLocation().then(response => { - const data = { locationId: undefined, name: '顶级节点', children: [] }; - data.children = this.handleTree(response.data, "locationId", "parentId"); - this.locationList.push(data); + this.locationList = this.handleTree(response.data, "locationId", "parentId"); }); }, handleNodeClick(data) { this.locationId = data.locationId; + this.deviceId = undefined; + this.refresh(); + }, + refresh() { + if (this.$refs.overview) { + this.$refs.overview.refresh(); + } + if (this.$refs.recentTrend) { + this.$refs.recentTrend.refresh(); + } + if (this.$refs.yearToYear) { + this.$refs.yearToYear.refresh(); + } + if (this.$refs.monthToMonth) { + this.$refs.monthToMonth.refresh(); + } } } } diff --git a/klp-ui/src/views/ems/dashboard/panels/MonthToMonth.vue b/klp-ui/src/views/ems/dashboard/panels/MonthToMonth.vue index e69de29b..488dcc59 100644 --- a/klp-ui/src/views/ems/dashboard/panels/MonthToMonth.vue +++ b/klp-ui/src/views/ems/dashboard/panels/MonthToMonth.vue @@ -0,0 +1,239 @@ + + + + + diff --git a/klp-ui/src/views/ems/dashboard/panels/Overview.vue b/klp-ui/src/views/ems/dashboard/panels/Overview.vue index e69de29b..0683382e 100644 --- a/klp-ui/src/views/ems/dashboard/panels/Overview.vue +++ b/klp-ui/src/views/ems/dashboard/panels/Overview.vue @@ -0,0 +1,320 @@ + + + + + diff --git a/klp-ui/src/views/ems/dashboard/panels/RecentTrends.vue b/klp-ui/src/views/ems/dashboard/panels/RecentTrends.vue index e69de29b..09363b6c 100644 --- a/klp-ui/src/views/ems/dashboard/panels/RecentTrends.vue +++ b/klp-ui/src/views/ems/dashboard/panels/RecentTrends.vue @@ -0,0 +1,382 @@ + + + + + diff --git a/klp-ui/src/views/ems/dashboard/panels/YearOnYear.vue b/klp-ui/src/views/ems/dashboard/panels/YearOnYear.vue index e69de29b..a96a69a0 100644 --- a/klp-ui/src/views/ems/dashboard/panels/YearOnYear.vue +++ b/klp-ui/src/views/ems/dashboard/panels/YearOnYear.vue @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/klp-ui/src/views/ems/data/index.vue b/klp-ui/src/views/ems/data/index.vue index 238c8b27..62f60b2d 100644 --- a/klp-ui/src/views/ems/data/index.vue +++ b/klp-ui/src/views/ems/data/index.vue @@ -114,12 +114,12 @@ diff --git a/klp-ui/src/views/ems/meter/index.vue b/klp-ui/src/views/ems/meter/index.vue index 33580c01..de880102 100644 --- a/klp-ui/src/views/ems/meter/index.vue +++ b/klp-ui/src/views/ems/meter/index.vue @@ -68,85 +68,82 @@ icon="el-icon-plus" size="mini" @click="handleAdd" - >新增 - - - 修改 - - - 删除 - - - 导出 + >新增设备 - - - - - - - - - - - - - - - - - - - - - - - - + +
+ + + +
+
{{ item.meterCode }}
+
+ {{ getEnergy(item.energyTypeId).name }} +
+
+ +
+
+ 安装位置: + {{ getLocationName(item.locationId) }} +
+
+ 设备型号: + {{ item.model }} +
+
+ 制造商: + {{ item.manufacturer }} +
+
+ 安装日期: + {{ parseTime(item.installDate, '{y}-{m}-{d}') }} +
+
+ 校准日期: + {{ parseTime(item.lastCalibrationDate, '{y}-{m}-{d}') }} +
+
+ 阈值: + {{ item.thresholdValue }} +
+
+ 备注: + {{ item.remark || '无' }} +
+
+ +
+ 编辑 + 删除 +
+
+
+
+
- + @@ -168,8 +165,7 @@ - - + @@ -229,17 +225,11 @@ export default { buttonLoading: false, // 遮罩层 loading: true, - // 选中数组 - ids: [], - // 非单个禁用 - single: true, - // 非多个禁用 - multiple: true, // 显示搜索条件 showSearch: true, // 总条数 total: 0, - // 计量设备(阈值移至此处)表格数据 + // 计量设备表格数据 meterList: [], // 弹出层标题 title: "", @@ -263,6 +253,24 @@ export default { form: {}, // 表单校验 rules: { + meterCode: [ + { required: true, message: "设备编号不能为空", trigger: "blur" } + ], + energyTypeId: [ + { required: true, message: "能源类型不能为空", trigger: "change" } + ], + locationId: [ + { required: true, message: "安装位置不能为空", trigger: "change" } + ], + model: [ + { required: true, message: "设备型号不能为空", trigger: "blur" } + ], + installDate: [ + { required: true, message: "安装日期不能为空", trigger: "change" } + ], + thresholdValue: [ + { required: true, message: "阈值不能为空", trigger: "blur" } + ] } }; }, @@ -272,7 +280,7 @@ export default { this.getEnergyTypeList(); }, methods: { - /** 查询计量设备(阈值移至此处)列表 */ + /** 查询计量设备列表 */ getList() { this.loading = true; listMeter(this.queryParams).then(response => { @@ -342,28 +350,22 @@ export default { this.resetForm("queryForm"); this.handleQuery(); }, - // 多选框选中数据 - handleSelectionChange(selection) { - this.ids = selection.map(item => item.meterId) - this.single = selection.length!==1 - this.multiple = !selection.length - }, /** 新增按钮操作 */ handleAdd() { this.reset(); this.open = true; - this.title = "添加计量设备(阈值移至此处)"; + this.title = "添加计量设备"; }, /** 修改按钮操作 */ handleUpdate(row) { this.loading = true; this.reset(); - const meterId = row.meterId || this.ids + const meterId = row.meterId; getMeter(meterId).then(response => { this.loading = false; this.form = response.data; this.open = true; - this.title = "修改计量设备(阈值移至此处)"; + this.title = "修改计量设备"; }); }, /** 提交按钮 */ @@ -392,17 +394,38 @@ export default { }); }, getLocationName(id) { - return this.locationList.find(item => item.locationId === id).name ?? ''; + const location = this.locationList.find(item => item.locationId === id); + return location ? location.name : ''; }, getEnergy(id) { - return this.energyTypeList.find(item => item.energyTypeId === id) ?? {}; + const energy = this.energyTypeList.find(item => item.energyTypeId === id); + return energy || { name: '' }; + }, + getStatusClass(status) { + if (status === '正常') return 'status-normal'; + if (status === '故障') return 'status-fault'; + if (status === '维护中') return 'status-maintenance'; + if (status === '离线') return 'status-offline'; + return ''; + }, + parseTime(time, format) { + if (!time) return ''; + const date = new Date(time); + const year = date.getFullYear(); + const month = (date.getMonth() + 1).toString().padStart(2, '0'); + const day = date.getDate().toString().padStart(2, '0'); + + if (format === '{y}-{m}-{d}') { + return `${year}-${month}-${day}`; + } + return `${year}-${month}-${day}`; }, /** 删除按钮操作 */ handleDelete(row) { - const meterIds = row.meterId || this.ids; - this.$modal.confirm('是否确认删除计量设备(阈值移至此处)编号为"' + meterIds + '"的数据项?').then(() => { + const meterId = row.meterId; + this.$modal.confirm('是否确认删除计量设备编号为"' + row.meterCode + '"的数据项?').then(() => { this.loading = true; - return delMeter(meterIds); + return delMeter(meterId); }).then(() => { this.loading = false; this.getList(); @@ -411,13 +434,145 @@ export default { }).finally(() => { this.loading = false; }); - }, - /** 导出按钮操作 */ - handleExport() { - this.download('ems/meter/export', { - ...this.queryParams - }, `meter_${new Date().getTime()}.xlsx`) } } }; + + \ No newline at end of file diff --git a/klp-ui/src/views/finance/order/index.vue b/klp-ui/src/views/finance/order/index.vue index 9418b12d..a1190991 100644 --- a/klp-ui/src/views/finance/order/index.vue +++ b/klp-ui/src/views/finance/order/index.vue @@ -69,7 +69,7 @@ - + diff --git a/klp-ui/src/views/wms/order/panels/detail.vue b/klp-ui/src/views/wms/order/panels/detail.vue index e5880790..72dffadf 100644 --- a/klp-ui/src/views/wms/order/panels/detail.vue +++ b/klp-ui/src/views/wms/order/panels/detail.vue @@ -16,7 +16,7 @@ --> - + 新增 @@ -155,6 +155,10 @@ export default { orderId: { type: [String, Number], required: true + }, + editable: { + type: Boolean, + default: true } }, components: {