|
|
@@ -84,6 +84,9 @@
|
|
|
<template #status="scope">
|
|
|
<span>{{ scope.row.statusName || '-' }}</span>
|
|
|
</template>
|
|
|
+ <template #feedbackRatio="scope">
|
|
|
+ <span>{{ scope.row.feedbackRatio ?? (scope.row.issueCount ? `${scope.row.feedbackCount ?? 0}/${scope.row.issueCount}` : '-') }}</span>
|
|
|
+ </template>
|
|
|
<template #action="scope">
|
|
|
<div class="action-container--div" style="justify-content: left">
|
|
|
<ActionButton
|
|
|
@@ -113,10 +116,9 @@
|
|
|
import BasicTable from '@/components/BasicTable.vue';
|
|
|
import ActionButton from '@/components/ActionButton.vue';
|
|
|
import useTableConfig from '@/hooks/useTableConfigHook';
|
|
|
- import {
|
|
|
- getDrawLessonsDeptDetail,
|
|
|
- getDrawLessonsAdminDetail,
|
|
|
- } from '@/api/drawLessons';
|
|
|
+ import { queryDrawLessonsAdminPage, type DrawLessonsQueryParam } from '@/api/drawLessons';
|
|
|
+ import type { QueryPageRequest } from '@/types/basic-query';
|
|
|
+ import { DRAW_LESSONS_TABLE_COLUMNS } from '../configs/tables';
|
|
|
|
|
|
const NOTIFY_TARGET_STATUS_OPTIONS = [
|
|
|
{ label: '未下发', value: '未下发' },
|
|
|
@@ -126,81 +128,17 @@
|
|
|
{ label: '已完成', value: '已完成' },
|
|
|
];
|
|
|
|
|
|
- const NOTIFY_TARGET_COLUMNS = [
|
|
|
- { label: '隐患问题', prop: 'problem', align: 'left', minWidth: '160px', showOverflowTooltip: true },
|
|
|
- { label: '状态', prop: 'statusName', slot: 'status', align: 'center', width: '100px' },
|
|
|
- { label: '部门名称', prop: 'associationOtObligationDeptName', align: 'left', minWidth: '140px' },
|
|
|
- { label: '部门负责人', prop: 'associationOtObligationDeptUserName', align: 'left', minWidth: '100px' },
|
|
|
- { label: '举一反三要求', prop: 'associationOneThree', align: 'left', minWidth: '180px', showOverflowTooltip: true },
|
|
|
- { label: '计划完成时间', prop: 'associationOtTimeLimit', align: 'left', width: '160px' },
|
|
|
- { label: '操作', prop: 'action', slot: 'action', fixed: 'right', width: '140px', align: 'left' },
|
|
|
- ];
|
|
|
-
|
|
|
const TABLE_OPTIONS = {
|
|
|
emptyText: '暂无通知对象',
|
|
|
loading: false,
|
|
|
maxHeight: 'calc(70vh - 200px)',
|
|
|
};
|
|
|
|
|
|
- /** 假数据:无 id 或接口无数据时使用 */
|
|
|
- const MOCK_HEADER = {
|
|
|
- problem: '7号楼水闸四眼和山红石煤塌场内外侧斜角有安全隐患',
|
|
|
- creatorName: '柳小虎',
|
|
|
- createdAt: '2024-01-01 13:30:00',
|
|
|
- };
|
|
|
-
|
|
|
- const MOCK_TABLE_DATA = [
|
|
|
- {
|
|
|
- id: 101,
|
|
|
- problem: '7号楼水闸四眼和山红石煤塌场内外侧斜角有安全隐患',
|
|
|
- statusName: '待反馈',
|
|
|
- associationOtObligationDeptName: '生产部',
|
|
|
- associationOtObligationDeptUserName: '张三',
|
|
|
- associationOneThree: '全厂同类区域排查,加固防护栏并设置警示标识。',
|
|
|
- associationOtTimeLimit: '2025-02-28 00:00:00',
|
|
|
- feedbackResult: '',
|
|
|
- feedbackTime: '',
|
|
|
- },
|
|
|
- {
|
|
|
- id: 102,
|
|
|
- problem: '7号楼水闸四眼和山红石煤塌场内外侧斜角有安全隐患',
|
|
|
- statusName: '待审核',
|
|
|
- associationOtObligationDeptName: '安全部',
|
|
|
- associationOtObligationDeptUserName: '李四',
|
|
|
- associationOneThree: '全厂同类区域排查,加固防护栏并设置警示标识。',
|
|
|
- associationOtTimeLimit: '2025-02-28 00:00:00',
|
|
|
- feedbackResult: '已组织现场排查并完成整改。',
|
|
|
- feedbackTime: '2025-01-15 10:20:00',
|
|
|
- },
|
|
|
- {
|
|
|
- id: 103,
|
|
|
- problem: '7号楼水闸四眼和山红石煤塌场内外侧斜角有安全隐患',
|
|
|
- statusName: '已完成',
|
|
|
- associationOtObligationDeptName: '综合部',
|
|
|
- associationOtObligationDeptUserName: '王五',
|
|
|
- associationOneThree: '全厂同类区域排查,加固防护栏并设置警示标识。',
|
|
|
- associationOtTimeLimit: '2025-02-28 00:00:00',
|
|
|
- feedbackResult: '整改已完成,复查通过。',
|
|
|
- feedbackTime: '2025-01-18 14:00:00',
|
|
|
- },
|
|
|
- {
|
|
|
- id: 104,
|
|
|
- problem: '7号楼水闸四眼和山红石煤塌场内外侧斜角有安全隐患',
|
|
|
- statusName: '未下发',
|
|
|
- associationOtObligationDeptName: '设备部',
|
|
|
- associationOtObligationDeptUserName: '赵六',
|
|
|
- associationOneThree: '全厂同类区域排查,加固防护栏并设置警示标识。',
|
|
|
- associationOtTimeLimit: '2025-02-28 00:00:00',
|
|
|
- feedbackResult: '',
|
|
|
- feedbackTime: '',
|
|
|
- },
|
|
|
- ];
|
|
|
-
|
|
|
const router = useRouter();
|
|
|
const route = useRoute();
|
|
|
const id = computed(() => Number(route.query.id));
|
|
|
|
|
|
- const { tableConfig, pagination } = useTableConfig(NOTIFY_TARGET_COLUMNS, TABLE_OPTIONS, true);
|
|
|
+ const { tableConfig, pagination } = useTableConfig(DRAW_LESSONS_TABLE_COLUMNS, TABLE_OPTIONS, true);
|
|
|
const basicTableRef = ref<InstanceType<typeof BasicTable>>();
|
|
|
const rawTableData = ref<any[]>([]);
|
|
|
const detailData = ref<{
|
|
|
@@ -231,7 +169,7 @@
|
|
|
if (searchDateRange.value?.length === 2) {
|
|
|
const [start, end] = searchDateRange.value;
|
|
|
list = list.filter((row) => {
|
|
|
- const t = (row.feedbackTime || '').slice(0, 10);
|
|
|
+ const t = (row.createdAt || row.associationOtTimeLimit || '').toString().slice(0, 10);
|
|
|
return t >= start && t <= end;
|
|
|
});
|
|
|
}
|
|
|
@@ -262,60 +200,48 @@
|
|
|
pagination.pageNumber = value;
|
|
|
};
|
|
|
|
|
|
- /** 顶部信息:使用 drawLessons/dept/queryDetail?id=xxx,无 id 或失败时用假数据 */
|
|
|
- const loadHeaderDetail = async () => {
|
|
|
- if (id.value) {
|
|
|
- try {
|
|
|
- const res = await getDrawLessonsDeptDetail(id.value);
|
|
|
- const data = (res as any)?.data ?? res;
|
|
|
- if (data && typeof data === 'object') {
|
|
|
+ /** 列表与顶部信息:直接使用外面的列表接口 queryDrawLessonsAdminPage,再按当前 id 筛出当前记录 */
|
|
|
+ const loadList = async () => {
|
|
|
+ try {
|
|
|
+ tableConfig.loading = true;
|
|
|
+ const query: QueryPageRequest<DrawLessonsQueryParam> = {
|
|
|
+ pageNumber: 1,
|
|
|
+ pageSize: 9999,
|
|
|
+ queryParam: {},
|
|
|
+ };
|
|
|
+ const res = await queryDrawLessonsAdminPage(query);
|
|
|
+ const records = (res && (res as { records?: unknown[] }).records) ?? [];
|
|
|
+ const list = Array.isArray(records) ? records : [];
|
|
|
+ if (id.value) {
|
|
|
+ const current = list.filter((r: { id?: number }) => r.id === id.value);
|
|
|
+ rawTableData.value = current;
|
|
|
+ if (current.length) {
|
|
|
+ const row = current[0] as { problem?: string; creatorName?: string; createdAt?: string };
|
|
|
detailData.value = {
|
|
|
- problem: data.problem,
|
|
|
- creatorName: data.creatorName,
|
|
|
- createdAt: data.createdAt,
|
|
|
+ problem: row.problem,
|
|
|
+ creatorName: row.creatorName,
|
|
|
+ createdAt: row.createdAt,
|
|
|
};
|
|
|
- return;
|
|
|
+ } else {
|
|
|
+ detailData.value = null;
|
|
|
}
|
|
|
- } catch (e) {
|
|
|
- console.error('获取举一反三详情(部门端)失败:', e);
|
|
|
+ } else {
|
|
|
+ rawTableData.value = list;
|
|
|
+ const first = list[0] as { problem?: string; creatorName?: string; createdAt?: string } | undefined;
|
|
|
+ detailData.value = first
|
|
|
+ ? { problem: first.problem, creatorName: first.creatorName, createdAt: first.createdAt }
|
|
|
+ : null;
|
|
|
}
|
|
|
+ } catch (e) {
|
|
|
+ console.error('获取举一反三列表失败:', e);
|
|
|
+ rawTableData.value = [];
|
|
|
+ detailData.value = null;
|
|
|
+ } finally {
|
|
|
+ tableConfig.loading = false;
|
|
|
}
|
|
|
- detailData.value = { ...MOCK_HEADER };
|
|
|
};
|
|
|
|
|
|
- /** 表格数据:使用管理端详情(含 issueRecords),无 id 或失败时用假数据 */
|
|
|
- const loadTableData = async () => {
|
|
|
- if (id.value) {
|
|
|
- try {
|
|
|
- tableConfig.loading = true;
|
|
|
- const res = await getDrawLessonsAdminDetail(id.value);
|
|
|
- const data = (res as any)?.data ?? res;
|
|
|
- if (data && typeof data === 'object') {
|
|
|
- const records = Array.isArray(data.issueRecords) ? data.issueRecords : [];
|
|
|
- if (records.length) {
|
|
|
- rawTableData.value = records.map((r: any) => ({
|
|
|
- ...r,
|
|
|
- problem: data.problem ?? r.problem,
|
|
|
- associationOneThree: data.associationOneThree ?? r.associationOneThree,
|
|
|
- associationOtTimeLimit: data.associationOtTimeLimit ?? r.associationOtTimeLimit,
|
|
|
- }));
|
|
|
- return;
|
|
|
- }
|
|
|
- }
|
|
|
- } catch (e) {
|
|
|
- console.error('获取举一反三详情(管理端)失败:', e);
|
|
|
- } finally {
|
|
|
- tableConfig.loading = false;
|
|
|
- if (rawTableData.value.length) return;
|
|
|
- }
|
|
|
- }
|
|
|
- rawTableData.value = [...MOCK_TABLE_DATA];
|
|
|
- pagination.pageNumber = 1;
|
|
|
- };
|
|
|
-
|
|
|
- const getDetail = async () => {
|
|
|
- await Promise.all([loadHeaderDetail(), loadTableData()]);
|
|
|
- };
|
|
|
+ const getDetail = () => loadList();
|
|
|
|
|
|
const handleTabChange = () => {
|
|
|
// 切换 tab 后列表由 filteredTableData 自动过滤
|