Newer
Older
KaiFengPC / src / views / floodSys / scada / pumpStationInformation / index.vue
@zhangdeliang zhangdeliang on 23 May 16 KB 初始化项目
<template>
  <!-- 泵站信息管理 -->
  <div class="water-analysis-page">
    <div class="top">
      <el-form ref="queryRef" inline :model="queryParams" v-show="showSearch">
        <el-form-item label="站点:" prop="pumpCode">
          <el-select clearable v-model="queryParams.pumpCode" placeholder="请选择">
            <el-option v-for="item in typeList" :key="item.stationCode" :label="item.stationName" :value="item.stationCode" />
          </el-select>
        </el-form-item>
        <el-form-item label="泵站类型:" prop="pumpType">
          <el-select clearable v-model="queryParams.pumpType" placeholder="请选择">
            <el-option v-for="dict in pump_type" :key="dict.value" :label="dict.label" :value="dict.value" />
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" icon="Search" @click="searchForm"> 查询</el-button>
          <el-button icon="Refresh" @click="resectClcik"> 重置</el-button>
        </el-form-item>
      </el-form>
      <el-row :gutter="10" class="mb8">
        <el-button type="primary" plain icon="Plus" @click="addData">新增</el-button>
        <right-toolbar v-model:showSearch="showSearch" @queryTable="searchForm"></right-toolbar>
      </el-row>
    </div>
    <!-- 表格 -->
    <el-table :data="tableData" v-loading="tableLoading" :max-height="650">
      <el-table-column type="index" width="70" label="序号" />
      <el-table-column label="泵站编号" prop="pumpCode" />
      <el-table-column label="泵站名称" prop="pumpName" />
      <el-table-column label="泵站类型" prop="pumpType">
        <template #default="{ row }">
          <dict-tag :options="pump_type" :value="row.pumpType"></dict-tag>
        </template>
      </el-table-column>
      <el-table-column label="设计规模" prop="designScale">
        <template #default="{ row }">
          {{ getUnitName(row) }}
        </template>
      </el-table-column>
      <el-table-column label="日抽排量" prop="dayLarge" />
      <el-table-column label="起抽水位(m)" prop="qbWaterlevel" />
      <el-table-column label="停抽水位(m)" prop="tbWaterlevel" />
      <el-table-column label="建设时间" prop="createTime" width="160" />
      <el-table-column label="主管单位" prop="unitDep" />
      <el-table-column label="泵机数量" prop="deviceCount" />
      <el-table-column label="操作" show-overflow-tooltip width="250">
        <template #default="{ row }">
          <el-button link icon="View" type="primary" @click="checkDetail(row)">详情</el-button>
          <el-button link icon="Edit" type="warning" @click="editData(row)">修改</el-button>
          <el-button link icon="Delete" type="danger" @click="deleteData(row)">删除</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="getDataList"
    />
    <div class="water-analysis-page">
      <!-- 添加 修改 查看彈框 -->
      <el-dialog :title="dialogTitle" v-model="showDialog" width="70%" :close-on-click-modal="false">
        <el-form ref="ruleForm" :model="formData" :rules="formRules" :disabled="isDisab" label-width="180px">
          <el-row>
            <el-form-item label="泵站名称:" prop="pumpName" style="width: 45%">
              <el-input v-model="formData.pumpName" placeholder="请输入" clearable />
            </el-form-item>
            <el-form-item label="泵站编码:" prop="pumpCode" style="width: 45%">
              <el-input v-model="formData.pumpCode" placeholder="请输入" clearable :disabled="hiddentext" />
            </el-form-item>
            <el-form-item label="泵站类型:" prop="pumpType" style="width: 45%">
              <el-select clearable v-model="formData.pumpType" class="m-2" placeholder="请选择" style="width: 100%">
                <el-option v-for="item in pump_type" :key="item.value" :label="item.label" :value="item.value" />
              </el-select>
            </el-form-item>
            <el-form-item label="所属:" prop="belongTo" style="width: 45%">
              <el-select clearable v-model="formData.belongTo" class="m-2" placeholder="请选择" style="width: 100%">
                <el-option v-for="item in Affiliation" :key="item.value" :label="item.label" :value="item.value" />
              </el-select>
            </el-form-item>
            <el-form-item label="建筑面积:" prop="buildArea" style="width: 45%">
              <el-input v-model="formData.buildArea" placeholder="请输入" clearable />
            </el-form-item>
            <el-form-item label="汇水分区(汇水分区):" prop="catchmentArea" style="width: 45%">
              <el-input v-model="formData.catchmentArea" placeholder="请输入" clearable />
            </el-form-item>
            <el-form-item label="运维公司:" prop="company" style="width: 45%">
              <el-input v-model="formData.company" placeholder="请输入" clearable />
            </el-form-item>
            <el-form-item label="出水管管径(csg管径):" prop="csgPipeDiameter" style="width: 45%">
              <el-input v-model="formData.csgPipeDiameter" placeholder="请输入" clearable />
            </el-form-item>
            <el-form-item label="设计来源:" prop="dataSource" style="width: 45%">
              <el-select clearable v-model="formData.dataSource" class="m-2" placeholder="请选择" style="width: 100%">
                <el-option v-for="item in Datasources" :key="item.value" :label="item.label" :value="item.value" />
              </el-select>
            </el-form-item>
            <el-form-item label="日抽排量:" prop="dayLarge" style="width: 45%">
              <el-input-number v-model="formData.dayLarge" placeholder="请输入" controls-position="right" style="width: 100%" clearable />
            </el-form-item>
            <el-form-item label="设计扬程:" prop="designHead" style="width: 45%">
              <el-input-number v-model="formData.designHead" placeholder="请输入" controls-position="right" style="width: 100%" clearable />
            </el-form-item>
            <el-form-item label="设计功率:" prop="designPower" style="width: 45%">
              <el-input-number
                v-model="formData.designPower"
                placeholder="请输入"
                controls-position="right"
                style="width: 100%"
                clearable
              />
            </el-form-item>
            <el-form-item :label="changelabel()" prop="designScale" style="width: 45%">
              <el-input-number v-model="formData.designScale" placeholder="请输入" controls-position="right" style="width: 100%" clearable>
              </el-input-number>
            </el-form-item>
            <el-form-item label="设计时间(sj时间):" prop="designTime" style="width: 45%">
              <el-input v-model="formData.designTime" placeholder="请输入" clearable />
            </el-form-item>

            <el-form-item label="泵机数量:" prop="deviceCount" style="width: 45%">
              <el-input-number
                v-model="formData.deviceCount"
                placeholder="请输入"
                controls-position="right"
                style="width: 100%"
                clearable
              />
            </el-form-item>
            <el-form-item label="领导:" prop="dutyLeaderName" style="width: 45%">
              <el-input v-model="formData.dutyLeaderName" placeholder="请输入" clearable />
            </el-form-item>
            <el-form-item label="领导手机号:" prop="dutyLeaderPhone" style="width: 45%">
              <el-input v-model="formData.dutyLeaderPhone" placeholder="请输入" clearable />
            </el-form-item>
            <el-form-item label="负责人:" prop="dutyUserName" style="width: 45%">
              <el-input v-model="formData.dutyUserName" placeholder="请输入" clearable />
            </el-form-item>
            <el-form-item label="负责人手机号:" prop="dutyUserPhone" style="width: 45%">
              <el-input v-model="formData.dutyUserPhone" placeholder="请输入" clearable />
            </el-form-item>
            <el-form-item label="空间数据:" prop="geometrys" style="width: 45%">
              <el-input v-model="formData.geometrys" placeholder="请输入" clearable />
            </el-form-item>
            <el-form-item label="地面高程(地面gc):" prop="groundAltitude" style="width: 45%">
              <el-input v-model="formData.groundAltitude" placeholder="请输入" clearable />
            </el-form-item>
            <el-form-item label="所属污水处理系统:" prop="hhsxWaterCode" style="width: 45%">
              <el-input v-model="formData.hhsxWaterCode" placeholder="请输入" clearable />
            </el-form-item>
            <el-form-item label="jsc高程 (jsc高程):" prop="jscAltitude" style="width: 45%">
              <el-input v-model="formData.jscAltitude" placeholder="请输入" clearable />
            </el-form-item>
            <el-form-item label="进水管管径(jsg管径):" prop="jsgPipeDiameter" style="width: 45%">
              <el-input v-model="formData.jsgPipeDiameter" placeholder="请输入" clearable />
            </el-form-item>

            <el-form-item label="抽排量(m³/h):" prop="large" style="width: 45%">
              <el-input-number v-model="formData.large" placeholder="请输入" controls-position="right" style="width: 100%" clearable />
            </el-form-item>
            <el-form-item label="最高水位 (zg水位):" prop="maxWaterlevel" style="width: 45%">
              <el-input-number
                v-model="formData.maxWaterlevel"
                placeholder="请输入"
                controls-position="right"
                style="width: 100%"
                clearable
              />
            </el-form-item>
            <el-form-item label="型号 (设计院-型号):" prop="model" style="width: 45%">
              <el-input v-model="formData.model" placeholder="请输入" clearable />
            </el-form-item>
            <el-form-item label="起排水位(起抽水位):" prop="qbWaterlevel" style="width: 45%">
              <el-input v-model="formData.qbWaterlevel" placeholder="请输入" clearable />
            </el-form-item>
            <el-form-item label="停排水位(停抽水位):" prop="tbWaterlevel" style="width: 45%">
              <el-input v-model="formData.tbWaterlevel" placeholder="请输入" clearable />
            </el-form-item>
            <el-form-item label="行政区(行政区):" prop="region" style="width: 45%">
              <el-input v-model="formData.region" placeholder="请输入" clearable />
            </el-form-item>
            <el-form-item label="主管单位:" prop="unitDep" style="width: 45%">
              <el-input v-model="formData.unitDep" placeholder="请输入" clearable />
            </el-form-item>
          </el-row>
        </el-form>
        <template #footer>
          <div class="dialog-footer">
            <el-button type="primary" @click="submitForm" v-show="!isDisab">保 存</el-button>
            <el-button @click="cancel">关闭</el-button>
          </div>
        </template>
      </el-dialog>
    </div>
  </div>
