feat:代码上传

This commit is contained in:
pengqiao1993
2026-03-16 17:32:56 +08:00
parent ced281252b
commit 41b5d50cd4
4 changed files with 68 additions and 53 deletions

View File

@ -176,7 +176,9 @@ const install = (Vue, vm) => {
getStationListByStatus: (params = {}) => getStationListByStatus: (params = {}) =>
vm.$u.post(config.adminPath + "/business/station/findListByStationStatus ", params), vm.$u.post(config.adminPath + "/business/station/findListByStationStatus ", params),
getStationPostionData: (params = {}) => getStationPostionData: (params = {}) =>
vm.$u.post(config.adminPath + "/business/dynamicConfig/pointListData", params) vm.$u.post(config.adminPath + "/business/dynamicConfig/pointListData", params),
getStationPostionSn: (params = {}) =>
vm.$u.post(config.adminPath + "/business/point/getSN", params)
}, },
//设备 //设备

View File

@ -78,12 +78,15 @@
}; };
}, },
onLoad() {
this.getSn()
},
computed: { computed: {
lang() { lang() {
return Langlist.find(v => v.value == this.$store.state.vuex_language).prop || 'en' return Langlist.find(v => v.value == this.$store.state.vuex_language).prop || 'en'
}, },
currentStation() { currentStation() {
return this.$store.state.vuex_currentStation; return this.vuex_currentStation;
}, },
}, },
@ -92,8 +95,16 @@
}, },
methods: { methods: {
getSn(){
this.$u.api.station.getStationPostionSn({
stationId: this.currentStation.id
}).then(res => {
this.sn = res.data[0]?.sn
})
},
initmqttClient() { initmqttClient() {
console.log(this.lang)
console.log(this.currentStation)
// 初始化客户端连接地址 // 初始化客户端连接地址
// #ifdef H5 // #ifdef H5
let mqttClient = mqtt.connect('ws://1.95.170.86:8083/mqtt', { let mqttClient = mqtt.connect('ws://1.95.170.86:8083/mqtt', {
@ -110,10 +121,10 @@
mqttClient.on('connect', function(res) { mqttClient.on('connect', function(res) {
console.log('连接成功') console.log('连接成功')
// 订阅主题 // 订阅主题
mqttClient.subscribe(`1/ems/zzkj0002/control/response`, function(err) { mqttClient.subscribe(`1/ems/${this.sn}/control/response`, (err) => {
if (!err) { if (!err) {
// 订阅成功 // 订阅成功
mqttClient.publish('1/app/zzkj0002/control/request', JSON.stringify({ mqttClient.publish(`1/app/${this.sn}/control/request`, JSON.stringify({
fun: 'GET', fun: 'GET',
type: 'WJ_Get_NewControlSystem', type: 'WJ_Get_NewControlSystem',
content: 0 content: 0
@ -250,7 +261,7 @@
return pre return pre
}, {}) }, {})
this.mqttClient.publish(`1/app/zzkj0002/control/request`, JSON.stringify({ this.mqttClient.publish(`1/app/${this.sn}/control/request`, JSON.stringify({
fun: 'SET', fun: 'SET',
type: 'WJ_Set_NewControlSystem', type: 'WJ_Set_NewControlSystem',
content: { content: {

View File

@ -167,6 +167,7 @@
return this.vuex_language return this.vuex_language
} }
}, },
watch: { watch: {
currentStation: { currentStation: {
handler(val) { handler(val) {
@ -284,6 +285,7 @@
this.userId = this.vuex_user.userId this.userId = this.vuex_user.userId
}, },
methods: { methods: {
toDeviceControl() { toDeviceControl() {
uni.navigateTo({ uni.navigateTo({

View File

@ -1,4 +1,3 @@
import config from '@/common/config.js'; import config from '@/common/config.js';
import Vue from 'vue' import Vue from 'vue'
import Vuex from 'vuex' import Vuex from 'vuex'
@ -14,7 +13,9 @@ try{
} }
// 需要永久存储且下次APP启动需要取出的在state中的变量名 // 需要永久存储且下次APP启动需要取出的在state中的变量名
let saveStateKeys = ['vuex_user', 'vuex_token', 'vuex_remember', 'vuex_locale','vuex_isAgent','vuex_language','vuex_stationValue']; let saveStateKeys = ['vuex_user', 'vuex_token', 'vuex_remember', 'vuex_locale', 'vuex_isAgent', 'vuex_language',
'vuex_stationValue'
];
// 保存变量到本地存储中 // 保存变量到本地存储中
const saveLifeData = function(key, value) { const saveLifeData = function(key, value) {
@ -53,8 +54,7 @@ const store = new Vuex.Store({
tabbar_current: 0, tabbar_current: 0,
vuex_stationValue: lifeData.vuex_stationValue ? lifeData.vuex_stationValue : '', vuex_stationValue: lifeData.vuex_stationValue ? lifeData.vuex_stationValue : '',
vuex_inverterFlag: lifeData.vuex_inverterFlag ? lifeData.vuex_inverterFlag : 0, vuex_inverterFlag: lifeData.vuex_inverterFlag ? lifeData.vuex_inverterFlag : 0,
tabbarList: [ tabbarList: [{
{
"icon": "warning", "icon": "warning",
"text": "告警", "text": "告警",
'name': 'Alarm' 'name': 'Alarm'