feat: 电影列表导出补充 11 个缺失字段

This commit is contained in:
2026-07-03 13:13:35 +08:00
parent 7f2e24155d
commit ebbd967664
+24 -2
View File
@@ -16,7 +16,7 @@
tips="请按照模板填写电影信息,名称为必填项" tips="请按照模板填写电影信息,名称为必填项"
/> />
<!-- 导出按钮 --> <!-- 导出按钮 -->
<cl-export-btn :columns="Table?.columns" filename="电影列表" /> <cl-export-btn :columns="exportColumns" filename="电影列表" />
<!-- 分类筛选 --> <!-- 分类筛选 -->
<cl-select <cl-select
:options="categoryOptions" :options="categoryOptions"
@@ -68,7 +68,7 @@ defineOptions({
import { useCrud, useTable, useUpsert } from '@cool-vue/crud'; import { useCrud, useTable, useUpsert } from '@cool-vue/crud';
import { useCool } from '/@/cool'; import { useCool } from '/@/cool';
import { h, reactive, ref } from 'vue'; import { computed, h, reactive, ref } from 'vue';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import { ElMessage } from 'element-plus'; import { ElMessage } from 'element-plus';
import FilmPosterEdit from '../../components/film-poster-edit.vue'; import FilmPosterEdit from '../../components/film-poster-edit.vue';
@@ -281,6 +281,28 @@ const Table = useTable({
] ]
}); });
// 导出列 - 包含表格列 + 额外字段(不在表格展示,导出时可选)
const exportColumns = computed(() => {
const cols: any[] = Table?.columns ? [...Table.columns] : [];
const base = cols.filter((e: any) => !['selection', 'expand', 'index', 'op'].includes(e.type));
base.push(
{ label: '国家', prop: 'country', width: 100 },
{ label: '语言', prop: 'language', width: 100 },
{ label: '主要人物', prop: 'mainCharacters', minWidth: 200 },
{ label: '内容简介', prop: 'synopsis', minWidth: 300 },
{ label: '背景故事', prop: 'backgroundStory', minWidth: 300 },
{ label: '荣誉', prop: 'honors', minWidth: 200 },
{ label: '亮点所在', prop: 'highlights', minWidth: 200 },
{ label: '为什么值得一看', prop: 'whyWorthWatching', minWidth: 300 },
{ label: '链接', prop: 'link', minWidth: 200 },
{ label: 'TMDB评分', prop: 'tmdbRating', width: 100 },
{ label: '更新时间', prop: 'updateTime', minWidth: 170 }
);
return base;
});
// cl-upsert 配置 - 新增/编辑表单 // cl-upsert 配置 - 新增/编辑表单
const Upsert = useUpsert({ const Upsert = useUpsert({
dialog: { dialog: {