fix: 修复网络组件 编辑查看页面空白问题
This commit is contained in:
parent
e2bcffe771
commit
478fac0cac
|
@ -51,7 +51,7 @@ import Channel from '../components/Channel/index.vue';
|
||||||
import Edge from '../components/Edge/index.vue';
|
import Edge from '../components/Edge/index.vue';
|
||||||
import Cloud from '../components/Cloud/index.vue';
|
import Cloud from '../components/Cloud/index.vue';
|
||||||
import { getProviders, detail } from '@/api/link/accessConfig';
|
import { getProviders, detail } from '@/api/link/accessConfig';
|
||||||
import { accessConfigTypeFilter } from '@/utils/setting'
|
import { accessConfigTypeFilter } from '@/utils/setting';
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const id = route.params.id as string;
|
const id = route.params.id as string;
|
||||||
|
@ -61,7 +61,7 @@ const type = ref(false);
|
||||||
const loading = ref(true);
|
const loading = ref(true);
|
||||||
const provider = ref({});
|
const provider = ref({});
|
||||||
const data = ref({});
|
const data = ref({});
|
||||||
const showType = ref('');
|
const showType: any = ref('');
|
||||||
|
|
||||||
const goProviders = (param: any) => {
|
const goProviders = (param: any) => {
|
||||||
showType.value = param.type;
|
showType.value = param.type;
|
||||||
|
@ -74,6 +74,19 @@ const goBack = () => {
|
||||||
type.value = true;
|
type.value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//network
|
||||||
|
const TypeMap = new Map([
|
||||||
|
['fixed-media', 'media'],
|
||||||
|
['gb28181-2016', 'media'],
|
||||||
|
['OneNet', 'cloud'],
|
||||||
|
['Ctwing', 'cloud'],
|
||||||
|
['modbus-tcp', 'channel'],
|
||||||
|
['opc-ua', 'channel'],
|
||||||
|
['official-edge-gateway', 'edge'],
|
||||||
|
['edge-child-device', 'edge'],
|
||||||
|
['network', 'network'],
|
||||||
|
]);
|
||||||
|
|
||||||
const getTypeList = (result: Record<string, any>) => {
|
const getTypeList = (result: Record<string, any>) => {
|
||||||
const list = [];
|
const list = [];
|
||||||
const media: any[] = [];
|
const media: any[] = [];
|
||||||
|
@ -141,8 +154,8 @@ const getTypeList = (result: Record<string, any>) => {
|
||||||
const queryProviders = async () => {
|
const queryProviders = async () => {
|
||||||
const resp: any = await getProviders();
|
const resp: any = await getProviders();
|
||||||
if (resp.status === 200) {
|
if (resp.status === 200) {
|
||||||
const data = resp.result || []
|
const _data = resp.result || [];
|
||||||
dataSource.value = getTypeList(accessConfigTypeFilter(data as any[]));
|
dataSource.value = getTypeList(accessConfigTypeFilter(_data as any[]));
|
||||||
// dataSource.value = getTypeList(resp.result)[0].list.filter(
|
// dataSource.value = getTypeList(resp.result)[0].list.filter(
|
||||||
// (item) => item.name !== '插件设备接入',
|
// (item) => item.name !== '插件设备接入',
|
||||||
// );
|
// );
|
||||||
|
@ -153,8 +166,10 @@ const getProvidersData = async () => {
|
||||||
if (id !== ':id') {
|
if (id !== ':id') {
|
||||||
getProviders().then((response: any) => {
|
getProviders().then((response: any) => {
|
||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
const data = response.result || []
|
const _data = response.result || [];
|
||||||
const list = getTypeList(accessConfigTypeFilter(data as any[]));
|
const list = getTypeList(
|
||||||
|
accessConfigTypeFilter(_data as any[]),
|
||||||
|
);
|
||||||
dataSource.value = list.filter(
|
dataSource.value = list.filter(
|
||||||
(item: any) =>
|
(item: any) =>
|
||||||
item.channel === 'network' ||
|
item.channel === 'network' ||
|
||||||
|
@ -165,11 +180,12 @@ const getProvidersData = async () => {
|
||||||
const dt = response.result.find(
|
const dt = response.result.find(
|
||||||
(item: any) => item?.id === resp.result.provider,
|
(item: any) => item?.id === resp.result.provider,
|
||||||
);
|
);
|
||||||
|
|
||||||
response.result.forEach((item: any) => {
|
response.result.forEach((item: any) => {
|
||||||
if (item.id === resp.result.provider) {
|
if (item.id === resp.result.provider) {
|
||||||
resp.result.type = item.type;
|
resp.result.type = TypeMap.has(item.id)
|
||||||
showType.value = item.type;
|
? TypeMap.get(item.id)
|
||||||
|
: TypeMap.get('network');
|
||||||
|
showType.value = resp.result.type;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue