DESKTOP-USV654P\pc преди 6 месеца
родител
ревизия
7b5f6efede

+ 6 - 0
src/views/educational/class/data.config.ts

@@ -29,6 +29,12 @@ export const tableColumns: BasicColumn[] = [
     align: 'left',
     width: 100,
   },
+  {
+    title: '班主任电话',
+    dataIndex: 'mobile',
+    align: 'left',
+    width: 120,
+  },
   {
     title: '所属年级',
     dataIndex: 'gradeName',

+ 42 - 4
src/views/educational/class/index.vue

@@ -2,19 +2,29 @@
   <PageWrapper dense contentFullHeight fixedHeight contentClass="flex">
     <BasicTable @register="registerTable">
       <template #toolbar>
-        <a-button type="primary" @click="handleEdit({}, false)">新增</a-button>
+        <a-button type="primary" @click="handleEdit({}, false)" v-auth="'00014:add'">
+          新增
+        </a-button>
+        <ExportTool
+          v-auth="'00014:export'"
+          ref="exportToolRef"
+          type="class"
+          @click="handelExportClick"
+        />
       </template>
       <template #action="{ record }">
-        <div style="display: flex; justify-content: center;">
+        <div style="display: flex; justify-content: center">
           <TableAction
             :actions="[
               {
                 label: '编辑',
+                auth: '00014:edit',
                 onClick: handleEdit.bind(null, record, true),
               },
               {
                 label: '删除',
                 color: 'error',
+                auth: '00014:delete',
                 onClick: handleDelete.bind(null, record),
               },
             ]"
@@ -27,7 +37,7 @@
 </template>
 
 <script setup lang="ts">
-  import { onMounted } from 'vue';
+  import { onMounted, ref } from 'vue';
   import { PageWrapper } from '/@/components/Page';
   import { BasicTable, useTable, TableAction } from '/@/components/Table';
   import { tableColumns, searchFormSchema } from './data.config';
@@ -35,10 +45,13 @@
   import { useModal } from '/@/components/Modal';
   import { useMessage } from '/@/hooks/web/useMessage';
   import FormEdit from './edit.vue';
+  import ExportTool from '/@/views/export/template/components/tool.vue';
+
+  const exportToolRef = ref<ElRef>(null);
 
   const [registerModal, { openModal }] = useModal();
 
-  const [registerTable, { reload }] = useTable({
+  const [registerTable, { reload, getForm, getSelectRowKeys }] = useTable({
     api: getBaseClassPage,
     title: '班级列表',
     rowKey: 'id',
@@ -59,6 +72,9 @@
       slots: { customRender: 'action' },
       fixed: 'right',
     },
+    rowSelection: {
+      type: 'checkbox',
+    },
   });
   const { createConfirm, createMessage } = useMessage();
 
@@ -95,6 +111,28 @@
   };
 
   onMounted(async () => {});
+
+  const handelExportClick = (type) => {
+    const data: Recordable = {
+      conditions: [],
+      ids: [],
+    };
+    if (type === 'all') {
+      const formData = getForm().getFieldsValue();
+      for (const key in formData) {
+        data.conditions.push({ keyName: key, keyValue: formData[key], keyType: '1' });
+      }
+    } else {
+      const selectKeys = getSelectRowKeys();
+      if (selectKeys.length === 0) {
+        createMessage.warning('请选择需要导入的数据');
+        return;
+      }
+      data.ids = selectKeys;
+    }
+
+    exportToolRef.value?.open(data);
+  };
 </script>
 
 <style scoped lang="less"></style>

+ 35 - 8
src/views/educational/teacherbasemanager/index.vue

@@ -16,17 +16,22 @@
     >
       <template #toolbar>
         <template v-for="button in tableButtonConfig" :key="button.code">
-          <a-button v-if="button.isDefault" type="primary" @click="buttonClick(button.code)">
-            <template #icon><Icon :icon="button.icon" /></template>
-            {{ button.name }}
-          </a-button>
-          <a-button v-else type="primary">
+          <a-button
+            type="primary"
+            @click="buttonClick(button.code)"
+            v-if="hasPermission(button.auth)"
+          >
             <template #icon><Icon :icon="button.icon" /></template>
             {{ button.name }}
           </a-button>
         </template>
 
-        <ExportTool ref="exportToolRef" type="teacher" @click="handelExportClick" />
+        <ExportTool
+          ref="exportToolRef"
+          type="teacher"
+          v-auth="'teacher:export'"
+          @click="handelExportClick"
+        />
       </template>
       <template #bodyCell="{ column, record }">
         <template v-if="column.dataIndex === 'action'">
