34 lines
982 B
JavaScript
34 lines
982 B
JavaScript
/**
|
|
* base_device 页面操作列扩展
|
|
* 在 onInit 中动态注入自定义操作列,按 DeviceGroup 渲染对应按钮组件
|
|
* 对话框由各按钮组件内部自行管理
|
|
*/
|
|
import { h } from 'vue'
|
|
import VideoDeviceActions from '@/views/warehouse/device_manager/base_device/components/VideoDeviceActions.vue'
|
|
import IoTDeviceActions from '@/views/warehouse/device_manager/base_device/components/IoTDeviceActions.vue'
|
|
|
|
const actionMap = {
|
|
'视频设备': VideoDeviceActions,
|
|
'IoT设备': IoTDeviceActions,
|
|
}
|
|
|
|
export default {
|
|
onInit() {
|
|
const gcol = this.columns.find(c => c.field === 'DeviceGroup')
|
|
if (gcol) gcol.hidden = false
|
|
this.columns.splice(0, 0, {
|
|
field: '_actions',
|
|
title: '操作',
|
|
type: 'string',
|
|
width: 300,
|
|
fixed: 'right',
|
|
align: 'left',
|
|
render: (h, { row }) => {
|
|
const comp = actionMap[row.DeviceGroup]
|
|
if (!comp) return null
|
|
return h(comp, { row })
|
|
}
|
|
})
|
|
}
|
|
}
|