diff --git a/web.vite/src/extension/warehouse/base_device.jsx b/web.vite/src/extension/warehouse/base_device.jsx deleted file mode 100644 index c6c5b47..0000000 --- a/web.vite/src/extension/warehouse/base_device.jsx +++ /dev/null @@ -1,72 +0,0 @@ -/** - * base_device 页面操作列扩展 - * 按 DeviceGroup 动态渲染对应的操作按钮组件 - * 框架升级不覆盖此文件(extension 目录受保护) - */ -import VideoDeviceActions from '@/views/warehouse/base_device/components/VideoDeviceActions.vue' -import IoTDeviceActions from '@/views/warehouse/base_device/components/IoTDeviceActions.vue' -import AccessDeviceActions from '@/views/warehouse/base_device/components/AccessDeviceActions.vue' -import BarrierDeviceActions from '@/views/warehouse/base_device/components/BarrierDeviceActions.vue' -import AlarmDeviceActions from '@/views/warehouse/base_device/components/AlarmDeviceActions.vue' -import DeviceLivePreview from '@/views/warehouse/base_device/components/DeviceLivePreview.vue' -import PtzControlPanel from '@/views/warehouse/base_device/components/PtzControlPanel.vue' -import RealtimeDataPanel from '@/views/warehouse/base_device/components/RealtimeDataPanel.vue' -import DeviceControlPanel from '@/views/warehouse/base_device/components/DeviceControlPanel.vue' -import DeviceEditDialog from '@/views/warehouse/base_device/components/DeviceEditDialog.vue' -import MapBindingPanel from '@/views/warehouse/base_device/components/MapBindingPanel.vue' - -// 按 DeviceGroup 映射操作组件 -const actionMap = { - '视频设备': 'VideoDeviceActions', - 'IoT设备': 'IoTDeviceActions', - '门禁设备': 'AccessDeviceActions', - '道闸设备': 'BarrierDeviceActions', - '报警设备': 'AlarmDeviceActions', -} - -export default { - components: { - VideoDeviceActions, IoTDeviceActions, AccessDeviceActions, BarrierDeviceActions, AlarmDeviceActions, - DeviceLivePreview, PtzControlPanel, RealtimeDataPanel, DeviceControlPanel, DeviceEditDialog, MapBindingPanel - }, - - data() { - return { - currentDevice: null, - dialogs: { preview: false, ptz: false, realtime: false, control: false, edit: false, map: false } - } - }, - - // 替换框架操作列 - slots: { - 'col-action': (h, { row }) => { - const compName = actionMap[row.deviceGroup] - if (!compName) return null - // 渲染自定义按钮组,绑定事件 - return h(compName, { - props: { row }, - on: { - preview: () => this.openDialog('preview', row), - ptz: () => this.openDialog('ptz', row), - playback: () => console.log('playback', row), - snapshot: () => console.log('snapshot', row), - syncChannels: () => console.log('syncChannels', row), - realtime: () => this.openDialog('realtime', row), - control: () => this.openDialog('control', row), - refresh: () => this.$emit('refresh'), - alarms: () => console.log('alarms', row), - } - }) - } - }, - - methods: { - openDialog(name, device) { - this.currentDevice = device - this.dialogs[name] = true - }, - onRefresh() { - this.$emit('refresh') - } - } -} diff --git a/web.vite/src/extension/warehouse/device_manager/base_device.jsx b/web.vite/src/extension/warehouse/device_manager/base_device.jsx index 9750d58..7230d76 100644 --- a/web.vite/src/extension/warehouse/device_manager/base_device.jsx +++ b/web.vite/src/extension/warehouse/device_manager/base_device.jsx @@ -1,75 +1,72 @@ -/***************************************************************************************** -** Author:jxx 2023 -** QQ:283591387 -** 框架文档: http://doc.volcore.xyz/ -*****************************************************************************************/ -//此js文件是用来自定义扩展业务代码,在当前[表.vue]文件中也可以实现业务处理 +/** + * base_device 页面操作列扩展 + * 按 DeviceGroup 动态渲染对应的操作按钮组件 + * 框架升级不覆盖此文件(extension 目录受保护) + */ +import VideoDeviceActions from '@/views/warehouse/device_manager/base_device/components/VideoDeviceActions.vue' +import IoTDeviceActions from '@/views/warehouse/device_manager/base_device/components/IoTDeviceActions.vue' +import AccessDeviceActions from '@/views/warehouse/device_manager/base_device/components/AccessDeviceActions.vue' +import BarrierDeviceActions from '@/views/warehouse/device_manager/base_device/components/BarrierDeviceActions.vue' +import AlarmDeviceActions from '@/views/warehouse/device_manager/base_device/components/AlarmDeviceActions.vue' +import DeviceLivePreview from '@/views/warehouse/device_manager/base_device/components/DeviceLivePreview.vue' +import PtzControlPanel from '@/views/warehouse/device_manager/base_device/components/PtzControlPanel.vue' +import RealtimeDataPanel from '@/views/warehouse/device_manager/base_device/components/RealtimeDataPanel.vue' +import DeviceControlPanel from '@/views/warehouse/device_manager/base_device/components/DeviceControlPanel.vue' +import DeviceEditDialog from '@/views/warehouse/device_manager/base_device/components/DeviceEditDialog.vue' +import MapBindingPanel from '@/views/warehouse/device_manager/base_device/components/MapBindingPanel.vue' -let extension = { +// 按 DeviceGroup 映射操作组件 +const actionMap = { + '视频设备': 'VideoDeviceActions', + 'IoT设备': 'IoTDeviceActions', + '门禁设备': 'AccessDeviceActions', + '道闸设备': 'BarrierDeviceActions', + '报警设备': 'AlarmDeviceActions', +} + +export default { components: { - //查询界面扩展组件 - gridHeader: '', - gridBody: '', - gridFooter: '', - //新建、编辑弹出框扩展组件 - modelHeader: '', - modelBody: '', - modelRight: '', - modelFooter: '' + VideoDeviceActions, IoTDeviceActions, AccessDeviceActions, BarrierDeviceActions, AlarmDeviceActions, + DeviceLivePreview, PtzControlPanel, RealtimeDataPanel, DeviceControlPanel, DeviceEditDialog, MapBindingPanel }, - tableAction: '', //指定某张表的权限(这里填写表名,默认不用填写) - buttons: { view: [], box: [], detail: [] }, //扩展的按钮 - methods: { - //下面这些方法可以保留也可以删除 - onInit() { //框架初始化配置前, - //示例:在按钮的最前面添加一个按钮 - // this.buttons.unshift({ //也可以用push或者splice方法来修改buttons数组 - // name: '按钮', //按钮名称 - // icon: 'el-icon-document', //按钮图标:https://element.eleme.cn/#/zh-CN/component/icon - // type: 'primary', //按钮样式:https://element-plus.gitee.io/zh-CN/component/button.html - // //color:"#eee",//自定义按钮颜色 - // onClick: function () { - // this.$Message.success('点击了按钮'); - // } - // }); - //示例:设置修改新建、编辑弹出框字段标签的长度 - // this.boxOptions.labelWidth = 150; + data() { + return { + currentDevice: null, + dialogs: { preview: false, ptz: false, realtime: false, control: false, edit: false, map: false } + } + }, + + // 替换框架操作列 + slots: { + 'col-action': (h, { row }) => { + const compName = actionMap[row.deviceGroup] + if (!compName) return null + // 渲染自定义按钮组,绑定事件 + return h(compName, { + props: { row }, + on: { + preview: () => this.openDialog('preview', row), + ptz: () => this.openDialog('ptz', row), + playback: () => console.log('playback', row), + snapshot: () => console.log('snapshot', row), + syncChannels: () => console.log('syncChannels', row), + realtime: () => this.openDialog('realtime', row), + control: () => this.openDialog('control', row), + refresh: () => this.$emit('refresh'), + alarms: () => console.log('alarms', row), + } + }) + } + }, + + methods: { + openDialog(name, device) { + this.currentDevice = device + this.dialogs[name] = true }, - onInited() { - //框架初始化配置后 - //如果要配置明细表,在此方法操作 - //this.detailOptions.columns.forEach(column=>{ }); - }, - searchBefore(param) { - //界面查询前,可以给param.wheres添加查询参数 - //返回false,则不会执行查询 - return true; - }, - searchAfter(result) { - //查询后,result返回的查询数据,可以在显示到表格前处理表格的值 - return true; - }, - addBefore(formData) { - //新建保存前formData为对象,包括明细表,可以给给表单设置值,自己输出看formData的值 - return true; - }, - updateBefore(formData) { - //编辑保存前formData为对象,包括明细表、删除行的Id - return true; - }, - rowClick({ row, column, event }) { - //查询界面点击行事件 - // this.$refs.table.$refs.table.toggleRowSelection(row); //单击行时选中当前行; - }, - modelOpenAfter(row) { - //点击编辑、新建按钮弹出框后,可以在此处写逻辑,如,从后台获取数据 - //(1)判断是编辑还是新建操作: this.currentAction=='Add'; - //(2)给弹出框设置默认值 - //(3)this.editFormFields.字段='xxx'; - //如果需要给下拉框设置默认值,请遍历this.editFormOptions找到字段配置对应data属性的key值 - //看不懂就把输出看:console.log(this.editFormOptions) + onRefresh() { + this.$emit('refresh') } } -}; -export default extension; +} diff --git a/web.vite/src/views/warehouse/base_device.vue b/web.vite/src/views/warehouse/base_device.vue new file mode 100644 index 0000000..70bb481 --- /dev/null +++ b/web.vite/src/views/warehouse/base_device.vue @@ -0,0 +1,82 @@ + + + diff --git a/web.vite/src/views/warehouse/base_device/components/AccessDeviceActions.vue b/web.vite/src/views/warehouse/device_manager/base_device/components/AccessDeviceActions.vue similarity index 100% rename from web.vite/src/views/warehouse/base_device/components/AccessDeviceActions.vue rename to web.vite/src/views/warehouse/device_manager/base_device/components/AccessDeviceActions.vue diff --git a/web.vite/src/views/warehouse/base_device/components/AlarmDeviceActions.vue b/web.vite/src/views/warehouse/device_manager/base_device/components/AlarmDeviceActions.vue similarity index 100% rename from web.vite/src/views/warehouse/base_device/components/AlarmDeviceActions.vue rename to web.vite/src/views/warehouse/device_manager/base_device/components/AlarmDeviceActions.vue diff --git a/web.vite/src/views/warehouse/base_device/components/BarrierDeviceActions.vue b/web.vite/src/views/warehouse/device_manager/base_device/components/BarrierDeviceActions.vue similarity index 100% rename from web.vite/src/views/warehouse/base_device/components/BarrierDeviceActions.vue rename to web.vite/src/views/warehouse/device_manager/base_device/components/BarrierDeviceActions.vue diff --git a/web.vite/src/views/warehouse/base_device/components/DeviceControlPanel.vue b/web.vite/src/views/warehouse/device_manager/base_device/components/DeviceControlPanel.vue similarity index 100% rename from web.vite/src/views/warehouse/base_device/components/DeviceControlPanel.vue rename to web.vite/src/views/warehouse/device_manager/base_device/components/DeviceControlPanel.vue diff --git a/web.vite/src/views/warehouse/base_device/components/DeviceEditDialog.vue b/web.vite/src/views/warehouse/device_manager/base_device/components/DeviceEditDialog.vue similarity index 100% rename from web.vite/src/views/warehouse/base_device/components/DeviceEditDialog.vue rename to web.vite/src/views/warehouse/device_manager/base_device/components/DeviceEditDialog.vue diff --git a/web.vite/src/views/warehouse/base_device/components/DeviceLivePreview.vue b/web.vite/src/views/warehouse/device_manager/base_device/components/DeviceLivePreview.vue similarity index 100% rename from web.vite/src/views/warehouse/base_device/components/DeviceLivePreview.vue rename to web.vite/src/views/warehouse/device_manager/base_device/components/DeviceLivePreview.vue diff --git a/web.vite/src/views/warehouse/base_device/components/IoTDeviceActions.vue b/web.vite/src/views/warehouse/device_manager/base_device/components/IoTDeviceActions.vue similarity index 100% rename from web.vite/src/views/warehouse/base_device/components/IoTDeviceActions.vue rename to web.vite/src/views/warehouse/device_manager/base_device/components/IoTDeviceActions.vue diff --git a/web.vite/src/views/warehouse/base_device/components/MapBindingPanel.vue b/web.vite/src/views/warehouse/device_manager/base_device/components/MapBindingPanel.vue similarity index 100% rename from web.vite/src/views/warehouse/base_device/components/MapBindingPanel.vue rename to web.vite/src/views/warehouse/device_manager/base_device/components/MapBindingPanel.vue diff --git a/web.vite/src/views/warehouse/base_device/components/PtzControlPanel.vue b/web.vite/src/views/warehouse/device_manager/base_device/components/PtzControlPanel.vue similarity index 100% rename from web.vite/src/views/warehouse/base_device/components/PtzControlPanel.vue rename to web.vite/src/views/warehouse/device_manager/base_device/components/PtzControlPanel.vue diff --git a/web.vite/src/views/warehouse/base_device/components/RealtimeDataPanel.vue b/web.vite/src/views/warehouse/device_manager/base_device/components/RealtimeDataPanel.vue similarity index 100% rename from web.vite/src/views/warehouse/base_device/components/RealtimeDataPanel.vue rename to web.vite/src/views/warehouse/device_manager/base_device/components/RealtimeDataPanel.vue diff --git a/web.vite/src/views/warehouse/base_device/components/VideoDeviceActions.vue b/web.vite/src/views/warehouse/device_manager/base_device/components/VideoDeviceActions.vue similarity index 100% rename from web.vite/src/views/warehouse/base_device/components/VideoDeviceActions.vue rename to web.vite/src/views/warehouse/device_manager/base_device/components/VideoDeviceActions.vue