能源分析

This commit is contained in:
2023-09-05 15:45:59 +08:00
parent 01fe2da523
commit 9c59a7e715
29 changed files with 2203 additions and 100 deletions

View File

@@ -27,12 +27,12 @@
</el-select>
</el-form-item>
<el-form-item label="监控详细参数" prop="plcParamId" v-if="form.type === 2">
<el-select v-model="form.plcParamId" placeholder="请选择" style="width: 100%;">
<el-select v-model="form.plcParamId" placeholder="请选择" style="width: 100%;" @change="selectDetail">
<el-option
v-for="item in getDictDatas(DICT_TYPE.ENERGY_UNIT)"
:key="item.value"
:label="item.label"
:value="item.value">
v-for="item in detailList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
@@ -52,7 +52,7 @@
</el-form>
</template>
<script>
import { getEnergyLimit, updateEnergyLimit, createEnergyLimit } from '@/api/monitoring/energyLimit'
import { getEnergyLimit, updateEnergyLimit, createEnergyLimit, getEnergyParamList } from '@/api/monitoring/energyLimit'
export default {
name: 'energyLimitAdd',
props: {
@@ -73,6 +73,8 @@ export default {
form: {
id: '',
objectId: '',
objectType: '',
energyTypeId: '',
type: '',
plcParamId: '',
limitType: '',
@@ -84,7 +86,8 @@ export default {
objectId: [{ required: true, message: '对象不能为空', trigger: 'change' }],
energyTypeId: [{ required: true, message: '能源类型不能为空', trigger: 'change' }],
type: [{ required: true, message: '监控模式不能为空', trigger: 'change' }]
}
},
detailList: []
}
},
methods: {
@@ -95,10 +98,12 @@ export default {
getEnergyLimit( id ).then((res) => {
if (res.code === 0) {
this.form = res.data
this.form.plcParamId = res.data.plcParamId || ''
this.form.limitType = this.form.limitType + ''
console.log(this.objList)
this.objIds = this.changeDetSelect(this.form.objectId, this.objList)
console.log(this.objIds)
if (this.form.type === 2) {
this.getDetailList()
}
}
})
} else {
@@ -106,8 +111,25 @@ export default {
this.form.id = ''
}
},
typeChange() {
// 监控详细参数
getDetailList() {
getEnergyParamList({
objId: this.form.objectId,
energyTypeId: this.form.energyTypeId
}).then((res) => {
if (res.code === 0) {
this.detailList = res.data
} else {
this.detailList = []
}
})
},
typeChange(val) {
console.log(this.form)
this.form.plcParamId = ''
if (val === 2) {
this.getDetailList()
}
},
// 递归处理分类回显问题
changeDetSelect(key, treeData) {
@@ -137,9 +159,16 @@ export default {
this.form.objectId = val[val.length-1]
this.form.objectType = val.length-1
},
selectDetail() {
this.$forceUpdate()
},
submitForm() {
this.$refs['form'].validate((valid) => {
if (valid) {
if (this.form.type === 2 && !this.form.plcParamId) {
this.$modal.msgError("监控模式为详细时,详细参数为必填");
return false
}
// this.form.limitType = Number(this.form.limitType)
if (this.isEdit) {
// 编辑
@@ -164,6 +193,8 @@ export default {
},
formClear() {
this.$refs.form.resetFields()
this.objIds = ''
this.detailList = []
this.isEdit = false
}
}

View File

@@ -231,7 +231,7 @@ export default {
},
/** 删除按钮操作 */
handleDelete(row) {
this.$modal.confirm('是否确认删除监控参数为"' + row.plcParamName + '"的数据项?').then(function() {
this.$modal.confirm('是否确认删除监控对象为"' + row.objName + '"的数据项?').then(function() {
return deleteEnergyLimit(row.id);
}).then(() => {
this.queryParams.pageNo = 1;

View File

@@ -25,11 +25,10 @@
</template>
<script>
import { energyReportPageAuto, energyReportPageExportAuto } from "@/api/monitoring/energyReport";
import { parseTime } from '@/utils/ruoyi'
import { energyReportPageAuto, energyReportPageExportAuto } from "@/api/monitoring/energyReport"
import { getEnergyTypeListAll } from "@/api/base/energyType";
// import { getTree } from '@/api/base/factory'
import { publicFormatter } from '@/utils/dict'
import { parseTime } from '@/utils/ruoyi'
const tableProps = [
{
prop: 'statisticType',
@@ -70,7 +69,7 @@ const tableProps = [
}
]
export default {
name: "EnergyReportSearch",
name: "EnergyLimit",
data() {
return {
formConfig: [
@@ -78,7 +77,8 @@ export default {
type: 'select',
label: '能源类型',
selectOptions: [],
param: 'energyTypeId'
param: 'energyTypeId',
filterable: true
},
{
type: 'select',
@@ -93,7 +93,7 @@ export default {
label: '时间',
dateType: 'datetimerange',
format: 'yyyy-MM-dd HH:mm:ss',
valueFormat: "yyyy-MM-ddTHH:mm:ss",
valueFormat: "timestamp",
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
@@ -111,7 +111,7 @@ export default {
type: 'separate'
},
{
type: this.$auth.hasPermi('monitoring:energy-limit:create') ? 'button' : '',
type: this.$auth.hasPermi('monitoring:energy-report:export') ? 'button' : '',
btnName: '导出',
name: 'add',
color: 'primary',
@@ -129,23 +129,17 @@ export default {
pageNo: 1,
pageSize: 20,
energyTypeId: null,
statisticType: null,
startTime: null,
endTime: null,
statisticType: null
},
energyTypeList: [],
typeList: [
{label: '合并', value: '1'},
{label: '详细', value: '2'}
],
objList: []
endTime: null
}
};
},
created() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260)
})
this.getList();
this.getList()
this.getTypeList()
},
methods: {
@@ -158,33 +152,25 @@ export default {
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.queryParams.pageNo = 1;
this.queryParams.pageNo = 1
this.queryParams.energyTypeId = val.energyTypeId
this.queryParams.statisticType = val.statisticType
this.queryParams.startTime = val.timeVal ? val.timeVal[0] : nul
this.queryParams.endTime = val.timeVal ? val.timeVal[1] : nul
this.queryParams.startTime = val.timeVal ? val.timeVal[0] : null
this.queryParams.endTime = val.timeVal ? val.timeVal[1] : null
this.getList()
break
default:
this.addOrEditTitle = '新增'
this.centervisible = true
this.$nextTick(() => {
this.$refs.energyLimit.init()
})
this.$modal.confirm('是否确认导出').then(() => {
return energyReportPageExportAuto({...this.queryParams});
}).then(response => {
this.$download.excel(response, '能源统计报表.xls');
}).catch(() => {})
}
},
/** 查询列表 */
getList() {
energyReportPageAuto({...this.queryParams}).then(response => {
let arr = response.data.list || [];
// arr&&arr.map(item => {
// this.typeList.map(i => {
// if (item.type === i.value) {
// item.type = i.label
// }
// })
// })
this.list = arr
energyReportPageAuto(this.queryParams).then(response => {
this.list = response.data.list || [];
this.total = response.data.total;
});
}

View File

@@ -26,7 +26,7 @@
<script>
import { energyReportPage, energyReportPageExport } from "@/api/monitoring/energyReport";
// import { publicFormatter } from '@/utils/dict'
import { getEnergyTypeListAll } from "@/api/base/energyType"
const tableProps = [
{
prop: 'statisticName',
@@ -59,18 +59,26 @@ export default {
label: '统计方案',
param: 'statisticName'
},
{
type: 'select',
label: '能源类型',
selectOptions: [],
param: 'energyTypeId',
filterable: true
},
{
type: 'datePicker',
label: '时间',
label: '时间(必填)',
dateType: 'datetimerange',
format: 'yyyy-MM-dd HH:mm:ss',
valueFormat: "yyyy-MM-ddTHH:mm:ss",
valueFormat: "timestamp",
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'timeVal',
defaultSelect: [],
width: 350
width: 350,
clearable: false
},
{
type: 'button',
@@ -82,7 +90,7 @@ export default {
type: 'separate'
},
{
type: this.$auth.hasPermi('monitoring:energy-limit:create') ? 'button' : '',
type: this.$auth.hasPermi('monitoring:energy-report-search:export') ? 'button' : '',
btnName: '导出',
name: 'add',
color: 'primary',
@@ -103,65 +111,49 @@ export default {
startTime: null,
endTime: null
},
energyTypeList: [],
typeList: [
{label: '合并', value: '1'},
{label: '详细', value: '2'}
],
objList: []
energyTypeList: []
};
},
created() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260)
})
this.getList();
this.formConfig[2].defaultSelect = [Date.now() - 7*24*3600000, Date.now()]
this.queryParams.startTime = this.formConfig[2].defaultSelect[0]
this.queryParams.endTime = this.formConfig[2].defaultSelect[1]
this.getList()
this.getTypeList()
},
methods: {
getTypeList() {
getEnergyTypeListAll().then((res) => {
this.formConfig[1].selectOptions = res.data || []
})
},
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.queryParams.pageNo = 1;
this.queryParams.pageNo = 1
this.queryParams.statisticName = val.statisticName
this.queryParams.startTime = val.timeVal ? val.timeVal[0] : nul
this.queryParams.endTime = val.timeVal ? val.timeVal[1] : nul
this.queryParams.energyTypeId = val.energyTypeId
this.queryParams.startTime = val.timeVal ? val.timeVal[0] : null
this.queryParams.endTime = val.timeVal ? val.timeVal[1] : null
this.getList()
break
default:
this.addOrEditTitle = '新增'
this.centervisible = true
this.$nextTick(() => {
this.$refs.energyLimit.init()
})
this.$modal.confirm('是否确认导出').then(() => {
return energyReportPageExport({...this.queryParams});
}).then(response => {
this.$download.excel(response, '能源统计查询报表.xls');
}).catch(() => {})
}
},
/** 查询列表 */
getList() {
energyReportPage({...this.queryParams}).then(response => {
let arr = response.data.list || [];
// arr&&arr.map(item => {
// this.typeList.map(i => {
// if (item.type === i.value) {
// item.type = i.label
// }
// })
// })
this.list = arr
this.list = response.data.list || [];
this.total = response.data.total;
});
},
handleClick(val) {
switch (val.type) {
case 'edit':
this.addOrEditTitle = '编辑'
this.$nextTick(() => {
this.$refs.energyLimit.init(val.data.id)
})
this.centervisible = true
break
default:
this.handleDelete(val.data)
}
}
}
};

View File

@@ -53,6 +53,10 @@ const tableProps = [
prop: 'objName',
label: '所属对象'
},
{
prop: 'objRemark',
label: '对象备注'
},
{
prop: 'paramName',
label: '参数名称'

View File

@@ -40,6 +40,10 @@ const tableProps = [
prop: 'objName',
label: '所属对象'
},
{
prop: 'objRemark',
label: '对象备注'
},
{
prop: 'paramName',
label: '参数名称'