Showing
2 changed files
with
29 additions
and
4 deletions
1 | <template> | 1 | <template> |
2 | <div :class="prefixCls"> | 2 | <div :class="prefixCls"> |
3 | - <CollapseHeader v-bind="$props" :prefixCls="prefixCls" :show="show" @expand="handleExpand"> | 3 | + <CollapseHeader |
4 | + v-bind="$props" | ||
5 | + :prefixCls="prefixCls" | ||
6 | + :show="!isClose ? isClose : show" | ||
7 | + @expand="handleExpand" | ||
8 | + > | ||
4 | <template #title> | 9 | <template #title> |
5 | <slot name="title"></slot> | 10 | <slot name="title"></slot> |
6 | </template> | 11 | </template> |
@@ -12,7 +17,7 @@ | @@ -12,7 +17,7 @@ | ||
12 | <div class="p-2"> | 17 | <div class="p-2"> |
13 | <CollapseTransition :enable="canExpan"> | 18 | <CollapseTransition :enable="canExpan"> |
14 | <Skeleton v-if="loading" :active="loading" /> | 19 | <Skeleton v-if="loading" :active="loading" /> |
15 | - <div :class="`${prefixCls}__body`" v-else v-show="show"> | 20 | + <div :class="`${prefixCls}__body`" v-else v-show="!isClose ? isClose : show"> |
16 | <slot></slot> | 21 | <slot></slot> |
17 | </div> | 22 | </div> |
18 | </CollapseTransition> | 23 | </CollapseTransition> |
@@ -35,6 +40,7 @@ | @@ -35,6 +40,7 @@ | ||
35 | import { useDesign } from '/@/hooks/web/useDesign'; | 40 | import { useDesign } from '/@/hooks/web/useDesign'; |
36 | 41 | ||
37 | const props = defineProps({ | 42 | const props = defineProps({ |
43 | + isClose: { type: Boolean, default: true }, | ||
38 | title: { type: String, default: '' }, | 44 | title: { type: String, default: '' }, |
39 | loading: { type: Boolean }, | 45 | loading: { type: Boolean }, |
40 | /** | 46 | /** |
@@ -58,7 +64,7 @@ | @@ -58,7 +64,7 @@ | ||
58 | */ | 64 | */ |
59 | lazyTime: { type: Number, default: 0 }, | 65 | lazyTime: { type: Number, default: 0 }, |
60 | }); | 66 | }); |
61 | - const emit = defineEmits(['expand']); | 67 | + const emit = defineEmits(['expand', 'change', 'hchange']); |
62 | 68 | ||
63 | const show = ref(true); | 69 | const show = ref(true); |
64 | 70 | ||
@@ -69,6 +75,8 @@ | @@ -69,6 +75,8 @@ | ||
69 | */ | 75 | */ |
70 | function handleExpand() { | 76 | function handleExpand() { |
71 | show.value = !show.value; | 77 | show.value = !show.value; |
78 | + emit('change', !show.value); | ||
79 | + emit('hchange', !show.value); | ||
72 | if (props.triggerWindowResize) { | 80 | if (props.triggerWindowResize) { |
73 | // 200 milliseconds here is because the expansion has animation, | 81 | // 200 milliseconds here is because the expansion has animation, |
74 | useTimeoutFn(triggerWindowResize, 200); | 82 | useTimeoutFn(triggerWindowResize, 200); |
@@ -12,10 +12,13 @@ | @@ -12,10 +12,13 @@ | ||
12 | >包括引导服务器更新 | 12 | >包括引导服务器更新 |
13 | </Checkbox> | 13 | </Checkbox> |
14 | <CollapseContainer | 14 | <CollapseContainer |
15 | + @hchange="hChange" | ||
16 | + @change="eChange(item, index)" | ||
15 | v-for="(item, index) in dynamicBOOTSTRAP.bootstrap" | 17 | v-for="(item, index) in dynamicBOOTSTRAP.bootstrap" |
16 | :key="item" | 18 | :key="item" |
17 | :title="collapseTitle(item)" | 19 | :title="collapseTitle(item)" |
18 | class="mt-4" | 20 | class="mt-4" |
21 | + :isClose="item.close" | ||
19 | > | 22 | > |
20 | <template #action> | 23 | <template #action> |
21 | <Button | 24 | <Button |
@@ -89,12 +92,25 @@ | @@ -89,12 +92,25 @@ | ||
89 | import { useModal } from '/@/components/Modal'; | 92 | import { useModal } from '/@/components/Modal'; |
90 | import ServerConfigModal from './cpns/ServerConfigModal.vue'; | 93 | import ServerConfigModal from './cpns/ServerConfigModal.vue'; |
91 | 94 | ||
95 | + const eChange = (_, e1) => { | ||
96 | + if (eS) { | ||
97 | + dynamicBOOTSTRAP.bootstrap.forEach((bootstrap, index: number) => { | ||
98 | + if (index === e1) { | ||
99 | + bootstrap.close = true; | ||
100 | + } | ||
101 | + }); | ||
102 | + } | ||
103 | + }; | ||
104 | + let eS = false; | ||
105 | + const hChange = (e) => { | ||
106 | + eS = e; | ||
107 | + }; | ||
92 | const collapseTitle = (item) => { | 108 | const collapseTitle = (item) => { |
93 | return `LwM2M Server Short server ID: ${item.shortServerId} Security config mode: ${item.securityMode}`; | 109 | return `LwM2M Server Short server ID: ${item.shortServerId} Security config mode: ${item.securityMode}`; |
94 | }; | 110 | }; |
95 | const bootstrapServerUpdateEnable = ref(false); | 111 | const bootstrapServerUpdateEnable = ref(false); |
96 | const dynamicBOOTSTRAP: any = reactive({ | 112 | const dynamicBOOTSTRAP: any = reactive({ |
97 | - bootstrap: [{ securityMode: 'NO_SEC', shortServerId: 1234 }], | 113 | + bootstrap: [{ securityMode: 'NO_SEC', shortServerId: 1234, close: false }], |
98 | }); | 114 | }); |
99 | const dynamicBindRef: any = { | 115 | const dynamicBindRef: any = { |
100 | BootStrapFormItemRef: ref([]), | 116 | BootStrapFormItemRef: ref([]), |
@@ -154,6 +170,7 @@ | @@ -154,6 +170,7 @@ | ||
154 | dynamicBOOTSTRAP.bootstrap.push({ | 170 | dynamicBOOTSTRAP.bootstrap.push({ |
155 | securityMode: 'NO_SEC', | 171 | securityMode: 'NO_SEC', |
156 | shortServerId: 1234, | 172 | shortServerId: 1234, |
173 | + close: false, | ||
157 | }); | 174 | }); |
158 | } | 175 | } |
159 | }; | 176 | }; |