|
|
@@ -64,6 +64,15 @@
|
|
|
style="width: 240px"
|
|
|
/>
|
|
|
</div>
|
|
|
+ <div class="select-box--item">
|
|
|
+ <span>关键词:</span>
|
|
|
+ <el-input
|
|
|
+ v-model="searchKeyword"
|
|
|
+ placeholder="请输入关键词"
|
|
|
+ clearable
|
|
|
+ class="act-search-input"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
</section>
|
|
|
<section class="search-btn">
|
|
|
<el-button type="primary" @click="handleSearch">查询</el-button>
|
|
|
@@ -76,7 +85,7 @@
|
|
|
<div class="batch-table">
|
|
|
<BasicTable
|
|
|
ref="basicTableRef"
|
|
|
- :tableData="paginatedTableData"
|
|
|
+ :tableData="rawTableData"
|
|
|
:tableConfig="tableConfig"
|
|
|
@update:pageSize="handleSizeChange"
|
|
|
@update:pageNumber="handleCurrentChange"
|
|
|
@@ -116,16 +125,24 @@
|
|
|
import BasicTable from '@/components/BasicTable.vue';
|
|
|
import ActionButton from '@/components/ActionButton.vue';
|
|
|
import useTableConfig from '@/hooks/useTableConfigHook';
|
|
|
- import { queryDrawLessonsAdminPage, type DrawLessonsQueryParam } from '@/api/drawLessons';
|
|
|
+ import {
|
|
|
+ queryDrawLessonsAdminPage,
|
|
|
+ queryDrawLessonsAdminDetailPage,
|
|
|
+ cancellationMessagePost,
|
|
|
+ exportTheDocumentPost,
|
|
|
+ type DrawLessonsQueryParam
|
|
|
+ } from '@/api/drawLessons';
|
|
|
import type { QueryPageRequest } from '@/types/basic-query';
|
|
|
import { DRAW_LESSONS_TABLE_COLUMNS } from '../configs/tables';
|
|
|
+ import { t } from '@wangeditor/editor';
|
|
|
+ import { downloadByData } from '@/utils/file/download';
|
|
|
|
|
|
const NOTIFY_TARGET_STATUS_OPTIONS = [
|
|
|
- { label: '未下发', value: '未下发' },
|
|
|
- { label: '待反馈', value: '待反馈' },
|
|
|
- { label: '待审核', value: '待审核' },
|
|
|
- { label: '已作废', value: '已作废' },
|
|
|
- { label: '已完成', value: '已完成' },
|
|
|
+ // { label: '未下发', value: '未下发' },
|
|
|
+ { label: '待反馈', value: '3' },
|
|
|
+ { label: '待审核', value: '4' },
|
|
|
+ { label: '已作废', value: '6' },
|
|
|
+ { label: '已完成', value: '5' },
|
|
|
];
|
|
|
|
|
|
const TABLE_OPTIONS = {
|
|
|
@@ -137,6 +154,7 @@
|
|
|
const router = useRouter();
|
|
|
const route = useRoute();
|
|
|
const id = computed(() => Number(route.query.id));
|
|
|
+ const tableData = ref<any[]>([]);
|
|
|
|
|
|
const { tableConfig, pagination } = useTableConfig(DRAW_LESSONS_TABLE_COLUMNS, TABLE_OPTIONS, true);
|
|
|
const basicTableRef = ref<InstanceType<typeof BasicTable>>();
|
|
|
@@ -151,30 +169,31 @@
|
|
|
const searchStatus = ref<string>('');
|
|
|
const searchDeptName = ref<string>('');
|
|
|
const searchDateRange = ref<string[] | null>(null);
|
|
|
+ const searchKeyword = ref<string>('');
|
|
|
|
|
|
- const filteredTableData = computed(() => {
|
|
|
- let list = rawTableData.value;
|
|
|
- if (activeTab.value !== 'ALL') {
|
|
|
- list = list.filter((row) => (row.statusName || '') === activeTab.value);
|
|
|
- }
|
|
|
- if (searchStatus.value) {
|
|
|
- list = list.filter((row) => (row.statusName || '') === searchStatus.value);
|
|
|
- }
|
|
|
- if (searchDeptName.value?.trim()) {
|
|
|
- const kw = searchDeptName.value.trim().toLowerCase();
|
|
|
- list = list.filter(
|
|
|
- (row) => (row.associationOtObligationDeptName || '').toLowerCase().includes(kw),
|
|
|
- );
|
|
|
- }
|
|
|
- if (searchDateRange.value?.length === 2) {
|
|
|
- const [start, end] = searchDateRange.value;
|
|
|
- list = list.filter((row) => {
|
|
|
- const t = (row.createdAt || row.associationOtTimeLimit || '').toString().slice(0, 10);
|
|
|
- return t >= start && t <= end;
|
|
|
- });
|
|
|
- }
|
|
|
- return list;
|
|
|
- });
|
|
|
+ // const filteredTableData = computed(() => {
|
|
|
+ // let list = rawTableData.value;
|
|
|
+ // if (activeTab.value !== 'ALL') {
|
|
|
+ // list = list.filter((row) => (row.statusName || '') === activeTab.value);
|
|
|
+ // }
|
|
|
+ // if (searchStatus.value) {
|
|
|
+ // list = list.filter((row) => (row.statusName || '') === searchStatus.value);
|
|
|
+ // }
|
|
|
+ // if (searchDeptName.value?.trim()) {
|
|
|
+ // const kw = searchDeptName.value.trim().toLowerCase();
|
|
|
+ // list = list.filter(
|
|
|
+ // (row) => (row.associationOtObligationDeptName || '').toLowerCase().includes(kw),
|
|
|
+ // );
|
|
|
+ // }
|
|
|
+ // if (searchDateRange.value?.length === 2) {
|
|
|
+ // const [start, end] = searchDateRange.value;
|
|
|
+ // list = list.filter((row) => {
|
|
|
+ // const t = (row.createdAt || row.associationOtTimeLimit || '').toString().slice(0, 10);
|
|
|
+ // return t >= start && t <= end;
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // return list;
|
|
|
+ // });
|
|
|
|
|
|
/** 分页后的列表(前端分页) */
|
|
|
const paginatedTableData = computed(() => {
|
|
|
@@ -183,13 +202,13 @@
|
|
|
return list.slice(start, start + pagination.pageSize);
|
|
|
});
|
|
|
|
|
|
- watch(
|
|
|
- () => filteredTableData.value.length,
|
|
|
- (len) => {
|
|
|
- pagination.total = len;
|
|
|
- },
|
|
|
- { immediate: true },
|
|
|
- );
|
|
|
+ // watch(
|
|
|
+ // () => filteredTableData.value.length,
|
|
|
+ // (len) => {
|
|
|
+ // pagination.total = len;
|
|
|
+ // },
|
|
|
+ // { immediate: true },
|
|
|
+ // );
|
|
|
|
|
|
const handleSizeChange = (value: number) => {
|
|
|
pagination.pageSize = value;
|
|
|
@@ -207,13 +226,20 @@
|
|
|
const query: QueryPageRequest<DrawLessonsQueryParam> = {
|
|
|
pageNumber: 1,
|
|
|
pageSize: 9999,
|
|
|
- queryParam: {},
|
|
|
+ queryParam: {
|
|
|
+ associationOtId: id.value,
|
|
|
+ obligationDeptName: searchDeptName.value,
|
|
|
+ planStartDate: searchDateRange.value?.[0],
|
|
|
+ planEndDate: searchDateRange.value?.[1],
|
|
|
+ statusId: searchStatus.value ? Number(searchStatus.value) : undefined,
|
|
|
+ problem: searchKeyword.value,
|
|
|
+ },
|
|
|
};
|
|
|
- const res = await queryDrawLessonsAdminPage(query);
|
|
|
+ const res = await queryDrawLessonsAdminDetailPage(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);
|
|
|
+ const current = list;
|
|
|
rawTableData.value = current;
|
|
|
if (current.length) {
|
|
|
const row = current[0] as { problem?: string; creatorName?: string; createdAt?: string };
|
|
|
@@ -244,25 +270,46 @@
|
|
|
const getDetail = () => loadList();
|
|
|
|
|
|
const handleTabChange = () => {
|
|
|
- // 切换 tab 后列表由 filteredTableData 自动过滤
|
|
|
+ loadList();
|
|
|
};
|
|
|
|
|
|
const handleSearch = () => {
|
|
|
- // 由 filteredTableData 响应 searchStatus/searchDeptName/searchDateRange
|
|
|
+ loadList();
|
|
|
};
|
|
|
|
|
|
const handleReset = () => {
|
|
|
searchStatus.value = '';
|
|
|
searchDeptName.value = '';
|
|
|
searchDateRange.value = null;
|
|
|
+ searchKeyword.value = '';
|
|
|
+ loadList();
|
|
|
};
|
|
|
|
|
|
- const handleExport = () => {
|
|
|
- ElMessage.info('导出功能待对接');
|
|
|
+ const handleExport = async () => {
|
|
|
+ try {
|
|
|
+ const response = await exportTheDocumentPost();
|
|
|
+ if (response) {
|
|
|
+ const fileName = `法律法规管理_${new Date().toISOString().split('T')[0]}.xlsx`;
|
|
|
+ downloadByData(response, fileName);
|
|
|
+ ElMessage.success('导出成功');
|
|
|
+ }
|
|
|
+ loadList();
|
|
|
+ } catch (e) {
|
|
|
+ console.error('导出举一反三记录失败:', e);
|
|
|
+ ElMessage.error(e?.message || e?.data || '导出失败,请重试');
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
const handleCancel = async (row: any) => {
|
|
|
ElMessage.info('作废功能待对接接口');
|
|
|
+ try {
|
|
|
+ await cancellationMessagePost(row.id);
|
|
|
+ ElMessage.success('作废成功');
|
|
|
+ loadList();
|
|
|
+ } catch (e) {
|
|
|
+ console.error('作废举一反三记录失败:', e);
|
|
|
+ ElMessage.error(e?.message || e?.data || '作废失败,请重试');
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
const handleApprove = () => {
|