From 7e83d5bdc272cf5a8e803aad40e42b78591e3c8e Mon Sep 17 00:00:00 2001 From: jackhoo_98 Date: Thu, 16 Mar 2023 09:54:48 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=BF=90=E7=BB=B4=E7=AE=A1=E7=90=86=20?= =?UTF-8?q?=E8=AE=BE=E5=A4=87=E6=8E=A5=E5=85=A5=E7=BD=91=E5=85=B3=E8=87=AA?= =?UTF-8?q?=E6=B5=8Btodo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/link/AccessConfig/Detail/index.vue | 19 ++- .../AccessConfig/components/Network/index.vue | 133 +++++++++--------- src/views/link/AccessConfig/index.vue | 26 ++-- 3 files changed, 86 insertions(+), 92 deletions(-) diff --git a/src/views/link/AccessConfig/Detail/index.vue b/src/views/link/AccessConfig/Detail/index.vue index 56d1fdb6..7d201357 100644 --- a/src/views/link/AccessConfig/Detail/index.vue +++ b/src/views/link/AccessConfig/Detail/index.vue @@ -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) => { 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) => { }; 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; diff --git a/src/views/link/AccessConfig/components/Network/index.vue b/src/views/link/AccessConfig/components/Network/index.vue index 94d0057a..2da436dd 100644 --- a/src/views/link/AccessConfig/components/Network/index.vue +++ b/src/views/link/AccessConfig/components/Network/index.vue @@ -32,7 +32,7 @@ v-for="item in networkList" :key="item.id" > - @@ -139,36 +139,34 @@ -
- + - - - - - - - -
+ + + + + +
@@ -256,9 +254,7 @@ 'stream' " > - {{ - getStream(record) - }} + {{ getStream(record) }} @@ -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( - (i: any) => - i.name && - i.name.toLocaleLowerCase().includes(value.toLocaleLowerCase()), - ); - } else { - networkList.value = allNetworkList.value; - } + networkList.value = value + ? allNetworkList.value.filter( + (i: any) => + i.name && + 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 ( - i.name && - i.name.toLocaleLowerCase().includes(value.toLocaleLowerCase()) - ); - }); - procotolList.value = list; - } else { - procotolList.value = allProcotolList.value; - } + procotolList.value = value + ? allProcotolList.value.filter( + (i: any) => + i.name && + 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; } } } diff --git a/src/views/link/AccessConfig/index.vue b/src/views/link/AccessConfig/index.vue index 0ab0345f..4b9af3ba 100644 --- a/src/views/link/AccessConfig/index.vue +++ b/src/views/link/AccessConfig/index.vue @@ -1,7 +1,11 @@