|
@@ -1,16 +1,15 @@
|
|
|
<template>
|
|
|
<div class="app-container">
|
|
|
<el-card class="box-card">
|
|
|
- <div>
|
|
|
- <el-button size="small" @click="insertData" icon="el-icon-plus">新增</el-button>
|
|
|
+ <div style="margin-bottom: 1%">
|
|
|
+ <el-button size="small" @click="insertData" icon="el-icon-plus" >新增</el-button>
|
|
|
</div>
|
|
|
<el-table v-loading="loading" border
|
|
|
:data="tableAllData.slice((page.currentPage-1)*page.pageSize,page.currentPage*page.pageSize)">
|
|
|
<el-table-column type="index" label="序号" width="55" align="center"/>
|
|
|
<el-table-column label="通道名称" align="center" prop="tunnelName"/>
|
|
|
- <el-table-column label="场站名称" align="center" prop="stationId"/>
|
|
|
- <el-table-column label="设备名称" align="center" prop="equipmentNo" :formatter="formatEquipmentNo"/>
|
|
|
- <el-table-column label="数据类型" align="center" prop="dataFormat"/>
|
|
|
+ <el-table-column label="设备名称" align="center" prop="weatherLookNo" :formatter="formatEquipmentNo"/>
|
|
|
+ <el-table-column label="数据类型" align="center" prop="dataFormat" :formatter="formatDataFormat"/>
|
|
|
<el-table-column label="ip地址" align="center" prop="ip"/>
|
|
|
<el-table-column label="端口号" align="center" prop="port"/>
|
|
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
@@ -52,53 +51,64 @@
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
|
|
<el-row :gutter="20" class="mb8">
|
|
|
<el-col :span="12">
|
|
|
- <el-form-item label="通道名称" prop="tunnelName">
|
|
|
+ <el-form-item label="通道名称:" prop="tunnelName">
|
|
|
<el-input v-model="form.tunnelName" placeholder="请输入通道名称"/>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
|
- <el-form-item label="场站名" prop="stationId">
|
|
|
- <el-select v-model="form.stationId" placeholder="请选择场站" style="width: 100%" clearable>
|
|
|
- <el-option
|
|
|
- v-for="(item,index) in stationInfo"
|
|
|
- :key="index"
|
|
|
- :label="item.name"
|
|
|
- :value="item.id">
|
|
|
- </el-option>
|
|
|
- </el-select>
|
|
|
+ <el-form-item label="通道状态:" prop="status">
|
|
|
+ <el-switch
|
|
|
+ style="display: flex;height: 36px"
|
|
|
+ v-model="form.status"
|
|
|
+ active-color="#13ce66"
|
|
|
+ inactive-color="#ff4949"
|
|
|
+ active-text="正常"
|
|
|
+ inactive-text="停用">
|
|
|
+ </el-switch>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
+
|
|
|
</el-row>
|
|
|
<el-row :gutter="20" class="mb8">
|
|
|
<el-col :span="12">
|
|
|
- <el-form-item label="设备名" prop="equipmentNo">
|
|
|
- <el-select v-model="form.equipmentNo" placeholder="请选择设备" style="width: 100%" clearable>
|
|
|
- <el-option
|
|
|
- v-for="(item,index) in equipmentInfo"
|
|
|
- :key="index"
|
|
|
- :label="item.name"
|
|
|
- :value="item.equipmentNo">
|
|
|
- </el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- </el-col> <el-col :span="12">
|
|
|
- <el-form-item label="数据类型" prop="dataFormat">
|
|
|
- <el-input v-model="form.dataFormat" placeholder="请输入数据类型" readonly/>
|
|
|
+ <el-form-item label="设备名:" prop="weatherLookNo">
|
|
|
+ <el-select v-model="form.weatherLookNo" placeholder="请选择设备" style="width: 100%" clearable>
|
|
|
+ <el-option
|
|
|
+ v-for="(item,index) in equipmentInfo"
|
|
|
+ :key="item.id"
|
|
|
+ :label="item.weatherLookName"
|
|
|
+ :value="item.weatherLookNo">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="数据类型:" prop="dataFormat">
|
|
|
+ <el-select v-model="form.dataFormat" placeholder="请输入数据类型" style="width: 100%" clearable>
|
|
|
+ <el-option
|
|
|
+ v-for="(item,index) in protocolDataType"
|
|
|
+ :key="item.key"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+
|
|
|
</el-row>
|
|
|
|
|
|
<el-row :gutter="20" class="mb8">
|
|
|
<el-col :span="12">
|
|
|
- <el-form-item label="ip地址" prop="ip">
|
|
|
- <el-input v-model="form.ip" placeholder="请输入ip地址"/>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
+ <el-form-item label="ip地址:" prop="ip">
|
|
|
+ <el-input v-model="form.ip" placeholder="请输入ip地址"/>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
<el-col :span="12">
|
|
|
- <el-form-item label="端口" prop="port">
|
|
|
+ <el-form-item label="端口:" prop="port">
|
|
|
<el-input v-model="form.port" placeholder="请输入端口"/>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
+
|
|
|
</el-row>
|
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
@@ -111,9 +121,13 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-// import {list,listAll,addTunnelInfo,updateTunnelInfo,delTunnelInfo} from "@/api/biz/dataQuery/tunnelInfo";
|
|
|
-// import {listAllInfo} from "@/api/biz/dataQuery/windTowerStatusInfo";
|
|
|
-// import {listElectricStation} from "@/api/biz/dataQuery/electricStation";
|
|
|
+import {list,addTunnelInfo,updateTunnelInfo,delTunnelInfo} from "@/api/biz/dataQuery/tunnelInfo";
|
|
|
+import {
|
|
|
+ addWeatherLook,
|
|
|
+ delWeatherLook,
|
|
|
+ list as weatherLookList,
|
|
|
+ updateWeatherLook
|
|
|
+} from "@/api/biz/dataQuery/weatherLook";
|
|
|
export default {
|
|
|
name: "index",
|
|
|
data(){
|
|
@@ -166,6 +180,7 @@ export default {
|
|
|
pageSize: 10 // 每页显示多少条
|
|
|
},
|
|
|
title: '新增&保存',
|
|
|
+ editFlag:'add',
|
|
|
open:false,
|
|
|
form:{},
|
|
|
rules:{
|
|
@@ -181,70 +196,100 @@ export default {
|
|
|
equipmentNo: [{ required: true, message: '请选择所属设备', trigger: 'blur' }],
|
|
|
},
|
|
|
modId:'',//备用id
|
|
|
+ protocolDataType: [{label: '遥信开关量', value: 'A', key: 0},
|
|
|
+ {label: '+AB 无符号整型', value: 'P_AB', key: 1},
|
|
|
+ {label: '±AB 有符号整型', value: 'PM_AB', key: 2},
|
|
|
+ {label: '+BA 无符号整型反转', value: 'P_BA', key: 3},
|
|
|
+ {label: '±BA 有符号整型反转', value: 'PM_BA', key: 4},
|
|
|
+ {label: '+AABB', value: 'P_AABB', key: 5},
|
|
|
+ {label: '±AABB', value: 'PM_AABB', key: 6},
|
|
|
+ {label: '+BBAA', value: 'P_BBAA', key: 7},
|
|
|
+ {label: '±BBAA', value: 'PM_BBAA', key: 8},
|
|
|
+ {label: 'ABCD', value: 'ABCD', key: 9},
|
|
|
+ {label: 'CDAB', value: 'CDAB', key: 10},
|
|
|
+ {label: 'DCBA', value: 'DCBA', key: 11},
|
|
|
+ {label: 'BADC', value: 'BADC', key: 13}
|
|
|
+ ],
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
|
- // this.getStationInfo()
|
|
|
- // this.getEquipmentInfo()
|
|
|
- // this.getTunnelInfo()
|
|
|
+ this.getEquipmentInfo()
|
|
|
+ this.getTunnelInfo()
|
|
|
},
|
|
|
methods:{
|
|
|
- /*获取场站信息*/
|
|
|
- getStationInfo(){
|
|
|
- listElectricStation().then(res=>{
|
|
|
- this.stationInfo = res.data
|
|
|
- }).catch(err=>{
|
|
|
- console.log('获取场站信息异常:'+ err)
|
|
|
- this.$message.error('获取场站信息异常:'+ err)
|
|
|
- })
|
|
|
- },
|
|
|
/*获取设备信息*/
|
|
|
getEquipmentInfo(){
|
|
|
- listAllInfo().then(res=>{
|
|
|
+ weatherLookList().then(res=>{
|
|
|
this.equipmentInfo = res.rows
|
|
|
}).catch(err=>{
|
|
|
console.log('获取设备信息异常:'+ err)
|
|
|
- this.$message.error('获取设备信息异常:'+ err)
|
|
|
})
|
|
|
},
|
|
|
/*获取所有通道信息*/
|
|
|
getTunnelInfo(){
|
|
|
- listAll().then(res=>{
|
|
|
+ list().then(res=>{
|
|
|
this.tableAllData = res.rows
|
|
|
this.page.total = this.tableAllData.length
|
|
|
}).catch(err=>{
|
|
|
console.log('获取通道信息异常:'+ err)
|
|
|
- this.$message.error('获取通道信息异常:'+ err)
|
|
|
})
|
|
|
},
|
|
|
/*新增*/
|
|
|
insertData(){
|
|
|
+ this.editFlag = 'add'
|
|
|
this.title = '新增&保存'
|
|
|
this.resetForm()
|
|
|
this.open = true
|
|
|
},
|
|
|
/*编辑*/
|
|
|
handleUpdate(row){
|
|
|
+ this.editFlag = 'edit'
|
|
|
this.title = '修改&保存'
|
|
|
this.modId = row.id
|
|
|
+ console.log(row)
|
|
|
this.form={
|
|
|
id:row.id,
|
|
|
tunnelName:row.tunnelName,
|
|
|
stationId:row.stationId,
|
|
|
- equipmentNo:row.equipmentNo,
|
|
|
+ weatherLookNo:row.weatherLookNo,
|
|
|
ip:row.ip,
|
|
|
port:row.port,
|
|
|
- dataFormat:row.dataFormat
|
|
|
+ dataFormat:row.dataFormat,
|
|
|
+ status:row.status === '1'? true: false
|
|
|
}
|
|
|
this.open = true
|
|
|
},
|
|
|
/*删除*/
|
|
|
handleDelete(row){
|
|
|
-
|
|
|
+ const ids = row.id;
|
|
|
+ this.$modal.confirm('是否确认删除通道名称为"' + row.tunnelName + '"信息及所有数据?').then(function () {
|
|
|
+ return delTunnelInfo(ids);
|
|
|
+ }).then(() => {
|
|
|
+ this.getTunnelInfo();
|
|
|
+ this.$modal.msgSuccess("删除成功");
|
|
|
+ }).catch(() => {
|
|
|
+ });
|
|
|
},
|
|
|
/*保存*/
|
|
|
submitForm(){
|
|
|
-
|
|
|
+ this.$refs["form"].validate(valid => {
|
|
|
+ if (valid) {
|
|
|
+ this.form.status = this.form.status === true? '1':'0'
|
|
|
+ if (this.editFlag === 'edit') {
|
|
|
+ updateTunnelInfo(this.form).then(response => {
|
|
|
+ this.$modal.msgSuccess("修改成功");
|
|
|
+ this.open = false;
|
|
|
+ this.getTunnelInfo();
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ addTunnelInfo(this.form).then(response => {
|
|
|
+ this.$modal.msgSuccess("新增成功");
|
|
|
+ this.open = false;
|
|
|
+ this.getTunnelInfo();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
},
|
|
|
/*取消*/
|
|
|
cancel(){
|
|
@@ -257,21 +302,27 @@ export default {
|
|
|
id:null,
|
|
|
tunnelName:null,
|
|
|
stationId:null,
|
|
|
- equipmentNo:null,
|
|
|
+ weatherLookNo:null,
|
|
|
ip:null,
|
|
|
port:null,
|
|
|
- dataFormat:'CDAB'
|
|
|
+ dataFormat:'CDAB',
|
|
|
+ status: true
|
|
|
}
|
|
|
},
|
|
|
/*设备编号转换*/
|
|
|
formatEquipmentNo(row){
|
|
|
- let equipmentInfo = this.equipmentInfo.find(w=>w.equipmentNo === row.equipmentNo)
|
|
|
- return equipmentInfo !== undefined?equipmentInfo.name:row.equipmentNo
|
|
|
+ let equipmentInfo = this.equipmentInfo.find(w=>w.weatherLookNo === row.weatherLookNo)
|
|
|
+ return equipmentInfo !== undefined?equipmentInfo.weatherLookName:row.weatherLookNo
|
|
|
+ },
|
|
|
+ formatDataFormat(row){
|
|
|
+ let protocolDataType = this.protocolDataType.find(w=>w.value === row.dataFormat)
|
|
|
+ return protocolDataType !== undefined?protocolDataType.label:row.dataFormat
|
|
|
},
|
|
|
/*pageSize改变*/
|
|
|
handleSizeChange(val) {
|
|
|
this.page.pageSize = val
|
|
|
this.page.currentPage = 1
|
|
|
+
|
|
|
},
|
|
|
/*currentPage改变*/
|
|
|
handleCurrentChange(val) {
|