index.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470
  1. <template>
  2. <div class="app-container">
  3. <!-- 搜索区域 -->
  4. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  5. <el-form-item label="管网编号" prop="pipeCode">
  6. <el-input v-model="queryParams.pipeCode" placeholder="请输入管网编号" clearable size="small" @keyup.enter="handleQuery" />
  7. </el-form-item>
  8. <el-form-item label="管网名称" prop="pipeName">
  9. <el-input v-model="queryParams.pipeName" placeholder="请输入管网名称" clearable size="small" @keyup.enter="handleQuery" />
  10. </el-form-item>
  11. <el-form-item label="管道材质" prop="pipeMaterial">
  12. <el-select v-model="queryParams.pipeMaterial" placeholder="请选择材质" clearable size="small" style="width: 120px">
  13. <el-option label="铸铁" value="铸铁" />
  14. <el-option label="PE" value="PE" />
  15. <el-option label="钢管" value="钢管" />
  16. <el-option label="球墨铸铁" value="球墨铸铁" />
  17. <el-option label="PVC" value="PVC" />
  18. <el-option label="混凝土" value="混凝土" />
  19. </el-select>
  20. </el-form-item>
  21. <el-form-item label="状态" prop="status">
  22. <el-select v-model="queryParams.status" placeholder="管网状态" clearable size="small" style="width: 120px">
  23. <el-option
  24. v-for="dict in sysNormalDisable"
  25. :key="dict.value"
  26. :label="dict.label"
  27. :value="dict.value"
  28. />
  29. </el-select>
  30. </el-form-item>
  31. <el-form-item label="创建时间">
  32. <el-date-picker
  33. v-model="dateRange"
  34. size="small"
  35. style="width: 240px"
  36. value-format="YYYY-MM-DD HH:mm:ss"
  37. type="datetimerange"
  38. range-separator="-"
  39. start-placeholder="开始日期"
  40. end-placeholder="结束日期"
  41. />
  42. </el-form-item>
  43. <el-form-item>
  44. <el-button type="primary" icon="Search" size="small" @click="handleQuery">搜索</el-button>
  45. <el-button icon="Refresh" size="small" @click="resetQuery">重置</el-button>
  46. </el-form-item>
  47. </el-form>
  48. <!-- 操作按钮区域 -->
  49. <el-row :gutter="10" class="mb8">
  50. <el-col :span="1.5">
  51. <el-button type="primary" plain icon="Plus" size="small" @click="handleAdd" v-hasPermi="['waterSupply:pipeInfo:add']">新增</el-button>
  52. </el-col>
  53. <el-col :span="1.5">
  54. <el-button type="danger" plain icon="Delete" size="small" :disabled="multiple" @click="handleDelete" v-hasPermi="['waterSupply:pipeInfo:remove']">删除</el-button>
  55. </el-col>
  56. <right-toolbar v-model:showSearch="showSearch" @queryTable="getList" />
  57. </el-row>
  58. <!-- 数据表格 -->
  59. <el-table v-loading="loading" :data="tableData" @selection-change="handleSelectionChange">
  60. <el-table-column type="selection" width="55" align="center" />
  61. <el-table-column label="管网编号" align="center" prop="pipeCode" :show-overflow-tooltip="true" min-width="120" />
  62. <el-table-column label="管网名称" align="center" prop="pipeName" :show-overflow-tooltip="true" min-width="140" />
  63. <el-table-column label="管道材质" align="center" prop="pipeMaterial" width="100">
  64. <template #default="{ row }">
  65. <el-tag :type="materialTagType(row.pipeMaterial)" size="small">{{ row.pipeMaterial || '-' }}</el-tag>
  66. </template>
  67. </el-table-column>
  68. <el-table-column label="管径(mm)" align="center" prop="pipeDiameter" width="100" />
  69. <el-table-column label="长度(m)" align="center" prop="pipeLength" width="100" />
  70. <el-table-column label="起点位置" align="center" prop="startPoint" :show-overflow-tooltip="true" min-width="140" />
  71. <el-table-column label="终点位置" align="center" prop="endPoint" :show-overflow-tooltip="true" min-width="140" />
  72. <el-table-column label="铺设年份" align="center" prop="layingYear" width="100" />
  73. <el-table-column label="设计压力(MPa)" align="center" prop="pressureRating" width="130" />
  74. <el-table-column label="状态" align="center" width="80">
  75. <template #default="{ row }">
  76. <el-tag
  77. :type="row.status == 1 ? 'success' : 'danger'"
  78. size="small"
  79. >
  80. {{ row.status == 1 ? '正常' : '停用' }}
  81. </el-tag>
  82. </template>
  83. </el-table-column>
  84. <el-table-column label="创建时间" align="center" prop="createTime" width="160" />
  85. <el-table-column label="操作" align="center" width="180" fixed="right">
  86. <template #default="{ row }">
  87. <el-button size="small" type="text" icon="View" @click="handleDetail(row)">详情</el-button>
  88. <el-button size="small" type="text" icon="Edit" @click="handleUpdate(row)" v-hasPermi="['waterSupply:pipeInfo:edit']">修改</el-button>
  89. <el-button size="small" type="text" icon="Delete" @click="handleDelete(row)" v-hasPermi="['waterSupply:pipeInfo:remove']">删除</el-button>
  90. </template>
  91. </el-table-column>
  92. </el-table>
  93. <!-- 分页 -->
  94. <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
  95. <!-- 新增/修改对话框 -->
  96. <el-dialog :title="dialogTitle" v-model="dialogVisible" width="700px" append-to-body>
  97. <el-form ref="form" :model="form" :rules="rules" label-width="100px">
  98. <el-row :gutter="20">
  99. <el-col :span="12">
  100. <el-form-item label="管网编号" prop="pipeCode">
  101. <el-input v-model="form.pipeCode" placeholder="请输入管网编号" maxlength="50" />
  102. </el-form-item>
  103. </el-col>
  104. <el-col :span="12">
  105. <el-form-item label="管网名称" prop="pipeName">
  106. <el-input v-model="form.pipeName" placeholder="请输入管网名称" maxlength="100" />
  107. </el-form-item>
  108. </el-col>
  109. <el-col :span="12">
  110. <el-form-item label="管道材质" prop="pipeMaterial">
  111. <el-select v-model="form.pipeMaterial" placeholder="请选择管道材质" style="width: 100%">
  112. <el-option label="铸铁" value="铸铁" />
  113. <el-option label="PE" value="PE" />
  114. <el-option label="钢管" value="钢管" />
  115. <el-option label="球墨铸铁" value="球墨铸铁" />
  116. <el-option label="PVC" value="PVC" />
  117. <el-option label="混凝土" value="混凝土" />
  118. </el-select>
  119. </el-form-item>
  120. </el-col>
  121. <el-col :span="12">
  122. <el-form-item label="管径(mm)" prop="pipeDiameter">
  123. <el-input-number v-model="form.pipeDiameter" :min="0" :precision="0" style="width: 100%" placeholder="请输入管径" />
  124. </el-form-item>
  125. </el-col>
  126. <el-col :span="12">
  127. <el-form-item label="管道长度(m)" prop="pipeLength">
  128. <el-input-number v-model="form.pipeLength" :min="0" :precision="2" style="width: 100%" placeholder="请输入管道长度" />
  129. </el-form-item>
  130. </el-col>
  131. <el-col :span="12">
  132. <el-form-item label="铺设年份" prop="layingYear">
  133. <el-date-picker v-model="form.layingYear" type="year" placeholder="请选择铺设年份" value-format="YYYY" style="width: 100%" />
  134. </el-form-item>
  135. </el-col>
  136. <el-col :span="12">
  137. <el-form-item label="设计压力(MPa)" prop="pressureRating">
  138. <el-input-number v-model="form.pressureRating" :min="0" :precision="2" style="width: 100%" placeholder="请输入设计压力" />
  139. </el-form-item>
  140. </el-col>
  141. <el-col :span="12">
  142. <el-form-item label="运行状态" prop="status">
  143. <el-radio-group v-model="form.status">
  144. <el-radio v-for="dict in sysNormalDisable" :key="dict.value" :label="dict.value">{{ dict.label }}</el-radio>
  145. </el-radio-group>
  146. </el-form-item>
  147. </el-col>
  148. <el-col :span="24">
  149. <el-form-item label="起点位置" prop="startPoint">
  150. <el-input v-model="form.startPoint" placeholder="请输入起点位置" maxlength="200" />
  151. </el-form-item>
  152. </el-col>
  153. <el-col :span="24">
  154. <el-form-item label="终点位置" prop="endPoint">
  155. <el-input v-model="form.endPoint" placeholder="请输入终点位置" maxlength="200" />
  156. </el-form-item>
  157. </el-col>
  158. <el-col :span="24">
  159. <el-form-item label="备注" prop="remark">
  160. <el-input v-model="form.remark" type="textarea" :rows="3" placeholder="请输入备注" maxlength="500" />
  161. </el-form-item>
  162. </el-col>
  163. </el-row>
  164. </el-form>
  165. <template #footer>
  166. <el-button type="primary" @click="submitForm">确 定</el-button>
  167. <el-button @click="dialogVisible = false">取 消</el-button>
  168. </template>
  169. </el-dialog>
  170. <!-- 详情对话框 -->
  171. <el-dialog title="管网详情" v-model="detailVisible" width="600px" append-to-body>
  172. <el-descriptions :column="2" border>
  173. <el-descriptions-item label="管网编号">{{ detailData.pipeCode }}</el-descriptions-item>
  174. <el-descriptions-item label="管网名称">{{ detailData.pipeName }}</el-descriptions-item>
  175. <el-descriptions-item label="管道材质">{{ detailData.pipeMaterial }}</el-descriptions-item>
  176. <el-descriptions-item label="管径(mm)">{{ detailData.pipeDiameter }}</el-descriptions-item>
  177. <el-descriptions-item label="管道长度(m)">{{ detailData.pipeLength }}</el-descriptions-item>
  178. <el-descriptions-item label="铺设年份">{{ detailData.layingYear }}</el-descriptions-item>
  179. <el-descriptions-item label="设计压力(MPa)">{{ detailData.pressureRating }}</el-descriptions-item>
  180. <el-descriptions-item label="运行状态">
  181. <el-tag :type="detailData.status === '0' ? 'success' : 'danger'" size="small">
  182. {{ detailData.status === '0' ? '正常' : '停用' }}
  183. </el-tag>
  184. </el-descriptions-item>
  185. <el-descriptions-item label="起点位置" :span="2">{{ detailData.startPoint }}</el-descriptions-item>
  186. <el-descriptions-item label="终点位置" :span="2">{{ detailData.endPoint }}</el-descriptions-item>
  187. <el-descriptions-item label="备注" :span="2">{{ detailData.remark }}</el-descriptions-item>
  188. <el-descriptions-item label="创建者">{{ detailData.createBy }}</el-descriptions-item>
  189. <el-descriptions-item label="创建时间">{{ detailData.createTime }}</el-descriptions-item>
  190. <el-descriptions-item label="更新者">{{ detailData.updateBy }}</el-descriptions-item>
  191. <el-descriptions-item label="更新时间">{{ detailData.updateTime }}</el-descriptions-item>
  192. </el-descriptions>
  193. <template #footer>
  194. <el-button @click="detailVisible = false">关 闭</el-button>
  195. </template>
  196. </el-dialog>
  197. <!-- 回收站对话框 -->
  198. <el-dialog title="回收站" v-model:visible="recycleVisible" width="900px" append-to-body>
  199. <el-form :model="recycleQuery" ref="recycleForm" :inline="true" size="small">
  200. <el-form-item label="管网编号" prop="pipeCode">
  201. <el-input v-model="recycleQuery.pipeCode" placeholder="请输入编号" clearable />
  202. </el-form-item>
  203. <el-form-item label="管网名称" prop="pipeName">
  204. <el-input v-model="recycleQuery.pipeName" placeholder="请输入名称" clearable />
  205. </el-form-item>
  206. <el-form-item>
  207. <el-button type="primary" icon="Search" @click="getRecycleList">搜索</el-button>
  208. <el-button icon="Refresh" @click="resetRecycleQuery">重置</el-button>
  209. </el-form-item>
  210. </el-form>
  211. <el-table v-loading="recycleLoading" :data="recycleData" @selection-change="handleRecycleSelectionChange">
  212. <el-table-column type="selection" width="55" align="center" />
  213. <el-table-column label="管网编号" align="center" prop="pipeCode" />
  214. <el-table-column label="管网名称" align="center" prop="pipeName" />
  215. <el-table-column label="管道材质" align="center" prop="pipeMaterial" width="100" />
  216. <el-table-column label="管径(mm)" align="center" prop="pipeDiameter" width="100" />
  217. <el-table-column label="长度(m)" align="center" prop="pipeLength" width="100" />
  218. <el-table-column label="状态" align="center" width="80">
  219. <template #default="{ row }">
  220. <dict-tag :options="sysNormalDisable" :value="row.status" />
  221. </template>
  222. </el-table-column>
  223. <el-table-column label="删除时间" align="center" prop="updateTime" width="160" />
  224. <el-table-column label="操作" align="center" width="150">
  225. <template #default="{ row }">
  226. <el-button size="small" type="text" icon="RefreshLeft" @click="handleRestore(row)">恢复</el-button>
  227. <el-button size="small" type="text" icon="Delete" @click="handleDeletePhysically(row)">
  228. <span style="color: #F56C6C">彻底删除</span>
  229. </el-button>
  230. </template>
  231. </el-table-column>
  232. </el-table>
  233. <pagination v-show="recycleTotal > 0" :total="recycleTotal" v-model:page="recycleQuery.pageNum" v-model:limit="recycleQuery.pageSize" @pagination="getRecycleList" />
  234. </el-dialog>
  235. </div>
  236. </template>
  237. <script>
  238. import { listPipeInfo, getPipeInfo, addPipeInfo, updatePipeInfo, delPipeInfo, listRecyclePipeInfo, restorePipeInfo, deletePhysicallyPipeInfo } from '@/api/pipeNetwork/pipeInfo'
  239. import { getDicts } from '@/api/system/dict/data'
  240. export default {
  241. name: 'WaterPipeInfo',
  242. data() {
  243. return {
  244. // 遮罩层
  245. loading: true,
  246. // 选中数组
  247. ids: [],
  248. // 非单个禁用
  249. single: true,
  250. // 非多个禁用
  251. multiple: true,
  252. // 显示搜索条件
  253. showSearch: true,
  254. // 总条数
  255. total: 0,
  256. // 表格数据
  257. tableData: [],
  258. // 日期范围
  259. dateRange: [],
  260. // 弹出层标题
  261. dialogTitle: '',
  262. // 是否显示弹出层
  263. dialogVisible: false,
  264. // 详情显示
  265. detailVisible: false,
  266. // 详情数据
  267. detailData: {},
  268. // 回收站显示
  269. recycleVisible: false,
  270. // 回收站加载
  271. recycleLoading: false,
  272. // 回收站数据
  273. recycleData: [],
  274. // 回收站总条数
  275. recycleTotal: 0,
  276. // 回收站选中数组
  277. recycleIds: [],
  278. // 系统状态字典
  279. sysNormalDisable: [
  280. { value: 1, label: '正常' },
  281. { value: 0, label: '停用' }
  282. ],
  283. // 查询参数
  284. queryParams: {
  285. pageNum: 1,
  286. pageSize: 10,
  287. pipeCode: undefined,
  288. pipeName: undefined,
  289. pipeMaterial: undefined,
  290. status: undefined
  291. },
  292. // 回收站查询参数
  293. recycleQuery: {
  294. pageNum: 1,
  295. pageSize: 10,
  296. pipeCode: undefined,
  297. pipeName: undefined
  298. },
  299. // 表单参数
  300. form: {},
  301. // 表单校验
  302. rules: {
  303. pipeCode: [
  304. { required: true, message: '管网编号不能为空', trigger: 'blur' }
  305. ],
  306. pipeName: [
  307. { required: true, message: '管网名称不能为空', trigger: 'blur' }
  308. ],
  309. pipeMaterial: [
  310. { required: true, message: '请选择管道材质', trigger: 'change' }
  311. ]
  312. }
  313. }
  314. },
  315. created() {
  316. this.getList()
  317. },
  318. methods: {
  319. /** 查询管网信息列表 */
  320. getList() {
  321. this.loading = true
  322. listPipeInfo(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
  323. this.tableData = response.data.records
  324. this.total = response.data.total
  325. this.loading = false
  326. console.log("入参线信息列表",this.queryParams)
  327. }).catch(() => {
  328. this.loading = false
  329. })
  330. },
  331. /** 管道材质标签类型 */
  332. materialTagType(material) {
  333. const map = { '铸铁': '', 'PE': 'success', '钢管': 'warning', '球墨铸铁': 'info', 'PVC': 'danger', '混凝土': '' }
  334. return map[material] || ''
  335. },
  336. /** 搜索按钮操作 */
  337. handleQuery() {
  338. this.queryParams.pageNum = 1
  339. this.getList()
  340. },
  341. /** 重置按钮操作 */
  342. resetQuery() {
  343. this.dateRange = []
  344. this.resetForm('queryForm')
  345. this.handleQuery()
  346. },
  347. /** 多选框选中数据 */
  348. handleSelectionChange(selection) {
  349. this.ids = selection.map(item => item.id)
  350. this.single = selection.length !== 1
  351. this.multiple = !selection.length
  352. },
  353. /** 回收站多选框选中 */
  354. handleRecycleSelectionChange(selection) {
  355. this.recycleIds = selection.map(item => item.id)
  356. },
  357. /** 新增按钮操作 */
  358. handleAdd() {
  359. this.reset()
  360. this.dialogTitle = '新增管网信息'
  361. this.dialogVisible = true
  362. },
  363. /** 修改按钮操作 */
  364. handleUpdate(row) {
  365. this.reset()
  366. const id = row.id || this.ids
  367. getPipeInfo(id).then(response => {
  368. this.form = response.data
  369. this.dialogTitle = '修改管网信息'
  370. this.dialogVisible = true
  371. })
  372. },
  373. /** 详情按钮操作 */
  374. handleDetail(row) {
  375. getPipeInfo(row.id).then(response => {
  376. this.detailData = response.data
  377. this.detailVisible = true
  378. })
  379. },
  380. /** 提交按钮 */
  381. submitForm() {
  382. this.$refs.form.validate(valid => {
  383. if (valid) {
  384. if (this.form.id != undefined) {
  385. updatePipeInfo(this.form).then(() => {
  386. this.$modal.msgSuccess('修改成功')
  387. this.dialogVisible = false
  388. this.getList()
  389. })
  390. } else {
  391. addPipeInfo(this.form).then(() => {
  392. this.$modal.msgSuccess('新增成功')
  393. this.dialogVisible = false
  394. this.getList()
  395. })
  396. }
  397. }
  398. })
  399. },
  400. /** 删除按钮操作 */
  401. handleDelete(row) {
  402. const ids = row.id ? [row.id] : this.ids
  403. this.$modal.confirm('是否确认删除管网编号为"' + ids.join(',') + '"的数据项?').then(() => {
  404. return delPipeInfo(ids.join(','))
  405. }).then(() => {
  406. this.getList()
  407. this.$modal.msgSuccess('删除成功')
  408. }).catch(() => {})
  409. },
  410. /** 打开回收站 */
  411. handleRecycle() {
  412. this.recycleVisible = true
  413. this.getRecycleList()
  414. },
  415. /** 查询回收站列表 */
  416. getRecycleList() {
  417. this.recycleLoading = true
  418. listRecyclePipeInfo(this.recycleQuery).then(response => {
  419. this.recycleData = response.data.records
  420. this.recycleTotal = response.data.total
  421. this.recycleLoading = false
  422. }).catch(() => {
  423. this.recycleLoading = false
  424. })
  425. },
  426. /** 回收站搜索重置 */
  427. resetRecycleQuery() {
  428. this.resetForm('recycleForm')
  429. this.getRecycleList()
  430. },
  431. /** 恢复数据 */
  432. handleRestore(row) {
  433. const ids = row.id || this.recycleIds
  434. this.$modal.confirm('是否确认恢复该数据?').then(() => {
  435. return restorePipeInfo(Array.isArray(ids) ? ids.join(',') : ids)
  436. }).then(() => {
  437. this.getRecycleList()
  438. this.getList()
  439. this.$modal.msgSuccess('恢复成功')
  440. }).catch(() => {})
  441. },
  442. /** 彻底删除 */
  443. handleDeletePhysically(row) {
  444. const ids = row.id || this.recycleIds
  445. this.$modal.confirm('彻底删除后数据不可恢复,是否继续?').then(() => {
  446. return deletePhysicallyPipeInfo(Array.isArray(ids) ? ids.join(',') : ids)
  447. }).then(() => {
  448. this.getRecycleList()
  449. this.$modal.msgSuccess('彻底删除成功')
  450. }).catch(() => {})
  451. },
  452. /** 表单重置 */
  453. reset() {
  454. this.form = {
  455. status: '0'
  456. }
  457. this.resetForm('form')
  458. }
  459. }
  460. }
  461. </script>