Pārlūkot izejas kodu

fix: 客户管理新增编辑后查询列表

赖奇 1 gadu atpakaļ
vecāks
revīzija
f5546d71b8

+ 2 - 0
apps/web-ele/src/views/customer-manage/form.vue

@@ -14,6 +14,7 @@ import {
   getCustomerDetailApi,
 } from '#/api/customer-manage';
 
+const emit = defineEmits(['finish']);
 const data = ref();
 const formType = ref<'create' | 'detail' | 'edit'>('create');
 
@@ -245,6 +246,7 @@ const [Modal, modalApi] = useVbenModal({
 
       await apiMap[formType.value]();
       ElMessage.success('操作成功');
+      emit('finish');
       modalApi.close();
     } catch {}
   },

+ 6 - 2
apps/web-ele/src/views/customer-manage/index.vue

@@ -97,7 +97,7 @@ const gridOptions: VxeGridProps<any> = {
   ],
 };
 
-const [Grid] = useVbenVxeGrid({ gridOptions, formOptions });
+const [Grid, gridApi] = useVbenVxeGrid({ gridOptions, formOptions });
 
 const [Modal, modalApi] = useVbenModal({
   fullscreenButton: false,
@@ -120,6 +120,10 @@ function handleEdit(row: any) {
 function handleDetail(row: any) {
   modalApi.setData({ formType: 'detail', row }).open();
 }
+
+function handleFinish() {
+  gridApi.reload();
+}
 </script>
 
 <template>
@@ -143,6 +147,6 @@ function handleDetail(row: any) {
         />
       </template>
     </Grid>
-    <Modal />
+    <Modal @finish="handleFinish" />
   </Page>
 </template>