Commit 263d95a9053a6b00add37ce3eaa2dc75e32544eb

Authored by fengtao
1 parent 490a39e6

pref:优化物模型 封装输入参数输出参数通用表单 优化相关代码

... ... @@ -2,24 +2,15 @@
2 2 <div>
3 3 <BasicForm @register="register">
4 4 <template #outputParamSlot>
5   - <div>
6   - <template v-for="(item, index) in outputParamData" :key="item">
7   - <span style="display: none">{{ item + index }}</span>
8   - <InputParamItem
9   - :title="item.name"
10   - :item="item"
11   - class="mt-4"
12   - :index="item.id"
13   - :ref="dynamicBindRef.outputParamItemRef"
14   - @delete="deleteOutParItem"
15   - @edit="editOutParItem"
16   - />
17   - </template>
18   - <div style="display: flex" :class="{ 'mt-2': outputParamData.length > 0 }">
19   - <span class="add-style">+</span>
20   - <span class="add-style" @click="handleAddOutParam">增加参数</span>
21   - </div>
22   - </div>
  5 + <CommomParam
  6 + ref="CommomParamInParamRef"
  7 + :isExcludeStruct="true"
  8 + :isInputParam="true"
  9 + :inputParamData="inputParamData"
  10 + @emitAddInParam="handleAddInParam"
  11 + @emitEditInParam="handleEditInParam"
  12 + @emitDeletelnParam="handleDelInParam"
  13 + />
23 14 </template>
24 15 </BasicForm>
25 16 <AddParamsModal @register="registerModal" @data="getData" />
... ... @@ -30,16 +21,15 @@
30 21 import { BasicForm, useForm } from '/@/components/Form';
31 22 import { attrSchemas } from './config';
32 23 import { useModal } from '/@/components/Modal';
33   - import InputParamItem from './components/InputParamItem.vue';
34   - import AddParamsModal from './components/AddParamsModal.vue';
35 24 import { validateValueStruct } from '../hook/useValidateParital';
36 25 import { useChangeTypeGetTypeForm } from '../hook/useTypeGetForm';
37 26 import { buildUUID } from '/@/utils/uuid';
  27 + import AddParamsModal from './components/AddParamsModal.vue';
  28 + import CommomParam from './components/CommomParam.vue';
38 29
39   - const outputParamData: any = ref([]);
40   - const dynamicBindRef = {
41   - outputParamItemRef: ref([]),
42   - };
  30 + const inputParamData: any = ref([]);
  31 +
  32 + const CommomParamInParamRef = ref<InstanceType<typeof CommomParam>>();
