Browse Source

fix: change sending

DESKTOP-USV654P\pc 1 day ago
parent
commit
f7d6047282

+ 1 - 1
Makefile

@@ -12,7 +12,7 @@ build:
 
 commit:
 	git add . && \
-	git commit --no-verify -m "fix: change basicInformation"
+	git commit --no-verify -m "fix: change sending"
 
 checkPre:
 	git checkout pre

+ 139 - 0
src/views/educational/probation/report/adjust.vue

@@ -0,0 +1,139 @@
+<template>
+  <BasicModal
+    @ok="handleSubmit"
+    :destroyOnClose="true"
+    :maskClosable="false"
+    v-bind="$attrs"
+    @register="registerModal"
+    :title="getTitle"
+    :width="1002"
+  >
+    <BasicForm @register="registerForm">
+      <template #studentIds>
+        <div class="flex" style="flex-wrap: wrap">
+          <div v-for="(item, index) in modelRef" :key="index">
+            <div style="margin: 4px" v-if="index < 6"> {{ item.name }}</div>
+          </div>
+          <div style="margin: 4px" v-if="modelRef.length > 6"> ... 等{{ modelRef.length }}个 </div>
+        </div>
+      </template>
+    </BasicForm>
+  </BasicModal>
+</template>
+<script setup lang="ts">
+  import { ref, computed, unref } from 'vue';
+  import { useMessage } from '/@/hooks/web/useMessage';
+  import { BasicModal, useModalInner } from '/@/components/Modal';
+  import { BasicForm, useForm } from '/@/components/Form/index';
+
+  import {
+    getBandingTaskClassList,
+    postBandingTaskClassChangeClass,
+  } from '/@/services/apis/BandingTaskClassController';
+
+  const isUpdate = ref(true);
+  const modelRef = ref<Recordable[]>([]);
+  const emit = defineEmits(['success', 'register']);
+  const { createMessage } = useMessage();
+  const [registerForm, { validate, resetFields, updateSchema, setFieldsValue }] = useForm({
+    labelWidth: 100,
+    schemas: [
+      {
+        field: 'studentName',
+        label: '调整学生',
+        component: 'Input',
+        colProps: { span: 24 },
+        dynamicDisabled: true,
+      },
+      {
+        field: 'gradeName',
+        label: '年级',
+        component: 'Input',
+        colProps: { span: 24 },
+        dynamicDisabled: true,
+      },
+      {
+        field: 'bandingTaskClassId',
+        label: '调到班级',
+        component: 'ApiSelect',
+        colProps: { span: 24 },
+        componentProps: {
+          api: requestMagicApi,
+          params: { url: 'educational/class/option' },
+          getPopupContainer: () => document.body,
+          showSearch: true,
+          filterOption: (input: string, option: any) => {
+            return (
+              option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0 ||
+              option.value.toLowerCase().indexOf(input.toLowerCase()) >= 0
+            );
+          },
+        },
+      },
+    ],
+    showActionButtonGroup: false,
+  });
+
+  const [registerModal, { closeModal, setModalProps }] = useModalInner(async (data) => {
+    resetFields();
+    setModalProps({ confirmLoading: false });
+    isUpdate.value = !!data?.isUpdate;
+    modelRef.value = [...data.baseData];
+
+    const taskClassList = await getBandingTaskClassList({
+      bandingTaskId: data.bandingTaskId,
+    });
+
+    const classList = taskClassList.map((item) => {
+      return {
+        label: item.name,
+        value: item.id,
+      };
+    });
+
+    updateSchema([
+      {
+        field: 'bandingTaskClassId',
+        componentProps: {
+          options: classList,
+          onChange: (value: string) => {
+            const filterItme = taskClassList.find((it) => it.id === value);
+            if (filterItme) {
+              setFieldsValue({ teacherName: filterItme.teacherName });
+              // formModel.teacherName = filterItme.teacherName;
+            }
+          },
+        },
+      },
+    ]);
+  });
+
+  const getTitle = computed(() => (!unref(isUpdate) ? '调整班级' : '调整班级'));
+  const handleSubmit = async () => {
+    try {
+      const values = await validate();
+      setModalProps({ confirmLoading: true });
+
+      const newStudentIds: string[] = [];
+
+      modelRef.value.forEach((item) => {
+        newStudentIds.push(item.id);
+      });
+
+      const postParams = {
+        newStudentIds: newStudentIds,
+      };
+      Object.assign(postParams, values);
+
+      await postBandingTaskClassChangeClass(postParams as API.ChangeClassDto);
+
+      createMessage.success('操作成功');
+      closeModal();
+      emit('success');
+    } finally {
+      setModalProps({ confirmLoading: false });
+    }
+  };
+</script>
+
+<style scoped lang="less"></style>

