|
|
|
|
@ -28,12 +28,23 @@ v-model="queryParams.deviceName" placeholder="请输入设备名称" clearable @
|
|
|
|
|
<el-button @click="resetQuery">
|
|
|
|
|
<Icon icon="ep:refresh" class="mr-5px" /> 重置
|
|
|
|
|
</el-button>
|
|
|
|
|
<el-button type="success" plain @click="handleExport" :loading="exportLoading">
|
|
|
|
|
<Icon icon="ep:download" 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
|
|
|
|
|
v-loading="loading"
|
|
|
|
|
:data="list"
|
|
|
|
|
:stripe="true"
|
|
|
|
|
:show-overflow-tooltip="true"
|
|
|
|
|
row-key="id"
|
|
|
|
|
@selection-change="handleSelectionChange"
|
|
|
|
|
>
|
|
|
|
|
<el-table-column type="selection" width="55" reserve-selection />
|
|
|
|
|
<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" />
|
|
|
|
|
@ -66,6 +77,7 @@ v-model="queryParams.deviceName" placeholder="请输入设备名称" clearable @
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
import { DICT_TYPE } from '@/utils/dict'
|
|
|
|
|
import { dateFormatter } from '@/utils/formatTime'
|
|
|
|
|
import download from '@/utils/download'
|
|
|
|
|
import { DeviceApi, LineDeviceVO } from '@/api/iot/device'
|
|
|
|
|
import SingleDeviceMonitorDialog from './SingleDeviceMonitorDialog.vue'
|
|
|
|
|
|
|
|
|
|
@ -76,6 +88,7 @@ const message = useMessage()
|
|
|
|
|
const loading = ref(true)
|
|
|
|
|
const list = ref<LineDeviceVO[]>([])
|
|
|
|
|
const total = ref(0)
|
|
|
|
|
const exportLoading = ref(false)
|
|
|
|
|
const queryParams = reactive({
|
|
|
|
|
pageNo: 1,
|
|
|
|
|
pageSize: 10,
|
|
|
|
|
@ -87,7 +100,15 @@ const queryParams = reactive({
|
|
|
|
|
status: undefined,
|
|
|
|
|
collectionTime: undefined
|
|
|
|
|
})
|
|
|
|
|
const queryFormRef = ref() // 搜索的表单
|
|
|
|
|
const queryFormRef = ref()
|
|
|
|
|
|
|
|
|
|
const selectedIds = ref<(string | number)[]>([])
|
|
|
|
|
const handleSelectionChange = (rows: LineDeviceVO[]) => {
|
|
|
|
|
selectedIds.value =
|
|
|
|
|
rows?.map((row) => ((row as any)?.id ?? (row as any)?.deviceId) as string | number).filter(
|
|
|
|
|
(id) => id !== undefined && id !== null && id !== ''
|
|
|
|
|
) ?? []
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const monitorDialogVisible = ref(false)
|
|
|
|
|
const monitorDeviceId = ref<string | number>()
|
|
|
|
|
@ -143,6 +164,22 @@ const handleSingleMonitor = (row: LineDeviceVO) => {
|
|
|
|
|
monitorDialogVisible.value = true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const handleExport = async () => {
|
|
|
|
|
try {
|
|
|
|
|
await message.exportConfirm()
|
|
|
|
|
exportLoading.value = true
|
|
|
|
|
const params: any = {
|
|
|
|
|
...buildQueryParams(),
|
|
|
|
|
ids: selectedIds.value.length ? selectedIds.value.join(',') : undefined
|
|
|
|
|
}
|
|
|
|
|
const data = await DeviceApi.exportLineDevice(params)
|
|
|
|
|
download.excel(data, '实时监控设备.xls')
|
|
|
|
|
} catch {
|
|
|
|
|
} finally {
|
|
|
|
|
exportLoading.value = false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
getList()
|
|
|
|
|
})
|
|
|
|
|
|