Browse Source

feat:修改分班

DESKTOP-USV654P\pc 8 months ago
parent
commit
79f14f7d7a

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

@@ -10,7 +10,7 @@
     :showFooter="false"
     @close="handelClose"
   >
-    <FormDivision :taskId="modelRef?.id" />
+    <FormDivision :taskId="modelRef?.id" @success="handelSuccess" />
   </BasicDrawer>
 </template>
 <script setup lang="ts">
@@ -38,6 +38,10 @@
     }
   };
 
+  const handelSuccess = () => {
+    emit('success');
+  };
+
   const handelClose = () => {
     modelRef.value = {};
   };

+ 9 - 2
src/views/educational/division/components/DsionStep5.vue

@@ -2,7 +2,7 @@
   <div class="dsion-step5">
     <BasicTable @register="registerTable">
       <template #toolbar>
-        <a-button type="primary">分班确认</a-button>
+        <!-- <a-button type="primary" @click="handelConfirm">分班确认</a-button> -->
       </template>
     </BasicTable>
   </div>
@@ -12,9 +12,11 @@
   import { reactive, watch } from 'vue';
   import { BasicTable, useTable } from '/@/components/Table';
   import { table5Columns } from '../data.config';
+  import { getBandingTaskClassClassSure } from '/@/services/apis/BandingTaskClassController';
+  import { postBandingTaskSure } from '/@/services/apis/BandingTaskController';
 
   const [registerTable, { reload }] = useTable({
-    // api: getEvaluateTemplatePage,
+    api: getBandingTaskClassClassSure,
     title: '班级列表',
     rowKey: 'id',
     useSearchForm: false,
@@ -48,6 +50,11 @@
   const reloadStep = () => {
     reload();
   };
+
+  const handelConfirm = async () => {
+    await postBandingTaskSure({ id: props.taskId });
+  };
+
   defineExpose({ validateStep, reloadStep });
 </script>
 

+ 22 - 7
src/views/educational/division/components/DsionStep6.vue

@@ -1,6 +1,9 @@
 <template>
-  <div class="dsion-step3">
+  <div class="dsion-step6">
     <BasicTable @register="registerTable" :searchInfo="searchInfo">
+      <template #toolbar>
+        <a-button type="primary" @click="handelSave">保存</a-button>
+      </template>
       <template #height="{ record, column }">
         <a-input-number
           v-model:value="record[column.dataIndex]"
@@ -28,6 +31,9 @@
     getBandingTaskMajorConditionList,
     postBandingTaskMajorConditionSave,
   } 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({
     api: getBandingTaskMajorConditionList,
@@ -43,7 +49,10 @@
   });
 
   const searchInfo = reactive<Recordable>({});
-
+  const { createMessage } = useMessage();
+  const [openFullLoading, closeFullLoading] = useLoading({
+    tip: '处理中...',
+  });
   const props = defineProps({
     taskId: { type: String, default: '' },
   });
@@ -53,13 +62,17 @@
     async (newVal) => {
       if (newVal) {
         searchInfo.bandingTaskId = newVal;
-        reload();
       }
     },
   );
 
   const validateStep = async () => {
+    return true;
+  };
+
+  const handelSave = async () => {
     try {
+      openFullLoading();
       const dataSource = getDataSource();
 
       const list: Recordable[] = [];
@@ -72,10 +85,11 @@
       });
 
       await postBandingTaskMajorConditionSave({ bandingTaskId: props.taskId, conditionList: list });
-
-      return true;
+      createMessage.success('保存成功');
     } catch {
-      return false;
+      createMessage.success('保存失败');
+    } finally {
+      closeFullLoading();
     }
   };
 
@@ -87,7 +101,8 @@
 </script>
 
 <style lang="less" scoped>