+ 231 - 0
src/views/educational/probation/report/data.config.ts

@@ -0,0 +1,231 @@
+import { BasicColumn, FormSchema } from '/@/components/Table';
+import { getDataOption } from '/@/api/system/dic';
+import { Switch } from 'ant-design-vue';
+import { h } from 'vue';
+import { useMessage } from '/@/hooks/web/useMessage';
+import {
+  deleteStudentStudentReportRecord,
+  postStudentStudentReportRecord,
+} from '/@/services/apis/StudentReportRecordController';
+import { formatToDate } from '/@/utils/dateUtil';
+import { getBasestudentcadreClasslist } from '/@/services/apis/BaseStudentCadreController';
+import { requestMagicApi } from '/@/api/magicApi';
+
+export const tableColumns: BasicColumn[] = [
+  {
+    title: '年级',
+    dataIndex: 'gradeName',
+    align: 'left',
+    width: 100,
+  },
+  {
+    title: '班级',
+    dataIndex: 'className',
+    align: 'left',
+  },
+  {
+    title: '班主任',
+    dataIndex: 'teacherName',
+    align: 'left',
+    width: 100,
+  },
+  {
+    title: '学生姓名',
+    dataIndex: 'name',
+    align: 'left',
+    width: 100,
+  },
+  {
+    title: '性别',
+    dataIndex: 'genderCn',
+    align: 'left',
+    width: 80,
+  },
+  {
+    title: '身份证号码',
+    dataIndex: 'credentialNumber',
+    align: 'left',
+    width: 150,
+  },
+  {
+    title: '手机号',
+    dataIndex: 'mobile',
+    align: 'left',
+    width: 120,
+  },
+  {
+    title: '家长联系电话',
+    dataIndex: 'familyMobile',
+    align: 'left',
+    width: 120,
+  },
+  {
+    title: '学生来源',
+    dataIndex: 'sourceCn',
+    align: 'left',
+    width: 120,
+  },
+  //   {
+  //     title: '毕业学校',
+  //     dataIndex: 'graduateSchool',
+  //     align: 'left',
+  //     width: 150,
+  //   },
+  {
+    title: '就读方式',
+    dataIndex: 'stduyStatusCn',
+    align: 'left',
+    width: 100,
+  },
+  {
+    title: '报到状态',
+    dataIndex: 'isReport',
+    align: 'left',
+    width: 80,
+    customRender: ({ record }) => {
+      if (!Reflect.has(record, 'pendingStatus')) {
+        record.pendingStatus = false;
+      }
+      return h(Switch, {
+        checked: record.isReport === 1,
+        // checkedChildren: '已报到',
+        // unCheckedChildren: '未报到',
+        loading: record.pendingStatus,
+        async onChange(checked: boolean) {
+          record.pendingStatus = true;
+          const newStatus = checked ? 1 : 0;
+          const { createMessage } = useMessage();
+          try {
+            if (checked) {
+              await postStudentStudentReportRecord({ userId: record.userId });
+            } else {
+              await deleteStudentStudentReportRecord([record.userId]);
+            }
+            record.isReport = newStatus;
+            record.reportTime = formatToDate(new Date());
+            createMessage.success('修改成功');
+          } finally {
+            record.pendingStatus = false;
+          }
+        },
+      });
+    },
+  },
+  {
+    title: '报到日期',
+    dataIndex: 'reportTime',
+    align: 'left',
+    width: 150,
+    customRender: ({ record }) => {
+      return record.isReport === 1 ? record.reportTime : '';
+    },
+  },
+];
+
+export const searchFormSchema: FormSchema[] = [
+  {
+    field: 'classId',
+    label: '班级',
+    component: 'Input',
+    colProps: { span: 8 },
+    componentProps: {
+      api: getBasestudentcadreClasslist,
+      showSearch: true,
+      labelField: 'name',
+      valueField: 'id',
+      optionFilterProp: 'name',
+      getPopupContainer: () => document.body,
+    },
+  },
+  {
+    field: 'name',
+    label: '学生姓名',
+    component: 'Input',
+    colProps: { span: 8 },
+  },
+  {
+    field: 'credentialNumber',
+    label: '身份证号',
+    component: 'Input',
+    colProps: { span: 8 },
+  },
+  {
+    field: 'source',
+    label: '学生来源',
+    component: 'ApiSelect',
+    colProps: { span: 8 },
+    componentProps: {
+      api: getDataOption,
+      params: { code: 'student_type' },
+      showSearch: true,
+      optionFilterProp: 'label',
+      getPopupContainer: () => document.body,
+    },
+  },
+  {
+    field: 'stduyStatus',
+    label: '就读方式',
+    component: 'ApiSelect',
+    colProps: { span: 8 },
+    componentProps: {
+      api: getDataOption,
+      params: { code: 'stduy_status' },
+      getPopupContainer: () => document.body,
+    },
+  },
+  {
+    field: 'gender',
+    label: '性别',
+    component: 'ApiSelect',
+    componentProps: {
+      api: getDataOption,
+      params: { code: 'gender' },
+      getPopupContainer: () => document.body,
+    },
+    colProps: { span: 8 },
+  },
+  {
+    field: 'isReport',
+    label: '报到状态',
+    component: 'Select',
+    colProps: { span: 8 },
+    componentProps: {
+      getPopupContainer: () => document.body,
+      options: [
+        {
+          label: '已报到',
+          value: '1',
+        },
+        {
+          label: '未报到',
+          value: '0',
+        },
+      ],
+    },
+  },
+  {
+    field: '[startDate,endDate]',
+    label: '报到日期',
+    component: 'RangePicker',
+    componentProps: {
+      getPopupContainer: () => document.body,
+      format: 'YYYY-MM-DD HH:mm:ss',
+      placeholder: ['开始时间', '结束时间'],
+      showTime: { format: 'HH:mm:ss' },
+    },
+    colProps: { span: 8 },
+  },
+  {
+    field: 'gradeId',
+    label: '年级',
+    component: 'ApiSelect',
+    colProps: { span: 8 },
+    componentProps: () => {
+      return {
+        api: requestMagicApi,
+        params: { url: 'baseData/grade/option' },
+        getPopupContainer: () => document.body,
+      };
+    },
+  },
+];

