更新
This commit is contained in:
@@ -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