Newer
Older
Nanping_sponge_GCYPG / src / views / AlertService / components / reportService.vue
@liyingjing liyingjing on 25 Oct 7 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="dataType" >
        <el-select v-model="queryParams.dataType" 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="dataType" >
        <el-select v-model="queryParams.dataType" 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>
        <el-button type="primary" icon="Search" @click="handleQuery"
          >搜索</el-button
        >
        <el-button type="primary" plain icon="Plus" @click="handleAdd"
          >新增</el-button
        >
        <el-button icon="Refresh" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>
    <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="siteType">
        <template #default="scope">
          <span>{{ selectDictLabel(siteTypes, scope.row.siteType) }}</span>
        </template>
      </el-table-column>
      <el-table-column label="监测类型" align="center" prop="monitorTargetType">
        <template #default="scope">
          <span>{{
            selectDictLabel(monitorTargetTypes, scope.row.monitorTargetType)
          }}</span>
        </template>
      </el-table-column>
      <el-table-column label="站点编号" align="center" prop="stCode" />
      <el-table-column
        label="站点名称"
        align="center"
        prop="stName"
        show-overflow-tooltip
      />
      <el-table-column label="在线状态" align="center" prop="onlineStatus">
        <template #default="scope">
          <dict-tag :options="onlineStatus" :value="scope.row.onlineStatus" />
        </template>
      </el-table-column>
      <el-table-column label="故障状态" align="center" prop="faultStatus">
        <template #default="scope">
          <dict-tag :options="faultStatus" :value="scope.row.faultStatus" />
        </template>
      </el-table-column>
      <el-table-column
        label="安装地址"
        align="center"
        prop="address"
        show-overflow-tooltip
      />
      <el-table-column
        label="安装日期"
        align="center"
        prop="installDate"
        width="180"
      >
        <template #default="scope">
          <span>{{ parseTime(scope.row.installDate, "{y}-{m}-{d}") }}</span>
        </template>
      </el-table-column>
      <el-table-column
        label="合同日期"
        align="center"
        prop="contractDate"
        width="180"
      >
        <template #default="scope">
          <span>{{ parseTime(scope.row.contractDate, "{y}-{m}-{d}") }}</span>
        </template>
      </el-table-column>
      <el-table-column label="负责人" align="center" prop="chargeUser" />
      <el-table-column
        label="操作"
        align="center"
        width="200"
        class-name="small-padding fixed-width"
      >
        <template #default="scope">
          <el-button
            link
            type="primary"
            icon="Edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['newfiber-business-base:rtuSiteInfo:edit']"
            >修改</el-button
          >
          <!-- <el-button
            link
            type="primary"
            icon="Delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['newfiber-business-base:rtuSiteInfo:remove']"
            >删除</el-button
          > -->
          <el-button
            link
            type="primary"
            icon="View"
            @click="handleDetail(scope.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="getList"
    />

    <el-dialog v-model="dialogShow" title="新增告警" width="800px" append-to-body class="equipmentDialog">
      <abilityAnalysis v-if="dialogShow"></abilityAnalysis>
    </el-dialog>
  </div>
</template>
<script setup name="syntheticData">
import abilityAnalysis from './abilityAnalysis.vue'; //基本信息查看更多
const { proxy } = getCurrentInstance();
const showSearch = ref(true);
const tableData = ref([]);
const loading = ref(false);
const dialogShow = ref(false);

// 变量声明
const searchVal1 = ref("");
const searchVal2 = ref("");
const shortcuts = [
  {
    text: "上周",
    value: () => {
      const end = new Date();
      const start = new Date();
      start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
      return [start, end];
    },
  },
  {
    text: "上个月",
    value: () => {
      const end = new Date();
      const start = new Date();
      start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
      return [start, end];
    },
  },
  {
    text: "过去3个月",
    value: () => {
      const end = new Date();
      const start = new Date();
      start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
      return [start, end];
    },
  },
];
const holidays = ["2023-06-01", "2023-06-06", "2023-07-06"];
const data = reactive({
  form: {},
  queryParams: {
    pageNum: 1,
    pageSize: 10,
    dataType: null,
    dateTime: [],
  },
});
const { queryParams, form } = toRefs(data);
const isHoliday = ({ dayjs }) => {
  return holidays.includes(dayjs.format("YYYY-MM-DD"));
};
// 方法
//获取分页数据
function getList() {
  loading.value = true;
  //   pagertuSiteInfo(queryParams.value).then((response) => {
  //     rtuSiteInfoList.value = response.data;
  //     total.value = response.total;
  //     loading.value = false;
  //   });
}
/** 搜索按钮操作 */
function handleQuery() {
  queryParams.value.pageNum = 1;
  getList();
}

/** 重置按钮操作 */
function resetQuery() {
  proxy.resetForm("queryRef");
  handleQuery();
}

// 多选框选中数据
function handleSelectionChange(selection) {
  ids.value = selection.map((item) => item.id);
  single.value = selection.length != 1;
  multiple.value = !selection.length;
}
//新增按钮
function handleAdd(){ 
  dialogShow.value=true
console.log(1111);
}
// 初始化
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>