You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							254 lines
						
					
					
						
							6.9 KiB
						
					
					
				
			
		
		
	
	
							254 lines
						
					
					
						
							6.9 KiB
						
					
					
				<template> | 
						|
  <!-- 列表 --> | 
						|
  <ContentWrap> | 
						|
    <section class="flex flex-col gap-20px"> | 
						|
      <section class="content"> | 
						|
        <el-tabs class="demo-tabs" @tab-click="handleClick" v-model="activeName"> | 
						|
          <el-tab-pane | 
						|
            v-for="dict in getIntDictOptions(DICT_TYPE.AIR_COLLECTION_TYPE)" | 
						|
            :key="dict.value" | 
						|
            :label="dict.label" | 
						|
            :name="dict.value" | 
						|
          > | 
						|
              <!-- 保持空内容 --> | 
						|
          </el-tab-pane> | 
						|
        </el-tabs> | 
						|
   | 
						|
        <div> | 
						|
          <UploadExcel | 
						|
            v-model="fileUrls" | 
						|
            :file-type="['xlsx', 'xls']" | 
						|
            :file-size="1" | 
						|
            @success="getList" | 
						|
          /> | 
						|
        </div> | 
						|
      </section> | 
						|
      | 
						|
 | 
						|
      <el-form | 
						|
            :model="queryParams" | 
						|
            ref="queryFormRef" | 
						|
            :inline="true" | 
						|
            size="large" | 
						|
            label-width="68px" | 
						|
            label-position="right" | 
						|
            class="formClass" | 
						|
          > | 
						|
            <el-form-item label="站点" prop="siteName"> | 
						|
              <el-input | 
						|
                v-model="queryParams.siteName" | 
						|
                placeholder="请输入站点名称" | 
						|
                clearable | 
						|
                @keyup.enter="handleQuery" | 
						|
                class="!w-240px" | 
						|
              /> | 
						|
            </el-form-item> | 
						|
 | 
						|
            <el-form-item label="时间" prop="createTime"> | 
						|
              <el-date-picker | 
						|
                v-model="queryParams.times" | 
						|
                value-format="YYYY-MM-DD HH:mm:ss" | 
						|
                type="daterange" | 
						|
                start-placeholder="开始日期" | 
						|
                end-placeholder="结束日期" | 
						|
                :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]" | 
						|
                class="!w-220px" | 
						|
              /> | 
						|
            </el-form-item> | 
						|
            <el-form-item> | 
						|
              <el-button @click="handleQuery" | 
						|
                ><Icon icon="ep:search" class="mr-5px" /> 查询 </el-button | 
						|
              > | 
						|
              <el-button @click="resetQuery" | 
						|
                ><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button | 
						|
              > | 
						|
             | 
						|
            </el-form-item> | 
						|
          </el-form> | 
						|
 | 
						|
          <el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true" style="margin-top: 25px"> | 
						|
            <template #empty> | 
						|
              <el-empty description="暂无数据" /> | 
						|
            </template> | 
						|
             | 
						|
            <el-table-column label="站点名称" align="center" prop="siteName" /> | 
						|
            <el-table-column | 
						|
              label="时间" | 
						|
              align="center" | 
						|
              prop="time" | 
						|
              width="220px" | 
						|
              :cell-style="{ borderBottom: '1px solid #EBEEF5' }" | 
						|
              :header-cell-style="{ | 
						|
                borderBottom: '1px solid #EBEEF5', | 
						|
                backgroundColor: '#F5F7FA' | 
						|
              }" | 
						|
            /> | 
						|
            <el-table-column label="PM2.s(ugim3)" align="center" prop="pm25" /> | 
						|
            <el-table-column label="PMo(ug/m3)" align="center" prop="pm10" /> | 
						|
            <el-table-column label="sOz(ug/m3)" align="center" prop="so2" /> | 
						|
            <el-table-column label="NOz(ug/m3)" align="center" prop="no2" /> | 
						|
            <el-table-column label="NO(Hg/m3)" align="center" prop="no" /> | 
						|
            <el-table-column label="NOx(Hg/m3)" align="center" prop="nox" /> | 
						|
            <el-table-column label="CO(mg/m3)" align="center" prop="co" /> | 
						|
            <el-table-column label="Oз(ug/m3)" align="center" prop="o3" /> | 
						|
            | 
						|
          </el-table> | 
						|
          <!-- 分页 --> | 
						|
          <el-pagination | 
						|
            :total="total" | 
						|
            :show-page-size="false" | 
						|
            layout="total, prev, pager, next" | 
						|
            v-model:current-page="queryParams.pageNo" | 
						|
            v-model:page-size="queryParams.pageSize" | 
						|
            @change="getList" | 
						|
            class="ml-auto" | 
						|
          /> | 
						|
 | 
						|
       | 
						|
    </section> | 
						|
  </ContentWrap> | 
						|
 | 
						|
  <!-- 表单弹窗:添加/修改 --> | 
						|
  <QualityCollectionForm ref="formRef" @success="getList" /> | 
						|
</template> | 
						|
 | 
						|
<script setup lang="ts"> | 
						|
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict' | 
						|
