fix: 优化初始化菜单协议查询;修改产品保存接口请求类型为put
This commit is contained in:
parent
b6c8bb568f
commit
d34bb10d97
|
@ -106,7 +106,7 @@ export const addProduct = (data:any) => server.post('/device-product',data)
|
|||
* @param data
|
||||
* @returns
|
||||
*/
|
||||
export const editProduct = (data: any) => server.patch('/device-product', data)
|
||||
export const editProduct = (data: any) => server.put(`/device-product/${data.id}`, data)
|
||||
|
||||
/**
|
||||
* 删除产品
|
||||
|
|
|
@ -23,15 +23,27 @@ const menuDatas = reactive({
|
|||
count: 0,
|
||||
current: undefined,
|
||||
});
|
||||
|
||||
/**
|
||||
* 查询支持的协议
|
||||
*/
|
||||
const getProvidersFn = async () => {
|
||||
const res: any = await getProviders();
|
||||
const ids = res.result?.map?.(item => item.id) || []
|
||||
return protocolList.some(item => ids.includes(item.value))
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前系统权限信息
|
||||
*/
|
||||
const getSystemPermissionData = async () => {
|
||||
const hasProtocol = await getProvidersFn();
|
||||
const resp = await getSystemPermission();
|
||||
if (resp.status === 200) {
|
||||
const newTree = filterMenu(
|
||||
resp.result.map((item: any) => JSON.parse(item).id),
|
||||
BaseMenu,
|
||||
hasProtocol
|
||||
);
|
||||
const _count = menuCount(newTree);
|
||||
menuDatas.current = newTree;
|
||||
|
@ -39,21 +51,10 @@ const getSystemPermissionData = async () => {
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 查询支持的协议
|
||||
*/
|
||||
let filterProtocolList: any[] = [];
|
||||
const getProvidersFn = async () => {
|
||||
const res: any = await getProviders();
|
||||
filterProtocolList = protocolList.filter((item) => {
|
||||
return res.result?.find((val: any) => item.alias == val.id);
|
||||
})
|
||||
}
|
||||
getProvidersFn();
|
||||
/**
|
||||
* 过滤菜单
|
||||
*/
|
||||
const filterMenu = (permissions: string[], menus: any[]) => {
|
||||
const filterMenu = (permissions: string[], menus: any[], hasProtocol: boolean) => {
|
||||
return menus.filter((item) => {
|
||||
let isShow = false;
|
||||
if (item.showPage && item.showPage.length) {
|
||||
|
@ -62,9 +63,9 @@ const filterMenu = (permissions: string[], menus: any[]) => {
|
|||
});
|
||||
}
|
||||
if (item.children) {
|
||||
item.children = filterMenu(permissions, item.children);
|
||||
item.children = filterMenu(permissions, item.children, hasProtocol);
|
||||
}
|
||||
if (!filterProtocolList.length && item.code == 'link/DataCollect') {
|
||||
if (!hasProtocol && item.code == 'link/DataCollect') {
|
||||
return false;
|
||||
}
|
||||
return isShow || !!item.children?.length;
|
||||
|
|
|
@ -95,8 +95,8 @@ export default defineConfig(({ mode}) => {
|
|||
// target: 'http://192.168.32.226:8844',
|
||||
// target: 'http://192.168.32.244:8881',
|
||||
// target: 'http://192.168.32.163:8844', //张季本地
|
||||
// target: 'http://120.77.179.54:8844', // 120测试
|
||||
target: 'http://192.168.33.46:8844', // 本地开发环境
|
||||
target: 'http://120.77.179.54:8844', // 120测试
|
||||
// target: 'http://47.109.52.230:8844', // 本地开发环境
|
||||
ws: 'ws://192.168.33.46:8844',
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/api/, '')
|
||||
|
|
|
@ -3755,8 +3755,8 @@ jetlinks-ui-components@^1.0.23:
|
|||
|
||||
jetlinks-ui-components@^1.0.28:
|
||||
version "1.0.28"
|
||||
resolved "http://registry.jetlinks.cn/jetlinks-ui-components/-/jetlinks-ui-components-1.0.28.tgz#592812416edb5b1f45991d1714ab13701eeba8da"
|
||||
integrity sha512-+6zDWT3QwnrtmCNwpZkejZ084Sx5UrH+Jd7z0e8Ds71p7VGxMx/GE+2DQ/ob8ZW2tB7dHQmJi7JhYblHxl6EFg==
|
||||
resolved "http://registry.jetlinks.cn/jetlinks-ui-components/-/jetlinks-ui-components-1.0.28.tgz#f409bdb62769947bf026a32b98899417d2352d0e"
|
||||
integrity sha512-SO/04K//MHJ4lAK1KPYf8q+FNaXCnSVsAOhr8YIcaPWlgHuitj9sxdso8xHwypCvNBMEUzTx+kDXB9HAlFqGMA==
|
||||
dependencies:
|
||||
"@vueuse/core" "^9.12.0"
|
||||
"@vueuse/router" "^9.13.0"
|
||||
|
|
Loading…
Reference in New Issue