Showing
16 changed files
with
637 additions
and
134 deletions
... | ... | @@ -23,31 +23,31 @@ export const physicalColumn: BasicColumn[] = [ |
23 | 23 | { |
24 | 24 | title: '功能名称', |
25 | 25 | dataIndex: 'name', |
26 | - width: 80, | |
26 | + width: 90, | |
27 | 27 | }, |
28 | 28 | { |
29 | 29 | title: '标识符', |
30 | 30 | dataIndex: 'type', |
31 | - width: 80, | |
31 | + width: 90, | |
32 | 32 | }, |
33 | 33 | { |
34 | 34 | title: '数据类型', |
35 | 35 | dataIndex: 'transportType', |
36 | - width: 80, | |
36 | + width: 100, | |
37 | 37 | }, |
38 | 38 | { |
39 | 39 | title: '单位', |
40 | 40 | dataIndex: 'description1', |
41 | - width: 70, | |
41 | + width: 90, | |
42 | 42 | }, |
43 | 43 | { |
44 | 44 | title: '读写类型', |
45 | 45 | dataIndex: 'default', |
46 | - width: 70, | |
46 | + width: 60, | |
47 | 47 | customRender: ({ record }) => { |
48 | 48 | const status = record.actionStatus; |
49 | 49 | const enable = status === 'SUCCESS' ? '读写' : '只读'; |
50 | - const color = enable === '读写' ? 'blue' : 'blue'; | |
50 | + const color = enable === '读写' ? 'blue' : 'green'; | |
51 | 51 | const text = enable === '读写' ? '读写' : '只读'; |
52 | 52 | return h(Tag, { color }, () => text); |
53 | 53 | }, |
... | ... | @@ -55,12 +55,12 @@ export const physicalColumn: BasicColumn[] = [ |
55 | 55 | { |
56 | 56 | title: '创建人', |
57 | 57 | dataIndex: 'description', |
58 | - width: 90, | |
58 | + width: 80, | |
59 | 59 | }, |
60 | 60 | { |
61 | 61 | title: '创建时间', |
62 | 62 | dataIndex: 'createTime', |
63 | - width: 140, | |
63 | + width: 150, | |
64 | 64 | }, |
65 | 65 | ]; |
66 | 66 | |
... | ... | @@ -406,3 +406,119 @@ export const formSchema: FormSchema[] = [ |
406 | 406 | }, |
407 | 407 | }, |
408 | 408 | ]; |
409 | + | |
410 | +export const mockData: any = async () => { | |
411 | + const res = await [ | |
412 | + { | |
413 | + name: '亮度百分比', | |
414 | + type: 'Brightness', | |
415 | + transportType: 'int32(整数型)', | |
416 | + description1: '饱和度/aw', | |
417 | + default: '1', | |
418 | + actionStatus: 'SUCCESS', | |
419 | + description: 'cheche', | |
420 | + createTime: '2022-10-20 10:24:22', | |
421 | + }, | |
422 | + { | |
423 | + name: '运行状态', | |
424 | + type: 'RunningState', | |
425 | + transportType: 'bool(布尔型)', | |
426 | + description1: '', | |
427 | + default: '1', | |
428 | + actionStatus: 'FA', | |
429 | + description: 'cheche', | |
430 | + createTime: '2022-10-20 10:24:22', | |
431 | + }, | |
432 | + { | |
433 | + name: '设备运行状态', | |
434 | + type: 'E_Status_UP', | |
435 | + transportType: 'text(字符串)', | |
436 | + description1: '', | |
437 | + default: '1', | |
438 | + actionStatus: 'D', | |
439 | + description: 'cheche', | |
440 | + createTime: '2022-10-20 10:24:22', | |
441 | + }, | |
442 | + { | |
443 | + name: '过流告警使能', | |
444 | + type: 'OverCurrentEnable', | |
445 | + transportType: 'struct(结构体)', | |
446 | + description1: '', | |
447 | + default: '1', | |
448 | + actionStatus: 'SUCCESS', | |
449 | + description: 'cheche', | |
450 | + createTime: '2022-10-20 10:24:22', | |
451 | + }, | |
452 | + { | |
453 | + name: '变频器运行状态1', | |
454 | + type: 'Brightness', | |
455 | + transportType: 'int32(整数型)', | |
456 | + description1: '转每分钟/turn/m', | |
457 | + default: '1', | |
458 | + actionStatus: 'Fa', | |
459 | + description: 'cheche', | |
460 | + createTime: '2022-10-20 10:24:22', | |
461 | + }, | |
462 | + { | |
463 | + name: '产品序列号', | |
464 | + type: 'SerialNo', | |
465 | + transportType: 'text(字符串)', | |
466 | + description1: '', | |
467 | + default: '1', | |
468 | + actionStatus: 'FA', | |
469 | + description: 'cheche', | |
470 | + createTime: '2022-10-20 10:24:22', | |
471 | + }, | |
472 | + { | |
473 | + name: '音量百分比', | |
474 | + type: 'Volume', | |
475 | + transportType: 'int32(整数型)', | |
476 | + description1: '分贝/db', | |
477 | + default: '1', | |
478 | + actionStatus: 'SUCCESS', | |
479 | + description: 'cheche', | |
480 | + createTime: '2022-10-20 10:24:22', | |
481 | + }, | |
482 | + { | |
483 | + name: '易释放氰化物', | |
484 | + type: 'easy_release_cyanide', | |
485 | + transportType: 'double(双精度浮点型)', | |
486 | + description1: '毫克每升/mg/L', | |
487 | + default: '1', | |
488 | + actionStatus: 'SUCCESS', | |
489 | + description: 'cheche', | |
490 | + createTime: '2022-10-20 10:24:22', | |
491 | + }, | |
492 | + { | |
493 | + name: '湿度', | |
494 | + type: 'Humidity', | |
495 | + transportType: 'float(单精度浮点型)', | |
496 | + description1: '相对湿度/%RH', | |
497 | + default: '1', | |
498 | + actionStatus: 'SUCCESS', | |
499 | + description: 'cheche', | |
500 | + createTime: '2022-10-20 10:24:22', | |
501 | + }, | |
502 | + { | |
503 | + name: '设备固件版本', | |
504 | + type: 'FirmwareVersion', | |
505 | + transportType: 'text(字符串)', | |
506 | + description1: '', | |
507 | + default: '1', | |
508 | + actionStatus: 'SUCCESS', | |
509 | + description: 'cheche', | |
510 | + createTime: '2022-10-20 10:24:22', | |
511 | + }, | |
512 | + { | |
513 | + name: '用电量', | |
514 | + type: 'PowerConsumption', | |
515 | + transportType: 'float(单精度浮点型)', | |
516 | + description1: '千瓦时/kW.h', | |
517 | + default: '1', | |
518 | + actionStatus: 'F', | |
519 | + description: 'cheche', | |
520 | + createTime: '2022-10-20 10:24:22', | |
521 | + }, | |
522 | + ]; | |
523 | + return res; | |
524 | +}; | ... | ... |
... | ... | @@ -8,20 +8,20 @@ |
8 | 8 | <template #toolbar> |
9 | 9 | <div class="p-column"> |
10 | 10 | <div class="p-content"> |
11 | - <a-alert | |
12 | - style="width: 420px" | |
13 | - message="当前展示的是已发布到线上的功能定义,如需修改,请点击" | |
14 | - type="info" | |
15 | - show-icon | |
16 | - /> | |
17 | - <span | |
18 | - @click="handleEditPhysicalModel" | |
19 | - class="ml-2" | |
20 | - style="color: #409eff; cursor: pointer" | |
21 | - type="primary" | |
22 | - size="small" | |
23 | - >“编辑物模型”</span | |
24 | - > | |
11 | + <a-alert v-if="!isShowBtn" style="width: 511px" type="info" show-icon> | |
12 | + <template #message> | |
13 | + <span | |
14 | + >当前展示的是已发布到线上的功能定义,如需修改,请点击 | |
15 | + <span | |
16 | + @click="handleEditPhysicalModel" | |
17 | + class="ml-2" | |
18 | + style="color: #409eff; cursor: pointer" | |
19 | + size="small" | |
20 | + >“编辑物模型”</span | |
21 | + ></span | |
22 | + > | |
23 | + </template> | |
24 | + </a-alert> | |
25 | 25 | </div> |
26 | 26 | <div style="height: 20px"></div> |
27 | 27 | <div class="p-bottom"> |
... | ... | @@ -131,11 +131,12 @@ |
131 | 131 | import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; |
132 | 132 | import { deleteReportManage } from '/@/api/report/reportManager'; |
133 | 133 | import { Authority } from '/@/components/Authority'; |
134 | - import { deviceConfigGetQuery } from '/@/api/device/deviceConfigApi'; | |
134 | + // import { mockData } from '/@/api/device/deviceConfigApi'; | |
135 | 135 | import PhysicalModelModal from './cpns/physical/PhysicalModelModal.vue'; |
136 | 136 | import PhysicalModelTsl from './cpns/physical/PhysicalModelTsl.vue'; |
137 | 137 | import { Popconfirm } from 'ant-design-vue'; |
138 | 138 | import { useMessage } from '/@/hooks/web/useMessage'; |
139 | + import { mockData } from '../device.profile.data'; | |
139 | 140 | |
140 | 141 | defineEmits(['register']); |
141 | 142 | const { createMessage } = useMessage(); |
... | ... | @@ -144,7 +145,8 @@ |
144 | 145 | const [registerModalTsl, { openModal: openModalTsl }] = useModal(); |
145 | 146 | |
146 | 147 | const [registerTable, { reload, setProps }] = useTable({ |
147 | - api: deviceConfigGetQuery, | |
148 | + // api: deviceConfigGetQuery, | |
149 | + api: mockData, | |
148 | 150 | columns: physicalColumn, |
149 | 151 | showIndexColumn: false, |
150 | 152 | clickToRowSelect: false, |
... | ... | @@ -184,6 +186,7 @@ |
184 | 186 | isUpdate: true, |
185 | 187 | record, |
186 | 188 | isView: true, |
189 | + isText: 'view', | |
187 | 190 | }); |
188 | 191 | } |
189 | 192 | }; |
... | ... | @@ -194,11 +197,13 @@ |
194 | 197 | isUpdate: false, |
195 | 198 | record, |
196 | 199 | isView: false, |
200 | + isText: 'edit', | |
197 | 201 | }); |
198 | 202 | } else { |
199 | 203 | openModal(true, { |
200 | 204 | isUpdate: true, |
201 | 205 | isView: false, |
206 | + isText: 'add', | |
202 | 207 | }); |
203 | 208 | } |
204 | 209 | }; | ... | ... |
... | ... | @@ -35,12 +35,13 @@ |
35 | 35 | </div> |
36 | 36 | </template> |
37 | 37 | <script lang="ts" setup> |
38 | - import { ref, unref } from 'vue'; | |
38 | + import { ref, unref, reactive } from 'vue'; | |
39 | 39 | import { BasicModal, useModalInner } from '/@/components/Modal'; |
40 | 40 | import { Tabs, TabPane, Typography, TypographyParagraph } from 'ant-design-vue'; |
41 | 41 | import Attribute from './cpns/Attribute.vue'; |
42 | 42 | import Service from './cpns/Service.vue'; |
43 | 43 | import Events from './cpns/Events.vue'; |
44 | + import { mockData } from '../physical/cpns/components/mock'; | |
44 | 45 | |
45 | 46 | defineEmits(['register']); |
46 | 47 | const blockContent = `属性一般是设备的运行状态,如当前温度等;服务是设备可被调用的方法,支持定义参数,如执行某项任务;事件则是设备上报的 |
... | ... | @@ -52,29 +53,50 @@ |
52 | 53 | const EventsRef = ref<InstanceType<typeof Events>>(); |
53 | 54 | const isUpdate = ref(false); |
54 | 55 | const isViewDetail = ref(''); |
56 | + const isText = ref(''); | |
57 | + const allData: any = reactive({ | |
58 | + properties: [], | |
59 | + events: [], | |
60 | + services: [], | |
61 | + productKey: '', | |
62 | + _ppk: {}, | |
63 | + }); | |
55 | 64 | const [register, { closeModal, setModalProps }] = useModalInner(async (data) => { |
56 | 65 | setModalProps({ loading: true }); |
66 | + handleCancel(false); | |
57 | 67 | isUpdate.value = data.isUpdate; |
58 | 68 | isViewDetail.value = data.isView; |
59 | - // AttrRef.value?.setFormData() | |
60 | - setModalProps({ loading: false }); | |
69 | + isText.value = data.isText; | |
61 | 70 | if (!unref(isViewDetail)) { |
62 | 71 | const title = !unref(isUpdate) ? '编辑物模型' : '新增物模型'; |
72 | + if (!unref(isUpdate)) { | |
73 | + AttrRef.value?.setFormData(mockData.properties); | |
74 | + } | |
63 | 75 | setModalProps({ title, showOkBtn: true, showCancelBtn: true }); |
64 | 76 | if (!unref(isUpdate)) { |
65 | 77 | } |
66 | 78 | } else { |
67 | 79 | setModalProps({ showOkBtn: false, showCancelBtn: false, title: '查看物模型' }); |
80 | + AttrRef.value?.setFormData(mockData.properties); | |
68 | 81 | } |
82 | + setModalProps({ loading: false }); | |
69 | 83 | }); |
70 | - const handleCancel = () => { | |
84 | + const handleCancel = (flag) => { | |
71 | 85 | AttrRef.value?.resetFormData(); |
72 | - closeModal(); | |
86 | + activeKey.value = '1'; | |
87 | + allData.properties = []; | |
88 | + allData.events = []; | |
89 | + allData.services = []; | |
90 | + if (flag) { | |
91 | + closeModal(); | |
92 | + } | |
73 | 93 | }; |
74 | 94 | const handleSubmit = async () => { |
75 | 95 | const value = await AttrRef.value?.getFormData(); |
76 | 96 | if (!value) return; |
77 | - console.log('搜集值', value); | |
97 | + allData.properties.push(value); | |
98 | + console.log('搜集值', allData); | |
99 | + closeModal(); | |
78 | 100 | }; |
79 | 101 | </script> |
80 | 102 | ... | ... |
1 | 1 | <template> |
2 | 2 | <div> |
3 | - <BasicForm @register="register" /> | |
3 | + <BasicForm @register="register"> | |
4 | + <template #valueRangeSlot> | |
5 | + <div style="display: flex"> | |
6 | + <Input | |
7 | + type="number" | |
8 | + v-model:vlaue="minMaxObj.min" | |
9 | + placeholder="最小值" | |
10 | + @blur="onInputBlurMin" | |
11 | + /> | |
12 | + <span>~</span> | |
13 | + <Input | |
14 | + type="number" | |
15 | + v-model:vlaue="minMaxObj.max" | |
16 | + placeholder="最大值" | |
17 | + @blur="onInputBlurMax" | |
18 | + /> | |
19 | + </div> | |
20 | + </template> | |
21 | + <template #outputParamSlot> | |
22 | + <div> | |
23 | + <template v-for="(item, index) in outputParamData" :key="item"> | |
24 | + <span style="display: none">{{ item }}</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"> | |
36 | + <span style="color: #0170cc; cursor: pointer">+</span> | |
37 | + <span style="color: #0170cc; cursor: pointer" @click="handleAddOutParam">增加参数</span> | |
38 | + </div> | |
39 | + </div> | |
40 | + </template> | |
41 | + </BasicForm> | |
42 | + <AddParamsModal @register="registerModal" @data="getData" /> | |
4 | 43 | </div> |
5 | 44 | </template> |
6 | 45 | <script lang="ts" setup> |
46 | + import { ref, unref, reactive } from 'vue'; | |
7 | 47 | import { BasicForm, useForm } from '/@/components/Form'; |
8 | 48 | import { attrSchemas } from './config'; |
49 | + import { useModal } from '/@/components/Modal'; | |
50 | + import InputParamItem from './components/InputParamItem.vue'; | |
51 | + import AddParamsModal from './components/AddParamsModal.vue'; | |
52 | + import { Input } from 'ant-design-vue'; | |
53 | + import { useMessage } from '/@/hooks/web/useMessage'; | |
54 | + | |
55 | + const { createMessage } = useMessage(); | |
56 | + const outputParamData: any = ref([]); | |
57 | + const minMaxObj = reactive({ | |
58 | + min: '', | |
59 | + max: '', | |
60 | + }); | |
61 | + | |
62 | + const dynamicBindRef = { | |
63 | + outputParamItemRef: ref([]), | |
64 | + }; | |
65 | + const [registerModal, { openModal }] = useModal(); | |
9 | 66 | |
10 | 67 | const [register, { validate, setFieldsValue, resetFields }] = useForm({ |
11 | 68 | labelWidth: 100, |
... | ... | @@ -17,20 +74,91 @@ |
17 | 74 | submitOnReset: false, |
18 | 75 | showActionButtonGroup: false, |
19 | 76 | }); |
77 | + const onInputBlurMin = (e) => (minMaxObj.min = e.target.value); | |
78 | + const onInputBlurMax = (e) => (minMaxObj.max = e.target.value); | |
79 | + | |
80 | + const getData = (d, f) => { | |
81 | + if (f == 'output') { | |
82 | + unref(outputParamData).push(d); | |
83 | + if (d.id !== null) { | |
84 | + const findIndex = unref(outputParamData).findIndex((f) => f.id !== d.id); | |
85 | + if (findIndex !== -1) unref(outputParamData).splice(findIndex, 1); | |
86 | + } | |
87 | + } | |
88 | + }; | |
89 | + | |
90 | + const handleAddOutParam = () => { | |
91 | + openModal(true, { | |
92 | + isUpdate: true, | |
93 | + flag: 'output', | |
94 | + excludeStruct: true, | |
95 | + }); | |
96 | + }; | |
97 | + | |
98 | + const deleteOutParItem = (index) => { | |
99 | + unref(outputParamData).splice(index, 1); | |
100 | + }; | |
101 | + const editOutParItem = (item) => { | |
102 | + openModal(true, { | |
103 | + isUpdate: false, | |
104 | + record: item, | |
105 | + flag: 'output', | |
106 | + excludeStruct: true, | |
107 | + }); | |
108 | + }; | |
20 | 109 | |
21 | 110 | //回显数据 |
22 | 111 | const setFormData = (v) => { |
23 | - setFieldsValue(v); | |
112 | + setFieldsValue(v[0]); | |
113 | + const { dataSpecsList } = v[0]; | |
114 | + outputParamData.value = [...new Array(dataSpecsList.length).keys()]; | |
115 | + outputParamData.value = v[0].dataSpecsList; | |
116 | + // dataSpecsList.forEach((item, index) => { | |
117 | + // nextTick(() => { | |
118 | + // unref(dynamicBindRef.outputParamItemRef)[index].setFormData(dataSpecsList) | |
119 | + // }) | |
120 | + // }); | |
24 | 121 | }; |
25 | 122 | //获取数据 |
123 | + const getStructList = () => { | |
124 | + const val = unref(dynamicBindRef.outputParamItemRef)?.map((item: any) => item.getFormData()); | |
125 | + return val; | |
126 | + }; | |
127 | + | |
26 | 128 | async function getFormData() { |
27 | 129 | const values = await validate(); |
28 | 130 | if (!values) return; |
29 | - return values; | |
131 | + const dataSpecsList = getStructList(); | |
132 | + if (Number(minMaxObj.min) > Number(minMaxObj.max)) { | |
133 | + createMessage.error('最大值必须大于最小值,整数型不能有小数位,单精度有效位为7,双精度为16'); | |
134 | + throw '最大值必须大于最小值,整数型不能有小数位,单精度有效位为7,双精度为16'; | |
135 | + } | |
136 | + if (Number(values.step) > Number(minMaxObj.max) - Number(minMaxObj.min)) { | |
137 | + createMessage.error('步长不能大于取值范围的差值'); | |
138 | + throw '步长不能大于取值范围的差值'; | |
139 | + } | |
140 | + const isStruct = values.dataType === 'STRUCT'; | |
141 | + const dataSpecs = { | |
142 | + ...minMaxObj, | |
143 | + ...{ step: values.step }, | |
144 | + ...{ unit: values.unit }, | |
145 | + ...{ dataType: values.dataType }, | |
146 | + }; | |
147 | + Reflect.deleteProperty(values, 'valueRange'); | |
148 | + Reflect.deleteProperty(values, 'step'); | |
149 | + Reflect.deleteProperty(values, 'unit'); | |
150 | + Reflect.deleteProperty(values, 'outputParam'); | |
151 | + return { | |
152 | + ...values, | |
153 | + ...{ dataSpecs: isStruct ? null : dataSpecs }, | |
154 | + ...{ dataSpecsList: isStruct ? dataSpecsList : null }, | |
155 | + }; | |
30 | 156 | } |
31 | 157 | //清空数据 |
32 | 158 | const resetFormData = () => { |
33 | 159 | resetFields(); |
160 | + Reflect.set(minMaxObj, 'min', ''); | |
161 | + Reflect.set(minMaxObj, 'max', ''); | |
34 | 162 | }; |
35 | 163 | |
36 | 164 | defineExpose({ | ... | ... |
... | ... | @@ -92,12 +92,14 @@ |
92 | 92 | openModal(true, { |
93 | 93 | isUpdate: true, |
94 | 94 | flag: 'input', |
95 | + excludeStruct: false, | |
95 | 96 | }); |
96 | 97 | }; |
97 | 98 | const handleAddOutParam = () => { |
98 | 99 | openModal(true, { |
99 | 100 | isUpdate: true, |
100 | 101 | flag: 'output', |
102 | + excludeStruct: false, | |
101 | 103 | }); |
102 | 104 | }; |
103 | 105 | ... | ... |
src/views/device/profiles/step/cpns/physical/cpns/components/1.json
deleted
100644 → 0
1 | -{ | |
2 | - "_ppk": {}, | |
3 | - "events": [], | |
4 | - "productKey": "hsrnBYoBGFe", | |
5 | - "properties": [], | |
6 | - "services": [ | |
7 | - { | |
8 | - "callType": "ASYNC", | |
9 | - "createTs": 1666172133097, | |
10 | - "custom": true, | |
11 | - "identifier": "1", | |
12 | - "inputParams": [ | |
13 | - { | |
14 | - "custom": true, | |
15 | - "dataSpecs": { | |
16 | - "dataType": "INT", | |
17 | - "max": "2", | |
18 | - "min": "1", | |
19 | - "step": "1", | |
20 | - "unit": "W/㎡", | |
21 | - "unitName": "太阳总辐射" | |
22 | - }, | |
23 | - "dataType": "INT", | |
24 | - "direction": "PARAM_INPUT", | |
25 | - "identifier": "1", | |
26 | - "name": "1", | |
27 | - "paraOrder": 0 | |
28 | - } | |
29 | - ], | |
30 | - "outputParams": [], | |
31 | - "productKey": "hsrnBYoBGFe", | |
32 | - "required": false, | |
33 | - "serviceName": "1" | |
34 | - }, | |
35 | - { | |
36 | - "callType": "ASYNC", | |
37 | - "createTs": 1666172369588, | |
38 | - "custom": true, | |
39 | - "identifier": "wufu1", | |
40 | - "inputParams": [ | |
41 | - { | |
42 | - "custom": true, | |
43 | - "dataSpecs": { | |
44 | - "dataType": "INT", | |
45 | - "max": "200", | |
46 | - "min": "100", | |
47 | - "step": "11", | |
48 | - "unit": "dS/m", | |
49 | - "unitName": "土壤EC值" | |
50 | - }, | |
51 | - "dataType": "INT", | |
52 | - "direction": "PARAM_INPUT", | |
53 | - "identifier": "ceshi", | |
54 | - "name": "ceshi1", | |
55 | - "paraOrder": 0 | |
56 | - } | |
57 | - ], | |
58 | - "outputParams": [], | |
59 | - "productKey": "hsrnBYoBGFe", | |
60 | - "required": false, | |
61 | - "serviceName": "服务1" | |
62 | - } | |
63 | - ] | |
64 | -} |
... | ... | @@ -3,9 +3,9 @@ |
3 | 3 | <BasicForm @register="registerForm"> |
4 | 4 | <template #valueRangeSlot> |
5 | 5 | <div style="display: flex"> |
6 | - <a-input v-model:vlaue="minMaxObj.min" placeholder="最小值" /> | |
6 | + <a-input v-model:vlaue="minMaxObj.min" placeholder="最小值" @blur="onInputBlurMin" /> | |
7 | 7 | <span>~</span> |
8 | - <a-input v-model:vlaue="minMaxObj.max" placeholder="最大值" /> | |
8 | + <a-input v-model:vlaue="minMaxObj.max" placeholder="最大值" @blur="onInputBlurMax" /> | |
9 | 9 | </div> |
10 | 10 | </template> |
11 | 11 | <template #structSlot> |
... | ... | @@ -39,8 +39,11 @@ |
39 | 39 | import { useModal } from '/@/components/Modal'; |
40 | 40 | import InputParamItem from './InputParamItem.vue'; |
41 | 41 | import AddParamsModal from './AddParamsModal.vue'; |
42 | + import { findDictItemByCode } from '/@/api/system/dict'; | |
43 | + import { useMessage } from '/@/hooks/web/useMessage'; | |
42 | 44 | |
43 | 45 | defineEmits(['register']); |
46 | + const { createMessage } = useMessage(); | |
44 | 47 | const outputParamData: any = ref([]); |
45 | 48 | const dynamicBindRef = { |
46 | 49 | outputParamItemRef: ref([]), |
... | ... | @@ -51,7 +54,7 @@ |
51 | 54 | }); |
52 | 55 | const [registerModal, { openModal }] = useModal(); |
53 | 56 | |
54 | - const [registerForm, { validate, setFieldsValue, resetFields }] = useForm({ | |
57 | + const [registerForm, { validate, setFieldsValue, resetFields, updateSchema }] = useForm({ | |
55 | 58 | labelWidth: 100, |
56 | 59 | schemas: addParamsSchemas, |
57 | 60 | actionColOptions: { |
... | ... | @@ -61,6 +64,8 @@ |
61 | 64 | submitOnReset: false, |
62 | 65 | showActionButtonGroup: false, |
63 | 66 | }); |
67 | + const onInputBlurMin = (e) => (minMaxObj.min = e.target.value); | |
68 | + const onInputBlurMax = (e) => (minMaxObj.max = e.target.value); | |
64 | 69 | |
65 | 70 | const getData = (d, f) => { |
66 | 71 | if (f == 'output') { |
... | ... | @@ -76,6 +81,7 @@ |
76 | 81 | openModal(true, { |
77 | 82 | isUpdate: true, |
78 | 83 | flag: 'output', |
84 | + excludeStruct: true, | |
79 | 85 | }); |
80 | 86 | }; |
81 | 87 | |
... | ... | @@ -90,10 +96,67 @@ |
90 | 96 | }); |
91 | 97 | }; |
92 | 98 | |
99 | + const updateFormExcludeStruct = async (flag) => { | |
100 | + const res: any = await findDictItemByCode({ dictCode: 'data_type' }); | |
101 | + const optionTrue = res | |
102 | + .map((m) => { | |
103 | + if (flag) { | |
104 | + if (m.itemValue !== 'STRUCT') { | |
105 | + return { | |
106 | + value: m.itemValue, | |
107 | + label: m.itemText, | |
108 | + }; | |
109 | + } | |
110 | + } else { | |
111 | + return { | |
112 | + value: m.itemValue, | |
113 | + label: m.itemText, | |
114 | + }; | |
115 | + } | |
116 | + }) | |
117 | + .filter(Boolean); | |
118 | + updateSchema({ | |
119 | + field: 'dataType', | |
120 | + componentProps: { | |
121 | + options: optionTrue, | |
122 | + }, | |
123 | + }); | |
124 | + }; | |
125 | + | |
93 | 126 | const getFormData = async () => { |
94 | - const value = await validate(); | |
95 | - if (!value) return; | |
96 | - return value; | |
127 | + const values = await validate(); | |
128 | + if (!values) return; | |
129 | + if (Number(minMaxObj.min) > Number(minMaxObj.max)) { | |
130 | + createMessage.error('最大值必须大于最小值,整数型不能有小数位,单精度有效位为7,双精度为16'); | |
131 | + throw '最大值必须大于最小值,整数型不能有小数位,单精度有效位为7,双精度为16'; | |
132 | + } | |
133 | + if (Number(values.step) > Number(minMaxObj.max) - Number(minMaxObj.min)) { | |
134 | + createMessage.error('步长不能大于取值范围的差值'); | |
135 | + throw '步长不能大于取值范围的差值'; | |
136 | + } | |
137 | + const childSpecsDTO = { | |
138 | + dataType: values.dataType, | |
139 | + max: values.max, | |
140 | + min: values.min, | |
141 | + step: values.step, | |
142 | + unit: values.unit, | |
143 | + }; | |
144 | + const dataSpecs = { | |
145 | + dataType: values.dataType, | |
146 | + max: values.max, | |
147 | + min: values.min, | |
148 | + step: values.step, | |
149 | + unit: values.unit, | |
150 | + }; | |
151 | + return { | |
152 | + ...values, | |
153 | + ...{ dataSpecs }, | |
154 | + ...{ childSpecsDTO }, | |
155 | + ...{ | |
156 | + childDataType: values.dataType, | |
157 | + childName: values.name, | |
158 | + }, | |
159 | + }; | |
97 | 160 | }; |
98 | 161 | const setFormData = (v) => { |
99 | 162 | setFieldsValue(v); |
... | ... | @@ -108,6 +171,7 @@ |
108 | 171 | setFormData, |
109 | 172 | getFormData, |
110 | 173 | resetFormData, |
174 | + updateFormExcludeStruct, | |
111 | 175 | }); |
112 | 176 | </script> |
113 | 177 | ... | ... |
... | ... | @@ -25,6 +25,7 @@ |
25 | 25 | const AddParamFormRef = ref<InstanceType<typeof AddParamForm>>(); |
26 | 26 | const isUpdate = ref(false); |
27 | 27 | const isFlag = ref(''); |
28 | + const excludeStruct = ref(false); | |
28 | 29 | const getTitle = computed(() => (!isUpdate.value ? '编辑参数' : '新增参数')); |
29 | 30 | |
30 | 31 | const [register, { closeModal, setModalProps }] = useModalInner(async (data) => { |
... | ... | @@ -32,9 +33,15 @@ |
32 | 33 | handleCancel(false); |
33 | 34 | isUpdate.value = data.isUpdate; |
34 | 35 | isFlag.value = data.flag; |
36 | + excludeStruct.value = data.excludeStruct; | |
35 | 37 | AddParamFormRef.value?.setFormData(data.record); |
36 | 38 | setEditData.getEditData = data.record; |
37 | 39 | setModalProps({ loading: false }); |
40 | + if (excludeStruct.value) { | |
41 | + AddParamFormRef.value?.updateFormExcludeStruct(true); | |
42 | + } else { | |
43 | + AddParamFormRef.value?.updateFormExcludeStruct(false); | |
44 | + } | |
38 | 45 | }); |
39 | 46 | |
40 | 47 | const handleCancel = (flag) => { | ... | ... |
... | ... | @@ -17,7 +17,7 @@ |
17 | 17 | import { buildUUID } from '/@/utils/uuid'; |
18 | 18 | |
19 | 19 | const emit = defineEmits(['delete', 'edit']); |
20 | - defineProps({ | |
20 | + const props = defineProps({ | |
21 | 21 | index: { |
22 | 22 | type: Number, |
23 | 23 | required: true, |
... | ... | @@ -43,6 +43,16 @@ |
43 | 43 | }; |
44 | 44 | emit('edit', value); |
45 | 45 | }; |
46 | + | |
47 | + const getFormData = () => { | |
48 | + return props.item; | |
49 | + }; | |
50 | + // const setFormData = (v) => { | |
51 | + // console.log(v) | |
52 | + // } | |
53 | + defineExpose({ | |
54 | + getFormData, | |
55 | + }); | |
46 | 56 | </script> |
47 | 57 | <style lang="less" scoped> |
48 | 58 | :deep(.ant-card-body) { | ... | ... |
1 | +export const mockData = { | |
2 | + _ppk: {}, | |
3 | + events: [], | |
4 | + productKey: 'hsrnXEfGFDv', | |
5 | + properties: [ | |
6 | + { | |
7 | + createTs: 1666259889029, | |
8 | + custom: true, | |
9 | + customFlag: true, | |
10 | + dataSpecsList: [ | |
11 | + { | |
12 | + childDataType: 'INT', | |
13 | + childName: '测试参数1', | |
14 | + childSpecsDTO: { | |
15 | + dataType: 'INT', | |
16 | + max: '30', | |
17 | + min: '20', | |
18 | + step: '1', | |
19 | + unit: 'mm/hour', | |
20 | + unitName: '降雨量', | |
21 | + }, | |
22 | + custom: true, | |
23 | + dataSpecs: { | |
24 | + dataType: 'INT', | |
25 | + max: '30', | |
26 | + min: '20', | |
27 | + step: '1', | |
28 | + unit: 'mm/hour', | |
29 | + unitName: '降雨量', | |
30 | + }, | |
31 | + dataType: 'STRUCT', | |
32 | + identifier: 'iden2', | |
33 | + isStd: 0, | |
34 | + name: '测试参数1', | |
35 | + }, | |
36 | + { | |
37 | + childDataType: 'INT', | |
38 | + childName: '测试参数2', | |
39 | + childSpecsDTO: { | |
40 | + dataType: 'INT', | |
41 | + max: '40', | |
42 | + min: '30', | |
43 | + step: '2', | |
44 | + unit: 'pH', | |
45 | + unitName: 'PH值', | |
46 | + }, | |
47 | + custom: true, | |
48 | + dataSpecs: { | |
49 | + dataType: 'INT', | |
50 | + max: '40', | |
51 | + min: '30', | |
52 | + step: '2', | |
53 | + unit: 'pH', | |
54 | + unitName: 'PH值', | |
55 | + }, | |
56 | + dataType: 'STRUCT', | |
57 | + identifier: 'idne2', | |
58 | + isStd: 0, | |
59 | + name: '测试参数2', | |
60 | + }, | |
61 | + ], | |
62 | + dataType: 'STRUCT', | |
63 | + description: '21212', | |
64 | + identifier: 'iden1', | |
65 | + name: '测试功能', | |
66 | + productKey: 'hsrnXEfGFDv', | |
67 | + required: false, | |
68 | + rwFlag: 'READ_WRITE', | |
69 | + std: false, | |
70 | + }, | |
71 | + ], | |
72 | + services: [], | |
73 | +}; | ... | ... |
... | ... | @@ -26,7 +26,7 @@ export const defaultTslContent = { |
26 | 26 | |
27 | 27 | export const attrSchemas: FormSchema[] = [ |
28 | 28 | { |
29 | - field: 'configName', | |
29 | + field: 'name', | |
30 | 30 | label: '功能名称', |
31 | 31 | required: true, |
32 | 32 | component: 'Input', |
... | ... | @@ -39,7 +39,7 @@ export const attrSchemas: FormSchema[] = [ |
39 | 39 | }, |
40 | 40 | }, |
41 | 41 | { |
42 | - field: 'configName1', | |
42 | + field: 'identifier', | |
43 | 43 | label: '标识符', |
44 | 44 | required: true, |
45 | 45 | component: 'Input', |
... | ... | @@ -59,7 +59,7 @@ export const attrSchemas: FormSchema[] = [ |
59 | 59 | colProps: { |
60 | 60 | span: 9, |
61 | 61 | }, |
62 | - defaultValue: 'int32', | |
62 | + defaultValue: 'INT', | |
63 | 63 | componentProps: { |
64 | 64 | placeholder: '请选择数据类型', |
65 | 65 | api: findDictItemByCode, |
... | ... | @@ -71,7 +71,30 @@ export const attrSchemas: FormSchema[] = [ |
71 | 71 | }, |
72 | 72 | }, |
73 | 73 | { |
74 | - field: 'accessKeyId', | |
74 | + field: 'valueRange', | |
75 | + label: '取值范围', | |
76 | + component: 'Input', | |
77 | + slot: 'valueRangeSlot', | |
78 | + colProps: { | |
79 | + span: 18, | |
80 | + }, | |
81 | + ifShow: ({ values }) => isNumber(values.dataType), | |
82 | + }, | |
83 | + { | |
84 | + field: 'step', | |
85 | + label: '步长', | |
86 | + component: 'Input', | |
87 | + colProps: { | |
88 | + span: 18, | |
89 | + }, | |
90 | + componentProps: { | |
91 | + maxLength: 255, | |
92 | + placeholder: '请输入步长', | |
93 | + }, | |
94 | + ifShow: ({ values }) => isNumber(values.dataType), | |
95 | + }, | |
96 | + { | |
97 | + field: 'unit', | |
75 | 98 | label: '单位', |
76 | 99 | component: 'ApiSelect', |
77 | 100 | colProps: { |
... | ... | @@ -89,7 +112,7 @@ export const attrSchemas: FormSchema[] = [ |
89 | 112 | ifShow: ({ values }) => isNumber(values.dataType), |
90 | 113 | }, |
91 | 114 | { |
92 | - field: 'field1', | |
115 | + field: 'boolClose', | |
93 | 116 | component: 'Input', |
94 | 117 | required: true, |
95 | 118 | label: '0 -', |
... | ... | @@ -102,7 +125,7 @@ export const attrSchemas: FormSchema[] = [ |
102 | 125 | ifShow: ({ values }) => isBool(values.dataType), |
103 | 126 | }, |
104 | 127 | { |
105 | - field: 'field11', | |
128 | + field: 'boolOpen', | |
106 | 129 | component: 'Input', |
107 | 130 | required: true, |
108 | 131 | label: '1 -', |
... | ... | @@ -115,7 +138,7 @@ export const attrSchemas: FormSchema[] = [ |
115 | 138 | ifShow: ({ values }) => isBool(values.dataType), |
116 | 139 | }, |
117 | 140 | { |
118 | - field: 'field2', | |
141 | + field: 'length', | |
119 | 142 | component: 'Input', |
120 | 143 | required: true, |
121 | 144 | label: '数据长度', |
... | ... | @@ -127,7 +150,7 @@ export const attrSchemas: FormSchema[] = [ |
127 | 150 | ifShow: ({ values }) => isString(values.dataType), |
128 | 151 | }, |
129 | 152 | { |
130 | - field: 'brand', | |
153 | + field: 'rwFlag', | |
131 | 154 | component: 'ApiRadioGroup', |
132 | 155 | label: '读写类型', |
133 | 156 | required: true, |
... | ... | @@ -146,12 +169,21 @@ export const attrSchemas: FormSchema[] = [ |
146 | 169 | }, |
147 | 170 | }, |
148 | 171 | { |
172 | + field: 'outputParam', | |
173 | + label: 'JSON 对象', | |
174 | + component: 'Input', | |
175 | + // required: true, | |
176 | + slot: 'outputParamSlot', | |
177 | + colProps: { span: 24 }, | |
178 | + ifShow: ({ values }) => isStruct(values.dataType), | |
179 | + }, | |
180 | + { | |
149 | 181 | label: '描述', |
150 | 182 | field: 'description', |
151 | 183 | component: 'InputTextArea', |
152 | 184 | componentProps: { |
153 | 185 | rows: 6, |
154 | - maxLength: 255, | |
186 | + maxLength: 100, | |
155 | 187 | placeholder: '请输入描述', |
156 | 188 | }, |
157 | 189 | }, |
... | ... | @@ -223,7 +255,7 @@ export const serviceSchemas: FormSchema[] = [ |
223 | 255 | component: 'InputTextArea', |
224 | 256 | componentProps: { |
225 | 257 | rows: 6, |
226 | - maxLength: 255, | |
258 | + maxLength: 100, | |
227 | 259 | placeholder: '请输入描述', |
228 | 260 | }, |
229 | 261 | }, |
... | ... | @@ -288,7 +320,7 @@ export const eventSchemas: FormSchema[] = [ |
288 | 320 | component: 'InputTextArea', |
289 | 321 | componentProps: { |
290 | 322 | rows: 6, |
291 | - maxLength: 255, | |
323 | + maxLength: 100, | |
292 | 324 | placeholder: '请输入描述', |
293 | 325 | }, |
294 | 326 | }, |
... | ... | @@ -298,11 +330,11 @@ export const eventSchemas: FormSchema[] = [ |
298 | 330 | * 新增参数 动态显示表单 |
299 | 331 | */ |
300 | 332 | enum DateTypeEnum { |
301 | - IS_NUMBER_INT = 'int32', | |
302 | - IS_NUMBER_DOUBLE = 'double', | |
303 | - IS_STRING = 'text', | |
304 | - IS_STRUCT = 'struct', | |
305 | - IS_BOOL = 'bool', | |
333 | + IS_NUMBER_INT = 'INT', | |
334 | + IS_NUMBER_DOUBLE = 'DOUBLE', | |
335 | + IS_STRING = 'TEXT', | |
336 | + IS_STRUCT = 'STRUCT', | |
337 | + IS_BOOL = 'BOOL', | |
306 | 338 | } |
307 | 339 | const isNumber = (type: string) => { |
308 | 340 | return type === DateTypeEnum.IS_NUMBER_INT || type === DateTypeEnum.IS_NUMBER_DOUBLE; |
... | ... | @@ -354,7 +386,7 @@ export const addParamsSchemas: FormSchema[] = [ |
354 | 386 | colProps: { |
355 | 387 | span: 23, |
356 | 388 | }, |
357 | - defaultValue: 'int32', | |
389 | + defaultValue: 'INT', | |
358 | 390 | componentProps: { |
359 | 391 | placeholder: '请选择数据类型', |
360 | 392 | api: findDictItemByCode, |
... | ... | @@ -366,7 +398,7 @@ export const addParamsSchemas: FormSchema[] = [ |
366 | 398 | }, |
367 | 399 | }, |
368 | 400 | { |
369 | - field: 'configNam2112111', | |
401 | + field: 'structSlot', | |
370 | 402 | label: 'JSON 对象', |
371 | 403 | required: true, |
372 | 404 | component: 'Input', |
... | ... | @@ -377,7 +409,7 @@ export const addParamsSchemas: FormSchema[] = [ |
377 | 409 | ifShow: ({ values }) => isStruct(values.dataType), |
378 | 410 | }, |
379 | 411 | { |
380 | - field: 'field1', | |
412 | + field: 'boolClose', | |
381 | 413 | component: 'Input', |
382 | 414 | required: true, |
383 | 415 | label: '0 -', |
... | ... | @@ -390,7 +422,7 @@ export const addParamsSchemas: FormSchema[] = [ |
390 | 422 | ifShow: ({ values }) => isBool(values.dataType), |
391 | 423 | }, |
392 | 424 | { |
393 | - field: 'field11', | |
425 | + field: 'boolOpen', | |
394 | 426 | component: 'Input', |
395 | 427 | required: true, |
396 | 428 | label: '1 -', |
... | ... | @@ -403,7 +435,7 @@ export const addParamsSchemas: FormSchema[] = [ |
403 | 435 | ifShow: ({ values }) => isBool(values.dataType), |
404 | 436 | }, |
405 | 437 | { |
406 | - field: 'field2', | |
438 | + field: 'length', | |
407 | 439 | component: 'Input', |
408 | 440 | required: true, |
409 | 441 | label: '数据长度', |
... | ... | @@ -415,7 +447,7 @@ export const addParamsSchemas: FormSchema[] = [ |
415 | 447 | ifShow: ({ values }) => isString(values.dataType), |
416 | 448 | }, |
417 | 449 | { |
418 | - field: 'configNam2112', | |
450 | + field: 'valueRange', | |
419 | 451 | label: '取值范围', |
420 | 452 | component: 'Input', |
421 | 453 | slot: 'valueRangeSlot', |
... | ... | @@ -425,7 +457,7 @@ export const addParamsSchemas: FormSchema[] = [ |
425 | 457 | ifShow: ({ values }) => isNumber(values.dataType), |
426 | 458 | }, |
427 | 459 | { |
428 | - field: 'configNam22', | |
460 | + field: 'step', | |
429 | 461 | label: '步长', |
430 | 462 | component: 'Input', |
431 | 463 | colProps: { | ... | ... |
... | ... | @@ -103,7 +103,9 @@ |
103 | 103 | var str = ""; |
104 | 104 | for(var i = 6;i<20;i+=2){ |
105 | 105 | str += String.fromCharCode(parseInt(trimSource[i]+trimSource[i+1],16)); |
106 | - }` | |
106 | + } | |
107 | + } | |
108 | + ` | |
107 | 109 | ); |
108 | 110 | beautify(aceEditor.value.session); |
109 | 111 | scriptForm.scriptContent = aceEditor.value.getValue(); | ... | ... |
... | ... | @@ -10,7 +10,7 @@ |
10 | 10 | @cancel="handleCancel" |
11 | 11 | @ok="handleSubmit" |
12 | 12 | > |
13 | - <ConverScript :ifAdd="true" ref="converScriptRef" /> | |
13 | + <ConverScript :ifAdd="isTest ? false : true" ref="converScriptRef" /> | |
14 | 14 | </BasicModal> |
15 | 15 | </div> |
16 | 16 | </template> |
... | ... | @@ -23,16 +23,28 @@ |
23 | 23 | const getTitle = computed(() => (isUpdate.value ? '编辑转换脚本' : '新增转换脚本')); |
24 | 24 | const isUpdate = ref(false); |
25 | 25 | const isViewDetail = ref(''); |
26 | + const isTest = ref(false); | |
27 | + const isText = ref(''); | |
28 | + const isTitle = ref(''); | |
26 | 29 | const [register, { setModalProps, closeModal }] = useModalInner(async (data) => { |
27 | 30 | setModalProps({ loading: true }); |
28 | 31 | handleCancel(false); |
29 | 32 | isUpdate.value = data.isUpdate; |
30 | 33 | isViewDetail.value = data.isView; |
34 | + isTest.value = data.isTest; | |
35 | + isText.value = data.isText; | |
36 | + isTitle.value = data.isTitle; | |
31 | 37 | converScriptRef.value?.initEditor(data.record?.configuration?.jsScript); |
32 | 38 | setModalProps({ loading: false }); |
33 | 39 | if (!unref(isViewDetail)) { |
34 | - const title = !unref(isUpdate) ? '编辑转换脚本' : '新增转换脚本'; | |
35 | - setModalProps({ title, showOkBtn: true, showCancelBtn: true }); | |
40 | + const title = | |
41 | + unref(isTitle) == 'edit' | |
42 | + ? '编辑转换脚本' | |
43 | + : unref(isTitle) == 'add' | |
44 | + ? '新增转换脚本' | |
45 | + : '测试转换脚本'; | |
46 | + const okText = isText.value == 'test' ? '测试' : '确定'; | |
47 | + setModalProps({ title, showOkBtn: true, showCancelBtn: true, okText }); | |
36 | 48 | if (!unref(isUpdate)) { |
37 | 49 | } |
38 | 50 | } else { | ... | ... |
... | ... | @@ -91,3 +91,72 @@ export const formSchema: FormSchema[] = [ |
91 | 91 | colProps: { span: 24 }, |
92 | 92 | }, |
93 | 93 | ]; |
94 | + | |
95 | +export const mockData: any = async () => { | |
96 | + const res = await [ | |
97 | + { | |
98 | + reportConfigName: '风机转换', | |
99 | + organizationName: 1, | |
100 | + dataType: 'function', | |
101 | + executeWay: '风机转换脚本使用js', | |
102 | + executeTime: '2022-10-20 10:24:22', | |
103 | + }, | |
104 | + { | |
105 | + reportConfigName: '水电转换', | |
106 | + organizationName: 1, | |
107 | + dataType: 'function', | |
108 | + executeWay: '水电转换脚本使用js', | |
109 | + executeTime: '2022-10-20 10:24:22', | |
110 | + }, | |
111 | + { | |
112 | + reportConfigName: '摄像头转换', | |
113 | + organizationName: 1, | |
114 | + dataType: 'function', | |
115 | + executeWay: '摄像头转换脚本使用js', | |
116 | + executeTime: '2022-10-20 10:24:22', | |
117 | + }, | |
118 | + { | |
119 | + reportConfigName: '变压器转换', | |
120 | + organizationName: 1, | |
121 | + dataType: 'function', | |
122 | + executeWay: '变压器转换脚本使用js', | |
123 | + executeTime: '2022-10-20 10:24:22', | |
124 | + }, | |
125 | + { | |
126 | + reportConfigName: '设备状态转换', | |
127 | + organizationName: 1, | |
128 | + dataType: 'function', | |
129 | + executeWay: '设备状态转换脚本使用js', | |
130 | + executeTime: '2022-10-20 10:24:22', | |
131 | + }, | |
132 | + { | |
133 | + reportConfigName: '电流转换', | |
134 | + organizationName: 1, | |
135 | + dataType: 'function', | |
136 | + executeWay: '电流转换脚本使用js', | |
137 | + executeTime: '2022-10-20 10:24:22', | |
138 | + }, | |
139 | + { | |
140 | + reportConfigName: '电压转换', | |
141 | + organizationName: 1, | |
142 | + dataType: 'function', | |
143 | + executeWay: '电压转换脚本使用js', | |
144 | + executeTime: '2022-10-20 10:24:22', | |
145 | + }, | |
146 | + { | |
147 | + reportConfigName: '传感器转换', | |
148 | + organizationName: 1, | |
149 | + dataType: 'function', | |
150 | + executeWay: '传感器转换脚本使用js', | |
151 | + executeTime: '2022-10-20 10:24:22', | |
152 | + }, | |
153 | + { | |
154 | + reportConfigName: '物模型转换', | |
155 | + organizationName: 1, | |
156 | + dataType: 'function', | |
157 | + executeWay: '物模型转换脚本使用js', | |
158 | + executeTime: '2022-10-20 10:24:22', | |
159 | + }, | |
160 | + ]; | |
161 | + return res; | |
162 | +}; | ... | ... |
... | ... | @@ -25,6 +25,12 @@ |
25 | 25 | <TableAction |
26 | 26 | :actions="[ |
27 | 27 | { |
28 | + label: '测试', | |
29 | + icon: 'clarity:note-edit-line', | |
30 | + auth: '', | |
31 | + onClick: handleBindTest.bind(null, record), | |
32 | + }, | |
33 | + { | |
28 | 34 | label: '编辑', |
29 | 35 | icon: 'clarity:note-edit-line', |
30 | 36 | auth: '', |
... | ... | @@ -51,18 +57,19 @@ |
51 | 57 | <script lang="ts" setup> |
52 | 58 | import { reactive, nextTick } from 'vue'; |
53 | 59 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
54 | - import { searchFormSchema, columns } from './config.data'; | |
60 | + import { searchFormSchema, columns, mockData } from './config.data'; | |
55 | 61 | import { Authority } from '/@/components/Authority'; |
56 | 62 | import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; |
57 | 63 | import { Popconfirm } from 'ant-design-vue'; |
58 | 64 | import { useModal } from '/@/components/Modal'; |
59 | 65 | import ConverScriptModal from './ConverScriptModal.vue'; |
60 | - import { exportPage, deleteExportManage } from '/@/api/export/exportManager'; | |
66 | + import { deleteExportManage } from '/@/api/export/exportManager'; | |
61 | 67 | |
62 | 68 | const searchInfo = reactive<Recordable>({}); |
63 | 69 | const [registerTable, { reload, setProps }] = useTable({ |
64 | 70 | title: '转换脚本列表', |
65 | - api: exportPage, | |
71 | + // api: exportPage, | |
72 | + api: mockData, | |
66 | 73 | columns, |
67 | 74 | showIndexColumn: false, |
68 | 75 | clickToRowSelect: false, |
... | ... | @@ -107,11 +114,28 @@ |
107 | 114 | isUpdate: false, |
108 | 115 | record, |
109 | 116 | isView: false, |
117 | + isTest: false, | |
118 | + isText: 'confirm', | |
119 | + isTitle: 'edit', | |
110 | 120 | }); |
111 | 121 | } else { |
112 | 122 | openModal(true, { |
113 | 123 | isUpdate: true, |
114 | 124 | isView: false, |
125 | + isTest: false, | |
126 | + isText: 'confirm', | |
127 | + isTitle: 'add', | |
128 | + }); | |
129 | + } | |
130 | + }; | |
131 | + const handleBindTest = (record: Recordable | null) => { | |
132 | + if (record) { | |
133 | + openModal(true, { | |
134 | + isUpdate: false, | |
135 | + record, | |
136 | + isTest: true, | |
137 | + isText: 'test', | |
138 | + isTitle: 'test', | |
115 | 139 | }); |
116 | 140 | } |
117 | 141 | }; | ... | ... |