|
@@ -94,7 +94,8 @@
|
|
|
:stripe="true"
|
|
:stripe="true"
|
|
|
:show-overflow-tooltip="true"
|
|
:show-overflow-tooltip="true"
|
|
|
@sort-change="handleSortChange"
|
|
@sort-change="handleSortChange"
|
|
|
- height="45vh"
|
|
|
|
|
|
|
+ ref="tableRef"
|
|
|
|
|
+ :height="tableHeight"
|
|
|
>
|
|
>
|
|
|
<el-table-column :label="t('iotDevice.serial')" width="70" align="center">
|
|
<el-table-column :label="t('iotDevice.serial')" width="70" align="center">
|
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
@@ -237,6 +238,7 @@ import { useRefreshStore } from '@/store/modules/pms/refreshStore'
|
|
|
import Echart from '@/components/Echart/src/Echart.vue'
|
|
import Echart from '@/components/Echart/src/Echart.vue'
|
|
|
import echarts from '@/plugins/echarts'
|
|
import echarts from '@/plugins/echarts'
|
|
|
import { formatDate } from '@/utils/formatTime'
|
|
import { formatDate } from '@/utils/formatTime'
|
|
|
|
|
+import { nextTick } from 'vue'
|
|
|
|
|
|
|
|
/** 设备台账 列表 */
|
|
/** 设备台账 列表 */
|
|
|
defineOptions({ name: 'IotDevicePms' })
|
|
defineOptions({ name: 'IotDevicePms' })
|
|
@@ -309,7 +311,7 @@ const myoption = computed(() => {
|
|
|
axisLabel: { color: '#000', rotate: 50 }
|
|
axisLabel: { color: '#000', rotate: 50 }
|
|
|
},
|
|
},
|
|
|
yAxis: {
|
|
yAxis: {
|
|
|
- name: '分类top10',
|
|
|
|
|
|
|
+ name: '分类top',
|
|
|
type: 'value'
|
|
type: 'value'
|
|
|
},
|
|
},
|
|
|
series: [
|
|
series: [
|
|
@@ -339,6 +341,9 @@ const myoption = computed(() => {
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
|
|
+let tableRef = ref(null)
|
|
|
|
|
+let tableHeight = ref(450)
|
|
|
|
|
+
|
|
|
/** 查询列表 */
|
|
/** 查询列表 */
|
|
|
const getList = async () => {
|
|
const getList = async () => {
|
|
|
loading.value = true
|
|
loading.value = true
|
|
@@ -369,56 +374,11 @@ const handleQuery = () => {
|
|
|
queryParams.pageNo = 1
|
|
queryParams.pageNo = 1
|
|
|
getList()
|
|
getList()
|
|
|
}
|
|
}
|
|
|
-const moreQuery = (show) => {
|
|
|
|
|
- ifShow.value = show
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-const openForm = (type: string, id?: number, deptId?: number) => {
|
|
|
|
|
- //修改
|
|
|
|
|
- if (typeof id === 'number') {
|
|
|
|
|
- push({ name: 'DeviceDetailEdit', params: { type, id }, query: { source: 'devicerouter' } })
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
- // 新增
|
|
|
|
|
- if (deptId) {
|
|
|
|
|
- push({ name: 'DeviceDetailAdd', params: { type, deptId }, query: { source: 'devicerouter' } })
|
|
|
|
|
- } else {
|
|
|
|
|
- push({ name: 'DeviceDetailAddd', params: {}, query: { source: 'devicerouter' } })
|
|
|
|
|
- }
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-/** 删除按钮操作 */
|
|
|
|
|
-const handleDelete = async (id: number) => {
|
|
|
|
|
- try {
|
|
|
|
|
- // 删除的二次确认
|
|
|
|
|
- await message.delConfirm()
|
|
|
|
|
- // 发起删除
|
|
|
|
|
- await IotDeviceApi.deleteIotDevice(id)
|
|
|
|
|
- message.success(t('common.delSuccess'))
|
|
|
|
|
- // 刷新列表
|
|
|
|
|
- await getList()
|
|
|
|
|
- } catch {}
|
|
|
|
|
-}
|
|
|
|
|
|
|
|
|
|
const handleDetail = (id: number) => {
|
|
const handleDetail = (id: number) => {
|
|
|
push({ name: 'DeviceDetailInfo', params: { id } })
|
|
push({ name: 'DeviceDetailInfo', params: { id } })
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-/** 导出按钮操作 */
|
|
|
|
|
-const handleExport = async () => {
|
|
|
|
|
- try {
|
|
|
|
|
- // 导出的二次确认
|
|
|
|
|
- await message.exportConfirm()
|
|
|
|
|
- // 发起导出
|
|
|
|
|
- exportLoading.value = true
|
|
|
|
|
- const data = await IotDeviceApi.exportIotDevice(queryParams)
|
|
|
|
|
- download.excel(data, '设备台账.xls')
|
|
|
|
|
- } catch {
|
|
|
|
|
- } finally {
|
|
|
|
|
- exportLoading.value = false
|
|
|
|
|
- }
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
// 设备数量
|
|
// 设备数量
|
|
|
let devicesCount = ref(0)
|
|
let devicesCount = ref(0)
|
|
|
const deviceCountQueryParams = reactive({
|
|
const deviceCountQueryParams = reactive({
|
|
@@ -492,12 +452,31 @@ const getDeviceCount = async () => {
|
|
|
deviceStatus.value = await IotDeviceApi.getIotDeviceStatus(deviceCountQueryParams)
|
|
deviceStatus.value = await IotDeviceApi.getIotDeviceStatus(deviceCountQueryParams)
|
|
|
deviceClassify.value = await IotDeviceApi.getIotDeviceClassify(deviceCountQueryParams)
|
|
deviceClassify.value = await IotDeviceApi.getIotDeviceClassify(deviceCountQueryParams)
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+// 计算表格高度
|
|
|
|
|
+const calculateTableHeight = () => {
|
|
|
|
|
+ if (!tableRef.value) return
|
|
|
|
|
+ let h = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight
|
|
|
|
|
+ tableHeight.value = h - 460
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+// 防抖处理(防止频繁触发)
|
|
|
|
|
+const debounce = (fn, delay) => {
|
|
|
|
|
+ let timer
|
|
|
|
|
+ return (...args) => {
|
|
|
|
|
+ clearTimeout(timer)
|
|
|
|
|
+ timer = setTimeout(() => fn(...args), delay)
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
/** 初始化 **/
|
|
/** 初始化 **/
|
|
|
onMounted(async () => {
|
|
onMounted(async () => {
|
|
|
- getDeviceCount()
|
|
|
|
|
- // productClassifyList.value = handleTree(
|
|
|
|
|
- // await ProductClassifyApi.IotProductClassifyApi.getSimpleProductClassifyList()
|
|
|
|
|
- // )
|
|
|
|
|
|
|
+ nextTick(() => {
|
|
|
|
|
+ calculateTableHeight()
|
|
|
|
|
+ // 使用防抖避免频繁触发
|
|
|
|
|
+ const handleResize = debounce(calculateTableHeight, 150)
|
|
|
|
|
+ window.addEventListener('resize', handleResize)
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
const sort = {
|
|
const sort = {
|
|
|
field: 'sortColumn',
|
|
field: 'sortColumn',
|
|
|
order: 'asc'
|
|
order: 'asc'
|