能源类型
This commit is contained in:
@@ -33,11 +33,28 @@
|
||||
v-model="objIds"
|
||||
:options="objList"
|
||||
:props="{ checkStrictly: true, value: 'id', label: 'name' }"
|
||||
popper-class="cascaderParent"
|
||||
@change="selectObj"
|
||||
clearable></el-cascader>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item
|
||||
label="监控能源类型"
|
||||
prop="energyTypeId">
|
||||
<el-select
|
||||
v-model="form.energyTypeId"
|
||||
placeholder="请选择"
|
||||
style="width: 100%"
|
||||
filterable
|
||||
@change="toggleType">
|
||||
<el-option
|
||||
v-for="item in this.energyTypeList"
|
||||
:key="item.id"
|
||||
:label="item.labelName"
|
||||
:value="item.id"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col
|
||||
:span="12"
|
||||
v-if="form.method == 2">
|
||||
@@ -56,24 +73,6 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item
|
||||
label="监控能源类型"
|
||||
prop="energyTypeId">
|
||||
<el-select
|
||||
v-model="form.energyTypeId"
|
||||
placeholder="请选择"
|
||||
style="width: 100%"
|
||||
filterable
|
||||
@change="toggleType">
|
||||
<el-option
|
||||
v-for="item in this.energyTypeList"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col
|
||||
:span="12"
|
||||
v-if="form.method == 1">
|
||||
@@ -353,8 +352,3 @@ export default {
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
.cascaderParent .el-cascader-panel .el-scrollbar:first-child .el-radio {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -48,7 +48,7 @@ import {
|
||||
deleteEnergyLimit,
|
||||
} from '@/api/monitoring/energyLimit';
|
||||
import { getEnergyTypeListAll } from '@/api/base/energyType';
|
||||
import { getTree } from '@/api/base/factory';
|
||||
import { getTree } from '@/api/analysis/energyAnalysis';
|
||||
import { publicFormatter } from '@/utils/dict';
|
||||
import EnergyLimitAdd from './components/energyLimitAdd';
|
||||
const tableProps = [
|
||||
@@ -60,20 +60,27 @@ const tableProps = [
|
||||
{
|
||||
prop: 'objName',
|
||||
label: '监控对象',
|
||||
minWidth: 100,
|
||||
showOverflowtooltip: true,
|
||||
},
|
||||
{
|
||||
prop: 'objCode',
|
||||
label: '对象编码',
|
||||
minWidth: 140,
|
||||
showOverflowtooltip: true,
|
||||
},
|
||||
{
|
||||
prop: 'tableName',
|
||||
label: '能源表名',
|
||||
filter: publicFormatter('table_name'),
|
||||
minWidth: 120,
|
||||
showOverflowtooltip: true,
|
||||
},
|
||||
{
|
||||
prop: 'energyType',
|
||||
label: '能源类型',
|
||||
filter: publicFormatter('energy_type'),
|
||||
showOverflowtooltip: true,
|
||||
},
|
||||
{
|
||||
prop: 'type',
|
||||
@@ -104,6 +111,7 @@ export default {
|
||||
type: 'select',
|
||||
label: '能源类型',
|
||||
selectOptions: [],
|
||||
labelField: 'labelName',
|
||||
param: 'energyTypeId',
|
||||
},
|
||||
{
|
||||
|
||||
@@ -1,248 +1,271 @@
|
||||
<template>
|
||||
<div class="app-container energyOverlimitLog">
|
||||
|
||||
<!-- 搜索工作栏 -->
|
||||
<search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" />
|
||||
<el-tabs v-model="activeName" @tab-click="toggleTab">
|
||||
<el-tab-pane label="自动抄表" name="auto"></el-tab-pane>
|
||||
<el-tab-pane label="手动抄表" name="manual"></el-tab-pane>
|
||||
</el-tabs>
|
||||
<!-- 列表 -->
|
||||
<div v-if="activeName === 'auto'">
|
||||
<base-table :page="queryParams.pageNo" :limit="queryParams.pageSize" :table-props="tableProps" :table-data="list"
|
||||
:max-height="tableH" />
|
||||
</div>
|
||||
<div v-if="activeName === 'manual'">
|
||||
<base-table :page="queryParams.pageNo" :limit="queryParams.pageSize" :table-props="tableProps2"
|
||||
:table-data="list2" :max-height="tableH" />
|
||||
</div>
|
||||
<pagination :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" :total="total"
|
||||
@pagination="getList" />
|
||||
</div>
|
||||
<div class="app-container energyOverlimitLog">
|
||||
<!-- 搜索工作栏 -->
|
||||
<search-bar
|
||||
:formConfigs="formConfig"
|
||||
ref="searchBarForm"
|
||||
@headBtnClick="buttonClick" />
|
||||
<el-tabs
|
||||
v-model="activeName"
|
||||
@tab-click="toggleTab">
|
||||
<el-tab-pane
|
||||
label="自动抄表"
|
||||
name="auto"></el-tab-pane>
|
||||
<el-tab-pane
|
||||
label="手动抄表"
|
||||
name="manual"></el-tab-pane>
|
||||
</el-tabs>
|
||||
<!-- 列表 -->
|
||||
<div v-if="activeName === 'auto'">
|
||||
<base-table
|
||||
:page="queryParams.pageNo"
|
||||
:limit="queryParams.pageSize"
|
||||
:table-props="tableProps"
|
||||
:table-data="list"
|
||||
:max-height="tableH" />
|
||||
</div>
|
||||
<div v-if="activeName === 'manual'">
|
||||
<base-table
|
||||
:page="queryParams.pageNo"
|
||||
:limit="queryParams.pageSize"
|
||||
:table-props="tableProps2"
|
||||
:table-data="list2"
|
||||
:max-height="tableH" />
|
||||
</div>
|
||||
<pagination
|
||||
:page.sync="queryParams.pageNo"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
:total="total"
|
||||
@pagination="getList" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getEnergyOverlimitLogPage } from "@/api/monitoring/energyOverlimitLog";
|
||||
import { getEnergyTypeListAll } from "@/api/base/energyType";
|
||||
import { publicFormatter } from '@/utils/dict'
|
||||
import { parseTime } from '@/utils/ruoyi'
|
||||
import { getEnergyOverlimitLogPage } from '@/api/monitoring/energyOverlimitLog';
|
||||
import { getEnergyTypeListAll } from '@/api/base/energyType';
|
||||
import { publicFormatter } from '@/utils/dict';
|
||||
import { parseTime } from '@/utils/ruoyi';
|
||||
const tableProps = [
|
||||
{
|
||||
prop: 'objName',
|
||||
label: '监控对象'
|
||||
},
|
||||
{
|
||||
prop: 'objCode',
|
||||
label: '对象编码'
|
||||
},
|
||||
{
|
||||
prop: 'energyType',
|
||||
label: '能源类型'
|
||||
},
|
||||
{
|
||||
prop: 'type',
|
||||
label: '监控模式'
|
||||
},
|
||||
{
|
||||
prop: 'paramName',
|
||||
label: '监控参数'
|
||||
},
|
||||
{
|
||||
prop: 'limitType',
|
||||
label: '指标类型',
|
||||
filter: publicFormatter('monitor_index_type')
|
||||
},
|
||||
{
|
||||
prop: 'realityValue',
|
||||
label: '实际值'
|
||||
},
|
||||
{
|
||||
prop: 'limitValue',
|
||||
label: '阈值'
|
||||
},
|
||||
{
|
||||
prop: 'overValue',
|
||||
label: '超出值'
|
||||
},
|
||||
{
|
||||
prop: 'time',
|
||||
label: '提醒时间',
|
||||
filter: parseTime,
|
||||
minWidth: 160
|
||||
}
|
||||
]
|
||||
{
|
||||
prop: 'objName',
|
||||
label: '监控对象',
|
||||
},
|
||||
{
|
||||
prop: 'objCode',
|
||||
label: '对象编码',
|
||||
},
|
||||
{
|
||||
prop: 'energyType',
|
||||
label: '能源类型',
|
||||
filter: publicFormatter('energy_type'),
|
||||
},
|
||||
{
|
||||
prop: 'type',
|
||||
label: '监控模式',
|
||||
},
|
||||
{
|
||||
prop: 'paramName',
|
||||
label: '监控参数',
|
||||
},
|
||||
{
|
||||
prop: 'limitType',
|
||||
label: '指标类型',
|
||||
filter: publicFormatter('monitor_index_type'),
|
||||
},
|
||||
{
|
||||
prop: 'realityValue',
|
||||
label: '实际值',
|
||||
},
|
||||
{
|
||||
prop: 'limitValue',
|
||||
label: '阈值',
|
||||
},
|
||||
{
|
||||
prop: 'overValue',
|
||||
label: '超出值',
|
||||
},
|
||||
{
|
||||
prop: 'time',
|
||||
label: '提醒时间',
|
||||
filter: parseTime,
|
||||
minWidth: 160,
|
||||
},
|
||||
];
|
||||
const tableProps2 = [
|
||||
{
|
||||
prop: 'energyType',
|
||||
label: '能源类型'
|
||||
},
|
||||
{
|
||||
prop: 'limitType',
|
||||
label: '指标类型',
|
||||
filter: publicFormatter('monitor_index_type')
|
||||
},
|
||||
{
|
||||
prop: 'realityValue',
|
||||
label: '实际值'
|
||||
},
|
||||
{
|
||||
prop: 'limitValue',
|
||||
label: '阈值'
|
||||
},
|
||||
{
|
||||
prop: 'overValue',
|
||||
label: '超出值'
|
||||
},
|
||||
{
|
||||
prop: 'time',
|
||||
label: '提醒时间',
|
||||
filter: parseTime,
|
||||
minWidth: 160
|
||||
}
|
||||
]
|
||||
{
|
||||
prop: 'energyType',
|
||||
label: '能源类型',
|
||||
filter: publicFormatter('energy_type'),
|
||||
},
|
||||
{
|
||||
prop: 'limitType',
|
||||
label: '指标类型',
|
||||
filter: publicFormatter('monitor_index_type'),
|
||||
},
|
||||
{
|
||||
prop: 'realityValue',
|
||||
label: '实际值',
|
||||
},
|
||||
{
|
||||
prop: 'limitValue',
|
||||
label: '阈值',
|
||||
},
|
||||
{
|
||||
prop: 'overValue',
|
||||
label: '超出值',
|
||||
},
|
||||
{
|
||||
prop: 'time',
|
||||
label: '提醒时间',
|
||||
filter: parseTime,
|
||||
minWidth: 160,
|
||||
},
|
||||
];
|
||||
export default {
|
||||
name: "EnergyOverlimitLog",
|
||||
data() {
|
||||
return {
|
||||
formConfig: [
|
||||
{
|
||||
type: 'select',
|
||||
label: '能源类型',
|
||||
selectOptions: [],
|
||||
param: 'energyTypeId'
|
||||
},
|
||||
{
|
||||
type: 'select',
|
||||
label: '指标类型',
|
||||
selectOptions: this.getDictDatas(this.DICT_TYPE.MONITOR_INDEX_TYPE),
|
||||
labelField: 'label',
|
||||
valueField: 'value',
|
||||
param: 'indexType'
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
btnName: '查询',
|
||||
name: 'search',
|
||||
color: 'primary'
|
||||
}
|
||||
],
|
||||
activeName: 'auto',
|
||||
tableProps,
|
||||
tableProps2,
|
||||
tableH: this.tableHeight(260),
|
||||
total: 0,
|
||||
list: [],
|
||||
list2: [],
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNo: 1,
|
||||
pageSize: 20,
|
||||
energyTypeId: '',
|
||||
indexType: '',
|
||||
method: '1'
|
||||
},
|
||||
typeList: [
|
||||
{ id: 1, name: '合并' },
|
||||
{ id: 2, name: '详细' }
|
||||
]
|
||||
};
|
||||
},
|
||||
created() {
|
||||
window.addEventListener('resize', () => {
|
||||
this.tableH = this.tableHeight(260)
|
||||
})
|
||||
this.getList();
|
||||
this.getTypeList()
|
||||
},
|
||||
methods: {
|
||||
buttonClick(val) {
|
||||
this.queryParams.pageNo = 1;
|
||||
this.queryParams.energyTypeId = val.energyTypeId
|
||||
this.queryParams.indexType = val.indexType
|
||||
this.getList()
|
||||
},
|
||||
/** 查询列表 */
|
||||
getList() {
|
||||
getEnergyOverlimitLogPage(this.queryParams).then(response => {
|
||||
let arr = response.data.list || [];
|
||||
arr && arr.map((item) => {
|
||||
this.typeList.map((i) => {
|
||||
if (item.type === i.id) {
|
||||
item.type = i.name
|
||||
}
|
||||
})
|
||||
if (item.minValue && item.maxValue) {
|
||||
item.limitValue = item.minValue + '-' + item.maxValue
|
||||
} else if (item.minValue) {
|
||||
item.limitValue = '最小值' + item.minValue
|
||||
} else if (item.maxValue) {
|
||||
item.limitValue = '最大值' + item.maxValue
|
||||
} else {
|
||||
item.limitValue = ''
|
||||
}
|
||||
})
|
||||
if (this.queryParams.method === '1') {
|
||||
this.list = arr
|
||||
this.list2 = []
|
||||
} else {
|
||||
this.list2 = arr
|
||||
this.list1 = []
|
||||
}
|
||||
this.total = response.data.total;
|
||||
});
|
||||
},
|
||||
getTypeList() {
|
||||
getEnergyTypeListAll().then((res) => {
|
||||
console.log(res)
|
||||
this.formConfig[0].selectOptions = res.data || []
|
||||
})
|
||||
},
|
||||
toggleTab() {
|
||||
if (this.activeName === 'auto') {
|
||||
this.queryParams.method = '1'
|
||||
} else {
|
||||
this.queryParams.method = '2'
|
||||
}
|
||||
this.queryParams.pageNo = 1
|
||||
this.getList()
|
||||
}
|
||||
}
|
||||
name: 'EnergyOverlimitLog',
|
||||
data() {
|
||||
return {
|
||||
formConfig: [
|
||||
{
|
||||
type: 'select',
|
||||
label: '能源类型',
|
||||
labelField: 'labelName',
|
||||
selectOptions: [],
|
||||
param: 'energyTypeId',
|
||||
},
|
||||
{
|
||||
type: 'select',
|
||||
label: '指标类型',
|
||||
selectOptions: this.getDictDatas(this.DICT_TYPE.MONITOR_INDEX_TYPE),
|
||||
labelField: 'label',
|
||||
valueField: 'value',
|
||||
param: 'indexType',
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
btnName: '查询',
|
||||
name: 'search',
|
||||
color: 'primary',
|
||||
},
|
||||
],
|
||||
activeName: 'auto',
|
||||
tableProps,
|
||||
tableProps2,
|
||||
tableH: this.tableHeight(260),
|
||||
total: 0,
|
||||
list: [],
|
||||
list2: [],
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNo: 1,
|
||||
pageSize: 20,
|
||||
energyTypeId: '',
|
||||
indexType: '',
|
||||
method: '1',
|
||||
},
|
||||
typeList: [
|
||||
{ id: 1, name: '合并' },
|
||||
{ id: 2, name: '详细' },
|
||||
],
|
||||
};
|
||||
},
|
||||
created() {
|
||||
window.addEventListener('resize', () => {
|
||||
this.tableH = this.tableHeight(260);
|
||||
});
|
||||
this.getList();
|
||||
this.getTypeList();
|
||||
},
|
||||
methods: {
|
||||
buttonClick(val) {
|
||||
this.queryParams.pageNo = 1;
|
||||
this.queryParams.energyTypeId = val.energyTypeId;
|
||||
this.queryParams.indexType = val.indexType;
|
||||
this.getList();
|
||||
},
|
||||
/** 查询列表 */
|
||||
getList() {
|
||||
getEnergyOverlimitLogPage(this.queryParams).then((response) => {
|
||||
let arr = response.data.list || [];
|
||||
arr &&
|
||||
arr.map((item) => {
|
||||
this.typeList.map((i) => {
|
||||
if (item.type === i.id) {
|
||||
item.type = i.name;
|
||||
}
|
||||
});
|
||||
if (item.minValue && item.maxValue) {
|
||||
item.limitValue = item.minValue + '-' + item.maxValue;
|
||||
} else if (item.minValue) {
|
||||
item.limitValue = '最小值' + item.minValue;
|
||||
} else if (item.maxValue) {
|
||||
item.limitValue = '最大值' + item.maxValue;
|
||||
} else {
|
||||
item.limitValue = '';
|
||||
}
|
||||
});
|
||||
if (this.queryParams.method === '1') {
|
||||
this.list = arr;
|
||||
this.list2 = [];
|
||||
} else {
|
||||
this.list2 = arr;
|
||||
this.list1 = [];
|
||||
}
|
||||
this.total = response.data.total;
|
||||
});
|
||||
},
|
||||
getTypeList() {
|
||||
getEnergyTypeListAll().then((res) => {
|
||||
console.log(res);
|
||||
this.formConfig[0].selectOptions = res.data || [];
|
||||
});
|
||||
},
|
||||
toggleTab() {
|
||||
if (this.activeName === 'auto') {
|
||||
this.queryParams.method = '1';
|
||||
} else {
|
||||
this.queryParams.method = '2';
|
||||
}
|
||||
this.queryParams.pageNo = 1;
|
||||
this.getList();
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style lang='scss'>
|
||||
.energyOverlimitLog {
|
||||
.el-tabs__nav::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
height: 2px;
|
||||
background-color: #e4e7ed;
|
||||
}
|
||||
.el-tabs__nav::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
height: 2px;
|
||||
background-color: #e4e7ed;
|
||||
}
|
||||
|
||||
.el-tabs__nav-wrap::after {
|
||||
width: 0;
|
||||
}
|
||||
.el-tabs__nav-wrap::after {
|
||||
width: 0;
|
||||
}
|
||||
|
||||
.el-tabs__item {
|
||||
padding: 0 10px;
|
||||
}
|
||||
.el-tabs__item {
|
||||
padding: 0 10px;
|
||||
}
|
||||
|
||||
.el-tabs__item:hover {
|
||||
color: rgba(0, 0, 0, 0.85);
|
||||
}
|
||||
.el-tabs__item:hover {
|
||||
color: rgba(0, 0, 0, 0.85);
|
||||
}
|
||||
|
||||
.el-tabs__item.is-active {
|
||||
color: rgba(0, 0, 0, 0.85);
|
||||
}
|
||||
.el-tabs__item.is-active {
|
||||
color: rgba(0, 0, 0, 0.85);
|
||||
}
|
||||
|
||||
.el-tabs__item {
|
||||
color: rgba(0, 0, 0, 0.45);
|
||||
}
|
||||
.el-tabs__item {
|
||||
color: rgba(0, 0, 0, 0.45);
|
||||
}
|
||||
|
||||
.searchBarBox {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.searchBarBox {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -56,6 +56,7 @@ const tableProps = [
|
||||
{
|
||||
prop: 'energyType',
|
||||
label: '能源类型',
|
||||
filter: publicFormatter('energy_type'),
|
||||
},
|
||||
{
|
||||
prop: 'startNum',
|
||||
@@ -79,6 +80,7 @@ export default {
|
||||
{
|
||||
type: 'select',
|
||||
label: '能源类型',
|
||||
labelField: 'labelName',
|
||||
selectOptions: [],
|
||||
param: 'energyTypeId',
|
||||
filterable: true,
|
||||
|
||||
@@ -1,128 +1,160 @@
|
||||
<template>
|
||||
<el-form ref="form" :rules="rules" label-width="100px" :model="form">
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="方案名称" prop="name">
|
||||
<el-input v-model="form.name"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="方案编码" prop="code">
|
||||
<el-input v-model="form.code" disabled></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="统计类型" prop="type">
|
||||
<el-select v-model="form.type" placeholder="请选择" style="width: 100%;">
|
||||
<el-option
|
||||
v-for="item in getDictDatas(DICT_TYPE.STATISTIC_TYPE)"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="能源类型" prop="energyTypeId">
|
||||
<el-select v-model="form.energyTypeId" placeholder="请选择" style="width: 100%;" filterable>
|
||||
<el-option
|
||||
v-for="item in energyListType"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<el-form
|
||||
ref="form"
|
||||
:rules="rules"
|
||||
label-width="100px"
|
||||
:model="form">
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item
|
||||
label="方案名称"
|
||||
prop="name">
|
||||
<el-input v-model="form.name"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item
|
||||
label="方案编码"
|
||||
prop="code">
|
||||
<el-input
|
||||
v-model="form.code"
|
||||
disabled></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item
|
||||
label="统计类型"
|
||||
prop="type">
|
||||
<el-select
|
||||
v-model="form.type"
|
||||
placeholder="请选择"
|
||||
style="width: 100%">
|
||||
<el-option
|
||||
v-for="item in getDictDatas(DICT_TYPE.STATISTIC_TYPE)"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item
|
||||
label="能源类型"
|
||||
prop="energyTypeId">
|
||||
<el-select
|
||||
v-model="form.energyTypeId"
|
||||
placeholder="请选择"
|
||||
style="width: 100%"
|
||||
filterable>
|
||||
<el-option
|
||||
v-for="item in energyListType"
|
||||
:key="item.id"
|
||||
:label="item.labelName"
|
||||
:value="item.id"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item
|
||||
label="备注"
|
||||
prop="remark">
|
||||
<el-input v-model="form.remark"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</template>
|
||||
<script>
|
||||
import { getCode, createEnergyStatistics, updateEnergyStatistics, getEnergyStatistics } from "@/api/monitoring/energyStatistics";
|
||||
import { getEnergyTypeListAll } from '@/api/base/energyType'
|
||||
import {
|
||||
getCode,
|
||||
createEnergyStatistics,
|
||||
updateEnergyStatistics,
|
||||
getEnergyStatistics,
|
||||
} from '@/api/monitoring/energyStatistics';
|
||||
import { getEnergyTypeListAll } from '@/api/base/energyType';
|
||||
import { number } from 'echarts';
|
||||
export default {
|
||||
name: 'EnergyStatisticsAdd',
|
||||
data() {
|
||||
return {
|
||||
form: {
|
||||
id: '',
|
||||
name: '',
|
||||
code: '',
|
||||
type: '',
|
||||
energyTypeId: ''
|
||||
},
|
||||
plcList: [],
|
||||
objList: [],
|
||||
isEdit: false, //是否是编辑
|
||||
rules: {
|
||||
name: [{ required: true, message: '方案名称不能为空', trigger: 'blur' }],
|
||||
type: [{ required: true, message: '统计类型不能为空', trigger: 'change' }],
|
||||
energyTypeId: [{ required: true, message: '能源类型不能为空', trigger: 'change' }]
|
||||
},
|
||||
energyListType: [],
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init(id) {
|
||||
getEnergyTypeListAll().then((res) => {
|
||||
this.energyListType = res.data || []
|
||||
})
|
||||
if (id) {
|
||||
this.isEdit = true
|
||||
this.form.id = id
|
||||
getEnergyStatistics( id ).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.form = res.data
|
||||
this.form.type = this.form.type + ''
|
||||
}
|
||||
})
|
||||
} else {
|
||||
getCode().then((res) => {
|
||||
this.form.code = res.data
|
||||
})
|
||||
this.isEdit = false
|
||||
this.form.id = ''
|
||||
}
|
||||
},
|
||||
submitForm() {
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (valid) {
|
||||
if (this.isEdit) {
|
||||
// 编辑
|
||||
updateEnergyStatistics({...this.form}).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.$modal.msgSuccess("操作成功");
|
||||
this.$emit('successSubmit')
|
||||
}
|
||||
})
|
||||
} else {
|
||||
createEnergyStatistics({...this.form}).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.$modal.msgSuccess("操作成功");
|
||||
this.$emit('successSubmit')
|
||||
}
|
||||
})
|
||||
}
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
},
|
||||
formClear() {
|
||||
this.$refs.form.resetFields()
|
||||
this.isEdit = false
|
||||
}
|
||||
}
|
||||
}
|
||||
name: 'EnergyStatisticsAdd',
|
||||
data() {
|
||||
return {
|
||||
form: {
|
||||
id: '',
|
||||
name: '',
|
||||
code: '',
|
||||
type: '',
|
||||
energyTypeId: '',
|
||||
},
|
||||
plcList: [],
|
||||
objList: [],
|
||||
isEdit: false, //是否是编辑
|
||||
rules: {
|
||||
name: [
|
||||
{ required: true, message: '方案名称不能为空', trigger: 'blur' },
|
||||
],
|
||||
type: [
|
||||
{ required: true, message: '统计类型不能为空', trigger: 'change' },
|
||||
],
|
||||
energyTypeId: [
|
||||
{ required: true, message: '能源类型不能为空', trigger: 'change' },
|
||||
],
|
||||
},
|
||||
energyListType: [],
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
init(id) {
|
||||
getEnergyTypeListAll().then((res) => {
|
||||
this.energyListType = res.data || [];
|
||||
});
|
||||
if (id) {
|
||||
this.isEdit = true;
|
||||
this.form.id = id;
|
||||
getEnergyStatistics(id).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.form = res.data;
|
||||
this.form.type = this.form.type + '';
|
||||
}
|
||||
});
|
||||
} else {
|
||||
getCode().then((res) => {
|
||||
this.form.code = res.data;
|
||||
});
|
||||
this.isEdit = false;
|
||||
this.form.id = '';
|
||||
}
|
||||
},
|
||||
submitForm() {
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (valid) {
|
||||
if (this.isEdit) {
|
||||
// 编辑
|
||||
updateEnergyStatistics({ ...this.form }).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.$modal.msgSuccess('操作成功');
|
||||
this.$emit('successSubmit');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
createEnergyStatistics({ ...this.form }).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.$modal.msgSuccess('操作成功');
|
||||
this.$emit('successSubmit');
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
formClear() {
|
||||
this.$refs.form.resetFields();
|
||||
this.isEdit = false;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -1,222 +1,254 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
|
||||
<!-- 搜索工作栏 -->
|
||||
<search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" />
|
||||
<!-- 列表 -->
|
||||
<base-table :page="queryParams.pageNo" :limit="queryParams.pageSize" :table-props="tableProps" :table-data="list"
|
||||
:max-height="tableH">
|
||||
<method-btn v-if="tableBtn.length" slot="handleBtn" :width="160" label="操作" :method-list="tableBtn"
|
||||
@clickBtn="handleClick" />
|
||||
</base-table>
|
||||
<pagination :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" :total="total"
|
||||
@pagination="getList" />
|
||||
<!-- 新增 -->
|
||||
<base-dialog :dialogTitle="addOrEditTitle" :dialogVisible="centervisible" @cancel="handleCancel"
|
||||
@confirm="handleConfirm" :before-close="handleCancel">
|
||||
<energy-statistics-add ref="energyStatistics" @successSubmit="successSubmit" />
|
||||
</base-dialog>
|
||||
<!-- 参数绑定/查看 -->
|
||||
<energy-statistics-det ref="plcParam" @closeDrawer="closeDrawer"
|
||||
:energyTypeList="energyTypeList"></energy-statistics-det>
|
||||
</div>
|
||||
<div class="app-container">
|
||||
<!-- 搜索工作栏 -->
|
||||
<search-bar
|
||||
:formConfigs="formConfig"
|
||||
ref="searchBarForm"
|
||||
@headBtnClick="buttonClick" />
|
||||
<!-- 列表 -->
|
||||
<base-table
|
||||
:page="queryParams.pageNo"
|
||||
:limit="queryParams.pageSize"
|
||||
:table-props="tableProps"
|
||||
:table-data="list"
|
||||
:max-height="tableH">
|
||||
<method-btn
|
||||
v-if="tableBtn.length"
|
||||
slot="handleBtn"
|
||||
:width="160"
|
||||
label="操作"
|
||||
:method-list="tableBtn"
|
||||
@clickBtn="handleClick" />
|
||||
</base-table>
|
||||
<pagination
|
||||
:page.sync="queryParams.pageNo"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
:total="total"
|
||||
@pagination="getList" />
|
||||
<!-- 新增 -->
|
||||
<base-dialog
|
||||
:dialogTitle="addOrEditTitle"
|
||||
:dialogVisible="centervisible"
|
||||
@cancel="handleCancel"
|
||||
@confirm="handleConfirm"
|
||||
:before-close="handleCancel">
|
||||
<energy-statistics-add
|
||||
ref="energyStatistics"
|
||||
@successSubmit="successSubmit" />
|
||||
</base-dialog>
|
||||
<!-- 参数绑定/查看 -->
|
||||
<energy-statistics-det
|
||||
ref="plcParam"
|
||||
@closeDrawer="closeDrawer"
|
||||
:energyTypeList="energyTypeList"></energy-statistics-det>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getEnergyStatisticsPage, deleteEnergyStatistics } from "@/api/monitoring/energyStatistics";
|
||||
import { publicFormatter } from '@/utils/dict'
|
||||
import { getEnergyTypeListAll } from '@/api/base/energyType'
|
||||
import EnergyStatisticsAdd from './components/energyStatisticsAdd'
|
||||
import EnergyStatisticsDet from './components/energyStatisticsDet'
|
||||
import {
|
||||
getEnergyStatisticsPage,
|
||||
deleteEnergyStatistics,
|
||||
} from '@/api/monitoring/energyStatistics';
|
||||
import { publicFormatter } from '@/utils/dict';
|
||||
import { getEnergyTypeListAll } from '@/api/base/energyType';
|
||||
import EnergyStatisticsAdd from './components/energyStatisticsAdd';
|
||||
import EnergyStatisticsDet from './components/energyStatisticsDet';
|
||||
const tableProps = [
|
||||
{
|
||||
prop: 'name',
|
||||
label: '方案名称'
|
||||
},
|
||||
{
|
||||
prop: 'code',
|
||||
label: '方案编码',
|
||||
minWidth: 120,
|
||||
showOverflowtooltip: true
|
||||
},
|
||||
{
|
||||
prop: 'type',
|
||||
label: '统计类型',
|
||||
filter: publicFormatter('statistic_type')
|
||||
},
|
||||
{
|
||||
prop: 'energyType',
|
||||
label: '能源类型'
|
||||
},
|
||||
{
|
||||
prop: 'paramNum',
|
||||
label: '统计参数数量'
|
||||
},
|
||||
{
|
||||
prop: 'remark',
|
||||
label: '备注'
|
||||
}
|
||||
]
|
||||
{
|
||||
prop: 'name',
|
||||
label: '方案名称',
|
||||
},
|
||||
{
|
||||
prop: 'code',
|
||||
label: '方案编码',
|
||||
minWidth: 120,
|
||||
showOverflowtooltip: true,
|
||||
},
|
||||
{
|
||||
prop: 'type',
|
||||
label: '统计类型',
|
||||
filter: publicFormatter('statistic_type'),
|
||||
},
|
||||
{
|
||||
prop: 'energyType',
|
||||
label: '能源类型',
|
||||
filter: publicFormatter('energy_type'),
|
||||
},
|
||||
{
|
||||
prop: 'paramNum',
|
||||
label: '统计参数数量',
|
||||
},
|
||||
{
|
||||
prop: 'remark',
|
||||
label: '备注',
|
||||
},
|
||||
];
|
||||
export default {
|
||||
name: "EnergyStatistics",
|
||||
components: { EnergyStatisticsAdd, EnergyStatisticsDet },
|
||||
data() {
|
||||
return {
|
||||
formConfig: [
|
||||
{
|
||||
type: 'input',
|
||||
label: '方案名称',
|
||||
placeholder: '方案名称',
|
||||
param: 'name'
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
btnName: '查询',
|
||||
name: 'search',
|
||||
color: 'primary'
|
||||
},
|
||||
{
|
||||
type: 'separate'
|
||||
},
|
||||
{
|
||||
type: this.$auth.hasPermi('monitoring:energy-statistics:create') ? 'button' : '',
|
||||
btnName: '新增',
|
||||
name: 'add',
|
||||
color: 'success',
|
||||
plain: true
|
||||
}
|
||||
],
|
||||
tableProps,
|
||||
tableBtn: [
|
||||
this.$auth.hasPermi('monitoring:energy-statistics:bind')
|
||||
? {
|
||||
type: 'connect',
|
||||
btnName: '绑定'
|
||||
}
|
||||
: undefined,
|
||||
{
|
||||
type: 'detail',
|
||||
btnName: '详情'
|
||||
},
|
||||
this.$auth.hasPermi('monitoring:energy-statistics:update')
|
||||
? {
|
||||
type: 'edit',
|
||||
btnName: '编辑'
|
||||
}
|
||||
: undefined,
|
||||
this.$auth.hasPermi('monitoring:energy-statistics:delete')
|
||||
? {
|
||||
type: 'delete',
|
||||
btnName: '删除'
|
||||
}
|
||||
: undefined
|
||||
].filter((v) => v),
|
||||
tableH: this.tableHeight(260),
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 班次基础信息列表
|
||||
list: [],
|
||||
// 弹出层标题
|
||||
addOrEditTitle: "",
|
||||
// 是否显示弹出层
|
||||
centervisible: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNo: 1,
|
||||
pageSize: 20,
|
||||
name: null
|
||||
},
|
||||
energyTypeList: []
|
||||
};
|
||||
},
|
||||
created() {
|
||||
window.addEventListener('resize', () => {
|
||||
this.tableH = this.tableHeight(260)
|
||||
})
|
||||
this.getList();
|
||||
},
|
||||
mounted() {
|
||||
// 获取能源列表
|
||||
this.getEnergyTypeList()
|
||||
},
|
||||
methods: {
|
||||
buttonClick(val) {
|
||||
switch (val.btnName) {
|
||||
case 'search':
|
||||
this.queryParams.pageNo = 1;
|
||||
this.queryParams.name = val.name
|
||||
this.getList()
|
||||
break
|
||||
default:
|
||||
this.addOrEditTitle = '新增'
|
||||
this.centervisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.energyStatistics.init()
|
||||
})
|
||||
}
|
||||
},
|
||||
/** 查询列表 */
|
||||
getList() {
|
||||
getEnergyStatisticsPage(this.queryParams).then(response => {
|
||||
let arr = response.data.list || [];
|
||||
this.list = arr
|
||||
this.total = response.data.total;
|
||||
});
|
||||
},
|
||||
handleClick(val) {
|
||||
console.log(val)
|
||||
switch (val.type) {
|
||||
case 'edit':
|
||||
this.addOrEditTitle = '编辑'
|
||||
this.$nextTick(() => {
|
||||
this.$refs.energyStatistics.init(val.data.id)
|
||||
})
|
||||
this.centervisible = true
|
||||
break
|
||||
case 'delete':
|
||||
this.handleDelete(val.data)
|
||||
break
|
||||
case 'detail':
|
||||
this.$nextTick(() => {
|
||||
this.$refs.plcParam.init(val.data, 'detail')
|
||||
})
|
||||
break
|
||||
default:
|
||||
this.$nextTick(() => {
|
||||
this.$refs.plcParam.init(val.data, 'connect')
|
||||
})
|
||||
}
|
||||
},
|
||||
handleCancel() {
|
||||
this.$refs.energyStatistics.formClear()
|
||||
this.centervisible = false
|
||||
this.addOrEditTitle = ''
|
||||
},
|
||||
handleConfirm() {
|
||||
this.$refs.energyStatistics.submitForm()
|
||||
},
|
||||
successSubmit() {
|
||||
this.handleCancel()
|
||||
this.getList()
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
this.$modal.confirm('是否确认删除方案名称为"' + row.name + '"的数据项?').then(function () {
|
||||
return deleteEnergyStatistics(row.id);
|
||||
}).then(() => {
|
||||
this.queryParams.pageNo = 1;
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => { });
|
||||
},
|
||||
closeDrawer() {
|
||||
this.getList()
|
||||
},
|
||||
getEnergyTypeList() {
|
||||
getEnergyTypeListAll().then((res) => {
|
||||
this.energyTypeList = res.data || []
|
||||
})
|
||||
}
|
||||
}
|
||||
name: 'EnergyStatistics',
|
||||
components: { EnergyStatisticsAdd, EnergyStatisticsDet },
|
||||
data() {
|
||||
return {
|
||||
formConfig: [
|
||||
{
|
||||
type: 'input',
|
||||
label: '方案名称',
|
||||
placeholder: '方案名称',
|
||||
param: 'name',
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
btnName: '查询',
|
||||
name: 'search',
|
||||
color: 'primary',
|
||||
},
|
||||
{
|
||||
type: 'separate',
|
||||
},
|
||||
{
|
||||
type: this.$auth.hasPermi('monitoring:energy-statistics:create')
|
||||
? 'button'
|
||||
: '',
|
||||
btnName: '新增',
|
||||
name: 'add',
|
||||
color: 'success',
|
||||
plain: true,
|
||||
},
|
||||
],
|
||||
tableProps,
|
||||
tableBtn: [
|
||||
this.$auth.hasPermi('monitoring:energy-statistics:bind')
|
||||
? {
|
||||
type: 'connect',
|
||||
btnName: '绑定',
|
||||
}
|
||||
: undefined,
|
||||
{
|
||||
type: 'detail',
|
||||
btnName: '详情',
|
||||
},
|
||||
this.$auth.hasPermi('monitoring:energy-statistics:update')
|
||||
? {
|
||||
type: 'edit',
|
||||
btnName: '编辑',
|
||||
}
|
||||
: undefined,
|
||||
this.$auth.hasPermi('monitoring:energy-statistics:delete')
|
||||
? {
|
||||
type: 'delete',
|
||||
btnName: '删除',
|
||||
}
|
||||
: undefined,
|
||||
].filter((v) => v),
|
||||
tableH: this.tableHeight(260),
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 班次基础信息列表
|
||||
list: [],
|
||||
// 弹出层标题
|
||||
addOrEditTitle: '',
|
||||
// 是否显示弹出层
|
||||
centervisible: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNo: 1,
|
||||
pageSize: 20,
|
||||
name: null,
|
||||
},
|
||||
energyTypeList: [],
|
||||
};
|
||||
},
|
||||
created() {
|
||||
window.addEventListener('resize', () => {
|
||||
this.tableH = this.tableHeight(260);
|
||||
});
|
||||
this.getList();
|
||||
},
|
||||
mounted() {
|
||||
// 获取能源列表
|
||||
this.getEnergyTypeList();
|
||||
},
|
||||
methods: {
|
||||
buttonClick(val) {
|
||||
switch (val.btnName) {
|
||||
case 'search':
|
||||
this.queryParams.pageNo = 1;
|
||||
this.queryParams.name = val.name;
|
||||
this.getList();
|
||||
break;
|
||||
default:
|
||||
this.addOrEditTitle = '新增';
|
||||
this.centervisible = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs.energyStatistics.init();
|
||||
});
|
||||
}
|
||||
},
|
||||
/** 查询列表 */
|
||||
getList() {
|
||||
getEnergyStatisticsPage(this.queryParams).then((response) => {
|
||||
let arr = response.data.list || [];
|
||||
this.list = arr;
|
||||
this.total = response.data.total;
|
||||
});
|
||||
},
|
||||
handleClick(val) {
|
||||
console.log(val);
|
||||
switch (val.type) {
|
||||
case 'edit':
|
||||
this.addOrEditTitle = '编辑';
|
||||
this.$nextTick(() => {
|
||||
this.$refs.energyStatistics.init(val.data.id);
|
||||
});
|
||||
this.centervisible = true;
|
||||
break;
|
||||
case 'delete':
|
||||
this.handleDelete(val.data);
|
||||
break;
|
||||
case 'detail':
|
||||
this.$nextTick(() => {
|
||||
this.$refs.plcParam.init(val.data, 'detail');
|
||||
});
|
||||
break;
|
||||
default:
|
||||
this.$nextTick(() => {
|
||||
this.$refs.plcParam.init(val.data, 'connect');
|
||||
});
|
||||
}
|
||||
},
|
||||
handleCancel() {
|
||||
this.$refs.energyStatistics.formClear();
|
||||
this.centervisible = false;
|
||||
this.addOrEditTitle = '';
|
||||
},
|
||||
handleConfirm() {
|
||||
this.$refs.energyStatistics.submitForm();
|
||||
},
|
||||
successSubmit() {
|
||||
this.handleCancel();
|
||||
this.getList();
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
this.$modal
|
||||
.confirm('是否确认删除方案名称为"' + row.name + '"的数据项?')
|
||||
.then(function () {
|
||||
return deleteEnergyStatistics(row.id);
|
||||
})
|
||||
.then(() => {
|
||||
this.queryParams.pageNo = 1;
|
||||
this.getList();
|
||||
this.$modal.msgSuccess('删除成功');
|
||||
})
|
||||
.catch(() => {});
|
||||
},
|
||||
closeDrawer() {
|
||||
this.getList();
|
||||
},
|
||||
getEnergyTypeList() {
|
||||
getEnergyTypeListAll().then((res) => {
|
||||
this.energyTypeList = res.data || [];
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user