-  .dsion-step3 {
+  .dsion-step6 {
     margin: 16px 0;
+    position: relative;
   }
 </style>

+ 21 - 3
src/views/educational/division/components/adjust.vue

@@ -8,7 +8,16 @@
     :title="getTitle"
     :width="1002"
   >
-    <BasicForm @register="registerForm" />
+    <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">
@@ -21,7 +30,7 @@
   import { postBandingTaskClassChangeClass } from '/@/services/apis/BandingTaskClassController';
 
   const isUpdate = ref(true);
-  const modelRef = ref({});
+  const modelRef = ref<Recordable[]>([]);
   const emit = defineEmits(['success', 'register']);
   const { createMessage } = useMessage();
   const [registerForm, { validate, resetFields }] = useForm({
@@ -42,7 +51,16 @@
     try {
       const values = await validate();
       setModalProps({ confirmLoading: true });
-      const postParams = unref(modelRef);
+
+      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);

+ 1 - 1
src/views/educational/division/components/surplus.vue

@@ -71,7 +71,7 @@
           <TableAction
             :actions="[
               {
-                label: '移',
+                label: '移',
                 onClick: handleDelete.bind(null, record),
               },
             ]"

+ 17 - 17
src/views/educational/division/data.config.ts

@@ -165,37 +165,37 @@ export const table4Columns: BasicColumn[] = [
   },
   {
     title: '性别',
-    dataIndex: 'gend',
+    dataIndex: 'genderCn',
     align: 'left',
     width: 80,
   },
   {
     title: '毕业学校',
-    dataIndex: 'schoolName',
+    dataIndex: 'graduateSchool',
     align: 'left',
     width: 180,
   },
   {
     title: '毕业班级',
-    dataIndex: 'className',
+    dataIndex: 'graduateClass',
     align: 'left',
     width: 120,
   },
   {
     title: '住宿类型',
-    dataIndex: 'stateType',
+    dataIndex: 'stduyStatusCn',
     align: 'left',
     width: 100,
   },
   {
     title: '身高',
-    dataIndex: 'hi',
+    dataIndex: 'height',
     align: 'left',
     width: 80,
   },
   {
     title: '体重',
-    dataIndex: 'wg',
+    dataIndex: 'weight',
     align: 'left',
     width: 80,
   },
@@ -207,7 +207,7 @@ export const table4Columns: BasicColumn[] = [
   },
   {
     title: '班级名称',
-    dataIndex: 'cName',
+    dataIndex: 'className',
     align: 'left',
     width: 120,
   },
@@ -280,13 +280,13 @@ export const searchForm4Schema: FormSchema[] = [
   },
 ];
 
-
 export const form4Schema: FormSchema[] = [
   {
     field: 'studentIds',
     label: '调整学生',
     component: 'Input',
     colProps: { span: 24 },
+    slot: 'studentIds',
   },
   {
     field: 'bandingTaskClassId',
@@ -299,7 +299,7 @@ export const form4Schema: FormSchema[] = [
 export const table5Columns: BasicColumn[] = [
   {
     title: '专业方向',
-    dataIndex: 'studentId',
+    dataIndex: 'majorSetName',
     align: 'left',
   },
   {
@@ -310,49 +310,49 @@ export const table5Columns: BasicColumn[] = [
   },
   {
     title: '班主任',
-    dataIndex: 'gend',
+    dataIndex: 'teacherName',
     align: 'left',
     width: 80,
   },
   {
     title: '固定教室',
-    dataIndex: 'schoolName',
+    dataIndex: 'classroomName',
     align: 'left',
     width: 180,
   },
   {
     title: '是否订单班',
-    dataIndex: 'className',
+    dataIndex: 'isOrdeClass',
     align: 'left',
     width: 120,
   },
   {
     title: '班级人数',
-    dataIndex: 'stateType',
+    dataIndex: 'number',
     align: 'left',
     width: 100,
   },
   {
     title: '男生人数',
-    dataIndex: 'hi',
+    dataIndex: 'maleCount',
     align: 'left',
     width: 80,
   },
   {
     title: '女生人数',
-    dataIndex: 'wg',
+    dataIndex: 'femaleCount',
     align: 'left',
     width: 80,
   },
   {
     title: '住校人数',
-    dataIndex: 'score',
+    dataIndex: 'stayCount',
     align: 'left',
     width: 120,
   },
   {
     title: '走读人数',
-    dataIndex: 'cName',
+    dataIndex: 'notStayCount',
     align: 'left',
     width: 120,
   },

+ 17 - 4
src/views/educational/division/index.vue

@@ -34,7 +34,7 @@
           class="ml-[24px]"
           @click="handleSubmit"
         >
-          提交
+          分班确认
         </a-button>
       </div>
     </div>
@@ -51,11 +51,16 @@
   import DsionStep4 from './components/DsionStep4.vue';
   import DsionStep5 from './components/DsionStep5.vue';
   import DsionStep6 from './components/DsionStep6.vue';
+  import { postBandingTaskSure } from '/@/services/apis/BandingTaskController';
+  import { useMessage } from '/@/hooks/web/useMessage';
 
-  defineProps({
+  const props = defineProps({
     taskId: { type: String, default: '' },
   });
 
+  const emits = defineEmits(['success']);
+  const { createMessage } = useMessage();
+
   const dsionStep1Ref = ref<ElRef>(null);
   const dsionStep2Ref = ref<ElRef>(null);
   const dsionStep3Ref = ref<ElRef>(null);
@@ -74,7 +79,11 @@
     ],
   });
 
-  const handleSubmit = () => {};
+  const handleSubmit = async () => {
+    await postBandingTaskSure({ id: props.taskId });
+    createMessage.success('分班成功');
+    emits('success');
+  };
 
   const handleStep = async (type) => {
     if (type == 1) {
@@ -112,6 +121,7 @@
   .page-dsion {
     width: 100%;
     height: 100%;
+    position: relative;
 
     &-header {
       margin: 0 auto;
@@ -122,7 +132,10 @@
 
     &-body {
       height: calc(100% - 80px - 60px);
-      display: flex;
+      // display: flex;
+      position: relative;
+      display: inline-block;
+      overflow: auto;
     }
 
     &-floor {