<template>
|
<div class="task-info-page">
|
<a-card>
|
<a-space style="margin-bottom: 16px">
|
<a-input-search
|
v-model:value="searchText"
|
placeholder="搜索任务号"
|
style="width: 200px"
|
@search="handleSearch"
|
/>
|
<a-select
|
v-model:value="statusFilter"
|
placeholder="任务状态"
|
style="width: 120px"
|
@change="handleSearch"
|
allowClear
|
>
|
<a-select-option :value="0">待处理</a-select-option>
|
<a-select-option :value="1">处理中</a-select-option>
|
<a-select-option :value="2">已完成</a-select-option>
|
<a-select-option :value="3">已取消</a-select-option>
|
</a-select>
|
</a-space>
|
|
<a-table
|
:columns="columns"
|
:data-source="dataSource"
|
:loading="loading"
|
:pagination="pagination"
|
@change="handleTableChange"
|
row-key="Id"
|
>
|
<template #bodyCell="{ column, record }">
|
<template v-if="column.key === 'TaskStatus'">
|
<a-tag :color="getStatusColor(record.TaskStatus)">
|
{{ getStatusText(record.TaskStatus) }}
|
</a-tag>
|
</template>
|
<template v-else-if="column.key === 'action'">
|
<a @click="handleView(record)">查看详情</a>
|
</template>
|
</template>
|
</a-table>
|
</a-card>
|
</div>
|
</template>
|
|
<script setup lang="ts">
|
import { ref, reactive, onMounted } from 'vue';
|
import { message } from 'ant-design-vue';
|
import type { TaskInfo } from '../../../types/common';
|
|
const columns = [
|
{ title: '任务号', dataIndex: 'TaskNo', key: 'TaskNo' },
|
{ title: '任务类型', dataIndex: 'TaskType', key: 'TaskType' },
|
{ title: '任务状态', dataIndex: 'TaskStatus', key: 'TaskStatus' },
|
{ title: '仓库编码', dataIndex: 'WarehouseCode', key: 'WarehouseCode' },
|
{ title: '创建时间', dataIndex: 'CreateDate', key: 'CreateDate' },
|
{ title: '创建人', dataIndex: 'Creator', key: 'Creator' },
|
{ title: '操作', key: 'action', width: 120 },
|
];
|
|
const dataSource = ref<TaskInfo[]>([]);
|
const loading = ref(false);
|
const searchText = ref('');
|
const statusFilter = ref<number>();
|
const pagination = reactive({
|
current: 1,
|
pageSize: 20,
|
total: 0,
|
showSizeChanger: true,
|
showTotal: (total: number) => `共 ${total} 条`,
|
});
|
|
onMounted(() => {
|
fetchData();
|
});
|
|
async function fetchData() {
|
loading.value = true;
|
try {
|
// 这里调用实际的 API
|
setTimeout(() => {
|
dataSource.value = [];
|
pagination.total = 0;
|
loading.value = false;
|
}, 500);
|
} catch (error) {
|
console.error('Fetch data error:', error);
|
loading.value = false;
|
}
|
}
|
|
function handleTableChange(pag: any) {
|
pagination.current = pag.current;
|
pagination.pageSize = pag.pageSize;
|
fetchData();
|
}
|
|
function handleSearch() {
|
pagination.current = 1;
|
fetchData();
|
}
|
|
function handleView(record: TaskInfo) {
|
message.info(`查看任务详情: ${record.TaskNo}`);
|
}
|
|
function getStatusColor(status?: number) {
|
const colorMap: Record<number, string> = {
|
0: 'default',
|
1: 'processing',
|
2: 'success',
|
3: 'error',
|
};
|
return colorMap[status || 0] || 'default';
|
}
|
|
function getStatusText(status?: number) {
|
const textMap: Record<number, string> = {
|
0: '待处理',
|
1: '处理中',
|
2: '已完成',
|
3: '已取消',
|
};
|
return textMap[status || 0] || '未知';
|
}
|
</script>
|
|
<style scoped>
|
.task-info-page {
|
padding: 0;
|
}
|
</style>
|