update:页面缓存方法
This commit is contained in:
@@ -229,6 +229,7 @@ import { cloneDeep, isString } from 'lodash-es';
|
||||
import { CommonStore } from '@/stores/common';
|
||||
import { setTableColumnSize, userTableHeadData } from '@/utils/common';
|
||||
import dayjs from 'dayjs';
|
||||
import { getPageStorage, setPageStorage } from '@/utils/common';
|
||||
|
||||
const commonStore = CommonStore();
|
||||
const allDictData = ref(commonStore.dictData);
|
||||
@@ -304,6 +305,10 @@ const props = withDefaults(defineProps<Props>(), {
|
||||
data: [],
|
||||
});
|
||||
|
||||
if (props.viewType !== getPageStorage('viewType')) {
|
||||
emit('update:viewType', getPageStorage('viewType'));
|
||||
}
|
||||
|
||||
const tableData = ref<any>([]);
|
||||
const tableHead = ref<TableHead[]>([]);
|
||||
const tableHeadVisible = ref<TableHead[]>([]);
|
||||
@@ -585,6 +590,7 @@ const changeFun = (data: any) => {
|
||||
};
|
||||
// 视图切换
|
||||
const viewTypeChangeFun = (type: string) => {
|
||||
setPageStorage('viewType', type);
|
||||
emit('update:viewType', type);
|
||||
};
|
||||
const setOptionsFun = (key: string, options: any[]) => {
|
||||
|
||||
@@ -50,11 +50,12 @@ import { useDict } from '@/utils/useDict';
|
||||
import { disposeMemberList } from '@/views/task/projectDetail/components/project';
|
||||
import { getTagMapList } from '@/utils/task';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { getPageStorage, setPageStorage } from '@/utils/common';
|
||||
|
||||
const { t } = useI18n();
|
||||
const { TASK_PROGRESS_STATUS } = useDict('TASK_PROGRESS_STATUS');
|
||||
|
||||
const activeTab = ref('confirmed');
|
||||
const activeTab = ref(getPageStorage('activeTab') || 'confirmed');
|
||||
const tableRef = ref();
|
||||
const editVisible = ref(false);
|
||||
const editRowInfo = ref<any>({});
|
||||
@@ -89,7 +90,8 @@ const tableParams = computed(() => {
|
||||
});
|
||||
|
||||
// Tab切换事件
|
||||
const tabChangeFun = () => {
|
||||
const tabChangeFun = (val: any) => {
|
||||
setPageStorage('activeTab', val);
|
||||
nextTick(() => {
|
||||
tableRef.value?.resetFun();
|
||||
});
|
||||
|
||||
@@ -170,3 +170,23 @@ export const resListFormat = (res: any) => {
|
||||
});
|
||||
return res;
|
||||
};
|
||||
|
||||
const pageStorageData: any = JSON.parse(localStorage.getItem('PAGE_STORAGE_DATA') || '{}');
|
||||
// 设置页面本地存储
|
||||
export const setPageStorage = (key: string, val: any) => {
|
||||
const path = window.location.pathname;
|
||||
if (!pageStorageData[path]) {
|
||||
pageStorageData[path] = {};
|
||||
}
|
||||
pageStorageData[path][key] = val;
|
||||
localStorage.setItem('PAGE_STORAGE_DATA', JSON.stringify(pageStorageData));
|
||||
};
|
||||
// 获取页面本地存储
|
||||
export const getPageStorage = (key: string) => {
|
||||
const path = window.location.pathname;
|
||||
if (pageStorageData[path]) {
|
||||
return pageStorageData[path][key] || '';
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
};
|
||||
|
||||
@@ -315,6 +315,7 @@ import { downloadFileById } from '@/utils/file';
|
||||
import { exportToPdf } from '@/utils/exportPdf';
|
||||
import dayjs from 'dayjs';
|
||||
import { CommonStore } from '@/stores/common';
|
||||
import { getPageStorage, setPageStorage } from '@/utils/common';
|
||||
|
||||
const commonStore = CommonStore();
|
||||
|
||||
@@ -515,11 +516,12 @@ const actionList = ref<any>([
|
||||
|
||||
const compareList = ref<any[]>([]);
|
||||
const modeChangeFun = () => {
|
||||
setPageStorage('currentModel', currentModel.value);
|
||||
tableRef.value?.setSearchParamsFun({});
|
||||
compareList.value = [];
|
||||
};
|
||||
|
||||
const currentModel = ref('仿真任务');
|
||||
const currentModel = ref(getPageStorage('currentModel') || '仿真任务');
|
||||
modeChangeFun();
|
||||
|
||||
const projectOptions = ref<any[]>([]);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<div class="gl-page-content-grey-full">
|
||||
<div class="content">
|
||||
<div class="page-title">
|
||||
<el-tabs v-model="currentTab" type="card">
|
||||
<el-tabs v-model="currentTab" type="card" @tab-change="tabChangeFun">
|
||||
<el-tab-pane :label="$t('系统管理.存储统计')" name="Storage statistics" />
|
||||
<el-tab-pane :label="$t('系统管理.存储设置')" name="Storage Settings" />
|
||||
<el-tab-pane :label="$t('系统管理.文件管理')" name="Document Management" />
|
||||
@@ -22,9 +22,10 @@ import { ref, computed } from 'vue';
|
||||
import storageStatistics from './components/storageStatistics/index.vue';
|
||||
import storageSettings from './components/storageSettings/index.vue';
|
||||
import documentManagement from './components/documentManagement/index.vue';
|
||||
import { getPageStorage, setPageStorage } from '@/utils/common';
|
||||
|
||||
type TabType = 'Storage statistics' | 'Storage Settings' | 'Document Management';
|
||||
const currentTab = ref<TabType>('Storage statistics');
|
||||
const currentTab = ref<TabType>(getPageStorage('currentTab') || 'Storage statistics');
|
||||
|
||||
const componentsMap = {
|
||||
'Storage statistics': storageStatistics,
|
||||
@@ -32,6 +33,10 @@ const componentsMap = {
|
||||
'Document Management': documentManagement,
|
||||
};
|
||||
const currentComponent = computed(() => componentsMap[currentTab.value]);
|
||||
|
||||
const tabChangeFun = (val: any) => {
|
||||
setPageStorage('currentTab', val);
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<div class="gl-page-content-full">
|
||||
<div class="content">
|
||||
<div class="tabs">
|
||||
<el-tabs v-model="flowType" type="card">
|
||||
<el-tabs v-model="flowType" type="card" @tab-change="tabChangeFun">
|
||||
<el-tab-pane label="公共模板" name="1" />
|
||||
<el-tab-pane label="个人模板" name="2" />
|
||||
</el-tabs>
|
||||
@@ -215,6 +215,7 @@ import { getApproveStyleClass } from '@/components/common/statusDot/statusMap';
|
||||
import PoolTaskSelect from '@/components/pool/poolTaskSelect.vue';
|
||||
import { hasPermission } from '@/utils/permission';
|
||||
import { jumpPage } from '@/utils/common';
|
||||
import { getPageStorage, setPageStorage } from '@/utils/common';
|
||||
|
||||
defineProps({
|
||||
apiParams: {
|
||||
@@ -235,7 +236,7 @@ const dialogType = ref<FLOW_OPERATION_TYPE>(FLOW_OPERATION_TYPE.CREATE); // crea
|
||||
const viewType = ref('car');
|
||||
const addDiaRef = ref();
|
||||
const templateVersion = ref('');
|
||||
const flowType = ref<string>(FLOW_TEMPLATE_PUBLIC_STATUS.PUBLIC);
|
||||
const flowType = ref<string>(getPageStorage('flowType') || FLOW_TEMPLATE_PUBLIC_STATUS.PUBLIC);
|
||||
|
||||
const actionList = ref<any>([
|
||||
{
|
||||
@@ -507,6 +508,10 @@ const upgradeFlowFun = (flow: any) => {
|
||||
addDiaRef.value.setEditForm({ ...flow });
|
||||
templateVersion.value = flow.templateVersion;
|
||||
};
|
||||
|
||||
const tabChangeFun = (val: any) => {
|
||||
setPageStorage('flowType', val);
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<div class="gl-page-content-full" v-if="!showFlowDetailVisible">
|
||||
<div class="content">
|
||||
<div class="tabs">
|
||||
<el-tabs v-model="flowType" type="card">
|
||||
<el-tabs v-model="flowType" type="card" @tab-change="tabChangeFun">
|
||||
<el-tab-pane label="公共模板" :name="REPORT_TEMPLATE_PUBLIC_STATUS.PUBLIC" />
|
||||
<el-tab-pane label="个人模板" :name="REPORT_TEMPLATE_PUBLIC_STATUS.PRIVATE" />
|
||||
</el-tabs>
|
||||
@@ -207,6 +207,7 @@ import PoolTaskSelect from '@/components/pool/poolTaskSelect.vue';
|
||||
import { deleteReportTemplateApi, queryReportTemplateApi } from '@/api/capability/report';
|
||||
import { REPORT_OPERATION_TYPE, REPORT_TEMPLATE_PUBLIC_STATUS } from '@/utils/enum/report';
|
||||
import ReportCreate from './components/reportCreate.vue';
|
||||
import { getPageStorage, setPageStorage } from '@/utils/common';
|
||||
|
||||
defineProps({
|
||||
apiParams: {
|
||||
@@ -228,7 +229,7 @@ const dialogType = ref<REPORT_OPERATION_TYPE>(REPORT_OPERATION_TYPE.CREATE); //
|
||||
const viewType = ref('list');
|
||||
const addDiaRef = ref();
|
||||
const templateVersion = ref('');
|
||||
const flowType = ref<string>(REPORT_TEMPLATE_PUBLIC_STATUS.PUBLIC);
|
||||
const flowType = ref<string>(getPageStorage('flowType') || REPORT_TEMPLATE_PUBLIC_STATUS.PUBLIC);
|
||||
|
||||
const actionList = ref<any>([
|
||||
{
|
||||
@@ -493,6 +494,10 @@ const upgradeFlowFun = (flow: any) => {
|
||||
addDiaRef.value.setEditForm({ ...flow });
|
||||
templateVersion.value = flow.templateVersion;
|
||||
};
|
||||
|
||||
const tabChangeFun = (val: any) => {
|
||||
setPageStorage('flowType', val);
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
||||
@@ -34,6 +34,7 @@ import DepartMent from './components/departMent.vue';
|
||||
import Review from './components/review.vue';
|
||||
import roleDiscipline from './components/roleDiscipline.vue';
|
||||
import { ref } from 'vue';
|
||||
import { getPageStorage, setPageStorage } from '@/utils/common';
|
||||
|
||||
const configList = [
|
||||
{
|
||||
@@ -55,10 +56,11 @@ const configList = [
|
||||
];
|
||||
|
||||
// 当前选中的索引(默认选中第一个)
|
||||
const currentActive = ref('department');
|
||||
const currentActive = ref(getPageStorage('currentActive') || 'department');
|
||||
|
||||
// 点击菜单切换选中状态
|
||||
const handleMenuClick = (departValue: string) => {
|
||||
setPageStorage('currentActive', departValue);
|
||||
currentActive.value = departValue;
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div class="gl-page-content-grey log-page">
|
||||
<div class="tabs">
|
||||
<el-tabs v-model="showType" type="card">
|
||||
<el-tabs v-model="showType" type="card" @tab-change="tabChangeFun">
|
||||
<el-tab-pane :label="$t('系统管理.日志列表')" name="1" />
|
||||
<el-tab-pane :label="$t('系统管理.日志统计')" name="2" />
|
||||
</el-tabs>
|
||||
@@ -34,13 +34,18 @@ import { ref } from 'vue';
|
||||
import BaseTable from '@/components/common/table/baseTable.vue';
|
||||
import LineChart from './components/lineChart.vue';
|
||||
import { pageApi } from '@/api/system/systemLog';
|
||||
import { getPageStorage, setPageStorage } from '@/utils/common';
|
||||
|
||||
const showType = ref('1');
|
||||
const showType = ref(getPageStorage('showType') || '1');
|
||||
const actionList = ref([]);
|
||||
|
||||
const disabledDateFun = (time: Date) => {
|
||||
return time.getTime() > Date.now();
|
||||
};
|
||||
|
||||
const tabChangeFun = (val: any) => {
|
||||
setPageStorage('showType', val);
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@@ -77,6 +77,7 @@ import { permissionGroups } from '@/utils/enum/permission';
|
||||
import { assignPermissionsApi, getRolePermissionsApi } from '@/api/system/role';
|
||||
import { getUserPermissionsFun } from '@/utils/common';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import { getPageStorage, setPageStorage } from '@/utils/common';
|
||||
|
||||
// 获取全量的按钮权限列表
|
||||
const allPermissions = ref<any[]>([]);
|
||||
@@ -96,7 +97,9 @@ const getRoleList = async () => {
|
||||
const { data } = await roleListRolesApi(params);
|
||||
roleList.value = data.data.filter((item: any) => item.roleCode !== 'ROLE_ADMIN');
|
||||
adminRoleId.value = data.data.find((item: any) => item.roleCode === 'ROLE_ADMIN').roleId;
|
||||
activeRole.value = roleList.value[0];
|
||||
activeRole.value =
|
||||
(getPageStorage('activeRole') ? JSON.parse(getPageStorage('activeRole')) : '') ||
|
||||
roleList.value[0];
|
||||
getRolePermissionsFun();
|
||||
};
|
||||
const activeRole = ref<any>({});
|
||||
@@ -105,6 +108,7 @@ const selectRoleFun = (item: any) => {
|
||||
activeRole.value = item;
|
||||
chosenData.value = [];
|
||||
getRolePermissionsFun();
|
||||
setPageStorage('activeRole', JSON.stringify(activeRole.value));
|
||||
};
|
||||
const getRolePermissionsFun = () => {
|
||||
const params = {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<div class="gl-page-content-full">
|
||||
<div class="content">
|
||||
<div class="tabs">
|
||||
<el-tabs v-model="activeTab" type="card">
|
||||
<el-tabs v-model="activeTab" type="card" @tab-change="tabChangeFun">
|
||||
<el-tab-pane
|
||||
v-for="tab in tabConfigs"
|
||||
:key="tab.name"
|
||||
@@ -27,6 +27,7 @@ import SummaryDashboard from './components/summaryDashboard.vue';
|
||||
import dataStatistics from './components/dataStatistics.vue';
|
||||
import workLoad from '@/views/task/workLoad/index.vue';
|
||||
import workerLoad from '@/views/task/workerLoad/index.vue';
|
||||
import { getPageStorage, setPageStorage } from '@/utils/common';
|
||||
|
||||
// 看板tab
|
||||
const tabConfigs = [
|
||||
@@ -61,7 +62,11 @@ const currentComponent = computed(() => {
|
||||
const tab = tabConfigs.find((item) => item.name === activeTab.value);
|
||||
return tab?.component;
|
||||
});
|
||||
const activeTab = ref('dataStatistics');
|
||||
const activeTab = ref(getPageStorage('activeTab') || 'dataStatistics');
|
||||
|
||||
const tabChangeFun = (val: any) => {
|
||||
setPageStorage('activeTab', val);
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@@ -96,10 +96,9 @@
|
||||
:stroke-width="8"
|
||||
:percentage="
|
||||
row.taskTotalCount > 0
|
||||
? (
|
||||
((row.taskCompletedCount + row.taskClosedLoopCount) / row.taskTotalCount) *
|
||||
100
|
||||
).toFixed(0)
|
||||
? Math.floor(
|
||||
((row.taskCompletedCount + row.taskClosedLoopCount) / row.taskTotalCount) * 100
|
||||
)
|
||||
: 0
|
||||
"
|
||||
/>
|
||||
|
||||
@@ -95,6 +95,7 @@ import taskDetail from '@/views/task/projectDetail/components/taskDetail.vue';
|
||||
import { enableConfigByTenant, TENANT_ENUM } from '@/tenants/tenant';
|
||||
import SendTask from './sendTask.vue';
|
||||
import { changeTaskStatusCommon, syncDemandList } from '../taskPage';
|
||||
import { getPageStorage, setPageStorage } from '@/utils/common';
|
||||
|
||||
const props = defineProps({
|
||||
actionList: {
|
||||
@@ -122,9 +123,10 @@ const formAttrs = ref({
|
||||
},
|
||||
});
|
||||
|
||||
const isSend = ref(false);
|
||||
const isSend = ref(getPageStorage('isSend') || false);
|
||||
|
||||
const tabChangeFun = () => {
|
||||
const tabChangeFun = (val: any) => {
|
||||
setPageStorage('isSend', val);
|
||||
nextTick(() => {
|
||||
exeTableRef.value.initTaskCount();
|
||||
});
|
||||
|
||||
@@ -234,6 +234,7 @@ import PlanningInformation from '@/tenants/lyric/views/task/components/planningI
|
||||
import { FILE_TYPE } from '@/utils/enum/file';
|
||||
import { jumpPage } from '@/utils/common';
|
||||
import dayjs from 'dayjs';
|
||||
import { getPageStorage, setPageStorage } from '@/utils/common';
|
||||
// import emitter from '@/utils/eventBus';
|
||||
|
||||
// const env = import.meta.env;
|
||||
@@ -657,7 +658,7 @@ const formHideKeys = ref<any[]>([]);
|
||||
const currentProjectUndertaker = ref('');
|
||||
|
||||
const simulationTypeList = ref(commonStore.getDictData('SIMULATION_TYPE').A);
|
||||
const simulationType = ref(simulationTypeList.value[0].value);
|
||||
const simulationType = ref(getPageStorage('simulationType') || simulationTypeList.value[0].value);
|
||||
|
||||
const attachmentRemark = ref('');
|
||||
const endTimeRemark = ref('【需求时间】请参考发图时间或客户评审时间');
|
||||
@@ -683,6 +684,7 @@ watch(
|
||||
);
|
||||
const demandFormName = ref('SIMULATION_TASK_DEMAND_CREATE');
|
||||
const changeSimulationType = (val: string) => {
|
||||
setPageStorage('simulationType', val);
|
||||
if (simulationType.value === '工业设计') {
|
||||
demandFormName.value = 'SIMULATION_TASK_DEMAND_INDUSTRIAL_CREATE';
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user