update: 首页代码优化
This commit is contained in:
parent
db3c66d3b7
commit
2f7a4f718b
|
@ -34,8 +34,11 @@ const props = defineProps({
|
|||
const { cardData, cardTitle } = toRefs(props);
|
||||
|
||||
const jumpPage = (item: bootConfig) => {
|
||||
if (item.auth === undefined || item.auth) _jumpPage(item.link, item.params);
|
||||
else message.warning('暂无权限,请联系管理员');
|
||||
if (item.auth === undefined || item.auth) {
|
||||
_jumpPage(item.link, item.params);
|
||||
} else {
|
||||
message.warning('暂无权限,请联系管理员');
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
|
|
|
@ -37,8 +37,11 @@ const { cardData, cardTitle } = toRefs(props);
|
|||
const { jumpPage: _jumpPage } = useMenuStore();
|
||||
|
||||
const jumpPage = (item: bootConfig) => {
|
||||
if (item.auth === undefined || item.auth) _jumpPage(item.link, item.params);
|
||||
else message.warning('暂无权限,请联系管理员');
|
||||
if (item.auth === undefined || item.auth) {
|
||||
_jumpPage(item.link, item.params);
|
||||
} else {
|
||||
message.warning('暂无权限,请联系管理员');
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<j-row :gutter="24">
|
||||
<j-col :span="12"><DeviceCountCard /></j-col>
|
||||
<j-col :span="12"><BasicCountCard /></j-col>
|
||||
<j-col :span="24" style="margin-top: 24px;">
|
||||
<j-col :span="24" style="margin-top: 24px">
|
||||
<PlatformPicCard image="/images/home/content1.svg" />
|
||||
</j-col>
|
||||
</j-row>
|
||||
|
@ -157,7 +157,7 @@ const deviceStepDetails: recommendList[] = [
|
|||
linkUrl: 'device/Instance',
|
||||
auth: devicePermission('import'),
|
||||
params: {
|
||||
type: 'import'
|
||||
type: 'import',
|
||||
},
|
||||
},
|
||||
];
|
||||
|
@ -227,17 +227,4 @@ const opsStepDetails: recommendList[] = [
|
|||
|
||||
const productDialogVisible = ref(false);
|
||||
const deviceDialogVisible = ref(false);
|
||||
|
||||
|
||||
|
||||
// 设备管理-产品---新增弹窗 {save:true}
|
||||
// 设备管理-产品-产品详情---设备接入标签页 {id: 'xxxx', tab:'xxx'}
|
||||
// 规则引擎-规则编排---新增弹窗 {save: true}
|
||||
|
||||
|
||||
// 设备管理-设备---新增弹窗
|
||||
// 设备管理-设备---导入弹窗
|
||||
// 设备管理-设备-设备详情---设备诊断标签页
|
||||
|
||||
// 运维管理-日志管理---系统日志标签页
|
||||
</script>
|
||||
|
|
|
@ -46,9 +46,6 @@ const opsBootConfig: bootConfig[] = [
|
|||
english: 'STEP3',
|
||||
label: '实时监控',
|
||||
link: 'link/DashBoard',
|
||||
params: {
|
||||
type: 'add',
|
||||
},
|
||||
},
|
||||
];
|
||||
const opsStepDetails: recommendList[] = [
|
||||
|
|
|
@ -38,7 +38,9 @@ const props = defineProps({
|
|||
|
||||
// 跳转页面
|
||||
const jumpPage = (row: recommendList) => {
|
||||
if (row.auth === false) return message.warning('暂无权限,请联系管理员');
|
||||
if (row.auth === false) {
|
||||
return message.warning('暂无权限,请联系管理员');
|
||||
}
|
||||
row.onClick ? row.onClick(row) : _jumpPage(row.linkUrl, row.params);
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -52,7 +52,9 @@ const props = defineProps<{
|
|||
|
||||
// 弹窗控制
|
||||
const confirm = () => {
|
||||
if (selectedKeys.value.length < 1) return message.warn('请选择设备');
|
||||
if (selectedKeys.value.length < 1) {
|
||||
return message.warn('请选择设备');
|
||||
}
|
||||
emits('confirm', selectedKeys.value[0]);
|
||||
emits('update:visible', false);
|
||||
};
|
||||
|
|
|
@ -46,8 +46,8 @@ const form = ref({
|
|||
|
||||
const productList = ref<[productItem] | []>([]);
|
||||
const getOptions = () => {
|
||||
getProductList_api().then((resp: any) => {
|
||||
productList.value = resp.result
|
||||
getProductList_api().then(({ result }: any) => {
|
||||
productList.value = result
|
||||
.filter((i: any) => !i?.accessId)
|
||||
.map((item: { name: any; id: any }) => ({
|
||||
label: item.name,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<page-container>
|
||||
<div class="iot-home-container" v-loading="loading">
|
||||
<div class="iot-home-container">
|
||||
<InitHome v-if="currentView === 'init'" @refresh="setCurrentView" />
|
||||
<DeviceHome v-else-if="currentView === 'device'" />
|
||||
<DevOpsHome v-else-if="currentView === 'ops'" />
|
||||
|
@ -54,25 +54,26 @@ import { getMe_api, getView_api } from '@/api/home';
|
|||
import { getAppInfo_api } from '@/api/system/apply';
|
||||
|
||||
const currentView = ref<string>('');
|
||||
const loading = ref<boolean>(true);
|
||||
const clientId = useUserInfo().$state.userInfos.id;
|
||||
const secureKey = ref<string>('');
|
||||
const showKey = ref(false);
|
||||
// 获取选择的视图
|
||||
const setCurrentView = () => {
|
||||
getView_api().then((resp: any) => {
|
||||
if (resp.status === 200) {
|
||||
if (resp.result) {
|
||||
if (resp.result.username === 'admin')
|
||||
currentView.value = 'comprehensive';
|
||||
else currentView.value = resp.result?.content;
|
||||
} else currentView.value = 'init';
|
||||
getView_api().then(({ status, result }: any) => {
|
||||
if (status === 200) {
|
||||
currentView.value = 'init';
|
||||
if (result) {
|
||||
currentView.value =
|
||||
result.username === 'admin'
|
||||
? 'comprehensive'
|
||||
: result?.content;
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
if (isNoCommunity) {
|
||||
// 判断是否是api用户 是则跳转 否则获取选中的视图
|
||||
// 判断是否是api用户 不是则获取选中的视图
|
||||
getMe_api().then((resp: any) => {
|
||||
if (resp && resp.status === 200) {
|
||||
const isApiUser = resp.result.dimensions.find(
|
||||
|
@ -85,10 +86,14 @@ if (isNoCommunity) {
|
|||
getAppInfo_api(clientId).then((resp: any) => {
|
||||
secureKey.value = resp.result.apiServer.secureKey;
|
||||
});
|
||||
} else setCurrentView();
|
||||
} else {
|
||||
setCurrentView();
|
||||
}
|
||||
}
|
||||
});
|
||||
} else setCurrentView();
|
||||
} else {
|
||||
setCurrentView();
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
|
|
Loading…
Reference in New Issue