Browse Source

fix: change teachingManager textbookPopManager

DESKTOP-USV654P\pc 2 weeks ago
parent
commit
7f14e66b29
1 changed files with 14 additions and 23 deletions
  1. 14 23
      src/views/teachingManager/textbookPushManager/index.vue

+ 14 - 23
src/views/teachingManager/textbookPushManager/index.vue

@@ -9,19 +9,21 @@
   import { useMessage } from '/@/hooks/web/useMessage';
   import { searchFormSchema } from './components/data.config';
   import {
-    getTextbookWarehouseRecordExport,
+    getTextbookWarehouseRecordExportQuery,
     getTextbookWarehouseRecordPage,
-    postTextbookWarehouseRecordExportQuery,
   } from '/@/services/apis/TextbookWarehouseRecordController';
   import { downloadByData } from '/@/utils/file/download';
   import { formatToDate } from '/@/utils/dateUtil';
   import { useModal } from '/@/components/Modal';
   import FormImport from '/@/views/sys/import/index.vue';
-  import { postTextbookWarehouseRecordDetailImport } from '/@/services/apis/TextbookWarehouseRecordDetailController';
   import FormStore from './components/store.vue';
   import ListStore from './components/storeList.vue';
   import FormDiscount from './components/editDiscount.vue';
   import DiscountList from './components/discountList.vue';
+  import {
+    postTextbookSubscriptionInstockroomExcelImport,
+    postTextbookSubscriptionSubscriptionInstockroomExportQuery,
+  } from '/@/services/apis/TextbookSubscriptionController';
 
   const [formReg, {}] = useDrawer();
   const [formDetailReg, { openModal }] = useModal();
@@ -31,7 +33,7 @@
   const [formDiscountRegister, { openModal: openDiscountModal }] = useModal();
   const [formDiscountListRegister, { openModal: openDiscountListModal }] = useModal();
   const selectedRowKeysList = ref<string[] | number[]>([]);
-  const [registerTable, { reload }] = useTable({
+  const [registerTable, { reload, getForm }] = useTable({
     api: getTextbookWarehouseRecordPage,
     rowKey: 'id',
     columns: TableColumns,
@@ -64,15 +66,9 @@
   });
   const { createMessage } = useMessage();
 
-  const handleExport = async (isAll) => {
-    let data;
-    if (isAll) {
-      data = await getTextbookWarehouseRecordExport({ id: 123 });
-    } else {
-      data = await postTextbookWarehouseRecordExportQuery({
-        ids: selectedRowKeysList.value,
-      });
-    }
+  const handleExport = async () => {
+    const fromData = getForm().getFieldsValue();
+    const data = await getTextbookWarehouseRecordExportQuery(fromData);
     downloadByData(data.data, `教材入库记录${formatToDate(new Date())}.xlsx`);
     createMessage.success('导出成功');
   };
@@ -87,12 +83,13 @@
     openImportModal(true, {
       baseData: {
         title: '教材导入',
-        upload: postTextbookWarehouseRecordDetailImport,
+        upload: postTextbookSubscriptionInstockroomExcelImport,
         params: {},
         errorName: '教材导入错误记录',
+        download: postTextbookSubscriptionSubscriptionInstockroomExportQuery,
         // templatePath:
         //   'https://zhxy.cqtlzjzx.com/minio/static/resources/%E7%99%BD%E5%90%8D%E5%8D%95%E5%AF%BC%E5%85%A5%E6%A8%A1%E6%9D%BF.xlsx',
-        // templateName: '教材导入模板',
+        templateName: '教材导入模板',
       },
     });
   };
@@ -125,14 +122,8 @@
       <template #toolbar>
         <a-button type="primary" @click="handelStore"> 教材入库 </a-button>
         <a-button type="primary" @click="handelImport"> 教材导入 </a-button>
-        <a-button
-          type="primary"
-          :disabled="!selectedRowKeysList.length"
-          @click="handleExport(false)"
-        >
-          导出指定记录
-        </a-button>
-        <a-button type="primary" @click="handleExport(true)">导出全部记录</a-button>
+        <!-- <a-button type="primary" @click="handleExport()"> 导出指定记录 </a-button> -->
+        <a-button type="primary" @click="handleExport">导出记录</a-button>
       </template>
       <template #action="{ record }">
         <TableAction