| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470 |
- <template>
- <div class="app-container">
- <!-- 搜索区域 -->
- <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
- <el-form-item label="管网编号" prop="pipeCode">
- <el-input v-model="queryParams.pipeCode" placeholder="请输入管网编号" clearable size="small" @keyup.enter="handleQuery" />
- </el-form-item>
- <el-form-item label="管网名称" prop="pipeName">
- <el-input v-model="queryParams.pipeName" placeholder="请输入管网名称" clearable size="small" @keyup.enter="handleQuery" />
- </el-form-item>
- <el-form-item label="管道材质" prop="pipeMaterial">
- <el-select v-model="queryParams.pipeMaterial" placeholder="请选择材质" clearable size="small" style="width: 120px">
- <el-option label="铸铁" value="铸铁" />
- <el-option label="PE" value="PE" />
- <el-option label="钢管" value="钢管" />
- <el-option label="球墨铸铁" value="球墨铸铁" />
- <el-option label="PVC" value="PVC" />
- <el-option label="混凝土" value="混凝土" />
- </el-select>
- </el-form-item>
- <el-form-item label="状态" prop="status">
- <el-select v-model="queryParams.status" placeholder="管网状态" clearable size="small" style="width: 120px">
- <el-option
- v-for="dict in sysNormalDisable"
- :key="dict.value"
- :label="dict.label"
- :value="dict.value"
- />
- </el-select>
- </el-form-item>
- <el-form-item label="创建时间">
- <el-date-picker
- v-model="dateRange"
- size="small"
- style="width: 240px"
- value-format="YYYY-MM-DD HH:mm:ss"
- type="datetimerange"
- range-separator="-"
- start-placeholder="开始日期"
- end-placeholder="结束日期"
- />
- </el-form-item>
- <el-form-item>
- <el-button type="primary" icon="Search" size="small" @click="handleQuery">搜索</el-button>
- <el-button icon="Refresh" size="small" @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" size="small" @click="handleAdd" v-hasPermi="['waterSupply:pipeInfo:add']">新增</el-button>
- </el-col>
- <el-col :span="1.5">
- <el-button type="danger" plain icon="Delete" size="small" :disabled="multiple" @click="handleDelete" v-hasPermi="['waterSupply:pipeInfo:remove']">删除</el-button>
- </el-col>
- <right-toolbar v-model:showSearch="showSearch" @queryTable="getList" />
- </el-row>
- <!-- 数据表格 -->
- <el-table v-loading="loading" :data="tableData" @selection-change="handleSelectionChange">
- <el-table-column type="selection" width="55" align="center" />
- <el-table-column label="管网编号" align="center" prop="pipeCode" :show-overflow-tooltip="true" min-width="120" />
- <el-table-column label="管网名称" align="center" prop="pipeName" :show-overflow-tooltip="true" min-width="140" />
- <el-table-column label="管道材质" align="center" prop="pipeMaterial" width="100">
- <template #default="{ row }">
- <el-tag :type="materialTagType(row.pipeMaterial)" size="small">{{ row.pipeMaterial || '-' }}</el-tag>
- </template>
- </el-table-column>
- <el-table-column label="管径(mm)" align="center" prop="pipeDiameter" width="100" />
- <el-table-column label="长度(m)" align="center" prop="pipeLength" width="100" />
- <el-table-column label="起点位置" align="center" prop="startPoint" :show-overflow-tooltip="true" min-width="140" />
- <el-table-column label="终点位置" align="center" prop="endPoint" :show-overflow-tooltip="true" min-width="140" />
- <el-table-column label="铺设年份" align="center" prop="layingYear" width="100" />
- <el-table-column label="设计压力(MPa)" align="center" prop="pressureRating" width="130" />
- <el-table-column label="状态" align="center" width="80">
- <template #default="{ row }">
- <el-tag
- :type="row.status == 1 ? 'success' : 'danger'"
- size="small"
- >
- {{ row.status == 1 ? '正常' : '停用' }}
- </el-tag>
- </template>
- </el-table-column>
- <el-table-column label="创建时间" align="center" prop="createTime" width="160" />
- <el-table-column label="操作" align="center" width="180" fixed="right">
- <template #default="{ row }">
- <el-button size="small" type="text" icon="View" @click="handleDetail(row)">详情</el-button>
- <el-button size="small" type="text" icon="Edit" @click="handleUpdate(row)" v-hasPermi="['waterSupply:pipeInfo:edit']">修改</el-button>
- <el-button size="small" type="text" icon="Delete" @click="handleDelete(row)" v-hasPermi="['waterSupply:pipeInfo: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="dialogTitle" v-model="dialogVisible" width="700px" append-to-body>
- <el-form ref="form" :model="form" :rules="rules" label-width="100px">
- <el-row :gutter="20">
- <el-col :span="12">
- <el-form-item label="管网编号" prop="pipeCode">
- <el-input v-model="form.pipeCode" placeholder="请输入管网编号" maxlength="50" />
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="管网名称" prop="pipeName">
- <el-input v-model="form.pipeName" placeholder="请输入管网名称" maxlength="100" />
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="管道材质" prop="pipeMaterial">
- <el-select v-model="form.pipeMaterial" placeholder="请选择管道材质" style="width: 100%">
- <el-option label="铸铁" value="铸铁" />
- <el-option label="PE" value="PE" />
- <el-option label="钢管" value="钢管" />
- <el-option label="球墨铸铁" value="球墨铸铁" />
- <el-option label="PVC" value="PVC" />
- <el-option label="混凝土" value="混凝土" />
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="管径(mm)" prop="pipeDiameter">
- <el-input-number v-model="form.pipeDiameter" :min="0" :precision="0" style="width: 100%" placeholder="请输入管径" />
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="管道长度(m)" prop="pipeLength">
- <el-input-number v-model="form.pipeLength" :min="0" :precision="2" style="width: 100%" placeholder="请输入管道长度" />
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="铺设年份" prop="layingYear">
- <el-date-picker v-model="form.layingYear" type="year" placeholder="请选择铺设年份" value-format="YYYY" style="width: 100%" />
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="设计压力(MPa)" prop="pressureRating">
- <el-input-number v-model="form.pressureRating" :min="0" :precision="2" style="width: 100%" placeholder="请输入设计压力" />
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="运行状态" prop="status">
- <el-radio-group v-model="form.status">
- <el-radio v-for="dict in sysNormalDisable" :key="dict.value" :label="dict.value">{{ dict.label }}</el-radio>
- </el-radio-group>
- </el-form-item>
- </el-col>
- <el-col :span="24">
- <el-form-item label="起点位置" prop="startPoint">
- <el-input v-model="form.startPoint" placeholder="请输入起点位置" maxlength="200" />
- </el-form-item>
- </el-col>
- <el-col :span="24">
- <el-form-item label="终点位置" prop="endPoint">
- <el-input v-model="form.endPoint" placeholder="请输入终点位置" maxlength="200" />
- </el-form-item>
- </el-col>
- <el-col :span="24">
- <el-form-item label="备注" prop="remark">
- <el-input v-model="form.remark" type="textarea" :rows="3" placeholder="请输入备注" maxlength="500" />
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- <template #footer>
- <el-button type="primary" @click="submitForm">确 定</el-button>
- <el-button @click="dialogVisible = false">取 消</el-button>
- </template>
- </el-dialog>
- <!-- 详情对话框 -->
- <el-dialog title="管网详情" v-model="detailVisible" width="600px" append-to-body>
- <el-descriptions :column="2" border>
- <el-descriptions-item label="管网编号">{{ detailData.pipeCode }}</el-descriptions-item>
- <el-descriptions-item label="管网名称">{{ detailData.pipeName }}</el-descriptions-item>
- <el-descriptions-item label="管道材质">{{ detailData.pipeMaterial }}</el-descriptions-item>
- <el-descriptions-item label="管径(mm)">{{ detailData.pipeDiameter }}</el-descriptions-item>
- <el-descriptions-item label="管道长度(m)">{{ detailData.pipeLength }}</el-descriptions-item>
- <el-descriptions-item label="铺设年份">{{ detailData.layingYear }}</el-descriptions-item>
- <el-descriptions-item label="设计压力(MPa)">{{ detailData.pressureRating }}</el-descriptions-item>
- <el-descriptions-item label="运行状态">
- <el-tag :type="detailData.status === '0' ? 'success' : 'danger'" size="small">
- {{ detailData.status === '0' ? '正常' : '停用' }}
- </el-tag>
- </el-descriptions-item>
- <el-descriptions-item label="起点位置" :span="2">{{ detailData.startPoint }}</el-descriptions-item>
- <el-descriptions-item label="终点位置" :span="2">{{ detailData.endPoint }}</el-descriptions-item>
- <el-descriptions-item label="备注" :span="2">{{ detailData.remark }}</el-descriptions-item>
- <el-descriptions-item label="创建者">{{ detailData.createBy }}</el-descriptions-item>
- <el-descriptions-item label="创建时间">{{ detailData.createTime }}</el-descriptions-item>
- <el-descriptions-item label="更新者">{{ detailData.updateBy }}</el-descriptions-item>
- <el-descriptions-item label="更新时间">{{ detailData.updateTime }}</el-descriptions-item>
- </el-descriptions>
- <template #footer>
- <el-button @click="detailVisible = false">关 闭</el-button>
- </template>
- </el-dialog>
- <!-- 回收站对话框 -->
- <el-dialog title="回收站" v-model:visible="recycleVisible" width="900px" append-to-body>
- <el-form :model="recycleQuery" ref="recycleForm" :inline="true" size="small">
- <el-form-item label="管网编号" prop="pipeCode">
- <el-input v-model="recycleQuery.pipeCode" placeholder="请输入编号" clearable />
- </el-form-item>
- <el-form-item label="管网名称" prop="pipeName">
- <el-input v-model="recycleQuery.pipeName" placeholder="请输入名称" clearable />
- </el-form-item>
- <el-form-item>
- <el-button type="primary" icon="Search" @click="getRecycleList">搜索</el-button>
- <el-button icon="Refresh" @click="resetRecycleQuery">重置</el-button>
- </el-form-item>
- </el-form>
- <el-table v-loading="recycleLoading" :data="recycleData" @selection-change="handleRecycleSelectionChange">
- <el-table-column type="selection" width="55" align="center" />
- <el-table-column label="管网编号" align="center" prop="pipeCode" />
- <el-table-column label="管网名称" align="center" prop="pipeName" />
- <el-table-column label="管道材质" align="center" prop="pipeMaterial" width="100" />
- <el-table-column label="管径(mm)" align="center" prop="pipeDiameter" width="100" />
- <el-table-column label="长度(m)" align="center" prop="pipeLength" width="100" />
- <el-table-column label="状态" align="center" width="80">
- <template #default="{ row }">
- <dict-tag :options="sysNormalDisable" :value="row.status" />
- </template>
- </el-table-column>
- <el-table-column label="删除时间" align="center" prop="updateTime" width="160" />
- <el-table-column label="操作" align="center" width="150">
- <template #default="{ row }">
- <el-button size="small" type="text" icon="RefreshLeft" @click="handleRestore(row)">恢复</el-button>
- <el-button size="small" type="text" icon="Delete" @click="handleDeletePhysically(row)">
- <span style="color: #F56C6C">彻底删除</span>
- </el-button>
- </template>
- </el-table-column>
- </el-table>
- <pagination v-show="recycleTotal > 0" :total="recycleTotal" v-model:page="recycleQuery.pageNum" v-model:limit="recycleQuery.pageSize" @pagination="getRecycleList" />
- </el-dialog>
- </div>
- </template>
- <script>
- import { listPipeInfo, getPipeInfo, addPipeInfo, updatePipeInfo, delPipeInfo, listRecyclePipeInfo, restorePipeInfo, deletePhysicallyPipeInfo } from '@/api/pipeNetwork/pipeInfo'
- import { getDicts } from '@/api/system/dict/data'
- export default {
- name: 'WaterPipeInfo',
- data() {
- return {
- // 遮罩层
- loading: true,
- // 选中数组
- ids: [],
- // 非单个禁用
- single: true,
- // 非多个禁用
- multiple: true,
- // 显示搜索条件
- showSearch: true,
- // 总条数
- total: 0,
- // 表格数据
- tableData: [],
- // 日期范围
- dateRange: [],
- // 弹出层标题
- dialogTitle: '',
- // 是否显示弹出层
- dialogVisible: false,
- // 详情显示
- detailVisible: false,
- // 详情数据
- detailData: {},
- // 回收站显示
- recycleVisible: false,
- // 回收站加载
- recycleLoading: false,
- // 回收站数据
- recycleData: [],
- // 回收站总条数
- recycleTotal: 0,
- // 回收站选中数组
- recycleIds: [],
- // 系统状态字典
- sysNormalDisable: [
- { value: 1, label: '正常' },
- { value: 0, label: '停用' }
- ],
- // 查询参数
- queryParams: {
- pageNum: 1,
- pageSize: 10,
- pipeCode: undefined,
- pipeName: undefined,
- pipeMaterial: undefined,
- status: undefined
- },
- // 回收站查询参数
- recycleQuery: {
- pageNum: 1,
- pageSize: 10,
- pipeCode: undefined,
- pipeName: undefined
- },
- // 表单参数
- form: {},
- // 表单校验
- rules: {
- pipeCode: [
- { required: true, message: '管网编号不能为空', trigger: 'blur' }
- ],
- pipeName: [
- { required: true, message: '管网名称不能为空', trigger: 'blur' }
- ],
- pipeMaterial: [
- { required: true, message: '请选择管道材质', trigger: 'change' }
- ]
- }
- }
- },
- created() {
- this.getList()
- },
- methods: {
- /** 查询管网信息列表 */
- getList() {
- this.loading = true
- listPipeInfo(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
- this.tableData = response.data.records
- this.total = response.data.total
- this.loading = false
- console.log("入参线信息列表",this.queryParams)
- }).catch(() => {
- this.loading = false
- })
- },
- /** 管道材质标签类型 */
- materialTagType(material) {
- const map = { '铸铁': '', 'PE': 'success', '钢管': 'warning', '球墨铸铁': 'info', 'PVC': 'danger', '混凝土': '' }
- return map[material] || ''
- },
- /** 搜索按钮操作 */
- handleQuery() {
- this.queryParams.pageNum = 1
- this.getList()
- },
- /** 重置按钮操作 */
- resetQuery() {
- this.dateRange = []
- this.resetForm('queryForm')
- this.handleQuery()
- },
- /** 多选框选中数据 */
- handleSelectionChange(selection) {
- this.ids = selection.map(item => item.id)
- this.single = selection.length !== 1
- this.multiple = !selection.length
- },
- /** 回收站多选框选中 */
- handleRecycleSelectionChange(selection) {
- this.recycleIds = selection.map(item => item.id)
- },
- /** 新增按钮操作 */
- handleAdd() {
- this.reset()
- this.dialogTitle = '新增管网信息'
- this.dialogVisible = true
- },
- /** 修改按钮操作 */
- handleUpdate(row) {
- this.reset()
- const id = row.id || this.ids
- getPipeInfo(id).then(response => {
- this.form = response.data
- this.dialogTitle = '修改管网信息'
- this.dialogVisible = true
- })
- },
- /** 详情按钮操作 */
- handleDetail(row) {
- getPipeInfo(row.id).then(response => {
- this.detailData = response.data
- this.detailVisible = true
- })
- },
- /** 提交按钮 */
- submitForm() {
- this.$refs.form.validate(valid => {
- if (valid) {
- if (this.form.id != undefined) {
- updatePipeInfo(this.form).then(() => {
- this.$modal.msgSuccess('修改成功')
- this.dialogVisible = false
- this.getList()
- })
- } else {
- addPipeInfo(this.form).then(() => {
- this.$modal.msgSuccess('新增成功')
- this.dialogVisible = false
- this.getList()
- })
- }
- }
- })
- },
- /** 删除按钮操作 */
- handleDelete(row) {
- const ids = row.id ? [row.id] : this.ids
- this.$modal.confirm('是否确认删除管网编号为"' + ids.join(',') + '"的数据项?').then(() => {
- return delPipeInfo(ids.join(','))
- }).then(() => {
- this.getList()
- this.$modal.msgSuccess('删除成功')
- }).catch(() => {})
- },
- /** 打开回收站 */
- handleRecycle() {
- this.recycleVisible = true
- this.getRecycleList()
- },
- /** 查询回收站列表 */
- getRecycleList() {
- this.recycleLoading = true
- listRecyclePipeInfo(this.recycleQuery).then(response => {
- this.recycleData = response.data.records
- this.recycleTotal = response.data.total
- this.recycleLoading = false
- }).catch(() => {
- this.recycleLoading = false
- })
- },
- /** 回收站搜索重置 */
- resetRecycleQuery() {
- this.resetForm('recycleForm')
- this.getRecycleList()
- },
- /** 恢复数据 */
- handleRestore(row) {
- const ids = row.id || this.recycleIds
- this.$modal.confirm('是否确认恢复该数据?').then(() => {
- return restorePipeInfo(Array.isArray(ids) ? ids.join(',') : ids)
- }).then(() => {
- this.getRecycleList()
- this.getList()
- this.$modal.msgSuccess('恢复成功')
- }).catch(() => {})
- },
- /** 彻底删除 */
- handleDeletePhysically(row) {
- const ids = row.id || this.recycleIds
- this.$modal.confirm('彻底删除后数据不可恢复,是否继续?').then(() => {
- return deletePhysicallyPipeInfo(Array.isArray(ids) ? ids.join(',') : ids)
- }).then(() => {
- this.getRecycleList()
- this.$modal.msgSuccess('彻底删除成功')
- }).catch(() => {})
- },
- /** 表单重置 */
- reset() {
- this.form = {
- status: '0'
- }
- this.resetForm('form')
- }
- }
- }
- </script>
|