Newer
Older
KaiFengPC / src / views / floodSys / scada / sewage / index.vue
@zhangdeliang zhangdeliang on 23 May 8 KB 初始化项目
  1. <template>
  2. <div class="water-analysis-page">
  3. <div class="top">
  4. <el-form ref="queryRef" inline :model="queryParams" v-show="showSearch">
  5. <el-form-item label="污水处理厂名称:" prop="sewageName">
  6. <el-input v-model="queryParams.sewageName" placeholder="请输入" clearable style="width: 220px" />
  7. </el-form-item>
  8. <el-form-item>
  9. <el-button type="primary" icon="Search" @click="searchForm"> 查询</el-button>
  10. <el-button icon="Refresh" @click="resectClcik"> 重置</el-button>
  11. </el-form-item>
  12. </el-form>
  13. <el-row :gutter="10" class="mb8">
  14. <el-button type="primary" plain icon="Plus" @click="addData">新增</el-button>
  15. <right-toolbar v-model:showSearch="showSearch" @queryTable="searchForm"></right-toolbar>
  16. </el-row>
  17. </div>
  18. <!-- 表格 -->
  19. <el-table :data="tableData" v-loading="tableLoading" max-height="650">
  20. <el-table-column type="index" width="70" label="序号" />
  21. <el-table-column label="污水处理厂名称" prop="sewageName" />
  22. <el-table-column label="污水处理厂编码" prop="sewageCode" />
  23. <el-table-column label="地址" prop="address" />
  24. <el-table-column label="设计来源" prop="dataSource">
  25. <template #default="{ row }">
  26. <dict-tag :options="Datasources" :value="row.dataSource" />
  27. </template>
  28. </el-table-column>
  29. <el-table-column label="排入水体(pr水体)" prop="intoWater" />
  30. <el-table-column label="纬度" prop="lat" />
  31. <el-table-column label="经度" prop="lon" />
  32. <el-table-column label="规划规模(万吨/日)" prop="planScale" />
  33. <el-table-column label="辖区" prop="region" />
  34. <el-table-column label="标准" prop="standard" />
  35. <el-table-column label="工艺" prop="workmanship" />
  36. <el-table-column label="操作" show-overflow-tooltip width="220">
  37. <template #default="{ row }">
  38. <el-button link icon="View" type="primary" @click="checkDetail(row)">详情</el-button>
  39. <el-button link icon="Edit" type="warning" @click="editData(row)">修改</el-button>
  40. <el-button link icon="Delete" type="danger" @click="deleteData(row)">删除</el-button>
  41. </template>
  42. </el-table-column>
  43. </el-table>
  44. <!-- 分页 -->
  45. <pagination
  46. v-show="total > 0"
  47. :total="total"
  48. v-model:page="queryParams.pageNum"
  49. v-model:limit="queryParams.pageSize"
  50. @pagination="getDataList"
  51. />
  52. <div class="water-analysis-page">
  53. <!-- 添加 修改 查看弹窗 -->
  54. <el-dialog :title="dialogTitle" v-model="showDialog" width="900px" :close-on-click-modal="false">
  55. <el-form ref="ruleForm" :model="formData" :rules="formRules" :disabled="isDisab" label-width="140px" class="flex50">
  56. <el-row>
  57. <el-form-item label="污水处理厂名称:" prop="sewageName">
  58. <el-input v-model="formData.sewageName" placeholder="请输入" clearable />
  59. </el-form-item>
  60. <el-form-item label="污水处理厂编码:" prop="sewageCode">
  61. <el-input v-model="formData.sewageCode" placeholder="请输入" clearable :disabled="hiddentext" />
  62. </el-form-item>
  63. <el-form-item label="地址:" prop="address">
  64. <el-input v-model="formData.address" placeholder="请输入" clearable />
  65. </el-form-item>
  66. <el-form-item label="设计来源:" prop="dataSource">
  67. <el-select clearable v-model="formData.dataSource" class="m-2" placeholder="请选择" style="width: 100%">
  68. <el-option v-for="item in Datasources" :key="item.value" :label="item.label" :value="item.value" />
  69. </el-select>
  70. </el-form-item>
  71. <el-form-item label="空间数据集:" prop="geometrys">
  72. <el-input v-model="formData.geometrys" placeholder="请输入" clearable />
  73. </el-form-item>
  74. <el-form-item label="排入水体(pr水体):" prop="intoWater">
  75. <el-input v-model="formData.intoWater" placeholder="请输入" clearable />
  76. </el-form-item>
  77. <el-form-item label="经度:" prop="lon">
  78. <el-input-number v-model="formData.lon" placeholder="请输入" style="width: 100%" controls-position="right" />
  79. </el-form-item>
  80. <el-form-item label="纬度:" prop="lat">
  81. <el-input-number v-model="formData.lat" placeholder="请输入" style="width: 100%" controls-position="right" />
  82. </el-form-item>
  83. <el-form-item label="规划规模(万吨/日):" prop="planScale">
  84. <el-input-number v-model="formData.planScale" placeholder="请输入" style="width: 100%" controls-position="right" />
  85. </el-form-item>
  86. <el-form-item label="辖区:" prop="region">
  87. <el-input v-model="formData.region" placeholder="请输入" clearable />
  88. </el-form-item>
  89. <el-form-item label="标准:" prop="standard">
  90. <el-input v-model="formData.standard" placeholder="请输入" clearable />
  91. </el-form-item>
  92. <el-form-item label="工艺:" prop="workmanship">
  93. <el-input v-model="formData.workmanship" placeholder="请输入" clearable />
  94. </el-form-item>
  95. <el-form-item label="xz规模(xz规模):" prop="xzScale">
  96. <el-input v-model="formData.xzScale" placeholder="请输入" clearable />
  97. </el-form-item>
  98. </el-row>
  99. </el-form>
  100. <template #footer>
  101. <div class="dialog-footer">
  102. <el-button type="primary" @click="submitForm" v-show="!isDisab">保 存</el-button>
  103. <el-button @click="cancel">关闭</el-button>
  104. </div>
  105. </template>
  106. </el-dialog>
  107. </div>
  108. </div>
  109. </template>
  110.  
  111. <script setup>
  112. import { facilitySewagePage, facilitySewageAdd, facilitySewageEdit, facilitySewageDelete } from '@/api/scada/sewage';
  113. const { proxy } = getCurrentInstance();
  114. const isDisab = ref(false);
  115. const hiddentext = ref(false);
  116. const showSearch = ref(true);
  117. const showDialog = ref(false);
  118. const tableLoading = ref(true);
  119. const total = ref(0);
  120. const tableData = ref([]);
  121. const dialogTitle = ref('');
  122. const Datasources = ref([
  123. { label: '设计院', value: '1' },
  124. { label: '待定', value: '2' },
  125. ]);
  126. let AllData = reactive({
  127. formData: {},
  128. queryParams: { sewageName: '', pageNum: 1, pageSize: 10 },
  129. formRules: {
  130. sewageName: [{ required: true, message: '请输入', trigger: 'blur' }],
  131. sewageCode: [{ required: true, message: '请输入', trigger: 'blur' }],
  132. },
  133. });
  134. let { queryParams, formData, formRules } = toRefs(AllData);
  135. /** 表单重置 */
  136. function resetForm() {
  137. formData.value = {};
  138. proxy.resetForm('ruleForm');
  139. }
  140. //搜索
  141. const searchForm = () => {
  142. queryParams.value.pageNum = 1;
  143. getDataList();
  144. };
  145. //重置按钮
  146. const resectClcik = () => {
  147. queryParams.value.sewageName = '';
  148. getDataList();
  149. };
  150.  
  151. //获取列表数据
  152. const getDataList = async () => {
  153. tableLoading.value = true;
  154. const res = await facilitySewagePage(queryParams.value);
  155. tableLoading.value = false;
  156. tableData.value = res.data;
  157. total.value = res.total;
  158. };
  159. //新增按钮
  160. const addData = () => {
  161. resetForm();
  162. isDisab.value = false;
  163. showDialog.value = true;
  164. hiddentext.value = false;
  165. dialogTitle.value = '新增污水厂信息';
  166. };
  167. /** 取消按钮 */
  168. function cancel() {
  169. showDialog.value = false;
  170. resetForm();
  171. }
  172. /** 新增弹框 修改弹框 提交按钮 */
  173. async function submitForm() {
  174. proxy.$refs['ruleForm'].validate(valid => {
  175. if (valid) {
  176. if (formData.value.id != undefined) {
  177. facilitySewageEdit(formData.value).then(() => {
  178. proxy.$modal.msgSuccess('修改成功');
  179. showDialog.value = false;
  180. getDataList();
  181. });
  182. } else {
  183. facilitySewageAdd(formData.value).then(() => {
  184. proxy.$modal.msgSuccess('新增成功');
  185. showDialog.value = false;
  186. getDataList();
  187. });
  188. }
  189. }
  190. });
  191. }
  192. //表格修改
  193. function editData(row) {
  194. dialogTitle.value = '修改污水厂信息';
  195. isDisab.value = false;
  196. showDialog.value = true;
  197. hiddentext.value = true;
  198. formData.value = { ...row };
  199. formData.value.lat = Number(row.lat);
  200. formData.value.lon = Number(row.lon);
  201. }
  202. // 表格删除
  203. function deleteData(row) {
  204. proxy.$modal
  205. .confirm('是否确认删除?')
  206. .then(async () => {
  207. const res = await facilitySewageDelete(row.id);
  208. if (res?.code !== 200) return;
  209. proxy.$modal.msgSuccess('操作成功!');
  210. getDataList();
  211. })
  212. .catch(() => {});
  213. }
  214. //详情按钮
  215. function checkDetail(row) {
  216. dialogTitle.value = '查看污水厂信息';
  217. isDisab.value = true;
  218. showDialog.value = true;
  219. formData.value = { ...row };
  220. formData.value.lat = Number(row.lat);
  221. formData.value.lon = Number(row.lon);
  222. }
  223.  
  224. onMounted(() => {
  225. getDataList();
  226. });
  227. </script>
  228.  
  229. <style lang="scss" scoped>
  230. .water-analysis-page {
  231. padding: 20px;
  232. overflow-y: hidden;
  233. }
  234. </style>