|
|
|
|
@ -1,52 +1,33 @@
|
|
|
|
|
<template>
|
|
|
|
|
<ContentWrap>
|
|
|
|
|
<el-form
|
|
|
|
|
class="-mb-15px"
|
|
|
|
|
:model="queryParams"
|
|
|
|
|
ref="queryFormRef"
|
|
|
|
|
:inline="true"
|
|
|
|
|
label-width="100px"
|
|
|
|
|
>
|
|
|
|
|
<el-form class="-mb-15px" :model="queryParams" ref="queryFormRef" :inline="true" label-width="100px">
|
|
|
|
|
<el-form-item label="点位编码" prop="attributeCode">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="queryParams.attributeCode"
|
|
|
|
|
placeholder="请输入点位编码"
|
|
|
|
|
clearable
|
|
|
|
|
@keyup.enter="handleQuery"
|
|
|
|
|
class="!w-240px"
|
|
|
|
|
/>
|
|
|
|
|
<el-input v-model="queryParams.attributeCode" placeholder="请输入点位编码" clearable @keyup.enter="handleQuery"
|
|
|
|
|
class="!w-240px" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="点位名称" prop="attributeName">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="queryParams.attributeName"
|
|
|
|
|
placeholder="请输入点位名称"
|
|
|
|
|
clearable
|
|
|
|
|
@keyup.enter="handleQuery"
|
|
|
|
|
class="!w-240px"
|
|
|
|
|
/>
|
|
|
|
|
<el-input v-model="queryParams.attributeName" placeholder="请输入点位名称" clearable @keyup.enter="handleQuery"
|
|
|
|
|
class="!w-240px" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="点位类型" prop="attributeType">
|
|
|
|
|
<el-select
|
|
|
|
|
v-model="queryParams.attributeType"
|
|
|
|
|
clearable
|
|
|
|
|
filterable
|
|
|
|
|
placeholder="请选择"
|
|
|
|
|
class="!w-240px"
|
|
|
|
|
>
|
|
|
|
|
<el-select v-model="queryParams.attributeType" clearable filterable placeholder="请选择" class="!w-240px">
|
|
|
|
|
<el-option v-for="item in typeList" :key="item.id" :label="item.name" :value="item.name" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</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-button
|
|
|
|
|
type="primary"
|
|
|
|
|
plain
|
|
|
|
|
@click="openForm('create')"
|
|
|
|
|
v-hasPermi="['iot:device:create']"
|
|
|
|
|
>
|
|
|
|
|
<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-button type="primary" plain @click="openForm('create')" v-hasPermi="['iot:device:create']">
|
|
|
|
|
<Icon icon="ep:plus" class="mr-5px" /> 新增
|
|
|
|
|
</el-button>
|
|
|
|
|
<el-button type="success" plain @click="handleExport" :loading="exportLoading"
|
|
|
|
|
v-hasPermi="['iot:device:export']">
|
|
|
|
|
<Icon icon="ep:download" class="mr-5px" /> 导出
|
|
|
|
|
</el-button>
|
|
|
|
|
<el-button type="danger" plain @click="handleBatchDelete" v-hasPermi="['iot:device:delete']">
|
|
|
|
|
<Icon icon="ep:delete" class="mr-5px" /> 批量删除
|
|
|
|
|
</el-button>
|
|
|
|
|
@ -55,15 +36,8 @@
|
|
|
|
|
</ContentWrap>
|
|
|
|
|
|
|
|
|
|
<ContentWrap>
|
|
|
|
|
<el-table
|
|
|
|
|
ref="tableRef"
|
|
|
|
|
v-loading="loading"
|
|
|
|
|
:data="list"
|
|
|
|
|
:stripe="true"
|
|
|
|
|
:show-overflow-tooltip="true"
|
|
|
|
|
row-key="id"
|
|
|
|
|
@selection-change="handleSelectionChange"
|
|
|
|
|
>
|
|
|
|
|
<el-table ref="tableRef" v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true" row-key="id"
|
|
|
|
|
@selection-change="handleSelectionChange">
|
|
|
|
|
<el-table-column type="selection" width="55" reserve-selection />
|
|
|
|
|
<el-table-column label="点位编码" align="left" prop="attributeCode" width="150px" />
|
|
|
|
|
<el-table-column label="点位名称" align="left" prop="attributeName" width="150px" />
|
|
|
|
|
@ -85,13 +59,8 @@
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="单位" align="center" prop="dataUnit" width="80px" />
|
|
|
|
|
<el-table-column label="倍率" align="center" prop="ratio" width="80px" />
|
|
|
|
|
<el-table-column
|
|
|
|
|
label="最新采集时间"
|
|
|
|
|
align="center"
|
|
|
|
|
prop="latestCollectTime"
|
|
|
|
|
:formatter="dateFormatter"
|
|
|
|
|
width="170px"
|
|
|
|
|
/>
|
|
|
|
|
<el-table-column label="最新采集时间" align="center" prop="latestCollectTime" :formatter="dateFormatter"
|
|
|
|
|
width="170px" />
|
|
|
|
|
<el-table-column label="顺序" align="center" prop="sort" width="80px">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
{{ scope.row.sort ?? '-' }}
|
|
|
|
|
@ -100,31 +69,17 @@
|
|
|
|
|
<el-table-column label="备注" align="center" prop="remark" min-width="160px" />
|
|
|
|
|
<el-table-column label="操作" align="center" width="150px" fixed="right">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<el-button
|
|
|
|
|
link
|
|
|
|
|
type="primary"
|
|
|
|
|
@click="openForm('update', scope.row.id)"
|
|
|
|
|
v-hasPermi="['iot:device:update']"
|
|
|
|
|
>
|
|
|
|
|
<el-button link type="primary" @click="openForm('update', scope.row.id)" v-hasPermi="['iot:device:update']">
|
|
|
|
|
编辑
|
|
|
|
|
</el-button>
|
|
|
|
|
<el-button
|
|
|
|
|
link
|
|
|
|
|
type="danger"
|
|
|
|
|
@click="handleDelete(scope.row.id)"
|
|
|
|
|
v-hasPermi="['iot:device:delete']"
|
|
|
|
|
>
|
|
|
|
|
<el-button link type="danger" @click="handleDelete(scope.row.id)" v-hasPermi="['iot:device:delete']">
|
|
|
|
|
删除
|
|
|
|
|
</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
|
|
|
|
<Pagination
|
|
|
|
|
:total="total"
|
|
|
|
|
v-model:page="queryParams.pageNo"
|
|
|
|
|
v-model:limit="queryParams.pageSize"
|
|
|
|
|
@pagination="getList"
|
|
|
|
|
/>
|
|
|
|
|
<Pagination :total="total" v-model:page="queryParams.pageNo" v-model:limit="queryParams.pageSize"
|
|
|
|
|
@pagination="getList" />
|
|
|
|
|
</ContentWrap>
|
|
|
|
|
|
|
|
|
|
<DeviceAttributeForm ref="formRef" @success="getList" />
|
|
|
|
|
@ -132,6 +87,7 @@
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
import { DICT_TYPE } from '@/utils/dict'
|
|
|
|
|
import { dateFormatter } from '@/utils/formatTime'
|
|
|
|
|
import download from '@/utils/download'
|
|
|
|
|
import { DeviceApi } from '@/api/iot/device'
|
|
|
|
|
import DeviceAttributeForm from './DeviceAttributeForm.vue'
|
|
|
|
|
import { DeviceAttributeTypeApi, DeviceAttributeTypeVO } from '@/api/iot/deviceattributetype'
|
|
|
|
|
@ -161,6 +117,8 @@ const queryParams = reactive({
|
|
|
|
|
|
|
|
|
|
const queryFormRef = ref()
|
|
|
|
|
|
|
|
|
|
const exportLoading = ref(false)
|
|
|
|
|
|
|
|
|
|
const selectedIds = ref<number[]>([])
|
|
|
|
|
const handleSelectionChange = (rows: any[]) => {
|
|
|
|
|
selectedIds.value = rows?.map((row) => row.id).filter((id) => id !== undefined) ?? []
|
|
|
|
|
@ -248,7 +206,7 @@ const handleDelete = async (ids: number | number[]) => {
|
|
|
|
|
tableRef.value?.clearSelection?.()
|
|
|
|
|
// 刷新列表
|
|
|
|
|
await getList()
|
|
|
|
|
} catch {}
|
|
|
|
|
} catch { }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const handleBatchDelete = async () => {
|
|
|
|
|
@ -259,6 +217,23 @@ const handleBatchDelete = async () => {
|
|
|
|
|
await handleDelete(selectedIds.value)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 导出按钮操作 */
|
|
|
|
|
const handleExport = async () => {
|
|
|
|
|
if (!selectedIds.value.length) {
|
|
|
|
|
message.error('请选择需要导出的数据')
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
await message.exportConfirm()
|
|
|
|
|
exportLoading.value = true
|
|
|
|
|
const data = await DeviceApi.exportDeviceAttribute({ ids: selectedIds.value.join(',') })
|
|
|
|
|
download.excel(data, '采集设备-点位管理.xls')
|
|
|
|
|
} catch {
|
|
|
|
|
} finally {
|
|
|
|
|
exportLoading.value = false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onMounted(async () => {
|
|
|
|
|
try {
|
|
|
|
|
const data = await DeviceAttributeTypeApi.getDeviceAttributeTypePage({ pageNo: 1, pageSize: 10 })
|
|
|
|
|
|