index.vue 25 KB

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