|
|
@@ -6,8 +6,13 @@
|
|
|
<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
|
|
|
+ type="primary"
|
|
|
+ class="disaster-precaution__header--button"
|
|
|
+ :icon="Plus"
|
|
|
+ v-if="disposalManagementPermissions"
|
|
|
+ >
|
|
|
+ 创建灾害处置任务
|
|
|
</el-button>
|
|
|
<Search
|
|
|
:searchConfig="DISPOSAL_MANAGEMENT_SEARCH_CONFIG"
|
|
|
@@ -15,13 +20,23 @@
|
|
|
@update:searchData="handleSearch"
|
|
|
>
|
|
|
<template #reportDeptIds>
|
|
|
- <el-select v-model="searchData.reportDeptIds" multiple placeholder="请选择上报单位" filterable class="custom-select">
|
|
|
+ <el-select
|
|
|
+ v-model="searchData.reportDeptIds"
|
|
|
+ multiple
|
|
|
+ placeholder="请选择上报单位"
|
|
|
+ filterable
|
|
|
+ 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="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>
|
|
|
@@ -32,6 +47,7 @@
|
|
|
:key="item.id"
|
|
|
:name="item.taskName"
|
|
|
:defaultOpen="item.id === 1"
|
|
|
+ :disposalManagementPermissions="disposalManagementPermissions"
|
|
|
>
|
|
|
<template #main-table>
|
|
|
<BasicTable :tableData="item.tableData" :tableConfig="tableConfig">
|
|
|
@@ -45,7 +61,7 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
<template #taskStage="scope">
|
|
|
- <span>{{ formatTaskStage(scope.row.taskStage) }}</span>
|
|
|
+ <span>{{ getTaskStage(scope.row.taskStage) }}</span>
|
|
|
</template>
|
|
|
<template #reportPrincipals="scope">
|
|
|
<p v-for="user in scope.row.reportPrincipals" :key="user.id">
|
|
|
@@ -53,22 +69,28 @@
|
|
|
</p>
|
|
|
</template>
|
|
|
<template #action="scope">
|
|
|
- <ActionButton text="编辑" v-if="scope.row.status === ACTIVE_STATUS.NOT_EFFECTIVE" />
|
|
|
+ <ActionButton
|
|
|
+ text="编辑"
|
|
|
+ v-if="scope.row.status === ACTIVE_STATUS.NOT_EFFECTIVE && disposalManagementPermissions"
|
|
|
+ />
|
|
|
<ActionButton
|
|
|
text="发布"
|
|
|
:popconfirm="{
|
|
|
title: '确定发布吗?',
|
|
|
}"
|
|
|
- v-if="scope.row.status === ACTIVE_STATUS.NOT_EFFECTIVE"
|
|
|
+ v-if="scope.row.status === ACTIVE_STATUS.NOT_EFFECTIVE && disposalManagementPermissions"
|
|
|
/>
|
|
|
<ActionButton
|
|
|
text="撤回"
|
|
|
:popconfirm="{
|
|
|
title: '确定撤回吗?',
|
|
|
}"
|
|
|
- v-if="scope.row.taskStage === TASK_STAGE.TO_BE_REPORTED"
|
|
|
+ v-if="scope.row.taskStage === TASK_STAGE.TO_BE_REPORTED && disposalManagementPermissions"
|
|
|
+ />
|
|
|
+ <ActionButton
|
|
|
+ text="删除"
|
|
|
+ v-if="scope.row.status === ACTIVE_STATUS.NOT_EFFECTIVE && disposalManagementPermissions"
|
|
|
/>
|
|
|
- <ActionButton text="删除" v-if="scope.row.status === ACTIVE_STATUS.NOT_EFFECTIVE" />
|
|
|
<ActionButton text="查看" v-if="scope.row.status === ACTIVE_STATUS.ACTIVE" />
|
|
|
</template>
|
|
|
</BasicTable>
|
|
|
@@ -98,20 +120,32 @@
|
|
|
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 { 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 type { DisposalManagementListResponse, DisposalManagementTableResponse } 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 {
|
|
|
+ DISPOSAL_MANAGEMENT_SEARCH_CONFIG,
|
|
|
+ DISPOSAL_MANAGEMENT_TABLE_COLUMNS,
|
|
|
+ DISPOSAL_MANAGEMENT_TABLE_OPTIONS,
|
|
|
+ } from './src/config';
|
|
|
+ import { getTaskStage } from './src/util';
|
|
|
+ import {
|
|
|
+ ACTIVE_STATUS,
|
|
|
+ ACTIVE_STATUS_COLOR,
|
|
|
+ ACTIVE_STATUS_MAP,
|
|
|
+ DISASTER_PERMISSIONS,
|
|
|
+ } from '@/views/disaster/constant';
|
|
|
import ActionButton from '@/components/ActionButton.vue';
|
|
|
import Empty from 'assets/images/empty@1X.png';
|
|
|
+ import { useUserInfoHook } from '@/views/disaster/hooks/userInfo';
|
|
|
+
|
|
|
+ const { permissions } = useUserInfoHook();
|
|
|
|
|
|
const firstLevelDepts = ref<DeptTree[]>([]);
|
|
|
const searchData = reactive({
|
|
|
@@ -125,13 +159,10 @@
|
|
|
const total = ref(0);
|
|
|
|
|
|
const collapseLoading = ref(false);
|
|
|
- const collapseList = ref<DisposalManagementListResponse[]>([]);
|
|
|
+ const collapseList = ref<DisposalManagementListResponse<DisposalManagementTableResponse>[]>([]);
|
|
|
+ const disposalManagementPermissions = ref(false);
|
|
|
|
|
|
- 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 { tableConfig } = useTableConfig(DISPOSAL_MANAGEMENT_TABLE_COLUMNS, DISPOSAL_MANAGEMENT_TABLE_OPTIONS, false);
|
|
|
|
|
|
const handleSizeChange = (size: number) => {
|
|
|
pageSize.value = size;
|
|
|
@@ -178,12 +209,18 @@
|
|
|
const result = await getAllDepartments();
|
|
|
await getDisposalData();
|
|
|
await getDisposalTableData();
|
|
|
+ disposalManagementPermissions.value = Boolean(
|
|
|
+ permissions.find((item: { code: string }) => item.code === DISASTER_PERMISSIONS.DISPOSAL_MANAGEMENT),
|
|
|
+ );
|
|
|
firstLevelDepts.value = formatDeptTree(result);
|
|
|
});
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
@use '../style/disaster.scss' as *;
|
|
|
+ @use './src/style/collapse.scss' as *;
|
|
|
+ $collapse-container-height-default: calc(68vh - 13cpx);
|
|
|
+ $collapse-container-height-permission: calc(63vh - 15cpx);
|
|
|
.custom-select {
|
|
|
width: 200cpx;
|
|
|
:deep(.el-select__selection) {
|
|
|
@@ -193,23 +230,13 @@
|
|
|
}
|
|
|
}
|
|
|
.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;
|
|
|
+ &--permission {
|
|
|
+ height: $collapse-container-height-permission;
|
|
|
+ max-height: $collapse-container-height-permission;
|
|
|
+ }
|
|
|
+ &--default {
|
|
|
+ height: $collapse-container-height-default;
|
|
|
+ max-height: $collapse-container-height-default;
|
|
|
+ }
|
|
|
}
|
|
|
</style>
|