style: 更新学生端分页样式为科技蓝,优化评分表格布局

优化了评分表格的结构和样式,调整了各项评分的计算方式,确保视觉一致性和用户体验
fix/exam-question-access-material-excel-delete-draft
qinzhenpen 2 months ago
parent 3ea98be5a5
commit 802bd35593

@ -496,13 +496,13 @@ aside {
// color: #eef5ff !important; // color: #eef5ff !important;
// } // }
/* === 学生端分页:墨黑极简(覆盖上方裸深色 !important 规则) === */ /* === 学生端分页:科技蓝(与学生端亮色主题一致,覆盖上方裸深色 !important 规则) === */
#app .studentLayout .pagination-container .el-pagination, #app .studentLayout .pagination-container .el-pagination,
#app .studentLayout .el-pagination { #app .studentLayout .el-pagination {
--el-pagination-bg-color: transparent !important; --el-pagination-bg-color: transparent !important;
--el-pagination-button-bg-color: #ffffff !important; --el-pagination-button-bg-color: #ffffff !important;
--el-pagination-hover-color: #1f2937 !important; --el-pagination-hover-color: #2563eb !important;
--el-pagination-button-disabled-bg-color: #ffffff !important; --el-pagination-button-disabled-bg-color: #f9fafb !important;
--el-pagination-button-disabled-color: #9ca3af !important; --el-pagination-button-disabled-color: #9ca3af !important;
color: #4b5563 !important; color: #4b5563 !important;
} }
@ -517,21 +517,30 @@ aside {
border-radius: 8px !important; border-radius: 8px !important;
background-color: #ffffff !important; background-color: #ffffff !important;
color: #374151 !important; color: #374151 !important;
font-weight: 600; font-weight: 500;
} }
/* 悬浮:软蓝浅底 + 蓝字蓝边 */
#app .studentLayout .pagination-container .el-pagination .el-pager li:hover, #app .studentLayout .pagination-container .el-pagination .el-pager li:hover,
#app .studentLayout .el-pager li:hover, #app .studentLayout .el-pager li:hover,
#app .studentLayout .el-pagination button:hover { #app .studentLayout .el-pagination button:hover:not(:disabled) {
border-color: #1f2937 !important; border-color: #2563eb !important;
background-color: #f9fafb !important; background-color: #eff6ff !important;
color: #1f2937 !important; color: #2563eb !important;
} }
/* 当前页:实心教育蓝(与学生端主按钮同色系) */
#app .studentLayout .pagination-container .el-pagination .el-pager li.is-active, #app .studentLayout .pagination-container .el-pagination .el-pager li.is-active,
#app .studentLayout .el-pager li.is-active { #app .studentLayout .el-pager li.is-active {
border-color: #1f2937 !important; border-color: #2563eb !important;
background: #1f2937 !important; background: #2563eb !important;
color: #ffffff !important;
}
#app .studentLayout .pagination-container .el-pagination .el-pager li.is-active:hover,
#app .studentLayout .el-pager li.is-active:hover {
border-color: #1d4ed8 !important;
background: #1d4ed8 !important;
color: #ffffff !important; color: #ffffff !important;
} }
@ -539,8 +548,8 @@ aside {
#app .studentLayout .pagination-container .el-pagination .btn-next:disabled, #app .studentLayout .pagination-container .el-pagination .btn-next:disabled,
#app .studentLayout .el-pagination .btn-prev:disabled, #app .studentLayout .el-pagination .btn-prev:disabled,
#app .studentLayout .el-pagination .btn-next:disabled { #app .studentLayout .el-pagination .btn-next:disabled {
background-color: #ffffff !important; background-color: #f9fafb !important;
color: #9ca3af !important; color: #b0c0d0 !important;
border-color: #e5e7eb !important; border-color: #e5e7eb !important;
} }
@ -550,14 +559,23 @@ aside {
font-weight: 400; font-weight: 400;
} }
#app .studentLayout .el-pagination .el-select .el-input__wrapper { /* 每页条数下拉 + 跳页输入框:白底灰边,hover/focus 教育蓝 */
#app .studentLayout .el-pagination .el-input__wrapper {
background: #ffffff !important; background: #ffffff !important;
border: 1px solid #e5e7eb !important; border: 1px solid #e5e7eb !important;
border-radius: 8px !important; border-radius: 8px !important;
box-shadow: none !important; box-shadow: none !important;
} }
#app .studentLayout .el-pagination .el-select .el-input__inner { #app .studentLayout .el-pagination .el-input__wrapper:hover {
border-color: #3b82f6 !important;
}
#app .studentLayout .el-pagination .el-input__wrapper.is-focus {
border-color: #2563eb !important;
}
#app .studentLayout .el-pagination .el-input__inner {
color: #374151 !important; color: #374151 !important;
} }

