update: 统一修改浏览器标签跳转、设备接入网关新增快速添加

This commit is contained in:
jackhoo_98 2023-03-31 12:39:44 +08:00
parent ef6c66600f
commit e7be6d4770
13 changed files with 41 additions and 13 deletions

View File

@ -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),
);
}
}

View File

@ -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);
}
}
};

View File

@ -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);
}
}
};

View File

@ -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);
}
}
};

View File

@ -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);
}
}
};

View File

@ -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();

View File

@ -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();

View File

@ -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);

View File

@ -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);
};

View File

@ -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();

View File

@ -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();
}

View File

@ -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 });
}

View File

@ -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();