Commit bda2c6e0 by lijiabin

【需求 25171】fix: 案例库导入失败列表精确标红缺失字段

之前"文化主关键词"这一列漏了 v-if 判空,为空时会渲染出一个看起来像空
勾选框的 el-tag。顺带按后端新增的 errorFields(必填项校验失败的字段名
数组)实现按单元格精确标红,不再需要靠肉眼整行找哪个字段填错了。

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
parent f72cb397
...@@ -11,11 +11,20 @@ const handleContent = (content: string) => { ...@@ -11,11 +11,20 @@ const handleContent = (content: string) => {
confirmButtonText: '确定', confirmButtonText: '确定',
}) })
} }
// 后端返回 errorFields(必填项校验失败的字段名数组),按字段精确标红对应单元格,而不是整行飘红
const getCellStyle = ({ row, column }: { row: any; column: any }) => {
const errorFields = row.errorFields as string[] | undefined
if (column.property && errorFields?.includes(column.property)) {
return { backgroundColor: 'var(--el-color-danger-light-9)', color: 'var(--el-color-danger)' }
}
return {}
}
</script> </script>
<template> <template>
<el-dialog v-model="visible" title="以下数据导入失败" width="80vw"> <el-dialog v-model="visible" title="以下数据导入失败" width="80vw">
<el-table :data="errorList" style="width: 100%" height="500"> <el-table :data="errorList" :cell-style="getCellStyle" style="width: 100%" height="500">
<el-table-column prop="errorMsg" label="错误信息" width="200"></el-table-column> <el-table-column prop="errorMsg" label="错误信息" width="200"></el-table-column>
<el-table-column label="来源对象" align="center"> <el-table-column label="来源对象" align="center">
<el-table-column prop="jobNo" label="工号" width="120"></el-table-column> <el-table-column prop="jobNo" label="工号" width="120"></el-table-column>
...@@ -35,7 +44,7 @@ const handleContent = (content: string) => { ...@@ -35,7 +44,7 @@ const handleContent = (content: string) => {
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="文化关键词(次关键词选填)" align="center"> <el-table-column label="文化关键词(次关键词选填)" align="center">
<el-table-column label="主关键词" width="160"> <el-table-column prop="cultureMain" label="主关键词" width="160">
<template #default="{ row }"> <template #default="{ row }">
<el-tag v-if="row.cultureMain" type="primary"> {{ row.cultureMain }}</el-tag> <el-tag v-if="row.cultureMain" type="primary"> {{ row.cultureMain }}</el-tag>
</template> </template>
......
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