From 43aa4bc16e13b2b6e6ccc7e396cbfcb3b68dec17 Mon Sep 17 00:00:00 2001 From: XieYongHong <18010623010@163.com> Date: Fri, 9 Jun 2023 17:54:00 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96=E6=A0=87=E7=AD=BE?= =?UTF-8?q?=E4=BF=9D=E5=AD=98ico=E5=9B=9E=E6=98=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: fix:15071 * feat: fix#15077 * feat: 修复组织管理树搜索 * Revert "feat: fix:15071" This reverts commit 7a8340d3e8047ddf5ac3e08bf6e1e1f65d4a26e1. * fix: 修改告警配置卡顿 * fix: 产品新增分类搜索 * fix: string错误 * fix: 优化标签title,ico * fix: 优化标签保存ico回显 --- src/api/data-collect/channel.ts | 2 +- src/api/system/basis.ts | 2 ++ src/store/system.ts | 16 +++++++++++++++- src/views/device/Product/Save/index.vue | 6 +++--- src/views/system/Basis/index.vue | 15 +++++++++------ src/views/user/Login/index.vue | 15 +++------------ 6 files changed, 33 insertions(+), 23 deletions(-) diff --git a/src/api/data-collect/channel.ts b/src/api/data-collect/channel.ts index 08bbbd8c..f255032e 100644 --- a/src/api/data-collect/channel.ts +++ b/src/api/data-collect/channel.ts @@ -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) => diff --git a/src/api/system/basis.ts b/src/api/system/basis.ts index ea3677ec..267093fe 100644 --- a/src/api/system/basis.ts +++ b/src/api/system/basis.ts @@ -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(`/system/config/scopes`, data) + +export const settingDetail = (scopes: string) => server.get(`/system/config/${scopes}`) diff --git a/src/store/system.ts b/src/store/system.ts index d5065be0..024daa98 100644 --- a/src/store/system.ts +++ b/src/store/system.ts @@ -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 || ''; + } }) } } diff --git a/src/views/device/Product/Save/index.vue b/src/views/device/Product/Save/index.vue index bc41dcdf..5f05f4ff 100644 --- a/src/views/device/Product/Save/index.vue +++ b/src/views/device/Product/Save/index.vue @@ -73,7 +73,7 @@ children: 'children', }" :filterTreeNode=" - (v, option) => filterSelectNode(v, option) + (v, option) => filterSelectNode(v, option, 'name') " > @@ -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: '能挂载子设备与平台进行通信的设备', }, ]); diff --git a/src/views/system/Basis/index.vue b/src/views/system/Basis/index.vue index 4a2dde94..19b12fee 100644 --- a/src/views/system/Basis/index.vue +++ b/src/views/system/Basis/index.vue @@ -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({ formValue: { title: '', @@ -378,10 +380,10 @@ const form = reactive({ 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({ ]; 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)); diff --git a/src/views/user/Login/index.vue b/src/views/user/Login/index.vue index 4e563dc3..b98d58a3 100644 --- a/src/views/user/Login/index.vue +++ b/src/views/user/Login/index.vue @@ -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) => {