Merge branch 'dev' of github.com:jetlinks/jetlinks-ui-vue into dev

This commit is contained in:
100011797 2023-06-12 10:25:52 +08:00
commit 299f624658
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 getProviders = () => server.get(`/gateway/device/providers`);
export const queryOptionsList = (type: strimg) => export const queryOptionsList = (type: string) =>
server.get(`/data-collect/opc/${type}`); server.get(`/data-collect/opc/${type}`);
export const validateField = (data: any) => 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 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 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 { defineStore } from 'pinia';
import { systemVersion } from '@/api/comm' import { systemVersion } from '@/api/comm'
import { useMenuStore } from './menu' 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 type { ConfigInfoType } from '@/views/system/Basis/typing';
import { LocalStore } from '@/utils/comm' import { LocalStore } from '@/utils/comm'
import { SystemConst } from '@/utils/consts' 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() { async getSystemConfig() {
const params = ['front', 'amap', 'paths']; const params = ['front', 'amap', 'paths'];
const { status, result } = await getDetails_api(params); const { status, result } = await getDetails_api(params);
if (status === 200) { if (status === 200) {
params.forEach((key: string) => { params.forEach((key: string) => {
this.configInfo[key] = { ...result.find((item: any) => item.scope === key)?.properties } 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', children: 'children',
}" }"
:filterTreeNode=" :filterTreeNode="
(v, option) => filterSelectNode(v, option) (v, option) => filterSelectNode(v, option, 'name')
" "
> >
<template> </template> <template> </template>
@ -164,13 +164,13 @@ const deviceList = ref([
label: '网关子设备', label: '网关子设备',
value: 'childrenDevice', value: 'childrenDevice',
iconUrl: getImage('/device-type-2.png'), iconUrl: getImage('/device-type-2.png'),
tooltip: '能挂载子设备与平台进行通信的设备', tooltip: '作为网关的子设备,有网关代理连接到物联网平台',
}, },
{ {
label: '网关设备', label: '网关设备',
value: 'gateway', value: 'gateway',
iconUrl: getImage('/device/device-type-3.png'), 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 action = `${BASE_API_PATH}/file/static`;
const headers = { [TOKEN_KEY]: LocalStore.get(TOKEN_KEY) }; const headers = { [TOKEN_KEY]: LocalStore.get(TOKEN_KEY) };
const formRef = ref(); const formRef = ref();
const system = useSystem();
const form = reactive<formType>({ const form = reactive<formType>({
formValue: { formValue: {
title: '', title: '',
@ -378,10 +380,10 @@ const form = reactive<formType>({
iconLoading: false, // iconLoading: false, //
saveLoading: false, saveLoading: false,
getDetails: async () => { getDetails: async () => {
const system = useSystem();
await system.getSystemConfig(); // await system.getSystemConfig();
await settingDetail('front'); // await settingDetail('front');
const configInfo = system.$state.configInfo; const configInfo = system.configInfo;
form.formValue = { form.formValue = {
title: configInfo.front?.title, title: configInfo.front?.title,
headerTheme: configInfo.front?.headerTheme, headerTheme: configInfo.front?.headerTheme,
@ -422,10 +424,11 @@ const form = reactive<formType>({
]; ];
save_api(params) save_api(params)
.then((resp) => { .then(async (resp) => {
if (resp.status === 200) { if (resp.status === 200) {
message.success('保存成功'); message.success('保存成功');
form.getDetails(); await system.getSystemConfig()
await form.getDetails();
} }
}) })
.finally(() => (form.saveLoading = false)); .finally(() => (form.saveLoading = false));

View File

@ -172,11 +172,13 @@ import {
settingDetail, userDetail settingDetail, userDetail
} from '@/api/login' } from '@/api/login'
import { useUserInfo } from '@/store/userInfo'; import { useUserInfo } from '@/store/userInfo';
import { useSystem } from '@/store/system'
import { LocalStore } from '@/utils/comm'; import { LocalStore } from '@/utils/comm';
import { BASE_API_PATH, TOKEN_KEY, Version_Code } from '@/utils/variable'; import { BASE_API_PATH, TOKEN_KEY, Version_Code } from '@/utils/variable';
import { SystemConst } from '@/utils/consts'; import { SystemConst } from '@/utils/consts';
const store = useUserInfo(); const store = useUserInfo();
const systemStore = useSystem();
const router = useRouter(); const router = useRouter();
const bgImage = getImage('/logo.png'); const bgImage = getImage('/logo.png');
const viewLogo = getImage('/view-logo.png'); const viewLogo = getImage('/view-logo.png');
@ -310,18 +312,7 @@ const getOpen = () => {
} }
} }
}); });
settingDetail('front').then((res: any) => { systemStore.getFront()
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 = '';
}
}
});
}; };
const handleClickOther = (item: any) => { const handleClickOther = (item: any) => {