<template> <div class="operate"> <el-table :data="tableData" v-loading="loading" stripe :max-height="600" ref="multipleTableRef" > <el-table-column label="关键里程碑编号" align="center" prop="projectNo" show-overflow-tooltip width="140" /> <el-table-column label="名称" align="center" prop="nodeName" show-overflow-tooltip width="160" /> <el-table-column label="项目编号" prop="projectNo" align="center" show-overflow-tooltip width="160" /> <el-table-column label="项目名称" prop="projectName" align="center" show-overflow-tooltip width="160" /> <el-table-column label="当月计划资金(万元)" align="center" prop="plannedFundsMonth" show-overflow-tooltip width="160" /> <el-table-column label="实际使用资金(万元)" align="center" prop="actualUseFunds" show-overflow-tooltip width="160" /> <el-table-column label="资金描述" align="center" prop="capitalDescription" show-overflow-tooltip width="160" /> <el-table-column label="填报时间" align="center" prop="fillTime" show-overflow-tooltip width="160" /> <el-table-column label="实际完成时间" align="center" prop="actualFinishTime" show-overflow-tooltip width="160" /> <el-table-column label="进度偏差" align="center" prop="scheduleVariance" show-overflow-tooltip width="160" /> <el-table-column label="超期天数" align="center" prop="timeoutDays" show-overflow-tooltip width="160" /> <el-table-column label="进度描述" align="center" prop="planDescription" show-overflow-tooltip width="160" /> <el-table-column label="操作" align="center" show-overflow-tooltip width="170" fixed="right" v-if="opts.type === 'edit'"> <template #default="{ row }"> <el-button type="primary" link @click="openDialog(row)">编辑</el-button> </template> </el-table-column> </el-table> <pagination class="pagination" :total="total" v-model:page="pageNum" v-model:limit="pageSize" @pagination="getTableList" /> <el-dialog v-model="visible" title="修改" :close-on-click-modal="false" width="50%" :before-close="close" class="dialog" > <el-form ref="ruleForm" :model="form" :rules="rules" > <el-row :gutter="20"> <el-col :span="12"> <el-form-item label="当月计划资金(万元):" prop="plannedFundsMonth"> <el-input v-model="form.plannedFundsMonth" placeholder="请输入当月计划资金" style="width: 100%" ></el-input> </el-form-item> </el-col> <el-col :span="12"> <el-form-item label="实际使用资金(万元):" prop="actualUseFunds"> <el-input v-model="form.actualUseFunds" placeholder="请输入实际使用资金" style="width: 100%" ></el-input> </el-form-item> </el-col> </el-row> <el-row :gutter="20"> <el-col :span="24"> <el-form-item label="资金描述:" prop="capitalDescription"> <el-input type="textarea" v-model="form.capitalDescription" placeholder="请输入资金描述" style="width: 100%" resize="none" ></el-input> </el-form-item> </el-col> </el-row> <el-row :gutter="20"> <el-col :span="12"> <el-form-item label="进度偏差:" prop="scheduleVariance"> <el-input v-model="form.scheduleVariance" placeholder="请输入进度偏差" style="width: 100%" ></el-input> </el-form-item> </el-col> <el-col :span="12"> <el-form-item label="超期天数:" prop="timeoutDays"> <el-input v-model="form.timeoutDays" placeholder="请输入超期天数" style="width: 100%" ></el-input> </el-form-item> </el-col> </el-row> <el-row :gutter="20"> <el-col :span="24"> <el-form-item label="进度描述:" prop="planDescription"> <el-input type="textarea" v-model="form.planDescription" placeholder="请输入进度描述" style="width: 100%" resize="none" ></el-input> </el-form-item> </el-col> </el-row> </el-form> <template #footer> <div class="dialog-footer"> <el-button type="primary" @click="submit">确 定</el-button> <el-button @click="close">取 消</el-button> </div> </template> </el-dialog> </div> </template> <script setup> import { ref, reactive, watch, onMounted, shallowRef } from 'vue' import { usePagination } from '@/hooks' import { getProjectFundAnalysisPage, projectFundAnalysisEdit } from '@/api/fundAnalysis' import { required } from '@/utils/validate-helper' import { inheritAttr } from '@/utils/v3' const { proxy } = getCurrentInstance() const props = defineProps({ curRow: { type: Object, default: () => ({}) }, opts: { type: Object, default: () => ({}) } }) const { curRow, opts } = props const visible = ref(false) const form = reactive({ id: '', plannedFundsMonth: '', actualUseFunds: '', capitalDescription: '', scheduleVariance: '', timeoutDays: '', planDescription: '' }) const rules = reactive({ plannedFundsMonth: required('当月计划资金'), actualUseFunds: required('实际使用资金'), capitalDescription: required('资金描述'), scheduleVariance: required('进度偏差'), timeoutDays: required('超期天数'), planDescription: required('进度描述') }) const { pageNum, pageSize, tableData, total, loading, getTableList } = usePagination(getProjectFundAnalysisPage, { value: { projectNo: curRow.projectNo || '' } }) const submit = () => { proxy.$refs.ruleForm.validate(async (valid, fields) => { if(valid){ const res = await projectFundAnalysisEdit(form) if(res?.code !== 200) return proxy.$modal.msgSuccess('操作成功!') close() getTableList() } else { console.log('error submit!', fields) } }) } const close = () => { visible.value = false proxy.$refs.ruleForm.resetFields() } const openDialog = (row) => { inheritAttr(row, form) visible.value = true } onMounted(() => { getTableList() }) defineExpose({ submit }) </script> <style lang="scss" scoped> .pagination { ::v-deep(.el-pagination) { right: 20px; } } </style>