fix: 优化标签保存ico回显

* feat: fix:15071

* feat: fix#15077

* feat: 修复组织管理树搜索

* Revert "feat: fix:15071"

This reverts commit 7a8340d3e8.

* fix: 修改告警配置卡顿

* fix: 产品新增分类搜索

* fix: string错误

* fix: 优化标签title,ico

* fix: 优化标签保存ico回显
This commit is contained in:
XieYongHong 2023-06-09 17:54:00 +08:00 committed by GitHub
parent 1dd119144a
commit 43aa4bc16e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 33 additions and 23 deletions

View File

@ -13,7 +13,7 @@ export const update = (id: string, data: any) =>
export const getProviders = () => server.get(`/gateway/device/providers`);
export const queryOptionsList = (type: strimg) =>
export const queryOptionsList = (type: string) =>
server.get(`/data-collect/opc/${type}`);
export const validateField = (data: any) =>

View File

@ -4,3 +4,5 @@ import server from '@/utils/request';
export const save_api = (data: any) => server.post(`/system/config/scope/_save`, data)
// 获取详情
export const getDetails_api = (data: any) => server.post<any>(`/system/config/scopes`, data)
export const settingDetail = (scopes: string) => server.get<any>(`/system/config/${scopes}`)

View File

@ -1,7 +1,7 @@
import { defineStore } from 'pinia';
import { systemVersion } from '@/api/comm'
import { useMenuStore } from './menu'
import { getDetails_api } from '@/api/system/basis';
import {getDetails_api, settingDetail} from '@/api/system/basis';
import type { ConfigInfoType } from '@/views/system/Basis/typing';
import { LocalStore } from '@/utils/comm'
import { SystemConst } from '@/utils/consts'
@ -33,12 +33,26 @@ export const useSystem = defineStore('system', {
}
})
},
async getFront () {
const res = await settingDetail('front')
if (res.success) {
const ico: any = document.querySelector('link[rel="icon"]');
ico.href = res.result.ico;
document.title = res.result.title || '';
}
},
async getSystemConfig() {
const params = ['front', 'amap', 'paths'];
const { status, result } = await getDetails_api(params);
if (status === 200) {
params.forEach((key: string) => {
this.configInfo[key] = { ...result.find((item: any) => item.scope === key)?.properties }
if (key === 'front') {
const data = result.find((item: any) => item.scope === key).properties
const ico: any = document.querySelector('link[rel="icon"]');
ico.href = data.ico;
document.title = data.title || '';
}
})
}
}

View File

@ -73,7 +73,7 @@
children: 'children',
}"
:filterTreeNode="
(v, option) => filterSelectNode(v, option)
(v, option) => filterSelectNode(v, option, 'name')
"
>
<template> </template>
@ -164,13 +164,13 @@ const deviceList = ref([
label: '网关子设备',
value: 'childrenDevice',
iconUrl: getImage('/device-type-2.png'),
tooltip: '能挂载子设备与平台进行通信的设备',
tooltip: '作为网关的子设备,有网关代理连接到物联网平台',
},
{
label: '网关设备',
value: 'gateway',
iconUrl: getImage('/device/device-type-3.png'),
tooltip: '作为网关的子设备,有网关代理连接到物联网平台',
tooltip: '能挂载子设备与平台进行通信的设备',
},
]);

View File

@ -337,6 +337,8 @@ import { settingDetail } from '@/api/login';
const action = `${BASE_API_PATH}/file/static`;
const headers = { [TOKEN_KEY]: LocalStore.get(TOKEN_KEY) };
const formRef = ref();
const system = useSystem();
const form = reactive<formType>({
formValue: {
title: '',
@ -378,10 +380,10 @@ const form = reactive<formType>({
iconLoading: false, //
saveLoading: false,
getDetails: async () => {
const system = useSystem();
await system.getSystemConfig();
await settingDetail('front');
const configInfo = system.$state.configInfo;
// await system.getSystemConfig();
// await settingDetail('front');
const configInfo = system.configInfo;
form.formValue = {
title: configInfo.front?.title,
headerTheme: configInfo.front?.headerTheme,
@ -422,10 +424,11 @@ const form = reactive<formType>({
];
save_api(params)
.then((resp) => {
.then(async (resp) => {
if (resp.status === 200) {
message.success('保存成功');
form.getDetails();
await system.getSystemConfig()
await form.getDetails();
}
})
.finally(() => (form.saveLoading = false));

View File

@ -172,11 +172,13 @@ import {
settingDetail, userDetail
} from '@/api/login'
import { useUserInfo } from '@/store/userInfo';
import { useSystem } from '@/store/system'
import { LocalStore } from '@/utils/comm';
import { BASE_API_PATH, TOKEN_KEY, Version_Code } from '@/utils/variable';
import { SystemConst } from '@/utils/consts';
const store = useUserInfo();
const systemStore = useSystem();
const router = useRouter();
const bgImage = getImage('/logo.png');
const viewLogo = getImage('/view-logo.png');
@ -310,18 +312,7 @@ const getOpen = () => {
}
}
});
settingDetail('front').then((res: any) => {
if (res.status === 200) {
const ico: any = document.querySelector('link[rel="icon"]');
ico.href = res.result.ico;
basis.value = res.result;
if (res.result.title) {
document.title = res.result.title;
} else {
document.title = '';
}
}
});
systemStore.getFront()
};
const handleClickOther = (item: any) => {