@ -94,26 +94,37 @@
<section class="intro-card compact"> <section class="intro-card compact">
<p class="step-caption">Step 02</p> <p class="step-caption">Step 02</p>
<h2>为供应渠道评分并比较结果</h2> <h2>为供应渠道评分并比较结果</h2>
<p>每项评分为 0–10 分,渠道名称和评分均由学生填写;系统会按第一步已保存的权重自动计算加权总分。</p> <p>每项评分为 0–10 分,渠道名称与评分由学生填写;系统按第一步已保存的试产/量产权重分别计算两个加权总分。</p>
</section> </section>
<section v-for="section in scoreSections" :key="section.key" class="score-section"> <section class="score-section">
<div class="section-heading"> <div class="section-heading">
<div><span>{{ section.label }}</span><h3>{{ section.title }}</h3></div> <div><span>渠道评分</span><h3>供应渠道评分与加权对比</h3></div>
<small>加权总分 = Σ(维度评分 × 权重)</small> <small>试产加权总分 = Σ(评分 × 试产权重) · 量产加权总分 = Σ(评分 × 量产权重)</small>
</div> </div>
<div class="table-scroll"> <div class="table-scroll">
<table class="training-table score-table"> <table class="training-table score-table merged-score-table">
<thead> <thead>
<tr><th>渠道</th><th v-for="dimension in rows" :key="dimension.key">{{ dimension.name }}</th><th>加权总分</th></tr> <tr class="group-header">
<th rowspan="2" class="col-channel">渠道</th>
<th :colspan="rows.length" class="group-dimensions">维度评分(0–10 分)</th>
<th class="group-total group-total-small">试产加权总分</th>
<th class="group-total group-total-large">量产加权总分</th>
</tr>
<tr>
<th v-for="dimension in rows" :key="dimension.key" class="col-dimension">{{ dimension.name }}</th>
<th class="col-total col-total-small">Σ × 试产权重</th>
<th class="col-total col-total-large">Σ × 量产权重</th>
</tr>
</thead> </thead>
<tbody> <tbody>
<tr v-for="row in section.rows" :key="row.id"> <tr v-for="row in channelRows" :key="row.id">
<td><el-input v-model.trim="row.channel" maxlength="40" placeholder="填写渠道名称" :disabled="section.key === 'large'" @input="section.key === 'small' && syncChannelNames()" /></td> <td class="col-channel"><el-input v-model.trim="row.channel" maxlength="40" placeholder="填写渠道名称" /></td>
<td v-for="dimension in rows" :key="dimension.key"> <td v-for="dimension in rows" :key="dimension.key" class="col-dimension">
<el-input-number v-model="scoreFor(row, dimension.key).score" :min="0" :max="10" :precision="0" controls-position="right" /> <el-input-number v-model="scoreFor(row, dimension.key).score" :min="0" :max="10" :precision="0" controls-position="right" />
</td> </td>
<td class="total-score">{{ weightedScore(row, section.weights) }}</td> <td class="total-score col-total col-total-small">{{ weightedScore(row, 'smallBatch') }}</td>
<td class="total-score col-total col-total-large">{{ weightedScore(row, 'largeBatch') }}</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@ -268,15 +279,18 @@ function normalizeScores(source = {}) {
}, {}); }, {});
} }
function createScoreRows(savedRows = []) { function createChannelRows(smallSaved = [], largeSaved = []) {
const source = Array.isArray(savedRows) ? savedRows : []; const small = Array.isArray(smallSaved) ? smallSaved : [];
const large = Array.isArray(largeSaved) ? largeSaved : [];
return Array.from({ length: 5 }, (_, index) => { return Array.from({ length: 5 }, (_, index) => {
const saved = source[index] || {}; const s = small[index] || {};
const l = large[index] || {};
return { return {
id: `${Date.now()}-${index}-${Math.random().toString(16).slice(2)}`, id: `${Date.now()}-${index}-${Math.random().toString(16).slice(2)}`,
channel: String(saved.channel || ""), channel: String(s.channel || l.channel || ""),
scores: normalizeScores(saved.scores), scores: normalizeScores(s.scores ?? l.scores),
weightedTotal: saved.weightedTotal ?? null, smallWeightedTotal: s.weightedTotal ?? null,
largeWeightedTotal: l.weightedTotal ?? null,
}; };
}); });
} }
@ -302,8 +316,7 @@ function createRiskRows(savedRows = []) {
})); }));
} }
const smallBatchRows = ref(createScoreRows()); const channelRows = ref(createChannelRows());
const largeBatchRows = ref(createScoreRows());
const scenarioAnalyses = ref(createScenarioAnalyses()); const scenarioAnalyses = ref(createScenarioAnalyses());
const procurementRecommendation = ref(""); const procurementRecommendation = ref("");
const riskRows = ref(createRiskRows()); const riskRows = ref(createRiskRows());
@ -312,16 +325,12 @@ const smallWeightTotal = computed(() => rows.value.reduce((sum, row) => sum + Nu
const largeWeightTotal = computed(() => rows.value.reduce((sum, row) => sum + Number(row.largeBatchWeight || 0), 0)); const largeWeightTotal = computed(() => rows.value.reduce((sum, row) => sum + Number(row.largeBatchWeight || 0), 0));
const smallWeights = computed(() => rows.value.reduce((result, row) => ({ ...result, [row.key]: Number(row.smallBatchWeight || 0) }), {})); const smallWeights = computed(() => rows.value.reduce((result, row) => ({ ...result, [row.key]: Number(row.smallBatchWeight || 0) }), {}));
const largeWeights = computed(() => rows.value.reduce((result, row) => ({ ...result, [row.key]: Number(row.largeBatchWeight || 0) }), {})); const largeWeights = computed(() => rows.value.reduce((result, row) => ({ ...result, [row.key]: Number(row.largeBatchWeight || 0) }), {}));
const scoreSections = computed(() => [
{ key: "small", label: "场景 A", title: "小批量试产(100台)渠道评分", rows: smallBatchRows.value, weights: smallWeights.value },
{ key: "large", label: "场景 B", title: "大规模量产(10000台)渠道评分", rows: largeBatchRows.value, weights: largeWeights.value },
]);
function scoreFor(row, key) { function scoreFor(row, key) {
if (!Object.prototype.hasOwnProperty.call(row.scores, key)) row.scores[key] = 0; if (!Object.prototype.hasOwnProperty.call(row.scores, key)) row.scores[key] = 0;
return { return {
get score() { return row.scores[key]; }, get score() { return row.scores[key]; },
set score(value) { row.scores[key] = value; row.weightedTotal = null; }, set score(value) { row.scores[key] = value; row.smallWeightedTotal = null; row.largeWeightedTotal = null; },
}; };
} }
@ -330,18 +339,18 @@ function toNumber(value) {
return Number.isFinite(numeric) ? numeric : 0; return Number.isFinite(numeric) ? numeric : 0;
} }
function weightedScore(row, weights) { function weightedScore(row, scenario) {
const weights = scenario === "smallBatch" ? smallWeights.value : largeWeights.value;
const score = rows.value.reduce((sum, item) => sum + toNumber(row.scores[item.key]) * toNumber(weights[item.key]) / 100, 0); const score = rows.value.reduce((sum, item) => sum + toNumber(row.scores[item.key]) * toNumber(weights[item.key]) / 100, 0);
return score.toFixed(2); return score.toFixed(2);
} }
function channelRanking(scenario) { function channelRanking(scenario) {
const source = scenario === "smallBatch" ? smallBatchRows.value : largeBatchRows.value; const storedKey = scenario === "smallBatch" ? "smallWeightedTotal" : "largeWeightedTotal";
const weights = scenario === "smallBatch" ? smallWeights.value : largeWeights.value; return channelRows.value
return source
.map((row) => { .map((row) => {
const stored = Number(row.weightedTotal); const stored = Number(row[storedKey]);
return { channel: String(row.channel || "").trim(), score: Number.isFinite(stored) ? stored : Number(weightedScore(row, weights)) }; return { channel: String(row.channel || "").trim(), score: Number.isFinite(stored) ? stored : Number(weightedScore(row, scenario)) };
}) })
.filter((item) => item.channel) .filter((item) => item.channel)
.sort((left, right) => right.score - left.score || left.channel.localeCompare(right.channel, "zh-CN")); .sort((left, right) => right.score - left.score || left.channel.localeCompare(right.channel, "zh-CN"));
@ -356,12 +365,6 @@ function formatScore(value) {
return Number.isFinite(score) ? score.toFixed(2) : "--"; return Number.isFinite(score) ? score.toFixed(2) : "--";
} }
function syncChannelNames() {
largeBatchRows.value.forEach((row, index) => {
row.channel = String(smallBatchRows.value[index]?.channel || "").trim();
});
}
function buildStepOnePayload() { function buildStepOnePayload() {
return { return {
items: rows.value.map((row) => ({ items: rows.value.map((row) => ({
@ -373,16 +376,17 @@ function buildStepOnePayload() {
} }
function buildStepTwoPayload() { function buildStepTwoPayload() {
const serializeChannels = (source) => source.map((row) => ({ const serializeChannels = (storedKey) => channelRows.value.map((row) => ({
channel: String(row.channel || "").trim(), channel: String(row.channel || "").trim(),
scores: rows.value.map((dimension) => ({ scores: rows.value.map((dimension) => ({
dimension: dimension.name, dimension: dimension.name,
score: toNumber(row.scores[dimension.key]), score: toNumber(row.scores[dimension.key]),
})), })),
weightedTotal: row[storedKey],
})); }));
return { return {
smallBatchChannels: serializeChannels(smallBatchRows.value), smallBatchChannels: serializeChannels("smallWeightedTotal"),
largeBatchChannels: serializeChannels(largeBatchRows.value), largeBatchChannels: serializeChannels("largeWeightedTotal"),
}; };
} }
@ -421,9 +425,7 @@ function applyStepOne(answer) {
function applyStepTwo(answer) { function applyStepTwo(answer) {
const result = parseJson(answer?.step2Answer); const result = parseJson(answer?.step2Answer);
if (!Array.isArray(result?.smallBatchChannels) || !Array.isArray(result?.largeBatchChannels)) return false; if (!Array.isArray(result?.smallBatchChannels) || !Array.isArray(result?.largeBatchChannels)) return false;
smallBatchRows.value = createScoreRows(result.smallBatchChannels); channelRows.value = createChannelRows(result.smallBatchChannels, result.largeBatchChannels);
largeBatchRows.value = createScoreRows(result.largeBatchChannels);
syncChannelNames();
return true; return true;
} }
@ -451,14 +453,11 @@ async function saveStepOne() {
async function saveStepTwo() { async function saveStepTwo() {
try { try {
syncChannelNames();
const result = (await validateSupplierEvaluationStepTwo(buildStepTwoPayload()))?.data || {}; const result = (await validateSupplierEvaluationStepTwo(buildStepTwoPayload()))?.data || {};
if (!result?.valid) throw new Error(result?.message || "渠道评分校验未通过"); if (!result?.valid) throw new Error(result?.message || "渠道评分校验未通过");
smallBatchRows.value = createScoreRows(result.smallBatchChannels); channelRows.value = createChannelRows(result.smallBatchChannels, result.largeBatchChannels);
largeBatchRows.value = createScoreRows(result.largeBatchChannels);
await saveStudentTrainingAnswer(TASK_KEY, { currentStep: 2, saveAction: "SAVE", progressStatus: "IN_PROGRESS", step2Answer: JSON.stringify({ weights: result.weights, smallBatchChannels: result.smallBatchChannels, largeBatchChannels: result.largeBatchChannels }) }); await saveStudentTrainingAnswer(TASK_KEY, { currentStep: 2, saveAction: "SAVE", progressStatus: "IN_PROGRESS", step2Answer: JSON.stringify({ weights: result.weights, smallBatchChannels: result.smallBatchChannels, largeBatchChannels: result.largeBatchChannels }) });
stepTwoSaved.value = true; stepTwoSaved.value = true;
syncChannelNames();
ElMessage.success("渠道评分已保存,可进入第 3 步形成采购建议"); ElMessage.success("渠道评分已保存,可进入第 3 步形成采购建议");
} catch (error) { } catch (error) {
ElMessage.error(error?.message || "保存失败,请检查渠道和评分"); ElMessage.error(error?.message || "保存失败,请检查渠道和评分");
@ -878,6 +877,35 @@ onMounted(async () => {
.score-table th:first-child, .score-table td:first-child { width: 175px; } .score-table th:first-child, .score-table td:first-child { width: 175px; }
.score-table :deep(.el-input-number) { width: 100%; } .score-table :deep(.el-input-number) { width: 100%; }
/* 合并评分表:双列组布局 */
.merged-score-table { min-width: 1080px; table-layout: fixed; }
.merged-score-table .col-channel { width: 150px; }
.merged-score-table .col-dimension { width: auto; }
.merged-score-table .col-total { width: 110px; }
/* 顶层分组表头:维度组中性底,总分组着色 */
.merged-score-table .group-header th {
text-align: center;
font-size: var(--student-fs-body-sm);
}
.merged-score-table .group-dimensions {
background: #fafbfc;
color: var(--student-text);
}
.merged-score-table .group-total { color: #ffffff; font-weight: 800; }
.merged-score-table .group-total-small { background: var(--student-accent); }
.merged-score-table .group-total-large { background: var(--student-accent-deep); }
/* 第二行子表头 */
.merged-score-table .col-dimension,
.merged-score-table .col-total { background: #fafbfc; }
.merged-score-table .col-total-small { color: var(--student-accent); }
.merged-score-table .col-total-large { color: var(--student-accent-deep); }
/* 列组竖向分隔线 */
.merged-score-table .col-channel,
.merged-score-table .col-total-small { border-right: 2px solid var(--student-panel-border); }
.total-score { .total-score {
color: var(--student-accent) !important; color: var(--student-accent) !important;
font-size: var(--student-fs-data); font-size: var(--student-fs-data);

Loading…
Cancel
Save