|
|
@@ -1,14 +1,14 @@
|
|
|
<template>
|
|
|
<div class="safety-platform-container">
|
|
|
<header class="safety-platform-container__header">
|
|
|
- <div class="breadcrumb-title"> 院级文件管理 </div>
|
|
|
+ <div class="breadcrumb-title"> 员工上报隐患管理(管理员审核) </div>
|
|
|
</header>
|
|
|
<main class="safety-platform-container__main">
|
|
|
<div class="search-table-container">
|
|
|
<header>
|
|
|
<div style="position: relative">
|
|
|
<el-button type="primary" class="search-table-container--button" @click="handleCreate">
|
|
|
- 添加
|
|
|
+ 新增
|
|
|
</el-button>
|
|
|
<el-button plain class="search-table-container--button" @click="handleImport">
|
|
|
导入
|
|
|
@@ -21,35 +21,34 @@
|
|
|
<div class="act-search">
|
|
|
<section class="select-box">
|
|
|
<div class="select-box--item">
|
|
|
- <span>文件名称/编号:</span>
|
|
|
+ <span>隐患问题:</span>
|
|
|
<el-input
|
|
|
v-model="tableQuery.queryParam.keyword"
|
|
|
- placeholder="搜索文件名称或编号"
|
|
|
+ placeholder="请输入隐患问题、地点、姓名、工号或联系电话"
|
|
|
class="act-search-input"
|
|
|
/>
|
|
|
</div>
|
|
|
- <div class="select-box--item">
|
|
|
- <span>分类:</span>
|
|
|
- <el-select
|
|
|
- v-model="tableQuery.queryParam.classifyName"
|
|
|
- placeholder="请选择分类"
|
|
|
- clearable
|
|
|
- >
|
|
|
- <el-option label="外部院级文件" value="外部院级文件" />
|
|
|
- <el-option label="内部院级文件" value="内部院级文件" />
|
|
|
- </el-select>
|
|
|
- </div>
|
|
|
<div class="select-box--item">
|
|
|
<span>状态:</span>
|
|
|
<el-select
|
|
|
- v-model="tableQuery.queryParam.status"
|
|
|
+ v-model="tableQuery.queryParam.statusType"
|
|
|
placeholder="请选择状态"
|
|
|
clearable
|
|
|
>
|
|
|
- <el-option label="启用" :value="1" />
|
|
|
- <el-option label="禁用" :value="0" />
|
|
|
+ <el-option label="全部" :value="0" />
|
|
|
+ <el-option label="待审核" :value="1" />
|
|
|
+ <el-option label="审核通过" :value="2" />
|
|
|
+ <el-option label="审核不通过" :value="3" />
|
|
|
</el-select>
|
|
|
</div>
|
|
|
+ <div class="select-box--item">
|
|
|
+ <span>任务来源:</span>
|
|
|
+ <el-input
|
|
|
+ v-model="tableQuery.queryParam.sourceTypeName"
|
|
|
+ placeholder="请输入任务来源"
|
|
|
+ class="act-search-input"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
</section>
|
|
|
<section class="search-btn">
|
|
|
<el-button type="primary" @click="handleSearch">查询</el-button>
|
|
|
@@ -68,20 +67,29 @@
|
|
|
>
|
|
|
<template #status="scope">
|
|
|
<span>
|
|
|
- {{ scope.row.status === 1 ? '启用' : scope.row.status === 0 ? '禁用' : '-' }}
|
|
|
+ {{ getStatusTypeName(scope.row.statusType ?? getStatusType(scope.row.status)) }}
|
|
|
</span>
|
|
|
</template>
|
|
|
<template #action="scope">
|
|
|
<div class="action-container--div" style="justify-content: left">
|
|
|
- <ActionButton text="编辑" @click="handleEdit(scope.row.id)" />
|
|
|
- <ActionButton
|
|
|
- text="删除"
|
|
|
- :popconfirm="{
|
|
|
- title: '确定要删除?',
|
|
|
- }"
|
|
|
- @confirm="handleDelete(scope.row.id)"
|
|
|
- />
|
|
|
- <ActionButton text="查看" @click="handleView(scope.row.id)" />
|
|
|
+ <!-- 待审核:显示审核和查看 -->
|
|
|
+ <template v-if="scope.row.status === 1">
|
|
|
+ <ActionButton text="审核" @click="handleApprove(scope.row.id)" />
|
|
|
+ <ActionButton text="查看" @click="handleView(scope.row.id)" />
|
|
|
+ </template>
|
|
|
+ <!-- 审核通过(需求部门通过或安全部门通过):显示查看和入账 -->
|
|
|
+ <template v-else-if="scope.row.status === 2 || scope.row.status === 4">
|
|
|
+ <ActionButton text="查看" @click="handleView(scope.row.id)" />
|
|
|
+ <ActionButton text="入账" @click="handleAccount(scope.row.id)" />
|
|
|
+ </template>
|
|
|
+ <!-- 审核不通过(需求部门驳回或安全部门驳回):显示查看 -->
|
|
|
+ <template v-else-if="scope.row.status === 3 || scope.row.status === 5">
|
|
|
+ <ActionButton text="查看" @click="handleView(scope.row.id)" />
|
|
|
+ </template>
|
|
|
+ <!-- 其他状态:显示查看 -->
|
|
|
+ <template v-else>
|
|
|
+ <ActionButton text="查看" @click="handleView(scope.row.id)" />
|
|
|
+ </template>
|
|
|
</div>
|
|
|
</template>
|
|
|
</BasicTable>
|
|
|
@@ -111,11 +119,12 @@
|
|
|
import { useRouter } from 'vue-router';
|
|
|
import type { QueryPageRequest } from '@/types/basic-query';
|
|
|
import {
|
|
|
- queryAcademyFilePage,
|
|
|
- deleteAcademyFile,
|
|
|
- exportAcademyFile,
|
|
|
- type ProductionSafetyFileQuery,
|
|
|
- } from '@/api/production-safety-system';
|
|
|
+ queryHiddenDangerPage,
|
|
|
+ exportHiddenDanger,
|
|
|
+ accountEmployeeHazardReport,
|
|
|
+ type QueryHiddenDangerReq,
|
|
|
+ type HiddenDanger,
|
|
|
+ } from '@/api/production-safety';
|
|
|
import { downloadByData } from '@/utils/file/download';
|
|
|
import BatchImport from '@/components/batch-import/BatchImport.vue';
|
|
|
import { useGlobSetting } from '@/hooks/setting';
|
|
|
@@ -128,17 +137,30 @@
|
|
|
|
|
|
const { tableConfig, pagination } = useTableConfig(INVENTORY_TABLE_COLUMNS, TABLE_OPTIONS);
|
|
|
|
|
|
- const tableData = ref<any[]>([]);
|
|
|
+ const tableData = ref<HiddenDanger[]>([]);
|
|
|
+
|
|
|
+ // 将 status (1-7) 转换为 statusType (1-3)
|
|
|
+ const getStatusType = (status: number): number => {
|
|
|
+ if (status === 1) return 1;
|
|
|
+ if (status === 2 || status === 4 || status === 6) return 2;
|
|
|
+ if (status === 3 || status === 5 || status === 7) return 3;
|
|
|
+ return 0;
|
|
|
+ };
|
|
|
+
|
|
|
+ const getStatusTypeName = (statusType: number): string => {
|
|
|
+ if (statusType === 1) return '待审核';
|
|
|
+ if (statusType === 2) return '审核通过';
|
|
|
+ if (statusType === 3) return '审核不通过';
|
|
|
+ return '-';
|
|
|
+ };
|
|
|
|
|
|
- const tableQuery = reactive<QueryPageRequest<ProductionSafetyFileQuery>>({
|
|
|
+ const tableQuery = reactive<QueryPageRequest<QueryHiddenDangerReq>>({
|
|
|
pageNumber: pagination.pageNumber,
|
|
|
pageSize: pagination.pageSize,
|
|
|
queryParam: {
|
|
|
- keyword: '', // 文件名称/编号(模糊查询)
|
|
|
- status: 1, // 状态:1-启用,0-禁用
|
|
|
- classifyName: '', // 分类名称:外部院级文件/内部院级文件
|
|
|
- startDate: '', // 上传日期范围-开始日期
|
|
|
- endDate: '', // 上传日期范围-结束日期
|
|
|
+ keyword: '',
|
|
|
+ statusType: undefined,
|
|
|
+ sourceTypeName: '',
|
|
|
},
|
|
|
});
|
|
|
|
|
|
@@ -154,28 +176,16 @@
|
|
|
getTableData();
|
|
|
};
|
|
|
|
|
|
-
|
|
|
async function getTableData() {
|
|
|
tableConfig.loading = true;
|
|
|
try {
|
|
|
- const res = await queryAcademyFilePage(tableQuery);
|
|
|
+ const res = await queryHiddenDangerPage(tableQuery);
|
|
|
if (res) {
|
|
|
- // 映射返回数据字段到表格字段
|
|
|
- tableData.value = res.records.map((item) => ({
|
|
|
- id: item.id,
|
|
|
- fileName: item.fileName, // 文件名称
|
|
|
- fileCode: item.fileCode, // 文件编号
|
|
|
- classifyName: item.classifyName, // 分类名称
|
|
|
- fileVersion: item.fileVersion, // 文件版本号
|
|
|
- fileFormat: item.fileFormat, // 文件格式
|
|
|
- releaseDate: item.releaseDate, // 发布日期
|
|
|
- status: item.status, // 状态:1-启用,0-禁用
|
|
|
- uploadTime: item.uploadTime || item.createdAt, // 上传时间
|
|
|
- }));
|
|
|
- pagination.total = res.total || 0;
|
|
|
+ tableData.value = res.records || [];
|
|
|
+ pagination.total = res.totalRow || 0;
|
|
|
}
|
|
|
} catch (e) {
|
|
|
- console.error('获取院级文件列表失败:', e);
|
|
|
+ console.error('获取隐患上报列表失败:', e);
|
|
|
tableData.value = [];
|
|
|
pagination.total = 0;
|
|
|
} finally {
|
|
|
@@ -191,18 +201,15 @@
|
|
|
|
|
|
const handleReset = () => {
|
|
|
tableQuery.queryParam.keyword = '';
|
|
|
- tableQuery.queryParam.status = undefined;
|
|
|
- tableQuery.queryParam.classifyName = '';
|
|
|
- tableQuery.queryParam.startDate = '';
|
|
|
- tableQuery.queryParam.endDate = '';
|
|
|
+ tableQuery.queryParam.statusType = undefined;
|
|
|
+ tableQuery.queryParam.sourceTypeName = '';
|
|
|
handleSearch();
|
|
|
};
|
|
|
|
|
|
- // 批量导入
|
|
|
const batchImportVisible = ref(false);
|
|
|
const { urlPrefix } = useGlobSetting();
|
|
|
- const importApiUrl = ref(urlJoin(urlPrefix, '/productionSafety/academyFile/import'));
|
|
|
- const templateUrl = ref('./skyeye-file-upload/sfysecurity/TEMPLATE/import-academy-file-template.xlsx');
|
|
|
+ const importApiUrl = ref(urlJoin(urlPrefix, '/api/employeeHazardReport/importEmployeeHazardReport'));
|
|
|
+ const templateUrl = ref('');
|
|
|
|
|
|
const handleImport = () => {
|
|
|
batchImportVisible.value = true;
|
|
|
@@ -215,21 +222,19 @@
|
|
|
|
|
|
const handleDownload = async () => {
|
|
|
try {
|
|
|
- const exportParams: ProductionSafetyFileQuery = {
|
|
|
+ const exportParams: QueryHiddenDangerReq = {
|
|
|
keyword: tableQuery.queryParam.keyword || undefined,
|
|
|
- status: tableQuery.queryParam.status,
|
|
|
- classifyName: tableQuery.queryParam.classifyName || undefined,
|
|
|
- startDate: tableQuery.queryParam.startDate || undefined,
|
|
|
- endDate: tableQuery.queryParam.endDate || undefined,
|
|
|
+ statusType: tableQuery.queryParam.statusType,
|
|
|
+ sourceTypeName: tableQuery.queryParam.sourceTypeName || undefined,
|
|
|
};
|
|
|
- const response = await exportAcademyFile(exportParams);
|
|
|
+ const response = await exportHiddenDanger(exportParams);
|
|
|
if (response) {
|
|
|
- const fileName = `院级文件管理_${new Date().toISOString().split('T')[0]}.xlsx`;
|
|
|
+ const fileName = `员工上报隐患管理(管理员审核)_${new Date().toISOString().split('T')[0]}.xlsx`;
|
|
|
downloadByData(response, fileName);
|
|
|
ElMessage.success('导出成功');
|
|
|
}
|
|
|
} catch (e) {
|
|
|
- console.error('导出院级文件失败:', e);
|
|
|
+ console.error('导出隐患上报失败:', e);
|
|
|
ElMessage.error('导出失败,请重试');
|
|
|
}
|
|
|
};
|
|
|
@@ -243,37 +248,37 @@
|
|
|
});
|
|
|
};
|
|
|
|
|
|
- const handleEdit = (id: number) => {
|
|
|
+ const handleView = (id: number) => {
|
|
|
router.push({
|
|
|
name: 'hiddenTroubleReviewManagementItem',
|
|
|
query: {
|
|
|
id,
|
|
|
- operate: 'hidden-trouble-review-edit',
|
|
|
+ operate: 'hidden-trouble-review-view',
|
|
|
},
|
|
|
});
|
|
|
};
|
|
|
|
|
|
- const handleDelete = async (id: number) => {
|
|
|
- try {
|
|
|
- await deleteAcademyFile(id);
|
|
|
- ElMessage.success('删除成功');
|
|
|
- getTableData();
|
|
|
- } catch (e) {
|
|
|
- console.error('删除院级文件失败:', e);
|
|
|
- ElMessage.error('删除失败,请重试');
|
|
|
- }
|
|
|
- };
|
|
|
-
|
|
|
- const handleView = (id: number) => {
|
|
|
+ const handleApprove = (id: number) => {
|
|
|
router.push({
|
|
|
name: 'hiddenTroubleReviewManagementItem',
|
|
|
query: {
|
|
|
id,
|
|
|
- operate: 'hidden-trouble-review-view',
|
|
|
+ operate: 'hidden-trouble-review-approve',
|
|
|
},
|
|
|
});
|
|
|
};
|
|
|
|
|
|
+ const handleAccount = async (hazardId: number) => {
|
|
|
+ try {
|
|
|
+ await accountEmployeeHazardReport(hazardId);
|
|
|
+ ElMessage.success('入账成功');
|
|
|
+ getTableData();
|
|
|
+ } catch (e) {
|
|
|
+ console.error('入账失败:', e);
|
|
|
+ ElMessage.error('入账失败,请重试');
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
onMounted(() => {
|
|
|
getTableData();
|
|
|
});
|
|
|
@@ -284,4 +289,4 @@
|
|
|
@use '@/styles/page-main-layout.scss' as *;
|
|
|
@use '@/styles/basic-table-action.scss' as *;
|
|
|
@use '@/views/traffic/violation/style/act-search-table.scss' as *;
|
|
|
-</style>
|
|
|
+</style>
|