|
|
@@ -0,0 +1,215 @@
|
|
|
+<template>
|
|
|
+ <div class="disaster-precaution-container">
|
|
|
+ <header class="disaster-precaution-container__header">
|
|
|
+ <span class="disaster-precaution-container__title">灾害处置管理</span>
|
|
|
+ </header>
|
|
|
+ <main class="disaster-precaution-container__main">
|
|
|
+ <div class="disaster-precaution">
|
|
|
+ <header class="disaster-precaution__header">
|
|
|
+ <el-button type="primary" class="disaster-precaution__header--button" :icon="Plus">
|
|
|
+ 创建灾害损失记录
|
|
|
+ </el-button>
|
|
|
+ <Search
|
|
|
+ :searchConfig="DISPOSAL_MANAGEMENT_SEARCH_CONFIG"
|
|
|
+ :searchData="searchData"
|
|
|
+ @update:searchData="handleSearch"
|
|
|
+ >
|
|
|
+ <template #reportDeptIds>
|
|
|
+ <el-select v-model="searchData.reportDeptIds" multiple placeholder="请选择上报单位" class="custom-select">
|
|
|
+ <el-option v-for="item in firstLevelDepts" :key="item.id" :label="item.deptName" :value="item.id" />
|
|
|
+ </el-select>
|
|
|
+ </template>
|
|
|
+ </Search>
|
|
|
+ </header>
|
|
|
+ <div class="collapse-container" v-loading="collapseLoading">
|
|
|
+ <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 === 1"
|
|
|
+ >
|
|
|
+ <template #main-table>
|
|
|
+ <BasicTable :tableData="item.tableData" :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>{{ formatTaskStage(scope.row.taskStage) }}</span>
|
|
|
+ </template>
|
|
|
+ <template #reportPrincipals="scope">
|
|
|
+ <p v-for="user in scope.row.reportPrincipals" :key="user.id">
|
|
|
+ {{ user.realname }}({{ user.username }})
|
|
|
+ </p>
|
|
|
+ </template>
|
|
|
+ <template #action="scope">
|
|
|
+ <ActionButton text="编辑" v-if="scope.row.status === ACTIVE_STATUS.NOT_EFFECTIVE" />
|
|
|
+ <ActionButton
|
|
|
+ text="发布"
|
|
|
+ :popconfirm="{
|
|
|
+ title: '确定发布吗?',
|
|
|
+ }"
|
|
|
+ v-if="scope.row.status === ACTIVE_STATUS.NOT_EFFECTIVE"
|
|
|
+ />
|
|
|
+ <ActionButton
|
|
|
+ text="撤回"
|
|
|
+ :popconfirm="{
|
|
|
+ title: '确定撤回吗?',
|
|
|
+ }"
|
|
|
+ v-if="scope.row.taskStage === TASK_STAGE.TO_BE_REPORTED"
|
|
|
+ />
|
|
|
+ <ActionButton text="删除" v-if="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>
|
|
|
+ </div>
|
|
|
+ </main>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup lang="ts">
|
|
|
+ import { Plus } from '@element-plus/icons-vue';
|
|
|
+ import Search from '@/views/disaster/components/Search.vue';
|
|
|
+ import CollapseItem from './src/components/CollapseItem.vue';
|
|
|
+ import BasicTable from '@/components/BasicTable.vue';
|
|
|
+ import { DISPOSAL_MANAGEMENT_SEARCH_CONFIG } from './src/config';
|
|
|
+ import { getAllDepartments } from '@/api/auth/dept';
|
|
|
+ import { onMounted, reactive, ref } from 'vue';
|
|
|
+ import { formatDeptTree } from '@/views/disaster/utils/formatDeptTree';
|
|
|
+ import type { DeptTree } from '@/types/dept/type';
|
|
|
+ import { TASK_STAGE_OPTIONS, TASK_STAGE } from './src/constant';
|
|
|
+ import { getDisasterControlCollapseData, getDisasterControlTableData } from '@/api/disaster-control';
|
|
|
+ import { DEFAULT_PAGE_SIZE, DISASTER_CONTROL_PAGE_SIZE_CONFIG } from './src/constant';
|
|
|
+ import type { DisposalManagementListResponse } from '@/types/disaster-control';
|
|
|
+ import useTableConfig from '@/hooks/useTableConfigHook';
|
|
|
+ import { DISPOSAL_MANAGEMENT_TABLE_COLUMNS, TABLE_OPTIONS } from './src/config';
|
|
|
+ import { ACTIVE_STATUS, ACTIVE_STATUS_COLOR, ACTIVE_STATUS_MAP } from '@/views/disaster/constant';
|
|
|
+ import ActionButton from '@/components/ActionButton.vue';
|
|
|
+ import Empty from 'assets/images/empty@1X.png';
|
|
|
+
|
|
|
+ const firstLevelDepts = ref<DeptTree[]>([]);
|
|
|
+ const searchData = reactive({
|
|
|
+ reportDeptIds: [],
|
|
|
+ status: '',
|
|
|
+ taskStage: '',
|
|
|
+ });
|
|
|
+
|
|
|
+ const currentPage = ref(1);
|
|
|
+ const pageSize = ref(DEFAULT_PAGE_SIZE);
|
|
|
+ const total = ref(0);
|
|
|
+
|
|
|
+ const collapseLoading = ref(false);
|
|
|
+ const collapseList = ref<DisposalManagementListResponse[]>([]);
|
|
|
+
|
|
|
+ const { tableConfig } = useTableConfig(DISPOSAL_MANAGEMENT_TABLE_COLUMNS, TABLE_OPTIONS, false);
|
|
|
+
|
|
|
+ const formatTaskStage = (taskStage: number) => {
|
|
|
+ return TASK_STAGE_OPTIONS.find((item) => item.value === taskStage)?.label;
|
|
|
+ };
|
|
|
+
|
|
|
+ const handleSizeChange = (size: number) => {
|
|
|
+ pageSize.value = size;
|
|
|
+ };
|
|
|
+
|
|
|
+ const handleCurrentChange = (page: number) => {
|
|
|
+ currentPage.value = page;
|
|
|
+ };
|
|
|
+
|
|
|
+ const handleSearch = () => {
|
|
|
+ console.log(searchData);
|
|
|
+ };
|
|
|
+
|
|
|
+ const taskIds = ref<number[]>([]);
|
|
|
+ const getDisposalData = async () => {
|
|
|
+ collapseLoading.value = true;
|
|
|
+ const res = await getDisasterControlCollapseData({
|
|
|
+ pageNumber: currentPage.value,
|
|
|
+ pageSize: pageSize.value,
|
|
|
+ queryParam: {},
|
|
|
+ });
|
|
|
+ collapseList.value = res.records;
|
|
|
+ collapseList.value.forEach((item) => {
|
|
|
+ item.tableData = [];
|
|
|
+ });
|
|
|
+ taskIds.value = res.records.map((item) => item.id);
|
|
|
+ total.value = res.totalRow;
|
|
|
+ collapseLoading.value = false;
|
|
|
+ };
|
|
|
+
|
|
|
+ const getDisposalTableData = async () => {
|
|
|
+ tableConfig.loading = true;
|
|
|
+ const res = await getDisasterControlTableData({
|
|
|
+ handleTaskIds: taskIds.value,
|
|
|
+ ...searchData,
|
|
|
+ });
|
|
|
+ collapseList.value.forEach((item) => {
|
|
|
+ item.tableData = res;
|
|
|
+ });
|
|
|
+ tableConfig.loading = false;
|
|
|
+ };
|
|
|
+
|
|
|
+ onMounted(async () => {
|
|
|
+ const result = await getAllDepartments();
|
|
|
+ await getDisposalData();
|
|
|
+ await getDisposalTableData();
|
|
|
+ firstLevelDepts.value = formatDeptTree(result);
|
|
|
+ });
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped lang="scss">
|
|
|
+ @use '../style/disaster.scss' as *;
|
|
|
+ .custom-select {
|
|
|
+ width: 200cpx;
|
|
|
+ :deep(.el-select__selection) {
|
|
|
+ min-height: 24px;
|
|
|
+ max-height: 24px;
|
|
|
+ overflow-y: auto;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .collapse-container {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ gap: 10cpx;
|
|
|
+ width: 100%;
|
|
|
+ height: calc(63vh - 15cpx);
|
|
|
+ max-height: calc(63vh - 15cpx);
|
|
|
+ overflow-y: auto;
|
|
|
+ }
|
|
|
+ .empty-container {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ @include flex-center;
|
|
|
+ flex-direction: column;
|
|
|
+ gap: 10cpx;
|
|
|
+ }
|
|
|
+ .pagination-container {
|
|
|
+ display: flex;
|
|
|
+ justify-content: flex-end;
|
|
|
+ }
|
|
|
+</style>
|