V4修复: 操作按钮改用JSX语法(el-button而非h函数)

This commit is contained in:
2026-05-17 14:18:31 +08:00
parent cce032fe91
commit f04a92db02

View File

@@ -140,26 +140,38 @@
// 自定义操作列
columns.push({
title: '操作', field: '_actions', width: 300, align: 'left', fixed: 'right',
render: (_h, { row }) => {
render: (h, { row, column, index }) => {
if (row.DeviceGroup === '视频设备') {
return _h('div', [
h('el-button', { size: 'small', type: 'primary',
onClick: () => openPreview(row)
}, { default: () => '预览' }),
h('el-button', { size: 'small',
onClick: () => { curDev.value = row; ptzVisible.value = true }
}, { default: () => '云台' }),
]);
return (
<div>
<el-button size="small" type="primary" plain
style="height:26px;padding:0 8px !important;"
onClick={($e) => openPreview(row)}>
预览
</el-button>
<el-button size="small" plain
style="height:26px;padding:0 8px !important;margin-left:4px"
onClick={($e) => { curDev.value = row; ptzVisible.value = true }}>
云台
</el-button>
</div>
);
}
if (row.DeviceGroup === 'IoT设备') {
return _h('div', [
h('el-button', { size: 'small', type: 'primary',
onClick: () => openRealtime(row)
}, { default: () => '实时数据' }),
h('el-button', { size: 'small',
onClick: () => openControl(row)
}, { default: () => '控制' }),
]);
return (
<div>
<el-button size="small" type="primary" plain
style="height:26px;padding:0 8px !important;"
onClick={($e) => openRealtime(row)}>
实时数据
</el-button>
<el-button size="small" plain
style="height:26px;padding:0 8px !important;margin-left:4px"
onClick={($e) => openControl(row)}>
控制
</el-button>
</div>
);
}
return null;
}