|
@@ -1,25 +1,14 @@
|
|
|
<template>
|
|
|
- <div class="duty-card">
|
|
|
- <ul class="tabs">
|
|
|
- <li v-for="(tab, index) in tabs" :key="index" :class="{ active: tab.id === activeTab }" @click="setActiveTab(tab.id)">
|
|
|
- {{ tab.label }}
|
|
|
- </li>
|
|
|
- </ul>
|
|
|
- <div class="card-content">
|
|
|
- <div v-if="activeTab === '任务追踪'" class="custom-table">
|
|
|
- <div class="table-content">
|
|
|
- <div v-for="(notification, index) in notifications" :key="index" class="tr">
|
|
|
- <div class="td">
|
|
|
- <div class="unit-date">
|
|
|
- <span class="unit">{{ notification.unit }}</span>
|
|
|
- <span class="date">{{ notification.date }}</span>
|
|
|
- <span class="status" :class="statusClasses[notification.status]">{{ notification.status }}</span>
|
|
|
- <button @click="updateTask(index)">更新</button>
|
|
|
- </div>
|
|
|
- <div class="content">{{ notification.content }}</div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
+ <div class="table-content">
|
|
|
+ <div v-for="(notification, index) in notifications" :key="index" class="tr">
|
|
|
+ <div class="td">
|
|
|
+ <div class="unit-date">
|
|
|
+ <span class="unit">{{ notification.unit }}</span>
|
|
|
+ <span class="date">{{ notification.date }}</span>
|
|
|
+ <span class="status" :class="statusClasses[notification.status]">{{ notification.status }}</span>
|
|
|
+ <button @click="updateTask(index)">更新</button>
|
|
|
</div>
|
|
|
+ <div class="content">{{ notification.content }}</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -27,33 +16,18 @@
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
import { onMounted, ref } from 'vue';
|
|
|
-import { selectTask, updateTask } from '@/api/emergencyCommandMap/JointDuty.ts'; // 确保API路径正确
|
|
|
+import { selectTask, updateTaskRegistration } from '@/api/emergencyCommandMap/JointDuty'; // 确保API路径正确
|
|
|
|
|
|
const props = defineProps<{
|
|
|
eventId?: string; // 使用可选属性
|
|
|
}>();
|
|
|
|
|
|
-// 输出 eventId 以验证是否正确获取
|
|
|
-console.log('Received eventId in RightTop:', props.eventId);
|
|
|
-
|
|
|
-// 定义 tabs
|
|
|
-const tabs = reactive([
|
|
|
- { id: '任务追踪', label: '任务追踪' },
|
|
|
- { id: '预案通知', label: '预案通知' },
|
|
|
- { id: '资源调度', label: '资源调度' }
|
|
|
-]);
|
|
|
-
|
|
|
-const activeTab = ref('任务追踪');
|
|
|
const notifications = ref([]);
|
|
|
const statusClasses = reactive({
|
|
|
'已完成': 'success',
|
|
|
'处理中': 'processing'
|
|
|
});
|
|
|
|
|
|
-const setActiveTab = (id) => {
|
|
|
- activeTab.value = id;
|
|
|
-};
|
|
|
-
|
|
|
// 请求数据
|
|
|
const fetchData = async () => {
|
|
|
try {
|
|
@@ -75,21 +49,11 @@ const fetchData = async () => {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
-// 更新任务列表
|
|
|
-// const updateTask = (tasks) => {
|
|
|
-// notifications.value = tasks.map((task) => ({
|
|
|
-// unit: tasks.unit_name,
|
|
|
-// date: tasks.update_time,
|
|
|
-// status: task.processing_status,
|
|
|
-// content: task.task_description
|
|
|
-// }));
|
|
|
-// };
|
|
|
-
|
|
|
// 更新任务
|
|
|
const updateTask = async (index) => {
|
|
|
try {
|
|
|
const task = notifications.value[index];
|
|
|
- const response = await updateTask(task);
|
|
|
+ const response = await updateTaskRegistration(task);
|
|
|
|
|
|
if (response.code === 200) {
|
|
|
console.log('任务更新成功');
|