|
@@ -5,6 +5,7 @@
|
|
|
@update:model-value="$emit('update:visible', $event)"
|
|
|
class="dialog_class"
|
|
|
draggable
|
|
|
+ @open="handleDialogOpen"
|
|
|
>
|
|
|
<template #header="{ titleId, titleClass }">
|
|
|
<div class="my-header">
|
|
@@ -465,24 +466,37 @@ const handleConfirm = () => {
|
|
|
emit("update:visible", false)
|
|
|
}
|
|
|
|
|
|
+const handleDialogOpen = async () => {
|
|
|
+ loading.value = true
|
|
|
+ try {
|
|
|
+ const groups = await fetchUnitGroups()
|
|
|
+ unitGroups.value = groups
|
|
|
+ if (groups.length > 0) {
|
|
|
+ await fetchUnitTableData(selectedGroupId.value)
|
|
|
+ }
|
|
|
+ } finally {
|
|
|
+ loading.value = false
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
// 初始化数据
|
|
|
-watch(
|
|
|
- () => props.visible,
|
|
|
- async (newVisible) => {
|
|
|
- if (newVisible) {
|
|
|
- loading.value = true
|
|
|
- const groups = await fetchUnitGroups()
|
|
|
- unitGroups.value = groups
|
|
|
- if (groups.length > 0) {
|
|
|
+// watch(
|
|
|
+// () => props.visible,
|
|
|
+// async (newVisible) => {
|
|
|
+// if (newVisible) {
|
|
|
+// loading.value = true
|
|
|
+// const groups = await fetchUnitGroups()
|
|
|
+// unitGroups.value = groups
|
|
|
+// if (groups.length > 0) {
|
|
|
|
|
|
- await fetchUnitTableData(selectedGroupId.value)
|
|
|
- } else {
|
|
|
- loading.value = false
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- { immediate: true }
|
|
|
-)
|
|
|
+// await fetchUnitTableData(selectedGroupId.value)
|
|
|
+// } else {
|
|
|
+// loading.value = false
|
|
|
+// }
|
|
|
+// }
|
|
|
+// },
|
|
|
+// // { immediate: true }
|
|
|
+// )
|
|
|
|
|
|
// 监听选中的单位系统变化
|
|
|
watch(
|