Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eab882f92c | ||
|
|
04450fff88 | ||
|
|
82c21262ed |
No files matched your search
@@ -0,0 +1,46 @@
|
||||
/**
|
||||
* 顶栏侧栏收起按钮必须始终可见:
|
||||
* - persist afterRestore 强制 ensureMenuButtonVisible(禁止 toggle)
|
||||
* - AppLayout 挂载时再次兜底
|
||||
* - 设置面板不再提供可关闭开关
|
||||
*/
|
||||
import test from 'node:test'
|
||||
import assert from 'node:assert/strict'
|
||||
import { readFileSync } from 'node:fs'
|
||||
import { dirname, join } from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
|
||||
const root = join(dirname(fileURLToPath(import.meta.url)), '..')
|
||||
|
||||
test('setting store forces menu button visible on restore', () => {
|
||||
const src = readFileSync(join(root, 'src/store/modules/setting.ts'), 'utf8')
|
||||
assert.match(src, /ensureMenuButtonVisible\s*=\s*\(\)\s*=>\s*\{[\s\S]*?showMenuButton\.value\s*=\s*true/)
|
||||
assert.match(src, /afterRestore:\s*\(ctx\)\s*=>\s*\{[\s\S]*?ensureMenuButtonVisible\(\)/)
|
||||
assert.doesNotMatch(
|
||||
src,
|
||||
/afterRestore:[\s\S]*?if\s*\(\s*!ctx\.store\.showMenuButton\s*\)[\s\S]*?setButton\(\)/,
|
||||
'afterRestore must not rely on setButton toggle'
|
||||
)
|
||||
assert.match(
|
||||
src,
|
||||
/const setButton = \(\) => \{\s*showMenuButton\.value = true/,
|
||||
'setButton must assign true, not toggle'
|
||||
)
|
||||
})
|
||||
|
||||
test('AppLayout mount ensures menu button visible', () => {
|
||||
const src = readFileSync(join(root, 'src/views/index/index.vue'), 'utf8')
|
||||
assert.match(src, /ensureMenuButtonVisible\(\)/)
|
||||
})
|
||||
|
||||
test('settings panel does not expose showMenuButton switch', () => {
|
||||
const src = readFileSync(
|
||||
join(root, 'src/components/core/layouts/art-settings-panel/composables/useSettingsConfig.ts'),
|
||||
'utf8'
|
||||
)
|
||||
assert.doesNotMatch(
|
||||
src,
|
||||
/key:\s*'showMenuButton'/,
|
||||
'settings UI must not allow turning off the fold control'
|
||||
)
|
||||
})
|
||||
@@ -12,18 +12,36 @@ import { parse } from '@vue/compiler-sfc'
|
||||
|
||||
const root = join(dirname(fileURLToPath(import.meta.url)), '..')
|
||||
|
||||
test('ArtSvgIcon: el-icon branch must not use Tailwind inline class', () => {
|
||||
test('ArtSvgIcon: icon roots must not use Tailwind inline class', () => {
|
||||
const src = readFileSync(join(root, 'src/components/core/base/art-svg-icon/index.vue'), 'utf8')
|
||||
const { descriptor } = parse(src)
|
||||
const template = descriptor.template?.content || ''
|
||||
assert.match(template, /<el-icon\b[^>]*class="[^"]*art-svg-icon/)
|
||||
assert.doesNotMatch(
|
||||
template,
|
||||
/<el-icon\b[^>]*class="[^"]*\binline\b/,
|
||||
'el-icon must not include Tailwind inline (breaks display:inline-flex in prod CSS order)'
|
||||
/<(?:el-icon|Icon)\b[^>]*class="[^"]*\binline\b/,
|
||||
'icon roots must not include Tailwind inline (breaks display in prod CSS order)'
|
||||
)
|
||||
})
|
||||
|
||||
test('header fold button uses inline SVG button (Chrome-safe)', () => {
|
||||
const src = readFileSync(
|
||||
join(root, 'src/components/core/layouts/art-header-bar/index.vue'),
|
||||
'utf8'
|
||||
)
|
||||
const { descriptor } = parse(src)
|
||||
const template = descriptor.template?.content || ''
|
||||
assert.match(template, /class="menu-fold-btn/)
|
||||
assert.match(template, /menu-fold-btn__icon/)
|
||||
assert.match(template, /<svg[\s\S]*viewBox="0 0 24 24"/)
|
||||
assert.doesNotMatch(
|
||||
template,
|
||||
/<ArtIconButton[\s\S]*menu-fold/,
|
||||
'fold control must not rely on ArtIconButton/iconify in Chrome'
|
||||
)
|
||||
assert.match(template, /<button[\s\S]*class="menu-fold-btn/)
|
||||
})
|
||||
|
||||
test('plan-archive: planNo is in column defs and table visibility gate', () => {
|
||||
const src = readFileSync(join(root, 'src/views/pl/plan-archive/index.vue'), 'utf8')
|
||||
assert.match(src, /prop:\s*'planNo',\s*label:\s*'计划编号'/)
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
/**
|
||||
* #41 回归:运输归档绿色合计行须与表头列一一对应。
|
||||
* planNo 可隐藏后,不得再无条件硬编码插入 planNo,否则按索引错位。
|
||||
*/
|
||||
import test from 'node:test'
|
||||
import assert from 'node:assert/strict'
|
||||
import { readFileSync } from 'node:fs'
|
||||
import { dirname, join } from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import { buildStatsRowColumns } from '../src/utils/list-column-stats.ts'
|
||||
|
||||
const root = join(dirname(fileURLToPath(import.meta.url)), '..')
|
||||
|
||||
const ARCHIVE_DEFS = [
|
||||
{ prop: 'planNo' },
|
||||
{ prop: 'planDate' },
|
||||
{ prop: 'planQty' },
|
||||
{ prop: 'actualQty' },
|
||||
{ prop: 'amount' }
|
||||
]
|
||||
|
||||
test('buildStatsRowColumns: hidden planNo must not leave a phantom stats cell', () => {
|
||||
const visible = new Set(['planDate', 'planQty', 'actualQty', 'amount'])
|
||||
const cols = buildStatsRowColumns({
|
||||
leadingSpacers: 2,
|
||||
optionalDefs: ARCHIVE_DEFS,
|
||||
isColumnVisible: (prop) => visible.has(prop),
|
||||
moneyProps: ['amount']
|
||||
})
|
||||
const props = cols.map((c) => c.prop || c.key)
|
||||
assert.deepEqual(props, [
|
||||
'__spacer_0',
|
||||
'__spacer_1',
|
||||
'planDate',
|
||||
'planQty',
|
||||
'actualQty',
|
||||
'amount'
|
||||
])
|
||||
assert.equal(cols.filter((c) => c.prop === 'planNo').length, 0)
|
||||
})
|
||||
|
||||
test('buildStatsRowColumns: visible planNo appears once after spacers', () => {
|
||||
const visible = new Set(['planNo', 'planDate', 'planQty'])
|
||||
const cols = buildStatsRowColumns({
|
||||
leadingSpacers: 2,
|
||||
optionalDefs: ARCHIVE_DEFS,
|
||||
isColumnVisible: (prop) => visible.has(prop)
|
||||
})
|
||||
const props = cols.map((c) => c.prop || c.key)
|
||||
assert.deepEqual(props, ['__spacer_0', '__spacer_1', 'planNo', 'planDate', 'planQty'])
|
||||
assert.equal(cols.filter((c) => c.prop === 'planNo').length, 1)
|
||||
})
|
||||
|
||||
test('plan-archive: stats row builds from visible columns without always-on planNo', () => {
|
||||
const src = readFileSync(join(root, 'src/views/pl/plan-archive/index.vue'), 'utf8')
|
||||
assert.match(
|
||||
src,
|
||||
/archiveStatsRowColumns[\s\S]*?buildStatsRowColumns\s*\(/,
|
||||
'archive stats columns should use buildStatsRowColumns so visibility stays in sync'
|
||||
)
|
||||
assert.doesNotMatch(
|
||||
src,
|
||||
/archiveStatsRowColumns[\s\S]*?key:\s*'__index'[\s\S]*?key:\s*'planNo'[\s\S]*?for\s*\(\s*const\s+def\s+of\s+listColumnDefs/,
|
||||
'must not hardcode planNo before looping listColumnDefs (causes off-by-one when hidden)'
|
||||
)
|
||||
})
|
||||
@@ -1,11 +1,11 @@
|
||||
<!-- 图标组件:支持 Element Plus 图标(无 : 前缀)与 Iconify 图标(含 : 前缀) -->
|
||||
<template>
|
||||
<!-- el-icon 勿加 Tailwind `inline`:生产 CSS 中 `.inline{display:inline}` 会覆盖
|
||||
`.el-icon{display:inline-flex}`,导致 Fold 等图标在打包后不可见 -->
|
||||
<!-- 勿给图标根节点加 Tailwind `inline`:生产 CSS 中 `.inline{display:inline}`
|
||||
会覆盖 flex/尺寸,部分 Chrome 下 Fold 等图标不可见 -->
|
||||
<el-icon v-if="epIcon" v-bind="iconAttrs" class="art-svg-icon">
|
||||
<component :is="epIcon" />
|
||||
</el-icon>
|
||||
<Icon v-else-if="icon" :icon="icon" v-bind="iconAttrs" class="art-svg-icon inline" />
|
||||
<Icon v-else-if="icon" :icon="icon" v-bind="iconAttrs" class="art-svg-icon" />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
|
||||
@@ -21,17 +21,31 @@
|
||||
@click="toHome"
|
||||
/>
|
||||
|
||||
<!-- 菜单按钮 -->
|
||||
<ArtIconButton
|
||||
<!-- 菜单按钮:内联 SVG,避开 Chrome 下 el-icon / Iconify 偶发不绘制 -->
|
||||
<button
|
||||
v-if="isLeftMenu && shouldShowMenuButton"
|
||||
icon="fold"
|
||||
class="ml-3 max-sm:ml-[7px] menu-fold-btn"
|
||||
type="button"
|
||||
class="menu-fold-btn"
|
||||
:class="{ 'is-menu-collapsed': !menuOpen }"
|
||||
:title="menuOpen ? '收起菜单' : '展开菜单'"
|
||||
:aria-label="menuOpen ? '收起菜单' : '展开菜单'"
|
||||
:aria-expanded="menuOpen"
|
||||
@click="visibleMenu"
|
||||
/>
|
||||
>
|
||||
<svg
|
||||
class="menu-fold-btn__icon"
|
||||
viewBox="0 0 24 24"
|
||||
width="20"
|
||||
height="20"
|
||||
aria-hidden="true"
|
||||
focusable="false"
|
||||
>
|
||||
<path
|
||||
fill="currentColor"
|
||||
d="M21 18v2H3v-2zm0-5v2h-9v-2zm0-5v2h-9V8zM3 3.5v10l5-5z"
|
||||
/>
|
||||
</svg>
|
||||
</button>
|
||||
|
||||
<!-- 刷新按钮 - 已隐藏 -->
|
||||
<ArtIconButton
|
||||
@@ -388,14 +402,49 @@
|
||||
}
|
||||
}
|
||||
|
||||
.menu-fold-btn :deep(.art-svg-icon) {
|
||||
transition: transform 0.3s ease;
|
||||
/* 顶栏折叠按钮:原生 button + 内联 SVG,保证 Chrome/Safari 一致可见 */
|
||||
.menu-fold-btn {
|
||||
box-sizing: border-box;
|
||||
display: inline-flex;
|
||||
flex-shrink: 0;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 34px;
|
||||
height: 34px;
|
||||
margin-left: 12px;
|
||||
padding: 0;
|
||||
color: #64748b;
|
||||
cursor: pointer;
|
||||
background: transparent;
|
||||
border: 0;
|
||||
border-radius: 8px;
|
||||
appearance: none;
|
||||
}
|
||||
|
||||
.menu-fold-btn.is-menu-collapsed :deep(.art-svg-icon) {
|
||||
@media (max-width: 640px) {
|
||||
.menu-fold-btn {
|
||||
margin-left: 7px;
|
||||
}
|
||||
}
|
||||
|
||||
.menu-fold-btn:hover {
|
||||
color: #1e293b;
|
||||
background: var(--mint-row-alt, #f1f5f9);
|
||||
}
|
||||
|
||||
.menu-fold-btn__icon {
|
||||
display: block;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
transition: transform 0.3s ease;
|
||||
/* 展开态默认旋转,与收起态对调 */
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
|
||||
.menu-fold-btn.is-menu-collapsed .menu-fold-btn__icon {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
|
||||
/* Hover animation classes */
|
||||
.refresh-btn:hover :deep(.art-svg-icon) {
|
||||
animation: rotate180 0.5s;
|
||||
|
||||
+1
-7
@@ -119,13 +119,7 @@ export function useSettingsConfig() {
|
||||
handler: 'uniqueOpened',
|
||||
headerBarKey: null // 不依赖headerBar配置
|
||||
},
|
||||
{
|
||||
key: 'showMenuButton',
|
||||
label: t('setting.basics.list.collapseSidebar'),
|
||||
type: 'switch' as const,
|
||||
handler: 'menuButton',
|
||||
headerBarKey: 'menuButton' as const
|
||||
},
|
||||
// showMenuButton 不提供开关:顶栏收起侧栏按钮为产品必显能力
|
||||
{
|
||||
key: 'showFastEnter',
|
||||
label: t('setting.basics.list.fastEnter'),
|
||||
|
||||
+1
-1
@@ -67,7 +67,7 @@ export function useSettingsHandlers() {
|
||||
uniqueOpened: createToggleHandler(() => settingStore.setUniqueOpened()),
|
||||
|
||||
// 显示菜单按钮
|
||||
menuButton: createToggleHandler(() => settingStore.setButton()),
|
||||
menuButton: createToggleHandler(() => settingStore.ensureMenuButtonVisible()),
|
||||
|
||||
// 显示快速入口
|
||||
fastEnter: createToggleHandler(() => settingStore.setFastEnter()),
|
||||
|
||||
@@ -185,9 +185,8 @@
|
||||
settingStore.setElementTheme(config.systemThemeColor)
|
||||
|
||||
// 界面显示(切换类方法)
|
||||
toggleIfDifferent(settingStore.showMenuButton, config.showMenuButton, () =>
|
||||
settingStore.setButton()
|
||||
)
|
||||
// 顶栏收起按钮为必显,导入配置时也强制打开
|
||||
settingStore.ensureMenuButtonVisible()
|
||||
toggleIfDifferent(settingStore.showFastEnter, config.showFastEnter, () =>
|
||||
settingStore.setFastEnter()
|
||||
)
|
||||
|
||||
@@ -227,10 +227,15 @@ export const useSettingStore = defineStore(
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换菜单按钮显示
|
||||
* 切换菜单按钮显示(产品要求顶栏始终可收起侧栏,禁止关闭)
|
||||
*/
|
||||
const setButton = () => {
|
||||
showMenuButton.value = !showMenuButton.value
|
||||
showMenuButton.value = true
|
||||
}
|
||||
|
||||
/** 强制显示顶栏侧栏收起按钮,修复旧 localStorage 中 false 残留 */
|
||||
const ensureMenuButtonVisible = () => {
|
||||
showMenuButton.value = true
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -423,6 +428,7 @@ export const useSettingStore = defineStore(
|
||||
setContainerWidth,
|
||||
setUniqueOpened,
|
||||
setButton,
|
||||
ensureMenuButtonVisible,
|
||||
setFastEnter,
|
||||
setAutoClose,
|
||||
setShowRefreshButton,
|
||||
@@ -458,10 +464,8 @@ export const useSettingStore = defineStore(
|
||||
} else if (width === 290) {
|
||||
ctx.store.setMenuOpenWidth(270)
|
||||
}
|
||||
// 旧本地配置把收起按钮关掉了;产品需要顶栏始终能收起侧栏
|
||||
if (!ctx.store.showMenuButton) {
|
||||
ctx.store.setButton()
|
||||
}
|
||||
// 旧本地配置(sys-v*-setting)可能残留 showMenuButton:false;必须赋值 true,禁止用 toggle
|
||||
ctx.store.ensureMenuButtonVisible()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,6 +75,8 @@
|
||||
if (!settingStore.showCrumbs) {
|
||||
settingStore.setCrumbs()
|
||||
}
|
||||
// 纠正版本化 localStorage 中 showMenuButton:false,保证折叠钮始终可见
|
||||
settingStore.ensureMenuButtonVisible()
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
@@ -970,7 +970,7 @@ import {
|
||||
overflowExportPlaceholder
|
||||
} from '@/utils/list-toolbar-overflow-items'
|
||||
import ListColumnStatsRow from '@/components/business/list-column-stats-row/index.vue'
|
||||
import type { StatsRowColumn } from '@/utils/list-column-stats'
|
||||
import { buildStatsRowColumns, type StatsRowColumn } from '@/utils/list-column-stats'
|
||||
import { useContractDetailDialog } from '@/composables/useContractDetailDialog'
|
||||
import { usePersistedListColumns } from '@/composables/usePersistedListColumns'
|
||||
import { useListTableViewportHeight } from '@/composables/useListTableViewportHeight'
|
||||
@@ -1287,22 +1287,15 @@ const {
|
||||
|
||||
const archiveStatsRowRef = ref<{ resync?: () => void } | null>(null)
|
||||
|
||||
const archiveStatsRowColumns = computed((): StatsRowColumn[] => {
|
||||
const cols: StatsRowColumn[] = [
|
||||
{ key: '__selection', interactive: false },
|
||||
{ key: '__index', interactive: false },
|
||||
{ key: 'planNo', interactive: true, prop: 'planNo' }
|
||||
]
|
||||
for (const def of listColumnDefs.value) {
|
||||
if (!isArchiveColumnVisible(def.prop)) continue
|
||||
cols.push({
|
||||
key: def.prop,
|
||||
interactive: true,
|
||||
prop: def.prop
|
||||
})
|
||||
}
|
||||
return cols
|
||||
})
|
||||
/** 与表头可见列一一对应:勾选/序号占位 + 可见业务列(含可隐藏的 planNo) */
|
||||
const archiveStatsRowColumns = computed((): StatsRowColumn[] =>
|
||||
buildStatsRowColumns({
|
||||
leadingSpacers: 2,
|
||||
optionalDefs: listColumnDefs.value,
|
||||
isColumnVisible: isArchiveColumnVisible,
|
||||
moneyProps: PRICE_COLUMN_PROPS
|
||||
})
|
||||
)
|
||||
|
||||
function getArchiveStatCellValue(row: PlPlanListDisplayRow, prop: string): unknown {
|
||||
const plan = row.plan
|
||||
|
||||
@@ -84,6 +84,7 @@ server {
|
||||
}
|
||||
|
||||
# MinIO(bucket=ruoyi);兼容旧链接,推荐逐步切到 res.shanxiachem.com
|
||||
# 必须 proxy_hide_header 上游 CORS,否则 MinIO 的 Origin 与 nginx 的 * 叠成非法双头
|
||||
location ^~ /ruoyi/ {
|
||||
proxy_pass http://127.0.0.1:9000;
|
||||
|
||||
@@ -96,8 +97,15 @@ server {
|
||||
proxy_send_timeout 60s;
|
||||
proxy_read_timeout 60s;
|
||||
|
||||
proxy_hide_header Access-Control-Allow-Origin;
|
||||
proxy_hide_header Access-Control-Allow-Methods;
|
||||
proxy_hide_header Access-Control-Allow-Headers;
|
||||
proxy_hide_header Access-Control-Expose-Headers;
|
||||
proxy_hide_header Access-Control-Allow-Credentials;
|
||||
|
||||
add_header Access-Control-Allow-Origin * always;
|
||||
add_header Access-Control-Allow-Methods 'GET, HEAD, OPTIONS' always;
|
||||
add_header Access-Control-Allow-Headers 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization' always;
|
||||
|
||||
if ($request_method = 'OPTIONS') {
|
||||
return 204;
|
||||
@@ -224,6 +232,7 @@ server {
|
||||
}
|
||||
}
|
||||
|
||||
# 必须 proxy_hide_header 上游 CORS,否则 MinIO 的 Origin 与 nginx 的 * 叠成非法双头
|
||||
location ^~ /ruoyi/ {
|
||||
proxy_pass http://127.0.0.1:9000;
|
||||
|
||||
@@ -236,8 +245,15 @@ server {
|
||||
proxy_send_timeout 60s;
|
||||
proxy_read_timeout 60s;
|
||||
|
||||
proxy_hide_header Access-Control-Allow-Origin;
|
||||
proxy_hide_header Access-Control-Allow-Methods;
|
||||
proxy_hide_header Access-Control-Allow-Headers;
|
||||
proxy_hide_header Access-Control-Expose-Headers;
|
||||
proxy_hide_header Access-Control-Allow-Credentials;
|
||||
|
||||
add_header Access-Control-Allow-Origin * always;
|
||||
add_header Access-Control-Allow-Methods 'GET, HEAD, OPTIONS' always;
|
||||
add_header Access-Control-Allow-Headers 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization' always;
|
||||
|
||||
if ($request_method = 'OPTIONS') {
|
||||
return 204;
|
||||
@@ -364,6 +380,7 @@ server {
|
||||
}
|
||||
}
|
||||
|
||||
# 必须 proxy_hide_header 上游 CORS,否则 MinIO 的 Origin 与 nginx 的 * 叠成非法双头
|
||||
location ^~ /ruoyi/ {
|
||||
proxy_pass http://127.0.0.1:9000;
|
||||
|
||||
@@ -376,8 +393,15 @@ server {
|
||||
proxy_send_timeout 60s;
|
||||
proxy_read_timeout 60s;
|
||||
|
||||
proxy_hide_header Access-Control-Allow-Origin;
|
||||
proxy_hide_header Access-Control-Allow-Methods;
|
||||
proxy_hide_header Access-Control-Allow-Headers;
|
||||
proxy_hide_header Access-Control-Expose-Headers;
|
||||
proxy_hide_header Access-Control-Allow-Credentials;
|
||||
|
||||
add_header Access-Control-Allow-Origin * always;
|
||||
add_header Access-Control-Allow-Methods 'GET, HEAD, OPTIONS' always;
|
||||
add_header Access-Control-Allow-Headers 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization' always;
|
||||
|
||||
if ($request_method = 'OPTIONS') {
|
||||
return 204;
|
||||
@@ -477,6 +501,7 @@ server {
|
||||
|
||||
add_header X-Content-Type-Options "nosniff" always;
|
||||
|
||||
# 必须 proxy_hide_header 上游 CORS,否则 MinIO 的 Origin 与 nginx 的 * 叠成非法双头
|
||||
location ^~ /ruoyi/ {
|
||||
proxy_pass http://127.0.0.1:9000;
|
||||
|
||||
@@ -489,6 +514,12 @@ server {
|
||||
proxy_send_timeout 60s;
|
||||
proxy_read_timeout 60s;
|
||||
|
||||
proxy_hide_header Access-Control-Allow-Origin;
|
||||
proxy_hide_header Access-Control-Allow-Methods;
|
||||
proxy_hide_header Access-Control-Allow-Headers;
|
||||
proxy_hide_header Access-Control-Expose-Headers;
|
||||
proxy_hide_header Access-Control-Allow-Credentials;
|
||||
|
||||
add_header Access-Control-Allow-Origin * always;
|
||||
add_header Access-Control-Allow-Methods 'GET, HEAD, OPTIONS' always;
|
||||
add_header Access-Control-Allow-Headers 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization' always;
|
||||
|
||||
Reference in new issue
Block a user