update 优化 类型报错问题
This commit is contained in:
parent
9193f0b84a
commit
9eb7b433b4
@ -1,63 +0,0 @@
|
|||||||
import request from '@/utils/request';
|
|
||||||
import { AxiosPromise } from 'axios';
|
|
||||||
import { NodeConfigVO, NodeConfigForm, NodeConfigQuery } from '@/api/workflow/nodeConfig/types';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询节点配置列表
|
|
||||||
* @param query
|
|
||||||
* @returns {*}
|
|
||||||
*/
|
|
||||||
|
|
||||||
export const listNodeConfig = (query?: NodeConfigQuery): AxiosPromise<NodeConfigVO[]> => {
|
|
||||||
return request({
|
|
||||||
url: '/workflow/nodeConfig/list',
|
|
||||||
method: 'get',
|
|
||||||
params: query
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询节点配置详细
|
|
||||||
* @param id
|
|
||||||
*/
|
|
||||||
export const getNodeConfig = (id: string | number): AxiosPromise<NodeConfigVO> => {
|
|
||||||
return request({
|
|
||||||
url: '/workflow/nodeConfig/' + id,
|
|
||||||
method: 'get'
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增节点配置
|
|
||||||
* @param data
|
|
||||||
*/
|
|
||||||
export const addNodeConfig = (data: NodeConfigForm) => {
|
|
||||||
return request({
|
|
||||||
url: '/workflow/nodeConfig',
|
|
||||||
method: 'post',
|
|
||||||
data: data
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改节点配置
|
|
||||||
* @param data
|
|
||||||
*/
|
|
||||||
export const updateNodeConfig = (data: NodeConfigForm) => {
|
|
||||||
return request({
|
|
||||||
url: '/workflow/nodeConfig',
|
|
||||||
method: 'put',
|
|
||||||
data: data
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除节点配置
|
|
||||||
* @param id
|
|
||||||
*/
|
|
||||||
export const delNodeConfig = (id: string | number | Array<string | number>) => {
|
|
||||||
return request({
|
|
||||||
url: '/workflow/nodeConfig/' + id,
|
|
||||||
method: 'delete'
|
|
||||||
});
|
|
||||||
};
|
|
@ -40,6 +40,7 @@ router.beforeEach(async (to, from, next) => {
|
|||||||
router.addRoute(route); // 动态添加可访问路由表
|
router.addRoute(route); // 动态添加可访问路由表
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
// @ts-ignore
|
||||||
next({ path: to.path, replace: true, params: to.params, query: to.query, hash: to.hash, name: to.name as string }); // hack方法 确保addRoutes已完成
|
next({ path: to.path, replace: true, params: to.params, query: to.query, hash: to.hash, name: to.name as string }); // hack方法 确保addRoutes已完成
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import router from '@/router';
|
import router from '@/router';
|
||||||
import { RouteLocationMatched, RouteLocationNormalized } from 'vue-router';
|
import {RouteLocationMatched, RouteLocationNormalized, RouteLocationRaw} from 'vue-router';
|
||||||
import useTagsViewStore from '@/store/modules/tagsView';
|
import useTagsViewStore from '@/store/modules/tagsView';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@ -41,7 +41,7 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
// 关闭当前tab页签,打开新页签
|
// 关闭当前tab页签,打开新页签
|
||||||
closeOpenPage(obj: RouteLocationNormalized): void {
|
closeOpenPage(obj: RouteLocationRaw): void {
|
||||||
useTagsViewStore().delView(router.currentRoute.value);
|
useTagsViewStore().delView(router.currentRoute.value);
|
||||||
if (obj !== undefined) {
|
if (obj !== undefined) {
|
||||||
router.push(obj);
|
router.push(obj);
|
||||||
|
@ -21,13 +21,13 @@ export const usePermissionStore = defineStore('permission', () => {
|
|||||||
const sidebarRouters = ref<RouteRecordRaw[]>([]);
|
const sidebarRouters = ref<RouteRecordRaw[]>([]);
|
||||||
|
|
||||||
const getRoutes = (): RouteRecordRaw[] => {
|
const getRoutes = (): RouteRecordRaw[] => {
|
||||||
return routes.value;
|
return routes.value as RouteRecordRaw[];
|
||||||
};
|
};
|
||||||
const getSidebarRoutes = (): RouteRecordRaw[] => {
|
const getSidebarRoutes = (): RouteRecordRaw[] => {
|
||||||
return sidebarRouters.value;
|
return sidebarRouters.value as RouteRecordRaw[];
|
||||||
};
|
};
|
||||||
const getTopbarRoutes = (): RouteRecordRaw[] => {
|
const getTopbarRoutes = (): RouteRecordRaw[] => {
|
||||||
return topbarRouters.value;
|
return topbarRouters.value as RouteRecordRaw[];
|
||||||
};
|
};
|
||||||
|
|
||||||
const setRoutes = (newRoutes: RouteRecordRaw[]): void => {
|
const setRoutes = (newRoutes: RouteRecordRaw[]): void => {
|
||||||
|
@ -6,10 +6,10 @@ export const useTagsViewStore = defineStore('tagsView', () => {
|
|||||||
const iframeViews = ref<RouteLocationNormalized[]>([]);
|
const iframeViews = ref<RouteLocationNormalized[]>([]);
|
||||||
|
|
||||||
const getVisitedViews = (): RouteLocationNormalized[] => {
|
const getVisitedViews = (): RouteLocationNormalized[] => {
|
||||||
return visitedViews.value;
|
return visitedViews.value as RouteLocationNormalized[];
|
||||||
};
|
};
|
||||||
const getIframeViews = (): RouteLocationNormalized[] => {
|
const getIframeViews = (): RouteLocationNormalized[] => {
|
||||||
return iframeViews.value;
|
return iframeViews.value as RouteLocationNormalized[];
|
||||||
};
|
};
|
||||||
const getCachedViews = (): string[] => {
|
const getCachedViews = (): string[] => {
|
||||||
return cachedViews.value;
|
return cachedViews.value;
|
||||||
@ -31,7 +31,7 @@ export const useTagsViewStore = defineStore('tagsView', () => {
|
|||||||
const delIframeView = (view: RouteLocationNormalized): Promise<RouteLocationNormalized[]> => {
|
const delIframeView = (view: RouteLocationNormalized): Promise<RouteLocationNormalized[]> => {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
iframeViews.value = iframeViews.value.filter((item: RouteLocationNormalized) => item.path !== view.path);
|
iframeViews.value = iframeViews.value.filter((item: RouteLocationNormalized) => item.path !== view.path);
|
||||||
resolve([...iframeViews.value]);
|
resolve([...iframeViews.value as RouteLocationNormalized[]]);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
const addVisitedView = (view: RouteLocationNormalized): void => {
|
const addVisitedView = (view: RouteLocationNormalized): void => {
|
||||||
@ -54,7 +54,7 @@ export const useTagsViewStore = defineStore('tagsView', () => {
|
|||||||
delCachedView(view);
|
delCachedView(view);
|
||||||
}
|
}
|
||||||
resolve({
|
resolve({
|
||||||
visitedViews: [...visitedViews.value],
|
visitedViews: [...visitedViews.value as RouteLocationNormalized[]],
|
||||||
cachedViews: [...cachedViews.value]
|
cachedViews: [...cachedViews.value]
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -68,7 +68,7 @@ export const useTagsViewStore = defineStore('tagsView', () => {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
resolve([...visitedViews.value]);
|
resolve([...visitedViews.value as RouteLocationNormalized[]]);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
const delCachedView = (view?: RouteLocationNormalized): Promise<string[]> => {
|
const delCachedView = (view?: RouteLocationNormalized): Promise<string[]> => {
|
||||||
@ -92,7 +92,7 @@ export const useTagsViewStore = defineStore('tagsView', () => {
|
|||||||
delOthersVisitedViews(view);
|
delOthersVisitedViews(view);
|
||||||
delOthersCachedViews(view);
|
delOthersCachedViews(view);
|
||||||
resolve({
|
resolve({
|
||||||
visitedViews: [...visitedViews.value],
|
visitedViews: [...visitedViews.value as RouteLocationNormalized[]],
|
||||||
cachedViews: [...cachedViews.value]
|
cachedViews: [...cachedViews.value]
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -103,7 +103,7 @@ export const useTagsViewStore = defineStore('tagsView', () => {
|
|||||||
visitedViews.value = visitedViews.value.filter((v: RouteLocationNormalized) => {
|
visitedViews.value = visitedViews.value.filter((v: RouteLocationNormalized) => {
|
||||||
return v.meta?.affix || v.path === view.path;
|
return v.meta?.affix || v.path === view.path;
|
||||||
});
|
});
|
||||||
resolve([...visitedViews.value]);
|
resolve([...visitedViews.value as RouteLocationNormalized[]]);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
const delOthersCachedViews = (view: RouteLocationNormalized): Promise<string[]> => {
|
const delOthersCachedViews = (view: RouteLocationNormalized): Promise<string[]> => {
|
||||||
@ -124,7 +124,7 @@ export const useTagsViewStore = defineStore('tagsView', () => {
|
|||||||
delAllVisitedViews();
|
delAllVisitedViews();
|
||||||
delAllCachedViews();
|
delAllCachedViews();
|
||||||
resolve({
|
resolve({
|
||||||
visitedViews: [...visitedViews.value],
|
visitedViews: [...visitedViews.value as RouteLocationNormalized[]],
|
||||||
cachedViews: [...cachedViews.value]
|
cachedViews: [...cachedViews.value]
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -132,7 +132,7 @@ export const useTagsViewStore = defineStore('tagsView', () => {
|
|||||||
const delAllVisitedViews = (): Promise<RouteLocationNormalized[]> => {
|
const delAllVisitedViews = (): Promise<RouteLocationNormalized[]> => {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
visitedViews.value = visitedViews.value.filter((tag: RouteLocationNormalized) => tag.meta?.affix);
|
visitedViews.value = visitedViews.value.filter((tag: RouteLocationNormalized) => tag.meta?.affix);
|
||||||
resolve([...visitedViews.value]);
|
resolve([...visitedViews.value as RouteLocationNormalized[]]);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -167,7 +167,7 @@ export const useTagsViewStore = defineStore('tagsView', () => {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
resolve([...visitedViews.value]);
|
resolve([...visitedViews.value as RouteLocationNormalized[]]);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
const delLeftTags = (view: RouteLocationNormalized): Promise<RouteLocationNormalized[]> => {
|
const delLeftTags = (view: RouteLocationNormalized): Promise<RouteLocationNormalized[]> => {
|
||||||
@ -186,7 +186,7 @@ export const useTagsViewStore = defineStore('tagsView', () => {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
resolve([...visitedViews.value]);
|
resolve([...visitedViews.value as RouteLocationNormalized[]]);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user