Browse Source

feat:修改分班

DESKTOP-USV654P\pc 4 months ago
parent
commit
98e862872f

+ 13 - 1
src/views/educational/division/components/DsionStep2_1.vue

@@ -15,6 +15,14 @@
           style="margin: -5px 0; width: 100%"
         />
       </template>
+      <template #classType="{ record, column }">
+        <Select
+          v-model:value="record[column.dataIndex]"
+          :options="classTypeOptions"
+          :disabled="status === 1"
+          style="margin: -5px 0; width: 100%"
+        />
+      </template>
       <template #name="{ record, column }">
         <a-input
           v-model:value="record[column.dataIndex]"
@@ -98,6 +106,7 @@
   import { getMajorSetOption } from '/@/api/userMagic';
   import { requestMagicApi } from '/@/api/magicApi';
   import { Checkbox, Select } from 'ant-design-vue';
+  import { getDataOption } from '/@/api/system/dic';
 
   const [registerImportModal, { openModal: openImportModal }] = useModal();
 
@@ -167,7 +176,8 @@
       };
       data['isOrderClass'] = data['isOrderClass'] || data['isOrderClass'] === 1 ? 1 : 0;
       if (record._newRow) {
-        await postBandingBandingTaskClass([
+        delete data.id;
+        await putBandingBandingTaskClass([
           {
             ...data,
             bandingTaskId: props.taskId,
@@ -225,11 +235,13 @@
   const majorSetOptions = ref([]);
   const teacherOptions = ref([]);
   const classroomOptions = ref([]);
+  const classTypeOptions = ref([]);
 
   onMounted(async () => {
     majorSetOptions.value = await getMajorSetOption();
     teacherOptions.value = await requestMagicApi({ url: 'baseData/user/list?type=1' });
     classroomOptions.value = await requestMagicApi({ url: 'baseData/classroom/option' });
+    classTypeOptions.value = await getDataOption({ code: 'class_type' });
   });
 
   defineExpose({ validateStep, reloadStep });

+ 13 - 3
src/views/educational/division/components/DsionStep5.vue

@@ -2,19 +2,23 @@
   <div class="dsion-step5">
     <BasicTable @register="registerTable" :searchInfo="searchInfo">
       <template #toolbar>
-        <!-- <a-button type="primary" @click="handelConfirm">分班确认</a-button> -->
+        <a-button type="primary" @click="handelConfirm" :loading="loadingRef">分班确认</a-button>
       </template>
     </BasicTable>
   </div>
 </template>
 
 <script setup lang="ts">
-  import { reactive, watch } from 'vue';
+  import { reactive, ref, 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 emit = defineEmits(['success']);
+
+  const loadingRef = ref(false);
+
   const [registerTable, { reload }] = useTable({
     api: getBandingTaskClassClassSure,
     title: '班级列表',
@@ -53,7 +57,13 @@
   };
 
   const handelConfirm = async () => {
-    await postBandingTaskSure({ id: props.taskId });
+    try {
+      loadingRef.value = true;
+      await postBandingTaskSure({ id: props.taskId });
+      emit('success');
+    } finally {
+      loadingRef.value = false;
+    }
   };
 
   defineExpose({ validateStep, reloadStep });

+ 34 - 0
src/views/educational/division/data.config.ts

@@ -18,6 +18,20 @@ export const table2Columns: BasicColumn[] = [
       getPopupContainer: () => document.body,
     },
   },
+  {
+    title: '班级类型',
+    dataIndex: 'classType',
+    align: 'left',
+    width: 250,
+    editRow: true,
+    editRule: true,
+    editComponent: 'ApiSelect',
+    editComponentProps: {
+      api: getDataOption,
+      params: { code: 'class_type' },
+      getPopupContainer: () => document.body,
+    },
+  },
   {
     title: '班级名称',
     dataIndex: 'name',
@@ -291,6 +305,26 @@ export const searchForm4Schema: FormSchema[] = [
     },
     colProps: { span: 8 },
   },
+  {
+    label: '第一志愿',
+    field: 'firstAmbition',
+    colProps: { span: 8 },
+    component: 'ApiSelect',
+    componentProps: {
+      api: getMajorSetOption,
+      getPopupContainer: () => document.body,
+    },
+  },
+  {
+    label: '第二志愿',
+    field: 'secondAmbition',
+    colProps: { span: 8 },
+    component: 'ApiSelect',
+    componentProps: {
+      api: getMajorSetOption,
+      getPopupContainer: () => document.body,
+    },
+  },
 ];
 
 export const form4Schema: FormSchema[] = [

+ 3 - 2
src/views/educational/division/index.vue

@@ -44,6 +44,7 @@
           :taskId="taskId"
           :status="status"
           v-show="state.stepIndex === 5"
+          @success="handleSubmit"
         />
       </div>
       <div class="page-dsion-floor">
@@ -113,8 +114,8 @@
   });
 
   const handleSubmit = async () => {
-    await postBandingTaskSure({ id: props.taskId });
-    createMessage.success('分班成功');
+    // await postBandingTaskSure({ id: props.taskId });
+    // createMessage.success('分班成功');
     emits('success');
   };