更新
This commit is contained in:
9
src/api/equipment/gateway.js
Normal file
9
src/api/equipment/gateway.js
Normal file
@@ -0,0 +1,9 @@
|
||||
import service from '@/utils/request'
|
||||
|
||||
export const getDeviceGatewayListByPage = (data) => {
|
||||
return service({
|
||||
url: '/device/getDeviceGatewayListByPage',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
@@ -1,8 +1,16 @@
|
||||
import service from '@/utils/request'
|
||||
|
||||
export const resetPassword = (data) => {
|
||||
export const getDeviceListByPage = (data) => {
|
||||
return service({
|
||||
url: '/user/resetPassword',
|
||||
url: '/device/getDeviceListByPage',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
export const deviceOperation = (data) => {
|
||||
return service({
|
||||
url: '/device/deviceOperation',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
未经授权的商用使用可能会被我们的资产搜索引擎爬取,并可能导致后续索赔。索赔金额将不低于高级授权费的十倍。请您遵守版权法律法规,尊重知识产权。
|
||||
-->
|
||||
<template>
|
||||
<div
|
||||
<!-- <div
|
||||
class="flex flex-col md:flex-row gap-2 items-center text-sm text-slate-700 dark:text-slate-500 justify-center py-2"
|
||||
>
|
||||
<div class="text-center">
|
||||
@@ -27,7 +27,7 @@
|
||||
>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
|
||||
@@ -11,7 +11,8 @@
|
||||
"/src/view/dashboard/components/table.vue": "Table",
|
||||
"/src/view/dashboard/components/wiki.vue": "Wiki",
|
||||
"/src/view/dashboard/index.vue": "Dashboard",
|
||||
"/src/view/equipment/list/index.vue": "User",
|
||||
"/src/view/equipment/gateway/index.vue": "Index",
|
||||
"/src/view/equipment/list/index.vue": "Index",
|
||||
"/src/view/error/index.vue": "Error",
|
||||
"/src/view/error/reload.vue": "Reload",
|
||||
"/src/view/example/breakpoint/breakpoint.vue": "BreakPoint",
|
||||
|
||||
@@ -9,35 +9,31 @@
|
||||
<div>
|
||||
<div class="w-full flex items-center justify-center">
|
||||
<a href="https://github.com/flipped-aurora/gin-vue-admin">
|
||||
<img
|
||||
class="org-img dom-center"
|
||||
src="@/assets/logo.png"
|
||||
alt="gin-vue-admin"
|
||||
/>
|
||||
</a>
|
||||
<img class="org-img dom-center" src="@/assets/logo.png" alt="gin-vue-admin" />
|
||||
</a>
|
||||
</div>
|
||||
<div class="w-full flex items-center justify-around">
|
||||
<a href="https://github.com/flipped-aurora/gin-vue-admin">
|
||||
<img
|
||||
class="dom-center"
|
||||
src="https://img.shields.io/github/watchers/flipped-aurora/gin-vue-admin.svg?label=Watch"
|
||||
alt=""
|
||||
/>
|
||||
</a>
|
||||
<a href="https://github.com/flipped-aurora/gin-vue-admin">
|
||||
<img
|
||||
class="dom-center"
|
||||
src="https://img.shields.io/github/stars/flipped-aurora/gin-vue-admin.svg?style=social"
|
||||
alt=""
|
||||
/>
|
||||
</a>
|
||||
<a href="https://github.com/flipped-aurora/gin-vue-admin">
|
||||
<img
|
||||
class="dom-center"
|
||||
src="https://img.shields.io/github/forks/flipped-aurora/gin-vue-admin.svg?label=Fork"
|
||||
alt=""
|
||||
/>
|
||||
</a>
|
||||
<img
|
||||
class="dom-center"
|
||||
src="https://img.shields.io/github/watchers/flipped-aurora/gin-vue-admin.svg?label=Watch"
|
||||
alt=""
|
||||
/>
|
||||
</a>
|
||||
<a href="https://github.com/flipped-aurora/gin-vue-admin">
|
||||
<img
|
||||
class="dom-center"
|
||||
src="https://img.shields.io/github/stars/flipped-aurora/gin-vue-admin.svg?style=social"
|
||||
alt=""
|
||||
/>
|
||||
</a>
|
||||
<a href="https://github.com/flipped-aurora/gin-vue-admin">
|
||||
<img
|
||||
class="dom-center"
|
||||
src="https://img.shields.io/github/forks/flipped-aurora/gin-vue-admin.svg?label=Fork"
|
||||
alt=""
|
||||
/>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
@@ -47,22 +43,15 @@
|
||||
</template>
|
||||
<div>
|
||||
<div class="w-full flex items-center justify-center">
|
||||
<a href="https://github.com/flipped-aurora">
|
||||
<img
|
||||
class="org-img dom-center"
|
||||
src="@/assets/flipped-aurora.png"
|
||||
alt="flipped-aurora"
|
||||
/>
|
||||
</a>
|
||||
</div>
|
||||
<a href="https://github.com/flipped-aurora">
|
||||
<img class="org-img dom-center" src="@/assets/flipped-aurora.png" alt="flipped-aurora" />
|
||||
</a>
|
||||
</div>
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4 gap-4 mt-4">
|
||||
<div v-for="(item, index) in members" :key="index" class="min-h-10 flex items-center">
|
||||
<a :href="item.html_url" class="flex items-center group">
|
||||
<img class="w-8 h-8 rounded-full" :src="item.avatar_url" />
|
||||
<el-link
|
||||
class="text-blue-700 ml-2 text-lg font-bold font-sans break-all"
|
||||
>{{ item.login }}</el-link
|
||||
>
|
||||
<el-link class="text-blue-700 ml-2 text-lg font-bold font-sans break-all">{{ item.login }}</el-link>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
@@ -89,11 +78,9 @@
|
||||
</el-timeline-item>
|
||||
</el-timeline>
|
||||
</div>
|
||||
<div class="w-full flex items-center justify-center">
|
||||
<el-button class="load-more" type="primary" link @click="loadMore">
|
||||
Load more
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="w-full flex items-center justify-center">
|
||||
<el-button class="load-more" type="primary" link @click="loadMore"> Load more </el-button>
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
121
src/view/equipment/gateway/index.vue
Normal file
121
src/view/equipment/gateway/index.vue
Normal 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>
|
||||
@@ -4,10 +4,10 @@
|
||||
<div class="gva-search-box">
|
||||
<el-form ref="searchForm" :inline="true" :model="searchInfo">
|
||||
<el-form-item label="用户名">
|
||||
<el-input v-model="searchInfo.username" placeholder="用户名" />
|
||||
<el-input v-model="searchInfo.username" placeholder="设备ID" />
|
||||
</el-form-item>
|
||||
<el-form-item label="昵称">
|
||||
<el-input v-model="searchInfo.nickname" placeholder="昵称" />
|
||||
<el-input v-model="searchInfo.nickname" placeholder="设备状态" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
@@ -21,21 +21,37 @@
|
||||
<el-button type="primary" icon="plus" @click="addUser">新增用户</el-button>
|
||||
</div>
|
||||
<el-table :data="tableData" row-key="ID">
|
||||
<el-table-column align="left" label="头像" min-width="75">
|
||||
<!-- <el-table-column align="left" label="设备图片" min-width="75">
|
||||
<template #default="scope">
|
||||
<CustomPic style="margin-top: 8px" :pic-src="scope.row.headerImg" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="left" label="ID" min-width="50" prop="ID" />
|
||||
<el-table-column align="left" label="用户名" min-width="150" prop="userName" />
|
||||
<el-table-column align="left" label="昵称" min-width="150" prop="nickName" />
|
||||
<el-table-column align="left" label="手机号" min-width="180" prop="phone" />
|
||||
<el-table-column align="left" label="邮箱" min-width="180" prop="email" />
|
||||
|
||||
<el-table-column label="操作" :min-width="appStore.operateMinWith" fixed="right">
|
||||
</el-table-column> -->
|
||||
<el-table-column align="left" label="设备ID" prop="cbId" />
|
||||
<el-table-column align="left" label="项目ID" prop="projectId" />
|
||||
<el-table-column align="left" label="网关ID" prop="gatewayId" />
|
||||
<el-table-column align="left" label="设备状态">
|
||||
<template #default="scope">
|
||||
<el-button type="primary" link icon="delete" @click="deleteUserFunc(scope.row)">删除</el-button>
|
||||
<el-button type="primary" link icon="edit" @click="openEdit(scope.row)">编辑</el-button>
|
||||
<el-tag :type="scope.row.deviceStatus == 1 ? 'success' : 'danger'">{{
|
||||
scope.row.deviceStatus == 1 ? '合闸' : '分闸'
|
||||
}}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="left" label="网络">
|
||||
<template #default="scope">
|
||||
<el-tag :type="scope.row.netStatus == 1 ? 'primary' : 'info'">{{
|
||||
scope.row.netStatus == 1 ? '在线' : '离线'
|
||||
}}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="left" label="设备类型名称" prop="cbTypeName" />
|
||||
<el-table-column align="left" label="网关mac" prop="gatewayMac" />
|
||||
<el-table-column align="left" label="创建时间" prop="createTime" />
|
||||
|
||||
<el-table-column label="操作" fixed="right">
|
||||
<template #default="scope">
|
||||
<el-link underline="never" type="primary" @click="changeStatus(scope.row)">合分闸</el-link>
|
||||
<!-- <el-button type="primary" link icon="delete" @click="deleteUserFunc(scope.row)">删除</el-button> -->
|
||||
<!-- <el-button type="primary" link icon="edit" @click="openEdit(scope.row)">编辑</el-button> -->
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -55,22 +71,13 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { getUserList, setUserAuthorities, register, deleteUser } from '@/api/user'
|
||||
import * as serve from '@/api/equipment/list'
|
||||
|
||||
import { getAuthorityList } from '@/api/authority'
|
||||
import CustomPic from '@/components/customPic/index.vue'
|
||||
import WarningBar from '@/components/warningBar/warningBar.vue'
|
||||
import { setUserInfo, resetPassword } from '@/api/user.js'
|
||||
|
||||
import { nextTick, ref, watch } from 'vue'
|
||||
import { nextTick, ref, watch, onMounted } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import SelectImage from '@/components/selectImage/selectImage.vue'
|
||||
// import { id } from 'element-plus/es/locale'
|
||||
import { useAppStore } from '@/pinia'
|
||||
|
||||
defineOptions({
|
||||
name: 'User'
|
||||
})
|
||||
|
||||
const appStore = useAppStore()
|
||||
|
||||
const searchInfo = ref({
|
||||
@@ -80,6 +87,58 @@
|
||||
email: ''
|
||||
})
|
||||
|
||||
const page = ref(1)
|
||||
const total = ref(0)
|
||||
const pageSize = ref(10)
|
||||
const tableData = ref([])
|
||||
|
||||
onMounted(() => {
|
||||
getTableData()
|
||||
})
|
||||
|
||||
// 合分闸
|
||||
const changeStatus = (row) => {
|
||||
ElMessageBox.confirm(row.deviceStatus == 1 ? '确认合闸吗?' : '确认分闸吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(async () => {
|
||||
const res = await serve.deviceOperation({
|
||||
id: row.ID,
|
||||
gatewayId: row.gatewayId,
|
||||
para: row.deviceStatus == 1 ? '0xA2' : '0xA1'
|
||||
})
|
||||
if (res.code === 0) {
|
||||
ElMessage.success('操作成功')
|
||||
getTableData()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 分页
|
||||
const handleSizeChange = (val) => {
|
||||
pageSize.value = val
|
||||
getTableData()
|
||||
}
|
||||
const handleCurrentChange = (val) => {
|
||||
page.value = val
|
||||
getTableData()
|
||||
}
|
||||
// 查询
|
||||
const getTableData = async () => {
|
||||
const table = await serve.getDeviceListByPage({
|
||||
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()
|
||||
|
||||
Reference in New Issue
Block a user