|
|
@@ -11,7 +11,7 @@
|
|
|
class="disaster-precaution__header--button"
|
|
|
:icon="Plus"
|
|
|
v-if="disposalManagementPermissions"
|
|
|
- @click="handleCreateDisposalManagement(FORM_OPERATE_TYPE.TASK_ITEM)"
|
|
|
+ @click="handleCreateDisposalManagement"
|
|
|
>
|
|
|
创建灾害处置任务
|
|
|
</el-button>
|
|
|
@@ -33,133 +33,140 @@
|
|
|
</template>
|
|
|
</Search>
|
|
|
</header>
|
|
|
- <div
|
|
|
- class="collapse-container"
|
|
|
- v-loading="collapseLoading"
|
|
|
- :class="disposalManagementPermissions ? 'collapse-container--permission' : 'collapse-container--default'"
|
|
|
- >
|
|
|
- <div class="empty-container" v-if="collapseList.length === 0">
|
|
|
- <img :src="Empty" />
|
|
|
- <span>暂无数据</span>
|
|
|
- </div>
|
|
|
- <template v-else>
|
|
|
- <CollapseItem
|
|
|
- v-for="item in collapseList"
|
|
|
- :key="item.id"
|
|
|
- :name="item.taskName"
|
|
|
- :defaultOpen="item.id === defaultOpenId"
|
|
|
- >
|
|
|
- <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>
|
|
|
- <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
|
|
|
- class="dot"
|
|
|
- :style="{ backgroundColor: ACTIVE_STATUS_COLOR[scope.row.status as ACTIVE_STATUS] }"
|
|
|
- />
|
|
|
- <span>{{ ACTIVE_STATUS_MAP[scope.row.status] }}</span>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- <template #taskStage="scope">
|
|
|
- <span>{{ getTaskStage(scope.row.taskStage) }}</span>
|
|
|
- </template>
|
|
|
- <template #reportPrincipals="scope">
|
|
|
- <p v-for="user in scope.row.reportPrincipalInfoList" :key="user.reportPrincipalId">
|
|
|
- {{ user.reportPrincipalName }}({{ user.reportPrincipalStaffNo }})
|
|
|
- </p>
|
|
|
- </template>
|
|
|
- <template #action="scope">
|
|
|
- <ActionButton
|
|
|
- text="编辑"
|
|
|
- v-if="scope.row.status === ACTIVE_STATUS.NOT_EFFECTIVE && disposalManagementPermissions"
|
|
|
- @click="handleEditDisposalManagement(scope.row.id)"
|
|
|
- />
|
|
|
- <ActionButton
|
|
|
- text="发布"
|
|
|
- :popconfirm="{
|
|
|
- title: '确定发布吗?',
|
|
|
- }"
|
|
|
- v-if="scope.row.status === ACTIVE_STATUS.NOT_EFFECTIVE && disposalManagementPermissions"
|
|
|
- />
|
|
|
- <ActionButton
|
|
|
- text="撤回"
|
|
|
- :popconfirm="{
|
|
|
- title: '确定撤回吗?',
|
|
|
- }"
|
|
|
- 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"
|
|
|
+ <section class="disaster-precaution__section">
|
|
|
+ <div
|
|
|
+ class="collapse-container"
|
|
|
+ v-loading="collapseLoading"
|
|
|
+ :class="disposalManagementPermissions ? 'collapse-container--permission' : 'collapse-container--default'"
|
|
|
+ >
|
|
|
+ <div class="empty-container" v-if="collapseList.length === 0">
|
|
|
+ <img :src="Empty" />
|
|
|
+ <span>暂无数据</span>
|
|
|
+ </div>
|
|
|
+ <template v-else>
|
|
|
+ <CollapseItem
|
|
|
+ ref="collapseItemRef"
|
|
|
+ v-for="item in collapseList"
|
|
|
+ :key="item.id"
|
|
|
+ :name="item.taskName"
|
|
|
+ :defaultOpen="item.id === collapseList[0].id"
|
|
|
+ >
|
|
|
+ <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)"
|
|
|
/>
|
|
|
- <ActionButton text="查看" v-if="scope.row.status === ACTIVE_STATUS.ACTIVE" />
|
|
|
- </template>
|
|
|
- </BasicTable>
|
|
|
- </template>
|
|
|
- </CollapseItem>
|
|
|
- </template>
|
|
|
- </div>
|
|
|
- <div class="pagination-container" v-if="collapseList.length > 0">
|
|
|
- <el-pagination
|
|
|
- :current-page="currentPage"
|
|
|
- :page-size="pageSize"
|
|
|
- :page-sizes="DISASTER_CONTROL_PAGE_SIZE_CONFIG"
|
|
|
- layout="prev, pager, next, jumper, sizes, total"
|
|
|
- background
|
|
|
- :total="total"
|
|
|
- @size-change="handleSizeChange"
|
|
|
- @current-change="handleCurrentChange"
|
|
|
- />
|
|
|
- </div>
|
|
|
+ </el-tooltip>
|
|
|
+ </template>
|
|
|
+ <template #batchOperation v-if="disposalManagementPermissions">
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ v-if="isBatchRelease(item.tableData[0].disasterReportTaskInfoList)"
|
|
|
+ @click.stop="handleBatchRelease(item.id)"
|
|
|
+ >发布
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ v-if="isBatchWithdraw(item.tableData[0].disasterReportTaskInfoList)"
|
|
|
+ @click.stop="handleBatchWithdraw(item.id)"
|
|
|
+ >撤回
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ v-if="isBatchDelete(item.tableData[0].disasterReportTaskInfoList)"
|
|
|
+ @click.stop="handleBatchDelete(item.id)"
|
|
|
+ >删除
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ <template #main-table>
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ :icon="Plus"
|
|
|
+ class="main-table__button"
|
|
|
+ @click="handleCreateReportTask(item.id, item.taskName)"
|
|
|
+ >新增</el-button
|
|
|
+ >
|
|
|
+ <BasicTable :tableData="item.tableData[0].disasterReportTaskInfoList" :tableConfig="tableConfig">
|
|
|
+ <template #status="scope">
|
|
|
+ <div class="active-status--div">
|
|
|
+ <div
|
|
|
+ class="dot"
|
|
|
+ :style="{ backgroundColor: ACTIVE_STATUS_COLOR[scope.row.status as ACTIVE_STATUS] }"
|
|
|
+ />
|
|
|
+ <span>{{ ACTIVE_STATUS_MAP[scope.row.status] }}</span>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <template #taskStage="scope">
|
|
|
+ <span>{{ getTaskStage(scope.row.taskStage) }}</span>
|
|
|
+ </template>
|
|
|
+ <template #reportPrincipals="scope">
|
|
|
+ <p v-for="user in scope.row.reportPrincipalInfoList" :key="user.reportPrincipalId">
|
|
|
+ {{ user.reportPrincipalName }}({{ user.reportPrincipalStaffNo }})
|
|
|
+ </p>
|
|
|
+ </template>
|
|
|
+ <template #action="scope">
|
|
|
+ <ActionButton
|
|
|
+ text="编辑"
|
|
|
+ v-if="disposalManagementPermissions && scope.row.status === ACTIVE_STATUS.NOT_EFFECTIVE"
|
|
|
+ @click="handleEditReportTask(item.id, scope.row.id)"
|
|
|
+ />
|
|
|
+ <ActionButton
|
|
|
+ text="发布"
|
|
|
+ :popconfirm="{
|
|
|
+ title: '确定发布吗?',
|
|
|
+ }"
|
|
|
+ @confirm="handlePublishReportTask(scope.row.id, item.id)"
|
|
|
+ v-if="disposalManagementPermissions && scope.row.status === ACTIVE_STATUS.NOT_EFFECTIVE"
|
|
|
+ />
|
|
|
+ <ActionButton
|
|
|
+ text="撤回"
|
|
|
+ :popconfirm="{
|
|
|
+ title: '确定撤回吗?',
|
|
|
+ }"
|
|
|
+ @confirm="handleWithdrawReportTask(scope.row.id, item.id)"
|
|
|
+ v-if="
|
|
|
+ disposalManagementPermissions &&
|
|
|
+ (scope.row.taskStage === TASK_STAGE.TO_BE_REPORTED ||
|
|
|
+ scope.row.taskStage === TASK_STAGE.OVERDUE)
|
|
|
+ "
|
|
|
+ />
|
|
|
+ <ActionButton
|
|
|
+ text="删除"
|
|
|
+ :popconfirm="{
|
|
|
+ title: '确定删除吗?',
|
|
|
+ }"
|
|
|
+ @confirm="handleDeleteReportTask(scope.row.id)"
|
|
|
+ v-if="disposalManagementPermissions && scope.row.status === ACTIVE_STATUS.NOT_EFFECTIVE"
|
|
|
+ />
|
|
|
+ <ActionButton text="查看" v-if="scope.row.status === ACTIVE_STATUS.ACTIVE" />
|
|
|
+ </template>
|
|
|
+ </BasicTable>
|
|
|
+ </template>
|
|
|
+ </CollapseItem>
|
|
|
+ </template>
|
|
|
+ </div>
|
|
|
+ <div class="pagination-container" v-if="collapseList.length > 0">
|
|
|
+ <el-pagination
|
|
|
+ :current-page="currentPage"
|
|
|
+ :page-size="pageSize"
|
|
|
+ :page-sizes="DISASTER_CONTROL_PAGE_SIZE_CONFIG"
|
|
|
+ layout="prev, pager, next, jumper, sizes, total"
|
|
|
+ background
|
|
|
+ :total="total"
|
|
|
+ @size-change="handleSizeChange"
|
|
|
+ @current-change="handleCurrentChange"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </section>
|
|
|
</div>
|
|
|
</main>
|
|
|
</div>
|
|
|
@@ -171,13 +178,17 @@
|
|
|
import CollapseItem from './src/components/CollapseItem.vue';
|
|
|
import BasicTable from '@/components/BasicTable.vue';
|
|
|
import { getAllDepartments } from '@/api/auth/dept';
|
|
|
- import { onMounted, reactive, ref } from 'vue';
|
|
|
+ import { onMounted, reactive, ref, nextTick } from 'vue';
|
|
|
import { formatDeptTree } from '@/views/disaster/utils/formatDeptTree';
|
|
|
import type { DeptTreeItem } from '@/types/dept/type';
|
|
|
import {
|
|
|
getDisasterControlCollapseData,
|
|
|
getDisasterControlTableData,
|
|
|
+ publishDisasterHandleTask,
|
|
|
+ withdrawDisasterHandleTask,
|
|
|
deleteDisasterHandleTask,
|
|
|
+ deleteDisasterReportTask,
|
|
|
+ editDisasterReportTask,
|
|
|
} from '@/api/disaster-control';
|
|
|
import type { disasterReportTaskInfoListResponse } from '@/types/disaster-control';
|
|
|
import { DEFAULT_PAGE_SIZE, DISASTER_CONTROL_PAGE_SIZE_CONFIG, TASK_STAGE } from './src/constant';
|
|
|
@@ -202,11 +213,12 @@
|
|
|
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';
|
|
|
+ import { useMessageBox } from '@/views/disaster/hooks/messageBox';
|
|
|
import { ElMessage } from 'element-plus';
|
|
|
- const { permissions } = useUserInfoHook();
|
|
|
|
|
|
+ const { permissions } = useUserInfoHook();
|
|
|
+ const { openMessageBox } = useMessageBox();
|
|
|
const firstLevelDepts = ref<DeptTreeItem[]>([]);
|
|
|
const searchData = reactive({
|
|
|
reportDeptIds: [],
|
|
|
@@ -214,12 +226,12 @@
|
|
|
taskStage: '',
|
|
|
});
|
|
|
|
|
|
- const defaultOpenId = ref<number>();
|
|
|
const currentPage = ref(1);
|
|
|
const pageSize = ref(DEFAULT_PAGE_SIZE);
|
|
|
const total = ref(0);
|
|
|
|
|
|
const collapseLoading = ref(false);
|
|
|
+ const collapseItemRef = ref<InstanceType<typeof CollapseItem>[]>([]);
|
|
|
const collapseList = ref<DisposalManagementCollapseListResponse<DisposalManagementTableResponse>[]>([]);
|
|
|
const disposalManagementPermissions = ref(false);
|
|
|
|
|
|
@@ -245,25 +257,63 @@
|
|
|
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;
|
|
|
+ const handleCreateDisposalManagement = () => {
|
|
|
router.push({
|
|
|
- name: routerName,
|
|
|
+ name: Task_RouterName,
|
|
|
query: {
|
|
|
operate: 'create',
|
|
|
- taskName: taskName,
|
|
|
},
|
|
|
});
|
|
|
};
|
|
|
- const handleEditDisposalManagement = (id: number) => {
|
|
|
+ const handleCreateReportTask = (id: number, taskName: string) => {
|
|
|
router.push({
|
|
|
name: Table_RouterName,
|
|
|
+ params: {
|
|
|
+ id,
|
|
|
+ },
|
|
|
query: {
|
|
|
+ operate: 'create',
|
|
|
+ taskName,
|
|
|
+ },
|
|
|
+ });
|
|
|
+ };
|
|
|
+ const handleEditReportTask = (id: number, reportTaskId: number) => {
|
|
|
+ router.push({
|
|
|
+ name: Table_RouterName,
|
|
|
+ params: {
|
|
|
id,
|
|
|
+ },
|
|
|
+ query: {
|
|
|
+ reportTaskId,
|
|
|
operate: 'edit',
|
|
|
},
|
|
|
});
|
|
|
};
|
|
|
+ const handlePublishReportTask = async (id: number, handleTaskId: number) => {
|
|
|
+ await editDisasterReportTask({
|
|
|
+ id,
|
|
|
+ handleTaskId,
|
|
|
+ taskStage: TASK_STAGE.TO_BE_REPORTED,
|
|
|
+ status: ACTIVE_STATUS.ACTIVE,
|
|
|
+ });
|
|
|
+ ElMessage.success('发布成功');
|
|
|
+ await getDisposalTableData();
|
|
|
+ };
|
|
|
+ const handleWithdrawReportTask = async (id: number, handleTaskId: number) => {
|
|
|
+ await editDisasterReportTask({
|
|
|
+ id,
|
|
|
+ handleTaskId,
|
|
|
+ taskStage: TASK_STAGE.TO_BE_RELEASED,
|
|
|
+ status: ACTIVE_STATUS.NOT_EFFECTIVE,
|
|
|
+ });
|
|
|
+ ElMessage.success('已取消发布');
|
|
|
+ await getDisposalTableData();
|
|
|
+ };
|
|
|
+ const handleDeleteReportTask = async (id: number) => {
|
|
|
+ await deleteDisasterReportTask(id);
|
|
|
+ await getDisposalTableData();
|
|
|
+ ElMessage.success('删除成功');
|
|
|
+ };
|
|
|
|
|
|
const getDisposalData = async () => {
|
|
|
collapseLoading.value = true;
|
|
|
@@ -281,12 +331,12 @@
|
|
|
},
|
|
|
],
|
|
|
}));
|
|
|
- console.log(collapseList.value);
|
|
|
- defaultOpenId.value = collapseList.value[0].id;
|
|
|
- console.log('默认打开的ID' + defaultOpenId.value);
|
|
|
taskIds.value = collapseList.value.map((item) => item.id);
|
|
|
total.value = res.totalRow;
|
|
|
collapseLoading.value = false;
|
|
|
+ nextTick(() => {
|
|
|
+ collapseItemRef.value[0]?.openFirstCollapseItem();
|
|
|
+ });
|
|
|
};
|
|
|
|
|
|
const getDisposalTableData = async () => {
|
|
|
@@ -327,21 +377,27 @@
|
|
|
console.log('查看任务ID' + id);
|
|
|
};
|
|
|
|
|
|
- const handleBatchRelease = (disasterReportTaskInfoList: disasterReportTaskInfoListResponse[]) => {
|
|
|
- const batchReleaseIds = disasterReportTaskInfoList
|
|
|
- .filter((item) => item.taskStage === TASK_STAGE.TO_BE_RELEASED)
|
|
|
- .map((item) => item.reportTaskId);
|
|
|
- console.log(batchReleaseIds);
|
|
|
+ const handleBatchRelease = async (id: number) => {
|
|
|
+ const confirmed = await openMessageBox('确定发布吗?');
|
|
|
+ if (!confirmed) return;
|
|
|
+ await publishDisasterHandleTask(id);
|
|
|
+ ElMessage.success('发布成功');
|
|
|
+ await getDisposalData();
|
|
|
+ await getDisposalTableData();
|
|
|
};
|
|
|
|
|
|
- const handleBatchWithdraw = (disasterReportTaskInfoList: disasterReportTaskInfoListResponse[]) => {
|
|
|
- const batchWithdrawIds = disasterReportTaskInfoList
|
|
|
- .filter((item) => item.taskStage === TASK_STAGE.TO_BE_REPORTED || item.taskStage === TASK_STAGE.OVERDUE)
|
|
|
- .map((item) => item.reportTaskId);
|
|
|
- console.log(batchWithdrawIds);
|
|
|
+ const handleBatchWithdraw = async (id: number) => {
|
|
|
+ const confirmed = await openMessageBox('确定撤回吗?');
|
|
|
+ if (!confirmed) return;
|
|
|
+ await withdrawDisasterHandleTask(id);
|
|
|
+ ElMessage.success('撤回成功');
|
|
|
+ await getDisposalData();
|
|
|
+ await getDisposalTableData();
|
|
|
};
|
|
|
|
|
|
const handleBatchDelete = async (id: number) => {
|
|
|
+ const confirmed = await openMessageBox('确定删除吗?');
|
|
|
+ if (!confirmed) return;
|
|
|
await deleteDisasterHandleTask(id);
|
|
|
ElMessage.success('删除成功');
|
|
|
await getDisposalData();
|
|
|
@@ -363,9 +419,8 @@
|
|
|
@use '../style/disaster.scss' as *;
|
|
|
@use './src/style/collapse.scss' as *;
|
|
|
@use './src/style/common.scss' as *;
|
|
|
- @use './src/style/pagination.scss' as *;
|
|
|
- $collapse-container-height-default: calc(68vh - 13cpx);
|
|
|
- $collapse-container-height-permission: calc(63vh - 15cpx);
|
|
|
+ $collapse-container-height-default: calc(68vh - 43px);
|
|
|
+ $collapse-container-height-permission: calc(63vh - 45px);
|
|
|
.collapse-container {
|
|
|
&--permission {
|
|
|
height: $collapse-container-height-permission;
|
|
|
@@ -377,7 +432,7 @@
|
|
|
}
|
|
|
}
|
|
|
.collapse-item__icon {
|
|
|
- width: 20cpx;
|
|
|
+ width: 20px;
|
|
|
&--disabled {
|
|
|
cursor: not-allowed;
|
|
|
opacity: 0.5;
|