|
|
@@ -11,6 +11,7 @@
|
|
|
class="disaster-precaution__header--button"
|
|
|
:icon="Plus"
|
|
|
v-if="disposalManagementPermissions"
|
|
|
+ @click="handleCreateDisposalManagement(FORM_OPERATE_TYPE.TASK_ITEM)"
|
|
|
>
|
|
|
创建灾害处置任务
|
|
|
</el-button>
|
|
|
@@ -47,10 +48,52 @@
|
|
|
:key="item.id"
|
|
|
:name="item.taskName"
|
|
|
:defaultOpen="item.id === 1"
|
|
|
- :disposalManagementPermissions="disposalManagementPermissions"
|
|
|
>
|
|
|
+ <template #viewOperation>
|
|
|
+ <el-tooltip
|
|
|
+ :content="isViewTask(item.tableData[0].disasterReportTaskInfoList) ? '查看' : '任务尚未发布'"
|
|
|
+ placement="top"
|
|
|
+ effect="light"
|
|
|
+ >
|
|
|
+ <img
|
|
|
+ :src="ViewDocument"
|
|
|
+ :class="[
|
|
|
+ 'collapse-item__icon',
|
|
|
+ { 'collapse-item__icon--disabled': !isViewTask(item.tableData[0].disasterReportTaskInfoList) },
|
|
|
+ ]"
|
|
|
+ @click.stop="isViewTask(item.tableData[0].disasterReportTaskInfoList) && handleViewTask(item.id)"
|
|
|
+ />
|
|
|
+ </el-tooltip>
|
|
|
+ </template>
|
|
|
+ <template #batchOperation v-if="disposalManagementPermissions">
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ v-if="isBatchRelease(item.tableData[0].disasterReportTaskInfoList)"
|
|
|
+ @click.stop="handleBatchRelease(item.tableData[0].disasterReportTaskInfoList)"
|
|
|
+ >发布
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ v-if="isBatchWithdraw(item.tableData[0].disasterReportTaskInfoList)"
|
|
|
+ @click.stop="handleBatchWithdraw(item.tableData[0].disasterReportTaskInfoList)"
|
|
|
+ >撤回
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ v-if="isBatchDelete(item.tableData[0].disasterReportTaskInfoList)"
|
|
|
+ @click.stop="handleBatchDelete(item.id)"
|
|
|
+ >删除
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
<template #main-table>
|
|
|
- <BasicTable :tableData="item.tableData" :tableConfig="tableConfig">
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ :icon="Plus"
|
|
|
+ class="main-table__button"
|
|
|
+ @click="handleCreateDisposalManagement(FORM_OPERATE_TYPE.TABLE_ITEM, item.taskName)"
|
|
|
+ >新增</el-button
|
|
|
+ >
|
|
|
+ <BasicTable :tableData="item.tableData[0].disasterReportTaskInfoList" :tableConfig="tableConfig">
|
|
|
<template #status="scope">
|
|
|
<div class="active-status--div">
|
|
|
<div
|
|
|
@@ -64,7 +107,7 @@
|
|
|
<span>{{ getTaskStage(scope.row.taskStage) }}</span>
|
|
|
</template>
|
|
|
<template #reportPrincipals="scope">
|
|
|
- <p v-for="user in scope.row.reportPrincipals" :key="user.id">
|
|
|
+ <p v-for="user in scope.row.reportPrincipalInfoList" :key="user.id">
|
|
|
{{ user.realname }}({{ user.username }})
|
|
|
</p>
|
|
|
</template>
|
|
|
@@ -85,10 +128,16 @@
|
|
|
:popconfirm="{
|
|
|
title: '确定撤回吗?',
|
|
|
}"
|
|
|
- v-if="scope.row.taskStage === TASK_STAGE.TO_BE_REPORTED && disposalManagementPermissions"
|
|
|
+ v-if="
|
|
|
+ scope.row.taskStage === TASK_STAGE.TO_BE_REPORTED ||
|
|
|
+ (TASK_STAGE.OVERDUE && disposalManagementPermissions)
|
|
|
+ "
|
|
|
/>
|
|
|
<ActionButton
|
|
|
text="删除"
|
|
|
+ :popconfirm="{
|
|
|
+ title: '确定删除吗?',
|
|
|
+ }"
|
|
|
v-if="scope.row.status === ACTIVE_STATUS.NOT_EFFECTIVE && disposalManagementPermissions"
|
|
|
/>
|
|
|
<ActionButton text="查看" v-if="scope.row.status === ACTIVE_STATUS.ACTIVE" />
|
|
|
@@ -126,8 +175,12 @@
|
|
|
import type { DeptTree } from '@/types/dept/type';
|
|
|
import { TASK_STAGE } from './src/constant';
|
|
|
import { getDisasterControlCollapseData, getDisasterControlTableData } from '@/api/disaster-control';
|
|
|
+ import type { disasterReportTaskInfoListResponse } from '@/types/disaster-control';
|
|
|
import { DEFAULT_PAGE_SIZE, DISASTER_CONTROL_PAGE_SIZE_CONFIG } from './src/constant';
|
|
|
- import type { DisposalManagementListResponse, DisposalManagementTableResponse } from '@/types/disaster-control';
|
|
|
+ import type {
|
|
|
+ DisposalManagementCollapseListResponse,
|
|
|
+ DisposalManagementTableResponse,
|
|
|
+ } from '@/types/disaster-control';
|
|
|
import useTableConfig from '@/hooks/useTableConfigHook';
|
|
|
import {
|
|
|
DISPOSAL_MANAGEMENT_SEARCH_CONFIG,
|
|
|
@@ -142,7 +195,10 @@
|
|
|
DISASTER_PERMISSIONS,
|
|
|
} from '@/views/disaster/constant';
|
|
|
import ActionButton from '@/components/ActionButton.vue';
|
|
|
+ import { useRouter } from 'vue-router';
|
|
|
import Empty from 'assets/images/empty@1X.png';
|
|
|
+ import ViewDocument from './src/svg/view-document.svg';
|
|
|
+ import { FORM_OPERATE_TYPE } from './src/constant';
|
|
|
import { useUserInfoHook } from '@/views/disaster/hooks/userInfo';
|
|
|
|
|
|
const { permissions } = useUserInfoHook();
|
|
|
@@ -159,24 +215,42 @@
|
|
|
const total = ref(0);
|
|
|
|
|
|
const collapseLoading = ref(false);
|
|
|
- const collapseList = ref<DisposalManagementListResponse<DisposalManagementTableResponse>[]>([]);
|
|
|
+ const collapseList = ref<DisposalManagementCollapseListResponse<DisposalManagementTableResponse>[]>([]);
|
|
|
const disposalManagementPermissions = ref(false);
|
|
|
|
|
|
const { tableConfig } = useTableConfig(DISPOSAL_MANAGEMENT_TABLE_COLUMNS, DISPOSAL_MANAGEMENT_TABLE_OPTIONS, false);
|
|
|
|
|
|
- const handleSizeChange = (size: number) => {
|
|
|
+ const handleSizeChange = async (size: number) => {
|
|
|
pageSize.value = size;
|
|
|
+ await getDisposalData();
|
|
|
+ await getDisposalTableData();
|
|
|
};
|
|
|
|
|
|
- const handleCurrentChange = (page: number) => {
|
|
|
+ const handleCurrentChange = async (page: number) => {
|
|
|
currentPage.value = page;
|
|
|
+ await getDisposalData();
|
|
|
+ await getDisposalTableData();
|
|
|
};
|
|
|
|
|
|
const handleSearch = () => {
|
|
|
- console.log(searchData);
|
|
|
+ getDisposalTableData();
|
|
|
};
|
|
|
|
|
|
const taskIds = ref<number[]>([]);
|
|
|
+ const router = useRouter();
|
|
|
+ const Task_RouterName = 'disaster-control-disposal-management-task-item';
|
|
|
+ const Table_RouterName = 'disaster-control-disposal-management-item';
|
|
|
+ const handleCreateDisposalManagement = (type: FORM_OPERATE_TYPE, taskName?: string) => {
|
|
|
+ const routerName = type === FORM_OPERATE_TYPE.TASK_ITEM ? Task_RouterName : Table_RouterName;
|
|
|
+ router.push({
|
|
|
+ name: routerName,
|
|
|
+ query: {
|
|
|
+ operate: 'create',
|
|
|
+ taskName: taskName,
|
|
|
+ },
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
const getDisposalData = async () => {
|
|
|
collapseLoading.value = true;
|
|
|
const res = await getDisasterControlCollapseData({
|
|
|
@@ -184,11 +258,16 @@
|
|
|
pageSize: pageSize.value,
|
|
|
queryParam: {},
|
|
|
});
|
|
|
- collapseList.value = res.records;
|
|
|
- collapseList.value.forEach((item) => {
|
|
|
- item.tableData = [];
|
|
|
- });
|
|
|
- taskIds.value = res.records.map((item) => item.id);
|
|
|
+ collapseList.value = res.records.map((item) => ({
|
|
|
+ ...item,
|
|
|
+ tableData: [
|
|
|
+ {
|
|
|
+ handleTaskId: item.id,
|
|
|
+ disasterReportTaskInfoList: [],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ }));
|
|
|
+ taskIds.value = collapseList.value.map((item) => item.id);
|
|
|
total.value = res.totalRow;
|
|
|
collapseLoading.value = false;
|
|
|
};
|
|
|
@@ -200,11 +279,49 @@
|
|
|
...searchData,
|
|
|
});
|
|
|
collapseList.value.forEach((item) => {
|
|
|
- item.tableData = res;
|
|
|
+ item.tableData = res.filter((tableItem) => tableItem.handleTaskId === item.id);
|
|
|
});
|
|
|
tableConfig.loading = false;
|
|
|
};
|
|
|
|
|
|
+ const isViewTask = (disasterReportTaskInfoList: disasterReportTaskInfoListResponse[]) => {
|
|
|
+ return disasterReportTaskInfoList.some((item) => item.status === ACTIVE_STATUS.ACTIVE);
|
|
|
+ };
|
|
|
+
|
|
|
+ const isBatchRelease = (disasterReportTaskInfoList: disasterReportTaskInfoListResponse[]) => {
|
|
|
+ return disasterReportTaskInfoList.some((item) => item.status === ACTIVE_STATUS.NOT_EFFECTIVE);
|
|
|
+ };
|
|
|
+
|
|
|
+ const isBatchWithdraw = (disasterReportTaskInfoList: disasterReportTaskInfoListResponse[]) => {
|
|
|
+ return disasterReportTaskInfoList.some((item) => item.status === ACTIVE_STATUS.ACTIVE);
|
|
|
+ };
|
|
|
+
|
|
|
+ const isBatchDelete = (disasterReportTaskInfoList: disasterReportTaskInfoListResponse[]) => {
|
|
|
+ return disasterReportTaskInfoList.every((item) => item.status === ACTIVE_STATUS.NOT_EFFECTIVE);
|
|
|
+ };
|
|
|
+
|
|
|
+ const handleViewTask = (id: number) => {
|
|
|
+ console.log('查看任务ID' + id);
|
|
|
+ };
|
|
|
+
|
|
|
+ const handleBatchRelease = (disasterReportTaskInfoList: disasterReportTaskInfoListResponse[]) => {
|
|
|
+ const batchReleaseIds = disasterReportTaskInfoList
|
|
|
+ .filter((item) => item.taskStage === TASK_STAGE.TO_BE_RELEASED)
|
|
|
+ .map((item) => item.id);
|
|
|
+ console.log(batchReleaseIds);
|
|
|
+ };
|
|
|
+
|
|
|
+ const handleBatchWithdraw = (disasterReportTaskInfoList: disasterReportTaskInfoListResponse[]) => {
|
|
|
+ const batchWithdrawIds = disasterReportTaskInfoList
|
|
|
+ .filter((item) => item.taskStage === TASK_STAGE.TO_BE_REPORTED || item.taskStage === TASK_STAGE.OVERDUE)
|
|
|
+ .map((item) => item.id);
|
|
|
+ console.log(batchWithdrawIds);
|
|
|
+ };
|
|
|
+
|
|
|
+ const handleBatchDelete = (id: number) => {
|
|
|
+ console.log('当前任务ID' + id);
|
|
|
+ };
|
|
|
+
|
|
|
onMounted(async () => {
|
|
|
const result = await getAllDepartments();
|
|
|
await getDisposalData();
|
|
|
@@ -239,4 +356,14 @@
|
|
|
max-height: $collapse-container-height-default;
|
|
|
}
|
|
|
}
|
|
|
+ .collapse-item__icon {
|
|
|
+ width: 20cpx;
|
|
|
+ &--disabled {
|
|
|
+ cursor: not-allowed;
|
|
|
+ opacity: 0.5;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .main-table__button {
|
|
|
+ margin-bottom: 10cpx;
|
|
|
+ }
|
|
|
</style>
|