Browse Source

wip:新生基础信息页面

zcuishan 9 months ago
parent
commit
8deacc207d

+ 75 - 0
src/views/educational/basicInformation/components/achievementImport.vue

@@ -0,0 +1,75 @@
+<script setup lang="ts">
+  import BasicModal from '/@/components/Modal/src/BasicModal.vue';
+  import { useModal } 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();
+  const errMsg = ref('');
+  const folderId = ref('');
+  const { createMessage } = useMessage();
+  const data = ref('');
+  const handleUpdate = async (e) => {
+    data.value = e[0];
+  };
+  const handleSubmit = async () => {
+    try {
+      await postBaseClassCourseImport({ file: data.value }, 'none');
+      createMessage.success('导入成功');
+      folderId.value = '';
+      closeModal();
+    } catch (err: any) {
+      errMsg.value = err;
+    }
+  };
+  const handleCancel = () => {
+    folderId.value = '';
+    errMsg.value = '';
+    closeModal();
+  };
+  const handleDonwmLoad = 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',
+    );
+  };
+</script>
+
+<template>
+  <BasicModal
+    @cancel="handleCancel"
+    @ok="handleSubmit"
+    @register="modalRegister"
+    destroyOnClose
+    v-bind="$attrs"
+    title="新生成绩导入"
+  >
+    <div class="flex flex-col mt-[24px]">
+      <div class="flex flex-col">
+        <span class="text-[16px] text-[1000]">1、 下载导入模板</span>
+        <a-button type="primary" class="w-[110px] mt-[12px]" @click="handleDonwmLoad">
+          下载模板</a-button
+        >
+      </div>
+      <div class="mt-[12px]">
+        <span class="text-[16px] text-[1000]">2、 上传文件</span>
+        <Upload
+          class="mt-[12px]"
+          accept="xlsx,xls"
+          :maxNumber="1"
+          v-model:value="folderId"
+          :multiple="false"
+          @success="handleUpdate"
+        />
+      </div>
+      <span class="mt-[24px]">导入反馈:</span>
+      <div style="border: 1px solid #ccc; width: 100%; height: 300px; overflow: auto; color: red">
+        {{ errMsg }}
+      </div>
+    </div>
+  </BasicModal>
+</template>
+
+<style scoped lang="less"></style>

+ 162 - 0
src/views/educational/basicInformation/components/data.config.ts

