增加新的列

This commit is contained in:
zhx 2026-05-23 21:27:23 +08:00
parent 8677241ae8
commit 2ff4c11f0a

View File

@ -17,6 +17,7 @@ import {
} from 'antdv-next'; } from 'antdv-next';
import UserProfileLink from './components/user-profile-link.vue'; import UserProfileLink from './components/user-profile-link.vue';
import { CP_RELATION_TYPE_OPTIONS } from './constants';
defineOptions({ name: 'OperateCpApply' }); defineOptions({ name: 'OperateCpApply' });
@ -33,6 +34,10 @@ const statusFilterOptions = STATUS_OPTIONS.map(({ label, value }) => ({
value, value,
})); }));
const cpRelationTypeLabelMap = new Map(
CP_RELATION_TYPE_OPTIONS.map((item) => [item.value, item.name]),
);
const loading = ref(false); const loading = ref(false);
const total = ref(0); const total = ref(0);
const list = ref<Array<Record<string, any>>>([]); const list = ref<Array<Record<string, any>>>([]);
@ -64,6 +69,7 @@ const columns: any[] = [
title: '金额', title: '金额',
width: 120, width: 120,
}, },
{ dataIndex: 'relationType', key: 'relationType', title: '关系类型', width: 120 },
{ dataIndex: 'status', key: 'status', title: '状态', width: 120 }, { dataIndex: 'status', key: 'status', title: '状态', width: 120 },
{ dataIndex: 'time', key: 'time', title: '时间', width: 220 }, { dataIndex: 'time', key: 'time', title: '时间', width: 220 },
]; ];
@ -77,6 +83,11 @@ function getStatusMeta(status?: string) {
); );
} }
function getCpRelationTypeName(relationType?: string) {
const value = relationType || 'CP';
return cpRelationTypeLabelMap.get(value) || value || '-';
}
async function loadData(reset = false) { async function loadData(reset = false) {
if (reset) { if (reset) {
query.cursor = 1; query.cursor = 1;
@ -137,7 +148,7 @@ void loadData(true);
:loading="loading" :loading="loading"
:pagination="false" :pagination="false"
row-key="id" row-key="id"
:scroll="{ x: 1060 }" :scroll="{ x: 1180 }"
> >
<template #bodyCell="{ column, record }"> <template #bodyCell="{ column, record }">
<template v-if="column.key === 'sendApplyUser'"> <template v-if="column.key === 'sendApplyUser'">
@ -151,6 +162,9 @@ void loadData(true);
{{ getStatusMeta(record.status).label }} {{ getStatusMeta(record.status).label }}
</Tag> </Tag>
</template> </template>
<template v-else-if="column.key === 'relationType'">
<Tag>{{ getCpRelationTypeName(record.relationType) }}</Tag>
</template>
<template v-else-if="column.key === 'time'"> <template v-else-if="column.key === 'time'">
<div>创建: {{ formatDate(record.createTime) }}</div> <div>创建: {{ formatDate(record.createTime) }}</div>
<div>修改: {{ formatDate(record.updateTime) }}</div> <div>修改: {{ formatDate(record.updateTime) }}</div>