</template>

<script setup>
import { stationInfolist } from '@/api/scada/areaInfo';
import { facilityPumpPage, facilityPumpAdd, facilityPumpEdit, facilityPumpDelete } from '@/api/scada/pumpStationInformation';
import { getInfo } from '@/api/scada/plcPointInfo';
const { proxy } = getCurrentInstance();
const hiddentext = ref(false);
const isDisab = ref(false);
const showSearch = ref(true);
const showDialog = ref(false);
const tableLoading = ref(true);
const total = ref(0);
const tableData = ref([]);
let typeList = ref([]);
const dialogTitle = ref('');
const { pump_type } = proxy.useDict('pump_type');

const Affiliation = ref([
  { label: '市', value: '1' },
  { label: '区', value: '2' },
]);
const Datasources = ref([
  { label: '设计院', value: '1' },
  { label: '待定', value: '2' },
]);

let AllData = reactive({
  formData: {},
  queryParams: { pumpCode: '', pumpType: '', pageNum: 1, pageSize: 10 },
  formRules: {},
});
let { queryParams, formData, formRules } = toRefs(AllData);
/** 表单重置 */
function resetForm() {
  formData.value = {
    stCode: undefined,
    belongTo: undefined,
    dataSource: undefined,
    buildArea: undefined,
    dayLarge: undefined,
    designHead: undefined,
  };
  proxy.resetForm('ruleForm');
}
//搜索
const searchForm = () => {
  queryParams.value.pageNum = 1;
  getDataList();
};
//重置按钮
const resectClcik = () => {
  queryParams.value.pumpCode = '';
  queryParams.value.pumpType = '';
  getDataList();
};
//站点下拉框
const stationInfolistM = async p => {
  const res = await stationInfolist();
  typeList.value = res.data;
};
//获取列表数据
const getDataList = async () => {
  tableLoading.value = true;
  const res = await facilityPumpPage(queryParams.value);
  tableLoading.value = false;
  tableData.value = res.data;
  total.value = res.total;
};
//新增按钮
const addData = () => {
  resetForm();
  isDisab.value = false;
  showDialog.value = true;
  hiddentext.value = false;
  dialogTitle.value = '新增泵站信息';
};
/** 取消按钮 */
function cancel() {
  showDialog.value = false;
  resetForm();
}
/** 新增弹框 修改弹框 提交按钮 */
async function submitForm() {
  proxy.$refs['ruleForm'].validate(valid => {
    if (valid) {
      if (formData.value.id != undefined) {
        facilityPumpEdit(formData.value).then(() => {
          proxy.$modal.msgSuccess('修改成功');
          showDialog.value = false;
          getDataList();
        });
      } else {
        facilityPumpAdd(formData.value).then(() => {
          proxy.$modal.msgSuccess('新增成功');
          showDialog.value = false;
          getDataList();
        });
      }
    }
  });
}

