141 lines
3.1 KiB
Vue
141 lines
3.1 KiB
Vue
<template>
|
|
<div class="app-container">
|
|
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
|
<el-form-item label="设备类型" prop="type">
|
|
<el-radio-group type="button" v-model="queryParams.type" @change="handleQuery">
|
|
<el-radio-button :label="undefined">全部</el-radio-button>
|
|
<el-radio-button v-for="dict in device_type" :key="dict.value" :label="dict.value">{{ dict.label }}</el-radio-button>
|
|
</el-radio-group>
|
|
</el-form-item>
|
|
</el-form>
|
|
|
|
<div style="display: flex;">
|
|
<div class="card" @click="handleVideoCameraFilled(item)" v-for="item in deviceList" :key="item.deviceId">
|
|
<div class="card-image"></div>
|
|
<div class="category"><dict-tag :options="device_type" :value="item.type"/></div>
|
|
<div class="heading">
|
|
{{ item.ip }}
|
|
<!-- <div class="author"> By <span class="name">Abi</span> 4 days ago</div> -->
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"
|
|
v-model:limit="queryParams.pageSize" @pagination="getList" />
|
|
</div>
|
|
</template>
|
|
|
|
<script setup name="Device">
|
|
import router from '@/router'
|
|
import { listDevice } from "@/api/video/device";
|
|
|
|
const { proxy } = getCurrentInstance();
|
|
const { device_on_status, device_type } = proxy.useDict('device_on_status', 'device_type');
|
|
|
|
const deviceList = ref([]);
|
|
const loading = ref(true);
|
|
const showSearch = ref(true);
|
|
const ids = ref([]);
|
|
const single = ref(true);
|
|
const multiple = ref(true);
|
|
const total = ref(0);
|
|
|
|
const data = reactive({
|
|
queryParams: {
|
|
pageNum: 1,
|
|
pageSize: 20,
|
|
type: undefined,
|
|
},
|
|
});
|
|
|
|
const { queryParams } = toRefs(data);
|
|
|
|
const handleVideoCameraFilled = (row) => {
|
|
router.push({ path: "/video/flv", query: { deviceId: row.deviceId } });
|
|
}
|
|
|
|
/** 查询设备列表 */
|
|
function getList() {
|
|
loading.value = true;
|
|
listDevice(queryParams.value).then(response => {
|
|
deviceList.value = response.rows;
|
|
total.value = response.total;
|
|
loading.value = false;
|
|
});
|
|
}
|
|
|
|
/** 搜索按钮操作 */
|
|
function handleQuery() {
|
|
queryParams.value.pageNum = 1;
|
|
getList();
|
|
}
|
|
|
|
// 多选框选中数据
|
|
function handleSelectionChange(selection) {
|
|
ids.value = selection.map(item => item.deviceId);
|
|
single.value = selection.length != 1;
|
|
multiple.value = !selection.length;
|
|
}
|
|
|
|
getList();
|
|
</script>
|
|
|
|
<style scoped>
|
|
/* From Uiverse.io by alexmaracinaru */
|
|
.card {
|
|
width: 190px;
|
|
background: white;
|
|
padding: .4em;
|
|
border-radius: 6px;
|
|
}
|
|
|
|
.card-image {
|
|
background-color: rgb(236, 236, 236);
|
|
width: 100%;
|
|
height: 130px;
|
|
border-radius: 6px 6px 0 0;
|
|
}
|
|
|
|
.card-image:hover {
|
|
transform: scale(0.98);
|
|
}
|
|
|
|
.category {
|
|
text-transform: uppercase;
|
|
font-size: 0.7em;
|
|
font-weight: 600;
|
|
color: rgb(63, 121, 230);
|
|
padding: 10px 7px 0;
|
|
}
|
|
|
|
.category:hover {
|
|
cursor: pointer;
|
|
}
|
|
|
|
.heading {
|
|
font-weight: 600;
|
|
color: rgb(88, 87, 87);
|
|
padding: 7px;
|
|
}
|
|
|
|
.heading:hover {
|
|
cursor: pointer;
|
|
}
|
|
|
|
.author {
|
|
color: gray;
|
|
font-weight: 400;
|
|
font-size: 11px;
|
|
padding-top: 20px;
|
|
}
|
|
|
|
.name {
|
|
font-weight: 600;
|
|
}
|
|
|
|
.name:hover {
|
|
cursor: pointer;
|
|
}
|
|
</style>
|