import { dateFormatter } from '@/utils/formatTime' | 
						|
import download from '@/utils/download' | 
						|
import { QualityCollectionApi, QualityCollectionVO } from '@/api/airqualitycollection' | 
						|
import QualityCollectionForm from './QualityCollectionForm.vue' | 
						|
const activeName = ref(1) | 
						|
 | 
						|
import { UploadExcel } from '@/components/UploadFile' | 
						|
 | 
						|
/** 空气质量采集 列表 */ | 
						|
defineOptions({ name: 'QualityCollection' }) | 
						|
 | 
						|
const message = useMessage() // 消息弹窗 | 
						|
const { t } = useI18n() // 国际化 | 
						|
 | 
						|
const loading = ref(true) // 列表的加载中 | 
						|
const list = ref<QualityCollectionVO[]>([]) // 列表的数据 | 
						|
const total = ref(0) // 列表的总页数 | 
						|
const queryParams:any = reactive({ | 
						|
  pageNo: 1, | 
						|
  pageSize: 10, | 
						|
  siteName: undefined, | 
						|
  city: undefined, | 
						|
  type: 1, | 
						|
  pm25: undefined, | 
						|
  pm10: undefined, | 
						|
  so2: undefined, | 
						|
  no2: undefined, | 
						|
  no: undefined, | 
						|
  nOx: undefined, | 
						|
  co: undefined, | 
						|
  o3: undefined, | 
						|
  remark: undefined, | 
						|
  remark2: undefined, | 
						|
  createTime: [], | 
						|
  times: [] | 
						|
}) | 
						|
const queryFormRef = ref() // 搜索的表单 | 
						|
const exportLoading = ref(false) // 导出的加载中 | 
						|
 | 
						|
const fileUrls = ref() | 
						|
 | 
						|
/** 查询列表 */ | 
						|
const getList = async () => { | 
						|
  loading.value = true | 
						|
  try { | 
						|
    const data = await QualityCollectionApi.getQualityCollectionPage(queryParams) | 
						|
    list.value = data.list | 
						|
    total.value = data.total | 
						|
  } finally { | 
						|
    loading.value = false | 
						|
  } | 
						|
} | 
						|
 | 
						|
const currentActiveType = computed(() => activeName.value) | 
						|
 | 
						|
 | 
						|
const handleClick = (tab: TabsPaneContext, event: Event) => { | 
						|
 | 
						|
  queryParams.type = tab.props.name | 
						|
  activeName.value = Number(tab.props.name) // 确保类型一致 | 
						|
  nextTick(getList) | 
						|
   | 
						|
} | 
						|
 | 
						|
/** 搜索按钮操作 */ | 
						|
const handleQuery = () => { | 
						|
  queryParams.pageNo = 1 | 
						|
  getList() | 
						|
} | 
						|
 | 
						|
/** 重置按钮操作 */ | 
						|
const resetQuery = () => { | 
						|
  queryFormRef.value.resetFields() | 
						|
  handleQuery() | 
						|
} | 
						|
 | 
						|
/** 添加/修改操作 */ | 
						|
const formRef = ref() | 
						|
const openForm = (type: string, id?: number) => { | 
						|
  formRef.value.open(type, id) | 
						|
} | 
						|
 | 
						|
/** 删除按钮操作 */ | 
						|
const handleDelete = async (id: number) => { | 
						|
  try { | 
						|
    // 删除的二次确认 | 
						|
    await message.delConfirm() | 
						|
    // 发起删除 | 
						|
    await QualityCollectionApi.deleteQualityCollection(id) | 
						|
    message.success(t('common.delSuccess')) | 
						|
    // 刷新列表 | 
						|
    await getList() | 
						|
  } catch {} | 
						|
} | 
						|
 | 
						|
/** 导出按钮操作 */ | 
						|
const handleExport = async () => { | 
						|
  try { | 
						|
    // 导出的二次确认 | 
						|
    await message.exportConfirm() | 
						|
    // 发起导出 | 
						|
    exportLoading.value = true | 
						|
    const data = await QualityCollectionApi.exportQualityCollection(queryParams) | 
						|
    download.excel(data, '空气质量采集.xls') | 
						|
  } catch { | 
						|
  } finally { | 
						|
    exportLoading.value = false | 
						|
  } | 
						|
} | 
						|
 | 
						|
/** 初始化 **/ | 
						|
onMounted(() => { | 
						|
  getList() | 
						|
}) | 
						|
</script> | 
						|
<style> | 
						|
.tabs { | 
						|
  display: flex; | 
						|
  flex-direction: column; | 
						|
 | 
						|
  ::v-deep(.el-form-item__label) { | 
						|
    display: inline-flex; | 
						|
  } | 
						|
} | 
						|
 | 
						|
.content { | 
						|
  display: flex; | 
						|
  flex-direction: row; | 
						|
  align-items: center; | 
						|
  justify-content: space-between; | 
						|
} | 
						|
 | 
						|
.demo-tabs > .el-tabs__content { | 
						|
  color: #6b778c; | 
						|
  font-size: 32px; | 
						|
  font-weight: 600; | 
						|
} | 
						|
</style>
 | 
						|
 |