diff --git a/src/store/modules/mqtt.js b/src/store/modules/mqtt.js index 1d08eab..6fd8fc4 100644 --- a/src/store/modules/mqtt.js +++ b/src/store/modules/mqtt.js @@ -3,8 +3,10 @@ const mqttStore = defineStore('mqtt', { state: () => ({ // 是否链接 isLinked: false, - // 连接地址 - baseUrl: '192.168.0.58', + // 连接地址(测试) + demoUrl: '192.168.0.58', + // 连接地址(生产) + baseUrl: '192.0.0.24', client: null, options: { // 清除 session @@ -40,10 +42,14 @@ const mqttStore = defineStore('mqtt', { return `wss://${this.baseUrl}:8084/mqtt` } }, - create(type = 'mqtt', topic = null) { + create(type = 'mqtt', topic = null, clientId = 'ziyuanweb' + Math.random().toString(16).substr(2, 8)) { try { return new Promise((resolve, reject) => { const that = this; + if (process.env.NODE_ENV === 'development') { + this.baseUrl = this.demoUrl + } + this.options.clientId = clientId this.client = mqtt.connect(this.getUrl(type), this.options) this.client.on('connect', function (connack) { console.log('=======mqtt链接成功=======') diff --git a/src/views/business/CloudMonitor/index.vue b/src/views/business/CloudMonitor/index.vue index 0bb2890..10563e7 100644 --- a/src/views/business/CloudMonitor/index.vue +++ b/src/views/business/CloudMonitor/index.vue @@ -11,23 +11,22 @@ + + + + + + + + + - - - - - - - - - - - - - + @@ -36,16 +35,16 @@ - + - + - + - + 0) { queryParams.reflexAccount_id = _options[0].id - handleQuery() } + getCompanyOptions() } }) } -getReflexAccountOptions() +import { GetAllCompany } from '@/api/business/recipe/recipe.js' +const companyOptions = ref([]) +function getCompanyOptions() { + GetAllCompany().then((res) => { + if (res.code === 200) { + companyOptions.value = res.data.map((item) => { + return { + id: item.id, + label: `${item.companyName}`, + value: item.companyName + } + }) + setTenantCompany(companyOptions.value) + } + }) +} +function setTenantCompany(list) { + for (let item of companyOptions.value) { + if (item.id === tenantId.value) { + queryParams.factory = item.value + } + } + handleQuery() +} /// ==================================================================== /// ===========tabs切换============ const tabsActive = ref('1') @@ -487,7 +512,7 @@ const queryParams = reactive({ pageNum: 1, pageSize: 10, isUpload: 1, - uploadTime:[null,null], + uploadTime: [null, null], reflexAccount_id: null, sort: 'createdTime', sortType: 'desc' @@ -684,6 +709,4 @@ function handleDelete(row) { proxy.$modal.msgSuccess('删除成功') }) } - - diff --git a/src/views/business/RecipeManagement/index.vue b/src/views/business/RecipeManagement/index.vue index 320fe4b..c48c77f 100644 --- a/src/views/business/RecipeManagement/index.vue +++ b/src/views/business/RecipeManagement/index.vue @@ -6,7 +6,7 @@