Procházet zdrojové kódy

fix: change textbook textbookSubscription

DESKTOP-USV654P\pc před 1 měsícem
rodič
revize
3d752fb0cc

+ 15 - 0
src/services/apis/StudentReportRecordController.ts

@@ -22,9 +22,15 @@ export async function putStudentStudentReportRecord(params:API.UpdateStudentRepo
 /** 删除学生报到记录表 DELETE /student/studentReportRecord */
 export async function deleteStudentStudentReportRecord(params:string[],mode: ErrorMessageMode = 'modal'){ return defHttp.delete<any>
         ({url: '/student/studentReportRecord', data:params},{errorMessageMode:mode});}
+/** 变更已报到 POST /student/studentReportRecord/all-sign */
+export async function postStudentReportRecordAllSign(mode: ErrorMessageMode = 'modal'){ return defHttp.post<any>
+        ({url: '/student/studentReportRecord/all-sign', data:{}},{errorMessageMode:mode});}
 /** 班级统计 GET /student/studentReportRecord/class-statistics */
 export async function getStudentReportRecordClassStatistics(params:any,mode: ErrorMessageMode = 'modal'){ return defHttp.get<API.StudentReportRecordStatisticsVo>
         ({url: '/student/studentReportRecord/class-statistics', params:params},{errorMessageMode:mode});}
+/** 导出 POST /student/studentReportRecord/export-querty */
+export async function postStudentReportRecordExportQuerty(mode: ErrorMessageMode = 'modal'){ return defHttp.download<any>
+        ({url: '/student/studentReportRecord/export-querty',responseType:'blob', data:{}},{errorMessageMode:mode});}
 /** 根据id查询学生报到记录表信息 GET /student/studentReportRecord/info */
 export async function getStudentReportRecordInfo(params:any,mode: ErrorMessageMode = 'modal'){ return defHttp.get<API.StudentReportRecordVo>
         ({url: '/student/studentReportRecord/info', params:params},{errorMessageMode:mode});}
@@ -34,7 +40,16 @@ export async function getStudentReportRecordMobilePage(params:any,mode: ErrorMes
 /** 学生报到记录表列表(分页) GET /student/studentReportRecord/page */
 export async function getStudentReportRecordPage(params:any,mode: ErrorMessageMode = 'modal'){ return defHttp.get<API.PageOutput<API.StudentReportRecordPageVo>>
         ({url: '/student/studentReportRecord/page', params:params},{errorMessageMode:mode});}
+/** 学生报到记录表列表(分页) GET /student/studentReportRecord/plan-page */
+export async function getStudentReportRecordPlanPage(params:any,mode: ErrorMessageMode = 'modal'){ return defHttp.get<API.PageOutput<API.StudentReportRecordPageVo>>
+        ({url: '/student/studentReportRecord/plan-page', params:params},{errorMessageMode:mode});}
+/** 学生报到 POST /student/studentReportRecord/sign */
+export async function postStudentReportRecordSign(mode: ErrorMessageMode = 'modal'){ return defHttp.post<any>
+        ({url: '/student/studentReportRecord/sign', data:{}},{errorMessageMode:mode});}
 /** 领导统计 GET /student/studentReportRecord/statistics */
 export async function getStudentReportRecordStatistics(params:any,mode: ErrorMessageMode = 'modal'){ return defHttp.get<API.StudentReportRecordStatisticsVo>
         ({url: '/student/studentReportRecord/statistics', params:params},{errorMessageMode:mode});}
+/** 切换就读方式 POST /student/studentReportRecord/update-stduyStatus */
+export async function postStudentReportRecordUpdateStduyStatus(mode: ErrorMessageMode = 'modal'){ return defHttp.post<any>
+        ({url: '/student/studentReportRecord/update-stduyStatus', data:{}},{errorMessageMode:mode});}
             

+ 60 - 43
src/views/educational/textbookSubscription/components/changeHistory.vue

@@ -7,7 +7,8 @@
   import { h, ref } from 'vue';
   import { historySchema } from './data.config';
   import { getTextbookSubscriptionItemHistoryPage } from '/@/services/apis/TextbookSubscriptionItemHistoryController';
-  const [registerModal, { closeModal }] = useModalInner((data) => {
+  defineEmits(['success', 'register']);
+  const [registerModal] = useModalInner((data) => {
     id.value = data;
     reload();
   });
@@ -22,64 +23,80 @@
     },
     columns: [
       {
-        title: '变更类型',
-        dataIndex: 'alterationType',
-        customRender({ text }) {
-          return text == 1 ? '变更数量' : text == 2 ? '变更教材' : '原始版本';
-        },
+        title: '变更前课程',
+        dataIndex: 'oldCourseName',
       },
       {
-        title: '变更时间',
-        dataIndex: 'createDate',
+        title: '变更前书名',
+        dataIndex: 'oldBookName',
       },
       {
-        title: '操作人',
-        dataIndex: 'createUserIdCn',
+        title: '变更前书号',
+        dataIndex: 'oldIssn',
+      },
+      {
+        title: '变更前出版社',
+        dataIndex: 'oldPublishingHouse',
+      },
+      {
+        title: '变更前作者',
+        dataIndex: 'oldEditorInChief',
+      },
+      {
+        title: '变更前类型',
+        dataIndex: 'oldTextbookTypeCn',
+      },
+      {
+        title: '变更前学生数量',
+        dataIndex: 'oldStudentNum',
+      },
+      {
+        title: '变更前教师数量',
+        dataIndex: 'oldTeacherNum',
       },
       {
-        title: '类型',
-        dataIndex: 'textbookTypeCn',
-        width: '120',
+        title: '变更后课程',
+        dataIndex: 'newCourseName',
       },
       {
-        title: '课程名称',
-        dataIndex: 'courseName',
-        customRender({ record, text }) {
-          if (record.alterationType == 2) {
-            return h('span', { style: 'color:red' }, text);
-          }
-        },
+        title: '变更后书名',
+        dataIndex: 'newBookName',
       },
       {
-        title: '教材名称',
-        dataIndex: 'bookName',
-        customRender({ record, text }) {
-          if (record.alterationType == 2) {
-            return h('span', { style: 'color:red' }, text);
-          }
-        },
+        title: '变更后书号',
+        dataIndex: 'newIssn',
       },
       {
-        title: '学生用书征订数量',
-        dataIndex: 'studentNum',
-        customRender({ record, text }) {
-          if (record.alterationType == 1) {
-            return h('span', { style: 'color:red' }, text);
-          }
-        },
+        title: '变更后出版社',
+        dataIndex: 'newPublishingHouse',
       },
       {
-        title: '教师用书征订数量',
-        dataIndex: 'teacherNum',
-        customRender({ record, text }) {
-          if (record.alterationType == 1) {
-            return h('span', { style: 'color:red' }, text);
-          }
-        },
+        title: '变更后作者',
+        dataIndex: 'newEditorInChief',
+      },
+      {
+        title: '变更后类型',
+        dataIndex: 'newTextbookTypeCn',
+      },
+      {
+        title: '变更后学生数量',
+        dataIndex: 'newStudentNum',
+      },
+      {
+        title: '变更后教师数量',
+        dataIndex: 'newTeacherNum',
+      },
+      {
+        title: '变更时间',
+        dataIndex: 'createDate',
+      },
+      {
+        title: '操作人',
+        dataIndex: 'createUserIdCn',
       },
     ],
     title: '变更记录表',
-    resizeHeightOffset: 200,
+    // resizeHeightOffset: 200,
     beforeFetch: (params) => {
       return {
         ...params,
@@ -90,7 +107,7 @@
 </script>
 
 <template>
-  <BasicModal :footer="[]" @register="registerModal" default-fullscreen title="变更记录">
+  <BasicModal :footer="null" @register="registerModal" default-fullscreen title="变更记录">
     <BasicTable @register="tableRef" />
   </BasicModal>
 </template>

+ 202 - 0
src/views/schoolOpens/record/data.config.ts

@@ -0,0 +1,202 @@
+import { BasicColumn, FormSchema } from '/@/components/Table';
+import { requestMagicApi } from '/@/api/magicApi';
+import { formatToDate } from '/@/utils/dateUtil';
+import { Switch } from 'ant-design-vue';
+import { h } from 'vue';
+import { useMessage } from '/@/hooks/web/useMessage';
+import { postStudentReportRecordSign } from '/@/services/apis/StudentReportRecordController';
+
+export const stateOptions = [
+  { label: '草稿', value: 0 },
+  { label: '进行中', value: 1 },
+  { label: '已结束', value: 2 },
+];
+
+export const tableColumns: BasicColumn[] = [
+  {
+    title: '年级',
+    dataIndex: 'gradeName',
+    align: 'left',
+    width: 100,
+  },
+  {
+    title: '班级',
+    dataIndex: 'classNmae',
+    align: 'left',
+    width: 120,
+  },
+  {
+    title: '班主任',
+    dataIndex: 'teacherName',
+    align: 'left',
+    width: 100,
+  },
+  {
+    title: '学生姓名',
+    dataIndex: 'name',
+    align: 'left',
+    width: 100,
+  },
+  {
+    title: '性别',
+    dataIndex: 'grendCn',
+    align: 'left',
+    width: 80,
+  },
+  {
+    title: '身份证号',
+    dataIndex: 'credentialNumber',
+    align: 'left',
+    width: 120,
+  },
+  {
+    title: '手机号',
+    dataIndex: 'mobile',
+    align: 'left',
+    width: 120,
+  },
+  {
+    title: '家长联系电话',
+    dataIndex: 'parentMobile',
+    align: 'left',
+    width: 120,
+  },
+  {
+    title: '学生来源',
+    dataIndex: 'sourceName',
+    align: 'left',
+  },
+  {
+    title: '学籍状态',
+    dataIndex: 'status',
+    align: 'left',
+    width: 80,
+  },
+  {
+    title: '状态',
+    dataIndex: 'isReport',
+    customRender: ({ record }) => {
+      if (!Reflect.has(record, 'pendingStatus')) {
+        record.pendingStatus = false;
+      }
+      return h(Switch, {
+        checked: record.isReport === 1,
+        checkedChildren: '报到',
+        unCheckedChildren: '未报到',
+        loading: record.pendingStatus,
+        onChange(checked: boolean) {
+          record.pendingStatus = true;
+          const newStatus = checked ? 1 : 0;
+          const { createMessage } = useMessage();
+          postStudentReportRecordSign(record.id)
+            .then(() => {
+              record.isReport = newStatus;
+              createMessage.success('已成功修改状态');
+            })
+            .catch(() => {
+              createMessage.error('修改状态失败');
+            })
+            .finally(() => {
+              record.pendingStatus = false;
+            });
+        },
+      });
+    },
+    width: 80,
+  },
+  {
+    title: '报到日期',
+    dataIndex: 'reportDate',
+    align: 'left',
+    width: 120,
+  },
+];
+
+export const searchFormSchema: FormSchema[] = [
+  {
+    field: 'baseSemesterId',
+    label: '学期',
+    component: 'ApiSelect',
+    componentProps: {
+      getPopupContainer: () => document.body,
+      api: requestMagicApi,
+      params: { url: 'baseData/semester/option' },
+    },
+    colProps: { span: 8 },
+  },
+  {
+    field: 'classId',
+    label: '班级',
+    component: 'Input',
+    colProps: { span: 8 },
+  },
+  {
+    field: 'name',
+    label: '学生姓名',
+    component: 'Input',
+    colProps: { span: 8 },
+  },
+  {
+    field: '身份证号',
+    label: '状态',
+    component: 'Input',
+    colProps: { span: 8 },
+  },
+];
+
+export const formSchema: FormSchema[] = [
+  {
+    label: '计划名称',
+    field: 'name',
+    component: 'Input',
+    required: true,
+    colProps: { span: 24 },
+  },
+  {
+    field: 'semesterId',
+    label: '学期',
+    component: 'ApiSelect',
+    componentProps: {
+      getPopupContainer: () => document.body,
+      api: requestMagicApi,
+      params: { url: 'baseData/semester/option' },
+    },
+    required: true,
+    colProps: { span: 24 },
+  },
+  {
+    label: '报到时间',
+    field: 'dateTime',
+    component: 'RangePicker',
+    colProps: { span: 24 },
+    required: true,
+    componentProps: {
+      getPopupContainer: () => document.body,
+      placeholder: ['开始时间', '结束时间'],
+      format: 'YYYY-MM-DD HH:mm:ss',
+      showTime: { format: 'HH:mm:ss' },
+    },
+  },
+  {
+    label: '就读修改时间',
+    field: 'date',
+    component: 'RangePicker',
+    colProps: { span: 24 },
+    required: true,
+    componentProps: {
+      getPopupContainer: () => document.body,
+      placeholder: ['开始时间', '结束时间'],
+      format: 'YYYY-MM-DD',
+      valueFormat: 'YYYY-MM-DD',
+      showTime: false,
+    },
+  },
+  {
+    label: '参与班级',
+    field: 'classIds',
+    component: 'Input',
+    required: true,
+    colProps: { span: 24 },
+    slot: 'classIds',
+  },
+];

+ 109 - 0
src/views/schoolOpens/record/index.vue

@@ -0,0 +1,109 @@
+<script setup lang="ts">
+  import { PageWrapper } from '/@/components/Page';
+  import { useTable, BasicTable, TableAction } from '/@/components/Table';
+  import { searchFormSchema, tableColumns } from './data.config';
+  import { reactive } from 'vue';
+  import { Recordable } from 'vite-plugin-mock';
+  import { useMessage } from '/@/hooks/web/useMessage';
+  import {
+    getStudentReportRecordPlanPage,
+    postStudentReportRecordAllSign,
+    postStudentReportRecordExportQuerty,
+    postStudentReportRecordUpdateStduyStatus,
+  } from '/@/services/apis/StudentReportRecordController';
+  import { downloadByData } from '/@/utils/file/download';
+  import { formatToDate } from '/@/utils/dateUtil';
+  import PlanTree from './planTree.vue';
+
+  const searchInfo = reactive<Recordable>({});
+
+  const { createConfirm, createMessage } = useMessage();
+
+  const [registerTable, { reload, getSelectRowKeys, getForm }] = useTable({
+    api: getStudentReportRecordPlanPage,
+    title: '报到计划表',
+    rowKey: 'id',
+    columns: tableColumns,
+    formConfig: {
+      labelWidth: 120,
+      schemas: searchFormSchema,
+    },
+    useSearchForm: true,
+    showTableSetting: true,
+    bordered: true,
+    immediate: true,
+    canResize: true,
+    actionColumn: {
+      width: 120,
+      title: '操作',
+      dataIndex: 'action',
+      slots: { customRender: 'action' },
+      fixed: 'right',
+    },
+    rowSelection: {
+      type: 'checkbox',
+    },
+  });
+
+  const handleChangeReport = async () => {
+    const keys = getSelectRowKeys();
+    if (keys.length > 0) {
+      await postStudentReportRecordAllSign(keys[0]);
+    }
+  };
+  const handleChangeStduyStatus = (record: any) => {
+    createConfirm({
+      iconType: 'warning',
+      title: '温馨提醒',
+      content: '确认切换当前学生就读方式?',
+      onOk: async () => {
+        try {
+          await postStudentReportRecordUpdateStduyStatus(record.id);
+          createMessage.success('删除成功');
+          await reload();
+        } catch (e) {
+          createMessage.error('删除失败');
+        }
+      },
+      okText: '确认',
+      cancelText: '取消',
+    });
+  };
+
+  const handleExport = async () => {
+    const postData = getForm();
+    downloadByData(
+      (await postStudentReportRecordExportQuerty({ ...postData, ...searchInfo })).data,
+      `学生报到信息${formatToDate(new Date())}.xlsx`,
+    );
+  };
+
+  function handleSelect(data) {
+    searchInfo.studentReportPlanId = data.id;
+    reload();
+  }
+</script>
+
+<template>
+  <PageWrapper dense contentFullHeight fixedHeight contentClass="flex">
+    <PlanTree class="w-1/3 xl:w-1/4" @select="handleSelect" />
+    <BasicTable @register="registerTable" class="w-2/3 xl:w-3/4" :searchInfo="searchInfo">
+      <template #toolbar>
+        <a-button type="primary" @click="handleChangeReport">变更为已报到</a-button>
+        <a-button type="primary" @click="handleExport">导出</a-button>
+      </template>
+      <template #action="{ record }">
+        <TableAction
+          :actions="[
+            {
+              label: '切换就读方式',
+              onClick: handleChangeStduyStatus.bind(null, record),
+            },
+          ]"
+        />
+      </template>
+    </BasicTable>
+  </PageWrapper>
+</template>
+
+<style scoped lang="less"></style>

+ 57 - 0
src/views/schoolOpens/record/planTree.vue

@@ -0,0 +1,57 @@
+<template>
+  <div class="mr-2 overflow-hidden bg-white h-full">
+    <BasicTree
+      title="计划列表"
+      toolbar
+      search
+      :clickRowToExpand="true"
+      :treeData="treeData"
+      :selectedKeys="selectedKeys"
+      expandOnSearch
+      :fieldNames="{ key: 'id', title: 'name' }"
+      @select="handleSelect"
+    >
+      <template #title="item">
+        <div class="flex justify-between flex-1">
+          <div>{{ item.name }}</div>
+          <div v-if="item.parentId" :class="{ 'text-[#f00]': item.status === 2 }">
+            {{ item.status === 1 ? '进行中' : '已结束' }}
+          </div>
+        </div>
+      </template>
+    </BasicTree>
+  </div>
+</template>
+<script lang="ts">
+  import { defineComponent, onMounted, ref } from 'vue';
+
+  import { BasicTree, TreeItem } from '/@/components/Tree';
+  import { useI18n } from '/@/hooks/web/useI18n';
+  import { getStudentReportPlanTree } from '/@/services/apis/StudentReportPlanController';
+  const { t } = useI18n();
+  export default defineComponent({
+    name: 'ClassTree',
+    components: { BasicTree },
+
+    emits: ['select'],
+    setup(_, { emit }) {
+      const treeData = ref<TreeItem[]>([]);
+      const selectedKeys = ref<string[]>([]);
+
+      async function fetch() {
+        treeData.value = (await getStudentReportPlanTree({})) as unknown as TreeItem[];
+      }
+
+      function handleSelect(keys: string, event: Event) {
+        if (event.node.parentId) {
+          emit('select', keys[0]);
+        }
+      }
+
+      onMounted(() => {
+        fetch();
+      });
+      return { treeData, handleSelect, selectedKeys, t };
+    },
+  });
+</script>