|
@@ -0,0 +1,170 @@
|
|
|
|
|
+<template>
|
|
|
|
|
+ <div class="disaster-precaution-container">
|
|
|
|
|
+ <header class="header">
|
|
|
|
|
+ <span class="title">检查任务管理</span>
|
|
|
|
|
+ </header>
|
|
|
|
|
+ <main class="main">
|
|
|
|
|
+ <div class="disaster-precaution">
|
|
|
|
|
+ <header class="header" style="padding: 0 !important">
|
|
|
|
|
+ <el-button type="primary" :icon="Plus" class="create-task-btn">创建检查任务单</el-button>
|
|
|
|
|
+ <Search type="management" />
|
|
|
|
|
+ </header>
|
|
|
|
|
+ <BasicTable
|
|
|
|
|
+ :table-config="tableConfig"
|
|
|
|
|
+ :table-data="tableData"
|
|
|
|
|
+ @update:pageSize="handleSizeChange"
|
|
|
|
|
+ @update:pageNumber="handleCurrentChange"
|
|
|
|
|
+ >
|
|
|
|
|
+ <template #taskName="scope">
|
|
|
|
|
+ <div class="task-name--div">
|
|
|
|
|
+ <el-tooltip :content="scope.row.taskName" placement="top" effect="light">
|
|
|
|
|
+ <span>{{ scope.row.taskName }}</span>
|
|
|
|
|
+ </el-tooltip>
|
|
|
|
|
+ <img :src="OverdueIcon" alt="overdue" v-if="scope.row.isOverdue === OVERDUE_STATUS.OVERDUE" />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <template #activeStatus="scope">
|
|
|
|
|
+ <div class="active-status--div">
|
|
|
|
|
+ <div
|
|
|
|
|
+ class="dot"
|
|
|
|
|
+ :style="{ backgroundColor: ACTIVE_STATUS_COLOR[scope.row.activeStatus as ACTIVE_STATUS] }"
|
|
|
|
|
+ ></div>
|
|
|
|
|
+ <span>{{ ACTIVE_STATUS_MAP[scope.row.activeStatus] }}</span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <template #taskStage="scope">
|
|
|
|
|
+ <span>{{ TASK_STAGE_MAP[scope.row.taskStage] }}</span>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <template #action="scope">
|
|
|
|
|
+ <ActionButton text="编辑" v-if="scope.row.activeStatus === ACTIVE_STATUS.NOT_EFFECTIVE" />
|
|
|
|
|
+ <ActionButton text="查看" />
|
|
|
|
|
+ <el-popconfirm
|
|
|
|
|
+ confirm-button-text="确定"
|
|
|
|
|
+ cancel-button-text="取消"
|
|
|
|
|
+ title="确定要发布?"
|
|
|
|
|
+ v-if="scope.row.activeStatus === ACTIVE_STATUS.NOT_EFFECTIVE"
|
|
|
|
|
+ >
|
|
|
|
|
+ <template #reference>
|
|
|
|
|
+ <ActionButton text="发布" />
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-popconfirm>
|
|
|
|
|
+ <el-popconfirm
|
|
|
|
|
+ confirm-button-text="确定"
|
|
|
|
|
+ cancel-button-text="取消"
|
|
|
|
|
+ title="确定要取消发布?"
|
|
|
|
|
+ v-else-if="scope.row.activeStatus === ACTIVE_STATUS.ACTIVE"
|
|
|
|
|
+ >
|
|
|
|
|
+ <template #reference>
|
|
|
|
|
+ <ActionButton text="取消发布" />
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-popconfirm>
|
|
|
|
|
+ <ActionButton text="删除" v-if="scope.row.activeStatus === ACTIVE_STATUS.NOT_EFFECTIVE" />
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </BasicTable>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </main>
|
|
|
|
|
+ </div>
|
|
|
|
|
+</template>
|
|
|
|
|
+
|
|
|
|
|
+<script setup lang="ts">
|
|
|
|
|
+ import { ref, onMounted } from 'vue';
|
|
|
|
|
+ import { Plus } from '@element-plus/icons-vue';
|
|
|
|
|
+ import Search from './src/components/Search.vue';
|
|
|
|
|
+ import BasicTable from '@/components/BasicTable.vue';
|
|
|
|
|
+ import ActionButton from '@/components/ActionButton.vue';
|
|
|
|
|
+ import type { TableColumnProps } from '@/types/basic-table';
|
|
|
|
|
+ import useTableConfig from '@/hooks/useTableConfigHook';
|
|
|
|
|
+ import { getTaskManagementTableData } from '@/api/task-execution/tableData';
|
|
|
|
|
+ import type { TaskExecutionTableData } from '@/types/task-execution/tableData';
|
|
|
|
|
+ import OverdueIcon from '@/assets/svg/overdue.svg';
|
|
|
|
|
+ import {
|
|
|
|
|
+ OVERDUE_STATUS,
|
|
|
|
|
+ ACTIVE_STATUS,
|
|
|
|
|
+ ACTIVE_STATUS_MAP,
|
|
|
|
|
+ ACTIVE_STATUS_COLOR,
|
|
|
|
|
+ TASK_STAGE_MAP,
|
|
|
|
|
+ } from './src/constants/task-execution';
|
|
|
|
|
+ const tableData = ref<TaskExecutionTableData[]>([]);
|
|
|
|
|
+ const columns: TableColumnProps[] = [
|
|
|
|
|
+ {
|
|
|
|
|
+ prop: 'taskName',
|
|
|
|
|
+ label: '任务名称',
|
|
|
|
|
+ align: 'center',
|
|
|
|
|
+ slot: 'taskName',
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ prop: 'selfCheckUnit',
|
|
|
|
|
+ label: '被检查(自查)单位',
|
|
|
|
|
+ align: 'center',
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ prop: 'taskType',
|
|
|
|
|
+ label: '检查类型',
|
|
|
|
|
+ align: 'center',
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ prop: 'shouldCompleteTime',
|
|
|
|
|
+ label: '应完成时间',
|
|
|
|
|
+ align: 'center',
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ prop: 'activeStatus',
|
|
|
|
|
+ label: '生效状态',
|
|
|
|
|
+ align: 'center',
|
|
|
|
|
+ slot: 'activeStatus',
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ prop: 'taskStage',
|
|
|
|
|
+ label: '任务阶段',
|
|
|
|
|
+ align: 'center',
|
|
|
|
|
+ slot: 'taskStage',
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ prop: 'action',
|
|
|
|
|
+ label: '操作',
|
|
|
|
|
+ align: 'center',
|
|
|
|
|
+ slot: 'action',
|
|
|
|
|
+ width: '250cpx',
|
|
|
|
|
+ fixed: 'right',
|
|
|
|
|
+ },
|
|
|
|
|
+ ];
|
|
|
|
|
+ const options = {
|
|
|
|
|
+ emptyText: '暂无数据',
|
|
|
|
|
+ height: '64vh',
|
|
|
|
|
+ loading: true,
|
|
|
|
|
+ stripe: true,
|
|
|
|
|
+ };
|
|
|
|
|
+ const { tableConfig, pagination } = useTableConfig(columns, options);
|
|
|
|
|
+ const handleSizeChange = (value: number) => {
|
|
|
|
|
+ pagination.pageSize = value;
|
|
|
|
|
+ tableConfig.loading = true;
|
|
|
|
|
+ getTableData();
|
|
|
|
|
+ };
|
|
|
|
|
+ const handleCurrentChange = (value: number) => {
|
|
|
|
|
+ pagination.pageNumber = value;
|
|
|
|
|
+ tableConfig.loading = true;
|
|
|
|
|
+ getTableData();
|
|
|
|
|
+ };
|
|
|
|
|
+ const getTableData = async () => {
|
|
|
|
|
+ const res = await getTaskManagementTableData();
|
|
|
|
|
+ console.log(res);
|
|
|
|
|
+ tableData.value = res;
|
|
|
|
|
+ pagination.total = tableData.value.length;
|
|
|
|
|
+ tableConfig.loading = false;
|
|
|
|
|
+ };
|
|
|
|
|
+ onMounted(() => {
|
|
|
|
|
+ getTableData();
|
|
|
|
|
+ });
|
|
|
|
|
+</script>
|
|
|
|
|
+
|
|
|
|
|
+<style scoped lang="scss">
|
|
|
|
|
+ @use './src/styles/disaster-precaution.scss' as *;
|
|
|
|
|
+ @use './src/styles/task-execution.scss' as *;
|
|
|
|
|
+ .disaster-precaution {
|
|
|
|
|
+ gap: 20cpx !important;
|
|
|
|
|
+ }
|
|
|
|
|
+ .create-task-btn {
|
|
|
|
|
+ width: 150cpx;
|
|
|
|
|
+ font-size: 14cpx;
|
|
|
|
|
+ }
|
|
|
|
|
+</style>
|