<template> <div class="publicContainer"> <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch"> <el-form-item label="名称:" prop="riverName" style="width: 250px"> <el-input v-model="queryParams.riverName" placeholder="请输入名称" clearable /> </el-form-item> <el-form-item> <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button> <el-button type="primary" icon="Plus" @click="handleAdd">新增</el-button> <el-button icon="Refresh" @click="resetQuery">重置</el-button> </el-form-item> </el-form> <!-- 表格 --> <el-table :data="dataList" :span-method="objectSpanMethod" v-loading="loading" stripe :max-height="680"> <el-table-column type="index" label="序号" width="60" /> <!-- <el-table-column label="排水分区" prop="belongPartition"> <template #default="scope"> <span>{{ scope.row.belongPartition == '1' ? '老城区排水分区' : scope.row.belongPartition == '2' ? '东部排水分区' : scope.row.belongPartition == '3' ? '西部排水分区' : scope.row.belongPartition == '4' ? '南部排水分区' : scope.row.belongPartition == '5' ? '北部排水分区' : scope.row.belongPartition == '6' ? '示范区排水分区' : scope.row.belongPartition == '7' ? '正在整治积水点' : '' }}</span> </template> </el-table-column> --> <el-table-column label="名称" prop="name" width="150" /> <el-table-column label="编码" prop="pointCode" width="150" /> <el-table-column label="位置" prop="address" width="350" /> <el-table-column label="治理方案" prop="solution" width="350" /> <el-table-column label="现状积水深度(cm)" prop="nowPondingDeep" /> <el-table-column label="编现状积水时间(h)" prop="address" /> <el-table-column label="建设开始时间" prop="transformStartTime" width="160" /> <el-table-column label="建设结束时间" prop="transformEndTime" width="160" /> <!-- <el-table-column label="纬度" prop="latitude" width="110" /> <el-table-column label="经度" prop="longitude" width="110" /> --> <!-- <el-table-column label="治理前照片" prop="address" /> <el-table-column label="施工照片" prop="constructionPhoto" /> <el-table-column label="治理完工照片" prop="address" /> --> <el-table-column label="操作" width="280"> <template #default="scope"> <el-button link icon="View" type="primary" @click="handleDetail(scope.row, 'view')">查看</el-button> <el-button link type="warning" icon="Edit" @click="handleUpdate(scope.row, 'view')">修改</el-button> <el-button link type="danger" icon="Delete" @click="handleDelete(scope.row, 'view')">删除</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" append-to-body :close-on-click-modal="false"> <el-form ref="roleRef" :model="form" :rules="rules" label-width="140px" :disabled="multiple"> <el-row :gutter="20"> <el-col :span="12"> <el-form-item label="名称" prop="name"> <el-input v-model="form.name" placeholder="请输入名称名称" clearable style="width: 100%" /> </el-form-item> </el-col> <el-col :span="12"> <el-form-item label="编码:" prop="pointCode"> <el-input v-model="form.pointCode" placeholder="请输入编码" clearable style="width: 100%" /> </el-form-item> </el-col> </el-row> <el-row :gutter="20"> <el-col :span="12"> <el-form-item label="现状积水深度(cm):" prop="address"> <el-input v-model="form.address" placeholder="请输入现状积水深度(cm)" clearable style="width: 100%" /> </el-form-item> </el-col> <el-col :span="12"> <el-form-item label="责任单位:" prop="responsibilityUnit"> <el-input v-model="form.responsibilityUnit" placeholder="请输入责任单位" clearable style="width: 100%" /> </el-form-item> </el-col> </el-row> <el-row :gutter="20"> <el-col :span="24"> <el-form-item label="位置:" prop="alreadyMeasure"> <el-input type="textarea" :rows="5" v-model="form.alreadyMeasure" placeholder="请输入位置" clearable style="width: 100%" /> </el-form-item> </el-col> <el-col :span="24"> <el-form-item label="治理方案:" prop="emergencyMeasure"> <el-input type="textarea" :rows="5" v-model="form.emergencyMeasure" placeholder="请输入治理方案" clearable style="width: 100%" /> </el-form-item> </el-col> </el-row> </el-form> <template #footer> <div class="dialog-footer"> <el-button type="primary" @click="submitForm">确 定</el-button> <el-button @click="cancel">取 消</el-button> </div> </template> </el-dialog> </div> </template> <script setup name="AccumulatedWater"> import { waterloggingPointpage, waterloggedRoadedit, waterloggedRoadadd, waterloggedRoaddelete, } from '@/api/longoPeration/AccumulatedWater'; const { proxy } = getCurrentInstance(); const showSearch = ref(true); const title = ref(''); const multiple = ref(false); const open = ref(false); const loading = ref(true); const total = ref(0); const AllData = reactive({ form: {}, queryParams: { pageNum: 1, pageSize: 10, belongPartition: '', }, rules: { belongPartition: [{ required: true, message: '请选择排水分区', trigger: 'blur' }], roadName: [{ required: true, message: '请输入道路名称', trigger: 'blur' }], address: [{ required: true, message: '请输入积水点位置', trigger: 'blur' }], responsibilityUnit: [{ required: true, message: '请输入责任单位', trigger: 'blur' }], alreadyMeasure: [{ required: true, message: '请输入已采取工程措施', trigger: 'blur' }], emergencyMeasure: [{ required: true, message: '请输入应急处置措施', trigger: 'blur' }], }, }); const { queryParams, rules, form } = toRefs(AllData); const dataList = ref([]); //搜索 function handleQuery() { getList(); } //重置 function resetQuery() { proxy.resetForm('queryRef'); handleQuery(); } // 新增 function handleAdd() { title.value = '新增积水点'; open.value = true; form.value = {}; multiple.value = false; } // 新增中取消事件 function cancel() { open.value = false; proxy.resetForm('roleRef'); } //查看详情操作 function handleDetail(row) { open.value = true; multiple.value = true; title.value = '查看积水点'; form.value = { ...row }; } // 修改按钮操作 function handleUpdate(row) { open.value = true; title.value = '修改积水点'; multiple.value = false; form.value = { ...row }; } /** 搜索列表 */ const getList = async () => { loading.value = true; let res = await waterloggingPointpage(queryParams.value); dataList.value = res.data; total.value = res.total; loading.value = false; }; /** 新增弹框 修改弹框 提交按钮 */ async function submitForm() { proxy.$refs['roleRef'].validate(valid => { if (valid) { if (form.value.id != undefined) { waterloggedRoadedit(form.value).then(() => { proxy.$modal.msgSuccess('修改成功'); open.value = false; getList(); }); } else { waterloggedRoadadd(form.value).then(() => { proxy.$modal.msgSuccess('新增成功'); open.value = false; getList(); }); } } }); } // 表格删除 function handleDelete(row) { proxy.$modal .confirm('是否确认删除?') .then(async () => { const res = await waterloggedRoaddelete(row.id); if (res?.code !== 200) return; proxy.$modal.msgSuccess('操作成功!'); getList(); }) .catch(() => {}); } onMounted(() => { getList(); }); </script>