Commit 5d45f03500e3e0dc2ce6c153e8bdabab6acea424
Merge branch 'main_dev' of http://git.yunteng.com/yunteng/thingskit-front into main_dev
Showing
8 changed files
with
13 additions
and
8 deletions
... | ... | @@ -87,7 +87,8 @@ |
87 | 87 | const isTcpDevice = unref(props.deviceDetail)?.transportType === TransportTypeEnum.TCP; |
88 | 88 | if (commandType === CommandTypeEnum.CUSTOM) { |
89 | 89 | if (isTcpDevice) { |
90 | - return values.tcpCommandValue; | |
90 | + const value = values.tcpCommandValue; | |
91 | + return value?.replaceAll(/\s/g, ''); | |
91 | 92 | } |
92 | 93 | return parseStringToJSON(values.commandValue!).json; |
93 | 94 | } else { | ... | ... |
... | ... | @@ -130,7 +130,11 @@ function handleServiceType( |
130 | 130 | functionJson: { |
131 | 131 | inputData: |
132 | 132 | transportType === TransportTypeEnum.TCP |
133 | - ? [{ [FormFieldsEnum.SERVICE_COMMAND]: serviceCommand } as unknown as StructJSON] | |
133 | + ? [ | |
134 | + { | |
135 | + [FormFieldsEnum.SERVICE_COMMAND]: serviceCommand?.replaceAll(/\s/g, ''), | |
136 | + } as unknown as StructJSON, | |
137 | + ] | |
134 | 138 | : inputData, |
135 | 139 | outputData, |
136 | 140 | }, | ... | ... |
... | ... | @@ -14,6 +14,7 @@ import { dateUtil } from '/@/utils/dateUtil'; |
14 | 14 | import { ProductPicker, validateProductPicker } from '../ProductPicker'; |
15 | 15 | import { useGlobSetting } from '/@/hooks/setting'; |
16 | 16 | import { TransportTypeEnum } from '/@/enums/deviceEnum'; |
17 | +import { validateTCPCustomCommand } from '/@/components/Form/src/components/ThingsModelForm'; | |
17 | 18 | |
18 | 19 | useComponentRegister('DevicePicker', DevicePicker); |
19 | 20 | useComponentRegister('ProductPicker', ProductPicker); |
... | ... | @@ -218,7 +219,7 @@ export const formSchemas: FormSchema[] = [ |
218 | 219 | const rules: Rule[] = [{ required: true, message: '请输入自定义数据流' }]; |
219 | 220 | return model[FormFieldsEnum.PUSH_WAY] === PushWayEnum.MQTT |
220 | 221 | ? [...rules, ...JSONEditorValidator()] |
221 | - : rules; | |
222 | + : [...rules, { validator: validateTCPCustomCommand }]; | |
222 | 223 | }, |
223 | 224 | ifShow: ({ model }) => model[FormFieldsEnum.EXECUTE_CONTENT_TYPE] === TaskTypeEnum.CUSTOM, |
224 | 225 | valueField: 'value', | ... | ... |
... | ... | @@ -95,7 +95,8 @@ export const composeData = (result: Required<FormValueType>): CreateTaskRecordTy |
95 | 95 | targetType, |
96 | 96 | executeContent: { |
97 | 97 | pushContent: { |
98 | - rpcCommand: pushWay === PushWayEnum.MQTT ? JSON.parse(rpcCommand) : rpcCommand, | |
98 | + rpcCommand: | |
99 | + pushWay === PushWayEnum.TCP ? rpcCommand.replaceAll(/\s/g, '') : JSON.parse(rpcCommand), | |
99 | 100 | }, |
100 | 101 | pushWay, |
101 | 102 | type: executeContentType, | ... | ... |
... | ... | @@ -8,7 +8,7 @@ export enum MoreActionEvent { |
8 | 8 | export enum VisualBoardPermission { |
9 | 9 | UPDATE = 'api:yt:data_board:update:update', |
10 | 10 | DELETE = 'api:yt:data_board:delete', |
11 | - CREATE = '', | |
11 | + CREATE = 'api:yt:data_board:add:post', | |
12 | 12 | SHARE = 'api:yt:data_board:share', |
13 | 13 | DETAIL = 'api:yt:data_component:list', |
14 | 14 | } | ... | ... |