Browse Source

fix:修改教材征订

zcuishan 4 tháng trước cách đây
mục cha
commit
56b623dcc0

+ 7 - 1
src/views/educational/textbookSubscription/components/changeHistory.vue

@@ -6,6 +6,7 @@
   const id = ref('');
   import { getWfTextbookSubscriptionItemHistoryPage } from '/@/services/apis/WfTextbookSubscriptionItemHistoryController';
   import { h, ref } from 'vue';
+  import { historySchema } from './data.config';
   const [registerModal, { closeModal }] = useModalInner((data) => {
     id.value = data;
     reload();
@@ -14,9 +15,14 @@
     api: getWfTextbookSubscriptionItemHistoryPage,
     bordered: true,
     immediate: false,
+    useSearchForm: true,
+    formConfig: {
+      labelWidth: 100,
+      schemas: historySchema,
+    },
     columns: [
       {
-        title: '变更Id',
+        title: '主键Id',
         dataIndex: 'wfTextbookSubscriptionItemId',
         align: 'left',
       },

+ 27 - 10
src/views/educational/textbookSubscription/components/classImport.vue

@@ -1,12 +1,19 @@
 <script setup lang="ts">
   import BasicModal from '/@/components/Modal/src/BasicModal.vue';
-  import { useModal } from '/@/components/Modal';
+  import { useModal, useModalInner } from '/@/components/Modal';
   import Upload from '/@/components/Form/src/components/Upload.vue';
   import { ref } from 'vue';
-  import { postBaseClassCourseImport } from '/@/services/apis/BaseClassCourseController';
   import { useMessage } from '/@/hooks/web/useMessage';
-  import { baseDownloadFileUrl } from '/@/utils/file/download';
-  const [modalRegister, { closeModal }] = useModal();
+  import { baseDownloadFileUrl, downloadByData } from '/@/utils/file/download';
+  import {
+    postWfTextbookSubscriptionInstockroomExcelImport,
+    postWfTextbookSubscriptionTextbookSubscriptionExportQuery,
+  } from '/@/services/apis/WfTextbookSubscriptionController';
+  import { formatToDate } from '/@/utils/dateUtil';
+  const wfTextbookSubscriptionId = ref('');
+  const [modalRegister, { closeModal }] = useModalInner((data) => {
+    wfTextbookSubscriptionId.value = data.wfTextbookSubscriptionId;
+  });
   const errMsg = ref('');
   const folderId = ref('');
   const { createMessage } = useMessage();
@@ -16,7 +23,10 @@
   };
   const handleSubmit = async () => {
     try {
-      await postBaseClassCourseImport({ file: data.value }, 'none');
+      await postWfTextbookSubscriptionInstockroomExcelImport(
+        { wfTextbookSubscriptionId: wfTextbookSubscriptionId.value, file: data.value },
+        'none',
+      );
       createMessage.success('导入成功');
       folderId.value = '';
       closeModal();
@@ -30,9 +40,16 @@
     closeModal();
   };
   const handleDownLoad = async () => {
-    await baseDownloadFileUrl(
-      'https://zhxy.cqtlzjzx.com/minio/static/resources/%E7%8F%AD%E7%BA%A7%E8%AF%BE%E7%A8%8B%E5%AF%BC%E5%85%A5%E6%A8%A1%E6%9D%BF.xlsx',
-      '班级课表导入模板.xlsx',
+    const data = await postWfTextbookSubscriptionTextbookSubscriptionExportQuery({
+      wfTextbookSubscriptionId: wfTextbookSubscriptionId.value,
+    });
+
+    await downloadByData(
+      data.data,
+      `${wfTextbookSubscriptionId.value}征订记录${formatToDate(
+        new Date(),
+        'YYYY-MM-DD-HH-mm-ss',
+      )}.xlsx`,
     );
   };
 </script>
@@ -48,9 +65,9 @@
   >
     <div class="flex flex-col mt-[24px]">
       <div class="flex flex-col">
-        <span class="text-[16px] text-[1000]">1、 下载导入模板</span>
+        <span class="text-[16px] text-[1000]">1、 导出当前征订数据</span>
         <a-button type="primary" class="w-[110px] mt-[12px]" @click="handleDownLoad">
-          下载模板</a-button
+          导出</a-button
         >
       </div>
       <div class="mt-[12px]">

+ 46 - 0
src/views/educational/textbookSubscription/components/data.config.ts

@@ -1,6 +1,7 @@
 import { BasicColumn, FormSchema } from '/@/components/Table';
 import { requestMagicApi } from '/@/api/magicApi';
 import { h } from 'vue';
+import { getDataOption } from '/@/api/system/dic';
 export const subscription = {
   1: '待发起',
   2: '征订中',
@@ -223,6 +224,11 @@ export const textbookColumns: BasicColumn[] = [
 ];
 
 export const historyTableColumns: BasicColumn[] = [
+  {
+    title: '主键ID',
+    dataIndex: 'id',
+    width: 120,
+  },
   {
     title: '课程名称',
     dataIndex: 'courseSubjectIdCn',
@@ -412,3 +418,43 @@ export const changeColumns: BasicColumn[] = [
     },
   },
 ];
+export const historySchema: FormSchema[] = [
+  {
+    field: 'wfTextbookSubscriptionItemId',
+    label: 'ID',
+    component: 'Input',
+    colProps: {
+      span: 6,
+    },
+  },
+  {
+    field: 'textbookType',
+    label: '教材类型',
+    component: 'ApiSelect',
+    componentProps: {
+      api: getDataOption,
+      params: {
+        code: 'textbook_type',
+      },
+    },
+    colProps: {
+      span: 6,
+    },
+  },
+  {
+    field: 'bookName',
+    label: '教材书名',
+    component: 'Input',
+    colProps: {
+      span: 6,
+    },
+  },
+  {
+    field: 'courseSubjectIdCn',
+    label: '课程名称',
+    component: 'Input',
+    colProps: {
+      span: 6,
+    },
+  },
+];

+ 18 - 1
src/views/educational/textbookSubscription/components/textBookPop.vue

@@ -8,9 +8,12 @@
   import {
     getWfTextbookSubscriptionInstockroomList,
     postWfTextbookSubscriptionInstockroom,
+    postWfTextbookSubscriptionTextbookSubscriptionExportQuery,
   } from '/@/services/apis/WfTextbookSubscriptionController';
   import { ref } from 'vue';
   import { useMessage } from '/@/hooks/web/useMessage';
+  import { downloadByData } from '/@/utils/file/download';
+  import { formatToDate } from '/@/utils/dateUtil';
   const wfTextbookSubscriptionId = ref('');
   const [register, { closeModal, setModalProps }] = useModalInner((data) => {
     wfTextbookSubscriptionId.value = data.id;
@@ -68,7 +71,20 @@
     }
   };
   const handleExport = () => {
-    openModal(true);
+    openModal(true, { wfTextbookSubscriptionId: wfTextbookSubscriptionId.value });
+  };
+  const handleDownLoad = async () => {
+    const data = await postWfTextbookSubscriptionTextbookSubscriptionExportQuery({
+      wfTextbookSubscriptionId: wfTextbookSubscriptionId.value,
+    });
+
+    await downloadByData(
+      data.data,
+      `${wfTextbookSubscriptionId.value}征订记录${formatToDate(
+        new Date(),
+        'YYYY-MM-DD-HH-mm-ss',
+      )}.xlsx`,
+    );
   };
 </script>
 
@@ -82,6 +98,7 @@
   >
     <BasicTable @register="tableReg">
       <template #toolbar>
+        <a-button @click="handleDownLoad" type="primary">导出</a-button>
         <a-button type="primary" @click="handleExport">导入</a-button>
       </template>
       <template #action="{ record }">

+ 9 - 38
src/views/educational/textbookSubscription/components/view.vue

@@ -5,10 +5,7 @@
   import BasicTable from '/@/components/Table/src/BasicTable.vue';
   import changeHistoryVue from './changeHistory.vue';
   import changeTextBookVue from './changeTextBook.vue';
-  import {
-    ClassColumns,
-    historyTableColumns,
-  } from '/@/views/educational/textbookSubscription/components/data.config';
+  import { ClassColumns, historySchema, historyTableColumns } from './data.config';
   import {
     getWfTextbookSubscriptionBaseclassPage,
     getWfTextbookSubscriptionInfo,
@@ -16,16 +13,18 @@
   } from '/@/services/apis/WfTextbookSubscriptionController';
   import { nextTick, ref } from 'vue';
   import { Modal } from 'ant-design-vue';
-  import { getDataOption } from '/@/api/system/dic';
   import { useMessage } from '/@/hooks/web/useMessage';
   import { downloadByData } from '/@/utils/file/download';
   import { formatToDate } from '/@/utils/dateUtil';
   const visible = ref(false);
   const dataInfo = ref<any>({});
   const itemId = ref<any>(null);
+  const status = ref<any>(null);
   const [viewReg] = useModalInner(async (data) => {
     dataInfo.value = await getWfTextbookSubscriptionInfo({ id: data.id });
     itemId.value = data.id;
+    status.value = data.status;
+    console.log(data);
     await reloadHistory();
   });
   const [changeHistoryRef, { openModal: openChangeHistory }] = useModal();
@@ -37,38 +36,7 @@
     useSearchForm: true,
     formConfig: {
       labelWidth: 120,
-      schemas: [
-        {
-          field: 'textbookType',
-          label: '教材类型',
-          component: 'ApiSelect',
-          componentProps: {
-            api: getDataOption,
-            params: {
-              code: 'textbook_type',
-            },
-          },
-          colProps: {
-            span: 8,
-          },
-        },
-        {
-          field: 'bookName',
-          label: '教材书名',
-          component: 'Input',
-          colProps: {
-            span: 8,
-          },
-        },
-        {
-          field: 'courseName',
-          label: '课程名称',
-          component: 'Input',
-          colProps: {
-            span: 8,
-          },
-        },
-      ],
+      schemas: historySchema,
     },
     immediate: false,
     rowKey: 'id',
@@ -157,7 +125,10 @@
           <a-button type="primary" @click="handleExport">导出</a-button>
         </template>
         <template #action="{ record }">
-          <a-button type="link" @click="openModal(true, record)" :disabled="record.inStockroomNum"
+          <a-button
+            type="link"
+            @click="openModal(true, record)"
+            :disabled="record.inStockroomNum || status === 4"
             >变更</a-button
           >
         </template>