@@ -0,0 +1,162 @@
+import { BasicColumn, FormSchema } from '/@/components/Table';
+import { requestMagicApi } from '/@/api/magicApi';
+export const TableColumns: BasicColumn[] = [
+  {
+    title: '毕业学校',
+    dataIndex: 's',
+  },
+  {
+    title: '学生姓名',
+    dataIndex: 'studentName',
+  },
+  {
+    title: '姓名',
+    dataIndex: 'sex',
+  },
+  {
+    title: '身份证号码',
+    dataIndex: 'idCard',
+  },
+  {
+    title: '身高(CM)',
+    dataIndex: 'height',
+  },
+  {
+    title: '体重(KG)',
+    dataIndex: 'weight',
+  },
+  {
+    title: '成绩',
+    dataIndex: 'score',
+  },
+  {
+    title: '初中毕业班级',
+    dataIndex: 'grade',
+  },
+  {
+    title: '学生来源',
+    dataIndex: 'source',
+  },
+  {
+    title: '住宿类型',
+    dataIndex: 'source',
+  },
+  {
+    title: '手机号',
+    dataIndex: 'source',
+  },
+  {
+    title: '第一志愿',
+    dataIndex: 'source',
+  },
+  {
+    title: '第二志愿',
+    dataIndex: 'source',
+  },
+  {
+    title: '班级状态',
+    dataIndex: 'source',
+  },
+  {
+    title: '操作',
+    dataIndex: 'action',
+    width: 100,
+    fixed: 'right',
+    slots: { customRender: 'action' },
+  },
+];
+export const formSchema: FormSchema[] = [
+  {
+    label: '年级',
+    field: 'gradeId',
+    component: 'ApiSelect',
+    componentProps: {
+      getPopupContainer: () => document.body,
+      api: requestMagicApi,
+      params: { url: 'baseData/grade/option' },
+    },
+    colProps: { span: 24 },
+  },
+  {
+    field: 'majorSetId',
+    label: '专业',
+    component: 'ApiSelect',
+    required: true,
+    componentProps: ({ formActionType }) => {
+      return {
+        getPopupContainer: () => document.body,
+        api: requestMagicApi,
+        params: { url: `/major/majorset/option` },
+        showSearch: true,
+        filterOption: (input: string, option: any) => {
+          return (
+            option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0 ||
+            option.value.toLowerCase().indexOf(input.toLowerCase()) >= 0
+          );
+        },
+        onChange: async (vlaue) => {
+          const { getFieldsValue, updateSchema } = formActionType;
+          const formData = getFieldsValue();
+          const classData = await requestMagicApi({
+            url: 'educational/class-by',
+            query: { grade_id: formData.gradeId, major_set_id: vlaue },
+          } as any);
+          updateSchema({
+            field: 'classId',
+            componentProps: {
+              getPopupContainer: () => document.body,
+              options: classData,
+            },
+          });
+        },
+      };
+    },
+    colProps: { span: 24 },
+  },
+  {
+    label: '班级',
+    field: 'classId',
+    component: 'ApiSelect',
+    componentProps: ({ formModel }) => {
+      return {
+        getPopupContainer: () => document.body,
+        api: requestMagicApi,
+        valueField: 'label',
+        params: { url: `educational/class/gradeid?grade_id=${formModel.gradeId}` },
+      };
+    },
+    colProps: { span: 24 },
+  },
+];
+export const searchSchema: FormSchema[] = [
+  {
+    field: 'name',
+    label: '学生姓名',
+    component: 'Input',
+    colProps: { span: 6 },
+  },
+  {
+    field: 'icCard',
+    label: '身份证号',
+    component: 'Input',
+    colProps: { span: 6 },
+  },
+  {
+    field: 'export',
+    label: '成绩导入',
+    component: 'Select',
+    componentProps: {
+      options: [
+        {
+          label: '未导入',
+          value: '0',
+        },
+        {
+          label: '已导入',
+          value: '1',
+        },
+      ],
+    },
+    colProps: { span: 6 },
+  },
+];

+ 77 - 0
src/views/educational/basicInformation/components/formEdit.vue

@@ -0,0 +1,77 @@
+<script setup lang="ts">
+  import { ref } from 'vue';
+  import { useMessage } from '/@/hooks/web/useMessage';
+  import BasicForm from '/@/components/Form/src/BasicForm.vue';
+  import { useForm } from '/@/components/Form';
+  import { formSchema } from './data.config';
+  import {
+    postAppBaseappfunction,
+    putAppBaseappfunction,
+  } from '/@/services/apis/BaseAppFunctionController';
+  import BasicModal from '/@/components/Modal/src/BasicModal.vue';
+  import { useModalInner } from '/@/components/Modal';
+  const taskId = ref('');
+  const isUpdate = ref();
+  const [register, { closeModal }] = useModalInner(async (data) => {
+    taskId.value = data.id;
+    isUpdate.value = data.isUpdate;
+    if (isUpdate.value) {
+      title.value = '修改配置';
+    } else if (taskId.value) {
+      title.value = '查看配置';
+    } else {
+      title.value = '新增配置';
+    }
+    await setFieldsValue({ ...data });
+  });
+  const handleClose = () => {
+    closeModal();
+  };
+  const { createMessage } = useMessage();
+  const emit = defineEmits(['success']);
+  const [formReg, { validateFields, setFieldsValue, resetFields }] = useForm({
+    schemas: formSchema,
+    layout: 'vertical',
+    showActionButtonGroup: false,
+  });
+  const title = ref('手动分班');
+  const handleSubmit = async () => {
+    const data = await validateFields();
+    try {
+      if (isUpdate.value) {
+        data.id = taskId.value;
+        await putAppBaseappfunction({ ...(data as API.UpdateBaseAppFunctionDto) });
+        createMessage.success('修改成功');
+      } else {
+        if (taskId.value) {
+          closeModal();
+          return false;
+        }
+        await postAppBaseappfunction({ ...(data as API.AddBaseAppFunctionDto) });
+        createMessage.success('新增成功');
+      }
+      emit('success');
+      await resetFields();
+      closeModal();
+    } catch (error) {
+      createMessage.error(error.message);
+    }
+  };
+</script>
+
+<template>
+  <BasicModal
+    show-footer
+    @close="handleClose"
+    @ok="handleSubmit"
+    destroyOnClose
+    v-bind="$attrs"
+    @register="register"
+    :title="title"
+    width="50%"
+  >
+    <BasicForm @register="formReg" />
+  </BasicModal>
+</template>
+
+<style scoped lang="less"></style>

