You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
192 lines
5.1 KiB
Vue
192 lines
5.1 KiB
Vue
<template>
|
|
<ContentWrap>
|
|
<el-form
|
|
class="-mb-15px"
|
|
:model="queryParams"
|
|
ref="queryFormRef"
|
|
:inline="true"
|
|
label-width="80px"
|
|
>
|
|
<el-form-item label="产线编码" prop="lineNode">
|
|
<el-input
|
|
v-model="queryParams.lineNode"
|
|
placeholder="请输入产线编码"
|
|
clearable
|
|
@keyup.enter="handleQuery"
|
|
class="!w-240px"
|
|
/>
|
|
</el-form-item>
|
|
<el-form-item label="产线名称" prop="lineName">
|
|
<el-input
|
|
v-model="queryParams.lineName"
|
|
placeholder="请输入产线名称"
|
|
clearable
|
|
@keyup.enter="handleQuery"
|
|
class="!w-240px"
|
|
/>
|
|
</el-form-item>
|
|
<el-form-item label="设备编码" prop="deviceCode">
|
|
<el-input
|
|
v-model="queryParams.deviceCode"
|
|
placeholder="请输入设备编码"
|
|
clearable
|
|
@keyup.enter="handleQuery"
|
|
class="!w-240px"
|
|
/>
|
|
</el-form-item>
|
|
<el-form-item label="设备名称" prop="deviceName">
|
|
<el-input
|
|
v-model="queryParams.deviceName"
|
|
placeholder="请输入设备名称"
|
|
clearable
|
|
@keyup.enter="handleQuery"
|
|
class="!w-240px"
|
|
/>
|
|
</el-form-item>
|
|
<el-form-item>
|
|
<el-button @click="handleQuery">
|
|
<Icon icon="ep:search" class="mr-5px" /> 搜索
|
|
</el-button>
|
|
<el-button @click="resetQuery">
|
|
<Icon icon="ep:refresh" class="mr-5px" /> 重置
|
|
</el-button>
|
|
</el-form-item>
|
|
</el-form>
|
|
</ContentWrap>
|
|
|
|
<ContentWrap>
|
|
<el-table
|
|
v-loading="loading"
|
|
:data="list"
|
|
:stripe="true"
|
|
:show-overflow-tooltip="true"
|
|
row-key="id"
|
|
>
|
|
<el-table-column label="产线编码" align="left" prop="lineNode" min-width="140px" />
|
|
<el-table-column label="产线名称" align="left" prop="lineName" min-width="160px" />
|
|
<el-table-column label="设备编码" align="left" prop="deviceCode" min-width="140px" />
|
|
<el-table-column label="设备名称" align="left" prop="deviceName" min-width="160px" />
|
|
<el-table-column
|
|
label="采集时间"
|
|
align="center"
|
|
prop="collectionTime"
|
|
:formatter="dateFormatter"
|
|
width="180px"
|
|
/>
|
|
<el-table-column label="操作" align="center" fixed="right" width="150px">
|
|
<template #default="scope">
|
|
<el-button link type="primary" @click="handleSingleView(scope.row)">
|
|
历史记录
|
|
</el-button>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
<Pagination
|
|
:total="total"
|
|
v-model:page="queryParams.pageNo"
|
|
v-model:limit="queryParams.pageSize"
|
|
@pagination="getList"
|
|
/>
|
|
</ContentWrap>
|
|
|
|
<HistorySingleDeviceDialog
|
|
v-model="singleDialogVisible"
|
|
:device-id="singleDeviceId"
|
|
:device-name="singleDeviceName"
|
|
/>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { dateFormatter } from '@/utils/formatTime'
|
|
import { DeviceApi, LineDeviceVO, LineDevicePageParams } from '@/api/iot/device'
|
|
import HistorySingleDeviceDialog from './HistorySingleDeviceDialog.vue'
|
|
|
|
defineOptions({ name: 'HistoryData' })
|
|
|
|
const loading = ref(true)
|
|
const list = ref<LineDeviceVO[]>([])
|
|
const total = ref(0)
|
|
const queryParams = reactive({
|
|
pageNo: 1,
|
|
pageSize: 10,
|
|
id: undefined as string | number | undefined,
|
|
lineNode: undefined as string | undefined,
|
|
lineName: undefined as string | undefined,
|
|
deviceCode: undefined as string | undefined,
|
|
deviceName: undefined as string | undefined,
|
|
status: undefined as string | number | undefined
|
|
})
|
|
|
|
const queryFormRef = ref()
|
|
|
|
const singleDialogVisible = ref(false)
|
|
const singleDeviceId = ref<string | number>()
|
|
const singleDeviceName = ref<string>('')
|
|
|
|
const buildQueryParams = (): LineDevicePageParams => {
|
|
const params: LineDevicePageParams = {
|
|
pageNo: queryParams.pageNo,
|
|
pageSize: queryParams.pageSize
|
|
}
|
|
|
|
if (queryParams.lineNode) {
|
|
params.lineNode = queryParams.lineNode
|
|
}
|
|
if (queryParams.lineName) {
|
|
params.lineName = queryParams.lineName
|
|
}
|
|
if (queryParams.deviceCode) {
|
|
params.deviceCode = queryParams.deviceCode
|
|
}
|
|
if (queryParams.deviceName) {
|
|
params.deviceName = queryParams.deviceName
|
|
}
|
|
|
|
return params
|
|
}
|
|
|
|
const getList = async () => {
|
|
loading.value = true
|
|
try {
|
|
const data = await DeviceApi.getLineDevicePage(buildQueryParams())
|
|
list.value = data.list
|
|
total.value = data.total
|
|
} finally {
|
|
loading.value = false
|
|
}
|
|
}
|
|
|
|
const handleQuery = () => {
|
|
queryParams.pageNo = 1
|
|
getList()
|
|
}
|
|
|
|
const resetQuery = () => {
|
|
queryFormRef.value?.resetFields()
|
|
handleQuery()
|
|
}
|
|
|
|
const handleSingleView = (row: LineDeviceVO) => {
|
|
const deviceId = (row as any)?.deviceId ?? row?.id
|
|
if (deviceId === undefined || deviceId === null || deviceId === '') {
|
|
return
|
|
}
|
|
singleDeviceId.value = deviceId
|
|
singleDeviceName.value = row.deviceName || ''
|
|
singleDialogVisible.value = true
|
|
}
|
|
|
|
onMounted(() => {
|
|
getList()
|
|
})
|
|
|
|
const activatedOnce = ref(false)
|
|
onActivated(() => {
|
|
if (!activatedOnce.value) {
|
|
activatedOnce.value = true
|
|
return
|
|
}
|
|
getList()
|
|
})
|
|
</script>
|