设备管理-飞行器-编辑删除及列表数据通过mqtt补足 dellog

main
zhufu 3 months ago
parent 1a85cd6256
commit d87f7aa4d1

@ -41,7 +41,7 @@ import { columns, dataSource, searchFormSchema } from './utils'
import { GetUavPageList, DeleteUav } from '@/api/demo/device' import { GetUavPageList, DeleteUav } from '@/api/demo/device'
import { getClient, clientSubscribe } from '@/utils/mqtt' import { getClient, clientSubscribe } from '@/utils/mqtt'
import dayjs from "dayjs"; import dayjs from "dayjs";
import { Modal } from "ant-design-vue"; import { message, Modal } from "ant-design-vue";
import EditDevice from './EditDevice/index.vue' import EditDevice from './EditDevice/index.vue'
const props = defineProps(['projectList','connected']) const props = defineProps(['projectList','connected'])
@ -56,10 +56,8 @@ onMounted(() => {
}; };
} }
getClient().on('message', (topic, msg) => { getClient().on('message', (topic, msg) => {
console.log(123,'topic',topic)
if (topic.endsWith("osd")) { if (topic.endsWith("osd")) {
const rs = JSON.parse(msg) const rs = JSON.parse(msg)
console.log(1231,rs)
let list = getDataSource() let list = getDataSource()
let sn = rs.gateway let sn = rs.gateway
for(let i = 0; i < list.length; i++){ for(let i = 0; i < list.length; i++){
@ -75,9 +73,7 @@ onMounted(() => {
}) })
const afterFetch = ref(false) const afterFetch = ref(false)
watch(() => afterFetch.value, () => { watch(() => afterFetch.value, () => {
console.log(123123,getDataSource())
nextTick(() => { nextTick(() => {
console.log(456,456,getDataSource())
getDataSource().forEach(item => { getDataSource().forEach(item => {
let topicUrl = `thing/product/${item.psn}/osd`; let topicUrl = `thing/product/${item.psn}/osd`;
clientSubscribe(topicUrl); clientSubscribe(topicUrl);
@ -106,7 +102,6 @@ const [registerTable, { reload, expandAll, getForm,getDataSource}] = useTable({
}, },
afterFetch(data) { afterFetch(data) {
afterFetch.value = true afterFetch.value = true
console.log('afterFetch', data);
}, },
actionColumn: { actionColumn: {
width: 100, width: 100,

Loading…
Cancel
Save