@@ -60,6 +65,9 @@
   import { getDepartmentEnabledTree } from '/@/services/apis/DepartmentController';
 
   import ExportTool from '/@/views/export/template/components/tool.vue';
+  import { usePermission } from '/@/hooks/web/usePermission';
+
+  const { hasPermission } = usePermission();
 
   const { notification, createMessage } = useMessage();
   const { t } = useI18n();
@@ -106,15 +114,31 @@
         code: 'refresh',
         icon: 'ant-design:reload-outlined',
         isDefault: true,
+        auth: 'teacher:refresh',
+      },
+      {
+        isUse: true,
+        name: '查看',
+        code: 'view',
+        icon: 'ant-design:eye-outlined',
+        isDefault: true,
+        auth: 'teacher:view',
+      },
+      {
+        isUse: true,
+        name: '新增',
+        code: 'add',
+        icon: 'ant-design:plus-outlined',
+        isDefault: true,
+        auth: 'teacher:add',
       },
-      { isUse: true, name: '查看', code: 'view', icon: 'ant-design:eye-outlined', isDefault: true },
-      { isUse: true, name: '新增', code: 'add', icon: 'ant-design:plus-outlined', isDefault: true },
       {
         isUse: true,
         name: '编辑',
         code: 'edit',
         icon: 'ant-design:form-outlined',
         isDefault: true,
+        auth: 'teacher:edit',
       },
       {
         isUse: true,
@@ -122,6 +146,7 @@
         code: 'delete',
         icon: 'ant-design:delete-outlined',
         isDefault: true,
+        auth: 'teacher:delete',
       },
     ];
     return list;
@@ -270,6 +295,7 @@
           tooltip: button?.name,
           color: button.code === 'delete' ? 'error' : undefined,
           onClick: btnEvent[button.code].bind(null, record),
+          auth: button.auth,
         };
       } else {
         if (button.code === 'view') {
@@ -277,6 +303,7 @@
             icon: button?.icon,
             tooltip: button?.name,
             onClick: btnEvent[button.code].bind(null, record),
+            auth: button.auth,
           };
         } else {
           return {};

+ 2 - 0
src/views/system/menu/components/ButtonTable.vue

@@ -145,4 +145,6 @@
     const dataSource = getDataSource();
     setTableData(dataSource.filter((x) => x.key !== record.key));
   }
+
+  defineExpose({ getDataSource });
 </script>

+ 1 - 0
src/views/system/menu/components/MenuDrawer.vue

@@ -464,6 +464,7 @@
       closeDrawer();
       emit('success');
     } catch (error) {
+      console.log('error submit!!', error);
       setDrawerProps({ confirmLoading: false });
     }
   }

+ 22 - 17
src/views/teachingManager/textbookManagement/index.vue

@@ -27,6 +27,8 @@
   import { Upload } from 'ant-design-vue';
   import { useLoading } from '/@/components/Loading';
 
+  import FormImport from '/@/views/sys/import/index.vue';
+
   const [formReg, { openDrawer }] = useDrawer();
   const [pushInfoReg, { openModal }] = useModal();
   const [viewInfoReg, { openModal: openInfoModal }] = useModal();
@@ -43,6 +45,8 @@
     },
   });
   const { createConfirm, createMessage } = useMessage();
+
+  const [registerImportModal, { openModal: openImportModal }] = useModal();
   const handleDelete = (record: any) => {
     createConfirm({
       iconType: 'warning',
@@ -86,20 +90,22 @@
     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;
+  const handelImport = () => {
+    openImportModal(true, {
+      baseData: {
+        title: '导入教材信息',
+        upload: postTextbookExcelImport,
+        params: {},
+        errorName: '导入教材信息错误数据',
+        templatePath:
+          'https://zhxy.cqtlzjzx.com/minio/static/resources/%E6%95%99%E6%9D%90%E4%BF%A1%E6%81%AF%E5%AF%BC%E5%85%A5%E8%A1%A8%E6%A8%A1%E6%9D%BF.xlsx',
+        templateName: '导入教材信息模板',
+      },
+    });
+  };
+
+  const handleSuccess = () => {
+    reload();
   };
 </script>
 
@@ -110,9 +116,7 @@
         <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="handelImport">导入</a-button>
 
         <a-button type="primary" @click="handleEdit({}, false)">新增</a-button>
       </template>
@@ -145,6 +149,7 @@
     <formEdit @register="formReg" @success="reload" />
     <pushView @register="pushInfoReg" @susccess="reload" />
     <infoView @register="viewInfoReg" />
+    <FormImport @register="registerImportModal" @success="handleSuccess" />
   </PageWrapper>
 </template>