Explorar o código

feat:新生分配

DESKTOP-USV654P\pc hai 4 meses
pai
achega
6189a1678b

+ 3 - 3
src/services/apis/BandingTaskClassController.ts

@@ -12,11 +12,11 @@ import { ErrorMessageMode } from '/#/axios';
 
 
             /** 新增新生分班 POST /banding/bandingTaskClass */
-export async function postBandingBandingTaskClass(params:API.AddBandingTaskClassDto
+export async function postBandingBandingTaskClass(params:API.AddBandingTaskClassDto[]
 ,mode: ErrorMessageMode = 'modal'){ return defHttp.post<any>
         ({url: '/banding/bandingTaskClass', data:params},{errorMessageMode:mode});}
-/** 修改新生分班 PUT /banding/bandingTaskClass */
-export async function putBandingBandingTaskClass(params:API.UpdateBandingClassDto
+/** 批量新增或者修改新生分班 PUT /banding/bandingTaskClass */
+export async function putBandingBandingTaskClass(params:API.UpdateBandingClassDto[]
 ,mode: ErrorMessageMode = 'modal'){ return defHttp.put<any>
         ({url: '/banding/bandingTaskClass', data:params},{errorMessageMode:mode});}
 /** 删除新生分班 DELETE /banding/bandingTaskClass */

+ 9 - 1
src/services/typing.d.ts

@@ -4453,7 +4453,7 @@ femaleCount?: number;
 /** 主键编号 */
 id?: string;
 /** 是否是订单班 */
-isOrdeClass?: number;
+isOrderClass?: number;
 /** 专业方向id */
 majorSetId?: string;
 /** 专业方向 */
@@ -4522,6 +4522,10 @@ sortCode?: number;
 }
 
 type BandingTaskPageVo = {
+/** 已录取人数 */
+admissionsCount?: number;
+/** 已分班人数 */
+dividedCount?: number;
 /** 招生类型 */
 enrollType?: string;
 /** 招生类型-中文 */
@@ -4534,6 +4538,8 @@ id?: string;
 /** 分班任务名称 */
 name?: string;
 sortCode?: number;
+/** 任务状态(0:未确认 1:已确认) */
+status?: number;
 }
 
 type BandingTaskRuleVo = {
@@ -6989,6 +6995,8 @@ status?: number;
 type ChangeClassDto = {
 /** 班级id */
 bandingTaskClassId?: string;
+/** 是否手动分班(1:是 0:否) */
+isHandle?: number;
 /** 学生ids */
 newStudentIds?: string[];
 }

+ 11 - 2
src/views/educational/banding/task/data.config.ts

@@ -23,16 +23,25 @@ export const tableColumns: BasicColumn[] = [
   },
   {
     title: '已录取人数',
-    dataIndex: 'ab',
+    dataIndex: 'admissionsCount',
     align: 'left',
     width: 100,
   },
   {
     title: '已分班人数',
-    dataIndex: 'abc',
+    dataIndex: 'dividedCount',
     align: 'left',
     width: 100,
   },
+  {
+    title: '状态',
+    dataIndex: 'status',
+    align: 'left',
+    width: 80,
+    customRender: ({ record }) => {
+      return record.status === 1 ? '已分班' : '未分班';
+    },
+  },
 ];
 
 export const searchFormSchema: FormSchema[] = [

+ 1 - 1
src/views/educational/banding/task/division.vue

@@ -10,7 +10,7 @@
     :showFooter="false"
     @close="handelClose"
   >
-    <FormDivision :taskId="modelRef?.id" @success="handelSuccess" />
+    <FormDivision :taskId="modelRef?.id" :status="modelRef?.status" @success="handelSuccess" />
   </BasicDrawer>
 </template>
 <script setup lang="ts">

+ 1 - 0
src/views/educational/division/components/DsionStep1.vue

@@ -25,6 +25,7 @@
 
   const props = defineProps({
     taskId: { type: String, default: '' },
+    status: { type: Number, default: 0 },
   });
 
   const state = reactive<{

+ 3 - 2
src/views/educational/division/components/DsionStep2.vue

@@ -2,8 +2,8 @@
   <div class="dsion-step2">
     <BasicTable @register="registerTable" :searchInfo="searchInfo">
       <template #toolbar>
-        <a-button type="primary" @click="handelImport">导入</a-button>
-        <a-button type="primary" @click="handelAdd">添加</a-button>
+        <a-button type="primary" @click="handelImport" :disabled="status === 1">导入</a-button>
+        <a-button type="primary" @click="handelAdd" :disabled="status === 1">添加</a-button>
       </template>
       <template #action="{ record }">
         <TableAction :actions="createActions(record)" />
@@ -63,6 +63,7 @@
 
   const props = defineProps({
     taskId: { type: String, default: '' },
+    status: { type: Number, default: 0 },
   });
 
   watch(

+ 44 - 18
src/views/educational/division/components/DsionStep2_1.vue

@@ -2,14 +2,16 @@
   <div class="dsion-step2">
     <BasicTable @register="registerTable" :searchInfo="searchInfo">
       <template #toolbar>
-        <a-button type="primary" @click="handelImport">导入</a-button>
-        <a-button type="primary" @click="handelAdd">添加</a-button>
+        <a-button type="primary" @click="handelImport" :disabled="status === 1">导入</a-button>
+        <a-button type="primary" @click="handelAdd" :disabled="status === 1">添加</a-button>
+        <a-button type="primary" @click="handelSave" :disabled="status === 1">保存</a-button>
       </template>
 
       <template #majorSetId="{ record, column }">
         <Select
           v-model:value="record[column.dataIndex]"
           :options="majorSetOptions"
+          :disabled="status === 1"
           style="margin: -5px 0; width: 100%"
         />
       </template>
@@ -17,6 +19,7 @@
         <a-input
           v-model:value="record[column.dataIndex]"
           placeholder="班级名称"
+          :disabled="status === 1"
           style="margin: -5px 0; width: 100%"
         />
       </template>
@@ -24,6 +27,7 @@
         <a-input-number
           v-model:value="record[column.dataIndex]"
           placeholder="班级人数"
+          :disabled="status === 1"
           style="margin: -5px 0; width: 100%"
         />
       </template>
@@ -31,6 +35,7 @@
         <Select
           v-model:value="record[column.dataIndex]"
           :options="teacherOptions"
+          :disabled="status === 1"
           style="margin: -5px 0; width: 100%"
         />
       </template>
@@ -38,16 +43,18 @@
         <Select
           v-model:value="record[column.dataIndex]"
           :options="classroomOptions"
+          :disabled="status === 1"
           style="margin: -5px 0; width: 100%"
         />
       </template>
       <template #isOrderClass="{ record, column }">
-        <Checkbox v-model:checked="record[column.dataIndex]" />
+        <Checkbox :disabled="status === 1" v-model:checked="record[column.dataIndex]" />
       </template>
       <template #sortCode="{ record, column }">
         <a-input-number
           v-model:value="record[column.dataIndex]"
           placeholder="排序"
+          :disabled="status === 1"
           style="margin: -5px 0; width: 100%"
         />
       </template>
@@ -56,11 +63,13 @@
           :actions="[
             {
               label: '保存',
+              disabled: status === 1,
               onClick: handleSave.bind(null, record),
             },
             {
               label: '删除',
               color: 'error',
+              disabled: status === 1,
               onClick: handleDelete.bind(null, record),
             },
           ]"
@@ -74,13 +83,7 @@
 
 <script setup lang="ts">
   import { reactive, ref, watch, onMounted } from 'vue';
-  import {
-    BasicTable,
-    useTable,
-    TableAction,
-    EditRecordRow,
-    ActionItem,
-  } from '/@/components/Table';
+  import { BasicTable, useTable, TableAction, EditRecordRow } from '/@/components/Table';
   import { table2Columns } from '../data.config';
   import { useMessage } from '/@/hooks/web/useMessage';
   import { buildUUID } from '/@/utils/uuid';
@@ -92,8 +95,6 @@
     postBandingBandingTaskClass,
     putBandingBandingTaskClass,
   } from '/@/services/apis/BandingTaskClassController';
-  import { cloneDeep } from 'lodash-es';
-  import ApiSelect from '/@/components/Form/src/components/ApiSelect.vue';
   import { getMajorSetOption } from '/@/api/userMagic';
   import { requestMagicApi } from '/@/api/magicApi';
   import { Checkbox, Select } from 'ant-design-vue';
@@ -131,6 +132,7 @@
 
   const props = defineProps({
     taskId: { type: String, default: '' },
+    status: { type: Number, default: 0 },
   });
 
   watch(
@@ -163,17 +165,19 @@
       const data = {
         ...record,
       };
-      data['isOrderClass'] = data['isOrderClass'] ? 1 : 0;
+      data['isOrderClass'] = data['isOrderClass'] || data['isOrderClass'] === 1 ? 1 : 0;
       if (record._newRow) {
-        await postBandingBandingTaskClass({
-          ...data,
-          bandingTaskId: props.taskId,
-        } as API.AddBandingTaskClassDto);
+        await postBandingBandingTaskClass([
+          {
+            ...data,
+            bandingTaskId: props.taskId,
+          },
+        ]);
       } else {
         const _dataSource = getDataSource();
         const editData = _dataSource.filter((row) => row.id === record.id)[0];
         Object.assign(editData, data);
-        await putBandingBandingTaskClass(editData as API.UpdateBandingTaskClassDto);
+        await putBandingBandingTaskClass([editData]);
       }
       reload();
     } else {
@@ -181,6 +185,28 @@
     }
   };
 
+  const handelSave = async () => {
+    const dataSource = getDataSource();
+    const postData: Recordable[] = [];
+    dataSource.forEach((item) => {
+      const dataItem = {
+        ...item,
+      };
+
+      dataItem['isOrderClass'] = dataItem['isOrderClass'] || dataItem['isOrderClass'] === 1 ? 1 : 0;
+      if (item._newRow) {
+        delete dataItem.id;
+        Object.assign(dataItem, { bandingTaskId: props.taskId });
+      }
+      postData.push(dataItem);
+    });
+    try {
+      await putBandingBandingTaskClass(postData);
+      createMessage.success('保存成功');
+      reload();
+    } catch {}
+  };
+
   const handelImport = () => {
     openImportModal(true, { baseData: { taskId: props.taskId } });
   };

+ 5 - 6
src/views/educational/division/components/DsionStep3.vue

@@ -2,9 +2,9 @@
   <div class="dsion-step3">
     <BasicTable @register="registerTable" :searchInfo="searchInfo">
       <template #toolbar>
-        <a-button type="primary" @click="handelConfirm">开始分班</a-button>
+        <a-button type="primary" @click="handelConfirm" :disabled="status === 1">开始分班</a-button>
         <!-- <a-button type="warning">撤回</a-button> -->
-        <a-button type="error" @click="handelReset">重置</a-button>
+        <a-button type="error" @click="handelReset" :disabled="status === 1">重置</a-button>
       </template>
       <template #satisfyCount="{ record, text }">
         <a-button type="link" @click="handelSatisfy(record)">{{ text }}</a-button>
@@ -51,6 +51,7 @@
 
   const props = defineProps({
     taskId: { type: String, default: '' },
+    status: { type: Number, default: 0 },
   });
 
   watch(
@@ -76,15 +77,13 @@
   };
 
   const handelSatisfy = (record: Recordable) => {
-    openSatisfyModal(true, { baseData: { ...record } });
+    openSatisfyModal(true, { baseData: { ...record }, status: props.status });
   };
   const handelSurplus = (record: Recordable) => {
-    openSurplusModal(true, { baseData: { ...record } });
+    openSurplusModal(true, { baseData: { ...record }, status: props.status });
   };
 
   const handelConfirm = async () => {
-    // const data = getDataSource();
-    // console.log('handelConfirm', data);
     await postBandingTaskAutomaticBanding({ bandingTaskId: props.taskId });
     reload();
   };

+ 2 - 1
src/views/educational/division/components/DsionStep4.vue

@@ -2,7 +2,7 @@
   <div class="dsion-step4">
     <BasicTable @register="registerTable" :searchInfo="searchInfo">
       <template #toolbar>
-        <a-button type="primary" @click="handelAjd">调整班级</a-button>
+        <a-button type="primary" @click="handelAjd" :disabled="status === 1">调整班级</a-button>
         <a-button type="primary" @click="handelExport">导出</a-button>
       </template>
     </BasicTable>
@@ -48,6 +48,7 @@
 
   const props = defineProps({
     taskId: { type: String, default: '' },
+    status: { type: Number, default: 0 },
   });
 
   watch(

+ 1 - 0
src/views/educational/division/components/DsionStep5.vue

@@ -32,6 +32,7 @@
 
   const props = defineProps({
     taskId: { type: String, default: '' },
+    status: { type: Number, default: 0 },
   });
 
   watch(

+ 6 - 3
src/views/educational/division/components/DsionStep6.vue

@@ -2,12 +2,13 @@
   <div class="dsion-step6">
     <BasicTable @register="registerTable" :searchInfo="searchInfo">
       <template #toolbar>
-        <a-button type="primary" @click="handelSave">保存</a-button>
+        <a-button type="primary" @click="handelSave" :disabled="status === 1">保存</a-button>
       </template>
       <template #height="{ record, column }">
         <a-input-number
           v-model:value="record[column.dataIndex]"
           placeholder="请设置限制条件"
+          :disabled="status === 1"
           style="margin: -5px 0; width: 100%"
         />
       </template>
@@ -15,6 +16,7 @@
         <a-input-number
           v-model:value="record[column.dataIndex]"
           placeholder="请设置限制条件"
+          :disabled="status === 1"
           style="margin: -5px 0; width: 100%"
         />
       </template>
@@ -33,9 +35,8 @@
   } from '/@/services/apis/BandingTaskMajorConditionController';
   import { useMessage } from '/@/hooks/web/useMessage';
   import { useLoading } from '/@/components/Loading';
-  import { PageWrapper } from '/@/components/Page';
 
-  const [registerTable, { reload, getDataSource }] = useTable({
+  const [registerTable, { reload, getDataSource, redoHeight }] = useTable({
     api: getBandingTaskMajorConditionList,
     title: '专业限制条件设置',
     rowKey: 'id',
@@ -55,6 +56,7 @@
   });
   const props = defineProps({
     taskId: { type: String, default: '' },
+    status: { type: Number, default: 0 },
   });
 
   watch(
@@ -95,6 +97,7 @@
 
   const reloadStep = () => {
     reload();
+    redoHeight();
   };
 
   defineExpose({ validateStep, reloadStep });

+ 3 - 0
src/views/educational/division/components/satisfy.vue

@@ -11,6 +11,7 @@
   import { tableSatisfyColumns } from '../data.config';
 
   const modelRef = ref<Recordable>({});
+  const status = ref<Number>(0);
 
   const emit = defineEmits(['success', 'register']);
   const searchInfo = reactive<Recordable>({});
@@ -39,6 +40,7 @@
     setModalProps({ confirmLoading: false });
     modelRef.value = { ...data.baseData };
     searchInfo.bandingTaskClassId = data.baseData.id;
+    status.value = data.status;
     reload();
   });
 
@@ -73,6 +75,7 @@
             :actions="[
               {
                 label: '移出',
+                disabled: status === 1,
                 onClick: handleDelete.bind(null, record),
               },
             ]"

+ 3 - 0
src/views/educational/division/components/surplus.vue

@@ -11,6 +11,7 @@
   import { tableSatisfyColumns } from '../data.config';
 
   const modelRef = ref<Recordable>({});
+  const status = ref<Number>(0);
 
   const emit = defineEmits(['success', 'register']);
   const searchInfo = reactive<Recordable>({});
@@ -39,6 +40,7 @@
     setModalProps({ confirmLoading: false });
     modelRef.value = { ...data.baseData };
     searchInfo.bandingTaskClassId = data.baseData.id;
+    status.value = data.status;
     reload();
   });
 
