明树Git Lab

Commit a16431ee authored by zhanghan's avatar zhanghan

样式处理

parent 24964840
Pipeline #109171 passed with stage
in 20 seconds
...@@ -52,9 +52,18 @@ const props = defineProps({ ...@@ -52,9 +52,18 @@ const props = defineProps({
type: Number, type: Number,
default: 0, default: 0,
}, },
// 折叠面板的 v-model 绑定值(用于自动展开折叠面板)
collapseActiveNames: {
type: Array,
default: null,
},
}); });
const emit = defineEmits(["update:activeItem", "navClick"]); const emit = defineEmits([
"update:activeItem",
"navClick",
"update:collapseActiveNames",
]);
const currentItem = ref(""); const currentItem = ref("");
const scrollContainerEl = ref(null); const scrollContainerEl = ref(null);
......
...@@ -383,3 +383,43 @@ ...@@ -383,3 +383,43 @@
} }
} }
// ==========================设置定制化样式 end ========================== // ==========================设置定制化样式 end ==========================
// ==========================表格双色条纹样式 start ==========================
.table-stripe-colors {
border: 1px solid #ebeef5;
// 奇数行 1、3、5、7…
.odd-row {
background-color: #f5f5f5 !important;
}
// 偶数行 2、4、6、8…
.even-row {
background-color: #edf0f5 !important;
}
// 鼠标悬停
.el-table__body tr:hover > td {
background-color: #e8f4ff !important;
}
// 表头
.el-table__header-wrapper {
th {
background-color: #f0f2f5 !important;
color: #333;
font-weight: 600;
text-align: center;
border-color: #ebeef5;
}
}
// 表格主体单元格
.el-table__body-wrapper {
td {
border-color: #ebeef5;
padding: 8px 0;
}
}
}
// ==========================表格双色条纹样式 end ==========================
This diff is collapsed.
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<table class="investment-table"> <table class="investment-table">
<!-- 表头行 --> <!-- 表头行 -->
<thead> <thead>
<tr style="background: #f5f7fa"> <tr>
<td class="first-col" colspan="5">指标名称</td> <td class="first-col" colspan="5">指标名称</td>
<td>合计</td> <td>合计</td>
</tr> </tr>
...@@ -151,14 +151,7 @@ ...@@ -151,14 +151,7 @@
<!-- 右侧:Element 时间输入表格(绑定**内部响应式数据**,不再直接绑props) --> <!-- 右侧:Element 时间输入表格(绑定**内部响应式数据**,不再直接绑props) -->
<div class="right-table"> <div class="right-table">
<el-table <el-table :data="tableData" :row-class-name="tableRowClassName" border>
:data="tableData"
style="width: 100%"
border
:cell-style="tableCellStyle"
:row-style="{ height: '48px' }"
:header-row-style="{ height: '48px', background: '#f5f7fa' }"
>
<el-table-column <el-table-column
v-for="time in validDynamicTimeList" v-for="time in validDynamicTimeList"
:key="`time-col-${time}`" :key="`time-col-${time}`"
...@@ -201,7 +194,9 @@ const props = defineProps({ ...@@ -201,7 +194,9 @@ const props = defineProps({
dynamicTimeList: { type: Array, default: () => [] }, // 父组件必须传 dynamicTimeList: { type: Array, default: () => [] }, // 父组件必须传
isPreview: { type: Boolean, default: false }, isPreview: { type: Boolean, default: false },
}); });
const tableRowClassName = ({ rowIndex }) => {
return rowIndex % 2 === 0 ? "even-row" : "odd-row";
};
const emit = defineEmits([ const emit = defineEmits([
"update:modelValue", // v-model双向绑定 "update:modelValue", // v-model双向绑定
"handleAnnualPlanChange", // 原有业务事件 "handleAnnualPlanChange", // 原有业务事件
...@@ -322,19 +317,31 @@ const getAllRowsTotal = () => { ...@@ -322,19 +317,31 @@ const getAllRowsTotal = () => {
return total.toFixed(2); return total.toFixed(2);
}; };
// 合计行样式(保持不变) // 表格单元格样式
const tableCellStyle = ({ row }) => const tableCellStyle = ({ row, columnIndex }) => {
row?.isTotal ? { background: "#f5f7fa", fontWeight: "bold" } : {}; const baseStyle = {
border: "1px solid #ebeef5",
};
// 调试日志(打印内部数据字段,确认是否保留) if (row.isTotal) {
onMounted(() => { return { ...baseStyle, background: "#f5f7fa", fontWeight: "bold" };
if (tableData.value.length > 0) {
} }
}); // 左边三列(序号、指标项、合计)使用 #f7faff 背景色
if (columnIndex === 0 || columnIndex === 1 || columnIndex === 2) {
return { ...baseStyle, background: "#f7faff" };
}
return baseStyle;
};
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
// 所有样式保持不变,仅优化input样式,确保能看见 ::v-deep .odd-row {
background-color: #f5f5f5 !important;
}
// 偶数行 2、4、6、8…
::v-deep .even-row {
background-color: #edf0f5 !important;
}
.annual-plan-wrap { .annual-plan-wrap {
display: flex; display: flex;
align-items: flex-start; align-items: flex-start;
...@@ -368,24 +375,9 @@ onMounted(() => { ...@@ -368,24 +375,9 @@ onMounted(() => {
.investment-table thead td { .investment-table thead td {
height: 48px; height: 48px;
font-weight: bold; font-weight: bold;
background: #f7faff; // background: #f7faff;
}
.first-col {
font-weight: bold;
// background-color: #f5f7fa;
}
.second-col {
// background-color: #f5f7fa;
}
.third-col {
font-weight: 500;
// background-color: #f5f7fa;
}
// 新增:第四列样式(计划投资回款等模块)
.fourth-col {
// background-color: #f5f7fa;
font-weight: 500;
} }
// 样式优化:移除不必要的隐藏,确保元素可见 // 样式优化:移除不必要的隐藏,确保元素可见
:deep(.el-table) { :deep(.el-table) {
--el-table-border-color: #ebeef5; --el-table-border-color: #ebeef5;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment