diff --git a/src/components/echarts/MyEchart.vue b/src/components/echarts/MyEchart.vue index 5d21441..238bf02 100644 --- a/src/components/echarts/MyEchart.vue +++ b/src/components/echarts/MyEchart.vue @@ -191,7 +191,9 @@ const handlerYAxis = () => { color: '#000', fontSize: 14, formatter: function (value) { - return parseFloat(value.toFixed(1)) // 格式化显示为一位小数 + // 分类轴为字符串,数值轴才做小数格式化 + if (typeof value !== 'number' || Number.isNaN(value)) return value + return parseFloat(value.toFixed(1)) } }, splitLine: { diff --git a/src/components/table/column/index.vue b/src/components/table/column/index.vue index a241d6a..b57064a 100644 --- a/src/components/table/column/index.vue +++ b/src/components/table/column/index.vue @@ -1,23 +1,41 @@ - + diff --git a/src/components/table/defaultAttribute.ts b/src/components/table/defaultAttribute.ts index a1d30a9..3df623d 100644 --- a/src/components/table/defaultAttribute.ts +++ b/src/components/table/defaultAttribute.ts @@ -10,7 +10,8 @@ export const defaultAttribute: VxeTableProps = { rowConfig: { isCurrent: true, isHover: true }, scrollX: { scrollToLeftOnChange: true }, scrollY: { scrollToTopOnChange: true, enabled: true, gt: 100 }, - customConfig: { enabled: true, allowFixed: false, showFooter: false, immediate: true ,mode:'default'}, + customConfig: { enabled: true, allowFixed: true, storage: false, showFooter: false, immediate: true, mode: 'default' }, + showOverflow: 'tooltip', showHeaderOverflow: false } diff --git a/src/components/table/header/index.vue b/src/components/table/header/index.vue index 1486903..1dc3ed0 100644 --- a/src/components/table/header/index.vue +++ b/src/components/table/header/index.vue @@ -417,6 +417,7 @@ html.dark { #header-form-second { :deep(.el-select) { --el-select-width: 220px; + width: 200px; } :deep(.el-input) { diff --git a/src/components/table/index.vue b/src/components/table/index.vue index 03d3352..31b38dd 100644 --- a/src/components/table/index.vue +++ b/src/components/table/index.vue @@ -3,10 +3,12 @@
列设置
+ - + @@ -102,10 +104,22 @@ const props = withDefaults(defineProps(), { const attrs = useAttrs() const tableBindProps = computed(() => { const overflow = props.showOverflow ?? defaultAttribute.showOverflow - return Object.assign({}, defaultAttribute, attrs, { + const bindProps: Record = Object.assign({}, defaultAttribute, attrs, { showOverflow: overflow, showHeaderOverflow: false }) + if (props.showCustomColumn) { + bindProps.customConfig = { + ...(bindProps.customConfig || {}), + enabled: true, + allowFixed: true, + storage: true, + showFooter: false, + immediate: true, + mode: 'default' + } + } + return bindProps }) const openCustomColumn = () => { if (!tableRef.value) return @@ -188,6 +202,17 @@ const getTableExportFilename = () => { '导出' return buildExportBaseName({ feature }) } +const getTableId = () => { + const exportName = tableStore.exportName + if (exportName && typeof exportName === 'object') { + return exportName + } + const feature = + exportName || + (document.querySelectorAll('.ba-nav-tab.active')[0] as HTMLElement | undefined)?.textContent || + '导出' + return feature +} watch( () => tableStore.table.allFlag, diff --git a/src/layouts/admin/components/navMenus.vue b/src/layouts/admin/components/navMenus.vue index 1ea26ab..6f53195 100644 --- a/src/layouts/admin/components/navMenus.vue +++ b/src/layouts/admin/components/navMenus.vue @@ -48,7 +48,7 @@ size="18" /> --> - " + @@ -71,6 +71,7 @@ import html2canvas from 'html2canvas' import PopupPwd from './popup/password.vue' import AdminInfo from './popup/adminInfo.vue' import { useNavTabs } from '@/stores/navTabs' +import { Local } from '@/utils/storage' const adminInfo = useAdminInfo() const navTabs = useNavTabs() @@ -117,7 +118,7 @@ const handleCommand = async (key: string) => { break case 'layout': navTabs.closeTabs() - window.localStorage.clear() + Local.clear() adminInfo.reset() setTimeout(() => { window.location.reload() diff --git a/src/layouts/admin/components/popup/password.vue b/src/layouts/admin/components/popup/password.vue index b4ab20d..2e9f05e 100644 --- a/src/layouts/admin/components/popup/password.vue +++ b/src/layouts/admin/components/popup/password.vue @@ -33,6 +33,7 @@ import { validatePwd } from '@/utils/common' import { useAdminInfo } from '@/stores/adminInfo' import router from '@/router' import { useNavTabs } from '@/stores/navTabs' +import { Local } from '@/utils/storage' const adminInfo = useAdminInfo() const navTabs = useNavTabs() const dialogVisible = ref(false) @@ -109,7 +110,7 @@ const submit = () => { setTimeout(() => { navTabs.closeTabs() - window.localStorage.clear() + Local.clear() adminInfo.reset() router.push({ name: 'login' }) }, 0) diff --git a/src/utils/request.ts b/src/utils/request.ts index 23c560c..df13a90 100644 --- a/src/utils/request.ts +++ b/src/utils/request.ts @@ -5,6 +5,7 @@ import { refreshToken } from '@/api/user-boot/user' import router from '@/router/index' import { useAdminInfo } from '@/stores/adminInfo' import { useNavTabs } from '@/stores/navTabs' +import { Local } from '@/utils/storage' window.requests = [] window.tokenRefreshing = false let loginExpireTimer: any = null @@ -171,7 +172,7 @@ function createAxios>( }) adminInfo.removeToken() navTabs.closeTabs() - window.localStorage.clear() + Local.clear() adminInfo.reset() router.push({ name: 'login' }) loginExpireTimer = null // 执行后清空定时器 diff --git a/src/utils/storage.ts b/src/utils/storage.ts index 9b52e35..24bd4b5 100644 --- a/src/utils/storage.ts +++ b/src/utils/storage.ts @@ -3,8 +3,13 @@ * @method set 设置 * @method get 获取 * @method remove 移除 - * @method clear 移除全部 + * @method clear 移除全部(保留表格列配置、Pinia DevTools 设置) */ +const LOCAL_STORAGE_PRESERVE_KEYS = [ + 'VXE_CUSTOM_STORE', + '__VUE_DEVTOOLS_NEXT_PLUGIN_SETTINGS__dev.esm.pinia__' +] + export const Local = { set(key: string, val: any) { window.localStorage.setItem(key, JSON.stringify(val)) @@ -17,7 +22,15 @@ export const Local = { window.localStorage.removeItem(key) }, clear() { + const preserved: Record = {} + for (const key of LOCAL_STORAGE_PRESERVE_KEYS) { + const value = window.localStorage.getItem(key) + if (value !== null) preserved[key] = value + } window.localStorage.clear() + for (const [key, value] of Object.entries(preserved)) { + window.localStorage.setItem(key, value) + } }, } diff --git a/src/views/auth/menu/menu.vue b/src/views/auth/menu/menu.vue index 8466bde..1e8b24f 100644 --- a/src/views/auth/menu/menu.vue +++ b/src/views/auth/menu/menu.vue @@ -2,11 +2,24 @@
菜单列表
- + 新增
- +
@@ -50,7 +63,8 @@ const tableStore = new TableStore({ render: 'icon' }, { - title: '操作', fixed: 'right', + title: '操作', + fixed: 'right', align: 'center', width: '180', render: 'buttons', @@ -89,7 +103,7 @@ const tableStore = new TableStore({ }, click: row => { delMenu(row.id).then(() => { - ElMessage.success('删除成功!') + ElMessage.success('删除成功!') emits('init') }) diff --git a/src/views/govern/alarm/Device.vue b/src/views/govern/alarm/Device.vue index 113dae7..41760f6 100644 --- a/src/views/govern/alarm/Device.vue +++ b/src/views/govern/alarm/Device.vue @@ -17,11 +17,11 @@ style="width: 100%" > - + - \ No newline at end of file + diff --git a/src/views/govern/device/control/index.vue b/src/views/govern/device/control/index.vue index 8631172..8b202c7 100644 --- a/src/views/govern/device/control/index.vue +++ b/src/views/govern/device/control/index.vue @@ -164,7 +164,7 @@ + style="width: 200px !important">