选中提示
This commit is contained in:
@ -187,6 +187,18 @@
|
||||
@page-size-change="onPageSizeChange"
|
||||
/>
|
||||
</div>
|
||||
<template #footer>
|
||||
<div class="flex items-center justify-between">
|
||||
<div class="flex items-center">
|
||||
<div class="color-#737478 font-size-14px">已选择:</div>
|
||||
<div class="color-#737478 font-size-14px">{{ choseText }}</div>
|
||||
</div>
|
||||
<div class="flex justify-end">
|
||||
<Button @click="handleCancel">取消</Button>
|
||||
<Button class="ml-16px" type="primary" @click="handleOk">确定</Button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</a-drawer>
|
||||
</a-drawer>
|
||||
</template>
|
||||
@ -200,7 +212,7 @@ import dayjs from 'dayjs';
|
||||
import { getRawMaterialsPage } from '@/api/all/generationWorkshop';
|
||||
// 工具引入
|
||||
import { useTableSelectionWithPagination } from '@/hooks/useTableSelectionWithPagination';
|
||||
|
||||
const choseText = ref('');
|
||||
const columns = ref([
|
||||
{
|
||||
title: '文件名称',
|
||||
@ -239,6 +251,18 @@ const { pageInfo, onPageChange, onPageSizeChange, rowSelection, selectedRowKeys
|
||||
watch(selectedRowKeys, (newVal) => {
|
||||
console.log(newVal);
|
||||
query.ids = newVal;
|
||||
const filteredData = materialData.value.filter((item) => newVal.includes(item.id));
|
||||
choseText.value = '';
|
||||
const typeCount = filteredData.reduce((acc, item) => {
|
||||
acc[item.type] = (acc[item.type] || 0) + 1;
|
||||
return acc;
|
||||
}, {});
|
||||
console.log('+++++', typeCount);
|
||||
Object.entries(typeCount).forEach(([type, count]) => {
|
||||
console.log('++++tyype', type, getType(type));
|
||||
console.log(`${getType(type)}: ${count}个`);
|
||||
choseText.value += `${getType(type)}: ${count}个 `;
|
||||
});
|
||||
});
|
||||
|
||||
// 定义props和emit
|
||||
@ -276,12 +300,19 @@ const publishOptions = ref([
|
||||
const publishType = ref('immediate');
|
||||
|
||||
const getType = (type) => {
|
||||
// 处理字符串和数字类型的type值
|
||||
switch (type) {
|
||||
case RawMaterialType.Image:
|
||||
case '0':
|
||||
case 0:
|
||||
return '图片';
|
||||
case RawMaterialType.Video:
|
||||
case '1':
|
||||
case 1:
|
||||
return '视频';
|
||||
case RawMaterialType.Text:
|
||||
case '2':
|
||||
case 2:
|
||||
return '文本';
|
||||
default:
|
||||
return '未知';
|
||||
|
||||
Reference in New Issue
Block a user