Merge pull request '能源配置&能源抄表' (#14) from zjl into test

Reviewed-on: #14
This commit is contained in:
朱菊兰 2023-08-21 11:14:03 +08:00
bovenliggende c466cbb378 6e39dd48ff
commit d370948705
22 gewijzigde bestanden met toevoegingen van 2416 en 6 verwijderingen

70
src/api/base/energyPlc.js Normal file
Bestand weergeven

@ -0,0 +1,70 @@
import request from '@/utils/request'
// 创建能源实时数据库plc相关
export function createEnergyPlc(data) {
return request({
url: '/base/energy-plc/create',
method: 'post',
data: data
})
}
// 更新能源实时数据库plc相关
export function updateEnergyPlc(data) {
return request({
url: '/base/energy-plc/update',
method: 'put',
data: data
})
}
// 删除能源实时数据库plc相关
export function deleteEnergyPlc(id) {
return request({
url: '/base/energy-plc/delete?id=' + id,
method: 'delete'
})
}
// 获得能源实时数据库plc相关
export function getEnergyPlc(id) {
return request({
url: '/base/energy-plc/get?id=' + id,
method: 'get'
})
}
// 获得实时数据表列表(所有)
export function getEnergyPlcAll() {
return request({
url: '/base/energy-plc/listAll',
method: 'get'
})
}
// 获取关联表编码
export function getCode() {
return request({
url: '/base/energy-plc/getCode',
method: 'get'
})
}
// 获得能源实时数据库plc相关分页
export function getEnergyPlcPage(data) {
return request({
url: '/base/energy-plc/page',
method: 'post',
data: data
})
}
// 导出能源实时数据库plc相关 Excel
export function exportEnergyPlcExcel(query) {
return request({
url: '/base/energy-plc/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}

Bestand weergeven

@ -0,0 +1,54 @@
import request from '@/utils/request'
// 创建能源与对象的关联关系(一对多)
export function createEnergyPlcConnect(data) {
return request({
url: '/base/energy-plc-connect/create',
method: 'post',
data: data
})
}
// 更新能源与对象的关联关系(一对多)
export function updateEnergyPlcConnect(data) {
return request({
url: '/base/energy-plc-connect/update',
method: 'put',
data: data
})
}
// 删除能源与对象的关联关系(一对多)
export function deleteEnergyPlcConnect(id) {
return request({
url: '/base/energy-plc-connect/delete?id=' + id,
method: 'delete'
})
}
// 获得能源与对象的关联关系(一对多)
export function getEnergyPlcConnect(id) {
return request({
url: '/base/energy-plc-connect/get?id=' + id,
method: 'get'
})
}
// 获得能源与对象的关联关系(一对多)分页
export function getEnergyPlcConnectPage(data) {
return request({
url: '/base/energy-plc-connect/page',
method: 'post',
data: data
})
}
// 导出能源与对象的关联关系(一对多) Excel
export function exportEnergyPlcConnectExcel(query) {
return request({
url: '/base/energy-plc-connect/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}

Bestand weergeven

@ -0,0 +1,54 @@
import request from '@/utils/request'
// 创建能源plc详细点
export function createEnergyPlcParam(data) {
return request({
url: '/base/energy-plc-param/create',
method: 'post',
data: data
})
}
// 更新能源plc详细点
export function updateEnergyPlcParam(data) {
return request({
url: '/base/energy-plc-param/update',
method: 'put',
data: data
})
}
// 删除能源plc详细点
export function deleteEnergyPlcParam(id) {
return request({
url: '/base/energy-plc-param/delete?id=' + id,
method: 'delete'
})
}
// 获得能源plc详细点
export function getEnergyPlcParam(id) {
return request({
url: '/base/energy-plc-param/get?id=' + id,
method: 'get'
})
}
// 获得能源plc详细点分页
export function getEnergyPlcParamPage(data) {
return request({
url: '/base/energy-plc-param/page',
method: 'post',
data: data
})
}
// 导出能源plc详细点 Excel
export function exportEnergyPlcParamExcel(query) {
return request({
url: '/base/energy-plc-param/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}

Bestand weergeven

@ -0,0 +1,54 @@
import request from '@/utils/request'
// 创建后端统计 能源抄表 实时
export function createEnergyQuantityRealtime(data) {
return request({
url: '/base/energy-quantity-realtime/create',
method: 'post',
data: data
})
}
// 更新后端统计 能源抄表 实时
export function updateEnergyQuantityRealtime(data) {
return request({
url: '/base/energy-quantity-realtime/update',
method: 'put',
data: data
})
}
// 删除后端统计 能源抄表 实时
export function deleteEnergyQuantityRealtime(id) {
return request({
url: '/base/energy-quantity-realtime/delete?id=' + id,
method: 'delete'
})
}
// 获得后端统计 能源抄表 实时
export function getEnergyQuantityRealtime(id) {
return request({
url: '/base/energy-quantity-realtime/get?id=' + id,
method: 'get'
})
}
// 获得后端统计 能源抄表 实时分页
export function getEnergyQuantityRealtimePage(data) {
return request({
url: '/base/energy-quantity-realtime/page',
method: 'post',
data: data
})
}
// 导出后端统计 能源抄表 实时 Excel
export function exportEnergyQuantityRealtimeExcel(query) {
return request({
url: '/base/energy-quantity-realtime/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}

Bestand weergeven

@ -43,6 +43,14 @@ export function getEnergyTypePage(data) {
})
}
// 获得能源类型列表(获取所有)
export function getEnergyTypeListAll() {
return request({
url: '/base/energy-type/listAll',
method: 'get'
})
}
// 获得能源类型编码
export function getEnergyTypeCode() {
return request({

Bestand weergeven

@ -0,0 +1,63 @@
import request from '@/utils/request'
// 创建能源监控配置
export function createEnergyLimit(data) {
return request({
url: '/monitoring/energy-limit/create',
method: 'post',
data: data
})
}
// 更新能源监控配置
export function updateEnergyLimit(data) {
return request({
url: '/monitoring/energy-limit/update',
method: 'put',
data: data
})
}
// 删除能源监控配置
export function deleteEnergyLimit(id) {
return request({
url: '/monitoring/energy-limit/delete?id=' + id,
method: 'delete'
})
}
// 获得能源监控配置
export function getEnergyLimit(id) {
return request({
url: '/monitoring/energy-limit/get?id=' + id,
method: 'get'
})
}
// 获得能源监控配置分页
export function getEnergyLimitPage(data) {
return request({
url: '/monitoring/energy-limit/page',
method: 'post',
data: data
})
}
// 导出能源监控配置 Excel
export function exportEnergyLimitExcel(query) {
return request({
url: '/monitoring/energy-limit/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}
// 获取详细参数列表
export function getEnergyParamList(data) {
return request({
url: '/monitoring/energy-limit/listParam',
method: 'post',
data: data
})
}

Bestand weergeven

@ -175,4 +175,24 @@ input, textarea{
::-webkit-scrollbar-thumb:hover {
background-color: rgba(144,147,153,.3);
}
}
// 抽屉head区域---start
.el-drawer__header {
padding-bottom: 20px;
margin-bottom: 23px;
font-size: 20px;
font-weight: 500;
color: rgba(0,0,0,0.85);
border-bottom: 1px solid rgba(233, 233, 233, 1);
}
.el-drawer__header > :first-child::before {
content: '';
display: inline-block;
width: 4px;
height: 24px;
background-color: #0b58ff;
margin-right: 8px;
vertical-align: middle;
}
// 抽屉head区域---end

Bestand weergeven

@ -0,0 +1,116 @@
<template>
<el-form ref="form" :rules="rules" label-width="100px" :model="form">
<el-row>
<el-col :span="12">
<el-form-item label="关联表名" prop="plcTableName">
<el-input v-model="form.plcTableName"></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="name">
<el-input v-model="form.name"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="英文标识名" prop="enName">
<el-input v-model="form.enName"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="描述" prop="description">
<el-input v-model="form.description"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="是否采集" prop="collection">
<el-switch v-model="form.collection"></el-switch>
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
import { getEnergyPlc, updateEnergyPlc, createEnergyPlc, getCode } from '@/api/base/energyPlc'
export default {
name: 'energyPlcAdd',
data() {
return {
form: {
id: '',
plcTableName: '',
code: '',
name: '',
enName: '',
description: '',
collection: true
},
isEdit: false, //
rules: {
plcTableName: [{ required: true, message: '关联表名不能为空', trigger: 'blur' }],
code: [{ required: true, message: '关联表编码不能为空', trigger: 'blur' }],
name: [{ required: true, message: '标识名称不能为空', trigger: 'blur' }]
}
}
},
methods: {
init(id) {
if (id) {
this.isEdit = true
this.form.id = id
getEnergyPlc( id ).then((res) => {
if (res.code === 0) {
this.form = res.data
this.form.collection = this.form.collection === 0 ? false : true
}
})
} else {
this.isEdit = false
this.form.id = ''
getCode().then((res) => {
this.form.code = res.data
})
}
},
submitForm() {
this.$refs['form'].validate((valid) => {
if (valid) {
this.form.collection = this.form.collection === false ? 0 : 1
if (this.isEdit) {
//
updateEnergyPlc({...this.form}).then((res) => {
if (res.code === 0) {
this.$modal.msgSuccess("操作成功");
this.$emit('successSubmit')
}
})
} else {
createEnergyPlc({...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>

Bestand weergeven

@ -0,0 +1,218 @@
<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="80"
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-plc-add ref="energyPlc" @successSubmit="successSubmit" />
</base-dialog>
</div>
</template>
<script>
import { getEnergyPlcPage, deleteEnergyPlc } from "@/api/base/energyPlc";
// import { publicFormatter } from '@/utils/dict'
import EnergyPlcAdd from './components/energyPlcAdd.vue'
const tableProps = [
{
prop: 'plcTableName',
label: '关联表名'
},
{
prop: 'code',
label: '关联表编码',
minWidth: 150,
showOverflowtooltip: true
},
{
prop: 'name',
label: '标识名'
},
{
prop: 'enName',
label: '英文标识名'
},
{
prop: 'collection',
label: '是否采集'
},
{
prop: 'description',
label: '描述',
showOverflowtooltip: true
}
]
export default {
name: "EnergyPlc",
components: { EnergyPlcAdd },
data() {
return {
formConfig: [
{
type: 'input',
label: '标识名',
placeholder: '标识名',
param: 'name'
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary'
},
{
type: 'separate'
},
{
type: this.$auth.hasPermi('base:energy-plc:create') ? 'button' : '',
btnName: '新增',
name: 'add',
color: 'success',
plain: true
}
],
tableProps,
tableBtn: [
this.$auth.hasPermi('base:energy-plc:update')
? {
type: 'edit',
btnName: '编辑'
}
: undefined,
this.$auth.hasPermi('base:energy-plc:delete')
? {
type: 'delete',
btnName: '删除'
}
: undefined
].filter((v) => v),
tableH: this.tableHeight(260),
collectionList: [
{value: 0,label: '否'},
{value: 1,label: '是'}
],
//
total: 0,
//
list: [],
//
addOrEditTitle: "",
//
centervisible: false,
//
queryParams: {
pageNo: 1,
pageSize: 20,
name: null
}
};
},
created() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260)
})
this.getList();
},
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.energyPlc.init()
})
}
},
/** 查询列表 */
getList() {
getEnergyPlcPage(this.queryParams).then(response => {
let arr = response.data.list || [];
arr&&arr.map(item => {
this.collectionList.map(i => {
if (item.collection === i.value) {
item.collection = i.label
}
})
})
this.list = arr
this.total = response.data.total;
});
},
handleClick(val) {
switch (val.type) {
case 'edit':
this.addOrEditTitle = '编辑'
this.$nextTick(() => {
this.$refs.energyPlc.init(val.data.id)
})
this.centervisible = true
break
default:
this.handleDelete(val.data)
}
},
handleCancel() {
this.$refs.energyPlc.formClear()
this.centervisible = false
this.addOrEditTitle = ''
},
handleConfirm() {
this.$refs.energyPlc.submitForm()
},
successSubmit() {
this.handleCancel()
this.getList()
},
/** 删除按钮操作 */
handleDelete(row) {
this.$modal.confirm('是否确认删除关联表名为"' + row.name + '"的数据项?').then(function() {
return deleteEnergyPlc(row.id);
}).then(() => {
this.queryParams.pageNo = 1;
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
}
}
};
</script>

Bestand weergeven

@ -0,0 +1,96 @@
<template>
<el-form ref="form" :rules="rules" label-width="100px" :model="form">
<el-row>
<el-col :span="12">
<el-form-item label="关联表名" prop="plcId">
<el-select v-model="form.plcId" placeholder="请选择" style="width: 100%;">
<el-option
v-for="item in plcList"
:key="item.id"
:label="item.plcTableName"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="对象" prop="code">
<el-input v-model="form.code"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
import { getEnergyPlcConnect, updateEnergyPlcConnect, createEnergyPlcConnect } from '@/api/base/energyPlcConnect'
import { getEnergyPlcAll } from '@/api/base/energyPlc'
export default {
name: 'EnergyPlcConnectAdd',
data() {
return {
form: {
id: '',
plcId: '',
bindObjectId: '',
bindObjectType: ''
},
plcList: [],
isEdit: false, //
rules: {
plcTableName: [{ required: true, message: '关联表名不能为空', trigger: 'blur' }],
code: [{ required: true, message: '关联表编码不能为空', trigger: 'blur' }],
name: [{ required: true, message: '标识名称不能为空', trigger: 'blur' }]
}
}
},
methods: {
init(id) {
getEnergyPlcAll().then((res) => {
this.plcList = res.data || []
})
if (id) {
this.isEdit = true
this.form.id = id
getEnergyPlcConnect( id ).then((res) => {
if (res.code === 0) {
this.form = res.data
this.form.collection = this.form.collection === 0 ? false : true
}
})
} else {
this.isEdit = false
this.form.id = ''
}
},
submitForm() {
this.$refs['form'].validate((valid) => {
if (valid) {
this.form.collection = this.form.collection === false ? 0 : 1
if (this.isEdit) {
//
updateEnergyPlcConnect({...this.form}).then((res) => {
if (res.code === 0) {
this.$modal.msgSuccess("操作成功");
this.$emit('successSubmit')
}
})
} else {
createEnergyPlcConnect({...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>

Bestand weergeven

@ -0,0 +1,227 @@
<template>
<div>
<el-drawer title="参数绑定" :visible.sync="visible" size="70%" @close='closeD'>
<div class="box">
<el-form :inline="true">
<el-form-item label="关联表名">
<el-input v-model="plcTableName" size='small' readonly></el-input>
</el-form-item>
<el-form-item label="对象">
<el-input v-model="bindObjectType" size='small' readonly></el-input>
</el-form-item>
<el-form-item v-if="showBtn&&this.$auth.hasPermi('base:energy-plc-param:create')">
<el-button type="success" size='small' plain @click="addNew">新增</el-button>
</el-form-item>
</el-form>
<base-table
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-props="tableProps"
:table-data="tableData"
:max-height="tableH"
>
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="100"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
<pagination
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
:total="total"
@pagination="getList"
/>
</div>
</el-drawer>
<!-- 新增 -->
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="centervisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
>
<energy-plc-param-add ref="energyPlcParam" @successSubmit="successSubmit" />
</base-dialog>
</div>
</template>
<script>
import { getEnergyPlcParamPage, deleteEnergyPlcParam } from '@/api/base/energyPlcParam'
import EnergyPlcParamAdd from './energyPlcParamAdd'
import { publicFormatter } from '@/utils/dict'
const tableProps = [
{
prop: 'typeId',
label: '能源类型'
},
{
prop: 'plcParamName',
label: '参数列名'
},
{
prop: 'name',
label: '参数名称'
},
{
prop: 'unit',
label: '单位',
filter: publicFormatter('energy_unit')
},
{
prop: 'collection',
label: '是否采集'
},
{
prop: 'description',
label: '描述'
}
]
export default {
name: 'EnergyPlcParam',
props: {
energyTypeList: {
type: Array,
required: true,
default: () => {
return []
}
}
},
data() {
return {
visible: false,
tableProps,
tableData: [],
tableBtn: [],
tableH: this.tableHeight(115),
total: 0,
queryParams: {
pageNo: 1,
pageSize: 30,
connectId: null
},
plcTableName: '',
bindObjectType: '',
//
addOrEditTitle: "",
//
centervisible: false,
collectionList: [
{value: 0,label: '否'},
{value: 1,label: '是'}
],
showBtn: true
}
},
components: { EnergyPlcParamAdd },
created() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(115)
})
},
methods: {
init(data,title) {
this.visible = true
this.queryParams.connectId = data.id
this.plcTableName = data.plcTableName
this.bindObjectType = data.bindObjectType
this.getList()
if (title === 'view') {
this.showBtn = false
this.tableBtn = []
} else {
this.showBtn = true
this.tableBtn = [
this.$auth.hasPermi('base:energy-plc-param:update')
? {
type: 'edit',
btnName: '编辑'
}
: undefined,
this.$auth.hasPermi('base:energy-plc-param:delete')
? {
type: 'delete',
btnName: '删除'
}
: undefined
].filter((v) => v)
}
},
getList() {
getEnergyPlcParamPage({...this.queryParams}).then((res) => {
let arr = res.data.list || []
arr&&arr.map(item => {
this.collectionList.map(i => {
if (item.collection === i.value) {
item.collection = i.label
}
})
this.energyTypeList.map(j => {
if (item.typeId === j.id) {
item.typeId = j.name
}
})
})
this.tableData = arr
this.total = res.data.total;
})
},
//
addNew() {
this.addOrEditTitle = '新增'
this.centervisible = true
this.$nextTick(() => {
this.$refs.energyPlcParam.init({'connectId': this.queryParams.connectId, id: ''})
})
},
handleCancel() {
this.$refs.energyPlcParam.formClear()
this.centervisible = false
this.addOrEditTitle = ''
},
handleConfirm() {
this.$refs.energyPlcParam.submitForm()
},
successSubmit() {
this.handleCancel()
this.getList()
},
handleClick(val) {
console.log(val)
switch (val.type) {
case 'edit':
this.addOrEditTitle = '编辑'
this.centervisible = true
this.$nextTick(() => {
this.$refs.energyPlcParam.init({'connectId': this.queryParams.connectId, id: val.data.id})
})
break
default:
this.handleDelete(val.data)
}
},
/** 删除按钮操作 */
handleDelete(row) {
this.$modal.confirm('是否确认删除参数列名为"' + row.plcParamName + '"的数据项?').then(function() {
return deleteEnergyPlcParam(row.id);
}).then(() => {
this.queryParams.pageNo = 1;
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
closeD() {
this.$emit('closeDrawer')
}
}
}
</script>
<style lang="scss" scoped>
.box {
padding: 0 32px;
}
</style>

Bestand weergeven

@ -0,0 +1,134 @@
<template>
<el-form ref="form" :rules="rules" label-width="100px" :model="form">
<el-row>
<el-col :span="12">
<el-form-item label="能源类型" prop="typeId">
<el-select v-model="form.typeId" placeholder="请选择" style="width: 100%;">
<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-col :span="12">
<el-form-item label="参数列名" prop="plcParamName">
<el-input v-model="form.plcParamName"></el-input>
</el-form-item>
</el-col>
</el-row>
<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="unit">
<el-select v-model="form.unit" placeholder="请选择" style="width: 100%;">
<el-option
v-for="item in getDictDatas(DICT_TYPE.ENERGY_UNIT)"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="是否采集" prop="collection">
<el-switch v-model="form.collection"></el-switch>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="描述" prop="description">
<el-input v-model="form.description"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
import { getEnergyPlcParam, updateEnergyPlcParam, createEnergyPlcParam } from '@/api/base/energyPlcParam'
import { getEnergyTypeListAll } from '@/api/base/energyType'
export default {
name: 'EnergyPlcParamAdd',
data() {
return {
form: {
id: '',
typeId: '',
plcParamName: '',
name: '',
unit: '',
description: '',
collection: true,
connectId: ''
},
energyListType: [],
isEdit: false, //
rules: {
typeId: [{ required: true, message: '能源类型不能为空', trigger: 'change' }],
plcParamName: [{ required: true, message: '参数列名不能为空', trigger: 'blur' }],
name: [{ required: true, message: '参数名称不能为空', trigger: 'blur' }]
}
}
},
methods: {
init(param) {
this.form.connectId = param.connectId
getEnergyTypeListAll().then((res) => {
this.energyListType = res.data || []
})
if (param.id) {
this.isEdit = true
this.form.id = param.id
getEnergyPlcParam(this.form.id).then((res) => {
if (res.code === 0) {
this.form = res.data
this.form.collection = this.form.collection === 0 ? false : true
}
})
} else {
this.isEdit = false
this.form.id = ''
}
},
submitForm() {
this.$refs['form'].validate((valid) => {
if (valid) {
this.form.collection = this.form.collection === false ? 0 : 1
if (this.isEdit) {
//
updateEnergyPlcParam({...this.form}).then((res) => {
if (res.code === 0) {
this.$modal.msgSuccess("操作成功");
this.$emit('successSubmit')
}
})
} else {
createEnergyPlcParam({...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>

Bestand weergeven

@ -0,0 +1,127 @@
<template>
<div>
<el-drawer title="参数绑定" :visible.sync="visible" size="70%">
<div class="box">
<el-form :inline="true">
<el-form-item label="关联表名">
<el-input v-model="plcTableName" size='small' readonly></el-input>
</el-form-item>
<el-form-item label="对象">
<el-input v-model="bindObjectType" size='small' readonly></el-input>
</el-form-item>
</el-form>
<base-table
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-props="tableProps"
:table-data="tableData"
:max-height="tableH"
/>
<pagination
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
:total="total"
@pagination="getList"
/>
</div>
</el-drawer>
</div>
</template>
<script>
import { getEnergyPlcParamPage } from '@/api/base/energyPlcParam'
import { publicFormatter } from '@/utils/dict'
const tableProps = [
{
prop: 'typeId',
label: '能源类型'
},
{
prop: 'plcParamName',
label: '参数列名'
},
{
prop: 'name',
label: '参数名称'
},
{
prop: 'unit',
label: '单位',
filter: publicFormatter('energy_unit')
},
{
prop: 'collection',
label: '是否采集'
},
{
prop: 'description',
label: '描述'
}
]
const tableBtn = [
{
type: 'edit',
btnName: '编辑'
},
{
type: 'delete',
btnName: '删除'
}
]
export default {
name: 'EnergyPlcParamView',
data() {
return {
visible: false,
tableProps,
tableData: [],
tableBtn,
tableH: this.tableHeight(115),
total: 0,
queryParams: {
pageNo: 1,
pageSize: 30,
connectId: null
},
plcTableName: '',
bindObjectType: '',
collectionList: [
{value: 0,label: '否'},
{value: 1,label: '是'}
]
}
},
created() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(115)
})
},
methods: {
init(data) {
this.visible = true
this.queryParams.connectId = data.id
this.plcTableName = data.plcTableName
this.bindObjectType = data.bindObjectType
this.getList()
},
getList() {
getEnergyPlcParamPage({...this.queryParams}).then((res) => {
let arr = res.data.list || [];
arr&&arr.map(item => {
this.collectionList.map(i => {
if (item.collection === i.value) {
item.collection = i.label
}
})
})
this.tableData = arr
this.total = res.data.total;
})
}
}
}
</script>
<style lang="scss" scoped>
.box {
padding: 0 32px;
}
</style>

Bestand weergeven

@ -0,0 +1,245 @@
<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-plc-connect-add ref="energyPlcConnect" @successSubmit="successSubmit" />
</base-dialog>
<!-- 参数绑定/查看 -->
<energy-plc-param v-if="paramVisible" ref="plcParam" @closeDrawer="closeDrawer" :energyTypeList="energyTypeList"></energy-plc-param>
</div>
</template>
<script>
import { getEnergyPlcConnectPage, deleteEnergyPlcConnect } from "@/api/base/energyPlcConnect";
// import { publicFormatter } from '@/utils/dict'
import { getEnergyTypeListAll } from '@/api/base/energyType'
import EnergyPlcConnectAdd from './components/energyPlcConnectAdd.vue'
import EnergyPlcParam from './components/energyPlcParam.vue'
const tableProps = [
{
prop: 'bindObjectType',
label: '对象'
},
{
prop: 'bindObjectId',
label: '对象编码'
},
{
prop: 'plcTableName',
label: '关联表名'
},
{
prop: 'plcTableCode',
label: '关联表编码'
},
{
prop: 'cnName',
label: '标识名'
},
{
prop: 'varNum',
label: '绑定参数数量'
}
]
export default {
name: "EnergyPlcConnect",
components: { EnergyPlcConnectAdd, EnergyPlcParam },
data() {
return {
formConfig: [
{
type: 'input',
label: '标识名',
placeholder: '标识名',
param: 'name'
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary'
},
{
type: 'separate'
},
{
type: this.$auth.hasPermi('base:energy-plc-connect:create') ? 'button' : '',
btnName: '新增',
name: 'add',
color: 'success',
plain: true
}
],
tableProps,
tableBtn: [
this.$auth.hasPermi('base:energy-plc-connect:update')
? {
type: 'edit',
btnName: '编辑'
}
: undefined,
{
type: 'view',
btnName: '查看'
},
this.$auth.hasPermi('base:energy-plc-connect:bind')
? {
type: 'connect',
btnName: '绑定'
}
: undefined,
this.$auth.hasPermi('base:energy-plc-connect: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
},
paramVisible: false,
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.energyPlcConnect.init()
})
}
},
/** 查询列表 */
getList() {
getEnergyPlcConnectPage(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.energyPlcConnect.init(val.data.id)
})
this.centervisible = true
break
case 'delete':
this.handleDelete(val.data)
break
case 'view':
this.paramVisible = true
this.$nextTick(() => {
this.$refs.plcParam.init(val.data, 'view')
})
break
default:
this.paramVisible = true
this.$nextTick(() => {
this.$refs.plcParam.init(val.data, 'connect')
})
}
},
handleCancel() {
this.$refs.energyPlcConnect.formClear()
this.centervisible = false
this.addOrEditTitle = ''
},
handleConfirm() {
this.$refs.energyPlcConnect.submitForm()
},
successSubmit() {
this.handleCancel()
this.getList()
},
/** 删除按钮操作 */
handleDelete(row) {
this.$modal.confirm('是否确认删除关联表名为"' + row.name + '"的数据项?').then(function() {
return deleteEnergyPlcConnect(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>

Bestand weergeven

@ -0,0 +1,151 @@
<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"
/>
<pagination
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
:total="total"
@pagination="getList"
/>
</div>
</template>
<script>
import { getEnergyQuantityRealtimePage } from "@/api/base/energyQuantityRealtime";
import { getEnergyTypeListAll } from "@/api/base/energyType";
// import { publicFormatter } from '@/utils/dict'
const tableProps = [
{
prop: 'bindObjectName',
label: '统计对象'
},
{
prop: 'bindObjectType',
label: '能源类型'
},
{
prop: 'startValue',
label: '初始值'
},
{
prop: 'endValue',
label: '当前值'
},
{
prop: 'diffValue',
label: '差值'
},
{
prop: 'amount',
label: '金额'
}
]
export default {
name: "EnergyPlc",
data() {
return {
formConfig: [
{
type: 'select',
label: '能源类型',
selectOptions: [],
param: 'energyTypeId'
},
{
type: 'datePicker',
label: '时间',
dateType: 'datetimerange',
format: 'yyyy-MM-dd HH:mm:ss',
valueFormat: "timestamp",
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'timeVal',
defaultSelect: [],
width: 350
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary'
},
{
type: 'separate'
},
{
type: this.$auth.hasPermi('base:energy-quantity-realtime:export') ? 'button' : '',
btnName: '导出',
name: 'export',
color: 'primary',
plain: true
}
],
tableProps,
tableH: this.tableHeight(260),
//
total: 0,
//
list: [],
//
queryParams: {
pageNo: 1,
pageSize: 20,
energyTypeId: '',
startTime: null,
endTime: null
}
};
},
created() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260)
})
this.getList();
this.getTypeList()
},
methods: {
buttonClick(val) {
console.log(val)
switch (val.btnName) {
case 'search':
this.queryParams.pageNo = 1;
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:
console.log('导出')
}
},
/** 查询列表 */
getList() {
getEnergyQuantityRealtimePage(this.queryParams).then(response => {
this.list = response.data.list || [];
this.total = response.data.total;
});
},
getTypeList() {
getEnergyTypeListAll().then((res) => {
console.log(res)
this.formConfig[0].selectOptions = res.data || []
})
}
}
};
</script>

Bestand weergeven

@ -44,14 +44,15 @@
</template>
<script>
import { getEnergyTypePage, deleteEnergyType, updateGroupTeam } from "@/api/base/energyType";
import { getEnergyTypePage, deleteEnergyType } from "@/api/base/energyType";
import { publicFormatter } from '@/utils/dict'
import InnerTable from './components/InnerTable'
import EnergyTypeAdd from './components/energyTypeAdd.vue'
import EnergyTypeAdd from './components/energyTypeAdd'
const tableProps = [
{
prop: 'code',
label: '类型编码'
label: '类型编码',
showOverflowtooltip: true
},
{
prop: 'name',
@ -73,7 +74,7 @@ const tableProps = [
}
]
export default {
name: "GroupTeam",
name: "EnergyType",
components: { EnergyTypeAdd },
data() {
return {

Bestand weergeven

@ -0,0 +1,37 @@
<template>
<div class="tableInner">
<el-input-number v-model="list[itemProp]" @blur="changeInput" :min="0" :max="100000000" style="width: 100%" :controls='false'></el-input-number>
</div>
</template>
<script>
export default {
name: 'InputArea',
props: {
injectData: {
type: Object,
default: () => ({})
},
itemProp: {
type: String
}
},
data() {
return {
list: this.injectData
}
},
methods: {
changeInput() {
console.log(this.list)
this.$emit('emitData', this.list)
}
}
}
</script>
<style lang="scss">
.tableInner .el-input__inner {
border: none;
padding: 0;
height: 33px;
}
</style>

Bestand weergeven

@ -0,0 +1,43 @@
<template>
<div class="tableInner">
<el-time-picker
v-model="list[itemProp]"
@blur="changeInput"
style="width: 100%"
format='HH:mm:ss'
value-format='HH:mm:ss'
></el-time-picker>
</div>
</template>
<script>
export default {
name: 'TimePickerArea',
props: {
injectData: {
type: Object,
default: () => ({})
},
itemProp: {
type: String
}
},
data() {
return {
list: this.injectData
}
},
methods: {
changeInput() {
console.log(this.list)
this.$emit('emitData', this.list)
}
}
}
</script>
<style lang="scss">
.tableInner .el-input--prefix .el-input__inner {
border: none;
padding-left: 30px;
height: 33px;
}
</style>

Bestand weergeven

@ -0,0 +1,173 @@
<template>
<el-form ref="form" :rules="rules" label-width="100px" :model="form">
<el-form-item label="监控对象" prop="objectId">
<el-input v-model="form.objectId"></el-input>
</el-form-item>
<el-form-item label="能源类型" prop="energyTypeId">
<el-select v-model="form.energyTypeId" placeholder="请选择" style="width: 100%;">
<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-form-item label="监控模式" prop="type">
<el-select v-model="form.type" placeholder="请选择" style="width: 100%;" @change="typeChange">
<el-option label="合并" value= "1" ></el-option>
<el-option label="详细" value= "2" ></el-option>
</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-option
v-for="item in getDictDatas(DICT_TYPE.ENERGY_UNIT)"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="消耗量阈值" prop="code">
<el-input v-model="form.code"></el-input>
</el-form-item>
</el-form>
</template>
<script>
import { getEnergyParamList, getEnergyType, updateEnergyType, createEnergyType } from '@/api/monitoring/energyLimit'
export default {
name: 'energyLimitAdd',
props: {
energyTypeList: {
type: Array,
required: true,
default: () => {
return []
}
}
},
data() {
return {
form: {
id: '',
name: '',
code: '',
nuit: '',
pricingMethod: 1,
leaderName: ''
},
isEdit: false, //
rules: {
name: [{ required: true, message: '能源类型不能为空', trigger: 'blur' }]
}
}
},
methods: {
init(id) {
// getEnergyParamList().then((res) => {
// console.log(res)
// })
if (id) {
this.isEdit = true
this.form.id = id
getEnergyType( id ).then((res) => {
if (res.code === 0) {
this.form = res.data
}
})
} else {
this.isEdit = false
this.form.id = ''
}
},
typeChange() {
// if (this.form.type === '2') {
// } else {
// }
},
submitForm() {
this.$refs['form'].validate((valid) => {
if (valid) {
switch(this.form.pricingMethod) {
case 0://
if (this.tableData1.length === 0) {
this.$modal.msgError('时间段表格数据不能为空')
return false
} else {
this.tableData1.map(item => {
if (item.price <= 0) {
this.$modal.msgError('单价有误请检查,请检查')
return false
}
})
}
break;
case 1:// 使
if (this.tableData2.length === 0) {
this.$modal.msgError('使用量表格数据不能为空')
return false
} else {
this.tableData1.map(item => {
if (item.price <= 0) {
this.$modal.msgError('单价有误请检查,请检查')
return false
}
})
}
break;
default://
if (!this.form.singlePrice) {
this.$modal.msgError('单价有误请检查1请检查')
return false
}
}
if (this.isEdit) {
//
updateEnergyType({
id: this.form.id,
code: this.form.code,
name: this.form.name,
unit: this.form.unit,
pricingMethod: this.form.pricingMethod,
description: this.form.description,
singlePrice: this.form.pricingMethod === 2 ? this.form.singlePrice : '',
segPriceList: this.form.pricingMethod === 0 ? this.tableData1: [],
usedPriceList: this.form.pricingMethod === 1 ? this.tableData2: []
}).then((res) => {
if (res.code === 0) {
this.$modal.msgSuccess("操作成功");
this.$emit('successSubmit')
}
})
} else {
createEnergyType({
code: this.form.code,
name: this.form.name,
unit: this.form.unit,
pricingMethod: this.form.pricingMethod,
description: this.form.description,
singlePrice: this.form.pricingMethod === 2 ? this.form.singlePrice : '',
segPriceList: this.form.pricingMethod === 0 ? this.tableData1: [],
usedPriceList: this.form.pricingMethod === 1 ? this.tableData2: []
}).then((res) => {
if (res.code === 0) {
this.$modal.msgSuccess("操作成功");
this.$emit('successSubmit')
}
})
}
} else {
return false
}
})
},
formClear() {
this.$refs.form.resetFields()
this.isEdit = false
}
}
}
</script>

Bestand weergeven

@ -0,0 +1,222 @@
<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="80"
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-limit-add ref="energyLimit" @successSubmit="successSubmit" :energyTypeList="energyTypeList"/>
</base-dialog>
</div>
</template>
<script>
import { getEnergyLimitPage, deleteEnergyLimit } from "@/api/monitoring/energyLimit";
import { getEnergyTypeListAll } from "@/api/base/energyType";
// import { publicFormatter } from '@/utils/dict'
import EnergyLimitAdd from './components/energyLimitAdd'
const tableProps = [
{
prop: 'objectId',
label: '监控对象'
},
{
prop: 'energyType',
label: '能源类型'
},
{
prop: 'type',
label: '监控模式'
// filter: publicFormatter('energy_unit')
},
{
prop: 'plcParamName',
label: '监控参数'
},
{
prop: 'limitType',
label: '指标类型'
},
{
prop: 'limitValue',
label: '阈值'
}
]
export default {
name: "EnergyLimit",
components: { EnergyLimitAdd },
data() {
return {
formConfig: [
{
type: 'select',
label: '能源类型',
selectOptions: [],
param: 'energyTypeId'
},
{
type: 'input',
label: '指标类型',
placeholder: '指标类型',
param: 'limitType'
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary'
},
{
type: 'separate'
},
{
type: this.$auth.hasPermi('base:energy-type:create') ? 'button' : '',
btnName: '新增',
name: 'add',
color: 'success',
plain: true
}
],
tableProps,
tableBtn: [
this.$auth.hasPermi('base:energy-type:update')
? {
type: 'edit',
btnName: '编辑'
}
: undefined,
this.$auth.hasPermi('base:energy-type:delete')
? {
type: 'delete',
btnName: '删除'
}
: undefined
].filter((v) => v),
tableH: this.tableHeight(260),
//
total: 0,
//
list: [],
//
addOrEditTitle: "",
//
centervisible: false,
//
queryParams: {
pageNo: 1,
pageSize: 20,
energyTypeId: null,
limitType: null
},
energyTypeList: []
};
},
created() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260)
})
this.getList();
this.getTypeList()
},
methods: {
getTypeList() {
getEnergyTypeListAll().then((res) => {
this.formConfig[0].selectOptions = res.data || []
this.energyTypeList = res.data || []
})
},
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.queryParams.pageNo = 1;
this.queryParams.energyTypeId = val.energyTypeId
this.queryParams.limitType = val.limitType
this.getList()
break
default:
this.addOrEditTitle = '新增'
this.centervisible = true
this.$nextTick(() => {
this.$refs.energyLimit.init()
})
}
},
/** 查询列表 */
getList() {
getEnergyLimitPage(this.queryParams).then(response => {
let arr = response.data.list || [];
this.list = arr
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)
}
},
handleCancel() {
this.$refs.energyLimit.formClear()
this.centervisible = false
this.addOrEditTitle = ''
},
handleConfirm() {
this.$refs.energyLimit.submitForm()
},
successSubmit() {
this.handleCancel()
this.getList()
},
/** 删除按钮操作 */
handleDelete(row) {
this.$modal.confirm('是否确认删除能源类型为"' + row.name + '"的数据项?').then(function() {
return deleteEnergyLimit(row.id);
}).then(() => {
this.queryParams.pageNo = 1;
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
}
}
};
</script>

Bestand weergeven

@ -0,0 +1,296 @@
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="需要监控对象的id " prop="objectId">
<el-input v-model="queryParams.objectId" placeholder="请输入需要监控对象的id " clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="需要监控的对象类型 1.产线 2.工段 3.设备" prop="objectType">
<el-select v-model="queryParams.objectType" placeholder="请选择需要监控的对象类型 1.产线 2.工段 3.设备" clearable size="small">
<el-option label="请选择字典生成" value="" />
</el-select>
</el-form-item>
<el-form-item label="需要监控的能源类型id" prop="energyTypeId">
<el-input v-model="queryParams.energyTypeId" placeholder="请输入需要监控的能源类型id" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="监控模式 1.合并 2.详细" prop="type">
<el-select v-model="queryParams.type" placeholder="请选择监控模式 1.合并 2.详细" clearable size="small">
<el-option label="请选择字典生成" value="" />
</el-select>
</el-form-item>
<el-form-item label="需要监控的详细参数id 可以为空" prop="plcParamId">
<el-input v-model="queryParams.plcParamId" placeholder="请输入需要监控的详细参数id 可以为空" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="限制类型 1.日 2.月" prop="limitType">
<el-select v-model="queryParams.limitType" placeholder="请选择限制类型 1.日 2.月" clearable size="small">
<el-option label="请选择字典生成" value="" />
</el-select>
</el-form-item>
<el-form-item label="限制量 阈值" prop="limitValue">
<el-input v-model="queryParams.limitValue" placeholder="请输入限制量 阈值" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="queryParams.remark" placeholder="请输入备注" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="版本号" prop="version">
<el-input v-model="queryParams.version" placeholder="请输入版本号" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="创建时间" prop="createTime">
<el-date-picker v-model="queryParams.createTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange"
range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" />
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<!-- 操作工具栏 -->
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
v-hasPermi="['monitoring:energy-limit:create']">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
v-hasPermi="['monitoring:energy-limit:export']">导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<!-- 列表 -->
<el-table v-loading="loading" :data="list">
<el-table-column label="id" align="center" prop="id" />
<el-table-column label="需要监控对象的id " align="center" prop="objectId" />
<el-table-column label="需要监控的对象类型 1.产线 2.工段 3.设备" align="center" prop="objectType" />
<el-table-column label="需要监控的能源类型id" align="center" prop="energyTypeId" />
<el-table-column label="监控模式 1.合并 2.详细" align="center" prop="type" />
<el-table-column label="需要监控的详细参数id 可以为空" align="center" prop="plcParamId" />
<el-table-column label="限制类型 1.日 2.月" align="center" prop="limitType" />
<el-table-column label="限制量 阈值" align="center" prop="limitValue" />
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="版本号" align="center" prop="version" />
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template v-slot="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template v-slot="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
v-hasPermi="['monitoring:energy-limit:update']">修改</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['monitoring:energy-limit:delete']">删除</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页组件 -->
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
@pagination="getList"/>
<!-- 对话框(添加 / 修改) -->
<el-dialog :title="title" :visible.sync="open" width="500px" v-dialogDrag append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="需要监控对象的id " prop="objectId">
<el-input v-model="form.objectId" placeholder="请输入需要监控对象的id " />
</el-form-item>
<el-form-item label="需要监控的对象类型 1.产线 2.工段 3.设备" prop="objectType">
<el-select v-model="form.objectType" placeholder="请选择需要监控的对象类型 1.产线 2.工段 3.设备">
<el-option label="请选择字典生成" value="" />
</el-select>
</el-form-item>
<el-form-item label="需要监控的能源类型id" prop="energyTypeId">
<el-input v-model="form.energyTypeId" placeholder="请输入需要监控的能源类型id" />
</el-form-item>
<el-form-item label="监控模式 1.合并 2.详细" prop="type">
<el-select v-model="form.type" placeholder="请选择监控模式 1.合并 2.详细">
<el-option label="请选择字典生成" value="" />
</el-select>
</el-form-item>
<el-form-item label="需要监控的详细参数id 可以为空" prop="plcParamId">
<el-input v-model="form.plcParamId" placeholder="请输入需要监控的详细参数id 可以为空" />
</el-form-item>
<el-form-item label="限制类型 1.日 2.月" prop="limitType">
<el-select v-model="form.limitType" placeholder="请选择限制类型 1.日 2.月">
<el-option label="请选择字典生成" value="" />
</el-select>
</el-form-item>
<el-form-item label="限制量 阈值" prop="limitValue">
<el-input v-model="form.limitValue" placeholder="请输入限制量 阈值" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入备注" />
</el-form-item>
<el-form-item label="版本号" prop="version">
<el-input v-model="form.version" placeholder="请输入版本号" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { createEnergyLimit, updateEnergyLimit, deleteEnergyLimit, getEnergyLimit, getEnergyLimitPage, exportEnergyLimitExcel } from "@/api/monitoring/energyLimit";
export default {
name: "EnergyLimit",
components: {
},
data() {
return {
//
loading: true,
//
exportLoading: false,
//
showSearch: true,
//
total: 0,
//
list: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNo: 1,
pageSize: 10,
objectId: null,
objectType: null,
energyTypeId: null,
type: null,
plcParamId: null,
limitType: null,
limitValue: null,
remark: null,
version: null,
createTime: [],
},
//
form: {},
//
rules: {
objectId: [{ required: true, message: "需要监控对象的id 不能为空", trigger: "blur" }],
objectType: [{ required: true, message: "需要监控的对象类型 1.产线 2.工段 3.设备不能为空", trigger: "change" }],
energyTypeId: [{ required: true, message: "需要监控的能源类型id不能为空", trigger: "blur" }],
type: [{ required: true, message: "监控模式 1.合并 2.详细不能为空", trigger: "change" }],
}
};
},
created() {
this.getList();
},
methods: {
/** 查询列表 */
getList() {
this.loading = true;
//
getEnergyLimitPage(this.queryParams).then(response => {
this.list = response.data.list;
this.total = response.data.total;
this.loading = false;
});
},
/** 取消按钮 */
cancel() {
this.open = false;
this.reset();
},
/** 表单重置 */
reset() {
this.form = {
id: undefined,
objectId: undefined,
objectType: undefined,
energyTypeId: undefined,
type: undefined,
plcParamId: undefined,
limitType: undefined,
limitValue: undefined,
remark: undefined,
version: undefined,
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加能源监控配置";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id;
getEnergyLimit(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改能源监控配置";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (!valid) {
return;
}
//
if (this.form.id != null) {
updateEnergyLimit(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
return;
}
//
createEnergyLimit(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
});
},
/** 删除按钮操作 */
handleDelete(row) {
const id = row.id;
this.$modal.confirm('是否确认删除能源监控配置编号为"' + id + '"的数据项?').then(function() {
return deleteEnergyLimit(id);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
//
let params = {...this.queryParams};
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal.confirm('是否确认导出所有能源监控配置数据项?').then(() => {
this.exportLoading = true;
return exportEnergyLimitExcel(params);
}).then(response => {
this.$download.excel(response, '能源监控配置.xls');
this.exportLoading = false;
}).catch(() => {});
}
}
};
</script>

Bestand weergeven

@ -60,7 +60,8 @@ const tableProps = [
},
{
prop: 'timeStr',
label: '班次时间'
label: '班次时间',
minWidth: 100
},
{
prop: 'code',