+ 103 - 0
src/views/educational/probation/report/edit.vue

@@ -0,0 +1,103 @@
+<template>
+  <BasicModal
+    @ok="handleSubmit"
+    :destroyOnClose="true"
+    :maskClosable="false"
+    v-bind="$attrs"
+    @register="registerModal"
+    :title="getTitle"
+    :width="1002"
+  >
+    <BasicForm @register="registerForm" />
+  </BasicModal>
+</template>
+<script setup lang="ts">
+  import { ref, computed, unref } from 'vue';
+  import { useMessage } from '/@/hooks/web/useMessage';
+  import { BasicModal, useModalInner } from '/@/components/Modal';
+  import { BasicForm, useForm } from '/@/components/Form/index';
+
+  import { deleteBaseNewStudentDeleteByUserIds } from '/@/services/apis/BaseNewStudentController';
+  import { formatToDate } from '/@/utils/dateUtil';
+
+  const isUpdate = ref(true);
+  const modelRef = ref<Recordable[]>([]);
+  const emit = defineEmits(['success', 'register']);
+  const { createMessage } = useMessage();
+  const [registerForm, { validate, resetFields }] = useForm({
+    labelWidth: 100,
+    schemas: [
+      {
+        label: '报到开始时间',
+        field: 'startTime',
+        component: 'DatePicker',
+        colProps: { span: 24 },
+        required: true,
+        componentProps: {
+          getPopupContainer: () => document.body,
+          format: 'YYYY-MM-DD HH:mm:ss',
+          // showTime: { format: 'HH:mm:ss' },
+        },
+      },
+      {
+        label: '报到结束时间',
+        field: 'endTime',
+        component: 'DatePicker',
+        colProps: { span: 24 },
+        required: true,
+        componentProps: {
+          getPopupContainer: () => document.body,
+          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,
+        },
+      },
+    ],
+    showActionButtonGroup: false,
+  });
+
+  const [registerModal, { closeModal, setModalProps }] = useModalInner(async (data) => {
+    resetFields();
+    setModalProps({ confirmLoading: false });
+    isUpdate.value = !!data?.isUpdate;
+    modelRef.value = { ...data.baseData };
+    //   resData['date'] = [resData['updateStartTime'], resData['updateEndTime']];
+  });
+
+  const getTitle = computed(() => (!unref(isUpdate) ? '报到日间设置' : '报到日间设置'));
+  const handleSubmit = async () => {
+    try {
+      const values = await validate();
+      setModalProps({ confirmLoading: true });
+      const postParams = unref(modelRef);
+      Object.assign(postParams, values);
+
+      postParams['updateStartTime'] = formatToDate(values['date'][0]);
+      postParams['updateEndTime'] = formatToDate(values['date'][1]);
+      delete postParams['date'];
+
+      await deleteBaseNewStudentDeleteByUserIds(postParams);
+
+      createMessage.success('操作成功');
+      closeModal();
+      emit('success');
+    } finally {
+      setModalProps({ confirmLoading: false });
+    }
+  };
+</script>
+
+<style scoped lang="less"></style>

