Ver código fonte

feat:教材信息

DESKTOP-USV654P\pc 8 meses atrás
pai
commit
b6bafdfff1

+ 25 - 0
src/views/teachingManager/textbookManagement/index.vue

@@ -17,11 +17,16 @@
     postTextbookTextbookClaimExportQuery,
     postTextbookTextbookSubscriptionExportQuery,
     postTextbookTextbookStandingExportQuery,
+    postTextbookExcelImport,
   } from '/@/services/apis/TextbookController';
   import { useModal } from '/@/components/Modal';
   import infoView from './components/infoView.vue';
   import { downloadByData } from '/@/utils/file/download';
   import { formatToDateTime } from '/@/utils/dateUtil';
+
+  import { Upload } from 'ant-design-vue';
+  import { useLoading } from '/@/components/Loading';
+
   const [formReg, { openDrawer }] = useDrawer();
   const [pushInfoReg, { openModal }] = useModal();
   const [viewInfoReg, { openModal: openInfoModal }] = useModal();
@@ -80,6 +85,22 @@
     const data = await postTextbookTextbookStandingExportQuery(postDate);
     downloadByData(data.data, `教材信息${formatToDateTime(new Date(), 'YYYYMMDDHHmmss')}.xlsx`);
   };
+
+  const [openFullLoading, closeFullLoading] = useLoading({
+    tip: '处理中...',
+  });
+  const handleImport = async (e) => {
+    try {
+      openFullLoading();
+      await postTextbookExcelImport({ file: e });
+      closeFullLoading();
+      createMessage.success('导入成功');
+      reload();
+    } catch {
+      closeFullLoading();
+    }
+    return false;
+  };
 </script>
 
 <template>
@@ -89,6 +110,10 @@
         <a-button type="primary" @click="handleExport1()">导出征订表</a-button>
         <a-button type="primary" @click="handleExport()">导出发放表</a-button>
         <a-button type="primary" @click="handleExport2()">导出台账</a-button>
+        <Upload :showUploadList="false" :before-upload="handleImport">
+          <a-button block type="primary"> 导入 </a-button>
+        </Upload>
+
         <a-button type="primary" @click="handleEdit({}, false)">新增</a-button>
       </template>
       <template #action="{ record }">