diff --git a/klp-ui/src/assets/images/avatar.png b/klp-ui/src/assets/images/avatar.png new file mode 100644 index 00000000..357f31d4 Binary files /dev/null and b/klp-ui/src/assets/images/avatar.png differ diff --git a/klp-ui/src/assets/styles/element-ui.scss b/klp-ui/src/assets/styles/element-ui.scss index d83e5318..33e2eaee 100644 --- a/klp-ui/src/assets/styles/element-ui.scss +++ b/klp-ui/src/assets/styles/element-ui.scss @@ -1,9 +1,14 @@ // ====================== 1. 基础颜色变量(Sass直接处理)====================== -$primary-base: #5F7BA0; /* 工业蓝灰(主色原始值) */ -$success-base: #2ECC71; /* 成功色原始值 */ -$warning-base: #E67E22; /* 警告色原始值 */ -$danger-base: #E74C3C; /* 危险色原始值 */ -$info-base: #AEB6BF; /* 次主色原始值 */ +$primary-base: #5F7BA0; +/* 工业蓝灰(主色原始值) */ +$success-base: #2ECC71; +/* 成功色原始值 */ +$warning-base: #E67E22; +/* 警告色原始值 */ +$danger-base: #E74C3C; +/* 危险色原始值 */ +$info-base: #AEB6BF; +/* 次主色原始值 */ // 背景色原始值 $background-base: #2B2F36; @@ -38,26 +43,27 @@ $--border-color: $border-color-base; --color-warning: #{$warning-base}; --color-danger: #{$danger-base}; --color-info: #{$info-base}; - + /* 背景层级 */ --color-background: #{$background-base}; --color-background-light: #{$background-light-base}; --color-background-lighter: #{$background-lighter-base}; --panel-bg: #{$panel-bg-base}; --table-bg: #{$table-bg-base}; - + /* 文本色 */ --color-text-primary: #FFFFFF; --color-text-regular: #EAEAEA; --color-text-secondary: #B6BDC5; --color-text-placeholder: #8A9098; - + /* 边框色 */ --border-color-base: #{$border-color-base}; --border-color-light: #{$border-color-light}; --border-color-lighter: #{$border-color-lighter}; - --border-color: #{$--border-color}; /* 同步新增的边框色变量 */ - + --border-color: #{$--border-color}; + /* 同步新增的边框色变量 */ + /* 间距/尺寸体系 */ --spacing-sm: #{$--spacing-sm}; --spacing-base: #{$--spacing-base}; @@ -65,13 +71,13 @@ $--border-color: $border-color-base; --spacing-lg: #{$--spacing-lg}; --form-item-margin: #{$--form-item-margin}; --btn-height: #{$--btn-height}; - + /* 金属质感变量 */ --metal-gradient-light: linear-gradient(145deg, #3E434A, #363B41); --metal-gradient-dark: linear-gradient(145deg, #363B41, #3E434A); - --metal-highlight: rgba(255,255,255,.14); - --metal-shadow: 5px 5px 12px rgba(0,0,0,.22), -5px -5px 12px rgba(255,255,255,.06); - --metal-shadow-inset: inset 3px 3px 6px rgba(0,0,0,.28), inset -3px -3px 6px rgba(255,255,255,.06); + --metal-highlight: rgba(255, 255, 255, .14); + --metal-shadow: 5px 5px 12px rgba(0, 0, 0, .22), -5px -5px 12px rgba(255, 255, 255, .06); + --metal-shadow-inset: inset 3px 3px 6px rgba(0, 0, 0, .28), inset -3px -3px 6px rgba(255, 255, 255, .06); } @@ -97,7 +103,8 @@ $--color-text-placeholder: var(--color-text-placeholder) !default; $--border-color-base: $border-color-base !default; $--border-color-light: $border-color-light !default; $--border-color-lighter: $border-color-lighter !default; -$--border-color: $--border-color !default; /* 关键修复:同步到Element变量 */ +$--border-color: $--border-color !default; +/* 关键修复:同步到Element变量 */ // 间距变量 $--spacing-sm: $--spacing-sm !default; @@ -156,7 +163,7 @@ body { border: 1px solid $border-color; box-shadow: $--metal-shadow; border-radius: 6px; - text-shadow: 0 1px 0 rgba(0,0,0,.16); + text-shadow: 0 1px 0 rgba(0, 0, 0, .16); transition: all .25s ease; height: $--btn-height; padding: 0 var(--spacing-lg); @@ -167,7 +174,7 @@ body { color: $text-color; background: $--metal-gradient-dark; border-color: $--border-color-base; - box-shadow: 6px 6px 14px rgba(0,0,0,.28), -6px -6px 14px rgba(255,255,255,.08); + box-shadow: 6px 6px 14px rgba(0, 0, 0, .28), -6px -6px 14px rgba(255, 255, 255, .08); transform: translateY(-1px); } @@ -188,30 +195,33 @@ body { // 主按钮(品牌梯度) .el-button--primary { @include button-variant(#fff, darken($--color-primary, 10%)); - background: linear-gradient(145deg, lighten($--color-primary,6%), darken($--color-primary,6%)); - border-color: darken($--color-primary,10%); + background: linear-gradient(145deg, lighten($--color-primary, 6%), darken($--color-primary, 6%)); + border-color: darken($--color-primary, 10%); &:hover { - background: linear-gradient(145deg, $--color-primary, darken($--color-primary,8%)); + background: linear-gradient(145deg, $--color-primary, darken($--color-primary, 8%)); } } // 功能按钮(统一风格) .el-button--success { @include button-variant(#fff, darken($--color-success, 10%)); - background: linear-gradient(145deg, lighten($--color-success,6%), darken($--color-success,6%)); + background: linear-gradient(145deg, lighten($--color-success, 6%), darken($--color-success, 6%)); } + .el-button--warning { @include button-variant(#fff, darken($--color-warning, 10%)); - background: linear-gradient(145deg, lighten($--color-warning,6%), darken($--color-warning,6%)); + background: linear-gradient(145deg, lighten($--color-warning, 6%), darken($--color-warning, 6%)); } + .el-button--danger { @include button-variant(#fff, darken($--color-danger, 10%)); - background: linear-gradient(145deg, lighten($--color-danger,6%), darken($--color-danger,6%)); + background: linear-gradient(145deg, lighten($--color-danger, 6%), darken($--color-danger, 6%)); } + .el-button--info { @include button-variant(#111, darken($--color-info, 10%)); - background: linear-gradient(145deg, lighten($--color-info,6%), darken($--color-info,6%)); + background: linear-gradient(145deg, lighten($--color-info, 6%), darken($--color-info, 6%)); } // 文本按钮(低干扰) @@ -253,9 +263,11 @@ body { border-radius: 6px 0 0 6px; border-left: none; } + &:last-child { border-radius: 0 6px 6px 0; } + &:not(:last-child) { border-right: none; } @@ -287,7 +299,7 @@ body { // 表头(深灰黑 + 纯白文字) .el-table__header-wrapper { - th { + th.el-table__cell { background: #1F2227; color: $--color-text-primary; font-weight: 600; @@ -301,21 +313,25 @@ body { // 表体(奇偶行交替 + hover高亮) .el-table__body-wrapper { .el-table__row { + // 奇数行 &:nth-child(odd) .el-table__cell { background: #2F3339; color: #EAEAEA; } + // 偶数行 &:nth-child(even) .el-table__cell { background: #353A40; color: #EAEAEA; } + // hover &:hover .el-table__cell { background: rgba($--color-primary, 0.25); color: #888888; } + // 当前行 &.current-row .el-table__cell { background: rgba($--color-primary, 0.35); @@ -366,6 +382,257 @@ body { } } +.el-table__fixed-right { + // 表头(深灰黑 + 纯白文字) + .el-table__fixed-header-wrapper { + th.el-table__cell { + background: #1F2227; + color: $--color-text-primary; + font-weight: 600; + border-bottom: 1px solid #444A52; + padding: 4px !important; // 紧凑 padding + font-size: 13px; + } + } + + // 表体(奇偶行交替 + hover高亮) + .el-table__fixed-body-wrapper { + .el-table__row { + + // 奇数行 + &:nth-child(odd) .el-table__cell { + background: #2F3339; + color: #EAEAEA; + } + + // 偶数行 + &:nth-child(even) .el-table__cell { + background: #353A40; + color: #EAEAEA; + } + + // 当前行 + &.current-row .el-table__cell { + background: rgba($--color-primary, 0.35); + color: $--color-text-primary; + font-weight: 600; + } + } + } +} + +// ---------------------- 3.2 日期范围选择器 ---------------------- +// 日期范围选择器主题样式 +.el-date-editor { + height: $--btn-height; + + // 基础样式 + &.el-range-editor { + background: $--color-background; + border: 1px solid $--border-color; + border-radius: 4px; + color: $--color-text-regular; + height: $--btn-height; + padding: 0 8px; + box-shadow: none; + transition: all 0.2s ease; + + // 悬停状态 + &:hover { + border-color: $--color-primary; + box-shadow: 0 0 0 2px rgba($--color-primary, 0.2); + } + + // 聚焦状态 + &.is-focus { + border-color: $--color-primary; + box-shadow: 0 0 0 2px rgba($--color-primary, 0.2); + outline: none; + } + + // 图标样式 + .el-input__icon { + color: $--color-text-secondary; + width: 18px; + height: 18px; + line-height: 18px; + + &:hover { + color: $--color-primary; + } + } + + // 输入框样式 + .el-range-input { + background: transparent; + border: none; + color: $--color-text-regular; + padding: 0 4px; + height: 100%; + font-size: 13px; + width: 80px; + + &::placeholder { + color: $--color-text-placeholder; + } + + &:focus { + outline: none; + } + } + + // 分隔符样式 + .el-range-separator { + color: $--color-text-secondary; + padding: 0 4px; + font-size: 13px; + } + + // 清除图标 + .el-range__close-icon { + margin-left: 4px; + + &:hover { + color: $--color-danger; + } + } + } + + &--medium.el-input__inner { + height: auto; + } +} + +.el-range-editor--medium.el-input__inner { + height: $--btn-height !important; + width: auto !important; + + .el-range-separator { + padding: 0; + line-height: 16px; + font-size: 13px; + color: $--color-text-secondary; + } +} + +// 日期选择面板样式 +.el-picker-panel { + background: $--color-background; + border: 1px solid $--border-color; + border-radius: 6px; + box-shadow: $--metal-shadow; + color: $--color-text-regular; + + // 头部导航 + .el-picker-panel__header { + border-bottom: 1px solid $--border-color-lighter; + padding: 6px 10px; + + button { + color: $--color-text-secondary; + + &:hover { + color: $--color-primary; + background: rgba($--color-primary, 0.1); + } + } + + .el-picker-panel__icon-btn { + width: 24px; + height: 24px; + line-height: 24px; + border-radius: 4px; + } + + .el-date-picker__header-label { + color: $--color-text-primary; + font-weight: 500; + } + } + + // 日期表格 + .el-date-table { + border-collapse: separate; + border-spacing: 2px; + + th { + color: $--color-text-secondary; + font-weight: normal; + padding: 4px 0; + font-size: 12px; + } + + td { + padding: 0; + + .el-date-table__cell { + width: 28px; + height: 28px; + line-height: 28px; + border-radius: 4px; + margin: 1px; + font-size: 13px; + + &:hover { + background: rgba($--color-primary, 0.2); + } + + &.current { + background: $--color-primary; + color: #fff; + } + + &.in-range { + background: rgba($--color-primary, 0.1); + + &::before { + background: $--color-primary; + } + } + + &.start-date, + &.end-date { + background: $--color-primary; + color: #fff; + } + } + } + } + + // 范围选择器底部按钮 + .el-range-picker__footer { + border-top: 1px solid $--border-color-lighter; + padding: 6px 10px; + + button { + background: $--color-background-light; + border: 1px solid $--border-color; + color: $--color-text-regular; + height: 24px; + line-height: 22px; + padding: 0 12px; + font-size: 12px; + border-radius: 4px; + + &:hover { + background: rgba($--color-primary, 0.2); + border-color: $--color-primary; + } + + &.el-button--primary { + background: $--color-primary; + border-color: $--color-primary; + color: #fff; + + &:hover { + background: lighten($--color-primary, 10%); + border-color: lighten($--color-primary, 10%); + } + } + } + } +} + // 自定义表格工具类(补充紧凑) .small-padding .cell { padding-left: calc($--spacing-base / 2); @@ -382,7 +649,6 @@ body { // 表单项布局 .el-form-item { margin-bottom: $--form-item-margin !important; - label-align: right; // 标签右对齐 font-size: 13px; // 标签样式 @@ -412,7 +678,6 @@ body { border-radius: 0; height: $--btn-height; line-height: $--btn-height; - padding: 0 $--spacing-base; font-size: 13px; &::placeholder { @@ -508,12 +773,15 @@ body { .el-input-number__increase { border-radius: 0; + .el-icon-plus { color: $--color-text-regular; } } + .el-input-number__decrease { border-radius: 0; + .el-icon-minus { color: $--color-text-regular; } @@ -521,6 +789,7 @@ body { // 迷你尺寸 &.el-input-number--small { + .el-input-number__increase, .el-input-number__decrease { width: 24px; @@ -556,6 +825,7 @@ body { &:hover { background-color: rgba($--color-primary, .12); } + &.selected { background-color: rgba($--color-primary, .20); color: #fff; @@ -580,6 +850,7 @@ body { .el-slider__bar { background: $--metal-gradient-dark; } + .el-slider__button { background: $--metal-gradient-light; border-color: $--border-color-light; @@ -649,6 +920,10 @@ body { border-bottom: 1px solid $--border-color-lighter; } + .el-dialog__title { + color: $--color-text-primary; + } + // 对话框主体 .el-dialog__body { padding: $--spacing-lg; @@ -699,11 +974,12 @@ body { &::after { background: $--metal-gradient-light; } + border-color: $--border-color-light; } } -.el-button-group + .el-popover { +.el-button-group+.el-popover { margin-left: 5px; } @@ -715,8 +991,8 @@ body { // 标签栏 .el-tabs__header { - margin: 0 0 var(--spacing-lg) 0; - padding: 0 var(--spacing-base); + margin: 0; + padding: 0; border-bottom: 1px solid $--border-color-light; background-color: transparent; @@ -724,7 +1000,7 @@ body { .el-tabs__nav { height: 40px; line-height: 40px; - background-color: $--color-background-light; + // background-color: $--color-background-light; border-radius: 6px 6px 0 0; padding: 0 var(--spacing-base); box-shadow: inset 0 -1px 0 $--border-color-light; @@ -735,8 +1011,8 @@ body { color: $--color-text-secondary; height: 40px; line-height: 40px; - padding: 0 var(--spacing-lg); - margin: 0 var(--spacing-sm); + // padding: 0 var(--spacing-lg); + // margin: 0 var(--spacing-sm); font-size: 13px; transition: all 0.2s ease; border-bottom: 2px solid transparent; @@ -744,7 +1020,7 @@ body { // 悬停状态 &:hover { color: $--color-primary; - background-color: rgba($--color-primary, 0.08); + // background-color: rgba($--color-primary, 0.08); border-bottom-color: rgba($--color-primary, 0.3); } @@ -753,7 +1029,7 @@ body { color: $--color-primary; font-weight: 500; border-bottom-color: $--color-primary; - background-color: rgba($--color-primary, 0.1); + // background-color: rgba($--color-primary, 0.1); } // 禁用状态 @@ -1055,6 +1331,123 @@ body { } } +// ====================== 描述列表组件(el-descriptions)- 深色模式 ====================== +.el-descriptions { + width: 100%; + background: $--color-background; // 黑色背景 + box-shadow: $--metal-shadow; + overflow: hidden; + color: $--color-text-primary; // 白色文字 + + // 描述列表头部 + &__header { + padding: $--spacing-base $--spacing-lg; + border-bottom: 1px solid $--border-color-lighter; + background: $--metal-gradient-dark; + color: $--color-text-primary; // 白色标题 + font-weight: 600; + font-size: 14px; + } + + // 描述列表主体容器 + &__body { + width: 100%; + } + + // 描述列表行 + &__row { + display: flex; + width: 100%; + border-bottom: 1px solid $--border-color-lighter; + + // 最后一行移除底部边框 + &:last-child { + border-bottom: none; + } + } + + // 描述列表标签项(左侧) + .el-descriptions-item__label { + padding: $--spacing-lg; + background: $--color-background; // 极浅灰背景区分标签 + color: $--color-text-secondary; // 浅灰文字 + font-weight: 500; + border-right: 1px solid $--border-color-lighter; + box-sizing: border-box; + white-space: nowrap; + font-size: 13px; + } + + // 描述列表内容项(右侧) + &-item__content { + padding: $--spacing-lg; + background: $--color-background-light; + color: $--color-text-primary; // 白色文字 + flex: 1; + box-sizing: border-box; + font-size: 13px; + word-break: break-word; + } + + // 带边框模式适配 + &--border { + border: 1px solid $--border-color-light; + border-radius: 8px; + overflow: hidden; + + .el-descriptions__label, + .el-descriptions__content { + border-color: $--border-color-lighter; + } + + .el-descriptions__header { + border-bottom: 1px solid $--border-color-light; + } + } + + // 尺寸适配 + &--small { + + .el-descriptions__label, + .el-descriptions__content { + padding: calc($--spacing-base / 2) $--spacing-base; + font-size: 12px; + } + + .el-descriptions__header { + padding: calc($--spacing-base / 2) $--spacing-base; + font-size: 13px; + } + } + + &--large { + + .el-descriptions__label, + .el-descriptions__content { + padding: $--spacing-lg calc($--spacing-lg * 1.5); + font-size: 14px; + } + + .el-descriptions__header { + padding: $--spacing-base calc($--spacing-lg * 1.5); + font-size: 15px; + } + } + + // 响应式适配 + @media (max-width: 768px) { + .el-descriptions__row { + flex-direction: column; + } + + .el-descriptions__label { + border-right: none; + border-bottom: 1px solid $--border-color-lighter; + width: 100%; + } + } +} + // ---------------------- 3.6 导航类(面包屑/菜单)---------------------- // 面包屑 @@ -1094,7 +1487,7 @@ body { } // 折叠菜单 - &.el-menu--collapse > div > .el-submenu > .el-submenu__title .el-submenu__icon-arrow { + &.el-menu--collapse>div>.el-submenu>.el-submenu__title .el-submenu__icon-arrow { display: none; } @@ -1216,7 +1609,7 @@ div.pagination-container { background: rgba($--color-primary, .12); } - &.is-current > .el-tree-node__content { + &.is-current>.el-tree-node__content { background: rgba($--color-primary, .2); color: $--color-primary; } diff --git a/klp-ui/src/components/MarkdownPreview.vue b/klp-ui/src/components/MarkdownPreview.vue index ba32b8cd..51c73846 100644 --- a/klp-ui/src/components/MarkdownPreview.vue +++ b/klp-ui/src/components/MarkdownPreview.vue @@ -13,6 +13,12 @@ export default { default: '' } }, + data() { + return { + vditor: null, + loading: false + } + }, mounted() { this.renderMarkdown(); }, @@ -22,13 +28,17 @@ export default { } }, methods: { - renderMarkdown() { - Vditor.preview(this.$refs.preview, this.value || '', { + async renderMarkdown() { + this.loading = true; + await Vditor.preview(this.$refs.preview, this.value || '', { anchor: 1, hl: true, + theme: 'dark', math: { inlineDigit: true }, mermaid: true, }); + this.loading = false; + console.log(this.$refs.preview, p); } } } @@ -36,9 +46,9 @@ export default { diff --git a/klp-ui/src/store/modules/user.js b/klp-ui/src/store/modules/user.js index d67c9a4a..507f1845 100644 --- a/klp-ui/src/store/modules/user.js +++ b/klp-ui/src/store/modules/user.js @@ -51,7 +51,7 @@ const user = { return new Promise((resolve, reject) => { getInfo().then(res => { const user = res.data.user - const avatar = (user.avatar == "" || user.avatar == null) ? require("@/assets/images/profile.jpg") : user.avatar; + const avatar = (user.avatar == "" || user.avatar == null) ? require("@/assets/images/avatar.png") : user.avatar; if (res.data.roles && res.data.roles.length > 0) { // 验证返回的roles是否是一个非空数组 commit('SET_ROLES', res.data.roles) commit('SET_PERMISSIONS', res.data.permissions) diff --git a/klp-ui/src/views/components/AllApplications.vue b/klp-ui/src/views/components/AllApplications.vue index 22b57e2c..a4d8ecc9 100644 --- a/klp-ui/src/views/components/AllApplications.vue +++ b/klp-ui/src/views/components/AllApplications.vue @@ -207,7 +207,6 @@ export default { \ No newline at end of file diff --git a/klp-ui/src/views/finance/document/index.vue b/klp-ui/src/views/finance/document/index.vue index c088c234..a440be25 100644 --- a/klp-ui/src/views/finance/document/index.vue +++ b/klp-ui/src/views/finance/document/index.vue @@ -46,26 +46,6 @@ @click="handleAdd" >新增 - - 修改 - - - 删除 - .dashboard-root { min-height: 100vh; - background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%); padding: 32px; } @@ -88,7 +87,6 @@ export default { padding: 24px; border-radius: 16px; backdrop-filter: blur(4px); - background: rgba(255, 255, 255, 0.8); box-shadow: 0 4px 24px 0 rgba(0, 0, 0, 0.06); border: 1px solid rgba(255, 255, 255, 0.2); transition: transform 0.2s; @@ -158,7 +156,6 @@ export default { align-items: center; padding: 16px; border-radius: 12px; - background: #fff; box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.05); transition: all 0.2s; cursor: pointer; @@ -182,7 +179,6 @@ export default { .business-module-icon i { font-size: 20px; - color: #fff; } .bg-blue { @@ -229,7 +225,6 @@ export default { .monitor-records { padding: 24px; border-radius: 16px; - background: #fff; box-shadow: 0 4px 24px 0 rgba(0, 0, 0, 0.06); } @@ -279,7 +274,6 @@ export default { .monitor-record-icon-inner { font-size: 14px; - color: #fff; } .monitor-record-action { @@ -305,7 +299,6 @@ export default { border-radius: 50%; object-fit: cover; border: 2px solid #e0e0e0; - background: #fff; } .greeting-text { diff --git a/klp-ui/src/views/login.vue b/klp-ui/src/views/login.vue index bd3cf0b0..17b08ed0 100644 --- a/klp-ui/src/views/login.vue +++ b/klp-ui/src/views/login.vue @@ -153,10 +153,18 @@ export default { + \ No newline at end of file diff --git a/klp-ui/src/views/mes/qc/files/index.vue b/klp-ui/src/views/mes/qc/files/index.vue index f57bed7d..1318bee9 100644 --- a/klp-ui/src/views/mes/qc/files/index.vue +++ b/klp-ui/src/views/mes/qc/files/index.vue @@ -1,44 +1,84 @@ @@ -58,7 +98,7 @@ export default { }, created() { this.fetchFileList(); - getFileStats() + getFileStats(); // 补充括号,修复语法问题 }, computed: { groupedFiles() { @@ -79,6 +119,7 @@ export default { weekAgo.setDate(today.getDate() - 6); const monthStart = new Date(now.getFullYear(), now.getMonth(), 1); const threeMonthsAgo = new Date(now.getFullYear(), now.getMonth() - 2, 1); + (this.files || []).forEach(file => { const d = file.lastModified ? new Date(file.lastModified) : null; if (!d) { @@ -99,6 +140,7 @@ export default { groups['更久'].push(file); } }); + // 只返回有文件的分组 return Object.fromEntries(Object.entries(groups).filter(([k, v]) => v.length)); } @@ -111,10 +153,12 @@ export default { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning', + confirmButtonClass: 'el-button--warning', + cancelButtonClass: 'el-button--text' }).then(async () => { const names = this.files.map(f => f.fileName); await this.batchDelete(names); - }).catch(() => {}); + }).catch(() => { }); }, // 清空某个分组 @@ -125,10 +169,12 @@ export default { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning', + confirmButtonClass: 'el-button--warning', + cancelButtonClass: 'el-button--text' }).then(async () => { const names = group.map(f => f.fileName); await this.batchDelete(names); - }).catch(() => {}); + }).catch(() => { }); }, // 批量删除 @@ -154,6 +200,8 @@ export default { this.loadingList = false; } }, + + // 获取文件列表 async fetchFileList() { this.loadingList = true; this.files = []; @@ -168,6 +216,7 @@ export default { } }, + // 选择文件预览 async selectFile(file) { this.selectedFileName = file.fileName; this.selectedFile = null; @@ -175,26 +224,25 @@ export default { try { const isText = /\.(txt|md|json|js|ts|log|csv|xml|html|css)$/i.test(file.fileName); const isImage = /\.(png|jpe?g|gif|bmp|webp|svg)$/i.test(file.fileName); + if (isText) { - const textResult = await getFileContent(file.fileName) - this.selectedFile = {...textResult.data, fileType: 'text'}; - } + const textResult = await getFileContent(file.fileName); + this.selectedFile = { ...textResult.data, fileType: 'text' }; + } + // 图片预览逻辑(保留,需时启用) // else if (isImage) { - // // 图片文件 // let blob = null; // if (typeof this.$options.components?.getFileContent === 'function') { // blob = await this.$options.components.getFileContent(file.fileName); // } else if (typeof window.getFileContent === 'function') { // blob = await window.getFileContent(file.fileName); // } - // // blob 可能是base64字符串或Blob对象,需适配 // let imgUrl = ''; // if (blob instanceof Blob) { // imgUrl = URL.createObjectURL(blob); // } else if (typeof blob === 'string' && blob.startsWith('data:image')) { // imgUrl = blob; // } else if (typeof blob === 'string') { - // // 假设后端返回base64 // imgUrl = 'data:image/*;base64,' + blob; // } // this.selectedFile = { fileName: file.fileName, fileContent: imgUrl, fileType: 'image' }; @@ -206,11 +254,13 @@ export default { this.loadingContent = false; } }, + + // 单个文件删除 handleDeleteFile(file) { deleteFile(file.fileName) .then(() => { this.$message.success('文件删除成功'); - this.fetchFileList(); // 重新加载文件列表 + this.fetchFileList(); }) .catch(err => { this.$message.error('删除文件失败: ' + (err.message || '未知错误')); @@ -221,5 +271,291 @@ export default { +/* 全局容器 */ +.file-preview-container { + display: flex; + height: calc(100vh - 84px); + background: var(--color-background); + color: var(--color-text-regular); +} + +/* 左侧文件列表侧边栏 */ +.file-list-sidebar { + width: 250px; + border-right: 1px solid var(--border-color-light); + overflow-y: auto; + background: var(--color-background-light); +} + +/* 列表顶部操作栏 */ +.file-list-header { + padding: var(--spacing-base) var(--spacing-lg); + border-bottom: 1px solid var(--border-color-light); + display: flex; + gap: var(--spacing-base); + align-items: center; + background: var(--metal-gradient-light); +} + +/* 清空全部按钮 */ +.clear-all-btn { + background: linear-gradient(145deg, #e53e3e, #c53030); + color: #fff; + border: 1px solid #9b2c2c; + border-radius: 4px; + padding: 4px 10px; + cursor: pointer; + transition: all 0.2s; + box-shadow: var(--metal-shadow-inset); +} + +.clear-all-btn:hover { + box-shadow: var(--metal-shadow); + transform: translateY(-1px); +} + +.clear-all-btn:active { + box-shadow: var(--metal-shadow-inset); + transform: translateY(0); +} + +/* 列表加载状态 */ +.list-loading { + padding: 24px; + color: var(--color-text-secondary); + text-align: center; + background: var(--metal-gradient-light); +} + +/* 文件分组列表 */ +.file-group-list { + list-style: none; + padding: 0; + margin: 0; +} + +/* 分组标题栏 */ +.group-header { + background: var(--metal-gradient-dark); + color: var(--color-text-primary); + font-weight: 600; + padding: var(--spacing-base) var(--spacing-lg); + display: flex; + align-items: center; + justify-content: space-between; + border-bottom: 1px solid var(--border-color-lighter); +} + +/* 清空分组按钮 */ +.clear-group-btn { + background: linear-gradient(145deg, #e6a23c, #d48822); + color: #fff; + border: 1px solid #b87319; + border-radius: 3px; + padding: 2px 8px; + font-size: 12px; + cursor: pointer; + transition: all 0.2s; + box-shadow: var(--metal-shadow-inset); +} + +.clear-group-btn:hover { + box-shadow: var(--metal-shadow); + transform: translateY(-1px); +} + +.clear-group-btn:active { + box-shadow: var(--metal-shadow-inset); + transform: translateY(0); +} + +/* 文件项基础样式 */ +.file-item { + padding: 12px var(--spacing-lg); + cursor: pointer; + transition: all 0.2s; + background: var(--color-background-light); + border-left: 3px solid transparent; +} + +.file-item:hover { + background: var(--metal-gradient-light); + box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); +} + +/* 文件项选中状态 */ +.file-item--active { + background: rgba(var(--color-primary-rgb), 0.2); + border-left: 3px solid var(--color-primary); +} + +/* 文件项内容容器 */ +.file-item__content { + display: flex; + justify-content: space-between; + align-items: center; +} + +/* 文件名 */ +.file-name { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + max-width: 180px; +} + +/* 删除文件按钮 */ +.delete-file-btn { + color: var(--color-danger); + cursor: pointer; + padding: 2px 4px; + border-radius: 3px; + transition: all 0.2s; +} + +.delete-file-btn:hover { + background: rgba(var(--color-danger-rgb), 0.15); +} + +/* 右侧预览主区域 */ +.file-preview-main { + flex: 1; + padding: var(--spacing-lg); + overflow-y: auto; +} + +/* 内容加载状态 */ +.content-loading { + color: var(--color-text-secondary); + padding: 24px; + background: var(--metal-gradient-light); + border-radius: 6px; + border: 1px solid var(--border-color-light); +} + +/* 预览卡片容器 */ +.preview-card { + background: var(--metal-gradient-light); + border-radius: 6px; + border: 1px solid var(--border-color-light); + padding: var(--spacing-lg); + box-shadow: var(--metal-shadow); +} + +/* 预览标题 */ +.preview-title { + color: var(--color-text-primary); + margin-top: 0; + padding-bottom: var(--spacing-base); + border-bottom: 1px solid var(--border-color-lighter); +} + +/* 文本预览样式 */ +.text-preview { + background: var(--table-bg); + color: var(--color-text-regular); + padding: var(--spacing-lg); + border-radius: 4px; + min-height: 300px; + border: 1px solid var(--border-color-lighter); + overflow-x: auto; + font-size: 13px; + line-height: 1.5; + margin: 0; +} + +/* 图片预览容器(保留,需时启用) */ +/* .image-preview-container { + padding: var(--spacing-lg); + background: var(--table-bg); + border-radius: 4px; + min-height: 300px; + display: flex; + align-items: center; + justify-content: center; + border: 1px solid var(--border-color-lighter); +} + +.image-preview { + max-width: 100%; + max-height: 600px; + border-radius: 4px; + box-shadow: var(--metal-shadow); +} */ + +/* 不支持的文件类型样式 */ +.unsupported-type { + background: var(--table-bg); + padding: var(--spacing-lg); + border-radius: 4px; + min-height: 300px; + color: var(--color-warning); + border: 1px solid var(--border-color-lighter); + display: flex; + align-items: center; + justify-content: center; + font-size: 14px; +} + +/* 未选择文件状态 */ +.no-selection { + color: var(--color-text-secondary); + padding: 24px; + background: var(--metal-gradient-light); + border-radius: 6px; + border: 1px solid var(--border-color-light); +} + +/* 滚动条样式优化 */ +::-webkit-scrollbar { + width: 6px; + height: 6px; +} + +::-webkit-scrollbar-track { + background: var(--color-background-light); + border-radius: 3px; +} + +::-webkit-scrollbar-thumb { + background: var(--border-color-light); + border-radius: 3px; +} + +::-webkit-scrollbar-thumb:hover { + background: var(--border-color-base); +} + +/* 修复Element消息提示框样式(适配深色) */ +::v-deep .el-message { + background: var(--metal-gradient-light); + border-color: var(--border-color-light); + color: var(--color-text-regular); +} + +::v-deep .el-message__icon--success { + color: var(--color-success); +} + +::v-deep .el-message__icon--error { + color: var(--color-danger); +} + +::v-deep .el-message__icon--info { + color: var(--color-info); +} + +/* 修复确认对话框样式 */ +::v-deep .el-dialog { + background: var(--metal-gradient-light) !important; + border-color: var(--border-color-light) !important; +} + +::v-deep .el-dialog__title { + color: var(--color-text-primary) !important; +} + +::v-deep .el-dialog__body { + color: var(--color-text-regular) !important; +} + \ No newline at end of file diff --git a/klp-ui/src/views/wms/hotProduct/index.vue b/klp-ui/src/views/wms/hotProduct/index.vue index 5dc76ab7..6a0bca23 100644 --- a/klp-ui/src/views/wms/hotProduct/index.vue +++ b/klp-ui/src/views/wms/hotProduct/index.vue @@ -148,22 +148,6 @@ - - -
- - - 刷新数据 - - -
@@ -394,7 +378,6 @@ export default {