mirror of
https://github.com/yudaocode/yudao-ui-admin-vue3.git
synced 2026-04-23 12:08:37 +00:00
perf: 【IoT 物联网】场景联动移除自定义校验规则简化校验逻辑
This commit is contained in:
@@ -55,7 +55,6 @@
|
||||
type="service"
|
||||
:config="{ service: selectedService }"
|
||||
placeholder="请输入JSON格式的服务参数"
|
||||
@validate="handleParamsValidate"
|
||||
/>
|
||||
</el-form-item>
|
||||
</div>
|
||||
@@ -70,7 +69,6 @@
|
||||
type="property"
|
||||
:config="{ properties: thingModelProperties }"
|
||||
placeholder="请输入JSON格式的控制参数"
|
||||
@validate="handleParamsValidate"
|
||||
/>
|
||||
</el-form-item>
|
||||
</div>
|
||||
@@ -86,7 +84,8 @@ import type { Action } from '@/api/iot/rule/scene'
|
||||
import type { ThingModelProperty, ThingModelService } from '@/api/iot/thingmodel'
|
||||
import {
|
||||
IotRuleSceneActionTypeEnum,
|
||||
IoTThingModelAccessModeEnum
|
||||
IoTThingModelAccessModeEnum,
|
||||
IoTDataSpecsDataTypeEnum
|
||||
} from '@/views/iot/utils/constants'
|
||||
import { ThingModelApi } from '@/api/iot/thingmodel'
|
||||
|
||||
@@ -126,12 +125,6 @@ const paramsValue = computed({
|
||||
}
|
||||
})
|
||||
|
||||
// 参数验证处理
|
||||
const handleParamsValidate = (result: { valid: boolean; message: string }) => {
|
||||
// 可以在这里处理验证结果,比如显示错误信息
|
||||
console.log('参数验证结果:', result)
|
||||
}
|
||||
|
||||
const isPropertySetAction = computed(() => {
|
||||
// 是否为属性设置类型
|
||||
return action.value.type === IotRuleSceneActionTypeEnum.DEVICE_PROPERTY_SET
|
||||
@@ -301,16 +294,16 @@ const loadServiceFromTSL = async (productId: number, serviceIdentifier: string)
|
||||
*/
|
||||
const getDefaultValueForParam = (param: any) => {
|
||||
switch (param.dataType) {
|
||||
case 'int':
|
||||
case IoTDataSpecsDataTypeEnum.INT:
|
||||
return 0
|
||||
case 'float':
|
||||
case 'double':
|
||||
case IoTDataSpecsDataTypeEnum.FLOAT:
|
||||
case IoTDataSpecsDataTypeEnum.DOUBLE:
|
||||
return 0.0
|
||||
case 'bool':
|
||||
case IoTDataSpecsDataTypeEnum.BOOL:
|
||||
return false
|
||||
case 'text':
|
||||
case IoTDataSpecsDataTypeEnum.TEXT:
|
||||
return ''
|
||||
case 'enum':
|
||||
case IoTDataSpecsDataTypeEnum.ENUM:
|
||||
// 如果有枚举值,使用第一个
|
||||
if (param.dataSpecs?.dataSpecsList && param.dataSpecs.dataSpecsList.length > 0) {
|
||||
return param.dataSpecs.dataSpecsList[0].value
|
||||
|
||||
Reference in New Issue
Block a user