Newer
Older
KaiFengPC / src / views / floodSys / scada / plcPointInfo / index.vue
@zhangdeliang zhangdeliang on 23 May 5 KB 初始化项目
<template>
  <div class="water-analysis-page">
    <div class="top">
      <el-form ref="ruleForm" inline :model="tableData" v-show="showSearch">
        <el-form-item v-for="i in queryClouns" :label="i.label" :prop="i.prop">
          <el-select
            style="width: 100%"
            clearable
            v-model="tableData.stationCode"
            v-if="i.prop == 'stationCode'"
            :placeholder="i.placeholder"
            @change="stationNameChange"
            :disabled="typeList.type == 2"
          >
            <el-option
              v-for="dict in typeList.stationName_type"
              :key="dict.stationCode"
              :label="dict.stationName"
              :value="dict.stationCode"
            />
          </el-select>

          <el-select
            style="width: 100%"
            clearable
            v-model="tableData.status"
            class="m-2"
            v-else-if="i.prop == 'status'"
            :placeholder="i.placeholder"
          >
            <el-option v-for="dict in status_source" :key="dict.value" :label="dict.label" :value="dict.value" />
          </el-select>
          <el-select
            style="width: 100%"
            clearable
            v-model="tableData.deviceCode"
            v-else-if="i.prop == 'deviceCode'"
            :placeholder="i.placeholder"
          >
            <el-option v-for="dict in typeList.deviceNameList" :key="dict.deviceCode" :label="dict.deviceName" :value="dict.deviceCode" />
          </el-select>
          <el-select v-else-if="i.prop == 'dataType'" clearable v-model="tableData.dataType" :placeholder="i.placeholder">
            <el-option v-for="dict in data_type" :key="dict.stCode" :label="dict.label" :value="dict.value"></el-option>
          </el-select>
          <el-select v-else-if="i.prop == 'reportType'" clearable v-model="tableData.reportType" :placeholder="i.placeholder">
            <el-option v-for="dict in report_type" :key="dict.stCode" :label="dict.label" :value="dict.value"></el-option>
          </el-select>
          <el-input v-else style="width: 240px" clearable v-model="tableData[i.prop]" :placeholder="i.placeholder"></el-input>
        </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-col :span="1.5">
          <el-button type="primary" plain icon="Plus" @click="onCheck(4)">新增</el-button>
        </el-col>
        <right-toolbar v-model:showSearch="showSearch" @queryTable="searchForm"></right-toolbar>
      </el-row>
    </div>
    <todoDon ref="todoDonRef" :typeListlist="typeList"></todoDon>
    <el-dialog v-model="visible" title="PLC点位信息新增" :modal-append-to-body="false" :close-on-click-modal="false" width="51%">
      <tableDalgo :key="isFlag" ref="tableDalgoRef" :typeList="typeList" @onModalClose="onModalClose"></tableDalgo>
      <template #footer>
        <div class="dialog-footer">
          <el-button @click="open2" type="primary">保 存</el-button>
          <el-button @click="visible = false">关闭</el-button>
        </div>
      </template>
    </el-dialog>
  </div>
</template>
<script setup>
import tableDalgo from './tableDalgo.vue';
import todoDon from './todoDon.vue';
import { stationInfolist, areaInfolist } from '@/api/scada/areaInfo';
import { getInfolist } from '@/api/scada/deviceInfo';
import { status_source } from '@/utils/form';
const { proxy } = getCurrentInstance();
const { data_type, report_type, plc_point_type } = proxy.useDict('data_type', 'report_type', 'plc_point_type');
const todoDonRef = ref(null);
const ruleForm = ref(null);
let typeList = ref({});
const tableDalgoRef = ref();
const showSearch = ref(true);
let visible = ref(false);
let isFlag = ref(1);
const queryClouns = [
  { label: '点位名称:', prop: 'pointName', placeholder: '请输入点位名称' },
  { label: '站点:', prop: 'stationCode', placeholder: '请选择站点' },
  { label: '设备', prop: 'deviceCode', placeholder: '请选择设备' },
  { label: '数据类型:', prop: 'dataType', placeholder: '请选择数据类型' },
  // { label: "点位名称:",prop: "pointName",placeholder: "请输入点位名称",},
  // { label: "报表统计类型:",prop: "reportType",placeholder: "请选择报表统计类型",},
  { label: '状态:', prop: 'status', placeholder: '请选择状态' },
  // { label: "报价日期:", prop: "quoteDate", placeholder: "请选择报价日期" },
];
//动态组件
let dataForm = reactive({
  tableData: {
    pageNum: 1,
    pageSize: 10,
    stationCode: null,
    status: null,
    deviceCode: null,
    dataType: null,
    reportType: null,
  },
  tableDateTwo: '',
  tableLoading: true,
});
let { tableData } = toRefs(dataForm);
//获取列表数据
//搜索
const searchForm = () => {
  todoDonRef.value.search(tableData.value);
};
//重置
const resectClcik = () => {
  ruleForm.value.resetFields();
  todoDonRef.value.search(tableData.value);
};
// 新增
const onCheck = ty => {
  visible.value = true;
  typeList.value.type = ty;
  nextTick(() => {
    tableDalgoRef.value.resetFiled();
  });
};
//保存
function open2() {
  tableDalgoRef.value.submit();
}
function onModalClose() {
  visible.value = false;
  todoDonRef.value.search(tableData.value);
}
const stationInfolistM = async () => {
  let { data } = await stationInfolist();
  typeList.value.stationName_type = data;
};
const areaInfolistM = async p => {
  let { data } = await areaInfolist(p);
  typeList.value.areaName_type = data;
};
const getInfolistM = async p => {
  let { data } = await getInfolist(p);
  typeList.value.deviceNameList = data;
};
function stationNameChange(v) {
  tableData.value.deviceCode = '';
  getInfolistM({ stationCode: v });
}
onMounted(() => {
  stationInfolistM();
  areaInfolistM();
  getInfolistM();
  searchForm();
});
</script>
<style lang="scss" scoped>
.water-analysis-page {
  padding: 20px;
  overflow-y: hidden;
}
</style>