Commit e4fc9fcff4c4b078734e88700c738c937ea76146
Merge branch 'ft_local_dev' into 'main'
feat:mock模拟阿里云后端数据,物模型新增编辑回显数据大致完成,待完善细节问题和联调服务端 See merge request huang/yun-teng-iot-front!366
Showing
14 changed files
with
781 additions
and
319 deletions
@@ -33,7 +33,7 @@ | @@ -33,7 +33,7 @@ | ||
33 | 33 | ||
34 | import { useUserStore } from '/@/store/modules/user'; | 34 | import { useUserStore } from '/@/store/modules/user'; |
35 | import { useLockStore } from '/@/store/modules/lock'; | 35 | import { useLockStore } from '/@/store/modules/lock'; |
36 | - import headerImg from '/@/assets/images/header.jpg'; | 36 | + import headerImg from '/@/assets/images/logo.png'; |
37 | export default defineComponent({ | 37 | export default defineComponent({ |
38 | name: 'LockModal', | 38 | name: 'LockModal', |
39 | components: { BasicModal, BasicForm }, | 39 | components: { BasicModal, BasicForm }, |
@@ -106,6 +106,7 @@ | @@ -106,6 +106,7 @@ | ||
106 | left: calc(50% - 45px); | 106 | left: calc(50% - 45px); |
107 | width: auto; | 107 | width: auto; |
108 | text-align: center; | 108 | text-align: center; |
109 | + | ||
109 | &-img { | 110 | &-img { |
110 | width: 70px; | 111 | width: 70px; |
111 | border-radius: 50%; | 112 | border-radius: 50%; |
@@ -113,7 +114,7 @@ | @@ -113,7 +114,7 @@ | ||
113 | 114 | ||
114 | &-name { | 115 | &-name { |
115 | margin-top: 5px; | 116 | margin-top: 5px; |
116 | - display: flex; | 117 | + // display: flex; |
117 | width: 100%; | 118 | width: 100%; |
118 | // margin-left: -15px; | 119 | // margin-left: -15px; |
119 | } | 120 | } |
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | <BasicModal | 3 | <BasicModal |
4 | :maskClosable="false" | 4 | :maskClosable="false" |
5 | v-bind="$attrs" | 5 | v-bind="$attrs" |
6 | - width="60rem" | 6 | + :width="dynamicWidth" |
7 | @register="register" | 7 | @register="register" |
8 | @ok="handleSubmit" | 8 | @ok="handleSubmit" |
9 | @cancel="handleCancel" | 9 | @cancel="handleCancel" |
@@ -86,6 +86,7 @@ | @@ -86,6 +86,7 @@ | ||
86 | profileData: {}, | 86 | profileData: {}, |
87 | }); | 87 | }); |
88 | const transportTypeStr = ref(''); | 88 | const transportTypeStr = ref(''); |
89 | + const dynamicWidth = ref('55rem'); | ||
89 | const [register, { closeModal, setModalProps }] = useModalInner(async (data) => { | 90 | const [register, { closeModal, setModalProps }] = useModalInner(async (data) => { |
90 | setModalProps({ confirmLoading: false }); | 91 | setModalProps({ confirmLoading: false }); |
91 | current.value = 0; | 92 | current.value = 0; |
@@ -95,6 +96,7 @@ | @@ -95,6 +96,7 @@ | ||
95 | isEditId.value = data.record !== undefined ? data.record.id : null; | 96 | isEditId.value = data.record !== undefined ? data.record.id : null; |
96 | isEditCreatTime.value = data.record !== undefined ? data.record.createTime : null; | 97 | isEditCreatTime.value = data.record !== undefined ? data.record.createTime : null; |
97 | if (!unref(isViewDetail)) { | 98 | if (!unref(isViewDetail)) { |
99 | + dynamicWidth.value = 55 + 'rem'; | ||
98 | const title = !unref(isUpdate) ? '编辑设备配置' : '新增设备配置'; | 100 | const title = !unref(isUpdate) ? '编辑设备配置' : '新增设备配置'; |
99 | setModalProps({ title, showOkBtn: true, showCancelBtn: true }); | 101 | setModalProps({ title, showOkBtn: true, showCancelBtn: true }); |
100 | if (!unref(isUpdate)) { | 102 | if (!unref(isUpdate)) { |
@@ -103,6 +105,7 @@ | @@ -103,6 +105,7 @@ | ||
103 | handleStepNext(false, res); | 105 | handleStepNext(false, res); |
104 | } | 106 | } |
105 | } else { | 107 | } else { |
108 | + dynamicWidth.value = 60 + 'rem'; | ||
106 | setModalProps({ showOkBtn: false, showCancelBtn: false, title: '设备配置详情' }); | 109 | setModalProps({ showOkBtn: false, showCancelBtn: false, title: '设备配置详情' }); |
107 | await setDeviceConfEditFormData(res); | 110 | await setDeviceConfEditFormData(res); |
108 | await setTransConfEditFormData(res); | 111 | await setTransConfEditFormData(res); |
@@ -21,6 +21,11 @@ export const steps = [ | @@ -21,6 +21,11 @@ export const steps = [ | ||
21 | 21 | ||
22 | export const physicalColumn: BasicColumn[] = [ | 22 | export const physicalColumn: BasicColumn[] = [ |
23 | { | 23 | { |
24 | + title: '功能类型', | ||
25 | + dataIndex: 'dType', | ||
26 | + width: 90, | ||
27 | + }, | ||
28 | + { | ||
24 | title: '功能名称', | 29 | title: '功能名称', |
25 | dataIndex: 'name', | 30 | dataIndex: 'name', |
26 | width: 90, | 31 | width: 90, |
@@ -410,6 +415,7 @@ export const formSchema: FormSchema[] = [ | @@ -410,6 +415,7 @@ export const formSchema: FormSchema[] = [ | ||
410 | export const mockData: any = async () => { | 415 | export const mockData: any = async () => { |
411 | const res = await [ | 416 | const res = await [ |
412 | { | 417 | { |
418 | + dType: 'events', | ||
413 | name: '亮度百分比', | 419 | name: '亮度百分比', |
414 | type: 'Brightness', | 420 | type: 'Brightness', |
415 | transportType: 'int32(整数型)', | 421 | transportType: 'int32(整数型)', |
@@ -420,6 +426,7 @@ export const mockData: any = async () => { | @@ -420,6 +426,7 @@ export const mockData: any = async () => { | ||
420 | createTime: '2022-10-20 10:24:22', | 426 | createTime: '2022-10-20 10:24:22', |
421 | }, | 427 | }, |
422 | { | 428 | { |
429 | + dType: 'service', | ||
423 | name: '运行状态', | 430 | name: '运行状态', |
424 | type: 'RunningState', | 431 | type: 'RunningState', |
425 | transportType: 'bool(布尔型)', | 432 | transportType: 'bool(布尔型)', |
@@ -430,6 +437,7 @@ export const mockData: any = async () => { | @@ -430,6 +437,7 @@ export const mockData: any = async () => { | ||
430 | createTime: '2022-10-20 10:24:22', | 437 | createTime: '2022-10-20 10:24:22', |
431 | }, | 438 | }, |
432 | { | 439 | { |
440 | + dType: 'attr', | ||
433 | name: '设备运行状态', | 441 | name: '设备运行状态', |
434 | type: 'E_Status_UP', | 442 | type: 'E_Status_UP', |
435 | transportType: 'text(字符串)', | 443 | transportType: 'text(字符串)', |
@@ -440,6 +448,7 @@ export const mockData: any = async () => { | @@ -440,6 +448,7 @@ export const mockData: any = async () => { | ||
440 | createTime: '2022-10-20 10:24:22', | 448 | createTime: '2022-10-20 10:24:22', |
441 | }, | 449 | }, |
442 | { | 450 | { |
451 | + dType: 'attr', | ||
443 | name: '过流告警使能', | 452 | name: '过流告警使能', |
444 | type: 'OverCurrentEnable', | 453 | type: 'OverCurrentEnable', |
445 | transportType: 'struct(结构体)', | 454 | transportType: 'struct(结构体)', |
@@ -450,6 +459,7 @@ export const mockData: any = async () => { | @@ -450,6 +459,7 @@ export const mockData: any = async () => { | ||
450 | createTime: '2022-10-20 10:24:22', | 459 | createTime: '2022-10-20 10:24:22', |
451 | }, | 460 | }, |
452 | { | 461 | { |
462 | + dType: 'events', | ||
453 | name: '变频器运行状态1', | 463 | name: '变频器运行状态1', |
454 | type: 'Brightness', | 464 | type: 'Brightness', |
455 | transportType: 'int32(整数型)', | 465 | transportType: 'int32(整数型)', |
@@ -460,6 +470,7 @@ export const mockData: any = async () => { | @@ -460,6 +470,7 @@ export const mockData: any = async () => { | ||
460 | createTime: '2022-10-20 10:24:22', | 470 | createTime: '2022-10-20 10:24:22', |
461 | }, | 471 | }, |
462 | { | 472 | { |
473 | + dType: 'service', | ||
463 | name: '产品序列号', | 474 | name: '产品序列号', |
464 | type: 'SerialNo', | 475 | type: 'SerialNo', |
465 | transportType: 'text(字符串)', | 476 | transportType: 'text(字符串)', |
@@ -470,6 +481,7 @@ export const mockData: any = async () => { | @@ -470,6 +481,7 @@ export const mockData: any = async () => { | ||
470 | createTime: '2022-10-20 10:24:22', | 481 | createTime: '2022-10-20 10:24:22', |
471 | }, | 482 | }, |
472 | { | 483 | { |
484 | + dType: 'service', | ||
473 | name: '音量百分比', | 485 | name: '音量百分比', |
474 | type: 'Volume', | 486 | type: 'Volume', |
475 | transportType: 'int32(整数型)', | 487 | transportType: 'int32(整数型)', |
@@ -480,6 +492,7 @@ export const mockData: any = async () => { | @@ -480,6 +492,7 @@ export const mockData: any = async () => { | ||
480 | createTime: '2022-10-20 10:24:22', | 492 | createTime: '2022-10-20 10:24:22', |
481 | }, | 493 | }, |
482 | { | 494 | { |
495 | + dType: 'attr', | ||
483 | name: '易释放氰化物', | 496 | name: '易释放氰化物', |
484 | type: 'easy_release_cyanide', | 497 | type: 'easy_release_cyanide', |
485 | transportType: 'double(双精度浮点型)', | 498 | transportType: 'double(双精度浮点型)', |
@@ -490,6 +503,7 @@ export const mockData: any = async () => { | @@ -490,6 +503,7 @@ export const mockData: any = async () => { | ||
490 | createTime: '2022-10-20 10:24:22', | 503 | createTime: '2022-10-20 10:24:22', |
491 | }, | 504 | }, |
492 | { | 505 | { |
506 | + dType: 'attr', | ||
493 | name: '湿度', | 507 | name: '湿度', |
494 | type: 'Humidity', | 508 | type: 'Humidity', |
495 | transportType: 'float(单精度浮点型)', | 509 | transportType: 'float(单精度浮点型)', |
@@ -500,6 +514,7 @@ export const mockData: any = async () => { | @@ -500,6 +514,7 @@ export const mockData: any = async () => { | ||
500 | createTime: '2022-10-20 10:24:22', | 514 | createTime: '2022-10-20 10:24:22', |
501 | }, | 515 | }, |
502 | { | 516 | { |
517 | + dType: 'attr', | ||
503 | name: '设备固件版本', | 518 | name: '设备固件版本', |
504 | type: 'FirmwareVersion', | 519 | type: 'FirmwareVersion', |
505 | transportType: 'text(字符串)', | 520 | transportType: 'text(字符串)', |
@@ -510,6 +525,7 @@ export const mockData: any = async () => { | @@ -510,6 +525,7 @@ export const mockData: any = async () => { | ||
510 | createTime: '2022-10-20 10:24:22', | 525 | createTime: '2022-10-20 10:24:22', |
511 | }, | 526 | }, |
512 | { | 527 | { |
528 | + dType: 'events', | ||
513 | name: '用电量', | 529 | name: '用电量', |
514 | type: 'PowerConsumption', | 530 | type: 'PowerConsumption', |
515 | transportType: 'float(单精度浮点型)', | 531 | transportType: 'float(单精度浮点型)', |
@@ -10,6 +10,8 @@ | @@ -10,6 +10,8 @@ | ||
10 | > | 10 | > |
11 | <div v-if="isViewDetail"> | 11 | <div v-if="isViewDetail"> |
12 | <Attribute v-show="activeKey === '1'" ref="AttrRef" /> | 12 | <Attribute v-show="activeKey === '1'" ref="AttrRef" /> |
13 | + <Service v-show="activeKey === '2'" ref="ServiceRef" /> | ||
14 | + <Events v-show="activeKey === '3'" ref="EventsRef" /> | ||
13 | </div> | 15 | </div> |
14 | <div v-if="!isViewDetail"> | 16 | <div v-if="!isViewDetail"> |
15 | <div> | 17 | <div> |
@@ -20,13 +22,19 @@ | @@ -20,13 +22,19 @@ | ||
20 | </Typography> | 22 | </Typography> |
21 | </div> | 23 | </div> |
22 | <Tabs type="card" v-model:activeKey="activeKey" :size="size"> | 24 | <Tabs type="card" v-model:activeKey="activeKey" :size="size"> |
23 | - <TabPane key="1" tab="属性"> | 25 | + <TabPane :disabled="attrDisable" forceRender key="1" tab="属性"> |
24 | <Attribute v-show="activeKey === '1'" ref="AttrRef" /> | 26 | <Attribute v-show="activeKey === '1'" ref="AttrRef" /> |
25 | </TabPane> | 27 | </TabPane> |
26 | - <TabPane key="2" tab="服务"> | 28 | + <TabPane :disabled="serveiceDisable" forceRender key="2" tab="服务"> |
27 | <Service v-show="activeKey === '2'" ref="ServiceRef" /> | 29 | <Service v-show="activeKey === '2'" ref="ServiceRef" /> |
28 | </TabPane> | 30 | </TabPane> |
29 | - <TabPane key="3" v-show="activeKey === '3'" tab="事件"> | 31 | + <TabPane |
32 | + :disabled="eventDisable" | ||
33 | + forceRender | ||
34 | + key="3" | ||
35 | + v-show="activeKey === '3'" | ||
36 | + tab="事件" | ||
37 | + > | ||
30 | <Events v-show="activeKey === '3'" ref="EventsRef" /> | 38 | <Events v-show="activeKey === '3'" ref="EventsRef" /> |
31 | </TabPane> | 39 | </TabPane> |
32 | </Tabs> | 40 | </Tabs> |
@@ -44,6 +52,9 @@ | @@ -44,6 +52,9 @@ | ||
44 | import { mockData } from '../physical/cpns/components/mock'; | 52 | import { mockData } from '../physical/cpns/components/mock'; |
45 | 53 | ||
46 | defineEmits(['register']); | 54 | defineEmits(['register']); |
55 | + const attrDisable = ref(false); | ||
56 | + const serveiceDisable = ref(false); | ||
57 | + const eventDisable = ref(false); | ||
47 | const blockContent = `属性一般是设备的运行状态,如当前温度等;服务是设备可被调用的方法,支持定义参数,如执行某项任务;事件则是设备上报的 | 58 | const blockContent = `属性一般是设备的运行状态,如当前温度等;服务是设备可被调用的方法,支持定义参数,如执行某项任务;事件则是设备上报的 |
48 | 通知,如告警,需要被及时处理。`; | 59 | 通知,如告警,需要被及时处理。`; |
49 | const activeKey = ref('1'); | 60 | const activeKey = ref('1'); |
@@ -54,6 +65,7 @@ | @@ -54,6 +65,7 @@ | ||
54 | const isUpdate = ref(false); | 65 | const isUpdate = ref(false); |
55 | const isViewDetail = ref(''); | 66 | const isViewDetail = ref(''); |
56 | const isText = ref(''); | 67 | const isText = ref(''); |
68 | + const dType = ref(''); | ||
57 | const allData: any = reactive({ | 69 | const allData: any = reactive({ |
58 | properties: [], | 70 | properties: [], |
59 | events: [], | 71 | events: [], |
@@ -61,27 +73,64 @@ | @@ -61,27 +73,64 @@ | ||
61 | productKey: '', | 73 | productKey: '', |
62 | _ppk: {}, | 74 | _ppk: {}, |
63 | }); | 75 | }); |
76 | + | ||
77 | + const setAttrFormData = (data: {}) => AttrRef.value?.setFormData(data); | ||
78 | + const setServiceFormData = (data: {}) => ServiceRef.value?.setFormData(data); | ||
79 | + const setEventsFormData = (data: {}) => EventsRef.value?.setFormData(data); | ||
80 | + const enums = { | ||
81 | + attr: setAttrFormData, | ||
82 | + service: setServiceFormData, | ||
83 | + events: setEventsFormData, | ||
84 | + }; | ||
85 | + function action(val, data) { | ||
86 | + let F = enums[val]; | ||
87 | + F(data); | ||
88 | + } | ||
89 | + const dynamicData = (t, a, s, e) => { | ||
90 | + switch (t) { | ||
91 | + case 'attr': | ||
92 | + activeKey.value = '1'; | ||
93 | + action(t, a); | ||
94 | + attrDisable.value = false; | ||
95 | + serveiceDisable.value = true; | ||
96 | + eventDisable.value = true; | ||
97 | + break; | ||
98 | + case 'service': | ||
99 | + activeKey.value = '2'; | ||
100 | + action(t, s); | ||
101 | + attrDisable.value = true; | ||
102 | + serveiceDisable.value = false; | ||
103 | + eventDisable.value = true; | ||
104 | + break; | ||
105 | + case 'events': | ||
106 | + activeKey.value = '3'; | ||
107 | + action(t, e); | ||
108 | + attrDisable.value = true; | ||
109 | + serveiceDisable.value = true; | ||
110 | + eventDisable.value = false; | ||
111 | + break; | ||
112 | + } | ||
113 | + }; | ||
64 | const [register, { closeModal, setModalProps }] = useModalInner(async (data) => { | 114 | const [register, { closeModal, setModalProps }] = useModalInner(async (data) => { |
65 | setModalProps({ loading: true }); | 115 | setModalProps({ loading: true }); |
66 | handleCancel(false); | 116 | handleCancel(false); |
67 | isUpdate.value = data.isUpdate; | 117 | isUpdate.value = data.isUpdate; |
68 | isViewDetail.value = data.isView; | 118 | isViewDetail.value = data.isView; |
69 | isText.value = data.isText; | 119 | isText.value = data.isText; |
120 | + dType.value = data.record?.dType; | ||
70 | if (!unref(isViewDetail)) { | 121 | if (!unref(isViewDetail)) { |
71 | const title = !unref(isUpdate) ? '编辑物模型' : '新增物模型'; | 122 | const title = !unref(isUpdate) ? '编辑物模型' : '新增物模型'; |
72 | if (!unref(isUpdate)) { | 123 | if (!unref(isUpdate)) { |
73 | nextTick(() => { | 124 | nextTick(() => { |
74 | - AttrRef.value?.setFormData(mockData.properties); | ||
75 | - ServiceRef.value?.setFormData(mockData.services); | ||
76 | - EventsRef.value?.setFormData(mockData.events); | 125 | + dynamicData(dType.value, mockData.properties, mockData.services, mockData.events); |
77 | }); | 126 | }); |
78 | } | 127 | } |
79 | setModalProps({ title, showOkBtn: true, showCancelBtn: true }); | 128 | setModalProps({ title, showOkBtn: true, showCancelBtn: true }); |
80 | } else { | 129 | } else { |
81 | setModalProps({ showOkBtn: false, showCancelBtn: false, title: '查看物模型' }); | 130 | setModalProps({ showOkBtn: false, showCancelBtn: false, title: '查看物模型' }); |
82 | - AttrRef.value?.setFormData(mockData.properties); | ||
83 | - ServiceRef.value?.setFormData(mockData.services); | ||
84 | - EventsRef.value?.setFormData(mockData.events); | 131 | + nextTick(() => { |
132 | + dynamicData(dType.value, mockData.properties, mockData.services, mockData.events); | ||
133 | + }); | ||
85 | } | 134 | } |
86 | setModalProps({ loading: false }); | 135 | setModalProps({ loading: false }); |
87 | }); | 136 | }); |
@@ -93,6 +142,9 @@ | @@ -93,6 +142,9 @@ | ||
93 | allData.properties = []; | 142 | allData.properties = []; |
94 | allData.events = []; | 143 | allData.events = []; |
95 | allData.services = []; | 144 | allData.services = []; |
145 | + attrDisable.value = false; | ||
146 | + serveiceDisable.value = false; | ||
147 | + eventDisable.value = false; | ||
96 | if (flag) { | 148 | if (flag) { |
97 | closeModal(); | 149 | closeModal(); |
98 | } | 150 | } |
@@ -5,14 +5,14 @@ | @@ -5,14 +5,14 @@ | ||
5 | <div style="display: flex"> | 5 | <div style="display: flex"> |
6 | <Input | 6 | <Input |
7 | type="number" | 7 | type="number" |
8 | - v-model:vlaue="minMaxObj.min" | 8 | + v-model:value="minMaxObj.min" |
9 | placeholder="最小值" | 9 | placeholder="最小值" |
10 | @blur="onInputBlurMin" | 10 | @blur="onInputBlurMin" |
11 | /> | 11 | /> |
12 | <span>~</span> | 12 | <span>~</span> |
13 | <Input | 13 | <Input |
14 | type="number" | 14 | type="number" |
15 | - v-model:vlaue="minMaxObj.max" | 15 | + v-model:value="minMaxObj.max" |
16 | placeholder="最大值" | 16 | placeholder="最大值" |
17 | @blur="onInputBlurMax" | 17 | @blur="onInputBlurMax" |
18 | /> | 18 | /> |
@@ -50,11 +50,9 @@ | @@ -50,11 +50,9 @@ | ||
50 | import InputParamItem from './components/InputParamItem.vue'; | 50 | import InputParamItem from './components/InputParamItem.vue'; |
51 | import AddParamsModal from './components/AddParamsModal.vue'; | 51 | import AddParamsModal from './components/AddParamsModal.vue'; |
52 | import { Input } from 'ant-design-vue'; | 52 | import { Input } from 'ant-design-vue'; |
53 | - // import { useMessage } from '/@/hooks/web/useMessage'; | ||
54 | - import { validateValueRangeAndStep } from '../hook/useValidateParital'; | 53 | + import { validateValueRangeAndStep, validateValueBool } from '../hook/useValidateParital'; |
55 | import { buildUUID } from '/@/utils/uuid'; | 54 | import { buildUUID } from '/@/utils/uuid'; |
56 | 55 | ||
57 | - // const { createMessage } = useMessage(); | ||
58 | const outputParamData: any = ref([]); | 56 | const outputParamData: any = ref([]); |
59 | const minMaxObj = reactive({ | 57 | const minMaxObj = reactive({ |
60 | min: '', | 58 | min: '', |
@@ -94,7 +92,7 @@ | @@ -94,7 +92,7 @@ | ||
94 | openModal(true, { | 92 | openModal(true, { |
95 | isUpdate: true, | 93 | isUpdate: true, |
96 | flag: 'output', | 94 | flag: 'output', |
97 | - excludeStruct: false, | 95 | + excludeStruct: true, |
98 | }); | 96 | }); |
99 | }; | 97 | }; |
100 | 98 | ||
@@ -106,13 +104,24 @@ | @@ -106,13 +104,24 @@ | ||
106 | isUpdate: false, | 104 | isUpdate: false, |
107 | record: item, | 105 | record: item, |
108 | flag: 'output', | 106 | flag: 'output', |
109 | - excludeStruct: false, | 107 | + excludeStruct: true, |
110 | }); | 108 | }); |
111 | }; | 109 | }; |
112 | 110 | ||
113 | //回显数据 | 111 | //回显数据 |
114 | const setFormData = (v) => { | 112 | const setFormData = (v) => { |
115 | setFieldsValue(v[0]); | 113 | setFieldsValue(v[0]); |
114 | + setFieldsValue({ | ||
115 | + ...v[0].dataSpecs, | ||
116 | + boolClose: | ||
117 | + v[0].dataSpecsList !== undefined || v[0].dataSpecsList !== null | ||
118 | + ? v[0].dataSpecsList[0].name | ||
119 | + : '', | ||
120 | + boolOpen: | ||
121 | + v[0].dataSpecsList !== undefined || v[0].dataSpecsList !== null | ||
122 | + ? v[0].dataSpecsList[1].name | ||
123 | + : '', | ||
124 | + }); | ||
116 | const { dataSpecsList } = v[0]; | 125 | const { dataSpecsList } = v[0]; |
117 | if (dataSpecsList !== undefined) { | 126 | if (dataSpecsList !== undefined) { |
118 | outputParamData.value = [...new Array(dataSpecsList.length).keys()]; | 127 | outputParamData.value = [...new Array(dataSpecsList.length).keys()]; |
@@ -130,13 +139,26 @@ | @@ -130,13 +139,26 @@ | ||
130 | if (!values) return; | 139 | if (!values) return; |
131 | const dataSpecsList = getStructList(); | 140 | const dataSpecsList = getStructList(); |
132 | validateValueRangeAndStep(Number(minMaxObj.min), Number(values.step), Number(minMaxObj.max)); | 141 | validateValueRangeAndStep(Number(minMaxObj.min), Number(values.step), Number(minMaxObj.max)); |
133 | - const isStruct = values.dataType === 'STRUCT'; | 142 | + validateValueBool(Number(values.boolClose), Number(values.boolOpen)); |
134 | const dataSpecs = { | 143 | const dataSpecs = { |
135 | ...minMaxObj, | 144 | ...minMaxObj, |
136 | ...{ step: values.step }, | 145 | ...{ step: values.step }, |
137 | ...{ unit: values.unit }, | 146 | ...{ unit: values.unit }, |
138 | ...{ dataType: values.dataType }, | 147 | ...{ dataType: values.dataType }, |
148 | + ...{ length: values.length }, | ||
139 | }; | 149 | }; |
150 | + const dataSpecsListBool = [ | ||
151 | + { | ||
152 | + dataType: values.dataType, | ||
153 | + name: '0', | ||
154 | + value: values.boolClose, | ||
155 | + }, | ||
156 | + { | ||
157 | + dataType: values.dataType, | ||
158 | + name: '1', | ||
159 | + value: values.boolOpen, | ||
160 | + }, | ||
161 | + ]; | ||
140 | const { valueRange, step, unit, outputParam, ...value } = values; | 162 | const { valueRange, step, unit, outputParam, ...value } = values; |
141 | console.log(valueRange); | 163 | console.log(valueRange); |
142 | console.log(step); | 164 | console.log(step); |
@@ -144,13 +166,26 @@ | @@ -144,13 +166,26 @@ | ||
144 | console.log(outputParam); | 166 | console.log(outputParam); |
145 | return { | 167 | return { |
146 | ...value, | 168 | ...value, |
147 | - ...{ dataSpecs: isStruct ? null : dataSpecs }, | ||
148 | - ...{ dataSpecsList: isStruct ? dataSpecsList : null }, | 169 | + ...{ |
170 | + dataSpecs: | ||
171 | + values.dataType === 'INT' || values.dataType === 'DOUBLE' || values.dataType === 'TEXT' | ||
172 | + ? dataSpecs | ||
173 | + : null, | ||
174 | + }, | ||
175 | + ...{ | ||
176 | + dataSpecsList: | ||
177 | + values.dataType === 'STRUCT' | ||
178 | + ? dataSpecsList | ||
179 | + : values.dataType === 'BOOL' | ||
180 | + ? dataSpecsListBool | ||
181 | + : null, | ||
182 | + }, | ||
149 | }; | 183 | }; |
150 | } | 184 | } |
151 | //清空数据 | 185 | //清空数据 |
152 | const resetFormData = () => { | 186 | const resetFormData = () => { |
153 | resetFields(); | 187 | resetFields(); |
188 | + outputParamData.value = []; | ||
154 | Reflect.set(minMaxObj, 'min', ''); | 189 | Reflect.set(minMaxObj, 'min', ''); |
155 | Reflect.set(minMaxObj, 'max', ''); | 190 | Reflect.set(minMaxObj, 'max', ''); |
156 | }; | 191 | }; |
@@ -74,6 +74,7 @@ | @@ -74,6 +74,7 @@ | ||
74 | isUpdate: false, | 74 | isUpdate: false, |
75 | record: item, | 75 | record: item, |
76 | flag: 'output', | 76 | flag: 'output', |
77 | + excludeStruct: false, | ||
77 | }); | 78 | }); |
78 | }; | 79 | }; |
79 | //回显数据 | 80 | //回显数据 |
@@ -105,6 +106,7 @@ | @@ -105,6 +106,7 @@ | ||
105 | //清空数据 | 106 | //清空数据 |
106 | const resetFormData = () => { | 107 | const resetFormData = () => { |
107 | resetFields(); | 108 | resetFields(); |
109 | + outputParamData.value = []; | ||
108 | }; | 110 | }; |
109 | 111 | ||
110 | defineExpose({ | 112 | defineExpose({ |
@@ -114,6 +114,7 @@ | @@ -114,6 +114,7 @@ | ||
114 | isUpdate: false, | 114 | isUpdate: false, |
115 | record: item, | 115 | record: item, |
116 | flag: 'input', | 116 | flag: 'input', |
117 | + excludeStruct: false, | ||
117 | }); | 118 | }); |
118 | }; | 119 | }; |
119 | const deleteOutParItem = (index) => { | 120 | const deleteOutParItem = (index) => { |
@@ -124,12 +125,12 @@ | @@ -124,12 +125,12 @@ | ||
124 | isUpdate: false, | 125 | isUpdate: false, |
125 | record: item, | 126 | record: item, |
126 | flag: 'output', | 127 | flag: 'output', |
128 | + excludeStruct: false, | ||
127 | }); | 129 | }); |
128 | }; | 130 | }; |
129 | 131 | ||
130 | //回显数据 | 132 | //回显数据 |
131 | const setFormData = (v) => { | 133 | const setFormData = (v) => { |
132 | - console.log(v[0]); | ||
133 | setFieldsValue(v[0]); | 134 | setFieldsValue(v[0]); |
134 | const { inputParams, outputParams } = v[0]; | 135 | const { inputParams, outputParams } = v[0]; |
135 | if (outputParams !== undefined) { | 136 | if (outputParams !== undefined) { |
@@ -168,6 +169,8 @@ | @@ -168,6 +169,8 @@ | ||
168 | //清空数据 | 169 | //清空数据 |
169 | const resetFormData = () => { | 170 | const resetFormData = () => { |
170 | resetFields(); | 171 | resetFields(); |
172 | + inputParamData.value = []; | ||
173 | + outputParamData.value = []; | ||
171 | }; | 174 | }; |
172 | 175 | ||
173 | defineExpose({ | 176 | defineExpose({ |
@@ -3,9 +3,9 @@ | @@ -3,9 +3,9 @@ | ||
3 | <BasicForm @register="registerForm"> | 3 | <BasicForm @register="registerForm"> |
4 | <template #valueRangeSlot> | 4 | <template #valueRangeSlot> |
5 | <div style="display: flex"> | 5 | <div style="display: flex"> |
6 | - <a-input v-model:vlaue="minMaxObj.min" placeholder="最小值" @blur="onInputBlurMin" /> | 6 | + <Input v-model:value="minMaxObj.min" placeholder="最小值" @blur="onInputBlurMin" /> |
7 | <span>~</span> | 7 | <span>~</span> |
8 | - <a-input v-model:vlaue="minMaxObj.max" placeholder="最大值" @blur="onInputBlurMax" /> | 8 | + <Input v-model:value="minMaxObj.max" placeholder="最大值" @blur="onInputBlurMax" /> |
9 | </div> | 9 | </div> |
10 | </template> | 10 | </template> |
11 | <template #structSlot> | 11 | <template #structSlot> |
@@ -40,11 +40,11 @@ | @@ -40,11 +40,11 @@ | ||
40 | import InputParamItem from './InputParamItem.vue'; | 40 | import InputParamItem from './InputParamItem.vue'; |
41 | import AddParamsModal from './AddParamsModal.vue'; | 41 | import AddParamsModal from './AddParamsModal.vue'; |
42 | import { findDictItemByCode } from '/@/api/system/dict'; | 42 | import { findDictItemByCode } from '/@/api/system/dict'; |
43 | - // import { useMessage } from '/@/hooks/web/useMessage'; | ||
44 | - import { validateValueRangeAndStep } from '../../hook/useValidateParital'; | 43 | + import { validateValueRangeAndStep, validateValueBool } from '../../hook/useValidateParital'; |
44 | + import { buildUUID } from '/@/utils/uuid'; | ||
45 | + import { Input } from 'ant-design-vue'; | ||
45 | 46 | ||
46 | defineEmits(['register']); | 47 | defineEmits(['register']); |
47 | - // const { createMessage } = useMessage(); | ||
48 | const outputParamData: any = ref([]); | 48 | const outputParamData: any = ref([]); |
49 | const dynamicBindRef = { | 49 | const dynamicBindRef = { |
50 | outputParamItemRef: ref([]), | 50 | outputParamItemRef: ref([]), |
@@ -70,10 +70,11 @@ | @@ -70,10 +70,11 @@ | ||
70 | 70 | ||
71 | const getData = (d, f) => { | 71 | const getData = (d, f) => { |
72 | if (f == 'output') { | 72 | if (f == 'output') { |
73 | - unref(outputParamData).push(d); | ||
74 | if (d.id !== null) { | 73 | if (d.id !== null) { |
75 | - const findIndex = unref(outputParamData).findIndex((f) => f.id !== d.id); | ||
76 | - if (findIndex !== -1) unref(outputParamData).splice(findIndex, 1); | 74 | + const findIndex = unref(outputParamData).findIndex((f) => f.id == d.id); |
75 | + if (findIndex !== -1) unref(outputParamData).splice(findIndex, 1, d); | ||
76 | + } else { | ||
77 | + unref(outputParamData).push({ ...d, id: buildUUID() }); | ||
77 | } | 78 | } |
78 | } | 79 | } |
79 | }; | 80 | }; |
@@ -94,6 +95,7 @@ | @@ -94,6 +95,7 @@ | ||
94 | isUpdate: false, | 95 | isUpdate: false, |
95 | record: item, | 96 | record: item, |
96 | flag: 'output', | 97 | flag: 'output', |
98 | + excludeStruct: true, | ||
97 | }); | 99 | }); |
98 | }; | 100 | }; |
99 | 101 | ||
@@ -124,26 +126,74 @@ | @@ -124,26 +126,74 @@ | ||
124 | }); | 126 | }); |
125 | }; | 127 | }; |
126 | 128 | ||
129 | + const getOutputStructList = () => { | ||
130 | + const val = unref(dynamicBindRef.outputParamItemRef)?.map((item: any) => item.getFormData()); | ||
131 | + return val; | ||
132 | + }; | ||
127 | const getFormData = async () => { | 133 | const getFormData = async () => { |
128 | const values = await validate(); | 134 | const values = await validate(); |
129 | if (!values) return; | 135 | if (!values) return; |
130 | validateValueRangeAndStep(Number(minMaxObj.min), Number(values.step), Number(minMaxObj.max)); | 136 | validateValueRangeAndStep(Number(minMaxObj.min), Number(values.step), Number(minMaxObj.max)); |
137 | + validateValueBool(Number(values.boolClose), Number(values.boolOpen)); | ||
138 | + const outputParams = getOutputStructList(); | ||
139 | + outputParams.forEach((f) => { | ||
140 | + f.dataType = 'STRUCT'; | ||
141 | + }); | ||
142 | + //int double类型 | ||
131 | const childSpecsDTO = { | 143 | const childSpecsDTO = { |
132 | dataType: values.dataType, | 144 | dataType: values.dataType, |
133 | max: minMaxObj.max, | 145 | max: minMaxObj.max, |
134 | min: minMaxObj.min, | 146 | min: minMaxObj.min, |
135 | step: values.step, | 147 | step: values.step, |
136 | unit: values.unit, | 148 | unit: values.unit, |
149 | + length: values.length, | ||
137 | }; | 150 | }; |
138 | const dataSpecs = childSpecsDTO; | 151 | const dataSpecs = childSpecsDTO; |
139 | - const { step, unit, valueRange, ...value } = values; | 152 | + //bool类型 |
153 | + const childEnumSpecsDTO = [ | ||
154 | + { | ||
155 | + dataType: values.dataType, | ||
156 | + name: values.boolClose, | ||
157 | + value: 0, | ||
158 | + }, | ||
159 | + { | ||
160 | + dataType: values.dataType, | ||
161 | + name: values.boolOpen, | ||
162 | + value: 1, | ||
163 | + }, | ||
164 | + ]; | ||
165 | + const dataSpecsList = childEnumSpecsDTO; | ||
166 | + //text类型 | ||
167 | + //其他类型 | ||
168 | + const { boolClose, boolOpen, step, unit, valueRange, ...value } = values; | ||
140 | console.log(valueRange); | 169 | console.log(valueRange); |
141 | console.log(step); | 170 | console.log(step); |
142 | console.log(unit); | 171 | console.log(unit); |
172 | + console.log(boolClose); | ||
173 | + console.log(boolOpen); | ||
143 | return { | 174 | return { |
144 | ...value, | 175 | ...value, |
145 | - ...{ dataSpecs }, | ||
146 | - ...{ childSpecsDTO }, | 176 | + ...{ |
177 | + dataSpecs: | ||
178 | + values.dataType === 'INT' || values.dataType === 'DOUBLE' || values.dataType === 'TEXT' | ||
179 | + ? dataSpecs | ||
180 | + : null, | ||
181 | + }, | ||
182 | + ...{ | ||
183 | + childSpecsDTO: | ||
184 | + values.dataType === 'INT' || values.dataType === 'DOUBLE' || values.dataType === 'TEXT' | ||
185 | + ? childSpecsDTO | ||
186 | + : null, | ||
187 | + }, | ||
188 | + ...{ | ||
189 | + dataSpecsList: | ||
190 | + values.dataType === 'BOOL' | ||
191 | + ? dataSpecsList | ||
192 | + : values.dataType === 'STRUCT' | ||
193 | + ? outputParams | ||
194 | + : null, | ||
195 | + }, | ||
196 | + ...{ childEnumSpecsDTO: values.dataType === 'BOOL' ? childEnumSpecsDTO : null }, | ||
147 | ...{ | 197 | ...{ |
148 | childDataType: values.dataType, | 198 | childDataType: values.dataType, |
149 | childName: values.name, | 199 | childName: values.name, |
@@ -151,10 +201,35 @@ | @@ -151,10 +201,35 @@ | ||
151 | }; | 201 | }; |
152 | }; | 202 | }; |
153 | const setFormData = (v) => { | 203 | const setFormData = (v) => { |
204 | + console.log('回显', v); | ||
154 | setFieldsValue(v); | 205 | setFieldsValue(v); |
155 | setFieldsValue({ | 206 | setFieldsValue({ |
156 | ...v.dataSpecs, | 207 | ...v.dataSpecs, |
157 | }); | 208 | }); |
209 | + try { | ||
210 | + setFieldsValue({ | ||
211 | + boolClose: v.dataType == 'BOOL' ? v.dataSpecsList[0].name : '', | ||
212 | + boolOpen: v.dataType == 'BOOL' ? v.dataSpecsList[1].name : '', | ||
213 | + }); | ||
214 | + } catch (e) { | ||
215 | + console.log(e); | ||
216 | + } | ||
217 | + const { dataSpecsList, dataType, childDataType } = v; | ||
218 | + if (childDataType == 'BOOL') { | ||
219 | + setFieldsValue({ | ||
220 | + dataType: childDataType, | ||
221 | + boolClose: dataSpecsList[0].name, | ||
222 | + boolOpen: dataSpecsList[1].name, | ||
223 | + }); | ||
224 | + } | ||
225 | + try { | ||
226 | + if (dataType == 'BOOL' || dataType == 'STRUCT') { | ||
227 | + outputParamData.value = [...new Array(dataSpecsList.length).keys()]; | ||
228 | + outputParamData.value = dataSpecsList; | ||
229 | + } | ||
230 | + } catch (e) { | ||
231 | + console.log(e); | ||
232 | + } | ||
158 | nextTick(() => { | 233 | nextTick(() => { |
159 | minMaxObj.min = v?.dataSpecs?.min; | 234 | minMaxObj.min = v?.dataSpecs?.min; |
160 | minMaxObj.max = v?.dataSpecs?.max; | 235 | minMaxObj.max = v?.dataSpecs?.max; |
1 | import { buildUUID } from '/@/utils/uuid'; | 1 | import { buildUUID } from '/@/utils/uuid'; |
2 | 2 | ||
3 | +//模拟阿里云属性服务事件服务端格式 | ||
3 | export const mockData = { | 4 | export const mockData = { |
4 | _ppk: {}, | 5 | _ppk: {}, |
5 | events: [ | 6 | events: [ |
6 | { | 7 | { |
7 | - createTs: 1666344382193, | 8 | + createTs: 1666596472189, |
8 | custom: true, | 9 | custom: true, |
9 | - description: '33', | ||
10 | - eventName: '事件1', | ||
11 | - eventType: 'ALERT_EVENT_TYPE', | ||
12 | - identifier: 'i1', | 10 | + description: '监播动作结果上报事件', |
11 | + eventName: '监播动作结果上报事件', | ||
12 | + eventType: 'INFO_EVENT_TYPE', | ||
13 | + identifier: 'MonitorActionEvent', | ||
13 | outputData: [ | 14 | outputData: [ |
14 | { | 15 | { |
15 | id: buildUUID(), | 16 | id: buildUUID(), |
16 | custom: true, | 17 | custom: true, |
17 | dataSpecs: { | 18 | dataSpecs: { |
18 | dataType: 'INT', | 19 | dataType: 'INT', |
19 | - max: '20', | ||
20 | - min: '10', | ||
21 | - step: '3', | ||
22 | - unit: 'W/㎡', | ||
23 | - unitName: '太阳总辐射', | 20 | + max: '1024', |
21 | + min: '-1024', | ||
22 | + precise: 0, | ||
23 | + step: '1', | ||
24 | + unit: '', | ||
25 | + unitName: '无', | ||
24 | }, | 26 | }, |
25 | dataType: 'INT', | 27 | dataType: 'INT', |
26 | direction: 'PARAM_OUTPUT', | 28 | direction: 'PARAM_OUTPUT', |
27 | - identifier: 'i1', | ||
28 | - name: '参数1', | 29 | + identifier: 'ActionType', |
30 | + name: '监播操作类型', | ||
29 | paraOrder: 0, | 31 | paraOrder: 0, |
30 | }, | 32 | }, |
33 | + { | ||
34 | + id: buildUUID(), | ||
35 | + custom: true, | ||
36 | + dataSpecs: { | ||
37 | + dataType: 'TEXT', | ||
38 | + length: 1024, | ||
39 | + }, | ||
40 | + dataType: 'TEXT', | ||
41 | + direction: 'PARAM_OUTPUT', | ||
42 | + identifier: 'FileKey', | ||
43 | + name: '上传文件ossKey', | ||
44 | + paraOrder: 1, | ||
45 | + }, | ||
46 | + { | ||
47 | + id: buildUUID(), | ||
48 | + custom: true, | ||
49 | + dataSpecsList: [ | ||
50 | + { | ||
51 | + id: buildUUID(), | ||
52 | + dataType: 'BOOL', | ||
53 | + name: '1', | ||
54 | + value: 0, | ||
55 | + }, | ||
56 | + { | ||
57 | + id: buildUUID(), | ||
58 | + dataType: 'BOOL', | ||
59 | + name: '0', | ||
60 | + value: 1, | ||
61 | + }, | ||
62 | + ], | ||
63 | + dataType: 'BOOL', | ||
64 | + direction: 'PARAM_OUTPUT', | ||
65 | + identifier: 'Extension', | ||
66 | + name: '扩展信息', | ||
67 | + paraOrder: 2, | ||
68 | + }, | ||
69 | + { | ||
70 | + id: buildUUID(), | ||
71 | + custom: true, | ||
72 | + dataSpecsList: [ | ||
73 | + { | ||
74 | + id: buildUUID(), | ||
75 | + childDataType: 'DOUBLE', | ||
76 | + childName: '峰值', | ||
77 | + childSpecsDTO: { | ||
78 | + dataType: 'DOUBLE', | ||
79 | + max: '33', | ||
80 | + min: '22', | ||
81 | + step: '2', | ||
82 | + unit: 'm³/s', | ||
83 | + unitName: '立方米每秒', | ||
84 | + }, | ||
85 | + custom: true, | ||
86 | + dataSpecs: { | ||
87 | + dataType: 'DOUBLE', | ||
88 | + max: '33', | ||
89 | + min: '22', | ||
90 | + step: '2', | ||
91 | + unit: 'm³/s', | ||
92 | + unitName: '立方米每秒', | ||
93 | + }, | ||
94 | + dataType: 'STRUCT', | ||
95 | + identifier: 'bass', | ||
96 | + isStd: 0, | ||
97 | + name: '峰值', | ||
98 | + }, | ||
99 | + { | ||
100 | + id: buildUUID(), | ||
101 | + childDataType: 'BOOL', | ||
102 | + childEnumSpecsDTO: [ | ||
103 | + { | ||
104 | + dataType: 'BOOL', | ||
105 | + name: '1', | ||
106 | + value: 0, | ||
107 | + }, | ||
108 | + { | ||
109 | + dataType: 'BOOL', | ||
110 | + name: '0', | ||
111 | + value: 1, | ||
112 | + }, | ||
113 | + ], | ||
114 | + childName: '平均速率', | ||
115 | + custom: true, | ||
116 | + dataSpecsList: [ | ||
117 | + { | ||
118 | + id: buildUUID(), | ||
119 | + dataType: 'BOOL', | ||
120 | + name: '1', | ||
121 | + value: 0, | ||
122 | + }, | ||
123 | + { | ||
124 | + id: buildUUID(), | ||
125 | + dataType: 'BOOL', | ||
126 | + name: '0', | ||
127 | + value: 1, | ||
128 | + }, | ||
129 | + ], | ||
130 | + dataType: 'STRUCT', | ||
131 | + identifier: 'average', | ||
132 | + isStd: 0, | ||
133 | + name: '平均速率', | ||
134 | + }, | ||
135 | + ], | ||
136 | + dataType: 'STRUCT', | ||
137 | + direction: 'PARAM_OUTPUT', | ||
138 | + identifier: 'ceshi', | ||
139 | + name: '网速', | ||
140 | + paraOrder: 3, | ||
141 | + }, | ||
31 | ], | 142 | ], |
32 | productKey: 'hsrnXEfGFDv', | 143 | productKey: 'hsrnXEfGFDv', |
33 | required: false, | 144 | required: false, |
@@ -36,67 +147,123 @@ export const mockData = { | @@ -36,67 +147,123 @@ export const mockData = { | ||
36 | productKey: 'hsrnXEfGFDv', | 147 | productKey: 'hsrnXEfGFDv', |
37 | properties: [ | 148 | properties: [ |
38 | { | 149 | { |
39 | - createTs: 1666259889029, | 150 | + createTs: 1666604372638, |
40 | custom: true, | 151 | custom: true, |
41 | customFlag: true, | 152 | customFlag: true, |
42 | dataSpecsList: [ | 153 | dataSpecsList: [ |
43 | { | 154 | { |
44 | - id: buildUUID(), | 155 | + childDataType: 'BOOL', |
156 | + childEnumSpecsDTO: [ | ||
157 | + { | ||
158 | + dataType: 'BOOL', | ||
159 | + name: '左眼', | ||
160 | + value: 0, | ||
161 | + }, | ||
162 | + { | ||
163 | + dataType: 'BOOL', | ||
164 | + name: '右眼', | ||
165 | + value: 1, | ||
166 | + }, | ||
167 | + ], | ||
168 | + childName: '眼睛', | ||
169 | + custom: true, | ||
170 | + dataSpecsList: [ | ||
171 | + { | ||
172 | + dataType: 'BOOL', | ||
173 | + name: '左眼', | ||
174 | + value: 0, | ||
175 | + }, | ||
176 | + { | ||
177 | + dataType: 'BOOL', | ||
178 | + name: '右眼', | ||
179 | + value: 1, | ||
180 | + }, | ||
181 | + ], | ||
182 | + dataType: 'STRUCT', | ||
183 | + identifier: 'Eye', | ||
184 | + isStd: 0, | ||
185 | + name: '眼睛', | ||
186 | + }, | ||
187 | + { | ||
45 | childDataType: 'INT', | 188 | childDataType: 'INT', |
46 | - childName: '测试参数1', | 189 | + childName: '鼻子', |
47 | childSpecsDTO: { | 190 | childSpecsDTO: { |
48 | dataType: 'INT', | 191 | dataType: 'INT', |
49 | - max: '30', | ||
50 | - min: '20', | ||
51 | - step: '1', | ||
52 | - unit: 'mm/hour', | ||
53 | - unitName: '降雨量', | 192 | + max: '22', |
193 | + min: '12', | ||
194 | + step: '5', | ||
195 | + unit: '只', | ||
196 | + unitName: '只', | ||
54 | }, | 197 | }, |
55 | custom: true, | 198 | custom: true, |
56 | dataSpecs: { | 199 | dataSpecs: { |
57 | dataType: 'INT', | 200 | dataType: 'INT', |
58 | - max: '30', | ||
59 | - min: '20', | ||
60 | - step: '1', | ||
61 | - unit: 'mm/hour', | ||
62 | - unitName: '降雨量', | 201 | + max: '22', |
202 | + min: '12', | ||
203 | + step: '5', | ||
204 | + unit: '只', | ||
205 | + unitName: '只', | ||
63 | }, | 206 | }, |
64 | dataType: 'STRUCT', | 207 | dataType: 'STRUCT', |
65 | - identifier: 'iden2', | 208 | + identifier: 'Boless', |
66 | isStd: 0, | 209 | isStd: 0, |
67 | - name: '测试参数1', | 210 | + name: '鼻子', |
68 | }, | 211 | }, |
69 | { | 212 | { |
70 | - id: buildUUID(), | ||
71 | - childDataType: 'INT', | ||
72 | - childName: '测试参数2', | 213 | + childDataType: 'TEXT', |
214 | + childName: '脸颊', | ||
73 | childSpecsDTO: { | 215 | childSpecsDTO: { |
74 | - dataType: 'INT', | ||
75 | - max: '40', | ||
76 | - min: '30', | ||
77 | - step: '2', | ||
78 | - unit: 'pH', | ||
79 | - unitName: 'PH值', | 216 | + dataType: 'TEXT', |
217 | + length: 10240, | ||
80 | }, | 218 | }, |
81 | custom: true, | 219 | custom: true, |
82 | dataSpecs: { | 220 | dataSpecs: { |
83 | - dataType: 'INT', | ||
84 | - max: '40', | ||
85 | - min: '30', | ||
86 | - step: '2', | ||
87 | - unit: 'pH', | ||
88 | - unitName: 'PH值', | 221 | + dataType: 'TEXT', |
222 | + length: 10240, | ||
89 | }, | 223 | }, |
90 | dataType: 'STRUCT', | 224 | dataType: 'STRUCT', |
91 | - identifier: 'idne2', | 225 | + identifier: 'Facebook', |
92 | isStd: 0, | 226 | isStd: 0, |
93 | - name: '测试参数2', | 227 | + name: '脸颊', |
228 | + }, | ||
229 | + { | ||
230 | + childDataType: 'BOOL', | ||
231 | + childEnumSpecsDTO: [ | ||
232 | + { | ||
233 | + dataType: 'BOOL', | ||
234 | + name: '左耳', | ||
235 | + value: 0, | ||
236 | + }, | ||
237 | + { | ||
238 | + dataType: 'BOOL', | ||
239 | + name: '右耳', | ||
240 | + value: 1, | ||
241 | + }, | ||
242 | + ], | ||
243 | + childName: '耳朵', | ||
244 | + custom: true, | ||
245 | + dataSpecsList: [ | ||
246 | + { | ||
247 | + dataType: 'BOOL', | ||
248 | + name: '左耳', | ||
249 | + value: 0, | ||
250 | + }, | ||
251 | + { | ||
252 | + dataType: 'BOOL', | ||
253 | + name: '右耳', | ||
254 | + value: 1, | ||
255 | + }, | ||
256 | + ], | ||
257 | + dataType: 'STRUCT', | ||
258 | + identifier: 'Eyear', | ||
259 | + isStd: 0, | ||
260 | + name: '耳朵', | ||
94 | }, | 261 | }, |
95 | ], | 262 | ], |
96 | dataType: 'STRUCT', | 263 | dataType: 'STRUCT', |
97 | - description: '21212', | ||
98 | - identifier: 'iden1', | ||
99 | - name: '测试功能', | 264 | + description: '用于人脸特征下发,基于人脸门禁1.0物模型\n设备级开关', |
265 | + identifier: 'SupportFaceFeature', | ||
266 | + name: '支持人脸特征下发', | ||
100 | productKey: 'hsrnXEfGFDv', | 267 | productKey: 'hsrnXEfGFDv', |
101 | required: false, | 268 | required: false, |
102 | rwFlag: 'READ_WRITE', | 269 | rwFlag: 'READ_WRITE', |
@@ -105,249 +272,329 @@ export const mockData = { | @@ -105,249 +272,329 @@ export const mockData = { | ||
105 | ], | 272 | ], |
106 | services: [ | 273 | services: [ |
107 | { | 274 | { |
108 | - callType: 'ASYNC', | ||
109 | - createTs: 1666343456853, | 275 | + callType: 'SYNC', |
276 | + createTs: 1666603858325, | ||
110 | custom: true, | 277 | custom: true, |
111 | - description: '4343', | ||
112 | - identifier: 'Iide1', | 278 | + description: '更新模型', |
279 | + identifier: 'UpdateModel', | ||
113 | inputParams: [ | 280 | inputParams: [ |
114 | { | 281 | { |
115 | id: buildUUID(), | 282 | id: buildUUID(), |
116 | custom: true, | 283 | custom: true, |
117 | dataSpecs: { | 284 | dataSpecs: { |
285 | + dataType: 'TEXT', | ||
286 | + length: 128, | ||
287 | + }, | ||
288 | + dataType: 'TEXT', | ||
289 | + direction: 'PARAM_INPUT', | ||
290 | + identifier: 'UpdateTaskID', | ||
291 | + name: '更新任务ID', | ||
292 | + paraOrder: 0, | ||
293 | + }, | ||
294 | + { | ||
295 | + id: buildUUID(), | ||
296 | + custom: true, | ||
297 | + dataSpecs: { | ||
298 | + dataType: 'TEXT', | ||
299 | + length: 128, | ||
300 | + }, | ||
301 | + dataType: 'TEXT', | ||
302 | + direction: 'PARAM_INPUT', | ||
303 | + identifier: 'AlgorithmID', | ||
304 | + name: '算法任务唯一标识', | ||
305 | + paraOrder: 1, | ||
306 | + }, | ||
307 | + { | ||
308 | + id: buildUUID(), | ||
309 | + | ||
310 | + custom: true, | ||
311 | + dataSpecs: { | ||
312 | + dataType: 'TEXT', | ||
313 | + length: 64, | ||
314 | + }, | ||
315 | + dataType: 'TEXT', | ||
316 | + direction: 'PARAM_INPUT', | ||
317 | + identifier: 'AlgorithmName', | ||
318 | + name: '算法名称', | ||
319 | + paraOrder: 2, | ||
320 | + }, | ||
321 | + { | ||
322 | + id: buildUUID(), | ||
323 | + | ||
324 | + custom: true, | ||
325 | + dataSpecs: { | ||
118 | dataType: 'INT', | 326 | dataType: 'INT', |
119 | - max: '20', | ||
120 | - min: '10', | ||
121 | - step: '2', | ||
122 | - unit: 'dS/m', | ||
123 | - unitName: '土壤EC值', | 327 | + max: '128', |
328 | + min: '0', | ||
329 | + precise: 0, | ||
330 | + step: '1', | ||
331 | + unit: '', | ||
332 | + unitName: '无', | ||
124 | }, | 333 | }, |
125 | dataType: 'INT', | 334 | dataType: 'INT', |
126 | direction: 'PARAM_INPUT', | 335 | direction: 'PARAM_INPUT', |
127 | - identifier: 'i1', | ||
128 | - name: '参数名字1', | ||
129 | - paraOrder: 0, | 336 | + identifier: 'NumThreads', |
337 | + name: '使用线程数', | ||
338 | + paraOrder: 4, | ||
339 | + }, | ||
340 | + { | ||
341 | + id: buildUUID(), | ||
342 | + | ||
343 | + custom: true, | ||
344 | + dataSpecs: { | ||
345 | + dataType: 'TEXT', | ||
346 | + length: 128, | ||
347 | + }, | ||
348 | + dataType: 'TEXT', | ||
349 | + direction: 'PARAM_INPUT', | ||
350 | + identifier: 'ModelID', | ||
351 | + name: '模型唯一标识', | ||
352 | + paraOrder: 5, | ||
353 | + }, | ||
354 | + { | ||
355 | + id: buildUUID(), | ||
356 | + | ||
357 | + custom: true, | ||
358 | + dataSpecs: { | ||
359 | + dataType: 'TEXT', | ||
360 | + length: 64, | ||
361 | + }, | ||
362 | + dataType: 'TEXT', | ||
363 | + direction: 'PARAM_INPUT', | ||
364 | + identifier: 'ModelName', | ||
365 | + name: '模型名称', | ||
366 | + paraOrder: 6, | ||
367 | + }, | ||
368 | + { | ||
369 | + id: buildUUID(), | ||
370 | + | ||
371 | + custom: true, | ||
372 | + dataSpecs: { | ||
373 | + dataType: 'TEXT', | ||
374 | + length: 64, | ||
375 | + }, | ||
376 | + dataType: 'TEXT', | ||
377 | + direction: 'PARAM_INPUT', | ||
378 | + identifier: 'ModelVersion', | ||
379 | + name: '模型版本', | ||
380 | + paraOrder: 7, | ||
381 | + }, | ||
382 | + { | ||
383 | + id: buildUUID(), | ||
384 | + | ||
385 | + custom: true, | ||
386 | + dataSpecs: { | ||
387 | + dataType: 'TEXT', | ||
388 | + length: 1024, | ||
389 | + }, | ||
390 | + dataType: 'TEXT', | ||
391 | + direction: 'PARAM_INPUT', | ||
392 | + identifier: 'ModelURL', | ||
393 | + name: '模型地址', | ||
394 | + paraOrder: 8, | ||
395 | + }, | ||
396 | + { | ||
397 | + id: buildUUID(), | ||
398 | + | ||
399 | + custom: true, | ||
400 | + dataSpecs: { | ||
401 | + dataType: 'TEXT', | ||
402 | + length: 128, | ||
403 | + }, | ||
404 | + dataType: 'TEXT', | ||
405 | + direction: 'PARAM_INPUT', | ||
406 | + identifier: 'ModelMD5', | ||
407 | + name: '模型文件MD5', | ||
408 | + paraOrder: 9, | ||
409 | + }, | ||
410 | + { | ||
411 | + id: buildUUID(), | ||
412 | + | ||
413 | + custom: true, | ||
414 | + dataSpecs: { | ||
415 | + dataType: 'TEXT', | ||
416 | + length: 64, | ||
417 | + }, | ||
418 | + dataType: 'TEXT', | ||
419 | + direction: 'PARAM_INPUT', | ||
420 | + identifier: 'ModelPlatform', | ||
421 | + name: '模型平台', | ||
422 | + paraOrder: 10, | ||
423 | + }, | ||
424 | + { | ||
425 | + id: buildUUID(), | ||
426 | + | ||
427 | + custom: true, | ||
428 | + dataSpecs: { | ||
429 | + dataType: 'TEXT', | ||
430 | + length: 128, | ||
431 | + }, | ||
432 | + dataType: 'TEXT', | ||
433 | + direction: 'PARAM_INPUT', | ||
434 | + identifier: 'ModelTaskID', | ||
435 | + name: '模型生成任务ID', | ||
436 | + paraOrder: 11, | ||
437 | + }, | ||
438 | + { | ||
439 | + id: buildUUID(), | ||
440 | + | ||
441 | + custom: true, | ||
442 | + dataSpecs: { | ||
443 | + dataType: 'TEXT', | ||
444 | + length: 64, | ||
445 | + }, | ||
446 | + dataType: 'TEXT', | ||
447 | + direction: 'PARAM_INPUT', | ||
448 | + identifier: 'ModelEncryptType', | ||
449 | + name: '模型加密方式', | ||
450 | + paraOrder: 12, | ||
451 | + }, | ||
452 | + { | ||
453 | + id: buildUUID(), | ||
454 | + | ||
455 | + custom: true, | ||
456 | + dataSpecs: { | ||
457 | + dataType: 'TEXT', | ||
458 | + length: 2048, | ||
459 | + }, | ||
460 | + dataType: 'TEXT', | ||
461 | + direction: 'PARAM_INPUT', | ||
462 | + identifier: 'ModelExtension', | ||
463 | + name: '扩展信息', | ||
464 | + paraOrder: 13, | ||
465 | + }, | ||
466 | + { | ||
467 | + id: buildUUID(), | ||
468 | + | ||
469 | + custom: true, | ||
470 | + dataSpecsList: [ | ||
471 | + { | ||
472 | + id: buildUUID(), | ||
473 | + | ||
474 | + childDataType: 'TEXT', | ||
475 | + childName: '模型结构体参数1', | ||
476 | + childSpecsDTO: { | ||
477 | + dataType: 'TEXT', | ||
478 | + length: 10240, | ||
479 | + }, | ||
480 | + custom: true, | ||
481 | + dataSpecs: { | ||
482 | + dataType: 'TEXT', | ||
483 | + length: 10240, | ||
484 | + }, | ||
485 | + dataType: 'STRUCT', | ||
486 | + identifier: 'ModelParams1', | ||
487 | + isStd: 0, | ||
488 | + name: '模型结构体参数1', | ||
489 | + }, | ||
490 | + { | ||
491 | + id: buildUUID(), | ||
492 | + | ||
493 | + childDataType: 'BOOL', | ||
494 | + childEnumSpecsDTO: [ | ||
495 | + { | ||
496 | + dataType: 'BOOL', | ||
497 | + name: '1', | ||
498 | + value: 0, | ||
499 | + }, | ||
500 | + { | ||
501 | + dataType: 'BOOL', | ||
502 | + name: '0', | ||
503 | + value: 1, | ||
504 | + }, | ||
505 | + ], | ||
506 | + childName: '模型结构体参数2', | ||
507 | + custom: true, | ||
508 | + dataSpecsList: [ | ||
509 | + { | ||
510 | + id: buildUUID(), | ||
511 | + | ||
512 | + dataType: 'BOOL', | ||
513 | + name: '1', | ||
514 | + value: 0, | ||
515 | + }, | ||
516 | + { | ||
517 | + id: buildUUID(), | ||
518 | + | ||
519 | + dataType: 'BOOL', | ||
520 | + name: '0', | ||
521 | + value: 1, | ||
522 | + }, | ||
523 | + ], | ||
524 | + dataType: 'STRUCT', | ||
525 | + identifier: 'ModelParams2', | ||
526 | + isStd: 0, | ||
527 | + name: '模型结构体参数2', | ||
528 | + }, | ||
529 | + ], | ||
530 | + dataType: 'STRUCT', | ||
531 | + direction: 'PARAM_INPUT', | ||
532 | + identifier: 'ModelStruct', | ||
533 | + name: '模型结构体', | ||
534 | + paraOrder: 3, | ||
130 | }, | 535 | }, |
131 | ], | 536 | ], |
132 | outputParams: [ | 537 | outputParams: [ |
133 | { | 538 | { |
134 | id: buildUUID(), | 539 | id: buildUUID(), |
540 | + | ||
541 | + custom: true, | ||
542 | + dataSpecs: { | ||
543 | + dataType: 'TEXT', | ||
544 | + length: 10240, | ||
545 | + }, | ||
546 | + dataType: 'TEXT', | ||
547 | + direction: 'PARAM_OUTPUT', | ||
548 | + identifier: 'Django', | ||
549 | + name: 'django', | ||
550 | + paraOrder: 0, | ||
551 | + }, | ||
552 | + { | ||
553 | + id: buildUUID(), | ||
554 | + | ||
555 | + custom: true, | ||
556 | + dataSpecsList: [ | ||
557 | + { | ||
558 | + id: buildUUID(), | ||
559 | + | ||
560 | + dataType: 'BOOL', | ||
561 | + name: '1', | ||
562 | + value: 0, | ||
563 | + }, | ||
564 | + { | ||
565 | + id: buildUUID(), | ||
566 | + dataType: 'BOOL', | ||
567 | + name: '0', | ||
568 | + value: 1, | ||
569 | + }, | ||
570 | + ], | ||
571 | + dataType: 'BOOL', | ||
572 | + direction: 'PARAM_OUTPUT', | ||
573 | + identifier: 'Flask', | ||
574 | + name: 'flask', | ||
575 | + paraOrder: 1, | ||
576 | + }, | ||
577 | + { | ||
578 | + id: buildUUID(), | ||
135 | custom: true, | 579 | custom: true, |
136 | dataSpecs: { | 580 | dataSpecs: { |
137 | dataType: 'INT', | 581 | dataType: 'INT', |
138 | - max: '20', | ||
139 | - min: '10', | 582 | + max: '22', |
583 | + min: '11', | ||
140 | step: '3', | 584 | step: '3', |
141 | - unit: 'pH', | ||
142 | - unitName: 'PH值', | 585 | + unit: '只', |
586 | + unitName: '只', | ||
143 | }, | 587 | }, |
144 | dataType: 'INT', | 588 | dataType: 'INT', |
145 | direction: 'PARAM_OUTPUT', | 589 | direction: 'PARAM_OUTPUT', |
146 | - identifier: 'i2', | ||
147 | - name: '输出参数2', | ||
148 | - paraOrder: 0, | 590 | + identifier: 'Tornado', |
591 | + name: 'tornado', | ||
592 | + paraOrder: 2, | ||
149 | }, | 593 | }, |
150 | ], | 594 | ], |
151 | productKey: 'hsrnXEfGFDv', | 595 | productKey: 'hsrnXEfGFDv', |
152 | required: false, | 596 | required: false, |
153 | - serviceName: '服务1', | 597 | + serviceName: '更新模型', |
154 | }, | 598 | }, |
155 | ], | 599 | ], |
156 | }; | 600 | }; |
157 | - | ||
158 | -// { | ||
159 | -// _ppk: {}, | ||
160 | -// events: [], | ||
161 | -// productKey: 'hsrnXEfGFDv', | ||
162 | -// properties: [ | ||
163 | -// { | ||
164 | -// createTs: 1666259889029, | ||
165 | -// custom: true, | ||
166 | -// customFlag: true, | ||
167 | -// dataSpecsList: [ | ||
168 | -// { | ||
169 | -// id: buildUUID(), | ||
170 | -// childDataType: 'INT', | ||
171 | -// childName: '测试参数1', | ||
172 | -// childSpecsDTO: { | ||
173 | -// dataType: 'INT', | ||
174 | -// max: '30', | ||
175 | -// min: '20', | ||
176 | -// step: '1', | ||
177 | -// unit: 'mm/hour', | ||
178 | -// unitName: '降雨量', | ||
179 | -// }, | ||
180 | -// custom: true, | ||
181 | -// dataSpecs: { | ||
182 | -// dataType: 'INT', | ||
183 | -// max: '30', | ||
184 | -// min: '20', | ||
185 | -// step: '1', | ||
186 | -// unit: 'mm/hour', | ||
187 | -// unitName: '降雨量', | ||
188 | -// }, | ||
189 | -// dataType: 'STRUCT', | ||
190 | -// identifier: 'iden2', | ||
191 | -// isStd: 0, | ||
192 | -// name: '测试参数1', | ||
193 | -// }, | ||
194 | -// { | ||
195 | -// id: buildUUID(), | ||
196 | -// childDataType: 'INT', | ||
197 | -// childName: '测试参数2', | ||
198 | -// childSpecsDTO: { | ||
199 | -// dataType: 'INT', | ||
200 | -// max: '40', | ||
201 | -// min: '30', | ||
202 | -// step: '2', | ||
203 | -// unit: 'pH', | ||
204 | -// unitName: 'PH值', | ||
205 | -// }, | ||
206 | -// custom: true, | ||
207 | -// dataSpecs: { | ||
208 | -// dataType: 'INT', | ||
209 | -// max: '40', | ||
210 | -// min: '30', | ||
211 | -// step: '2', | ||
212 | -// unit: 'pH', | ||
213 | -// unitName: 'PH值', | ||
214 | -// }, | ||
215 | -// dataType: 'STRUCT', | ||
216 | -// identifier: 'idne2', | ||
217 | -// isStd: 0, | ||
218 | -// name: '测试参数2', | ||
219 | -// }, | ||
220 | -// ], | ||
221 | -// dataType: 'STRUCT', | ||
222 | -// description: '21212', | ||
223 | -// identifier: 'iden1', | ||
224 | -// name: '测试功能', | ||
225 | -// productKey: 'hsrnXEfGFDv', | ||
226 | -// required: false, | ||
227 | -// rwFlag: 'READ_WRITE', | ||
228 | -// std: false, | ||
229 | -// }, | ||
230 | -// ], | ||
231 | -// services: [], | ||
232 | -// }; | ||
233 | - | ||
234 | -// { | ||
235 | -// "_ppk": {}, | ||
236 | -// "events": [], | ||
237 | -// "productKey": "hsrnXEfGFDv", | ||
238 | -// "properties": [ | ||
239 | -// { | ||
240 | -// "createTs": 1666259889029, | ||
241 | -// "custom": true, | ||
242 | -// "customFlag": true, | ||
243 | -// "dataSpecsList": [ | ||
244 | -// { | ||
245 | -// "childDataType": "INT", | ||
246 | -// "childName": "测试参数1", | ||
247 | -// "childSpecsDTO": { | ||
248 | -// "dataType": "INT", | ||
249 | -// "max": "30", | ||
250 | -// "min": "20", | ||
251 | -// "step": "1", | ||
252 | -// "unit": "mm/hour", | ||
253 | -// "unitName": "降雨量" | ||
254 | -// }, | ||
255 | -// "custom": true, | ||
256 | -// "dataSpecs": { | ||
257 | -// "dataType": "INT", | ||
258 | -// "max": "30", | ||
259 | -// "min": "20", | ||
260 | -// "step": "1", | ||
261 | -// "unit": "mm/hour", | ||
262 | -// "unitName": "降雨量" | ||
263 | -// }, | ||
264 | -// "dataType": "STRUCT", | ||
265 | -// "identifier": "iden2", | ||
266 | -// "isStd": 0, | ||
267 | -// "name": "测试参数1" | ||
268 | -// }, | ||
269 | -// { | ||
270 | -// "childDataType": "INT", | ||
271 | -// "childName": "测试参数2", | ||
272 | -// "childSpecsDTO": { | ||
273 | -// "dataType": "INT", | ||
274 | -// "max": "40", | ||
275 | -// "min": "30", | ||
276 | -// "step": "2", | ||
277 | -// "unit": "pH", | ||
278 | -// "unitName": "PH值" | ||
279 | -// }, | ||
280 | -// "custom": true, | ||
281 | -// "dataSpecs": { | ||
282 | -// "dataType": "INT", | ||
283 | -// "max": "40", | ||
284 | -// "min": "30", | ||
285 | -// "step": "2", | ||
286 | -// "unit": "pH", | ||
287 | -// "unitName": "PH值" | ||
288 | -// }, | ||
289 | -// "dataType": "STRUCT", | ||
290 | -// "identifier": "idne2", | ||
291 | -// "isStd": 0, | ||
292 | -// "name": "测试参数2" | ||
293 | -// } | ||
294 | -// ], | ||
295 | -// "dataType": "STRUCT", | ||
296 | -// "description": "21212", | ||
297 | -// "identifier": "iden1", | ||
298 | -// "name": "测试功能", | ||
299 | -// "productKey": "hsrnXEfGFDv", | ||
300 | -// "required": false, | ||
301 | -// "rwFlag": "READ_WRITE", | ||
302 | -// "std": false | ||
303 | -// } | ||
304 | -// ], | ||
305 | -// "services": [ | ||
306 | -// { | ||
307 | -// "callType": "ASYNC", | ||
308 | -// "createTs": 1666343456853, | ||
309 | -// "custom": true, | ||
310 | -// "description": "4343", | ||
311 | -// "identifier": "Iide1", | ||
312 | -// "inputParams": [ | ||
313 | -// { | ||
314 | -// "custom": true, | ||
315 | -// "dataSpecs": { | ||
316 | -// "dataType": "INT", | ||
317 | -// "max": "20", | ||
318 | -// "min": "10", | ||
319 | -// "step": "2", | ||
320 | -// "unit": "dS/m", | ||
321 | -// "unitName": "土壤EC值" | ||
322 | -// }, | ||
323 | -// "dataType": "INT", | ||
324 | -// "direction": "PARAM_INPUT", | ||
325 | -// "identifier": "i1", | ||
326 | -// "name": "参数名字1", | ||
327 | -// "paraOrder": 0 | ||
328 | -// } | ||
329 | -// ], | ||
330 | -// "outputParams": [ | ||
331 | -// { | ||
332 | -// "custom": true, | ||
333 | -// "dataSpecs": { | ||
334 | -// "dataType": "INT", | ||
335 | -// "max": "20", | ||
336 | -// "min": "10", | ||
337 | -// "step": "3", | ||
338 | -// "unit": "pH", | ||
339 | -// "unitName": "PH值" | ||
340 | -// }, | ||
341 | -// "dataType": "INT", | ||
342 | -// "direction": "PARAM_OUTPUT", | ||
343 | -// "identifier": "i2", | ||
344 | -// "name": "输出参数2", | ||
345 | -// "paraOrder": 0 | ||
346 | -// } | ||
347 | -// ], | ||
348 | -// "productKey": "hsrnXEfGFDv", | ||
349 | -// "required": false, | ||
350 | -// "serviceName": "服务1" | ||
351 | -// } | ||
352 | -// ] | ||
353 | -// } |
@@ -139,14 +139,17 @@ export const attrSchemas: FormSchema[] = [ | @@ -139,14 +139,17 @@ export const attrSchemas: FormSchema[] = [ | ||
139 | }, | 139 | }, |
140 | { | 140 | { |
141 | field: 'length', | 141 | field: 'length', |
142 | - component: 'Input', | 142 | + component: 'InputNumber', |
143 | required: true, | 143 | required: true, |
144 | label: '数据长度', | 144 | label: '数据长度', |
145 | - defaultValue: '10240', | 145 | + defaultValue: 10240, |
146 | colProps: { | 146 | colProps: { |
147 | - span: 18, | 147 | + span: 8, |
148 | + }, | ||
149 | + componentProps: { | ||
150 | + max: 10240, | ||
151 | + min: 1, | ||
148 | }, | 152 | }, |
149 | - suffix: '字节', | ||
150 | ifShow: ({ values }) => isString(values.dataType), | 153 | ifShow: ({ values }) => isString(values.dataType), |
151 | }, | 154 | }, |
152 | { | 155 | { |
@@ -224,7 +227,7 @@ export const serviceSchemas: FormSchema[] = [ | @@ -224,7 +227,7 @@ export const serviceSchemas: FormSchema[] = [ | ||
224 | colProps: { | 227 | colProps: { |
225 | span: 24, | 228 | span: 24, |
226 | }, | 229 | }, |
227 | - defaultValue: 'asynchronous', | 230 | + defaultValue: 'ASYNC', |
228 | componentProps: { | 231 | componentProps: { |
229 | placeholder: '请选择调用方式', | 232 | placeholder: '请选择调用方式', |
230 | api: findDictItemByCode, | 233 | api: findDictItemByCode, |
@@ -296,7 +299,7 @@ export const eventSchemas: FormSchema[] = [ | @@ -296,7 +299,7 @@ export const eventSchemas: FormSchema[] = [ | ||
296 | colProps: { | 299 | colProps: { |
297 | span: 24, | 300 | span: 24, |
298 | }, | 301 | }, |
299 | - defaultValue: 'message', | 302 | + defaultValue: 'INFO_EVENT_TYPE', |
300 | componentProps: { | 303 | componentProps: { |
301 | placeholder: '请选择事件类型', | 304 | placeholder: '请选择事件类型', |
302 | api: findDictItemByCode, | 305 | api: findDictItemByCode, |
@@ -400,7 +403,7 @@ export const addParamsSchemas: FormSchema[] = [ | @@ -400,7 +403,7 @@ export const addParamsSchemas: FormSchema[] = [ | ||
400 | { | 403 | { |
401 | field: 'structSlot', | 404 | field: 'structSlot', |
402 | label: 'JSON 对象', | 405 | label: 'JSON 对象', |
403 | - required: true, | 406 | + // required: true, |
404 | component: 'Input', | 407 | component: 'Input', |
405 | slot: 'structSlot', | 408 | slot: 'structSlot', |
406 | colProps: { | 409 | colProps: { |
@@ -436,14 +439,17 @@ export const addParamsSchemas: FormSchema[] = [ | @@ -436,14 +439,17 @@ export const addParamsSchemas: FormSchema[] = [ | ||
436 | }, | 439 | }, |
437 | { | 440 | { |
438 | field: 'length', | 441 | field: 'length', |
439 | - component: 'Input', | 442 | + component: 'InputNumber', |
440 | required: true, | 443 | required: true, |
441 | label: '数据长度', | 444 | label: '数据长度', |
442 | - defaultValue: '10240', | 445 | + defaultValue: 10240, |
443 | colProps: { | 446 | colProps: { |
444 | - span: 24, | 447 | + span: 8, |
448 | + }, | ||
449 | + componentProps: { | ||
450 | + max: 50000, | ||
451 | + min: 1, | ||
445 | }, | 452 | }, |
446 | - suffix: '字节', | ||
447 | ifShow: ({ values }) => isString(values.dataType), | 453 | ifShow: ({ values }) => isString(values.dataType), |
448 | }, | 454 | }, |
449 | { | 455 | { |
@@ -14,3 +14,10 @@ export const validateValueRangeAndStep = (min, step, max) => { | @@ -14,3 +14,10 @@ export const validateValueRangeAndStep = (min, step, max) => { | ||
14 | throw '步长不能大于取值范围的差值'; | 14 | throw '步长不能大于取值范围的差值'; |
15 | } | 15 | } |
16 | }; | 16 | }; |
17 | + | ||
18 | +export const validateValueBool = (boolClose, boolOpen) => { | ||
19 | + if (boolClose == boolOpen) { | ||
20 | + createMessage.error('布尔值不能相同'); | ||
21 | + throw '布尔值不能相同'; | ||
22 | + } | ||
23 | +}; |
@@ -39,7 +39,9 @@ | @@ -39,7 +39,9 @@ | ||
39 | import { Select } from 'ant-design-vue'; | 39 | import { Select } from 'ant-design-vue'; |
40 | import { useModal } from '/@/components/Modal'; | 40 | import { useModal } from '/@/components/Modal'; |
41 | import ConverScriptModal from './ConverScriptModal.vue'; | 41 | import ConverScriptModal from './ConverScriptModal.vue'; |
42 | + import { useMessage } from '/@/hooks/web/useMessage'; | ||
42 | 43 | ||
44 | + const { createMessage } = useMessage(); | ||
43 | const selectScript = reactive({ | 45 | const selectScript = reactive({ |
44 | script: null, | 46 | script: null, |
45 | }); | 47 | }); |
@@ -78,6 +80,10 @@ | @@ -78,6 +80,10 @@ | ||
78 | }; | 80 | }; |
79 | 81 | ||
80 | const getFormData = () => { | 82 | const getFormData = () => { |
83 | + if (!selectScript.script) { | ||
84 | + createMessage.error('请选择转换脚本'); | ||
85 | + throw '请选择转换脚本'; | ||
86 | + } | ||
81 | const value = { | 87 | const value = { |
82 | ...{ | 88 | ...{ |
83 | scriptId: selectScript.script, | 89 | scriptId: selectScript.script, |
@@ -16,16 +16,16 @@ | @@ -16,16 +16,16 @@ | ||
16 | <a-input v-if="ifAdd" v-model:value="scriptForm.scriptName" placeholder="请输入脚本名称" /> | 16 | <a-input v-if="ifAdd" v-model:value="scriptForm.scriptName" placeholder="请输入脚本名称" /> |
17 | <a-input v-else v-model:value="scriptForm.inputParams" placeholder="请输入参数" /> | 17 | <a-input v-else v-model:value="scriptForm.inputParams" placeholder="请输入参数" /> |
18 | </a-form-item> | 18 | </a-form-item> |
19 | - <a-form-item label="上报数据类型" name="reportType"> | 19 | + <a-form-item |
20 | + label="上报数据类型" | ||
21 | + name="reportType" | ||
22 | + :rules="[{ required: true, message: '请选择上报数据类型' }]" | ||
23 | + > | ||
20 | <a-space direction="vertical"> | 24 | <a-space direction="vertical"> |
21 | <a-radio-group v-model:value="scriptForm.reportType" :options="typeOptions" /> | 25 | <a-radio-group v-model:value="scriptForm.reportType" :options="typeOptions" /> |
22 | </a-space> | 26 | </a-space> |
23 | </a-form-item> | 27 | </a-form-item> |
24 | - <a-form-item | ||
25 | - label="脚本内容" | ||
26 | - name="scriptContent" | ||
27 | - :rules="[{ required: true, message: '请输入脚本内容' }]" | ||
28 | - > | 28 | + <a-form-item label="脚本内容" name="scriptContent"> |
29 | <Card title="脚本内容" :bodyStyle="{ padding: 0, height: '280px' }"> | 29 | <Card title="脚本内容" :bodyStyle="{ padding: 0, height: '280px' }"> |
30 | <template #extra> | 30 | <template #extra> |
31 | <a-button @click="handleFormat" size="small">格式化</a-button> | 31 | <a-button @click="handleFormat" size="small">格式化</a-button> |
@@ -60,7 +60,7 @@ | @@ -60,7 +60,7 @@ | ||
60 | </div> | 60 | </div> |
61 | </template> | 61 | </template> |
62 | <script setup lang="ts"> | 62 | <script setup lang="ts"> |
63 | - import { ref, unref, reactive, onMounted, toRef } from 'vue'; | 63 | + import { ref, unref, reactive, onMounted, toRefs } from 'vue'; |
64 | import ace from 'ace-builds'; | 64 | import ace from 'ace-builds'; |
65 | import { Card, Button } from 'ant-design-vue'; | 65 | import { Card, Button } from 'ant-design-vue'; |
66 | import 'ace-builds/src-noconflict/theme-chrome'; // 默认设置的主题 | 66 | import 'ace-builds/src-noconflict/theme-chrome'; // 默认设置的主题 |
@@ -81,12 +81,12 @@ | @@ -81,12 +81,12 @@ | ||
81 | scriptContent: '', | 81 | scriptContent: '', |
82 | inputParams: '', | 82 | inputParams: '', |
83 | outputParams: '', | 83 | outputParams: '', |
84 | - reportType: ['define 16'], | 84 | + reportType: 'HEX', |
85 | }); | 85 | }); |
86 | const reportTypeOptions = reactive({ | 86 | const reportTypeOptions = reactive({ |
87 | typeOptions: [], | 87 | typeOptions: [], |
88 | }); | 88 | }); |
89 | - const typeOptions = toRef(reportTypeOptions, 'typeOptions'); | 89 | + const { typeOptions } = toRefs(reportTypeOptions); |
90 | const { createMessage } = useMessage(); | 90 | const { createMessage } = useMessage(); |
91 | const { clipboardRef, copiedRef } = useCopyToClipboard(); | 91 | const { clipboardRef, copiedRef } = useCopyToClipboard(); |
92 | const aceEditor = ref(); | 92 | const aceEditor = ref(); |
@@ -144,8 +144,16 @@ | @@ -144,8 +144,16 @@ | ||
144 | const formRef = ref(); | 144 | const formRef = ref(); |
145 | const getFormData = async () => { | 145 | const getFormData = async () => { |
146 | const value = await formRef.value.validateFields(); | 146 | const value = await formRef.value.validateFields(); |
147 | + scriptForm.scriptContent = aceEditor.value.getValue(); | ||
148 | + if (scriptForm.scriptContent == '') { | ||
149 | + createMessage.error('请编写脚本内容'); | ||
150 | + throw '请编写脚本内容'; | ||
151 | + } | ||
147 | if (!value) return; | 152 | if (!value) return; |
148 | - return value; | 153 | + return { |
154 | + ...value, | ||
155 | + ...{ scriptContent: scriptForm.scriptContent }, | ||
156 | + }; | ||
149 | }; | 157 | }; |
150 | const setFormData = (v) => { | 158 | const setFormData = (v) => { |
151 | for (let i in scriptForm) { | 159 | for (let i in scriptForm) { |
@@ -90,6 +90,7 @@ export const formSchema: FormSchema[] = [ | @@ -90,6 +90,7 @@ export const formSchema: FormSchema[] = [ | ||
90 | colProps: { | 90 | colProps: { |
91 | span: 23, | 91 | span: 23, |
92 | }, | 92 | }, |
93 | + defaultValue: 'HEX', | ||
93 | componentProps: { | 94 | componentProps: { |
94 | placeholder: '请上报数据类型', | 95 | placeholder: '请上报数据类型', |
95 | api: findDictItemByCode, | 96 | api: findDictItemByCode, |