能源配置&能源抄表
This commit is contained in:
116
src/views/energy/base/energyPlc/components/energyPlcAdd.vue
Normal file
116
src/views/energy/base/energyPlc/components/energyPlcAdd.vue
Normal file
@@ -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>
|
||||
218
src/views/energy/base/energyPlc/index.vue
Normal file
218
src/views/energy/base/energyPlc/index.vue
Normal file
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
245
src/views/energy/base/energyPlcConnect/index.vue
Normal file
245
src/views/energy/base/energyPlcConnect/index.vue
Normal file
@@ -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>
|
||||
151
src/views/energy/base/energyQuantityRealtime/index.vue
Normal file
151
src/views/energy/base/energyQuantityRealtime/index.vue
Normal file
@@ -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>
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user