+ 177 - 0
src/views/educational/probation/report/index.vue

@@ -0,0 +1,177 @@
+<script setup lang="ts">
+  import { PageWrapper } from '/@/components/Page';
+  import { useTable, BasicTable, TableAction } from '/@/components/Table';
+  import { searchFormSchema, tableColumns } from './data.config';
+  import ClassTree from '/@/views/educational/basicInformation/components/tree.vue';
+  import { computed, reactive } from 'vue';
+  import {
+    postBaseNewStudentReportExportQuery,
+    getBaseNewStudentReportPage,
+  } from '/@/services/apis/BaseNewStudentController';
+  import { Recordable } from 'vite-plugin-mock';
+  import { useModal } from '/@/components/Modal';
+  import FormEdit from './edit.vue';
+  import { useMessage } from '/@/hooks/web/useMessage';
+  import { formatToDate } from '/@/utils/dateUtil';
+  import { downloadByData } from '/@/utils/file/download';
+  import { useLoading } from '/@/components/Loading';
+  import { postStudentReportRecordUpdateStduyStatus } from '/@/services/apis/StudentReportRecordController';
+  import FormAdjust from './adjust.vue';
+
+  const searchInfo = reactive<Recordable>({});
+
+  const [registerModal, { openModal }] = useModal();
+  const [registerAdjustModal, { openModal: openAdjustModal }] = useModal();
+  const { createMessage, createConfirm } = useMessage();
+  const [openFullLoading, closeFullLoading] = useLoading({
+    tip: '处理中...',
+  });
+
+  const [registerTable, { reload, getSelectRowKeys, getForm, clearSelectedRowKeys }] = useTable({
+    api: getBaseNewStudentReportPage,
+    title: '学生列表',
+    rowKey: 'id',
+    columns: tableColumns,
+    formConfig: {
+      labelWidth: 120,
+      schemas: searchFormSchema,
+    },
+    useSearchForm: true,
+    showTableSetting: true,
+    bordered: true,
+    immediate: true,
+    canResize: true,
+    actionColumn: {
+      width: 200,
+      title: '操作',
+      dataIndex: 'action',
+      slots: { customRender: 'action' },
+      fixed: 'right',
+    },
+    rowSelection: {
+      type: 'checkbox',
+      getCheckboxProps: (record: Recordable) => ({
+        disabled: record.isReport === 1,
+      }),
+    },
+  });
+
+  const hasSelected = computed(() => getSelectRowKeys().length > 0);
+
+  function handleSelect(id) {
+    searchInfo.enrollmentPlanId = id;
+    reload();
+  }
+
+  const handleDelete = (record: any) => {
+    openModal(true, {
+      isUpdate: false,
+      baseData: [
+        {
+          ...record,
+        },
+      ],
+    });
+  };
+
+  const handleDeleteBatch = () => {
+    openModal(true, {
+      isUpdate: false,
+      baseData: {},
+    });
+  };
+
+  const handleSuccess = () => {
+    reload();
+  };
+  const handleExport = async () => {
+    const postData = getForm().getFieldsValue();
+    downloadByData(
+      (await postBaseNewStudentReportExportQuery({ ...postData, ...searchInfo })).data,
+      `新生列表${formatToDate(new Date())}.xlsx`,
+    );
+  };
+
+  const handleChangeReport = async () => {
+    try {
+      openFullLoading();
+      const keys: Recordable[] = [];
+      getSelectRowKeys().forEach((item) => {
+        keys.push({ id: item });
+      });
+      if (keys.length > 0) {
+        // await postStudentReportRecordAllSign(keys);
+        clearSelectedRowKeys();
+        await reload();
+      }
+    } finally {
+      closeFullLoading();
+    }
+  };
+
+  const handleChangeStduyStatus = (record: any) => {
+    createConfirm({
+      iconType: 'warning',
+      title: '温馨提醒',
+      content: '确认切换当前学生就读方式?',
+      onOk: async () => {
+        try {
+          await postStudentReportRecordUpdateStduyStatus({ id: record.id });
+          createMessage.success('切换成功');
+          await reload();
+        } catch (e) {
+          createMessage.error('切换失败');
+        }
+      },
+      okText: '确认',
+      cancelText: '取消',
+    });
+  };
+
+  const handleAjdust = (record: any) => {
+    openAdjustModal(true, {
+      isUpdate: false,
+      baseData: { ...record },
+    });
+  };
+</script>
+
+<template>
+  <PageWrapper dense contentFullHeight fixedHeight contentClass="flex">
+    <ClassTree class="w-1/3 xl:w-1/4" @select="handleSelect" />
+    <BasicTable class="w-2/3 xl:w-3/4" @register="registerTable" :searchInfo="searchInfo">
+      <template #toolbar>
+        <a-button type="primary" @click="handleDeleteBatch">报到日期设置</a-button>
+        <a-button type="primary" @click="handleChangeReport" :disabled="!hasSelected">
+          变更为已报到
+        </a-button>
+        <a-button type="primary" @click="handleExport">导出</a-button>
+      </template>
+      <template #action="{ record }">
+        <TableAction
+          :actions="[
+            {
+              label: '切换就读方式',
+              onClick: handleChangeStduyStatus.bind(null, record),
+              ifShow: record.className,
+            },
+            {
+              label: '非本班学生',
+              onClick: handleDelete.bind(null, record),
+              ifShow: record.className,
+            },
+            {
+              label: '调整班级',
+              onClick: handleAjdust.bind(null, record),
+              ifShow: !record.className,
+            },
+          ]"
+        />
+      </template>
+    </BasicTable>
+    <FormEdit @register="registerModal" @success="handleSuccess" />
+    <FormAdjust @register="registerAdjustModal" @success="handleSuccess" />
+  </PageWrapper>
+</template>
+
+<style scoped lang="less"></style>

+ 3 - 3
src/views/teachingManager/sending/data.config.ts

@@ -4,9 +4,9 @@ import { getDataOption } from '/@/api/system/dic';
 import { BasicOptionModel } from '/@/api/model/baseModel';
 
 export const distributeStatusList: BasicOptionModel[] = [
-  { label: '未发放', value: '1' },
-  { label: '全部领取', value: '3' },
-  { label: '部分领取', value: '2' },
+  { label: '未发放', value: 1},
+  { label: '全部领取', value: 3 },
+  { label: '部分领取', value: 2 },
 ];
 
 export const tableColumns: BasicColumn[] = [