Compare commits
2 Commits
fdcf82e343
...
28176ce052
| Author | SHA1 | Date | |
|---|---|---|---|
| 28176ce052 | |||
| 0b2e7d9b86 |
@ -149,9 +149,9 @@ export function importPointList(data) {
|
|||||||
|
|
||||||
|
|
||||||
//mqtt
|
//mqtt
|
||||||
export function getMqttList({pageSize,pageNum,mqttTopic,topicName}) {
|
export function getMqttList({pageSize,pageNum,mqttTopic,topicName,siteId}) {
|
||||||
return request({
|
return request({
|
||||||
url: `/ems/mqttConfig/list?pageSize=${pageSize}&pageNum=${pageNum}&mqttTopic=${mqttTopic}&topicName=${topicName}`,
|
url: `/ems/mqttConfig/list?pageSize=${pageSize}&pageNum=${pageNum}&mqttTopic=${mqttTopic}&topicName=${topicName}&siteId=${siteId}`,
|
||||||
method: 'get',
|
method: 'get',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -180,4 +180,4 @@ export function deleteMqtt(id) {
|
|||||||
url: `/ems/mqttConfig/${id}`,
|
url: `/ems/mqttConfig/${id}`,
|
||||||
method: 'delete',
|
method: 'delete',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,11 +1,23 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog :visible.sync="dialogTableVisible" :close-on-press-escape="false" :close-on-click-modal="false" :show-close="false" destroy-on-close lock-scroll append-to-body width="400px" class="ems-dialog" :title="mode === 'add'?'新增配置':`编辑配置` " >
|
<el-dialog :visible.sync="dialogTableVisible" :close-on-press-escape="false" :close-on-click-modal="false" :show-close="false" destroy-on-close lock-scroll append-to-body width="400px" class="ems-dialog" :title="mode === 'add'?'新增配置':`编辑配置` " >
|
||||||
<el-form v-loading="loading>0" ref="addTempForm" :model="formData" :rules="rules" size="medium" label-width="140px">
|
<el-form v-loading="loading>0" ref="addTempForm" :model="formData" :rules="rules" size="medium" label-width="140px">
|
||||||
<el-form-item label="订阅topic" prop="deviceName">
|
<el-form-item label="站点" prop="siteId">
|
||||||
|
<el-select v-model="formData.siteId" :disabled="mode === 'edit'" placeholder="请选择站点" :loading="searchLoading" loading-text="正在加载数据">
|
||||||
|
<el-option v-for="(item,index) in siteList" :key="index+'zdxeSelect'" :label="item.siteName" :value="item.siteId" ></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="消息等级" prop="qos">
|
||||||
|
<el-select v-model="formData.qos" placeholder="请选择消息等级">
|
||||||
|
<el-option :value="1">1</el-option>
|
||||||
|
<el-option :value="2">2</el-option>
|
||||||
|
<el-option :value="3">3</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="订阅topic" prop="mqttTopic">
|
||||||
<el-input v-model="formData.mqttTopic" placeholder="请输入" clearable :style="{width: '100%'}">
|
<el-input v-model="formData.mqttTopic" placeholder="请输入" clearable :style="{width: '100%'}">
|
||||||
</el-input>
|
</el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="topic描述" prop="description">
|
<el-form-item label="topic描述" prop="topicName">
|
||||||
<el-input v-model="formData.topicName" type="textarea" placeholder="请输入" clearable :style="{width: '100%'}">
|
<el-input v-model="formData.topicName" type="textarea" placeholder="请输入" clearable :style="{width: '100%'}">
|
||||||
</el-input>
|
</el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -18,18 +30,29 @@
|
|||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import {editMqtt,addMqtt,getMqttDetail} from "@/api/ems/site";
|
import {editMqtt,addMqtt,getMqttDetail} from "@/api/ems/site";
|
||||||
|
import {getAllSites} from '@/api/ems/zddt'
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
loading:0,
|
loading:0,
|
||||||
|
siteList:[],
|
||||||
|
searchLoading:false,
|
||||||
dialogTableVisible:false,
|
dialogTableVisible:false,
|
||||||
mode:'',
|
mode:'',
|
||||||
formData: {
|
formData: {
|
||||||
id:'',//设备唯一标识
|
id:'',//设备唯一标识
|
||||||
|
siteId:'',
|
||||||
|
qos:'',
|
||||||
topicName:'',
|
topicName:'',
|
||||||
mqttTopic:''
|
mqttTopic:''
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
|
siteId:[
|
||||||
|
{ required: true, message: '请选择站点', trigger: 'blur'},
|
||||||
|
],
|
||||||
|
qos:[
|
||||||
|
{ required: true, message: '请选择消息等级', trigger: 'blur'},
|
||||||
|
],
|
||||||
mqttTopic:[
|
mqttTopic:[
|
||||||
{ required: true, message: '请输入订阅topic', trigger: 'blur'},
|
{ required: true, message: '请输入订阅topic', trigger: 'blur'},
|
||||||
],
|
],
|
||||||
@ -42,6 +65,7 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
showDialog(id){
|
showDialog(id){
|
||||||
this.dialogTableVisible = true
|
this.dialogTableVisible = true
|
||||||
|
this.getZdList()
|
||||||
if(id){
|
if(id){
|
||||||
this.mode = 'edit'
|
this.mode = 'edit'
|
||||||
this.formData.id = id
|
this.formData.id = id
|
||||||
@ -49,12 +73,21 @@ export default {
|
|||||||
}else{
|
}else{
|
||||||
this.mode = 'add'
|
this.mode = 'add'
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
//获取站点列表
|
||||||
|
getZdList(){
|
||||||
|
this.searchLoading=true
|
||||||
|
getAllSites().then(response => {
|
||||||
|
this.siteList = response?.data || []
|
||||||
|
}).finally(() => {this.searchLoading=false})
|
||||||
},
|
},
|
||||||
getDetail(id){
|
getDetail(id){
|
||||||
getMqttDetail(id).then(response => {
|
getMqttDetail(id).then(response => {
|
||||||
const {topicName='',mqttTopic=''} = JSON.parse(JSON.stringify(response?.data || {}));
|
const {topicName='',mqttTopic='',qos='',siteId=''} = JSON.parse(JSON.stringify(response?.data || {}));
|
||||||
this.formData.mqttTopic=mqttTopic;
|
this.formData.mqttTopic=mqttTopic;
|
||||||
this.formData.topicName=topicName;
|
this.formData.topicName=topicName;
|
||||||
|
this.formData.qos=qos;
|
||||||
|
this.formData.siteId=siteId;
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
saveDialog() {
|
saveDialog() {
|
||||||
@ -63,11 +96,13 @@ export default {
|
|||||||
this.loading+=1
|
this.loading+=1
|
||||||
const {
|
const {
|
||||||
id='',
|
id='',
|
||||||
|
siteId='',
|
||||||
|
qos='',
|
||||||
mqttTopic='',//站点ID
|
mqttTopic='',//站点ID
|
||||||
topicName='',//设备id
|
topicName='',//设备id
|
||||||
}= this.formData;
|
}= this.formData;
|
||||||
if(this.mode === 'add'){
|
if(this.mode === 'add'){
|
||||||
addMqtt( {mqttTopic,topicName}).then(response => {
|
addMqtt( {mqttTopic,topicName,siteId,qos}).then(response => {
|
||||||
if(response.code === 200){
|
if(response.code === 200){
|
||||||
//新增成功
|
//新增成功
|
||||||
// 关闭弹窗 更新表格
|
// 关闭弹窗 更新表格
|
||||||
@ -78,7 +113,7 @@ export default {
|
|||||||
this.loading-=1
|
this.loading-=1
|
||||||
})
|
})
|
||||||
}else{
|
}else{
|
||||||
editMqtt({mqttTopic,topicName,id}).then(response => {
|
editMqtt({mqttTopic,topicName,id,siteId,qos}).then(response => {
|
||||||
if(response.code === 200){
|
if(response.code === 200){
|
||||||
//新增成功
|
//新增成功
|
||||||
// 关闭弹窗 更新表格
|
// 关闭弹窗 更新表格
|
||||||
|
|||||||
@ -1,6 +1,11 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="ems-dashboard-editor-container" style="background-color: #ffffff" v-loading="loading">
|
<div class="ems-dashboard-editor-container" style="background-color: #ffffff" v-loading="loading">
|
||||||
<el-form :inline="true" class="select-container">
|
<el-form :inline="true" class="select-container">
|
||||||
|
<el-form-item label="站点选择">
|
||||||
|
<el-select v-model="form.siteId" placeholder="请选择换电站名称" :loading="searchLoading" loading-text="正在加载数据" clearable>
|
||||||
|
<el-option :label="item.siteName" :value="item.siteId" v-for="(item,index) in siteList" :key="index+'zdxeSelect'"></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item label="订阅topic">
|
<el-form-item label="订阅topic">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="form.mqttTopic"
|
v-model="form.mqttTopic"
|
||||||
@ -29,6 +34,14 @@
|
|||||||
max-height="600px"
|
max-height="600px"
|
||||||
stripe
|
stripe
|
||||||
style="width: 100%;margin-top: 25px">
|
style="width: 100%;margin-top: 25px">
|
||||||
|
<el-table-column
|
||||||
|
label="站点"
|
||||||
|
prop="siteId">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
label="消息等级"
|
||||||
|
prop="qos">
|
||||||
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
label="订阅topic"
|
label="订阅topic"
|
||||||
prop="mqttTopic">
|
prop="mqttTopic">
|
||||||
@ -77,6 +90,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {deleteMqtt,getMqttList} from '@/api/ems/site'
|
import {deleteMqtt,getMqttList} from '@/api/ems/site'
|
||||||
|
import {getAllSites} from '@/api/ems/zddt'
|
||||||
import AddMqtt from './AddMqtt.vue'
|
import AddMqtt from './AddMqtt.vue'
|
||||||
export default {
|
export default {
|
||||||
name: "Mqtt",
|
name: "Mqtt",
|
||||||
@ -85,9 +99,12 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
form:{
|
form:{
|
||||||
|
siteId:"",
|
||||||
topicName:'',
|
topicName:'',
|
||||||
mqttTopic:''
|
mqttTopic:''
|
||||||
},
|
},
|
||||||
|
siteList:[],
|
||||||
|
searchLoading:false,
|
||||||
loading:false,
|
loading:false,
|
||||||
tableData:[],
|
tableData:[],
|
||||||
pageSize:10,//分页栏当前每个数据总数
|
pageSize:10,//分页栏当前每个数据总数
|
||||||
@ -116,17 +133,26 @@ export default {
|
|||||||
},
|
},
|
||||||
onReset(){
|
onReset(){
|
||||||
this.form={
|
this.form={
|
||||||
|
siteId:'',
|
||||||
topicName:'',
|
topicName:'',
|
||||||
mqttTopic:''
|
mqttTopic:''
|
||||||
}
|
}
|
||||||
this.pageNum =1//每次搜索从1开始搜索
|
this.pageNum =1//每次搜索从1开始搜索
|
||||||
this.getData()
|
this.getData()
|
||||||
},
|
},
|
||||||
|
//获取站点列表
|
||||||
|
getZdList(){
|
||||||
|
this.searchLoading=true
|
||||||
|
return getAllSites().then(response => {
|
||||||
|
this.siteList = response?.data || []
|
||||||
|
// if( this.siteList.length>0 ) this.siteId = this.siteList[0].siteId
|
||||||
|
}).finally(() => {this.searchLoading=false})
|
||||||
|
},
|
||||||
getData(){
|
getData(){
|
||||||
this.loading=true;
|
this.loading=true;
|
||||||
const {mqttTopic,topicName} = this.form;
|
const {mqttTopic,topicName,siteId} = this.form;
|
||||||
const {pageNum,pageSize} = this;
|
const {pageNum,pageSize} = this;
|
||||||
getMqttList({pageNum,pageSize,mqttTopic,topicName}).then(response => {
|
getMqttList({pageNum,pageSize,mqttTopic,topicName,siteId}).then(response => {
|
||||||
this.tableData=response?.rows || [];
|
this.tableData=response?.rows || [];
|
||||||
this.totalSize = response?.total || 0
|
this.totalSize = response?.total || 0
|
||||||
}).finally(() => {this.loading=false})
|
}).finally(() => {this.loading=false})
|
||||||
@ -168,6 +194,7 @@ export default {
|
|||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.loading=true
|
this.loading=true
|
||||||
|
this.getZdList()
|
||||||
this.getData()
|
this.getData()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user