Commit 1f788a854a6a994892648579463303c0426f6450
1 parent
4c930d7b
chore: 恢复合并到main_dev丢失的代码(TCP详情和产品分页表格部分代码)
Showing
2 changed files
with
64 additions
and
22 deletions
@@ -52,6 +52,9 @@ | @@ -52,6 +52,9 @@ | ||
52 | compact: true, | 52 | compact: true, |
53 | baseColProps: { span: 8 }, | 53 | baseColProps: { span: 8 }, |
54 | schemas: searchFormSchema, | 54 | schemas: searchFormSchema, |
55 | + resetFunc: async () => { | ||
56 | + getDataSource({ name: '' }); | ||
57 | + }, | ||
55 | submitFunc: async () => { | 58 | submitFunc: async () => { |
56 | getDataSource({ pageSize: pagination.pageSize, page: 1 }); | 59 | getDataSource({ pageSize: pagination.pageSize, page: 1 }); |
57 | }, | 60 | }, |
1 | <script lang="ts" setup> | 1 | <script lang="ts" setup> |
2 | import { Button, Tag } from 'ant-design-vue'; | 2 | import { Button, Tag } from 'ant-design-vue'; |
3 | - import { h, onMounted, ref, unref } from 'vue'; | 3 | + import { h, onMounted, ref, unref, Ref } from 'vue'; |
4 | import { DeviceRecord } from '/@/api/device/model/deviceModel'; | 4 | import { DeviceRecord } from '/@/api/device/model/deviceModel'; |
5 | - import { ScriptRecord } from '/@/api/scriptmanage/model/scriptModel'; | 5 | + // import { ScriptRecord } from '/@/api/scriptmanage/model/scriptModel'; |
6 | import { getScriptManageMeList } from '/@/api/scriptmanage/scriptManager'; | 6 | import { getScriptManageMeList } from '/@/api/scriptmanage/scriptManager'; |
7 | import { Description, useDescription } from '/@/components/Description'; | 7 | import { Description, useDescription } from '/@/components/Description'; |
8 | import { useModal } from '/@/components/Modal'; | 8 | import { useModal } from '/@/components/Modal'; |
9 | import CoverScriptModal from '/@/views/scriptmanage/converscript/ConverScriptModal.vue'; | 9 | import CoverScriptModal from '/@/views/scriptmanage/converscript/ConverScriptModal.vue'; |
10 | + import { SelectTypes } from 'ant-design-vue/es/select'; | ||
10 | 11 | ||
11 | const props = defineProps<{ | 12 | const props = defineProps<{ |
12 | record: DeviceRecord['profileData']['transportConfiguration']; | 13 | record: DeviceRecord['profileData']['transportConfiguration']; |
13 | }>(); | 14 | }>(); |
14 | 15 | ||
15 | - const scriptInfo = ref<ScriptRecord>({} as unknown as ScriptRecord); | 16 | + // const scriptInfo = ref<ScriptRecord>({} as unknown as ScriptRecord); |
17 | + const authScriptIdStr = ref(''); | ||
18 | + | ||
19 | + const upScriptIdStr = ref(''); | ||
20 | + | ||
21 | + const selectUpOptions: Ref<SelectTypes['options']> = ref([]); | ||
22 | + | ||
23 | + const selectAuthOptions: Ref<SelectTypes['options']> = ref([]); | ||
24 | + | ||
25 | + onMounted(async () => { | ||
26 | + selectUpOptions.value = await getAllScriptType('TRANSPORT_TCP_UP'); | ||
27 | + selectAuthOptions.value = await getAllScriptType('TRANSPORT_TCP_AUTH'); | ||
28 | + setDescProps({ | ||
29 | + data: Object.assign(props.record), | ||
30 | + }); | ||
31 | + }); | ||
32 | + | ||
33 | + const getAllScriptType = async (type) => { | ||
34 | + const rest = await getScriptManageMeList({ scriptType: type }); | ||
35 | + return rest.map((m) => ({ label: m.name, value: m.id })); | ||
36 | + }; | ||
37 | + | ||
38 | + const findScriptUpName = (scriptId) => { | ||
39 | + upScriptIdStr.value = scriptId; | ||
40 | + return selectUpOptions.value?.find((it) => it.value === scriptId)?.label; | ||
41 | + }; | ||
42 | + | ||
43 | + const findScriptAuthName = (scriptId) => { | ||
44 | + authScriptIdStr.value = scriptId; | ||
45 | + return selectAuthOptions.value?.find((it) => it.value === scriptId)?.label; | ||
46 | + }; | ||
16 | 47 | ||
17 | const [register, { setDescProps }] = useDescription({ | 48 | const [register, { setDescProps }] = useDescription({ |
18 | layout: 'vertical', | 49 | layout: 'vertical', |
@@ -25,14 +56,27 @@ | @@ -25,14 +56,27 @@ | ||
25 | span: 2, | 56 | span: 2, |
26 | }, | 57 | }, |
27 | { | 58 | { |
28 | - field: 'scriptName', | ||
29 | - label: '转换脚本', | 59 | + field: 'authScriptId', |
60 | + label: '鉴权脚本', | ||
30 | render: (value: string) => { | 61 | render: (value: string) => { |
31 | return ( | 62 | return ( |
32 | value && | 63 | value && |
33 | h('div', [ | 64 | h('div', [ |
34 | - h(Tag, { color: 'blue' }, () => value), | ||
35 | - h(Button, { type: 'link', onClick: handleTestScript }, () => '测试脚本'), | 65 | + h(Tag, { color: 'blue' }, () => findScriptAuthName(value)), |
66 | + h(Button, { type: 'link', onClick: handleTestAuthScript }, () => '测试脚本'), | ||
67 | + ]) | ||
68 | + ); | ||
69 | + }, | ||
70 | + }, | ||
71 | + { | ||
72 | + field: 'upScriptId', | ||
73 | + label: '上行脚本', | ||
74 | + render: (value: string) => { | ||
75 | + return ( | ||
76 | + value && | ||
77 | + h('div', [ | ||
78 | + h(Tag, { color: 'blue' }, () => findScriptUpName(value)), | ||
79 | + h(Button, { type: 'link', onClick: handleTestUpScript }, () => '测试脚本'), | ||
36 | ]) | 80 | ]) |
37 | ); | 81 | ); |
38 | }, | 82 | }, |
@@ -42,29 +86,24 @@ | @@ -42,29 +86,24 @@ | ||
42 | 86 | ||
43 | const [registerModal, { openModal }] = useModal(); | 87 | const [registerModal, { openModal }] = useModal(); |
44 | 88 | ||
45 | - const handleTestScript = () => { | 89 | + const handleTestAuthScript = () => { |
46 | openModal(true, { | 90 | openModal(true, { |
47 | isUpdate: false, | 91 | isUpdate: false, |
48 | isTest: true, | 92 | isTest: true, |
49 | - record: unref(scriptInfo).id, | 93 | + record: unref(authScriptIdStr), |
50 | isText: 'test', | 94 | isText: 'test', |
51 | isTitle: 'test', | 95 | isTitle: 'test', |
52 | }); | 96 | }); |
53 | }; | 97 | }; |
54 | 98 | ||
55 | - onMounted(() => { | ||
56 | - getTransforScriptInfo(); | ||
57 | - }); | ||
58 | - | ||
59 | - const getTransforScriptInfo = async () => { | ||
60 | - try { | ||
61 | - const list = await getScriptManageMeList(); | ||
62 | - const record = list.find((item) => item.id === props.record.scriptId); | ||
63 | - scriptInfo.value = record!; | ||
64 | - setDescProps({ | ||
65 | - data: Object.assign(props.record, record, { scriptName: record?.name || '' }), | ||
66 | - }); | ||
67 | - } catch (error) {} | 99 | + const handleTestUpScript = () => { |
100 | + openModal(true, { | ||
101 | + isUpdate: false, | ||
102 | + isTest: true, | ||
103 | + record: unref(upScriptIdStr), | ||
104 | + isText: 'test', | ||
105 | + isTitle: 'test', | ||
106 | + }); | ||
68 | }; | 107 | }; |
69 | </script> | 108 | </script> |
70 | 109 |