update: 统一修改浏览器标签跳转、设备接入网关新增快速添加
This commit is contained in:
parent
ef6c66600f
commit
e7be6d4770
|
@ -88,6 +88,17 @@ const TypeMap = new Map([
|
|||
['edge-child-device', 'edge'],
|
||||
['network', 'network'],
|
||||
]);
|
||||
// DataMap后期优化
|
||||
const DataMap = new Map();
|
||||
DataMap.set('fixed-media', { type: 'media', title: '视频类设备接入' });
|
||||
DataMap.set('gb28181-2016', { type: 'media', title: '视频类设备接入' });
|
||||
DataMap.set('OneNet', { type: 'cloud', title: '云平台接入' });
|
||||
DataMap.set('Ctwing', { type: 'cloud', title: '云平台接入' });
|
||||
DataMap.set('modbus-tcp', { type: 'channel', title: '通道类设备接入' });
|
||||
DataMap.set('opc-ua', { type: 'channel', title: '通道类设备接入' });
|
||||
DataMap.set('official-edge-gateway', { type: 'edge', title: '官方接入' });
|
||||
DataMap.set('edge-child-device', { type: 'edge', title: '官方接入' });
|
||||
DataMap.set('network', { type: 'network', title: '自定义设备接入' });
|
||||
|
||||
const getTypeList = (result: Record<string, any>) => {
|
||||
const list = [];
|
||||
|
@ -161,12 +172,14 @@ const queryProviders = async () => {
|
|||
// dataSource.value = getTypeList(resp.result)[0].list.filter(
|
||||
// (item) => item.name !== '插件设备接入',
|
||||
// );
|
||||
if (route.query.save) {
|
||||
// 视频中心-设备快速添加产品, 添加接入网关
|
||||
|
||||
// 快速添加接入网关
|
||||
if (route.query.save && route.query?.type) {
|
||||
const type = route.query.type;
|
||||
goProviders(
|
||||
dataSource.value
|
||||
.find((f: any) => f.title === '视频类设备接入')
|
||||
?.list?.find((f: any) => f.id === route.query.type),
|
||||
.find((f: any) => f.title === DataMap.get(type).title)
|
||||
?.list?.find((f: any) => f.id === type),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -119,6 +119,10 @@ const onFinish = async (values: any) => {
|
|||
if (resp.status === 200) {
|
||||
onlyMessage('操作成功', 'success');
|
||||
history.back();
|
||||
if ((window as any).onTabSaveSuccess) {
|
||||
(window as any).onTabSaveSuccess(resp);
|
||||
setTimeout(() => window.close(), 300);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -413,6 +413,10 @@ const saveData = async () => {
|
|||
if (resp.status === 200) {
|
||||
onlyMessage('操作成功', 'success');
|
||||
history.back();
|
||||
if ((window as any).onTabSaveSuccess) {
|
||||
(window as any).onTabSaveSuccess(resp);
|
||||
setTimeout(() => window.close(), 300);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -501,6 +501,10 @@ const saveData = async () => {
|
|||
if (resp.status === 200) {
|
||||
onlyMessage('操作成功', 'success');
|
||||
history.back();
|
||||
if ((window as any).onTabSaveSuccess) {
|
||||
(window as any).onTabSaveSuccess(resp);
|
||||
setTimeout(() => window.close(), 300);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -265,6 +265,10 @@ const onFinish = async (values: any) => {
|
|||
if (resp.status === 200) {
|
||||
onlyMessage('操作成功', 'success');
|
||||
history.back();
|
||||
if ((window as any).onTabSaveSuccess) {
|
||||
(window as any).onTabSaveSuccess(resp);
|
||||
setTimeout(() => window.close(), 300);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -654,7 +654,7 @@ const saveData = () => {
|
|||
onlyMessage('操作成功', 'success');
|
||||
if (route.query.save) {
|
||||
// @ts-ignore
|
||||
window?.onSaveSuccess(resp.result);
|
||||
window?.onTabSaveSuccess(resp.result);
|
||||
window.close();
|
||||
} else {
|
||||
history.back();
|
||||
|
|
|
@ -124,7 +124,7 @@ const onFinish = async (values: any) => {
|
|||
|
||||
if (route.query.save) {
|
||||
// @ts-ignore
|
||||
window?.onSaveSuccess(resp.result);
|
||||
window?.onTabSaveSuccess(resp.result);
|
||||
window.close();
|
||||
} else {
|
||||
history.back();
|
||||
|
|
|
@ -522,7 +522,6 @@ const saveData = () => {
|
|||
onlyMessage('操作成功', 'success');
|
||||
history.back();
|
||||
if ((window as any).onTabSaveSuccess) {
|
||||
console.log(123);
|
||||
if (resp.result?.id) {
|
||||
(window as any).onTabSaveSuccess(resp);
|
||||
setTimeout(() => window.close(), 300);
|
||||
|
|
|
@ -319,7 +319,7 @@ const handleAdd = () => {
|
|||
const tab: any = window.open(
|
||||
`${origin}/#/iot/link/accessConfig/detail/:id?save=true&view=false&type=${props.channel}`,
|
||||
);
|
||||
tab.onSaveSuccess = async (value: string) => {
|
||||
tab.onTabSaveSuccess = async (value: string) => {
|
||||
await getGatewayList();
|
||||
handleClick(value);
|
||||
};
|
||||
|
|
|
@ -1771,7 +1771,7 @@ function getOrgIdList() {
|
|||
// 添加角色/组织
|
||||
function clickAddItem(data: string[], target: string) {
|
||||
const tab: any = window.open(`${origin}/#/system/${target}?save=true`);
|
||||
tab.onSaveSuccess = (value: string) => {
|
||||
tab.onTabSaveSuccess = (value: string) => {
|
||||
data.push(value);
|
||||
if (target === 'Role') getRoleIdList();
|
||||
else getOrgIdList();
|
||||
|
|
|
@ -187,7 +187,7 @@ function delDepartment(id: string) {
|
|||
}
|
||||
function refresh(id: string) {
|
||||
// @ts-ignore
|
||||
window?.onSaveSuccess && window.onSaveSuccess(id);
|
||||
window?.onTabSaveSuccess && window.onTabSaveSuccess(id);
|
||||
window.close();
|
||||
getTree();
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ const confirm = () => {
|
|||
|
||||
if (route.query.save) {
|
||||
// @ts-ignore
|
||||
window?.onSaveSuccess(resp.result.id);
|
||||
window?.onTabSaveSuccess(resp.result.id);
|
||||
window.close();
|
||||
} else jumpPage(`system/Role/Detail`, { id: resp.result.id });
|
||||
}
|
||||
|
|
|
@ -345,7 +345,7 @@ const form = reactive({
|
|||
IsShow: (...typeList: modalType[]) => typeList.includes(props.type),
|
||||
clickAddItem: (prop: 'roleIdList' | 'orgIdList', target: string) => {
|
||||
const tab: any = window.open(`${origin}/#/system/${target}?save=true`);
|
||||
tab.onSaveSuccess = (value: string) => {
|
||||
tab.onTabSaveSuccess = (value: string) => {
|
||||
form.data[prop] = [...(form.data[prop] || []), value];
|
||||
if (prop === 'roleIdList') form.getRoleList();
|
||||
else form.getDepartmentList();
|
||||
|
|
Loading…
Reference in New Issue