Files
hb_pqs_web/src/views/Account-management/components/TerminalAccount.vue
2025-01-09 19:02:44 +08:00

773 lines
31 KiB
Vue

<template>
<div>
<el-form :inline="true" :model="ruleForm" class="demo-form-inline">
<el-form-item>
<Area @click="handleNodeArea"></Area>
</el-form-item>
<el-form-item label="信息查询:">
<el-input v-model.trim="ruleForm.searchValue" placeholder="请输入查询信息" clearable></el-input>
</el-form-item>
<el-form-item label="装置类别:">
<el-select v-model="ruleForm.deviceCategory" placeholder="请选择装置类别" clearable class="select">
<el-option v-for="item in deviceCategoryList" :key="item.id" :label="item.name"
:value="item.id"></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-download" class="pms">PMS获取数据</el-button>
<!-- <el-button type="primary" icon="el-icon-upload2" class="ml10" @click="upload">PMS数据上传</el-button> -->
<el-button type="primary" class="ml10" icon="el-icon-search" @click="pagMonitor">查询</el-button>
<!-- <el-button type="primary" icon="el-icon-refresh-right" @click="Reset"
>重置</el-button
> -->
<el-button type="primary" icon="el-icon-download" @click="exportEvent">导出</el-button>
</el-form-item>
</el-form>
<template>
<span>
<el-button type="primary" size="mini" class="ml10" icon="el-icon-plus" @click="addFn">新增</el-button>
<el-button type="primary" size="mini" class="ml10" icon="el-icon-edit" @click="modifyFn">
修改
</el-button>
<el-button type="primary" size="mini" class="ml10" icon="el-icon-delete" @click="deleteFn">
删除
</el-button>
</span>
<vxe-table stripe :data="UserData" :height="height" border :row-config="{ isCurrent: true, isHover: true }"
size="mini" ref="TerminalAccount" style="width: 100%" v-loading="isLoading"
header-cell-class-name="table_header" @checkbox-all="handleSelectionChange"
@checkbox-change="handleSelectionChange" class="mt10" :cell-style="cellStyle">
<vxe-table-column align="center" type="checkbox" width="55"></vxe-table-column>
<vxe-table-column v-for="(item, index) in tableHeaderMonitor" align="center" :field="item.prop"
:title="item.label" :min-width="item.width" :key="index" :formatter="formFilter"
:show-overflow="true"></vxe-table-column>
</vxe-table>
<el-pagination background align="right" @size-change="handleSizeChange"
@current-change="handleCurrentChange" :current-page="ruleForm.pageNum"
:page-sizes="[20, 30, 40, 50, 100]" :page-size="ruleForm.pageSize"
layout="total, sizes, prev, pager, next, jumper" :total="total" class="mt10"></el-pagination>
</template>
<!-- <PMS_Data
:PMSobtain="PMSobtain"
:title="title"
@Close="Close"
:Data="UserData"
:Name="tableHeaderMonitor"
></PMS_Data> -->
<!-- 新增/修改 -->
<el-dialog :close-on-click-modal="false" :title="title" :visible.sync="addinformation"
:before-close="handleClose" width="50%" height="80%">
<el-form :inline="true" :model="form" label-width="170px" class="form" :rules="rules" ref="rulesform">
<el-form-item label="终端编号:" prop="id" class="mt10">
<el-input v-model="form.id" placeholder="请输入终端编号" clearable :disabled="disabled"></el-input>
</el-form-item>
<el-form-item label="终端名称:" prop="name" class="mt10">
<el-input v-model="form.name" clearable placeholder="请输入终端名称"></el-input>
</el-form-item>
<el-form-item prop="orgName" class="mt10" label="组织机构名称:" :rules="{
required: true,
message: '请输入组织机构名称',
trigger: 'change'
}">
<Organization @click="handleNodeClick" ref="Organization" :valueTitle="valueTitle"
:editCheckCode="editCheckCode"></Organization>
</el-form-item>
<el-form-item prop="operationName" class="mt10" label="运维单位名称:" :rules="{
required: true,
message: '请输入运维单位名称',
trigger: 'change'
}">
<Operation @click="handleNodeClick1" ref="Operation" :valueTitle="valueTitle1"
:editCheckCode="editCheckCode1"></Operation>
</el-form-item>
<el-form-item label="变电站名称:" prop="powerStationId" class="mt10">
<el-select v-model="form.powerStationId" clearable placeholder="请选择变电站名称" @change="changeFn3"
filterable>
<el-option v-for="item in statationName" :key="item.powerId"
:label="item.orgName + '_' + item.powerName" :value="item.powerId"></el-option>
</el-select>
</el-form-item>
<el-form-item label="终端状态:" prop="terminalState" class="mt10">
<el-select v-model="form.terminalState" clearable placeholder="请选择终端状态">
<el-option v-for="item in terminalStateList" :key="item.id" :label="item.name"
:value="item.id"></el-option>
</el-select>
</el-form-item>
<el-form-item label="终端级别:" prop="terminalLevel" class="mt10">
<el-select v-model="form.terminalLevel" clearable placeholder="请选择终端级别">
<el-option v-for="item in terminalLevelList" :key="item.id" :label="item.name"
:value="item.id"></el-option>
</el-select>
</el-form-item>
<el-form-item label="装置型号:" prop="deviceModel" class="mt10">
<el-select v-model="form.deviceModel" clearable placeholder="请选择装置型号">
<el-option v-for="item in deviceModelList" :key="item.id" :label="item.name"
:value="item.id"></el-option>
</el-select>
</el-form-item>
<el-form-item label="装置类别:" prop="deviceCategory" class="mt10">
<el-select v-model="form.deviceCategory" clearable placeholder="请选择装置类别">
<el-option v-for="item in deviceCategoryList" :key="item.id" :label="item.name"
:value="item.id"></el-option>
</el-select>
</el-form-item>
<el-form-item label="生产厂家:" prop="manufacture" class="mt10">
<el-select v-model="form.manufacture" clearable placeholder="请选择生产厂家">
<el-option v-for="item in manufactureList" :key="item.id" :label="item.name"
:value="item.id"></el-option>
</el-select>
</el-form-item>
<el-form-item label="检定日期:" prop="verificationDate" class="mt10">
<el-date-picker v-model="form.verificationDate" value-format="yyyy-MM-dd" type="date"
placeholder="选择日期"></el-date-picker>
</el-form-item>
<el-form-item label="投运日期:" prop="useDate" class="mt10">
<el-date-picker v-model="form.useDate" value-format="yyyy-MM-dd" type="date"
placeholder="选择日期"></el-date-picker>
</el-form-item>
<el-form-item label="测量信号输入形式:" prop="inputType" class="mt10">
<el-select v-model="form.inputType" clearable placeholder="请选择测量信号输入形式">
<el-option v-for="item in inputTypeList" :key="item.id" :label="item.name"
:value="item.id"></el-option>
</el-select>
</el-form-item>
<el-form-item label="IP地址:" prop="ip" class="mt10">
<el-input v-model="form.ip" clearable placeholder="请输入IP地址"></el-input>
</el-form-item>
<el-form-item label="通信端口:" prop="port" class="mt10">
<el-input v-model="form.port" clearable placeholder="请输入通信端口"></el-input>
</el-form-item>
<el-form-item label="是否是上送网公司监测点:" prop="isUpToGrid" class="mt10">
<el-select v-model="form.isUpToGrid" clearable placeholder="请选择是否是上送网公司监测点">
<el-option v-for="item in whether" :key="item.id" :label="item.label"
:value="item.id"></el-option>
</el-select>
</el-form-item>
<el-form-item label="同源终端编号:" class="mt10">
<el-input v-model="form.terminalCode" clearable placeholder="请输入同源终端编号"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="handleClose"> </el-button>
<el-button v-if="add" type="primary" @click="addinformationFn"> </el-button>
<el-button v-if="modify" type="primary" @click="modifyinformationFn"> </el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import PMS_Data from '@/views/components/Accountinformation/PMS_Data'
import Organization from './Area/Organization.vue'
import Operation from './Area/Operation.vue'
import {
getTerminalList,
getstatationStatList,
addTerminal,
deleteTerminal,
updateTerminal
} from '@/api/hbaccountoperation/TerminalAccount'
import { deptTree } from '@/api/admin/dept'
import Area from '@/views/components/Area/Area.vue'
import { dicData } from '@/assets/commjs/dictypeData'
export default {
components: { PMS_Data, Organization, Operation, Area },
data() {
return {
vh: '',
title: '',
add: false,
modify: false,
// 查询数据
ruleForm: {
searchValue: '',
deviceCategory: '',
pageNum: 1,
pageSize: 20,
orgId: JSON.parse(window.sessionStorage.getItem('Info')).deptId
},
total: 0,
form: {
deviceModel: '',
deviceCategory: '',
id: '',
inputType: '',
terminalCode: '',
ip: '',
isUpToGrid: 0,
manufacture: '',
name: '',
operationId: '',
operationName: '',
orgId: '',
orgName: '',
port: '',
powerStationId: '',
powerrName: '',
terminalLevel: '',
terminalState: '',
useDate: '',
verificationDate: ''
},
rules: {
id: [{ required: true, message: '请输入终端编号', trigger: 'blur' }],
name: [{ required: true, message: '请输入终端名称', trigger: 'blur' }],
powerStationId: [{ required: true, message: '请选择变电站名称', trigger: 'change' }],
terminalState: [{ required: true, message: '请选择终端状态', trigger: 'change' }],
terminalLevel: [{ required: true, message: '请选择终端级别', trigger: 'change' }],
deviceModel: [{ required: true, message: '请选择装置型号', trigger: 'change' }],
deviceCategory: [{ required: true, message: '请选择装置类别', trigger: 'change' }],
manufacture: [{ required: true, message: '请选择生产厂家', trigger: 'change' }],
verificationDate: [{ required: true, message: '选择日期', trigger: 'change' }],
useDate: [{ required: true, message: '选择日期', trigger: 'change' }],
inputType: [
{
required: true,
message: '请选择测量信号输入形式',
trigger: 'change'
}
],
ip: [
{ required: true, message: '请输入IP地址', trigger: 'blur' },
{
pattern:
/^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/,
message: '请输入正确ip格式',
trigger: 'blur'
}
],
port: [
{ required: true, message: '请输入通信端口', trigger: 'blur' },
{ pattern: /^[0-9]*$/, message: '只可以输入数字', trigger: 'blur' }
],
isUpToGrid: [
{
required: true,
message: '请选择是否是上送网公司监测点',
trigger: 'change'
}
]
},
height: null,
height1: null,
isLoading: false,
disabled: true,
multipleSelection: [],
deviceCategoryList: [],
//台区台账表头
tableHeaderMonitor: [
{ prop: 'terminalCode', label: '同源终端编号', width: 170 },
{ prop: 'name', label: '终端名称', width: 150 },
{ prop: 'orgName', label: '组织机构名称', width: 180 },
{ prop: 'operationName', label: '运维单位名称', width: 180 },
{ prop: 'powerrName', label: '变电站名称', width: 150 },
{ prop: 'terminalState', label: '终端状态', width: 120 },
{ prop: 'deviceModel', label: '装置型号', width: 160 },
{ prop: 'ip', label: 'IP地址', width: 120 },
{ prop: 'port', label: '通信端口', width: 120 },
{ prop: 'deviceCategory', label: '装置类别', width: 100 },
{ prop: 'manufacture', label: '生产厂家', width: 120 },
{ prop: 'verificationDate', label: '检定日期', width: 100 },
{ prop: 'useDate', label: '投运日期', width: 100 },
{ prop: 'inputType', label: '测量信号输入形式', width: 180 },
{ prop: 'terminalLevel', label: '终端级别', width: 120 }
//{ prop: "isUpToGrid", label: "是否是上送网公司监测点", width: 190 },
// { prop: "status", label: "数据状态", width:100 },
],
whether: [
{
id: 0,
value: '选项1',
label: '否'
},
{
id: 1,
value: '选项2',
label: '是'
}
],
editCheckCode: '',
valueTitle: '',
editCheckCode1: '',
valueTitle1: '',
UserData: [],
device: '',
organization: [], //组织机构名称
operation: [], //运维单位名称
statationName: [], //变电站名称
terminalStateList: [], //终端状态
terminalLevelList: [], //终端级别
deviceModelList: [], //装置型号
manufactureList: [], //生产厂家
inputTypeList: [], //测量信号输入形式
PMSobtain: false,
information: false, //修改台区信息
addinformation: false //新增台区信息
}
},
created() {
this.getclassificationData()
},
mounted() {
this.device = window.devicePixelRatio
this.setHeight()
window.addEventListener('resize', this.setHeight)
this.Monitor()
},
computed: {},
beforeDestroy() {
window.removeEventListener('resize', this.setHeight)
},
methods: {
setHeight() {
this.height = window.sessionStorage.getItem('appheight') - 205
this.height1 = window.sessionStorage.getItem('appheight') - 285
},
// 切换选项
handleNodeClick(data) {
// console.log(data);
if (data.code != null) {
let form = {
deptId: data.id
}
// 变电站名称
getstatationStatList(form).then(res => {
this.statationName = res.data
})
}
this.form.orgId = data.code
this.form.orgName = data.name
},
handleNodeClick1(data) {
// console.log(data);
this.form.operationId = data.code
this.form.operationName = data.name
},
changeFn3(val) {
// console.log(val);
this.statationName.forEach(item => {
if (item.powerId == val) {
this.form.powerrName = item.powerName
}
})
},
//获取类型
getclassificationData() {
//终端状态
var code = 'Dev_Status'
this.terminalStateList = dicData(code, [])
//终端级别
var code1 = 'Dev_Level'
this.terminalLevelList = dicData(code1, [])
//装置型号
var code2 = 'Dev_Type'
this.deviceModelList = dicData(code2, [])
//生产厂家
var code3 = 'Dev_Manufacturers'
this.manufactureList = dicData(code3, [])
//测量信号输入形式
var code4 = 'Signal_form'
this.inputTypeList = dicData(code4, [])
//装置类别
this.deviceCategoryList = dicData('Device_Category', [])
},
//PMS获取数据
// PMSobtainFn() {
// this.PMSobtain = true;
// this.title = "线路表";
// },
pagMonitor() {
this.ruleForm.pageNum = 1
this.ruleForm.pageSize = 20
this.Monitor()
},
//查询用户用电信息
Monitor() {
this.isLoading = true
getTerminalList(this.ruleForm).then(res => {
this.isLoading = false
this.UserData = res.data.records
this.total = res.data.total
})
},
// 数据过滤
formFilter(row, column) {
if (row.column.property == 'terminalState') {
let title = ''
this.terminalStateList.forEach(item => {
if (item.value == row.row.terminalState) {
title = item.label
}
})
return title
} else if (row.column.property == 'terminalLevel') {
let title = ''
this.terminalLevelList.forEach(item => {
if (item.value == row.row.terminalLevel) {
title = item.label
}
})
return title
} else if (row.column.property == 'deviceModel') {
let title = ''
this.deviceModelList.forEach(item => {
if (item.value == row.row.deviceModel) {
title = item.label
}
})
return title
} else if (row.column.property == 'manufacture') {
let title = ''
this.manufactureList.forEach(item => {
if (item.value == row.row.manufacture) {
title = item.label
}
})
return title
} else if (row.column.property == 'inputType') {
let title = ''
this.inputTypeList.forEach(item => {
if (item.value == row.row.inputType) {
title = item.label
}
})
return title
} else if (row.column.property == 'deviceCategory') {
let title = ''
this.deviceCategoryList.forEach(item => {
if (item.value == row.row.deviceCategory) {
title = item.label
}
})
return title
} else {
return row.row[row.column.property]
}
},
//数据上传
upload() {
if (this.multipleSelection.length == 0) {
this.$message({
showClose: true,
message: '请选择台账!!!',
type: 'warning'
})
return
}
this.$message({
showClose: true,
message: '上传成功!!!',
type: 'success'
})
},
// 重置
Reset() {
// 查询数据
this.ruleForm.searchValue = ''
},
//获取数据
getData() {
// deptTree().then(res=>{
// if(res.code=='A0000'){
// this.operation=res.data[0].children[0].children
// this.organization=res.data[0].children[0].children
// }
// })
// getstatationStatList().then(res=>{
// // console.log(res);
// this.statationName=res.data
// });
},
//新增
addFn() {
this.form = {
deviceModel: '',
deviceCategory: '',
id: '',
inputType: '',
ip: '',
terminalCode: '',
isUpToGrid: 0,
manufacture: '',
name: '',
operationId: '',
operationName: '',
orgId: '',
orgName: '',
port: '',
powerStationId: '',
powerrName: '',
terminalLevel: '',
terminalState: '',
useDate: '',
verificationDate: ''
}
this.disabled = false
this.modify = false
this.add = true
this.title = '新增监测终端台帐'
this.addinformation = true
this.getData()
},
//新增台区确定
addinformationFn() {
this.$refs.rulesform.validate(value => {
// console.log(value);
if (value == true) {
this.$confirm('是否确认新增?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
addTerminal(this.form).then(res => {
if (res.code == 'A0000') {
this.$message({
message: res.message,
type: 'success'
})
}
this.addinformation = false
this.Monitor()
})
})
.catch(() => {
this.$message({
type: 'info',
message: '已取消新增'
})
})
}
})
},
handleClose() {
this.addinformation = false
if (this.title == '新增监测终端台帐') {
this.$refs.Operation.form.valueTitle = ''
this.$refs.Organization.form.valueTitle = ''
}
},
//修改数据
modifyFn() {
this.getData()
this.disabled = true
this.modify = true
this.add = false
this.title = '修改监测终端台帐'
if (this.multipleSelection.length != 1) {
this.$message({
showClose: true,
message: '请选择台账!!!',
type: 'warning'
})
return
}
this.addinformation = true
// console.log(this.multipleSelection[0],'===============');
this.form = JSON.parse(JSON.stringify(this.multipleSelection[0]))
this.form.powerStationId = this.form.orgName + '_' + this.form.powerrName
this.valueTitle = this.multipleSelection[0].orgName
this.editCheckCode = this.multipleSelection[0].orgId
this.valueTitle1 = this.multipleSelection[0].operationName
this.editCheckCode1 = this.multipleSelection[0].operationId
getstatationStatList({ deptCode: this.multipleSelection[0].orgId }).then(res => {
this.statationName = res.data
})
if (this.form.ifSensitiveUser == '是') {
this.form.ifSensitiveUser = 1
} else if (this.form.ifSensitiveUser == '否') {
this.form.ifSensitiveUser = 0
}
if (this.form.ifPowerQuality == '是') {
this.form.ifPowerQuality = 1
} else if (this.form.ifPowerQuality == '否') {
this.form.ifPowerQuality = 0
}
if (this.form.ifKeyCustomers == '是') {
this.form.ifKeyCustomers = 1
} else if (this.form.ifKeyCustomers == '否') {
this.form.ifKeyCustomers = 0
}
if (this.form.isUpToGrid == '是') {
this.form.isUpToGrid = 1
} else if (this.form.isUpToGrid == '否') {
this.form.isUpToGrid = 0
}
},
//修改台区信息确定
modifyinformationFn() {
this.$refs.rulesform.validate(value => {
// console.log(value);
if (value == true) {
this.$confirm('是否确认修改?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
updateTerminal(this.form).then(res => {
if (res.code == 'A0000') {
this.$message({
message: res.message,
type: 'success'
})
}
this.addinformation = false
this.Monitor()
})
})
.catch(() => {
this.$message({
type: 'info',
message: '已取消修改'
})
})
}
})
},
// 删除
deleteFn() {
if (this.multipleSelection.length == 0) {
this.$message({
showClose: true,
message: '请选择台账!!!',
type: 'warning'
})
return
}
this.$confirm('是否确认删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
let id = []
this.multipleSelection.forEach(item => {
id.push(item.id)
})
deleteTerminal(id).then(res => {
if ((res.code == 'A0000')) {
this.$message({
type: 'success',
message: res.message
})
}
this.Monitor()
})
})
.catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
},
//关闭PMS数据弹框
// Close() {
// this.PMSobtain = false;
// },
// 表格多选
handleSelectionChange(row) {
this.multipleSelection = row.records
// console.log(this.multipleSelection);
},
handleNodeArea(data) {
this.ruleForm.orgId = data.id
},
//每页条数改变时触发 选择一页显示多少行
handleSizeChange(val) {
this.ruleForm.pageSize = val
this.Monitor()
},
//当前页改变时触发 跳转其他页
handleCurrentChange(val) {
this.ruleForm.pageNum = val
this.Monitor()
},
cellStyle(row) {
if (row.row.isUpToGrid == 0) {
row.row.isUpToGrid = '否'
} else if (row.row.isUpToGrid == 1) {
row.row.isUpToGrid = '是'
}
},
//导出
exportEvent() {
getTerminalList({
searchValue: this.ruleForm.searchValue,
deviceCategory: this.ruleForm.deviceCategory,
pageNum: 1,
pageSize: this.total
}).then(res => {
this.$refs.TerminalAccount.exportData({
filename: '监测终端台帐', // 文件名字
sheetName: 'Sheet1',
type: 'xlsx', //导出文件类型 xlsx 和 csv
useStyle: true,
data: res.data.records, // 数据源 // 过滤那个字段导出
columnFilterMethod: function (column, $columnIndex) {
return !(column.$columnIndex === 0)
}
})
})
}
}
}
</script>
<style lang="less" scoped>
@import url('../../../styles/comStyle.less');
::v-deep .vxe-table .cell {
text-align: center;
}
::v-deep .el-tabs--border-card>.el-tabs__content {
padding: 10px;
}
::v-deep .form {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
.el-form-item {
display: flex;
width: 48%;
.el-form-item__content {
flex: 1 !important;
.el-select {
width: 100%;
}
.el-date-editor {
width: 100%;
}
}
}
}
.pms {
margin-left: 10px;
}
.obtain {
margin-left: 1220px;
}
</style>