Newer
Older
KaiFengPC / src / views / floodSys / assetManage / AccumulatedWater.vue
@鲁yixuan 鲁yixuan on 11 Sep 8 KB 1
  1. <template>
  2. <div class="publicContainer">
  3. <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch">
  4. <el-form-item label="名称:" prop="name" style="width: 250px">
  5. <el-input v-model="queryParams.name" placeholder="请输入名称" clearable />
  6. </el-form-item>
  7. <el-form-item>
  8. <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
  9. <el-button type="primary" icon="Plus" @click="handleAdd">新增</el-button>
  10. <el-button icon="Refresh" @click="resetQuery">重置</el-button>
  11. </el-form-item>
  12. </el-form>
  13. <!-- 表格 -->
  14. <el-table :data="dataList" :span-method="objectSpanMethod" v-loading="loading" stripe :max-height="680">
  15. <el-table-column type="index" label="序号" width="60" />
  16. <!-- <el-table-column label="排水分区" prop="belongPartition">
  17. <template #default="scope">
  18. <span>{{
  19. scope.row.belongPartition == '1'
  20. ? '老城区排水分区'
  21. : scope.row.belongPartition == '2'
  22. ? '东部排水分区'
  23. : scope.row.belongPartition == '3'
  24. ? '西部排水分区'
  25. : scope.row.belongPartition == '4'
  26. ? '南部排水分区'
  27. : scope.row.belongPartition == '5'
  28. ? '北部排水分区'
  29. : scope.row.belongPartition == '6'
  30. ? '示范区排水分区'
  31. : scope.row.belongPartition == '7'
  32. ? '正在整治积水点'
  33. : ''
  34. }}</span>
  35. </template>
  36. </el-table-column> -->
  37. <el-table-column label="名称" prop="name" width="150" />
  38. <el-table-column label="编码" prop="pointCode" width="150" />
  39. <el-table-column label="位置" prop="address" width="350" />
  40. <el-table-column label="治理方案" prop="solution" width="350" />
  41.  
  42. <el-table-column label="现状积水深度(cm)" prop="nowPondingDeep" />
  43. <el-table-column label="现状积水时间(h)" prop="nowPongdingTime" />
  44. <el-table-column label="建设开始时间" prop="transformStartTime" width="160" />
  45.  
  46. <el-table-column label="建设结束时间" prop="transformEndTime" width="160" />
  47. <!-- <el-table-column label="纬度" prop="latitude" width="110" />
  48. <el-table-column label="经度" prop="longitude" width="110" /> -->
  49. <!-- <el-table-column label="治理前照片" prop="address" />
  50. <el-table-column label="施工照片" prop="constructionPhoto" />
  51. <el-table-column label="治理完工照片" prop="address" /> -->
  52.  
  53. <el-table-column label="操作" width="280">
  54. <template #default="scope">
  55. <el-button link icon="View" type="primary" @click="handleDetail(scope.row, 'view')">查看</el-button>
  56. <el-button link type="warning" icon="Edit" @click="handleUpdate(scope.row, 'view')">修改</el-button>
  57. <el-button link type="danger" icon="Delete" @click="handleDelete(scope.row, 'view')">删除</el-button>
  58. </template>
  59. </el-table-column>
  60. </el-table>
  61. <!-- 分页 -->
  62. <pagination
  63. v-show="total > 0"
  64. :total="total"
  65. v-model:page="queryParams.pageNum"
  66. v-model:limit="queryParams.pageSize"
  67. @pagination="getList"
  68. />
  69. <!-- 新增弹窗 -->
  70. <el-dialog :title="title" v-model="open" width="800px" append-to-body :close-on-click-modal="false">
  71. <el-form ref="roleRef" :model="form" :rules="rules" label-width="140px" :disabled="multiple">
  72. <el-row :gutter="20">
  73. <el-col :span="12">
  74. <el-form-item label="名称" prop="name">
  75. <el-input v-model="form.name" placeholder="请输入名称名称" clearable style="width: 100%" />
  76. </el-form-item>
  77. </el-col>
  78. <el-col :span="12">
  79. <el-form-item label="编码:" prop="pointCode">
  80. <el-input v-model="form.pointCode" placeholder="请输入编码" clearable style="width: 100%" />
  81. </el-form-item>
  82. </el-col>
  83. </el-row>
  84. <el-row :gutter="20">
  85. <el-col :span="12">
  86. <el-form-item label="现状积水深度(cm):" prop="address">
  87. <el-input v-model="form.address" placeholder="请输入现状积水深度(cm)" clearable style="width: 100%" />
  88. </el-form-item>
  89. </el-col>
  90. <el-col :span="12">
  91. <el-form-item label="责任单位:" prop="responsibilityUnit">
  92. <el-input v-model="form.responsibilityUnit" placeholder="请输入责任单位" clearable style="width: 100%" />
  93. </el-form-item>
  94. </el-col>
  95. </el-row>
  96. <el-row :gutter="20">
  97. <el-col :span="24">
  98. <el-form-item label="位置:" prop="alreadyMeasure">
  99. <el-input type="textarea" :rows="5" v-model="form.alreadyMeasure" placeholder="请输入位置" clearable style="width: 100%" />
  100. </el-form-item>
  101. </el-col>
  102. <el-col :span="24">
  103. <el-form-item label="治理方案:" prop="emergencyMeasure">
  104. <el-input
  105. type="textarea"
  106. :rows="5"
  107. v-model="form.emergencyMeasure"
  108. placeholder="请输入治理方案"
  109. clearable
  110. style="width: 100%"
  111. />
  112. </el-form-item>
  113. </el-col>
  114. </el-row>
  115. </el-form>
  116. <template #footer>
  117. <div class="dialog-footer">
  118. <el-button type="primary" @click="submitForm">确 定</el-button>
  119. <el-button @click="cancel">取 消</el-button>
  120. </div>
  121. </template>
  122. </el-dialog>
  123. </div>
  124. </template>
  125. <script setup name="AccumulatedWater">
  126. import {
  127. waterloggingPointpage,
  128. waterloggedRoadedit,
  129. waterloggedRoadadd,
  130. waterloggedRoaddelete,
  131. } from '@/api/longoPeration/AccumulatedWater';
  132. const { proxy } = getCurrentInstance();
  133.  
  134. const showSearch = ref(true);
  135. const title = ref('');
  136. const multiple = ref(false);
  137. const open = ref(false);
  138. const loading = ref(true);
  139. const total = ref(0);
  140. const AllData = reactive({
  141. form: {},
  142. queryParams: {
  143. pageNum: 1,
  144. pageSize: 10,
  145. belongPartition: '',
  146. },
  147. rules: {
  148. belongPartition: [{ required: true, message: '请选择排水分区', trigger: 'blur' }],
  149. roadName: [{ required: true, message: '请输入道路名称', trigger: 'blur' }],
  150. address: [{ required: true, message: '请输入积水点位置', trigger: 'blur' }],
  151. responsibilityUnit: [{ required: true, message: '请输入责任单位', trigger: 'blur' }],
  152. alreadyMeasure: [{ required: true, message: '请输入已采取工程措施', trigger: 'blur' }],
  153. emergencyMeasure: [{ required: true, message: '请输入应急处置措施', trigger: 'blur' }],
  154. },
  155. });
  156. const { queryParams, rules, form } = toRefs(AllData);
  157. const dataList = ref([]);
  158. //搜索
  159. function handleQuery() {
  160. getList();
  161. }
  162. //重置
  163. function resetQuery() {
  164. proxy.resetForm('queryRef');
  165. handleQuery();
  166. }
  167. // 新增
  168. function handleAdd() {
  169. title.value = '新增积水点';
  170. open.value = true;
  171. form.value = {};
  172. multiple.value = false;
  173. }
  174. // 新增中取消事件
  175. function cancel() {
  176. open.value = false;
  177. proxy.resetForm('roleRef');
  178. }
  179. //查看详情操作
  180. function handleDetail(row) {
  181. open.value = true;
  182. multiple.value = true;
  183. title.value = '查看积水点';
  184. form.value = { ...row };
  185. }
  186. // 修改按钮操作
  187. function handleUpdate(row) {
  188. open.value = true;
  189. title.value = '修改积水点';
  190. multiple.value = false;
  191. form.value = { ...row };
  192. }
  193.  
  194. /** 搜索列表 */
  195. const getList = async () => {
  196. loading.value = true;
  197. let res = await waterloggingPointpage(queryParams.value);
  198. dataList.value = res.data;
  199. total.value = res.total;
  200. loading.value = false;
  201. };
  202. /** 新增弹框 修改弹框 提交按钮 */
  203. async function submitForm() {
  204. proxy.$refs['roleRef'].validate(valid => {
  205. if (valid) {
  206. if (form.value.id != undefined) {
  207. waterloggedRoadedit(form.value).then(() => {
  208. proxy.$modal.msgSuccess('修改成功');
  209. open.value = false;
  210. getList();
  211. });
  212. } else {
  213. waterloggedRoadadd(form.value).then(() => {
  214. proxy.$modal.msgSuccess('新增成功');
  215. open.value = false;
  216. getList();
  217. });
  218. }
  219. }
  220. });
  221. }
  222. // 表格删除
  223. function handleDelete(row) {
  224. proxy.$modal
  225. .confirm('是否确认删除?')
  226. .then(async () => {
  227. const res = await waterloggedRoaddelete(row.id);
  228. if (res?.code !== 200) return;
  229. proxy.$modal.msgSuccess('操作成功!');
  230. getList();
  231. })
  232. .catch(() => {});
  233. }
  234. onMounted(() => {
  235. getList();
  236. });
  237. </script>