fix: 详情返回
This commit is contained in:
parent
49ed583525
commit
f8cad6d7b1
|
@ -6,7 +6,7 @@
|
||||||
v-model:selectedKeys="state.selectedKeys"
|
v-model:selectedKeys="state.selectedKeys"
|
||||||
:pure="state.pure"
|
:pure="state.pure"
|
||||||
:breadcrumb="{ routes: breadcrumb }"
|
:breadcrumb="{ routes: breadcrumb }"
|
||||||
@back='routerBack'
|
@backClick='routerBack'
|
||||||
>
|
>
|
||||||
<template #breadcrumbRender="slotProps">
|
<template #breadcrumbRender="slotProps">
|
||||||
<a
|
<a
|
||||||
|
|
|
@ -1,21 +1,16 @@
|
||||||
<template>
|
<template>
|
||||||
<page-container
|
<page-container
|
||||||
:tabList="list"
|
:tabList="list"
|
||||||
|
:showBack="true"
|
||||||
:tabActiveKey="instanceStore.tabActiveKey"
|
:tabActiveKey="instanceStore.tabActiveKey"
|
||||||
@tabChange="onTabChange"
|
@tabChange="onTabChange"
|
||||||
>
|
>
|
||||||
<template #title>
|
<template #title>
|
||||||
<div>
|
|
||||||
<div style="display: flex; align-items: center">
|
<div style="display: flex; align-items: center">
|
||||||
<!-- <j-button @click="onBack" size="small">返回</j-button> -->
|
|
||||||
<div style="font-size: 24px">
|
|
||||||
{{ instanceStore.current?.name }}
|
{{ instanceStore.current?.name }}
|
||||||
</div>
|
|
||||||
<j-divider type="vertical" />
|
<j-divider type="vertical" />
|
||||||
<j-space>
|
<j-space>
|
||||||
<span
|
<span style="font-size: 14px; color: rgba(0, 0, 0, 0.85)">
|
||||||
style="font-size: 14px; color: rgba(0, 0, 0, 0.85)"
|
|
||||||
>
|
|
||||||
状态:
|
状态:
|
||||||
<j-badge
|
<j-badge
|
||||||
:status="
|
:status="
|
||||||
|
@ -28,8 +23,7 @@
|
||||||
</span>
|
</span>
|
||||||
<PermissionButton
|
<PermissionButton
|
||||||
v-if="
|
v-if="
|
||||||
instanceStore.current?.state?.value ===
|
instanceStore.current?.state?.value === 'notActive'
|
||||||
'notActive'
|
|
||||||
"
|
"
|
||||||
type="link"
|
type="link"
|
||||||
style="margin-top: -5px; padding: 0 20px"
|
style="margin-top: -5px; padding: 0 20px"
|
||||||
|
@ -42,9 +36,7 @@
|
||||||
启用设备
|
启用设备
|
||||||
</PermissionButton>
|
</PermissionButton>
|
||||||
<PermissionButton
|
<PermissionButton
|
||||||
v-if="
|
v-if="instanceStore.current?.state?.value === 'online'"
|
||||||
instanceStore.current?.state?.value === 'online'
|
|
||||||
"
|
|
||||||
type="link"
|
type="link"
|
||||||
style="margin-top: -5px; padding: 0 20px"
|
style="margin-top: -5px; padding: 0 20px"
|
||||||
:popConfirm="{
|
:popConfirm="{
|
||||||
|
@ -59,8 +51,7 @@
|
||||||
v-if="
|
v-if="
|
||||||
instanceStore.current?.accessProvider ===
|
instanceStore.current?.accessProvider ===
|
||||||
'child-device' &&
|
'child-device' &&
|
||||||
instanceStore.current?.state?.value ===
|
instanceStore.current?.state?.value === 'offline'
|
||||||
'offline'
|
|
||||||
"
|
"
|
||||||
:title="
|
:title="
|
||||||
instanceStore.current?.features?.find(
|
instanceStore.current?.features?.find(
|
||||||
|
@ -77,7 +68,8 @@
|
||||||
</j-tooltip>
|
</j-tooltip>
|
||||||
</j-space>
|
</j-space>
|
||||||
</div>
|
</div>
|
||||||
<div style="padding-top: 24px">
|
</template>
|
||||||
|
<template #content>
|
||||||
<j-descriptions size="small" :column="4">
|
<j-descriptions size="small" :column="4">
|
||||||
<j-descriptions-item label="ID">{{
|
<j-descriptions-item label="ID">{{
|
||||||
instanceStore.current?.id
|
instanceStore.current?.id
|
||||||
|
@ -93,8 +85,6 @@
|
||||||
</PermissionButton>
|
</PermissionButton>
|
||||||
</j-descriptions-item>
|
</j-descriptions-item>
|
||||||
</j-descriptions>
|
</j-descriptions>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
<template #extra>
|
<template #extra>
|
||||||
<img
|
<img
|
||||||
|
@ -142,7 +132,7 @@ statusMap.set('notActive', 'warning');
|
||||||
|
|
||||||
const statusRef = ref();
|
const statusRef = ref();
|
||||||
|
|
||||||
const list = ref([
|
const initList = [
|
||||||
{
|
{
|
||||||
key: 'Info',
|
key: 'Info',
|
||||||
tab: '实例信息',
|
tab: '实例信息',
|
||||||
|
@ -163,7 +153,9 @@ const list = ref([
|
||||||
key: 'Log',
|
key: 'Log',
|
||||||
tab: '日志管理',
|
tab: '日志管理',
|
||||||
},
|
},
|
||||||
]);
|
];
|
||||||
|
|
||||||
|
const list = ref([...initList]);
|
||||||
|
|
||||||
const tabs = {
|
const tabs = {
|
||||||
Info,
|
Info,
|
||||||
|
@ -191,64 +183,7 @@ const getStatus = (id: string) => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
watch(
|
const getDetail = () => {
|
||||||
() => route.params?.id,
|
|
||||||
(newId) => {
|
|
||||||
if (newId) {
|
|
||||||
instanceStore.refresh(String(newId));
|
|
||||||
getStatus(String(newId));
|
|
||||||
instanceStore.tabActiveKey = 'Info'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ immediate: true, deep: true },
|
|
||||||
);
|
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
instanceStore.tabActiveKey = history.state?.params?.tab || 'Info';
|
|
||||||
});
|
|
||||||
|
|
||||||
// const onBack = () => {
|
|
||||||
// menuStory.jumpPage('device/Instance');
|
|
||||||
// };
|
|
||||||
|
|
||||||
const onTabChange = (e: string) => {
|
|
||||||
instanceStore.tabActiveKey = e;
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleAction = async () => {
|
|
||||||
if (instanceStore.current?.id) {
|
|
||||||
const resp = await _deploy(instanceStore.current?.id);
|
|
||||||
if (resp.status === 200) {
|
|
||||||
message.success('操作成功!');
|
|
||||||
instanceStore.refresh(instanceStore.current?.id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleDisconnect = async () => {
|
|
||||||
if (instanceStore.current?.id) {
|
|
||||||
const resp = await _disconnect(instanceStore.current?.id);
|
|
||||||
if (resp.status === 200) {
|
|
||||||
message.success('操作成功!');
|
|
||||||
instanceStore.refresh(instanceStore.current?.id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleRefresh = async () => {
|
|
||||||
if (instanceStore.current?.id) {
|
|
||||||
await instanceStore.refresh(instanceStore.current?.id);
|
|
||||||
message.success('操作成功');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const jumpProduct = () => {
|
|
||||||
menuStory.jumpPage('device/Product/Detail', {
|
|
||||||
id: instanceStore.current?.productId,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
watchEffect(() => {
|
|
||||||
const keys = list.value.map((i) => i.key);
|
const keys = list.value.map((i) => i.key);
|
||||||
if (
|
if (
|
||||||
instanceStore.current?.protocol &&
|
instanceStore.current?.protocol &&
|
||||||
|
@ -309,8 +244,67 @@ watchEffect(() => {
|
||||||
tab: '边缘端映射',
|
tab: '边缘端映射',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => route.params?.id,
|
||||||
|
async (newId) => {
|
||||||
|
if (newId) {
|
||||||
|
await instanceStore.refresh(String(newId));
|
||||||
|
getStatus(String(newId));
|
||||||
|
list.value = [...initList];
|
||||||
|
getDetail();
|
||||||
|
instanceStore.tabActiveKey = 'Info';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ immediate: true, deep: true },
|
||||||
|
);
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
instanceStore.tabActiveKey = history.state?.params?.tab || 'Info';
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const onBack = () => {
|
||||||
|
menuStory.jumpPage('device/Instance');
|
||||||
|
};
|
||||||
|
|
||||||
|
const onTabChange = (e: string) => {
|
||||||
|
instanceStore.tabActiveKey = e;
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleAction = async () => {
|
||||||
|
if (instanceStore.current?.id) {
|
||||||
|
const resp = await _deploy(instanceStore.current?.id);
|
||||||
|
if (resp.status === 200) {
|
||||||
|
message.success('操作成功!');
|
||||||
|
instanceStore.refresh(instanceStore.current?.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleDisconnect = async () => {
|
||||||
|
if (instanceStore.current?.id) {
|
||||||
|
const resp = await _disconnect(instanceStore.current?.id);
|
||||||
|
if (resp.status === 200) {
|
||||||
|
message.success('操作成功!');
|
||||||
|
instanceStore.refresh(instanceStore.current?.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleRefresh = async () => {
|
||||||
|
if (instanceStore.current?.id) {
|
||||||
|
await instanceStore.refresh(instanceStore.current?.id);
|
||||||
|
message.success('操作成功');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const jumpProduct = () => {
|
||||||
|
menuStory.jumpPage('device/Product/Detail', {
|
||||||
|
id: instanceStore.current?.productId,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
statusRef.value && statusRef.value.unsubscribe();
|
statusRef.value && statusRef.value.unsubscribe();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue