|
|
@@ -33,20 +33,16 @@
|
|
|
:name="item.taskName"
|
|
|
:defaultOpen="item.id === collapseList[0].id"
|
|
|
>
|
|
|
- <template #viewOperation>
|
|
|
- <div class="update-time-container">
|
|
|
- <span>发布时间:{{ item.updatedAt }}</span>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
<template #main-table>
|
|
|
<el-button
|
|
|
type="primary"
|
|
|
:icon="Plus"
|
|
|
class="main-table__button"
|
|
|
+ v-if="isOverdue(item.dueCompleteTime)"
|
|
|
@click="handleReport(item.id, item.taskName)"
|
|
|
>新增</el-button
|
|
|
>
|
|
|
- <BasicTable :tableData="item.tableData[0].disasterReportRecordDetailList" :tableConfig="tableConfig">
|
|
|
+ <BasicTable :tableData="item.tableData[0]?.disasterReportRecordDetailList" :tableConfig="tableConfig">
|
|
|
<template #affectedArea="scope">
|
|
|
<div class="affected-area-container">
|
|
|
<span>{{ scope.row.buildingNo }}-{{ scope.row.floorNo }}-{{ scope.row.roomNo }}</span>
|
|
|
@@ -83,7 +79,7 @@
|
|
|
<div class="action-container" v-if="scope.row.affectedItems">
|
|
|
<ActionButton
|
|
|
text="编辑"
|
|
|
- v-if="scope.row.fixStatus === FIX_STATUS.TO_BE_RECTIFIED"
|
|
|
+ v-if="isOverdue(scope.row.dueCompleteTime) && scope.row.fixStatus === FIX_STATUS.TO_BE_RECTIFIED"
|
|
|
@click="handleEdit(scope.row.id, item.id)"
|
|
|
/>
|
|
|
<ActionButton text="查看" />
|
|
|
@@ -95,8 +91,16 @@
|
|
|
</div>
|
|
|
<div class="action-container" v-else>
|
|
|
<ActionButton text="查看" v-if="scope.row.fixStatus === FIX_STATUS.TEMPORARY_CLOSED" />
|
|
|
- <ActionButton text="编辑" @click="handleEdit(scope.row.id, item.id)" v-if="scope.row.fixStatus !== FIX_STATUS.TEMPORARY_CLOSED" />
|
|
|
- <ActionButton text="删除" @click="handleDelete(scope.row.id)" v-if="scope.row.fixStatus !== FIX_STATUS.TEMPORARY_CLOSED" />
|
|
|
+ <ActionButton
|
|
|
+ text="编辑"
|
|
|
+ @click="handleEdit(scope.row.id, item.id)"
|
|
|
+ v-if="isOverdue(scope.row.dueCompleteTime) && scope.row.fixStatus !== FIX_STATUS.TEMPORARY_CLOSED"
|
|
|
+ />
|
|
|
+ <ActionButton
|
|
|
+ text="删除"
|
|
|
+ @click="handleDelete(scope.row.id)"
|
|
|
+ v-if="scope.row.fixStatus !== FIX_STATUS.TEMPORARY_CLOSED"
|
|
|
+ />
|
|
|
</div>
|
|
|
</template>
|
|
|
</BasicTable>
|
|
|
@@ -121,14 +125,14 @@
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
- import { ref, reactive, onMounted, nextTick } from 'vue';
|
|
|
+ import { ref, reactive, onMounted, nextTick, onUnmounted } from 'vue';
|
|
|
import { Plus } from '@element-plus/icons-vue';
|
|
|
import Search from '@/views/disaster/components/Search.vue';
|
|
|
import BasicTable from '@/components/BasicTable.vue';
|
|
|
import ActionButton from '@/components/ActionButton.vue';
|
|
|
import { getAllDepartments } from '@/api/auth/dept';
|
|
|
import CollapseItem from './CollapseItem.vue';
|
|
|
- import { DEFAULT_PAGE_SIZE, DISASTER_CONTROL_PAGE_SIZE_CONFIG, IS_LOSS, FIX_STATUS } from '../constant';
|
|
|
+ import { DEFAULT_PAGE_SIZE, DISASTER_CONTROL_PAGE_SIZE_CONFIG, FIX_STATUS } from '../constant';
|
|
|
import type { DisposalManagementCollapseListResponse, LossRecordTableResponse } from '@/types/disaster-control';
|
|
|
import { getReportTaskList, getLossRecordTableData, deleteLossRecord } from '@/api/disaster-control';
|
|
|
import {
|
|
|
@@ -157,7 +161,7 @@
|
|
|
const { tableConfig } = useTableConfig(LOSS_RECORD_TABLE_COLUMNS, DISPOSAL_MANAGEMENT_TABLE_OPTIONS, false);
|
|
|
const searchData = reactive({
|
|
|
handleDeptIds: [],
|
|
|
- fixStatus: '',
|
|
|
+ fixStatus: null,
|
|
|
});
|
|
|
const handleSearch = () => {
|
|
|
getDisposalTableData();
|
|
|
@@ -173,9 +177,11 @@
|
|
|
queryParam: {},
|
|
|
});
|
|
|
collapseList.value = res.records.map((item) => ({
|
|
|
- id: item.handleTaskId,
|
|
|
+ id: item.id,
|
|
|
+ handleTaskId: item.handleTaskId,
|
|
|
taskName: item.taskName,
|
|
|
updatedAt: item.updatedAt,
|
|
|
+ dueCompleteTime: item.dueCompleteTime,
|
|
|
tableData: [
|
|
|
{
|
|
|
handleTaskId: item.handleTaskId,
|
|
|
@@ -200,7 +206,7 @@
|
|
|
...(handleDeptIds.length > 0 ? { handleDeptIds } : {}),
|
|
|
});
|
|
|
collapseList.value.forEach((item) => {
|
|
|
- item.tableData = res.filter((tableItem) => tableItem.handleTaskId === item.id);
|
|
|
+ item.tableData = res.filter((tableItem) => tableItem.handleTaskId === item.handleTaskId);
|
|
|
});
|
|
|
tableConfig.loading = false;
|
|
|
};
|
|
|
@@ -247,6 +253,18 @@
|
|
|
await getDisposalTableData();
|
|
|
ElMessage.success('删除成功');
|
|
|
};
|
|
|
+ // 添加刷新时间变量,用于触发视图更新
|
|
|
+ const refreshTime = ref(Date.now());
|
|
|
+ let refreshTimer: number | null = null;
|
|
|
+ // 判断是否超过应完成时间
|
|
|
+ const isOverdue = (dueCompleteTime: string) => {
|
|
|
+ if (!dueCompleteTime) return false;
|
|
|
+
|
|
|
+ const dueTime = new Date(dueCompleteTime).getTime();
|
|
|
+ const currentTime = refreshTime.value;
|
|
|
+
|
|
|
+ return currentTime < dueTime;
|
|
|
+ };
|
|
|
|
|
|
onMounted(async () => {
|
|
|
const result = await getAllDepartments();
|
|
|
@@ -254,6 +272,17 @@
|
|
|
getPriorityDict();
|
|
|
await getDisposalData();
|
|
|
await getDisposalTableData();
|
|
|
+ // 设置定时器,每秒更新一次时间
|
|
|
+ refreshTimer = window.setInterval(() => {
|
|
|
+ refreshTime.value = Date.now();
|
|
|
+ }, 1000);
|
|
|
+ });
|
|
|
+
|
|
|
+ onUnmounted(() => {
|
|
|
+ if (refreshTimer !== null) {
|
|
|
+ clearInterval(refreshTimer);
|
|
|
+ refreshTimer = null;
|
|
|
+ }
|
|
|
});
|
|
|
</script>
|
|
|
|