This commit is contained in:
xiaozhiyong
2026-05-25 10:18:54 +08:00
parent 4d39de6299
commit 4c5456bbcf
7 changed files with 258 additions and 73 deletions

View File

@@ -0,0 +1,121 @@
<template>
<div>
<!-- <warning-bar title="注:右上角头像下拉可切换角色" /> -->
<div class="gva-search-box">
<el-form ref="searchForm" :inline="true" :model="searchInfo">
<el-form-item label="用户名">
<el-input v-model="searchInfo.username" placeholder="设备ID" />
</el-form-item>
<el-form-item label="昵称">
<el-input v-model="searchInfo.nickname" placeholder="设备状态" />
</el-form-item>
<el-form-item>
<el-button type="primary" icon="search" @click="onSubmit"> 查询 </el-button>
<el-button icon="refresh" @click="onReset"> 重置 </el-button>
</el-form-item>
</el-form>
</div>
<div class="gva-table-box">
<div class="gva-btn-list">
<el-button type="primary" icon="plus" @click="addUser">新增用户</el-button>
</div>
<el-table :data="tableData">
<el-table-column align="left" label="网关ID" prop="gatewayId" width="200" />
<el-table-column align="left" label="设备号" prop="imei" width="200" />
<el-table-column align="left" label="网关mac" prop="gatewayMac" width="200" />
<el-table-column align="left" label="网关地址" prop="gatewayAddress" />
<el-table-column align="left" label="经纬度" width="250">
<template #default="scope">
<span>{{ scope.row.gatewayLong }}</span>
<el-divider direction="vertical" />
<span>{{ scope.row.gatewayLat }}</span>
</template>
</el-table-column>
</el-table>
<div class="gva-pagination">
<el-pagination
:current-page="page"
:page-size="pageSize"
:page-sizes="[10, 30, 50, 100]"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@current-change="handleCurrentChange"
@size-change="handleSizeChange"
/>
</div>
</div>
</div>
</template>
<script setup>
import * as serve from '@/api/equipment/gateway'
import { nextTick, ref, watch, onMounted } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
// import { id } from 'element-plus/es/locale'
import { useAppStore } from '@/pinia'
const appStore = useAppStore()
const searchInfo = ref({
username: '',
nickname: '',
phone: '',
email: ''
})
const page = ref(1)
const total = ref(0)
const pageSize = ref(10)
const tableData = ref([])
onMounted(() => {
getTableData()
})
// 分页
const handleSizeChange = (val) => {
pageSize.value = val
getTableData()
}
const handleCurrentChange = (val) => {
page.value = val
getTableData()
}
// 查询
const getTableData = async () => {
const table = await serve.getDeviceGatewayListByPage({
page: page.value,
pageSize: pageSize.value,
...searchInfo.value
})
if (table.code === 0) {
tableData.value = table.data.list
total.value = table.data.total
page.value = table.data.page
pageSize.value = table.data.pageSize
}
}
const onSubmit = () => {
page.value = 1
getTableData()
}
const onReset = () => {
searchInfo.value = {
username: '',
nickname: '',
phone: '',
email: ''
}
getTableData()
}
</script>
<style lang="scss">
.header-img-box {
@apply w-52 h-52 border border-solid border-gray-300 rounded-xl flex justify-center items-center cursor-pointer;
}
</style>