@@ -182,22 +175,22 @@ watchEffect(() => {
// 监听选中项变化
watch(selectedRowKeys, (newKeys) => {
const filteredData = materialData.value.filter((item) => newKeys.includes(item.id));
+ choseText.value = filteredData.length + '个稿件';
+ // // 统计各类型数量
+ // const typeCount = filteredData.reduce((acc, item) => {
+ // const typeKey = item.type === EnumManuscriptType.Image ? 'image' : 'video';
+ // acc[typeKey] = (acc[typeKey] || 0) + 1;
+ // return acc;
+ // }, {});
- // 统计各类型数量
- const typeCount = filteredData.reduce((acc, item) => {
- const typeKey = item.type === EnumManuscriptType.Image ? 'image' : 'video';
- acc[typeKey] = (acc[typeKey] || 0) + 1;
- return acc;
- }, {});
+ // // 生成选中文本
+ // choseText.value = [];
+ // if (typeCount.image) choseText.value.push(`图文: ${typeCount.image}个`);
+ // if (typeCount.video) choseText.value.push(`视频: ${typeCount.video}个`);
+ // choseText.value = choseText.value.join(' ');
- // 生成选中文本
- choseText.value = [];
- if (typeCount.image) choseText.value.push(`图文: ${typeCount.image}个`);
- if (typeCount.video) choseText.value.push(`视频: ${typeCount.video}个`);
- choseText.value = choseText.value.join(' ');
-
- // 筛选选中的内容用于预览
- choseImgArray.value = filteredData;
+ // // 筛选选中的内容用于预览
+ // choseImgArray.value = filteredData;
});
// 格式化审核状态显示
diff --git a/src/views/property-marketing/assignment-management/components/raw-material-drawer.vue b/src/views/property-marketing/assignment-management/components/raw-material-drawer.vue
index a059a3b..18e5688 100644
--- a/src/views/property-marketing/assignment-management/components/raw-material-drawer.vue
+++ b/src/views/property-marketing/assignment-management/components/raw-material-drawer.vue
@@ -22,7 +22,11 @@
>
-
![类型图标]()
+
{{ record.name }}
{{ record.uid }}
@@ -72,6 +76,15 @@
class="w-44px h-44px border-rounded-8px bg-#F0EDFF"
/>
+
@@ -94,6 +107,7 @@ import icon2 from '@/assets/img/creative-generation-workshop/icon-photo.png';
import icon3 from '@/assets/img/creative-generation-workshop/icon-video.png';
import icon4 from '@/assets/img/error-img.png';
import { RawMaterialType } from '@/views/material-center/components/raw-material/constants';
+import icon5 from '../../../../views/material-center/components/raw-material/img/icon-no-text.png';
// 定义Props
const props = defineProps({
visible: {
@@ -133,14 +147,27 @@ const getOrigin = (origin: number): string => {
};
return fromMap[origin] || '未知';
};
-// 定义Emits
-const emit = defineEmits(['update:visible', 'after-visible-change', 'confirm', 'cancel']);
-
+// 定义Emits类型
+const emit = defineEmits<{
+ (e: 'update:visible', value: boolean): void;
+ (e: 'after-visible-change', visible: boolean): void;
+ (
+ e: 'confirm',
+ data: {
+ selectedKeys: string[];
+ selectedData: any[];
+ choseText: string;
+ choseImgArray: any[];
+ selectedTexts: string[];
+ },
+ ): void;
+ (e: 'cancel'): void;
+}>();
// 内部状态管理
const materialData = ref([]);
const choseText = ref('');
const choseImgArray = ref([]);
-
+const choseTextArray = ref([]);
// 表格列配置
const columns = ref([
{ title: '文件名称', dataIndex: 'name', width: 200, slots: { customRender: 'name' } },
@@ -188,21 +215,20 @@ watchEffect(() => {
watch(selectedRowKeys, (newKeys) => {
const filteredData = materialData.value.filter((item) => newKeys.includes(item.id));
- // 统计各类型数量
- const typeCount = filteredData.reduce((acc, item) => {
- const typeKey = item.type === EnumManuscriptType.Image ? 'image' : 'video';
- acc[typeKey] = (acc[typeKey] || 0) + 1;
- return acc;
- }, {});
+ const typeCount: Record = {};
+ filteredData.forEach((item) => {
+ typeCount[item.type] = (typeCount[item.type] || 0) + 1;
+ });
- // 生成选中文本
- choseText.value = [];
- if (typeCount.image) choseText.value.push(`图文: ${typeCount.image}个`);
- if (typeCount.video) choseText.value.push(`视频: ${typeCount.video}个`);
- choseText.value = choseText.value.join(' ');
+ choseText.value = Object.entries(typeCount)
+ .map(([type, count]) => {
+ const typeName = getType(Number(type));
+ return `${typeName}: ${count}个`;
+ })
+ .join(' ');
- // 筛选选中的内容用于预览
- choseImgArray.value = filteredData;
+ choseImgArray.value = filteredData.filter((item) => [0, 1].includes(item.type));
+ choseTextArray.value = filteredData.filter((item) => [2].includes(item.type));
});
// 格式化审核状态显示
@@ -250,11 +276,15 @@ const handleCancel = () => {
// 确定按钮处理
const handleOk = () => {
const selectedData = materialData.value.filter((item) => selectedRowKeys.value.includes(item.id));
+ const selectedTexts = selectedData
+ .filter((item) => item.type === RawMaterialType.Text)
+ .map((item) => item.content || item.name);
emit('confirm', {
selectedKeys: selectedRowKeys.value,
selectedData,
choseText: choseText.value,
choseImgArray: choseImgArray.value,
+ selectedTexts: selectedTexts,
});
emit('update:visible', false);
};