Browse Source

feat:新生添加删除

DESKTOP-USV654P\pc 8 months ago
parent
commit
59e8e65c0c
1 changed files with 30 additions and 3 deletions
  1. 30 3
      src/views/educational/basicInformation/index.vue

+ 30 - 3
src/views/educational/basicInformation/index.vue

@@ -9,14 +9,17 @@
   import StudentImport from './components/import1.vue';
   import { useModal } from '/@/components/Modal';
   import { reactive } from 'vue';
-  import { getBaseNewStudentPage } from '/@/services/apis/BaseNewStudentController';
+  import {
+    deleteStudentBaseNewStudent,
+    getBaseNewStudentPage,
+  } from '/@/services/apis/BaseNewStudentController';
   import { useMessage } from '/@/hooks/web/useMessage';
 
   const searchInfo = reactive<Recordable>({});
 
   const [registerModal, { openModal }] = useModal();
 
-  const { createMessage } = useMessage();
+  const { createConfirm, createMessage } = useMessage();
 
   const [registerImportModal, { openModal: openImportModal }] = useModal();
 
@@ -38,7 +41,7 @@
     immediate: true,
     canResize: true,
     actionColumn: {
-      width: 100,
+      width: 120,
       title: '操作',
       dataIndex: 'action',
       slots: { customRender: 'action' },
@@ -97,6 +100,25 @@
     }
     openDivisionModal(true, { isUpdate: false, baseData: [...data] });
   };
+
+  const handleDelete = (record: any) => {
+    createConfirm({
+      iconType: 'warning',
+      title: '温馨提醒',
+      content: '是否删除该记录?',
+      onOk: async () => {
+        try {
+          await deleteStudentBaseNewStudent([record.id]);
+          createMessage.success('删除成功');
+          await reload();
+        } catch (e) {
+          createMessage.error('删除失败');
+        }
+      },
+      okText: '确认',
+      cancelText: '取消',
+    });
+  };
 </script>
 
 <template>
@@ -117,6 +139,11 @@
                 label: '编辑',
                 onClick: handleEdit.bind(null, record, true),
               },
+              {
+                label: '删除',
+                color: 'error',
+                onClick: handleDelete.bind(null, record),
+              },
             ]"
           />
         </div>