43 33
44 34 const [registerModal, { openModal }] = useModal();
45 35
... ... @@ -55,42 +45,28 @@
55 45 });
56 46
57 47 const getData = (d, f) => {
58   - if (f == 'output') {
  48 + if (f == 'input') {
59 49 if (d.id !== null) {
60   - const findIndex = unref(outputParamData).findIndex((f) => f.id == d.id);
61   - if (findIndex !== -1) unref(outputParamData).splice(findIndex, 1, d);
  50 + const findIndex = unref(inputParamData).findIndex((f) => f.id == d.id);
  51 + if (findIndex !== -1) unref(inputParamData).splice(findIndex, 1, d);
62 52 } else {
63   - unref(outputParamData).push({ ...d, id: buildUUID() });
  53 + unref(inputParamData).push({ ...d, id: buildUUID() });
64 54 }
65 55 }
66 56 };
67 57
68   - const handleAddOutParam = () => {
69   - openModal(true, {
70   - isUpdate: true,
71   - flag: 'output',
72   - excludeStruct: true,
73   - });
74   - };
  58 + const handleAddInParam = (b, o) => openModal(b, o);
75 59
76   - const deleteOutParItem = (index) => {
77   - unref(outputParamData).splice(index, 1);
78   - };
  60 + const handleEditInParam = (b, o) => openModal(b, o);
79 61
80   - const editOutParItem = (item) => {
81   - openModal(true, {
82   - isUpdate: false,
83   - record: item,
84   - flag: 'output',
85   - excludeStruct: true,
86   - });
87   - };
  62 + const handleDelInParam = (i) => unref(inputParamData).splice(i, 1);
88 63
  64 + //回显不同类型数据
89 65 const setTypeData = (T, D) => {
90 66 if (T === 'INT' || T === 'DOUBLE' || T === 'TEXT') {
91 67 return {
92 68 ...D?.dataSpecs,
93   - valueRange: D?.dataSpecs,
  69 + valueRange: { ...D?.dataSpecs },
94 70 };
95 71 } else if (T === 'BOOL') {
96 72 return {
... ... @@ -100,22 +76,23 @@
100 76 }
101 77 };
102 78
103   - //回显数据
104 79 const setFormData = (v) => {
105   - setFieldsValue({ ...v[0] });
106   - setFieldsValue(setTypeData(v[0].dataType, v[0]));
107   - const { dataSpecsList } = v[0];
108   - if (dataSpecsList !== undefined) {
109   - outputParamData.value = [...new Array(dataSpecsList.length).keys()];
110   - outputParamData.value = dataSpecsList;
  80 + try {
  81 + setFieldsValue({ ...v[0] });
  82 + setFieldsValue(setTypeData(v[0]?.dataType, v[0]));
  83 + //回显结构体数据
  84 + const { dataSpecsList } = v[0];
  85 + if (dataSpecsList !== undefined) {
  86 + inputParamData.value = [...new Array(dataSpecsList.length).keys()];
  87 + inputParamData.value = dataSpecsList;
  88 + }
  89 + } catch (e) {
  90 + console.log('Attribute error info', e);
111 91 }
112 92 };
113 93
114 94 //获取结构体数据
115   - const getStructList = () => {
116   - const val = unref(dynamicBindRef.outputParamItemRef)?.map((item: any) => item.getFormData());
117   - return val;
118   - };
  95 + const getStructList = () => CommomParamInParamRef.value?.getInputStructList();
119 96
120 97 const getBoolOrStructData = (T, S, B) => {
121 98 if (T === 'STRUCT') {
... ... @@ -135,12 +112,7 @@
135 112 const dataSpecs = useChangeTypeGetTypeForm(values.dataType, values);
136 113 const dataSpecsListBool = useChangeTypeGetTypeForm(values.dataType, values);
137 114 const { valueRange, step, unit, outputParam, ...value } = values;
138   - const none = {
139   - ...outputParam,
140   - ...step,
141   - ...unit,
142   - ...valueRange,
143   - };
  115 + const none = [valueRange, step, unit, outputParam]; //没用,防止eslint报未使用变量
144 116 console.log(none);
145 117 return {
146 118 ...value,
... ... @@ -153,7 +125,7 @@
153 125
154 126 const resetFormData = () => {
155 127 resetFields();
156   - outputParamData.value = [];
  128 + inputParamData.value = [];
157 129 };
158 130
159 131 defineExpose({
... ... @@ -162,9 +134,4 @@
162 134 getFormData,
163 135 });
164 136 </script>
165   -<style lang="less" scoped>
166   - .add-style {
167   - color: #0170cc;
168   - cursor: pointer;
169   - }
170   -</style>
  137 +<style lang="less" scoped></style>
... ...
... ... @@ -2,24 +2,15 @@
2 2 <div>
3 3 <BasicForm @register="register">
4 4 <template #outputParamSlot>
5   - <div>
6   - <template v-for="(item, index) in outputParamData" :key="item">
7   - <span style="display: none">{{ item }}</span>
8   - <InputParamItem
9   - :title="item.name"
10   - :item="item"
11   - class="mt-4"
12   - :index="index"
13   - :ref="dynamicBindRef.outputParamItemRef"
14   - @delete="deleteOutParItem"
15   - @edit="editOutParItem"
16   - />
17   - </template>
18   - <div style="display: flex" :class="{ 'mt-2': outputParamData.length > 0 }">
19   - <span class="add-style">+</span>
20   - <span class="add-style" @click="handleAddOutParam">增加参数</span>
21   - </div>
22   - </div>
  5 + <CommomParam
  6 + ref="CommomParamInParamRef"
  7 + :isInputParam="true"
  8 + :isExcludeStruct="false"
  9 + :inputParamData="inputParamData"
  10 + @emitAddInParam="handleAddInParam"
  11 + @emitEditInParam="handleEditInParam"
  12 + @emitDeletelnParam="handleDelInParam"
  13 + />
23 14 </template>
24 15 </BasicForm>
25 16 <AddParamsModal @register="registerModal" @data="getData" />
... ... @@ -30,14 +21,13 @@
30 21 import { BasicForm, useForm } from '/@/components/Form';
31 22 import { eventSchemas } from './config';
32 23 import { useModal } from '/@/components/Modal';
33   - import InputParamItem from './components/InputParamItem.vue';
34   - import AddParamsModal from './components/AddParamsModal.vue';
35 24 import { buildUUID } from '/@/utils/uuid';
  25 + import AddParamsModal from './components/AddParamsModal.vue';
  26 + import CommomParam from './components/CommomParam.vue';
36 27
37   - const outputParamData: any = ref([]);
38   - const dynamicBindRef = {
39   - outputParamItemRef: ref([]),
40   - };
  28 + const inputParamData: any = ref([]);
  29 +
  30 + const CommomParamInParamRef = ref<InstanceType<typeof CommomParam>>();
41 31
42 32 const [registerModal, { openModal }] = useModal();
43 33
... ... @@ -53,59 +43,42 @@
53 43 });
54 44
55 45 const getData = (d, f) => {
56   - if (f == 'output') {
  46 + if (f == 'input') {
57 47 if (d.id !== null) {
58   - const findIndex = unref(outputParamData).findIndex((f) => f.id == d.id);
59   - if (findIndex !== -1) unref(outputParamData).splice(findIndex, 1, d);
  48 + const findIndex = unref(inputParamData).findIndex((f) => f.id == d.id);
  49 + if (findIndex !== -1) unref(inputParamData).splice(findIndex, 1, d);
60 50 } else {
61   - unref(outputParamData).push({ ...d, id: buildUUID() });
  51 + unref(inputParamData).push({ ...d, id: buildUUID() });
62 52 }
63 53 }
64 54 };
65 55
66   - const handleAddOutParam = () => {
67   - openModal(true, {
68   - isUpdate: true,
69   - flag: 'output',
70   - excludeStruct: false,
71   - });
72   - };
  56 + const handleAddInParam = (b, o) => openModal(b, o);
73 57
74   - const deleteOutParItem = (index) => {
75   - unref(outputParamData).splice(index, 1);
76   - };
  58 + const handleEditInParam = (b, o) => openModal(b, o);
77 59
78   - const editOutParItem = (item) => {
79   - openModal(true, {
80   - isUpdate: false,
81   - record: item,
82   - flag: 'output',
83   - excludeStruct: false,
84   - });
85   - };
  60 + const handleDelInParam = (i) => unref(inputParamData).splice(i, 1);
86 61
87 62 //回显数据
88 63 const setFormData = (v) => {
89 64 setFieldsValue(v[0]);
90 65 const { outputData } = v[0];
91 66 if (outputData !== undefined) {
92   - outputParamData.value = [...new Array(outputData.length).keys()];
93   - outputParamData.value = outputData;
  67 + inputParamData.value = [...new Array(outputData.length).keys()];
  68 + inputParamData.value = outputData;
94 69 }
95 70 };
96 71
97 72 //获取数据
98   - const getStructList = () => {
99   - const val = unref(dynamicBindRef.outputParamItemRef)?.map((item: any) => item.getFormData());
100   - return val;
101   - };
  73 + const getStructList = () => CommomParamInParamRef.value?.getInputStructList();
102 74
103 75 async function getFormData() {
104 76 const values = await validate();
105 77 if (!values) return;
106 78 const outputData = getStructList();
107 79 const { outputParam, ...value } = values;
108   - console.log(outputParam);
  80 + const none = [outputParam]; //没用,防止eslint报未使用变量
  81 + console.log(none);
109 82 return {
110 83 ...value,
111 84 ...{ outputData },
... ... @@ -115,7 +88,7 @@
115 88 //清空数据
116 89 const resetFormData = () => {
117 90 resetFields();
118   - outputParamData.value = [];
  91 + inputParamData.value = [];
119 92 };
120 93
121 94 defineExpose({
... ... @@ -124,9 +97,4 @@
124 97 getFormData,
125 98 });
126 99 </script>
127   -<style lang="less" scoped>
128   - .add-style {
129   - color: #0170cc;
130   - cursor: pointer;
131   - }
132   -</style>
  100 +<style lang="less" scoped></style>
... ...
... ... @@ -2,44 +2,26 @@
2 2 <div>
3 3 <BasicForm @register="register">
4 4 <template #inputParamSlot>
5   - <div>
6   - <template v-for="(item, index) in inputParamData" :key="item.id">
7   - <span style="display: none">{{ item }}</span>
8   - <InputParamItem
9   - :title="item.name"
10   - :item="item"
11   - class="mt-4"
12   - :index="index"
13   - :ref="dynamicBindRef.inputParamItemRef"
14   - @delete="deleteInParItem"
15   - @edit="editInParItem"
16   - />
17   - </template>
18   - <div style="display: flex" :class="{ 'mt-2': inputParamData.length > 0 }">
19   - <span class="add-style">+</span>
20   - <span class="add-style" @click="handleAddInParam">增加参数</span>
21   - </div>
22   - </div>
  5 + <CommomParam
  6 + ref="CommomParamInParamRef"
  7 + :isInputParam="true"
  8 + :isExcludeStruct="false"
  9 + :inputParamData="inputParamData"
  10 + @emitAddInParam="handleAddInParam"
  11 + @emitEditInParam="handleEditInParam"
  12 + @emitDeletelnParam="handleDelInParam"
  13 + />
23 14 </template>
24 15 <template #outputParamSlot>
25   - <div>
26   - <template v-for="(item, index) in outputParamData" :key="item.id">
27   - <span style="display: none">{{ item }}</span>
28   - <InputParamItem
29   - :title="item.name"
30   - :item="item"
31   - class="mt-4"
32   - :index="index"
33   - :ref="dynamicBindRef.outputParamItemRef"
34   - @delete="deleteOutParItem"
35   - @edit="editOutParItem"
36   - />
37   - </template>
38   - <div style="display: flex" :class="{ 'mt-2': outputParamData.length > 0 }">
39   - <span class="add-style">+</span>
40   - <span class="add-style" @click="handleAddOutParam">增加参数</span>
41   - </div>
42   - </div>
  16 + <CommomParam
  17 + ref="CommomParamOutParamRef"
  18 + :isOutputParam="true"
  19 + :isExcludeStruct="false"
  20 + :outputParamData="outputParamData"
  21 + @emitAddOutParam="handleAddOutParam"
  22 + @emitEditOutParam="handleEditOutParam"
  23 + @emitDeleteOutParam="handleDelOutParam"
  24 + />
43 25 </template>
44 26 </BasicForm>
45 27 <AddParamsModal @register="registerModal" @data="getData" />
... ... @@ -50,16 +32,15 @@
50 32 import { BasicForm, useForm } from '/@/components/Form';
51 33 import { serviceSchemas } from './config';
52 34 import { useModal } from '/@/components/Modal';
53   - import InputParamItem from './components/InputParamItem.vue';
54   - import AddParamsModal from './components/AddParamsModal.vue';
55 35 import { buildUUID } from '/@/utils/uuid';
  36 + import AddParamsModal from './components/AddParamsModal.vue';
  37 + import CommomParam from './components/CommomParam.vue';
56 38
57 39 const inputParamData: any = ref([]);
58 40 const outputParamData: any = ref([]);
59   - const dynamicBindRef = {
60   - inputParamItemRef: ref([]),
61   - outputParamItemRef: ref([]),
62   - };
  41 +
  42 + const CommomParamInParamRef = ref<InstanceType<typeof CommomParam>>();
  43 + const CommomParamOutParamRef = ref<InstanceType<typeof CommomParam>>();
63 44
64 45 const [registerModal, { openModal }] = useModal();
65 46
... ... @@ -92,47 +73,17 @@
92 73 }
93 74 };
94 75
95   - const handleAddInParam = () => {
96   - openModal(true, {
97   - isUpdate: true,
98   - flag: 'input',
99   - excludeStruct: false,
100   - });
101   - };
  76 + const handleAddInParam = (b, o) => openModal(b, o);
102 77
103   - const deleteInParItem = (index) => {
104   - unref(inputParamData).splice(index, 1);
105   - };
  78 + const handleEditInParam = (b, o) => openModal(b, o);
106 79
107   - const editInParItem = (item) => {
108   - openModal(true, {
109   - isUpdate: false,
110   - record: item,
111   - flag: 'input',
112   - excludeStruct: false,
113   - });
114   - };
  80 + const handleDelInParam = (i) => unref(inputParamData).splice(i, 1);
115 81
116   - const handleAddOutParam = () => {
117   - openModal(true, {
118   - isUpdate: true,
119   - flag: 'output',
120   - excludeStruct: false,
121   - });
122   - };
  82 + const handleAddOutParam = (b, o) => openModal(b, o);
123 83
124   - const deleteOutParItem = (index) => {
125   - unref(outputParamData).splice(index, 1);
126   - };
  84 + const handleEditOutParam = (b, o) => openModal(b, o);
127 85
128   - const editOutParItem = (item) => {
129   - openModal(true, {
130   - isUpdate: false,
131   - record: item,
132   - flag: 'output',
133   - excludeStruct: false,
134   - });
135   - };
  86 + const handleDelOutParam = (i) => unref(outputParamData).splice(i, 1);
136 87
137 88 //回显数据
138 89 const setFormData = (v) => {
... ... @@ -148,15 +99,9 @@
148 99 }
149 100 };
150 101
151   - const getInputStructList = () => {
152   - const val = unref(dynamicBindRef.inputParamItemRef)?.map((item: any) => item.getFormData());
153   - return val;
154   - };
  102 + const getInputStructList = () => CommomParamInParamRef.value?.getInputStructList();
155 103
156   - const getOutputStructList = () => {
157   - const val = unref(dynamicBindRef.outputParamItemRef)?.map((item: any) => item.getFormData());
158   - return val;
159   - };
  104 + const getOutputStructList = () => CommomParamOutParamRef.value?.getOutputStructList();
160 105
161 106 //获取数据
162 107 async function getFormData() {
... ... @@ -165,8 +110,8 @@
165 110 const inputParams = getInputStructList();
166 111 const outputParams = getOutputStructList();
167 112 const { inputParam, outputParam, ...value } = values;
168   - console.log(inputParam);
169   - console.log(outputParam);
  113 + const none = [inputParam, outputParam]; //没用,防止eslint报未使用变量
  114 + console.log(none);
170 115 return {
171 116 ...value,
172 117 ...{ inputParams },
... ... @@ -187,9 +132,4 @@
187 132 getFormData,
188 133 });
189 134 </script>
190   -<style lang="less" scoped>
191   - .add-style {
192   - color: #0170cc;
193   - cursor: pointer;
194   - }
195   -</style>
  135 +<style lang="less" scoped></style>
... ...
... ... @@ -2,24 +2,15 @@
2 2 <div>
3 3 <BasicForm @register="registerForm">
4 4 <template #structSlot>
5   - <div>
6   - <template v-for="(item, index) in outputParamData" :key="item">
7   - <span style="display: none">{{ item }}</span>
8   - <InputParamItem
9   - :title="item.name"
10   - :item="item"
11   - class="mt-4"
12   - :index="index"
13   - :ref="dynamicBindRef.outputParamItemRef"
14   - @delete="deleteOutParItem"
15   - @edit="editOutParItem"
16   - />
17   - </template>
18   - <div style="display: flex" :class="{ 'mt-2': outputParamData.length > 0 }">
19   - <span class="add-style">+</span>
20   - <span class="add-style" @click="handleAddOutParam">增加参数</span>
21   - </div>
22   - </div>
  5 + <CommomParam
  6 + ref="CommomParamInParamRef"
  7 + :isExcludeStruct="true"
  8 + :isInputParam="true"
  9 + :inputParamData="inputParamData"
  10 + @emitAddInParam="handleAddInParam"
  11 + @emitEditInParam="handleEditInParam"
  12 + @emitDeletelnParam="handleDelInParam"
  13 + />
23 14 </template>
24 15 </BasicForm>
25 16 <AddParamsModal @register="registerModal" @data="getData" />
... ... @@ -30,16 +21,17 @@
30 21 import { BasicForm, useForm } from '/@/components/Form';
31 22 import { addParamsSchemas } from '../config';
32 23 import { useModal } from '/@/components/Modal';
33   - import InputParamItem from './InputParamItem.vue';
34   - import AddParamsModal from './AddParamsModal.vue';
35 24 import { buildUUID } from '/@/utils/uuid';
36 25 import { useChangeTypeGetTypeForm, useUpdateFormExcludeStruct } from '../../hook/useTypeGetForm';
  26 + import AddParamsModal from './AddParamsModal.vue';
  27 + import CommomParam from './CommomParam.vue';
37 28
38 29 defineEmits(['register']);
39   - const outputParamData: any = ref([]);
40   - const dynamicBindRef = {
41   - outputParamItemRef: ref([]),
42   - };
  30 +
  31 + const inputParamData: any = ref([]);
  32 +
  33 + const CommomParamInParamRef = ref<InstanceType<typeof CommomParam>>();
  34 +
43 35 const [registerModal, { openModal }] = useModal();
44 36
45 37 const [registerForm, { validate, setFieldsValue, resetFields, updateSchema }] = useForm({
... ... @@ -54,41 +46,25 @@
54 46 });
55 47
56 48 const getData = (d, f) => {
57   - if (f == 'output') {
  49 + if (f === 'input') {
58 50 if (d.id !== null) {
59   - const findIndex = unref(outputParamData).findIndex((f) => f.id == d.id);
60   - if (findIndex !== -1) unref(outputParamData).splice(findIndex, 1, d);
  51 + const findIndex = unref(inputParamData).findIndex((f) => f.id == d.id);
  52 + if (findIndex !== -1) unref(inputParamData).splice(findIndex, 1, d);
61 53 } else {
62   - unref(outputParamData).push({ ...d, id: buildUUID() });
  54 + unref(inputParamData).push({ ...d, id: buildUUID() });
63 55 }
64 56 }
65 57 };
66 58
67   - const handleAddOutParam = () => {
68   - openModal(true, {
69   - isUpdate: true,
70   - flag: 'output',
71   - excludeStruct: true,
72   - });
73   - };
  59 + const handleAddInParam = (b, o) => openModal(b, o);
74 60
75   - const deleteOutParItem = (index) => {
76   - unref(outputParamData).splice(index, 1);
77   - };
  61 + const handleEditInParam = (b, o) => openModal(b, o);
78 62
79   - const editOutParItem = (item) => {
80   - openModal(true, {
81   - isUpdate: false,
82   - record: item,
83   - flag: 'output',
84   - excludeStruct: true,
85   - });
86   - };
  63 + const handleDelInParam = (i) => unref(inputParamData).splice(i, 1);
87 64
88 65 const updateFormExcludeStruct = (flag) => useUpdateFormExcludeStruct(flag, updateSchema);
89 66
90   - const getOutputStructList = () =>
91   - unref(dynamicBindRef.outputParamItemRef)?.map((item: any) => item.getFormData());
  67 + const getOutputStructList = () => CommomParamInParamRef.value?.getInputStructList();
92 68
93 69 const getBoolOrStruct = (T, S, B) => {
94 70 if (T === 'STRUCT') {
... ... @@ -112,76 +88,60 @@
112 88 const values = await validate();
113 89 if (!values) return;
114 90 const outputParams = getOutputStructList();
115   - outputParams.forEach((f) => {
  91 + outputParams?.forEach((f) => {
116 92 f.dataType = 'STRUCT';
117   - f.childDataType = values.dataType;
118   - f.childName = values.name;
  93 + f.childSpecsDTO = getIntOrText(f.childDataType, f.dataSpecs);
  94 + f.childEnumSpecsDTO = getBoolOrStruct(f.childDataType, null, f.dataSpecsList);
119 95 });
120 96 const dataSpecs = useChangeTypeGetTypeForm(values.dataType, values);
121 97 const dataSpecsList = useChangeTypeGetTypeForm(values.dataType, values);
122   - const { boolClose, boolOpen, step, unit, valueRange, ...value } = values;
123   - const none = {
124   - ...boolClose,
125   - ...boolOpen,
126   - ...step,
127   - ...unit,
128   - ...valueRange,
129   - };
  98 + const { boolClose, boolOpen, step, unit, valueRange, length, ...value } = values;
  99 + const none = [valueRange, step, unit, boolOpen, boolClose, length]; //没用,防止eslint报未使用变量
130 100 console.log(none);
131 101 return {
  102 + ...{ childName: value.name },
  103 + ...{ childDataType: value.dataType },
132 104 ...value,
133 105 ...{
134 106 dataSpecs: getIntOrText(values.dataType, dataSpecs),
135 107 },
136   - // ...{
137   - // childSpecsDTO: getIntOrText(values.dataType, dataSpecs),
138   - // },
139 108 ...{
140 109 dataSpecsList: getBoolOrStruct(values.dataType, outputParams, dataSpecsList),
141 110 },
142   - // ...{ childEnumSpecsDTO: getBoolOrStruct(values.dataType, outputParams, dataSpecsList) },
143   - // ...{
144   - // childDataType: values.dataType,
145   - // childName: values.name,
146   - // },
147 111 };
148 112 };
149 113
150 114 const setFormData = (v) => {
151   - setFieldsValue(v);
152   - setFieldsValue({
153   - ...v.dataSpecs,
154   - valueRange: v.dataSpecs,
155   - });
156 115 try {
  116 + setFieldsValue(v);
157 117 setFieldsValue({
158   - boolClose: v.dataType == 'BOOL' ? v.dataSpecsList[0].name : '',
159   - boolOpen: v.dataType == 'BOOL' ? v.dataSpecsList[1].name : '',
  118 + ...v.dataSpecs,
  119 + valueRange: v.dataSpecs,
160 120 });
161   - } catch (e) {
162   - console.log(e);
163   - }
164   - const { dataSpecsList, dataType, childDataType } = v;
165   - if (childDataType == 'BOOL') {
166 121 setFieldsValue({
167   - dataType: childDataType,
168   - boolClose: dataSpecsList[0].name,
169   - boolOpen: dataSpecsList[1].name,
  122 + boolClose: v.dataType == 'BOOL' ? v.dataSpecsList[0].name : '',
  123 + boolOpen: v.dataType == 'BOOL' ? v.dataSpecsList[1].name : '',
170 124 });
171   - }
172   - try {
  125 + const { dataSpecsList, dataType, childDataType } = v;
  126 + if (childDataType == 'BOOL') {
  127 + setFieldsValue({
  128 + dataType: childDataType,
  129 + boolClose: dataSpecsList[0].name,
  130 + boolOpen: dataSpecsList[1].name,
  131 + });
  132 + }
173 133 if (dataType == 'BOOL' || dataType == 'STRUCT') {
174   - outputParamData.value = [...new Array(dataSpecsList.length).keys()];
175   - outputParamData.value = dataSpecsList;
  134 + inputParamData.value = [...new Array(dataSpecsList.length).keys()];
  135 + inputParamData.value = dataSpecsList;
176 136 }
177 137 } catch (e) {
178   - console.log(e);
  138 + console.log('AddParamForm error info', e);
179 139 }
180 140 };
181 141
182 142 const resetFormData = () => {
183 143 resetFields();
184   - outputParamData.value = [];
  144 + inputParamData.value = [];
185 145 };
186 146
187 147 defineExpose({
... ...
  1 +<template>
  2 + <!-- 输入参数 -->
  3 + <div v-if="isInputParam">
  4 + <template v-for="(item, index) in inputParamData" :key="item.name">
  5 + <span style="display: none">{{ item }}</span>
  6 + <InputParamItem
  7 + :title="item.name"
  8 + :item="item"
  9 + class="mt-4"
  10 + :index="index"
  11 + :ref="dynamicBindRef.inputParamItemRef"
  12 + @delete="deleteInParItem"
  13 + @edit="editInParItem"
  14 + />
  15 + </template>
  16 + <div style="display: flex" :class="{ 'mt-2': inputParamData.length > 0 }">
  17 + <span class="add-style">+</span>
  18 + <span class="add-style" @click="handleAddInParam">增加参数</span>
  19 + </div>
  20 + </div>
  21 + <!-- 输出参数 -->
  22 + <div v-if="isOutputParam">
  23 + <template v-for="(item, index) in outputParamData" :key="item.name">
  24 + <span style="display: none">{{ item + index }}</span>
  25 + <InputParamItem
  26 + :title="item.name"
  27 + :item="item"
  28 + class="mt-4"
  29 + :index="index"
  30 + :ref="dynamicBindRef.outputParamItemRef"
  31 + @delete="deleteOutParItem"
  32 + @edit="editOutParItem"
  33 + />
  34 + </template>
  35 + <div style="display: flex" :class="{ 'mt-2': outputParamData.length > 0 }">
  36 + <span class="add-style">+</span>
  37 + <span class="add-style" @click="handleAddOutParam">增加参数</span>
  38 + </div>
  39 + </div>
  40 +</template>
  41 +<script lang="ts" setup>
  42 + import { ref, unref } from 'vue';
  43 + import InputParamItem from './InputParamItem.vue';
  44 +
  45 + const props = defineProps({
  46 + isExcludeStruct: { type: Boolean, default: true },
  47 + isInputParam: { type: Boolean, default: false },
  48 + isOutputParam: { type: Boolean, default: false },
  49 + inputParamData: {
  50 + type: Array as PropType<any[]>,
  51 + default: () => [],
  52 + },
  53 + outputParamData: {
  54 + type: Array as PropType<any[]>,
  55 + default: () => [],
  56 + },
  57 + });
  58 +
  59 + const emit = defineEmits([
  60 + 'emitAddInParam',
  61 + 'emitEditInParam',
  62 + 'emitDeletelnParam',
  63 + 'emitAddOutParam',
  64 + 'emitEditOutParam',
  65 + 'emitDeleteOutParam',
  66 + ]);
  67 +
  68 + const dynamicBindRef = {
  69 + inputParamItemRef: ref([]),
  70 + outputParamItemRef: ref([]),
  71 + };
  72 +
  73 + const commomAddParamObj = {
  74 + isUpdate: true,
  75 + excludeStruct: props.isExcludeStruct ? true : false,
  76 + };
  77 +
  78 + const commomEditParamObj = {
  79 + isUpdate: false,
  80 + excludeStruct: props.isExcludeStruct ? true : false,
  81 + };
  82 +
  83 + const handleAddInParam = () => {
  84 + emit('emitAddInParam', true, {
  85 + ...commomAddParamObj,
  86 + flag: 'input',
  87 + });
  88 + };
  89 +
  90 + const deleteInParItem = (index) => {
  91 + emit('emitDeletelnParam', index);
  92 + };
  93 +
  94 + const editInParItem = (item) => {
  95 + emit('emitEditInParam', true, {
  96 + ...commomEditParamObj,
  97 + record: item,
  98 + flag: 'input',
  99 + });
  100 + };
  101 +
  102 + const handleAddOutParam = () => {
  103 + emit('emitAddOutParam', true, {
  104 + ...commomAddParamObj,
  105 + flag: 'output',
  106 + });
  107 + };
  108 +
  109 + const deleteOutParItem = (index) => {
  110 + emit('emitDeleteOutParam', index);
  111 + };
  112 +
  113 + const editOutParItem = (item) => {
  114 + emit('emitEditOutParam', true, {
  115 + ...commomEditParamObj,
  116 + record: item,
  117 + flag: 'output',
  118 + });
  119 + };
  120 +
  121 + const getInputStructList = () =>
  122 + unref(dynamicBindRef.inputParamItemRef)?.map((item: any) => item.getFormData());
  123 +
  124 + const getOutputStructList = () =>
  125 + unref(dynamicBindRef.outputParamItemRef)?.map((item: any) => item.getFormData());
  126 +
  127 + defineExpose({
  128 + getInputStructList,
  129 + getOutputStructList,
  130 + });
  131 +</script>
  132 +<style lang="less" scoped>
  133 + .add-style {
  134 + color: #0170cc;
  135 + cursor: pointer;
  136 + }
  137 +</style>
... ...
... ... @@ -5,15 +5,15 @@ export const mockData = {
5 5 _ppk: {},
6 6 events: [
7 7 {
8   - createTs: 1666596472189,
  8 + createTs: 1668151471327,
9 9 custom: true,
10   - description: '监播动作结果上报事件',
11   - eventName: '监播动作结果上报事件',
  10 + eventName: 'SDK运行状态',
12 11 eventType: 'INFO_EVENT_TYPE',
13   - identifier: 'MonitorActionEvent',
  12 + identifier: 'ContentSdkStatusEvent',
14 13 outputData: [
15 14 {
16 15 id: buildUUID(),
  16 +
17 17 custom: true,
18 18 dataSpecs: {
19 19 dataType: 'INT',
... ... @@ -26,12 +26,13 @@ export const mockData = {
26 26 },
27 27 dataType: 'INT',
28 28 direction: 'PARAM_OUTPUT',
29   - identifier: 'ActionType',
30   - name: '监播操作类型',
  29 + identifier: 'Status',
  30 + name: '状态类型值',
31 31 paraOrder: 0,
32 32 },
33 33 {
34 34 id: buildUUID(),
  35 +
35 36 custom: true,
36 37 dataSpecs: {
37 38 dataType: 'TEXT',
... ... @@ -39,293 +40,247 @@ export const mockData = {
39 40 },
40 41 dataType: 'TEXT',
41 42 direction: 'PARAM_OUTPUT',
42   - identifier: 'FileKey',
43   - name: '上传文件ossKey',
  43 + identifier: 'Message',
  44 + name: '消息内容',
44 45 paraOrder: 1,
45 46 },
46 47 {
47 48 id: buildUUID(),
  49 +
48 50 custom: true,
49 51 dataSpecsList: [
50 52 {
51 53 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: '峰值',
  54 +
  55 + childDataType: 'INT',
  56 + childName: '测试结构体回显1',
77 57 childSpecsDTO: {
78   - dataType: 'DOUBLE',
79   - max: '33',
80   - min: '22',
81   - step: '2',
82   - unit: 'm³/s',
83   - unitName: '立方米每秒',
  58 + dataType: 'INT',
  59 + max: '22',
  60 + min: '11',
  61 + step: '3',
84 62 },
85 63 custom: true,
86 64 dataSpecs: {
87   - dataType: 'DOUBLE',
88   - max: '33',
89   - min: '22',
90   - step: '2',
91   - unit: 'm³/s',
92   - unitName: '立方米每秒',
  65 + dataType: 'INT',
  66 + max: '22',
  67 + min: '11',
  68 + step: '3',
93 69 },
94 70 dataType: 'STRUCT',
95   - identifier: 'bass',
  71 + identifier: '1',
96 72 isStd: 0,
97   - name: '峰值',
  73 + name: '测试结构体回显1',
98 74 },
99 75 {
100 76 id: buildUUID(),
  77 +
101 78 childDataType: 'BOOL',
102 79 childEnumSpecsDTO: [
103 80 {
104 81 dataType: 'BOOL',
105   - name: '1',
  82 + name: 'ffg',
106 83 value: 0,
107 84 },
108 85 {
109 86 dataType: 'BOOL',
110   - name: '0',
  87 + name: 'ggg',
111 88 value: 1,
112 89 },
113 90 ],
114   - childName: '平均速率',
  91 + childName: '测试结构体回显2',
115 92 custom: true,
116 93 dataSpecsList: [
117 94 {
118   - id: buildUUID(),
119 95 dataType: 'BOOL',
120   - name: '1',
  96 + name: 'ffg',
121 97 value: 0,
122 98 },
123 99 {
124   - id: buildUUID(),
125 100 dataType: 'BOOL',
126   - name: '0',
  101 + name: 'ggg',
127 102 value: 1,
128 103 },
129 104 ],
130 105 dataType: 'STRUCT',
131   - identifier: 'average',
  106 + identifier: '3',
132 107 isStd: 0,
133   - name: '平均速率',
  108 + name: '测试结构体回显2',
134 109 },
135   - ],
136   - dataType: 'STRUCT',
137   - direction: 'PARAM_OUTPUT',
138   - identifier: 'ceshi',
139   - name: '网速',
140   - paraOrder: 3,
141   - },
142   - ],
143   - productKey: 'hsrnXEfGFDv',
144   - required: false,
145   - },
146   - ],
147   - productKey: 'hsrnXEfGFDv',
148   - properties: [
149   - // {
150   - // createTs: 1667876342551,
151   - // custom: true,
152   - // customFlag: true,
153   - // dataSpecs: {
154   - // dataType: 'TEXT',
155   - // length: 10240,
156   - // },
157   - // dataType: 'TEXT',
158   - // description: '内容推荐',
159   - // identifier: 'Brightness',
160   - // name: '亮度百分比',
161   - // productKey: 'hsrnXEfGFDv',
162   - // required: false,
163   - // rwFlag: 'READ_WRITE',
164   - // std: false,
165   - // },
166   - // {
167   - // createTs: 1667876342551,
168   - // custom: true,
169   - // customFlag: 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: 'BOOL',
183   - // description: '内容推荐',
184   - // identifier: 'Brightness',
185   - // name: '亮度百分比',
186   - // productKey: 'hsrnXEfGFDv',
187   - // required: false,
188   - // rwFlag: 'READ_WRITE',
189   - // std: false,
190   - // },
191   - // {
192   - // createTs: 1667876342551,
193   - // custom: true,
194   - // customFlag: true,
195   - // dataSpecs: {
196   - // dataType: 'INT',
197   - // max: '1024',
198   - // min: '-1024',
199   - // step: '1',
200   - // unit: 'var',
201   - // },
202   - // dataType: 'INT',
203   - // description: '内容推荐。0:未知状态,1:熄屏,2:亮屏',
204   - // identifier: 'RunningState',
205   - // name: '运行状态',
206   - // productKey: 'hsrnXEfGFDv',
207   - // required: false,
208   - // rwFlag: 'READ_WRITE',
209   - // std: false,
210   - // },
211   - {
212   - createTs: 1666604372638,
213   - custom: true,
214   - customFlag: true,
215   - dataSpecsList: [
216   - {
217   - childDataType: 'BOOL',
218   - childEnumSpecsDTO: [
219 110 {
220   - dataType: 'BOOL',
221   - name: '左眼',
222   - value: 0,
  111 + id: buildUUID(),
  112 +
  113 + childDataType: 'TEXT',
  114 + childName: '测试结构体回显3',
  115 + childSpecsDTO: {
  116 + dataType: 'TEXT',
  117 + length: 10240,
  118 + },
  119 + custom: true,
  120 + dataSpecs: {
  121 + dataType: 'TEXT',
  122 + length: 10240,
  123 + },
  124 + dataType: 'STRUCT',
  125 + identifier: '33',
  126 + isStd: 0,
  127 + name: '测试结构体回显3',
223 128 },
224 129 {
225   - dataType: 'BOOL',
226   - name: '右眼',
227   - value: 1,
  130 + id: buildUUID(),
  131 +
  132 + childDataType: 'DOUBLE',
  133 + childName: '测试结构体回显4',
  134 + childSpecsDTO: {
  135 + dataType: 'DOUBLE',
  136 + max: '44.0',
  137 + min: '33.0',
  138 + step: '5.0',
  139 + unit: 'gear',
  140 + unitName: '档',
  141 + },
  142 + custom: true,
  143 + dataSpecs: {
  144 + dataType: 'DOUBLE',
  145 + max: '44.0',
  146 + min: '33.0',
  147 + step: '5.0',
  148 + unit: 'gear',
  149 + unitName: '档',
  150 + },
  151 + dataType: 'STRUCT',
  152 + identifier: '4',
  153 + isStd: 0,
  154 + name: '测试结构体回显4',
228 155 },
229 156 ],
230   - childName: '眼睛',
  157 + dataType: 'STRUCT',
  158 + direction: 'PARAM_OUTPUT',
  159 + identifier: '1',
  160 + name: '测试结构体回显',
  161 + paraOrder: 2,
  162 + },
  163 + {
  164 + id: buildUUID(),
  165 +
231 166 custom: true,
232 167 dataSpecsList: [
233 168 {
234 169 dataType: 'BOOL',
235   - name: '左眼',
  170 + name: 'er',
236 171 value: 0,
237 172 },
238 173 {
239 174 dataType: 'BOOL',
240   - name: '右眼',
  175 + name: 'dd',
241 176 value: 1,
242 177 },
243 178 ],
244   - dataType: 'STRUCT',
245   - identifier: 'Eye',
246   - isStd: 0,
247   - name: '眼睛',
  179 + dataType: 'BOOL',
  180 + direction: 'PARAM_OUTPUT',
  181 + identifier: '2212',
  182 + name: 'bool类型',
  183 + paraOrder: 3,
248 184 },
  185 + ],
  186 + productKey: 'hsrnXEfGFDv',
  187 + required: false,
  188 + },
  189 + ],
  190 + productKey: 'hsrnXEfGFDv',
  191 + properties: [
  192 + {
  193 + createTs: 1668152010679,
  194 + custom: true,
  195 + customFlag: true,
  196 + dataSpecsList: [
249 197 {
250   - childDataType: 'INT',
251   - childName: '鼻子',
  198 + id: buildUUID(),
  199 +
  200 + childDataType: 'TEXT',
  201 + childName: '测试化学需氧量text类型',
252 202 childSpecsDTO: {
253   - dataType: 'INT',
254   - max: '22',
255   - min: '12',
256   - step: '5',
257   - unit: '只',
258   - unitName: '只',
  203 + dataType: 'TEXT',
  204 + length: 10240,
259 205 },
260 206 custom: true,
261 207 dataSpecs: {
262   - dataType: 'INT',
263   - max: '22',
264   - min: '12',
265   - step: '5',
266   - unit: '只',
267   - unitName: '只',
  208 + dataType: 'TEXT',
  209 + length: 10240,
268 210 },
269 211 dataType: 'STRUCT',
270   - identifier: 'Boless',
  212 + identifier: 'text',
271 213 isStd: 0,
272   - name: '鼻子',
  214 + name: '测试化学需氧量text类型',
273 215 },
274 216 {
275   - childDataType: 'TEXT',
276   - childName: '脸颊',
  217 + id: buildUUID(),
  218 +
  219 + childDataType: 'INT',
  220 + childName: '测试化学需氧量int类型',
277 221 childSpecsDTO: {
278   - dataType: 'TEXT',
279   - length: 10240,
  222 + dataType: 'INT',
  223 + max: '22',
  224 + min: '11',
  225 + step: '2',
  226 + unit: 'mm/hour',
  227 + unitName: '降雨量',
280 228 },
281 229 custom: true,
282 230 dataSpecs: {
283   - dataType: 'TEXT',
284   - length: 10240,
  231 + dataType: 'INT',
  232 + max: '22',
  233 + min: '11',
  234 + step: '2',
  235 + unit: 'mm/hour',
  236 + unitName: '降雨量',
285 237 },
286 238 dataType: 'STRUCT',
287   - identifier: 'Facebook',
  239 + identifier: 'ibt',
288 240 isStd: 0,
289   - name: '脸颊',
  241 + name: '测试化学需氧量int类型',
290 242 },
291 243 {
  244 + id: buildUUID(),
  245 +
292 246 childDataType: 'BOOL',
293 247 childEnumSpecsDTO: [
294 248 {
295 249 dataType: 'BOOL',
296   - name: '左耳',
  250 + name: '需要',
297 251 value: 0,
298 252 },
299 253 {
300 254 dataType: 'BOOL',
301   - name: '右耳',
  255 + name: '不需要',
302 256 value: 1,
303 257 },
304 258 ],
305   - childName: '耳朵',
  259 + childName: '测试化学需氧量bool类型',
306 260 custom: true,
307 261 dataSpecsList: [
308 262 {
309 263 dataType: 'BOOL',
310   - name: '左耳',
  264 + name: '需要',
311 265 value: 0,
312 266 },
313 267 {
314 268 dataType: 'BOOL',
315   - name: '右耳',
  269 + name: '不需要',
316 270 value: 1,
317 271 },
318 272 ],
319 273 dataType: 'STRUCT',
320   - identifier: 'Eyear',
  274 + identifier: 'bol',
321 275 isStd: 0,
322   - name: '耳朵',
  276 + name: '测试化学需氧量bool类型',
323 277 },
324 278 ],
325 279 dataType: 'STRUCT',
326   - description: '用于人脸特征下发,基于人脸门禁1.0物模型\n设备级开关',
327   - identifier: 'SupportFaceFeature',
328   - name: '支持人脸特征下发',
  280 + description:
  281 + '化学需氧量COD(Chemical Oxygen Demand)是以化学方法测量水样中需要被氧化的还原性物质的量',
  282 + identifier: 'COD',
  283 + name: '化学需氧量',
329 284 productKey: 'hsrnXEfGFDv',
330 285 required: false,
331 286 rwFlag: 'READ_WRITE',
... ... @@ -334,13 +289,14 @@ export const mockData = {
334 289 ],
335 290 services: [
336 291 {
337   - callType: 'ASYNC',
338   - createTs: 1667963835032,
  292 + callType: 'SYNC',
  293 + createTs: 1668148397946,
339 294 custom: true,
340   - description: '配置模型',
341   - identifier: 'ConfigModel',
  295 + description: '删除模型1',
  296 + identifier: 'DeleteModel',
342 297 inputParams: [
343 298 {
  299 + id: buildUUID(),
344 300 custom: true,
345 301 dataSpecs: {
346 302 dataType: 'TEXT',
... ... @@ -349,100 +305,269 @@ export const mockData = {
349 305 dataType: 'TEXT',
350 306 direction: 'PARAM_INPUT',
351 307 identifier: 'AlgorithmID',
352   - name: '算法任务-人脸识别',
  308 + name: 'text类型',
353 309 paraOrder: 0,
354 310 },
355 311 {
  312 + id: buildUUID(),
  313 + custom: true,
  314 + dataSpecsList: [
  315 + {
  316 + id: buildUUID(),
  317 +
  318 + childDataType: 'INT',
  319 + childName: '结构体里面1',
  320 + childSpecsDTO: {
  321 + dataType: 'INT',
  322 + max: '22',
  323 + min: '11',
  324 + step: '3',
  325 + unit: 'W/㎡',
  326 + unitName: '太阳总辐射',
  327 + },
  328 + custom: true,
  329 + dataSpecs: {
  330 + dataType: 'INT',
  331 + max: '22',
  332 + min: '11',
  333 + step: '3',
  334 + unit: 'W/㎡',
  335 + unitName: '太阳总辐射',
  336 + },
  337 + dataType: 'STRUCT',
  338 + identifier: '1',
  339 + isStd: 0,
  340 + name: '结构体里面1',
  341 + },
  342 + {
  343 + id: buildUUID(),
  344 +
  345 + childDataType: 'BOOL',
  346 + childEnumSpecsDTO: [
  347 + {
  348 + dataType: 'BOOL',
  349 + name: '关',
  350 + value: 0,
  351 + },
  352 + {
  353 + dataType: 'BOOL',
  354 + name: '开',
  355 + value: 1,
  356 + },
  357 + ],
  358 + childName: '结构体里面2',
  359 + custom: true,
  360 + dataSpecsList: [
  361 + {
  362 + dataType: 'BOOL',
  363 + name: '关',
  364 + value: 0,
  365 + },
  366 + {
  367 + dataType: 'BOOL',
  368 + name: '开',
  369 + value: 1,
  370 + },
  371 + ],
  372 + dataType: 'STRUCT',
  373 + identifier: '2',
  374 + isStd: 0,
  375 + name: '结构体里面2',
  376 + },
  377 + {
  378 + id: buildUUID(),
  379 +
  380 + childDataType: 'TEXT',
  381 + childName: '结构体里面3',
  382 + childSpecsDTO: {
  383 + dataType: 'TEXT',
  384 + length: 10240,
  385 + },
  386 + custom: true,
  387 + dataSpecs: {
  388 + dataType: 'TEXT',
  389 + length: 10240,
  390 + },
  391 + dataType: 'STRUCT',
  392 + identifier: '3',
  393 + isStd: 0,
  394 + name: '结构体里面3',
  395 + },
  396 + ],
  397 + dataType: 'STRUCT',
  398 + direction: 'PARAM_INPUT',
  399 + identifier: '1',
  400 + name: '结构体里面数据',
  401 + paraOrder: 1,
  402 + },
  403 + {
  404 + id: buildUUID(),
  405 +
  406 + custom: true,
  407 + dataSpecsList: [
  408 + {
  409 + dataType: 'BOOL',
  410 + name: '开启',
  411 + value: 0,
  412 + },
  413 + {
  414 + dataType: 'BOOL',
  415 + name: '战斗',
  416 + value: 1,
  417 + },
  418 + ],
  419 + dataType: 'BOOL',
  420 + direction: 'PARAM_INPUT',
  421 + identifier: 'bool',
  422 + name: '布尔类型',
  423 + paraOrder: 2,
  424 + },
  425 + {
  426 + id: buildUUID(),
  427 +
356 428 custom: true,
357 429 dataSpecs: {
358   - dataType: 'DOUBLE',
  430 + dataType: 'INT',
359 431 max: '22',
360 432 min: '11',
361   - step: '3',
362   - unit: 'mm/hour',
363   - unitName: '降雨量',
  433 + step: '4',
  434 + unit: 'dS/m',
  435 + unitName: '土壤EC值',
364 436 },
365   - dataType: 'DOUBLE',
  437 + dataType: 'INT',
366 438 direction: 'PARAM_INPUT',
367   - identifier: 'Threshold',
368   - name: '结果置信度阈值',
369   - paraOrder: 1,
  439 + identifier: 'int',
  440 + name: 'int类型',
  441 + paraOrder: 3,
370 442 },
  443 + ],
  444 + outputParams: [
371 445 {
  446 + id: buildUUID(),
  447 +
  448 + custom: true,
  449 + dataSpecs: {
  450 + dataType: 'TEXT',
  451 + length: 10240,
  452 + },
  453 + dataType: 'TEXT',
  454 + direction: 'PARAM_OUTPUT',
  455 + identifier: '2',
  456 + name: '测试输出回显text类型',
  457 + paraOrder: 0,
  458 + },
  459 + {
  460 + id: buildUUID(),
  461 +
372 462 custom: true,
373 463 dataSpecs: {
374 464 dataType: 'INT',
375   - max: '1024',
376   - min: '-1024',
377   - step: '1',
  465 + max: '22',
  466 + min: '11',
  467 + step: '3',
378 468 unit: 'W/㎡',
379 469 unitName: '太阳总辐射',
380 470 },
381 471 dataType: 'INT',
382   - direction: 'PARAM_INPUT',
383   - identifier: 'Switch',
384   - name: '功能开关',
385   - paraOrder: 2,
  472 + direction: 'PARAM_OUTPUT',
  473 + identifier: 'int',
  474 + name: '测试输出回显int类型',
  475 + paraOrder: 1,
386 476 },
387 477 {
  478 + id: buildUUID(),
  479 +
388 480 custom: true,
389 481 dataSpecsList: [
390 482 {
391 483 dataType: 'BOOL',
392   - name: '',
  484 + name: 'd',
393 485 value: 0,
394 486 },
395 487 {
396 488 dataType: 'BOOL',
397   - name: '',
  489 + name: 'ff',
398 490 value: 1,
399 491 },
400 492 ],
401 493 dataType: 'BOOL',
402   - direction: 'PARAM_INPUT',
403   - identifier: 'NumThreads',
404   - name: '使用线程数',
405   - paraOrder: 3,
  494 + direction: 'PARAM_OUTPUT',
  495 + identifier: 'bol',
  496 + name: '测试输出回显bool类型',
  497 + paraOrder: 2,
406 498 },
407 499 {
  500 + id: buildUUID(),
  501 +
408 502 custom: true,
409 503 dataSpecsList: [
410 504 {
  505 + id: buildUUID(),
  506 +
  507 + childDataType: 'INT',
  508 + childName: '测试输出回显结构体类型1',
  509 + childSpecsDTO: {
  510 + dataType: 'INT',
  511 + max: '22',
  512 + min: '11',
  513 + step: '4',
  514 + unit: 'mm/hour',
  515 + unitName: '降雨量',
  516 + },
  517 + custom: true,
  518 + dataSpecs: {
  519 + dataType: 'INT',
  520 + max: '22',
  521 + min: '11',
  522 + step: '4',
  523 + unit: 'mm/hour',
  524 + unitName: '降雨量',
  525 + },
  526 + dataType: 'STRUCT',
  527 + identifier: '1',
  528 + isStd: 0,
  529 + name: '测试输出回显结构体类型1',
  530 + },
  531 + {
  532 + id: buildUUID(),
  533 +
411 534 childDataType: 'BOOL',
412 535 childEnumSpecsDTO: [
413 536 {
414 537 dataType: 'BOOL',
415   - name: '关1',
  538 + name: 'ff',
416 539 value: 0,
417 540 },
418 541 {
419 542 dataType: 'BOOL',
420   - name: '开1',
  543 + name: 'gg',
421 544 value: 1,
422 545 },
423 546 ],
424   - childName: '结构体里面1',
  547 + childName: '测试输出回显结构体类型2',
425 548 custom: true,
426 549 dataSpecsList: [
427 550 {
428 551 dataType: 'BOOL',
429   - name: '关1',
  552 + name: 'ff',
430 553 value: 0,
431 554 },
432 555 {
433 556 dataType: 'BOOL',
434   - name: '开1',
  557 + name: 'gg',
435 558 value: 1,
436 559 },
437 560 ],
438 561 dataType: 'STRUCT',
439   - identifier: 's11',
  562 + identifier: '3',
440 563 isStd: 0,
441   - name: '结构体里面1',
  564 + name: '测试输出回显结构体类型2',
442 565 },
443 566 {
  567 + id: buildUUID(),
  568 +
444 569 childDataType: 'TEXT',
445   - childName: '结构体里面2',
  570 + childName: '测试输出回显结构体类型3',
446 571 childSpecsDTO: {
447 572 dataType: 'TEXT',
448 573 length: 10240,
... ... @@ -453,374 +578,21 @@ export const mockData = {
453 578 length: 10240,
454 579 },
455 580 dataType: 'STRUCT',
456   - identifier: 's2',
457   - isStd: 0,
458   - name: '结构体里面2',
459   - },
460   - {
461   - childDataType: 'DOUBLE',
462   - childName: '结构体里面3',
463   - childSpecsDTO: {
464   - dataType: 'DOUBLE',
465   - max: '22',
466   - min: '11',
467   - step: '3',
468   - unit: 'mm/s',
469   - unitName: '毫米每秒',
470   - },
471   - custom: true,
472   - dataSpecs: {
473   - dataType: 'DOUBLE',
474   - max: '22',
475   - min: '11',
476   - step: '3',
477   - unit: 'mm/s',
478   - unitName: '毫米每秒',
479   - },
480   - dataType: 'STRUCT',
481   - identifier: 's3',
  581 + identifier: '12',
482 582 isStd: 0,
483   - name: '结构体里面3',
  583 + name: '测试输出回显结构体类型3',
484 584 },
485 585 ],
486 586 dataType: 'STRUCT',
487   - direction: 'PARAM_INPUT',
488   - identifier: 's1',
489   - name: '结构体1',
490   - paraOrder: 4,
  587 + direction: 'PARAM_OUTPUT',
  588 + identifier: 'struct',
  589 + name: '测试输出回显结构体类型',
  590 + paraOrder: 3,
491 591 },
492 592 ],
493   - outputParams: [],
494 593 productKey: 'hsrnXEfGFDv',
495 594 required: false,
496   - serviceName: '配置模型',
  595 + serviceName: '删除模型1',
497 596 },
498 597 ],
499   - // services: [
500   - // {
501   - // callType: 'SYNC',
502   - // createTs: 1666603858325,
503   - // custom: true,
504   - // description: '更新模型',
505   - // identifier: 'UpdateModel',
506   - // inputParams: [
507   - // {
508   - // id: buildUUID(),
509   - // custom: true,
510   - // dataSpecs: {
511   - // dataType: 'TEXT',
512   - // length: 128,
513   - // },
514   - // dataType: 'TEXT',
515   - // direction: 'PARAM_INPUT',
516   - // identifier: 'UpdateTaskID',
517   - // name: '更新任务ID',
518   - // paraOrder: 0,
519   - // },
520   - // {
521   - // id: buildUUID(),
522   - // custom: true,
523   - // dataSpecs: {
524   - // dataType: 'TEXT',
525   - // length: 128,
526   - // },
527   - // dataType: 'TEXT',
528   - // direction: 'PARAM_INPUT',
529   - // identifier: 'AlgorithmID',
530   - // name: '算法任务唯一标识',
531   - // paraOrder: 1,
532   - // },
533   - // {
534   - // id: buildUUID(),
535   -
536   - // custom: true,
537   - // dataSpecs: {
538   - // dataType: 'TEXT',
539   - // length: 64,
540   - // },
541   - // dataType: 'TEXT',
542   - // direction: 'PARAM_INPUT',
543   - // identifier: 'AlgorithmName',
544   - // name: '算法名称',
545   - // paraOrder: 2,
546   - // },
547   - // {
548   - // id: buildUUID(),
549   -
550   - // custom: true,
551   - // dataSpecs: {
552   - // dataType: 'INT',
553   - // max: '128',
554   - // min: '0',
555   - // precise: 0,
556   - // step: '1',
557   - // unit: '',
558   - // unitName: '无',
559   - // },
560   - // dataType: 'INT',
561   - // direction: 'PARAM_INPUT',
562   - // identifier: 'NumThreads',
563   - // name: '使用线程数',
564   - // paraOrder: 4,
565   - // },
566   - // {
567   - // id: buildUUID(),
568   -
569   - // custom: true,
570   - // dataSpecs: {
571   - // dataType: 'TEXT',
572   - // length: 128,
573   - // },
574   - // dataType: 'TEXT',
575   - // direction: 'PARAM_INPUT',
576   - // identifier: 'ModelID',
577   - // name: '模型唯一标识',
578   - // paraOrder: 5,
579   - // },
580   - // {
581   - // id: buildUUID(),
582   -
583   - // custom: true,
584   - // dataSpecs: {
585   - // dataType: 'TEXT',
586   - // length: 64,
587   - // },
588   - // dataType: 'TEXT',
589   - // direction: 'PARAM_INPUT',
590   - // identifier: 'ModelName',
591   - // name: '模型名称',
592   - // paraOrder: 6,
593   - // },
594   - // {
595   - // id: buildUUID(),
596   -
597   - // custom: true,
598   - // dataSpecs: {
599   - // dataType: 'TEXT',
600   - // length: 64,
601   - // },
602   - // dataType: 'TEXT',
603   - // direction: 'PARAM_INPUT',
604   - // identifier: 'ModelVersion',
605   - // name: '模型版本',
606   - // paraOrder: 7,
607   - // },
608   - // {
609   - // id: buildUUID(),
610   -
611   - // custom: true,
612   - // dataSpecs: {
613   - // dataType: 'TEXT',
614   - // length: 1024,
615   - // },
616   - // dataType: 'TEXT',
617   - // direction: 'PARAM_INPUT',
618   - // identifier: 'ModelURL',
619   - // name: '模型地址',
620   - // paraOrder: 8,
621   - // },
622   - // {
623   - // id: buildUUID(),
624   -
625   - // custom: true,
626   - // dataSpecs: {
627   - // dataType: 'TEXT',
628   - // length: 128,
629   - // },
630   - // dataType: 'TEXT',
631   - // direction: 'PARAM_INPUT',
632   - // identifier: 'ModelMD5',
633   - // name: '模型文件MD5',
634   - // paraOrder: 9,
635   - // },
636   - // {
637   - // id: buildUUID(),
638   -
639   - // custom: true,
640   - // dataSpecs: {
641   - // dataType: 'TEXT',
642   - // length: 64,
643   - // },
644   - // dataType: 'TEXT',
645   - // direction: 'PARAM_INPUT',
646   - // identifier: 'ModelPlatform',
647   - // name: '模型平台',
648   - // paraOrder: 10,
649   - // },
650   - // {
651   - // id: buildUUID(),
652   -
653   - // custom: true,
654   - // dataSpecs: {
655   - // dataType: 'TEXT',
656   - // length: 128,
657   - // },
658   - // dataType: 'TEXT',
659   - // direction: 'PARAM_INPUT',
660   - // identifier: 'ModelTaskID',
661   - // name: '模型生成任务ID',
662   - // paraOrder: 11,
663   - // },
664   - // {
665   - // id: buildUUID(),
666   -
667   - // custom: true,
668   - // dataSpecs: {
669   - // dataType: 'TEXT',
670   - // length: 64,
671   - // },
672   - // dataType: 'TEXT',
673   - // direction: 'PARAM_INPUT',
674   - // identifier: 'ModelEncryptType',
675   - // name: '模型加密方式',
676   - // paraOrder: 12,
677   - // },
678   - // {
679   - // id: buildUUID(),
680   -
681   - // custom: true,
682   - // dataSpecs: {
683   - // dataType: 'TEXT',
684   - // length: 2048,
685   - // },
686   - // dataType: 'TEXT',
687   - // direction: 'PARAM_INPUT',
688   - // identifier: 'ModelExtension',
689   - // name: '扩展信息',
690   - // paraOrder: 13,
691   - // },
692   - // {
693   - // id: buildUUID(),
694   -
695   - // custom: true,
696   - // dataSpecsList: [
697   - // {
698   - // id: buildUUID(),
699   -
700   - // childDataType: 'TEXT',
701   - // childName: '模型结构体参数1',
702   - // childSpecsDTO: {
703   - // dataType: 'TEXT',
704   - // length: 10240,
705   - // },
706   - // custom: true,
707   - // dataSpecs: {
708   - // dataType: 'TEXT',
709   - // length: 10240,
710   - // },
711   - // dataType: 'STRUCT',
712   - // identifier: 'ModelParams1',
713   - // isStd: 0,
714   - // name: '模型结构体参数1',
715   - // },
716   - // {
717   - // id: buildUUID(),
718   -
719   - // childDataType: 'BOOL',
720   - // childEnumSpecsDTO: [
721   - // {
722   - // dataType: 'BOOL',
723   - // name: '1',
724   - // value: 0,
725   - // },
726   - // {
727   - // dataType: 'BOOL',
728   - // name: '0',
729   - // value: 1,
730   - // },
731   - // ],
732   - // childName: '模型结构体参数2',
733   - // custom: true,
734   - // dataSpecsList: [
735   - // {
736   - // id: buildUUID(),
737   -
738   - // dataType: 'BOOL',
739   - // name: '1',
740   - // value: 0,
741   - // },
742   - // {
743   - // id: buildUUID(),
744   -
745   - // dataType: 'BOOL',
746   - // name: '0',
747   - // value: 1,
748   - // },
749   - // ],
750   - // dataType: 'STRUCT',
751   - // identifier: 'ModelParams2',
752   - // isStd: 0,
753   - // name: '模型结构体参数2',
754   - // },
755   - // ],
756   - // dataType: 'STRUCT',
757   - // direction: 'PARAM_INPUT',
758   - // identifier: 'ModelStruct',
759   - // name: '模型结构体',
760   - // paraOrder: 3,
761   - // },
762   - // ],
763   - // outputParams: [
764   - // {
765   - // id: buildUUID(),
766   -
767   - // custom: true,
768   - // dataSpecs: {
769   - // dataType: 'TEXT',
770   - // length: 10240,
771   - // },
772   - // dataType: 'TEXT',
773   - // direction: 'PARAM_OUTPUT',
774   - // identifier: 'Django',
775   - // name: 'django',
776   - // paraOrder: 0,
777   - // },
778   - // {
779   - // id: buildUUID(),
780   -
781   - // custom: true,
782   - // dataSpecsList: [
783   - // {
784   - // id: buildUUID(),
785   -
786   - // dataType: 'BOOL',
787   - // name: '1',
788   - // value: 0,
789   - // },
790   - // {
791   - // id: buildUUID(),
792   - // dataType: 'BOOL',
793   - // name: '0',
794   - // value: 1,
795   - // },
796   - // ],
797   - // dataType: 'BOOL',
798   - // direction: 'PARAM_OUTPUT',
799   - // identifier: 'Flask',
800   - // name: 'flask',
801   - // paraOrder: 1,
802   - // },
803   - // {
804   - // id: buildUUID(),
805   - // custom: true,
806   - // dataSpecs: {
807   - // dataType: 'INT',
808   - // max: '22',
809   - // min: '11',
810   - // step: '3',
811   - // unit: '只',
812   - // unitName: '只',
813   - // },
814   - // dataType: 'INT',
815   - // direction: 'PARAM_OUTPUT',
816   - // identifier: 'Tornado',
817   - // name: 'tornado',
818   - // paraOrder: 2,
819   - // },
820   - // ],
821   - // productKey: 'hsrnXEfGFDv',
822   - // required: false,
823   - // serviceName: '更新模型',
824   - // },
825   - // ],
826 598 };
... ...
... ... @@ -51,18 +51,18 @@ export const useChangeTypeGetTypeForm = (type, options: TForm) => {
51 51 {
52 52 dataType: options?.dataType,
53 53 name: options?.boolClose,
54   - value: '0',
  54 + value: 0,
55 55 },
56 56 {
57 57 dataType: options?.dataType,
58 58 name: options?.boolOpen,
59   - value: '1',
  59 + value: 1,
60 60 },
61 61 ];
62 62 case 'TEXT':
63 63 return {
64 64 dataType: options?.dataType,
65   - length: options?.length,
  65 + length: Number(options?.length),
66 66 };
67 67 }
68 68 };
... ...