10/10
1. 设备管理界面完成 2. 用户管理界面完成 3. 会话列表完成
This commit is contained in:
@@ -2,11 +2,6 @@
|
||||
<div class="p-2 page-shell system-device-page">
|
||||
<div class="search-wrap">
|
||||
<el-card :class="{ 'is-collapsed': !showSearch }" class="search-panel" shadow="hover">
|
||||
<template #header>
|
||||
<div class="panel-heading search-panel-toggle" @click.stop="showSearch = !showSearch">
|
||||
<div><h3>筛选条件</h3></div>
|
||||
</div>
|
||||
</template>
|
||||
<el-form ref="queryFormRef" :inline="true" :model="queryParams" class="query-form" label-position="top">
|
||||
<el-form-item label="设备名称" prop="name">
|
||||
<el-input v-model="queryParams.name" clearable placeholder="请输入设备名称" size="large"
|
||||
@@ -37,11 +32,11 @@
|
||||
<div class="table-heading">
|
||||
<el-button type="primary">
|
||||
<span style="margin:0 8px;color: #fff;">全部</span>
|
||||
<span style="color: #fff;font-weight: bold">1286</span>
|
||||
<span style="color: #fff;font-weight: bold">{{ total }}</span>
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="toolbar-actions">
|
||||
<el-button v-hasPermi="['system:device:export']" plain size="large" type="info" @click="handleExport">
|
||||
<el-button v-hasPermi="['device:device:export']" plain size="large" type="info" @click="handleExport">
|
||||
批量导出
|
||||
</el-button>
|
||||
<right-toolbar v-model:show-search="showSearch" :search="false" @query-table="getList"></right-toolbar>
|
||||
@@ -54,63 +49,62 @@
|
||||
<el-table-column align="center" type="selection" width="55"/>
|
||||
<el-table-column align="center" label="设备名称" prop="name"/>
|
||||
<el-table-column align="center" label="产品型号" prop="model"/>
|
||||
<el-table-column align="center" label="所在房间" prop="homeId"/>
|
||||
<el-table-column align="center" label="在线状态" prop="status">
|
||||
<template #default>
|
||||
<el-tag type="success">在线</el-tag>
|
||||
<el-tag type="danger">离线</el-tag>
|
||||
<el-table-column align="center" label="所在房间" prop="homeName"/>
|
||||
<el-table-column align="center" label="在线状态" prop="status" width="100">
|
||||
<template #default="scope">
|
||||
<el-tag v-if="scope.row.status === '0'" type="success">在线</el-tag>
|
||||
<el-tag v-else type="danger">离线</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="当前TVOC" prop="tvoc">
|
||||
<template #default="scope">
|
||||
<div>
|
||||
<div class="flex flex-items-center justify-center">
|
||||
<div>{{ scope.row.tvoc ?? '--' }}</div>
|
||||
<div>
|
||||
<el-tag v-if="scope.row.airLevel == '0'" type="primary">优</el-tag>
|
||||
<el-tag v-else-if="scope.row.airLevel == '1'" type="success">良</el-tag>
|
||||
<el-tag v-else-if="scope.row.airLevel == '2'" type="warning">差</el-tag>
|
||||
<el-tag v-else-if="scope.row.airLevel == '3'" type="danger">污染</el-tag>
|
||||
<el-tag v-else type="info">--</el-tag>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="滤芯寿命" prop="fwVersion">
|
||||
<el-table-column align="center" label="滤芯寿命" prop="filterLife" width="100">
|
||||
<template #default="scope">
|
||||
<span :class="{
|
||||
lowLife: scope.row.filterLife < 50
|
||||
}" class="defaultLife">{{ scope.row.filterLife }}</span>
|
||||
}" class="defaultLife">{{ scope.row.filterLife }}%</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="电池电量" prop="deviceBattery">
|
||||
<el-table-column align="center" label="电池电量" prop="deviceBattery" width="100">
|
||||
<template #default="scope">
|
||||
<span :class="{
|
||||
lowBattery: scope.row.filterLife < 50
|
||||
}" class="defaultLife">{{ scope.row.filterLife }}</span>
|
||||
}" class="defaultLife">{{ scope.row.filterLife }}%</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="运行模式" prop="runMode">
|
||||
<el-table-column align="center" label="运行模式" prop="runMode" width="100">
|
||||
<template #default="scope">
|
||||
<span v-if="scope.row.runMode == '2'" style="color: rgba(17, 24, 39, 1);">桌面模式</span>
|
||||
<span v-else-if="scope.row.runMode == '1'" style="color: rgba(17, 24, 39, 1);">车载模式</span>
|
||||
<span v-else style="color: rgba(17, 24, 39, 1);">自动</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="风速挡位" prop="mac">
|
||||
<el-table-column align="center" label="风速挡位" prop="mac" width="100">
|
||||
<template #default="scope">
|
||||
<span v-if="scope.row.fanLevel == '1'" style="color: rgba(17, 24, 39, 1);">强力</span>
|
||||
<span v-else-if="scope.row.fanLevel == '2'" style="color: rgba(17, 24, 39, 1);">低档</span>
|
||||
<span v-else style="color: rgba(17, 24, 39, 1);">标准</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="创建时间" prop="wifiSsid"/>
|
||||
<el-table-column align="center" class-name="small-padding fixed-width" label="操作">
|
||||
<el-table-column align="center" label="创建时间" prop="createTime"/>
|
||||
<el-table-column align="center" class-name="small-padding fixed-width" label="操作" min-width="100">
|
||||
<template #default="scope">
|
||||
<el-button v-hasPermi="['system:device:edit']" plain type="primary"
|
||||
<el-button v-hasPermi="['device:device:query']" plain type="primary"
|
||||
@click="handleUpdate(scope.row)">查看详情
|
||||
</el-button>
|
||||
<el-button v-hasPermi="['system:device:remove']" plain type="info"
|
||||
@click="handleDelete(scope.row)">编辑
|
||||
<el-button v-hasPermi="['device:device:edit']" plain type="info"
|
||||
@click="handleEdit(scope.row)">编辑
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -129,7 +123,6 @@ import {
|
||||
} from '@/api/system/device';
|
||||
import {DeviceForm, DeviceQuery, DeviceVO} from '@/api/system/device/types';
|
||||
import {useLoading} from '@/hooks/async/useLoading';
|
||||
import {useFormDialog} from '@/hooks/dialog/useFormDialog';
|
||||
import {useDateRangeQuery} from '@/hooks/form/useDateRangeQuery';
|
||||
import {useSearchReset} from '@/hooks/form/useSearchReset';
|
||||
import {useSearchToggle} from '@/hooks/form/useSearchToggle';
|
||||
@@ -165,7 +158,6 @@ const {
|
||||
} = useDateRangeQuery('UpdateTime');
|
||||
|
||||
const queryFormRef = ref<ElFormInstance>();
|
||||
const deviceFormRef = ref<ElFormInstance>();
|
||||
|
||||
const initFormData: DeviceForm = {
|
||||
deviceId: undefined,
|
||||
@@ -268,13 +260,9 @@ const data = reactive<PageData<DeviceForm, DeviceQuery>>({
|
||||
}
|
||||
});
|
||||
|
||||
const {queryParams, form} = toRefs(data);
|
||||
const {queryParams,} = toRefs(data);
|
||||
const {ids, handleSelectionChange} = useTableSelection<DeviceVO>(item => item.deviceId);
|
||||
useFormDialog({
|
||||
form,
|
||||
formRef: deviceFormRef,
|
||||
initialFormData: initFormData
|
||||
});
|
||||
|
||||
|
||||
/** 查询设备主列表 */
|
||||
const getList = async () => {
|
||||
@@ -326,6 +314,15 @@ function handleUpdate(row: Partial<DeviceVO>) {
|
||||
})
|
||||
}
|
||||
|
||||
function handleEdit(row: Partial<DeviceVO>) {
|
||||
router.push({
|
||||
path: '/device/deviceEdit',
|
||||
query: {
|
||||
id: row.deviceId,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (row?: Partial<DeviceVO>) => {
|
||||
const _deviceIds = row?.deviceId || ids.value;
|
||||
@@ -338,11 +335,11 @@ const handleDelete = async (row?: Partial<DeviceVO>) => {
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = () => {
|
||||
requestDownload(
|
||||
'system/device/export',
|
||||
'/device/device/export',
|
||||
{
|
||||
...queryParams.value
|
||||
},
|
||||
`device_${new Date().getTime()}.xlsx`
|
||||
`设备管理_${new Date().getTime()}.xlsx`
|
||||
);
|
||||
};
|
||||
onMounted(() => {
|
||||
@@ -352,6 +349,11 @@ onMounted(() => {
|
||||
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
.search-wrap {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.defaultLife {
|
||||
color: gray;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user