function changelabel() {
  let label = '设计规模';
  switch (formData.value.pumpType) {
    case 'rain_water':
      label = '设计规模(m³/s)';
      break;
    case 'sewage_water':
      label = '设计规模(万吨/日)';
      break;
    case 'drain_flooded':
      label = '设计规模(m³/s)';
      break;
  }
  return label;
}
//表格修改
function editData(row) {
  dialogTitle.value = '修改泵站信息';
  isDisab.value = false;
  showDialog.value = true;
  hiddentext.value = true;
  formData.value = { ...row };
  formData.value.designHead = Number(row.designHead);
  formData.value.dayLarge = Number(row.dayLarge);
  formData.value.designPower = Number(row.designPower);
  formData.value.deviceCount = Number(row.deviceCount);
  formData.value.maxWaterlevel = Number(row.maxWaterlevel);
  formData.value.modelValue = Number(row.modelValue);
  formData.value.large = Number(row.large);
}
// 表格删除
function deleteData(row) {
  proxy.$modal
    .confirm('是否确认删除?')
    .then(async () => {
      const res = await facilityPumpDelete(row.id);
      if (res?.code !== 200) return;
      proxy.$modal.msgSuccess('操作成功!');
      getDataList();
    })
    .catch(() => {});
}
//详情按钮
function checkDetail(row) {
  dialogTitle.value = '查看泵站信息';
  isDisab.value = true;
  showDialog.value = true;
  formData.value = { ...row };
  formData.value.designHead = Number(row.designHead);
  formData.value.dayLarge = Number(row.dayLarge);
  formData.value.designPower = Number(row.designPower);
  formData.value.deviceCount = Number(row.deviceCount);
  formData.value.maxWaterlevel = Number(row.maxWaterlevel);
  formData.value.modelValue = Number(row.modelValue);
  formData.value.large = Number(row.large);
  // console.log(formData.value.pumpType, 'formData.value.pumpType');
}

function getUnitName(row) {
  let unitName = '';
  switch (row.pumpType) {
    case 'rain_water':
      unitName = 'm³/s';
      break;
    case 'sewage_water':
      unitName = '万吨/日';
      break;
    case 'drain_flooded':
      unitName = 'm³/s';
      break;
  }

  return `${row.designScale}${unitName}`;
}

onMounted(() => {
  getDataList();
  stationInfolistM();
});
</script>

<style lang="scss" scoped>
.water-analysis-page {
  padding: 20px;
  overflow-y: hidden;
}
</style>