diff --git a/src/components/Layout/components/Notice.vue b/src/components/Layout/components/Notice.vue index 25570448..b6485554 100644 --- a/src/components/Layout/components/Notice.vue +++ b/src/components/Layout/components/Notice.vue @@ -45,47 +45,43 @@ const subscribeNotice = () => { total.value += 1; notification.open({ message: resp?.payload?.topicName, - description: () => ( -
{ - { - /* changeStatus_api('_read', [resp.id]); */ - } - read('', resp); - }} - > - {resp?.payload?.message} -
- ), + description: () => + h( + 'div', + { + class: "ellipsis", + style: { + cursor: 'pointer' + }, + onClick: () => { + read('', resp); + } + }, + { + default: () => resp?.payload?.message + } + ) + , onClick: () => { // changeStatus_api('_read', [resp.id]) read('', resp); }, key: resp.payload.id, - btn: ( - - ), + btn: () => + h( + Button, + { + type: "primary", + size: "small", + onClick: (e: Event) => { + e.stopPropagation(); + read('_read', resp); + } + }, + { + default: () => "标记已读" + } + ), }); }); }; diff --git a/src/views/DataCollect/Collector/Point/Save/SaveModBus.vue b/src/views/DataCollect/Collector/Point/Save/SaveModBus.vue index 3713b8d6..1480064b 100644 --- a/src/views/DataCollect/Collector/Point/Save/SaveModBus.vue +++ b/src/views/DataCollect/Collector/Point/Save/SaveModBus.vue @@ -62,9 +62,9 @@ />

- PLC地址:{{ + PLC地址: {{ InitAddress[formData.configuration.function] + - formData.pointKey || 0 + Number(formData.pointKey) || 0 }}

() const showBatch = ref(false); const clickBatch = () => { @@ -628,10 +629,10 @@ const handleSubscribeValue = throttle((payload: any) => { const subscribeProperty = (value: any) => { const list = value.map((item: any) => item.id); const id = `collector-${props.data?.channelId || 'channel'}-${ - props.data?.id || 'point' + (props.data?.id || (props.data && props.data.id === '*')) ? 'point' : props.data?.id }-data-${list.join('-')}`; const topic = `/collector/${props.data?.channelId || '*'}/${ - props.data?.id || '*' + (props.data?.id || (props.data && props.data.id === '*')) ? '*' : props.data?.id }/data`; subRef.value = getWebSocket(id, topic, { pointId: list.join(','), @@ -657,15 +658,18 @@ const onCheckAllChange = (e: any) => { watch( () => tableRef?.value?._dataSource, (value) => { + subRef.value?.unsubscribe(); if (value.length !== 0) { - subscribeProperty(value); - value.forEach((item: any) => { - item?.accessModes?.forEach((i: any) => { - if (i?.value === 'read') { - ReadIdMap.set(item.id, item); - } - }); - }); + setTimeout(() => { + subscribeProperty(value); + value.forEach((item: any) => { + item?.accessModes?.forEach((i: any) => { + if (i?.value === 'read') { + ReadIdMap.set(item.id, item); + } + }); + }); + }, 100) } cancelSelect(); checkAll.value = false; @@ -691,7 +695,7 @@ watch( label: '订阅', value: 'subscribe', }); - defaultParams.value.terms[0].terms[0].value = value.id; + defaultParams.value.terms[0].terms[0].value = !value.id ? 'undefined' : (value.id === '*' ? undefined : value.id); tableRef?.value?.reload && tableRef?.value?.reload(); cancelSelect(); checkAll.value = false; @@ -701,9 +705,7 @@ watch( ); onUnmounted(() => { - if (subRef.value) { - subRef.value?.unsubscribe(); - } + subRef.value?.unsubscribe(); }); /** diff --git a/src/views/DataCollect/Collector/Tree/Save/index.vue b/src/views/DataCollect/Collector/Tree/Save/index.vue index 7f325ae7..42c95c48 100644 --- a/src/views/DataCollect/Collector/Tree/Save/index.vue +++ b/src/views/DataCollect/Collector/Tree/Save/index.vue @@ -224,12 +224,12 @@ const handleOk = async () => { loading.value = true; const response = !id - ? await save(params) - : await update(id, { ...props.data, ...params }); - if (response.status === 200) { + ? await save(params).catch(() => { success: false }) + : await update(id, { ...props.data, ...params }).catch(() => { success: false }); + loading.value = false; + if (response.success) { emit('change', true); } - loading.value = false; }; const getTypeTooltip = (value: string) => diff --git a/src/views/DataCollect/Collector/Tree/index.vue b/src/views/DataCollect/Collector/Tree/index.vue index 29cfecd0..f614a4de 100644 --- a/src/views/DataCollect/Collector/Tree/index.vue +++ b/src/views/DataCollect/Collector/Tree/index.vue @@ -25,8 +25,8 @@ v-model:selected-keys="selectedKeys" :fieldNames="{ key: 'id' }" v-if=" - defualtDataSource.length !== 0 || - defualtDataSource?.[0]?.children?.length !== 0 + !(defualtDataSource.length === 0 || + defualtDataSource?.[0]?.children?.length === 0) " :height="660" defaultExpandAll @@ -247,7 +247,7 @@ const handleSearch = async (value: any) => { collectorAll.value = res.result; if (selectedKeys.value.length === 0) { - selectedKeys.value = ['*']; + selectedKeys.value = res.result.length ? ['*'] : []; } //激活change事件 @@ -259,8 +259,8 @@ const handleSearch = async (value: any) => { } spinning.value = false; }; - const getChannelNoPaging = async () => { + const res = await queryChannelNoPaging(); Store.set('channelListAll', res.result); }; @@ -275,8 +275,14 @@ watch( (n, p) => { const key = _.isArray(n) ? n[0] : n; if (key) { + if (key !== "*") { const row = collectorAll.value.find((i: any) => i.id === key); emits('change', row); + } else { + emits('change', { + id: '*' + }); + } } else { selectedKeys.value = p; // 防止取消 } diff --git a/src/views/DataCollect/Collector/index.vue b/src/views/DataCollect/Collector/index.vue index 4bc78162..cf6abe03 100644 --- a/src/views/DataCollect/Collector/index.vue +++ b/src/views/DataCollect/Collector/index.vue @@ -19,7 +19,7 @@ import Tree from './Tree/index.vue'; import Point from './Point/index.vue'; const data = ref(); -const spinning = ref(true); +const spinning = ref(false); const changeTree = (row: any) => { spinning.value = true; diff --git a/src/views/device/Instance/Detail/Info/components/Config/Save.vue b/src/views/device/Instance/Detail/Info/components/Config/Save.vue index c318ec66..788b39e9 100644 --- a/src/views/device/Instance/Detail/Info/components/Config/Save.vue +++ b/src/views/device/Instance/Detail/Info/components/Config/Save.vue @@ -21,9 +21,11 @@