<template> <div class="app-container"> <!-- 项目里程碑 --> <!-- 搜索栏 --> <el-form :model="queryParams" ref="queryRef" inline v-show="showSearch"> <el-form-item label="项目名称:"> <el-input v-model="queryParams.projectName" placeholder="请输入项目名称" clearable style="width: 240px" @keyup.enter="handleQuery" /> </el-form-item> <el-form-item label="里程碑名称:"> <el-input v-model="queryParams.milestoneName" placeholder="请输入里程碑名称" clearable style="width: 240px" @keyup.enter="handleQuery" /> </el-form-item> <!-- <br /> --> <el-form-item label="日期:"> <el-date-picker v-model="queryParams.timer" type="daterange" unlink-panels range-separator="至" start-placeholder="开始时间" end-placeholder="结束时间" format="YYYY-MM-DD" value-format="YYYY-MM-DD" /> </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" v-hasPermi="['system:post:add']" >新增</el-button > </el-col> <right-toolbar v-model:showSearch="showSearch" @queryTable="getList" ></right-toolbar> </el-row> <!-- 表格 --> <el-table v-loading="loading" :data="postList" @selection-change="handleSelectionChange" max-height="500" > <el-table-column label="序号" type="index" width="60" align="center" /> <el-table-column :label="i.label" align="center" :prop="i.props" show-overflow-tooltip v-for="i in projectMilestonesCloum" > <template #default="{ row }" v-if="i.props == 'finishDate'"> {{row.finishDate.substring(0, 10) }} </template> <template #default="{ row }" v-if="i.props == 'createTime'"> {{row.createTime.substring(0, 10) }} </template> </el-table-column> <el-table-column label="操作" width="250" align="center" class-name="small-padding fixed-width" > <template #default="scope"> <el-button link type="primary" icon="View" @click="handleDetails(scope.row)" v-hasPermi="['system:post:View']" >详情</el-button > <el-button link type="warning" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['system:post:edit']" >修改</el-button > <el-button link type="danger" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['system:post:remove']" >删除</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="getList" /> <!-- 添加或修改对话框 --> <el-dialog :title="title" v-model="open" width="800px"> <el-form ref="postRef" :model="form" :rules="rules" label-width="auto" :disabled="isDisabled" > <el-form-item label="项目名称:" prop="projectNo"> <el-select style="width: 100%" v-model="form.projectNo" placeholder="请选择项目" clearable @change="TouBiaoInfo(form.projectNo, 'add')" > <el-option v-for="dict in ProjectListData" :key="dict.projectNo" :label="dict.projectName" :value="dict.projectNo" /> </el-select> </el-form-item> <el-form-item label="项目编号:"> <el-input v-model="form.projectNo" placeholder="请先选择项目" disabled /> </el-form-item> <br /> <el-form-item label="里程碑:" prop="milestoneId"> <el-select style="width: 100%" v-model="form.milestoneId" placeholder="请选择里程碑" clearable @change="BiaoShuChange" > <el-option v-for="dict in BiaoShuList" :key="dict.milestoneId" :label="dict.nodeName" :value="dict.milestoneId" /> </el-select> </el-form-item> <el-form-item label="里程碑编号:" style="width: 31%; display: none"> <el-input v-model="form.milestoneName" disasbed class="readonlyClass" placeholder="请输入里程碑编号" /> </el-form-item> <el-form-item label="完成日期:"> <el-date-picker style="width: 100%" v-model="form.finishDate" type="date" placeholder="请选择完成日期" format="YYYY-MM-DD" class="readonlyClass" value-format="YYYY-MM-DD" /> </el-form-item> </el-form> <template #footer> <div class="dialog-footer"> <el-button type="primary" @click="submitForm" v-if="title!= '查看项目里程碑'">保 存</el-button> <el-button @click="cancel">关 闭</el-button> </div> </template> </el-dialog> </div> </template> <script setup name="Post"> import { ElMessage, ElMessageBox } from "element-plus"; import { projectMilestonePage, projectMilestoneAdd, projectMilestoneIDS, projectMilestoneId, projectMilestoneEdit, projectInfoList, projectPlanInventorySelectByProjectNoToMilestone, } from "@/api/project/tenderReview"; import { projectMilestonesCloum } from "@/utils/cloums"; import { getToken } from "@/utils/auth"; import { ref } from "vue"; const { proxy } = getCurrentInstance(); const postList = ref([]); const open = ref(false); const open2 = ref(false); const loading = ref(true); const showSearch = ref(true); const ids = ref([]); const single = ref(true); const multiple = ref(true); const total = ref(0); const title = ref(""); const isDisabled = ref(false); const data = reactive({ form: {}, queryParams: { pageNum: 1, pageSize: 10, milestoneName: undefined, projectName: undefined, timer: "", finishStartDate: "", finishEndDate: "", }, rules: { projectNo: [ { required: true, message: "项目名称不能为空", trigger: "blur" }, ], milestoneId: [ { required: true, message: "里程碑不能为空", trigger: "blur" }, ], }, DetailData: {}, }); const { queryParams, form, rules, DetailData } = toRefs(data); const BiaoShuList = ref([]); const ProjectListData = ref([]); const dialogType = ref(""); const uploadHeader = ref({ Authorization: "Bearer " + getToken(), }); /** 文件上传 */ const fileList1 = ref([]); function handlePreview(file) { console.log(file); return ElMessageBox.confirm(`下载此文件: ${file.name}?`).then( () => window.open(file.url), () => false ); } function beforeRemove(file) { return true } /** 查询列表 */ function getList() { loading.value = true; projectMilestonePage(queryParams.value).then((response) => { postList.value = response.data; total.value = response.total; loading.value = false; }); } /** 取消按钮 */ function cancel() { open.value = false; reset(); } /** 表单重置 */ function reset() { form.value = { id: undefined, projectNo: undefined, milestoneId: undefined, milestoneName: undefined, finishDate: undefined, }; BiaoShuList.value = []; fileList1.value = []; proxy.resetForm("postRef"); } /** 搜索按钮操作 */ function handleQuery() { if (queryParams.value.timer) { queryParams.value.finishStartDate = queryParams.value.timer[0]; queryParams.value.finishEndDate = queryParams.value.timer[1]; } else { queryParams.value.finishStartDate = ""; queryParams.value.finishEndDate = ""; } queryParams.value.pageNum = 1; getList(); } /** 重置按钮操作 */ function resetQuery() { // proxy.resetForm("queryRef"); queryParams.value = { pageNum: 1, pageSize: 10, }; getList(); } /** 多选框选中数据 */ function handleSelectionChange(selection) { ids.value = selection.map((item) => item.postId); single.value = selection.length != 1; multiple.value = !selection.length; } /** 新增按钮操作 */ function handleAdd() { reset(); open.value = true; isDisabled.value = false; dialogType.value = "add"; title.value = "添加项目里程碑"; } /** 修改按钮操作 */ function handleUpdate(row) { reset(); const id = row.id || ids.value; dialogType.value = "edit"; projectMilestoneId(id).then((response) => { form.value = response.data; TouBiaoInfo(form.value.projectNo, "edit"); open.value = true; isDisabled.value = false; title.value = "修改项目里程碑"; }); } /** 提交按钮 */ function submitForm() { proxy.$refs["postRef"].validate((valid) => { if (valid) { if (form.value.id != undefined) { projectMilestoneEdit(form.value).then((response) => { proxy.$modal.msgSuccess("修改成功"); open.value = false; getList(); }); } else { projectMilestoneAdd(form.value).then((response) => { proxy.$modal.msgSuccess("新增成功"); open.value = false; getList(); }); } } }); } /** 删除按钮操作 */ function handleDelete(row) { const id = row.id || ids.value; proxy.$modal .confirm('是否确认删除编号为"' + id + '"的数据项?') .then(function () { return projectMilestoneIDS(id); }) .then(() => { getList(); proxy.$modal.msgSuccess("删除成功"); }) .catch(() => {}); } /** 导出按钮操作 */ function handleExport() { proxy.download( "system/post/export", { ...queryParams.value, }, `post_${new Date().getTime()}.xlsx` ); } /**通过项目编号获取投标信息 */ function TouBiaoInfo(projectNo, type) { if (type == "add") { BiaoShuList.value = []; form.value.milestoneId = []; form.value.milestoneName = []; } projectPlanInventorySelectByProjectNoToMilestone(projectNo).then( (response) => { BiaoShuList.value = response.data; } ); } /**选择/修改 里程碑 */ function BiaoShuChange(val) { console.log(val); BiaoShuList.value.forEach((element) => { if (element.milestoneId == val) { form.value.milestoneName = element.nodeName; } }); } /**获取所有的项目数据 */ function loadProjerctListData() { projectInfoList().then((response) => { ProjectListData.value = response.data; }); } /**详情按钮 */ function handleDetails(row) { reset(); const id = row.id || ids.value; projectMilestoneId(id).then((response) => { form.value = response.data; // TouBiaoInfo(form.value.projectNo, 'edit') open.value = true; isDisabled.value = true; TouBiaoInfo(form.value.projectNo, "info"); title.value = "查看项目里程碑"; }); } getList(); loadProjerctListData(); </script> <style scoped lang="scss"> :deep(.el-dialog__body) { background-color: #eef1fb; height: auto; max-height: 750px; overflow: auto; } #DiaLogBox { .DetailHeader { width: 100%; height: 54px; line-height: 53px; box-sizing: border-box; border-top: 1px solid #eaeaea; background-color: #fff; .DetailName { font-size: 14px; font-family: Source Han Sans CN; font-weight: bold; color: #333333; margin: 0 10px 0 20px; } .DetailTypeName { width: 66px; height: 20px; background: #dffff0; border: 1px solid #3ad68e; border-radius: 2px; font-size: 14px; font-family: Source Han Sans CN; font-weight: bold; color: #3ad68e; margin-right: 20px; } .DetailNo { font-size: 14px; font-family: Source Han Sans CN; font-weight: bold; color: #666666; } } .DetailMoney { width: 100%; height: 111px; background: #ffffff; box-shadow: 0px 2px 6px 0px rgba(28, 52, 92, 0.1); border-radius: 6px; margin-top: 20px; .MoneyList { width: 230px; height: 70px; background: #f8faff; border: 1px solid #eaeaea; border-radius: 2px; float: left; margin: 20px; box-sizing: border-box; padding-left: 24px; .leftBox { width: 130px; height: 70px; float: left; .Left_top { width: 100%; height: 35px; line-height: 40px; text-align: left; font-size: 24px; font-family: Source Han Sans CN; font-weight: 500; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; } .Left_Bottom { width: 100%; height: 35px; line-height: 30px; text-align: left; font-size: 14px; font-family: Source Han Sans CN; font-weight: 500; color: #333333; } } .RightBox { float: left; width: 70px; height: 70px; .progressDom { width: 50px; height: 50px; margin: 10px; } } } } .ProjectInfo { width: 100%; height: auto; background: #ffffff; box-shadow: 0px 2px 6px 0px rgba(28, 52, 92, 0.1); border-radius: 6px; font-size: 0; margin-top: 20px; .ProjectInfoTitle { width: 100%; height: 50px; line-height: 50px; box-sizing: border-box; padding-left: 24px; font-size: 16px; font-family: Source Han Sans CN; font-weight: bold; color: #333333; margin: 0; } .InfoList { display: inline-block; width: 50%; height: 42px; border: 1px solid #d8ddef; box-sizing: border-box; // margin-left: 1%; .InfoListLable { height: 40px; line-height: 40px; width: 100px; float: left; background-color: #f3f7ff; box-sizing: border-box; font-size: 14px; font-family: Source Han Sans CN; font-weight: 500; color: #666666; text-align: center; } .InfoListvalue { width: calc(100% - 100px); height: 40px; line-height: 40px; float: left; font-size: 14px; font-family: Source Han Sans CN; font-weight: bold; color: #333333; text-align: right; padding-right: 10px; } } .InfoList2 { width: 100%; height: 82px; .InfoListLable { height: 100%; height: 80px; line-height: 80px; } .InfoListvalue { height: 100%; height: 80px; } } .InfoList3 { width: 100%; min-height: 60px; height: auto; .InfoListLable { width: 100px; float: left; font-size: 14px; font-family: Source Han Sans CN; font-weight: 500; color: #000000; text-align: center; line-height: 60px; } .InfoListvalue { float: left; width: calc(100% - 100px); height: auto; } } } } .readonlyClass :deep(.el-input__wrapper) { background: #f0f0f0 !important; user-select: none !important; } </style>