+ 70 - 0
src/views/educational/basicInformation/index.vue

@@ -0,0 +1,70 @@
+<script setup lang="ts">
+  import { PageWrapper } from '/@/components/Page';
+  import { useTable } from '/@/components/Table';
+  import BasicTable from '/@/components/Table/src/BasicTable.vue';
+  import { searchSchema, TableColumns } from './components/data.config';
+  import TableAction from '/@/components/Table/src/components/TableAction.vue';
+  import { getBaseappfunctionPage } from '/@/services/apis/BaseAppFunctionController';
+  import formEdit from './components/formEdit.vue';
+  import BasicTree from '/@/components/Tree/src/Tree.vue';
+  import achievementImport from './components/achievementImport.vue';
+  import { useModal } from '/@/components/Modal';
+  const [formReg, { openModal }] = useModal();
+  const [importReg, { openModal: openImportModal }] = useModal();
+  const [registerTable, { reload }] = useTable({
+    api: getBaseappfunctionPage,
+    columns: TableColumns,
+    title: '新生列表',
+    bordered: true,
+    rowKey: 'id',
+    showTableSetting: true,
+    beforeFetch: (params) => {
+      return params;
+    },
+    rowSelection: {
+      type: 'checkbox',
+      onChange: (selectedRowKeys, selectedRows) => {
+        console.log(selectedRowKeys, selectedRows);
+      },
+    },
+    useSearchForm: true,
+    formConfig: {
+      labelWidth: 120,
+      schemas: searchSchema,
+    },
+  });
+  const handleEdit = (record: any, isUpdate: boolean) => {
+    openModal(true, { ...record, isUpdate: isUpdate });
+  };
+</script>
+
+<template>
+  <PageWrapper dense contentFullHeight fixedHeight contentClass="flex">
+    <BasicTree title="年级列表" search class="min-w-[200px]" />
+    <div class="ml-[12px] w-full overflow-x-auto">
+      <BasicTable @register="registerTable">
+        <template #toolbar>
+          <a-button type="primary" @click="handleEdit({}, false)">手动分班</a-button>
+          <a-button type="primary" @click="openImportModal(true, {})">成绩导入</a-button>
+          <a-button>导出</a-button>
+        </template>
+        <template #action="{ record }">
+          <div style="display: flex; justify-content: center">
+            <TableAction
+              :actions="[
+                {
+                  label: '编辑',
+                  onClick: handleEdit.bind(null, record, true),
+                },
+              ]"
+            />
+          </div>
+        </template>
+      </BasicTable>
+    </div>
+    <formEdit @register="formReg" @success="reload" />
+    <achievementImport @register="importReg" />
+  </PageWrapper>
+</template>
+
+<style scoped lang="less"></style>

+ 1 - 1
src/views/educational/textbookSubscription/components/historyView.vue

@@ -38,7 +38,7 @@
         width: 120,
       },
       {
-        title: '教师用书正定数量',
+        title: '教师用书征订数量',
         dataIndex: 'teacherSubscriptionNumber',
         width: 120,
       },