This commit is contained in:
parent
139bed3da0
commit
64e06acc4d
|
|
@ -99,6 +99,13 @@ export function deleteRectificationApi(data) {
|
|||
data:data,
|
||||
})
|
||||
}
|
||||
export function issueRectificationApi(data) {
|
||||
return request({
|
||||
url: '/blade-system/fileManage/issue',
|
||||
method: 'post',
|
||||
data:data,
|
||||
})
|
||||
}
|
||||
|
||||
// 删除档案目录
|
||||
export function delFileManageApi(data) {
|
||||
|
|
|
|||
|
|
@ -4,11 +4,23 @@
|
|||
<template #header>
|
||||
<div class="card-header">
|
||||
<span>整改清单</span>
|
||||
<el-button size="small" @click="goBack">返回</el-button>
|
||||
<el-button @click="goBack">返回</el-button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- 表格:保留操作列 -->
|
||||
<!-- 操作栏 -->
|
||||
<div class="operation-bar">
|
||||
<el-button
|
||||
type="primary"
|
||||
@click="handleIssue"
|
||||
:disabled="selectedRows.length === 0"
|
||||
:loading="issueLoading"
|
||||
>
|
||||
下发
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
<!-- 表格:复选框列 -->
|
||||
<avue-crud
|
||||
:data="tableData"
|
||||
:page="page"
|
||||
|
|
@ -20,6 +32,7 @@
|
|||
@current-change="handleCurrentChange"
|
||||
@size-change="handleSizeChange"
|
||||
@search-change="handleSearch"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<!-- 操作列:编辑按钮 -->
|
||||
<template #menu="{ row, size }">
|
||||
|
|
@ -81,7 +94,8 @@ import { Edit,Delete } from '@element-plus/icons-vue';
|
|||
import {
|
||||
selectRectificationListApi,
|
||||
updateRectificationApi,
|
||||
deleteRectificationApi
|
||||
deleteRectificationApi,
|
||||
issueRectificationApi
|
||||
} from '@/api/archivesManagement/fileManager/fileManager.js';
|
||||
|
||||
const route = useRoute();
|
||||
|
|
@ -91,7 +105,9 @@ const router = useRouter();
|
|||
const projectId = route.query.projectId;
|
||||
|
||||
const loading = ref(false);
|
||||
const issueLoading = ref(false); // 下发按钮加载状态
|
||||
const tableData = ref([]);
|
||||
const selectedRows = ref([]); // 选中的行数据
|
||||
const page = reactive({
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
|
|
@ -99,7 +115,7 @@ const page = reactive({
|
|||
});
|
||||
const searchParams = ref({}); // 存储搜索参数
|
||||
|
||||
// 表格配置:保留操作列
|
||||
// 表格配置:添加复选框列
|
||||
const option = reactive({
|
||||
height: 'auto',
|
||||
index: true,
|
||||
|
|
@ -115,7 +131,18 @@ const option = reactive({
|
|||
searchShow: true, // 显示搜索区域
|
||||
searchMenuSpan: 6, // 搜索按钮占用的栅格数
|
||||
searchMenuAlign: 'right', // 搜索按钮对齐方式
|
||||
selection: true, // 启用复选框
|
||||
selectable: (row, index) => {
|
||||
// 根据 isIssue 字段判断是否可选
|
||||
return row.isIssue !== 1; // isIssue 为 1 时不可选
|
||||
},
|
||||
column: [
|
||||
{
|
||||
type: 'selection',
|
||||
width: 55,
|
||||
align: 'center',
|
||||
reserveSelection: true
|
||||
},
|
||||
{
|
||||
label: '项目名称',
|
||||
prop: 'proName',
|
||||
|
|
@ -133,6 +160,21 @@ const option = reactive({
|
|||
label: '整改内容',
|
||||
prop: 'description',
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
label: '下发状态',
|
||||
prop: 'isIssue',
|
||||
type: 'tag',
|
||||
align: 'center',
|
||||
width: 100,
|
||||
dicData: [
|
||||
{ label: '未下发', value: 0 },
|
||||
{ label: '已下发', value: 1 }
|
||||
],
|
||||
colors: {
|
||||
0: 'warning',
|
||||
1: 'success'
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
|
@ -170,6 +212,7 @@ const onLoad = async (pageParam = page) => {
|
|||
const handleResetSearch = (done) => {
|
||||
searchParams.value = {}; // 清空搜索条件
|
||||
page.currentPage = 1; // 重置到第一页
|
||||
selectedRows.value = []; // 清空选择
|
||||
onLoad(); // 重新加载数据
|
||||
done && done(); // 通知 Avue 搜索已完成(可选)
|
||||
};
|
||||
|
|
@ -181,6 +224,7 @@ const handleSearch = (params, done) => {
|
|||
console.log('查询参数:', searchParams.value);
|
||||
// 重新加载数据
|
||||
page.currentPage = 1; // 重置到第一页
|
||||
selectedRows.value = []; // 清空选择
|
||||
onLoad();
|
||||
done && done(); // 完成查询
|
||||
};
|
||||
|
|
@ -188,18 +232,76 @@ const handleSearch = (params, done) => {
|
|||
// 分页方法
|
||||
const handleCurrentChange = (val) => {
|
||||
page.currentPage = val;
|
||||
selectedRows.value = []; // 清空选择
|
||||
onLoad();
|
||||
};
|
||||
const handleSizeChange = (val) => {
|
||||
page.pageSize = val;
|
||||
selectedRows.value = []; // 清空选择
|
||||
onLoad();
|
||||
};
|
||||
|
||||
// 选择改变事件
|
||||
const handleSelectionChange = (selection) => {
|
||||
selectedRows.value = selection;
|
||||
console.log('选中的行:', selectedRows.value);
|
||||
};
|
||||
|
||||
// 返回
|
||||
const goBack = () => {
|
||||
router.go(-1);
|
||||
};
|
||||
|
||||
// ================== 下发功能 ==================
|
||||
const handleIssue = async () => {
|
||||
if (selectedRows.value.length === 0) {
|
||||
ElMessage.warning('请先选择要下发的整改项');
|
||||
return;
|
||||
}
|
||||
|
||||
// 过滤已下发的项
|
||||
const pendingRows = selectedRows.value.filter(row => row.isIssue !== 1);
|
||||
if (pendingRows.length === 0) {
|
||||
ElMessage.warning('选中的项已全部下发,无需重复操作');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
await ElMessageBox.confirm(
|
||||
`确定要下发选中的 ${pendingRows.length} 项整改内容吗?`,
|
||||
'提示',
|
||||
{
|
||||
confirmButtonText: '确定下发',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}
|
||||
);
|
||||
|
||||
issueLoading.value = true;
|
||||
|
||||
// 提取ID数组
|
||||
const ids = pendingRows.map(row => row.id);
|
||||
|
||||
const res = await issueRectificationApi({ ids });
|
||||
|
||||
if (res.data?.code === 200) {
|
||||
ElMessage.success(`成功下发 ${pendingRows.length} 项整改内容`);
|
||||
selectedRows.value = []; // 清空选择
|
||||
onLoad(); // 刷新列表
|
||||
} else {
|
||||
ElMessage.error(res.data?.msg || '下发失败');
|
||||
}
|
||||
} catch (error) {
|
||||
if (error === 'cancel') {
|
||||
return; // 用户取消,不处理
|
||||
}
|
||||
ElMessage.error('下发失败:' + (error.message || '请检查网络或参数'));
|
||||
console.error('下发请求异常:', error);
|
||||
} finally {
|
||||
issueLoading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
// ================== 编辑功能 ==================
|
||||
const dialogVisible = ref(false);
|
||||
const formData = ref({});
|
||||
|
|
@ -273,6 +375,7 @@ const submitEdit = async () => {
|
|||
submitLoading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
// 移除整改项
|
||||
const handleRemove = async (row) => {
|
||||
// 安全检查
|
||||
|
|
@ -319,4 +422,9 @@ const handleRemove = async (row) => {
|
|||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.operation-bar {
|
||||
margin-bottom: 15px;
|
||||
padding: 10px 0;
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
Loading…
Reference in New Issue