Newer
Older
Nanping_sponge_SJJC / src / views / dataAnalysis / dataService / reportService.vue
@liyingjing liyingjing on 25 Oct 6 KB 数据检测
<template>
  <!-- 数据服务 报表服务 -->
  <div class="app-container">
    <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="" prop="type">
        <el-select v-model="queryParams.type" placeholder="请选择数据类型">
          <el-option v-for="dict in dataTypes" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="" prop="monitorIntervalMinute">
        <el-select v-model="queryParams.monitorIntervalMinute" placeholder="请选择查询步长">
          <el-option v-for="dict in monitorIntervalMinutes" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="" prop="stCode">
        <el-select v-model="queryParams.stCode" filterable clearable placeholder="请选择站点" style="width: 300px">
          <el-option
            v-for="dict in searchSiteList"
            :key="dict.stCode"
            :label="`${dict.stName}-${dict.stCode}`"
            :value="dict.stCode"
          ></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="" prop="dateRange">
        <dateSelect dateType="daterange" valueFormat="YYYY-MM-DD" :dateTime="dateRange" @update="changeTime"></dateSelect>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
        <el-button icon="Refresh" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button type="warning" plain icon="Download" @click="handleExport">导出</el-button>
      </el-col>
      <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>
    <el-table v-loading="loading" :data="tableData" border @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="序号" type="index" width="55" align="center" />
      <el-table-column label="站点编号" align="center" prop="stCode" width="120" show-overflow-tooltip />
      <el-table-column label="站点名称" align="center" prop="stName" show-overflow-tooltip />
      <el-table-column label="最后数据上传" align="center" prop="tt" width="180"> </el-table-column>
      <el-table-column label="水位(m)" align="center" prop="z" width="100"> </el-table-column>
      <el-table-column label="安装高度(m)" align="center" prop="installHeight" width="100" />
      <el-table-column label="监测高程" align="center" prop="elevationSystem" width="100">
        <template #default="scope">
          <dict-tag :options="elevationSystemTypes" :value="scope.row.elevationSystem" />
        </template>
      </el-table-column>
      <el-table-column label="安装位置" align="center" prop="address" show-overflow-tooltip> </el-table-column>
      <el-table-column label="数据状态" align="center" prop="faultStatus" width="100">
        <template #default="scope">
          <dict-tag :options="faultStatus" :value="scope.row.faultStatus" />
        </template>
      </el-table-column>
      <el-table-column label="设备状态" align="center" prop="onlineStatus" width="100">
        <template #default="scope">
          <dict-tag :options="onlineStatus" :value="scope.row.onlineStatus" />
        </template>
      </el-table-column>
      <el-table-column label="数据完整率" align="center" prop="dataIntegrityRate" width="100" />
    </el-table>

    <pagination
      v-show="total > 0"
      :total="total"
      v-model:page="queryParams.pageNum"
      v-model:limit="queryParams.pageSize"
      @pagination="getList"
    />
  </div>
</template>
<script setup name="reportService">
import { rtuSiteInfoList } from '@/api/dataAnalysis/repairdata';
import { reportingService } from '@/api/dataAnalysis/dataCapability';
import dateSelect from '@/views/dataAnalysis/components/dateSelect'; //日期组件
const { proxy } = getCurrentInstance();
const monitorIntervalMinutes = proxy.fixDict['monitorIntervalMinutes'];
const dataTypes = proxy.fixDict['dataTypes'];
const onlineStatus = proxy.fixDict['onlineStatus'];
const faultStatus = proxy.fixDict['faultStatus'];
const elevationSystemTypes = proxy.fixDict['elevationSystemTypes'];
const showSearch = ref(true);
const loading = ref(false);
const searchSiteList = ref([]); //站点搜索列表
const total = ref(0);
const tableData = ref([]);

const data = reactive({
  form: {},
  queryParams: {
    pageNum: 1,
    pageSize: 10,
    monitorIntervalMinute: '',
    type: '',
  },
  dateRange: [proxy.moment(new Date()).format('YYYY-MM-DD'), proxy.moment(new Date()).add(1, 'days').format('YYYY-MM-DD')],
});
const { queryParams, form, dateRange } = toRefs(data);

//修改时间
function changeTime(val) {
  dateRange.value = val;
}

//获取站点列表
function getSearchSiteList() {
  loading.value = true;
  rtuSiteInfoList().then(res => {
    searchSiteList.value = res.data;
  });
}

//获取分页数据
function getList() {
  loading.value = true;
  let params = { ...queryParams.value };
  params.startTime = dateRange.value ? dateRange.value[0] : '';
  params.endTime = dateRange.value ? dateRange.value[1] : '';
  reportingService(params).then(response => {
    tableData.value = response.data;
    total.value = response.total;
    loading.value = false;
  });
}
/** 搜索按钮操作 */
function handleQuery() {
  queryParams.value.pageNum = 1;
  getList();
}

/** 重置按钮操作 */
function resetQuery() {
  proxy.resetForm('queryRef');
  //queryParams.value.stCode = searchSiteList.value.length ? searchSiteList.value[0].stCode : '';
  handleQuery();
}

// 多选框选中数据
function handleSelectionChange(selection) {
  ids.value = selection.map(item => item.id);
  single.value = selection.length != 1;
  multiple.value = !selection.length;
}
/** 导出按钮操作 */
function handleExport() {
  let params = { ...queryParams.value };
  params.startTime = dateRange.value ? dateRange.value[0] : '';
  params.endTime = dateRange.value ? dateRange.value[1] : '';
  proxy.download('/business/siteHistoryMonitor/reportingServiceExport', params, `报表服务-${new Date().getTime()}.xlsx`);
}
getList();
getSearchSiteList();
// 初始化
onMounted(() => {});
</script>
<style lang="scss" scoped>
.syntherticData {
  width: 100%;
  .cell {
    height: 30px;
    padding: 3px 0;
    box-sizing: border-box;
  }
  .cell .text {
    width: 24px;
    height: 24px;
    display: block;
    margin: 0 auto;
    line-height: 24px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 50%;
  }
  .cell.current .text {
    background: #626aef;
    color: #fff;
  }
  .cell .holiday {
    position: absolute;
    width: 6px;
    height: 6px;
    background: var(--el-color-danger);
    border-radius: 50%;
    bottom: 0px;
    left: 50%;
    transform: translateX(-50%);
  }
}
</style>