<template> <!-- 项目规划管理(应标) --> <div class="publicContainer"> <!-- 搜索区域 --> <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch"> <el-form-item label="项目名称:" prop="projectCode"> <el-select clearable v-model="queryParams.projectCode" style="width: 180px" placeholder="请选择项目名称"> <el-option v-for="proj in projectTList" :key="proj.projectNo" :label="proj.projectName" :value="proj.projectNo" /> </el-select> </el-form-item> <el-form-item> <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button> <el-button icon="Refresh" @click="resetQuery">重置</el-button> </el-form-item> </el-form> <!-- 按钮区域 --> <el-row :gutter="10" class="mb8"> <el-col :span="1.5"> <el-button type="primary" plain icon="Plus" @click="handleAdd">新增</el-button> </el-col> <right-toolbar v-model:showSearch="showSearch" @queryTable="getDataList"></right-toolbar> </el-row> <!-- 表格 --> <el-table v-loading="tableLoading" :data="tableData" max-height="650"> <el-table-column label="项目名称" prop="projectName" /> <el-table-column label="国土空间规划" prop="gtkjghFiles"> <template #default="scope"> <span class="filePreview" @click="previewPdf(scope.row.gtkjghFiles)"> {{ scope.row.gtkjghFiles.length > 0 ? scope.row.gtkjghFiles[0].name : '--' }} </span> </template> </el-table-column> <el-table-column label="海绵专篇" prop="hmcszp"> <template #default="scope"> <span class="filePreview" @click="previewPdf(scope.row.hmcszp)"> {{ scope.row.hmcszp.length > 0 ? scope.row.hmcszp[0].name : '--' }} </span> </template> </el-table-column> <el-table-column label="城市绿地系统专项规划" prop="ldxtzxghFiles"> <template #default="scope"> <span class="filePreview" @click="previewPdf(scope.row.ldxtzxghFiles)"> {{ scope.row.ldxtzxghFiles.length > 0 ? scope.row.ldxtzxghFiles[0].name : '--' }} </span> </template> </el-table-column> <el-table-column label="城市道路交通专项规划" prop="csjtdlzxghFiles"> <template #default="scope"> <span class="filePreview" @click="previewPdf(scope.row.csjtdlzxghFiles)"> {{ scope.row.csjtdlzxghFiles.length > 0 ? scope.row.csjtdlzxghFiles[0].name : '--' }} </span> </template> </el-table-column> <el-table-column label="发布时间" prop="createTime" /> <el-table-column label="操作" width="160" class-name="small-padding fixed-width"> <template #default="scope"> <el-button link type="warning" icon="Edit" @click="handleUpdate(scope.row)">修改</el-button> <el-button link type="danger" icon="Delete" @click="handleDelete(scope.row)"> 删除 </el-button> </template> </el-table-column> </el-table> <!-- 分页 --> <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getDataList" /> <!-- 添加或修改弹窗 --> <el-dialog :title="dialogTitle" v-model="dialogShow" width="1000px" append-to-body> <el-form ref="formRef" :model="formData" :rules="rulesForm" label-width="180px" class="publicForm"> <el-form-item label="项目名称:" prop="projectCode"> <el-select v-model="formData.projectCode" filterable clearable placeholder="请选择项目名称"> <el-option v-for="proj in projectTList" :key="proj.projectNo" :label="proj.projectName" :value="proj.projectNo" /> </el-select> </el-form-item> <el-form-item label="国土空间规划:" prop="gtkjghFiles"> <ImageFileUpload :limit="1" :listType="'text'" :saveFileArr="formData.gtkjghFiles" :fileType="['pdf']"></ImageFileUpload> </el-form-item> <el-form-item label="城市供水:" prop="csgsFiles"> <ImageFileUpload :limit="1" :listType="'text'" :saveFileArr="formData.csgsFiles" :fileType="['pdf']"></ImageFileUpload> </el-form-item> <el-form-item label="城市节水:" prop="csjsFiles"> <ImageFileUpload :limit="1" :listType="'text'" :saveFileArr="formData.csjsFiles" :fileType="['pdf']"></ImageFileUpload> </el-form-item> <el-form-item label="污水处理及再生:" prop="wscljzsFiles"> <ImageFileUpload :limit="1" :listType="'text'" :saveFileArr="formData.wscljzsFiles" :fileType="['pdf']"></ImageFileUpload> </el-form-item> <el-form-item label="城市防洪:" prop="csfhFiles"> <ImageFileUpload :limit="1" :listType="'text'" :saveFileArr="formData.csfhFiles" :fileType="['pdf']"></ImageFileUpload> </el-form-item> <el-form-item label="城市排水防涝:" prop="cspsflFiles"> <ImageFileUpload :limit="1" :listType="'text'" :saveFileArr="formData.cspsflFiles" :fileType="['pdf']"></ImageFileUpload> </el-form-item> <el-form-item label="城市水体:" prop="csstFiles"> <ImageFileUpload :limit="1" :listType="'text'" :saveFileArr="formData.csstFiles" :fileType="['pdf']"></ImageFileUpload> </el-form-item> <el-form-item label="绿地系统专项规划:" prop="ldxtzxghFiles"> <ImageFileUpload :limit="1" :listType="'text'" :saveFileArr="formData.ldxtzxghFiles" :fileType="['pdf']"></ImageFileUpload> </el-form-item> <el-form-item label="城市交通道路专项规划:" prop="csjtdlzxghFiles"> <ImageFileUpload :limit="1" :listType="'text'" :saveFileArr="formData.csjtdlzxghFiles" :fileType="['pdf']"></ImageFileUpload> </el-form-item> </el-form> <template #footer> <div class="dialog-footer"> <el-button type="info" @click="cancelForm">取 消</el-button> <el-button type="primary" @click="submitForm">确 定</el-button> </div> </template> </el-dialog> </div> </template> <script setup> import ImageFileUpload from '@/components/ImageFileUpload/index.vue'; //图片文件上传 import { projectOtherFilePage, projectOtherFileAdd, projectOtherFileDel, projectNoticeDetail, projectOtherFileEdit, } from '@/api/document/projectTransfer'; import { getProjectInfoList } from '@/api/preassess/targetManage'; const { proxy } = getCurrentInstance(); const { notice_board_type } = proxy.useDict('notice_board_type'); const tableData = ref([]); const tableLoading = ref(true); const total = ref(0); const dialogShow = ref(false); const dialogTitle = ref(''); const showSearch = ref(true); const checkedIds = ref([]); const projectTList = ref([]); const allData = reactive({ formData: { gtkjghFiles: [], csgsFiles: [], csjsFiles: [], wscljzsFiles: [], csfhFiles: [], cspsflFiles: [], csstFiles: [], ldxtzxghFiles: [], csjtdlzxghFiles: [], }, queryParams: { pageNum: 1, pageSize: 10, }, rulesForm: { projectCode: [{ required: true, message: '请选择项目名称', trigger: 'blur' }], }, }); const { queryParams, formData, rulesForm } = toRefs(allData); /** 获取搜索数据列表 */ function getDataList() { tableLoading.value = true; projectOtherFilePage(queryParams.value).then(response => { tableData.value = response.data; total.value = response.total; tableLoading.value = false; }); } /** 取消按钮 */ function cancelForm() { proxy.resetForm('formRef'); //清空表单 dialogShow.value = false; handleQuery(); } /** 搜索按钮操作 */ function handleQuery() { queryParams.value.pageNum = 1; getDataList(); } /** 重置按钮操作 */ function resetQuery() { proxy.resetForm('queryRef'); handleQuery(); } /** 新增按钮操作 */ function handleAdd() { dialogShow.value = true; formData.value.gtkjghFiles = []; formData.value.csgsFiles = []; formData.value.csjsFiles = []; formData.value.wscljzsFiles = []; formData.value.csfhFiles = []; formData.value.cspsflFiles = []; formData.value.csstFiles = []; formData.value.ldxtzxghFiles = []; formData.value.csjtdlzxghFiles = []; dialogTitle.value = '添加项目规划管理'; } /** 修改按钮操作 */ function handleUpdate(row) { dialogShow.value = true; dialogTitle.value = '修改项目规划管理'; formData.value.gtkjghFiles = []; formData.value.csgsFiles = []; formData.value.csjsFiles = []; formData.value.wscljzsFiles = []; formData.value.csfhFiles = []; formData.value.cspsflFiles = []; formData.value.csstFiles = []; formData.value.ldxtzxghFiles = []; formData.value.csjtdlzxghFiles = []; formData.value = { ...row }; } /** 提交按钮 */ function submitForm() { proxy.$refs['formRef'].validate(valid => { if (valid) { if (dialogTitle.value == '修改项目规划管理') { projectOtherFileEdit(formData.value).then(response => { proxy.$modal.msgSuccess('修改成功'); dialogShow.value = false; getDataList(); }); } else { projectOtherFileAdd(formData.value).then(response => { proxy.$modal.msgSuccess('新增成功'); dialogShow.value = false; getDataList(); }); } } }); } /** 删除按钮操作 */ function handleDelete(row) { const postIds = row.id || checkedIds.value; proxy.$modal .confirm('是否确认删除该数据项?') .then(function () { return projectOtherFileDel(postIds); }) .then(() => { getDataList(); proxy.$modal.msgSuccess('删除成功'); }) .catch(() => {}); } // 文件预览 function previewPdf(item) { if (item.length > 0) { window.open(item[0].url); } } // 项目接口 async function projectTypeListM() { let { data } = await getProjectInfoList(); projectTList.value = data; } onMounted(() => { getDataList(); projectTypeListM(); }); </script>