@@ -73,6 +75,7 @@
             :actions="[
               {
                 label: '移入',
+                disabled: status === 1,
                 onClick: handleDelete.bind(null, record),
               },
             ]"

+ 5 - 1
src/views/educational/division/data.config.ts

@@ -216,6 +216,7 @@ export const table4Columns: BasicColumn[] = [
     dataIndex: 'score',
     align: 'left',
     width: 80,
+    sorter: true,
   },
   {
     title: '班级名称',
@@ -337,9 +338,12 @@ export const table5Columns: BasicColumn[] = [
   },
   {
     title: '是否订单班',
-    dataIndex: 'isOrdeClass',
+    dataIndex: 'isOrderClass',
     align: 'left',
     width: 120,
+    customRender: ({ record }) => {
+      return record.isOrderClass === 1 ? '是' : '否';
+    },
   },
   {
     title: '班级人数',

+ 39 - 7
src/views/educational/division/index.vue

@@ -9,12 +9,42 @@
         </Steps>
       </div>
       <div class="page-dsion-body">
-        <DsionStep1 ref="dsionStep1Ref" :taskId="taskId" v-show="state.stepIndex === 0" />
-        <DsionStep6 ref="dsionStep6Ref" :taskId="taskId" v-show="state.stepIndex === 1" />
-        <DsionStep2 ref="dsionStep2Ref" :taskId="taskId" v-show="state.stepIndex === 2" />
-        <DsionStep3 ref="dsionStep3Ref" :taskId="taskId" v-show="state.stepIndex === 3" />
-        <DsionStep4 ref="dsionStep4Ref" :taskId="taskId" v-show="state.stepIndex === 4" />
-        <DsionStep5 ref="dsionStep5Ref" :taskId="taskId" v-show="state.stepIndex === 5" />
+        <DsionStep1
+          ref="dsionStep1Ref"
+          :taskId="taskId"
+          :status="status"
+          v-show="state.stepIndex === 0"
+        />
+        <DsionStep6
+          ref="dsionStep6Ref"
+          :taskId="taskId"
+          :status="status"
+          v-show="state.stepIndex === 1"
+        />
+        <DsionStep2
+          ref="dsionStep2Ref"
+          :taskId="taskId"
+          :status="status"
+          v-show="state.stepIndex === 2"
+        />
+        <DsionStep3
+          ref="dsionStep3Ref"
+          :taskId="taskId"
+          :status="status"
+          v-show="state.stepIndex === 3"
+        />
+        <DsionStep4
+          ref="dsionStep4Ref"
+          :taskId="taskId"
+          :status="status"
+          v-show="state.stepIndex === 4"
+        />
+        <DsionStep5
+          ref="dsionStep5Ref"
+          :taskId="taskId"
+          :status="status"
+          v-show="state.stepIndex === 5"
+        />
       </div>
       <div class="page-dsion-floor">
         <a-button v-show="state.stepIndex !== 0" @click="handleStep(0)" class="ml-[24px]">
@@ -32,6 +62,7 @@
           v-show="state.stepIndex === 5"
           type="primary"
           class="ml-[24px]"
+          :disabled="status === 1"
           @click="handleSubmit"
         >
           分班确认
@@ -56,6 +87,7 @@
 
   const props = defineProps({
     taskId: { type: String, default: '' },
+    status: { type: Number, default: 0 },
   });
 
   const emits = defineEmits(['success']);
@@ -137,7 +169,7 @@
       height: calc(100% - 80px - 60px);
       // display: flex;
       position: relative;
-      display: inline-block;
+      // display: inline-block;
       overflow: auto;
     }