fix: 运维管理 设备接入网关自测todo

This commit is contained in:
jackhoo_98 2023-03-16 09:54:48 +08:00
parent d8ca8ce212
commit 7e83d5bdc2
3 changed files with 86 additions and 92 deletions

View File

@ -55,14 +55,14 @@ import { getProviders, detail } from '@/api/link/accessConfig';
const route = useRoute();
const id = route.params.id as string;
const dataSource = ref([]);
const dataSource: any = ref([]);
const type = ref(false);
const loading = ref(true);
const provider = ref({});
const data = ref({});
const showType = ref('');
const goProviders = (param: object) => {
const goProviders = (param: any) => {
showType.value = param.type;
provider.value = param;
type.value = false;
@ -80,7 +80,7 @@ const getTypeList = (result: Record<string, any>) => {
const cloud: any[] = [];
const channel: any[] = [];
const edge: any[] = [];
result.map((item) => {
result.map((item: any) => {
if (item.id === 'fixed-media' || item.id === 'gb28181-2016') {
item.type = 'media';
media.push(item);
@ -138,33 +138,32 @@ const getTypeList = (result: Record<string, any>) => {
};
const queryProviders = async () => {
const resp = await getProviders();
const resp: any = await getProviders();
if (resp.status === 200) {
dataSource.value = getTypeList(resp.result);
// dataSource.value = getTypeList(resp.result)[0].list.filter(
// (item) => item.name !== '',
// );
console.log(111, dataSource.value);
}
};
const getProvidersData = async () => {
if (id !== ':id') {
getProviders().then((response) => {
getProviders().then((response: any) => {
if (response.status === 200) {
const list = getTypeList(response.result);
dataSource.value = list.filter(
(item) =>
(item: any) =>
item.channel === 'network' ||
item.channel === 'child-device',
);
detail(id).then((resp) => {
detail(id).then((resp: any) => {
if (resp.status === 200) {
const dt = response.result.find(
(item) => item?.id === resp.result.provider,
(item: any) => item?.id === resp.result.provider,
);
response.result.forEach((item) => {
response.result.forEach((item: any) => {
if (item.id === resp.result.provider) {
resp.result.type = item.type;
showType.value = item.type;

View File

@ -32,7 +32,7 @@
v-for="item in networkList"
:key="item.id"
>
<access-card
<AccessCard
@checkedChange="checkedChange"
:checked="networkCurrent"
:data="{
@ -84,7 +84,7 @@
</j-tooltip>
</div>
</template>
</access-card>
</AccessCard>
</j-col>
</j-row>
<j-empty v-else description="暂无数据" />
@ -139,7 +139,6 @@
<j-row :gutter="[24, 24]">
<j-col :span="12">
<title-component data="基本信息" />
<div>
<j-form
ref="formRef"
:model="formData"
@ -168,7 +167,6 @@
/>
</j-form-item>
</j-form>
</div>
</j-col>
<j-col :span="12">
<div class="config-right">
@ -256,9 +254,7 @@
'stream'
"
>
<span>{{
getStream(record)
}}</span>
{{ getStream(record) }}
</template>
</template>
</j-table>
@ -359,7 +355,7 @@ const stepCurrent = ref(0);
const steps = ref(['网络组件', '消息协议', '完成']);
const networkList: any = ref([]);
const allNetworkList: any = ref([]);
const procotolList = ref([]);
const procotolList: any = ref([]);
const allProcotolList = ref([]);
const networkCurrent: any = ref('');
const procotolCurrent: any = ref('');
@ -390,11 +386,12 @@ const queryNetworkList = async (id: string, include: string, data = {}) => {
);
if (resp.status === 200) {
networkList.value = resp.result;
allNetworkList.value = resp.result;
}
};
const queryProcotolList = async (id: string, params = {}) => {
const resp = await getProtocolList(ProtocolMapping.get(id), {
const resp: any = await getProtocolList(ProtocolMapping.get(id), {
...params,
'sorts[0].name': 'createTime',
'sorts[0].order': 'desc',
@ -407,12 +404,12 @@ const queryProcotolList = async (id: string, params = {}) => {
const addNetwork = () => {
const url = menuStory.menus['link/Type/Detail']?.path;
const tab = window.open(
const tab: any = window.open(
`${window.location.origin + window.location.pathname}#${url}?type=${
NetworkTypeMapping.get(props.provider?.id) || ''
}`,
);
tab.onTabSaveSuccess = (value) => {
tab.onTabSaveSuccess = (value: any) => {
if (value.success) {
networkCurrent.value = value.result.id;
queryNetworkList(props.provider?.id, networkCurrent.value || '');
@ -422,10 +419,10 @@ const addNetwork = () => {
const addProcotol = () => {
const url = menuStory.menus['link/Protocol']?.path;
const tab = window.open(
const tab: any = window.open(
`${window.location.origin + window.location.pathname}#${url}?save=true`,
);
tab.onTabSaveSuccess = (value) => {
tab.onTabSaveSuccess = (value: any) => {
if (value.success) {
procotolCurrent.value = value.result?.id;
queryProcotolList(props.provider?.id);
@ -434,15 +431,17 @@ const addProcotol = () => {
};
const getNetworkCurrent = () =>
networkList.value.find((i) => i.id === networkCurrent) &&
(networkList.value.find((i) => i.id === networkCurrent).addresses || [])
.length > 0;
networkList.value.find((i: any) => i.id === networkCurrent) &&
(
networkList.value.find((i: any) => i.id === networkCurrent).addresses ||
[]
).length > 0;
const getNetworkCurrentData = () =>
getNetworkCurrent()
? networkList.value.find((i) => i.id === networkCurrent).addresses
? networkList.value.find((i: any) => i.id === networkCurrent).addresses
: [];
const getColor = (i) => (i.health === -1 ? 'red' : 'green');
const getColor = (i: any) => (i.health === -1 ? 'red' : 'green');
const getStream = (record: any) => {
let stream = '';
@ -457,15 +456,15 @@ const checkedChange = (id: string) => {
};
const networkSearch = (value: string) => {
if (value) {
networkList.value = allNetworkList.value.filter(
networkList.value = value
? allNetworkList.value.filter(
(i: any) =>
i.name &&
i.name.toLocaleLowerCase().includes(value.toLocaleLowerCase()),
);
} else {
networkList.value = allNetworkList.value;
}
i.name
.toLocaleLowerCase()
.includes(value.toLocaleLowerCase()),
)
: allNetworkList.value;
};
const procotolChange = (id: string) => {
if (!props.data.id) {
@ -474,17 +473,15 @@ const procotolChange = (id: string) => {
};
const procotolSearch = (value: string) => {
if (value) {
const list = allProcotolList.value.filter((i: any) => {
return (
procotolList.value = value
? allProcotolList.value.filter(
(i: any) =>
i.name &&
i.name.toLocaleLowerCase().includes(value.toLocaleLowerCase())
);
});
procotolList.value = list;
} else {
procotolList.value = allProcotolList.value;
}
i.name
.toLocaleLowerCase()
.includes(value.toLocaleLowerCase()),
)
: allProcotolList.value;
};
const saveData = () => {
@ -538,8 +535,6 @@ const next = async () => {
: await getChildConfigView(procotolCurrent.value);
if (resp.status === 200) {
config.value = resp.result;
console.log(222, config.value);
current.value = current.value + 1;
const Group = {
title: '分组',
@ -567,8 +562,8 @@ const next = async () => {
return obj;
},
};
columnsMQTT.value = [Group, ...ColumnsMQTT];
columnsHTTP.value = [Group, ...ColumnsHTTP];
columnsMQTT.value = [Group, ...ColumnsMQTT] as TableColumnType;
columnsHTTP.value = [Group, ...ColumnsHTTP] as TableColumnType;
}
}
}

View File

@ -1,7 +1,11 @@
<template>
<page-container>
<div>
<Search :columns="columns" target="search" @search="handleSearch" />
<pro-search
:columns="columns"
target="search"
@search="handleSearch"
/>
<j-pro-table
ref="tableRef"
@ -16,18 +20,14 @@
:params="params"
>
<template #headerTitle>
<j-space>
<PermissionButton
type="primary"
@click="handlAdd"
hasPermission="link/AccessConfig:add"
>
<template #icon
><AIcon type="PlusOutlined"
/></template>
<template #icon><AIcon type="PlusOutlined" /></template>
新增
</PermissionButton>
</j-space>
</template>
<template #card="slotProps">
<CardBox