change - add电、水实时数据

change - update 计量设备信息
main
zhouhy 7 months ago
parent e43388d875
commit 101c12da0c

@ -42,3 +42,12 @@ export function delBaseMonitorInfo(objId) {
method: 'delete' method: 'delete'
}) })
} }
// 查询计量设备信息下拉树结构
export function getMonitorInfoTree(data) {
return request({
url: '/ems/base/baseMonitorInfo/monitorInfoTree',
method: 'post',
data: data
})
}

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询水实时数据列表
export function listRecordWaterInstant(query) {
return request({
url: '/ems/record/recordWaterInstant/list',
method: 'get',
params: query
})
}
// 查询水实时数据详细
export function getRecordWaterInstant(objId) {
return request({
url: '/ems/record/recordWaterInstant/' + objId,
method: 'get'
})
}
// 新增水实时数据
export function addRecordWaterInstant(data) {
return request({
url: '/ems/record/recordWaterInstant',
method: 'post',
data: data
})
}
// 修改水实时数据
export function updateRecordWaterInstant(data) {
return request({
url: '/ems/record/recordWaterInstant',
method: 'put',
data: data
})
}
// 删除水实时数据
export function delRecordWaterInstant(objId) {
return request({
url: '/ems/record/recordWaterInstant/' + objId,
method: 'delete'
})
}

@ -51,12 +51,3 @@ export function findOrderBomList(query) {
params: query params: query
}) })
} }
// 查询生产BOM树列表
export function productionBomTreeList(query) {
return request({
url: '/mes/prod/prodBomInfo/productionBomTreeList',
method: 'get',
params: query
})
}

@ -94,14 +94,12 @@
<el-table-column label="计量设备编号" align="center" prop="monitorCode" v-if="columns[2].visible" /> <el-table-column label="计量设备编号" align="center" prop="monitorCode" v-if="columns[2].visible" />
<el-table-column label="计量设备名称" align="center" prop="monitorName" v-if="columns[3].visible" /> <el-table-column label="计量设备名称" align="center" prop="monitorName" v-if="columns[3].visible" />
<el-table-column label="计量设备位置" align="center" prop="monitorAddr" v-if="columns[4].visible" /> <el-table-column label="计量设备位置" align="center" prop="monitorAddr" v-if="columns[4].visible" />
<el-table-column label="计量设备类型" align="center" prop="monitorType" v-if="columns[5].visible" />
<el-table-column label="计量设备状态" align="center" prop="monitorStatus" v-if="columns[6].visible"> <el-table-column label="计量设备状态" align="center" prop="monitorStatus" v-if="columns[6].visible">
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :options="dict.type.monitor_status" :value="scope.row.monitorStatus"/> <dict-tag :options="dict.type.monitor_status" :value="scope.row.monitorStatus"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="采集设备编号" align="center" prop="collectDeviceId" v-if="columns[7].visible" /> <el-table-column label="采集设备编号" align="center" prop="collectDeviceId" v-if="columns[7].visible" />
<el-table-column label="祖级列表" align="center" prop="ancestors" v-if="columns[8].visible" />
<el-table-column label="等级" align="center" prop="grade" v-if="columns[9].visible" /> <el-table-column label="等级" align="center" prop="grade" v-if="columns[9].visible" />
<el-table-column label="传感器仪表" align="center" prop="meterTypeId" v-if="columns[10].visible" /> <el-table-column label="传感器仪表" align="center" prop="meterTypeId" v-if="columns[10].visible" />
<el-table-column label="修正值" align="center" prop="correctValue" v-if="columns[11].visible" /> <el-table-column label="修正值" align="center" prop="correctValue" v-if="columns[11].visible" />
@ -157,7 +155,7 @@
<!-- 添加或修改计量设备信息对话框 --> <!-- 添加或修改计量设备信息对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="100px"> <el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-form-item label="父级编号" prop="parentId"> <el-form-item label="父级编号" prop="parentId">
<treeselect v-model="form.parentId" :options="baseMonitorInfoOptions" :normalizer="normalizer" placeholder="请选择父级编号" /> <treeselect v-model="form.parentId" :options="baseMonitorInfoOptions" :normalizer="normalizer" placeholder="请选择父级编号" />
</el-form-item> </el-form-item>
@ -262,7 +260,7 @@ export default {
monitorCode: null, monitorCode: null,
monitorName: null, monitorName: null,
monitorAddr: null, monitorAddr: null,
monitorType: null, monitorType: 2,
monitorStatus: null, monitorStatus: null,
collectDeviceId: null, collectDeviceId: null,
ancestors: null, ancestors: null,
@ -364,7 +362,7 @@ export default {
monitorCode: null, monitorCode: null,
monitorName: null, monitorName: null,
monitorAddr: null, monitorAddr: null,
monitorType: null, monitorType: 2,
monitorStatus: null, monitorStatus: null,
collectDeviceId: null, collectDeviceId: null,
ancestors: null, ancestors: null,

@ -0,0 +1,452 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
<el-form-item label="计量设备编号" prop="monitorCode">
<el-input
v-model="queryParams.monitorCode"
placeholder="请输入计量设备编号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="计量设备名称" prop="monitorName">
<el-input
v-model="queryParams.monitorName"
placeholder="请输入计量设备名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="计量设备位置" prop="monitorAddr">
<el-input
v-model="queryParams.monitorAddr"
placeholder="请输入计量设备位置"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="计量设备状态" prop="monitorStatus">
<el-select v-model="queryParams.monitorStatus" placeholder="请选择计量设备状态" clearable>
<el-option
v-for="dict in dict.type.monitor_status"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="采集设备编号" prop="collectDeviceId">
<el-input
v-model="queryParams.collectDeviceId"
placeholder="请输入采集设备编号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="是否虚拟" prop="isAmmeter">
<el-select v-model="queryParams.isAmmeter" placeholder="请选择是否虚拟" clearable>
<el-option
v-for="dict in dict.type.is_ammeter"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @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="['ems/base:baseMonitorInfo:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="info"
plain
icon="el-icon-sort"
size="mini"
@click="toggleExpandAll"
>展开/折叠</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
</el-row>
<el-table
v-if="refreshTable"
v-loading="loading"
:data="baseMonitorInfoList"
row-key="objId"
:default-expand-all="isExpandAll"
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
>
<el-table-column label="父级编号" prop="parentId" v-if="columns[1].visible" />
<el-table-column label="计量设备编号" align="center" prop="monitorCode" v-if="columns[2].visible" />
<el-table-column label="计量设备名称" align="center" prop="monitorName" v-if="columns[3].visible" />
<el-table-column label="计量设备位置" align="center" prop="monitorAddr" v-if="columns[4].visible" />
<el-table-column label="计量设备状态" align="center" prop="monitorStatus" v-if="columns[6].visible">
<template slot-scope="scope">
<dict-tag :options="dict.type.monitor_status" :value="scope.row.monitorStatus"/>
</template>
</el-table-column>
<el-table-column label="采集设备编号" align="center" prop="collectDeviceId" v-if="columns[7].visible" />
<el-table-column label="等级" align="center" prop="grade" v-if="columns[9].visible" />
<el-table-column label="传感器仪表" align="center" prop="meterTypeId" v-if="columns[10].visible" />
<el-table-column label="修正值" align="center" prop="correctValue" v-if="columns[11].visible" />
<el-table-column label="是否虚拟" align="center" prop="isAmmeter" v-if="columns[14].visible">
<template slot-scope="scope">
<dict-tag :options="dict.type.is_ammeter" :value="scope.row.isAmmeter"/>
</template>
</el-table-column>
<el-table-column label="通断复位" align="center" prop="isKeyMonitor" v-if="columns[15].visible" />
<el-table-column label="是否断路" align="center" prop="isCircuit" v-if="columns[16].visible" />
<el-table-column label="创建人" align="center" prop="createBy" v-if="columns[17].visible" />
<el-table-column label="创建时间" align="center" prop="createTime" width="180" v-if="columns[18].visible">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="更新人" align="center" prop="updateBy" v-if="columns[19].visible" />
<el-table-column label="更新时间" align="center" prop="updateTime" width="180" v-if="columns[20].visible">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="公摊表类型" align="center" prop="publicShareType" v-if="columns[21].visible" />
<el-table-column label="表具层级" align="center" prop="monitorHierarchy" v-if="columns[22].visible" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="180">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['ems/base:baseMonitorInfo:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-plus"
@click="handleAdd(scope.row)"
v-hasPermi="['ems/base:baseMonitorInfo:add']"
>新增</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['ems/base:baseMonitorInfo:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<!-- 添加或修改计量设备信息对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-form-item label="父级编号" prop="parentId">
<treeselect v-model="form.parentId" :options="baseMonitorInfoOptions" :normalizer="normalizer" placeholder="请选择父级编号" />
</el-form-item>
<el-form-item label="计量设备编号" prop="monitorCode">
<el-input v-model="form.monitorCode" placeholder="请输入计量设备编号" />
</el-form-item>
<el-form-item label="计量设备名称" prop="monitorName">
<el-input v-model="form.monitorName" placeholder="请输入计量设备名称" />
</el-form-item>
<el-form-item label="计量设备位置" prop="monitorAddr">
<el-input v-model="form.monitorAddr" placeholder="请输入计量设备位置" />
</el-form-item>
<el-form-item label="计量设备状态" prop="monitorStatus">
<el-radio-group v-model="form.monitorStatus">
<el-radio
v-for="dict in dict.type.monitor_status"
:key="dict.value"
:label="parseInt(dict.value)"
>{{dict.label}}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="采集设备编号" prop="collectDeviceId">
<el-input v-model="form.collectDeviceId" placeholder="请输入采集设备编号" />
</el-form-item>
<el-form-item label="等级" prop="grade">
<el-input v-model="form.grade" placeholder="请输入等级" />
</el-form-item>
<el-form-item label="传感器仪表" prop="meterTypeId">
<el-input v-model="form.meterTypeId" placeholder="请输入传感器仪表" />
</el-form-item>
<el-form-item label="修正值" prop="correctValue">
<el-input v-model="form.correctValue" placeholder="请输入修正值" />
</el-form-item>
<el-form-item label="是否虚拟" prop="isAmmeter">
<el-radio-group v-model="form.isAmmeter">
<el-radio
v-for="dict in dict.type.is_ammeter"
:key="dict.value"
:label="dict.value"
>{{dict.label}}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="通断复位" prop="isKeyMonitor">
<el-input v-model="form.isKeyMonitor" placeholder="请输入通断复位" />
</el-form-item>
<el-form-item label="是否断路" prop="isCircuit">
<el-input v-model="form.isCircuit" placeholder="请输入是否断路" />
</el-form-item>
<el-form-item label="公摊表类型" prop="publicShareType">
<el-input v-model="form.publicShareType" placeholder="请输入公摊表类型" />
</el-form-item>
<el-form-item label="表具层级" prop="monitorHierarchy">
<el-input v-model="form.monitorHierarchy" 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 { listBaseMonitorInfo, getBaseMonitorInfo, delBaseMonitorInfo, addBaseMonitorInfo, updateBaseMonitorInfo } from "@/api/ems/base/baseMonitorInfo";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default {
name: "BaseMonitorInfo",
dicts: ['is_ammeter', 'monitor_status'],
components: {
Treeselect
},
data() {
return {
//
loading: true,
//
showSearch: true,
//
baseMonitorInfoList: [],
//
baseMonitorInfoOptions: [],
//
title: "",
//
open: false,
//
isExpandAll: true,
//
refreshTable: true,
//
queryParams: {
parentId: null,
monitorCode: null,
monitorName: null,
monitorAddr: null,
monitorType: 4,
monitorStatus: null,
collectDeviceId: null,
ancestors: null,
grade: null,
meterTypeId: null,
correctValue: null,
pt: null,
ct: null,
isAmmeter: null,
isKeyMonitor: null,
isCircuit: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
publicShareType: null,
monitorHierarchy: null
},
//
form: {},
//
rules: {
objId: [
{ required: true, message: "自增标识不能为空", trigger: "blur" }
],
monitorCode: [
{ required: true, message: "计量设备编号不能为空", trigger: "blur" }
],
},
columns: [
{key: 0, label: `自增标识`, visible: false},
{key: 1, label: `父级编号`, visible: false},
{key: 2, label: `计量设备编号`, visible: true},
{key: 3, label: `计量设备名称`, visible: true},
{key: 4, label: `计量设备位置`, visible: true},
{key: 5, label: `计量设备类型`, visible: true},
{key: 6, label: `计量设备状态`, visible: true},
{key: 7, label: `采集设备编号`, visible: true},
{key: 8, label: `祖级列表`, visible: true},
{key: 9, label: `等级`, visible: false},
{key: 10, label: `传感器仪表`, visible: false},
{key: 11, label: `修正值`, visible: false},
{key: 12, label: `PT值`, visible: true},
{key: 13, label: `CT值`, visible: true},
{key: 14, label: `是否虚拟`, visible: true},
{key: 15, label: `通断复位`, visible: false},
{key: 16, label: `是否断路`, visible: false},
{key: 17, label: `创建人`, visible: false},
{key: 18, label: `创建时间`, visible: false},
{key: 19, label: `更新人`, visible: false},
{key: 20, label: `更新时间`, visible: false},
{key: 21, label: `公摊表类型`, visible: false},
{key: 22, label: `表具层级`, visible: false},
]
};
},
created() {
this.getList();
},
methods: {
/** 查询计量设备信息列表 */
getList() {
this.loading = true;
listBaseMonitorInfo(this.queryParams).then(response => {
this.baseMonitorInfoList = this.handleTree(response.data, "objId", "parentId");
this.loading = false;
});
},
/** 转换计量设备信息数据结构 */
normalizer(node) {
if (node.children && !node.children.length) {
delete node.children;
}
return {
id: node.objId,
label: node.monitorName,
children: node.children
};
},
/** 查询计量设备信息下拉树结构 */
getTreeselect() {
listBaseMonitorInfo().then(response => {
this.baseMonitorInfoOptions = [];
const data = { objId: 0, monitorName: '顶级节点', children: [] };
data.children = this.handleTree(response.data, "objId", "parentId");
this.baseMonitorInfoOptions.push(data);
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
objId: null,
parentId: null,
monitorCode: null,
monitorName: null,
monitorAddr: null,
monitorType: 4,
monitorStatus: null,
collectDeviceId: null,
ancestors: null,
grade: null,
meterTypeId: null,
correctValue: null,
pt: null,
ct: null,
isAmmeter: null,
isKeyMonitor: null,
isCircuit: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
publicShareType: null,
monitorHierarchy: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd(row) {
this.reset();
this.getTreeselect();
if (row != null && row.objId) {
this.form.parentId = row.objId;
} else {
this.form.parentId = 0;
}
this.open = true;
this.title = "添加计量设备信息";
},
/** 展开/折叠操作 */
toggleExpandAll() {
this.refreshTable = false;
this.isExpandAll = !this.isExpandAll;
this.$nextTick(() => {
this.refreshTable = true;
});
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
this.getTreeselect();
if (row != null) {
this.form.parentId = row.parentId;
}
getBaseMonitorInfo(row.objId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改计量设备信息";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.objId != null) {
updateBaseMonitorInfo(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
// this.form.monitorType = 4;
addBaseMonitorInfo(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
this.$modal.confirm('是否确认删除计量设备信息编号为"' + row.objId + '"的数据项?').then(function() {
return delBaseMonitorInfo(row.objId);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
}
}
};
</script>

@ -0,0 +1,453 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
<el-form-item label="计量设备编号" prop="monitorCode">
<el-input
v-model="queryParams.monitorCode"
placeholder="请输入计量设备编号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="计量设备名称" prop="monitorName">
<el-input
v-model="queryParams.monitorName"
placeholder="请输入计量设备名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="计量设备位置" prop="monitorAddr">
<el-input
v-model="queryParams.monitorAddr"
placeholder="请输入计量设备位置"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="计量设备状态" prop="monitorStatus">
<el-select v-model="queryParams.monitorStatus" placeholder="请选择计量设备状态" clearable>
<el-option
v-for="dict in dict.type.monitor_status"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="采集设备编号" prop="collectDeviceId">
<el-input
v-model="queryParams.collectDeviceId"
placeholder="请输入采集设备编号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="是否虚拟" prop="isAmmeter">
<el-select v-model="queryParams.isAmmeter" placeholder="请选择是否虚拟" clearable>
<el-option
v-for="dict in dict.type.is_ammeter"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @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="['ems/base:baseMonitorInfo:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="info"
plain
icon="el-icon-sort"
size="mini"
@click="toggleExpandAll"
>展开/折叠</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
</el-row>
<el-table
v-if="refreshTable"
v-loading="loading"
:data="baseMonitorInfoList"
row-key="objId"
:default-expand-all="isExpandAll"
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
>
<el-table-column label="父级编号" prop="parentId" v-if="columns[1].visible" />
<el-table-column label="计量设备编号" align="center" prop="monitorCode" v-if="columns[2].visible" />
<el-table-column label="计量设备名称" align="center" prop="monitorName" v-if="columns[3].visible" />
<el-table-column label="计量设备位置" align="center" prop="monitorAddr" v-if="columns[4].visible" />
<!-- <el-table-column label="计量设备类型" align="center" prop="monitorType" v-if="columns[5].visible" />-->
<el-table-column label="计量设备状态" align="center" prop="monitorStatus" v-if="columns[6].visible">
<template slot-scope="scope">
<dict-tag :options="dict.type.monitor_status" :value="scope.row.monitorStatus"/>
</template>
</el-table-column>
<el-table-column label="采集设备编号" align="center" prop="collectDeviceId" v-if="columns[7].visible" />
<el-table-column label="等级" align="center" prop="grade" v-if="columns[9].visible" />
<el-table-column label="传感器仪表" align="center" prop="meterTypeId" v-if="columns[10].visible" />
<el-table-column label="修正值" align="center" prop="correctValue" v-if="columns[11].visible" />
<el-table-column label="是否虚拟" align="center" prop="isAmmeter" v-if="columns[14].visible">
<template slot-scope="scope">
<dict-tag :options="dict.type.is_ammeter" :value="scope.row.isAmmeter"/>
</template>
</el-table-column>
<el-table-column label="通断复位" align="center" prop="isKeyMonitor" v-if="columns[15].visible" />
<el-table-column label="是否断路" align="center" prop="isCircuit" v-if="columns[16].visible" />
<el-table-column label="创建人" align="center" prop="createBy" v-if="columns[17].visible" />
<el-table-column label="创建时间" align="center" prop="createTime" width="180" v-if="columns[18].visible">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="更新人" align="center" prop="updateBy" v-if="columns[19].visible" />
<el-table-column label="更新时间" align="center" prop="updateTime" width="180" v-if="columns[20].visible">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="公摊表类型" align="center" prop="publicShareType" v-if="columns[21].visible" />
<el-table-column label="表具层级" align="center" prop="monitorHierarchy" v-if="columns[22].visible" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="180">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['ems/base:baseMonitorInfo:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-plus"
@click="handleAdd(scope.row)"
v-hasPermi="['ems/base:baseMonitorInfo:add']"
>新增</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['ems/base:baseMonitorInfo:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<!-- 添加或修改计量设备信息对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-form-item label="父级编号" prop="parentId">
<treeselect v-model="form.parentId" :options="baseMonitorInfoOptions" :normalizer="normalizer" placeholder="请选择父级编号" />
</el-form-item>
<el-form-item label="计量设备编号" prop="monitorCode">
<el-input v-model="form.monitorCode" placeholder="请输入计量设备编号" />
</el-form-item>
<el-form-item label="计量设备名称" prop="monitorName">
<el-input v-model="form.monitorName" placeholder="请输入计量设备名称" />
</el-form-item>
<el-form-item label="计量设备位置" prop="monitorAddr">
<el-input v-model="form.monitorAddr" placeholder="请输入计量设备位置" />
</el-form-item>
<el-form-item label="计量设备状态" prop="monitorStatus">
<el-radio-group v-model="form.monitorStatus">
<el-radio
v-for="dict in dict.type.monitor_status"
:key="dict.value"
:label="parseInt(dict.value)"
>{{dict.label}}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="采集设备编号" prop="collectDeviceId">
<el-input v-model="form.collectDeviceId" placeholder="请输入采集设备编号" />
</el-form-item>
<el-form-item label="等级" prop="grade">
<el-input v-model="form.grade" placeholder="请输入等级" />
</el-form-item>
<el-form-item label="传感器仪表" prop="meterTypeId">
<el-input v-model="form.meterTypeId" placeholder="请输入传感器仪表" />
</el-form-item>
<el-form-item label="修正值" prop="correctValue">
<el-input v-model="form.correctValue" placeholder="请输入修正值" />
</el-form-item>
<el-form-item label="是否虚拟" prop="isAmmeter">
<el-radio-group v-model="form.isAmmeter">
<el-radio
v-for="dict in dict.type.is_ammeter"
:key="dict.value"
:label="dict.value"
>{{dict.label}}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="通断复位" prop="isKeyMonitor">
<el-input v-model="form.isKeyMonitor" placeholder="请输入通断复位" />
</el-form-item>
<el-form-item label="是否断路" prop="isCircuit">
<el-input v-model="form.isCircuit" placeholder="请输入是否断路" />
</el-form-item>
<el-form-item label="公摊表类型" prop="publicShareType">
<el-input v-model="form.publicShareType" placeholder="请输入公摊表类型" />
</el-form-item>
<el-form-item label="表具层级" prop="monitorHierarchy">
<el-input v-model="form.monitorHierarchy" 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 { listBaseMonitorInfo, getBaseMonitorInfo, delBaseMonitorInfo, addBaseMonitorInfo, updateBaseMonitorInfo } from "@/api/ems/base/baseMonitorInfo";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default {
name: "BaseMonitorInfo",
dicts: ['is_ammeter', 'monitor_status'],
components: {
Treeselect
},
data() {
return {
//
loading: true,
//
showSearch: true,
//
baseMonitorInfoList: [],
//
baseMonitorInfoOptions: [],
//
title: "",
//
open: false,
//
isExpandAll: true,
//
refreshTable: true,
//
queryParams: {
parentId: null,
monitorCode: null,
monitorName: null,
monitorAddr: null,
monitorType: 3,
monitorStatus: null,
collectDeviceId: null,
ancestors: null,
grade: null,
meterTypeId: null,
correctValue: null,
pt: null,
ct: null,
isAmmeter: null,
isKeyMonitor: null,
isCircuit: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
publicShareType: null,
monitorHierarchy: null
},
//
form: {},
//
rules: {
objId: [
{ required: true, message: "自增标识不能为空", trigger: "blur" }
],
monitorCode: [
{ required: true, message: "计量设备编号不能为空", trigger: "blur" }
],
},
columns: [
{key: 0, label: `自增标识`, visible: false},
{key: 1, label: `父级编号`, visible: false},
{key: 2, label: `计量设备编号`, visible: true},
{key: 3, label: `计量设备名称`, visible: true},
{key: 4, label: `计量设备位置`, visible: true},
{key: 5, label: `计量设备类型`, visible: true},
{key: 6, label: `计量设备状态`, visible: true},
{key: 7, label: `采集设备编号`, visible: true},
{key: 8, label: `祖级列表`, visible: true},
{key: 9, label: `等级`, visible: false},
{key: 10, label: `传感器仪表`, visible: false},
{key: 11, label: `修正值`, visible: false},
{key: 12, label: `PT值`, visible: true},
{key: 13, label: `CT值`, visible: true},
{key: 14, label: `是否虚拟`, visible: true},
{key: 15, label: `通断复位`, visible: false},
{key: 16, label: `是否断路`, visible: false},
{key: 17, label: `创建人`, visible: false},
{key: 18, label: `创建时间`, visible: false},
{key: 19, label: `更新人`, visible: false},
{key: 20, label: `更新时间`, visible: false},
{key: 21, label: `公摊表类型`, visible: false},
{key: 22, label: `表具层级`, visible: false},
]
};
},
created() {
this.getList();
},
methods: {
/** 查询计量设备信息列表 */
getList() {
this.loading = true;
listBaseMonitorInfo(this.queryParams).then(response => {
this.baseMonitorInfoList = this.handleTree(response.data, "objId", "parentId");
this.loading = false;
});
},
/** 转换计量设备信息数据结构 */
normalizer(node) {
if (node.children && !node.children.length) {
delete node.children;
}
return {
id: node.objId,
label: node.monitorName,
children: node.children
};
},
/** 查询计量设备信息下拉树结构 */
getTreeselect() {
listBaseMonitorInfo().then(response => {
this.baseMonitorInfoOptions = [];
const data = { objId: 0, monitorName: '顶级节点', children: [] };
data.children = this.handleTree(response.data, "objId", "parentId");
this.baseMonitorInfoOptions.push(data);
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
objId: null,
parentId: null,
monitorCode: null,
monitorName: null,
monitorAddr: null,
monitorType: 3,
monitorStatus: null,
collectDeviceId: null,
ancestors: null,
grade: null,
meterTypeId: null,
correctValue: null,
pt: null,
ct: null,
isAmmeter: null,
isKeyMonitor: null,
isCircuit: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
publicShareType: null,
monitorHierarchy: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd(row) {
this.reset();
this.getTreeselect();
if (row != null && row.objId) {
this.form.parentId = row.objId;
} else {
this.form.parentId = 0;
}
this.open = true;
this.title = "添加计量设备信息";
},
/** 展开/折叠操作 */
toggleExpandAll() {
this.refreshTable = false;
this.isExpandAll = !this.isExpandAll;
this.$nextTick(() => {
this.refreshTable = true;
});
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
this.getTreeselect();
if (row != null) {
this.form.parentId = row.parentId;
}
getBaseMonitorInfo(row.objId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改计量设备信息";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.objId != null) {
updateBaseMonitorInfo(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
// this.form.monitorType = 3;
addBaseMonitorInfo(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
this.$modal.confirm('是否确认删除计量设备信息编号为"' + row.objId + '"的数据项?').then(function() {
return delBaseMonitorInfo(row.objId);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
}
}
};
</script>

@ -39,6 +39,7 @@
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<!-- <el-form-item label="统计单元编号" prop="workUnitCode">--> <!-- <el-form-item label="统计单元编号" prop="workUnitCode">-->
<!-- <el-input--> <!-- <el-input-->
<!-- v-model="queryParams.workUnitCode"--> <!-- v-model="queryParams.workUnitCode"-->
@ -57,6 +58,16 @@
<!-- />--> <!-- />-->
<!-- </el-select>--> <!-- </el-select>-->
<!-- </el-form-item>--> <!-- </el-form-item>-->
<el-form-item label="设备计量类型" prop="monitorType">
<el-select v-model="queryParams.monitorType" placeholder="请选择计算方式">
<el-option
v-for="dict in dict.type.monitor_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="计算方式" prop="formulaMode"> <el-form-item label="计算方式" prop="formulaMode">
<el-select v-model="queryParams.formulaMode" placeholder="请选择计算方式" clearable> <el-select v-model="queryParams.formulaMode" placeholder="请选择计算方式" clearable>
<el-option <el-option
@ -145,7 +156,11 @@
<dict-tag :options="dict.type.monitor_status" :value="scope.row.monitorStatus"/> <dict-tag :options="dict.type.monitor_status" :value="scope.row.monitorStatus"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="计量设备类型" align="center" prop="monitorType" v-if="columns[4].visible"/> <el-table-column label="计量设备类型" align="center" prop="monitorType" v-if="columns[4].visible">
<template slot-scope="scope">
<dict-tag :options="dict.type.monitor_type" :value="scope.row.monitorType"/>
</template>
</el-table-column>
<el-table-column label="计算方式" align="center" prop="formulaMode" v-if="columns[5].visible"> <el-table-column label="计算方式" align="center" prop="formulaMode" v-if="columns[5].visible">
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :options="dict.type.formula_mode" :value="scope.row.formulaMode"/> <dict-tag :options="dict.type.formula_mode" :value="scope.row.formulaMode"/>
@ -212,6 +227,16 @@
<treeselect v-model="form.monitorCode" :options="monitorInfoOptions" :normalizer="normalizer" <treeselect v-model="form.monitorCode" :options="monitorInfoOptions" :normalizer="normalizer"
placeholder="请选择计量设备"/> placeholder="请选择计量设备"/>
</el-form-item> </el-form-item>
<el-form-item label="计量设备类型" prop="monitorType">
<el-radio-group v-model="form.monitorType">
<el-radio
v-for="dict in dict.type.monitor_type"
:key="dict.value"
:label="parseInt(dict.value)"
>{{ dict.label }}
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="计算方式" prop="formulaMode"> <el-form-item label="计算方式" prop="formulaMode">
<el-radio-group v-model="form.formulaMode"> <el-radio-group v-model="form.formulaMode">
<el-radio <el-radio
@ -262,7 +287,7 @@ import { getWorkUnitTrees } from '@/api/ems/base/baseWorkUnit'
export default { export default {
name: 'BaseMonitorWorkUnit', name: 'BaseMonitorWorkUnit',
dicts: ['formula_mode', 'is_flag', 'monitor_status'], dicts: ['formula_mode', 'is_flag', 'monitor_status','monitor_type'],
components: { components: {
Treeselect Treeselect
}, },
@ -296,7 +321,7 @@ export default {
monitorCode: null, monitorCode: null,
workUnitCode: null, workUnitCode: null,
monitorStatus: null, monitorStatus: null,
monitorType: null, monitorType: 2,
formulaMode: null, formulaMode: null,
proportion: null, proportion: null,
isFlag: null, isFlag: null,
@ -391,6 +416,7 @@ export default {
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.queryParams.workUnitCode = null
this.resetForm('queryForm') this.resetForm('queryForm')
this.handleQuery() this.handleQuery()
}, },

@ -1,112 +1,61 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px"> <el-row :gutter="28">
<el-form-item label="计量设备编号" prop="monitorId"> <el-col :span="5" :xs="24">
<div class="head-container">
<el-input <el-input
v-model="queryParams.monitorId" v-model="workUnitName"
placeholder="请输入计量设备编号" placeholder="请输入计量设备名称"
clearable clearable
@keyup.enter.native="handleQuery" size="small"
prefix-icon="el-icon-search"
style="margin-bottom: 20px"
/> />
</el-form-item> </div>
<div class="head-container">
<el-tree
:data="monitorInfoOptions"
:props="workUnitProps"
:expand-on-click-node="false"
:filter-node-method="filterNode"
ref="tree"
node-key="id"
default-expand-all
highlight-current
@node-click="handleNodeClick"
/>
</div>
</el-col>
<el-col :span="19" :xs="24">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"
label-width="100px">
<!-- <el-form-item label="计量设备编号" prop="monitorId">-->
<!-- <el-input-->
<!-- v-model="queryParams.monitorId"-->
<!-- placeholder="请输入计量设备编号"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<el-form-item label="采集时间" prop="collectTime"> <el-form-item label="采集时间" prop="collectTime">
<el-date-picker clearable <el-date-picker clearable
v-model="queryParams.collectTime" v-model="queryParams.beginCollectTime"
type="date" type="datetime"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择采集时间" placeholder="请选择开始时间"
@input="changeDate"
> >
</el-date-picker> </el-date-picker>
</el-form-item> -
<el-form-item label="A项电压" prop="vA">
<el-input
v-model="queryParams.vA"
placeholder="请输入A项电压"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="B项电压" prop="vB">
<el-input
v-model="queryParams.vB"
placeholder="请输入B项电压"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="C项电压" prop="vC">
<el-input
v-model="queryParams.vC"
placeholder="请输入C项电压"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="A项电流" prop="iA">
<el-input
v-model="queryParams.iA"
placeholder="请输入A项电流"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="B项电流" prop="iB">
<el-input
v-model="queryParams.iB"
placeholder="请输入B项电流"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="C项电流" prop="iC">
<el-input
v-model="queryParams.iC"
placeholder="请输入C项电流"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="记录时间" prop="recordTime">
<el-date-picker clearable <el-date-picker clearable
v-model="queryParams.recordTime" v-model="queryParams.endCollectTime"
type="date" type="datetime"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择记录时间" placeholder="请选择结束时间"
@input="changeDate"
> >
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item label="功率因数" prop="glys">
<el-input
v-model="queryParams.glys"
placeholder="请输入功率因数"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="正向有功" prop="zxyg">
<el-input
v-model="queryParams.zxyg"
placeholder="请输入正向有功"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="有功功率" prop="activePower">
<el-input
v-model="queryParams.activePower"
placeholder="请输入有功功率"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="无功功率" prop="reactivePower">
<el-input
v-model="queryParams.reactivePower"
placeholder="请输入无功功率"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="采集方式" prop="collectType"> <el-form-item label="采集方式" prop="collectType">
<el-select v-model="queryParams.collectType" placeholder="请选择采集方式" clearable> <el-select v-model="queryParams.collectType" placeholder="请选择采集方式" clearable>
<el-option <el-option
@ -117,12 +66,32 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="记录时间" prop="recordTime">
<el-date-picker clearable
v-model="queryParams.beginRecordTime"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择开始时间"
@input="changeDate"
>
</el-date-picker>
-
<el-date-picker clearable
v-model="queryParams.endRecordTime"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择结束时间"
@input="changeDate"
>
</el-date-picker>
</el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@ -176,18 +145,19 @@
<el-table v-loading="loading" :data="recordDnbInstantList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="recordDnbInstantList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center"/> <el-table-column type="selection" width="55" align="center"/>
<el-table-column label="编号" align="center" prop="objId" v-if="columns[0].visible"/> <el-table-column label="编号" align="center" prop="objId" v-if="columns[0].visible"/>
<el-table-column label="计量设备编号" align="center" prop="monitorId" v-if="columns[1].visible"/> <el-table-column label="计量设备编号" align="center" prop="monitorCode" v-if="columns[1].visible"/>
<el-table-column label="计量设备名称" align="center" prop="monitorName" v-if="columns[15].visible"/>
<el-table-column label="采集时间" align="center" prop="collectTime" width="180" v-if="columns[2].visible"> <el-table-column label="采集时间" align="center" prop="collectTime" width="180" v-if="columns[2].visible">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.collectTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span> <span>{{ parseTime(scope.row.collectTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="A项电压" align="center" prop="vA" v-if="columns[3].visible"/> <el-table-column label="A项电压" align="center" prop="va" v-if="columns[3].visible"/>
<el-table-column label="B项电压" align="center" prop="vB" v-if="columns[4].visible"/> <el-table-column label="B项电压" align="center" prop="vb" v-if="columns[4].visible"/>
<el-table-column label="C项电压" align="center" prop="vC" v-if="columns[5].visible"/> <el-table-column label="C项电压" align="center" prop="vc" v-if="columns[5].visible"/>
<el-table-column label="A项电流" align="center" prop="iA" v-if="columns[6].visible"/> <el-table-column label="A项电流" align="center" prop="ia" v-if="columns[6].visible"/>
<el-table-column label="B项电流" align="center" prop="iB" v-if="columns[7].visible"/> <el-table-column label="B项电流" align="center" prop="ib" v-if="columns[7].visible"/>
<el-table-column label="C项电流" align="center" prop="iC" v-if="columns[8].visible"/> <el-table-column label="C项电流" align="center" prop="ic" v-if="columns[8].visible"/>
<el-table-column label="记录时间" align="center" prop="recordTime" width="180" v-if="columns[9].visible"> <el-table-column label="记录时间" align="center" prop="recordTime" width="180" v-if="columns[9].visible">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.recordTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span> <span>{{ parseTime(scope.row.recordTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
@ -224,6 +194,12 @@
</el-table-column> </el-table-column>
</el-table> </el-table>
</el-col>
</el-row>
<pagination <pagination
v-show="total>0" v-show="total>0"
:total="total" :total="total"
@ -236,56 +212,59 @@
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="100px"> <el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-form-item label="计量设备编号" prop="monitorId"> <el-form-item label="计量设备编号" prop="monitorId">
<el-input v-model="form.monitorId" placeholder="请输入计量设备编号"/> <treeselect v-model="form.monitorId" :options="baseMonitorInfoOptions" :normalizer="normalizer" placeholder="请选择父级编号" />
</el-form-item> </el-form-item>
<!-- <el-form-item label="计量设备编号" prop="monitorId">-->
<!-- <el-input v-model="form.monitorId" placeholder="请输入计量设备编号"/>-->
<!-- </el-form-item>-->
<el-form-item label="采集时间" prop="collectTime"> <el-form-item label="采集时间" prop="collectTime">
<el-date-picker clearable <el-date-picker clearable
v-model="form.collectTime" v-model="form.collectTime"
type="date" type="datetime"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择采集时间" placeholder="请选择采集时间"
> >
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item label="A项电压" prop="vA"> <!-- <el-form-item label="A项电压" prop="va">-->
<el-input v-model="form.vA" placeholder="请输入A项电压"/> <!-- <el-input v-model="form.va" placeholder="请输入A项电压"/>-->
</el-form-item> <!-- </el-form-item>-->
<el-form-item label="B项电压" prop="vB"> <!-- <el-form-item label="B项电压" prop="vb">-->
<el-input v-model="form.vB" placeholder="请输入B项电压"/> <!-- <el-input v-model="form.vb" placeholder="请输入B项电压"/>-->
</el-form-item> <!-- </el-form-item>-->
<el-form-item label="C项电压" prop="vC"> <!-- <el-form-item label="C项电压" prop="vc">-->
<el-input v-model="form.vC" placeholder="请输入C项电压"/> <!-- <el-input v-model="form.vc" placeholder="请输入C项电压"/>-->
</el-form-item> <!-- </el-form-item>-->
<el-form-item label="A项电流" prop="iA"> <!-- <el-form-item label="A项电流" prop="ia">-->
<el-input v-model="form.iA" placeholder="请输入A项电流"/> <!-- <el-input v-model="form.ia" placeholder="请输入A项电流"/>-->
</el-form-item> <!-- </el-form-item>-->
<el-form-item label="B项电流" prop="iB"> <!-- <el-form-item label="B项电流" prop="ib">-->
<el-input v-model="form.iB" placeholder="请输入B项电流"/> <!-- <el-input v-model="form.ib" placeholder="请输入B项电流"/>-->
</el-form-item> <!-- </el-form-item>-->
<el-form-item label="C项电流" prop="iC"> <!-- <el-form-item label="C项电流" prop="ic">-->
<el-input v-model="form.iC" placeholder="请输入C项电流"/> <!-- <el-input v-model="form.ic" placeholder="请输入C项电流"/>-->
</el-form-item> <!-- </el-form-item>-->
<el-form-item label="记录时间" prop="recordTime"> <el-form-item label="记录时间" prop="recordTime">
<el-date-picker clearable <el-date-picker clearable
v-model="form.recordTime" v-model="form.recordTime"
type="date" type="datetime"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择记录时间" placeholder="请选择记录时间"
> >
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item label="功率因数" prop="glys"> <!-- <el-form-item label="功率因数" prop="glys">-->
<el-input v-model="form.glys" placeholder="请输入功率因数"/> <!-- <el-input v-model="form.glys" placeholder="请输入功率因数"/>-->
</el-form-item> <!-- </el-form-item>-->
<el-form-item label="正向有功" prop="zxyg"> <el-form-item label="正向有功" prop="zxyg">
<el-input v-model="form.zxyg" placeholder="请输入正向有功"/> <el-input v-model="form.zxyg" placeholder="请输入正向有功"/>
</el-form-item> </el-form-item>
<el-form-item label="有功功率" prop="activePower"> <!-- <el-form-item label="有功功率" prop="activePower">-->
<el-input v-model="form.activePower" placeholder="请输入有功功率"/> <!-- <el-input v-model="form.activePower" placeholder="请输入有功功率"/>-->
</el-form-item> <!-- </el-form-item>-->
<el-form-item label="无功功率" prop="reactivePower"> <!-- <el-form-item label="无功功率" prop="reactivePower">-->
<el-input v-model="form.reactivePower" placeholder="请输入无功功率"/> <!-- <el-input v-model="form.reactivePower" placeholder="请输入无功功率"/>-->
</el-form-item> <!-- </el-form-item>-->
<el-form-item label="采集方式" prop="collectType"> <el-form-item label="采集方式" prop="collectType">
<el-radio-group v-model="form.collectType"> <el-radio-group v-model="form.collectType">
<el-radio <el-radio
@ -313,12 +292,26 @@ import {
addRecordDnbInstant, addRecordDnbInstant,
updateRecordDnbInstant updateRecordDnbInstant
} from '@/api/ems/record/recordDnbInstant' } from '@/api/ems/record/recordDnbInstant'
import { getMonitorInfoTree, listBaseMonitorInfo } from '@/api/ems/base/baseMonitorInfo'
import Treeselect from '@riophae/vue-treeselect'
import { getWorkUnitTrees, listBaseWorkUnit } from '@/api/ems/base/baseWorkUnit'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
export default { export default {
name: 'RecordDnbInstant', name: 'RecordDnbInstant',
dicts: ['collect_type'], dicts: ['collect_type'],
components: {
Treeselect
},
data() { data() {
return { return {
baseMonitorInfoOptions:[],
monitorInfoOptions: [],
workUnitName: undefined,
//
baseMonitorInfoList: [],
nowBeginTime:null,
nowEndTime:null,
// //
loading: true, loading: true,
// //
@ -343,12 +336,12 @@ export default {
pageSize: 10, pageSize: 10,
monitorId: null, monitorId: null,
collectTime: null, collectTime: null,
vA: null, va: null,
vB: null, vb: null,
vC: null, vc: null,
iA: null, ia: null,
iB: null, ib: null,
iC: null, ic: null,
recordTime: null, recordTime: null,
glys: null, glys: null,
zxyg: null, zxyg: null,
@ -356,8 +349,15 @@ export default {
reactivePower: null, reactivePower: null,
collectType: null collectType: null
}, },
queryParamsInsert: {
monitorType:2,
},
// //
form: {}, form: {},
workUnitProps: {
children: 'children',
label: 'label'
},
// //
rules: { rules: {
objId: [ objId: [
@ -368,25 +368,66 @@ export default {
{ key: 0, label: `编号`, visible: false }, { key: 0, label: `编号`, visible: false },
{ key: 1, label: `计量设备编号`, visible: true }, { key: 1, label: `计量设备编号`, visible: true },
{ key: 2, label: `采集时间`, visible: true }, { key: 2, label: `采集时间`, visible: true },
{ key: 3, label: `A项电压`, visible: true }, { key: 3, label: `A项电压`, visible: false },
{ key: 4, label: `B项电压`, visible: true }, { key: 4, label: `B项电压`, visible: false },
{ key: 5, label: `C项电压`, visible: true }, { key: 5, label: `C项电压`, visible: false },
{ key: 6, label: `A项电流`, visible: true }, { key: 6, label: `A项电流`, visible: false },
{ key: 7, label: `B项电流`, visible: true }, { key: 7, label: `B项电流`, visible: false },
{ key: 8, label: `C项电流`, visible: true }, { key: 8, label: `C项电流`, visible: false },
{ key: 9, label: `记录时间`, visible: true }, { key: 9, label: `记录时间`, visible: true },
{ key: 10, label: `功率因数`, visible: true }, { key: 10, label: `功率因数`, visible: true },
{ key: 11, label: `正向有功`, visible: true }, { key: 11, label: `正向有功`, visible: true },
{ key: 12, label: `有功功率`, visible: false }, { key: 12, label: `有功功率`, visible: false },
{ key: 13, label: `无功功率`, visible: false }, { key: 13, label: `无功功率`, visible: false },
{ key: 14, label: `采集方式`, visible: true } { key: 14, label: `采集方式`, visible: true },
{ key: 15, label: `计量设备名称`, visible: true }
] ]
} }
}, },
created() { created() {
this.form.monitorType = 2;
const date = new Date;
this.nowBeginTime = date.toLocaleDateString().replaceAll("/","-")+" 00:00:00";
this.nowEndTime = date.toLocaleDateString().replaceAll("/","-")+" 23:59:59";
this.queryParams.beginCollectTime = this.nowBeginTime,
this.queryParams.endCollectTime=this.nowEndTime,
this.queryParams.beginRecordTime=this.nowBeginTime,
this.queryParams.endRecordTime=this.nowEndTime,
this.getList() this.getList()
this.getTreeselect()
this.getTreeMonitorInfo()
},
watch: {
//
workUnitName(val) {
this.$refs.tree.filter(val)
}
}, },
methods: { methods: {
/** 转换计量设备信息数据结构 */
normalizer(node) {
if (node.children && !node.children.length) {
delete node.children;
}
return {
id: node.objId,
label: node.monitorName,
children: node.children
};
},
/** 查询计量设备信息下拉树结构 新增用*/
getTreeMonitorInfo() {
listBaseMonitorInfo(this.queryParamsInsert).then(response => {
this.baseMonitorInfoOptions = [];
const data = { objId: 0, monitorName: '顶级节点', children: [] };
data.children = this.handleTree(response.data, "objId", "parentId");
this.baseMonitorInfoOptions.push(data);
});
},
//
changeDate() {
this.$forceUpdate()
},
/** 查询电实时数据列表 */ /** 查询电实时数据列表 */
getList() { getList() {
this.loading = true this.loading = true
@ -406,13 +447,14 @@ export default {
this.form = { this.form = {
objId: null, objId: null,
monitorId: null, monitorId: null,
monitorType:2,
collectTime: null, collectTime: null,
vA: null, va: null,
vB: null, vb: null,
vC: null, vc: null,
iA: null, ia: null,
iB: null, ib: null,
iC: null, ic: null,
recordTime: null, recordTime: null,
glys: null, glys: null,
zxyg: null, zxyg: null,
@ -429,6 +471,11 @@ export default {
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.queryParams.beginCollectTime = this.nowBeginTime;
this.queryParams.endCollectTime = this.nowEndTime;
this.queryParams.beginRecordTime = this.nowBeginTime;
this.queryParams.endRecordTime = this.nowEndTime;
this.queryParams.monitorId = null
this.resetForm('queryForm') this.resetForm('queryForm')
this.handleQuery() this.handleQuery()
}, },
@ -490,7 +537,26 @@ export default {
this.download('ems/record/recordDnbInstant/export', { this.download('ems/record/recordDnbInstant/export', {
...this.queryParams ...this.queryParams
}, `recordDnbInstant_${new Date().getTime()}.xlsx`) }, `recordDnbInstant_${new Date().getTime()}.xlsx`)
} },
/** 查询计量设备信息下拉树结构 */
getTreeselect() {
getMonitorInfoTree(this.form).then(response => {
this.monitorInfoOptions = response.data;
})
},
//
filterNode(value, data) {
if (!value) return true
return data.label.indexOf(value) !== -1
},
//
handleNodeClick(data) {
this.queryParams.monitorId = data.id
this.handleQuery()
},
} }
} }
</script> </script>

@ -0,0 +1,485 @@
<template>
<div class="app-container">
<el-row :gutter="28">
<el-col :span="5" :xs="24">
<div class="head-container">
<el-input
v-model="workUnitName"
placeholder="请输入计量设备名称"
clearable
size="small"
prefix-icon="el-icon-search"
style="margin-bottom: 20px"
/>
</div>
<div class="head-container">
<el-tree
:data="monitorInfoOptions"
:props="workUnitProps"
:expand-on-click-node="false"
:filter-node-method="filterNode"
ref="tree"
node-key="id"
default-expand-all
highlight-current
@node-click="handleNodeClick"
/>
</div>
</el-col>
<el-col :span="19" :xs="24">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
<el-form-item label="采集时间" >
<el-date-picker clearable prop="beginCollectTime"
v-model="queryParams.beginCollectTime"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
@input="changeDate"
placeholder="请选择开始时间">
</el-date-picker>
-
<el-date-picker clearable prop="endCollectTime"
v-model="queryParams.endCollectTime"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
@input="changeDate"
placeholder="请选择结束时间">
</el-date-picker>
</el-form-item>
<el-form-item label="采集方式" prop="collectType">
<el-select v-model="queryParams.collectType" placeholder="请选择采集方式" clearable>
<el-option
v-for="dict in dict.type.collect_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="记录时间" prop="recordTime">
<el-date-picker clearable
v-model="queryParams.beginRecordTime"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
@input="changeDate"
placeholder="请选择记录时间">
</el-date-picker>
-
<el-date-picker clearable
v-model="queryParams.endRecordTime"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
@input="changeDate"
placeholder="请选择记录时间">
</el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @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="['ems/record:recordWaterInstant:add']"
>新增
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['ems/record:recordWaterInstant:edit']"
>修改
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['ems/record:recordWaterInstant:remove']"
>删除
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['ems/record:recordWaterInstant:export']"
>导出
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="recordWaterInstantList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center"/>
<!-- <el-table-column label=" " align="center" prop="objId" v-if="columns[0].visible"/>-->
<el-table-column label="计量设备编号" align="center" prop="monitorCode" v-if="columns[1].visible"/>
<el-table-column label="计量设备名称" align="center" prop="monitorName" v-if="columns[7].visible"/>
<el-table-column label="采集时间" align="center" prop="collectTime" width="180" v-if="columns[2].visible">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.collectTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="瞬时流量" align="center" prop="fluxFlow" v-if="columns[3].visible"/>
<el-table-column label="累计流量" align="center" prop="waterFlow" v-if="columns[4].visible"/>
<el-table-column label="记录时间" align="center" prop="recordTime" width="180" v-if="columns[5].visible">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.recordTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="采集方式" align="center" prop="collectType" v-if="columns[6].visible">
<template slot-scope="scope">
<dict-tag :options="dict.type.collect_type" :value="scope.row.collectType"/>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['ems/record:recordWaterInstant:edit']"
>修改
</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['ems/record:recordWaterInstant:remove']"
>删除
</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</el-col>
</el-row>
<!-- 添加或修改水实时数据对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-form-item label="计量设备编号" prop="monitorId">
<treeselect v-model="form.monitorId" :options="baseMonitorInfoOptions" :normalizer="normalizer" placeholder="请选择父级编号" />
</el-form-item>
<el-form-item label="采集时间" prop="collectTime">
<el-date-picker clearable
v-model="form.collectTime"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择采集时间">
</el-date-picker>
</el-form-item>
<el-form-item label="瞬时流量" prop="fluxFlow">
<el-input v-model="form.fluxFlow" placeholder="请输入瞬时流量"/>
</el-form-item>
<el-form-item label="累计流量" prop="waterFlow">
<el-input v-model="form.waterFlow" placeholder="请输入累计流量"/>
</el-form-item>
<el-form-item label="记录时间" prop="recordTime">
<el-date-picker clearable
v-model="form.recordTime"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择采集时间">
</el-date-picker>
</el-form-item>
<el-form-item label="采集方式" prop="collectType">
<el-radio-group v-model="form.collectType">
<el-radio
v-for="dict in dict.type.collect_type"
:key="dict.value"
:label="parseInt(dict.value)"
>{{ dict.label }}
</el-radio>
</el-radio-group>
</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 {
listRecordWaterInstant,
getRecordWaterInstant,
delRecordWaterInstant,
addRecordWaterInstant,
updateRecordWaterInstant
} from '@/api/ems/record/recordWaterInstant'
import { getMonitorInfoTree, listBaseMonitorInfo } from '@/api/ems/base/baseMonitorInfo'
import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
export default {
name: 'RecordWaterInstant',
dicts: ['collect_type'],
components: {
Treeselect
},
data() {
return {
baseMonitorInfoOptions:[],
monitorInfoOptions: [],
workUnitOptions: [],
workUnitName: undefined,
//
baseMonitorInfoList: [],
nowBeginTime:null,
nowEndTime:null,
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
recordWaterInstantList: [],
//
title: '',
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
monitorId: null,
monitorType: 3,
collectTime: null,
fluxFlow: null,
waterFlow: null,
recordTime: null,
collectType: null
},
queryParamsInsert: {
monitorType:3,
},
//
form: {},
workUnitProps: {
children: 'children',
label: 'label'
},
//
rules: {
objId: [
{ required: true, message: ' 不能为空', trigger: 'blur' }
]
},
columns: [
{ key: 0, label: ` `, visible: true },
{ key: 1, label: `计量设备编号`, visible: true },
{ key: 2, label: `采集时间`, visible: true },
{ key: 3, label: `瞬时流量`, visible: true },
{ key: 4, label: `累计流量`, visible: true },
{ key: 5, label: `记录时间`, visible: true },
{ key: 6, label: `采集方式`, visible: true },
{ key: 7, label: `计量设备名称`, visible: true }
]
}
},
created() {
this.form.monitorType = 3;
const date = new Date;
this.nowBeginTime = date.toLocaleDateString().replaceAll("/","-")+" 00:00:00";
this.nowEndTime = date.toLocaleDateString().replaceAll("/","-")+" 23:59:59";
this.queryParams.beginCollectTime = this.nowBeginTime,
this.queryParams.endCollectTime=this.nowEndTime,
this.queryParams.beginRecordTime=this.nowBeginTime,
this.queryParams.endRecordTime=this.nowEndTime,
this.getList();
this.getTreeselect()
this.getTreeMonitorInfo()
},
watch: {
//
workUnitName(val) {
this.$refs.tree.filter(val)
}
},
methods: {
//
changeDate() {
this.$forceUpdate()
},
/** 查询计量设备信息下拉树结构 新增用*/
getTreeMonitorInfo() {
listBaseMonitorInfo(this.queryParamsInsert).then(response => {
this.baseMonitorInfoOptions = [];
const data = { objId: 0, monitorName: '顶级节点', children: [] };
data.children = this.handleTree(response.data, "objId", "parentId");
this.baseMonitorInfoOptions.push(data);
});
},
/** 查询水实时数据列表 */
getList() {
this.loading = true
listRecordWaterInstant(this.queryParams).then(response => {
this.recordWaterInstantList = response.rows
this.total = response.total
this.loading = false
})
},
//
cancel() {
this.open = false
this.reset()
},
//
reset() {
this.form = {
objId: null,
monitorId: null,
monitorType: 3,
collectTime: null,
fluxFlow: null,
waterFlow: null,
recordTime: null,
collectType: null
}
this.resetForm('form')
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.queryParams.beginCollectTime = this.nowBeginTime
this.queryParams.endCollectTime = this.nowEndTime
this.queryParams.beginRecordTime = this.nowBeginTime
this.queryParams.endRecordTime = this.nowEndTime
this.queryParams.monitorId = null
this.resetForm('queryForm')
this.handleQuery()
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.objId)
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset()
this.open = true
this.title = '添加水实时数据'
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset()
const objId = row.objId || this.ids
getRecordWaterInstant(objId).then(response => {
this.form = response.data
this.open = true
this.title = '修改水实时数据'
})
},
/** 提交按钮 */
submitForm() {
this.$refs['form'].validate(valid => {
if (valid) {
if (this.form.objId != null) {
updateRecordWaterInstant(this.form).then(response => {
this.$modal.msgSuccess('修改成功')
this.open = false
this.getList()
})
} else {
addRecordWaterInstant(this.form).then(response => {
this.$modal.msgSuccess('新增成功')
this.open = false
this.getList()
})
}
}
})
},
/** 删除按钮操作 */
handleDelete(row) {
const objIds = row.objId || this.ids
this.$modal.confirm('是否确认删除水实时数据编号为"' + objIds + '"的数据项?').then(function() {
return delRecordWaterInstant(objIds)
}).then(() => {
this.getList()
this.$modal.msgSuccess('删除成功')
}).catch(() => {
})
},
/** 导出按钮操作 */
handleExport() {
this.download('ems/record/recordWaterInstant/export', {
...this.queryParams
}, `recordWaterInstant_${new Date().getTime()}.xlsx`)
},
/** 查询计量设备信息下拉树结构 */
getTreeselect() {
getMonitorInfoTree(this.form).then(response => {
this.monitorInfoOptions = response.data;
})
},
/** 转换计量设备信息数据结构 */
normalizer(node) {
if (node.children && !node.children.length) {
delete node.children
}
return {
id: node.objId,
label: node.monitorName,
children: node.children
}
},
//
filterNode(value, data) {
if (!value) return true
return data.label.indexOf(value) !== -1
},
//
handleNodeClick(data) {
this.queryParams.monitorId = data.id
this.handleQuery()
}
}
}
</script>

@ -1,14 +1,14 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<!-- <el-form-item label="物料编码" prop="materialCode">--> <el-form-item label="物料编码" prop="materialCode">
<!-- <el-input--> <el-input
<!-- v-model="queryParams.materialCode"--> v-model="queryParams.materialCode"
<!-- placeholder="请输入物料编码"--> placeholder="请输入物料编码"
<!-- clearable--> clearable
<!-- @keyup.enter.native="handleQuery"--> @keyup.enter.native="handleQuery"
<!-- />--> />
<!-- </el-form-item>--> </el-form-item>
<el-form-item label="物料名称" prop="materialName"> <el-form-item label="物料名称" prop="materialName">
<el-input <el-input
v-model="queryParams.materialName" v-model="queryParams.materialName"
@ -32,8 +32,7 @@
size="mini" size="mini"
@click="handleAdd" @click="handleAdd"
v-hasPermi="['base:orderBomInfo:add']" v-hasPermi="['base:orderBomInfo:add']"
>新增 >新增</el-button>
</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@ -42,8 +41,7 @@
icon="el-icon-sort" icon="el-icon-sort"
size="mini" size="mini"
@click="toggleExpandAll" @click="toggleExpandAll"
>展开/折叠 >展开/折叠</el-button>
</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@ -52,8 +50,7 @@
icon="el-icon-close" icon="el-icon-close"
size="mini" size="mini"
@click="handleClose" @click="handleClose"
>关闭 >关闭</el-button>
</el-button>
</el-col> </el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
</el-row> </el-row>
@ -67,23 +64,19 @@
:tree-props="{children: 'children', hasChildren: 'hasChildren'}" :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
> >
<!-- <el-table-column label="BOM编号" prop="bomCode" />--> <!-- <el-table-column label="BOM编号" prop="bomCode" />-->
<el-table-column label="物料编码" align="center" prop="materialCode"/> <el-table-column label="物料编码" align="center" prop="materialCode" />
<el-table-column label="物料名称" align="center" prop="materialName"/> <el-table-column label="物料名称" align="center" prop="materialName" />
<el-table-column label="物料类别" align="center" prop="materialType"> <el-table-column label="物料类别" align="center" prop="materialType">
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :options="dict.type.material_subclass" :value="scope.row.materialType"/> <dict-tag :options="dict.type.material_type" :value="scope.row.materialType"/>
</template>
</el-table-column>
<el-table-column label="标准数量" align="center" prop="standardAmount"/>
<el-table-column label="计量单位" align="center" prop="materialUnit">
<template slot-scope="scope">
<dict-tag :options="dict.type.material_unit" :value="scope.row.materialUnit"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="工厂名称" align="center" prop="factoryName"/> <el-table-column label="标准数量" align="center" prop="standardAmount" />
<!-- <el-table-column label="排序" align="center" prop="sort" />--> <el-table-column label="父级编号" align="center" prop="parentId" />
<!-- <el-table-column label="销售凭证" align="center" prop="vbeln" />--> <el-table-column label="工厂编号" align="center" prop="factoryCode" />
<!-- <el-table-column label="销售单据项目" align="center" prop="vbpos" />--> <!-- <el-table-column label="排序" align="center" prop="sort" />-->
<!-- <el-table-column label="销售凭证" align="center" prop="vbeln" />-->
<!-- <el-table-column label="销售单据项目" align="center" prop="vbpos" />-->
<!-- <el-table-column label="启用标识" align="center" prop="isFlag">--> <!-- <el-table-column label="启用标识" align="center" prop="isFlag">-->
<!-- <template slot-scope="scope">--> <!-- <template slot-scope="scope">-->
<!-- <dict-tag :options="dict.type.is_flag" :value="scope.row.isFlag"/>--> <!-- <dict-tag :options="dict.type.is_flag" :value="scope.row.isFlag"/>-->
@ -101,7 +94,7 @@
<!-- <span>{{ parseTime(scope.row.updatedTime, '{y}-{m}-{d}') }}</span>--> <!-- <span>{{ parseTime(scope.row.updatedTime, '{y}-{m}-{d}') }}</span>-->
<!-- </template>--> <!-- </template>-->
<!-- </el-table-column>--> <!-- </el-table-column>-->
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="180"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini" size="mini"
@ -109,72 +102,65 @@
icon="el-icon-edit" icon="el-icon-edit"
@click="handleUpdate(scope.row)" @click="handleUpdate(scope.row)"
v-hasPermi="['base:orderBomInfo:edit']" v-hasPermi="['base:orderBomInfo:edit']"
>修改 >修改</el-button>
</el-button>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-plus" icon="el-icon-plus"
@click="handleAdd(scope.row)" @click="handleAdd(scope.row)"
v-hasPermi="['base:orderBomInfo:add']" v-hasPermi="['base:orderBomInfo:add']"
>新增 >新增</el-button>
</el-button>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-delete" icon="el-icon-delete"
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPermi="['base:orderBomInfo:remove']" v-hasPermi="['base:orderBomInfo:remove']"
>删除 >删除</el-button>
</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<!-- 添加或修改订单BOM对话框 --> <!-- 添加或修改订单BOM对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="100px"> <el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="父级编号" prop="parentId"> <el-form-item label="父级编号" prop="parentId">
<treeselect v-model="form.parentId" :options="orderBomInfoOptions" :normalizer="normalizer" <treeselect v-model="form.parentId" :options="orderBomInfoOptions" :normalizer="normalizer" placeholder="请选择父级编号" />
placeholder="请选择父级编号"
/>
</el-form-item> </el-form-item>
<!-- <el-form-item label="BOM编号" prop="bomCode">--> <el-form-item label="BOM编号" prop="bomCode">
<!-- <el-input v-model="form.bomCode" placeholder="请输入BOM编号"/>--> <el-input v-model="form.bomCode" placeholder="请输入BOM编号" />
<!-- </el-form-item>-->
<el-form-item label="子物料编号" prop="materialCode">
<el-input v-model="form.materialCode" placeholder="请输入成品物料编号" disabled/>
</el-form-item> </el-form-item>
<el-form-item label="子物料名称" prop="materialName"> <el-form-item label="物料编码" prop="materialCode">
<el-input v-model="form.materialName" placeholder="请输入物料名称"> <el-input v-model="form.materialCode" placeholder="请输入物料编码" />
<el-button slot="append" icon="el-icon-search" @click="handleMaterialAdd"></el-button> </el-form-item>
</el-input> <el-form-item label="物料名称" prop="materialName">
<el-input v-model="form.materialName" placeholder="请输入物料名称" />
</el-form-item>
<el-form-item label="物料类别" prop="materialType">
<el-select v-model="form.materialType" placeholder="请选择物料类别">
<el-option
v-for="dict in dict.type.material_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item> </el-form-item>
<!-- <el-form-item label="物料类别" prop="materialType">-->
<!-- <el-select v-model="form.materialType" placeholder="请选择物料类别">-->
<!-- <el-option-->
<!-- v-for="dict in dict.type.material_type"-->
<!-- :key="dict.value"-->
<!-- :label="dict.label"-->
<!-- :value="dict.value"-->
<!-- ></el-option>-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<el-form-item label="标准数量" prop="standardAmount"> <el-form-item label="标准数量" prop="standardAmount">
<el-input-number v-model="form.standardAmount" placeholder="请输入标准数量"/> <el-input v-model="form.standardAmount" placeholder="请输入标准数量" />
</el-form-item>
<el-form-item label="工厂编号" prop="factoryCode">
<el-input v-model="form.factoryCode" placeholder="请输入工厂编号" />
</el-form-item>
<el-form-item label="排序" prop="sort">
<el-input v-model="form.sort" placeholder="请输入排序" />
</el-form-item>
<el-form-item label="销售凭证" prop="vbeln">
<el-input v-model="form.vbeln" placeholder="请输入销售凭证" />
</el-form-item>
<el-form-item label="销售单据项目" prop="vbpos">
<el-input v-model="form.vbpos" placeholder="请输入销售单据项目" />
</el-form-item> </el-form-item>
<!-- <el-form-item label="工厂编号" prop="factoryCode">-->
<!-- <el-input v-model="form.factoryCode" placeholder="请输入工厂编号"/>-->
<!-- </el-form-item>-->
<!-- <el-form-item label="排序" prop="sort">-->
<!-- <el-input v-model="form.sort" placeholder="请输入排序"/>-->
<!-- </el-form-item>-->
<!-- <el-form-item label="销售凭证" prop="vbeln">-->
<!-- <el-input v-model="form.vbeln" placeholder="请输入销售凭证"/>-->
<!-- </el-form-item>-->
<!-- <el-form-item label="销售单据项目" prop="vbpos">-->
<!-- <el-input v-model="form.vbpos" placeholder="请输入销售单据项目"/>-->
<!-- </el-form-item>-->
<!-- <el-form-item label="启用标识" prop="isFlag">--> <!-- <el-form-item label="启用标识" prop="isFlag">-->
<!-- <el-radio-group v-model="form.isFlag">--> <!-- <el-radio-group v-model="form.isFlag">-->
<!-- <el-radio--> <!-- <el-radio-->
@ -190,16 +176,6 @@
<el-button @click="cancel"> </el-button> <el-button @click="cancel"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
<!-- 添加物料信息对话框 -->
<el-dialog title="添加成品BOM明细" :visible.sync="materialOpen" width="900px" append-to-body>
<add-bom @selection="handleSelection" ref="materialRef"></add-bom>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitMaterialForm"> </el-button>
<el-button @click="materialOpen = false"> </el-button>
</div>
</el-dialog>
</div> </div>
</template> </template>
@ -209,17 +185,15 @@ import {
delProdBomInfo, delProdBomInfo,
addProdBomInfo, addProdBomInfo,
updateProdBomInfo, updateProdBomInfo,
productionBomTreeList, findOrderBomList findOrderBomList
} from '@/api/mes/prod/prodBomInfo' } from '@/api/mes/prod/prodBomInfo'
import Treeselect from '@riophae/vue-treeselect' import Treeselect from "@riophae/vue-treeselect";
import '@riophae/vue-treeselect/dist/vue-treeselect.css' import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import addBom from '@//views/mes/prod/prodBomInfo/addBom.vue'
export default { export default {
name: 'OrderBomInfo', name: "OrderBomInfo",
dicts: ['material_subclass', 'is_flag', 'material_unit'], dicts: ['material_type', 'is_flag'],
components: { components: {
'add-bom': addBom,
Treeselect Treeselect
}, },
data() { data() {
@ -233,15 +207,13 @@ export default {
// BOM // BOM
orderBomInfoOptions: [], orderBomInfoOptions: [],
// //
title: '', title: "",
// //
open: false, open: false,
// //
isExpandAll: true, isExpandAll: true,
// //
refreshTable: true, refreshTable: true,
//
materialOpen: false,
// //
queryParams: { queryParams: {
bomCode: null, bomCode: null,
@ -264,51 +236,48 @@ export default {
// //
form: {}, form: {},
// //
rules: {} rules: {
} }
};
}, },
created() { created() {
this.queryParams.objId = this.$route.params && this.$route.params.materialCode this.queryParams.ancestors = this.$route.params && this.$route.params.materialCode;
this.getList() console.log( this.queryParams.ancestors)
this.getList();
}, },
methods: { methods: {
/** 查询订单BOM列表 */ /** 查询订单BOM列表 */
getList() { getList() {
this.loading = true this.loading = true;
productionBomTreeList(this.queryParams).then(response => { findOrderBomList(this.queryParams).then(response => {
this.orderBomInfoList = this.handleTree(response.data, 'objId', 'parentId') this.orderBomInfoList = this.handleTree(response.data, "materialCode", "parentId");
this.loading = false this.loading = false;
}) });
}, },
/** 转换订单BOM数据结构 */ /** 转换订单BOM数据结构 */
normalizer(node) { normalizer(node) {
if (node.children && !node.children.length) { if (node.children && !node.children.length) {
delete node.children delete node.children;
} }
return { return {
id: node.objId, id: node.materialCode,
label: node.materialName, label: node.materialName,
children: node.children children: node.children
} };
},
handleSelection(selection) {
this.ids = selection.map(item => item.objId)
this.single = selection.length !== 1
this.multiple = !selection.length
}, },
/** 查询订单BOM下拉树结构 */ /** 查询订单BOM下拉树结构 */
getTreeselect() { getTreeselect() {
findOrderBomList().then(response => { findOrderBomList().then(response => {
this.orderBomInfoOptions = [] this.orderBomInfoOptions = [];
const data = { objId: 0, materialName: '顶级节点', children: [] } const data = { materialCode: 0, materialName: '顶级节点', children: [] };
data.children = this.handleTree(response.data, 'objId', 'parentId') data.children = this.handleTree(response.data, "materialCode", "parentId");
this.orderBomInfoOptions.push(data) this.orderBomInfoOptions.push(data);
}) });
}, },
// //
cancel() { cancel() {
this.open = false this.open = false;
this.reset() this.reset();
}, },
// //
reset() { reset() {
@ -330,101 +299,85 @@ export default {
vbeln: null, vbeln: null,
vbpos: null, vbpos: null,
ancestors: null ancestors: null
} };
this.resetForm('form') this.resetForm("form");
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.getList() this.getList();
},
/** 新增按钮操作 */
handleMaterialAdd() {
this.materialOpen = true
// this.title = "BOM";
},
/** 提交物料信息按钮 */
submitMaterialForm() {
let selectedRow = this.$refs.materialRef.selectedRow
// this.form.bomCode = selectedRow.bomCode;
this.form.materialCode = selectedRow.materialCode
this.form.materialName = selectedRow.materialName
this.form.factoryCode = selectedRow.factoryCode
this.form.materialType = selectedRow.materialSubclass
this.materialOpen = false
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.resetForm('queryForm') this.resetForm("queryForm");
this.handleQuery() this.handleQuery();
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd(row) { handleAdd(row) {
this.reset() this.reset();
this.getTreeselect() this.getTreeselect();
if (row != null && row.objId) { if (row != null && row.materialCode) {
this.form.parentId = row.objId this.form.parentId = row.materialCode;
} else { } else {
this.form.parentId = 0 this.form.parentId = 0;
} }
this.open = true this.open = true;
this.title = '添加订单BOM' this.title = "添加订单BOM";
}, },
/** 返回按钮操作 */ /** 返回按钮操作 */
handleClose() { handleClose() {
const obj = { path: '/prod/prodBomInfo' } const obj = { path: "/base/orderBomInfo" };
this.$tab.closeOpenPage(obj) this.$tab.closeOpenPage(obj);
}, },
/** 展开/折叠操作 */ /** 展开/折叠操作 */
toggleExpandAll() { toggleExpandAll() {
this.refreshTable = false this.refreshTable = false;
this.isExpandAll = !this.isExpandAll this.isExpandAll = !this.isExpandAll;
this.$nextTick(() => { this.$nextTick(() => {
this.refreshTable = true this.refreshTable = true;
}) });
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset() this.reset();
this.getTreeselect() this.getTreeselect();
if (row != null) { if (row != null) {
this.form.parentId = row.parentId this.form.parentId = row.parentId;
} }
getProdBomInfo(row.objId).then(response => { getProdBomInfo(row.objId).then(response => {
this.form = response.data this.form = response.data;
this.open = true this.open = true;
this.title = '修改订单BOM' this.title = "修改订单BOM";
}) });
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
this.$refs['form'].validate(valid => { this.$refs["form"].validate(valid => {
if (valid) { if (valid) {
if (this.form.objId != null) { if (this.form.objId != null) {
updateProdBomInfo(this.form).then(response => { updateProdBomInfo(this.form).then(response => {
this.$modal.msgSuccess('修改成功') this.$modal.msgSuccess("修改成功");
this.open = false this.open = false;
this.getList() this.getList();
}) });
} else { } else {
addProdBomInfo(this.form).then(response => { addProdBomInfo(this.form).then(response => {
this.$modal.msgSuccess('新增成功') this.$modal.msgSuccess("新增成功");
this.open = false this.open = false;
this.getList() this.getList();
}) });
} }
} }
}) });
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
this.$modal.confirm('是否确认删除订单BOM编号为"' + row.objId + '"的数据项?').then(function() { this.$modal.confirm('是否确认删除订单BOM编号为"' + row.objId + '"的数据项?').then(function() {
return delProdBomInfo(row.objId) return delProdBomInfo(row.objId);
}).then(() => { }).then(() => {
this.getList() this.getList();
this.$modal.msgSuccess('删除成功') this.$modal.msgSuccess("删除成功");
}).catch(() => { }).catch(() => {});
})
} }
} }
} };
</script> </script>

@ -94,7 +94,7 @@
<el-table-column label="BOM编号" align="center" prop="bomCode" v-if="columns[1].visible"/> <el-table-column label="BOM编号" align="center" prop="bomCode" v-if="columns[1].visible"/>
<el-table-column label="成品物料编号" align="center" prop="materialCode" v-if="columns[2].visible"> <el-table-column label="成品物料编号" align="center" prop="materialCode" v-if="columns[2].visible">
<template slot-scope="scope"> <template slot-scope="scope">
<router-link :to="'/production/bom-info/index/' + scope.row.objId" class="link-type"> <router-link :to="'/production/bom-info/index/' + scope.row.materialCode" class="link-type">
<span>{{ scope.row.materialCode }}</span> <span>{{ scope.row.materialCode }}</span>
</router-link> </router-link>
</template> </template>
@ -107,13 +107,13 @@
</el-table-column> </el-table-column>
<el-table-column label="标准数量" align="center" prop="standardAmount" v-if="columns[5].visible"/> <el-table-column label="标准数量" align="center" prop="standardAmount" v-if="columns[5].visible"/>
<!-- <el-table-column label="父物料编号" align="center" prop="parentId" v-if="columns[6].visible"/>--> <!-- <el-table-column label="父物料编号" align="center" prop="parentId" v-if="columns[6].visible"/>-->
<el-table-column label="工厂名称" align="center" prop="factoryName" v-if="columns[7].visible"/> <el-table-column label="工厂名称" align="center" prop="plantName" v-if="columns[7].visible"/>
<!-- <el-table-column label="产线/工位" align="center" prop="productLineCode" v-if="columns[8].visible"/>--> <!-- <el-table-column label="产线/工位" align="center" prop="productLineCode" v-if="columns[8].visible"/>-->
<!-- <el-table-column label="工单编号" align="center" prop="orderCode" v-if="columns[14].visible"/>--> <!-- <el-table-column label="工单编号" align="center" prop="orderCode" v-if="columns[14].visible"/>-->
<el-table-column label="是否可生产" align="center" prop="isPlanToStation" v-if="columns[9].visible"> <el-table-column label="是否可生产" align="center" prop="isPlanToStation" v-if="columns[9].visible">
<!-- <template slot-scope="scope">--> <template slot-scope="scope">
<!-- <dict-tag :options="dict.type.is_release" :value="scope.row.isPlanToStation"/>--> <dict-tag :options="dict.type.is_release" :value="scope.row.isPlanToStation"/>
<!-- </template>--> </template>
</el-table-column> </el-table-column>
<el-table-column label="创建人" align="center" prop="createBy" v-if="columns[10].visible"/> <el-table-column label="创建人" align="center" prop="createBy" v-if="columns[10].visible"/>
<el-table-column label="创建时间" align="center" prop="createTime" width="180" v-if="columns[11].visible"> <el-table-column label="创建时间" align="center" prop="createTime" width="180" v-if="columns[11].visible">
@ -127,7 +127,7 @@
<span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span> <span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="100"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini" size="mini"
@ -200,7 +200,7 @@
<el-radio <el-radio
v-for="dict in dict.type.is_flag" v-for="dict in dict.type.is_flag"
:key="dict.value" :key="dict.value"
:label="dict.value" :label="parseInt(dict.value)"
>{{dict.label}}</el-radio> >{{dict.label}}</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
@ -225,17 +225,17 @@
<script> <script>
import { import {
listProdBomInfo, listProdBomInfo,
c, getProdBomInfo,
delProdBomInfo, delProdBomInfo,
addProdBomInfo, addProdBomInfo,
updateProdBomInfo, getProdBomInfo updateProdBomInfo
} from '@/api/mes/prod/prodBomInfo' } from '@/api/mes/prod/prodBomInfo'
import {getBaseFactoryList} from "@//api/mes/base/baseFactory"; import {getBaseFactoryList} from "@//api/mes/base/baseFactory";
import addBom from '@//views/mes/prod/prodBomInfo/addBom.vue'; import addBom from '@//views/mes/prod/prodBomInfo/addBom.vue';
export default { export default {
name: 'ProdBomInfo', name: 'ProdBomInfo',
dicts: ['is_flag','material_subclass'], dicts: ['is_flag'],
components: { components: {
'add-bom': addBom 'add-bom': addBom
}, },
@ -307,11 +307,11 @@ export default {
factoryList: [] factoryList: []
}; };
}, },
created() { create() {
// getBaseFactoryList().then(response => {
// this.factoryList = response.data;
// });
this.getList(); this.getList();
getBaseFactoryList().then(response => {
this.factoryList = response.data;
});
}, },
methods: { methods: {
/** 查询生产BOM列表 */ /** 查询生产BOM列表 */
@ -337,11 +337,11 @@ export default {
materialName: null, materialName: null,
materialType: 1, materialType: 1,
standardAmount: 1, standardAmount: 1,
parentId: 0, parentId: null,
plantCode: null, plantCode: null,
productLineCode: null, productLineCode: null,
isPlanToStation: null, isPlanToStation: null,
isFlag: '0', isFlag: 0,
createBy: null, createBy: null,
createTime: null, createTime: null,
updateBy: null, updateBy: null,

Loading…
Cancel
Save