Showing
5 changed files
with
25 additions
and
6 deletions
| ... | ... | @@ -21,18 +21,18 @@ |
| 21 | 21 | <template #outputParamSlot> |
| 22 | 22 | <div> |
| 23 | 23 | <template v-for="(item, index) in outputParamData" :key="item"> |
| 24 | - <span style="display: none">{{ item }}</span> | |
| 24 | + <span style="display: none">{{ item + index }}</span> | |
| 25 | 25 | <InputParamItem |
| 26 | 26 | :title="item.name" |
| 27 | 27 | :item="item" |
| 28 | 28 | class="mt-4" |
| 29 | - :index="index" | |
| 29 | + :index="item.id" | |
| 30 | 30 | :ref="dynamicBindRef.outputParamItemRef" |
| 31 | 31 | @delete="deleteOutParItem" |
| 32 | 32 | @edit="editOutParItem" |
| 33 | 33 | /> |
| 34 | 34 | </template> |
| 35 | - <div style="display: flex" class="mt-2"> | |
| 35 | + <div style="display: flex" :class="{ 'mt-2': outputParamData.length > 0 }"> | |
| 36 | 36 | <span style="color: #0170cc; cursor: pointer">+</span> |
| 37 | 37 | <span style="color: #0170cc; cursor: pointer" @click="handleAddOutParam">增加参数</span> |
| 38 | 38 | </div> |
| ... | ... | @@ -50,7 +50,11 @@ |
| 50 | 50 | import InputParamItem from './components/InputParamItem.vue'; |
| 51 | 51 | import AddParamsModal from './components/AddParamsModal.vue'; |
| 52 | 52 | import { Input } from 'ant-design-vue'; |
| 53 | - import { validateValueRangeAndStep, validateValueBool } from '../hook/useValidateParital'; | |
| 53 | + import { | |
| 54 | + validateValueRangeAndStep, | |
| 55 | + validateValueBool, | |
| 56 | + validateValueStruct, | |
| 57 | + } from '../hook/useValidateParital'; | |
| 54 | 58 | import { buildUUID } from '/@/utils/uuid'; |
| 55 | 59 | |
| 56 | 60 | const outputParamData: any = ref([]); |
| ... | ... | @@ -138,6 +142,9 @@ |
| 138 | 142 | const values = await validate(); |
| 139 | 143 | if (!values) return; |
| 140 | 144 | const dataSpecsList = getStructList(); |
| 145 | + if (values.dataType === 'STRUCT') { | |
| 146 | + validateValueStruct(dataSpecsList as any); | |
| 147 | + } | |
| 141 | 148 | validateValueRangeAndStep(Number(minMaxObj.min), Number(values.step), Number(minMaxObj.max)); |
| 142 | 149 | validateValueBool(Number(values.boolClose), Number(values.boolOpen)); |
| 143 | 150 | const dataSpecs = { | ... | ... |
| ... | ... | @@ -17,6 +17,7 @@ |
| 17 | 17 | import { ref, computed, reactive } from 'vue'; |
| 18 | 18 | import { BasicModal, useModalInner } from '/@/components/Modal'; |
| 19 | 19 | import AddParamForm from './AddParamForm.vue'; |
| 20 | + import { validateValueStruct } from '../../hook/useValidateParital'; | |
| 20 | 21 | |
| 21 | 22 | const emits = defineEmits(['register', 'data']); |
| 22 | 23 | const setEditData: any = reactive({ |
| ... | ... | @@ -53,6 +54,9 @@ |
| 53 | 54 | const handleSubmit = async () => { |
| 54 | 55 | const value = await AddParamFormRef.value?.getFormData(); |
| 55 | 56 | if (!value) return; |
| 57 | + if (value.dataType === 'STRUCT') { | |
| 58 | + validateValueStruct(value.dataSpecsList as any); | |
| 59 | + } | |
| 56 | 60 | emits( |
| 57 | 61 | 'data', |
| 58 | 62 | { | ... | ... |
| ... | ... | @@ -21,3 +21,10 @@ export const validateValueBool = (boolClose, boolOpen) => { |
| 21 | 21 | throw '布尔值不能相同'; |
| 22 | 22 | } |
| 23 | 23 | }; |
| 24 | + | |
| 25 | +export const validateValueStruct = (data: []) => { | |
| 26 | + if (data.length === 0) { | |
| 27 | + createMessage.error('struct不能为空'); | |
| 28 | + throw 'struct不能为空'; | |
| 29 | + } | |
| 30 | +}; | ... | ... |
| ... | ... | @@ -3,7 +3,7 @@ import { BasicColumn, FormSchema } from '/@/components/Table'; |
| 3 | 3 | import { screenLinkOrganizationGetApi } from '/@/api/ruleengine/ruleengineApi'; |
| 4 | 4 | import { scheduleOptions } from './formatData'; |
| 5 | 5 | import { copyTransFun } from '/@/utils/fnUtils'; |
| 6 | -import { numberAndNonegativeRule, numberAndEngLishRule } from '/@/utils/rules'; | |
| 6 | +import { numberAndNonegativeRule } from '/@/utils/rules'; | |
| 7 | 7 | |
| 8 | 8 | /** |
| 9 | 9 | * 所使用的枚举值 |
| ... | ... | @@ -265,7 +265,7 @@ export const trigger_condition_schema: FormSchema[] = [ |
| 265 | 265 | }, |
| 266 | 266 | ifShow: ({ values }) => isDevice(values.triggerType), |
| 267 | 267 | colProps: { span: 6 }, |
| 268 | - rules: numberAndEngLishRule, | |
| 268 | + // rules: numberAndEngLishRule, | |
| 269 | 269 | }, |
| 270 | 270 | { |
| 271 | 271 | field: 'operationType', | ... | ... |