You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
240 lines
6.3 KiB
240 lines
6.3 KiB
8 months ago
|
<template>
|
||
|
<div class="device-info-wrap">
|
||
|
<EdfsWrap class="device-info-from-wrap">
|
||
|
<div class="from">
|
||
|
<div class="from-input">
|
||
|
<div class="from-row">
|
||
|
<div class="label">设备序列:</div>
|
||
|
<el-input
|
||
|
v-model="queryParams.number"
|
||
|
placeholder="请输入设备序列号"
|
||
|
clearable
|
||
|
@keyup.enter="handleQuery"
|
||
|
/>
|
||
|
</div>
|
||
|
<div class="from-row">
|
||
|
<div class="label">设备名称:</div>
|
||
|
<el-input
|
||
|
v-model="queryParams.deviceName"
|
||
|
placeholder="请输入设备名称"
|
||
|
clearable
|
||
|
@keyup.enter="handleQuery"
|
||
|
/>
|
||
|
</div>
|
||
|
|
||
|
<div class="from-row">
|
||
|
<div class="label">注册时段:</div>
|
||
|
<el-date-picker
|
||
|
v-model="queryParams.createTime"
|
||
|
value-format="YYYY-MM-DD HH:mm:ss"
|
||
|
type="datetimerange"
|
||
|
start-placeholder="开始时间"
|
||
|
end-placeholder="结束时间"
|
||
|
/>
|
||
|
</div>
|
||
|
<div class="from-row">
|
||
|
<div class="label">设备类别:</div>
|
||
|
<el-select v-model="queryParams.status" placeholder="" clearable>
|
||
|
<!-- <el-option
|
||
|
v-for="dict in getIntDictOptions(DICT_TYPE.COMMON_STATUS)"
|
||
|
:key="dict.value"
|
||
|
:label="dict.label"
|
||
|
:value="dict.value"
|
||
|
/> -->
|
||
|
</el-select>
|
||
|
</div>
|
||
|
|
||
|
<div class="btn-group">
|
||
|
<el-button @click="addDevice"><Icon icon="ep:plus" />添加设备</el-button>
|
||
|
|
||
|
<el-button @click="handleQuery"><Icon icon="ep:search" />搜索</el-button>
|
||
|
<el-button @click="resetQuery"><Icon icon="ep:refresh" />重置</el-button>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</EdfsWrap>
|
||
|
<EdfsWrap title="设备信息列表" class="device-info-table">
|
||
|
<EdfsTable
|
||
|
class="table"
|
||
|
v-loading="loading"
|
||
|
:data="list"
|
||
|
:highlight-current-row="true"
|
||
|
:page-total="total"
|
||
|
:current-page="queryParams.pageNo"
|
||
|
:page-size="queryParams.pageSize"
|
||
|
row-class-name="row"
|
||
|
@pageCurrentChange="handleJump"
|
||
|
>
|
||
|
<template v-for="(col, idx) in tableCol" :key="idx">
|
||
|
<el-table-column
|
||
|
v-if="col.prop.endsWith('Time')"
|
||
|
:label="col.label"
|
||
|
:min-width="col.minWidth"
|
||
|
>
|
||
|
<template #default="scope">
|
||
|
{{ dayjs(scope.row.createTime).format('YYYY-MM-DD HH:mm:ss') }}
|
||
|
</template>
|
||
|
</el-table-column>
|
||
|
<el-table-column
|
||
|
v-else
|
||
|
:prop="col.prop"
|
||
|
:label="col.label"
|
||
|
:min-width="col.minWidth"
|
||
|
/>
|
||
|
</template>
|
||
|
|
||
|
<el-table-column label="操作" width="190" align="center">
|
||
|
<template #default="scope">
|
||
|
<EdfsButton
|
||
|
link
|
||
|
type="primary"
|
||
|
inner-text="查看"
|
||
|
@click="onView"
|
||
|
/><el-divider direction="vertical" />
|
||
|
<EdfsButton
|
||
|
link
|
||
|
type="primary"
|
||
|
inner-text="编辑"
|
||
|
@click="addInfo(scope.row)"
|
||
|
/>
|
||
|
</template>
|
||
|
</el-table-column>
|
||
|
</EdfsTable>
|
||
|
</EdfsWrap>
|
||
|
</div>
|
||
|
</template>
|
||
|
|
||
|
<script setup lang="ts">
|
||
|
import dayjs from 'dayjs'
|
||
|
import EdfsWrap from '@/components/dashboard/Edfs-wrap.vue'
|
||
|
import EdfsTable from '@/components/dashboard/Edfs-table/index.vue'
|
||
|
import EdfsButton from '@/components/dashboard/Edfs-button/index.vue'
|
||
|
import { isResError } from '@/hooks/useMessage'
|
||
|
import { dateFormatter } from '@/utils/formatTime'
|
||
|
import type { TableColumnCtx } from 'element-plus'
|
||
|
import { useRouter } from 'vue-router'
|
||
|
import { getDevicePage, type IDevice } from '@/api/module/eam/device'
|
||
|
const tableCol = [
|
||
|
{ label: '设备名称', prop: 'name', minWidth: '10%' },
|
||
|
{ label: '设备类型', prop: 'categoryId', minWidth: '10%' },
|
||
|
{ label: '设备sn', prop: 'sn', minWidth: '10%' },
|
||
|
{ label: '设备编号', prop: 'serialNo', minWidth: '16%' },
|
||
|
{ label: '创建时间', prop: 'createTime', minWidth: '10%' },
|
||
|
]
|
||
|
|
||
|
|
||
|
const loading = ref(true)
|
||
|
const total = ref(0)
|
||
|
const list = ref<IDevice[]>([])
|
||
|
const queryParams = reactive({
|
||
|
pageNo: 1,
|
||
|
pageSize: 10,
|
||
|
number: undefined,
|
||
|
deviceName: undefined,
|
||
|
status: undefined,
|
||
|
code: undefined,
|
||
|
createTime: [],
|
||
|
})
|
||
|
|
||
|
const getList = async () => {
|
||
|
loading.value = true
|
||
|
|
||
|
const res = await getDevicePage(queryParams)
|
||
|
|
||
|
if (!isResError(res)) {
|
||
|
list.value = res.data.list
|
||
|
total.value = res.data.total
|
||
|
}
|
||
|
|
||
|
loading.value = false
|
||
|
}
|
||
|
|
||
|
const handleQuery = () => {
|
||
|
queryParams.pageNo = 1
|
||
|
getList()
|
||
|
}
|
||
|
function handleJump(page: number) {
|
||
|
queryParams.pageNo = page
|
||
|
getList()
|
||
|
}
|
||
|
|
||
|
function resetQuery() {
|
||
|
queryParams.number = undefined
|
||
|
queryParams.deviceName = undefined
|
||
|
queryParams.status = undefined
|
||
|
queryParams.code = undefined
|
||
|
queryParams.createTime = []
|
||
|
handleQuery()
|
||
|
}
|
||
|
|
||
|
interface SpanMethodProps {
|
||
|
row: any
|
||
|
column: TableColumnCtx<any>
|
||
|
rowIndex: number
|
||
|
columnIndex: number
|
||
|
}
|
||
|
|
||
|
const formRef = ref()
|
||
|
const openForm = (type: string, id?: number) => {}
|
||
|
onMounted(() => {
|
||
|
getList()
|
||
|
})
|
||
|
|
||
|
const router = useRouter()
|
||
|
|
||
|
function addInfo(row: any) {
|
||
|
router.push({ path: '/user/deviceInfo', query: { type: 'edit' } })
|
||
|
}
|
||
|
function addDevice() {
|
||
|
router.push({ path: '/user/deviceInfo', query: { type: 'add' } })
|
||
|
}
|
||
|
function onView() {
|
||
|
router.push({ path: '/user/deviceInfo', query: { type: 'view' } })
|
||
|
}
|
||
|
</script>
|
||
|
|
||
|
<style lang="scss" scoped>
|
||
|
.device-info-wrap {
|
||
|
width: 100%;
|
||
|
height: 100%;
|
||
|
display: flex;
|
||
|
flex-direction: column;
|
||
|
row-gap: 10px;
|
||
|
.device-info-from-wrap {
|
||
|
height: auto;
|
||
|
width: 100%;
|
||
|
.from {
|
||
|
display: flex;
|
||
|
flex-direction: column;
|
||
|
justify-content: space-around;
|
||
|
height: 100%;
|
||
|
width: 100%;
|
||
|
.from-input {
|
||
|
display: flex;
|
||
|
width: 100%;
|
||
|
column-gap: 20px;
|
||
|
row-gap: 10px;
|
||
|
flex-wrap: wrap;
|
||
|
.from-row {
|
||
|
min-width: 270px;
|
||
|
display: flex;
|
||
|
align-items: center;
|
||
|
column-gap: 4px;
|
||
|
.label {
|
||
|
white-space: nowrap;
|
||
|
width: 70px;
|
||
|
color: var(--label-text);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
.device-info-table {
|
||
|
flex: 1;
|
||
|
.table {
|
||
|
height: 100%;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
</style>
|