|
75 | 75 |
|
76 | 76 | interface SelectedMap {
|
77 | 77 | [DBTypes.MYSQL]: {
|
78 |
| - [ClusterTypes.TENDBHA]: ClusterInfo[]; |
79 |
| - [ClusterTypes.TENDBSINGLE]: ClusterInfo[]; |
| 78 | + [ClusterTypes.TENDBHA]?: ClusterInfo[]; |
| 79 | + [ClusterTypes.TENDBSINGLE]?: ClusterInfo[]; |
80 | 80 | };
|
81 | 81 | [DBTypes.TENDBCLUSTER]: {
|
82 |
| - [ClusterTypes.TENDBCLUSTER]: ClusterInfo[]; |
| 82 | + [ClusterTypes.TENDBCLUSTER]?: ClusterInfo[]; |
83 | 83 | };
|
84 | 84 | }
|
85 | 85 | </script>
|
|
97 | 97 | }
|
98 | 98 |
|
99 | 99 | interface Emits {
|
100 |
| - (e: 'change', value: ClusterInfo[]): void; |
| 100 | + (e: 'change', value: Props['selected']): void; |
101 | 101 | }
|
102 | 102 |
|
103 | 103 | const props = defineProps<Props>();
|
|
111 | 111 | const { t } = useI18n();
|
112 | 112 |
|
113 | 113 | const panelTabActive = ref();
|
114 |
| - const lastValues = reactive<Record<string, ClusterInfo[]>>({}); |
| 114 | + const lastValues = reactive<Props['selected']>({}); |
115 | 115 |
|
116 | 116 | // const renderCom = computed(
|
117 | 117 | // () => {
|
|
145 | 145 | );
|
146 | 146 |
|
147 | 147 | watch(panelTabActive, (_, oldValue) => {
|
148 |
| - lastValues[oldValue] = []; |
| 148 | + Object.assign(lastValues, { |
| 149 | + [oldValue]: [], |
| 150 | + }); |
149 | 151 | });
|
150 | 152 |
|
151 | 153 | const handleChange = (values: Record<string, ClusterInfo[]>) => {
|
152 | 154 | Object.assign(lastValues, values);
|
153 | 155 | };
|
154 | 156 |
|
155 | 157 | const handleSubmit = () => {
|
156 |
| - emits('change', Object.values(lastValues).flat()); |
| 158 | + emits('change', lastValues); |
157 | 159 | handleClose();
|
158 | 160 | };
|
159 | 161 |
|
|
0 commit comments