| | |
| | | const deviceTypesLoading = ref(false) |
| | | |
| | | // 设备逻辑参数(根据设备类型动态显示) |
| | | const deviceLogicParams = reactive({}) |
| | | const deviceLogicParams = ref({}) |
| | | |
| | | const S7_PLC_TYPES = ['S1200', 'S1500'] |
| | | const MODBUS_PLC_TYPES = ['MODBUS'] |
| | |
| | | } |
| | | |
| | | // 加载设备逻辑参数 |
| | | const loadDeviceLogicParams = (deviceLogic, deviceType) => { |
| | | // 清空现有参数 |
| | | Object.keys(deviceLogicParams).forEach(key => { |
| | | delete deviceLogicParams[key] |
| | | }) |
| | | |
| | | // 根据设备类型加载对应的参数 |
| | | const loadDeviceLogicParams = (deviceLogic) => { |
| | | if (deviceLogic && Object.keys(deviceLogic).length > 0) { |
| | | Object.assign(deviceLogicParams, deviceLogic) |
| | | deviceLogicParams.value = { ...deviceLogic } |
| | | } else { |
| | | deviceLogicParams.value = {} |
| | | } |
| | | } |
| | | |
| | |
| | | deviceFormRef.value?.clearValidate() |
| | | |
| | | // 重置设备逻辑参数 |
| | | Object.keys(deviceLogicParams).forEach(key => { |
| | | delete deviceLogicParams[key] |
| | | }) |
| | | deviceLogicParams.value = {} |
| | | } |
| | | |
| | | const addConfigParam = () => { |
| | |
| | | } |
| | | |
| | | // 保存设备逻辑参数(直接使用deviceLogicParams,由各个配置组件管理) |
| | | if (deviceLogicParams && Object.keys(deviceLogicParams).length > 0) { |
| | | extraObj.deviceLogic = { ...deviceLogicParams } |
| | | if (deviceLogicParams.value && Object.keys(deviceLogicParams.value).length > 0) { |
| | | extraObj.deviceLogic = { ...deviceLogicParams.value } |
| | | } else { |
| | | delete extraObj.deviceLogic |
| | | } |
| | | |
| | | // 构建 configJson:将 configParams 数组转换为 JSON 字符串 |